@@ -2,18 +2,18 @@ |
||
2 | 2 | <p> |
3 | 3 | <?php _e('The importer can be used to import event information into Event Espresso using a CSV file.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | -<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso');?></h3> |
|
5 | +<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso'); ?></h3> |
|
6 | 6 | <p> |
7 | 7 | <?php _e('To import Event Espresso data from another Event Espresso 4 install, export a CSV file from the admin Events overview page, or anywhere you can generate a CSV export file from. Then upload that file here (regardless of what type of information was exported).', 'event_espresso'); ?> |
8 | 8 | </p> |
9 | 9 | <p> |
10 | 10 | <?php _e('Note: its possible that data from the other site have the same IDs as data in this site. The importer recognizes that this data is from a different database and inserts new items for each item in the CSV file, regardless of whether its ID matches that of an item in this site\'s database or not. However, the importer also remembers the mapping from the old site\'s database to this site\'s database, and on subsequent CSV importers from that site, the data in this database will be updated instead of re-inserting new items.', 'event_espresso'); ?> |
11 | 11 | </p> |
12 | -<h3><?php _e("Importing from this Site", 'event_espresso');?></h3> |
|
13 | -<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso');?></p> |
|
12 | +<h3><?php _e("Importing from this Site", 'event_espresso'); ?></h3> |
|
13 | +<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso'); ?></p> |
|
14 | 14 | |
15 | - <h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso");?></h3> |
|
16 | - <p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso");?></p> |
|
17 | - <p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso");?></p> |
|
18 | - <p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso");?></p> |
|
19 | - <p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso");?></p> |
|
20 | 15 | \ No newline at end of file |
16 | + <h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso"); ?></h3> |
|
17 | + <p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso"); ?></p> |
|
18 | + <p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso"); ?></p> |
|
19 | + <p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso"); ?></p> |
|
20 | + <p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso"); ?></p> |
|
21 | 21 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * constructor |
210 | 210 | * @param EE_Admin_Page $admin_page the calling admin_page_object |
211 | 211 | */ |
212 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
212 | + public function __construct(EE_Admin_Page $adminpage) { |
|
213 | 213 | |
214 | 214 | $this->_adminpage_obj = $adminpage; |
215 | 215 | $this->_req_data = array_merge($_GET, $_POST); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $this->_set_hooks_properties(); |
218 | 218 | |
219 | 219 | //first let's verify we're on the right page |
220 | - if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) ) |
|
220 | + if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page'])) |
|
221 | 221 | return; //get out nothing more to be done here. |
222 | 222 | |
223 | 223 | //allow for extends to modify properties |
224 | - if ( method_exists( $this, '_extend_properties' ) ) |
|
224 | + if (method_exists($this, '_extend_properties')) |
|
225 | 225 | $this->_extend_properties(); |
226 | 226 | |
227 | 227 | $this->_set_page_object(); |
@@ -229,9 +229,9 @@ discard block |
||
229 | 229 | $this->_load_custom_methods(); |
230 | 230 | $this->_load_routed_hooks(); |
231 | 231 | |
232 | - add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) ); |
|
233 | - add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 ); |
|
234 | - add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 ); |
|
232 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
233 | + add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20); |
|
234 | + add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15); |
|
235 | 235 | |
236 | 236 | $this->_ajax_hooks(); |
237 | 237 | |
@@ -272,15 +272,15 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function enqueue_scripts_styles() { |
274 | 274 | |
275 | - if ( !empty( $this->_scripts_styles ) ) { |
|
275 | + if ( ! empty($this->_scripts_styles)) { |
|
276 | 276 | //first let's do all the registrations |
277 | - if ( !isset($this->_scripts_styles['registers'] ) ) { |
|
277 | + if ( ! isset($this->_scripts_styles['registers'])) { |
|
278 | 278 | $msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso'); |
279 | - $msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' ); |
|
280 | - throw new EE_Error( implode( '||', $msg ) ); |
|
279 | + $msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>'); |
|
280 | + throw new EE_Error(implode('||', $msg)); |
|
281 | 281 | } |
282 | 282 | |
283 | - foreach( $this->_scripts_styles['registers'] as $ref => $details ) { |
|
283 | + foreach ($this->_scripts_styles['registers'] as $ref => $details) { |
|
284 | 284 | $defaults = array( |
285 | 285 | 'type' => 'js', |
286 | 286 | 'url' => '', |
@@ -289,48 +289,48 @@ discard block |
||
289 | 289 | 'footer' => TRUE |
290 | 290 | ); |
291 | 291 | $details = wp_parse_args($details, $defaults); |
292 | - extract( $details ); |
|
292 | + extract($details); |
|
293 | 293 | |
294 | 294 | //let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do |
295 | 295 | $this->_scripts_styles['registers'][$ref]['type'] = $type; |
296 | 296 | |
297 | 297 | //let's make sure we're not missing any REQUIRED parameters |
298 | - if ( empty($url) ) { |
|
299 | - $msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' ); |
|
300 | - $msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref ); |
|
301 | - throw new EE_Error( implode( '||', $msg ) ); |
|
298 | + if (empty($url)) { |
|
299 | + $msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet'); |
|
300 | + $msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref); |
|
301 | + throw new EE_Error(implode('||', $msg)); |
|
302 | 302 | } |
303 | 303 | //made it here so let's do the appropriate registration |
304 | - $type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version ); |
|
304 | + $type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | //k now lets do the enqueues |
308 | - if( !isset( $this->_scripts_styles['enqueues'] ) ) |
|
309 | - return; //not sure if we should throw an error here or not. |
|
310 | - foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) { |
|
308 | + if ( ! isset($this->_scripts_styles['enqueues'])) |
|
309 | + return; //not sure if we should throw an error here or not. |
|
310 | + foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) { |
|
311 | 311 | //make sure $routes is an array |
312 | 312 | $routes = (array) $routes; |
313 | 313 | |
314 | - if ( in_array($this->_current_route, $routes ) ) { |
|
314 | + if (in_array($this->_current_route, $routes)) { |
|
315 | 315 | $this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref); |
316 | 316 | //if we have a localization for the script let's do that too. |
317 | - if ( isset( $this->_scripts_styles['localize'][$ref] ) ) { |
|
318 | - foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) { |
|
319 | - wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] ); |
|
317 | + if (isset($this->_scripts_styles['localize'][$ref])) { |
|
318 | + foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) { |
|
319 | + wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]); |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
325 | 325 | //let's do the deregisters |
326 | - if ( !isset( $this->_scripts_styles['deregisters'] ) ) |
|
326 | + if ( ! isset($this->_scripts_styles['deregisters'])) |
|
327 | 327 | return; |
328 | - foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) { |
|
328 | + foreach ($this->_scripts_styles['deregisters'] as $ref => $details) { |
|
329 | 329 | $defaults = array( |
330 | 330 | 'type' => 'js' |
331 | 331 | ); |
332 | - $details = wp_parse_args( $details, $defaults ); |
|
333 | - extract( $details ); |
|
332 | + $details = wp_parse_args($details, $defaults); |
|
333 | + extract($details); |
|
334 | 334 | |
335 | 335 | $type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref); |
336 | 336 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | */ |
350 | 350 | private function _set_defaults() { |
351 | 351 | $this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array(); |
352 | - $this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
352 | + $this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
353 | 353 | $this->caller = get_class($this); |
354 | 354 | $this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE; |
355 | 355 | } |
@@ -364,34 +364,34 @@ discard block |
||
364 | 364 | */ |
365 | 365 | protected function _set_page_object() { |
366 | 366 | //first make sure $this->_name is set |
367 | - if ( empty( $this->_name ) ) { |
|
367 | + if (empty($this->_name)) { |
|
368 | 368 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
369 | - $msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller ); |
|
370 | - throw new EE_Error( implode( '||', $msg ) ); |
|
369 | + $msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller); |
|
370 | + throw new EE_Error(implode('||', $msg)); |
|
371 | 371 | } |
372 | 372 | |
373 | - $ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message |
|
374 | - $ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message |
|
373 | + $ref = str_replace('_', ' ', $this->_name); //take the_message -> the message |
|
374 | + $ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message |
|
375 | 375 | |
376 | 376 | //first default file (if exists) |
377 | - $decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php'; |
|
378 | - if ( is_readable( $decaf_file ) ) |
|
379 | - require_once( $decaf_file ); |
|
377 | + $decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php'; |
|
378 | + if (is_readable($decaf_file)) |
|
379 | + require_once($decaf_file); |
|
380 | 380 | |
381 | 381 | //now we have to do require for extended file (if needed) |
382 | - if ( $this->_extend ) { |
|
383 | - require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' ); |
|
382 | + if ($this->_extend) { |
|
383 | + require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php'); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
387 | 387 | //if we've got an extended class we use that! |
388 | - $ref = $this->_extend ? 'Extend_' . $ref : $ref; |
|
388 | + $ref = $this->_extend ? 'Extend_'.$ref : $ref; |
|
389 | 389 | |
390 | 390 | //let's make sure the class exists |
391 | - if ( !class_exists( $ref ) ) { |
|
391 | + if ( ! class_exists($ref)) { |
|
392 | 392 | $msg[] = __('We can\'t load the page object', 'event_espresso'); |
393 | - $msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref ); |
|
394 | - throw new EE_Error( implode( '||', $msg ) ); |
|
393 | + $msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref); |
|
394 | + throw new EE_Error(implode('||', $msg)); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | $a = new ReflectionClass($ref); |
@@ -416,27 +416,27 @@ discard block |
||
416 | 416 | $method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route; |
417 | 417 | |
418 | 418 | //these run before the Admin_Page route executes. |
419 | - if ( method_exists( $this, $method_callback ) ) { |
|
420 | - call_user_func( array( $this, $method_callback) ); |
|
419 | + if (method_exists($this, $method_callback)) { |
|
420 | + call_user_func(array($this, $method_callback)); |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | |
424 | 424 | //these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes. There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens. |
425 | 425 | //first the actions |
426 | 426 | //note that these action hooks will have the $query_args value available. |
427 | - $admin_class_name = get_class( $this->_adminpage_obj ); |
|
427 | + $admin_class_name = get_class($this->_adminpage_obj); |
|
428 | 428 | |
429 | - if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) { |
|
430 | - add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 ); |
|
429 | + if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) { |
|
430 | + add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10); |
|
431 | 431 | } |
432 | 432 | |
433 | - if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) { |
|
434 | - add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 ); |
|
433 | + if (method_exists($this, '_redirect_action_'.$this->_current_route)) { |
|
434 | + add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | //let's hook into the _redirect itself and allow for changing where the user goes after redirect. This will have $query_args and $redirect_url available. |
438 | - if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) { |
|
439 | - add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 ); |
|
438 | + if (method_exists($this, '_redirect_filter_'.$this->_current_route)) { |
|
439 | + add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | } |
@@ -459,12 +459,12 @@ discard block |
||
459 | 459 | 'argnum' => 1, |
460 | 460 | 'priority' => 10 |
461 | 461 | ), |
462 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array( |
|
462 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array( |
|
463 | 463 | 'type' => 'filter', |
464 | 464 | 'argnum' => 1, |
465 | 465 | 'priority' => 10 |
466 | 466 | ), |
467 | - 'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array( |
|
467 | + 'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array( |
|
468 | 468 | 'type' => 'filter', |
469 | 469 | 'argnum' => 1, |
470 | 470 | 'priority' => 10 |
@@ -483,14 +483,14 @@ discard block |
||
483 | 483 | |
484 | 484 | |
485 | 485 | |
486 | - foreach ( $hook_filter_array as $hook => $args ) { |
|
487 | - if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) { |
|
488 | - if ( isset( $this->_wp_action_filters_priority[$hook] ) ) |
|
486 | + foreach ($hook_filter_array as $hook => $args) { |
|
487 | + if (method_exists($this, $this->_current_route.'_'.$hook)) { |
|
488 | + if (isset($this->_wp_action_filters_priority[$hook])) |
|
489 | 489 | $args['priority'] = $this->_wp_action_filters_priority[$hook]; |
490 | - if ( $args['type'] == 'action' ) |
|
491 | - add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
490 | + if ($args['type'] == 'action') |
|
491 | + add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
492 | 492 | else |
493 | - add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] ); |
|
493 | + add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']); |
|
494 | 494 | } |
495 | 495 | } |
496 | 496 | |
@@ -503,18 +503,18 @@ discard block |
||
503 | 503 | */ |
504 | 504 | private function _ajax_hooks() { |
505 | 505 | |
506 | - if ( empty( $this->_ajax_func) ) |
|
506 | + if (empty($this->_ajax_func)) |
|
507 | 507 | return; //get out there's nothing to take care of. |
508 | 508 | |
509 | - foreach ( $this->_ajax_func as $action => $method ) { |
|
509 | + foreach ($this->_ajax_func as $action => $method) { |
|
510 | 510 | //make sure method exists |
511 | - if ( !method_exists($this, $method) ) { |
|
512 | - $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />'; |
|
513 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
514 | - throw new EE_Error( implode('||', $msg ) ); |
|
511 | + if ( ! method_exists($this, $method)) { |
|
512 | + $msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />'; |
|
513 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
514 | + throw new EE_Error(implode('||', $msg)); |
|
515 | 515 | } |
516 | 516 | |
517 | - add_action('wp_ajax_' . $action, array( $this, $method ) ); |
|
517 | + add_action('wp_ajax_'.$action, array($this, $method)); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | } |
@@ -527,21 +527,21 @@ discard block |
||
527 | 527 | * @return void |
528 | 528 | */ |
529 | 529 | protected function _init_hooks() { |
530 | - if ( empty( $this->_init_func) ) |
|
530 | + if (empty($this->_init_func)) |
|
531 | 531 | return; //get out there's nothing to take care of. |
532 | 532 | |
533 | 533 | //We need to determine what page_route we are on! |
534 | - $current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default'; |
|
534 | + $current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default'; |
|
535 | 535 | |
536 | - foreach ( $this->_init_func as $route => $method ) { |
|
536 | + foreach ($this->_init_func as $route => $method) { |
|
537 | 537 | //make sure method exists |
538 | - if ( !method_exists($this, $method) ) { |
|
539 | - $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />'; |
|
540 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller ); |
|
541 | - throw new EE_Error( implode('||', $msg ) ); |
|
538 | + if ( ! method_exists($this, $method)) { |
|
539 | + $msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />'; |
|
540 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller); |
|
541 | + throw new EE_Error(implode('||', $msg)); |
|
542 | 542 | } |
543 | - if ( $route == $this->_current_route ) |
|
544 | - add_action('admin_init', array( $this, $method ) ); |
|
543 | + if ($route == $this->_current_route) |
|
544 | + add_action('admin_init', array($this, $method)); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | } |
@@ -556,28 +556,28 @@ discard block |
||
556 | 556 | * @return void |
557 | 557 | */ |
558 | 558 | public function add_metaboxes() { |
559 | - if ( empty( $this->_metaboxes ) ) |
|
559 | + if (empty($this->_metaboxes)) |
|
560 | 560 | return; //get out we don't have any metaboxes to set for this connection |
561 | 561 | |
562 | - $this->_handle_metabox_array( $this->_metaboxes ); |
|
562 | + $this->_handle_metabox_array($this->_metaboxes); |
|
563 | 563 | |
564 | 564 | } |
565 | 565 | |
566 | 566 | |
567 | 567 | |
568 | - private function _handle_metabox_array( $boxes, $add = TRUE ) { |
|
568 | + private function _handle_metabox_array($boxes, $add = TRUE) { |
|
569 | 569 | |
570 | - foreach ( $boxes as $box ) { |
|
571 | - if ( !isset($box['page_route']) ) |
|
570 | + foreach ($boxes as $box) { |
|
571 | + if ( ! isset($box['page_route'])) |
|
572 | 572 | continue; //we dont' have a valid array |
573 | 573 | |
574 | 574 | //let's make sure $box['page_route'] is an array so the "foreach" will work. |
575 | 575 | $box['page_route'] = (array) $box['page_route']; |
576 | 576 | |
577 | - foreach ( $box['page_route'] as $route ) { |
|
578 | - if ( $route != $this->_current_route ) |
|
577 | + foreach ($box['page_route'] as $route) { |
|
578 | + if ($route != $this->_current_route) |
|
579 | 579 | continue; //get out we only add metaboxes for set route. |
580 | - if ( $add ) |
|
580 | + if ($add) |
|
581 | 581 | $this->_add_metabox($box); |
582 | 582 | else |
583 | 583 | $this->_remove_metabox($box); |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function remove_metaboxes() { |
597 | 597 | |
598 | - if ( empty( $this->_remove_metaboxes ) ) |
|
598 | + if (empty($this->_remove_metaboxes)) |
|
599 | 599 | return; //get out there are no metaboxes to remove |
600 | 600 | |
601 | - $this->_handle_metabox_array( $this->_remove_metaboxes, FALSE ); |
|
601 | + $this->_handle_metabox_array($this->_remove_metaboxes, FALSE); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | |
@@ -608,53 +608,53 @@ discard block |
||
608 | 608 | * @access private |
609 | 609 | * @param array $args an array of args that have been set for this metabox by the child class |
610 | 610 | */ |
611 | - private function _add_metabox( $args ) { |
|
611 | + private function _add_metabox($args) { |
|
612 | 612 | $current_screen = get_current_screen(); |
613 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
614 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
613 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
614 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
615 | 615 | |
616 | 616 | //set defaults |
617 | 617 | $defaults = array( |
618 | 618 | 'func' => $func, |
619 | - 'id' => $this->caller . '_' . $func . '_metabox', |
|
619 | + 'id' => $this->caller.'_'.$func.'_metabox', |
|
620 | 620 | 'priority' => 'default', |
621 | 621 | 'label' => $this->caller, |
622 | 622 | 'context' => 'advanced', |
623 | 623 | 'callback_args' => array(), |
624 | - 'page' => isset( $args['page'] ) ? $args['page'] : $screen_id |
|
624 | + 'page' => isset($args['page']) ? $args['page'] : $screen_id |
|
625 | 625 | ); |
626 | 626 | |
627 | - $args = wp_parse_args( $args, $defaults ); |
|
627 | + $args = wp_parse_args($args, $defaults); |
|
628 | 628 | extract($args); |
629 | 629 | |
630 | 630 | |
631 | 631 | //make sure method exists |
632 | - if ( !method_exists($this, $func) ) { |
|
633 | - $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />'; |
|
634 | - $msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller ); |
|
635 | - throw new EE_Error( implode('||', $msg ) ); |
|
632 | + if ( ! method_exists($this, $func)) { |
|
633 | + $msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />'; |
|
634 | + $msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller); |
|
635 | + throw new EE_Error(implode('||', $msg)); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | //everything checks out so lets add the metabox |
639 | - add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args); |
|
639 | + add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | |
643 | 643 | |
644 | - private function _remove_metabox( $args ) { |
|
644 | + private function _remove_metabox($args) { |
|
645 | 645 | $current_screen = get_current_screen(); |
646 | - $screen_id = is_object( $current_screen ) ? $current_screen->id : NULL; |
|
647 | - $func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback'; |
|
646 | + $screen_id = is_object($current_screen) ? $current_screen->id : NULL; |
|
647 | + $func = isset($args['func']) ? $args['func'] : 'some_invalid_callback'; |
|
648 | 648 | |
649 | 649 | //set defaults |
650 | 650 | $defaults = array( |
651 | - 'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox', |
|
651 | + 'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox', |
|
652 | 652 | 'context' => 'default', |
653 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id |
|
653 | + 'screen' => isset($args['screen']) ? $args['screen'] : $screen_id |
|
654 | 654 | ); |
655 | 655 | |
656 | - $args = wp_parse_args( $args, $defaults ); |
|
657 | - extract( $args ); |
|
656 | + $args = wp_parse_args($args, $defaults); |
|
657 | + extract($args); |
|
658 | 658 | |
659 | 659 | //everything checks out so lets remove the box! |
660 | 660 | remove_meta_box($id, $screen, $context); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Processor |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * @param array $registration_query_params |
51 | 51 | *@return EE_Transaction_Processor instance |
52 | 52 | */ |
53 | - public static function instance( $registration_query_params = array() ) { |
|
53 | + public static function instance($registration_query_params = array()) { |
|
54 | 54 | // check if class object is instantiated |
55 | - if ( ! self::$_instance instanceof EE_Transaction_Processor ) { |
|
56 | - self::$_instance = new self( $registration_query_params ); |
|
55 | + if ( ! self::$_instance instanceof EE_Transaction_Processor) { |
|
56 | + self::$_instance = new self($registration_query_params); |
|
57 | 57 | } |
58 | 58 | return self::$_instance; |
59 | 59 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @param array $registration_query_params |
65 | 65 | * @return EE_Transaction_Processor |
66 | 66 | */ |
67 | - private function __construct( $registration_query_params = array() ) { |
|
67 | + private function __construct($registration_query_params = array()) { |
|
68 | 68 | // make sure some query params are set for retrieving registrations |
69 | - $this->_set_registration_query_params( $registration_query_params ); |
|
69 | + $this->_set_registration_query_params($registration_query_params); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @access private |
76 | 76 | * @param array $registration_query_params |
77 | 77 | */ |
78 | - private function _set_registration_query_params( $registration_query_params ) { |
|
79 | - $this->_registration_query_params = ! empty( $registration_query_params ) ? $registration_query_params : array( 'order_by' => array( 'REG_count' => 'ASC' )); |
|
78 | + private function _set_registration_query_params($registration_query_params) { |
|
79 | + $this->_registration_query_params = ! empty($registration_query_params) ? $registration_query_params : array('order_by' => array('REG_count' => 'ASC')); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | /** |
94 | 94 | * @param string $old_txn_status |
95 | 95 | */ |
96 | - public function set_old_txn_status( $old_txn_status ) { |
|
96 | + public function set_old_txn_status($old_txn_status) { |
|
97 | 97 | // only set the first time |
98 | - if ( $this->_old_txn_status === null ) { |
|
98 | + if ($this->_old_txn_status === null) { |
|
99 | 99 | $this->_old_txn_status = $old_txn_status; |
100 | 100 | } |
101 | 101 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param string $new_txn_status |
116 | 116 | */ |
117 | - public function set_new_txn_status( $new_txn_status ) { |
|
117 | + public function set_new_txn_status($new_txn_status) { |
|
118 | 118 | $this->_new_txn_status = $new_txn_status; |
119 | 119 | } |
120 | 120 | |
@@ -145,17 +145,17 @@ discard block |
||
145 | 145 | * @param bool $check_all |
146 | 146 | * @return boolean | int |
147 | 147 | */ |
148 | - private function _reg_steps_completed( EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE ) { |
|
148 | + private function _reg_steps_completed(EE_Transaction $transaction, $reg_step_slug = '', $check_all = TRUE) { |
|
149 | 149 | $reg_steps = $transaction->reg_steps(); |
150 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps )) { |
|
150 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
151 | 151 | return false; |
152 | 152 | } |
153 | 153 | // loop thru reg steps array) |
154 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
154 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
155 | 155 | // if NOT checking ALL steps (only checking one step) |
156 | - if ( ! $check_all ) { |
|
156 | + if ( ! $check_all) { |
|
157 | 157 | // and this is the one |
158 | - if ( $slug == $reg_step_slug ) { |
|
158 | + if ($slug == $reg_step_slug) { |
|
159 | 159 | return $reg_step_completed; |
160 | 160 | } else { |
161 | 161 | // skip to next reg step in loop |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | } |
164 | 164 | } |
165 | 165 | // if any reg step is NOT completed (ignoring any specific steps), then just leave |
166 | - if ( $reg_step_completed !== true && $slug != $reg_step_slug ) { |
|
166 | + if ($reg_step_completed !== true && $slug != $reg_step_slug) { |
|
167 | 167 | return false; |
168 | - } else if ( $slug == $reg_step_slug ) { |
|
168 | + } else if ($slug == $reg_step_slug) { |
|
169 | 169 | // if we reach this point, then we are testing either: |
170 | 170 | // all_reg_steps_completed_except() or |
171 | 171 | // all_reg_steps_completed_except_final_step(), |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | * @param EE_Transaction $transaction |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function all_reg_steps_completed( EE_Transaction $transaction ) { |
|
194 | - return $this->_reg_steps_completed( $transaction ); |
|
193 | + public function all_reg_steps_completed(EE_Transaction $transaction) { |
|
194 | + return $this->_reg_steps_completed($transaction); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @param string $exception |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function all_reg_steps_completed_except( EE_Transaction $transaction, $exception = '' ) { |
|
212 | - return $this->_reg_steps_completed( $transaction, $exception ); |
|
211 | + public function all_reg_steps_completed_except(EE_Transaction $transaction, $exception = '') { |
|
212 | + return $this->_reg_steps_completed($transaction, $exception); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | * @param EE_Transaction $transaction |
226 | 226 | * @return boolean |
227 | 227 | */ |
228 | - public function all_reg_steps_completed_except_final_step( EE_Transaction $transaction ) { |
|
229 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration' ); |
|
228 | + public function all_reg_steps_completed_except_final_step(EE_Transaction $transaction) { |
|
229 | + return $this->_reg_steps_completed($transaction, 'finalize_registration'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | * @param string $reg_step_slug |
244 | 244 | * @return boolean | int |
245 | 245 | */ |
246 | - public function reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
247 | - return $this->_reg_steps_completed( $transaction, $reg_step_slug, FALSE ); |
|
246 | + public function reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
247 | + return $this->_reg_steps_completed($transaction, $reg_step_slug, FALSE); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -260,8 +260,8 @@ discard block |
||
260 | 260 | * @param EE_Transaction $transaction |
261 | 261 | * @return boolean | int |
262 | 262 | */ |
263 | - public function final_reg_step_completed( EE_Transaction $transaction ) { |
|
264 | - return $this->_reg_steps_completed( $transaction, 'finalize_registration', FALSE ); |
|
263 | + public function final_reg_step_completed(EE_Transaction $transaction) { |
|
264 | + return $this->_reg_steps_completed($transaction, 'finalize_registration', FALSE); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @param string $reg_step_slug |
276 | 276 | * @return boolean |
277 | 277 | */ |
278 | - public function set_reg_step_initiated( EE_Transaction $transaction, $reg_step_slug ) { |
|
278 | + public function set_reg_step_initiated(EE_Transaction $transaction, $reg_step_slug) { |
|
279 | 279 | $current_time = time(); |
280 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, $current_time ); |
|
280 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, $current_time); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * @param string $reg_step_slug |
292 | 292 | * @return boolean |
293 | 293 | */ |
294 | - public function set_reg_step_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
295 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, TRUE ); |
|
294 | + public function set_reg_step_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
295 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, TRUE); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -306,8 +306,8 @@ discard block |
||
306 | 306 | * @param string $reg_step_slug |
307 | 307 | * @return boolean |
308 | 308 | */ |
309 | - public function set_reg_step_not_completed( EE_Transaction $transaction, $reg_step_slug ) { |
|
310 | - return $this->_set_reg_step_completed_status( $transaction, $reg_step_slug, FALSE ); |
|
309 | + public function set_reg_step_not_completed(EE_Transaction $transaction, $reg_step_slug) { |
|
310 | + return $this->_set_reg_step_completed_status($transaction, $reg_step_slug, FALSE); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -323,36 +323,36 @@ discard block |
||
323 | 323 | * @param boolean | int $status |
324 | 324 | * @return boolean |
325 | 325 | */ |
326 | - private function _set_reg_step_completed_status( EE_Transaction $transaction, $reg_step_slug, $status ) { |
|
326 | + private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status) { |
|
327 | 327 | // validate status |
328 | - $status = is_bool( $status ) || is_numeric( $status ) ? $status : false; |
|
328 | + $status = is_bool($status) || is_numeric($status) ? $status : false; |
|
329 | 329 | // get reg steps array |
330 | 330 | $txn_reg_steps = $transaction->reg_steps(); |
331 | 331 | // if reg step does NOT exist |
332 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] )) { |
|
332 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | // if we're trying to complete a step that is already completed |
336 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
336 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
337 | 337 | return true; |
338 | 338 | } |
339 | 339 | // if we're trying to complete a step that hasn't even started |
340 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
340 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | // if current status value matches the incoming value (no change) |
344 | - if ( $txn_reg_steps[ $reg_step_slug ] === $status ) { |
|
344 | + if ($txn_reg_steps[$reg_step_slug] === $status) { |
|
345 | 345 | // this will happen in cases where multiple AJAX requests occur during the same step |
346 | 346 | return true; |
347 | 347 | } |
348 | 348 | // if we're trying to set a start time |
349 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] )) { |
|
349 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
350 | 350 | // skip the update below, but don't return FALSE so that errors won't be displayed |
351 | 351 | return true; |
352 | 352 | } |
353 | 353 | // update completed status |
354 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
355 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
354 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
355 | + $transaction->set_reg_steps($txn_reg_steps); |
|
356 | 356 | $transaction->save(); |
357 | 357 | // DEBUG LOG |
358 | 358 | //$this->log( |
@@ -378,11 +378,11 @@ discard block |
||
378 | 378 | * @param string $reg_step_slug |
379 | 379 | * @return void |
380 | 380 | */ |
381 | - public function remove_reg_step( EE_Transaction $transaction, $reg_step_slug ) { |
|
381 | + public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { |
|
382 | 382 | // get reg steps array |
383 | 383 | $txn_reg_steps = $transaction->reg_steps(); |
384 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
385 | - $transaction->set_reg_steps( $txn_reg_steps ); |
|
384 | + unset($txn_reg_steps[$reg_step_slug]); |
|
385 | + $transaction->set_reg_steps($txn_reg_steps); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | * @param EE_Transaction $transaction |
397 | 397 | * @return boolean |
398 | 398 | */ |
399 | - public function toggle_failed_transaction_status( EE_Transaction $transaction ) { |
|
399 | + public function toggle_failed_transaction_status(EE_Transaction $transaction) { |
|
400 | 400 | // set incoming TXN_Status |
401 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
401 | + $this->set_old_txn_status($transaction->status_ID()); |
|
402 | 402 | // if TXN status is still set as "failed"... |
403 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code ) { |
|
403 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code) { |
|
404 | 404 | // set incoming TXN_Status |
405 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
406 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
405 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
406 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
407 | 407 | return TRUE; |
408 | 408 | } |
409 | 409 | return FALSE; |
@@ -419,20 +419,20 @@ discard block |
||
419 | 419 | * @param EE_Transaction $transaction |
420 | 420 | * @return boolean |
421 | 421 | */ |
422 | - public function toggle_abandoned_transaction_status( EE_Transaction $transaction ) { |
|
422 | + public function toggle_abandoned_transaction_status(EE_Transaction $transaction) { |
|
423 | 423 | // set incoming TXN_Status |
424 | - $this->set_old_txn_status( $transaction->status_ID() ); |
|
424 | + $this->set_old_txn_status($transaction->status_ID()); |
|
425 | 425 | // if TXN status has not been updated already due to a payment, and is still set as "failed" or "abandoned"... |
426 | - if ( $transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code ) { |
|
427 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
426 | + if ($transaction->status_ID() == EEM_Transaction::failed_status_code || $transaction->status_ID() == EEM_Transaction::abandoned_status_code) { |
|
427 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
428 | 428 | // if a contact record for the primary registrant has been created |
429 | - if ( $transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee ) { |
|
430 | - $transaction->set_status( EEM_Transaction::incomplete_status_code ); |
|
431 | - $this->set_new_txn_status( EEM_Transaction::incomplete_status_code ); |
|
429 | + if ($transaction->primary_registration() instanceof EE_Registration && $transaction->primary_registration()->attendee() instanceof EE_Attendee) { |
|
430 | + $transaction->set_status(EEM_Transaction::incomplete_status_code); |
|
431 | + $this->set_new_txn_status(EEM_Transaction::incomplete_status_code); |
|
432 | 432 | } else { |
433 | 433 | // no contact record? yer abandoned! |
434 | - $transaction->set_status( EEM_Transaction::abandoned_status_code ); |
|
435 | - $this->set_new_txn_status( EEM_Transaction::abandoned_status_code ); |
|
434 | + $transaction->set_status(EEM_Transaction::abandoned_status_code); |
|
435 | + $this->set_new_txn_status(EEM_Transaction::abandoned_status_code); |
|
436 | 436 | } |
437 | 437 | return TRUE; |
438 | 438 | } |
@@ -450,16 +450,16 @@ discard block |
||
450 | 450 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
451 | 451 | * @return boolean |
452 | 452 | */ |
453 | - public function manually_update_registration_statuses( EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array() ) { |
|
454 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status ); |
|
453 | + public function manually_update_registration_statuses(EE_Transaction $transaction, $new_reg_status = '', $registration_query_params = array()) { |
|
454 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('manually_update_registration_status', $transaction, $registration_query_params, $new_reg_status); |
|
455 | 455 | // send messages |
456 | 456 | /** @type EE_Registration_Processor $registration_processor */ |
457 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
457 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
458 | 458 | $registration_processor->trigger_registration_update_notifications( |
459 | 459 | $transaction->primary_registration(), |
460 | - array( 'manually_updated' => true ) |
|
460 | + array('manually_updated' => true) |
|
461 | 461 | ); |
462 | - do_action( 'AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates ); |
|
462 | + do_action('AHEE__EE_Transaction_Processor__manually_update_registration_statuses', $transaction, $status_updates); |
|
463 | 463 | return $status_updates; |
464 | 464 | } |
465 | 465 | |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
474 | 474 | * @return boolean |
475 | 475 | */ |
476 | - public function toggle_registration_statuses_for_default_approved_events( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
477 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params ); |
|
478 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates ); |
|
476 | + public function toggle_registration_statuses_for_default_approved_events(EE_Transaction $transaction, $registration_query_params = array()) { |
|
477 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_for_default_approved_events', $transaction, $registration_query_params); |
|
478 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events', $transaction, $status_updates); |
|
479 | 479 | return $status_updates; |
480 | 480 | } |
481 | 481 | |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | * @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction |
490 | 490 | * @return boolean |
491 | 491 | */ |
492 | - public function toggle_registration_statuses_if_no_monies_owing( EE_Transaction $transaction, $registration_query_params = array() ) { |
|
493 | - $status_updates = $this->_call_method_on_registrations_via_Registration_Processor( 'toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params ); |
|
494 | - do_action( 'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates ); |
|
492 | + public function toggle_registration_statuses_if_no_monies_owing(EE_Transaction $transaction, $registration_query_params = array()) { |
|
493 | + $status_updates = $this->_call_method_on_registrations_via_Registration_Processor('toggle_registration_status_if_no_monies_owing', $transaction, $registration_query_params); |
|
494 | + do_action('AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing', $transaction, $status_updates); |
|
495 | 495 | return $status_updates; |
496 | 496 | } |
497 | 497 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @throws \EE_Error |
508 | 508 | * @return array |
509 | 509 | */ |
510 | - public function update_transaction_and_registrations_after_checkout_or_payment( EE_Transaction $transaction, $payment = NULL, $registration_query_params = array() ) { |
|
510 | + public function update_transaction_and_registrations_after_checkout_or_payment(EE_Transaction $transaction, $payment = NULL, $registration_query_params = array()) { |
|
511 | 511 | // set incoming TXN_Status, and consider it new since old status should have been set |
512 | - $this->set_new_txn_status( $transaction->status_ID() ); |
|
513 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()' ); |
|
512 | + $this->set_new_txn_status($transaction->status_ID()); |
|
513 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $transaction->status_ID(), '$transaction->status_ID()'); |
|
514 | 514 | // make sure some query params are set for retrieving registrations |
515 | - $this->_set_registration_query_params( $registration_query_params ); |
|
515 | + $this->_set_registration_query_params($registration_query_params); |
|
516 | 516 | // get final reg step status |
517 | - $finalized = $this->final_reg_step_completed( $transaction ); |
|
517 | + $finalized = $this->final_reg_step_completed($transaction); |
|
518 | 518 | // if the 'finalize_registration' step has been initiated (has a timestamp) but has not yet been fully completed (TRUE) |
519 | - if ( is_numeric( $finalized ) && $finalized !== true ) { |
|
520 | - $this->set_reg_step_completed( $transaction, 'finalize_registration' ); |
|
519 | + if (is_numeric($finalized) && $finalized !== true) { |
|
520 | + $this->set_reg_step_completed($transaction, 'finalize_registration'); |
|
521 | 521 | $finalized = true; |
522 | 522 | } |
523 | 523 | $transaction->save(); |
@@ -540,13 +540,13 @@ discard block |
||
540 | 540 | |
541 | 541 | // send messages |
542 | 542 | /** @type EE_Registration_Processor $registration_processor */ |
543 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
543 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
544 | 544 | $registration_processor->trigger_registration_update_notifications( |
545 | 545 | $transaction->primary_registration(), |
546 | 546 | $update_params |
547 | 547 | ); |
548 | 548 | |
549 | - do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params ); |
|
549 | + do_action('AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params); |
|
550 | 550 | return $update_params; |
551 | 551 | } |
552 | 552 | |
@@ -564,23 +564,23 @@ discard block |
||
564 | 564 | * @throws \EE_Error |
565 | 565 | * @return boolean |
566 | 566 | */ |
567 | - private function _call_method_on_registrations_via_Registration_Processor( $method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL ) { |
|
567 | + private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL) { |
|
568 | 568 | $response = FALSE; |
569 | 569 | /** @type EE_Registration_Processor $registration_processor */ |
570 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
570 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
571 | 571 | // check that method exists |
572 | - if ( ! method_exists( $registration_processor, $method_name )) { |
|
573 | - throw new EE_Error( __( 'Method does not exist.', 'event_espresso' )); |
|
572 | + if ( ! method_exists($registration_processor, $method_name)) { |
|
573 | + throw new EE_Error(__('Method does not exist.', 'event_espresso')); |
|
574 | 574 | } |
575 | 575 | // make sure some query params are set for retrieving registrations |
576 | - $this->_set_registration_query_params( $registration_query_params ); |
|
576 | + $this->_set_registration_query_params($registration_query_params); |
|
577 | 577 | // loop through cached registrations |
578 | - foreach ( $transaction->registrations( $this->_registration_query_params ) as $registration ) { |
|
579 | - if ( $registration instanceof EE_Registration ) { |
|
580 | - if ( $additional_param ) { |
|
581 | - $response = $registration_processor->$method_name( $registration, $additional_param ) ? TRUE : $response; |
|
578 | + foreach ($transaction->registrations($this->_registration_query_params) as $registration) { |
|
579 | + if ($registration instanceof EE_Registration) { |
|
580 | + if ($additional_param) { |
|
581 | + $response = $registration_processor->$method_name($registration, $additional_param) ? TRUE : $response; |
|
582 | 582 | } else { |
583 | - $response = $registration_processor->$method_name( $registration ) ? TRUE : $response; |
|
583 | + $response = $registration_processor->$method_name($registration) ? TRUE : $response; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | } |
@@ -605,46 +605,46 @@ discard block |
||
605 | 605 | public function set_transaction_payment_method_based_on_registration_statuses( |
606 | 606 | EE_Registration $edited_registration |
607 | 607 | ) { |
608 | - if ( $edited_registration instanceof EE_Registration ) { |
|
608 | + if ($edited_registration instanceof EE_Registration) { |
|
609 | 609 | $transaction = $edited_registration->transaction(); |
610 | - if ( $transaction instanceof EE_Transaction ) { |
|
610 | + if ($transaction instanceof EE_Transaction) { |
|
611 | 611 | $all_not_approved = true; |
612 | - foreach ( $transaction->registrations() as $registration ) { |
|
613 | - if ( $registration instanceof EE_Registration ) { |
|
612 | + foreach ($transaction->registrations() as $registration) { |
|
613 | + if ($registration instanceof EE_Registration) { |
|
614 | 614 | // if any REG != "Not Approved" then toggle to false |
615 | 615 | $all_not_approved = $registration->is_not_approved() ? $all_not_approved : false; |
616 | 616 | } |
617 | 617 | } |
618 | 618 | // if ALL Registrations are "Not Approved" |
619 | - if ( $all_not_approved ) { |
|
620 | - $transaction->set_payment_method_ID( null ); |
|
619 | + if ($all_not_approved) { |
|
620 | + $transaction->set_payment_method_ID(null); |
|
621 | 621 | $transaction->save(); |
622 | 622 | } else { |
623 | - $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ); |
|
624 | - if ( ! empty( $available_payment_methods ) ) { |
|
623 | + $available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart); |
|
624 | + if ( ! empty($available_payment_methods)) { |
|
625 | 625 | $PMD_ID = 0; |
626 | - foreach ( $available_payment_methods as $available_payment_method ) { |
|
627 | - if ( $available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default() ) { |
|
626 | + foreach ($available_payment_methods as $available_payment_method) { |
|
627 | + if ($available_payment_method instanceof EE_Payment_Method && $available_payment_method->open_by_default()) { |
|
628 | 628 | $PMD_ID = $available_payment_method->ID(); |
629 | 629 | break; |
630 | 630 | } |
631 | 631 | } |
632 | - if ( ! $PMD_ID ) { |
|
633 | - $first_payment_method = reset( $available_payment_methods ); |
|
634 | - if ( $first_payment_method instanceof EE_Payment_Method ) { |
|
632 | + if ( ! $PMD_ID) { |
|
633 | + $first_payment_method = reset($available_payment_methods); |
|
634 | + if ($first_payment_method instanceof EE_Payment_Method) { |
|
635 | 635 | $PMD_ID = $first_payment_method->ID(); |
636 | 636 | } else { |
637 | 637 | EE_Error::add_error( |
638 | - __( 'A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso' ), |
|
638 | + __('A valid Payment Method could not be determined. Please ensure that at least one Payment Method is activated.', 'event_espresso'), |
|
639 | 639 | __FILE__, __LINE__, __FUNCTION__ |
640 | 640 | ); |
641 | 641 | } |
642 | 642 | } |
643 | - $transaction->set_payment_method_ID( $PMD_ID ); |
|
643 | + $transaction->set_payment_method_ID($PMD_ID); |
|
644 | 644 | $transaction->save(); |
645 | 645 | } else { |
646 | 646 | EE_Error::add_error( |
647 | - __( 'Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso' ), |
|
647 | + __('Please activate at least one Payment Method in order for things to operate correctly.', 'event_espresso'), |
|
648 | 648 | __FILE__, __LINE__, __FUNCTION__ |
649 | 649 | ); |
650 | 650 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Add_New_State |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
31 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 ); |
|
32 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 ); |
|
33 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
34 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
35 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
36 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
37 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
38 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
39 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
30 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
31 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
32 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
33 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
34 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
35 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
36 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
37 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
38 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
39 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | public static function set_hooks_admin() { |
49 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
50 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
51 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
52 | - add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
53 | - add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
54 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
55 | - add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
56 | - add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
57 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
58 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
59 | - add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 ); |
|
60 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
61 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
49 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
50 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
51 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
52 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
53 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
54 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
55 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
56 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
57 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
58 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
59 | + add_filter('FHEE__Single_Page_Checkout___check_form_submission__request_params', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
60 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
61 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * @return void |
71 | 71 | */ |
72 | 72 | public static function set_definitions() { |
73 | - define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
74 | - define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
73 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
74 | + define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param \WP $WP |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - public function run( $WP ) { |
|
86 | + public function run($WP) { |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @return void |
112 | 112 | */ |
113 | 113 | public static function wp_enqueue_scripts() { |
114 | - if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) { |
|
115 | - wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true ); |
|
116 | - wp_enqueue_script( 'add_new_state' ); |
|
114 | + if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
115 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
116 | + wp_enqueue_script('add_new_state'); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,30 +127,30 @@ discard block |
||
127 | 127 | * @return string |
128 | 128 | */ |
129 | 129 | // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
130 | - public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){ |
|
130 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) { |
|
131 | 131 | // only add the 'new_state_micro_form' when displaying reg forms, |
132 | 132 | // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
133 | - $action = EE_Registry::instance()->REQ->get( 'action', '' ); |
|
134 | - if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) { |
|
133 | + $action = EE_Registry::instance()->REQ->get('action', ''); |
|
134 | + if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
135 | 135 | return $question_group_reg_form; |
136 | 136 | } |
137 | 137 | // is the "state" question in this form section? |
138 | - $input = $question_group_reg_form->get_subsection( 'state' ); |
|
138 | + $input = $question_group_reg_form->get_subsection('state'); |
|
139 | 139 | // we're only doing this for state select inputs |
140 | - if ( $input instanceof EE_State_Select_Input ) { |
|
140 | + if ($input instanceof EE_State_Select_Input) { |
|
141 | 141 | // load helpers |
142 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
142 | + EE_Registry::instance()->load_helper('HTML'); |
|
143 | 143 | // grab any set values from the request |
144 | - $country_name = str_replace( 'state', 'new_state_country', $input->html_name() ); |
|
145 | - $state_name = str_replace( 'state', 'new_state_name', $input->html_name() ); |
|
146 | - $abbrv_name = str_replace( 'state', 'new_state_abbrv', $input->html_name() ); |
|
147 | - $new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() ); |
|
144 | + $country_name = str_replace('state', 'new_state_country', $input->html_name()); |
|
145 | + $state_name = str_replace('state', 'new_state_name', $input->html_name()); |
|
146 | + $abbrv_name = str_replace('state', 'new_state_abbrv', $input->html_name()); |
|
147 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
148 | 148 | $country_options = array(); |
149 | 149 | $countries = EEM_Country::instance()->get_all_countries(); |
150 | - if ( ! empty( $countries )) { |
|
151 | - foreach( $countries as $country ){ |
|
152 | - if ( $country instanceof EE_Country ) { |
|
153 | - $country_options[ $country->ID() ] = $country->name(); |
|
150 | + if ( ! empty($countries)) { |
|
151 | + foreach ($countries as $country) { |
|
152 | + if ($country instanceof EE_Country) { |
|
153 | + $country_options[$country->ID()] = $country->name(); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | // add hidden input to indicate that a new state is being added |
164 | 164 | 'add_new_state' => new EE_Hidden_Input( |
165 | 165 | array( |
166 | - 'html_name' => str_replace( 'state', 'add_new_state', $input->html_name() ), |
|
167 | - 'html_id' => str_replace( 'state', 'add_new_state', $input->html_id() ), |
|
166 | + 'html_name' => str_replace('state', 'add_new_state', $input->html_name()), |
|
167 | + 'html_id' => str_replace('state', 'add_new_state', $input->html_id()), |
|
168 | 168 | 'default' => 0 |
169 | 169 | ) |
170 | 170 | ), |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | '', |
177 | 177 | __('click here to add a new state/province', 'event_espresso'), |
178 | 178 | '', |
179 | - 'display-' . $input->html_id(), |
|
179 | + 'display-'.$input->html_id(), |
|
180 | 180 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
181 | 181 | '', |
182 | - 'rel="' . $input->html_id() . '"' |
|
182 | + 'rel="'.$input->html_id().'"' |
|
183 | 183 | ) |
184 | 184 | ) |
185 | 185 | ), |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | 'add_new_state_micro_form' =>new EE_Form_Section_HTML( |
188 | 188 | apply_filters( |
189 | 189 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
190 | - EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) . |
|
191 | - EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) . |
|
192 | - EEH_HTML::ul() . |
|
193 | - EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) . |
|
194 | - EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) . |
|
195 | - EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) . |
|
196 | - EEH_HTML::li( __('click the ADD button', 'event_espresso') ) . |
|
190 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;'). |
|
191 | + EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')). |
|
192 | + EEH_HTML::ul(). |
|
193 | + EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')). |
|
194 | + EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')). |
|
195 | + EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')). |
|
196 | + EEH_HTML::li(__('click the ADD button', 'event_espresso')). |
|
197 | 197 | EEH_HTML::ulx() |
198 | 198 | ) |
199 | 199 | ), |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | $country_options, |
203 | 203 | array( |
204 | 204 | 'html_name' => $country_name, |
205 | - 'html_id' => str_replace( 'state', 'new_state_country', $input->html_id() ), |
|
206 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
205 | + 'html_id' => str_replace('state', 'new_state_country', $input->html_id()), |
|
206 | + 'html_class' => $input->html_class().' new-state-country', |
|
207 | 207 | 'html_label_text' => __('New State/Province Country', 'event_espresso'), |
208 | - 'default' => EE_Registry::instance()->REQ->get( $country_name, '' ), |
|
208 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
209 | 209 | 'required' => false |
210 | 210 | ) |
211 | 211 | ), |
@@ -213,23 +213,23 @@ discard block |
||
213 | 213 | 'new_state_name' => new EE_Text_Input( |
214 | 214 | array( |
215 | 215 | 'html_name' => $state_name, |
216 | - 'html_id' => str_replace( 'state', 'new_state_name', $input->html_id() ), |
|
217 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
216 | + 'html_id' => str_replace('state', 'new_state_name', $input->html_id()), |
|
217 | + 'html_class' => $input->html_class().' new-state-state', |
|
218 | 218 | 'html_label_text' => __('New State/Province Name', 'event_espresso'), |
219 | - 'default' => EE_Registry::instance()->REQ->get( $state_name, '' ), |
|
219 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
220 | 220 | 'required' => false |
221 | 221 | ) |
222 | 222 | ), |
223 | - 'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ), |
|
223 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
224 | 224 | // NEW STATE NAME |
225 | 225 | 'new_state_abbrv' => new EE_Text_Input( |
226 | 226 | array( |
227 | 227 | 'html_name' => $abbrv_name, |
228 | - 'html_id' => str_replace( 'state', 'new_state_abbrv', $input->html_id() ), |
|
229 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
228 | + 'html_id' => str_replace('state', 'new_state_abbrv', $input->html_id()), |
|
229 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
230 | 230 | 'html_label_text' => __('New State/Province Abbreviation', 'event_espresso'), |
231 | 231 | 'html_other_attributes' => 'size="24"', |
232 | - 'default' => EE_Registry::instance()->REQ->get( $abbrv_name, '' ), |
|
232 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
233 | 233 | 'required' => false |
234 | 234 | ) |
235 | 235 | ), |
@@ -237,26 +237,26 @@ discard block |
||
237 | 237 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
238 | 238 | apply_filters( |
239 | 239 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
240 | - EEH_HTML::nbsp(3) . |
|
241 | - EEH_HTML::link( '', __('ADD', 'event_espresso'), '', 'submit-' . $new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="' . $new_state_submit_id . '"' ) |
|
240 | + EEH_HTML::nbsp(3). |
|
241 | + EEH_HTML::link('', __('ADD', 'event_espresso'), '', 'submit-'.$new_state_submit_id, 'ee-form-add-new-state-submit button button-secondary', '', 'rel="'.$new_state_submit_id.'"') |
|
242 | 242 | ) |
243 | 243 | ), |
244 | 244 | // extra info |
245 | 245 | 'add_new_state_extra' => new EE_Form_Section_HTML( |
246 | 246 | apply_filters( |
247 | 247 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
248 | - EEH_HTML::br(2) . |
|
249 | - EEH_HTML::div( '', '', 'small-text' ) . |
|
250 | - EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) . |
|
251 | - EEH_HTML::br() . |
|
248 | + EEH_HTML::br(2). |
|
249 | + EEH_HTML::div('', '', 'small-text'). |
|
250 | + EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')). |
|
251 | + EEH_HTML::br(). |
|
252 | 252 | sprintf( |
253 | 253 | __('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'), |
254 | - EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' ) |
|
255 | - ) . |
|
256 | - EEH_HTML::divx() . |
|
257 | - EEH_HTML::br() . |
|
258 | - EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="' . $input->html_id() . '"' ) . |
|
259 | - EEH_HTML::divx() . |
|
254 | + EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk') |
|
255 | + ). |
|
256 | + EEH_HTML::divx(). |
|
257 | + EEH_HTML::br(). |
|
258 | + EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'rel="'.$input->html_id().'"'). |
|
259 | + EEH_HTML::divx(). |
|
260 | 260 | EEH_HTML::br() |
261 | 261 | ) |
262 | 262 | ) |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ) |
265 | 265 | ) |
266 | 266 | ); |
267 | - $question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false ); |
|
267 | + $question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false); |
|
268 | 268 | } |
269 | 269 | return $question_group_reg_form; |
270 | 270 | } |
@@ -281,41 +281,41 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public static function add_new_state() { |
283 | 283 | $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
284 | - if ( $REQ->is_set( 'add_new_state' ) && $REQ->get( 'add_new_state' ) == 1 ) { |
|
284 | + if ($REQ->is_set('add_new_state') && $REQ->get('add_new_state') == 1) { |
|
285 | 285 | EE_Registry::instance()->load_model('State'); |
286 | 286 | // grab country ISO code, new state name, and new state abbreviation |
287 | - $state_country = $REQ->is_set( 'new_state_country' ) ? sanitize_text_field( $REQ->get( 'new_state_country' )) : FALSE; |
|
288 | - $state_name = $REQ->is_set( 'new_state_name' ) ? sanitize_text_field( $REQ->get( 'new_state_name' )) : FALSE; |
|
289 | - $state_abbr = $REQ->is_set( 'new_state_abbrv' ) ? sanitize_text_field( $REQ->get( 'new_state_abbrv' )) : FALSE; |
|
287 | + $state_country = $REQ->is_set('new_state_country') ? sanitize_text_field($REQ->get('new_state_country')) : FALSE; |
|
288 | + $state_name = $REQ->is_set('new_state_name') ? sanitize_text_field($REQ->get('new_state_name')) : FALSE; |
|
289 | + $state_abbr = $REQ->is_set('new_state_abbrv') ? sanitize_text_field($REQ->get('new_state_abbrv')) : FALSE; |
|
290 | 290 | |
291 | 291 | //echo '<h4>$state_country : ' . $state_country . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
292 | 292 | //echo '<h4>$state_name : ' . $state_name . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
293 | 293 | //echo '<h4>$state_abbr : ' . $state_abbr . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
294 | 294 | |
295 | - if ( $state_country && $state_name && $state_abbr ) { |
|
296 | - $new_state = EED_Add_New_State::save_new_state_to_db( array( |
|
297 | - 'CNT_ISO'=> strtoupper( $state_country ), |
|
298 | - 'STA_abbrev' => strtoupper( $state_abbr ), |
|
299 | - 'STA_name' => ucwords( $state_name ), |
|
295 | + if ($state_country && $state_name && $state_abbr) { |
|
296 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
297 | + 'CNT_ISO'=> strtoupper($state_country), |
|
298 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
299 | + 'STA_name' => ucwords($state_name), |
|
300 | 300 | 'STA_active' => FALSE |
301 | 301 | )); |
302 | 302 | |
303 | - if ( $new_state instanceof EE_State ) { |
|
303 | + if ($new_state instanceof EE_State) { |
|
304 | 304 | // clean house |
305 | - EE_Registry::instance()->REQ->un_set( 'add_new_state' ); |
|
306 | - EE_Registry::instance()->REQ->un_set( 'new_state_country' ); |
|
307 | - EE_Registry::instance()->REQ->un_set( 'new_state_name' ); |
|
308 | - EE_Registry::instance()->REQ->un_set( 'new_state_abbrv' ); |
|
305 | + EE_Registry::instance()->REQ->un_set('add_new_state'); |
|
306 | + EE_Registry::instance()->REQ->un_set('new_state_country'); |
|
307 | + EE_Registry::instance()->REQ->un_set('new_state_name'); |
|
308 | + EE_Registry::instance()->REQ->un_set('new_state_abbrv'); |
|
309 | 309 | |
310 | 310 | // get any existing new states |
311 | 311 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
312 | 312 | 'new_states' |
313 | 313 | ); |
314 | - $new_states[ $new_state->ID() ] = $new_state; |
|
315 | - EE_Registry::instance()->SSN->set_session_data( array( 'new_states' => $new_states )); |
|
314 | + $new_states[$new_state->ID()] = $new_state; |
|
315 | + EE_Registry::instance()->SSN->set_session_data(array('new_states' => $new_states)); |
|
316 | 316 | |
317 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
318 | - echo json_encode( array( |
|
317 | + if (EE_Registry::instance()->REQ->ajax) { |
|
318 | + echo json_encode(array( |
|
319 | 319 | 'success' => TRUE, |
320 | 320 | 'id' => $new_state->ID(), |
321 | 321 | 'name' => $new_state->name(), |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | } else { |
333 | - $error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' ); |
|
334 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
335 | - echo json_encode( array( 'error' => $error )); |
|
333 | + $error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso'); |
|
334 | + if (EE_Registry::instance()->REQ->ajax) { |
|
335 | + echo json_encode(array('error' => $error)); |
|
336 | 336 | exit(); |
337 | 337 | } else { |
338 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
338 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | } |
@@ -353,11 +353,11 @@ discard block |
||
353 | 353 | * @param array $request_params |
354 | 354 | * @return array |
355 | 355 | */ |
356 | - public static function filter_checkout_request_params ( $request_params ) { |
|
357 | - foreach ( $request_params as $form_section ) { |
|
358 | - if ( is_array( $form_section )) { |
|
359 | - EED_Add_New_State::unset_new_state_request_params( $form_section ); |
|
360 | - EED_Add_New_State::filter_checkout_request_params( $form_section ); |
|
356 | + public static function filter_checkout_request_params($request_params) { |
|
357 | + foreach ($request_params as $form_section) { |
|
358 | + if (is_array($form_section)) { |
|
359 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
360 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | return $request_params; |
@@ -372,12 +372,12 @@ discard block |
||
372 | 372 | * @param array $request_params |
373 | 373 | * @return boolean |
374 | 374 | */ |
375 | - public static function unset_new_state_request_params ( $request_params ) { |
|
376 | - unset( $request_params[ 'new_state_micro_form' ] ); |
|
377 | - unset( $request_params[ 'add_new_state' ] ); |
|
378 | - unset( $request_params[ 'new_state_country' ] ); |
|
379 | - unset( $request_params[ 'new_state_name' ] ); |
|
380 | - unset( $request_params[ 'new_state_abbrv' ] ); |
|
375 | + public static function unset_new_state_request_params($request_params) { |
|
376 | + unset($request_params['new_state_micro_form']); |
|
377 | + unset($request_params['add_new_state']); |
|
378 | + unset($request_params['new_state_country']); |
|
379 | + unset($request_params['new_state_name']); |
|
380 | + unset($request_params['new_state_abbrv']); |
|
381 | 381 | return $request_params; |
382 | 382 | } |
383 | 383 | |
@@ -390,25 +390,25 @@ discard block |
||
390 | 390 | * @param array $props_n_values |
391 | 391 | * @return boolean |
392 | 392 | */ |
393 | - public static function save_new_state_to_db ( $props_n_values = array() ) { |
|
393 | + public static function save_new_state_to_db($props_n_values = array()) { |
|
394 | 394 | // EEH_Debug_Tools::printr( $props_n_values, '$props_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
395 | - $existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 )); |
|
396 | - if ( ! empty( $existing_state )) { |
|
397 | - return array_pop( $existing_state ); |
|
395 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
396 | + if ( ! empty($existing_state)) { |
|
397 | + return array_pop($existing_state); |
|
398 | 398 | } |
399 | - $new_state = EE_State::new_instance( $props_n_values ); |
|
400 | - if ( $new_state instanceof EE_State ) { |
|
399 | + $new_state = EE_State::new_instance($props_n_values); |
|
400 | + if ($new_state instanceof EE_State) { |
|
401 | 401 | // if not non-ajax admin |
402 | - $new_state_key = $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
402 | + $new_state_key = $new_state->country_iso().'-'.$new_state->abbrev(); |
|
403 | 403 | $new_state_notice = sprintf( |
404 | - __( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ), |
|
405 | - '<b>' . $new_state->name() . '</b>', |
|
406 | - '<b>' . $new_state->abbrev() . '</b>', |
|
407 | - '<b>' . $new_state->country()->name() . '</b>', |
|
408 | - '<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>', |
|
404 | + __('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'), |
|
405 | + '<b>'.$new_state->name().'</b>', |
|
406 | + '<b>'.$new_state->abbrev().'</b>', |
|
407 | + '<b>'.$new_state->country()->name().'</b>', |
|
408 | + '<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>', |
|
409 | 409 | '<br />' |
410 | 410 | ); |
411 | - EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice ); |
|
411 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
412 | 412 | $new_state->save(); |
413 | 413 | EEM_State::instance()->reset_cached_states(); |
414 | 414 | return $new_state; |
@@ -427,22 +427,22 @@ discard block |
||
427 | 427 | * @param array $cols_n_values |
428 | 428 | * @return boolean |
429 | 429 | */ |
430 | - public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) { |
|
431 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE; |
|
432 | - if ( ! $CNT_ISO ) { |
|
433 | - EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
430 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) { |
|
431 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE; |
|
432 | + if ( ! $CNT_ISO) { |
|
433 | + EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
434 | 434 | } |
435 | - $STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
436 | - if ( ! $STA_abbrev && ! empty( $STA_ID )) { |
|
437 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
438 | - if ( $state instanceof EE_State ) { |
|
435 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
436 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
437 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
438 | + if ($state instanceof EE_State) { |
|
439 | 439 | $STA_abbrev = $state->abbrev(); |
440 | 440 | } |
441 | 441 | } |
442 | - if ( ! $STA_abbrev ) { |
|
443 | - EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
442 | + if ( ! $STA_abbrev) { |
|
443 | + EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
444 | 444 | } |
445 | - EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE ); |
|
445 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -458,19 +458,19 @@ discard block |
||
458 | 458 | * @param $answer |
459 | 459 | * @return bool |
460 | 460 | */ |
461 | - public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
462 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) { |
|
461 | + public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
462 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) { |
|
463 | 463 | $STA_ID = $answer->value(); |
464 | - if ( ! empty( $STA_ID ) ) { |
|
465 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
466 | - if ( $state instanceof EE_State ) { |
|
464 | + if ( ! empty($STA_ID)) { |
|
465 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
466 | + if ($state instanceof EE_State) { |
|
467 | 467 | $country = $state->country(); |
468 | - if ( $country instanceof EE_Country ) { |
|
469 | - if ( ! isset( $state_options[ $country->name() ] )) { |
|
470 | - $state_options[ $country->name() ] = array(); |
|
468 | + if ($country instanceof EE_Country) { |
|
469 | + if ( ! isset($state_options[$country->name()])) { |
|
470 | + $state_options[$country->name()] = array(); |
|
471 | 471 | } |
472 | - if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) { |
|
473 | - $state_options[ $country->name() ][ $STA_ID ] = $state->name(); |
|
472 | + if ( ! isset($state_options[$country->name()][$STA_ID])) { |
|
473 | + $state_options[$country->name()][$STA_ID] = $state->name(); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | } |
@@ -492,14 +492,14 @@ discard block |
||
492 | 492 | * @param $answer |
493 | 493 | * @return bool |
494 | 494 | */ |
495 | - public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
496 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) { |
|
495 | + public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
496 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) { |
|
497 | 497 | $CNT_ISO = $answer->value(); |
498 | - if ( ! empty( $CNT_ISO ) ) { |
|
499 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
500 | - if ( $country instanceof EE_Country ) { |
|
501 | - if ( ! isset( $country_options[ $CNT_ISO ] ) ) { |
|
502 | - $country_options[ $CNT_ISO ] = $country->name(); |
|
498 | + if ( ! empty($CNT_ISO)) { |
|
499 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
500 | + if ($country instanceof EE_Country) { |
|
501 | + if ( ! isset($country_options[$CNT_ISO])) { |
|
502 | + $country_options[$CNT_ISO] = $country->name(); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | } |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param EE_State[] $state_options |
517 | 517 | * @return boolean |
518 | 518 | */ |
519 | - public static function state_options( $state_options = array() ) { |
|
519 | + public static function state_options($state_options = array()) { |
|
520 | 520 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
521 | 521 | 'new_states' |
522 | 522 | ); |
523 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
524 | - foreach ( $new_states as $new_state ) { |
|
523 | + if (is_array($new_states) && ! empty($new_states)) { |
|
524 | + foreach ($new_states as $new_state) { |
|
525 | 525 | if ( |
526 | 526 | $new_state instanceof EE_State |
527 | 527 | && $new_state->country() instanceof EE_Country |
528 | 528 | ) { |
529 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name(); |
|
529 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } |
@@ -542,17 +542,17 @@ discard block |
||
542 | 542 | * @param EE_Country[] $country_options |
543 | 543 | * @return boolean |
544 | 544 | */ |
545 | - public static function country_options( $country_options = array() ) { |
|
545 | + public static function country_options($country_options = array()) { |
|
546 | 546 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
547 | 547 | 'new_states' |
548 | 548 | ); |
549 | - if ( is_array( $new_states ) && ! empty( $new_states )) { |
|
550 | - foreach ( $new_states as $new_state ) { |
|
549 | + if (is_array($new_states) && ! empty($new_states)) { |
|
550 | + foreach ($new_states as $new_state) { |
|
551 | 551 | if ( |
552 | 552 | $new_state instanceof EE_State |
553 | 553 | && $new_state->country() instanceof EE_Country |
554 | 554 | ) { |
555 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name(); |
|
555 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
556 | 556 | } |
557 | 557 | } |
558 | 558 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,31 +198,31 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // load EE_SPCO_Reg_Step base class |
205 | 205 | // EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_SPCO_Reg_Step', 'class' ); |
206 | 206 | // filter list of reg_steps |
207 | - $reg_steps_to_load = apply_filters( 'AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps() ); |
|
207 | + $reg_steps_to_load = apply_filters('AHEE__SPCO__load_reg_steps__reg_steps_to_load', EED_Single_Page_Checkout::get_reg_steps()); |
|
208 | 208 | // sort by key (order) |
209 | - ksort( $reg_steps_to_load ); |
|
209 | + ksort($reg_steps_to_load); |
|
210 | 210 | // loop through folders |
211 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
211 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
212 | 212 | // we need a |
213 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
213 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
214 | 214 | // copy over to the reg_steps_array |
215 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
215 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
216 | 216 | // register custom key route for each reg step ( ie: step=>"slug" - this is the entire reason we load the reg steps array now ) |
217 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
217 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
218 | 218 | // add AJAX or other hooks |
219 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
219 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
220 | 220 | // setup autoloaders if necessary |
221 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
221 | + if ( ! class_exists($reg_step['class_name'])) { |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
223 | 223 | } |
224 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
225 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
224 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
225 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | } |
@@ -241,28 +241,28 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public static function get_reg_steps() { |
243 | 243 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
244 | - if ( empty( $reg_steps )) { |
|
244 | + if (empty($reg_steps)) { |
|
245 | 245 | $reg_steps = array( |
246 | 246 | 10 => array( |
247 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
247 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
248 | 248 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
249 | 249 | 'slug' => 'attendee_information', |
250 | 250 | 'has_hooks' => FALSE |
251 | 251 | ), |
252 | 252 | 20 => array( |
253 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
253 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
254 | 254 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
255 | 255 | 'slug' => 'registration_confirmation', |
256 | 256 | 'has_hooks' => FALSE |
257 | 257 | ), |
258 | 258 | 30 => array( |
259 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
259 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
260 | 260 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
261 | 261 | 'slug' => 'payment_options', |
262 | 262 | 'has_hooks' => TRUE |
263 | 263 | ), |
264 | 264 | 999 => array( |
265 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
265 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
266 | 266 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
267 | 267 | 'slug' => 'finalize_registration', |
268 | 268 | 'has_hooks' => FALSE |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function registration_checkout_for_admin() { |
284 | 284 | EED_Single_Page_Checkout::load_reg_steps(); |
285 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
286 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
287 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
285 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
286 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
287 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
288 | 288 | EED_Single_Page_Checkout::instance()->_initialize(); |
289 | 289 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
290 | 290 | return EE_Registry::instance()->REQ->get_output(); |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | */ |
301 | 301 | public static function process_registration_from_admin() { |
302 | 302 | EED_Single_Page_Checkout::load_reg_steps(); |
303 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
304 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
305 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
303 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
304 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
305 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
306 | 306 | EED_Single_Page_Checkout::instance()->_initialize(); |
307 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
308 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
309 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
310 | - if ( $final_reg_step->process_reg_step() ) { |
|
307 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
308 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
309 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
310 | + if ($final_reg_step->process_reg_step()) { |
|
311 | 311 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
312 | 312 | } |
313 | 313 | } |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | * @param WP_Query $WP_Query |
325 | 325 | * @return void |
326 | 326 | */ |
327 | - public function run( $WP_Query ) { |
|
328 | - if ( $WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true )) { |
|
327 | + public function run($WP_Query) { |
|
328 | + if ($WP_Query instanceof WP_Query && $WP_Query->is_main_query() && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)) { |
|
329 | 329 | $this->_initialize(); |
330 | 330 | } |
331 | 331 | } |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | * @param WP_Query $WP_Query |
341 | 341 | * @return void |
342 | 342 | */ |
343 | - public static function init( $WP_Query ) { |
|
344 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
343 | + public static function init($WP_Query) { |
|
344 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
@@ -355,32 +355,32 @@ discard block |
||
355 | 355 | */ |
356 | 356 | private function _initialize() { |
357 | 357 | // ensure SPCO doesn't run twice |
358 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
358 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
359 | 359 | return; |
360 | 360 | } |
361 | 361 | // setup the EE_Checkout object |
362 | 362 | $this->checkout = $this->_initialize_checkout(); |
363 | 363 | // filter checkout |
364 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
364 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
365 | 365 | // get the $_GET |
366 | 366 | $this->_get_request_vars(); |
367 | 367 | // filter continue_reg |
368 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
368 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
369 | 369 | // load the reg steps array |
370 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
370 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
371 | 371 | EED_Single_Page_Checkout::$_initialized = true; |
372 | 372 | return; |
373 | 373 | } |
374 | 374 | // set the current step |
375 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
375 | + $this->checkout->set_current_step($this->checkout->step); |
|
376 | 376 | // and the next step |
377 | 377 | $this->checkout->set_next_step(); |
378 | 378 | // was there already a valid transaction in the checkout from the session ? |
379 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
379 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
380 | 380 | // get transaction from db or session |
381 | 381 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() ? $this->_get_transaction_and_cart_for_previous_visit() : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
382 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
383 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
382 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
383 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
384 | 384 | // add some style and make it dance |
385 | 385 | $this->checkout->transaction = EE_Transaction::new_instance(); |
386 | 386 | $this->add_styles_and_scripts(); |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | return; |
389 | 389 | } |
390 | 390 | // and the registrations for the transaction |
391 | - $this->_get_registrations( $this->checkout->transaction ); |
|
391 | + $this->_get_registrations($this->checkout->transaction); |
|
392 | 392 | } |
393 | 393 | // verify that everything has been setup correctly |
394 | - if ( ! $this->_final_verifications() ) { |
|
394 | + if ( ! $this->_final_verifications()) { |
|
395 | 395 | EED_Single_Page_Checkout::$_initialized = true; |
396 | 396 | return; |
397 | 397 | } |
@@ -416,9 +416,9 @@ discard block |
||
416 | 416 | // set no cache headers and constants |
417 | 417 | EE_System::do_not_cache(); |
418 | 418 | // add anchor |
419 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
419 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
420 | 420 | // remove transaction lock |
421 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
421 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -435,20 +435,20 @@ discard block |
||
435 | 435 | // look in session for existing checkout |
436 | 436 | $checkout = EE_Registry::instance()->SSN->checkout(); |
437 | 437 | // verify |
438 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
438 | + if ( ! $checkout instanceof EE_Checkout) { |
|
439 | 439 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
440 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
440 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
441 | 441 | // verify again |
442 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
443 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
442 | + if ( ! $checkout instanceof EE_Checkout) { |
|
443 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
444 | 444 | } |
445 | 445 | } else { |
446 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
447 | - wp_safe_redirect( $checkout->redirect_url ); |
|
446 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
447 | + wp_safe_redirect($checkout->redirect_url); |
|
448 | 448 | exit(); |
449 | 449 | } |
450 | 450 | } |
451 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
451 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
452 | 452 | // reset anything that needs a clean slate for each request |
453 | 453 | $checkout->reset_for_current_request(); |
454 | 454 | return $checkout; |
@@ -466,22 +466,22 @@ discard block |
||
466 | 466 | // load classes |
467 | 467 | EED_Single_Page_Checkout::load_request_handler(); |
468 | 468 | //make sure this request is marked as belonging to EE |
469 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
469 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
470 | 470 | // which step is being requested ? |
471 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
471 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
472 | 472 | // which step is being edited ? |
473 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
473 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
474 | 474 | // and what we're doing on the current step |
475 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
475 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
476 | 476 | // returning to edit ? |
477 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
477 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
478 | 478 | // or some other kind of revisit ? |
479 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
479 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
480 | 480 | // and whether or not to generate a reg form for this request |
481 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
481 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
482 | 482 | // and whether or not to process a reg form submission for this request |
483 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
484 | - $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
483 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
484 | + $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' ? $this->checkout->process_form_submission : FALSE; // TRUE FALSE |
|
485 | 485 | //$this->_display_request_vars(); |
486 | 486 | } |
487 | 487 | |
@@ -494,17 +494,17 @@ discard block |
||
494 | 494 | * @return void |
495 | 495 | */ |
496 | 496 | protected function _display_request_vars() { |
497 | - if ( ! WP_DEBUG ) { |
|
497 | + if ( ! WP_DEBUG) { |
|
498 | 498 | return; |
499 | 499 | } |
500 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
501 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
502 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
503 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
504 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
505 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
506 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
507 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
500 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
501 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
502 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
503 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
504 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
505 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
506 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
507 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -518,8 +518,8 @@ discard block |
||
518 | 518 | * @return array |
519 | 519 | */ |
520 | 520 | private function _get_first_step() { |
521 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
522 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
521 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
522 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | |
@@ -535,37 +535,37 @@ discard block |
||
535 | 535 | private function _load_and_instantiate_reg_steps() { |
536 | 536 | // have reg_steps already been instantiated ? |
537 | 537 | if ( |
538 | - empty( $this->checkout->reg_steps ) || |
|
539 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
538 | + empty($this->checkout->reg_steps) || |
|
539 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
540 | 540 | ) { |
541 | 541 | // if not, then loop through raw reg steps array |
542 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
543 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
542 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
543 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
544 | 544 | return false; |
545 | 545 | } |
546 | 546 | } |
547 | 547 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
548 | 548 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
549 | 549 | // skip the registration_confirmation page ? |
550 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
550 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
551 | 551 | // just remove it from the reg steps array |
552 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
553 | - } else if ( EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset( $this->checkout->reg_steps['registration_confirmation'] )) { |
|
552 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
553 | + } else if (EE_Registry::instance()->CFG->registration->reg_confirmation_last && isset($this->checkout->reg_steps['registration_confirmation'])) { |
|
554 | 554 | // set the order to something big like 100 |
555 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
555 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
556 | 556 | } |
557 | 557 | // filter the array for good luck |
558 | - $this->checkout->reg_steps = apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps ); |
|
558 | + $this->checkout->reg_steps = apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reg_steps', $this->checkout->reg_steps); |
|
559 | 559 | // finally re-sort based on the reg step class order properties |
560 | 560 | $this->checkout->sort_reg_steps(); |
561 | 561 | } else { |
562 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
562 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
563 | 563 | // set all current step stati to FALSE |
564 | - $reg_step->set_is_current_step( FALSE ); |
|
564 | + $reg_step->set_is_current_step(FALSE); |
|
565 | 565 | } |
566 | 566 | } |
567 | - if ( empty( $this->checkout->reg_steps )) { |
|
568 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
567 | + if (empty($this->checkout->reg_steps)) { |
|
568 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
569 | 569 | return false; |
570 | 570 | } |
571 | 571 | // make reg step details available to JS |
@@ -583,34 +583,34 @@ discard block |
||
583 | 583 | * @param int $order |
584 | 584 | * @return bool |
585 | 585 | */ |
586 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
586 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
587 | 587 | |
588 | 588 | // we need a file_path, class_name, and slug to add a reg step |
589 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
589 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
590 | 590 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
591 | - if ( $this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration' ) { |
|
591 | + if ($this->checkout->reg_url_link && $this->checkout->step !== $reg_step['slug'] && $reg_step['slug'] !== 'finalize_registration') { |
|
592 | 592 | return true; |
593 | 593 | } |
594 | 594 | // instantiate step class using file path and class name |
595 | - $reg_step_obj = EE_Registry::instance()->load_file( $reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE ); |
|
595 | + $reg_step_obj = EE_Registry::instance()->load_file($reg_step['file_path'], $reg_step['class_name'], 'class', $this->checkout, FALSE); |
|
596 | 596 | // did we gets the goods ? |
597 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
597 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
598 | 598 | // set reg step order based on config |
599 | - $reg_step_obj->set_order( $order ); |
|
599 | + $reg_step_obj->set_order($order); |
|
600 | 600 | // add instantiated reg step object to the master reg steps array |
601 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
601 | + $this->checkout->add_reg_step($reg_step_obj); |
|
602 | 602 | } else { |
603 | - EE_Error::add_error( __( 'The current step could not be set.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
603 | + EE_Error::add_error(__('The current step could not be set.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
604 | 604 | return false; |
605 | 605 | } |
606 | 606 | } else { |
607 | - if ( WP_DEBUG ) { |
|
607 | + if (WP_DEBUG) { |
|
608 | 608 | EE_Error::add_error( |
609 | 609 | sprintf( |
610 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
611 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
612 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
613 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
610 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
611 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
612 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
613 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
614 | 614 | '<ul>', |
615 | 615 | '<li>', |
616 | 616 | '</li>', |
@@ -634,16 +634,16 @@ discard block |
||
634 | 634 | */ |
635 | 635 | private function _get_transaction_and_cart_for_previous_visit() { |
636 | 636 | /** @var $TXN_model EEM_Transaction */ |
637 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
637 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
638 | 638 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
639 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
639 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
640 | 640 | // verify transaction |
641 | - if ( $transaction instanceof EE_Transaction ) { |
|
641 | + if ($transaction instanceof EE_Transaction) { |
|
642 | 642 | // and get the cart that was used for that transaction |
643 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
643 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
644 | 644 | return $transaction; |
645 | 645 | } else { |
646 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
646 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
647 | 647 | return NULL; |
648 | 648 | } |
649 | 649 | } |
@@ -657,11 +657,11 @@ discard block |
||
657 | 657 | * @param EE_Transaction $transaction |
658 | 658 | * @return EE_Cart |
659 | 659 | */ |
660 | - private function _get_cart_for_transaction( $transaction ) { |
|
661 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
660 | + private function _get_cart_for_transaction($transaction) { |
|
661 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
662 | 662 | // verify cart |
663 | - if ( ! $cart instanceof EE_Cart ) { |
|
664 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
663 | + if ( ! $cart instanceof EE_Cart) { |
|
664 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
665 | 665 | } |
666 | 666 | return $cart; |
667 | 667 | } |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | * @param EE_Transaction $transaction |
677 | 677 | * @return EE_Cart |
678 | 678 | */ |
679 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
680 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
679 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
680 | + return EE_Cart::get_cart_from_txn($transaction); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | |
@@ -692,17 +692,17 @@ discard block |
||
692 | 692 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
693 | 693 | // if there's no transaction, then this is the FIRST visit to SPCO |
694 | 694 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
695 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
695 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
696 | 696 | // and then create a new transaction |
697 | 697 | $transaction = $this->_initialize_transaction(); |
698 | 698 | // verify transaction |
699 | - if ( $transaction instanceof EE_Transaction ) { |
|
699 | + if ($transaction instanceof EE_Transaction) { |
|
700 | 700 | // save it so that we have an ID for other objects to use |
701 | 701 | $transaction->save(); |
702 | 702 | // and save TXN data to the cart |
703 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
703 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
704 | 704 | } else { |
705 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
706 | 706 | } |
707 | 707 | return $transaction; |
708 | 708 | } |
@@ -722,15 +722,15 @@ discard block |
||
722 | 722 | // grab the cart grand total |
723 | 723 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
724 | 724 | // create new TXN |
725 | - return EE_Transaction::new_instance( array( |
|
725 | + return EE_Transaction::new_instance(array( |
|
726 | 726 | 'TXN_timestamp' => time(), |
727 | 727 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
728 | 728 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
729 | 729 | 'TXN_paid' => 0, |
730 | 730 | 'STS_ID' => EEM_Transaction::failed_status_code, |
731 | 731 | )); |
732 | - } catch( Exception $e ) { |
|
733 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
732 | + } catch (Exception $e) { |
|
733 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
734 | 734 | } |
735 | 735 | return NULL; |
736 | 736 | } |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param EE_Transaction $transaction |
745 | 745 | * @return EE_Cart |
746 | 746 | */ |
747 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
747 | + private function _get_registrations(EE_Transaction $transaction) { |
|
748 | 748 | // first step: grab the registrants { : o |
749 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
749 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
750 | 750 | // verify registrations have been set |
751 | - if ( empty( $registrations )) { |
|
751 | + if (empty($registrations)) { |
|
752 | 752 | // if no cached registrations, then check the db |
753 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
753 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
754 | 754 | // still nothing ? well as long as this isn't a revisit |
755 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
755 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
756 | 756 | // generate new registrations from scratch |
757 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
757 | + $registrations = $this->_initialize_registrations($transaction); |
|
758 | 758 | } |
759 | 759 | } |
760 | 760 | // sort by their original registration order |
761 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
761 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
762 | 762 | // then loop thru the array |
763 | - foreach ( $registrations as $registration ) { |
|
763 | + foreach ($registrations as $registration) { |
|
764 | 764 | // verify each registration |
765 | - if ( $registration instanceof EE_Registration ) { |
|
765 | + if ($registration instanceof EE_Registration) { |
|
766 | 766 | // we display all attendee info for the primary registrant |
767 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
767 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
768 | 768 | $this->checkout->primary_revisit = TRUE; |
769 | 769 | break; |
770 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
770 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
771 | 771 | // but hide info if it doesn't belong to you |
772 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
772 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
773 | 773 | } |
774 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
774 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
775 | 775 | } |
776 | 776 | } |
777 | 777 | } |
@@ -785,17 +785,17 @@ discard block |
||
785 | 785 | * @param EE_Transaction $transaction |
786 | 786 | * @return array |
787 | 787 | */ |
788 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
788 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
789 | 789 | $att_nmbr = 0; |
790 | 790 | $registrations = array(); |
791 | - if ( $transaction instanceof EE_Transaction ) { |
|
791 | + if ($transaction instanceof EE_Transaction) { |
|
792 | 792 | /** @type EE_Registration_Processor $registration_processor */ |
793 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
793 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
794 | 794 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
795 | 795 | // now let's add the cart items to the $transaction |
796 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
796 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
797 | 797 | //do the following for each ticket of this type they selected |
798 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
798 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
799 | 799 | $att_nmbr++; |
800 | 800 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
801 | 801 | $line_item, |
@@ -803,12 +803,12 @@ discard block |
||
803 | 803 | $att_nmbr, |
804 | 804 | $this->checkout->total_ticket_count |
805 | 805 | ); |
806 | - if ( $registration instanceof EE_Registration ) { |
|
807 | - $registrations[ $registration->ID() ] = $registration; |
|
806 | + if ($registration instanceof EE_Registration) { |
|
807 | + $registrations[$registration->ID()] = $registration; |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 | } |
811 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
811 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
812 | 812 | } |
813 | 813 | return $registrations; |
814 | 814 | } |
@@ -823,12 +823,12 @@ discard block |
||
823 | 823 | * @param EE_Registration $reg_B |
824 | 824 | * @return array() |
825 | 825 | */ |
826 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
826 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
827 | 827 | // this shouldn't ever happen within the same TXN, but oh well |
828 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
828 | + if ($reg_A->count() == $reg_B->count()) { |
|
829 | 829 | return 0; |
830 | 830 | } |
831 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
831 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -843,35 +843,35 @@ discard block |
||
843 | 843 | */ |
844 | 844 | private function _final_verifications() { |
845 | 845 | // filter checkout |
846 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
846 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
847 | 847 | //verify that current step is still set correctly |
848 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
849 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
849 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | 850 | return false; |
851 | 851 | } |
852 | 852 | // if returning to SPCO, then verify that primary registrant is set |
853 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
853 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
854 | 854 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
855 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
856 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
855 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
856 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
857 | 857 | return false; |
858 | 858 | } |
859 | 859 | $valid_registrant = null; |
860 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
861 | - if ( $registration instanceof EE_Registration ) { |
|
862 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
860 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
861 | + if ($registration instanceof EE_Registration) { |
|
862 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
863 | 863 | $valid_registrant = $registration; |
864 | 864 | } |
865 | 865 | } |
866 | 866 | } |
867 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
868 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
867 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
868 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
869 | 869 | return false; |
870 | 870 | } |
871 | 871 | } |
872 | 872 | // now that things have been kinda sufficiently verified, |
873 | 873 | // let's add the checkout to the session so that's available other systems |
874 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
874 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
875 | 875 | return true; |
876 | 876 | } |
877 | 877 | |
@@ -887,28 +887,28 @@ discard block |
||
887 | 887 | * @access private |
888 | 888 | * @param bool $reinitializing |
889 | 889 | */ |
890 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
891 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
890 | + private function _initialize_reg_steps($reinitializing = false) { |
|
891 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
892 | 892 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
893 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
894 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
893 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
894 | + if ( ! $reg_step->initialize_reg_step()) { |
|
895 | 895 | // if not initialized then maybe this step is being removed... |
896 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
896 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
897 | 897 | // if it was the current step, then we need to start over here |
898 | - $this->_initialize_reg_steps( true ); |
|
898 | + $this->_initialize_reg_steps(true); |
|
899 | 899 | return; |
900 | 900 | } |
901 | 901 | continue; |
902 | 902 | } |
903 | 903 | // i18n |
904 | 904 | $reg_step->translate_js_strings(); |
905 | - if ( $reg_step->is_current_step() ) { |
|
905 | + if ($reg_step->is_current_step()) { |
|
906 | 906 | // the text that appears on the reg step form submit button |
907 | 907 | $reg_step->set_submit_button_text(); |
908 | 908 | } |
909 | 909 | } |
910 | 910 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
911 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
911 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
912 | 912 | } |
913 | 913 | |
914 | 914 | |
@@ -921,39 +921,39 @@ discard block |
||
921 | 921 | */ |
922 | 922 | private function _check_form_submission() { |
923 | 923 | //does this request require the reg form to be generated ? |
924 | - if ( $this->checkout->generate_reg_form ) { |
|
924 | + if ($this->checkout->generate_reg_form) { |
|
925 | 925 | // ever heard that song by Blue Rodeo ? |
926 | 926 | try { |
927 | 927 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
928 | 928 | // if not displaying a form, then check for form submission |
929 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
929 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
930 | 930 | // clear out any old data in case this step is being run again |
931 | - $this->checkout->current_step->set_valid_data( array() ); |
|
931 | + $this->checkout->current_step->set_valid_data(array()); |
|
932 | 932 | // capture submitted form data |
933 | 933 | $this->checkout->current_step->reg_form->receive_form_submission( |
934 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
934 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
935 | 935 | ); |
936 | 936 | // validate submitted form data |
937 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
937 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
938 | 938 | // thou shall not pass !!! |
939 | 939 | $this->checkout->continue_reg = FALSE; |
940 | 940 | // any form validation errors? |
941 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
941 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
942 | 942 | $submission_error_messages = array(); |
943 | 943 | // bad, bad, bad registrant |
944 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
945 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
946 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
944 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
945 | + if ($validation_error instanceof EE_Validation_Error) { |
|
946 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
947 | 947 | } |
948 | 948 | } |
949 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
949 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
950 | 950 | } |
951 | 951 | // well not really... what will happen is we'll just get redirected back to redo the current step |
952 | 952 | $this->go_to_next_step(); |
953 | 953 | return; |
954 | 954 | } |
955 | 955 | } |
956 | - } catch( EE_Error $e ) { |
|
956 | + } catch (EE_Error $e) { |
|
957 | 957 | $e->get_error(); |
958 | 958 | } |
959 | 959 | } |
@@ -969,38 +969,38 @@ discard block |
||
969 | 969 | */ |
970 | 970 | private function _process_form_action() { |
971 | 971 | // what cha wanna do? |
972 | - switch( $this->checkout->action ) { |
|
972 | + switch ($this->checkout->action) { |
|
973 | 973 | // AJAX next step reg form |
974 | 974 | case 'display_spco_reg_step' : |
975 | 975 | $this->checkout->redirect = FALSE; |
976 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
977 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
976 | + if (EE_Registry::instance()->REQ->ajax) { |
|
977 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
978 | 978 | } |
979 | 979 | break; |
980 | 980 | |
981 | 981 | default : |
982 | 982 | // meh... do one of those other steps first |
983 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
983 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
984 | 984 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
985 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
985 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
986 | 986 | // call action on current step |
987 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
987 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
988 | 988 | // good registrant, you get to proceed |
989 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
990 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
991 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
989 | + if ($this->checkout->current_step->success_message() != '') { |
|
990 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
991 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
992 | 992 | } |
993 | 993 | } |
994 | 994 | // pack it up, pack it in... |
995 | 995 | $this->_setup_redirect(); |
996 | 996 | } |
997 | 997 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
998 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
998 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
999 | 999 | |
1000 | 1000 | } else { |
1001 | 1001 | EE_Error::add_error( |
1002 | 1002 | sprintf( |
1003 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1003 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1004 | 1004 | $this->checkout->action, |
1005 | 1005 | $this->checkout->current_step->name() |
1006 | 1006 | ), |
@@ -1026,10 +1026,10 @@ discard block |
||
1026 | 1026 | public function add_styles_and_scripts() { |
1027 | 1027 | // i18n |
1028 | 1028 | $this->translate_js_strings(); |
1029 | - if ( $this->checkout->admin_request ) { |
|
1030 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1029 | + if ($this->checkout->admin_request) { |
|
1030 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1031 | 1031 | } else { |
1032 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1032 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1033 | 1033 | } |
1034 | 1034 | } |
1035 | 1035 | |
@@ -1045,42 +1045,42 @@ discard block |
||
1045 | 1045 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1046 | 1046 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1047 | 1047 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1048 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1049 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1050 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1048 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1049 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1050 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1051 | 1051 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1052 | 1052 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1053 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1054 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1053 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1054 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1055 | 1055 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1056 | 1056 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1057 | 1057 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1058 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1059 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1060 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1061 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1062 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1063 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1064 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1065 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1066 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1067 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1068 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1069 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1070 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1071 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1058 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1059 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1060 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1061 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1062 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1063 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1064 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1065 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1066 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1067 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1068 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1069 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1070 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1071 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1072 | 1072 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1073 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1073 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1074 | 1074 | '<h4 class="important-notice">', |
1075 | 1075 | '</h4>', |
1076 | 1076 | '<br />', |
1077 | 1077 | '<p>', |
1078 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1078 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1079 | 1079 | '">', |
1080 | 1080 | '</a>', |
1081 | 1081 | '</p>' |
1082 | 1082 | ); |
1083 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1083 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1084 | 1084 | } |
1085 | 1085 | |
1086 | 1086 | |
@@ -1093,25 +1093,25 @@ discard block |
||
1093 | 1093 | */ |
1094 | 1094 | public function enqueue_styles_and_scripts() { |
1095 | 1095 | // load css |
1096 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1097 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1096 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1097 | + wp_enqueue_style('single_page_checkout'); |
|
1098 | 1098 | // load JS |
1099 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1100 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1101 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1102 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1099 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1100 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1101 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1102 | + wp_enqueue_script('single_page_checkout'); |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * global action hook for enqueueing styles and scripts with |
1106 | 1106 | * spco calls. |
1107 | 1107 | */ |
1108 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1108 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1109 | 1109 | |
1110 | 1110 | /** |
1111 | 1111 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1112 | 1112 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1113 | 1113 | */ |
1114 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1114 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1115 | 1115 | |
1116 | 1116 | // add css and JS for current step |
1117 | 1117 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1127,20 +1127,20 @@ discard block |
||
1127 | 1127 | */ |
1128 | 1128 | private function _display_spco_reg_form() { |
1129 | 1129 | // if registering via the admin, just display the reg form for the current step |
1130 | - if ( $this->checkout->admin_request ) { |
|
1131 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1130 | + if ($this->checkout->admin_request) { |
|
1131 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1132 | 1132 | } else { |
1133 | 1133 | // add powered by EE msg |
1134 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1134 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1135 | 1135 | |
1136 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1136 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1137 | 1137 | $cookies_not_set_msg = ''; |
1138 | - if ( $empty_cart ) { |
|
1139 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1138 | + if ($empty_cart) { |
|
1139 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1140 | 1140 | $cookies_not_set_msg = apply_filters( |
1141 | 1141 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1142 | 1142 | sprintf( |
1143 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1143 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1144 | 1144 | '<div class="ee-attention">', |
1145 | 1145 | '</div>', |
1146 | 1146 | '<h6 class="important-notice">', |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | 'layout_strategy' => |
1162 | 1162 | new EE_Template_Layout( |
1163 | 1163 | array( |
1164 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1164 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1165 | 1165 | 'template_args' => array( |
1166 | 1166 | 'empty_cart' => $empty_cart, |
1167 | 1167 | 'revisit' => $this->checkout->revisit, |
@@ -1170,8 +1170,8 @@ discard block |
||
1170 | 1170 | 'empty_msg' => apply_filters( |
1171 | 1171 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1172 | 1172 | sprintf( |
1173 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1174 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1173 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1174 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1175 | 1175 | '">', |
1176 | 1176 | '</a>' |
1177 | 1177 | ) |
@@ -1179,14 +1179,14 @@ discard block |
||
1179 | 1179 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1180 | 1180 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1181 | 1181 | 'session_expiration' => |
1182 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1182 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1183 | 1183 | ) |
1184 | 1184 | ) |
1185 | 1185 | ) |
1186 | 1186 | ) |
1187 | 1187 | ); |
1188 | 1188 | // load template and add to output sent that gets filtered into the_content() |
1189 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1189 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | |
@@ -1200,8 +1200,8 @@ discard block |
||
1200 | 1200 | * @internal param string $label |
1201 | 1201 | * @return string |
1202 | 1202 | */ |
1203 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1204 | - if ( $next_step == 'finalize_registration' ) { |
|
1203 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1204 | + if ($next_step == 'finalize_registration') { |
|
1205 | 1205 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1206 | 1206 | } |
1207 | 1207 | } |
@@ -1215,18 +1215,18 @@ discard block |
||
1215 | 1215 | * @return string |
1216 | 1216 | */ |
1217 | 1217 | public static function display_registration_footer() { |
1218 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1219 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1220 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'http://eventespresso.com/' ); |
|
1221 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1218 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1219 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1220 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'http://eventespresso.com/'); |
|
1221 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1222 | 1222 | echo apply_filters( |
1223 | 1223 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1224 | 1224 | sprintf( |
1225 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1226 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1225 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1226 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1227 | 1227 | '" target="_blank">', |
1228 | 1228 | '</a>', |
1229 | - '<a href="' . $url . '" title="', |
|
1229 | + '<a href="'.$url.'" title="', |
|
1230 | 1230 | '" target="_blank">', |
1231 | 1231 | '</a></div>' |
1232 | 1232 | ) |
@@ -1257,12 +1257,12 @@ discard block |
||
1257 | 1257 | * @return array |
1258 | 1258 | */ |
1259 | 1259 | private function _setup_redirect() { |
1260 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1260 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1261 | 1261 | $this->checkout->redirect = TRUE; |
1262 | - if ( empty( $this->checkout->redirect_url )) { |
|
1262 | + if (empty($this->checkout->redirect_url)) { |
|
1263 | 1263 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1264 | 1264 | } |
1265 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1265 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1275,12 +1275,12 @@ discard block |
||
1275 | 1275 | * @return void |
1276 | 1276 | */ |
1277 | 1277 | public function go_to_next_step() { |
1278 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1278 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1279 | 1279 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1280 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1280 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1281 | 1281 | } |
1282 | 1282 | // just return for these conditions |
1283 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1283 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1284 | 1284 | return; |
1285 | 1285 | } |
1286 | 1286 | // AJAX response |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | */ |
1302 | 1302 | protected function _handle_json_response() { |
1303 | 1303 | // if this is an ajax request |
1304 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1304 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1305 | 1305 | // DEBUG LOG |
1306 | 1306 | //$this->checkout->log( |
1307 | 1307 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1311,10 +1311,10 @@ discard block |
||
1311 | 1311 | // 'continue_reg' => $this->checkout->continue_reg, |
1312 | 1312 | // ) |
1313 | 1313 | //); |
1314 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1315 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1314 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1315 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1316 | 1316 | // just send the ajax ( |
1317 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1317 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1318 | 1318 | $this->unlock_transaction(); |
1319 | 1319 | echo $json_response; |
1320 | 1320 | exit(); |
@@ -1331,9 +1331,9 @@ discard block |
||
1331 | 1331 | */ |
1332 | 1332 | protected function _handle_html_redirects() { |
1333 | 1333 | // going somewhere ? |
1334 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1334 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1335 | 1335 | // store notices in a transient |
1336 | - EE_Error::get_notices( false, true, true ); |
|
1336 | + EE_Error::get_notices(false, true, true); |
|
1337 | 1337 | $this->unlock_transaction(); |
1338 | 1338 | // DEBUG LOG |
1339 | 1339 | //$this->checkout->log( |
@@ -1344,7 +1344,7 @@ discard block |
||
1344 | 1344 | // 'headers_list' => headers_list(), |
1345 | 1345 | // ) |
1346 | 1346 | //); |
1347 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1347 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1348 | 1348 | exit(); |
1349 | 1349 | } |
1350 | 1350 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param WP $WP |
20 | 20 | * @return void |
21 | 21 | */ |
22 | - public function run( WP $WP ) {} |
|
22 | + public function run(WP $WP) {} |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * @param array $attributes |
70 | 70 | * @return string |
71 | 71 | */ |
72 | - public function process_shortcode( $attributes = array() ) { |
|
72 | + public function process_shortcode($attributes = array()) { |
|
73 | 73 | |
74 | 74 | //load helpers |
75 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
76 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
75 | + EE_Registry::instance()->load_helper('Event_View'); |
|
76 | + EE_Registry::instance()->load_helper('Template'); |
|
77 | 77 | |
78 | 78 | // merge in any attributes passed via fallback shortcode processor |
79 | - $attributes = array_merge( (array) $attributes, (array) $this->_attributes ); |
|
79 | + $attributes = array_merge((array) $attributes, (array) $this->_attributes); |
|
80 | 80 | |
81 | 81 | //set default attributes |
82 | 82 | $default_shortcode_attributes = array( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | ); |
89 | 89 | |
90 | 90 | // allow the defaults to be filtered |
91 | - $default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes ); |
|
91 | + $default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes); |
|
92 | 92 | // grab attributes and merge with defaults, then extract |
93 | - $attributes = array_merge( $default_shortcode_attributes, $attributes ); |
|
93 | + $attributes = array_merge($default_shortcode_attributes, $attributes); |
|
94 | 94 | |
95 | 95 | $template_args = array( |
96 | 96 | 'contacts' => array(), |
@@ -106,31 +106,31 @@ discard block |
||
106 | 106 | $error = false; |
107 | 107 | |
108 | 108 | //what event? |
109 | - if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) { |
|
109 | + if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) { |
|
110 | 110 | //seems like is_espresso_event_single() isn't working as expected. So using alternate method. |
111 | - if ( is_single() && is_espresso_event() ) { |
|
111 | + if (is_single() && is_espresso_event()) { |
|
112 | 112 | $event = EEH_Event_View::get_event(); |
113 | - if ( $event instanceof EE_Event ) { |
|
113 | + if ($event instanceof EE_Event) { |
|
114 | 114 | $template_args['event'] = $event; |
115 | 115 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
116 | 116 | } |
117 | 117 | } else { |
118 | 118 | //try getting the earliest active event if none then get the |
119 | - $events = EEM_Event::instance()->get_active_events( array( 'limit' => 1, |
|
120 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
121 | - ) ); |
|
122 | - $events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit' => 1, |
|
123 | - 'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' ) |
|
124 | - ) ) : $events; |
|
125 | - $event = reset( $events ); |
|
126 | - if ( $event instanceof EE_Event ) { |
|
119 | + $events = EEM_Event::instance()->get_active_events(array('limit' => 1, |
|
120 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
121 | + )); |
|
122 | + $events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit' => 1, |
|
123 | + 'order_by' => array('Datetime.DTT_EVT_start' => 'ASC') |
|
124 | + )) : $events; |
|
125 | + $event = reset($events); |
|
126 | + if ($event instanceof EE_Event) { |
|
127 | 127 | $query[0]['Registration.EVT_ID'] = $event->ID(); |
128 | 128 | $template_args['event'] = $event; |
129 | 129 | } |
130 | 130 | } |
131 | - } elseif ( ! empty( $attributes['event_id'] ) ) { |
|
132 | - $event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] ); |
|
133 | - if ( $event instanceof EE_Event ) { |
|
131 | + } elseif ( ! empty($attributes['event_id'])) { |
|
132 | + $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']); |
|
133 | + if ($event instanceof EE_Event) { |
|
134 | 134 | $query[0]['Registration.EVT_ID'] = $attributes['event_id']; |
135 | 135 | $template_args['event'] = $event; |
136 | 136 | } else { |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | //datetime? |
142 | - if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) { |
|
143 | - $datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] ); |
|
144 | - if ( $datetime instanceof EE_Datetime ) { |
|
142 | + if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) { |
|
143 | + $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']); |
|
144 | + if ($datetime instanceof EE_Datetime) { |
|
145 | 145 | $query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id']; |
146 | 146 | $query['default_where_conditions'] = 'this_model_only'; |
147 | 147 | $template_args['datetime'] = $datetime; |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | //ticket?just |
155 | - if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) { |
|
156 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] ); |
|
157 | - if ( $ticket instanceof EE_Ticket ) { |
|
155 | + if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) { |
|
156 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']); |
|
157 | + if ($ticket instanceof EE_Ticket) { |
|
158 | 158 | $query[0]['Registration.TKT_ID'] = $attributes['ticket_id']; |
159 | 159 | $template_args['ticket'] = $ticket; |
160 | 160 | $template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | |
166 | 166 | //status |
167 | 167 | $reg_status_array = EEM_Registration::reg_status_array(); |
168 | - if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) { |
|
168 | + if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) { |
|
169 | 169 | $query[0]['Registration.STS_ID'] = $attributes['status']; |
170 | 170 | } |
171 | - $query['group_by'] = array( 'ATT_ID' ); |
|
172 | - $query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) ); |
|
171 | + $query['group_by'] = array('ATT_ID'); |
|
172 | + $query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')); |
|
173 | 173 | |
174 | 174 | //if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly |
175 | 175 | //so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string. |
176 | - if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) { |
|
177 | - if ( WP_DEBUG ) { |
|
178 | - return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>'; |
|
176 | + if (( ! isset($query[0]) || ! is_array($query[0])) || $error) { |
|
177 | + if (WP_DEBUG) { |
|
178 | + return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly. Please double check the arguments you used for any typos. In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>'; |
|
179 | 179 | } else { |
180 | 180 | return ''; |
181 | 181 | } |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | |
184 | 184 | |
185 | 185 | //get contacts! |
186 | - $template_args['contacts'] = EEM_Attendee::instance()->get_all( $query ); |
|
186 | + $template_args['contacts'] = EEM_Attendee::instance()->get_all($query); |
|
187 | 187 | |
188 | 188 | |
189 | 189 | //all set let's load up the template and return. |
190 | - return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true ); |
|
190 | + return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE ); |
3 | -if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) { |
|
4 | - set_error_handler( array( 'EE_Error', 'error_handler' )); |
|
5 | - register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' )); |
|
3 | +if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) { |
|
4 | + set_error_handler(array('EE_Error', 'error_handler')); |
|
5 | + register_shutdown_function(array('EE_Error', 'fatal_error_handler')); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @access private |
65 | 65 | * @var boolean |
66 | 66 | */ |
67 | - private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE ); |
|
67 | + private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE); |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @access public |
76 | 76 | * @echo string |
77 | 77 | */ |
78 | - function __construct( $message, $code = 0, Exception $previous = NULL ) { |
|
79 | - if ( version_compare( phpversion(), '5.3.0', '<' )) { |
|
80 | - parent::__construct( $message, $code ); |
|
78 | + function __construct($message, $code = 0, Exception $previous = NULL) { |
|
79 | + if (version_compare(phpversion(), '5.3.0', '<')) { |
|
80 | + parent::__construct($message, $code); |
|
81 | 81 | } else { |
82 | - parent::__construct( $message, $code, $previous ); |
|
82 | + parent::__construct($message, $code, $previous); |
|
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @param $line |
95 | 95 | * @return void |
96 | 96 | */ |
97 | - public static function error_handler( $code, $message, $file, $line ) { |
|
98 | - $type = EE_Error::error_type( $code ); |
|
97 | + public static function error_handler($code, $message, $file, $line) { |
|
98 | + $type = EE_Error::error_type($code); |
|
99 | 99 | $site = site_url(); |
100 | - switch ( $site ) { |
|
100 | + switch ($site) { |
|
101 | 101 | case 'http://ee4.eventespresso.com/' : |
102 | 102 | case 'http://ee4decaf.eventespresso.com/' : |
103 | 103 | case 'http://ee4hf.eventespresso.com/' : |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | $to = '[email protected]'; |
111 | 111 | break; |
112 | 112 | default : |
113 | - $to = get_option( 'admin_email' ); |
|
113 | + $to = get_option('admin_email'); |
|
114 | 114 | } |
115 | - $subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url(); |
|
116 | - $msg = EE_Error::_format_error( $type, $message, $file, $line ); |
|
117 | - if ( function_exists( 'wp_mail' )) { |
|
118 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
119 | - wp_mail( $to, $subject, $msg ); |
|
115 | + $subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url(); |
|
116 | + $msg = EE_Error::_format_error($type, $message, $file, $line); |
|
117 | + if (function_exists('wp_mail')) { |
|
118 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
119 | + wp_mail($to, $subject, $msg); |
|
120 | 120 | } |
121 | 121 | echo '<div id="message" class="espresso-notices error"><p>'; |
122 | - echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line; |
|
122 | + echo $type.': '.$message.'<br />'.$file.' line '.$line; |
|
123 | 123 | echo '<br /></p></div>'; |
124 | 124 | } |
125 | 125 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param $code |
133 | 133 | * @return string |
134 | 134 | */ |
135 | - public static function error_type( $code ) { |
|
136 | - switch( $code ) { |
|
135 | + public static function error_type($code) { |
|
136 | + switch ($code) { |
|
137 | 137 | case E_ERROR: // 1 // |
138 | 138 | return 'E_ERROR'; |
139 | 139 | case E_WARNING: // 2 // |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public static function fatal_error_handler() { |
181 | 181 | $last_error = error_get_last(); |
182 | - if ( $last_error['type'] === E_ERROR ) { |
|
183 | - EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] ); |
|
182 | + if ($last_error['type'] === E_ERROR) { |
|
183 | + EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param $line |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - private static function _format_error( $code, $message, $file, $line ) { |
|
198 | + private static function _format_error($code, $message, $file, $line) { |
|
199 | 199 | $html = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>"; |
200 | 200 | $html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>"; |
201 | 201 | $html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>"; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param $content_type |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - public static function set_content_type( $content_type ) { |
|
216 | + public static function set_content_type($content_type) { |
|
217 | 217 | return 'text/html'; |
218 | 218 | } |
219 | 219 | |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function get_error() { |
229 | 229 | |
230 | - if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){ |
|
230 | + if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) { |
|
231 | 231 | throw $this; |
232 | 232 | } |
233 | 233 | // get separate user and developer messages if they exist |
234 | - $msg = explode( '||', $this->getMessage() ); |
|
234 | + $msg = explode('||', $this->getMessage()); |
|
235 | 235 | $user_msg = $msg[0]; |
236 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
236 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
237 | 237 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
238 | 238 | |
239 | 239 | // add details to _all_exceptions array |
240 | 240 | $x_time = time(); |
241 | - self::$_all_exceptions[ $x_time ]['name'] = get_class( $this ); |
|
242 | - self::$_all_exceptions[ $x_time ]['file'] = $this->getFile(); |
|
243 | - self::$_all_exceptions[ $x_time ]['line'] = $this->getLine(); |
|
244 | - self::$_all_exceptions[ $x_time ]['msg'] = $msg; |
|
245 | - self::$_all_exceptions[ $x_time ]['code'] = $this->getCode(); |
|
246 | - self::$_all_exceptions[ $x_time ]['trace'] = $this->getTrace(); |
|
247 | - self::$_all_exceptions[ $x_time ]['string'] = $this->getTraceAsString(); |
|
241 | + self::$_all_exceptions[$x_time]['name'] = get_class($this); |
|
242 | + self::$_all_exceptions[$x_time]['file'] = $this->getFile(); |
|
243 | + self::$_all_exceptions[$x_time]['line'] = $this->getLine(); |
|
244 | + self::$_all_exceptions[$x_time]['msg'] = $msg; |
|
245 | + self::$_all_exceptions[$x_time]['code'] = $this->getCode(); |
|
246 | + self::$_all_exceptions[$x_time]['trace'] = $this->getTrace(); |
|
247 | + self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString(); |
|
248 | 248 | self::$_error_count++; |
249 | 249 | |
250 | 250 | //add_action( 'shutdown', array( $this, 'display_errors' )); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @return boolean |
261 | 261 | */ |
262 | - public static function has_error(){ |
|
262 | + public static function has_error() { |
|
263 | 263 | return self::$_error_count ? TRUE : FALSE; |
264 | 264 | } |
265 | 265 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @echo string |
272 | 272 | */ |
273 | - public function display_errors(){ |
|
273 | + public function display_errors() { |
|
274 | 274 | |
275 | 275 | $trace_details = ''; |
276 | 276 | |
@@ -331,18 +331,18 @@ discard block |
||
331 | 331 | </style> |
332 | 332 | <div id="ee-error-message" class="error">'; |
333 | 333 | |
334 | - if ( ! WP_DEBUG ) { |
|
334 | + if ( ! WP_DEBUG) { |
|
335 | 335 | $output .= ' |
336 | 336 | <p>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | // cycle thru errors |
340 | - foreach ( self::$_all_exceptions as $time => $ex ) { |
|
340 | + foreach (self::$_all_exceptions as $time => $ex) { |
|
341 | 341 | |
342 | 342 | // process trace info |
343 | - if ( empty( $ex['trace'] )) { |
|
343 | + if (empty($ex['trace'])) { |
|
344 | 344 | |
345 | - $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' ); |
|
345 | + $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso'); |
|
346 | 346 | |
347 | 347 | } else { |
348 | 348 | |
@@ -357,50 +357,50 @@ discard block |
||
357 | 357 | <th scope="col" align="left">Method( arguments )</th> |
358 | 358 | </tr>'; |
359 | 359 | |
360 | - $last_on_stack = count( $ex['trace'] ) - 1; |
|
360 | + $last_on_stack = count($ex['trace']) - 1; |
|
361 | 361 | // reverse array so that stack is in proper chronological order |
362 | - $sorted_trace = array_reverse( $ex['trace'] ); |
|
362 | + $sorted_trace = array_reverse($ex['trace']); |
|
363 | 363 | |
364 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
364 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
365 | 365 | |
366 | - $file = isset( $trace['file'] ) ? $trace['file'] : '' ; |
|
367 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
368 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
369 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
370 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
371 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
366 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
367 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
368 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
369 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
370 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
371 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
372 | 372 | $zebra = $nmbr % 2 ? ' odd' : ''; |
373 | 373 | |
374 | - if ( empty( $file ) && ! empty( $class )) { |
|
375 | - $a = new ReflectionClass( $class ); |
|
374 | + if (empty($file) && ! empty($class)) { |
|
375 | + $a = new ReflectionClass($class); |
|
376 | 376 | $file = $a->getFileName(); |
377 | - if ( empty( $line ) && ! empty( $function )) { |
|
378 | - $b = new ReflectionMethod( $class, $function ); |
|
377 | + if (empty($line) && ! empty($function)) { |
|
378 | + $b = new ReflectionMethod($class, $function); |
|
379 | 379 | $line = $b->getStartLine(); |
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | - if ( $nmbr == $last_on_stack ) { |
|
383 | + if ($nmbr == $last_on_stack) { |
|
384 | 384 | $file = $ex['file'] != '' ? $ex['file'] : $file; |
385 | 385 | $line = $ex['line'] != '' ? $ex['line'] : $line; |
386 | - $error_code = self::generate_error_code ( $file, $trace['function'], $line ); |
|
386 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
387 | 387 | } |
388 | 388 | |
389 | - $nmbr_dsply = ! empty( $nmbr ) ? $nmbr : ' '; |
|
390 | - $line_dsply = ! empty( $line ) ? $line : ' '; |
|
391 | - $file_dsply = ! empty( $file ) ? $file : ' '; |
|
392 | - $class_dsply = ! empty( $class ) ? $class : ' '; |
|
393 | - $type_dsply = ! empty( $type ) ? $type : ' '; |
|
394 | - $function_dsply = ! empty( $function ) ? $function : ' '; |
|
395 | - $args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : ''; |
|
389 | + $nmbr_dsply = ! empty($nmbr) ? $nmbr : ' '; |
|
390 | + $line_dsply = ! empty($line) ? $line : ' '; |
|
391 | + $file_dsply = ! empty($file) ? $file : ' '; |
|
392 | + $class_dsply = ! empty($class) ? $class : ' '; |
|
393 | + $type_dsply = ! empty($type) ? $type : ' '; |
|
394 | + $function_dsply = ! empty($function) ? $function : ' '; |
|
395 | + $args_dsply = ! empty($args) ? '( '.$args.' )' : ''; |
|
396 | 396 | |
397 | 397 | $trace_details .= ' |
398 | 398 | <tr> |
399 | - <td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td> |
|
400 | - <td align="right" class="' . $zebra . '">' . $line_dsply . '</td> |
|
401 | - <td align="left" class="' . $zebra . '">' . $file_dsply . '</td> |
|
402 | - <td align="left" class="' . $zebra . '">' . $class_dsply . '</td> |
|
403 | - <td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td> |
|
399 | + <td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td> |
|
400 | + <td align="right" class="' . $zebra.'">'.$line_dsply.'</td> |
|
401 | + <td align="left" class="' . $zebra.'">'.$file_dsply.'</td> |
|
402 | + <td align="left" class="' . $zebra.'">'.$class_dsply.'</td> |
|
403 | + <td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td> |
|
404 | 404 | </tr>'; |
405 | 405 | |
406 | 406 | |
@@ -415,9 +415,9 @@ discard block |
||
415 | 415 | $ex['code'] = $ex['code'] ? $ex['code'] : $error_code; |
416 | 416 | |
417 | 417 | // add generic non-identifying messages for non-privileged uesrs |
418 | - if ( ! WP_DEBUG ) { |
|
418 | + if ( ! WP_DEBUG) { |
|
419 | 419 | |
420 | - $output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] ) . '</span> <sup>' . $ex['code'] . '</sup><br />'; |
|
420 | + $output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> <sup>'.$ex['code'].'</sup><br />'; |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | |
@@ -425,24 +425,24 @@ discard block |
||
425 | 425 | $output .= ' |
426 | 426 | <div class="ee-error-dev-msg-dv"> |
427 | 427 | <p class="ee-error-dev-msg-pg"> |
428 | - <strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong> <span>code: ' . $ex['code'] . '</span><br /> |
|
429 | - <span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/> |
|
430 | - <a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '"> |
|
431 | - ' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . ' |
|
428 | + <strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong> <span>code: '.$ex['code'].'</span><br /> |
|
429 | + <span class="big-text">"' . trim($ex['msg']).'"</span><br/> |
|
430 | + <a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'"> |
|
431 | + ' . __('click to view backtrace and class/method details', 'event_espresso').' |
|
432 | 432 | </a><br /> |
433 | 433 | <span class="small-text lt-grey-text">'.$ex['file'].' ( line no: '.$ex['line'].' )</span> |
434 | 434 | </p> |
435 | - <div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
435 | + <div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;"> |
|
436 | 436 | ' . $trace_details; |
437 | 437 | |
438 | - if ( ! empty( $class )) { |
|
438 | + if ( ! empty($class)) { |
|
439 | 439 | $output .= ' |
440 | 440 | <div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;"> |
441 | 441 | <div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;"> |
442 | 442 | <h3>Class Details</h3>'; |
443 | - $a = new ReflectionClass( $class ); |
|
443 | + $a = new ReflectionClass($class); |
|
444 | 444 | $output .= ' |
445 | - <pre>' . $a . '</pre> |
|
445 | + <pre>' . $a.'</pre> |
|
446 | 446 | </div> |
447 | 447 | </div>'; |
448 | 448 | } |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | |
455 | 455 | } |
456 | 456 | |
457 | - $this->write_to_error_log( $time, $ex ); |
|
457 | + $this->write_to_error_log($time, $ex); |
|
458 | 458 | |
459 | 459 | } |
460 | 460 | |
461 | 461 | // remove last linebreak |
462 | - $output = substr( $output, 0, ( count( $output ) - 7 )); |
|
462 | + $output = substr($output, 0, (count($output) - 7)); |
|
463 | 463 | |
464 | - if ( ! WP_DEBUG ) { |
|
464 | + if ( ! WP_DEBUG) { |
|
465 | 465 | $output .= ' |
466 | 466 | </p>'; |
467 | 467 | } |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | $output .= ' |
470 | 470 | </div>'; |
471 | 471 | |
472 | - $output .= self::_print_scripts( TRUE ); |
|
472 | + $output .= self::_print_scripts(TRUE); |
|
473 | 473 | |
474 | - if ( defined( 'DOING_AJAX' )) { |
|
475 | - echo json_encode( array( 'error' => $output )); |
|
474 | + if (defined('DOING_AJAX')) { |
|
475 | + echo json_encode(array('error' => $output)); |
|
476 | 476 | exit(); |
477 | 477 | } |
478 | 478 | |
@@ -492,29 +492,29 @@ discard block |
||
492 | 492 | * @ param array $arguments |
493 | 493 | * @ return string |
494 | 494 | */ |
495 | - private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) { |
|
495 | + private function _convert_args_to_string($arguments = array(), $array = FALSE) { |
|
496 | 496 | |
497 | 497 | $arg_string = ''; |
498 | - if ( ! empty( $arguments )) { |
|
498 | + if ( ! empty($arguments)) { |
|
499 | 499 | |
500 | 500 | $args = array(); |
501 | 501 | |
502 | - foreach ( $arguments as $arg ) { |
|
502 | + foreach ($arguments as $arg) { |
|
503 | 503 | |
504 | - if ( ! empty( $arg )) { |
|
504 | + if ( ! empty($arg)) { |
|
505 | 505 | |
506 | - if ( is_string( $arg )) { |
|
507 | - $args[] = " '" . $arg . "'"; |
|
508 | - } elseif ( is_array( $arg )) { |
|
509 | - $args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE ); |
|
510 | - } elseif ( is_null( $arg )) { |
|
506 | + if (is_string($arg)) { |
|
507 | + $args[] = " '".$arg."'"; |
|
508 | + } elseif (is_array($arg)) { |
|
509 | + $args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE); |
|
510 | + } elseif (is_null($arg)) { |
|
511 | 511 | $args[] = ' NULL'; |
512 | - } elseif ( is_bool( $arg )) { |
|
513 | - $args[] = ( $arg ) ? ' TRUE' : ' FALSE'; |
|
514 | - } elseif ( is_object( $arg )) { |
|
515 | - $args[] = ' OBJECT ' . get_class( $arg ); |
|
516 | - } elseif ( is_resource( $arg )) { |
|
517 | - $args[] = get_resource_type( $arg ); |
|
512 | + } elseif (is_bool($arg)) { |
|
513 | + $args[] = ($arg) ? ' TRUE' : ' FALSE'; |
|
514 | + } elseif (is_object($arg)) { |
|
515 | + $args[] = ' OBJECT '.get_class($arg); |
|
516 | + } elseif (is_resource($arg)) { |
|
517 | + $args[] = get_resource_type($arg); |
|
518 | 518 | } else { |
519 | 519 | $args[] = $arg; |
520 | 520 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
525 | - $arg_string = implode( ', ', $args ); |
|
525 | + $arg_string = implode(', ', $args); |
|
526 | 526 | } |
527 | - if ( $array ) { |
|
527 | + if ($array) { |
|
528 | 528 | $arg_string .= ' )'; |
529 | 529 | } |
530 | 530 | return $arg_string; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $line the line number where the error occurred - just use __LINE__ |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
548 | - self::_add_notice ( 'errors', $msg, $file, $func, $line ); |
|
547 | + public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
548 | + self::_add_notice('errors', $msg, $file, $func, $line); |
|
549 | 549 | self::$_error_count++; |
550 | 550 | } |
551 | 551 | |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * @param string $line the line number where the error occurred - just use __LINE__ |
564 | 564 | * @return void |
565 | 565 | */ |
566 | - public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
567 | - self::_add_notice ( 'success', $msg, $file, $func, $line ); |
|
566 | + public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
567 | + self::_add_notice('success', $msg, $file, $func, $line); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | |
@@ -581,8 +581,8 @@ discard block |
||
581 | 581 | * @param string $line the line number where the error occurred - just use __LINE__ |
582 | 582 | * @return void |
583 | 583 | */ |
584 | - public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
585 | - self::_add_notice ( 'attention', $msg, $file, $func, $line ); |
|
584 | + public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
585 | + self::_add_notice('attention', $msg, $file, $func, $line); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | |
@@ -600,12 +600,12 @@ discard block |
||
600 | 600 | * @param string $line the line number where the error occurred - just use __LINE__ |
601 | 601 | * @return void |
602 | 602 | */ |
603 | - private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) { |
|
604 | - if ( empty( $msg )) { |
|
603 | + private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) { |
|
604 | + if (empty($msg)) { |
|
605 | 605 | EE_Error::doing_it_wrong( |
606 | - 'EE_Error::add_' . $type . '()', |
|
606 | + 'EE_Error::add_'.$type.'()', |
|
607 | 607 | sprintf( |
608 | - __( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ), |
|
608 | + __('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'), |
|
609 | 609 | $type, |
610 | 610 | $file, |
611 | 611 | $line |
@@ -613,27 +613,27 @@ discard block |
||
613 | 613 | EVENT_ESPRESSO_VERSION |
614 | 614 | ); |
615 | 615 | } |
616 | - if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) { |
|
616 | + if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) { |
|
617 | 617 | EE_Error::doing_it_wrong( |
618 | 618 | 'EE_Error::add_error()', |
619 | - __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ), |
|
619 | + __('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'), |
|
620 | 620 | EVENT_ESPRESSO_VERSION |
621 | 621 | ); |
622 | 622 | } |
623 | 623 | // get separate user and developer messages if they exist |
624 | - $msg = explode( '||', $msg ); |
|
624 | + $msg = explode('||', $msg); |
|
625 | 625 | $user_msg = $msg[0]; |
626 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
626 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
627 | 627 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
628 | 628 | // add notice if message exists |
629 | - if ( ! empty( $msg )) { |
|
629 | + if ( ! empty($msg)) { |
|
630 | 630 | // get error code, but only on error |
631 | - if ( WP_DEBUG && $type == 'errors' ) { |
|
632 | - $msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>'; |
|
631 | + if (WP_DEBUG && $type == 'errors') { |
|
632 | + $msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>'; |
|
633 | 633 | } |
634 | 634 | // add notice |
635 | - self::$_espresso_notices[ $type ][] = $msg; |
|
636 | - add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 ); |
|
635 | + self::$_espresso_notices[$type][] = $msg; |
|
636 | + add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | } |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @access private |
688 | 688 | * @return void |
689 | 689 | */ |
690 | - public static function reset_notices(){ |
|
690 | + public static function reset_notices() { |
|
691 | 691 | self::$_espresso_notices['success'] = FALSE; |
692 | 692 | self::$_espresso_notices['attention'] = FALSE; |
693 | 693 | self::$_espresso_notices['errors'] = FALSE; |
@@ -700,14 +700,14 @@ discard block |
||
700 | 700 | * @access public |
701 | 701 | * @return int |
702 | 702 | */ |
703 | - public static function has_notices(){ |
|
703 | + public static function has_notices() { |
|
704 | 704 | $has_notices = 0; |
705 | 705 | // check for success messages |
706 | - $has_notices = self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] ) ? 3 : $has_notices; |
|
706 | + $has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices; |
|
707 | 707 | // check for attention messages |
708 | - $has_notices = self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ? 2 : $has_notices; |
|
708 | + $has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices; |
|
709 | 709 | // check for error messages |
710 | - $has_notices = self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ? 1 : $has_notices; |
|
710 | + $has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices; |
|
711 | 711 | return $has_notices; |
712 | 712 | } |
713 | 713 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | * @param boolean $remove_empty whether or not to unset empty messages |
723 | 723 | * @return array |
724 | 724 | */ |
725 | - public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) { |
|
726 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
725 | + public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) { |
|
726 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
727 | 727 | |
728 | 728 | $success_messages = ''; |
729 | 729 | $attention_messages = ''; |
@@ -733,44 +733,44 @@ discard block |
||
733 | 733 | // EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
734 | 734 | |
735 | 735 | // either save notices to the db |
736 | - if ( $save_to_transient ) { |
|
737 | - update_option( 'ee_notices', self::$_espresso_notices ); |
|
736 | + if ($save_to_transient) { |
|
737 | + update_option('ee_notices', self::$_espresso_notices); |
|
738 | 738 | return; |
739 | 739 | } |
740 | 740 | // grab any notices that have been previously saved |
741 | - if ( $notices = get_option( 'ee_notices', FALSE )) { |
|
742 | - foreach ( $notices as $type => $notice ) { |
|
743 | - if ( is_array( $notice ) && ! empty( $notice )) { |
|
741 | + if ($notices = get_option('ee_notices', FALSE)) { |
|
742 | + foreach ($notices as $type => $notice) { |
|
743 | + if (is_array($notice) && ! empty($notice)) { |
|
744 | 744 | // make sure that existsing notice type is an array |
745 | - self::$_espresso_notices[ $type ] = is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array(); |
|
745 | + self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array(); |
|
746 | 746 | // merge stored notices with any newly created ones |
747 | - self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice ); |
|
747 | + self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice); |
|
748 | 748 | $print_scripts = TRUE; |
749 | 749 | } |
750 | 750 | } |
751 | 751 | // now clear any stored notices |
752 | - update_option( 'ee_notices', FALSE ); |
|
752 | + update_option('ee_notices', FALSE); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | // check for success messages |
756 | - if ( self::$_espresso_notices['success'] && ! empty( self::$_espresso_notices['success'] )) { |
|
756 | + if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) { |
|
757 | 757 | // combine messages |
758 | - $success_messages .= implode( self::$_espresso_notices['success'], '<br />' ); |
|
758 | + $success_messages .= implode(self::$_espresso_notices['success'], '<br />'); |
|
759 | 759 | $print_scripts = TRUE; |
760 | 760 | } |
761 | 761 | |
762 | 762 | // check for attention messages |
763 | - if ( self::$_espresso_notices['attention'] && ! empty( self::$_espresso_notices['attention'] ) ) { |
|
763 | + if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) { |
|
764 | 764 | // combine messages |
765 | - $attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' ); |
|
765 | + $attention_messages .= implode(self::$_espresso_notices['attention'], '<br />'); |
|
766 | 766 | $print_scripts = TRUE; |
767 | 767 | } |
768 | 768 | |
769 | 769 | // check for error messages |
770 | - if ( self::$_espresso_notices['errors'] && ! empty( self::$_espresso_notices['errors'] ) ) { |
|
771 | - $error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' ); |
|
770 | + if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) { |
|
771 | + $error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso'); |
|
772 | 772 | // combine messages |
773 | - $error_messages .= implode( self::$_espresso_notices['errors'], '<br />' ); |
|
773 | + $error_messages .= implode(self::$_espresso_notices['errors'], '<br />'); |
|
774 | 774 | $print_scripts = TRUE; |
775 | 775 | } |
776 | 776 | |
@@ -784,21 +784,21 @@ discard block |
||
784 | 784 | $css_id = is_admin() ? 'message' : 'espresso-notices-success'; |
785 | 785 | $css_class = is_admin() ? 'updated fade' : 'success fade-away'; |
786 | 786 | //showMessage( $success_messages ); |
787 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>'; |
|
787 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>'; |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | if ($attention_messages != '') { |
791 | 791 | $css_id = is_admin() ? 'message' : 'espresso-notices-attention'; |
792 | 792 | $css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away'; |
793 | 793 | //showMessage( $error_messages, TRUE ); |
794 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>'; |
|
794 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>'; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | if ($error_messages != '') { |
798 | 798 | $css_id = is_admin() ? 'message' : 'espresso-notices-error'; |
799 | 799 | $css_class = is_admin() ? 'error' : 'error fade-away'; |
800 | 800 | //showMessage( $error_messages, TRUE ); |
801 | - $notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>'; |
|
801 | + $notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>'; |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | $notices .= '</div>'; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | 'errors' => $error_messages |
812 | 812 | ); |
813 | 813 | |
814 | - if ( $remove_empty ) { |
|
814 | + if ($remove_empty) { |
|
815 | 815 | // remove empty notices |
816 | 816 | foreach ($notices as $type => $notice) { |
817 | 817 | if (empty($notice)) { |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } |
822 | 822 | } |
823 | 823 | |
824 | - if ( $print_scripts ) { |
|
824 | + if ($print_scripts) { |
|
825 | 825 | self::_print_scripts(); |
826 | 826 | } |
827 | 827 | |
@@ -841,17 +841,17 @@ discard block |
||
841 | 841 | * @param bool $force_update allows one to enforce the reappearance of a persistent message. |
842 | 842 | * @return void |
843 | 843 | */ |
844 | - public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) { |
|
845 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
846 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
844 | + public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) { |
|
845 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
846 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
847 | 847 | //maybe initialize persistent_admin_notices |
848 | - if ( empty( $persistent_admin_notices )) { |
|
849 | - add_option( 'ee_pers_admin_notices', array(), '', 'no' ); |
|
848 | + if (empty($persistent_admin_notices)) { |
|
849 | + add_option('ee_pers_admin_notices', array(), '', 'no'); |
|
850 | 850 | } |
851 | - $pan_name = sanitize_key( $pan_name ); |
|
852 | - if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) { |
|
853 | - $persistent_admin_notices[ $pan_name ] = $pan_message; |
|
854 | - update_option( 'ee_pers_admin_notices', $persistent_admin_notices ); |
|
851 | + $pan_name = sanitize_key($pan_name); |
|
852 | + if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) { |
|
853 | + $persistent_admin_notices[$pan_name] = $pan_message; |
|
854 | + update_option('ee_pers_admin_notices', $persistent_admin_notices); |
|
855 | 855 | } |
856 | 856 | } |
857 | 857 | } |
@@ -867,34 +867,34 @@ discard block |
||
867 | 867 | * @param bool $return_immediately |
868 | 868 | * @return void |
869 | 869 | */ |
870 | - public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) { |
|
871 | - $pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name; |
|
872 | - if ( ! empty( $pan_name )) { |
|
873 | - $persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() ); |
|
870 | + public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) { |
|
871 | + $pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name; |
|
872 | + if ( ! empty($pan_name)) { |
|
873 | + $persistent_admin_notices = get_option('ee_pers_admin_notices', array()); |
|
874 | 874 | // check if notice we wish to dismiss is actually in the $persistent_admin_notices array |
875 | - if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) { |
|
875 | + if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) { |
|
876 | 876 | // completely delete nag notice, or just NULL message so that it can NOT be added again ? |
877 | - if ( $purge ) { |
|
878 | - unset( $persistent_admin_notices[ $pan_name ] ); |
|
877 | + if ($purge) { |
|
878 | + unset($persistent_admin_notices[$pan_name]); |
|
879 | 879 | } else { |
880 | - $persistent_admin_notices[ $pan_name ] = NULL; |
|
880 | + $persistent_admin_notices[$pan_name] = NULL; |
|
881 | 881 | } |
882 | - if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) { |
|
883 | - EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ ); |
|
882 | + if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) { |
|
883 | + EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__); |
|
884 | 884 | } |
885 | 885 | } |
886 | 886 | } |
887 | - if ( $return_immediately ) { |
|
887 | + if ($return_immediately) { |
|
888 | 888 | return; |
889 | - } else if ( EE_Registry::instance()->REQ->ajax ) { |
|
889 | + } else if (EE_Registry::instance()->REQ->ajax) { |
|
890 | 890 | // grab any notices and concatenate into string |
891 | - echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE )))); |
|
891 | + echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE)))); |
|
892 | 892 | exit(); |
893 | 893 | } else { |
894 | 894 | // save errors to a transient to be displayed on next request (after redirect) |
895 | - EE_Error::get_notices( FALSE, TRUE ); |
|
896 | - $return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : ''; |
|
897 | - wp_safe_redirect( urldecode( $return_url )); |
|
895 | + EE_Error::get_notices(FALSE, TRUE); |
|
896 | + $return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : ''; |
|
897 | + wp_safe_redirect(urldecode($return_url)); |
|
898 | 898 | } |
899 | 899 | } |
900 | 900 | |
@@ -909,20 +909,20 @@ discard block |
||
909 | 909 | * @param string $return_url URL to go back to aftger nag notice is dismissed |
910 | 910 | * @return string |
911 | 911 | */ |
912 | - public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) { |
|
913 | - if ( ! empty( $pan_name ) && ! empty( $pan_message )) { |
|
912 | + public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') { |
|
913 | + if ( ! empty($pan_name) && ! empty($pan_message)) { |
|
914 | 914 | $args = array( |
915 | 915 | 'nag_notice' => $pan_name, |
916 | - 'return_url' => urlencode( $return_url ), |
|
916 | + 'return_url' => urlencode($return_url), |
|
917 | 917 | 'ajax_url' => WP_AJAX_URL, |
918 | - 'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' ) |
|
918 | + 'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso') |
|
919 | 919 | ); |
920 | - wp_localize_script( 'espresso_core', 'ee_dismiss', $args ); |
|
920 | + wp_localize_script('espresso_core', 'ee_dismiss', $args); |
|
921 | 921 | return ' |
922 | - <div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
923 | - <p>' . $pan_message . '</p> |
|
924 | - <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '"> |
|
925 | - <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .' |
|
922 | + <div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;"> |
|
923 | + <p>' . $pan_message.'</p> |
|
924 | + <a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'"> |
|
925 | + <span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').' |
|
926 | 926 | </a> |
927 | 927 | <div style="clear:both;"></div> |
928 | 928 | </div>'; |
@@ -938,17 +938,17 @@ discard block |
||
938 | 938 | * @param string $return_url |
939 | 939 | * @return array |
940 | 940 | */ |
941 | - public static function get_persistent_admin_notices( $return_url = '' ) { |
|
941 | + public static function get_persistent_admin_notices($return_url = '') { |
|
942 | 942 | $notices = ''; |
943 | 943 | // check for persistent admin notices |
944 | - if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) { |
|
944 | + if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) { |
|
945 | 945 | // load scripts |
946 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
947 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
948 | - wp_enqueue_script( 'ee_error_js' ); |
|
946 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
947 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
948 | + wp_enqueue_script('ee_error_js'); |
|
949 | 949 | // and display notices |
950 | - foreach( $persistent_admin_notices as $pan_name => $pan_message ) { |
|
951 | - $notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url ); |
|
950 | + foreach ($persistent_admin_notices as $pan_name => $pan_message) { |
|
951 | + $notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url); |
|
952 | 952 | } |
953 | 953 | } |
954 | 954 | return $notices; |
@@ -963,26 +963,26 @@ discard block |
||
963 | 963 | * @param bool $force_print |
964 | 964 | * @return void |
965 | 965 | */ |
966 | - private static function _print_scripts( $force_print = FALSE ) { |
|
967 | - if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) { |
|
968 | - if ( wp_script_is( 'ee_error_js', 'enqueued' )) { |
|
966 | + private static function _print_scripts($force_print = FALSE) { |
|
967 | + if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) { |
|
968 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
969 | 969 | return; |
970 | - } else if ( wp_script_is( 'ee_error_js', 'registered' )) { |
|
971 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
972 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
973 | - wp_enqueue_script( 'ee_error_js' ); |
|
974 | - wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG )); |
|
970 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
971 | + add_filter('FHEE_load_css', '__return_true'); |
|
972 | + add_filter('FHEE_load_js', '__return_true'); |
|
973 | + wp_enqueue_script('ee_error_js'); |
|
974 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG)); |
|
975 | 975 | } |
976 | 976 | } else { |
977 | 977 | return ' |
978 | 978 | <script> |
979 | 979 | /* <![CDATA[ */ |
980 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
980 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
981 | 981 | /* ]]> */ |
982 | 982 | </script> |
983 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
984 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
985 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
983 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
984 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
985 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
986 | 986 | '; |
987 | 987 | |
988 | 988 | } |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | * @ param string $line |
1017 | 1017 | * @ return string |
1018 | 1018 | */ |
1019 | - public static function generate_error_code ( $file = '', $func = '', $line = '' ) { |
|
1020 | - $file = explode( '.', basename( $file )); |
|
1021 | - $error_code = ! empty( $file[0] ) ? $file[0] : ''; |
|
1022 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
1023 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
1019 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
1020 | + $file = explode('.', basename($file)); |
|
1021 | + $error_code = ! empty($file[0]) ? $file[0] : ''; |
|
1022 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
1023 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
1024 | 1024 | return $error_code; |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1036,37 +1036,37 @@ discard block |
||
1036 | 1036 | * @ param object $ex |
1037 | 1037 | * @ return void |
1038 | 1038 | */ |
1039 | - public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) { |
|
1039 | + public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) { |
|
1040 | 1040 | |
1041 | - if ( ! $ex ) { |
|
1041 | + if ( ! $ex) { |
|
1042 | 1042 | return; |
1043 | 1043 | } |
1044 | 1044 | |
1045 | - if ( ! $time ) { |
|
1045 | + if ( ! $time) { |
|
1046 | 1046 | $time = time(); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - $exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1050 | - $exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . '] Exception Details' . PHP_EOL; |
|
1051 | - $exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL; |
|
1052 | - $exception_log .= 'Code: '. $ex['code'] . PHP_EOL; |
|
1053 | - $exception_log .= 'File: '. $ex['file'] . PHP_EOL; |
|
1054 | - $exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL; |
|
1055 | - $exception_log .= 'Stack trace: ' . PHP_EOL; |
|
1056 | - $exception_log .= $ex['string'] . PHP_EOL; |
|
1057 | - $exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
1058 | - |
|
1059 | - EE_Registry::instance()->load_helper( 'File' ); |
|
1049 | + $exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1050 | + $exception_log .= '['.date('Y-m-d H:i:s', $time).'] Exception Details'.PHP_EOL; |
|
1051 | + $exception_log .= 'Message: '.$ex['msg'].PHP_EOL; |
|
1052 | + $exception_log .= 'Code: '.$ex['code'].PHP_EOL; |
|
1053 | + $exception_log .= 'File: '.$ex['file'].PHP_EOL; |
|
1054 | + $exception_log .= 'Line No: '.$ex['line'].PHP_EOL; |
|
1055 | + $exception_log .= 'Stack trace: '.PHP_EOL; |
|
1056 | + $exception_log .= $ex['string'].PHP_EOL; |
|
1057 | + $exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
1058 | + |
|
1059 | + EE_Registry::instance()->load_helper('File'); |
|
1060 | 1060 | try { |
1061 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ); |
|
1062 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); |
|
1063 | - if ( ! $clear ) { |
|
1061 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file); |
|
1062 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); |
|
1063 | + if ( ! $clear) { |
|
1064 | 1064 | //get existing log file and append new log info |
1065 | - $exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log; |
|
1065 | + $exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log; |
|
1066 | 1066 | } |
1067 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log ); |
|
1068 | - } catch( EE_Error $e ){ |
|
1069 | - EE_Error::add_error( sprintf( __( 'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
1067 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log); |
|
1068 | + } catch (EE_Error $e) { |
|
1069 | + EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
1070 | 1070 | return; |
1071 | 1071 | } |
1072 | 1072 | |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | * @param int $error_type |
1091 | 1091 | * @return void |
1092 | 1092 | */ |
1093 | - public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
1094 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
1093 | + public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
1094 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
1095 | 1095 | EE_Registry::instance()->load_helper('Debug_Tools'); |
1096 | - EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type ); |
|
1096 | + EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type); |
|
1097 | 1097 | } |
1098 | 1098 | } |
1099 | 1099 | |
@@ -1113,13 +1113,13 @@ discard block |
||
1113 | 1113 | */ |
1114 | 1114 | function espresso_error_enqueue_scripts() { |
1115 | 1115 | // js for error handling |
1116 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1117 | - wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE ); |
|
1116 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1117 | + wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE); |
|
1118 | 1118 | } |
1119 | -if ( is_admin() ) { |
|
1120 | - add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1119 | +if (is_admin()) { |
|
1120 | + add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1121 | 1121 | } else { |
1122 | - add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 ); |
|
1122 | + add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2); |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 |
@@ -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 | * |
4 | 4 | * Class EE_Log |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return EE_Log |
63 | 63 | */ |
64 | 64 | public static function instance() { |
65 | - if ( ! self::$_instance instanceof EE_Log ) { |
|
65 | + if ( ! self::$_instance instanceof EE_Log) { |
|
66 | 66 | self::$_instance = new self(); |
67 | 67 | } |
68 | 68 | return self::$_instance; |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function __construct() { |
76 | 76 | |
77 | - if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
77 | + if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | |
81 | - $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS; |
|
81 | + $this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS; |
|
82 | 82 | $this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name(); |
83 | 83 | $this->_log = ''; |
84 | 84 | $this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name(); |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
87 | 87 | $this->_remote_log = ''; |
88 | 88 | |
89 | - add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 ); |
|
90 | - add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 ); |
|
91 | - if ( EE_Registry::instance()->CFG->admin->use_full_logging ) { |
|
92 | - add_action( 'shutdown', array( $this, 'write_log' ), 9999 ); |
|
89 | + add_action('admin_init', array($this, 'verify_filesystem'), -10); |
|
90 | + add_action('AHEE_log', array($this, 'log'), 10, 4); |
|
91 | + if (EE_Registry::instance()->CFG->admin->use_full_logging) { |
|
92 | + add_action('shutdown', array($this, 'write_log'), 9999); |
|
93 | 93 | // if WP_DEBUG |
94 | - add_action( 'shutdown', array( $this, 'write_debug' ), 9999 ); |
|
94 | + add_action('shutdown', array($this, 'write_debug'), 9999); |
|
95 | 95 | } |
96 | - if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) { |
|
97 | - add_action( 'shutdown', array( $this, 'send_log' ), 9999 ); |
|
96 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
97 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | } |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function verify_filesystem() { |
110 | 110 | try { |
111 | - EE_Registry::instance()->load_helper( 'File' ); |
|
112 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file ); |
|
113 | - EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file ); |
|
114 | - EEH_File::add_htaccess_deny_from_all( $this->_logs_folder ); |
|
115 | - } catch( EE_Error $e ){ |
|
116 | - EE_Error::add_error( sprintf( __( 'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
111 | + EE_Registry::instance()->load_helper('File'); |
|
112 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file); |
|
113 | + EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file); |
|
114 | + EEH_File::add_htaccess_deny_from_all($this->_logs_folder); |
|
115 | + } catch (EE_Error $e) { |
|
116 | + EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | } |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | * @param string $type |
131 | 131 | * @return string |
132 | 132 | */ |
133 | - private function _format_message( $file = '', $function = '', $message = '', $type = '' ) { |
|
134 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
135 | - $msg .= '[' . current_time( 'mysql' ) . '] '; |
|
136 | - $msg .= ! empty( $file ) ? basename( $file ) : ''; |
|
137 | - $msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : ''; |
|
138 | - $msg .= ! empty( $function ) ? $function . '()' : ''; |
|
133 | + private function _format_message($file = '', $function = '', $message = '', $type = '') { |
|
134 | + $msg = '----------------------------------------------------------------------------------------'.PHP_EOL; |
|
135 | + $msg .= '['.current_time('mysql').'] '; |
|
136 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
137 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
138 | + $msg .= ! empty($function) ? $function.'()' : ''; |
|
139 | 139 | $msg .= PHP_EOL; |
140 | - $type = ! empty( $type ) ? $type : 'log message'; |
|
141 | - $msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
140 | + $type = ! empty($type) ? $type : 'log message'; |
|
141 | + $msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : ''; |
|
142 | 142 | return $msg; |
143 | 143 | } |
144 | 144 | |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * @param string $message |
154 | 154 | * @param string $type |
155 | 155 | */ |
156 | - public function log( $file = '', $function = '', $message = '', $type = '' ) { |
|
157 | - $this->_log .= $this->_format_message( $file, $function, $message, $type ); |
|
156 | + public function log($file = '', $function = '', $message = '', $type = '') { |
|
157 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | public function write_log() { |
167 | 167 | try { |
168 | 168 | //get existing log file and append new log info |
169 | - $this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log; |
|
170 | - EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' ); |
|
171 | - } catch( EE_Error $e ){ |
|
172 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
169 | + $this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log; |
|
170 | + EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log'); |
|
171 | + } catch (EE_Error $e) { |
|
172 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | } |
@@ -182,31 +182,31 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function send_log() { |
184 | 184 | |
185 | - if ( empty( $this->_remote_logging_url )) { |
|
185 | + if (empty($this->_remote_logging_url)) { |
|
186 | 186 | return; |
187 | 187 | } |
188 | 188 | |
189 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
190 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
191 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
192 | - $data .= '&time=' . time(); |
|
193 | - $data .= '&remote_log=' . $this->_log; |
|
194 | - $data .= '&request_array=' . json_encode( $_REQUEST ); |
|
189 | + $data = 'domain='.$_SERVER['HTTP_HOST']; |
|
190 | + $data .= '&ip='.$_SERVER['SERVER_ADDR']; |
|
191 | + $data .= '&server_type='.$_SERVER['SERVER_SOFTWARE']; |
|
192 | + $data .= '&time='.time(); |
|
193 | + $data .= '&remote_log='.$this->_log; |
|
194 | + $data .= '&request_array='.json_encode($_REQUEST); |
|
195 | 195 | $data .= '&action=save'; |
196 | 196 | |
197 | - if ( defined( 'EELOGGING_PASS' )) { |
|
198 | - $data .= '&pass=' . EELOGGING_PASS; |
|
197 | + if (defined('EELOGGING_PASS')) { |
|
198 | + $data .= '&pass='.EELOGGING_PASS; |
|
199 | 199 | } |
200 | - if ( defined( 'EELOGGING_KEY' )) { |
|
201 | - $data .= '&key=' . EELOGGING_KEY; |
|
200 | + if (defined('EELOGGING_KEY')) { |
|
201 | + $data .= '&key='.EELOGGING_KEY; |
|
202 | 202 | } |
203 | 203 | |
204 | - $c = curl_init( $this->_remote_logging_url ); |
|
205 | - curl_setopt( $c, CURLOPT_POST, TRUE ); |
|
206 | - curl_setopt( $c, CURLOPT_POSTFIELDS, $data ); |
|
207 | - curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE ); |
|
208 | - curl_exec( $c ); |
|
209 | - curl_close( $c ); |
|
204 | + $c = curl_init($this->_remote_logging_url); |
|
205 | + curl_setopt($c, CURLOPT_POST, TRUE); |
|
206 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
207 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); |
|
208 | + curl_exec($c); |
|
209 | + curl_close($c); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -217,18 +217,18 @@ discard block |
||
217 | 217 | * previous entries are overwritten |
218 | 218 | */ |
219 | 219 | public function write_debug() { |
220 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
220 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
221 | 221 | $this->_debug_log = ''; |
222 | - foreach ( $_GET as $key => $value ) { |
|
223 | - $this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
222 | + foreach ($_GET as $key => $value) { |
|
223 | + $this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
224 | 224 | } |
225 | - foreach ( $_POST as $key => $value ) { |
|
226 | - $this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL; |
|
225 | + foreach ($_POST as $key => $value) { |
|
226 | + $this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL; |
|
227 | 227 | } |
228 | 228 | try { |
229 | - EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' ); |
|
230 | - } catch( EE_Error $e ){ |
|
231 | - EE_Error::add_error( sprintf( __( 'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
229 | + EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log'); |
|
230 | + } catch (EE_Error $e) { |
|
231 | + EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
232 | 232 | return; |
233 | 233 | } |
234 | 234 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * __clone |
241 | 241 | */ |
242 | 242 | public function __clone() { |
243 | - trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR ); |
|
243 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * @return string the assembled html string containing the tabbed content for display. |
47 | 47 | * @throws \EE_Error |
48 | 48 | */ |
49 | - public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) { |
|
49 | + public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) { |
|
50 | 50 | |
51 | 51 | //first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
52 | - if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) { |
|
53 | - throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') ); |
|
52 | + if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) { |
|
53 | + throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //make sure we've got incoming data setup properly |
57 | - $tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents ); |
|
58 | - $tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents; |
|
57 | + $tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
58 | + $tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
59 | 59 | |
60 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
60 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
61 | 61 | $all_tabs_content = ''; |
62 | 62 | |
63 | 63 | $index = 0; |
64 | - foreach ( $tabs as $tab ) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | $active = $index === 0 ? true : false; |
66 | 66 | $all_tabs .= self::tab($tab, $active); |
67 | 67 | $all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
80 | 80 | |
81 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
81 | + return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
105 | + if (empty($nav_tabs)) |
|
106 | + throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
107 | 107 | |
108 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
109 | - foreach ( $nav_tabs as $slug => $tab ) { |
|
108 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
109 | + foreach ($nav_tabs as $slug => $tab) { |
|
110 | 110 | $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
111 | 111 | } |
112 | 112 | $all_tabs .= '</h2>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | * @param bool|string $css If string given then the generated tab will include that as the class. |
123 | 123 | * @return string html for tab |
124 | 124 | */ |
125 | - private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) { |
|
125 | + private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) { |
|
126 | 126 | $name = str_replace(' ', '-', $name); |
127 | 127 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
128 | - $class = $css ? $class . ' ' . $css : $class; |
|
129 | - $nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) ); |
|
130 | - $url = $url ? $url : '#' . $name; |
|
131 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
128 | + $class = $css ? $class.' '.$css : $class; |
|
129 | + $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
130 | + $url = $url ? $url : '#'.$name; |
|
131 | + $tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t"; |
|
132 | 132 | return $tab; |
133 | 133 | } |
134 | 134 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private static function tab_content($name, $tab_content, $active = false) { |
146 | 146 | $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
147 | - $name = str_replace( ' ', '-', $name); |
|
148 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
149 | - $content .= "\t" . $tab_content . "\n"; |
|
147 | + $name = str_replace(' ', '-', $name); |
|
148 | + $content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n"; |
|
149 | + $content .= "\t".$tab_content."\n"; |
|
150 | 150 | $content .= '<div style="clear:both"></div></div>'; |
151 | 151 | return $content; |
152 | 152 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
173 | 173 | * @return string a html snippet of of all the formatted link elements. |
174 | 174 | */ |
175 | - public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
|
176 | - $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
|
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
175 | + public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') { |
|
176 | + $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
177 | + if ( ! is_array($item_array) || empty($item_array)) |
|
178 | 178 | return false; //get out we don't have even the basic thing we need! |
179 | 179 | |
180 | 180 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | 'title' => esc_attr__('Link for Item', 'event_espresso'), |
186 | 186 | 'slug' => 'item_slug' |
187 | 187 | ); |
188 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
189 | - $list = '<ul class="' . $container_class . '">'; |
|
188 | + $container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links'; |
|
189 | + $list = '<ul class="'.$container_class.'">'; |
|
190 | 190 | |
191 | 191 | $ci = 1; |
192 | - foreach ( $item_array as $item ) { |
|
193 | - $item = wp_parse_args( $item, $defaults ); |
|
194 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
192 | + foreach ($item_array as $item) { |
|
193 | + $item = wp_parse_args($item, $defaults); |
|
194 | + $item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class']; |
|
195 | 195 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
196 | + if ( ! empty($sep) && $ci != count($item_array)) |
|
197 | 197 | $list .= self::_text_link_item($sep); |
198 | 198 | $ci++; |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - private static function _text_link_item( $item ) { |
|
207 | + private static function _text_link_item($item) { |
|
208 | 208 | //if this isn't an array then we're doing a separator |
209 | - if ( !is_array( $item ) ) { |
|
209 | + if ( ! is_array($item)) { |
|
210 | 210 | $label = $item; |
211 | 211 | $class = 'ee-text-link-sep'; |
212 | 212 | $href = ''; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | extract($item); |
216 | 216 | } |
217 | 217 | |
218 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
218 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"'; |
|
219 | 219 | |
220 | - $content = '<li ' . $class . '>'; |
|
221 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
220 | + $content = '<li '.$class.'>'; |
|
221 | + $content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : ''; |
|
222 | 222 | $content .= $label; |
223 | - $content .= !empty($href) ? '</a>' : ''; |
|
223 | + $content .= ! empty($href) ? '</a>' : ''; |
|
224 | 224 | $content .= '</li>'; |
225 | 225 | return $content; |
226 | 226 | } |