@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * Class EE_Line_Item_Filter_Collection |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param int $code |
26 | 26 | * @param \Exception $previous |
27 | 27 | */ |
28 | - public function __construct( $class_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
29 | - if ( empty( $message ) ) { |
|
28 | + public function __construct($class_name, $message = '', $code = 0, \Exception $previous = null) { |
|
29 | + if (empty($message)) { |
|
30 | 30 | $message = sprintf( |
31 | - __( 'The "%1$s" Class is either missing or invalid.', 'event_espresso' ), |
|
31 | + __('The "%1$s" Class is either missing or invalid.', 'event_espresso'), |
|
32 | 32 | $class_name |
33 | 33 | ); |
34 | 34 | } |
35 | - parent::__construct( $message, $code, $previous ); |
|
35 | + parent::__construct($message, $code, $previous); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | * @param int $code |
27 | 27 | * @param \Exception $previous |
28 | 28 | */ |
29 | - public function __construct( $interface_name, $message = '', $code = 0, \Exception $previous = null ) { |
|
30 | - if ( empty( $message ) ) { |
|
29 | + public function __construct($interface_name, $message = '', $code = 0, \Exception $previous = null) { |
|
30 | + if (empty($message)) { |
|
31 | 31 | $message = sprintf( |
32 | - __( 'The "%1$s" Interface is either missing or invalid.', 'event_espresso' ), |
|
32 | + __('The "%1$s" Interface is either missing or invalid.', 'event_espresso'), |
|
33 | 33 | $interface_name |
34 | 34 | ); |
35 | 35 | } |
36 | - parent::__construct( $message, $code, $previous ); |
|
36 | + parent::__construct($message, $code, $previous); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -25,19 +25,19 @@ discard block |
||
25 | 25 | * @param int $code |
26 | 26 | * @param \Exception $previous |
27 | 27 | */ |
28 | - public function __construct( $file_path, $message = '', $code = 0, \Exception $previous = null ) { |
|
29 | - if ( empty( $message ) ) { |
|
28 | + public function __construct($file_path, $message = '', $code = 0, \Exception $previous = null) { |
|
29 | + if (empty($message)) { |
|
30 | 30 | $message = sprintf( |
31 | 31 | __( |
32 | 32 | 'The "%1$s" file is either missing or could not be read due to permissions. Please ensure that the following path is correct and verify that the file permissions are correct:%2$s %3$s', |
33 | 33 | 'event_espresso' |
34 | 34 | ), |
35 | - basename( $file_path ), |
|
35 | + basename($file_path), |
|
36 | 36 | '<br />', |
37 | 37 | $file_path |
38 | 38 | ); |
39 | 39 | } |
40 | - parent::__construct( $message, $code, $previous ); |
|
40 | + parent::__construct($message, $code, $previous); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class InvalidIdentifierException |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @param int $code |
24 | 24 | * @param \Exception $previous |
25 | 25 | */ |
26 | - public function __construct( $actual, $expected, $message = '', $code = 0, \Exception $previous = null ) { |
|
27 | - if ( empty( $message ) ) { |
|
26 | + public function __construct($actual, $expected, $message = '', $code = 0, \Exception $previous = null) { |
|
27 | + if (empty($message)) { |
|
28 | 28 | $message = sprintf( |
29 | 29 | __( |
30 | 30 | 'The supplied identifier "%1$s" is invalid. A value like "%2$s" was expected.', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $expected |
35 | 35 | ); |
36 | 36 | } |
37 | - parent::__construct( $message, $code, $previous ); |
|
37 | + parent::__construct($message, $code, $previous); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @final |
481 | 481 | * @access protected |
482 | - * @return void |
|
482 | + * @return false|null |
|
483 | 483 | */ |
484 | 484 | final protected function _page_setup() { |
485 | 485 | |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
754 | 754 | * |
755 | 755 | * @access protected |
756 | - * @return void |
|
756 | + * @return false|null |
|
757 | 757 | */ |
758 | 758 | protected function _verify_routes() { |
759 | 759 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | /** |
816 | 816 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
817 | 817 | * @param string $route the route name we're verifying |
818 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
818 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
819 | 819 | */ |
820 | 820 | protected function _verify_route( $route ) { |
821 | 821 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -2186,7 +2186,7 @@ discard block |
||
2186 | 2186 | * @param string $name key used for the action ID (i.e. event_id) |
2187 | 2187 | * @param int $id id attached to the item published |
2188 | 2188 | * @param string $delete page route callback for the delete action |
2189 | - * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
|
2189 | + * @param string $save_close_redirect_URL custom URL to redirect to after Save & Close has been completed |
|
2190 | 2190 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2191 | 2191 | */ |
2192 | 2192 | protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
@@ -2690,7 +2690,7 @@ discard block |
||
2690 | 2690 | /** |
2691 | 2691 | * sort nav tabs |
2692 | 2692 | * @access public |
2693 | - * @return void |
|
2693 | + * @return integer |
|
2694 | 2694 | */ |
2695 | 2695 | private function _sort_nav_tabs( $a, $b ) { |
2696 | 2696 | if ($a['order'] == $b['order']) { |
@@ -3309,7 +3309,7 @@ discard block |
||
3309 | 3309 | |
3310 | 3310 | |
3311 | 3311 | /** |
3312 | - * @return mixed |
|
3312 | + * @return string[] |
|
3313 | 3313 | */ |
3314 | 3314 | public function default_espresso_metaboxes() { |
3315 | 3315 | return $this->_default_espresso_metaboxes; |
@@ -3327,7 +3327,7 @@ discard block |
||
3327 | 3327 | |
3328 | 3328 | |
3329 | 3329 | /** |
3330 | - * @return mixed |
|
3330 | + * @return string |
|
3331 | 3331 | */ |
3332 | 3332 | public function wp_page_slug() { |
3333 | 3333 | return $this->_wp_page_slug; |
@@ -3340,7 +3340,6 @@ discard block |
||
3340 | 3340 | * |
3341 | 3341 | * @access protected |
3342 | 3342 | * @param string $tab |
3343 | - * @param array $data |
|
3344 | 3343 | * @param string $file file where error occurred |
3345 | 3344 | * @param string $func function where error occurred |
3346 | 3345 | * @param string $line line no where error occurred |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
155 | 155 | * @access public |
156 | 156 | */ |
157 | - public function __construct( $routing = TRUE ) { |
|
157 | + public function __construct($routing = TRUE) { |
|
158 | 158 | |
159 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
159 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
160 | 160 | $this->_is_caf = TRUE; |
161 | 161 | |
162 | 162 | $this->_yes_no_values = array( |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | |
168 | 168 | |
169 | 169 | //set the _req_data property. |
170 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
170 | + $this->_req_data = array_merge($_GET, $_POST); |
|
171 | 171 | |
172 | 172 | |
173 | 173 | //routing enabled? |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $this->_do_other_page_hooks(); |
189 | 189 | |
190 | 190 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
191 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
191 | + if (method_exists($this, '_before_page_setup')) |
|
192 | 192 | $this->_before_page_setup(); |
193 | 193 | |
194 | 194 | //set up page dependencies |
@@ -458,16 +458,16 @@ discard block |
||
458 | 458 | */ |
459 | 459 | protected function _global_ajax_hooks() { |
460 | 460 | //for lazy loading of metabox content |
461 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
461 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
465 | 465 | |
466 | 466 | public function ajax_metabox_content() { |
467 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
468 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
467 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
468 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
469 | 469 | |
470 | - self::cached_rss_display( $contentid, $url ); |
|
470 | + self::cached_rss_display($contentid, $url); |
|
471 | 471 | wp_die(); |
472 | 472 | } |
473 | 473 | |
@@ -486,87 +486,87 @@ discard block |
||
486 | 486 | //requires? |
487 | 487 | |
488 | 488 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
489 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
489 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
490 | 490 | |
491 | 491 | |
492 | 492 | //next verify if we need to load anything... |
493 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE; |
|
494 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
493 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE; |
|
494 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
495 | 495 | |
496 | 496 | global $ee_menu_slugs; |
497 | 497 | $ee_menu_slugs = (array) $ee_menu_slugs; |
498 | 498 | |
499 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
499 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
500 | 500 | |
501 | 501 | |
502 | 502 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
503 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
504 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
503 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
504 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
505 | 505 | } |
506 | 506 | // then set blank or -1 action values to 'default' |
507 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
507 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
508 | 508 | |
509 | 509 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
510 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
510 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
511 | 511 | |
512 | 512 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
513 | 513 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
514 | 514 | |
515 | 515 | $this->_current_view = $this->_req_action; |
516 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
516 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
517 | 517 | $this->_define_page_props(); |
518 | 518 | |
519 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
519 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
520 | 520 | |
521 | 521 | //default things |
522 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
522 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
523 | 523 | |
524 | 524 | //set page configs |
525 | 525 | $this->_set_page_routes(); |
526 | 526 | $this->_set_page_config(); |
527 | 527 | |
528 | 528 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
529 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
529 | + if (isset($this->_req_data['wp_referer'])) { |
|
530 | 530 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
531 | 531 | } |
532 | 532 | |
533 | 533 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
534 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
534 | + if (method_exists($this, '_extend_page_config')) |
|
535 | 535 | $this->_extend_page_config(); |
536 | 536 | |
537 | 537 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
538 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
539 | 539 | $this->_extend_page_config_for_cpt(); |
540 | 540 | |
541 | 541 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
542 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
543 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
542 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
543 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
544 | 544 | |
545 | 545 | |
546 | 546 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
547 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
548 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
547 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
548 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
552 | 552 | //next route only if routing enabled |
553 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
553 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
554 | 554 | |
555 | 555 | $this->_verify_routes(); |
556 | 556 | |
557 | 557 | //next let's just check user_access and kill if no access |
558 | 558 | $this->check_user_access(); |
559 | 559 | |
560 | - if ( $this->_is_UI_request ) { |
|
560 | + if ($this->_is_UI_request) { |
|
561 | 561 | //admin_init stuff - global, all views for this page class, specific view |
562 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
563 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
564 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
562 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
563 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
564 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | } else { |
568 | 568 | //hijack regular WP loading and route admin request immediately |
569 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
569 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
570 | 570 | $this->route_admin_request(); |
571 | 571 | } |
572 | 572 | } |
@@ -583,18 +583,18 @@ discard block |
||
583 | 583 | * @return void |
584 | 584 | */ |
585 | 585 | private function _do_other_page_hooks() { |
586 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
586 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
587 | 587 | |
588 | - foreach ( $registered_pages as $page ) { |
|
588 | + foreach ($registered_pages as $page) { |
|
589 | 589 | |
590 | 590 | //now let's setup the file name and class that should be present |
591 | 591 | $classname = str_replace('.class.php', '', $page); |
592 | 592 | |
593 | 593 | //autoloaders should take care of loading file |
594 | - if ( !class_exists( $classname ) ) { |
|
595 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
596 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
597 | - throw new EE_Error( implode( '||', $error_msg )); |
|
594 | + if ( ! class_exists($classname)) { |
|
595 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
596 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
597 | + throw new EE_Error(implode('||', $error_msg)); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | $a = new ReflectionClass($classname); |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | public function load_page_dependencies() { |
610 | 610 | try { |
611 | 611 | $this->_load_page_dependencies(); |
612 | - } catch ( EE_Error $e ) { |
|
612 | + } catch (EE_Error $e) { |
|
613 | 613 | $e->get_error(); |
614 | 614 | } |
615 | 615 | } |
@@ -627,16 +627,16 @@ discard block |
||
627 | 627 | $this->_current_screen = get_current_screen(); |
628 | 628 | |
629 | 629 | //load admin_notices - global, page class, and view specific |
630 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
631 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
632 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
633 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
630 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
631 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
632 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
633 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | //load network admin_notices - global, page class, and view specific |
637 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
638 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
639 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
637 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
638 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
639 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | //this will save any per_page screen options if they are present |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | //add screen options - global, page child class, and view specific |
653 | 653 | $this->_add_global_screen_options(); |
654 | 654 | $this->_add_screen_options(); |
655 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
656 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
655 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
656 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
657 | 657 | |
658 | 658 | |
659 | 659 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -664,33 +664,33 @@ discard block |
||
664 | 664 | //add feature_pointers - global, page child class, and view specific |
665 | 665 | $this->_add_feature_pointers(); |
666 | 666 | $this->_add_global_feature_pointers(); |
667 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
668 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
667 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
668 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
669 | 669 | |
670 | 670 | //enqueue scripts/styles - global, page class, and view specific |
671 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
672 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
673 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
674 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
671 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
672 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
673 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
674 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
675 | 675 | |
676 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
677 | 677 | |
678 | 678 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
679 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
680 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
681 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
682 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
679 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
680 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
681 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
682 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
683 | 683 | |
684 | 684 | //admin footer scripts |
685 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
686 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
687 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
688 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
685 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
686 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
687 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
688 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
689 | 689 | |
690 | 690 | |
691 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
691 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
692 | 692 | //targeted hook |
693 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
693 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
694 | 694 | |
695 | 695 | } |
696 | 696 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | private function _set_defaults() { |
706 | 706 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
707 | 707 | |
708 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
708 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
709 | 709 | |
710 | 710 | $this->default_nav_tab_name = 'overview'; |
711 | 711 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | public function route_admin_request() { |
733 | 733 | try { |
734 | 734 | $this->_route_admin_request(); |
735 | - } catch ( EE_Error $e ) { |
|
735 | + } catch (EE_Error $e) { |
|
736 | 736 | $e->get_error(); |
737 | 737 | } |
738 | 738 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | $this->_wp_page_slug = $wp_page_slug; |
744 | 744 | |
745 | 745 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
746 | - if ( is_network_admin() ) { |
|
746 | + if (is_network_admin()) { |
|
747 | 747 | $this->_wp_page_slug .= '-network'; |
748 | 748 | } |
749 | 749 | } |
@@ -756,53 +756,53 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | protected function _verify_routes() { |
759 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
759 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
760 | 760 | |
761 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
761 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
762 | 762 | |
763 | 763 | $this->_route = FALSE; |
764 | 764 | $func = FALSE; |
765 | 765 | $args = array(); |
766 | 766 | |
767 | 767 | // check that the page_routes array is not empty |
768 | - if ( empty( $this->_page_routes )) { |
|
768 | + if (empty($this->_page_routes)) { |
|
769 | 769 | // user error msg |
770 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
770 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
771 | 771 | // developer error msg |
772 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
773 | - throw new EE_Error( $error_msg ); |
|
772 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
773 | + throw new EE_Error($error_msg); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | // and that the requested page route exists |
777 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
778 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
777 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
778 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
779 | 779 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
780 | 780 | } else { |
781 | 781 | // user error msg |
782 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
782 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
783 | 783 | // developer error msg |
784 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
785 | - throw new EE_Error( $error_msg ); |
|
784 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
785 | + throw new EE_Error($error_msg); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | // and that a default route exists |
789 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
789 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
790 | 790 | // user error msg |
791 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
791 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
792 | 792 | // developer error msg |
793 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
794 | - throw new EE_Error( $error_msg ); |
|
793 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
794 | + throw new EE_Error($error_msg); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
798 | 798 | //first lets' catch if the UI request has EVER been set. |
799 | - if ( $this->_is_UI_request === NULL ) { |
|
799 | + if ($this->_is_UI_request === NULL) { |
|
800 | 800 | //lets set if this is a UI request or not. |
801 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
801 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
802 | 802 | |
803 | 803 | |
804 | 804 | //wait a minute... we might have a noheader in the route array |
805 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
805 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | $this->_set_current_labels(); |
@@ -817,15 +817,15 @@ discard block |
||
817 | 817 | * @param string $route the route name we're verifying |
818 | 818 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
819 | 819 | */ |
820 | - protected function _verify_route( $route ) { |
|
821 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
820 | + protected function _verify_route($route) { |
|
821 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
822 | 822 | return true; |
823 | 823 | } else { |
824 | 824 | // user error msg |
825 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
825 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
826 | 826 | // developer error msg |
827 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
828 | - throw new EE_Error( $error_msg ); |
|
827 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
828 | + throw new EE_Error($error_msg); |
|
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
@@ -839,18 +839,18 @@ discard block |
||
839 | 839 | * @param string $nonce_ref The nonce reference string (name0) |
840 | 840 | * @return mixed (bool|die) |
841 | 841 | */ |
842 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
842 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
843 | 843 | // verify nonce against expected value |
844 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
844 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
845 | 845 | // these are not the droids you are looking for !!! |
846 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
847 | - if ( WP_DEBUG ) { |
|
848 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
846 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
847 | + if (WP_DEBUG) { |
|
848 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
849 | 849 | } |
850 | - if ( ! defined( 'DOING_AJAX' )) { |
|
851 | - wp_die( $msg ); |
|
850 | + if ( ! defined('DOING_AJAX')) { |
|
851 | + wp_die($msg); |
|
852 | 852 | } else { |
853 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
853 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
854 | 854 | $this->_return_json(); |
855 | 855 | } |
856 | 856 | } |
@@ -868,63 +868,63 @@ discard block |
||
868 | 868 | * @return void |
869 | 869 | */ |
870 | 870 | protected function _route_admin_request() { |
871 | - if ( ! $this->_is_UI_request ) |
|
871 | + if ( ! $this->_is_UI_request) |
|
872 | 872 | $this->_verify_routes(); |
873 | 873 | |
874 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
874 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
875 | 875 | |
876 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
876 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
877 | 877 | // set nonce from post data |
878 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
879 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
878 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
879 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
880 | 880 | } |
881 | 881 | //set the nav_tabs array but ONLY if this is UI_request |
882 | - if ( $this->_is_UI_request ) |
|
882 | + if ($this->_is_UI_request) |
|
883 | 883 | $this->_set_nav_tabs(); |
884 | 884 | |
885 | 885 | // grab callback function |
886 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
886 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
887 | 887 | |
888 | 888 | // check if callback has args |
889 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
889 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
890 | 890 | |
891 | 891 | $error_msg = ''; |
892 | 892 | |
893 | 893 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
894 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
895 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
894 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
895 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
899 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
899 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
900 | 900 | |
901 | - if ( ! empty( $func )) { |
|
901 | + if ( ! empty($func)) { |
|
902 | 902 | $base_call = $addon_call = FALSE; |
903 | 903 | //try to access page route via this class |
904 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
904 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
905 | 905 | // user error msg |
906 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
906 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
907 | 907 | // developer error msg |
908 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
908 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
912 | 912 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
913 | 913 | |
914 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
915 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
916 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
914 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
915 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
916 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
917 | 917 | } |
918 | 918 | |
919 | 919 | |
920 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
921 | - throw new EE_Error( $error_msg ); |
|
920 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
921 | + throw new EE_Error($error_msg); |
|
922 | 922 | } |
923 | 923 | |
924 | 924 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
925 | 925 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
926 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
927 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
926 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
927 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | * @param string $new_route New (non header) route to redirect to. |
941 | 941 | * @return void |
942 | 942 | */ |
943 | - protected function _reset_routing_properties( $new_route ) { |
|
943 | + protected function _reset_routing_properties($new_route) { |
|
944 | 944 | $this->_is_UI_request = TRUE; |
945 | 945 | //now we set the current route to whatever the headers_sent_route is set at |
946 | 946 | $this->_req_data['action'] = $new_route; |
@@ -986,23 +986,23 @@ discard block |
||
986 | 986 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
987 | 987 | * @return string |
988 | 988 | */ |
989 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
989 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
990 | 990 | |
991 | 991 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
992 | - if ( $sticky ) { |
|
992 | + if ($sticky) { |
|
993 | 993 | $request = $_REQUEST; |
994 | - unset( $request['_wp_http_referer'] ); |
|
995 | - unset( $request['wp_referer'] ); |
|
996 | - foreach ( $request as $key => $value ) { |
|
994 | + unset($request['_wp_http_referer']); |
|
995 | + unset($request['wp_referer']); |
|
996 | + foreach ($request as $key => $value) { |
|
997 | 997 | //do not add nonces |
998 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
998 | + if (strpos($key, 'nonce') !== false) { |
|
999 | 999 | continue; |
1000 | 1000 | } |
1001 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1001 | + $args['wp_referer['.$key.']'] = $value; |
|
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | |
1005 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1005 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | |
@@ -1018,8 +1018,8 @@ discard block |
||
1018 | 1018 | * @uses EEH_Template::get_help_tab_link() |
1019 | 1019 | * @return string generated link |
1020 | 1020 | */ |
1021 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1022 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1021 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1022 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | |
@@ -1036,30 +1036,30 @@ discard block |
||
1036 | 1036 | */ |
1037 | 1037 | protected function _add_help_tabs() { |
1038 | 1038 | $tour_buttons = ''; |
1039 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1039 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1040 | 1040 | $config = $this->_page_config[$this->_req_action]; |
1041 | 1041 | |
1042 | 1042 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1043 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1043 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1044 | 1044 | $tb = array(); |
1045 | 1045 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1046 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1046 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1047 | 1047 | //if this is the end tour then we don't need to setup a button |
1048 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1048 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1049 | 1049 | continue; |
1050 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1050 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1051 | 1051 | } |
1052 | 1052 | $tour_buttons .= implode('<br />', $tb); |
1053 | 1053 | $tour_buttons .= '</div></div>'; |
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1057 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1057 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1058 | 1058 | //check that the callback given is valid |
1059 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1060 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1059 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1060 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1061 | 1061 | |
1062 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1062 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1063 | 1063 | |
1064 | 1064 | $content .= $tour_buttons; //add help tour buttons. |
1065 | 1065 | |
@@ -1068,49 +1068,49 @@ discard block |
||
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1071 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1071 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1072 | 1072 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1076 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1076 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1077 | 1077 | $_ht['id'] = $this->page_slug; |
1078 | 1078 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1079 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1079 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1080 | 1080 | $this->_current_screen->add_help_tab($_ht); |
1081 | 1081 | }/**/ |
1082 | 1082 | |
1083 | 1083 | |
1084 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1084 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1085 | 1085 | |
1086 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1086 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1087 | 1087 | //we're here so there ARE help tabs! |
1088 | 1088 | |
1089 | 1089 | //make sure we've got what we need |
1090 | - if ( !isset( $cfg['title'] ) ) |
|
1091 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1090 | + if ( ! isset($cfg['title'])) |
|
1091 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1092 | 1092 | |
1093 | 1093 | |
1094 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | //first priority goes to content. |
1100 | - if ( !empty($cfg['content'] ) ) { |
|
1101 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1100 | + if ( ! empty($cfg['content'])) { |
|
1101 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1102 | 1102 | |
1103 | 1103 | //second priority goes to filename |
1104 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1105 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1104 | + } else if ( ! empty($cfg['filename'])) { |
|
1105 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1106 | 1106 | |
1107 | 1107 | |
1108 | 1108 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1109 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1109 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1110 | 1110 | |
1111 | 1111 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1112 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1113 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1112 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1113 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1114 | 1114 | return; |
1115 | 1115 | } |
1116 | 1116 | $template_args['admin_page_obj'] = $this; |
@@ -1121,21 +1121,21 @@ discard block |
||
1121 | 1121 | |
1122 | 1122 | |
1123 | 1123 | //check if callback is valid |
1124 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1125 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1124 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1125 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1126 | 1126 | return; |
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | //setup config array for help tab method |
1130 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1130 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1131 | 1131 | $_ht = array( |
1132 | 1132 | 'id' => $id, |
1133 | 1133 | 'title' => $cfg['title'], |
1134 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1134 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1135 | 1135 | 'content' => $content |
1136 | 1136 | ); |
1137 | 1137 | |
1138 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1138 | + $this->_current_screen->add_help_tab($_ht); |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | } |
@@ -1155,49 +1155,49 @@ discard block |
||
1155 | 1155 | $this->_help_tour = array(); |
1156 | 1156 | |
1157 | 1157 | //exit early if help tours are turned off globally |
1158 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1158 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1159 | 1159 | return; |
1160 | 1160 | |
1161 | 1161 | //loop through _page_config to find any help_tour defined |
1162 | - foreach ( $this->_page_config as $route => $config ) { |
|
1162 | + foreach ($this->_page_config as $route => $config) { |
|
1163 | 1163 | //we're only going to set things up for this route |
1164 | - if ( $route !== $this->_req_action ) |
|
1164 | + if ($route !== $this->_req_action) |
|
1165 | 1165 | continue; |
1166 | 1166 | |
1167 | - if ( isset( $config['help_tour'] ) ) { |
|
1167 | + if (isset($config['help_tour'])) { |
|
1168 | 1168 | |
1169 | - foreach( $config['help_tour'] as $tour ) { |
|
1170 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1169 | + foreach ($config['help_tour'] as $tour) { |
|
1170 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1171 | 1171 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1172 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1172 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1173 | 1173 | |
1174 | 1174 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1175 | - if ( !is_readable($file_path) ) { |
|
1176 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1175 | + if ( ! is_readable($file_path)) { |
|
1176 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1177 | 1177 | return; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | require_once $file_path; |
1181 | - if ( !class_exists( $tour ) ) { |
|
1182 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1183 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1184 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1181 | + if ( ! class_exists($tour)) { |
|
1182 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1183 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1184 | + throw new EE_Error(implode('||', $error_msg)); |
|
1185 | 1185 | } |
1186 | 1186 | $a = new ReflectionClass($tour); |
1187 | 1187 | $tour_obj = $a->newInstance($this->_is_caf); |
1188 | 1188 | |
1189 | 1189 | $tours[] = $tour_obj; |
1190 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1190 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1191 | 1191 | } |
1192 | 1192 | |
1193 | 1193 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1194 | 1194 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1195 | 1195 | $tours[] = $end_stop_tour; |
1196 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1196 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
1200 | - if ( !empty( $tours ) ) |
|
1200 | + if ( ! empty($tours)) |
|
1201 | 1201 | $this->_help_tour['tours'] = $tours; |
1202 | 1202 | |
1203 | 1203 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1213,12 +1213,12 @@ discard block |
||
1213 | 1213 | * @return void |
1214 | 1214 | */ |
1215 | 1215 | protected function _add_qtips() { |
1216 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1216 | + if (isset($this->_route_config['qtips'])) { |
|
1217 | 1217 | $qtips = (array) $this->_route_config['qtips']; |
1218 | 1218 | //load qtip loader |
1219 | 1219 | $path = array( |
1220 | - $this->_get_dir() . '/qtips/', |
|
1221 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1220 | + $this->_get_dir().'/qtips/', |
|
1221 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1222 | 1222 | ); |
1223 | 1223 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1224 | 1224 | } |
@@ -1235,41 +1235,41 @@ discard block |
||
1235 | 1235 | * @return void |
1236 | 1236 | */ |
1237 | 1237 | protected function _set_nav_tabs() { |
1238 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1238 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1239 | 1239 | $i = 0; |
1240 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1241 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1240 | + foreach ($this->_page_config as $slug => $config) { |
|
1241 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1242 | 1242 | continue; //no nav tab for this config |
1243 | 1243 | |
1244 | 1244 | //check for persistent flag |
1245 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1245 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1246 | 1246 | continue; //nav tab is only to appear when route requested. |
1247 | 1247 | |
1248 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1248 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1249 | 1249 | continue; //no nav tab becasue current user does not have access. |
1250 | 1250 | |
1251 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1251 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1252 | 1252 | $this->_nav_tabs[$slug] = array( |
1253 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1254 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1255 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1256 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1253 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1254 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1255 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1256 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1257 | 1257 | ); |
1258 | 1258 | $i++; |
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | //if $this->_nav_tabs is empty then lets set the default |
1262 | - if ( empty( $this->_nav_tabs ) ) { |
|
1262 | + if (empty($this->_nav_tabs)) { |
|
1263 | 1263 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1264 | 1264 | 'url' => $this->admin_base_url, |
1265 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1265 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1266 | 1266 | 'css_class' => 'nav-tab-active', |
1267 | 1267 | 'order' => 10 |
1268 | 1268 | ); |
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | //now let's sort the tabs according to order |
1272 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1272 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1273 | 1273 | |
1274 | 1274 | } |
1275 | 1275 | |
@@ -1285,10 +1285,10 @@ discard block |
||
1285 | 1285 | * @return void |
1286 | 1286 | */ |
1287 | 1287 | private function _set_current_labels() { |
1288 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1289 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1290 | - if ( is_array($text) ) { |
|
1291 | - foreach ( $text as $sublabel => $subtext ) { |
|
1288 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1289 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1290 | + if (is_array($text)) { |
|
1291 | + foreach ($text as $sublabel => $subtext) { |
|
1292 | 1292 | $this->_labels[$label][$sublabel] = $subtext; |
1293 | 1293 | } |
1294 | 1294 | } else { |
@@ -1309,24 +1309,24 @@ discard block |
||
1309 | 1309 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1310 | 1310 | * @return BOOL|wp_die() |
1311 | 1311 | */ |
1312 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1313 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1314 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1315 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1312 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1313 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1314 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1315 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1316 | 1316 | |
1317 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1318 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1317 | + if (empty($capability) && empty($route_to_check)) { |
|
1318 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1319 | 1319 | } else { |
1320 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1320 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1323 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1324 | 1324 | |
1325 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1326 | - if ( $verify_only ) { |
|
1325 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1326 | + if ($verify_only) { |
|
1327 | 1327 | return FALSE; |
1328 | 1328 | } else { |
1329 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1329 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | return TRUE; |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | $this->_add_admin_page_overlay(); |
1404 | 1404 | |
1405 | 1405 | //if metaboxes are present we need to add the nonce field |
1406 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1406 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1407 | 1407 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1408 | 1408 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1409 | 1409 | } |
@@ -1422,19 +1422,19 @@ discard block |
||
1422 | 1422 | */ |
1423 | 1423 | public function admin_footer_global() { |
1424 | 1424 | //dialog container for dialog helper |
1425 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1425 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1426 | 1426 | $d_cont .= '<div class="ee-notices"></div>'; |
1427 | 1427 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1428 | 1428 | $d_cont .= '</div>'; |
1429 | 1429 | echo $d_cont; |
1430 | 1430 | |
1431 | 1431 | //help tour stuff? |
1432 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1432 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1433 | 1433 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1434 | 1434 | } |
1435 | 1435 | |
1436 | 1436 | //current set timezone for timezone js |
1437 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1437 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | |
@@ -1458,18 +1458,18 @@ discard block |
||
1458 | 1458 | * @access protected |
1459 | 1459 | * @return string content |
1460 | 1460 | */ |
1461 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1461 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1462 | 1462 | $content = ''; |
1463 | 1463 | |
1464 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1465 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1464 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1465 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1466 | 1466 | |
1467 | 1467 | |
1468 | 1468 | //loop through the array and setup content |
1469 | - foreach ( $help_array as $trigger => $help ) { |
|
1469 | + foreach ($help_array as $trigger => $help) { |
|
1470 | 1470 | //make sure the array is setup properly |
1471 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1472 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1471 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1472 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1473 | 1473 | } |
1474 | 1474 | |
1475 | 1475 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1479,10 +1479,10 @@ discard block |
||
1479 | 1479 | 'help_popup_content' => $help['content'] |
1480 | 1480 | ); |
1481 | 1481 | |
1482 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1482 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | - if ( $display ) |
|
1485 | + if ($display) |
|
1486 | 1486 | echo $content; |
1487 | 1487 | else |
1488 | 1488 | return $content; |
@@ -1499,18 +1499,18 @@ discard block |
||
1499 | 1499 | */ |
1500 | 1500 | private function _get_help_content() { |
1501 | 1501 | //what is the method we're looking for? |
1502 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1502 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1503 | 1503 | |
1504 | 1504 | //if method doesn't exist let's get out. |
1505 | - if ( !method_exists( $this, $method_name ) ) |
|
1505 | + if ( ! method_exists($this, $method_name)) |
|
1506 | 1506 | return array(); |
1507 | 1507 | |
1508 | 1508 | //k we're good to go let's retrieve the help array |
1509 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1509 | + $help_array = call_user_func(array($this, $method_name)); |
|
1510 | 1510 | |
1511 | 1511 | //make sure we've got an array! |
1512 | - if ( !is_array($help_array) ) { |
|
1513 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1512 | + if ( ! is_array($help_array)) { |
|
1513 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | return $help_array; |
@@ -1532,27 +1532,27 @@ discard block |
||
1532 | 1532 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1533 | 1533 | * @return string |
1534 | 1534 | */ |
1535 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1535 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1536 | 1536 | |
1537 | - if ( defined('DOING_AJAX') ) return; |
|
1537 | + if (defined('DOING_AJAX')) return; |
|
1538 | 1538 | |
1539 | 1539 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1540 | 1540 | $help_array = $this->_get_help_content(); |
1541 | 1541 | $help_content = ''; |
1542 | 1542 | |
1543 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1543 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1544 | 1544 | $help_array[$trigger_id] = array( |
1545 | 1545 | 'title' => __('Missing Content', 'event_espresso'), |
1546 | 1546 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1547 | 1547 | ); |
1548 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1548 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1549 | 1549 | } |
1550 | 1550 | |
1551 | 1551 | //let's setup the trigger |
1552 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1553 | - $content = $content . $help_content; |
|
1552 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1553 | + $content = $content.$help_content; |
|
1554 | 1554 | |
1555 | - if ( $display ) |
|
1555 | + if ($display) |
|
1556 | 1556 | echo $content; |
1557 | 1557 | else |
1558 | 1558 | return $content; |
@@ -1609,15 +1609,15 @@ discard block |
||
1609 | 1609 | public function load_global_scripts_styles() { |
1610 | 1610 | /** STYLES **/ |
1611 | 1611 | // add debugging styles |
1612 | - if ( WP_DEBUG ) { |
|
1613 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1612 | + if (WP_DEBUG) { |
|
1613 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1614 | 1614 | } |
1615 | 1615 | |
1616 | 1616 | //register all styles |
1617 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1618 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1617 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1618 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1619 | 1619 | //helpers styles |
1620 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1620 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | 1621 | //enqueue global styles |
1622 | 1622 | wp_enqueue_style('ee-admin-css'); |
1623 | 1623 | |
@@ -1625,66 +1625,66 @@ discard block |
||
1625 | 1625 | /** SCRIPTS **/ |
1626 | 1626 | |
1627 | 1627 | //register all scripts |
1628 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1629 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1630 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1628 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1629 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1630 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1631 | 1631 | |
1632 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1632 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1633 | 1633 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1634 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1634 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1635 | 1635 | add_filter('FHEE_load_joyride', '__return_true'); |
1636 | 1636 | |
1637 | 1637 | //script for sorting tables |
1638 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1638 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1639 | 1639 | //script for parsing uri's |
1640 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1640 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1641 | 1641 | //and parsing associative serialized form elements |
1642 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1642 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //helpers scripts |
1644 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1645 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1647 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1646 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1648 | 1648 | |
1649 | 1649 | //google charts |
1650 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1650 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1651 | 1651 | |
1652 | 1652 | //enqueue global scripts |
1653 | 1653 | |
1654 | 1654 | //taking care of metaboxes |
1655 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1655 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1656 | 1656 | wp_enqueue_script('dashboard'); |
1657 | 1657 | } |
1658 | 1658 | |
1659 | 1659 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1660 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1660 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1661 | 1661 | wp_enqueue_script('ee_admin_js'); |
1662 | 1662 | wp_enqueue_style('ee-admin-css'); |
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | |
1666 | 1666 | //localize script for ajax lazy loading |
1667 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1668 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1667 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1668 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1669 | 1669 | |
1670 | 1670 | |
1671 | 1671 | /** |
1672 | 1672 | * help tour stuff |
1673 | 1673 | */ |
1674 | - if ( !empty( $this->_help_tour ) ) { |
|
1674 | + if ( ! empty($this->_help_tour)) { |
|
1675 | 1675 | |
1676 | 1676 | //register the js for kicking things off |
1677 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1677 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1678 | 1678 | |
1679 | 1679 | //setup tours for the js tour object |
1680 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1680 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1681 | 1681 | $tours[] = array( |
1682 | 1682 | 'id' => $tour->get_slug(), |
1683 | 1683 | 'options' => $tour->get_options() |
1684 | 1684 | ); |
1685 | 1685 | } |
1686 | 1686 | |
1687 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1687 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1688 | 1688 | |
1689 | 1689 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1690 | 1690 | } |
@@ -1702,52 +1702,52 @@ discard block |
||
1702 | 1702 | public function admin_footer_scripts_eei18n_js_strings() { |
1703 | 1703 | |
1704 | 1704 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1705 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1706 | - |
|
1707 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1708 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1709 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1710 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1711 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1731 | - |
|
1732 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1736 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1705 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1706 | + |
|
1707 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1708 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1709 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1710 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1711 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1731 | + |
|
1732 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1736 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1746 | 1746 | |
1747 | 1747 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1748 | 1748 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1749 | 1749 | //espresso_core is listed as a dependency of ee_admin_js. |
1750 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1750 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1751 | 1751 | |
1752 | 1752 | } |
1753 | 1753 | |
@@ -1781,23 +1781,23 @@ discard block |
||
1781 | 1781 | protected function _set_list_table() { |
1782 | 1782 | |
1783 | 1783 | //first is this a list_table view? |
1784 | - if ( !isset($this->_route_config['list_table']) ) |
|
1784 | + if ( ! isset($this->_route_config['list_table'])) |
|
1785 | 1785 | return; //not a list_table view so get out. |
1786 | 1786 | |
1787 | 1787 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1788 | 1788 | |
1789 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1789 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1790 | 1790 | //user error msg |
1791 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1791 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1792 | 1792 | //developer error msg |
1793 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1794 | - throw new EE_Error( $error_msg ); |
|
1793 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1794 | + throw new EE_Error($error_msg); |
|
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1798 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1799 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1800 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1798 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1799 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1800 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1801 | 1801 | |
1802 | 1802 | $this->_set_list_table_view(); |
1803 | 1803 | $this->_set_list_table_object(); |
@@ -1819,14 +1819,14 @@ discard block |
||
1819 | 1819 | * @return array |
1820 | 1820 | */ |
1821 | 1821 | protected function _set_list_table_view() { |
1822 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1822 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1823 | 1823 | |
1824 | 1824 | |
1825 | 1825 | // looking at active items or dumpster diving ? |
1826 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1827 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1826 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1827 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1828 | 1828 | } else { |
1829 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1829 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1830 | 1830 | } |
1831 | 1831 | } |
1832 | 1832 | |
@@ -1837,9 +1837,9 @@ discard block |
||
1837 | 1837 | * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of. |
1838 | 1838 | */ |
1839 | 1839 | protected function _set_list_table_object() { |
1840 | - if ( isset($this->_route_config['list_table'] ) ) { |
|
1841 | - if ( !class_exists( $this->_route_config['list_table'] ) ) |
|
1842 | - throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) ); |
|
1840 | + if (isset($this->_route_config['list_table'])) { |
|
1841 | + if ( ! class_exists($this->_route_config['list_table'])) |
|
1842 | + throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this))); |
|
1843 | 1843 | $a = new ReflectionClass($this->_route_config['list_table']); |
1844 | 1844 | $this->_list_table_object = $a->newInstance($this); |
1845 | 1845 | } |
@@ -1858,27 +1858,27 @@ discard block |
||
1858 | 1858 | * |
1859 | 1859 | * @return array |
1860 | 1860 | */ |
1861 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1861 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1862 | 1862 | |
1863 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1863 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1864 | 1864 | |
1865 | - if ( empty( $this->_views )) { |
|
1865 | + if (empty($this->_views)) { |
|
1866 | 1866 | $this->_views = array(); |
1867 | 1867 | } |
1868 | 1868 | |
1869 | 1869 | // cycle thru views |
1870 | - foreach ( $this->_views as $key => $view ) { |
|
1870 | + foreach ($this->_views as $key => $view) { |
|
1871 | 1871 | $query_args = array(); |
1872 | 1872 | // check for current view |
1873 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1873 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1874 | 1874 | $query_args['action'] = $this->_req_action; |
1875 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1875 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1876 | 1876 | $query_args['status'] = $view['slug']; |
1877 | 1877 | //merge any other arguments sent in. |
1878 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1879 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1878 | + if (isset($extra_query_args[$view['slug']])) { |
|
1879 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1880 | 1880 | } |
1881 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1881 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1882 | 1882 | } |
1883 | 1883 | |
1884 | 1884 | return $this->_views; |
@@ -1895,15 +1895,15 @@ discard block |
||
1895 | 1895 | * @param int $max_entries total number of rows in the table |
1896 | 1896 | * @return string |
1897 | 1897 | */ |
1898 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1898 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1899 | 1899 | |
1900 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1901 | - $values = array( 10, 25, 50, 100 ); |
|
1902 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1900 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1901 | + $values = array(10, 25, 50, 100); |
|
1902 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1903 | 1903 | |
1904 | - if ( $max_entries ) { |
|
1904 | + if ($max_entries) { |
|
1905 | 1905 | $values[] = $max_entries; |
1906 | - sort( $values ); |
|
1906 | + sort($values); |
|
1907 | 1907 | } |
1908 | 1908 | |
1909 | 1909 | $entries_per_page_dropdown = ' |
@@ -1912,15 +1912,15 @@ discard block |
||
1912 | 1912 | Show |
1913 | 1913 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1914 | 1914 | |
1915 | - foreach ( $values as $value ) { |
|
1916 | - if ( $value < $max_entries ) { |
|
1917 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1915 | + foreach ($values as $value) { |
|
1916 | + if ($value < $max_entries) { |
|
1917 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1918 | 1918 | $entries_per_page_dropdown .= ' |
1919 | 1919 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1920 | 1920 | } |
1921 | 1921 | } |
1922 | 1922 | |
1923 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1923 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1924 | 1924 | $entries_per_page_dropdown .= ' |
1925 | 1925 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1926 | 1926 | |
@@ -1943,8 +1943,8 @@ discard block |
||
1943 | 1943 | * @return void |
1944 | 1944 | */ |
1945 | 1945 | public function _set_search_attributes() { |
1946 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1947 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1946 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1947 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1948 | 1948 | } |
1949 | 1949 | |
1950 | 1950 | /*** END LIST TABLE METHODS **/ |
@@ -1963,10 +1963,10 @@ discard block |
||
1963 | 1963 | * @return void |
1964 | 1964 | */ |
1965 | 1965 | private function _add_registered_meta_boxes() { |
1966 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1966 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1967 | 1967 | |
1968 | 1968 | //we only add meta boxes if the page_route calls for it |
1969 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1969 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1970 | 1970 | && is_array( |
1971 | 1971 | $this->_route_config['metaboxes'] |
1972 | 1972 | ) |
@@ -1974,27 +1974,27 @@ discard block |
||
1974 | 1974 | // this simply loops through the callbacks provided |
1975 | 1975 | // and checks if there is a corresponding callback registered by the child |
1976 | 1976 | // if there is then we go ahead and process the metabox loader. |
1977 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1977 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1978 | 1978 | // first check for Closures |
1979 | - if ( is_callable( $metabox_callback ) ) { |
|
1979 | + if (is_callable($metabox_callback)) { |
|
1980 | 1980 | $result = $metabox_callback(); |
1981 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1982 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1981 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1982 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1983 | 1983 | } else { |
1984 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
1984 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
1985 | 1985 | } |
1986 | - if ( $result === FALSE ) { |
|
1986 | + if ($result === FALSE) { |
|
1987 | 1987 | // user error msg |
1988 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
1988 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
1989 | 1989 | // developer error msg |
1990 | - $error_msg .= '||' . sprintf( |
|
1990 | + $error_msg .= '||'.sprintf( |
|
1991 | 1991 | __( |
1992 | 1992 | 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', |
1993 | 1993 | 'event_espresso' |
1994 | 1994 | ), |
1995 | 1995 | $metabox_callback |
1996 | 1996 | ); |
1997 | - throw new EE_Error( $error_msg ); |
|
1997 | + throw new EE_Error($error_msg); |
|
1998 | 1998 | } |
1999 | 1999 | } |
2000 | 2000 | } |
@@ -2011,17 +2011,17 @@ discard block |
||
2011 | 2011 | * @return void |
2012 | 2012 | */ |
2013 | 2013 | private function _add_screen_columns() { |
2014 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
2014 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
2015 | 2015 | |
2016 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2016 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2017 | 2017 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2018 | 2018 | $screen_id = $this->_current_screen->id; |
2019 | 2019 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2020 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2021 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2020 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2021 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2022 | 2022 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2023 | 2023 | $this->_template_args['screen'] = $this->_current_screen; |
2024 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2024 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2025 | 2025 | |
2026 | 2026 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2027 | 2027 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2038,11 +2038,11 @@ discard block |
||
2038 | 2038 | */ |
2039 | 2039 | |
2040 | 2040 | private function _espresso_news_post_box() { |
2041 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2042 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2041 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2042 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2043 | 2043 | $this, |
2044 | 2044 | 'espresso_news_post_box' |
2045 | - ), $this->_wp_page_slug, 'side' ); |
|
2045 | + ), $this->_wp_page_slug, 'side'); |
|
2046 | 2046 | } |
2047 | 2047 | |
2048 | 2048 | |
@@ -2050,14 +2050,14 @@ discard block |
||
2050 | 2050 | * Code for setting up espresso ratings request metabox. |
2051 | 2051 | */ |
2052 | 2052 | protected function _espresso_ratings_request() { |
2053 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2053 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2054 | 2054 | return ''; |
2055 | 2055 | } |
2056 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2057 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2056 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2057 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2058 | 2058 | $this, |
2059 | 2059 | 'espresso_ratings_request' |
2060 | - ), $this->_wp_page_slug, 'side' ); |
|
2060 | + ), $this->_wp_page_slug, 'side'); |
|
2061 | 2061 | } |
2062 | 2062 | |
2063 | 2063 | |
@@ -2065,34 +2065,34 @@ discard block |
||
2065 | 2065 | * Code for setting up espresso ratings request metabox content. |
2066 | 2066 | */ |
2067 | 2067 | public function espresso_ratings_request() { |
2068 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2069 | - EEH_Template::display_template( $template_path, array() ); |
|
2068 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2069 | + EEH_Template::display_template($template_path, array()); |
|
2070 | 2070 | } |
2071 | 2071 | |
2072 | 2072 | |
2073 | 2073 | |
2074 | 2074 | |
2075 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2076 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2077 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2078 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2079 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2080 | - $post = '</div>' . "\n"; |
|
2075 | + public static function cached_rss_display($rss_id, $url) { |
|
2076 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2077 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2078 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2079 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2080 | + $post = '</div>'."\n"; |
|
2081 | 2081 | |
2082 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2083 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2084 | - echo $pre . $output . $post; |
|
2082 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2083 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2084 | + echo $pre.$output.$post; |
|
2085 | 2085 | return TRUE; |
2086 | 2086 | } |
2087 | 2087 | |
2088 | - if ( ! $doing_ajax ) { |
|
2089 | - echo $pre . $loading . $post; |
|
2088 | + if ( ! $doing_ajax) { |
|
2089 | + echo $pre.$loading.$post; |
|
2090 | 2090 | return FALSE; |
2091 | 2091 | } |
2092 | 2092 | |
2093 | 2093 | ob_start(); |
2094 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2095 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2094 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2095 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2096 | 2096 | return TRUE; |
2097 | 2097 | |
2098 | 2098 | } |
@@ -2104,13 +2104,13 @@ discard block |
||
2104 | 2104 | <div id="espresso_news_post_box_content" class="infolinks"> |
2105 | 2105 | <?php |
2106 | 2106 | // Get RSS Feed(s) |
2107 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2107 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2108 | 2108 | $url = urlencode($feed_url); |
2109 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2109 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2110 | 2110 | |
2111 | 2111 | ?> |
2112 | 2112 | </div> |
2113 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2113 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2114 | 2114 | </div> |
2115 | 2115 | <?php |
2116 | 2116 | } |
@@ -2131,32 +2131,32 @@ discard block |
||
2131 | 2131 | |
2132 | 2132 | protected function _espresso_sponsors_post_box() { |
2133 | 2133 | |
2134 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2135 | - if ( $show_sponsors ) |
|
2136 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2134 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2135 | + if ($show_sponsors) |
|
2136 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2137 | 2137 | } |
2138 | 2138 | |
2139 | 2139 | |
2140 | 2140 | public function espresso_sponsors_post_box() { |
2141 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2142 | - EEH_Template::display_template( $templatepath ); |
|
2141 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2142 | + EEH_Template::display_template($templatepath); |
|
2143 | 2143 | } |
2144 | 2144 | |
2145 | 2145 | |
2146 | 2146 | |
2147 | 2147 | private function _publish_post_box() { |
2148 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2148 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2149 | 2149 | |
2150 | 2150 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2151 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2152 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2151 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2152 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2153 | 2153 | } else { |
2154 | 2154 | $box_label = __('Publish', 'event_espresso'); |
2155 | 2155 | } |
2156 | 2156 | |
2157 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2157 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2158 | 2158 | |
2159 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2159 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2160 | 2160 | |
2161 | 2161 | } |
2162 | 2162 | |
@@ -2164,9 +2164,9 @@ discard block |
||
2164 | 2164 | |
2165 | 2165 | public function editor_overview() { |
2166 | 2166 | //if we have extra content set let's add it in if not make sure its empty |
2167 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2168 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2169 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2167 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2168 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2169 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2170 | 2170 | } |
2171 | 2171 | |
2172 | 2172 | |
@@ -2182,8 +2182,8 @@ discard block |
||
2182 | 2182 | * @see $this->_set_publish_post_box_vars for param details |
2183 | 2183 | * @since 4.6.0 |
2184 | 2184 | */ |
2185 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2186 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2185 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2186 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2187 | 2187 | } |
2188 | 2188 | |
2189 | 2189 | |
@@ -2202,24 +2202,24 @@ discard block |
||
2202 | 2202 | * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
2203 | 2203 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2204 | 2204 | */ |
2205 | - protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
|
2205 | + protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) { |
|
2206 | 2206 | |
2207 | 2207 | // if Save & Close, use a custom redirect URL or default to the main page? |
2208 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2208 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2209 | 2209 | // create the Save & Close and Save buttons |
2210 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2210 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2211 | 2211 | //if we have extra content set let's add it in if not make sure its empty |
2212 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2212 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2213 | 2213 | |
2214 | 2214 | |
2215 | - if ( $delete && ! empty( $id ) ) { |
|
2215 | + if ($delete && ! empty($id)) { |
|
2216 | 2216 | $delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent. |
2217 | - $delete_link_args = array( $name => $id ); |
|
2218 | - $delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2217 | + $delete_link_args = array($name => $id); |
|
2218 | + $delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2219 | 2219 | } |
2220 | 2220 | |
2221 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2222 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2221 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2222 | + if ( ! empty($name) && ! empty($id)) { |
|
2223 | 2223 | $hidden_field_arr[$name] = array( |
2224 | 2224 | 'type' => 'hidden', |
2225 | 2225 | 'value' => $id |
@@ -2229,7 +2229,7 @@ discard block |
||
2229 | 2229 | $hf = ''; |
2230 | 2230 | } |
2231 | 2231 | // add hidden field |
2232 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2232 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2233 | 2233 | |
2234 | 2234 | } |
2235 | 2235 | |
@@ -2246,8 +2246,8 @@ discard block |
||
2246 | 2246 | <noscript> |
2247 | 2247 | <div id="no-js-message" class="error"> |
2248 | 2248 | <p style="font-size:1.3em;"> |
2249 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2250 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2249 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2250 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2251 | 2251 | </p> |
2252 | 2252 | </div> |
2253 | 2253 | </noscript> |
@@ -2267,7 +2267,7 @@ discard block |
||
2267 | 2267 | * @return string |
2268 | 2268 | */ |
2269 | 2269 | private function _display_espresso_notices() { |
2270 | - $notices = $this->_get_transient( TRUE ); |
|
2270 | + $notices = $this->_get_transient(TRUE); |
|
2271 | 2271 | echo stripslashes($notices); |
2272 | 2272 | } |
2273 | 2273 | |
@@ -2319,11 +2319,11 @@ discard block |
||
2319 | 2319 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2320 | 2320 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2321 | 2321 | */ |
2322 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2323 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2322 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2323 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2324 | 2324 | |
2325 | 2325 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2326 | - if ( empty( $callback_args ) && $create_func ) { |
|
2326 | + if (empty($callback_args) && $create_func) { |
|
2327 | 2327 | $callback_args = array( |
2328 | 2328 | 'template_path' => $this->_template_path, |
2329 | 2329 | 'template_args' => $this->_template_args, |
@@ -2333,7 +2333,7 @@ discard block |
||
2333 | 2333 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2334 | 2334 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2335 | 2335 | |
2336 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2336 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2337 | 2337 | } |
2338 | 2338 | |
2339 | 2339 | |
@@ -2346,7 +2346,7 @@ discard block |
||
2346 | 2346 | */ |
2347 | 2347 | public function display_admin_page_with_metabox_columns() { |
2348 | 2348 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2349 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2349 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2350 | 2350 | |
2351 | 2351 | //the final wrapper |
2352 | 2352 | $this->admin_page_wrapper(); |
@@ -2389,7 +2389,7 @@ discard block |
||
2389 | 2389 | * @return void |
2390 | 2390 | */ |
2391 | 2391 | public function display_about_admin_page() { |
2392 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2392 | + $this->_display_admin_page(FALSE, TRUE); |
|
2393 | 2393 | } |
2394 | 2394 | |
2395 | 2395 | |
@@ -2405,26 +2405,26 @@ discard block |
||
2405 | 2405 | * @return html admin_page |
2406 | 2406 | */ |
2407 | 2407 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2408 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2408 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2409 | 2409 | |
2410 | 2410 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2411 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2411 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2412 | 2412 | |
2413 | 2413 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2414 | 2414 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2415 | 2415 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2416 | 2416 | |
2417 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2417 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2418 | 2418 | |
2419 | - if ( defined('DOING_AJAX' ) ) |
|
2420 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2419 | + if (defined('DOING_AJAX')) |
|
2420 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2421 | 2421 | |
2422 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2422 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2423 | 2423 | |
2424 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2424 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2425 | 2425 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2426 | 2426 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2427 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2427 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2428 | 2428 | |
2429 | 2429 | |
2430 | 2430 | // the final template wrapper |
@@ -2444,7 +2444,7 @@ discard block |
||
2444 | 2444 | * @param bool $display_sidebar whether to use the sidebar template or the full template for the page. TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar. |
2445 | 2445 | * @return void |
2446 | 2446 | */ |
2447 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2447 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2448 | 2448 | //let's generate a default preview action button if there isn't one already present. |
2449 | 2449 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2450 | 2450 | $buy_now_url = add_query_arg( |
@@ -2457,10 +2457,10 @@ discard block |
||
2457 | 2457 | ), |
2458 | 2458 | 'http://eventespresso.com/pricing/' |
2459 | 2459 | ); |
2460 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button']; |
|
2461 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2462 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2463 | - $this->_display_admin_page( $display_sidebar ); |
|
2460 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button']; |
|
2461 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2462 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2463 | + $this->_display_admin_page($display_sidebar); |
|
2464 | 2464 | } |
2465 | 2465 | |
2466 | 2466 | |
@@ -2494,41 +2494,41 @@ discard block |
||
2494 | 2494 | * @param boolean $sidebar whether to display with sidebar or not. |
2495 | 2495 | * @return html |
2496 | 2496 | */ |
2497 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2497 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2498 | 2498 | //setup search attributes |
2499 | 2499 | $this->_set_search_attributes(); |
2500 | 2500 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2501 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2501 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2502 | 2502 | |
2503 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2503 | + $this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2504 | 2504 | $this->_template_args['list_table'] = $this->_list_table_object; |
2505 | 2505 | $this->_template_args['current_route'] = $this->_req_action; |
2506 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2506 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2507 | 2507 | |
2508 | 2508 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2509 | - if( ! empty( $ajax_sorting_callback )) { |
|
2510 | - $sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE ); |
|
2509 | + if ( ! empty($ajax_sorting_callback)) { |
|
2510 | + $sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE); |
|
2511 | 2511 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2512 | 2512 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2513 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2514 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2513 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2514 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2515 | 2515 | } else { |
2516 | 2516 | $sortable_list_table_form_fields = ''; |
2517 | 2517 | } |
2518 | 2518 | |
2519 | 2519 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2520 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2521 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2522 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2520 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2521 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2522 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2523 | 2523 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2524 | 2524 | |
2525 | 2525 | //display message about search results? |
2526 | - $this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action ); |
|
2526 | + $this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action); |
|
2527 | 2527 | |
2528 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2528 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2529 | 2529 | |
2530 | 2530 | // the final template wrapper |
2531 | - if ( $sidebar ) |
|
2531 | + if ($sidebar) |
|
2532 | 2532 | $this->display_admin_page_with_sidebar(); |
2533 | 2533 | else |
2534 | 2534 | $this->display_admin_page_with_no_sidebar(); |
@@ -2551,9 +2551,9 @@ discard block |
||
2551 | 2551 | * @param array $items see above for format of array |
2552 | 2552 | * @return string html string of legend |
2553 | 2553 | */ |
2554 | - protected function _display_legend( $items ) { |
|
2555 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2556 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2554 | + protected function _display_legend($items) { |
|
2555 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2556 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2557 | 2557 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2558 | 2558 | } |
2559 | 2559 | |
@@ -2578,33 +2578,33 @@ discard block |
||
2578 | 2578 | * |
2579 | 2579 | * @return string json object |
2580 | 2580 | */ |
2581 | - protected function _return_json( $sticky_notices = false ) { |
|
2581 | + protected function _return_json($sticky_notices = false) { |
|
2582 | 2582 | |
2583 | 2583 | //make sure any EE_Error notices have been handled. |
2584 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2584 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2585 | 2585 | |
2586 | 2586 | |
2587 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2587 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2588 | 2588 | unset($this->_template_args['data']); |
2589 | 2589 | $json = array( |
2590 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2591 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2592 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2593 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2590 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2591 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2592 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2593 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2594 | 2594 | 'notices' => EE_Error::get_notices(), |
2595 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2596 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2595 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2596 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2597 | 2597 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2598 | 2598 | ); |
2599 | 2599 | |
2600 | 2600 | |
2601 | 2601 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2602 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2602 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2603 | 2603 | header('Content-Type: application/json; charset=UTF-8'); |
2604 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2605 | - echo wp_json_encode( $json ); |
|
2604 | + if (function_exists('wp_json_encode')) { |
|
2605 | + echo wp_json_encode($json); |
|
2606 | 2606 | } else { |
2607 | - echo json_encode( $json ); |
|
2607 | + echo json_encode($json); |
|
2608 | 2608 | } |
2609 | 2609 | exit(); |
2610 | 2610 | } |
@@ -2616,11 +2616,11 @@ discard block |
||
2616 | 2616 | * @return json_obj|EE_Error |
2617 | 2617 | */ |
2618 | 2618 | public function return_json() { |
2619 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2619 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2620 | 2620 | $this->_return_json(); |
2621 | 2621 | |
2622 | 2622 | else { |
2623 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2623 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2624 | 2624 | } |
2625 | 2625 | } |
2626 | 2626 | |
@@ -2635,7 +2635,7 @@ discard block |
||
2635 | 2635 | * @access public |
2636 | 2636 | * @return void |
2637 | 2637 | */ |
2638 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2638 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2639 | 2639 | $this->_hook_obj = $hook_obj; |
2640 | 2640 | } |
2641 | 2641 | |
@@ -2651,33 +2651,33 @@ discard block |
||
2651 | 2651 | */ |
2652 | 2652 | public function admin_page_wrapper($about = FALSE) { |
2653 | 2653 | |
2654 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2654 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2655 | 2655 | |
2656 | 2656 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2657 | 2657 | |
2658 | 2658 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2659 | 2659 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2660 | 2660 | |
2661 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2662 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2661 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2662 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2663 | 2663 | |
2664 | 2664 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2665 | 2665 | |
2666 | 2666 | |
2667 | 2667 | |
2668 | 2668 | // load settings page wrapper template |
2669 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2669 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2670 | 2670 | |
2671 | 2671 | //about page? |
2672 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2672 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2673 | 2673 | |
2674 | 2674 | |
2675 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2676 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2675 | + if (defined('DOING_AJAX')) { |
|
2676 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2677 | 2677 | |
2678 | 2678 | $this->_return_json(); |
2679 | 2679 | } else { |
2680 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2680 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2681 | 2681 | } |
2682 | 2682 | |
2683 | 2683 | } |
@@ -2705,7 +2705,7 @@ discard block |
||
2705 | 2705 | * @access public |
2706 | 2706 | * @return void |
2707 | 2707 | */ |
2708 | - private function _sort_nav_tabs( $a, $b ) { |
|
2708 | + private function _sort_nav_tabs($a, $b) { |
|
2709 | 2709 | if ($a['order'] == $b['order']) { |
2710 | 2710 | return 0; |
2711 | 2711 | } |
@@ -2726,7 +2726,7 @@ discard block |
||
2726 | 2726 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2727 | 2727 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2728 | 2728 | */ |
2729 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2729 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2730 | 2730 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2731 | 2731 | return $content; |
2732 | 2732 | } |
@@ -2748,25 +2748,25 @@ discard block |
||
2748 | 2748 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2749 | 2749 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2750 | 2750 | */ |
2751 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2751 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2752 | 2752 | //make sure $text and $actions are in an array |
2753 | 2753 | $text = (array) $text; |
2754 | 2754 | $actions = (array) $actions; |
2755 | 2755 | $referrer_url = empty($referrer) ? '' : $referrer; |
2756 | - $referrer_url = !$referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2756 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2757 | 2757 | |
2758 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2759 | - $default_names = array( 'save', 'save_and_close' ); |
|
2758 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2759 | + $default_names = array('save', 'save_and_close'); |
|
2760 | 2760 | |
2761 | 2761 | //add in a hidden index for the current page (so save and close redirects properly) |
2762 | 2762 | $this->_template_args['save_buttons'] = $referrer_url; |
2763 | 2763 | |
2764 | - foreach ( $button_text as $key => $button ) { |
|
2764 | + foreach ($button_text as $key => $button) { |
|
2765 | 2765 | $ref = $default_names[$key]; |
2766 | - $id = $this->_current_view . '_' . $ref; |
|
2767 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2768 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2769 | - if ( !$both ) break; |
|
2766 | + $id = $this->_current_view.'_'.$ref; |
|
2767 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2768 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2769 | + if ( ! $both) break; |
|
2770 | 2770 | } |
2771 | 2771 | |
2772 | 2772 | } |
@@ -2779,8 +2779,8 @@ discard block |
||
2779 | 2779 | * @since 4.6.0 |
2780 | 2780 | * |
2781 | 2781 | */ |
2782 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2783 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2782 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2783 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2784 | 2784 | } |
2785 | 2785 | |
2786 | 2786 | |
@@ -2793,30 +2793,30 @@ discard block |
||
2793 | 2793 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2794 | 2794 | * @return void |
2795 | 2795 | */ |
2796 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2796 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2797 | 2797 | |
2798 | - if ( empty( $route )) { |
|
2798 | + if (empty($route)) { |
|
2799 | 2799 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2800 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2801 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2800 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2801 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2802 | 2802 | } |
2803 | 2803 | // open form |
2804 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2804 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2805 | 2805 | // add nonce |
2806 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2806 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2807 | 2807 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2808 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2808 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2809 | 2809 | // add REQUIRED form action |
2810 | 2810 | $hidden_fields = array( |
2811 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2811 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2812 | 2812 | ); |
2813 | 2813 | // merge arrays |
2814 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2814 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2815 | 2815 | // generate form fields |
2816 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2816 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2817 | 2817 | // add fields to form |
2818 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2819 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2818 | + foreach ($form_fields as $field_name => $form_field) { |
|
2819 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2820 | 2820 | } |
2821 | 2821 | |
2822 | 2822 | // close form |
@@ -2833,8 +2833,8 @@ discard block |
||
2833 | 2833 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2834 | 2834 | * @since 4.5.0 |
2835 | 2835 | */ |
2836 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2837 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2836 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2837 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2838 | 2838 | } |
2839 | 2839 | |
2840 | 2840 | |
@@ -2850,32 +2850,32 @@ discard block |
||
2850 | 2850 | * @access protected |
2851 | 2851 | * @return void |
2852 | 2852 | */ |
2853 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2853 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2854 | 2854 | |
2855 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2855 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2856 | 2856 | |
2857 | 2857 | //class name for actions/filters. |
2858 | 2858 | $classname = get_class($this); |
2859 | 2859 | |
2860 | 2860 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2861 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2862 | - $notices = EE_Error::get_notices( FALSE ); |
|
2861 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2862 | + $notices = EE_Error::get_notices(FALSE); |
|
2863 | 2863 | |
2864 | 2864 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2865 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2865 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2866 | 2866 | EE_Error::overwrite_success(); |
2867 | 2867 | } |
2868 | 2868 | // how many records affected ? more than one record ? or just one ? |
2869 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2869 | + if ($success > 1 && empty($notices['errors'])) { |
|
2870 | 2870 | // set plural msg |
2871 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2872 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2871 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2872 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2873 | 2873 | // set singular msg |
2874 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2874 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2875 | 2875 | } |
2876 | 2876 | |
2877 | 2877 | // check that $query_args isn't something crazy |
2878 | - if ( ! is_array( $query_args )) { |
|
2878 | + if ( ! is_array($query_args)) { |
|
2879 | 2879 | $query_args = array(); |
2880 | 2880 | } |
2881 | 2881 | |
@@ -2888,36 +2888,36 @@ discard block |
||
2888 | 2888 | * @param array $query_args The original query_args array coming into the |
2889 | 2889 | * method. |
2890 | 2890 | */ |
2891 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2891 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2892 | 2892 | |
2893 | 2893 | //calculate where we're going (if we have a "save and close" button pushed) |
2894 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2894 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2895 | 2895 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2896 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2896 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2897 | 2897 | // regenerate query args array from refferer URL |
2898 | - parse_str( $parsed_url['query'], $query_args ); |
|
2898 | + parse_str($parsed_url['query'], $query_args); |
|
2899 | 2899 | // correct page and action will be in the query args now |
2900 | - $redirect_url = admin_url( 'admin.php' ); |
|
2900 | + $redirect_url = admin_url('admin.php'); |
|
2901 | 2901 | } |
2902 | 2902 | |
2903 | 2903 | //merge any default query_args set in _default_route_query_args property |
2904 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2904 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2905 | 2905 | $args_to_merge = array(); |
2906 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2906 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2907 | 2907 | //is there a wp_referer array in our _default_route_query_args property? |
2908 | - if ( $query_param == 'wp_referer' ) { |
|
2908 | + if ($query_param == 'wp_referer') { |
|
2909 | 2909 | $query_value = (array) $query_value; |
2910 | - foreach ( $query_value as $reference => $value ) { |
|
2911 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2910 | + foreach ($query_value as $reference => $value) { |
|
2911 | + if (strpos($reference, 'nonce') !== false) { |
|
2912 | 2912 | continue; |
2913 | 2913 | } |
2914 | 2914 | |
2915 | 2915 | //finally we will override any arguments in the referer with |
2916 | 2916 | //what might be set on the _default_route_query_args array. |
2917 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2918 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2917 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2918 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2919 | 2919 | } else { |
2920 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2920 | + $args_to_merge[$reference] = urlencode($value); |
|
2921 | 2921 | } |
2922 | 2922 | } |
2923 | 2923 | continue; |
@@ -2928,7 +2928,7 @@ discard block |
||
2928 | 2928 | |
2929 | 2929 | //now let's merge these arguments but override with what was specifically sent in to the |
2930 | 2930 | //redirect. |
2931 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2931 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2932 | 2932 | } |
2933 | 2933 | |
2934 | 2934 | $this->_process_notices($query_args); |
@@ -2937,19 +2937,19 @@ discard block |
||
2937 | 2937 | // generate redirect url |
2938 | 2938 | |
2939 | 2939 | // if redirecting to anything other than the main page, add a nonce |
2940 | - if ( isset( $query_args['action'] )) { |
|
2940 | + if (isset($query_args['action'])) { |
|
2941 | 2941 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
2942 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
2942 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
2943 | 2943 | } |
2944 | 2944 | |
2945 | 2945 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
2946 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
2946 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
2947 | 2947 | |
2948 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
2948 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
2949 | 2949 | |
2950 | 2950 | |
2951 | 2951 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
2952 | - if ( defined('DOING_AJAX' ) ) { |
|
2952 | + if (defined('DOING_AJAX')) { |
|
2953 | 2953 | $default_data = array( |
2954 | 2954 | 'close' => TRUE, |
2955 | 2955 | 'redirect_url' => $redirect_url, |
@@ -2958,11 +2958,11 @@ discard block |
||
2958 | 2958 | ); |
2959 | 2959 | |
2960 | 2960 | $this->_template_args['success'] = $success; |
2961 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
2961 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
2962 | 2962 | $this->_return_json(); |
2963 | 2963 | } |
2964 | 2964 | |
2965 | - wp_safe_redirect( $redirect_url ); |
|
2965 | + wp_safe_redirect($redirect_url); |
|
2966 | 2966 | exit(); |
2967 | 2967 | } |
2968 | 2968 | |
@@ -2978,30 +2978,30 @@ discard block |
||
2978 | 2978 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
2979 | 2979 | * @return void |
2980 | 2980 | */ |
2981 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
2981 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
2982 | 2982 | |
2983 | 2983 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
2984 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
2985 | - $notices = EE_Error::get_notices( false ); |
|
2986 | - if ( empty( $this->_template_args['success'] ) ) { |
|
2987 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
2984 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2985 | + $notices = EE_Error::get_notices(false); |
|
2986 | + if (empty($this->_template_args['success'])) { |
|
2987 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
2988 | 2988 | } |
2989 | 2989 | |
2990 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
2991 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
2990 | + if (empty($this->_template_args['errors'])) { |
|
2991 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
2992 | 2992 | } |
2993 | 2993 | |
2994 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
2995 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
2994 | + if (empty($this->_template_args['attention'])) { |
|
2995 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
2996 | 2996 | } |
2997 | 2997 | } |
2998 | 2998 | |
2999 | 2999 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3000 | 3000 | |
3001 | 3001 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3002 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3003 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3004 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3002 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3003 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3004 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3005 | 3005 | } |
3006 | 3006 | } |
3007 | 3007 | |
@@ -3023,32 +3023,32 @@ discard block |
||
3023 | 3023 | * |
3024 | 3024 | * @return string html for button |
3025 | 3025 | */ |
3026 | - public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) { |
|
3026 | + public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) { |
|
3027 | 3027 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3028 | - if ( !isset($this->_page_routes[$action]) && !$base_url ) |
|
3029 | - throw new EE_Error( sprintf( __('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action) ); |
|
3028 | + if ( ! isset($this->_page_routes[$action]) && ! $base_url) |
|
3029 | + throw new EE_Error(sprintf(__('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action)); |
|
3030 | 3030 | |
3031 | - if ( !isset( $this->_labels['buttons'][$type] ) ) |
|
3032 | - throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) ); |
|
3031 | + if ( ! isset($this->_labels['buttons'][$type])) |
|
3032 | + throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type)); |
|
3033 | 3033 | |
3034 | 3034 | //finally check user access for this button. |
3035 | - $has_access = $this->check_user_access( $action, TRUE ); |
|
3036 | - if ( ! $has_access ) { |
|
3035 | + $has_access = $this->check_user_access($action, TRUE); |
|
3036 | + if ( ! $has_access) { |
|
3037 | 3037 | return ''; |
3038 | 3038 | } |
3039 | 3039 | |
3040 | - $_base_url = !$base_url ? $this->_admin_base_url : $base_url; |
|
3040 | + $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
|
3041 | 3041 | |
3042 | 3042 | $query_args = array( |
3043 | 3043 | 'action' => $action ); |
3044 | 3044 | |
3045 | 3045 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3046 | - if ( !empty($extra_request) ) |
|
3047 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3046 | + if ( ! empty($extra_request)) |
|
3047 | + $query_args = array_merge($extra_request, $query_args); |
|
3048 | 3048 | |
3049 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3049 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3050 | 3050 | |
3051 | - $button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class ); |
|
3051 | + $button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3052 | 3052 | |
3053 | 3053 | return $button; |
3054 | 3054 | } |
@@ -3068,11 +3068,11 @@ discard block |
||
3068 | 3068 | $args = array( |
3069 | 3069 | 'label' => $this->_admin_page_title, |
3070 | 3070 | 'default' => 10, |
3071 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3071 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3072 | 3072 | ); |
3073 | 3073 | //ONLY add the screen option if the user has access to it. |
3074 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3075 | - add_screen_option( $option, $args ); |
|
3074 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3075 | + add_screen_option($option, $args); |
|
3076 | 3076 | } |
3077 | 3077 | } |
3078 | 3078 | |
@@ -3088,36 +3088,36 @@ discard block |
||
3088 | 3088 | * @return void |
3089 | 3089 | */ |
3090 | 3090 | private function _set_per_page_screen_options() { |
3091 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3092 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3091 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3092 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3093 | 3093 | |
3094 | - if ( !$user = wp_get_current_user() ) |
|
3094 | + if ( ! $user = wp_get_current_user()) |
|
3095 | 3095 | return; |
3096 | 3096 | $option = $_POST['wp_screen_options']['option']; |
3097 | 3097 | $value = $_POST['wp_screen_options']['value']; |
3098 | 3098 | |
3099 | - if ( $option != sanitize_key( $option ) ) |
|
3099 | + if ($option != sanitize_key($option)) |
|
3100 | 3100 | return; |
3101 | 3101 | |
3102 | 3102 | $map_option = $option; |
3103 | 3103 | |
3104 | 3104 | $option = str_replace('-', '_', $option); |
3105 | 3105 | |
3106 | - switch ( $map_option ) { |
|
3107 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3106 | + switch ($map_option) { |
|
3107 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3108 | 3108 | $value = (int) $value; |
3109 | - if ( $value < 1 || $value > 999 ) |
|
3109 | + if ($value < 1 || $value > 999) |
|
3110 | 3110 | return; |
3111 | 3111 | break; |
3112 | 3112 | default: |
3113 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3114 | - if ( false === $value ) |
|
3113 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3114 | + if (false === $value) |
|
3115 | 3115 | return; |
3116 | 3116 | break; |
3117 | 3117 | } |
3118 | 3118 | |
3119 | 3119 | update_user_meta($user->ID, $option, $value); |
3120 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3120 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3121 | 3121 | exit; |
3122 | 3122 | } |
3123 | 3123 | } |
@@ -3128,8 +3128,8 @@ discard block |
||
3128 | 3128 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3129 | 3129 | * @param array $data array that will be assigned to template args. |
3130 | 3130 | */ |
3131 | - public function set_template_args( $data ) { |
|
3132 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3131 | + public function set_template_args($data) { |
|
3132 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3133 | 3133 | } |
3134 | 3134 | |
3135 | 3135 | |
@@ -3145,26 +3145,26 @@ discard block |
||
3145 | 3145 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3146 | 3146 | * @return void |
3147 | 3147 | */ |
3148 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3148 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3149 | 3149 | $user_id = get_current_user_id(); |
3150 | 3150 | |
3151 | - if ( !$skip_route_verify ) |
|
3151 | + if ( ! $skip_route_verify) |
|
3152 | 3152 | $this->_verify_route($route); |
3153 | 3153 | |
3154 | 3154 | |
3155 | 3155 | //now let's set the string for what kind of transient we're setting |
3156 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3157 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3156 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3157 | + $data = $notices ? array('notices' => $data) : $data; |
|
3158 | 3158 | //is there already a transient for this route? If there is then let's ADD to that transient |
3159 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3160 | - if ( $existing ) { |
|
3161 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3159 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3160 | + if ($existing) { |
|
3161 | + $data = array_merge((array) $data, (array) $existing); |
|
3162 | 3162 | } |
3163 | 3163 | |
3164 | - if ( is_multisite() && is_network_admin() ) { |
|
3165 | - set_site_transient( $transient, $data, 8 ); |
|
3164 | + if (is_multisite() && is_network_admin()) { |
|
3165 | + set_site_transient($transient, $data, 8); |
|
3166 | 3166 | } else { |
3167 | - set_transient( $transient, $data, 8 ); |
|
3167 | + set_transient($transient, $data, 8); |
|
3168 | 3168 | } |
3169 | 3169 | } |
3170 | 3170 | |
@@ -3176,18 +3176,18 @@ discard block |
||
3176 | 3176 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3177 | 3177 | * @return mixed data |
3178 | 3178 | */ |
3179 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3179 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3180 | 3180 | $user_id = get_current_user_id(); |
3181 | - $route = !$route ? $this->_req_action : $route; |
|
3182 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3183 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3181 | + $route = ! $route ? $this->_req_action : $route; |
|
3182 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3183 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3184 | 3184 | //delete transient after retrieval (just in case it hasn't expired); |
3185 | - if ( is_multisite() && is_network_admin() ) { |
|
3186 | - delete_site_transient( $transient ); |
|
3185 | + if (is_multisite() && is_network_admin()) { |
|
3186 | + delete_site_transient($transient); |
|
3187 | 3187 | } else { |
3188 | - delete_transient( $transient ); |
|
3188 | + delete_transient($transient); |
|
3189 | 3189 | } |
3190 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3190 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3191 | 3191 | } |
3192 | 3192 | |
3193 | 3193 | |
@@ -3204,12 +3204,12 @@ discard block |
||
3204 | 3204 | |
3205 | 3205 | //retrieve all existing transients |
3206 | 3206 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3207 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3208 | - foreach ( $results as $result ) { |
|
3209 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3210 | - get_transient( $transient ); |
|
3211 | - if ( is_multisite() && is_network_admin() ) { |
|
3212 | - get_site_transient( $transient ); |
|
3207 | + if ($results = $wpdb->get_results($query)) { |
|
3208 | + foreach ($results as $result) { |
|
3209 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3210 | + get_transient($transient); |
|
3211 | + if (is_multisite() && is_network_admin()) { |
|
3212 | + get_site_transient($transient); |
|
3213 | 3213 | } |
3214 | 3214 | } |
3215 | 3215 | } |
@@ -3359,23 +3359,23 @@ discard block |
||
3359 | 3359 | * @param string $line line no where error occurred |
3360 | 3360 | * @return boolean |
3361 | 3361 | */ |
3362 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3362 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3363 | 3363 | |
3364 | 3364 | //remove any options that are NOT going to be saved with the config settings. |
3365 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3365 | + if (isset($config->core->ee_ueip_optin)) { |
|
3366 | 3366 | $config->core->ee_ueip_has_notified = TRUE; |
3367 | 3367 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3368 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3369 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3368 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3369 | + update_option('ee_ueip_has_notified', TRUE); |
|
3370 | 3370 | } |
3371 | 3371 | // and save it (note we're also doing the network save here) |
3372 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3373 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3374 | - if ( $config_saved && $net_saved ) { |
|
3375 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3372 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3373 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3374 | + if ($config_saved && $net_saved) { |
|
3375 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3376 | 3376 | return TRUE; |
3377 | 3377 | } else { |
3378 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3378 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3379 | 3379 | return FALSE; |
3380 | 3380 | } |
3381 | 3381 | } |
@@ -3388,7 +3388,7 @@ discard block |
||
3388 | 3388 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3389 | 3389 | * @return array |
3390 | 3390 | */ |
3391 | - public function get_yes_no_values(){ |
|
3391 | + public function get_yes_no_values() { |
|
3392 | 3392 | return $this->_yes_no_values; |
3393 | 3393 | } |
3394 | 3394 | |
@@ -3410,8 +3410,8 @@ discard block |
||
3410 | 3410 | * |
3411 | 3411 | * @return string |
3412 | 3412 | */ |
3413 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3414 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3413 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3414 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3415 | 3415 | } |
3416 | 3416 | |
3417 | 3417 | |
@@ -3425,8 +3425,8 @@ discard block |
||
3425 | 3425 | * |
3426 | 3426 | * @return string |
3427 | 3427 | */ |
3428 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3429 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3428 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3429 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3430 | 3430 | } |
3431 | 3431 | |
3432 | 3432 | |
@@ -3445,8 +3445,8 @@ discard block |
||
3445 | 3445 | * @return bool success/fail |
3446 | 3446 | */ |
3447 | 3447 | protected function _process_resend_registration() { |
3448 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3449 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3448 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3449 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3450 | 3450 | return $this->_template_args['success']; |
3451 | 3451 | } |
3452 | 3452 | |
@@ -3459,11 +3459,11 @@ discard block |
||
3459 | 3459 | * @param \EE_Payment $payment |
3460 | 3460 | * @return bool success/fail |
3461 | 3461 | */ |
3462 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3463 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3464 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3465 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3466 | - return $this->_template_args[ 'success' ]; |
|
3462 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3463 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3464 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3465 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3466 | + return $this->_template_args['success']; |
|
3467 | 3467 | } |
3468 | 3468 | |
3469 | 3469 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class InvalidIdentifierException |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @param int $code |
24 | 24 | * @param \Exception $previous |
25 | 25 | */ |
26 | - public function __construct( $actual, $expected, $message = '', $code = 0, \Exception $previous = null ) { |
|
27 | - if ( empty( $message ) ) { |
|
26 | + public function __construct($actual, $expected, $message = '', $code = 0, \Exception $previous = null) { |
|
27 | + if (empty($message)) { |
|
28 | 28 | $message = sprintf( |
29 | 29 | __( |
30 | 30 | 'The supplied identifier "%1$s" is invalid. A value like "%2$s" was expected.', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $expected |
35 | 35 | ); |
36 | 36 | } |
37 | - parent::__construct( $message, $code, $previous ); |
|
37 | + parent::__construct($message, $code, $previous); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | } |
@@ -1,37 +1,37 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-reg-details-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | - <?php do_action( 'AHEE__reg_admin_details_main_meta_box_reg_details__top', $REG_ID ); ?> |
|
3 | + <?php do_action('AHEE__reg_admin_details_main_meta_box_reg_details__top', $REG_ID); ?> |
|
4 | 4 | <?php echo $resend_registration_button; ?> |
5 | 5 | <?php echo $view_transaction_button; ?> |
6 | 6 | <br/> |
7 | 7 | |
8 | - <h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span><?php _e( 'Registration Items', 'event_espresso' );?></h3> |
|
8 | + <h3 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-clipboard"></span><?php _e('Registration Items', 'event_espresso'); ?></h3> |
|
9 | 9 | |
10 | 10 | <?php echo $line_item_table; ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - if ( WP_DEBUG ) { |
|
14 | - $delivered_messages = get_option( 'EED_Messages__maybe_registration', array() ); |
|
15 | - if ( isset( $delivered_messages[ $REG_ID ] )) { |
|
13 | + if (WP_DEBUG) { |
|
14 | + $delivered_messages = get_option('EED_Messages__maybe_registration', array()); |
|
15 | + if (isset($delivered_messages[$REG_ID])) { |
|
16 | 16 | ?> |
17 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Registrant', 'event_espresso' );?></h4> |
|
17 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Registrant', 'event_espresso'); ?></h4> |
|
18 | 18 | |
19 | 19 | <div class="admin-primary-mbox-tbl-wrap"> |
20 | 20 | <table class="admin-primary-mbox-tbl"> |
21 | 21 | <thead> |
22 | 22 | <tr> |
23 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
24 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
25 | - <th class="jst-left"><?php _e( 'REG Status Upon Sending', 'event_espresso' );?></th> |
|
23 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
24 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
25 | + <th class="jst-left"><?php _e('REG Status Upon Sending', 'event_espresso'); ?></th> |
|
26 | 26 | </tr> |
27 | 27 | </thead> |
28 | 28 | <tbody> |
29 | - <?php foreach ( $delivered_messages[ $REG_ID ] as $timestamp => $delivered_message ) : |
|
29 | + <?php foreach ($delivered_messages[$REG_ID] as $timestamp => $delivered_message) : |
|
30 | 30 | ?> |
31 | 31 | <tr> |
32 | - <td class="jst-left"><?php echo gmdate( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
33 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
34 | - <td class="jst-left"><?php echo isset( $delivered_message['reg_status'] ) ? $delivered_message['reg_status'] : '';?></td> |
|
32 | + <td class="jst-left"><?php echo gmdate(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
33 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
34 | + <td class="jst-left"><?php echo isset($delivered_message['reg_status']) ? $delivered_message['reg_status'] : ''; ?></td> |
|
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $delivered_messages?> |
37 | 37 | </tbody> |
@@ -43,27 +43,27 @@ discard block |
||
43 | 43 | ?> |
44 | 44 | |
45 | 45 | <a id="display-additional-registration-session-info" class="display-the-hidden smaller-text" rel="additional-registration-session-info"> |
46 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional registration session details', 'event_espresso' );?> |
|
46 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional registration session details', 'event_espresso'); ?> |
|
47 | 47 | </a> |
48 | 48 | |
49 | 49 | <div id="additional-registration-session-info-dv" class="hidden"> |
50 | 50 | |
51 | 51 | <a id="hide-additional-registration-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-registration-session-info"> |
52 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional registration session details', 'event_espresso' );?> |
|
52 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional registration session details', 'event_espresso'); ?> |
|
53 | 53 | </a> |
54 | 54 | <br class="clear"/> |
55 | 55 | |
56 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Registration Session Details', 'event_espresso' );?></h3> |
|
56 | + <h3 class="admin-primary-mbox-h4"><?php _e('Registration Session Details', 'event_espresso'); ?></h3> |
|
57 | 57 | |
58 | 58 | <table id="admin-primary-mbox-reg-extra-session-info-tbl" class="form-table skinny-rows"> |
59 | 59 | <tbody> |
60 | - <?php foreach ( $reg_details as $key => $reg_detail ) : ?> |
|
60 | + <?php foreach ($reg_details as $key => $reg_detail) : ?> |
|
61 | 61 | <tr> |
62 | 62 | <th> |
63 | - <label for="<?php echo $key;?>"><?php echo $reg_detail['label'];?></label> |
|
63 | + <label for="<?php echo $key; ?>"><?php echo $reg_detail['label']; ?></label> |
|
64 | 64 | </th> |
65 | 65 | <td> |
66 | - <?php echo $reg_detail['value'];?> |
|
66 | + <?php echo $reg_detail['value']; ?> |
|
67 | 67 | </td> |
68 | 68 | </tr> |
69 | 69 | <?php endforeach; // $reg_details?> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * Loads the class file for a given class name. |
133 | 133 | * |
134 | 134 | * @param string $class The fully-qualified class name. |
135 | - * @return mixed The mapped file name on success, or boolean false on |
|
135 | + * @return string|false The mapped file name on success, or boolean false on |
|
136 | 136 | * failure. |
137 | 137 | */ |
138 | 138 | public function loadClass( $class ) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @param string $prefix The namespace prefix. |
167 | 167 | * @param string $relative_class The relative class name. |
168 | - * @return mixed Boolean false if no mapped file can be loaded, or the |
|
168 | + * @return string|false Boolean false if no mapped file can be loaded, or the |
|
169 | 169 | * name of the mapped file that was loaded. |
170 | 170 | */ |
171 | 171 | protected function loadMappedFile( $prefix, $relative_class ) { |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * @param string $prefix |
78 | 78 | * @return array |
79 | 79 | */ |
80 | - public function prefixes( $prefix = '' ) { |
|
81 | - if ( ! empty( $prefix ) ) { |
|
80 | + public function prefixes($prefix = '') { |
|
81 | + if ( ! empty($prefix)) { |
|
82 | 82 | // are there any base directories for this namespace prefix? |
83 | - return isset( $this->prefixes[ $prefix ] ) ? $this->prefixes[ $prefix ] : array(); |
|
83 | + return isset($this->prefixes[$prefix]) ? $this->prefixes[$prefix] : array(); |
|
84 | 84 | } |
85 | 85 | return $this->prefixes; |
86 | 86 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @return void |
94 | 94 | */ |
95 | 95 | public function register() { |
96 | - spl_autoload_register( array( $this, 'loadClass' ) ); |
|
96 | + spl_autoload_register(array($this, 'loadClass')); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | * than last. |
110 | 110 | * @return void |
111 | 111 | */ |
112 | - public function addNamespace( $prefix, $base_dir, $prepend = false ) { |
|
112 | + public function addNamespace($prefix, $base_dir, $prepend = false) { |
|
113 | 113 | // normalize namespace prefix |
114 | - $prefix = trim( $prefix, Psr4Autoloader::NS ) . Psr4Autoloader::NS; |
|
114 | + $prefix = trim($prefix, Psr4Autoloader::NS).Psr4Autoloader::NS; |
|
115 | 115 | // normalize the base directory with a trailing separator |
116 | - $base_dir = \EEH_File::standardise_and_end_with_directory_separator( $base_dir ); |
|
116 | + $base_dir = \EEH_File::standardise_and_end_with_directory_separator($base_dir); |
|
117 | 117 | // initialize the namespace prefix array |
118 | - if ( isset( $this->prefixes[ $prefix ] ) === false ) { |
|
119 | - $this->prefixes[ $prefix ] = array(); |
|
118 | + if (isset($this->prefixes[$prefix]) === false) { |
|
119 | + $this->prefixes[$prefix] = array(); |
|
120 | 120 | } |
121 | 121 | // retain the base directory for the namespace prefix |
122 | - if ( $prepend ) { |
|
123 | - array_unshift( $this->prefixes[ $prefix ], $base_dir ); |
|
122 | + if ($prepend) { |
|
123 | + array_unshift($this->prefixes[$prefix], $base_dir); |
|
124 | 124 | } else { |
125 | - $this->prefixes[ $prefix ][] = $base_dir; |
|
125 | + $this->prefixes[$prefix][] = $base_dir; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -135,24 +135,24 @@ discard block |
||
135 | 135 | * @return mixed The mapped file name on success, or boolean false on |
136 | 136 | * failure. |
137 | 137 | */ |
138 | - public function loadClass( $class ) { |
|
138 | + public function loadClass($class) { |
|
139 | 139 | // the current namespace prefix |
140 | 140 | $prefix = $class; |
141 | 141 | // work backwards through the namespace names of the fully-qualified |
142 | 142 | // class name to find a mapped file name |
143 | - while ( false !== $pos = strrpos( $prefix, Psr4Autoloader::NS ) ) { |
|
143 | + while (false !== $pos = strrpos($prefix, Psr4Autoloader::NS)) { |
|
144 | 144 | // retain the trailing namespace separator in the prefix |
145 | - $prefix = substr( $class, 0, $pos + 1 ); |
|
145 | + $prefix = substr($class, 0, $pos + 1); |
|
146 | 146 | // the rest is the relative class name |
147 | - $relative_class = substr( $class, $pos + 1 ); |
|
147 | + $relative_class = substr($class, $pos + 1); |
|
148 | 148 | // try to load a mapped file for the prefix and relative class |
149 | - $mapped_file = $this->loadMappedFile( $prefix, $relative_class ); |
|
150 | - if ( $mapped_file ) { |
|
149 | + $mapped_file = $this->loadMappedFile($prefix, $relative_class); |
|
150 | + if ($mapped_file) { |
|
151 | 151 | return $mapped_file; |
152 | 152 | } |
153 | 153 | // remove the trailing namespace separator for the next iteration |
154 | 154 | // of strrpos() |
155 | - $prefix = rtrim( $prefix, Psr4Autoloader::NS ); |
|
155 | + $prefix = rtrim($prefix, Psr4Autoloader::NS); |
|
156 | 156 | } |
157 | 157 | // never found a mapped file |
158 | 158 | return false; |
@@ -168,17 +168,17 @@ discard block |
||
168 | 168 | * @return mixed Boolean false if no mapped file can be loaded, or the |
169 | 169 | * name of the mapped file that was loaded. |
170 | 170 | */ |
171 | - protected function loadMappedFile( $prefix, $relative_class ) { |
|
171 | + protected function loadMappedFile($prefix, $relative_class) { |
|
172 | 172 | // look through base directories for this namespace prefix |
173 | - foreach ( $this->prefixes( $prefix ) as $base_dir ) { |
|
173 | + foreach ($this->prefixes($prefix) as $base_dir) { |
|
174 | 174 | // replace the namespace prefix with the base directory, |
175 | 175 | // replace namespace separators with directory separators |
176 | 176 | // in the relative class name, append with .php |
177 | 177 | $file = $base_dir |
178 | - . str_replace( Psr4Autoloader::NS, DS, $relative_class ) |
|
178 | + . str_replace(Psr4Autoloader::NS, DS, $relative_class) |
|
179 | 179 | . '.php'; |
180 | 180 | // if the mapped file exists, require it |
181 | - if ( $this->requireFile( $file ) ) { |
|
181 | + if ($this->requireFile($file)) { |
|
182 | 182 | // yes, we're done |
183 | 183 | return $file; |
184 | 184 | } |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param string $file The file to require. |
196 | 196 | * @return bool True if the file exists, false if not. |
197 | 197 | */ |
198 | - protected function requireFile( $file ) { |
|
199 | - if ( file_exists( $file ) ) { |
|
198 | + protected function requireFile($file) { |
|
199 | + if (file_exists($file)) { |
|
200 | 200 | require $file; |
201 | 201 | return true; |
202 | 202 | } |