@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
64 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
64 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
65 | 65 | } |
66 | 66 | $sibling_input_to_html_id_map = array(); |
67 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
68 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
67 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
68 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
69 | 69 | } |
70 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
70 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
71 | 71 | return $form_other_js_data; |
72 | 72 | } |
73 | 73 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | ! isset( $input_settings['include_whats_this_link'] ) |
34 | 34 | || ( |
35 | 35 | isset( $input_settings['include_whats_this_link'] ) |
36 | - && $input_settings['include_whats_this_link'] === true |
|
36 | + && $input_settings['include_whats_this_link'] === true |
|
37 | 37 | ) |
38 | 38 | ) { |
39 | 39 | $this->_html_label_text = sprintf( |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_CVV_Input extends EE_Text_Input{ |
|
11 | +class EE_CVV_Input extends EE_Text_Input { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $input_settings { |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal()); |
20 | 20 | $this->_add_validation_strategy( |
21 | 21 | new EE_Text_Validation_Strategy( |
22 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
23 | - ? $input_settings[ 'validation_error_message' ] |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | 24 | : __( |
25 | 25 | 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front', |
26 | 26 | 'event_espresso' |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | ) |
30 | 30 | ); |
31 | 31 | parent::__construct($input_settings); |
32 | - if( |
|
33 | - ! isset( $input_settings['include_whats_this_link'] ) |
|
32 | + if ( |
|
33 | + ! isset($input_settings['include_whats_this_link']) |
|
34 | 34 | || ( |
35 | - isset( $input_settings['include_whats_this_link'] ) |
|
35 | + isset($input_settings['include_whats_this_link']) |
|
36 | 36 | && $input_settings['include_whats_this_link'] === true |
37 | 37 | ) |
38 | 38 | ) { |
@@ -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 | |
@@ -488,87 +488,87 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | //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. |
491 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
491 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
492 | 492 | |
493 | 493 | |
494 | 494 | //next verify if we need to load anything... |
495 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE; |
|
496 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
495 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE; |
|
496 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
497 | 497 | |
498 | 498 | global $ee_menu_slugs; |
499 | 499 | $ee_menu_slugs = (array) $ee_menu_slugs; |
500 | 500 | |
501 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
501 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
502 | 502 | |
503 | 503 | |
504 | 504 | // 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 |
505 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
506 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
505 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
506 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | 507 | } |
508 | 508 | // then set blank or -1 action values to 'default' |
509 | - $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'; |
|
509 | + $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'; |
|
510 | 510 | |
511 | 511 | //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. |
512 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
512 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
513 | 513 | |
514 | 514 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
515 | 515 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
516 | 516 | |
517 | 517 | $this->_current_view = $this->_req_action; |
518 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
518 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
519 | 519 | $this->_define_page_props(); |
520 | 520 | |
521 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
521 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
522 | 522 | |
523 | 523 | //default things |
524 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
524 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
525 | 525 | |
526 | 526 | //set page configs |
527 | 527 | $this->_set_page_routes(); |
528 | 528 | $this->_set_page_config(); |
529 | 529 | |
530 | 530 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
531 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
531 | + if (isset($this->_req_data['wp_referer'])) { |
|
532 | 532 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
533 | 533 | } |
534 | 534 | |
535 | 535 | //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 |
536 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
536 | + if (method_exists($this, '_extend_page_config')) |
|
537 | 537 | $this->_extend_page_config(); |
538 | 538 | |
539 | 539 | //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. |
540 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
540 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
541 | 541 | $this->_extend_page_config_for_cpt(); |
542 | 542 | |
543 | 543 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
544 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
545 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
544 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
545 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
546 | 546 | |
547 | 547 | |
548 | 548 | //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 |
549 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
550 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
549 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
550 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | |
554 | 554 | //next route only if routing enabled |
555 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
555 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
556 | 556 | |
557 | 557 | $this->_verify_routes(); |
558 | 558 | |
559 | 559 | //next let's just check user_access and kill if no access |
560 | 560 | $this->check_user_access(); |
561 | 561 | |
562 | - if ( $this->_is_UI_request ) { |
|
562 | + if ($this->_is_UI_request) { |
|
563 | 563 | //admin_init stuff - global, all views for this page class, specific view |
564 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
565 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
566 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
564 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
565 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
566 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | } else { |
570 | 570 | //hijack regular WP loading and route admin request immediately |
571 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
571 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
572 | 572 | $this->route_admin_request(); |
573 | 573 | } |
574 | 574 | } |
@@ -585,18 +585,18 @@ discard block |
||
585 | 585 | * @return void |
586 | 586 | */ |
587 | 587 | private function _do_other_page_hooks() { |
588 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
588 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
589 | 589 | |
590 | - foreach ( $registered_pages as $page ) { |
|
590 | + foreach ($registered_pages as $page) { |
|
591 | 591 | |
592 | 592 | //now let's setup the file name and class that should be present |
593 | 593 | $classname = str_replace('.class.php', '', $page); |
594 | 594 | |
595 | 595 | //autoloaders should take care of loading file |
596 | - if ( !class_exists( $classname ) ) { |
|
597 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
598 | - $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 ); |
|
599 | - throw new EE_Error( implode( '||', $error_msg )); |
|
596 | + if ( ! class_exists($classname)) { |
|
597 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
598 | + $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); |
|
599 | + throw new EE_Error(implode('||', $error_msg)); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | $a = new ReflectionClass($classname); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | public function load_page_dependencies() { |
612 | 612 | try { |
613 | 613 | $this->_load_page_dependencies(); |
614 | - } catch ( EE_Error $e ) { |
|
614 | + } catch (EE_Error $e) { |
|
615 | 615 | $e->get_error(); |
616 | 616 | } |
617 | 617 | } |
@@ -629,16 +629,16 @@ discard block |
||
629 | 629 | $this->_current_screen = get_current_screen(); |
630 | 630 | |
631 | 631 | //load admin_notices - global, page class, and view specific |
632 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
633 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
634 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
632 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
633 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
634 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
635 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | //load network admin_notices - global, page class, and view specific |
639 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
640 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
639 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
640 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | //this will save any per_page screen options if they are present |
@@ -654,8 +654,8 @@ discard block |
||
654 | 654 | //add screen options - global, page child class, and view specific |
655 | 655 | $this->_add_global_screen_options(); |
656 | 656 | $this->_add_screen_options(); |
657 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
658 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
657 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
658 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
659 | 659 | |
660 | 660 | |
661 | 661 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -666,33 +666,33 @@ discard block |
||
666 | 666 | //add feature_pointers - global, page child class, and view specific |
667 | 667 | $this->_add_feature_pointers(); |
668 | 668 | $this->_add_global_feature_pointers(); |
669 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
670 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
669 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
670 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
671 | 671 | |
672 | 672 | //enqueue scripts/styles - global, page class, and view specific |
673 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
674 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
675 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
673 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
674 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
675 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
677 | 677 | |
678 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
679 | 679 | |
680 | 680 | //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 |
681 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
682 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
683 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
681 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
682 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
683 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
685 | 685 | |
686 | 686 | //admin footer scripts |
687 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
688 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
689 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
687 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
688 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
689 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
690 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
691 | 691 | |
692 | 692 | |
693 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
693 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
694 | 694 | //targeted hook |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
696 | 696 | |
697 | 697 | } |
698 | 698 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | private function _set_defaults() { |
708 | 708 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
709 | 709 | |
710 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
710 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
711 | 711 | |
712 | 712 | $this->default_nav_tab_name = 'overview'; |
713 | 713 | |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | public function route_admin_request() { |
735 | 735 | try { |
736 | 736 | $this->_route_admin_request(); |
737 | - } catch ( EE_Error $e ) { |
|
737 | + } catch (EE_Error $e) { |
|
738 | 738 | $e->get_error(); |
739 | 739 | } |
740 | 740 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $this->_wp_page_slug = $wp_page_slug; |
746 | 746 | |
747 | 747 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
748 | - if ( is_network_admin() ) { |
|
748 | + if (is_network_admin()) { |
|
749 | 749 | $this->_wp_page_slug .= '-network'; |
750 | 750 | } |
751 | 751 | } |
@@ -758,53 +758,53 @@ discard block |
||
758 | 758 | * @return void |
759 | 759 | */ |
760 | 760 | protected function _verify_routes() { |
761 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
761 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
762 | 762 | |
763 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
763 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
764 | 764 | |
765 | 765 | $this->_route = FALSE; |
766 | 766 | $func = FALSE; |
767 | 767 | $args = array(); |
768 | 768 | |
769 | 769 | // check that the page_routes array is not empty |
770 | - if ( empty( $this->_page_routes )) { |
|
770 | + if (empty($this->_page_routes)) { |
|
771 | 771 | // user error msg |
772 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
772 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
773 | 773 | // developer error msg |
774 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
775 | - throw new EE_Error( $error_msg ); |
|
774 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
775 | + throw new EE_Error($error_msg); |
|
776 | 776 | } |
777 | 777 | |
778 | 778 | // and that the requested page route exists |
779 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
780 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
779 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
780 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
781 | 781 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
782 | 782 | } else { |
783 | 783 | // user error msg |
784 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
784 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
785 | 785 | // developer error msg |
786 | - $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 ); |
|
787 | - throw new EE_Error( $error_msg ); |
|
786 | + $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); |
|
787 | + throw new EE_Error($error_msg); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | // and that a default route exists |
791 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
791 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
792 | 792 | // user error msg |
793 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
793 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
794 | 794 | // developer error msg |
795 | - $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' ); |
|
796 | - throw new EE_Error( $error_msg ); |
|
795 | + $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'); |
|
796 | + throw new EE_Error($error_msg); |
|
797 | 797 | } |
798 | 798 | |
799 | 799 | |
800 | 800 | //first lets' catch if the UI request has EVER been set. |
801 | - if ( $this->_is_UI_request === NULL ) { |
|
801 | + if ($this->_is_UI_request === NULL) { |
|
802 | 802 | //lets set if this is a UI request or not. |
803 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
803 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
804 | 804 | |
805 | 805 | |
806 | 806 | //wait a minute... we might have a noheader in the route array |
807 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
807 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
808 | 808 | } |
809 | 809 | |
810 | 810 | $this->_set_current_labels(); |
@@ -819,15 +819,15 @@ discard block |
||
819 | 819 | * @param string $route the route name we're verifying |
820 | 820 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
821 | 821 | */ |
822 | - protected function _verify_route( $route ) { |
|
823 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
822 | + protected function _verify_route($route) { |
|
823 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
824 | 824 | return true; |
825 | 825 | } else { |
826 | 826 | // user error msg |
827 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
827 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
828 | 828 | // developer error msg |
829 | - $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 ); |
|
830 | - throw new EE_Error( $error_msg ); |
|
829 | + $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); |
|
830 | + throw new EE_Error($error_msg); |
|
831 | 831 | } |
832 | 832 | } |
833 | 833 | |
@@ -841,18 +841,18 @@ discard block |
||
841 | 841 | * @param string $nonce_ref The nonce reference string (name0) |
842 | 842 | * @return mixed (bool|die) |
843 | 843 | */ |
844 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
844 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
845 | 845 | // verify nonce against expected value |
846 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
846 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
847 | 847 | // these are not the droids you are looking for !!! |
848 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
849 | - if ( WP_DEBUG ) { |
|
850 | - $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__ ); |
|
848 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
849 | + if (WP_DEBUG) { |
|
850 | + $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__); |
|
851 | 851 | } |
852 | - if ( ! defined( 'DOING_AJAX' )) { |
|
853 | - wp_die( $msg ); |
|
852 | + if ( ! defined('DOING_AJAX')) { |
|
853 | + wp_die($msg); |
|
854 | 854 | } else { |
855 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
855 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
856 | 856 | $this->_return_json(); |
857 | 857 | } |
858 | 858 | } |
@@ -870,63 +870,63 @@ discard block |
||
870 | 870 | * @return void |
871 | 871 | */ |
872 | 872 | protected function _route_admin_request() { |
873 | - if ( ! $this->_is_UI_request ) |
|
873 | + if ( ! $this->_is_UI_request) |
|
874 | 874 | $this->_verify_routes(); |
875 | 875 | |
876 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
876 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
877 | 877 | |
878 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
878 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
879 | 879 | // set nonce from post data |
880 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
881 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
880 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
881 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
882 | 882 | } |
883 | 883 | //set the nav_tabs array but ONLY if this is UI_request |
884 | - if ( $this->_is_UI_request ) |
|
884 | + if ($this->_is_UI_request) |
|
885 | 885 | $this->_set_nav_tabs(); |
886 | 886 | |
887 | 887 | // grab callback function |
888 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
888 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
889 | 889 | |
890 | 890 | // check if callback has args |
891 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
891 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
892 | 892 | |
893 | 893 | $error_msg = ''; |
894 | 894 | |
895 | 895 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
896 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
897 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
896 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
897 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | //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). |
901 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
901 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
902 | 902 | |
903 | - if ( ! empty( $func )) { |
|
903 | + if ( ! empty($func)) { |
|
904 | 904 | $base_call = $addon_call = FALSE; |
905 | 905 | //try to access page route via this class |
906 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
906 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
907 | 907 | // user error msg |
908 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
908 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
909 | 909 | // developer error msg |
910 | - $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 ); |
|
910 | + $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); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | //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) |
914 | 914 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
915 | 915 | |
916 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
917 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
918 | - $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 ); |
|
916 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
917 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
918 | + $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); |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | |
922 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
923 | - throw new EE_Error( $error_msg ); |
|
922 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
923 | + throw new EE_Error($error_msg); |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | //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. |
927 | 927 | //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. |
928 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
929 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
928 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
929 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
930 | 930 | } |
931 | 931 | } |
932 | 932 | |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | * @param string $new_route New (non header) route to redirect to. |
943 | 943 | * @return void |
944 | 944 | */ |
945 | - protected function _reset_routing_properties( $new_route ) { |
|
945 | + protected function _reset_routing_properties($new_route) { |
|
946 | 946 | $this->_is_UI_request = TRUE; |
947 | 947 | //now we set the current route to whatever the headers_sent_route is set at |
948 | 948 | $this->_req_data['action'] = $new_route; |
@@ -988,24 +988,24 @@ discard block |
||
988 | 988 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
989 | 989 | * @return string |
990 | 990 | */ |
991 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
991 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
992 | 992 | EE_Registry::instance()->load_helper('URL'); |
993 | 993 | |
994 | 994 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
995 | - if ( $sticky ) { |
|
995 | + if ($sticky) { |
|
996 | 996 | $request = $_REQUEST; |
997 | - unset( $request['_wp_http_referer'] ); |
|
998 | - unset( $request['wp_referer'] ); |
|
999 | - foreach ( $request as $key => $value ) { |
|
997 | + unset($request['_wp_http_referer']); |
|
998 | + unset($request['wp_referer']); |
|
999 | + foreach ($request as $key => $value) { |
|
1000 | 1000 | //do not add nonces |
1001 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1001 | + if (strpos($key, 'nonce') !== false) { |
|
1002 | 1002 | continue; |
1003 | 1003 | } |
1004 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1004 | + $args['wp_referer['.$key.']'] = $value; |
|
1005 | 1005 | } |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1008 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | |
@@ -1021,8 +1021,8 @@ discard block |
||
1021 | 1021 | * @uses EEH_Template::get_help_tab_link() |
1022 | 1022 | * @return string generated link |
1023 | 1023 | */ |
1024 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1025 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1024 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1025 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | |
@@ -1039,30 +1039,30 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | protected function _add_help_tabs() { |
1041 | 1041 | $tour_buttons = ''; |
1042 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1042 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1043 | 1043 | $config = $this->_page_config[$this->_req_action]; |
1044 | 1044 | |
1045 | 1045 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1046 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1046 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1047 | 1047 | $tb = array(); |
1048 | 1048 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1049 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1049 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1050 | 1050 | //if this is the end tour then we don't need to setup a button |
1051 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1051 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1052 | 1052 | continue; |
1053 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1053 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1054 | 1054 | } |
1055 | 1055 | $tour_buttons .= implode('<br />', $tb); |
1056 | 1056 | $tour_buttons .= '</div></div>'; |
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1060 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1060 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1061 | 1061 | //check that the callback given is valid |
1062 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1063 | - 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) ) ); |
|
1062 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1063 | + 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))); |
|
1064 | 1064 | |
1065 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1065 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1066 | 1066 | |
1067 | 1067 | $content .= $tour_buttons; //add help tour buttons. |
1068 | 1068 | |
@@ -1071,49 +1071,49 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1074 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1074 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1075 | 1075 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1079 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1079 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1080 | 1080 | $_ht['id'] = $this->page_slug; |
1081 | 1081 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1082 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1082 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1083 | 1083 | $this->_current_screen->add_help_tab($_ht); |
1084 | 1084 | }/**/ |
1085 | 1085 | |
1086 | 1086 | |
1087 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1087 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1088 | 1088 | |
1089 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1089 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1090 | 1090 | //we're here so there ARE help tabs! |
1091 | 1091 | |
1092 | 1092 | //make sure we've got what we need |
1093 | - if ( !isset( $cfg['title'] ) ) |
|
1094 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1093 | + if ( ! isset($cfg['title'])) |
|
1094 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1095 | 1095 | |
1096 | 1096 | |
1097 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1098 | - 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') ); |
|
1097 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1098 | + 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')); |
|
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | //first priority goes to content. |
1103 | - if ( !empty($cfg['content'] ) ) { |
|
1104 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1103 | + if ( ! empty($cfg['content'])) { |
|
1104 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1105 | 1105 | |
1106 | 1106 | //second priority goes to filename |
1107 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1108 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1107 | + } else if ( ! empty($cfg['filename'])) { |
|
1108 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1109 | 1109 | |
1110 | 1110 | |
1111 | 1111 | //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) |
1112 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1112 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1113 | 1113 | |
1114 | 1114 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1115 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1116 | - 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__ ); |
|
1115 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1116 | + 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__); |
|
1117 | 1117 | return; |
1118 | 1118 | } |
1119 | 1119 | $template_args['admin_page_obj'] = $this; |
@@ -1124,21 +1124,21 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | |
1126 | 1126 | //check if callback is valid |
1127 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1128 | - 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__ ); |
|
1127 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1128 | + 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__); |
|
1129 | 1129 | return; |
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | //setup config array for help tab method |
1133 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1133 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1134 | 1134 | $_ht = array( |
1135 | 1135 | 'id' => $id, |
1136 | 1136 | 'title' => $cfg['title'], |
1137 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1137 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1138 | 1138 | 'content' => $content |
1139 | 1139 | ); |
1140 | 1140 | |
1141 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1141 | + $this->_current_screen->add_help_tab($_ht); |
|
1142 | 1142 | } |
1143 | 1143 | } |
1144 | 1144 | } |
@@ -1158,49 +1158,49 @@ discard block |
||
1158 | 1158 | $this->_help_tour = array(); |
1159 | 1159 | |
1160 | 1160 | //exit early if help tours are turned off globally |
1161 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1161 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1162 | 1162 | return; |
1163 | 1163 | |
1164 | 1164 | //loop through _page_config to find any help_tour defined |
1165 | - foreach ( $this->_page_config as $route => $config ) { |
|
1165 | + foreach ($this->_page_config as $route => $config) { |
|
1166 | 1166 | //we're only going to set things up for this route |
1167 | - if ( $route !== $this->_req_action ) |
|
1167 | + if ($route !== $this->_req_action) |
|
1168 | 1168 | continue; |
1169 | 1169 | |
1170 | - if ( isset( $config['help_tour'] ) ) { |
|
1170 | + if (isset($config['help_tour'])) { |
|
1171 | 1171 | |
1172 | - foreach( $config['help_tour'] as $tour ) { |
|
1173 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1172 | + foreach ($config['help_tour'] as $tour) { |
|
1173 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1174 | 1174 | //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 |
1175 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1175 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1176 | 1176 | |
1177 | 1177 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1178 | - if ( !is_readable($file_path) ) { |
|
1179 | - 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__ ); |
|
1178 | + if ( ! is_readable($file_path)) { |
|
1179 | + 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__); |
|
1180 | 1180 | return; |
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | require_once $file_path; |
1184 | - if ( !class_exists( $tour ) ) { |
|
1185 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1186 | - $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) ); |
|
1187 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1184 | + if ( ! class_exists($tour)) { |
|
1185 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1186 | + $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)); |
|
1187 | + throw new EE_Error(implode('||', $error_msg)); |
|
1188 | 1188 | } |
1189 | 1189 | $a = new ReflectionClass($tour); |
1190 | 1190 | $tour_obj = $a->newInstance($this->_is_caf); |
1191 | 1191 | |
1192 | 1192 | $tours[] = $tour_obj; |
1193 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1193 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1197 | 1197 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1198 | 1198 | $tours[] = $end_stop_tour; |
1199 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1199 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1200 | 1200 | } |
1201 | 1201 | } |
1202 | 1202 | |
1203 | - if ( !empty( $tours ) ) |
|
1203 | + if ( ! empty($tours)) |
|
1204 | 1204 | $this->_help_tour['tours'] = $tours; |
1205 | 1205 | |
1206 | 1206 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1216,13 +1216,13 @@ discard block |
||
1216 | 1216 | * @return void |
1217 | 1217 | */ |
1218 | 1218 | protected function _add_qtips() { |
1219 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1219 | + if (isset($this->_route_config['qtips'])) { |
|
1220 | 1220 | $qtips = (array) $this->_route_config['qtips']; |
1221 | 1221 | //load qtip loader |
1222 | 1222 | EE_Registry::instance()->load_helper('Qtip_Loader', array(), TRUE); |
1223 | 1223 | $path = array( |
1224 | - $this->_get_dir() . '/qtips/', |
|
1225 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1224 | + $this->_get_dir().'/qtips/', |
|
1225 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1226 | 1226 | ); |
1227 | 1227 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1228 | 1228 | } |
@@ -1239,41 +1239,41 @@ discard block |
||
1239 | 1239 | * @return void |
1240 | 1240 | */ |
1241 | 1241 | protected function _set_nav_tabs() { |
1242 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1242 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1243 | 1243 | $i = 0; |
1244 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | + foreach ($this->_page_config as $slug => $config) { |
|
1245 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1246 | 1246 | continue; //no nav tab for this config |
1247 | 1247 | |
1248 | 1248 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1249 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1250 | 1250 | continue; //nav tab is only to appear when route requested. |
1251 | 1251 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1252 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1253 | 1253 | continue; //no nav tab becasue current user does not have access. |
1254 | 1254 | |
1255 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1255 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1256 | 1256 | $this->_nav_tabs[$slug] = array( |
1257 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1258 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1259 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1260 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1257 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1258 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1259 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1260 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1261 | 1261 | ); |
1262 | 1262 | $i++; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //if $this->_nav_tabs is empty then lets set the default |
1266 | - if ( empty( $this->_nav_tabs ) ) { |
|
1266 | + if (empty($this->_nav_tabs)) { |
|
1267 | 1267 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1268 | 1268 | 'url' => $this->admin_base_url, |
1269 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1269 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1270 | 1270 | 'css_class' => 'nav-tab-active', |
1271 | 1271 | 'order' => 10 |
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | //now let's sort the tabs according to order |
1276 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1276 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | */ |
1291 | 1291 | private function _set_current_labels() { |
1292 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1293 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1294 | - if ( is_array($text) ) { |
|
1295 | - foreach ( $text as $sublabel => $subtext ) { |
|
1292 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1293 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1294 | + if (is_array($text)) { |
|
1295 | + foreach ($text as $sublabel => $subtext) { |
|
1296 | 1296 | $this->_labels[$label][$sublabel] = $subtext; |
1297 | 1297 | } |
1298 | 1298 | } else { |
@@ -1313,24 +1313,24 @@ discard block |
||
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | 1314 | * @return BOOL|wp_die() |
1315 | 1315 | */ |
1316 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1317 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1318 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1319 | - $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 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1317 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1318 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1319 | + $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; |
|
1320 | 1320 | |
1321 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1322 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1321 | + if (empty($capability) && empty($route_to_check)) { |
|
1322 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1323 | 1323 | } else { |
1324 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1324 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1327 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1328 | 1328 | |
1329 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1330 | - if ( $verify_only ) { |
|
1329 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1330 | + if ($verify_only) { |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } else { |
1333 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1333 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | return TRUE; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $this->_add_admin_page_overlay(); |
1408 | 1408 | |
1409 | 1409 | //if metaboxes are present we need to add the nonce field |
1410 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1410 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1411 | 1411 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1412 | 1412 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1413 | 1413 | } |
@@ -1426,20 +1426,20 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | public function admin_footer_global() { |
1428 | 1428 | //dialog container for dialog helper |
1429 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1429 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1430 | 1430 | $d_cont .= '<div class="ee-notices"></div>'; |
1431 | 1431 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1432 | 1432 | $d_cont .= '</div>'; |
1433 | 1433 | echo $d_cont; |
1434 | 1434 | |
1435 | 1435 | //help tour stuff? |
1436 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1436 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1437 | 1437 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | //current set timezone for timezone js |
1441 | 1441 | EE_Registry::instance()->load_helper('DTT_Helper'); |
1442 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1442 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1443 | 1443 | } |
1444 | 1444 | |
1445 | 1445 | |
@@ -1463,18 +1463,18 @@ discard block |
||
1463 | 1463 | * @access protected |
1464 | 1464 | * @return string content |
1465 | 1465 | */ |
1466 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1466 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1467 | 1467 | $content = ''; |
1468 | 1468 | |
1469 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1470 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1469 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1470 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1471 | 1471 | |
1472 | 1472 | |
1473 | 1473 | //loop through the array and setup content |
1474 | - foreach ( $help_array as $trigger => $help ) { |
|
1474 | + foreach ($help_array as $trigger => $help) { |
|
1475 | 1475 | //make sure the array is setup properly |
1476 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1477 | - 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') ); |
|
1476 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1477 | + 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')); |
|
1478 | 1478 | } |
1479 | 1479 | |
1480 | 1480 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1484,10 +1484,10 @@ discard block |
||
1484 | 1484 | 'help_popup_content' => $help['content'] |
1485 | 1485 | ); |
1486 | 1486 | |
1487 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1487 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | - if ( $display ) |
|
1490 | + if ($display) |
|
1491 | 1491 | echo $content; |
1492 | 1492 | else |
1493 | 1493 | return $content; |
@@ -1504,18 +1504,18 @@ discard block |
||
1504 | 1504 | */ |
1505 | 1505 | private function _get_help_content() { |
1506 | 1506 | //what is the method we're looking for? |
1507 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1507 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1508 | 1508 | |
1509 | 1509 | //if method doesn't exist let's get out. |
1510 | - if ( !method_exists( $this, $method_name ) ) |
|
1510 | + if ( ! method_exists($this, $method_name)) |
|
1511 | 1511 | return array(); |
1512 | 1512 | |
1513 | 1513 | //k we're good to go let's retrieve the help array |
1514 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1514 | + $help_array = call_user_func(array($this, $method_name)); |
|
1515 | 1515 | |
1516 | 1516 | //make sure we've got an array! |
1517 | - if ( !is_array($help_array) ) { |
|
1518 | - 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' ) ); |
|
1517 | + if ( ! is_array($help_array)) { |
|
1518 | + 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')); |
|
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | return $help_array; |
@@ -1537,27 +1537,27 @@ discard block |
||
1537 | 1537 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1538 | 1538 | * @return string |
1539 | 1539 | */ |
1540 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1540 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1541 | 1541 | |
1542 | - if ( defined('DOING_AJAX') ) return; |
|
1542 | + if (defined('DOING_AJAX')) return; |
|
1543 | 1543 | |
1544 | 1544 | //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 |
1545 | 1545 | $help_array = $this->_get_help_content(); |
1546 | 1546 | $help_content = ''; |
1547 | 1547 | |
1548 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1548 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1549 | 1549 | $help_array[$trigger_id] = array( |
1550 | 1550 | 'title' => __('Missing Content', 'event_espresso'), |
1551 | 1551 | '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') |
1552 | 1552 | ); |
1553 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1553 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1554 | 1554 | } |
1555 | 1555 | |
1556 | 1556 | //let's setup the trigger |
1557 | - $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>'; |
|
1558 | - $content = $content . $help_content; |
|
1557 | + $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>'; |
|
1558 | + $content = $content.$help_content; |
|
1559 | 1559 | |
1560 | - if ( $display ) |
|
1560 | + if ($display) |
|
1561 | 1561 | echo $content; |
1562 | 1562 | else |
1563 | 1563 | return $content; |
@@ -1614,15 +1614,15 @@ discard block |
||
1614 | 1614 | public function load_global_scripts_styles() { |
1615 | 1615 | /** STYLES **/ |
1616 | 1616 | // add debugging styles |
1617 | - if ( WP_DEBUG ) { |
|
1618 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1617 | + if (WP_DEBUG) { |
|
1618 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1619 | 1619 | } |
1620 | 1620 | |
1621 | 1621 | //register all styles |
1622 | - 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 ); |
|
1623 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1622 | + 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); |
|
1623 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1624 | 1624 | //helpers styles |
1625 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1625 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1626 | 1626 | //enqueue global styles |
1627 | 1627 | wp_enqueue_style('ee-admin-css'); |
1628 | 1628 | |
@@ -1630,66 +1630,66 @@ discard block |
||
1630 | 1630 | /** SCRIPTS **/ |
1631 | 1631 | |
1632 | 1632 | //register all scripts |
1633 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1635 | - 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 ); |
|
1633 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1635 | + 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); |
|
1636 | 1636 | |
1637 | - 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 ); |
|
1637 | + 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); |
|
1638 | 1638 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1639 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1639 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1640 | 1640 | add_filter('FHEE_load_joyride', '__return_true'); |
1641 | 1641 | |
1642 | 1642 | //script for sorting tables |
1643 | - 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); |
|
1643 | + 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); |
|
1644 | 1644 | //script for parsing uri's |
1645 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1645 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1646 | 1646 | //and parsing associative serialized form elements |
1647 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1647 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1648 | 1648 | //helpers scripts |
1649 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1652 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1653 | 1653 | |
1654 | 1654 | //google charts |
1655 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1655 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1656 | 1656 | |
1657 | 1657 | //enqueue global scripts |
1658 | 1658 | |
1659 | 1659 | //taking care of metaboxes |
1660 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1660 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1661 | 1661 | wp_enqueue_script('dashboard'); |
1662 | 1662 | } |
1663 | 1663 | |
1664 | 1664 | //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 |
1665 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1665 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1666 | 1666 | wp_enqueue_script('ee_admin_js'); |
1667 | 1667 | wp_enqueue_style('ee-admin-css'); |
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | |
1671 | 1671 | //localize script for ajax lazy loading |
1672 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1673 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1672 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1673 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1674 | 1674 | |
1675 | 1675 | |
1676 | 1676 | /** |
1677 | 1677 | * help tour stuff |
1678 | 1678 | */ |
1679 | - if ( !empty( $this->_help_tour ) ) { |
|
1679 | + if ( ! empty($this->_help_tour)) { |
|
1680 | 1680 | |
1681 | 1681 | //register the js for kicking things off |
1682 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1682 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1683 | 1683 | |
1684 | 1684 | //setup tours for the js tour object |
1685 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1685 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1686 | 1686 | $tours[] = array( |
1687 | 1687 | 'id' => $tour->get_slug(), |
1688 | 1688 | 'options' => $tour->get_options() |
1689 | 1689 | ); |
1690 | 1690 | } |
1691 | 1691 | |
1692 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1692 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1693 | 1693 | |
1694 | 1694 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1695 | 1695 | } |
@@ -1707,52 +1707,52 @@ discard block |
||
1707 | 1707 | public function admin_footer_scripts_eei18n_js_strings() { |
1708 | 1708 | |
1709 | 1709 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1710 | - 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' ); |
|
1711 | - |
|
1712 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1736 | - |
|
1737 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1750 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1710 | + 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'); |
|
1711 | + |
|
1712 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1736 | + |
|
1737 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1750 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1751 | 1751 | |
1752 | 1752 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1753 | 1753 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1754 | 1754 | //espresso_core is listed as a dependency of ee_admin_js. |
1755 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1755 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1756 | 1756 | |
1757 | 1757 | } |
1758 | 1758 | |
@@ -1786,23 +1786,23 @@ discard block |
||
1786 | 1786 | protected function _set_list_table() { |
1787 | 1787 | |
1788 | 1788 | //first is this a list_table view? |
1789 | - if ( !isset($this->_route_config['list_table']) ) |
|
1789 | + if ( ! isset($this->_route_config['list_table'])) |
|
1790 | 1790 | return; //not a list_table view so get out. |
1791 | 1791 | |
1792 | 1792 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1793 | 1793 | |
1794 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1794 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1795 | 1795 | //user error msg |
1796 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1796 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1797 | 1797 | //developer error msg |
1798 | - $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 ); |
|
1799 | - throw new EE_Error( $error_msg ); |
|
1798 | + $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); |
|
1799 | + throw new EE_Error($error_msg); |
|
1800 | 1800 | } |
1801 | 1801 | |
1802 | 1802 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1805 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1805 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1806 | 1806 | |
1807 | 1807 | $this->_set_list_table_view(); |
1808 | 1808 | $this->_set_list_table_object(); |
@@ -1824,14 +1824,14 @@ discard block |
||
1824 | 1824 | * @return array |
1825 | 1825 | */ |
1826 | 1826 | protected function _set_list_table_view() { |
1827 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1827 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1828 | 1828 | |
1829 | 1829 | |
1830 | 1830 | // looking at active items or dumpster diving ? |
1831 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1832 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1831 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1832 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1833 | 1833 | } else { |
1834 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1834 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1835 | 1835 | } |
1836 | 1836 | } |
1837 | 1837 | |
@@ -1842,9 +1842,9 @@ discard block |
||
1842 | 1842 | * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of. |
1843 | 1843 | */ |
1844 | 1844 | protected function _set_list_table_object() { |
1845 | - if ( isset($this->_route_config['list_table'] ) ) { |
|
1846 | - if ( !class_exists( $this->_route_config['list_table'] ) ) |
|
1847 | - 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) ) ); |
|
1845 | + if (isset($this->_route_config['list_table'])) { |
|
1846 | + if ( ! class_exists($this->_route_config['list_table'])) |
|
1847 | + 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))); |
|
1848 | 1848 | $a = new ReflectionClass($this->_route_config['list_table']); |
1849 | 1849 | $this->_list_table_object = $a->newInstance($this); |
1850 | 1850 | } |
@@ -1863,27 +1863,27 @@ discard block |
||
1863 | 1863 | * |
1864 | 1864 | * @return array |
1865 | 1865 | */ |
1866 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1866 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1867 | 1867 | |
1868 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1868 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1869 | 1869 | |
1870 | - if ( empty( $this->_views )) { |
|
1870 | + if (empty($this->_views)) { |
|
1871 | 1871 | $this->_views = array(); |
1872 | 1872 | } |
1873 | 1873 | |
1874 | 1874 | // cycle thru views |
1875 | - foreach ( $this->_views as $key => $view ) { |
|
1875 | + foreach ($this->_views as $key => $view) { |
|
1876 | 1876 | $query_args = array(); |
1877 | 1877 | // check for current view |
1878 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1878 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1879 | 1879 | $query_args['action'] = $this->_req_action; |
1880 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1880 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1881 | 1881 | $query_args['status'] = $view['slug']; |
1882 | 1882 | //merge any other arguments sent in. |
1883 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1884 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1883 | + if (isset($extra_query_args[$view['slug']])) { |
|
1884 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1885 | 1885 | } |
1886 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1886 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1887 | 1887 | } |
1888 | 1888 | |
1889 | 1889 | return $this->_views; |
@@ -1900,15 +1900,15 @@ discard block |
||
1900 | 1900 | * @param int $max_entries total number of rows in the table |
1901 | 1901 | * @return string |
1902 | 1902 | */ |
1903 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1903 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1904 | 1904 | |
1905 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1906 | - $values = array( 10, 25, 50, 100 ); |
|
1907 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1905 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1906 | + $values = array(10, 25, 50, 100); |
|
1907 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1908 | 1908 | |
1909 | - if ( $max_entries ) { |
|
1909 | + if ($max_entries) { |
|
1910 | 1910 | $values[] = $max_entries; |
1911 | - sort( $values ); |
|
1911 | + sort($values); |
|
1912 | 1912 | } |
1913 | 1913 | |
1914 | 1914 | $entries_per_page_dropdown = ' |
@@ -1917,15 +1917,15 @@ discard block |
||
1917 | 1917 | Show |
1918 | 1918 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1919 | 1919 | |
1920 | - foreach ( $values as $value ) { |
|
1921 | - if ( $value < $max_entries ) { |
|
1922 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1920 | + foreach ($values as $value) { |
|
1921 | + if ($value < $max_entries) { |
|
1922 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1923 | 1923 | $entries_per_page_dropdown .= ' |
1924 | 1924 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1925 | 1925 | } |
1926 | 1926 | } |
1927 | 1927 | |
1928 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1928 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1929 | 1929 | $entries_per_page_dropdown .= ' |
1930 | 1930 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1931 | 1931 | |
@@ -1948,8 +1948,8 @@ discard block |
||
1948 | 1948 | * @return void |
1949 | 1949 | */ |
1950 | 1950 | public function _set_search_attributes() { |
1951 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1952 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1951 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1952 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1953 | 1953 | } |
1954 | 1954 | |
1955 | 1955 | /*** END LIST TABLE METHODS **/ |
@@ -1968,20 +1968,20 @@ discard block |
||
1968 | 1968 | * @return void |
1969 | 1969 | */ |
1970 | 1970 | private function _add_registered_meta_boxes() { |
1971 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1971 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1972 | 1972 | |
1973 | 1973 | //we only add meta boxes if the page_route calls for it |
1974 | - if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) { |
|
1974 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) { |
|
1975 | 1975 | |
1976 | 1976 | |
1977 | 1977 | //this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader. |
1978 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1979 | - if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) { |
|
1978 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1979 | + if (call_user_func(array($this, &$metabox_callback)) === FALSE) { |
|
1980 | 1980 | // user error msg |
1981 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
1981 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
1982 | 1982 | // developer error msg |
1983 | - $error_msg .= '||' . sprintf( __( '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.', 'event_espresso' ), $metabox_callback ); |
|
1984 | - throw new EE_Error( $error_msg ); |
|
1983 | + $error_msg .= '||'.sprintf(__('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.', 'event_espresso'), $metabox_callback); |
|
1984 | + throw new EE_Error($error_msg); |
|
1985 | 1985 | } |
1986 | 1986 | } |
1987 | 1987 | } |
@@ -1998,17 +1998,17 @@ discard block |
||
1998 | 1998 | * @return void |
1999 | 1999 | */ |
2000 | 2000 | private function _add_screen_columns() { |
2001 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
2001 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
2002 | 2002 | |
2003 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2003 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2004 | 2004 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2005 | 2005 | $screen_id = $this->_current_screen->id; |
2006 | 2006 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2007 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2008 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2007 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2008 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2009 | 2009 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2010 | 2010 | $this->_template_args['screen'] = $this->_current_screen; |
2011 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2011 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2012 | 2012 | |
2013 | 2013 | //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. |
2014 | 2014 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2025,11 +2025,11 @@ discard block |
||
2025 | 2025 | */ |
2026 | 2026 | |
2027 | 2027 | private function _espresso_news_post_box() { |
2028 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2029 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2028 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2029 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2030 | 2030 | $this, |
2031 | 2031 | 'espresso_news_post_box' |
2032 | - ), $this->_wp_page_slug, 'side' ); |
|
2032 | + ), $this->_wp_page_slug, 'side'); |
|
2033 | 2033 | } |
2034 | 2034 | |
2035 | 2035 | |
@@ -2037,14 +2037,14 @@ discard block |
||
2037 | 2037 | * Code for setting up espresso ratings request metabox. |
2038 | 2038 | */ |
2039 | 2039 | protected function _espresso_ratings_request() { |
2040 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2040 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2041 | 2041 | return ''; |
2042 | 2042 | } |
2043 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2044 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2043 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2044 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2045 | 2045 | $this, |
2046 | 2046 | 'espresso_ratings_request' |
2047 | - ), $this->_wp_page_slug, 'side' ); |
|
2047 | + ), $this->_wp_page_slug, 'side'); |
|
2048 | 2048 | } |
2049 | 2049 | |
2050 | 2050 | |
@@ -2052,35 +2052,35 @@ discard block |
||
2052 | 2052 | * Code for setting up espresso ratings request metabox content. |
2053 | 2053 | */ |
2054 | 2054 | public function espresso_ratings_request() { |
2055 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2056 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
2057 | - EEH_Template::display_template( $template_path, array() ); |
|
2055 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2056 | + EE_Registry::instance()->load_helper('Template'); |
|
2057 | + EEH_Template::display_template($template_path, array()); |
|
2058 | 2058 | } |
2059 | 2059 | |
2060 | 2060 | |
2061 | 2061 | |
2062 | 2062 | |
2063 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2064 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2065 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2066 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2067 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2068 | - $post = '</div>' . "\n"; |
|
2063 | + public static function cached_rss_display($rss_id, $url) { |
|
2064 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2065 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2066 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2067 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2068 | + $post = '</div>'."\n"; |
|
2069 | 2069 | |
2070 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2071 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2072 | - echo $pre . $output . $post; |
|
2070 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2071 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2072 | + echo $pre.$output.$post; |
|
2073 | 2073 | return TRUE; |
2074 | 2074 | } |
2075 | 2075 | |
2076 | - if ( ! $doing_ajax ) { |
|
2077 | - echo $pre . $loading . $post; |
|
2076 | + if ( ! $doing_ajax) { |
|
2077 | + echo $pre.$loading.$post; |
|
2078 | 2078 | return FALSE; |
2079 | 2079 | } |
2080 | 2080 | |
2081 | 2081 | ob_start(); |
2082 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2083 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2082 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2083 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2084 | 2084 | return TRUE; |
2085 | 2085 | |
2086 | 2086 | } |
@@ -2092,13 +2092,13 @@ discard block |
||
2092 | 2092 | <div id="espresso_news_post_box_content" class="infolinks"> |
2093 | 2093 | <?php |
2094 | 2094 | // Get RSS Feed(s) |
2095 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2095 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2096 | 2096 | $url = urlencode($feed_url); |
2097 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2097 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2098 | 2098 | |
2099 | 2099 | ?> |
2100 | 2100 | </div> |
2101 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2101 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2102 | 2102 | </div> |
2103 | 2103 | <?php |
2104 | 2104 | } |
@@ -2119,32 +2119,32 @@ discard block |
||
2119 | 2119 | |
2120 | 2120 | protected function _espresso_sponsors_post_box() { |
2121 | 2121 | |
2122 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2123 | - if ( $show_sponsors ) |
|
2124 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2122 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2123 | + if ($show_sponsors) |
|
2124 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2125 | 2125 | } |
2126 | 2126 | |
2127 | 2127 | |
2128 | 2128 | public function espresso_sponsors_post_box() { |
2129 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2130 | - EEH_Template::display_template( $templatepath ); |
|
2129 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2130 | + EEH_Template::display_template($templatepath); |
|
2131 | 2131 | } |
2132 | 2132 | |
2133 | 2133 | |
2134 | 2134 | |
2135 | 2135 | private function _publish_post_box() { |
2136 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2136 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2137 | 2137 | |
2138 | 2138 | //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) |
2139 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2140 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2139 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2140 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2141 | 2141 | } else { |
2142 | 2142 | $box_label = __('Publish', 'event_espresso'); |
2143 | 2143 | } |
2144 | 2144 | |
2145 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2145 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2146 | 2146 | |
2147 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2147 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2148 | 2148 | |
2149 | 2149 | } |
2150 | 2150 | |
@@ -2152,9 +2152,9 @@ discard block |
||
2152 | 2152 | |
2153 | 2153 | public function editor_overview() { |
2154 | 2154 | //if we have extra content set let's add it in if not make sure its empty |
2155 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2156 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2157 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2155 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2156 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2157 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2158 | 2158 | } |
2159 | 2159 | |
2160 | 2160 | |
@@ -2170,8 +2170,8 @@ discard block |
||
2170 | 2170 | * @see $this->_set_publish_post_box_vars for param details |
2171 | 2171 | * @since 4.6.0 |
2172 | 2172 | */ |
2173 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2174 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2173 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2174 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2175 | 2175 | } |
2176 | 2176 | |
2177 | 2177 | |
@@ -2190,24 +2190,24 @@ discard block |
||
2190 | 2190 | * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
2191 | 2191 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2192 | 2192 | */ |
2193 | - protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
|
2193 | + protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) { |
|
2194 | 2194 | |
2195 | 2195 | // if Save & Close, use a custom redirect URL or default to the main page? |
2196 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2196 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2197 | 2197 | // create the Save & Close and Save buttons |
2198 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2198 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2199 | 2199 | //if we have extra content set let's add it in if not make sure its empty |
2200 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2200 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2201 | 2201 | |
2202 | 2202 | |
2203 | - if ( $delete && ! empty( $id ) ) { |
|
2203 | + if ($delete && ! empty($id)) { |
|
2204 | 2204 | $delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent. |
2205 | - $delete_link_args = array( $name => $id ); |
|
2206 | - $delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2205 | + $delete_link_args = array($name => $id); |
|
2206 | + $delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2210 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2209 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2210 | + if ( ! empty($name) && ! empty($id)) { |
|
2211 | 2211 | $hidden_field_arr[$name] = array( |
2212 | 2212 | 'type' => 'hidden', |
2213 | 2213 | 'value' => $id |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | $hf = ''; |
2218 | 2218 | } |
2219 | 2219 | // add hidden field |
2220 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2220 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2221 | 2221 | |
2222 | 2222 | } |
2223 | 2223 | |
@@ -2234,8 +2234,8 @@ discard block |
||
2234 | 2234 | <noscript> |
2235 | 2235 | <div id="no-js-message" class="error"> |
2236 | 2236 | <p style="font-size:1.3em;"> |
2237 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2238 | - <?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' ); ?> |
|
2237 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2238 | + <?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'); ?> |
|
2239 | 2239 | </p> |
2240 | 2240 | </div> |
2241 | 2241 | </noscript> |
@@ -2255,7 +2255,7 @@ discard block |
||
2255 | 2255 | * @return string |
2256 | 2256 | */ |
2257 | 2257 | private function _display_espresso_notices() { |
2258 | - $notices = $this->_get_transient( TRUE ); |
|
2258 | + $notices = $this->_get_transient(TRUE); |
|
2259 | 2259 | echo stripslashes($notices); |
2260 | 2260 | } |
2261 | 2261 | |
@@ -2307,11 +2307,11 @@ discard block |
||
2307 | 2307 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2308 | 2308 | * @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. |
2309 | 2309 | */ |
2310 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2311 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2310 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2311 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2312 | 2312 | |
2313 | 2313 | //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. |
2314 | - if ( empty( $callback_args ) && $create_func ) { |
|
2314 | + if (empty($callback_args) && $create_func) { |
|
2315 | 2315 | $callback_args = array( |
2316 | 2316 | 'template_path' => $this->_template_path, |
2317 | 2317 | 'template_args' => $this->_template_args, |
@@ -2321,7 +2321,7 @@ discard block |
||
2321 | 2321 | //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) |
2322 | 2322 | $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; |
2323 | 2323 | |
2324 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2324 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2325 | 2325 | } |
2326 | 2326 | |
2327 | 2327 | |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | */ |
2335 | 2335 | public function display_admin_page_with_metabox_columns() { |
2336 | 2336 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2337 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2337 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2338 | 2338 | |
2339 | 2339 | //the final wrapper |
2340 | 2340 | $this->admin_page_wrapper(); |
@@ -2377,7 +2377,7 @@ discard block |
||
2377 | 2377 | * @return void |
2378 | 2378 | */ |
2379 | 2379 | public function display_about_admin_page() { |
2380 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2380 | + $this->_display_admin_page(FALSE, TRUE); |
|
2381 | 2381 | } |
2382 | 2382 | |
2383 | 2383 | |
@@ -2393,26 +2393,26 @@ discard block |
||
2393 | 2393 | * @return html admin_page |
2394 | 2394 | */ |
2395 | 2395 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2396 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2396 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2397 | 2397 | |
2398 | 2398 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2399 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2399 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2400 | 2400 | |
2401 | 2401 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2402 | 2402 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2403 | 2403 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2404 | 2404 | |
2405 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2405 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2406 | 2406 | |
2407 | - if ( defined('DOING_AJAX' ) ) |
|
2408 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2407 | + if (defined('DOING_AJAX')) |
|
2408 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2409 | 2409 | |
2410 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2410 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2411 | 2411 | |
2412 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2412 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2413 | 2413 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2414 | 2414 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2415 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2415 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2416 | 2416 | |
2417 | 2417 | |
2418 | 2418 | // the final template wrapper |
@@ -2432,7 +2432,7 @@ discard block |
||
2432 | 2432 | * @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. |
2433 | 2433 | * @return void |
2434 | 2434 | */ |
2435 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2435 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2436 | 2436 | //let's generate a default preview action button if there isn't one already present. |
2437 | 2437 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2438 | 2438 | $buy_now_url = add_query_arg( |
@@ -2445,10 +2445,10 @@ discard block |
||
2445 | 2445 | ), |
2446 | 2446 | 'http://eventespresso.com/pricing/' |
2447 | 2447 | ); |
2448 | - $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']; |
|
2449 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2450 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2451 | - $this->_display_admin_page( $display_sidebar ); |
|
2448 | + $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']; |
|
2449 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2450 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2451 | + $this->_display_admin_page($display_sidebar); |
|
2452 | 2452 | } |
2453 | 2453 | |
2454 | 2454 | |
@@ -2482,41 +2482,41 @@ discard block |
||
2482 | 2482 | * @param boolean $sidebar whether to display with sidebar or not. |
2483 | 2483 | * @return html |
2484 | 2484 | */ |
2485 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2485 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2486 | 2486 | //setup search attributes |
2487 | 2487 | $this->_set_search_attributes(); |
2488 | 2488 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2489 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2489 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2490 | 2490 | |
2491 | - $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); |
|
2491 | + $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); |
|
2492 | 2492 | $this->_template_args['list_table'] = $this->_list_table_object; |
2493 | 2493 | $this->_template_args['current_route'] = $this->_req_action; |
2494 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2494 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2495 | 2495 | |
2496 | 2496 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2497 | - if( ! empty( $ajax_sorting_callback )) { |
|
2498 | - $sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE ); |
|
2497 | + if ( ! empty($ajax_sorting_callback)) { |
|
2498 | + $sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE); |
|
2499 | 2499 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2500 | 2500 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2501 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2502 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2501 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2502 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2503 | 2503 | } else { |
2504 | 2504 | $sortable_list_table_form_fields = ''; |
2505 | 2505 | } |
2506 | 2506 | |
2507 | 2507 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2508 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2509 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2510 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2508 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2509 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2510 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2511 | 2511 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2512 | 2512 | |
2513 | 2513 | //display message about search results? |
2514 | - $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 ); |
|
2514 | + $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); |
|
2515 | 2515 | |
2516 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2516 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2517 | 2517 | |
2518 | 2518 | // the final template wrapper |
2519 | - if ( $sidebar ) |
|
2519 | + if ($sidebar) |
|
2520 | 2520 | $this->display_admin_page_with_sidebar(); |
2521 | 2521 | else |
2522 | 2522 | $this->display_admin_page_with_no_sidebar(); |
@@ -2539,9 +2539,9 @@ discard block |
||
2539 | 2539 | * @param array $items see above for format of array |
2540 | 2540 | * @return string html string of legend |
2541 | 2541 | */ |
2542 | - protected function _display_legend( $items ) { |
|
2543 | - $template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2544 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2542 | + protected function _display_legend($items) { |
|
2543 | + $template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2544 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2545 | 2545 | return EEH_Template::display_template($legend_template, $template_args, TRUE); |
2546 | 2546 | } |
2547 | 2547 | |
@@ -2566,33 +2566,33 @@ discard block |
||
2566 | 2566 | * |
2567 | 2567 | * @return json object |
2568 | 2568 | */ |
2569 | - protected function _return_json( $sticky_notices = false ) { |
|
2569 | + protected function _return_json($sticky_notices = false) { |
|
2570 | 2570 | |
2571 | 2571 | //make sure any EE_Error notices have been handled. |
2572 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2572 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2573 | 2573 | |
2574 | 2574 | |
2575 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2575 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2576 | 2576 | unset($this->_template_args['data']); |
2577 | 2577 | $json = array( |
2578 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2579 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2580 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2581 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2578 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2579 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2580 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2581 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2582 | 2582 | 'notices' => EE_Error::get_notices(), |
2583 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2584 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2583 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2584 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2585 | 2585 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2586 | 2586 | ); |
2587 | 2587 | |
2588 | 2588 | |
2589 | 2589 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2590 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2590 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2591 | 2591 | header('Content-Type: application/json; charset=UTF-8'); |
2592 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2593 | - echo wp_json_encode( $json ); |
|
2592 | + if (function_exists('wp_json_encode')) { |
|
2593 | + echo wp_json_encode($json); |
|
2594 | 2594 | } else { |
2595 | - echo json_encode( $json ); |
|
2595 | + echo json_encode($json); |
|
2596 | 2596 | } |
2597 | 2597 | exit(); |
2598 | 2598 | } |
@@ -2604,11 +2604,11 @@ discard block |
||
2604 | 2604 | * @return json_obj|EE_Error |
2605 | 2605 | */ |
2606 | 2606 | public function return_json() { |
2607 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2607 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2608 | 2608 | $this->_return_json(); |
2609 | 2609 | |
2610 | 2610 | else { |
2611 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2611 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2612 | 2612 | } |
2613 | 2613 | } |
2614 | 2614 | |
@@ -2623,7 +2623,7 @@ discard block |
||
2623 | 2623 | * @access public |
2624 | 2624 | * @return void |
2625 | 2625 | */ |
2626 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2626 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2627 | 2627 | $this->_hook_obj = $hook_obj; |
2628 | 2628 | } |
2629 | 2629 | |
@@ -2639,33 +2639,33 @@ discard block |
||
2639 | 2639 | */ |
2640 | 2640 | public function admin_page_wrapper($about = FALSE) { |
2641 | 2641 | |
2642 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2642 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2643 | 2643 | |
2644 | 2644 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2645 | 2645 | |
2646 | 2646 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2647 | 2647 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2648 | 2648 | |
2649 | - $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'] : ''); |
|
2650 | - $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'] : ''); |
|
2649 | + $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'] : ''); |
|
2650 | + $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'] : ''); |
|
2651 | 2651 | |
2652 | 2652 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2653 | 2653 | |
2654 | 2654 | |
2655 | 2655 | |
2656 | 2656 | // load settings page wrapper template |
2657 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2657 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2658 | 2658 | |
2659 | 2659 | //about page? |
2660 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2660 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2661 | 2661 | |
2662 | 2662 | |
2663 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2664 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2663 | + if (defined('DOING_AJAX')) { |
|
2664 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2665 | 2665 | |
2666 | 2666 | $this->_return_json(); |
2667 | 2667 | } else { |
2668 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2668 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2669 | 2669 | } |
2670 | 2670 | |
2671 | 2671 | } |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | */ |
2679 | 2679 | protected function _get_main_nav_tabs() { |
2680 | 2680 | //let's generate the html using the EEH_Tabbed_Content helper. We do this here so that it's possible for child classes to add in nav tabs dynamically at the last minute (rather than setting in the page_routes array) |
2681 | - EE_Registry::instance()->load_helper( 'Tabbed_Content' ); |
|
2681 | + EE_Registry::instance()->load_helper('Tabbed_Content'); |
|
2682 | 2682 | return EEH_Tabbed_Content::display_admin_nav_tabs($this->_nav_tabs); |
2683 | 2683 | } |
2684 | 2684 | |
@@ -2694,7 +2694,7 @@ discard block |
||
2694 | 2694 | * @access public |
2695 | 2695 | * @return void |
2696 | 2696 | */ |
2697 | - private function _sort_nav_tabs( $a, $b ) { |
|
2697 | + private function _sort_nav_tabs($a, $b) { |
|
2698 | 2698 | if ($a['order'] == $b['order']) { |
2699 | 2699 | return 0; |
2700 | 2700 | } |
@@ -2715,8 +2715,8 @@ discard block |
||
2715 | 2715 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2716 | 2716 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2717 | 2717 | */ |
2718 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2719 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
2718 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2719 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
2720 | 2720 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2721 | 2721 | return $content; |
2722 | 2722 | } |
@@ -2738,25 +2738,25 @@ discard block |
||
2738 | 2738 | * @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. |
2739 | 2739 | * @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). |
2740 | 2740 | */ |
2741 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2741 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2742 | 2742 | //make sure $text and $actions are in an array |
2743 | 2743 | $text = (array) $text; |
2744 | 2744 | $actions = (array) $actions; |
2745 | 2745 | $referrer_url = empty($referrer) ? '' : $referrer; |
2746 | - $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 .'" />'; |
|
2746 | + $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.'" />'; |
|
2747 | 2747 | |
2748 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2749 | - $default_names = array( 'save', 'save_and_close' ); |
|
2748 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2749 | + $default_names = array('save', 'save_and_close'); |
|
2750 | 2750 | |
2751 | 2751 | //add in a hidden index for the current page (so save and close redirects properly) |
2752 | 2752 | $this->_template_args['save_buttons'] = $referrer_url; |
2753 | 2753 | |
2754 | - foreach ( $button_text as $key => $button ) { |
|
2754 | + foreach ($button_text as $key => $button) { |
|
2755 | 2755 | $ref = $default_names[$key]; |
2756 | - $id = $this->_current_view . '_' . $ref; |
|
2757 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2758 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2759 | - if ( !$both ) break; |
|
2756 | + $id = $this->_current_view.'_'.$ref; |
|
2757 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2758 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2759 | + if ( ! $both) break; |
|
2760 | 2760 | } |
2761 | 2761 | |
2762 | 2762 | } |
@@ -2769,8 +2769,8 @@ discard block |
||
2769 | 2769 | * @since 4.6.0 |
2770 | 2770 | * |
2771 | 2771 | */ |
2772 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2773 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2772 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2773 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2774 | 2774 | } |
2775 | 2775 | |
2776 | 2776 | |
@@ -2783,30 +2783,30 @@ discard block |
||
2783 | 2783 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2784 | 2784 | * @return void |
2785 | 2785 | */ |
2786 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2786 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2787 | 2787 | |
2788 | - if ( empty( $route )) { |
|
2788 | + if (empty($route)) { |
|
2789 | 2789 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2790 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2791 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2790 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2791 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2792 | 2792 | } |
2793 | 2793 | // open form |
2794 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2794 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2795 | 2795 | // add nonce |
2796 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2796 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2797 | 2797 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2798 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2798 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2799 | 2799 | // add REQUIRED form action |
2800 | 2800 | $hidden_fields = array( |
2801 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2801 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2802 | 2802 | ); |
2803 | 2803 | // merge arrays |
2804 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2804 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2805 | 2805 | // generate form fields |
2806 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2806 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2807 | 2807 | // add fields to form |
2808 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2809 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2808 | + foreach ($form_fields as $field_name => $form_field) { |
|
2809 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2810 | 2810 | } |
2811 | 2811 | |
2812 | 2812 | // close form |
@@ -2823,8 +2823,8 @@ discard block |
||
2823 | 2823 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2824 | 2824 | * @since 4.5.0 |
2825 | 2825 | */ |
2826 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2827 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2826 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2827 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2828 | 2828 | } |
2829 | 2829 | |
2830 | 2830 | |
@@ -2840,32 +2840,32 @@ discard block |
||
2840 | 2840 | * @access protected |
2841 | 2841 | * @return void |
2842 | 2842 | */ |
2843 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2843 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2844 | 2844 | |
2845 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2845 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2846 | 2846 | |
2847 | 2847 | //class name for actions/filters. |
2848 | 2848 | $classname = get_class($this); |
2849 | 2849 | |
2850 | 2850 | //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 |
2851 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2852 | - $notices = EE_Error::get_notices( FALSE ); |
|
2851 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2852 | + $notices = EE_Error::get_notices(FALSE); |
|
2853 | 2853 | |
2854 | 2854 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2855 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2855 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2856 | 2856 | EE_Error::overwrite_success(); |
2857 | 2857 | } |
2858 | 2858 | // how many records affected ? more than one record ? or just one ? |
2859 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2859 | + if ($success > 1 && empty($notices['errors'])) { |
|
2860 | 2860 | // set plural msg |
2861 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2862 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2861 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2862 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2863 | 2863 | // set singular msg |
2864 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2864 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2865 | 2865 | } |
2866 | 2866 | |
2867 | 2867 | // check that $query_args isn't something crazy |
2868 | - if ( ! is_array( $query_args )) { |
|
2868 | + if ( ! is_array($query_args)) { |
|
2869 | 2869 | $query_args = array(); |
2870 | 2870 | } |
2871 | 2871 | |
@@ -2878,36 +2878,36 @@ discard block |
||
2878 | 2878 | * @param array $query_args The original query_args array coming into the |
2879 | 2879 | * method. |
2880 | 2880 | */ |
2881 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2881 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2882 | 2882 | |
2883 | 2883 | //calculate where we're going (if we have a "save and close" button pushed) |
2884 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2884 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2885 | 2885 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2886 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2886 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2887 | 2887 | // regenerate query args array from refferer URL |
2888 | - parse_str( $parsed_url['query'], $query_args ); |
|
2888 | + parse_str($parsed_url['query'], $query_args); |
|
2889 | 2889 | // correct page and action will be in the query args now |
2890 | - $redirect_url = admin_url( 'admin.php' ); |
|
2890 | + $redirect_url = admin_url('admin.php'); |
|
2891 | 2891 | } |
2892 | 2892 | |
2893 | 2893 | //merge any default query_args set in _default_route_query_args property |
2894 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2894 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2895 | 2895 | $args_to_merge = array(); |
2896 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2896 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2897 | 2897 | //is there a wp_referer array in our _default_route_query_args property? |
2898 | - if ( $query_param == 'wp_referer' ) { |
|
2898 | + if ($query_param == 'wp_referer') { |
|
2899 | 2899 | $query_value = (array) $query_value; |
2900 | - foreach ( $query_value as $reference => $value ) { |
|
2901 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2900 | + foreach ($query_value as $reference => $value) { |
|
2901 | + if (strpos($reference, 'nonce') !== false) { |
|
2902 | 2902 | continue; |
2903 | 2903 | } |
2904 | 2904 | |
2905 | 2905 | //finally we will override any arguments in the referer with |
2906 | 2906 | //what might be set on the _default_route_query_args array. |
2907 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2908 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2907 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2908 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2909 | 2909 | } else { |
2910 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2910 | + $args_to_merge[$reference] = urlencode($value); |
|
2911 | 2911 | } |
2912 | 2912 | } |
2913 | 2913 | continue; |
@@ -2918,7 +2918,7 @@ discard block |
||
2918 | 2918 | |
2919 | 2919 | //now let's merge these arguments but override with what was specifically sent in to the |
2920 | 2920 | //redirect. |
2921 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2921 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2922 | 2922 | } |
2923 | 2923 | |
2924 | 2924 | $this->_process_notices($query_args); |
@@ -2927,19 +2927,19 @@ discard block |
||
2927 | 2927 | // generate redirect url |
2928 | 2928 | |
2929 | 2929 | // if redirecting to anything other than the main page, add a nonce |
2930 | - if ( isset( $query_args['action'] )) { |
|
2930 | + if (isset($query_args['action'])) { |
|
2931 | 2931 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
2932 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
2932 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
2933 | 2933 | } |
2934 | 2934 | |
2935 | 2935 | //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). |
2936 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
2936 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
2937 | 2937 | |
2938 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
2938 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
2939 | 2939 | |
2940 | 2940 | |
2941 | 2941 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
2942 | - if ( defined('DOING_AJAX' ) ) { |
|
2942 | + if (defined('DOING_AJAX')) { |
|
2943 | 2943 | $default_data = array( |
2944 | 2944 | 'close' => TRUE, |
2945 | 2945 | 'redirect_url' => $redirect_url, |
@@ -2948,11 +2948,11 @@ discard block |
||
2948 | 2948 | ); |
2949 | 2949 | |
2950 | 2950 | $this->_template_args['success'] = $success; |
2951 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
2951 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
2952 | 2952 | $this->_return_json(); |
2953 | 2953 | } |
2954 | 2954 | |
2955 | - wp_safe_redirect( $redirect_url ); |
|
2955 | + wp_safe_redirect($redirect_url); |
|
2956 | 2956 | exit(); |
2957 | 2957 | } |
2958 | 2958 | |
@@ -2968,30 +2968,30 @@ discard block |
||
2968 | 2968 | * @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. |
2969 | 2969 | * @return void |
2970 | 2970 | */ |
2971 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
2971 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
2972 | 2972 | |
2973 | 2973 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
2974 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
2975 | - $notices = EE_Error::get_notices( false ); |
|
2976 | - if ( empty( $this->_template_args['success'] ) ) { |
|
2977 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
2974 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2975 | + $notices = EE_Error::get_notices(false); |
|
2976 | + if (empty($this->_template_args['success'])) { |
|
2977 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
2978 | 2978 | } |
2979 | 2979 | |
2980 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
2981 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
2980 | + if (empty($this->_template_args['errors'])) { |
|
2981 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
2982 | 2982 | } |
2983 | 2983 | |
2984 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
2985 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
2984 | + if (empty($this->_template_args['attention'])) { |
|
2985 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
2986 | 2986 | } |
2987 | 2987 | } |
2988 | 2988 | |
2989 | 2989 | $this->_template_args['notices'] = EE_Error::get_notices(); |
2990 | 2990 | |
2991 | 2991 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
2992 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
2993 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
2994 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
2992 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
2993 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
2994 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
2995 | 2995 | } |
2996 | 2996 | } |
2997 | 2997 | |
@@ -3013,32 +3013,32 @@ discard block |
||
3013 | 3013 | * |
3014 | 3014 | * @return string html for button |
3015 | 3015 | */ |
3016 | - public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) { |
|
3016 | + public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) { |
|
3017 | 3017 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3018 | - if ( !isset($this->_page_routes[$action]) && !$base_url ) |
|
3019 | - throw new EE_Error( sprintf( __('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action) ); |
|
3018 | + if ( ! isset($this->_page_routes[$action]) && ! $base_url) |
|
3019 | + throw new EE_Error(sprintf(__('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action)); |
|
3020 | 3020 | |
3021 | - if ( !isset( $this->_labels['buttons'][$type] ) ) |
|
3022 | - 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) ); |
|
3021 | + if ( ! isset($this->_labels['buttons'][$type])) |
|
3022 | + 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)); |
|
3023 | 3023 | |
3024 | 3024 | //finally check user access for this button. |
3025 | - $has_access = $this->check_user_access( $action, TRUE ); |
|
3026 | - if ( ! $has_access ) { |
|
3025 | + $has_access = $this->check_user_access($action, TRUE); |
|
3026 | + if ( ! $has_access) { |
|
3027 | 3027 | return ''; |
3028 | 3028 | } |
3029 | 3029 | |
3030 | - $_base_url = !$base_url ? $this->_admin_base_url : $base_url; |
|
3030 | + $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
|
3031 | 3031 | |
3032 | 3032 | $query_args = array( |
3033 | 3033 | 'action' => $action ); |
3034 | 3034 | |
3035 | 3035 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3036 | - if ( !empty($extra_request) ) |
|
3037 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3036 | + if ( ! empty($extra_request)) |
|
3037 | + $query_args = array_merge($extra_request, $query_args); |
|
3038 | 3038 | |
3039 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3039 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3040 | 3040 | |
3041 | - $button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class ); |
|
3041 | + $button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3042 | 3042 | |
3043 | 3043 | return $button; |
3044 | 3044 | } |
@@ -3058,11 +3058,11 @@ discard block |
||
3058 | 3058 | $args = array( |
3059 | 3059 | 'label' => $this->_admin_page_title, |
3060 | 3060 | 'default' => 10, |
3061 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3061 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3062 | 3062 | ); |
3063 | 3063 | //ONLY add the screen option if the user has access to it. |
3064 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3065 | - add_screen_option( $option, $args ); |
|
3064 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3065 | + add_screen_option($option, $args); |
|
3066 | 3066 | } |
3067 | 3067 | } |
3068 | 3068 | |
@@ -3078,36 +3078,36 @@ discard block |
||
3078 | 3078 | * @return void |
3079 | 3079 | */ |
3080 | 3080 | private function _set_per_page_screen_options() { |
3081 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3082 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3081 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3082 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3083 | 3083 | |
3084 | - if ( !$user = wp_get_current_user() ) |
|
3084 | + if ( ! $user = wp_get_current_user()) |
|
3085 | 3085 | return; |
3086 | 3086 | $option = $_POST['wp_screen_options']['option']; |
3087 | 3087 | $value = $_POST['wp_screen_options']['value']; |
3088 | 3088 | |
3089 | - if ( $option != sanitize_key( $option ) ) |
|
3089 | + if ($option != sanitize_key($option)) |
|
3090 | 3090 | return; |
3091 | 3091 | |
3092 | 3092 | $map_option = $option; |
3093 | 3093 | |
3094 | 3094 | $option = str_replace('-', '_', $option); |
3095 | 3095 | |
3096 | - switch ( $map_option ) { |
|
3097 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3096 | + switch ($map_option) { |
|
3097 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3098 | 3098 | $value = (int) $value; |
3099 | - if ( $value < 1 || $value > 999 ) |
|
3099 | + if ($value < 1 || $value > 999) |
|
3100 | 3100 | return; |
3101 | 3101 | break; |
3102 | 3102 | default: |
3103 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3104 | - if ( false === $value ) |
|
3103 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3104 | + if (false === $value) |
|
3105 | 3105 | return; |
3106 | 3106 | break; |
3107 | 3107 | } |
3108 | 3108 | |
3109 | 3109 | update_user_meta($user->ID, $option, $value); |
3110 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3110 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3111 | 3111 | exit; |
3112 | 3112 | } |
3113 | 3113 | } |
@@ -3118,8 +3118,8 @@ discard block |
||
3118 | 3118 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3119 | 3119 | * @param array $data array that will be assigned to template args. |
3120 | 3120 | */ |
3121 | - public function set_template_args( $data ) { |
|
3122 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3121 | + public function set_template_args($data) { |
|
3122 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3123 | 3123 | } |
3124 | 3124 | |
3125 | 3125 | |
@@ -3135,26 +3135,26 @@ discard block |
||
3135 | 3135 | * @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. |
3136 | 3136 | * @return void |
3137 | 3137 | */ |
3138 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3138 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3139 | 3139 | $user_id = get_current_user_id(); |
3140 | 3140 | |
3141 | - if ( !$skip_route_verify ) |
|
3141 | + if ( ! $skip_route_verify) |
|
3142 | 3142 | $this->_verify_route($route); |
3143 | 3143 | |
3144 | 3144 | |
3145 | 3145 | //now let's set the string for what kind of transient we're setting |
3146 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3147 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3146 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3147 | + $data = $notices ? array('notices' => $data) : $data; |
|
3148 | 3148 | //is there already a transient for this route? If there is then let's ADD to that transient |
3149 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3150 | - if ( $existing ) { |
|
3151 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3149 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3150 | + if ($existing) { |
|
3151 | + $data = array_merge((array) $data, (array) $existing); |
|
3152 | 3152 | } |
3153 | 3153 | |
3154 | - if ( is_multisite() && is_network_admin() ) { |
|
3155 | - set_site_transient( $transient, $data, 8 ); |
|
3154 | + if (is_multisite() && is_network_admin()) { |
|
3155 | + set_site_transient($transient, $data, 8); |
|
3156 | 3156 | } else { |
3157 | - set_transient( $transient, $data, 8 ); |
|
3157 | + set_transient($transient, $data, 8); |
|
3158 | 3158 | } |
3159 | 3159 | } |
3160 | 3160 | |
@@ -3166,18 +3166,18 @@ discard block |
||
3166 | 3166 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3167 | 3167 | * @return mixed data |
3168 | 3168 | */ |
3169 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3169 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3170 | 3170 | $user_id = get_current_user_id(); |
3171 | - $route = !$route ? $this->_req_action : $route; |
|
3172 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3173 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3171 | + $route = ! $route ? $this->_req_action : $route; |
|
3172 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3173 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3174 | 3174 | //delete transient after retrieval (just in case it hasn't expired); |
3175 | - if ( is_multisite() && is_network_admin() ) { |
|
3176 | - delete_site_transient( $transient ); |
|
3175 | + if (is_multisite() && is_network_admin()) { |
|
3176 | + delete_site_transient($transient); |
|
3177 | 3177 | } else { |
3178 | - delete_transient( $transient ); |
|
3178 | + delete_transient($transient); |
|
3179 | 3179 | } |
3180 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3180 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3181 | 3181 | } |
3182 | 3182 | |
3183 | 3183 | |
@@ -3194,12 +3194,12 @@ discard block |
||
3194 | 3194 | |
3195 | 3195 | //retrieve all existing transients |
3196 | 3196 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3197 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3198 | - foreach ( $results as $result ) { |
|
3199 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3200 | - get_transient( $transient ); |
|
3201 | - if ( is_multisite() && is_network_admin() ) { |
|
3202 | - get_site_transient( $transient ); |
|
3197 | + if ($results = $wpdb->get_results($query)) { |
|
3198 | + foreach ($results as $result) { |
|
3199 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3200 | + get_transient($transient); |
|
3201 | + if (is_multisite() && is_network_admin()) { |
|
3202 | + get_site_transient($transient); |
|
3203 | 3203 | } |
3204 | 3204 | } |
3205 | 3205 | } |
@@ -3323,23 +3323,23 @@ discard block |
||
3323 | 3323 | * @param string $line line no where error occurred |
3324 | 3324 | * @return boolean |
3325 | 3325 | */ |
3326 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3326 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3327 | 3327 | |
3328 | 3328 | //remove any options that are NOT going to be saved with the config settings. |
3329 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3329 | + if (isset($config->core->ee_ueip_optin)) { |
|
3330 | 3330 | $config->core->ee_ueip_has_notified = TRUE; |
3331 | 3331 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3332 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3333 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3332 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3333 | + update_option('ee_ueip_has_notified', TRUE); |
|
3334 | 3334 | } |
3335 | 3335 | // and save it (note we're also doing the network save here) |
3336 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3337 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3338 | - if ( $config_saved && $net_saved ) { |
|
3339 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3336 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3337 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3338 | + if ($config_saved && $net_saved) { |
|
3339 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3340 | 3340 | return TRUE; |
3341 | 3341 | } else { |
3342 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3342 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3343 | 3343 | return FALSE; |
3344 | 3344 | } |
3345 | 3345 | } |
@@ -3352,7 +3352,7 @@ discard block |
||
3352 | 3352 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3353 | 3353 | * @return array |
3354 | 3354 | */ |
3355 | - public function get_yes_no_values(){ |
|
3355 | + public function get_yes_no_values() { |
|
3356 | 3356 | return $this->_yes_no_values; |
3357 | 3357 | } |
3358 | 3358 | |
@@ -3374,8 +3374,8 @@ discard block |
||
3374 | 3374 | * |
3375 | 3375 | * @return string |
3376 | 3376 | */ |
3377 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3378 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3377 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3378 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3379 | 3379 | } |
3380 | 3380 | |
3381 | 3381 | |
@@ -3389,8 +3389,8 @@ discard block |
||
3389 | 3389 | * |
3390 | 3390 | * @return string |
3391 | 3391 | */ |
3392 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3393 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3392 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3393 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3394 | 3394 | } |
3395 | 3395 | |
3396 | 3396 | |
@@ -3409,8 +3409,8 @@ discard block |
||
3409 | 3409 | * @return bool success/fail |
3410 | 3410 | */ |
3411 | 3411 | protected function _process_resend_registration() { |
3412 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3413 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3412 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3413 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3414 | 3414 | return $this->_template_args['success']; |
3415 | 3415 | } |
3416 | 3416 | |
@@ -3423,9 +3423,9 @@ discard block |
||
3423 | 3423 | * @param \EE_Payment $payment |
3424 | 3424 | * @return bool success/fail |
3425 | 3425 | */ |
3426 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3427 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3428 | - $success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment ); |
|
3426 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3427 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3428 | + $success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment); |
|
3429 | 3429 | $this->_template_args['success'] = $success; |
3430 | 3430 | return $success; |
3431 | 3431 | } |
@@ -22,32 +22,32 @@ discard block |
||
22 | 22 | * @param EE_Response $response |
23 | 23 | * @return EE_Response |
24 | 24 | */ |
25 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
25 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
26 | 26 | $this->_request = $request; |
27 | 27 | $this->_response = $response; |
28 | 28 | //$this->_response->add_output( "\n\t IN >> " . __CLASS__ ); |
29 | 29 | //$this->_response->set_notice( 1, 'hey look at this' ); |
30 | 30 | // check required WP version |
31 | - if ( ! $this->_minimum_wp_version_required() ) { |
|
32 | - $this->_request->un_set( 'activate', true ); |
|
33 | - add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 ); |
|
31 | + if ( ! $this->_minimum_wp_version_required()) { |
|
32 | + $this->_request->un_set('activate', true); |
|
33 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
34 | 34 | //$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
35 | 35 | $this->_response->terminate_request(); |
36 | 36 | $this->_response->deactivate_plugin(); |
37 | 37 | } |
38 | 38 | // check required PHP version |
39 | - if ( ! $this->_minimum_php_version_required() ) { |
|
40 | - $this->_request->un_set( 'activate', true ); |
|
41 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
39 | + if ( ! $this->_minimum_php_version_required()) { |
|
40 | + $this->_request->un_set('activate', true); |
|
41 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
42 | 42 | //$this->_response->add_output( "\n<br />" . 'minimum_php_version_error' ); |
43 | 43 | $this->_response->terminate_request(); |
44 | 44 | $this->_response->deactivate_plugin(); |
45 | 45 | } |
46 | 46 | // check recommended PHP version |
47 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
47 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
48 | 48 | $this->_display_minimum_recommended_php_version_notice(); |
49 | 49 | } |
50 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
50 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
51 | 51 | //$this->_response->add_output( "\n\t OUT << " . __CLASS__ ); |
52 | 52 | return $this->_response; |
53 | 53 | } |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * @param string $min_version |
62 | 62 | * @return boolean |
63 | 63 | */ |
64 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
64 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
65 | 65 | global $wp_version; |
66 | - return version_compare( $wp_version, $min_version, '>=' ) ? true : false; |
|
66 | + return version_compare($wp_version, $min_version, '>=') ? true : false; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return boolean |
76 | 76 | */ |
77 | 77 | private function _minimum_wp_version_required() { |
78 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
78 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * @param string $min_version |
88 | 88 | * @return boolean |
89 | 89 | */ |
90 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
91 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false; |
|
90 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
91 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return boolean |
101 | 101 | */ |
102 | 102 | private function _minimum_php_version_required() { |
103 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
103 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @return boolean |
113 | 113 | */ |
114 | 114 | private function _minimum_php_version_recommended() { |
115 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
115 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | <p> |
130 | 130 | <?php |
131 | 131 | printf( |
132 | - __( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
132 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
133 | 133 | EE_MIN_WP_VER_REQUIRED, |
134 | 134 | $wp_version, |
135 | 135 | '<br/>', |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | <p> |
155 | 155 | <?php |
156 | 156 | printf( |
157 | - __( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
157 | + __('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
158 | 158 | EE_MIN_PHP_VER_REQUIRED, |
159 | 159 | PHP_VERSION, |
160 | 160 | '<br/>', |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | */ |
177 | 177 | private function _display_minimum_recommended_php_version_notice() { |
178 | 178 | EE_Error::add_persistent_admin_notice( |
179 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
179 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
180 | 180 | sprintf( |
181 | - __( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
181 | + __('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
182 | 182 | EE_MIN_PHP_VER_RECOMMENDED, |
183 | 183 | PHP_VERSION, |
184 | 184 | '<br/>', |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return \EE_Config |
171 | 171 | */ |
172 | 172 | private function __construct() { |
173 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
173 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
174 | 174 | // setup empty config classes |
175 | 175 | $this->_initialize_config(); |
176 | 176 | // load existing EE site settings |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | // register shortcodes and modules |
181 | 181 | add_action( |
182 | 182 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
183 | - array( $this, 'register_shortcodes_and_modules' ), |
|
183 | + array($this, 'register_shortcodes_and_modules'), |
|
184 | 184 | 999 |
185 | 185 | ); |
186 | 186 | // initialize shortcodes and modules |
187 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
187 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
188 | 188 | // register widgets |
189 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
189 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
190 | 190 | // shutdown |
191 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
191 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
192 | 192 | // construct__end hook |
193 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
193 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
194 | 194 | // hardcoded hack |
195 | 195 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string current theme set. |
204 | 204 | */ |
205 | 205 | public static function get_current_theme() { |
206 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
206 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
207 | 207 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
208 | 208 | } |
209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | private function _initialize_config() { |
219 | 219 | EE_Config::trim_log(); |
220 | 220 | //set defaults |
221 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
221 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
222 | 222 | $this->addons = new stdClass(); |
223 | 223 | // set _module_route_map |
224 | 224 | EE_Config::$_module_route_map = array(); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | 245 | $settings = apply_filters( |
246 | 246 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $config, |
249 | 249 | $this |
250 | 250 | ); |
251 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
252 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
251 | + if (is_object($settings) && property_exists($this, $config)) { |
|
252 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
253 | 253 | //call configs populate method to ensure any defaults are set for empty values. |
254 | - if ( method_exists( $settings, 'populate' ) ) { |
|
254 | + if (method_exists($settings, 'populate')) { |
|
255 | 255 | $this->{$config}->populate(); |
256 | 256 | } |
257 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
257 | + if (method_exists($settings, 'do_hooks')) { |
|
258 | 258 | $this->{$config}->do_hooks(); |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
262 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
263 | 263 | $this->update_espresso_config(); |
264 | 264 | } |
265 | 265 | // load_core_config__end hook |
266 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
266 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | $this->core = $this->core instanceof EE_Core_Config |
279 | 279 | ? $this->core |
280 | 280 | : new EE_Core_Config(); |
281 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
281 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
282 | 282 | $this->organization = $this->organization instanceof EE_Organization_Config |
283 | 283 | ? $this->organization |
284 | 284 | : new EE_Organization_Config(); |
285 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
285 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
286 | 286 | $this->currency = $this->currency instanceof EE_Currency_Config |
287 | 287 | ? $this->currency |
288 | 288 | : new EE_Currency_Config(); |
289 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
289 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
290 | 290 | $this->registration = $this->registration instanceof EE_Registration_Config |
291 | 291 | ? $this->registration |
292 | 292 | : new EE_Registration_Config(); |
293 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
293 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
294 | 294 | $this->admin = $this->admin instanceof EE_Admin_Config |
295 | 295 | ? $this->admin |
296 | 296 | : new EE_Admin_Config(); |
297 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
297 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
298 | 298 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
299 | 299 | ? $this->template_settings |
300 | 300 | : new EE_Template_Config(); |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
306 | 306 | ? $this->map_settings |
307 | 307 | : new EE_Map_Config(); |
308 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
308 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
309 | 309 | $this->environment = $this->environment instanceof EE_Environment_Config |
310 | 310 | ? $this->environment |
311 | 311 | : new EE_Environment_Config(); |
312 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
312 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
313 | 313 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
314 | 314 | ? $this->gateway |
315 | 315 | : new EE_Gateway_Config(); |
316 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
316 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // grab espresso configuration |
329 | 329 | return apply_filters( |
330 | 330 | 'FHEE__EE_Config__get_espresso_config__CFG', |
331 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
331 | + get_option(EE_Config::OPTION_NAME, array()) |
|
332 | 332 | ); |
333 | 333 | } |
334 | 334 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | * @param $old_value |
343 | 343 | * @param $value |
344 | 344 | */ |
345 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
345 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
346 | 346 | // make sure we're checking the ee config |
347 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
347 | + if ($option === EE_Config::OPTION_NAME) { |
|
348 | 348 | // run a loose comparison of the old value against the new value for type and properties, |
349 | 349 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
350 | - if ( $value != $old_value ) { |
|
350 | + if ($value != $old_value) { |
|
351 | 351 | // if they are NOT the same, then remove the hook, |
352 | 352 | // which means the subsequent update results will be based solely on the update query results |
353 | 353 | // the reason we do this is because, as stated above, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | // the string it sees in the db looks the same as the new one it has been passed!!! |
363 | 363 | // This results in the query returning an "affected rows" value of ZERO, |
364 | 364 | // which gets returned immediately by WP update_option and looks like an error. |
365 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
365 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
380 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
381 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
382 | - $config_class = get_class( $addon_config_obj ); |
|
383 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
384 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
380 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
381 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
382 | + $config_class = get_class($addon_config_obj); |
|
383 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
384 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
385 | 385 | } |
386 | 386 | $this->addons->{$addon_name} = null; |
387 | 387 | } |
@@ -397,18 +397,18 @@ discard block |
||
397 | 397 | * @param bool $add_error |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
400 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
401 | 401 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
402 | 402 | //$clone = clone( self::$_instance ); |
403 | 403 | //self::$_instance = NULL; |
404 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
404 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
405 | 405 | $this->_reset_espresso_addon_config(); |
406 | 406 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
407 | 407 | // but BEFORE the actual update occurs |
408 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
408 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
409 | 409 | // now update "ee_config" |
410 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
411 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
410 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
411 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
412 | 412 | // if not saved... check if the hook we just added still exists; |
413 | 413 | // if it does, it means one of two things: |
414 | 414 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -419,17 +419,17 @@ discard block |
||
419 | 419 | // but just means no update occurred, so don't display an error to the user. |
420 | 420 | // BUT... if update_option returns FALSE, AND the hook is missing, |
421 | 421 | // then it means that something truly went wrong |
422 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
422 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
423 | 423 | // remove our action since we don't want it in the system anymore |
424 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
425 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
424 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
425 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
426 | 426 | //self::$_instance = $clone; |
427 | 427 | //unset( $clone ); |
428 | 428 | // if config remains the same or was updated successfully |
429 | - if ( $saved ) { |
|
430 | - if ( $add_success ) { |
|
429 | + if ($saved) { |
|
430 | + if ($add_success) { |
|
431 | 431 | EE_Error::add_success( |
432 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
432 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
433 | 433 | __FILE__, |
434 | 434 | __FUNCTION__, |
435 | 435 | __LINE__ |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | } |
438 | 438 | return true; |
439 | 439 | } else { |
440 | - if ( $add_error ) { |
|
440 | + if ($add_error) { |
|
441 | 441 | EE_Error::add_error( |
442 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
442 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
443 | 443 | __FILE__, |
444 | 444 | __FUNCTION__, |
445 | 445 | __LINE__ |
@@ -468,16 +468,16 @@ discard block |
||
468 | 468 | $name = '', |
469 | 469 | $config_class = '', |
470 | 470 | $config_obj = null, |
471 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
471 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
472 | 472 | $display_errors = true |
473 | 473 | ) { |
474 | 474 | try { |
475 | - foreach ( $tests_to_run as $test ) { |
|
476 | - switch ( $test ) { |
|
475 | + foreach ($tests_to_run as $test) { |
|
476 | + switch ($test) { |
|
477 | 477 | // TEST #1 : check that section was set |
478 | 478 | case 1 : |
479 | - if ( empty( $section ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if (empty($section)) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | 482 | sprintf( |
483 | 483 | __( |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | break; |
494 | 494 | // TEST #2 : check that settings section exists |
495 | 495 | case 2 : |
496 | - if ( ! isset( $this->{$section} ) ) { |
|
497 | - if ( $display_errors ) { |
|
496 | + if ( ! isset($this->{$section} )) { |
|
497 | + if ($display_errors) { |
|
498 | 498 | throw new EE_Error( |
499 | 499 | sprintf( |
500 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
500 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
501 | 501 | $section |
502 | 502 | ) |
503 | 503 | ); |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | // TEST #3 : check that section is the proper format |
509 | 509 | case 3 : |
510 | 510 | if ( |
511 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
511 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
512 | 512 | ) { |
513 | - if ( $display_errors ) { |
|
513 | + if ($display_errors) { |
|
514 | 514 | throw new EE_Error( |
515 | 515 | sprintf( |
516 | 516 | __( |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | break; |
527 | 527 | // TEST #4 : check that config section name has been set |
528 | 528 | case 4 : |
529 | - if ( empty( $name ) ) { |
|
530 | - if ( $display_errors ) { |
|
529 | + if (empty($name)) { |
|
530 | + if ($display_errors) { |
|
531 | 531 | throw new EE_Error( |
532 | 532 | __( |
533 | 533 | 'No name has been provided for the specific configuration section.', |
@@ -540,8 +540,8 @@ discard block |
||
540 | 540 | break; |
541 | 541 | // TEST #5 : check that a config class name has been set |
542 | 542 | case 5 : |
543 | - if ( empty( $config_class ) ) { |
|
544 | - if ( $display_errors ) { |
|
543 | + if (empty($config_class)) { |
|
544 | + if ($display_errors) { |
|
545 | 545 | throw new EE_Error( |
546 | 546 | __( |
547 | 547 | 'No class name has been provided for the specific configuration section.', |
@@ -554,8 +554,8 @@ discard block |
||
554 | 554 | break; |
555 | 555 | // TEST #6 : verify config class is accessible |
556 | 556 | case 6 : |
557 | - if ( ! class_exists( $config_class ) ) { |
|
558 | - if ( $display_errors ) { |
|
557 | + if ( ! class_exists($config_class)) { |
|
558 | + if ($display_errors) { |
|
559 | 559 | throw new EE_Error( |
560 | 560 | sprintf( |
561 | 561 | __( |
@@ -571,11 +571,11 @@ discard block |
||
571 | 571 | break; |
572 | 572 | // TEST #7 : check that config has even been set |
573 | 573 | case 7 : |
574 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
575 | - if ( $display_errors ) { |
|
574 | + if ( ! isset($this->{$section}->{$name} )) { |
|
575 | + if ($display_errors) { |
|
576 | 576 | throw new EE_Error( |
577 | 577 | sprintf( |
578 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
578 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
579 | 579 | $section, |
580 | 580 | $name |
581 | 581 | ) |
@@ -584,13 +584,13 @@ discard block |
||
584 | 584 | return false; |
585 | 585 | } else { |
586 | 586 | // and make sure it's not serialized |
587 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
587 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
588 | 588 | } |
589 | 589 | break; |
590 | 590 | // TEST #8 : check that config is the requested type |
591 | 591 | case 8 : |
592 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
593 | - if ( $display_errors ) { |
|
592 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
593 | + if ($display_errors) { |
|
594 | 594 | throw new EE_Error( |
595 | 595 | sprintf( |
596 | 596 | __( |
@@ -608,12 +608,12 @@ discard block |
||
608 | 608 | break; |
609 | 609 | // TEST #9 : verify config object |
610 | 610 | case 9 : |
611 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
612 | - if ( $display_errors ) { |
|
611 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
612 | + if ($display_errors) { |
|
613 | 613 | throw new EE_Error( |
614 | 614 | sprintf( |
615 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
616 | - print_r( $config_obj, true ) |
|
615 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
616 | + print_r($config_obj, true) |
|
617 | 617 | ) |
618 | 618 | ); |
619 | 619 | } |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | break; |
623 | 623 | } |
624 | 624 | } |
625 | - } catch ( EE_Error $e ) { |
|
625 | + } catch (EE_Error $e) { |
|
626 | 626 | $e->get_error(); |
627 | 627 | } |
628 | 628 | // you have successfully run the gauntlet |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @param string $name |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
643 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
642 | + private function _generate_config_option_name($section = '', $name = '') { |
|
643 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -654,10 +654,10 @@ discard block |
||
654 | 654 | * @param string $name |
655 | 655 | * @return string |
656 | 656 | */ |
657 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
658 | - return ! empty( $config_class ) |
|
657 | + private function _set_config_class($config_class = '', $name = '') { |
|
658 | + return ! empty($config_class) |
|
659 | 659 | ? $config_class |
660 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
660 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | |
@@ -672,36 +672,36 @@ discard block |
||
672 | 672 | * @param EE_Config_Base $config_obj |
673 | 673 | * @return EE_Config_Base |
674 | 674 | */ |
675 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
675 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
676 | 676 | // ensure config class is set to something |
677 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
677 | + $config_class = $this->_set_config_class($config_class, $name); |
|
678 | 678 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
679 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
679 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
680 | 680 | return null; |
681 | 681 | } |
682 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
682 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
683 | 683 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
684 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
685 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
684 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
685 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
686 | 686 | $this->update_addon_option_names(); |
687 | 687 | } |
688 | 688 | // verify the incoming config object but suppress errors |
689 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
689 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
690 | 690 | $config_obj = new $config_class(); |
691 | 691 | } |
692 | - if ( get_option( $config_option_name ) ) { |
|
693 | - EE_Config::log( $config_option_name ); |
|
694 | - update_option( $config_option_name, $config_obj ); |
|
692 | + if (get_option($config_option_name)) { |
|
693 | + EE_Config::log($config_option_name); |
|
694 | + update_option($config_option_name, $config_obj); |
|
695 | 695 | $this->{$section}->{$name} = $config_obj; |
696 | 696 | return $this->{$section}->{$name}; |
697 | 697 | } else { |
698 | 698 | // create a wp-option for this config |
699 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
700 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
699 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
700 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
701 | 701 | return $this->{$section}->{$name}; |
702 | 702 | } else { |
703 | 703 | EE_Error::add_error( |
704 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
704 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
705 | 705 | __FILE__, |
706 | 706 | __FUNCTION__, |
707 | 707 | __LINE__ |
@@ -724,40 +724,40 @@ discard block |
||
724 | 724 | * @param bool $throw_errors |
725 | 725 | * @return bool |
726 | 726 | */ |
727 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
728 | - $config_obj = maybe_unserialize( $config_obj ); |
|
727 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
728 | + $config_obj = maybe_unserialize($config_obj); |
|
729 | 729 | // get class name of the incoming object |
730 | - $config_class = get_class( $config_obj ); |
|
730 | + $config_class = get_class($config_obj); |
|
731 | 731 | // run tests 1-5 and 9 to verify config |
732 | 732 | if ( ! $this->_verify_config_params( |
733 | 733 | $section, |
734 | 734 | $name, |
735 | 735 | $config_class, |
736 | 736 | $config_obj, |
737 | - array( 1, 2, 3, 4, 7, 9 ) |
|
737 | + array(1, 2, 3, 4, 7, 9) |
|
738 | 738 | ) |
739 | 739 | ) { |
740 | 740 | return false; |
741 | 741 | } |
742 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
742 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
743 | 743 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
744 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
744 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
745 | 745 | // save new config to db |
746 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
746 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
747 | 747 | } else { |
748 | 748 | // first check if the record already exists |
749 | - $existing_config = get_option( $config_option_name ); |
|
750 | - $config_obj = serialize( $config_obj ); |
|
749 | + $existing_config = get_option($config_option_name); |
|
750 | + $config_obj = serialize($config_obj); |
|
751 | 751 | // just return if db record is already up to date (NOT type safe comparison) |
752 | - if ( $existing_config == $config_obj ) { |
|
752 | + if ($existing_config == $config_obj) { |
|
753 | 753 | $this->{$section}->{$name} = $config_obj; |
754 | 754 | return true; |
755 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
756 | - EE_Config::log( $config_option_name ); |
|
755 | + } else if (update_option($config_option_name, $config_obj)) { |
|
756 | + EE_Config::log($config_option_name); |
|
757 | 757 | // update wp-option for this config class |
758 | 758 | $this->{$section}->{$name} = $config_obj; |
759 | 759 | return true; |
760 | - } elseif ( $throw_errors ) { |
|
760 | + } elseif ($throw_errors) { |
|
761 | 761 | EE_Error::add_error( |
762 | 762 | sprintf( |
763 | 763 | __( |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | 'event_espresso' |
766 | 766 | ), |
767 | 767 | $config_class, |
768 | - 'EE_Config->' . $section . '->' . $name |
|
768 | + 'EE_Config->'.$section.'->'.$name |
|
769 | 769 | ), |
770 | 770 | __FILE__, |
771 | 771 | __FUNCTION__, |
@@ -787,34 +787,34 @@ discard block |
||
787 | 787 | * @param string $config_class |
788 | 788 | * @return mixed EE_Config_Base | NULL |
789 | 789 | */ |
790 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
790 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
791 | 791 | // ensure config class is set to something |
792 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
792 | + $config_class = $this->_set_config_class($config_class, $name); |
|
793 | 793 | // run tests 1-4, 6 and 7 to verify that all params have been set |
794 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
794 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
795 | 795 | return null; |
796 | 796 | } |
797 | 797 | // now test if the requested config object exists, but suppress errors |
798 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
798 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
799 | 799 | // config already exists, so pass it back |
800 | 800 | return $this->{$section}->{$name}; |
801 | 801 | } |
802 | 802 | // load config option from db if it exists |
803 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
803 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
804 | 804 | // verify the newly retrieved config object, but suppress errors |
805 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
805 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
806 | 806 | // config is good, so set it and pass it back |
807 | 807 | $this->{$section}->{$name} = $config_obj; |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
811 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
811 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
812 | 812 | // verify the newly created config object |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
814 | 814 | return $this->{$section}->{$name}; |
815 | 815 | } else { |
816 | 816 | EE_Error::add_error( |
817 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
817 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
818 | 818 | __FILE__, |
819 | 819 | __FUNCTION__, |
820 | 820 | __LINE__ |
@@ -832,9 +832,9 @@ discard block |
||
832 | 832 | * @param string $config_option_name |
833 | 833 | * @return mixed EE_Config_Base | FALSE |
834 | 834 | */ |
835 | - public function get_config_option( $config_option_name = '' ) { |
|
835 | + public function get_config_option($config_option_name = '') { |
|
836 | 836 | // retrieve the wp-option for this config class. |
837 | - return maybe_unserialize( get_option( $config_option_name ) ); |
|
837 | + return maybe_unserialize(get_option($config_option_name)); |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | |
@@ -844,17 +844,17 @@ discard block |
||
844 | 844 | * |
845 | 845 | * @param string $config_option_name |
846 | 846 | */ |
847 | - public static function log( $config_option_name = '' ) { |
|
848 | - if ( ! empty( $config_option_name ) ) { |
|
849 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
847 | + public static function log($config_option_name = '') { |
|
848 | + if ( ! empty($config_option_name)) { |
|
849 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
850 | 850 | //copy incoming $_REQUEST and sanitize it so we can save it |
851 | 851 | $_request = $_REQUEST; |
852 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
853 | - $config_log[ (string) microtime( true ) ] = array( |
|
852 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
853 | + $config_log[(string) microtime(true)] = array( |
|
854 | 854 | 'config_name' => $config_option_name, |
855 | 855 | 'request' => $_request, |
856 | 856 | ); |
857 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
857 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | |
@@ -865,12 +865,12 @@ discard block |
||
865 | 865 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
866 | 866 | */ |
867 | 867 | public static function trim_log() { |
868 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
869 | - $log_length = count( $config_log ); |
|
870 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
871 | - ksort( $config_log ); |
|
872 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
873 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
868 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
869 | + $log_length = count($config_log); |
|
870 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
871 | + ksort($config_log); |
|
872 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
873 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
874 | 874 | } |
875 | 875 | } |
876 | 876 | |
@@ -885,14 +885,14 @@ discard block |
||
885 | 885 | * @return string |
886 | 886 | */ |
887 | 887 | public static function get_page_for_posts() { |
888 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
889 | - if ( ! $page_for_posts ) { |
|
888 | + $page_for_posts = get_option('page_for_posts'); |
|
889 | + if ( ! $page_for_posts) { |
|
890 | 890 | return 'posts'; |
891 | 891 | } |
892 | 892 | /** @type WPDB $wpdb */ |
893 | 893 | global $wpdb; |
894 | 894 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
895 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
895 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | |
@@ -948,17 +948,17 @@ discard block |
||
948 | 948 | ) |
949 | 949 | ) { |
950 | 950 | // grab list of installed widgets |
951 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
951 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
952 | 952 | // filter list of modules to register |
953 | 953 | $widgets_to_register = apply_filters( |
954 | 954 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
955 | 955 | $widgets_to_register |
956 | 956 | ); |
957 | - if ( ! empty( $widgets_to_register ) ) { |
|
957 | + if ( ! empty($widgets_to_register)) { |
|
958 | 958 | // cycle thru widget folders |
959 | - foreach ( $widgets_to_register as $widget_path ) { |
|
959 | + foreach ($widgets_to_register as $widget_path) { |
|
960 | 960 | // add to list of installed widget modules |
961 | - EE_Config::register_ee_widget( $widget_path ); |
|
961 | + EE_Config::register_ee_widget($widget_path); |
|
962 | 962 | } |
963 | 963 | } |
964 | 964 | // filter list of installed modules |
@@ -978,57 +978,57 @@ discard block |
||
978 | 978 | * @param string $widget_path - full path up to and including widget folder |
979 | 979 | * @return void |
980 | 980 | */ |
981 | - public static function register_ee_widget( $widget_path = null ) { |
|
982 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
981 | + public static function register_ee_widget($widget_path = null) { |
|
982 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
983 | 983 | $widget_ext = '.widget.php'; |
984 | 984 | // make all separators match |
985 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
985 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
986 | 986 | // does the file path INCLUDE the actual file name as part of the path ? |
987 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
987 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
988 | 988 | // grab and shortcode file name from directory name and break apart at dots |
989 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
989 | + $file_name = explode('.', basename($widget_path)); |
|
990 | 990 | // take first segment from file name pieces and remove class prefix if it exists |
991 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
991 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
992 | 992 | // sanitize shortcode directory name |
993 | - $widget = sanitize_key( $widget ); |
|
993 | + $widget = sanitize_key($widget); |
|
994 | 994 | // now we need to rebuild the shortcode path |
995 | - $widget_path = explode( DS, $widget_path ); |
|
995 | + $widget_path = explode(DS, $widget_path); |
|
996 | 996 | // remove last segment |
997 | - array_pop( $widget_path ); |
|
997 | + array_pop($widget_path); |
|
998 | 998 | // glue it back together |
999 | - $widget_path = implode( DS, $widget_path ); |
|
999 | + $widget_path = implode(DS, $widget_path); |
|
1000 | 1000 | } else { |
1001 | 1001 | // grab and sanitize widget directory name |
1002 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1002 | + $widget = sanitize_key(basename($widget_path)); |
|
1003 | 1003 | } |
1004 | 1004 | // create classname from widget directory name |
1005 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1005 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1006 | 1006 | // add class prefix |
1007 | - $widget_class = 'EEW_' . $widget; |
|
1007 | + $widget_class = 'EEW_'.$widget; |
|
1008 | 1008 | // does the widget exist ? |
1009 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1009 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1010 | 1010 | $msg = sprintf( |
1011 | 1011 | __( |
1012 | 1012 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1013 | 1013 | 'event_espresso' |
1014 | 1014 | ), |
1015 | 1015 | $widget_class, |
1016 | - $widget_path . DS . $widget_class . $widget_ext |
|
1016 | + $widget_path.DS.$widget_class.$widget_ext |
|
1017 | 1017 | ); |
1018 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1018 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1019 | 1019 | return; |
1020 | 1020 | } |
1021 | 1021 | // load the widget class file |
1022 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1022 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1023 | 1023 | // verify that class exists |
1024 | - if ( ! class_exists( $widget_class ) ) { |
|
1025 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1026 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1024 | + if ( ! class_exists($widget_class)) { |
|
1025 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1026 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1027 | 1027 | return; |
1028 | 1028 | } |
1029 | - register_widget( $widget_class ); |
|
1029 | + register_widget($widget_class); |
|
1030 | 1030 | // add to array of registered widgets |
1031 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1031 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | |
@@ -1041,17 +1041,17 @@ discard block |
||
1041 | 1041 | */ |
1042 | 1042 | private function _register_shortcodes() { |
1043 | 1043 | // grab list of installed shortcodes |
1044 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1044 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1045 | 1045 | // filter list of modules to register |
1046 | 1046 | $shortcodes_to_register = apply_filters( |
1047 | 1047 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1048 | 1048 | $shortcodes_to_register |
1049 | 1049 | ); |
1050 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1050 | + if ( ! empty($shortcodes_to_register)) { |
|
1051 | 1051 | // cycle thru shortcode folders |
1052 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1052 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1053 | 1053 | // add to list of installed shortcode modules |
1054 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1054 | + EE_Config::register_shortcode($shortcode_path); |
|
1055 | 1055 | } |
1056 | 1056 | } |
1057 | 1057 | // filter list of installed modules |
@@ -1070,64 +1070,64 @@ discard block |
||
1070 | 1070 | * @param string $shortcode_path - full path up to and including shortcode folder |
1071 | 1071 | * @return bool |
1072 | 1072 | */ |
1073 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1074 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1073 | + public static function register_shortcode($shortcode_path = null) { |
|
1074 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1075 | 1075 | $shortcode_ext = '.shortcode.php'; |
1076 | 1076 | // make all separators match |
1077 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1077 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1078 | 1078 | // does the file path INCLUDE the actual file name as part of the path ? |
1079 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1079 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1080 | 1080 | // grab shortcode file name from directory name and break apart at dots |
1081 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1081 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1082 | 1082 | // take first segment from file name pieces and remove class prefix if it exists |
1083 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1084 | - ? substr( $shortcode_file[0], 4 ) |
|
1083 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1084 | + ? substr($shortcode_file[0], 4) |
|
1085 | 1085 | : $shortcode_file[0]; |
1086 | 1086 | // sanitize shortcode directory name |
1087 | - $shortcode = sanitize_key( $shortcode ); |
|
1087 | + $shortcode = sanitize_key($shortcode); |
|
1088 | 1088 | // now we need to rebuild the shortcode path |
1089 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1089 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1090 | 1090 | // remove last segment |
1091 | - array_pop( $shortcode_path ); |
|
1091 | + array_pop($shortcode_path); |
|
1092 | 1092 | // glue it back together |
1093 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1093 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1094 | 1094 | } else { |
1095 | 1095 | // we need to generate the filename based off of the folder name |
1096 | 1096 | // grab and sanitize shortcode directory name |
1097 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1098 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1097 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1098 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1099 | 1099 | } |
1100 | 1100 | // create classname from shortcode directory or file name |
1101 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1101 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1102 | 1102 | // add class prefix |
1103 | - $shortcode_class = 'EES_' . $shortcode; |
|
1103 | + $shortcode_class = 'EES_'.$shortcode; |
|
1104 | 1104 | // does the shortcode exist ? |
1105 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1105 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1106 | 1106 | $msg = sprintf( |
1107 | 1107 | __( |
1108 | 1108 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1109 | 1109 | 'event_espresso' |
1110 | 1110 | ), |
1111 | 1111 | $shortcode_class, |
1112 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1112 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1113 | 1113 | ); |
1114 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1114 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1115 | 1115 | return false; |
1116 | 1116 | } |
1117 | 1117 | // load the shortcode class file |
1118 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1118 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1119 | 1119 | // verify that class exists |
1120 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1120 | + if ( ! class_exists($shortcode_class)) { |
|
1121 | 1121 | $msg = sprintf( |
1122 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1122 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1123 | 1123 | $shortcode_class |
1124 | 1124 | ); |
1125 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1125 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1126 | 1126 | return false; |
1127 | 1127 | } |
1128 | - $shortcode = strtoupper( $shortcode ); |
|
1128 | + $shortcode = strtoupper($shortcode); |
|
1129 | 1129 | // add to array of registered shortcodes |
1130 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1130 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1131 | 1131 | return true; |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1141,22 +1141,22 @@ discard block |
||
1141 | 1141 | */ |
1142 | 1142 | private function _register_modules() { |
1143 | 1143 | // grab list of installed modules |
1144 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1144 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1145 | 1145 | // filter list of modules to register |
1146 | 1146 | $modules_to_register = apply_filters( |
1147 | 1147 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1148 | 1148 | $modules_to_register |
1149 | 1149 | ); |
1150 | - if ( ! empty( $modules_to_register ) ) { |
|
1150 | + if ( ! empty($modules_to_register)) { |
|
1151 | 1151 | // loop through folders |
1152 | - foreach ( $modules_to_register as $module_path ) { |
|
1152 | + foreach ($modules_to_register as $module_path) { |
|
1153 | 1153 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1154 | 1154 | if ( |
1155 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1156 | - && $module_path !== EE_MODULES . 'gateways' |
|
1155 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1156 | + && $module_path !== EE_MODULES.'gateways' |
|
1157 | 1157 | ) { |
1158 | 1158 | // add to list of installed modules |
1159 | - EE_Config::register_module( $module_path ); |
|
1159 | + EE_Config::register_module($module_path); |
|
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | } |
@@ -1176,39 +1176,39 @@ discard block |
||
1176 | 1176 | * @param string $module_path - full path up to and including module folder |
1177 | 1177 | * @return bool |
1178 | 1178 | */ |
1179 | - public static function register_module( $module_path = null ) { |
|
1180 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1179 | + public static function register_module($module_path = null) { |
|
1180 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1181 | 1181 | $module_ext = '.module.php'; |
1182 | 1182 | // make all separators match |
1183 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1183 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1184 | 1184 | // does the file path INCLUDE the actual file name as part of the path ? |
1185 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1185 | + if (strpos($module_path, $module_ext) !== false) { |
|
1186 | 1186 | // grab and shortcode file name from directory name and break apart at dots |
1187 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1187 | + $module_file = explode('.', basename($module_path)); |
|
1188 | 1188 | // now we need to rebuild the shortcode path |
1189 | - $module_path = explode( DS, $module_path ); |
|
1189 | + $module_path = explode(DS, $module_path); |
|
1190 | 1190 | // remove last segment |
1191 | - array_pop( $module_path ); |
|
1191 | + array_pop($module_path); |
|
1192 | 1192 | // glue it back together |
1193 | - $module_path = implode( DS, $module_path ) . DS; |
|
1193 | + $module_path = implode(DS, $module_path).DS; |
|
1194 | 1194 | // take first segment from file name pieces and sanitize it |
1195 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1195 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1196 | 1196 | // ensure class prefix is added |
1197 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1197 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1198 | 1198 | } else { |
1199 | 1199 | // we need to generate the filename based off of the folder name |
1200 | 1200 | // grab and sanitize module name |
1201 | - $module = strtolower( basename( $module_path ) ); |
|
1202 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1201 | + $module = strtolower(basename($module_path)); |
|
1202 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1203 | 1203 | // like trailingslashit() |
1204 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1204 | + $module_path = rtrim($module_path, DS).DS; |
|
1205 | 1205 | // create classname from module directory name |
1206 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1206 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1207 | 1207 | // add class prefix |
1208 | - $module_class = 'EED_' . $module; |
|
1208 | + $module_class = 'EED_'.$module; |
|
1209 | 1209 | } |
1210 | 1210 | // does the module exist ? |
1211 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1211 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1212 | 1212 | $msg = sprintf( |
1213 | 1213 | __( |
1214 | 1214 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1216,19 +1216,19 @@ discard block |
||
1216 | 1216 | ), |
1217 | 1217 | $module |
1218 | 1218 | ); |
1219 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1219 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1220 | 1220 | return false; |
1221 | 1221 | } |
1222 | 1222 | // load the module class file |
1223 | - require_once( $module_path . $module_class . $module_ext ); |
|
1223 | + require_once($module_path.$module_class.$module_ext); |
|
1224 | 1224 | // verify that class exists |
1225 | - if ( ! class_exists( $module_class ) ) { |
|
1226 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1227 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1225 | + if ( ! class_exists($module_class)) { |
|
1226 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1227 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1228 | 1228 | return false; |
1229 | 1229 | } |
1230 | 1230 | // add to array of registered modules |
1231 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1231 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1232 | 1232 | do_action( |
1233 | 1233 | 'AHEE__EE_Config__register_module__complete', |
1234 | 1234 | $module_class, |
@@ -1248,26 +1248,26 @@ discard block |
||
1248 | 1248 | */ |
1249 | 1249 | private function _initialize_shortcodes() { |
1250 | 1250 | // cycle thru shortcode folders |
1251 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1251 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1252 | 1252 | // add class prefix |
1253 | - $shortcode_class = 'EES_' . $shortcode; |
|
1253 | + $shortcode_class = 'EES_'.$shortcode; |
|
1254 | 1254 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1255 | 1255 | // which set hooks ? |
1256 | - if ( is_admin() ) { |
|
1256 | + if (is_admin()) { |
|
1257 | 1257 | // fire immediately |
1258 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1258 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1259 | 1259 | } else { |
1260 | 1260 | // delay until other systems are online |
1261 | 1261 | add_action( |
1262 | 1262 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1263 | - array( $shortcode_class, 'set_hooks' ) |
|
1263 | + array($shortcode_class, 'set_hooks') |
|
1264 | 1264 | ); |
1265 | 1265 | // convert classname to UPPERCASE and create WP shortcode. |
1266 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1266 | + $shortcode_tag = strtoupper($shortcode); |
|
1267 | 1267 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1268 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1268 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1269 | 1269 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1270 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1270 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1271 | 1271 | } |
1272 | 1272 | } |
1273 | 1273 | } |
@@ -1284,17 +1284,17 @@ discard block |
||
1284 | 1284 | */ |
1285 | 1285 | private function _initialize_modules() { |
1286 | 1286 | // cycle thru shortcode folders |
1287 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1287 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1288 | 1288 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1289 | 1289 | // which set hooks ? |
1290 | - if ( is_admin() ) { |
|
1290 | + if (is_admin()) { |
|
1291 | 1291 | // fire immediately |
1292 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1292 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1293 | 1293 | } else { |
1294 | 1294 | // delay until other systems are online |
1295 | 1295 | add_action( |
1296 | 1296 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1297 | - array( $module_class, 'set_hooks' ) |
|
1297 | + array($module_class, 'set_hooks') |
|
1298 | 1298 | ); |
1299 | 1299 | } |
1300 | 1300 | } |
@@ -1312,29 +1312,29 @@ discard block |
||
1312 | 1312 | * @param string $key - url param key indicating a route is being called |
1313 | 1313 | * @return bool |
1314 | 1314 | */ |
1315 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1316 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1317 | - $module = str_replace( 'EED_', '', $module ); |
|
1318 | - $module_class = 'EED_' . $module; |
|
1319 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1320 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1321 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1315 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1316 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1317 | + $module = str_replace('EED_', '', $module); |
|
1318 | + $module_class = 'EED_'.$module; |
|
1319 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1320 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1321 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1322 | 1322 | return false; |
1323 | 1323 | } |
1324 | - if ( empty( $route ) ) { |
|
1325 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1326 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1324 | + if (empty($route)) { |
|
1325 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1326 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1327 | 1327 | return false; |
1328 | 1328 | } |
1329 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1329 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1330 | 1330 | $msg = sprintf( |
1331 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1331 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1332 | 1332 | $route |
1333 | 1333 | ); |
1334 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1334 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1335 | 1335 | return false; |
1336 | 1336 | } |
1337 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1337 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1338 | 1338 | return true; |
1339 | 1339 | } |
1340 | 1340 | |
@@ -1348,11 +1348,11 @@ discard block |
||
1348 | 1348 | * @param string $key - url param key indicating a route is being called |
1349 | 1349 | * @return string |
1350 | 1350 | */ |
1351 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1352 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1353 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1354 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1355 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1351 | + public static function get_route($route = null, $key = 'ee') { |
|
1352 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1353 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1354 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1355 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1356 | 1356 | } |
1357 | 1357 | return null; |
1358 | 1358 | } |
@@ -1382,49 +1382,49 @@ discard block |
||
1382 | 1382 | * @param string $key - url param key indicating a route is being called |
1383 | 1383 | * @return bool |
1384 | 1384 | */ |
1385 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1386 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1387 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1385 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1386 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1387 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1388 | 1388 | $msg = sprintf( |
1389 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1389 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1390 | 1390 | $route |
1391 | 1391 | ); |
1392 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1392 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1393 | 1393 | return false; |
1394 | 1394 | } |
1395 | - if ( empty( $forward ) ) { |
|
1396 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1397 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1395 | + if (empty($forward)) { |
|
1396 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1397 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1398 | 1398 | return false; |
1399 | 1399 | } |
1400 | - if ( is_array( $forward ) ) { |
|
1401 | - if ( ! isset( $forward[1] ) ) { |
|
1400 | + if (is_array($forward)) { |
|
1401 | + if ( ! isset($forward[1])) { |
|
1402 | 1402 | $msg = sprintf( |
1403 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1403 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1404 | 1404 | $route |
1405 | 1405 | ); |
1406 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1406 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1407 | 1407 | return false; |
1408 | 1408 | } |
1409 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1409 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1410 | 1410 | $msg = sprintf( |
1411 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1411 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1412 | 1412 | $forward[1], |
1413 | 1413 | $route |
1414 | 1414 | ); |
1415 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1415 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1416 | 1416 | return false; |
1417 | 1417 | } |
1418 | - } else if ( ! function_exists( $forward ) ) { |
|
1418 | + } else if ( ! function_exists($forward)) { |
|
1419 | 1419 | $msg = sprintf( |
1420 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1420 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1421 | 1421 | $forward, |
1422 | 1422 | $route |
1423 | 1423 | ); |
1424 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1424 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1425 | 1425 | return false; |
1426 | 1426 | } |
1427 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1427 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1428 | 1428 | return true; |
1429 | 1429 | } |
1430 | 1430 | |
@@ -1440,12 +1440,12 @@ discard block |
||
1440 | 1440 | * @param string $key - url param key indicating a route is being called |
1441 | 1441 | * @return string |
1442 | 1442 | */ |
1443 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1444 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1445 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1443 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1444 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1445 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1446 | 1446 | return apply_filters( |
1447 | 1447 | 'FHEE__EE_Config__get_forward', |
1448 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1448 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1449 | 1449 | $route, |
1450 | 1450 | $status |
1451 | 1451 | ); |
@@ -1467,17 +1467,17 @@ discard block |
||
1467 | 1467 | * @param string $key - url param key indicating a route is being called |
1468 | 1468 | * @return bool |
1469 | 1469 | */ |
1470 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1471 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1472 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1470 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1471 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1472 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1473 | 1473 | $msg = sprintf( |
1474 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1474 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1475 | 1475 | $route |
1476 | 1476 | ); |
1477 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1477 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1478 | 1478 | return false; |
1479 | 1479 | } |
1480 | - if ( ! is_readable( $view ) ) { |
|
1480 | + if ( ! is_readable($view)) { |
|
1481 | 1481 | $msg = sprintf( |
1482 | 1482 | __( |
1483 | 1483 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1485,10 +1485,10 @@ discard block |
||
1485 | 1485 | ), |
1486 | 1486 | $view |
1487 | 1487 | ); |
1488 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1488 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1489 | 1489 | return false; |
1490 | 1490 | } |
1491 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1491 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1492 | 1492 | return true; |
1493 | 1493 | } |
1494 | 1494 | |
@@ -1504,12 +1504,12 @@ discard block |
||
1504 | 1504 | * @param string $key - url param key indicating a route is being called |
1505 | 1505 | * @return string |
1506 | 1506 | */ |
1507 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1508 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1509 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1507 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1508 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1509 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1510 | 1510 | return apply_filters( |
1511 | 1511 | 'FHEE__EE_Config__get_view', |
1512 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1512 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1513 | 1513 | $route, |
1514 | 1514 | $status |
1515 | 1515 | ); |
@@ -1520,7 +1520,7 @@ discard block |
||
1520 | 1520 | |
1521 | 1521 | |
1522 | 1522 | public function update_addon_option_names() { |
1523 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1523 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | |
@@ -1548,22 +1548,22 @@ discard block |
||
1548 | 1548 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1549 | 1549 | * @throws \EE_Error |
1550 | 1550 | */ |
1551 | - public function get_pretty( $property ) { |
|
1552 | - if ( ! property_exists( $this, $property ) ) { |
|
1551 | + public function get_pretty($property) { |
|
1552 | + if ( ! property_exists($this, $property)) { |
|
1553 | 1553 | throw new EE_Error( |
1554 | 1554 | sprintf( |
1555 | 1555 | __( |
1556 | 1556 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1557 | 1557 | 'event_espresso' |
1558 | 1558 | ), |
1559 | - get_class( $this ), |
|
1559 | + get_class($this), |
|
1560 | 1560 | $property |
1561 | 1561 | ) |
1562 | 1562 | ); |
1563 | 1563 | } |
1564 | 1564 | //just handling escaping of strings for now. |
1565 | - if ( is_string( $this->{$property} ) ) { |
|
1566 | - return stripslashes( $this->{$property} ); |
|
1565 | + if (is_string($this->{$property} )) { |
|
1566 | + return stripslashes($this->{$property} ); |
|
1567 | 1567 | } |
1568 | 1568 | return $this->{$property}; |
1569 | 1569 | } |
@@ -1572,17 +1572,17 @@ discard block |
||
1572 | 1572 | |
1573 | 1573 | public function populate() { |
1574 | 1574 | //grab defaults via a new instance of this class. |
1575 | - $class_name = get_class( $this ); |
|
1575 | + $class_name = get_class($this); |
|
1576 | 1576 | $defaults = new $class_name; |
1577 | 1577 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1578 | 1578 | //default from our $defaults object. |
1579 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1580 | - if ( $this->{$property} === null ) { |
|
1579 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1580 | + if ($this->{$property} === null) { |
|
1581 | 1581 | $this->{$property} = $value; |
1582 | 1582 | } |
1583 | 1583 | } |
1584 | 1584 | //cleanup |
1585 | - unset( $defaults ); |
|
1585 | + unset($defaults); |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | |
@@ -1598,7 +1598,7 @@ discard block |
||
1598 | 1598 | * @param $a |
1599 | 1599 | * @return bool |
1600 | 1600 | */ |
1601 | - public function __isset( $a ) { |
|
1601 | + public function __isset($a) { |
|
1602 | 1602 | return false; |
1603 | 1603 | } |
1604 | 1604 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __unset( $a ) { |
|
1613 | + public function __unset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1709,18 +1709,18 @@ discard block |
||
1709 | 1709 | */ |
1710 | 1710 | public function __construct() { |
1711 | 1711 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1712 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1712 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1713 | 1713 | // set default organization settings |
1714 | 1714 | $this->current_blog_id = get_current_blog_id(); |
1715 | 1715 | $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id; |
1716 | 1716 | $this->ee_ueip_optin = is_main_site() |
1717 | - ? get_option( 'ee_ueip_optin', true ) |
|
1717 | + ? get_option('ee_ueip_optin', true) |
|
1718 | 1718 | : get_blog_option( |
1719 | 1719 | $current_main_site_id, |
1720 | 1720 | 'ee_ueip_optin', |
1721 | 1721 | true |
1722 | 1722 | ); |
1723 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1723 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1724 | 1724 | $this->post_shortcodes = array(); |
1725 | 1725 | $this->module_route_map = array(); |
1726 | 1726 | $this->module_forward_map = array(); |
@@ -1736,9 +1736,9 @@ discard block |
||
1736 | 1736 | $this->thank_you_page_url = ''; |
1737 | 1737 | $this->cancel_page_url = ''; |
1738 | 1738 | //cpt slugs |
1739 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1739 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1740 | 1740 | //ueip constant check |
1741 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1741 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1742 | 1742 | $this->ee_ueip_optin = false; |
1743 | 1743 | $this->ee_ueip_has_notified = true; |
1744 | 1744 | } |
@@ -1781,8 +1781,8 @@ discard block |
||
1781 | 1781 | * @return string |
1782 | 1782 | */ |
1783 | 1783 | public function reg_page_url() { |
1784 | - if ( ! $this->reg_page_url ) { |
|
1785 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1784 | + if ( ! $this->reg_page_url) { |
|
1785 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1786 | 1786 | } |
1787 | 1787 | return $this->reg_page_url; |
1788 | 1788 | } |
@@ -1797,12 +1797,12 @@ discard block |
||
1797 | 1797 | * @access public |
1798 | 1798 | * @return string |
1799 | 1799 | */ |
1800 | - public function txn_page_url( $query_args = array() ) { |
|
1801 | - if ( ! $this->txn_page_url ) { |
|
1802 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1800 | + public function txn_page_url($query_args = array()) { |
|
1801 | + if ( ! $this->txn_page_url) { |
|
1802 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1803 | 1803 | } |
1804 | - if ( $query_args ) { |
|
1805 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1804 | + if ($query_args) { |
|
1805 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1806 | 1806 | } else { |
1807 | 1807 | return $this->txn_page_url; |
1808 | 1808 | } |
@@ -1818,12 +1818,12 @@ discard block |
||
1818 | 1818 | * @access public |
1819 | 1819 | * @return string |
1820 | 1820 | */ |
1821 | - public function thank_you_page_url( $query_args = array() ) { |
|
1822 | - if ( ! $this->thank_you_page_url ) { |
|
1823 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1821 | + public function thank_you_page_url($query_args = array()) { |
|
1822 | + if ( ! $this->thank_you_page_url) { |
|
1823 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1824 | 1824 | } |
1825 | - if ( $query_args ) { |
|
1826 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1825 | + if ($query_args) { |
|
1826 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1827 | 1827 | } else { |
1828 | 1828 | return $this->thank_you_page_url; |
1829 | 1829 | } |
@@ -1838,8 +1838,8 @@ discard block |
||
1838 | 1838 | * @return string |
1839 | 1839 | */ |
1840 | 1840 | public function cancel_page_url() { |
1841 | - if ( ! $this->cancel_page_url ) { |
|
1842 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1841 | + if ( ! $this->cancel_page_url) { |
|
1842 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1843 | 1843 | } |
1844 | 1844 | return $this->cancel_page_url; |
1845 | 1845 | } |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | //reset all url properties |
1871 | 1871 | $this->_reset_urls(); |
1872 | 1872 | //return what to save to db |
1873 | - return array_keys( get_object_vars( $this ) ); |
|
1873 | + return array_keys(get_object_vars($this)); |
|
1874 | 1874 | } |
1875 | 1875 | |
1876 | 1876 | } |
@@ -2018,14 +2018,14 @@ discard block |
||
2018 | 2018 | */ |
2019 | 2019 | public function __construct() { |
2020 | 2020 | // set default organization settings |
2021 | - $this->name = get_bloginfo( 'name' ); |
|
2021 | + $this->name = get_bloginfo('name'); |
|
2022 | 2022 | $this->address_1 = '123 Onna Road'; |
2023 | 2023 | $this->address_2 = 'PO Box 123'; |
2024 | 2024 | $this->city = 'Inna City'; |
2025 | 2025 | $this->STA_ID = 4; |
2026 | 2026 | $this->CNT_ISO = 'US'; |
2027 | 2027 | $this->zip = '12345'; |
2028 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2028 | + $this->email = get_bloginfo('admin_email'); |
|
2029 | 2029 | $this->phone = ''; |
2030 | 2030 | $this->vat = '123456789'; |
2031 | 2031 | $this->logo_url = ''; |
@@ -2113,45 +2113,45 @@ discard block |
||
2113 | 2113 | * @param string $CNT_ISO |
2114 | 2114 | * @return \EE_Currency_Config |
2115 | 2115 | */ |
2116 | - public function __construct( $CNT_ISO = '' ) { |
|
2116 | + public function __construct($CNT_ISO = '') { |
|
2117 | 2117 | // get country code from organization settings or use default |
2118 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2118 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2119 | 2119 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2120 | 2120 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2121 | 2121 | : ''; |
2122 | 2122 | // but override if requested |
2123 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2124 | - EE_Registry::instance()->load_helper( 'Activation' ); |
|
2123 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2124 | + EE_Registry::instance()->load_helper('Activation'); |
|
2125 | 2125 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2126 | 2126 | if ( |
2127 | - ! empty( $CNT_ISO ) |
|
2127 | + ! empty($CNT_ISO) |
|
2128 | 2128 | && EE_Maintenance_Mode::instance()->models_can_query() |
2129 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2129 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2130 | 2130 | ) { |
2131 | 2131 | // retrieve the country settings from the db, just in case they have been customized |
2132 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2133 | - if ( $country instanceof EE_Country ) { |
|
2134 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2135 | - $this->name = $country->currency_name_single(); // Dollar |
|
2136 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2137 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2138 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2139 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2140 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2141 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2132 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2133 | + if ($country instanceof EE_Country) { |
|
2134 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2135 | + $this->name = $country->currency_name_single(); // Dollar |
|
2136 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2137 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2138 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2139 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2140 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2141 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2142 | 2142 | } |
2143 | 2143 | } |
2144 | 2144 | // fallback to hardcoded defaults, in case the above failed |
2145 | - if ( empty( $this->code ) ) { |
|
2145 | + if (empty($this->code)) { |
|
2146 | 2146 | // set default currency settings |
2147 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2148 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2149 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2150 | - $this->sign = '$'; // currency sign: $ |
|
2151 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2152 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2153 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2154 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2147 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2148 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2149 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2150 | + $this->sign = '$'; // currency sign: $ |
|
2151 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2152 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2153 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2154 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2155 | 2155 | } |
2156 | 2156 | } |
2157 | 2157 | } |
@@ -2314,7 +2314,7 @@ discard block |
||
2314 | 2314 | * @since 4.8.8.rc.019 |
2315 | 2315 | */ |
2316 | 2316 | public function do_hooks() { |
2317 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2317 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2318 | 2318 | } |
2319 | 2319 | |
2320 | 2320 | |
@@ -2323,7 +2323,7 @@ discard block |
||
2323 | 2323 | * @return void |
2324 | 2324 | */ |
2325 | 2325 | public function set_default_reg_status_on_EEM_Event() { |
2326 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2326 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2327 | 2327 | } |
2328 | 2328 | |
2329 | 2329 | |
@@ -2428,10 +2428,10 @@ discard block |
||
2428 | 2428 | * @param bool $reset |
2429 | 2429 | * @return string |
2430 | 2430 | */ |
2431 | - public function log_file_name( $reset = false ) { |
|
2432 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2433 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2434 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2431 | + public function log_file_name($reset = false) { |
|
2432 | + if (empty($this->log_file_name) || $reset) { |
|
2433 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2434 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2435 | 2435 | } |
2436 | 2436 | return $this->log_file_name; |
2437 | 2437 | } |
@@ -2442,10 +2442,10 @@ discard block |
||
2442 | 2442 | * @param bool $reset |
2443 | 2443 | * @return string |
2444 | 2444 | */ |
2445 | - public function debug_file_name( $reset = false ) { |
|
2446 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2447 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2448 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2445 | + public function debug_file_name($reset = false) { |
|
2446 | + if (empty($this->debug_file_name) || $reset) { |
|
2447 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2448 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2449 | 2449 | } |
2450 | 2450 | return $this->debug_file_name; |
2451 | 2451 | } |
@@ -2617,21 +2617,21 @@ discard block |
||
2617 | 2617 | // set default map settings |
2618 | 2618 | $this->use_google_maps = true; |
2619 | 2619 | // for event details pages (reg page) |
2620 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2621 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2622 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2623 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2624 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2625 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2626 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2620 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2621 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2622 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2623 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2624 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2625 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2626 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2627 | 2627 | // for event list pages |
2628 | - $this->event_list_map_width = 300; // ee_map_width |
|
2629 | - $this->event_list_map_height = 185; // ee_map_height |
|
2630 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2631 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2632 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2633 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2634 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2628 | + $this->event_list_map_width = 300; // ee_map_width |
|
2629 | + $this->event_list_map_height = 185; // ee_map_height |
|
2630 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2631 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2632 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2633 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2634 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2635 | 2635 | } |
2636 | 2636 | |
2637 | 2637 | } |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | * @return void |
2785 | 2785 | */ |
2786 | 2786 | protected function _set_php_values() { |
2787 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2787 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2788 | 2788 | $this->php->version = phpversion(); |
2789 | 2789 | } |
2790 | 2790 | |
@@ -2803,10 +2803,10 @@ discard block |
||
2803 | 2803 | * @type string $msg Any message to be displayed. |
2804 | 2804 | * } |
2805 | 2805 | */ |
2806 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2807 | - if ( ! empty( $this->php->max_input_vars ) |
|
2808 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2809 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2806 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2807 | + if ( ! empty($this->php->max_input_vars) |
|
2808 | + && ($input_count >= $this->php->max_input_vars) |
|
2809 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2810 | 2810 | ) { |
2811 | 2811 | return sprintf( |
2812 | 2812 | __( |
@@ -2872,7 +2872,7 @@ discard block |
||
2872 | 2872 | */ |
2873 | 2873 | public function __construct() { |
2874 | 2874 | $this->payment_settings = array(); |
2875 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2875 | + $this->active_gateways = array('Invoice' => false); |
|
2876 | 2876 | } |
2877 | 2877 | } |
2878 | 2878 |