@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | /** |
6 | 6 | * Event Espresso |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | ?> |
28 | 28 | <div class="event-display-boxes"> |
29 | 29 | <?php |
30 | - if ( ! empty( $page_title )) { |
|
31 | - echo '<h4 id="invoice_title" class="payment_type_title section-heading">' . stripslashes_deep( $page_title ) . '</h4>'; |
|
30 | + if ( ! empty($page_title)) { |
|
31 | + echo '<h4 id="invoice_title" class="payment_type_title section-heading">'.stripslashes_deep($page_title).'</h4>'; |
|
32 | 32 | } |
33 | - if ( ! empty( $invoice_url )) { |
|
33 | + if ( ! empty($invoice_url)) { |
|
34 | 34 | ?> |
35 | 35 | <p> |
36 | 36 | <a href="<?php echo $invoice_url; ?>" class="ee-button-lnk inline-button ee-invoice-lnk" target="_blank"> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <?php |
41 | 41 | |
42 | 42 | if (isset($page_confirmation_text)) { |
43 | - echo '<div class="event-messages ui-state-highlight"><span class="ui-icon ui-icon-alert"></span><p class="instruct">' . stripslashes_deep($page_confirmation_text) . '</p></div>'; |
|
43 | + echo '<div class="event-messages ui-state-highlight"><span class="ui-icon ui-icon-alert"></span><p class="instruct">'.stripslashes_deep($page_confirmation_text).'</p></div>'; |
|
44 | 44 | } |
45 | 45 | |
46 | - if ( ! empty( $page_extra_info )) { |
|
46 | + if ( ! empty($page_extra_info)) { |
|
47 | 47 | ?> |
48 | 48 | <div class="address-block"> |
49 | 49 | <?php echo wpautop(stripslashes_deep($page_extra_info)); ?> |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | /** |
6 | 7 | * Event Espresso |
7 | 8 | * |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * process_registration_from_admin |
319 | 319 | * |
320 | 320 | * @access public |
321 | - * @return int |
|
321 | + * @return EE_Transaction |
|
322 | 322 | * @throws \EE_Error |
323 | 323 | */ |
324 | 324 | public static function process_registration_from_admin() { |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * _get_transaction_and_cart_for_previous_visit |
688 | 688 | * |
689 | 689 | * @access private |
690 | - * @return mixed EE_Transaction|NULL |
|
690 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
691 | 691 | */ |
692 | 692 | private function _get_transaction_and_cart_for_previous_visit() { |
693 | 693 | /** @var $TXN_model EEM_Transaction */ |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | * generates a new EE_Transaction object and adds it to the $_transaction property. |
766 | 766 | * |
767 | 767 | * @access private |
768 | - * @return mixed EE_Transaction|NULL |
|
768 | + * @return EE_Transaction|null EE_Transaction|NULL |
|
769 | 769 | */ |
770 | 770 | private function _initialize_transaction() { |
771 | 771 | try { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Single Page Checkout (SPCO) |
4 | 4 | * |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @return EED_Single_Page_Checkout |
48 | 48 | */ |
49 | 49 | public static function instance() { |
50 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
51 | - return parent::get_instance( __CLASS__ ); |
|
50 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
51 | + return parent::get_instance(__CLASS__); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
@@ -93,22 +93,22 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function set_hooks_admin() { |
95 | 95 | EED_Single_Page_Checkout::set_definitions(); |
96 | - if ( defined( 'DOING_AJAX' )) { |
|
96 | + if (defined('DOING_AJAX')) { |
|
97 | 97 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
98 | 98 | ob_start(); |
99 | 99 | EED_Single_Page_Checkout::load_request_handler(); |
100 | 100 | EED_Single_Page_Checkout::load_reg_steps(); |
101 | 101 | } else { |
102 | 102 | // 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 |
103 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
103 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
104 | 104 | } |
105 | 105 | // set ajax hooks |
106 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
107 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
108 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
109 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
110 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
111 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
106 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
107 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
108 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
109 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
110 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
111 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | * @param string $ajax_action |
120 | 120 | * @throws \EE_Error |
121 | 121 | */ |
122 | - public static function process_ajax_request( $ajax_action ) { |
|
123 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
122 | + public static function process_ajax_request($ajax_action) { |
|
123 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
124 | 124 | EED_Single_Page_Checkout::instance()->_initialize(); |
125 | 125 | } |
126 | 126 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @throws \EE_Error |
133 | 133 | */ |
134 | 134 | public static function display_reg_step() { |
135 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
135 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @throws \EE_Error |
144 | 144 | */ |
145 | 145 | public static function process_reg_step() { |
146 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
146 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @throws \EE_Error |
155 | 155 | */ |
156 | 156 | public static function update_reg_step() { |
157 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
157 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | 169 | public static function update_checkout() { |
170 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
170 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | */ |
181 | 181 | public static function load_request_handler() { |
182 | 182 | // load core Request_Handler class |
183 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
184 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
183 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
184 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | * @throws \EE_Error |
196 | 196 | */ |
197 | 197 | public static function set_definitions() { |
198 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
199 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
200 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
201 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
202 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
203 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
204 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
205 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
198 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
199 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
200 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
201 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
202 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
203 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
204 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
205 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public static function load_reg_steps() { |
219 | 219 | static $reg_steps_loaded = FALSE; |
220 | - if ( $reg_steps_loaded ) { |
|
220 | + if ($reg_steps_loaded) { |
|
221 | 221 | return; |
222 | 222 | } |
223 | 223 | // filter list of reg_steps |
@@ -226,24 +226,24 @@ discard block |
||
226 | 226 | EED_Single_Page_Checkout::get_reg_steps() |
227 | 227 | ); |
228 | 228 | // sort by key (order) |
229 | - ksort( $reg_steps_to_load ); |
|
229 | + ksort($reg_steps_to_load); |
|
230 | 230 | // loop through folders |
231 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
231 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
232 | 232 | // we need a |
233 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
233 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
234 | 234 | // copy over to the reg_steps_array |
235 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
235 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
236 | 236 | // register custom key route for each reg step |
237 | 237 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
238 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
238 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
239 | 239 | // add AJAX or other hooks |
240 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
240 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
241 | 241 | // setup autoloaders if necessary |
242 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
243 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
242 | + if ( ! class_exists($reg_step['class_name'])) { |
|
243 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
244 | 244 | } |
245 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
246 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
245 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
246 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } |
@@ -262,28 +262,28 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public static function get_reg_steps() { |
264 | 264 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
265 | - if ( empty( $reg_steps )) { |
|
265 | + if (empty($reg_steps)) { |
|
266 | 266 | $reg_steps = array( |
267 | 267 | 10 => array( |
268 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
268 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
269 | 269 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
270 | 270 | 'slug' => 'attendee_information', |
271 | 271 | 'has_hooks' => FALSE |
272 | 272 | ), |
273 | 273 | 20 => array( |
274 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
274 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
275 | 275 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
276 | 276 | 'slug' => 'registration_confirmation', |
277 | 277 | 'has_hooks' => FALSE |
278 | 278 | ), |
279 | 279 | 30 => array( |
280 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
280 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
281 | 281 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
282 | 282 | 'slug' => 'payment_options', |
283 | 283 | 'has_hooks' => TRUE |
284 | 284 | ), |
285 | 285 | 999 => array( |
286 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
286 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
287 | 287 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
288 | 288 | 'slug' => 'finalize_registration', |
289 | 289 | 'has_hooks' => FALSE |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public static function registration_checkout_for_admin() { |
306 | 306 | EED_Single_Page_Checkout::load_reg_steps(); |
307 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
308 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
309 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
307 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
308 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
309 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
310 | 310 | EED_Single_Page_Checkout::instance()->_initialize(); |
311 | 311 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
312 | 312 | return EE_Registry::instance()->REQ->get_output(); |
@@ -323,15 +323,15 @@ discard block |
||
323 | 323 | */ |
324 | 324 | public static function process_registration_from_admin() { |
325 | 325 | EED_Single_Page_Checkout::load_reg_steps(); |
326 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
327 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
328 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
326 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
327 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
328 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
329 | 329 | EED_Single_Page_Checkout::instance()->_initialize(); |
330 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
331 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
332 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
333 | - EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated( $final_reg_step ); |
|
334 | - if ( $final_reg_step->process_reg_step() ) { |
|
330 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
331 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
332 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
333 | + EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step); |
|
334 | + if ($final_reg_step->process_reg_step()) { |
|
335 | 335 | $final_reg_step->set_completed(); |
336 | 336 | EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array(); |
337 | 337 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | * @return void |
352 | 352 | * @throws \EE_Error |
353 | 353 | */ |
354 | - public function run( $WP_Query ) { |
|
354 | + public function run($WP_Query) { |
|
355 | 355 | if ( |
356 | 356 | $WP_Query instanceof WP_Query |
357 | 357 | && $WP_Query->is_main_query() |
358 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
358 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
359 | 359 | ) { |
360 | 360 | $this->_initialize(); |
361 | 361 | } |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @return void |
372 | 372 | * @throws \EE_Error |
373 | 373 | */ |
374 | - public static function init( $WP_Query ) { |
|
375 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
374 | + public static function init($WP_Query) { |
|
375 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -386,34 +386,34 @@ discard block |
||
386 | 386 | */ |
387 | 387 | private function _initialize() { |
388 | 388 | // ensure SPCO doesn't run twice |
389 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
389 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
390 | 390 | return; |
391 | 391 | } |
392 | 392 | try { |
393 | 393 | // setup the EE_Checkout object |
394 | 394 | $this->checkout = $this->_initialize_checkout(); |
395 | 395 | // filter checkout |
396 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
396 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
397 | 397 | // get the $_GET |
398 | 398 | $this->_get_request_vars(); |
399 | 399 | // filter continue_reg |
400 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
400 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
401 | 401 | // load the reg steps array |
402 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
402 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
403 | 403 | EED_Single_Page_Checkout::$_initialized = true; |
404 | 404 | return; |
405 | 405 | } |
406 | 406 | // set the current step |
407 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
407 | + $this->checkout->set_current_step($this->checkout->step); |
|
408 | 408 | // and the next step |
409 | 409 | $this->checkout->set_next_step(); |
410 | 410 | // was there already a valid transaction in the checkout from the session ? |
411 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
411 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
412 | 412 | // get transaction from db or session |
413 | 413 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
414 | 414 | ? $this->_get_transaction_and_cart_for_previous_visit() |
415 | 415 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
416 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
416 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
417 | 417 | // add some style and make it dance |
418 | 418 | $this->checkout->transaction = EE_Transaction::new_instance(); |
419 | 419 | $this->add_styles_and_scripts(); |
@@ -421,10 +421,10 @@ discard block |
||
421 | 421 | return; |
422 | 422 | } |
423 | 423 | // and the registrations for the transaction |
424 | - $this->_get_registrations( $this->checkout->transaction ); |
|
424 | + $this->_get_registrations($this->checkout->transaction); |
|
425 | 425 | } |
426 | 426 | // verify that everything has been setup correctly |
427 | - if ( ! $this->_final_verifications() ) { |
|
427 | + if ( ! $this->_final_verifications()) { |
|
428 | 428 | EED_Single_Page_Checkout::$_initialized = true; |
429 | 429 | return; |
430 | 430 | } |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | // set no cache headers and constants |
450 | 450 | EE_System::do_not_cache(); |
451 | 451 | // add anchor |
452 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
453 | - } catch ( Exception $e ) { |
|
454 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
452 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
453 | + } catch (Exception $e) { |
|
454 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
@@ -469,20 +469,20 @@ discard block |
||
469 | 469 | // look in session for existing checkout |
470 | 470 | $checkout = EE_Registry::instance()->SSN->checkout(); |
471 | 471 | // verify |
472 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
472 | + if ( ! $checkout instanceof EE_Checkout) { |
|
473 | 473 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
474 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
474 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
475 | 475 | } else { |
476 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
476 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
477 | 477 | $this->unlock_transaction(); |
478 | - wp_safe_redirect( $checkout->redirect_url ); |
|
478 | + wp_safe_redirect($checkout->redirect_url); |
|
479 | 479 | exit(); |
480 | 480 | } |
481 | 481 | } |
482 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
482 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
483 | 483 | // verify again |
484 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
485 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
484 | + if ( ! $checkout instanceof EE_Checkout) { |
|
485 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
486 | 486 | } |
487 | 487 | // reset anything that needs a clean slate for each request |
488 | 488 | $checkout->reset_for_current_request(); |
@@ -502,24 +502,24 @@ discard block |
||
502 | 502 | // load classes |
503 | 503 | EED_Single_Page_Checkout::load_request_handler(); |
504 | 504 | //make sure this request is marked as belonging to EE |
505 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
505 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
506 | 506 | // which step is being requested ? |
507 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
507 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
508 | 508 | // which step is being edited ? |
509 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
509 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
510 | 510 | // and what we're doing on the current step |
511 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
511 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
512 | 512 | // returning to edit ? |
513 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
513 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
514 | 514 | // or some other kind of revisit ? |
515 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
515 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
516 | 516 | // and whether or not to generate a reg form for this request |
517 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
517 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
518 | 518 | // and whether or not to process a reg form submission for this request |
519 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
519 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
520 | 520 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
521 | 521 | ? $this->checkout->process_form_submission |
522 | - : FALSE; // TRUE FALSE |
|
522 | + : FALSE; // TRUE FALSE |
|
523 | 523 | // $this->_display_request_vars(); |
524 | 524 | } |
525 | 525 | |
@@ -532,17 +532,17 @@ discard block |
||
532 | 532 | * @return void |
533 | 533 | */ |
534 | 534 | protected function _display_request_vars() { |
535 | - if ( ! WP_DEBUG ) { |
|
535 | + if ( ! WP_DEBUG) { |
|
536 | 536 | return; |
537 | 537 | } |
538 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
539 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
540 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
541 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
542 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
543 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
544 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
545 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
538 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
539 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
540 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
541 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
542 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
543 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
544 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
545 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | * @return array |
557 | 557 | */ |
558 | 558 | private function _get_first_step() { |
559 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
560 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
559 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
560 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -573,27 +573,27 @@ discard block |
||
573 | 573 | private function _load_and_instantiate_reg_steps() { |
574 | 574 | // have reg_steps already been instantiated ? |
575 | 575 | if ( |
576 | - empty( $this->checkout->reg_steps ) || |
|
577 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
576 | + empty($this->checkout->reg_steps) || |
|
577 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
578 | 578 | ) { |
579 | 579 | // if not, then loop through raw reg steps array |
580 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
581 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
580 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
581 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
582 | 582 | return false; |
583 | 583 | } |
584 | 584 | } |
585 | 585 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
586 | 586 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
587 | 587 | // skip the registration_confirmation page ? |
588 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
588 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
589 | 589 | // just remove it from the reg steps array |
590 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
590 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
591 | 591 | } else if ( |
592 | - isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
592 | + isset($this->checkout->reg_steps['registration_confirmation']) |
|
593 | 593 | && EE_Registry::instance()->CFG->registration->reg_confirmation_last |
594 | 594 | ) { |
595 | 595 | // set the order to something big like 100 |
596 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
596 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
597 | 597 | } |
598 | 598 | // filter the array for good luck |
599 | 599 | $this->checkout->reg_steps = apply_filters( |
@@ -603,13 +603,13 @@ discard block |
||
603 | 603 | // finally re-sort based on the reg step class order properties |
604 | 604 | $this->checkout->sort_reg_steps(); |
605 | 605 | } else { |
606 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
606 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
607 | 607 | // set all current step stati to FALSE |
608 | - $reg_step->set_is_current_step( FALSE ); |
|
608 | + $reg_step->set_is_current_step(FALSE); |
|
609 | 609 | } |
610 | 610 | } |
611 | - if ( empty( $this->checkout->reg_steps )) { |
|
612 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
611 | + if (empty($this->checkout->reg_steps)) { |
|
612 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
613 | 613 | return false; |
614 | 614 | } |
615 | 615 | // make reg step details available to JS |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | * @param int $order |
628 | 628 | * @return bool |
629 | 629 | */ |
630 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
630 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
631 | 631 | |
632 | 632 | // we need a file_path, class_name, and slug to add a reg step |
633 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
633 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
634 | 634 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
635 | 635 | if ( |
636 | 636 | $this->checkout->reg_url_link |
@@ -648,26 +648,26 @@ discard block |
||
648 | 648 | FALSE |
649 | 649 | ); |
650 | 650 | // did we gets the goods ? |
651 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
651 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
652 | 652 | // set reg step order based on config |
653 | - $reg_step_obj->set_order( $order ); |
|
653 | + $reg_step_obj->set_order($order); |
|
654 | 654 | // add instantiated reg step object to the master reg steps array |
655 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
655 | + $this->checkout->add_reg_step($reg_step_obj); |
|
656 | 656 | } else { |
657 | 657 | EE_Error::add_error( |
658 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
658 | + __('The current step could not be set.', 'event_espresso'), |
|
659 | 659 | __FILE__, __FUNCTION__, __LINE__ |
660 | 660 | ); |
661 | 661 | return false; |
662 | 662 | } |
663 | 663 | } else { |
664 | - if ( WP_DEBUG ) { |
|
664 | + if (WP_DEBUG) { |
|
665 | 665 | EE_Error::add_error( |
666 | 666 | sprintf( |
667 | - __( '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' ), |
|
668 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
669 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
670 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
667 | + __('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'), |
|
668 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
669 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
670 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
671 | 671 | '<ul>', |
672 | 672 | '<li>', |
673 | 673 | '</li>', |
@@ -691,16 +691,16 @@ discard block |
||
691 | 691 | */ |
692 | 692 | private function _get_transaction_and_cart_for_previous_visit() { |
693 | 693 | /** @var $TXN_model EEM_Transaction */ |
694 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
694 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
695 | 695 | // 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 |
696 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
696 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
697 | 697 | // verify transaction |
698 | - if ( $transaction instanceof EE_Transaction ) { |
|
698 | + if ($transaction instanceof EE_Transaction) { |
|
699 | 699 | // and get the cart that was used for that transaction |
700 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
700 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
701 | 701 | return $transaction; |
702 | 702 | } else { |
703 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
703 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
704 | 704 | return NULL; |
705 | 705 | } |
706 | 706 | } |
@@ -714,8 +714,8 @@ discard block |
||
714 | 714 | * @param EE_Transaction $transaction |
715 | 715 | * @return EE_Cart |
716 | 716 | */ |
717 | - private function _get_cart_for_transaction( $transaction ) { |
|
718 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
717 | + private function _get_cart_for_transaction($transaction) { |
|
718 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
719 | 719 | } |
720 | 720 | |
721 | 721 | |
@@ -727,8 +727,8 @@ discard block |
||
727 | 727 | * @param EE_Transaction $transaction |
728 | 728 | * @return EE_Cart |
729 | 729 | */ |
730 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
731 | - return $this->checkout->get_cart_for_transaction( $transaction ); |
|
730 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
731 | + return $this->checkout->get_cart_for_transaction($transaction); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | |
@@ -744,17 +744,17 @@ discard block |
||
744 | 744 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
745 | 745 | // if there's no transaction, then this is the FIRST visit to SPCO |
746 | 746 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
747 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
747 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
748 | 748 | // and then create a new transaction |
749 | 749 | $transaction = $this->_initialize_transaction(); |
750 | 750 | // verify transaction |
751 | - if ( $transaction instanceof EE_Transaction ) { |
|
751 | + if ($transaction instanceof EE_Transaction) { |
|
752 | 752 | // save it so that we have an ID for other objects to use |
753 | 753 | $transaction->save(); |
754 | 754 | // and save TXN data to the cart |
755 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
755 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
756 | 756 | } else { |
757 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
757 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
758 | 758 | } |
759 | 759 | return $transaction; |
760 | 760 | } |
@@ -774,15 +774,15 @@ discard block |
||
774 | 774 | // grab the cart grand total |
775 | 775 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
776 | 776 | // create new TXN |
777 | - return EE_Transaction::new_instance( array( |
|
777 | + return EE_Transaction::new_instance(array( |
|
778 | 778 | 'TXN_timestamp' => time(), |
779 | 779 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
780 | 780 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
781 | 781 | 'TXN_paid' => 0, |
782 | 782 | 'STS_ID' => EEM_Transaction::failed_status_code, |
783 | 783 | )); |
784 | - } catch( Exception $e ) { |
|
785 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
784 | + } catch (Exception $e) { |
|
785 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
786 | 786 | } |
787 | 787 | return NULL; |
788 | 788 | } |
@@ -797,38 +797,38 @@ discard block |
||
797 | 797 | * @return EE_Cart |
798 | 798 | * @throws \EE_Error |
799 | 799 | */ |
800 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
800 | + private function _get_registrations(EE_Transaction $transaction) { |
|
801 | 801 | // first step: grab the registrants { : o |
802 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
802 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
803 | 803 | // verify registrations have been set |
804 | - if ( empty( $registrations )) { |
|
804 | + if (empty($registrations)) { |
|
805 | 805 | // if no cached registrations, then check the db |
806 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
806 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
807 | 807 | // still nothing ? well as long as this isn't a revisit |
808 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
808 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
809 | 809 | // generate new registrations from scratch |
810 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
810 | + $registrations = $this->_initialize_registrations($transaction); |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | // sort by their original registration order |
814 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
814 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
815 | 815 | // then loop thru the array |
816 | - foreach ( $registrations as $registration ) { |
|
816 | + foreach ($registrations as $registration) { |
|
817 | 817 | // verify each registration |
818 | - if ( $registration instanceof EE_Registration ) { |
|
818 | + if ($registration instanceof EE_Registration) { |
|
819 | 819 | // we display all attendee info for the primary registrant |
820 | - if ( $this->checkout->reg_url_link === $registration->reg_url_link() |
|
820 | + if ($this->checkout->reg_url_link === $registration->reg_url_link() |
|
821 | 821 | && $registration->is_primary_registrant() |
822 | 822 | ) { |
823 | 823 | $this->checkout->primary_revisit = true; |
824 | 824 | break; |
825 | - } else if ( $this->checkout->revisit |
|
825 | + } else if ($this->checkout->revisit |
|
826 | 826 | && $this->checkout->reg_url_link !== $registration->reg_url_link() |
827 | 827 | ) { |
828 | 828 | // but hide info if it doesn't belong to you |
829 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
829 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
830 | 830 | } |
831 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
831 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
832 | 832 | } |
833 | 833 | } |
834 | 834 | } |
@@ -843,17 +843,17 @@ discard block |
||
843 | 843 | * @return array |
844 | 844 | * @throws \EE_Error |
845 | 845 | */ |
846 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
846 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
847 | 847 | $att_nmbr = 0; |
848 | 848 | $registrations = array(); |
849 | - if ( $transaction instanceof EE_Transaction ) { |
|
849 | + if ($transaction instanceof EE_Transaction) { |
|
850 | 850 | /** @type EE_Registration_Processor $registration_processor */ |
851 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
851 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
852 | 852 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
853 | 853 | // now let's add the cart items to the $transaction |
854 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
854 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
855 | 855 | //do the following for each ticket of this type they selected |
856 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
856 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
857 | 857 | $att_nmbr++; |
858 | 858 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
859 | 859 | $line_item, |
@@ -861,12 +861,12 @@ discard block |
||
861 | 861 | $att_nmbr, |
862 | 862 | $this->checkout->total_ticket_count |
863 | 863 | ); |
864 | - if ( $registration instanceof EE_Registration ) { |
|
865 | - $registrations[ $registration->ID() ] = $registration; |
|
864 | + if ($registration instanceof EE_Registration) { |
|
865 | + $registrations[$registration->ID()] = $registration; |
|
866 | 866 | } |
867 | 867 | } |
868 | 868 | } |
869 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
869 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
870 | 870 | } |
871 | 871 | return $registrations; |
872 | 872 | } |
@@ -881,12 +881,12 @@ discard block |
||
881 | 881 | * @param EE_Registration $reg_B |
882 | 882 | * @return array() |
883 | 883 | */ |
884 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
884 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
885 | 885 | // this shouldn't ever happen within the same TXN, but oh well |
886 | - if ( $reg_A->count() === $reg_B->count() ) { |
|
886 | + if ($reg_A->count() === $reg_B->count()) { |
|
887 | 887 | return 0; |
888 | 888 | } |
889 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
889 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
890 | 890 | } |
891 | 891 | |
892 | 892 | |
@@ -901,21 +901,21 @@ discard block |
||
901 | 901 | */ |
902 | 902 | private function _final_verifications() { |
903 | 903 | // filter checkout |
904 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
904 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
905 | 905 | //verify that current step is still set correctly |
906 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
907 | - 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__ ); |
|
906 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
907 | + 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__); |
|
908 | 908 | return false; |
909 | 909 | } |
910 | 910 | // if returning to SPCO, then verify that primary registrant is set |
911 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
911 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
912 | 912 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
913 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
914 | - 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__ ); |
|
913 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
914 | + 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__); |
|
915 | 915 | return false; |
916 | 916 | } |
917 | 917 | $valid_registrant = null; |
918 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
918 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
919 | 919 | if ( |
920 | 920 | $registration instanceof EE_Registration |
921 | 921 | && $registration->reg_url_link() === $this->checkout->reg_url_link |
@@ -923,9 +923,9 @@ discard block |
||
923 | 923 | $valid_registrant = $registration; |
924 | 924 | } |
925 | 925 | } |
926 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
926 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
927 | 927 | // hmmm... maybe we have the wrong session because the user is opening multiple tabs ? |
928 | - if ( EED_Single_Page_Checkout::$_checkout_verified ) { |
|
928 | + if (EED_Single_Page_Checkout::$_checkout_verified) { |
|
929 | 929 | // clear the session, mark the checkout as unverified, and try again |
930 | 930 | EE_Registry::instance()->SSN->clear_session(); |
931 | 931 | EED_Single_Page_Checkout::$_initialized = false; |
@@ -934,13 +934,13 @@ discard block |
||
934 | 934 | EE_Error::reset_notices(); |
935 | 935 | return false; |
936 | 936 | } |
937 | - 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__ ); |
|
937 | + 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__); |
|
938 | 938 | return false; |
939 | 939 | } |
940 | 940 | } |
941 | 941 | // now that things have been kinda sufficiently verified, |
942 | 942 | // let's add the checkout to the session so that's available other systems |
943 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
943 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
944 | 944 | return true; |
945 | 945 | } |
946 | 946 | |
@@ -955,15 +955,15 @@ discard block |
||
955 | 955 | * @param bool $reinitializing |
956 | 956 | * @throws \EE_Error |
957 | 957 | */ |
958 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
959 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
958 | + private function _initialize_reg_steps($reinitializing = false) { |
|
959 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
960 | 960 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
961 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
962 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
961 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
962 | + if ( ! $reg_step->initialize_reg_step()) { |
|
963 | 963 | // if not initialized then maybe this step is being removed... |
964 | - if ( ! $reinitializing && $reg_step->is_current_step() ) { |
|
964 | + if ( ! $reinitializing && $reg_step->is_current_step()) { |
|
965 | 965 | // if it was the current step, then we need to start over here |
966 | - $this->_initialize_reg_steps( true ); |
|
966 | + $this->_initialize_reg_steps(true); |
|
967 | 967 | return; |
968 | 968 | } |
969 | 969 | continue; |
@@ -972,13 +972,13 @@ discard block |
||
972 | 972 | $reg_step->enqueue_styles_and_scripts(); |
973 | 973 | // i18n |
974 | 974 | $reg_step->translate_js_strings(); |
975 | - if ( $reg_step->is_current_step() ) { |
|
975 | + if ($reg_step->is_current_step()) { |
|
976 | 976 | // the text that appears on the reg step form submit button |
977 | 977 | $reg_step->set_submit_button_text(); |
978 | 978 | } |
979 | 979 | } |
980 | 980 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
981 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
981 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | |
@@ -991,43 +991,43 @@ discard block |
||
991 | 991 | */ |
992 | 992 | private function _check_form_submission() { |
993 | 993 | //does this request require the reg form to be generated ? |
994 | - if ( $this->checkout->generate_reg_form ) { |
|
994 | + if ($this->checkout->generate_reg_form) { |
|
995 | 995 | // ever heard that song by Blue Rodeo ? |
996 | 996 | try { |
997 | 997 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
998 | 998 | // if not displaying a form, then check for form submission |
999 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
999 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
1000 | 1000 | // clear out any old data in case this step is being run again |
1001 | - $this->checkout->current_step->set_valid_data( array() ); |
|
1001 | + $this->checkout->current_step->set_valid_data(array()); |
|
1002 | 1002 | // capture submitted form data |
1003 | 1003 | $this->checkout->current_step->reg_form->receive_form_submission( |
1004 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
1004 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
1005 | 1005 | ); |
1006 | 1006 | // validate submitted form data |
1007 | - if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid() ) { |
|
1007 | + if ( ! $this->checkout->continue_reg && ! $this->checkout->current_step->reg_form->is_valid()) { |
|
1008 | 1008 | // thou shall not pass !!! |
1009 | 1009 | $this->checkout->continue_reg = FALSE; |
1010 | 1010 | // any form validation errors? |
1011 | - if ( $this->checkout->current_step->reg_form->submission_error_message() !== '' ) { |
|
1011 | + if ($this->checkout->current_step->reg_form->submission_error_message() !== '') { |
|
1012 | 1012 | $submission_error_messages = array(); |
1013 | 1013 | // bad, bad, bad registrant |
1014 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
1015 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1014 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
1015 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1016 | 1016 | $submission_error_messages[] = sprintf( |
1017 | - __( '%s : %s', 'event_espresso' ), |
|
1017 | + __('%s : %s', 'event_espresso'), |
|
1018 | 1018 | $validation_error->get_form_section()->html_label_text(), |
1019 | 1019 | $validation_error->getMessage() |
1020 | 1020 | ); |
1021 | 1021 | } |
1022 | 1022 | } |
1023 | - EE_Error::add_error( implode( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1023 | + EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1024 | 1024 | } |
1025 | 1025 | // well not really... what will happen is we'll just get redirected back to redo the current step |
1026 | 1026 | $this->go_to_next_step(); |
1027 | 1027 | return; |
1028 | 1028 | } |
1029 | 1029 | } |
1030 | - } catch( EE_Error $e ) { |
|
1030 | + } catch (EE_Error $e) { |
|
1031 | 1031 | $e->get_error(); |
1032 | 1032 | } |
1033 | 1033 | } |
@@ -1044,22 +1044,22 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | private function _process_form_action() { |
1046 | 1046 | // what cha wanna do? |
1047 | - switch( $this->checkout->action ) { |
|
1047 | + switch ($this->checkout->action) { |
|
1048 | 1048 | // AJAX next step reg form |
1049 | 1049 | case 'display_spco_reg_step' : |
1050 | 1050 | $this->checkout->redirect = FALSE; |
1051 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1052 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1051 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1052 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1053 | 1053 | } |
1054 | 1054 | break; |
1055 | 1055 | |
1056 | 1056 | default : |
1057 | 1057 | // meh... do one of those other steps first |
1058 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1058 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1059 | 1059 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1060 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1060 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1061 | 1061 | // call action on current step |
1062 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1062 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1063 | 1063 | // good registrant, you get to proceed |
1064 | 1064 | if ( |
1065 | 1065 | $this->checkout->current_step->success_message() !== '' |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | ) { |
1071 | 1071 | EE_Error::add_success( |
1072 | 1072 | $this->checkout->current_step->success_message() |
1073 | - . '<br />' . $this->checkout->next_step->_instructions() |
|
1073 | + . '<br />'.$this->checkout->next_step->_instructions() |
|
1074 | 1074 | ); |
1075 | 1075 | |
1076 | 1076 | } |
@@ -1078,12 +1078,12 @@ discard block |
||
1078 | 1078 | $this->_setup_redirect(); |
1079 | 1079 | } |
1080 | 1080 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1081 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1081 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1082 | 1082 | |
1083 | 1083 | } else { |
1084 | 1084 | EE_Error::add_error( |
1085 | 1085 | sprintf( |
1086 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1086 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1087 | 1087 | $this->checkout->action, |
1088 | 1088 | $this->checkout->current_step->name() |
1089 | 1089 | ), |
@@ -1109,10 +1109,10 @@ discard block |
||
1109 | 1109 | public function add_styles_and_scripts() { |
1110 | 1110 | // i18n |
1111 | 1111 | $this->translate_js_strings(); |
1112 | - if ( $this->checkout->admin_request ) { |
|
1113 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1112 | + if ($this->checkout->admin_request) { |
|
1113 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1114 | 1114 | } else { |
1115 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1115 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1116 | 1116 | } |
1117 | 1117 | } |
1118 | 1118 | |
@@ -1128,42 +1128,42 @@ discard block |
||
1128 | 1128 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1129 | 1129 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1130 | 1130 | 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'); |
1131 | - 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' ); |
|
1132 | - 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' ); |
|
1133 | - 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' ); |
|
1131 | + 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'); |
|
1132 | + 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'); |
|
1133 | + 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'); |
|
1134 | 1134 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1135 | 1135 | 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'); |
1136 | - 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/>' ); |
|
1137 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1136 | + 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/>'); |
|
1137 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1138 | 1138 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1139 | 1139 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1140 | 1140 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1141 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1142 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1143 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1144 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1145 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1146 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1147 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1148 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1149 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1150 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1151 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1152 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1153 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1154 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1141 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1142 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1143 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1144 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1145 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1146 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1147 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1148 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1149 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1150 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1151 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1152 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1153 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1154 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1155 | 1155 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1156 | - __( '%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' ), |
|
1156 | + __('%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'), |
|
1157 | 1157 | '<h4 class="important-notice">', |
1158 | 1158 | '</h4>', |
1159 | 1159 | '<br />', |
1160 | 1160 | '<p>', |
1161 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1161 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1162 | 1162 | '">', |
1163 | 1163 | '</a>', |
1164 | 1164 | '</p>' |
1165 | 1165 | ); |
1166 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1166 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1176,25 +1176,25 @@ discard block |
||
1176 | 1176 | */ |
1177 | 1177 | public function enqueue_styles_and_scripts() { |
1178 | 1178 | // load css |
1179 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1180 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1179 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1180 | + wp_enqueue_style('single_page_checkout'); |
|
1181 | 1181 | // load JS |
1182 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1183 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1184 | - 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 ); |
|
1185 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1182 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1183 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1184 | + 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); |
|
1185 | + wp_enqueue_script('single_page_checkout'); |
|
1186 | 1186 | |
1187 | 1187 | /** |
1188 | 1188 | * global action hook for enqueueing styles and scripts with |
1189 | 1189 | * spco calls. |
1190 | 1190 | */ |
1191 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1191 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1192 | 1192 | |
1193 | 1193 | /** |
1194 | 1194 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1195 | 1195 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1196 | 1196 | */ |
1197 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1197 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1198 | 1198 | |
1199 | 1199 | } |
1200 | 1200 | |
@@ -1209,19 +1209,19 @@ discard block |
||
1209 | 1209 | */ |
1210 | 1210 | private function _display_spco_reg_form() { |
1211 | 1211 | // if registering via the admin, just display the reg form for the current step |
1212 | - if ( $this->checkout->admin_request ) { |
|
1213 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1212 | + if ($this->checkout->admin_request) { |
|
1213 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1214 | 1214 | } else { |
1215 | 1215 | // add powered by EE msg |
1216 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1216 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1217 | 1217 | |
1218 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1218 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1219 | 1219 | $cookies_not_set_msg = ''; |
1220 | - if ( $empty_cart && ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1220 | + if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) { |
|
1221 | 1221 | $cookies_not_set_msg = apply_filters( |
1222 | 1222 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1223 | 1223 | sprintf( |
1224 | - __( '%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' ), |
|
1224 | + __('%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'), |
|
1225 | 1225 | '<div class="ee-attention">', |
1226 | 1226 | '</div>', |
1227 | 1227 | '<h6 class="important-notice">', |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | 'layout_strategy' => |
1242 | 1242 | new EE_Template_Layout( |
1243 | 1243 | array( |
1244 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1244 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1245 | 1245 | 'template_args' => array( |
1246 | 1246 | 'empty_cart' => $empty_cart, |
1247 | 1247 | 'revisit' => $this->checkout->revisit, |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | 'empty_msg' => apply_filters( |
1251 | 1251 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1252 | 1252 | sprintf( |
1253 | - __( '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' ), |
|
1254 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1253 | + __('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'), |
|
1254 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1255 | 1255 | '">', |
1256 | 1256 | '</a>' |
1257 | 1257 | ) |
@@ -1259,14 +1259,14 @@ discard block |
||
1259 | 1259 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1260 | 1260 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1261 | 1261 | 'session_expiration' => |
1262 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1262 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1263 | 1263 | ) |
1264 | 1264 | ) |
1265 | 1265 | ) |
1266 | 1266 | ) |
1267 | 1267 | ); |
1268 | 1268 | // load template and add to output sent that gets filtered into the_content() |
1269 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1269 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1270 | 1270 | } |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1280,8 +1280,8 @@ discard block |
||
1280 | 1280 | * @internal param string $label |
1281 | 1281 | * @return string |
1282 | 1282 | */ |
1283 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1284 | - if ( $next_step === 'finalize_registration' ) { |
|
1283 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1284 | + if ($next_step === 'finalize_registration') { |
|
1285 | 1285 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1286 | 1286 | } |
1287 | 1287 | } |
@@ -1295,18 +1295,18 @@ discard block |
||
1295 | 1295 | * @return string |
1296 | 1296 | */ |
1297 | 1297 | public static function display_registration_footer() { |
1298 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1299 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1300 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1301 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1298 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1299 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1300 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1301 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1302 | 1302 | echo apply_filters( |
1303 | 1303 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1304 | 1304 | sprintf( |
1305 | - __( '%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' ), |
|
1306 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1305 | + __('%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'), |
|
1306 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1307 | 1307 | '" target="_blank">', |
1308 | 1308 | '</a>', |
1309 | - '<a href="' . $url . '" title="', |
|
1309 | + '<a href="'.$url.'" title="', |
|
1310 | 1310 | '" target="_blank">', |
1311 | 1311 | '</a></div>' |
1312 | 1312 | ) |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | * @throws \EE_Error |
1325 | 1325 | */ |
1326 | 1326 | public function unlock_transaction() { |
1327 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1327 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1328 | 1328 | $this->checkout->transaction->unlock(); |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1339,12 +1339,12 @@ discard block |
||
1339 | 1339 | * @return array |
1340 | 1340 | */ |
1341 | 1341 | private function _setup_redirect() { |
1342 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1342 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1343 | 1343 | $this->checkout->redirect = TRUE; |
1344 | - if ( empty( $this->checkout->redirect_url )) { |
|
1344 | + if (empty($this->checkout->redirect_url)) { |
|
1345 | 1345 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1346 | 1346 | } |
1347 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1347 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1348 | 1348 | } |
1349 | 1349 | } |
1350 | 1350 | |
@@ -1358,9 +1358,9 @@ discard block |
||
1358 | 1358 | * @throws \EE_Error |
1359 | 1359 | */ |
1360 | 1360 | public function go_to_next_step() { |
1361 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1361 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1362 | 1362 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1363 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1363 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1364 | 1364 | } |
1365 | 1365 | $this->unlock_transaction(); |
1366 | 1366 | // just return for these conditions |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | */ |
1390 | 1390 | protected function _handle_json_response() { |
1391 | 1391 | // if this is an ajax request |
1392 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1392 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1393 | 1393 | // DEBUG LOG |
1394 | 1394 | //$this->checkout->log( |
1395 | 1395 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1402,7 +1402,7 @@ discard block |
||
1402 | 1402 | $this->checkout->json_response->set_registration_time_limit( |
1403 | 1403 | $this->checkout->get_registration_time_limit() |
1404 | 1404 | ); |
1405 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1405 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1406 | 1406 | // just send the ajax ( |
1407 | 1407 | $json_response = apply_filters( |
1408 | 1408 | 'FHEE__EE_Single_Page_Checkout__JSON_response', |
@@ -1423,9 +1423,9 @@ discard block |
||
1423 | 1423 | */ |
1424 | 1424 | protected function _handle_html_redirects() { |
1425 | 1425 | // going somewhere ? |
1426 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1426 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1427 | 1427 | // store notices in a transient |
1428 | - EE_Error::get_notices( false, true, true ); |
|
1428 | + EE_Error::get_notices(false, true, true); |
|
1429 | 1429 | // DEBUG LOG |
1430 | 1430 | //$this->checkout->log( |
1431 | 1431 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | // 'headers_list' => headers_list(), |
1436 | 1436 | // ) |
1437 | 1437 | //); |
1438 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1438 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1439 | 1439 | exit(); |
1440 | 1440 | } |
1441 | 1441 | } |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | * @param \EE_Dependency_Map $dependency_map |
179 | 179 | * @return \EE_Registry instance |
180 | 180 | */ |
181 | - public static function instance( \EE_Dependency_Map $dependency_map = null ) { |
|
181 | + public static function instance(\EE_Dependency_Map $dependency_map = null) { |
|
182 | 182 | // check if class object is instantiated |
183 | - if ( ! self::$_instance instanceof EE_Registry ) { |
|
184 | - self::$_instance = new EE_Registry( $dependency_map ); |
|
183 | + if ( ! self::$_instance instanceof EE_Registry) { |
|
184 | + self::$_instance = new EE_Registry($dependency_map); |
|
185 | 185 | } |
186 | 186 | return self::$_instance; |
187 | 187 | } |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @param \EE_Dependency_Map $dependency_map |
197 | 197 | * @return \EE_Registry |
198 | 198 | */ |
199 | - protected function __construct( \EE_Dependency_Map $dependency_map ) { |
|
199 | + protected function __construct(\EE_Dependency_Map $dependency_map) { |
|
200 | 200 | $this->_dependency_map = $dependency_map; |
201 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
201 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -225,19 +225,19 @@ discard block |
||
225 | 225 | $this->modules = new StdClass(); |
226 | 226 | $this->shortcodes = new StdClass(); |
227 | 227 | $this->widgets = new StdClass(); |
228 | - $this->load_core( 'Base', array(), true ); |
|
228 | + $this->load_core('Base', array(), true); |
|
229 | 229 | // add our request and response objects to the cache |
230 | - $request_loader = $this->_dependency_map->class_loader( 'EE_Request' ); |
|
230 | + $request_loader = $this->_dependency_map->class_loader('EE_Request'); |
|
231 | 231 | $this->_set_cached_class( |
232 | 232 | $request_loader(), |
233 | 233 | 'EE_Request' |
234 | 234 | ); |
235 | - $response_loader = $this->_dependency_map->class_loader( 'EE_Response' ); |
|
235 | + $response_loader = $this->_dependency_map->class_loader('EE_Response'); |
|
236 | 236 | $this->_set_cached_class( |
237 | 237 | $response_loader(), |
238 | 238 | 'EE_Response' |
239 | 239 | ); |
240 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) ); |
|
240 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init')); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function init() { |
252 | 252 | // Get current page protocol |
253 | - $protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://'; |
|
253 | + $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; |
|
254 | 254 | // Output admin-ajax.php URL with same protocol as current page |
255 | - self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol ); |
|
256 | - self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false; |
|
255 | + self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol); |
|
256 | + self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false; |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * @return string |
265 | 265 | */ |
266 | 266 | public static function localize_i18n_js_strings() { |
267 | - $i18n_js_strings = (array)EE_Registry::$i18n_js_strings; |
|
268 | - foreach ( $i18n_js_strings as $key => $value ) { |
|
269 | - if ( is_scalar( $value ) ) { |
|
270 | - $i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' ); |
|
267 | + $i18n_js_strings = (array) EE_Registry::$i18n_js_strings; |
|
268 | + foreach ($i18n_js_strings as $key => $value) { |
|
269 | + if (is_scalar($value)) { |
|
270 | + $i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | - return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */'; |
|
274 | + return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -279,15 +279,15 @@ discard block |
||
279 | 279 | /** |
280 | 280 | * @param mixed string | EED_Module $module |
281 | 281 | */ |
282 | - public function add_module( $module ) { |
|
283 | - if ( $module instanceof EED_Module ) { |
|
284 | - $module_class = get_class( $module ); |
|
282 | + public function add_module($module) { |
|
283 | + if ($module instanceof EED_Module) { |
|
284 | + $module_class = get_class($module); |
|
285 | 285 | $this->modules->{$module_class} = $module; |
286 | 286 | } else { |
287 | - if ( ! class_exists( 'EE_Module_Request_Router' ) ) { |
|
288 | - $this->load_core( 'Module_Request_Router' ); |
|
287 | + if ( ! class_exists('EE_Module_Request_Router')) { |
|
288 | + $this->load_core('Module_Request_Router'); |
|
289 | 289 | } |
290 | - $this->modules->{$module} = EE_Module_Request_Router::module_factory( $module ); |
|
290 | + $this->modules->{$module} = EE_Module_Request_Router::module_factory($module); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @param string $module_name |
298 | 298 | * @return mixed EED_Module | NULL |
299 | 299 | */ |
300 | - public function get_module( $module_name = '' ) { |
|
301 | - return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
300 | + public function get_module($module_name = '') { |
|
301 | + return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -312,20 +312,20 @@ discard block |
||
312 | 312 | * @param bool $load_only |
313 | 313 | * @return mixed |
314 | 314 | */ |
315 | - public function load_core( $class_name, $arguments = array(), $load_only = false ) { |
|
315 | + public function load_core($class_name, $arguments = array(), $load_only = false) { |
|
316 | 316 | $core_paths = apply_filters( |
317 | 317 | 'FHEE__EE_Registry__load_core__core_paths', |
318 | 318 | array( |
319 | 319 | EE_CORE, |
320 | 320 | EE_ADMIN, |
321 | 321 | EE_CPTS, |
322 | - EE_CORE . 'data_migration_scripts' . DS, |
|
323 | - EE_CORE . 'request_stack' . DS, |
|
324 | - EE_CORE . 'middleware' . DS, |
|
322 | + EE_CORE.'data_migration_scripts'.DS, |
|
323 | + EE_CORE.'request_stack'.DS, |
|
324 | + EE_CORE.'middleware'.DS, |
|
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | // retrieve instantiated class |
328 | - return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only ); |
|
328 | + return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -339,15 +339,15 @@ discard block |
||
339 | 339 | * @param bool $load_only |
340 | 340 | * @return mixed |
341 | 341 | */ |
342 | - public function load_service( $class_name, $arguments = array(), $load_only = false ) { |
|
342 | + public function load_service($class_name, $arguments = array(), $load_only = false) { |
|
343 | 343 | $service_paths = apply_filters( |
344 | 344 | 'FHEE__EE_Registry__load_service__service_paths', |
345 | 345 | array( |
346 | - EE_CORE . 'services' . DS, |
|
346 | + EE_CORE.'services'.DS, |
|
347 | 347 | ) |
348 | 348 | ); |
349 | 349 | // retrieve instantiated class |
350 | - return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only ); |
|
350 | + return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * @param mixed $arguments |
361 | 361 | * @return EE_Data_Migration_Script_Base |
362 | 362 | */ |
363 | - public function load_dms( $class_name, $arguments = array() ) { |
|
363 | + public function load_dms($class_name, $arguments = array()) { |
|
364 | 364 | // retrieve instantiated class |
365 | - return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false ); |
|
365 | + return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default) |
378 | 378 | * @return EE_Base_Class | bool |
379 | 379 | */ |
380 | - public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) { |
|
381 | - $paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array( |
|
380 | + public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) { |
|
381 | + $paths = apply_filters('FHEE__EE_Registry__load_class__paths', array( |
|
382 | 382 | EE_CORE, |
383 | 383 | EE_CLASSES, |
384 | 384 | EE_BUSINESS |
385 | - ) ); |
|
385 | + )); |
|
386 | 386 | // retrieve instantiated class |
387 | - return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only ); |
|
387 | + return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | * @param bool $load_only |
398 | 398 | * @return EEH_Base | bool |
399 | 399 | */ |
400 | - public function load_helper( $class_name, $arguments = array(), $load_only = true ) { |
|
400 | + public function load_helper($class_name, $arguments = array(), $load_only = true) { |
|
401 | 401 | // todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed |
402 | - $helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) ); |
|
402 | + $helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS)); |
|
403 | 403 | // retrieve instantiated class |
404 | - return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only ); |
|
404 | + return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
@@ -416,16 +416,16 @@ discard block |
||
416 | 416 | * @param bool $cache whether to cache the object or not. |
417 | 417 | * @return mixed |
418 | 418 | */ |
419 | - public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) { |
|
419 | + public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) { |
|
420 | 420 | $paths = array( |
421 | 421 | EE_LIBRARIES, |
422 | - EE_LIBRARIES . 'messages' . DS, |
|
423 | - EE_LIBRARIES . 'shortcodes' . DS, |
|
424 | - EE_LIBRARIES . 'qtips' . DS, |
|
425 | - EE_LIBRARIES . 'payment_methods' . DS, |
|
422 | + EE_LIBRARIES.'messages'.DS, |
|
423 | + EE_LIBRARIES.'shortcodes'.DS, |
|
424 | + EE_LIBRARIES.'qtips'.DS, |
|
425 | + EE_LIBRARIES.'payment_methods'.DS, |
|
426 | 426 | ); |
427 | 427 | // retrieve instantiated class |
428 | - return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only ); |
|
428 | + return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | |
@@ -438,13 +438,13 @@ discard block |
||
438 | 438 | * @param bool $load_only |
439 | 439 | * @return EEM_Base | bool |
440 | 440 | */ |
441 | - public function load_model( $class_name, $arguments = array(), $load_only = false ) { |
|
442 | - $paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array( |
|
441 | + public function load_model($class_name, $arguments = array(), $load_only = false) { |
|
442 | + $paths = apply_filters('FHEE__EE_Registry__load_model__paths', array( |
|
443 | 443 | EE_MODELS, |
444 | 444 | EE_CORE |
445 | - ) ); |
|
445 | + )); |
|
446 | 446 | // retrieve instantiated class |
447 | - return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only ); |
|
447 | + return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | * @param bool $load_only |
458 | 458 | * @return mixed | bool |
459 | 459 | */ |
460 | - public function load_model_class( $class_name, $arguments = array(), $load_only = true ) { |
|
460 | + public function load_model_class($class_name, $arguments = array(), $load_only = true) { |
|
461 | 461 | $paths = array( |
462 | - EE_MODELS . 'fields' . DS, |
|
463 | - EE_MODELS . 'helpers' . DS, |
|
464 | - EE_MODELS . 'relations' . DS, |
|
465 | - EE_MODELS . 'strategies' . DS |
|
462 | + EE_MODELS.'fields'.DS, |
|
463 | + EE_MODELS.'helpers'.DS, |
|
464 | + EE_MODELS.'relations'.DS, |
|
465 | + EE_MODELS.'strategies'.DS |
|
466 | 466 | ); |
467 | 467 | // retrieve instantiated class |
468 | - return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only ); |
|
468 | + return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | * @param string $model_name like Event, Attendee, Question_Group_Question, etc. |
476 | 476 | * @return boolean |
477 | 477 | */ |
478 | - public function is_model_name( $model_name ) { |
|
479 | - return isset( $this->models[ $model_name ] ) ? true : false; |
|
478 | + public function is_model_name($model_name) { |
|
479 | + return isset($this->models[$model_name]) ? true : false; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | * @param bool $load_only |
492 | 492 | * @return mixed |
493 | 493 | */ |
494 | - public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) { |
|
494 | + public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) { |
|
495 | 495 | // retrieve instantiated class |
496 | - return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only ); |
|
496 | + return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | * @param bool $load_only |
509 | 509 | * @return EE_Addon |
510 | 510 | */ |
511 | - public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) { |
|
511 | + public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) { |
|
512 | 512 | // retrieve instantiated class |
513 | - return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only ); |
|
513 | + return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -541,46 +541,46 @@ discard block |
||
541 | 541 | $load_only = false |
542 | 542 | ) { |
543 | 543 | // strip php file extension |
544 | - $class_name = str_replace( '.php', '', trim( $class_name ) ); |
|
544 | + $class_name = str_replace('.php', '', trim($class_name)); |
|
545 | 545 | // does the class have a prefix ? |
546 | - if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) { |
|
546 | + if ( ! empty($class_prefix) && $class_prefix != 'addon') { |
|
547 | 547 | // make sure $class_prefix is uppercase |
548 | - $class_prefix = strtoupper( trim( $class_prefix ) ); |
|
548 | + $class_prefix = strtoupper(trim($class_prefix)); |
|
549 | 549 | // add class prefix ONCE!!! |
550 | - $class_name = $class_prefix . str_replace( $class_prefix, '', $class_name ); |
|
550 | + $class_name = $class_prefix.str_replace($class_prefix, '', $class_name); |
|
551 | 551 | } |
552 | - $class_exists = class_exists( $class_name ); |
|
552 | + $class_exists = class_exists($class_name); |
|
553 | 553 | // if we're only loading the class and it already exists, then let's just return true immediately |
554 | - if ( $load_only && $class_exists ) { |
|
554 | + if ($load_only && $class_exists) { |
|
555 | 555 | return true; |
556 | 556 | } |
557 | 557 | // $this->_cache_on is toggled during the recursive loading that can occur with dependency injection |
558 | 558 | // $cache is controlled by individual calls to separate Registry loader methods like load_class() |
559 | 559 | // $load_only is also controlled by individual calls to separate Registry loader methods like load_file() |
560 | - if ( $this->_cache_on && $cache && ! $load_only ) { |
|
560 | + if ($this->_cache_on && $cache && ! $load_only) { |
|
561 | 561 | // return object if it's already cached |
562 | - $cached_class = $this->_get_cached_class( $class_name, $class_prefix ); |
|
563 | - if ( $cached_class !== null ) { |
|
562 | + $cached_class = $this->_get_cached_class($class_name, $class_prefix); |
|
563 | + if ($cached_class !== null) { |
|
564 | 564 | return $cached_class; |
565 | 565 | } |
566 | 566 | } |
567 | 567 | // if the class doesn't already exist.. then we need to try and find the file and load it |
568 | - if ( ! $class_exists ) { |
|
568 | + if ( ! $class_exists) { |
|
569 | 569 | // get full path to file |
570 | - $path = $this->_resolve_path( $class_name, $type, $file_paths ); |
|
570 | + $path = $this->_resolve_path($class_name, $type, $file_paths); |
|
571 | 571 | // load the file |
572 | - $loaded = $this->_require_file( $path, $class_name, $type, $file_paths ); |
|
572 | + $loaded = $this->_require_file($path, $class_name, $type, $file_paths); |
|
573 | 573 | // if loading failed, or we are only loading a file but NOT instantiating an object |
574 | - if ( ! $loaded || $load_only ) { |
|
574 | + if ( ! $loaded || $load_only) { |
|
575 | 575 | // return boolean if only loading, or null if an object was expected |
576 | 576 | return $load_only ? $loaded : null; |
577 | 577 | } |
578 | 578 | } |
579 | 579 | // instantiate the requested object |
580 | - $class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db ); |
|
581 | - if ( $this->_cache_on && $cache ) { |
|
580 | + $class_obj = $this->_create_object($class_name, $arguments, $type, $from_db); |
|
581 | + if ($this->_cache_on && $cache) { |
|
582 | 582 | // save it for later... kinda like gum { : $ |
583 | - $this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db ); |
|
583 | + $this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db); |
|
584 | 584 | } |
585 | 585 | $this->_cache_on = true; |
586 | 586 | return $class_obj; |
@@ -603,21 +603,21 @@ discard block |
||
603 | 603 | * @param string $class_prefix |
604 | 604 | * @return null|object |
605 | 605 | */ |
606 | - protected function _get_cached_class( $class_name, $class_prefix = '' ) { |
|
607 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
608 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
606 | + protected function _get_cached_class($class_name, $class_prefix = '') { |
|
607 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
608 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
609 | 609 | } else { |
610 | 610 | // have to specify something, but not anything that will conflict |
611 | 611 | $class_abbreviation = 'FANCY_BATMAN_PANTS'; |
612 | 612 | } |
613 | 613 | // check if class has already been loaded, and return it if it has been |
614 | - if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) { |
|
614 | + if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) { |
|
615 | 615 | return $this->{$class_abbreviation}; |
616 | - } else if ( isset ( $this->{$class_name} ) ) { |
|
616 | + } else if (isset ($this->{$class_name} )) { |
|
617 | 617 | return $this->{$class_name}; |
618 | - } else if ( isset ( $this->LIB->{$class_name} ) ) { |
|
618 | + } else if (isset ($this->LIB->{$class_name} )) { |
|
619 | 619 | return $this->LIB->{$class_name}; |
620 | - } else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) { |
|
620 | + } else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) { |
|
621 | 621 | return $this->addons->{$class_name}; |
622 | 622 | } |
623 | 623 | return null; |
@@ -638,20 +638,20 @@ discard block |
||
638 | 638 | * @param array $file_paths |
639 | 639 | * @return string | bool |
640 | 640 | */ |
641 | - protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) { |
|
641 | + protected function _resolve_path($class_name, $type = '', $file_paths = array()) { |
|
642 | 642 | // make sure $file_paths is an array |
643 | - $file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths ); |
|
643 | + $file_paths = is_array($file_paths) ? $file_paths : array($file_paths); |
|
644 | 644 | // cycle thru paths |
645 | - foreach ( $file_paths as $key => $file_path ) { |
|
645 | + foreach ($file_paths as $key => $file_path) { |
|
646 | 646 | // convert all separators to proper DS, if no filepath, then use EE_CLASSES |
647 | - $file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES; |
|
647 | + $file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES; |
|
648 | 648 | // prep file type |
649 | - $type = ! empty( $type ) ? trim( $type, '.' ) . '.' : ''; |
|
649 | + $type = ! empty($type) ? trim($type, '.').'.' : ''; |
|
650 | 650 | // build full file path |
651 | - $file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php'; |
|
651 | + $file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php'; |
|
652 | 652 | //does the file exist and can be read ? |
653 | - if ( is_readable( $file_paths[ $key ] ) ) { |
|
654 | - return $file_paths[ $key ]; |
|
653 | + if (is_readable($file_paths[$key])) { |
|
654 | + return $file_paths[$key]; |
|
655 | 655 | } |
656 | 656 | } |
657 | 657 | return false; |
@@ -673,29 +673,29 @@ discard block |
||
673 | 673 | * @return boolean |
674 | 674 | * @throws \EE_Error |
675 | 675 | */ |
676 | - protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) { |
|
676 | + protected function _require_file($path, $class_name, $type = '', $file_paths = array()) { |
|
677 | 677 | // don't give up! you gotta... |
678 | 678 | try { |
679 | 679 | //does the file exist and can it be read ? |
680 | - if ( ! $path ) { |
|
680 | + if ( ! $path) { |
|
681 | 681 | // so sorry, can't find the file |
682 | - throw new EE_Error ( |
|
682 | + throw new EE_Error( |
|
683 | 683 | sprintf( |
684 | - __( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ), |
|
685 | - trim( $type, '.' ), |
|
684 | + __('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'), |
|
685 | + trim($type, '.'), |
|
686 | 686 | $class_name, |
687 | - '<br />' . implode( ',<br />', $file_paths ) |
|
687 | + '<br />'.implode(',<br />', $file_paths) |
|
688 | 688 | ) |
689 | 689 | ); |
690 | 690 | } |
691 | 691 | // get the file |
692 | - require_once( $path ); |
|
692 | + require_once($path); |
|
693 | 693 | // if the class isn't already declared somewhere |
694 | - if ( class_exists( $class_name, false ) === false ) { |
|
694 | + if (class_exists($class_name, false) === false) { |
|
695 | 695 | // so sorry, not a class |
696 | 696 | throw new EE_Error( |
697 | 697 | sprintf( |
698 | - __( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ), |
|
698 | + __('The %s file %s does not appear to contain the %s Class.', 'event_espresso'), |
|
699 | 699 | $type, |
700 | 700 | $path, |
701 | 701 | $class_name |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | ); |
704 | 704 | } |
705 | 705 | |
706 | - } catch ( EE_Error $e ) { |
|
706 | + } catch (EE_Error $e) { |
|
707 | 707 | $e->get_error(); |
708 | 708 | return false; |
709 | 709 | } |
@@ -735,55 +735,55 @@ discard block |
||
735 | 735 | * @return null | object |
736 | 736 | * @throws \EE_Error |
737 | 737 | */ |
738 | - protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) { |
|
738 | + protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) { |
|
739 | 739 | $class_obj = null; |
740 | 740 | // don't give up! you gotta... |
741 | 741 | try { |
742 | 742 | // create reflection |
743 | - $reflector = $this->get_ReflectionClass( $class_name ); |
|
743 | + $reflector = $this->get_ReflectionClass($class_name); |
|
744 | 744 | // make sure arguments are an array |
745 | - $arguments = is_array( $arguments ) ? $arguments : array( $arguments ); |
|
745 | + $arguments = is_array($arguments) ? $arguments : array($arguments); |
|
746 | 746 | // and if arguments array is numerically and sequentially indexed, then we want it to remain as is, |
747 | 747 | // else wrap it in an additional array so that it doesn't get split into multiple parameters |
748 | - $arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments ) |
|
748 | + $arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments) |
|
749 | 749 | ? $arguments |
750 | - : array( $arguments ); |
|
750 | + : array($arguments); |
|
751 | 751 | // attempt to inject dependencies ? |
752 | - if ( $this->_dependency_map->has( $class_name ) ) { |
|
753 | - $arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments ); |
|
752 | + if ($this->_dependency_map->has($class_name)) { |
|
753 | + $arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments); |
|
754 | 754 | } |
755 | 755 | // instantiate the class and add to the LIB array for tracking |
756 | 756 | // EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db) |
757 | - if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) { |
|
757 | + if ($reflector->getConstructor() === null || $reflector->isAbstract()) { |
|
758 | 758 | // no constructor = static methods only... nothing to instantiate, loading file was enough |
759 | 759 | //$instantiation_mode = "no constructor"; |
760 | 760 | $class_obj = true; |
761 | - } else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) { |
|
761 | + } else if ($from_db && method_exists($class_name, 'new_instance_from_db')) { |
|
762 | 762 | //$instantiation_mode = "new_instance_from_db"; |
763 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments ); |
|
764 | - } else if ( method_exists( $class_name, 'new_instance' ) ) { |
|
763 | + $class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments); |
|
764 | + } else if (method_exists($class_name, 'new_instance')) { |
|
765 | 765 | //$instantiation_mode = "new_instance"; |
766 | - $class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments ); |
|
767 | - } else if ( method_exists( $class_name, 'instance' ) ) { |
|
766 | + $class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments); |
|
767 | + } else if (method_exists($class_name, 'instance')) { |
|
768 | 768 | //$instantiation_mode = "instance"; |
769 | - $class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments ); |
|
770 | - } else if ( $reflector->isInstantiable() ) { |
|
769 | + $class_obj = call_user_func_array(array($class_name, 'instance'), $arguments); |
|
770 | + } else if ($reflector->isInstantiable()) { |
|
771 | 771 | //$instantiation_mode = "isInstantiable"; |
772 | - $class_obj = $reflector->newInstanceArgs( $arguments ); |
|
772 | + $class_obj = $reflector->newInstanceArgs($arguments); |
|
773 | 773 | } else { |
774 | 774 | // heh ? something's not right ! |
775 | 775 | //$instantiation_mode = 'none'; |
776 | 776 | throw new EE_Error( |
777 | 777 | sprintf( |
778 | - __( 'The %s file %s could not be instantiated.', 'event_espresso' ), |
|
778 | + __('The %s file %s could not be instantiated.', 'event_espresso'), |
|
779 | 779 | $type, |
780 | 780 | $class_name |
781 | 781 | ) |
782 | 782 | ); |
783 | 783 | } |
784 | - } catch ( Exception $e ) { |
|
785 | - if ( ! $e instanceof EE_Error ) { |
|
786 | - $e = new EE_Error( $e->getMessage() ); |
|
784 | + } catch (Exception $e) { |
|
785 | + if ( ! $e instanceof EE_Error) { |
|
786 | + $e = new EE_Error($e->getMessage()); |
|
787 | 787 | } |
788 | 788 | $e->get_error(); |
789 | 789 | } |
@@ -797,8 +797,8 @@ discard block |
||
797 | 797 | * @param array $array |
798 | 798 | * @return bool |
799 | 799 | */ |
800 | - protected function _array_is_numerically_and_sequentially_indexed( array $array ) { |
|
801 | - return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true; |
|
800 | + protected function _array_is_numerically_and_sequentially_indexed(array $array) { |
|
801 | + return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | |
@@ -813,14 +813,14 @@ discard block |
||
813 | 813 | * @param string $class_name |
814 | 814 | * @return ReflectionClass |
815 | 815 | */ |
816 | - public function get_ReflectionClass( $class_name ) { |
|
816 | + public function get_ReflectionClass($class_name) { |
|
817 | 817 | if ( |
818 | - ! isset( $this->_reflectors[ $class_name ] ) |
|
819 | - || ! $this->_reflectors[ $class_name ] instanceof ReflectionClass |
|
818 | + ! isset($this->_reflectors[$class_name]) |
|
819 | + || ! $this->_reflectors[$class_name] instanceof ReflectionClass |
|
820 | 820 | ) { |
821 | - $this->_reflectors[ $class_name ] = new ReflectionClass( $class_name ); |
|
821 | + $this->_reflectors[$class_name] = new ReflectionClass($class_name); |
|
822 | 822 | } |
823 | - return $this->_reflectors[ $class_name ]; |
|
823 | + return $this->_reflectors[$class_name]; |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -845,45 +845,45 @@ discard block |
||
845 | 845 | * @param array $arguments |
846 | 846 | * @return array |
847 | 847 | */ |
848 | - protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) { |
|
848 | + protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) { |
|
849 | 849 | // let's examine the constructor |
850 | 850 | $constructor = $reflector->getConstructor(); |
851 | 851 | // whu? huh? nothing? |
852 | - if ( ! $constructor ) { |
|
852 | + if ( ! $constructor) { |
|
853 | 853 | return $arguments; |
854 | 854 | } |
855 | 855 | // get constructor parameters |
856 | 856 | $params = $constructor->getParameters(); |
857 | 857 | // and the keys for the incoming arguments array so that we can compare existing arguments with what is expected |
858 | - $argument_keys = array_keys( $arguments ); |
|
858 | + $argument_keys = array_keys($arguments); |
|
859 | 859 | // now loop thru all of the constructors expected parameters |
860 | - foreach ( $params as $index => $param ) { |
|
860 | + foreach ($params as $index => $param) { |
|
861 | 861 | // is this a dependency for a specific class ? |
862 | 862 | $param_class = $param->getClass() ? $param->getClass()->name : null; |
863 | 863 | if ( |
864 | 864 | // param is not even a class |
865 | - empty( $param_class ) |
|
865 | + empty($param_class) |
|
866 | 866 | // and something already exists in the incoming arguments for this param |
867 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
867 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
868 | 868 | ) { |
869 | 869 | // so let's skip this argument and move on to the next |
870 | 870 | continue; |
871 | 871 | } else if ( |
872 | 872 | // parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class |
873 | - ! empty( $param_class ) |
|
874 | - && isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] ) |
|
875 | - && $arguments[ $argument_keys[ $index ] ] instanceof $param_class |
|
873 | + ! empty($param_class) |
|
874 | + && isset($argument_keys[$index], $arguments[$argument_keys[$index]]) |
|
875 | + && $arguments[$argument_keys[$index]] instanceof $param_class |
|
876 | 876 | ) { |
877 | 877 | // skip this argument and move on to the next |
878 | 878 | continue; |
879 | 879 | } else if ( |
880 | 880 | // parameter is type hinted as a class, and should be injected |
881 | - ! empty( $param_class ) |
|
882 | - && $this->_dependency_map->has_dependency_for_class( $class_name, $param_class ) |
|
881 | + ! empty($param_class) |
|
882 | + && $this->_dependency_map->has_dependency_for_class($class_name, $param_class) |
|
883 | 883 | ) { |
884 | - $arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index ); |
|
884 | + $arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index); |
|
885 | 885 | } else { |
886 | - $arguments[ $index ] = $param->getDefaultValue(); |
|
886 | + $arguments[$index] = $param->getDefaultValue(); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | } |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | * @param mixed $index |
901 | 901 | * @return array |
902 | 902 | */ |
903 | - protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) { |
|
903 | + protected function _resolve_dependency($class_name, $param_class, $arguments, $index) { |
|
904 | 904 | $dependency = null; |
905 | 905 | // should dependency be loaded from cache ? |
906 | 906 | $cache_on = $this->_dependency_map->loading_strategy_for_class_dependency( |
@@ -910,30 +910,30 @@ discard block |
||
910 | 910 | : false; |
911 | 911 | // we might have a dependency... |
912 | 912 | // let's MAYBE try and find it in our cache if that's what's been requested |
913 | - $cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null; |
|
913 | + $cached_class = $cache_on ? $this->_get_cached_class($param_class) : null; |
|
914 | 914 | // and grab it if it exists |
915 | - if ( $cached_class instanceof $param_class ) { |
|
915 | + if ($cached_class instanceof $param_class) { |
|
916 | 916 | $dependency = $cached_class; |
917 | - } else if ( $param_class != $class_name ) { |
|
917 | + } else if ($param_class != $class_name) { |
|
918 | 918 | // obtain the loader method from the dependency map |
919 | - $loader = $this->_dependency_map->class_loader( $param_class ); |
|
919 | + $loader = $this->_dependency_map->class_loader($param_class); |
|
920 | 920 | // is loader a custom closure ? |
921 | - if ( $loader instanceof Closure ) { |
|
921 | + if ($loader instanceof Closure) { |
|
922 | 922 | $dependency = $loader(); |
923 | 923 | } else { |
924 | 924 | // set the cache on property for the recursive loading call |
925 | 925 | $this->_cache_on = $cache_on; |
926 | 926 | // if not, then let's try and load it via the registry |
927 | - $dependency = $this->{$loader}( $param_class ); |
|
927 | + $dependency = $this->{$loader}($param_class); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | // did we successfully find the correct dependency ? |
931 | - if ( $dependency instanceof $param_class ) { |
|
931 | + if ($dependency instanceof $param_class) { |
|
932 | 932 | // then let's inject it into the incoming array of arguments at the correct location |
933 | - if ( isset( $argument_keys[ $index ] ) ) { |
|
934 | - $arguments[ $argument_keys[ $index ] ] = $dependency; |
|
933 | + if (isset($argument_keys[$index])) { |
|
934 | + $arguments[$argument_keys[$index]] = $dependency; |
|
935 | 935 | } else { |
936 | - $arguments[ $index ] = $dependency; |
|
936 | + $arguments[$index] = $dependency; |
|
937 | 937 | } |
938 | 938 | } |
939 | 939 | return $arguments; |
@@ -958,16 +958,16 @@ discard block |
||
958 | 958 | * @param bool $from_db |
959 | 959 | * @return void |
960 | 960 | */ |
961 | - protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) { |
|
961 | + protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) { |
|
962 | 962 | // return newly instantiated class |
963 | - if ( isset( $this->_class_abbreviations[ $class_name ] ) ) { |
|
964 | - $class_abbreviation = $this->_class_abbreviations[ $class_name ]; |
|
963 | + if (isset($this->_class_abbreviations[$class_name])) { |
|
964 | + $class_abbreviation = $this->_class_abbreviations[$class_name]; |
|
965 | 965 | $this->{$class_abbreviation} = $class_obj; |
966 | - } else if ( property_exists( $this, $class_name ) ) { |
|
966 | + } else if (property_exists($this, $class_name)) { |
|
967 | 967 | $this->{$class_name} = $class_obj; |
968 | - } else if ( $class_prefix == 'addon' ) { |
|
968 | + } else if ($class_prefix == 'addon') { |
|
969 | 969 | $this->addons->{$class_name} = $class_obj; |
970 | - } else if ( ! $from_db ) { |
|
970 | + } else if ( ! $from_db) { |
|
971 | 971 | $this->LIB->{$class_name} = $class_obj; |
972 | 972 | } |
973 | 973 | } |
@@ -984,12 +984,12 @@ discard block |
||
984 | 984 | * @param array $arguments |
985 | 985 | * @return object |
986 | 986 | */ |
987 | - public static function factory( $classname, $arguments = array() ) { |
|
988 | - $loader = self::instance()->_dependency_map->class_loader( $classname ); |
|
989 | - if ( $loader instanceof Closure ) { |
|
990 | - return $loader( $arguments ); |
|
991 | - } else if ( method_exists( EE_Registry::instance(), $loader ) ) { |
|
992 | - return EE_Registry::instance()->{$loader}( $classname, $arguments ); |
|
987 | + public static function factory($classname, $arguments = array()) { |
|
988 | + $loader = self::instance()->_dependency_map->class_loader($classname); |
|
989 | + if ($loader instanceof Closure) { |
|
990 | + return $loader($arguments); |
|
991 | + } else if (method_exists(EE_Registry::instance(), $loader)) { |
|
992 | + return EE_Registry::instance()->{$loader}($classname, $arguments); |
|
993 | 993 | } |
994 | 994 | return null; |
995 | 995 | } |
@@ -1002,9 +1002,9 @@ discard block |
||
1002 | 1002 | * @param string $name |
1003 | 1003 | * @return EE_Addon |
1004 | 1004 | */ |
1005 | - public function get_addon_by_name( $name ) { |
|
1006 | - foreach ( $this->addons as $addon ) { |
|
1007 | - if ( $addon->name() == $name ) { |
|
1005 | + public function get_addon_by_name($name) { |
|
1006 | + foreach ($this->addons as $addon) { |
|
1007 | + if ($addon->name() == $name) { |
|
1008 | 1008 | return $addon; |
1009 | 1009 | } |
1010 | 1010 | } |
@@ -1020,8 +1020,8 @@ discard block |
||
1020 | 1020 | */ |
1021 | 1021 | public function get_addons_by_name() { |
1022 | 1022 | $addons = array(); |
1023 | - foreach ( $this->addons as $addon ) { |
|
1024 | - $addons[ $addon->name() ] = $addon; |
|
1023 | + foreach ($this->addons as $addon) { |
|
1024 | + $addons[$addon->name()] = $addon; |
|
1025 | 1025 | } |
1026 | 1026 | return $addons; |
1027 | 1027 | } |
@@ -1036,14 +1036,14 @@ discard block |
||
1036 | 1036 | * @return \EEM_Base |
1037 | 1037 | * @throws \EE_Error |
1038 | 1038 | */ |
1039 | - public function reset_model( $model_name ) { |
|
1040 | - $model = $this->load_model( $model_name ); |
|
1041 | - $model_class_name = get_class( $model ); |
|
1039 | + public function reset_model($model_name) { |
|
1040 | + $model = $this->load_model($model_name); |
|
1041 | + $model_class_name = get_class($model); |
|
1042 | 1042 | //get that model reset it and make sure we nuke the old reference to it |
1043 | - if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) { |
|
1043 | + if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) { |
|
1044 | 1044 | $this->LIB->{$model_class_name} = $model::reset(); |
1045 | 1045 | } else { |
1046 | - throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) ); |
|
1046 | + throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name)); |
|
1047 | 1047 | } |
1048 | 1048 | return $this->LIB->{$model_class_name}; |
1049 | 1049 | } |
@@ -1080,13 +1080,13 @@ discard block |
||
1080 | 1080 | * |
1081 | 1081 | * @return EE_Registry |
1082 | 1082 | */ |
1083 | - public static function reset( $hard = false, $reinstantiate = true, $reset_models = true ) { |
|
1083 | + public static function reset($hard = false, $reinstantiate = true, $reset_models = true) { |
|
1084 | 1084 | $instance = self::instance(); |
1085 | 1085 | EEH_Activation::reset(); |
1086 | 1086 | |
1087 | 1087 | //properties that get reset |
1088 | 1088 | $instance->_cache_on = true; |
1089 | - $instance->CFG = EE_Config::reset( $hard, $reinstantiate ); |
|
1089 | + $instance->CFG = EE_Config::reset($hard, $reinstantiate); |
|
1090 | 1090 | $instance->CART = null; |
1091 | 1091 | $instance->MRM = null; |
1092 | 1092 | $instance->LIB = new stdClass(); |
@@ -1094,9 +1094,9 @@ discard block |
||
1094 | 1094 | //messages reset |
1095 | 1095 | EED_Messages::reset(); |
1096 | 1096 | |
1097 | - if ( $reset_models ) { |
|
1098 | - foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) { |
|
1099 | - $instance->reset_model( $model_name ); |
|
1097 | + if ($reset_models) { |
|
1098 | + foreach (array_keys($instance->non_abstract_db_models) as $model_name) { |
|
1099 | + $instance->reset_model($model_name); |
|
1100 | 1100 | } |
1101 | 1101 | } |
1102 | 1102 | |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * @param $a |
1119 | 1119 | * @param $b |
1120 | 1120 | */ |
1121 | - final function __call( $a, $b ) { |
|
1121 | + final function __call($a, $b) { |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | /** |
1127 | 1127 | * @param $a |
1128 | 1128 | */ |
1129 | - final function __get( $a ) { |
|
1129 | + final function __get($a) { |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | * @param $a |
1136 | 1136 | * @param $b |
1137 | 1137 | */ |
1138 | - final function __set( $a, $b ) { |
|
1138 | + final function __set($a, $b) { |
|
1139 | 1139 | } |
1140 | 1140 | |
1141 | 1141 | |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | /** |
1144 | 1144 | * @param $a |
1145 | 1145 | */ |
1146 | - final function __isset( $a ) { |
|
1146 | + final function __isset($a) { |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | 1149 | |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | /** |
1152 | 1152 | * @param $a |
1153 | 1153 | */ |
1154 | - final function __unset( $a ) { |
|
1154 | + final function __unset($a) { |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | * @param $a |
1199 | 1199 | * @param $b |
1200 | 1200 | */ |
1201 | - final static function __callStatic( $a, $b ) { |
|
1201 | + final static function __callStatic($a, $b) { |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1207,9 +1207,9 @@ discard block |
||
1207 | 1207 | */ |
1208 | 1208 | public function cpt_models() { |
1209 | 1209 | $cpt_models = array(); |
1210 | - foreach( $this->non_abstract_db_models as $short_name => $classname ) { |
|
1211 | - if( is_subclass_of( $classname, 'EEM_CPT_Base' ) ) { |
|
1212 | - $cpt_models[ $short_name ] = $classname; |
|
1210 | + foreach ($this->non_abstract_db_models as $short_name => $classname) { |
|
1211 | + if (is_subclass_of($classname, 'EEM_CPT_Base')) { |
|
1212 | + $cpt_models[$short_name] = $classname; |
|
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | return $cpt_models; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Datetime.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,27 +35,27 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Datetime','event_espresso'); |
|
40 | - $this->plural_item = __('Datetimes','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Datetime', 'event_espresso'); |
|
40 | + $this->plural_item = __('Datetimes', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Datetime'=>array( |
47 | - 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')), |
|
48 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
47 | + 'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), |
|
48 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
49 | 49 | 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), |
50 | 50 | 'DTT_description' => new EE_Post_Content_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), |
51 | - 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ), |
|
52 | - 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ), |
|
53 | - 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF), |
|
54 | - 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ), |
|
55 | - 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false), |
|
51 | + 'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), |
|
54 | + 'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), |
|
55 | + 'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), |
|
56 | 56 | 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), |
57 | - 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ), |
|
58 | - 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ), |
|
57 | + 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), |
|
58 | + 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false), |
|
59 | 59 | )); |
60 | 60 | $this->_model_relations = array( |
61 | 61 | 'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | ); |
65 | 65 | $this->_model_chain_to_wp_user = 'Event'; |
66 | 66 | //this model is generally available for reading |
67 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
70 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
71 | - parent::__construct( $timezone ); |
|
67 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
69 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
70 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
71 | + parent::__construct($timezone); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | public function create_new_blank_datetime() { |
84 | 84 | $blank_datetime = EE_Datetime::new_instance( |
85 | 85 | array( |
86 | - 'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30), |
|
87 | - 'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30), |
|
86 | + 'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30), |
|
87 | + 'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30), |
|
88 | 88 | 'DTT_order' => 1, |
89 | 89 | 'DTT_reg_limit' => EE_INF |
90 | 90 | ), |
91 | 91 | $this->_timezone |
92 | 92 | ); |
93 | - $blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) ); |
|
94 | - $blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) ); |
|
95 | - return array( $blank_datetime ); |
|
93 | + $blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone)); |
|
94 | + $blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone)); |
|
95 | + return array($blank_datetime); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param int $EVT_ID |
107 | 107 | * @return EE_Datetime[] array on success, FALSE on fail |
108 | 108 | */ |
109 | - public function get_all_event_dates( $EVT_ID = 0 ) { |
|
110 | - if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0 |
|
109 | + public function get_all_event_dates($EVT_ID = 0) { |
|
110 | + if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0 |
|
111 | 111 | return $this->create_new_blank_datetime(); |
112 | 112 | } |
113 | - $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
113 | + $results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID); |
|
114 | 114 | |
115 | - if ( empty( $results ) ) { |
|
115 | + if (empty($results)) { |
|
116 | 116 | return $this->create_new_blank_datetime(); |
117 | 117 | } |
118 | 118 | |
@@ -133,26 +133,26 @@ discard block |
||
133 | 133 | * the given number |
134 | 134 | * @return EE_Datetime[] |
135 | 135 | */ |
136 | - public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL ) { |
|
136 | + public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) { |
|
137 | 137 | |
138 | 138 | //sanitize EVT_ID |
139 | - $EVT_ID = intval( $EVT_ID ); |
|
139 | + $EVT_ID = intval($EVT_ID); |
|
140 | 140 | |
141 | 141 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
142 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
143 | - $where_params = array( 'Event.EVT_ID' => $EVT_ID ); |
|
142 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
143 | + $where_params = array('Event.EVT_ID' => $EVT_ID); |
|
144 | 144 | |
145 | - $query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ); |
|
145 | + $query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none'); |
|
146 | 146 | |
147 | - if( ! $include_expired){ |
|
148 | - $query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) ); |
|
147 | + if ( ! $include_expired) { |
|
148 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
149 | 149 | } |
150 | - if( $include_deleted){ |
|
151 | - $query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE )); |
|
150 | + if ($include_deleted) { |
|
151 | + $query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE)); |
|
152 | 152 | } |
153 | 153 | |
154 | - $result = $this->get_all( $query_params ); |
|
155 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
154 | + $result = $this->get_all($query_params); |
|
155 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
156 | 156 | return $result; |
157 | 157 | } |
158 | 158 | |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @param int $limit |
168 | 168 | * @return EE_Datetime[] |
169 | 169 | */ |
170 | - public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){ |
|
171 | - return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID), |
|
170 | + public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) { |
|
171 | + return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID), |
|
172 | 172 | 'limit'=>$limit, |
173 | 173 | 'order_by'=>array('DTT_EVT_start'=>'ASC'), |
174 | 174 | 'default_where_conditions' => 'none')); |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @param boolean $include_deleted |
184 | 184 | * @return EE_Datetime |
185 | 185 | */ |
186 | - public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){ |
|
187 | - $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | - if($results){ |
|
186 | + public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) { |
|
187 | + $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
|
188 | + if ($results) { |
|
189 | 189 | return array_shift($results); |
190 | - }else{ |
|
190 | + } else { |
|
191 | 191 | return NULL; |
192 | 192 | } |
193 | 193 | } |
@@ -201,16 +201,16 @@ discard block |
||
201 | 201 | * @param bool $try_to_exclude_deleted |
202 | 202 | * @return \EE_Datetime |
203 | 203 | */ |
204 | - public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){ |
|
205 | - if($try_to_exclude_expired){ |
|
206 | - $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false); |
|
207 | - if($non_expired){ |
|
204 | + public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) { |
|
205 | + if ($try_to_exclude_expired) { |
|
206 | + $non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false); |
|
207 | + if ($non_expired) { |
|
208 | 208 | return $non_expired; |
209 | 209 | } |
210 | 210 | } |
211 | - if($try_to_exclude_deleted){ |
|
211 | + if ($try_to_exclude_deleted) { |
|
212 | 212 | $expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true); |
213 | - if($expired_even){ |
|
213 | + if ($expired_even) { |
|
214 | 214 | return $expired_even; |
215 | 215 | } |
216 | 216 | } |
@@ -229,23 +229,23 @@ discard block |
||
229 | 229 | * @param int $limit |
230 | 230 | * @return EE_Datetime[] |
231 | 231 | */ |
232 | - public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){ |
|
232 | + public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
233 | 233 | //sanitize EVT_ID |
234 | - $EVT_ID = intval( $EVT_ID ); |
|
234 | + $EVT_ID = intval($EVT_ID); |
|
235 | 235 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
236 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
237 | - $query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | - if( ! $include_expired){ |
|
239 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
236 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
237 | + $query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
238 | + if ( ! $include_expired) { |
|
239 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
240 | 240 | } |
241 | - if( $include_deleted){ |
|
242 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
241 | + if ($include_deleted) { |
|
242 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
243 | 243 | } |
244 | - if($limit){ |
|
244 | + if ($limit) { |
|
245 | 245 | $query_params['limit'] = $limit; |
246 | 246 | } |
247 | - $result = $this->get_all( $query_params ); |
|
248 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
247 | + $result = $this->get_all($query_params); |
|
248 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
249 | 249 | return $result; |
250 | 250 | } |
251 | 251 | |
@@ -258,23 +258,23 @@ discard block |
||
258 | 258 | * @param int $limit |
259 | 259 | * @return EE_Datetime[] |
260 | 260 | */ |
261 | - public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){ |
|
261 | + public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
262 | 262 | //sanitize TKT_ID |
263 | - $TKT_ID = intval( $TKT_ID ); |
|
263 | + $TKT_ID = intval($TKT_ID); |
|
264 | 264 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
265 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
266 | - $query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | - if( ! $include_expired){ |
|
268 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
265 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
266 | + $query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc')); |
|
267 | + if ( ! $include_expired) { |
|
268 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
269 | 269 | } |
270 | - if( $include_deleted){ |
|
271 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
270 | + if ($include_deleted) { |
|
271 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
272 | 272 | } |
273 | - if($limit){ |
|
273 | + if ($limit) { |
|
274 | 274 | $query_params['limit'] = $limit; |
275 | 275 | } |
276 | - $result = $this->get_all( $query_params ); |
|
277 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
276 | + $result = $this->get_all($query_params); |
|
277 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
278 | 278 | return $result; |
279 | 279 | } |
280 | 280 | |
@@ -290,24 +290,24 @@ discard block |
||
290 | 290 | * that number |
291 | 291 | * @return EE_Datetime[] |
292 | 292 | */ |
293 | - public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) { |
|
293 | + public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) { |
|
294 | 294 | //sanitize id. |
295 | - $TKT_ID = intval( $TKT_ID ); |
|
295 | + $TKT_ID = intval($TKT_ID); |
|
296 | 296 | $old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object(); |
297 | - $this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db ); |
|
298 | - $where_params = array( 'Ticket.TKT_ID' => $TKT_ID ); |
|
299 | - $query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) ); |
|
300 | - if( ! $include_expired){ |
|
301 | - $query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE)); |
|
297 | + $this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db); |
|
298 | + $where_params = array('Ticket.TKT_ID' => $TKT_ID); |
|
299 | + $query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC')); |
|
300 | + if ( ! $include_expired) { |
|
301 | + $query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE)); |
|
302 | 302 | } |
303 | - if( $include_deleted){ |
|
304 | - $query_params[0]['DTT_deleted'] = array('IN',array(true,false)); |
|
303 | + if ($include_deleted) { |
|
304 | + $query_params[0]['DTT_deleted'] = array('IN', array(true, false)); |
|
305 | 305 | } |
306 | - if($limit){ |
|
306 | + if ($limit) { |
|
307 | 307 | $query_params['limit'] = $limit; |
308 | 308 | } |
309 | - $result = $this->get_all( $query_params ); |
|
310 | - $this->assume_values_already_prepared_by_model_object( $old_assumption ); |
|
309 | + $result = $this->get_all($query_params); |
|
310 | + $this->assume_values_already_prepared_by_model_object($old_assumption); |
|
311 | 311 | return $result; |
312 | 312 | } |
313 | 313 | |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | * @param int $EVT_ID |
319 | 319 | * @return EE_Datetime |
320 | 320 | */ |
321 | - public function get_most_important_datetime_for_event($EVT_ID){ |
|
321 | + public function get_most_important_datetime_for_event($EVT_ID) { |
|
322 | 322 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | - if($results){ |
|
323 | + if ($results) { |
|
324 | 324 | return array_shift($results); |
325 | - }else{ |
|
325 | + } else { |
|
326 | 326 | return null; |
327 | 327 | } |
328 | 328 | } |
@@ -341,77 +341,77 @@ discard block |
||
341 | 341 | * - inactive = Events that are either not published. |
342 | 342 | * @return wpdb results array |
343 | 343 | */ |
344 | - public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) { |
|
345 | - $current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' ); |
|
346 | - $current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' ); |
|
344 | + public function get_dtt_months_and_years($where_params, $evt_active_status = '') { |
|
345 | + $current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start'); |
|
346 | + $current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end'); |
|
347 | 347 | |
348 | - switch ( $evt_active_status ) { |
|
348 | + switch ($evt_active_status) { |
|
349 | 349 | case 'upcoming' : |
350 | 350 | $where_params['Event.status'] = 'publish'; |
351 | 351 | //if there are already query_params matching DTT_EVT_start then we need to modify that to add them. |
352 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
352 | + if (isset($where_params['DTT_EVT_start'])) { |
|
353 | 353 | $where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start']; |
354 | 354 | } |
355 | - $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start ); |
|
355 | + $where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
359 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
360 | 360 | //get events to exclude |
361 | - $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
|
361 | + $exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end))); |
|
362 | 362 | //first get all events that have datetimes where its not expired. |
363 | - $event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' ); |
|
364 | - $event_ids = array_keys( $event_ids ); |
|
363 | + $event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID'); |
|
364 | + $event_ids = array_keys($event_ids); |
|
365 | 365 | |
366 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
366 | + if (isset($where_params['DTT_EVT_end'])) { |
|
367 | 367 | $where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
368 | 368 | } |
369 | - $where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end ); |
|
370 | - $where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids ); |
|
369 | + $where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end); |
|
370 | + $where_params['Event.EVT_ID'] = array('NOT IN', $event_ids); |
|
371 | 371 | break; |
372 | 372 | |
373 | 373 | case 'active' : |
374 | 374 | $where_params['Event.status'] = 'publish'; |
375 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
375 | + if (isset($where_params['DTT_EVT_start'])) { |
|
376 | 376 | $where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start']; |
377 | 377 | } |
378 | - if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) { |
|
378 | + if (isset($where_params['Datetime.DTT_EVT_end'])) { |
|
379 | 379 | $where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end']; |
380 | 380 | } |
381 | - $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start ); |
|
382 | - $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end ); |
|
381 | + $where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start); |
|
382 | + $where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end); |
|
383 | 383 | break; |
384 | 384 | |
385 | 385 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
387 | - if ( isset( $where_params['OR'] ) ) { |
|
386 | + if (isset($where_params['Event.status'])) unset($where_params['Event.status']); |
|
387 | + if (isset($where_params['OR'])) { |
|
388 | 388 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 389 | } |
390 | - if ( isset( $where_params['DTT_EVT_end'] ) ) { |
|
390 | + if (isset($where_params['DTT_EVT_end'])) { |
|
391 | 391 | $where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end']; |
392 | - unset( $where_params['DTT_EVT_end'] ); |
|
392 | + unset($where_params['DTT_EVT_end']); |
|
393 | 393 | } |
394 | 394 | |
395 | - if ( isset( $where_params['DTT_EVT_start'] ) ) { |
|
395 | + if (isset($where_params['DTT_EVT_start'])) { |
|
396 | 396 | $where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start']; |
397 | - unset( $where_params['DTT_EVT_start'] ); |
|
397 | + unset($where_params['DTT_EVT_start']); |
|
398 | 398 | } |
399 | - $where_params['AND']['Event.status'] = array( '!=', 'publish' ); |
|
399 | + $where_params['AND']['Event.status'] = array('!=', 'publish'); |
|
400 | 400 | break; |
401 | 401 | } |
402 | 402 | |
403 | 403 | $query_params[0] = $where_params; |
404 | 404 | $query_params['group_by'] = array('dtt_year', 'dtt_month'); |
405 | - $query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' ); |
|
405 | + $query_params['order_by'] = array('DTT_EVT_start' => 'DESC'); |
|
406 | 406 | |
407 | - $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' ); |
|
407 | + $query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start'); |
|
408 | 408 | |
409 | 409 | $columns_to_select = array( |
410 | - 'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'), |
|
411 | - 'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'), |
|
412 | - 'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s') |
|
410 | + 'dtt_year' => array('YEAR('.$query_interval.')', '%s'), |
|
411 | + 'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'), |
|
412 | + 'dtt_month_num' => array('MONTH('.$query_interval.')', '%s') |
|
413 | 413 | ); |
414 | - return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select ); |
|
414 | + return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | * for the tickets for each datetime) |
420 | 420 | * @param EE_Datetime[] $datetimes |
421 | 421 | */ |
422 | - public function update_sold($datetimes){ |
|
423 | - foreach($datetimes as $datetime){ |
|
422 | + public function update_sold($datetimes) { |
|
423 | + foreach ($datetimes as $datetime) { |
|
424 | 424 | $datetime->update_sold(); |
425 | 425 | } |
426 | 426 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * @param array $query_params |
436 | 436 | * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF, IF there are NO tickets attached to datetime then FALSE is returned. |
437 | 437 | */ |
438 | - public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) { |
|
439 | - $datetime = $this->get_one_by_ID( $DTT_ID ); |
|
440 | - if ( $datetime instanceof EE_Datetime ) { |
|
441 | - return $datetime->tickets_remaining( $query_params ); |
|
438 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
439 | + $datetime = $this->get_one_by_ID($DTT_ID); |
|
440 | + if ($datetime instanceof EE_Datetime) { |
|
441 | + return $datetime->tickets_remaining($query_params); |
|
442 | 442 | } |
443 | 443 | return 0; |
444 | 444 | } |
@@ -460,36 +460,36 @@ discard block |
||
460 | 460 | * EE_Datetime::upcoming |
461 | 461 | * EE_Datetime::expired |
462 | 462 | */ |
463 | - public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) { |
|
463 | + public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) { |
|
464 | 464 | //only accept where conditions for this query. |
465 | - $_where = isset( $query_params[0] ) ? $query_params[0] : array(); |
|
465 | + $_where = isset($query_params[0]) ? $query_params[0] : array(); |
|
466 | 466 | $status_query_args = array( |
467 | 467 | EE_Datetime::active => array_merge( |
468 | 468 | $_where, |
469 | - array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) ) |
|
469 | + array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time())) |
|
470 | 470 | ), |
471 | 471 | EE_Datetime::upcoming => array_merge( |
472 | 472 | $_where, |
473 | - array( 'DTT_EVT_start' => array( '>', time() ) ) |
|
473 | + array('DTT_EVT_start' => array('>', time())) |
|
474 | 474 | ), |
475 | 475 | EE_Datetime::expired => array_merge( |
476 | 476 | $_where, |
477 | - array( 'DTT_EVT_end' => array('<', time() ) ) |
|
477 | + array('DTT_EVT_end' => array('<', time())) |
|
478 | 478 | ) |
479 | 479 | ); |
480 | 480 | |
481 | - if ( ! empty( $stati_to_include ) ) { |
|
482 | - foreach( array_keys( $status_query_args ) as $status ) { |
|
483 | - if ( ! in_array( $status, $stati_to_include ) ) { |
|
484 | - unset( $status_query_args[$status] ); |
|
481 | + if ( ! empty($stati_to_include)) { |
|
482 | + foreach (array_keys($status_query_args) as $status) { |
|
483 | + if ( ! in_array($status, $stati_to_include)) { |
|
484 | + unset($status_query_args[$status]); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | } |
488 | 488 | |
489 | 489 | //loop through and query counts for each stati. |
490 | 490 | $status_query_results = array(); |
491 | - foreach( $status_query_args as $status => $status_where_conditions ) { |
|
492 | - $status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true ); |
|
491 | + foreach ($status_query_args as $status => $status_where_conditions) { |
|
492 | + $status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | return $status_query_results; |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | * @param array $query_params |
504 | 504 | * @return int |
505 | 505 | */ |
506 | - public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) { |
|
507 | - $count = $this->get_datetime_counts_by_status( array( $status ), $query_params ); |
|
508 | - return ! empty( $count[$status] ) ? $count[$status] : 0; |
|
506 | + public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) { |
|
507 | + $count = $this->get_datetime_counts_by_status(array($status), $query_params); |
|
508 | + return ! empty($count[$status]) ? $count[$status] : 0; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -187,7 +189,7 @@ discard block |
||
187 | 189 | $results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1); |
188 | 190 | if($results){ |
189 | 191 | return array_shift($results); |
190 | - }else{ |
|
192 | + } else{ |
|
191 | 193 | return NULL; |
192 | 194 | } |
193 | 195 | } |
@@ -322,7 +324,7 @@ discard block |
||
322 | 324 | $results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1); |
323 | 325 | if($results){ |
324 | 326 | return array_shift($results); |
325 | - }else{ |
|
327 | + } else{ |
|
326 | 328 | return null; |
327 | 329 | } |
328 | 330 | } |
@@ -356,7 +358,9 @@ discard block |
||
356 | 358 | break; |
357 | 359 | |
358 | 360 | case 'expired' : |
359 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
361 | + if ( isset( $where_params['Event.status'] ) ) { |
|
362 | + unset( $where_params['Event.status'] ); |
|
363 | + } |
|
360 | 364 | //get events to exclude |
361 | 365 | $exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) ); |
362 | 366 | //first get all events that have datetimes where its not expired. |
@@ -383,7 +387,9 @@ discard block |
||
383 | 387 | break; |
384 | 388 | |
385 | 389 | case 'inactive' : |
386 | - if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] ); |
|
390 | + if ( isset( $where_params['Event.status'] ) ) { |
|
391 | + unset( $where_params['Event.status'] ); |
|
392 | + } |
|
387 | 393 | if ( isset( $where_params['OR'] ) ) { |
388 | 394 | $where_params['AND']['OR'] = $where_params['OR']; |
389 | 395 | } |
@@ -11,47 +11,47 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Display_Strategy extends EE_Display_Strategy_Base{ |
|
14 | +class EE_Select_Display_Strategy extends EE_Display_Strategy_Base { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
18 | 18 | * @throws EE_Error |
19 | 19 | * @return string of html to display the field |
20 | 20 | */ |
21 | - function display(){ |
|
22 | - if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){ |
|
23 | - throw new EE_Error( sprintf( __( 'Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso' ))); |
|
21 | + function display() { |
|
22 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
23 | + throw new EE_Error(sprintf(__('Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso'))); |
|
24 | 24 | } |
25 | 25 | |
26 | - $html = EEH_HTML::nl( 0, 'select' ); |
|
26 | + $html = EEH_HTML::nl(0, 'select'); |
|
27 | 27 | $html .= '<select'; |
28 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
29 | - $html .= ' name="' . $this->_input->html_name() . '"'; |
|
30 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
31 | - $html .= ' class="' . $class . '"'; |
|
28 | + $html .= ' id="'.$this->_input->html_id().'"'; |
|
29 | + $html .= ' name="'.$this->_input->html_name().'"'; |
|
30 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
31 | + $html .= ' class="'.$class.'"'; |
|
32 | 32 | // add html5 required |
33 | 33 | |
34 | 34 | $html .= $this->_input->required() ? ' required' : ''; |
35 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
36 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
35 | + $html .= ' style="'.$this->_input->html_style().'"'; |
|
36 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
37 | 37 | $html .= '>'; |
38 | 38 | |
39 | 39 | // EEH_HTML::indent( 1, 'select' ); |
40 | - if ( EEH_Array::is_multi_dimensional_array( $this->_input->options() )) { |
|
41 | - EEH_HTML::indent( 1, 'optgroup' ); |
|
42 | - foreach( $this->_input->options() as $opt_group_label => $opt_group ){ |
|
43 | - $html .= EEH_HTML::nl( 0, 'optgroup' ) . '<optgroup label="' . esc_attr( $opt_group_label ) . '">'; |
|
44 | - EEH_HTML::indent( 1, 'option' ); |
|
45 | - $html .= $this->_display_options( $opt_group ); |
|
40 | + if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
41 | + EEH_HTML::indent(1, 'optgroup'); |
|
42 | + foreach ($this->_input->options() as $opt_group_label => $opt_group) { |
|
43 | + $html .= EEH_HTML::nl(0, 'optgroup').'<optgroup label="'.esc_attr($opt_group_label).'">'; |
|
44 | + EEH_HTML::indent(1, 'option'); |
|
45 | + $html .= $this->_display_options($opt_group); |
|
46 | 46 | $html .= EEH_HTML::indent( -1, 'option' ); |
47 | - $html .= EEH_HTML::nl( 0, 'optgroup' ) . '</optgroup>'; |
|
47 | + $html .= EEH_HTML::nl(0, 'optgroup').'</optgroup>'; |
|
48 | 48 | } |
49 | 49 | EEH_HTML::indent( -1, 'optgroup' ); |
50 | 50 | } else { |
51 | - $html.=$this->_display_options( $this->_input->options() ); |
|
51 | + $html .= $this->_display_options($this->_input->options()); |
|
52 | 52 | } |
53 | 53 | |
54 | - $html.= EEH_HTML::nl( 0, 'select' ) . '</select>'; |
|
54 | + $html .= EEH_HTML::nl(0, 'select').'</select>'; |
|
55 | 55 | // $html.= EEH_HTML::nl( -1, 'select' ) . '</select>'; |
56 | 56 | return $html; |
57 | 57 | } |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | * @param array $options |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - protected function _display_options($options){ |
|
66 | + protected function _display_options($options) { |
|
67 | 67 | $html = ''; |
68 | - EEH_HTML::indent( 1, 'option' ); |
|
69 | - foreach( $options as $value => $display_text ){ |
|
70 | - $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one( $value ); |
|
71 | - $selected = $this->_check_if_option_selected( $unnormalized_value ) ? ' selected="selected"' : ''; |
|
72 | - $html.= EEH_HTML::nl( 0, 'option' ) . '<option value="' . esc_attr( $unnormalized_value ) . '"' . $selected . '>' . $display_text . '</option>'; |
|
68 | + EEH_HTML::indent(1, 'option'); |
|
69 | + foreach ($options as $value => $display_text) { |
|
70 | + $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one($value); |
|
71 | + $selected = $this->_check_if_option_selected($unnormalized_value) ? ' selected="selected"' : ''; |
|
72 | + $html .= EEH_HTML::nl(0, 'option').'<option value="'.esc_attr($unnormalized_value).'"'.$selected.'>'.$display_text.'</option>'; |
|
73 | 73 | } |
74 | 74 | EEH_HTML::indent( -1, 'option' ); |
75 | 75 | return $html; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param string|int $value unnormalized value option (string) |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - protected function _check_if_option_selected( $value ){ |
|
85 | + protected function _check_if_option_selected($value) { |
|
86 | 86 | return $this->_input->raw_value() == $value ? TRUE : FALSE; |
87 | 87 | } |
88 | 88 |
@@ -1,26 +1,26 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | ?> |
4 | -<h1><?php _e("Data Migration Error", "event_espresso");?></h1> |
|
5 | -<p class='error'><?php printf(__("Your last data migration had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"),"<b>","</b>");?></p> |
|
6 | -<a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Errors", 'event_espresso');?></a> |
|
4 | +<h1><?php _e("Data Migration Error", "event_espresso"); ?></h1> |
|
5 | +<p class='error'><?php printf(__("Your last data migration had a %s FATAL ERROR, and CANNOT be continued%s.", "event_espresso"), "<b>", "</b>"); ?></p> |
|
6 | +<a id="show-hide-migration-warnings" class="display-the-hidden"><?php _e("Show Errors", 'event_espresso'); ?></a> |
|
7 | 7 | <ul class="migration-warnings" style="display:none"> |
8 | -<?php foreach($most_recent_migration->get_errors() as $error){ ?> |
|
8 | +<?php foreach ($most_recent_migration->get_errors() as $error) { ?> |
|
9 | 9 | <li style="overflow-y:auto;max-height:100px"><?php echo esc_html($error)?></li> |
10 | 10 | <?php }?> |
11 | 11 | </ul> |
12 | -<h2><?php _e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso");?></h2> |
|
13 | -<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL);?>' method='post'> |
|
12 | +<h2><?php _e("Fill out the below form to automatically Send Event Espresso a Crash Report", "event_espresso"); ?></h2> |
|
13 | +<form action='<?php echo EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_migration_crash_report'), EE_MAINTENANCE_ADMIN_URL); ?>' method='post'> |
|
14 | 14 | <table class='widefat'> |
15 | - <tr><td><label for='from'><?php _e("From/Reply-To:", "event_espresso");?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email','display'); ?>'></td></tr> |
|
16 | - <tr><td><label for='from_name'><?php _e("Your Name", "event_espresso");?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(__("Admin of %s", "event_espresso"),get_bloginfo('name','display'));?>'></td></tr> |
|
17 | - <tr><td><label for='body'><?php _e("Comments", "event_espresso");?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php _e("Enter any comments about why you think the error may have occurred", "event_espresso");?></textarea> |
|
18 | - <p class='description'><?php _e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso");?></p></td></tr> |
|
19 | - <tr><td colspan="2"><input type="submit" value="<?php _e("Mail Crash Report to Event Espresso", "event_espresso");?>"/></td></tr> |
|
15 | + <tr><td><label for='from'><?php _e("From/Reply-To:", "event_espresso"); ?></label></td><td><input name='from' id='from' type='text' style="width:200px"value='<?php echo get_bloginfo('admin_email', 'display'); ?>'></td></tr> |
|
16 | + <tr><td><label for='from_name'><?php _e("Your Name", "event_espresso"); ?></label></td><td><input name='from_name' id='from_name' type='text' style="width:200px"value='<?php printf(__("Admin of %s", "event_espresso"), get_bloginfo('name', 'display')); ?>'></td></tr> |
|
17 | + <tr><td><label for='body'><?php _e("Comments", "event_espresso"); ?></label></td><td><textarea name="body" id="body" class='system_status_info'><?php _e("Enter any comments about why you think the error may have occurred", "event_espresso"); ?></textarea> |
|
18 | + <p class='description'><?php _e("Note: the System Information report will also be added to the email's body, which contains information about your Event Espresso, Wordpress, and PHP settings which can be helpful in debugging the problem.", "event_espresso"); ?></p></td></tr> |
|
19 | + <tr><td colspan="2"><input type="submit" value="<?php _e("Mail Crash Report to Event Espresso", "event_espresso"); ?>"/></td></tr> |
|
20 | 20 | </table> |
21 | 21 | </form> |
22 | 22 | <br> |
23 | -<p><?php printf(__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"),'<a href="mailto:'.EE_SUPPORT_EMAIL.'">',EE_SUPPORT_EMAIL,"</a>");?></p> |
|
24 | -<textarea class="system_status_info"><?php print_r( EEM_System_Status::instance()->get_system_stati())?></textarea> |
|
25 | -<p><?php printf( __( '%1$sNext Step%2$s', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p> |
|
26 | -<p><?php printf( __( '...or %1$sDON\'T send migration crash report%2$s.', 'event_espresso' ), "<a href='$next_url'>","</a>");?></p> |
|
23 | +<p><?php printf(__('...or copy-and-paste the below information to %1$s %2$s %3$s', "event_espresso"), '<a href="mailto:'.EE_SUPPORT_EMAIL.'">', EE_SUPPORT_EMAIL, "</a>"); ?></p> |
|
24 | +<textarea class="system_status_info"><?php print_r(EEM_System_Status::instance()->get_system_stati())?></textarea> |
|
25 | +<p><?php printf(__('%1$sNext Step%2$s', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p> |
|
26 | +<p><?php printf(__('...or %1$sDON\'T send migration crash report%2$s.', 'event_espresso'), "<a href='$next_url'>", "</a>"); ?></p> |