@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\exceptions\UnexpectedEntityException; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -24,97 +24,97 @@ discard block |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param \EE_Event $event |
|
29 | - * @param \EE_Transaction $transaction |
|
30 | - * @param \EE_Ticket $ticket |
|
31 | - * @param \EE_Line_Item $ticket_line_item |
|
32 | - * @param $reg_count |
|
33 | - * @param $reg_group_size |
|
34 | - * @return \EE_Registration |
|
35 | - * @throws \EE_Error |
|
36 | - * @throws UnexpectedEntityException |
|
37 | - */ |
|
38 | - public function create( |
|
39 | - \EE_Event $event, |
|
40 | - \EE_Transaction $transaction, |
|
41 | - \EE_Ticket $ticket, |
|
42 | - \EE_Line_Item $ticket_line_item, |
|
43 | - $reg_count, |
|
44 | - $reg_group_size |
|
45 | - ) { |
|
46 | - $registrations = $transaction->registrations(); |
|
47 | - $reg_count = $reg_count ? $reg_count : count($registrations) + 1; |
|
48 | - $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item); |
|
49 | - $reg_code = new RegCode($reg_url_link, $transaction, $ticket); |
|
50 | - // generate new EE_Registration |
|
51 | - $registration = \EE_Registration::new_instance( |
|
52 | - array( |
|
53 | - 'EVT_ID' => $event->ID(), |
|
54 | - 'TXN_ID' => $transaction->ID(), |
|
55 | - 'TKT_ID' => $ticket->ID(), |
|
56 | - 'STS_ID' => \EEM_Registration::status_id_incomplete, |
|
57 | - 'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item), |
|
58 | - 'REG_session' => \EE_Registry::instance()->SSN->id(), |
|
59 | - 'REG_count' => $reg_count, |
|
60 | - 'REG_group_size' => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations), |
|
61 | - 'REG_url_link' => $reg_url_link, |
|
62 | - 'REG_code' => $reg_code, |
|
63 | - ) |
|
64 | - ); |
|
65 | - if ( ! $registration instanceof \EE_Registration) { |
|
66 | - throw new UnexpectedEntityException($registration, 'EE_Registration'); |
|
67 | - } |
|
68 | - $registration->save(); |
|
69 | - $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
70 | - $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID()); |
|
71 | - $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID()); |
|
72 | - $registration->save(); |
|
73 | - return $registration; |
|
74 | - } |
|
27 | + /** |
|
28 | + * @param \EE_Event $event |
|
29 | + * @param \EE_Transaction $transaction |
|
30 | + * @param \EE_Ticket $ticket |
|
31 | + * @param \EE_Line_Item $ticket_line_item |
|
32 | + * @param $reg_count |
|
33 | + * @param $reg_group_size |
|
34 | + * @return \EE_Registration |
|
35 | + * @throws \EE_Error |
|
36 | + * @throws UnexpectedEntityException |
|
37 | + */ |
|
38 | + public function create( |
|
39 | + \EE_Event $event, |
|
40 | + \EE_Transaction $transaction, |
|
41 | + \EE_Ticket $ticket, |
|
42 | + \EE_Line_Item $ticket_line_item, |
|
43 | + $reg_count, |
|
44 | + $reg_group_size |
|
45 | + ) { |
|
46 | + $registrations = $transaction->registrations(); |
|
47 | + $reg_count = $reg_count ? $reg_count : count($registrations) + 1; |
|
48 | + $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item); |
|
49 | + $reg_code = new RegCode($reg_url_link, $transaction, $ticket); |
|
50 | + // generate new EE_Registration |
|
51 | + $registration = \EE_Registration::new_instance( |
|
52 | + array( |
|
53 | + 'EVT_ID' => $event->ID(), |
|
54 | + 'TXN_ID' => $transaction->ID(), |
|
55 | + 'TKT_ID' => $ticket->ID(), |
|
56 | + 'STS_ID' => \EEM_Registration::status_id_incomplete, |
|
57 | + 'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item), |
|
58 | + 'REG_session' => \EE_Registry::instance()->SSN->id(), |
|
59 | + 'REG_count' => $reg_count, |
|
60 | + 'REG_group_size' => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations), |
|
61 | + 'REG_url_link' => $reg_url_link, |
|
62 | + 'REG_code' => $reg_code, |
|
63 | + ) |
|
64 | + ); |
|
65 | + if ( ! $registration instanceof \EE_Registration) { |
|
66 | + throw new UnexpectedEntityException($registration, 'EE_Registration'); |
|
67 | + } |
|
68 | + $registration->save(); |
|
69 | + $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
70 | + $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID()); |
|
71 | + $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID()); |
|
72 | + $registration->save(); |
|
73 | + return $registration; |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @param \EE_Transaction $transaction |
|
80 | - * @param \EE_Ticket $ticket |
|
81 | - * @param \EE_Line_Item $ticket_line_item |
|
82 | - * @return float |
|
83 | - */ |
|
84 | - protected function resolveFinalPrice( |
|
85 | - \EE_Transaction $transaction, |
|
86 | - \EE_Ticket $ticket, |
|
87 | - \EE_Line_Item $ticket_line_item |
|
88 | - ) { |
|
89 | - $final_price = \EEH_Line_Item::calculate_final_price_for_ticket_line_item( |
|
90 | - $transaction->total_line_item(), |
|
91 | - $ticket_line_item |
|
92 | - ); |
|
93 | - $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes(); |
|
94 | - return (float)$final_price; |
|
95 | - } |
|
78 | + /** |
|
79 | + * @param \EE_Transaction $transaction |
|
80 | + * @param \EE_Ticket $ticket |
|
81 | + * @param \EE_Line_Item $ticket_line_item |
|
82 | + * @return float |
|
83 | + */ |
|
84 | + protected function resolveFinalPrice( |
|
85 | + \EE_Transaction $transaction, |
|
86 | + \EE_Ticket $ticket, |
|
87 | + \EE_Line_Item $ticket_line_item |
|
88 | + ) { |
|
89 | + $final_price = \EEH_Line_Item::calculate_final_price_for_ticket_line_item( |
|
90 | + $transaction->total_line_item(), |
|
91 | + $ticket_line_item |
|
92 | + ); |
|
93 | + $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes(); |
|
94 | + return (float)$final_price; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | - /** |
|
100 | - * @param \EE_Registration[] $registrations |
|
101 | - * @param boolean $update_existing_registrations |
|
102 | - * @return int |
|
103 | - * @throws \EE_Error |
|
104 | - */ |
|
105 | - protected function incrementRegCount(array $registrations, $update_existing_registrations = true) |
|
106 | - { |
|
107 | - $new_reg_count = count($registrations) + 1; |
|
108 | - if ($update_existing_registrations) { |
|
109 | - foreach ($registrations as $registration) { |
|
110 | - if ($registration instanceof \EE_Registration) { |
|
111 | - $registration->set_count($new_reg_count); |
|
112 | - $registration->save(); |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
116 | - return $new_reg_count; |
|
117 | - } |
|
99 | + /** |
|
100 | + * @param \EE_Registration[] $registrations |
|
101 | + * @param boolean $update_existing_registrations |
|
102 | + * @return int |
|
103 | + * @throws \EE_Error |
|
104 | + */ |
|
105 | + protected function incrementRegCount(array $registrations, $update_existing_registrations = true) |
|
106 | + { |
|
107 | + $new_reg_count = count($registrations) + 1; |
|
108 | + if ($update_existing_registrations) { |
|
109 | + foreach ($registrations as $registration) { |
|
110 | + if ($registration instanceof \EE_Registration) { |
|
111 | + $registration->set_count($new_reg_count); |
|
112 | + $registration->save(); |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | + return $new_reg_count; |
|
117 | + } |
|
118 | 118 | |
119 | 119 | |
120 | 120 | } |
@@ -822,12 +822,12 @@ discard block |
||
822 | 822 | if ( $registration instanceof EE_Registration ) { |
823 | 823 | // we display all attendee info for the primary registrant |
824 | 824 | if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
825 | - && $registration->is_primary_registrant() |
|
825 | + && $registration->is_primary_registrant() |
|
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | 829 | } else if ( $this->checkout->revisit |
830 | - && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
830 | + && $this->checkout->reg_url_link !== $registration->reg_url_link() |
|
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | 833 | $transaction->clear_cache( 'Registration', $registration->ID() ); |
@@ -859,23 +859,23 @@ discard block |
||
859 | 859 | //do the following for each ticket of this type they selected |
860 | 860 | for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
861 | 861 | $att_nmbr++; |
862 | - /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
863 | - $CreateRegistrationCommand = EE_Registry::instance() |
|
864 | - ->create( |
|
865 | - 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
866 | - array( |
|
867 | - $transaction, |
|
868 | - $line_item, |
|
869 | - $att_nmbr, |
|
870 | - $this->checkout->total_ticket_count |
|
871 | - ) |
|
872 | - ); |
|
873 | - // override capabilities for frontend registrations |
|
874 | - if ( ! is_admin()) { |
|
875 | - $CreateRegistrationCommand->setCapCheck( |
|
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
877 | - ); |
|
878 | - } |
|
862 | + /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
|
863 | + $CreateRegistrationCommand = EE_Registry::instance() |
|
864 | + ->create( |
|
865 | + 'EventEspresso\core\services\commands\registration\CreateRegistrationCommand', |
|
866 | + array( |
|
867 | + $transaction, |
|
868 | + $line_item, |
|
869 | + $att_nmbr, |
|
870 | + $this->checkout->total_ticket_count |
|
871 | + ) |
|
872 | + ); |
|
873 | + // override capabilities for frontend registrations |
|
874 | + if ( ! is_admin()) { |
|
875 | + $CreateRegistrationCommand->setCapCheck( |
|
876 | + new PublicCapabilities( '', 'create_new_registration' ) |
|
877 | + ); |
|
878 | + } |
|
879 | 879 | $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
880 | 880 | if ( ! $registration instanceof EE_Registration ) { |
881 | 881 | throw new InvalidEntityException( $registration, 'EE_Registration' ); |
@@ -1,7 +1,7 @@ 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')) {exit('No direct script access allowed');} |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
5 | 5 | /** |
6 | 6 | * Single Page Checkout (SPCO) |
7 | 7 | * |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @return EED_Single_Page_Checkout |
51 | 51 | */ |
52 | 52 | public static function instance() { |
53 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
54 | - return parent::get_instance( __CLASS__ ); |
|
53 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
54 | + return parent::get_instance(__CLASS__); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -96,22 +96,22 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function set_hooks_admin() { |
98 | 98 | EED_Single_Page_Checkout::set_definitions(); |
99 | - if ( defined( 'DOING_AJAX' )) { |
|
99 | + if (defined('DOING_AJAX')) { |
|
100 | 100 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
101 | 101 | ob_start(); |
102 | 102 | EED_Single_Page_Checkout::load_request_handler(); |
103 | 103 | EED_Single_Page_Checkout::load_reg_steps(); |
104 | 104 | } else { |
105 | 105 | // 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 |
106 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
106 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
107 | 107 | } |
108 | 108 | // set ajax hooks |
109 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
110 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
111 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
112 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
113 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
114 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
109 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
110 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
111 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
112 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
113 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
114 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param string $ajax_action |
123 | 123 | * @throws \EE_Error |
124 | 124 | */ |
125 | - public static function process_ajax_request( $ajax_action ) { |
|
126 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
125 | + public static function process_ajax_request($ajax_action) { |
|
126 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
127 | 127 | EED_Single_Page_Checkout::instance()->_initialize(); |
128 | 128 | } |
129 | 129 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @throws \EE_Error |
136 | 136 | */ |
137 | 137 | public static function display_reg_step() { |
138 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
138 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @throws \EE_Error |
147 | 147 | */ |
148 | 148 | public static function process_reg_step() { |
149 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
149 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @throws \EE_Error |
158 | 158 | */ |
159 | 159 | public static function update_reg_step() { |
160 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
160 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @throws \EE_Error |
171 | 171 | */ |
172 | 172 | public static function update_checkout() { |
173 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
173 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public static function load_request_handler() { |
185 | 185 | // load core Request_Handler class |
186 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
187 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
186 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
187 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * @throws \EE_Error |
199 | 199 | */ |
200 | 200 | public static function set_definitions() { |
201 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
202 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
203 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
204 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
205 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
206 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
207 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
208 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
201 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
202 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
203 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
204 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
205 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
206 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
207 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
208 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function load_reg_steps() { |
222 | 222 | static $reg_steps_loaded = FALSE; |
223 | - if ( $reg_steps_loaded ) { |
|
223 | + if ($reg_steps_loaded) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | // filter list of reg_steps |
@@ -229,24 +229,24 @@ discard block |
||
229 | 229 | EED_Single_Page_Checkout::get_reg_steps() |
230 | 230 | ); |
231 | 231 | // sort by key (order) |
232 | - ksort( $reg_steps_to_load ); |
|
232 | + ksort($reg_steps_to_load); |
|
233 | 233 | // loop through folders |
234 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
234 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
235 | 235 | // we need a |
236 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
236 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
237 | 237 | // copy over to the reg_steps_array |
238 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
238 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
239 | 239 | // register custom key route for each reg step |
240 | 240 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
241 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
241 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
242 | 242 | // add AJAX or other hooks |
243 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
243 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
244 | 244 | // setup autoloaders if necessary |
245 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
246 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
245 | + if ( ! class_exists($reg_step['class_name'])) { |
|
246 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
247 | 247 | } |
248 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
249 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
248 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
249 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | } |
@@ -265,28 +265,28 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public static function get_reg_steps() { |
267 | 267 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
268 | - if ( empty( $reg_steps )) { |
|
268 | + if (empty($reg_steps)) { |
|
269 | 269 | $reg_steps = array( |
270 | 270 | 10 => array( |
271 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
271 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
272 | 272 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
273 | 273 | 'slug' => 'attendee_information', |
274 | 274 | 'has_hooks' => FALSE |
275 | 275 | ), |
276 | 276 | 20 => array( |
277 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
277 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
278 | 278 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
279 | 279 | 'slug' => 'registration_confirmation', |
280 | 280 | 'has_hooks' => FALSE |
281 | 281 | ), |
282 | 282 | 30 => array( |
283 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
283 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
284 | 284 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
285 | 285 | 'slug' => 'payment_options', |
286 | 286 | 'has_hooks' => TRUE |
287 | 287 | ), |
288 | 288 | 999 => array( |
289 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
289 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
290 | 290 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
291 | 291 | 'slug' => 'finalize_registration', |
292 | 292 | 'has_hooks' => FALSE |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | */ |
308 | 308 | public static function registration_checkout_for_admin() { |
309 | 309 | EED_Single_Page_Checkout::load_reg_steps(); |
310 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
311 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
312 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
310 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
311 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
312 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
313 | 313 | EED_Single_Page_Checkout::instance()->_initialize(); |
314 | 314 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
315 | 315 | return EE_Registry::instance()->REQ->get_output(); |
@@ -326,15 +326,15 @@ discard block |
||
326 | 326 | */ |
327 | 327 | public static function process_registration_from_admin() { |
328 | 328 | EED_Single_Page_Checkout::load_reg_steps(); |
329 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
330 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
331 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
329 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
330 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
331 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
332 | 332 | EED_Single_Page_Checkout::instance()->_initialize(); |
333 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
334 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
335 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
336 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
337 | - if ( $final_reg_step->process_reg_step() ) { |
|
333 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
334 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
335 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
336 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
337 | + if ($final_reg_step->process_reg_step()) { |
|
338 | 338 | $final_reg_step->set_completed(); |
339 | 339 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
340 | 340 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -354,11 +354,11 @@ discard block |
||
354 | 354 | * @return void |
355 | 355 | * @throws \EE_Error |
356 | 356 | */ |
357 | - public function run( $WP_Query ) { |
|
357 | + public function run($WP_Query) { |
|
358 | 358 | if ( |
359 | 359 | $WP_Query instanceof WP_Query |
360 | 360 | && $WP_Query->is_main_query() |
361 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
361 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
362 | 362 | ) { |
363 | 363 | $this->_initialize(); |
364 | 364 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return void |
375 | 375 | * @throws \EE_Error |
376 | 376 | */ |
377 | - public static function init( $WP_Query ) { |
|
378 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
377 | + public static function init($WP_Query) { |
|
378 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | |
@@ -389,34 +389,34 @@ discard block |
||
389 | 389 | */ |
390 | 390 | private function _initialize() { |
391 | 391 | // ensure SPCO doesn't run twice |
392 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
392 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | try { |
396 | 396 | // setup the EE_Checkout object |
397 | 397 | $this->checkout = $this->_initialize_checkout(); |
398 | 398 | // filter checkout |
399 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
399 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
400 | 400 | // get the $_GET |
401 | 401 | $this->_get_request_vars(); |
402 | 402 | // filter continue_reg |
403 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
403 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
404 | 404 | // load the reg steps array |
405 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
405 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
409 | 409 | // set the current step |
410 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
410 | + $this->checkout->set_current_step($this->checkout->step); |
|
411 | 411 | // and the next step |
412 | 412 | $this->checkout->set_next_step(); |
413 | 413 | // was there already a valid transaction in the checkout from the session ? |
414 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
414 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
415 | 415 | // get transaction from db or session |
416 | 416 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
417 | 417 | ? $this->_get_transaction_and_cart_for_previous_visit() |
418 | 418 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
419 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
419 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
420 | 420 | // add some style and make it dance |
421 | 421 | $this->checkout->transaction = EE_Transaction::new_instance(); |
422 | 422 | $this->add_styles_and_scripts(); |
@@ -424,10 +424,10 @@ discard block |
||
424 | 424 | return; |
425 | 425 | } |
426 | 426 | // and the registrations for the transaction |
427 | - $this->_get_registrations( $this->checkout->transaction ); |
|
427 | + $this->_get_registrations($this->checkout->transaction); |
|
428 | 428 | } |
429 | 429 | // verify that everything has been setup correctly |
430 | - if ( ! $this->_final_verifications() ) { |
|
430 | + if ( ! $this->_final_verifications()) { |
|
431 | 431 | EED_Single_Page_Checkout::$_initialized = true; |
432 | 432 | return; |
433 | 433 | } |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | // set no cache headers and constants |
453 | 453 | EE_System::do_not_cache(); |
454 | 454 | // add anchor |
455 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
456 | - } catch ( Exception $e ) { |
|
457 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
455 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
456 | + } catch (Exception $e) { |
|
457 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | |
@@ -472,20 +472,20 @@ discard block |
||
472 | 472 | // look in session for existing checkout |
473 | 473 | $checkout = EE_Registry::instance()->SSN->checkout(); |
474 | 474 | // verify |
475 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
475 | + if ( ! $checkout instanceof EE_Checkout) { |
|
476 | 476 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
477 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
477 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
478 | 478 | } else { |
479 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
479 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
480 | 480 | $this->unlock_transaction(); |
481 | - wp_safe_redirect( $checkout->redirect_url ); |
|
481 | + wp_safe_redirect($checkout->redirect_url); |
|
482 | 482 | exit(); |
483 | 483 | } |
484 | 484 | } |
485 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
485 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
486 | 486 | // verify again |
487 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
488 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
487 | + if ( ! $checkout instanceof EE_Checkout) { |
|
488 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
489 | 489 | } |
490 | 490 | // reset anything that needs a clean slate for each request |
491 | 491 | $checkout->reset_for_current_request(); |
@@ -505,24 +505,24 @@ discard block |
||
505 | 505 | // load classes |
506 | 506 | EED_Single_Page_Checkout::load_request_handler(); |
507 | 507 | //make sure this request is marked as belonging to EE |
508 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
508 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
509 | 509 | // which step is being requested ? |
510 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
510 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
511 | 511 | // which step is being edited ? |
512 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
512 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
513 | 513 | // and what we're doing on the current step |
514 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
514 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
515 | 515 | // returning to edit ? |
516 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
516 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
517 | 517 | // or some other kind of revisit ? |
518 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
518 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
519 | 519 | // and whether or not to generate a reg form for this request |
520 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
520 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
521 | 521 | // and whether or not to process a reg form submission for this request |
522 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
522 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
523 | 523 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
524 | 524 | ? $this->checkout->process_form_submission |
525 | - : FALSE; // TRUE FALSE |
|
525 | + : FALSE; // TRUE FALSE |
|
526 | 526 | // $this->_display_request_vars(); |
527 | 527 | } |
528 | 528 | |
@@ -535,17 +535,17 @@ discard block |
||
535 | 535 | * @return void |
536 | 536 | */ |
537 | 537 | protected function _display_request_vars() { |
538 | - if ( ! WP_DEBUG ) { |
|
538 | + if ( ! WP_DEBUG) { |
|
539 | 539 | return; |
540 | 540 | } |
541 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
542 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
543 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
544 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
545 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
546 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
547 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
548 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
541 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
542 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
543 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
544 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
545 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
546 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
547 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
548 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | * @return array |
560 | 560 | */ |
561 | 561 | private function _get_first_step() { |
562 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
563 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
562 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
563 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -576,27 +576,27 @@ discard block |
||
576 | 576 | private function _load_and_instantiate_reg_steps() { |
577 | 577 | // have reg_steps already been instantiated ? |
578 | 578 | if ( |
579 | - empty( $this->checkout->reg_steps ) || |
|
580 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
579 | + empty($this->checkout->reg_steps) || |
|
580 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
581 | 581 | ) { |
582 | 582 | // if not, then loop through raw reg steps array |
583 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
584 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
583 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
584 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
585 | 585 | return false; |
586 | 586 | } |
587 | 587 | } |
588 | 588 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
589 | 589 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
590 | 590 | // skip the registration_confirmation page ? |
591 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
591 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
592 | 592 | // just remove it from the reg steps array |
593 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
593 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
594 | 594 | } else if ( |
595 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
595 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
596 | 596 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
597 | 597 | ) { |
598 | 598 | // set the order to something big like 100 |
599 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
599 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
600 | 600 | } |
601 | 601 | // filter the array for good luck |
602 | 602 | $this->checkout->reg_steps = apply_filters( |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | // finally re-sort based on the reg step class order properties |
607 | 607 | $this->checkout->sort_reg_steps(); |
608 | 608 | } else { |
609 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
609 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
610 | 610 | // set all current step stati to FALSE |
611 | - $reg_step->set_is_current_step( FALSE ); |
|
611 | + $reg_step->set_is_current_step(FALSE); |
|
612 | 612 | } |
613 | 613 | } |
614 | - if ( empty( $this->checkout->reg_steps )) { |
|
615 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
614 | + if (empty($this->checkout->reg_steps)) { |
|
615 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
616 | 616 | return false; |
617 | 617 | } |
618 | 618 | // make reg step details available to JS |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | * @param int $order |
631 | 631 | * @return bool |
632 | 632 | */ |
633 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
633 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
634 | 634 | |
635 | 635 | // we need a file_path, class_name, and slug to add a reg step |
636 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
636 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
637 | 637 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
638 | 638 | if ( |
639 | 639 | $this->checkout->reg_url_link |
@@ -651,26 +651,26 @@ discard block |
||
651 | 651 | FALSE |
652 | 652 | ); |
653 | 653 | // did we gets the goods ? |
654 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
654 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
655 | 655 | // set reg step order based on config |
656 | - $reg_step_obj->set_order( $order ); |
|
656 | + $reg_step_obj->set_order($order); |
|
657 | 657 | // add instantiated reg step object to the master reg steps array |
658 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
658 | + $this->checkout->add_reg_step($reg_step_obj); |
|
659 | 659 | } else { |
660 | 660 | EE_Error::add_error( |
661 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
661 | + __('The current step could not be set.', 'event_espresso'), |
|
662 | 662 | __FILE__, __FUNCTION__, __LINE__ |
663 | 663 | ); |
664 | 664 | return false; |
665 | 665 | } |
666 | 666 | } else { |
667 | - if ( WP_DEBUG ) { |
|
667 | + if (WP_DEBUG) { |
|
668 | 668 | EE_Error::add_error( |
669 | 669 | sprintf( |
670 | - __( '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' ), |
|
671 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
672 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
673 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
670 | + __('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'), |
|
671 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
672 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
673 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
674 | 674 | '<ul>', |
675 | 675 | '<li>', |
676 | 676 | '</li>', |
@@ -694,16 +694,16 @@ discard block |
||
694 | 694 | */ |
695 | 695 | private function _get_transaction_and_cart_for_previous_visit() { |
696 | 696 | /** @var $TXN_model EEM_Transaction */ |
697 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
697 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
698 | 698 | // 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 |
699 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
699 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
700 | 700 | // verify transaction |
701 | - if ( $transaction instanceof EE_Transaction ) { |
|
701 | + if ($transaction instanceof EE_Transaction) { |
|
702 | 702 | // and get the cart that was used for that transaction |
703 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
703 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
704 | 704 | return $transaction; |
705 | 705 | } else { |
706 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
706 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 707 | return NULL; |
708 | 708 | } |
709 | 709 | } |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | * @param EE_Transaction $transaction |
718 | 718 | * @return EE_Cart |
719 | 719 | */ |
720 | - private function _get_cart_for_transaction( $transaction ) { |
|
721 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
720 | + private function _get_cart_for_transaction($transaction) { |
|
721 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | |
@@ -730,8 +730,8 @@ discard block |
||
730 | 730 | * @param EE_Transaction $transaction |
731 | 731 | * @return EE_Cart |
732 | 732 | */ |
733 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
734 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
733 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
734 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -747,17 +747,17 @@ discard block |
||
747 | 747 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
748 | 748 | // if there's no transaction, then this is the FIRST visit to SPCO |
749 | 749 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
750 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
750 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
751 | 751 | // and then create a new transaction |
752 | 752 | $transaction = $this->_initialize_transaction(); |
753 | 753 | // verify transaction |
754 | - if ( $transaction instanceof EE_Transaction ) { |
|
754 | + if ($transaction instanceof EE_Transaction) { |
|
755 | 755 | // save it so that we have an ID for other objects to use |
756 | 756 | $transaction->save(); |
757 | 757 | // and save TXN data to the cart |
758 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
758 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
759 | 759 | } else { |
760 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
760 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
761 | 761 | } |
762 | 762 | return $transaction; |
763 | 763 | } |
@@ -785,8 +785,8 @@ discard block |
||
785 | 785 | 'STS_ID' => EEM_Transaction::failed_status_code, |
786 | 786 | ) |
787 | 787 | ); |
788 | - } catch( Exception $e ) { |
|
789 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
788 | + } catch (Exception $e) { |
|
789 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
790 | 790 | } |
791 | 791 | return NULL; |
792 | 792 | } |
@@ -801,38 +801,38 @@ discard block |
||
801 | 801 | * @return EE_Cart |
802 | 802 | * @throws \EE_Error |
803 | 803 | */ |
804 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
804 | + private function _get_registrations(EE_Transaction $transaction) { |
|
805 | 805 | // first step: grab the registrants { : o |
806 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
806 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
807 | 807 | // verify registrations have been set |
808 | - if ( empty( $registrations )) { |
|
808 | + if (empty($registrations)) { |
|
809 | 809 | // if no cached registrations, then check the db |
810 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
810 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
811 | 811 | // still nothing ? well as long as this isn't a revisit |
812 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
812 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
813 | 813 | // generate new registrations from scratch |
814 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
814 | + $registrations = $this->_initialize_registrations($transaction); |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | // sort by their original registration order |
818 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
818 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
819 | 819 | // then loop thru the array |
820 | - foreach ( $registrations as $registration ) { |
|
820 | + foreach ($registrations as $registration) { |
|
821 | 821 | // verify each registration |
822 | - if ( $registration instanceof EE_Registration ) { |
|
822 | + if ($registration instanceof EE_Registration) { |
|
823 | 823 | // we display all attendee info for the primary registrant |
824 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
824 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
825 | 825 | && $registration->is_primary_registrant() |
826 | 826 | ) { |
827 | 827 | $this->checkout->primary_revisit = true; |
828 | 828 | break; |
829 | - } else if ( $this->checkout->revisit |
|
829 | + } else if ($this->checkout->revisit |
|
830 | 830 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
831 | 831 | ) { |
832 | 832 | // but hide info if it doesn't belong to you |
833 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
833 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
834 | 834 | } |
835 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
835 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
@@ -847,17 +847,17 @@ discard block |
||
847 | 847 | * @return array |
848 | 848 | * @throws \EE_Error |
849 | 849 | */ |
850 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
850 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
851 | 851 | $att_nmbr = 0; |
852 | 852 | $registrations = array(); |
853 | - if ( $transaction instanceof EE_Transaction ) { |
|
853 | + if ($transaction instanceof EE_Transaction) { |
|
854 | 854 | /** @type EE_Registration_Processor $registration_processor */ |
855 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
855 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
856 | 856 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
857 | 857 | // now let's add the cart items to the $transaction |
858 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
858 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
859 | 859 | //do the following for each ticket of this type they selected |
860 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
860 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
861 | 861 | $att_nmbr++; |
862 | 862 | /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */ |
863 | 863 | $CreateRegistrationCommand = EE_Registry::instance() |
@@ -873,17 +873,17 @@ discard block |
||
873 | 873 | // override capabilities for frontend registrations |
874 | 874 | if ( ! is_admin()) { |
875 | 875 | $CreateRegistrationCommand->setCapCheck( |
876 | - new PublicCapabilities( '', 'create_new_registration' ) |
|
876 | + new PublicCapabilities('', 'create_new_registration') |
|
877 | 877 | ); |
878 | 878 | } |
879 | - $registration = EE_Registry::instance()->BUS->execute( $CreateRegistrationCommand ); |
|
880 | - if ( ! $registration instanceof EE_Registration ) { |
|
881 | - throw new InvalidEntityException( $registration, 'EE_Registration' ); |
|
879 | + $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand); |
|
880 | + if ( ! $registration instanceof EE_Registration) { |
|
881 | + throw new InvalidEntityException($registration, 'EE_Registration'); |
|
882 | 882 | } |
883 | - $registrations[ $registration->ID() ] = $registration; |
|
883 | + $registrations[$registration->ID()] = $registration; |
|
884 | 884 | } |
885 | 885 | } |
886 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
886 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
887 | 887 | } |
888 | 888 | return $registrations; |
889 | 889 | } |
@@ -898,12 +898,12 @@ discard block |
||
898 | 898 | * @param EE_Registration $reg_B |
899 | 899 | * @return int |
900 | 900 | */ |
901 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
901 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
902 | 902 | // this shouldn't ever happen within the same TXN, but oh well |
903 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
903 | + if ($reg_A->count() === $reg_B->count()) { |
|
904 | 904 | return 0; |
905 | 905 | } |
906 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
906 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
907 | 907 | } |
908 | 908 | |
909 | 909 | |
@@ -918,21 +918,21 @@ discard block |
||
918 | 918 | */ |
919 | 919 | private function _final_verifications() { |
920 | 920 | // filter checkout |
921 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
921 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
922 | 922 | //verify that current step is still set correctly |
923 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
924 | - 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__ ); |
|
923 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
924 | + 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__); |
|
925 | 925 | return false; |
926 | 926 | } |
927 | 927 | // if returning to SPCO, then verify that primary registrant is set |
928 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
928 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
929 | 929 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
930 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
931 | - 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__ ); |
|
930 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
931 | + 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__); |
|
932 | 932 | return false; |
933 | 933 | } |
934 | 934 | $valid_registrant = null; |
935 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
935 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
936 | 936 | if ( |
937 | 937 | $registration instanceof EE_Registration |
938 | 938 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -940,9 +940,9 @@ discard block |
||
940 | 940 | $valid_registrant = $registration; |
941 | 941 | } |
942 | 942 | } |
943 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
943 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
944 | 944 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
945 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
945 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
946 | 946 | // clear the session, mark the checkout as unverified, and try again |
947 | 947 | EE_Registry::instance()->SSN->clear_session(); |
948 | 948 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -951,13 +951,13 @@ discard block |
||
951 | 951 | EE_Error::reset_notices(); |
952 | 952 | return false; |
953 | 953 | } |
954 | - 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__ ); |
|
954 | + 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__); |
|
955 | 955 | return false; |
956 | 956 | } |
957 | 957 | } |
958 | 958 | // now that things have been kinda sufficiently verified, |
959 | 959 | // let's add the checkout to the session so that's available other systems |
960 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
960 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
961 | 961 | return true; |
962 | 962 | } |
963 | 963 | |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | * @param bool $reinitializing |
973 | 973 | * @throws \EE_Error |
974 | 974 | */ |
975 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
976 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
975 | + private function _initialize_reg_steps($reinitializing = false) { |
|
976 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
977 | 977 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
978 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
979 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
978 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
979 | + if ( ! $reg_step->initialize_reg_step()) { |
|
980 | 980 | // if not initialized then maybe this step is being removed... |
981 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
981 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
982 | 982 | // if it was the current step, then we need to start over here |
983 | - $this->_initialize_reg_steps( true ); |
|
983 | + $this->_initialize_reg_steps(true); |
|
984 | 984 | return; |
985 | 985 | } |
986 | 986 | continue; |
@@ -989,13 +989,13 @@ discard block |
||
989 | 989 | $reg_step->enqueue_styles_and_scripts(); |
990 | 990 | // i18n |
991 | 991 | $reg_step->translate_js_strings(); |
992 | - if ( $reg_step->is_current_step() ) { |
|
992 | + if ($reg_step->is_current_step()) { |
|
993 | 993 | // the text that appears on the reg step form submit button |
994 | 994 | $reg_step->set_submit_button_text(); |
995 | 995 | } |
996 | 996 | } |
997 | 997 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
998 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
998 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1008,43 +1008,43 @@ discard block |
||
1008 | 1008 | */ |
1009 | 1009 | private function _check_form_submission() { |
1010 | 1010 | //does this request require the reg form to be generated ? |
1011 | - if ( $this->checkout->generate_reg_form ) { |
|
1011 | + if ($this->checkout->generate_reg_form) { |
|
1012 | 1012 | // ever heard that song by Blue Rodeo ? |
1013 | 1013 | try { |
1014 | 1014 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
1015 | 1015 | // if not displaying a form, then check for form submission |
1016 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
1016 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1017 | 1017 | // clear out any old data in case this step is being run again |
1018 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1018 | + $this->checkout->current_step->set_valid_data(array()); |
|
1019 | 1019 | // capture submitted form data |
1020 | 1020 | $this->checkout->current_step->reg_form->receive_form_submission( |
1021 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1021 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1022 | 1022 | ); |
1023 | 1023 | // validate submitted form data |
1024 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1024 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1025 | 1025 | // thou shall not pass !!! |
1026 | 1026 | $this->checkout->continue_reg = FALSE; |
1027 | 1027 | // any form validation errors? |
1028 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1028 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1029 | 1029 | $submission_error_messages = array(); |
1030 | 1030 | // bad, bad, bad registrant |
1031 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1032 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1031 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1032 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1033 | 1033 | $submission_error_messages[] = sprintf( |
1034 | - __( '%s : %s', 'event_espresso' ), |
|
1034 | + __('%s : %s', 'event_espresso'), |
|
1035 | 1035 | $validation_error->get_form_section()->html_label_text(), |
1036 | 1036 | $validation_error->getMessage() |
1037 | 1037 | ); |
1038 | 1038 | } |
1039 | 1039 | } |
1040 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1041 | 1041 | } |
1042 | 1042 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1043 | 1043 | $this->go_to_next_step(); |
1044 | 1044 | return; |
1045 | 1045 | } |
1046 | 1046 | } |
1047 | - } catch( EE_Error $e ) { |
|
1047 | + } catch (EE_Error $e) { |
|
1048 | 1048 | $e->get_error(); |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -1061,22 +1061,22 @@ discard block |
||
1061 | 1061 | */ |
1062 | 1062 | private function _process_form_action() { |
1063 | 1063 | // what cha wanna do? |
1064 | - switch( $this->checkout->action ) { |
|
1064 | + switch ($this->checkout->action) { |
|
1065 | 1065 | // AJAX next step reg form |
1066 | 1066 | case 'display_spco_reg_step' : |
1067 | 1067 | $this->checkout->redirect = FALSE; |
1068 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1069 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1068 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1069 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1070 | 1070 | } |
1071 | 1071 | break; |
1072 | 1072 | |
1073 | 1073 | default : |
1074 | 1074 | // meh... do one of those other steps first |
1075 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1075 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1076 | 1076 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1077 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1077 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1078 | 1078 | // call action on current step |
1079 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1079 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1080 | 1080 | // good registrant, you get to proceed |
1081 | 1081 | if ( |
1082 | 1082 | $this->checkout->current_step->success_message() !== '' |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | ) { |
1088 | 1088 | EE_Error::add_success( |
1089 | 1089 | $this->checkout->current_step->success_message() |
1090 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1090 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1091 | 1091 | ); |
1092 | 1092 | |
1093 | 1093 | } |
@@ -1095,12 +1095,12 @@ discard block |
||
1095 | 1095 | $this->_setup_redirect(); |
1096 | 1096 | } |
1097 | 1097 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1098 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1098 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1099 | 1099 | |
1100 | 1100 | } else { |
1101 | 1101 | EE_Error::add_error( |
1102 | 1102 | sprintf( |
1103 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1103 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1104 | 1104 | $this->checkout->action, |
1105 | 1105 | $this->checkout->current_step->name() |
1106 | 1106 | ), |
@@ -1126,10 +1126,10 @@ discard block |
||
1126 | 1126 | public function add_styles_and_scripts() { |
1127 | 1127 | // i18n |
1128 | 1128 | $this->translate_js_strings(); |
1129 | - if ( $this->checkout->admin_request ) { |
|
1130 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1129 | + if ($this->checkout->admin_request) { |
|
1130 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1131 | 1131 | } else { |
1132 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1132 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | |
@@ -1145,42 +1145,42 @@ discard block |
||
1145 | 1145 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1146 | 1146 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1147 | 1147 | 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'); |
1148 | - 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' ); |
|
1149 | - 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' ); |
|
1150 | - 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' ); |
|
1148 | + 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'); |
|
1149 | + 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'); |
|
1150 | + 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'); |
|
1151 | 1151 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1152 | 1152 | 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'); |
1153 | - 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/>' ); |
|
1154 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1153 | + 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/>'); |
|
1154 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1155 | 1155 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1156 | 1156 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1157 | 1157 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1158 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1159 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1160 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1161 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1162 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1163 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1164 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1165 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1166 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1167 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1168 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1169 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1170 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1171 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1158 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1159 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1160 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1161 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1162 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1163 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1164 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1165 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1166 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1167 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1168 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1169 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1170 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1171 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1172 | 1172 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1173 | - __( '%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' ), |
|
1173 | + __('%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'), |
|
1174 | 1174 | '<h4 class="important-notice">', |
1175 | 1175 | '</h4>', |
1176 | 1176 | '<br />', |
1177 | 1177 | '<p>', |
1178 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1178 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1179 | 1179 | '">', |
1180 | 1180 | '</a>', |
1181 | 1181 | '</p>' |
1182 | 1182 | ); |
1183 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1183 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
@@ -1193,25 +1193,25 @@ discard block |
||
1193 | 1193 | */ |
1194 | 1194 | public function enqueue_styles_and_scripts() { |
1195 | 1195 | // load css |
1196 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1197 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1196 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1197 | + wp_enqueue_style('single_page_checkout'); |
|
1198 | 1198 | // load JS |
1199 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1200 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1201 | - 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 ); |
|
1202 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1199 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1200 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1201 | + 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); |
|
1202 | + wp_enqueue_script('single_page_checkout'); |
|
1203 | 1203 | |
1204 | 1204 | /** |
1205 | 1205 | * global action hook for enqueueing styles and scripts with |
1206 | 1206 | * spco calls. |
1207 | 1207 | */ |
1208 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1208 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1209 | 1209 | |
1210 | 1210 | /** |
1211 | 1211 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1212 | 1212 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1213 | 1213 | */ |
1214 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1214 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1215 | 1215 | |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1226,19 +1226,19 @@ discard block |
||
1226 | 1226 | */ |
1227 | 1227 | private function _display_spco_reg_form() { |
1228 | 1228 | // if registering via the admin, just display the reg form for the current step |
1229 | - if ( $this->checkout->admin_request ) { |
|
1230 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1229 | + if ($this->checkout->admin_request) { |
|
1230 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1231 | 1231 | } else { |
1232 | 1232 | // add powered by EE msg |
1233 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1233 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1234 | 1234 | |
1235 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1235 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1236 | 1236 | $cookies_not_set_msg = ''; |
1237 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1237 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1238 | 1238 | $cookies_not_set_msg = apply_filters( |
1239 | 1239 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1240 | 1240 | sprintf( |
1241 | - __( '%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' ), |
|
1241 | + __('%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'), |
|
1242 | 1242 | '<div class="ee-attention">', |
1243 | 1243 | '</div>', |
1244 | 1244 | '<h6 class="important-notice">', |
@@ -1258,7 +1258,7 @@ discard block |
||
1258 | 1258 | 'layout_strategy' => |
1259 | 1259 | new EE_Template_Layout( |
1260 | 1260 | array( |
1261 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1261 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1262 | 1262 | 'template_args' => array( |
1263 | 1263 | 'empty_cart' => $empty_cart, |
1264 | 1264 | 'revisit' => $this->checkout->revisit, |
@@ -1267,8 +1267,8 @@ discard block |
||
1267 | 1267 | 'empty_msg' => apply_filters( |
1268 | 1268 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1269 | 1269 | sprintf( |
1270 | - __( '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' ), |
|
1271 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1270 | + __('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'), |
|
1271 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1272 | 1272 | '">', |
1273 | 1273 | '</a>' |
1274 | 1274 | ) |
@@ -1276,14 +1276,14 @@ discard block |
||
1276 | 1276 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1277 | 1277 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1278 | 1278 | 'session_expiration' => |
1279 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1279 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1280 | 1280 | ) |
1281 | 1281 | ) |
1282 | 1282 | ) |
1283 | 1283 | ) |
1284 | 1284 | ); |
1285 | 1285 | // load template and add to output sent that gets filtered into the_content() |
1286 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1286 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | |
@@ -1297,8 +1297,8 @@ discard block |
||
1297 | 1297 | * @internal param string $label |
1298 | 1298 | * @return string |
1299 | 1299 | */ |
1300 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1301 | - if ( $next_step === 'finalize_registration' ) { |
|
1300 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1301 | + if ($next_step === 'finalize_registration') { |
|
1302 | 1302 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1303 | 1303 | } |
1304 | 1304 | } |
@@ -1312,18 +1312,18 @@ discard block |
||
1312 | 1312 | * @return string |
1313 | 1313 | */ |
1314 | 1314 | public static function display_registration_footer() { |
1315 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1316 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1317 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1318 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1315 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1316 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1317 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1318 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1319 | 1319 | echo apply_filters( |
1320 | 1320 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1321 | 1321 | sprintf( |
1322 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1323 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1322 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1323 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1324 | 1324 | '" target="_blank">', |
1325 | 1325 | '</a>', |
1326 | - '<a href="' . $url . '" title="', |
|
1326 | + '<a href="'.$url.'" title="', |
|
1327 | 1327 | '" target="_blank">', |
1328 | 1328 | '</a></div>' |
1329 | 1329 | ) |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | * @throws \EE_Error |
1342 | 1342 | */ |
1343 | 1343 | public function unlock_transaction() { |
1344 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1344 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1345 | 1345 | $this->checkout->transaction->unlock(); |
1346 | 1346 | } |
1347 | 1347 | } |
@@ -1356,12 +1356,12 @@ discard block |
||
1356 | 1356 | * @return array |
1357 | 1357 | */ |
1358 | 1358 | private function _setup_redirect() { |
1359 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1359 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1360 | 1360 | $this->checkout->redirect = TRUE; |
1361 | - if ( empty( $this->checkout->redirect_url )) { |
|
1361 | + if (empty($this->checkout->redirect_url)) { |
|
1362 | 1362 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1363 | 1363 | } |
1364 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1364 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1365 | 1365 | } |
1366 | 1366 | } |
1367 | 1367 | |
@@ -1375,9 +1375,9 @@ discard block |
||
1375 | 1375 | * @throws \EE_Error |
1376 | 1376 | */ |
1377 | 1377 | public function go_to_next_step() { |
1378 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1378 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1379 | 1379 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1380 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1380 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1381 | 1381 | } |
1382 | 1382 | $this->unlock_transaction(); |
1383 | 1383 | // just return for these conditions |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | */ |
1407 | 1407 | protected function _handle_json_response() { |
1408 | 1408 | // if this is an ajax request |
1409 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1409 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1410 | 1410 | // DEBUG LOG |
1411 | 1411 | //$this->checkout->log( |
1412 | 1412 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1419,7 +1419,7 @@ discard block |
||
1419 | 1419 | $this->checkout->json_response->set_registration_time_limit( |
1420 | 1420 | $this->checkout->get_registration_time_limit() |
1421 | 1421 | ); |
1422 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1422 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1423 | 1423 | // just send the ajax ( |
1424 | 1424 | $json_response = apply_filters( |
1425 | 1425 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1440,9 +1440,9 @@ discard block |
||
1440 | 1440 | */ |
1441 | 1441 | protected function _handle_html_redirects() { |
1442 | 1442 | // going somewhere ? |
1443 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1443 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1444 | 1444 | // store notices in a transient |
1445 | - EE_Error::get_notices( false, true, true ); |
|
1445 | + EE_Error::get_notices(false, true, true); |
|
1446 | 1446 | // DEBUG LOG |
1447 | 1447 | //$this->checkout->log( |
1448 | 1448 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | // 'headers_list' => headers_list(), |
1453 | 1453 | // ) |
1454 | 1454 | //); |
1455 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1455 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1456 | 1456 | exit(); |
1457 | 1457 | } |
1458 | 1458 | } |