@@ -9,8 +9,8 @@ |
||
9 | 9 | /** @var string $after_list_table */ |
10 | 10 | ?> |
11 | 11 | <?php echo $before_list_table; ?> |
12 | -<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url;?>" method="get"> |
|
13 | - <?php $list_table->search_box( $search['btn_label'], $current_page ); ?><br /> |
|
12 | +<form id="<?php echo $list_table_class; ?>-table-frm" action="<?php echo $table_url; ?>" method="get"> |
|
13 | + <?php $list_table->search_box($search['btn_label'], $current_page); ?><br /> |
|
14 | 14 | <?php echo $sortable_list_table_form_fields; ?> |
15 | 15 | <?php $list_table->display_views(); ?> |
16 | 16 | <?php $list_table->display(); ?> |
@@ -1315,8 +1315,8 @@ discard block |
||
1315 | 1315 | * verifies user access for this admin page |
1316 | 1316 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1317 | 1317 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1318 | - * @return BOOL|wp_die() |
|
1319 | - */ |
|
1318 | + * @return BOOL|wp_die() |
|
1319 | + */ |
|
1320 | 1320 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1321 | 1321 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1322 | 1322 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1703,11 +1703,11 @@ discard block |
||
1703 | 1703 | |
1704 | 1704 | |
1705 | 1705 | /** |
1706 | - * admin_footer_scripts_eei18n_js_strings |
|
1707 | - * |
|
1708 | - * @access public |
|
1709 | - * @return void |
|
1710 | - */ |
|
1706 | + * admin_footer_scripts_eei18n_js_strings |
|
1707 | + * |
|
1708 | + * @access public |
|
1709 | + * @return void |
|
1710 | + */ |
|
1711 | 1711 | public function admin_footer_scripts_eei18n_js_strings() { |
1712 | 1712 | |
1713 | 1713 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1763,11 +1763,11 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | |
1765 | 1765 | /** |
1766 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1767 | - * |
|
1768 | - * @access public |
|
1769 | - * @return void |
|
1770 | - */ |
|
1766 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1767 | + * |
|
1768 | + * @access public |
|
1769 | + * @return void |
|
1770 | + */ |
|
1771 | 1771 | public function add_xdebug_style() { |
1772 | 1772 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1773 | 1773 | } |
@@ -1824,9 +1824,9 @@ discard block |
||
1824 | 1824 | |
1825 | 1825 | /** |
1826 | 1826 | * set current view for List Table |
1827 | - * @access public |
|
1828 | - * @return array |
|
1829 | - */ |
|
1827 | + * @access public |
|
1828 | + * @return array |
|
1829 | + */ |
|
1830 | 1830 | protected function _set_list_table_view() { |
1831 | 1831 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1832 | 1832 | |
@@ -1903,7 +1903,7 @@ discard block |
||
1903 | 1903 | * @access protected |
1904 | 1904 | * @param int $max_entries total number of rows in the table |
1905 | 1905 | * @return string |
1906 | - */ |
|
1906 | + */ |
|
1907 | 1907 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1908 | 1908 | |
1909 | 1909 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1948,9 +1948,9 @@ discard block |
||
1948 | 1948 | |
1949 | 1949 | /** |
1950 | 1950 | * _set_search_attributes |
1951 | - * @access protected |
|
1952 | - * @return void |
|
1953 | - */ |
|
1951 | + * @access protected |
|
1952 | + * @return void |
|
1953 | + */ |
|
1954 | 1954 | public function _set_search_attributes() { |
1955 | 1955 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1956 | 1956 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1970,7 +1970,7 @@ discard block |
||
1970 | 1970 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1971 | 1971 | * @access private |
1972 | 1972 | * @return void |
1973 | - */ |
|
1973 | + */ |
|
1974 | 1974 | private function _add_registered_meta_boxes() { |
1975 | 1975 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1976 | 1976 | |
@@ -2185,7 +2185,6 @@ discard block |
||
2185 | 2185 | * Note: currently there is no validation for this. However if you want the delete button, the |
2186 | 2186 | * save, and save and close buttons to work properly, then you will want to include a |
2187 | 2187 | * values for the name and id arguments. |
2188 | - |
|
2189 | 2188 | * |
2190 | 2189 | *@todo Add in validation for name/id arguments. |
2191 | 2190 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2245,9 +2244,9 @@ discard block |
||
2245 | 2244 | |
2246 | 2245 | /** |
2247 | 2246 | * displays an error message to ppl who have javascript disabled |
2248 | - * @access private |
|
2249 | - * @return string |
|
2250 | - */ |
|
2247 | + * @access private |
|
2248 | + * @return string |
|
2249 | + */ |
|
2251 | 2250 | private function _display_no_javascript_warning() { |
2252 | 2251 | ?> |
2253 | 2252 | <noscript> |
@@ -2270,9 +2269,9 @@ discard block |
||
2270 | 2269 | |
2271 | 2270 | /** |
2272 | 2271 | * displays espresso success and/or error notices |
2273 | - * @access private |
|
2274 | - * @return string |
|
2275 | - */ |
|
2272 | + * @access private |
|
2273 | + * @return string |
|
2274 | + */ |
|
2276 | 2275 | private function _display_espresso_notices() { |
2277 | 2276 | $notices = $this->_get_transient( TRUE ); |
2278 | 2277 | echo stripslashes($notices); |
@@ -2284,10 +2283,10 @@ discard block |
||
2284 | 2283 | |
2285 | 2284 | |
2286 | 2285 | /** |
2287 | - * spinny things pacify the masses |
|
2288 | - * @access private |
|
2289 | - * @return string |
|
2290 | - */ |
|
2286 | + * spinny things pacify the masses |
|
2287 | + * @access private |
|
2288 | + * @return string |
|
2289 | + */ |
|
2291 | 2290 | protected function _add_admin_page_ajax_loading_img() { |
2292 | 2291 | ?> |
2293 | 2292 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2301,10 +2300,10 @@ discard block |
||
2301 | 2300 | |
2302 | 2301 | |
2303 | 2302 | /** |
2304 | - * add admin page overlay for modal boxes |
|
2305 | - * @access private |
|
2306 | - * @return string |
|
2307 | - */ |
|
2303 | + * add admin page overlay for modal boxes |
|
2304 | + * @access private |
|
2305 | + * @return string |
|
2306 | + */ |
|
2308 | 2307 | protected function _add_admin_page_overlay() { |
2309 | 2308 | ?> |
2310 | 2309 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2366,10 +2365,10 @@ discard block |
||
2366 | 2365 | |
2367 | 2366 | |
2368 | 2367 | /** |
2369 | - * generates HTML wrapper for an admin details page |
|
2370 | - * @access public |
|
2371 | - * @return void |
|
2372 | - */ |
|
2368 | + * generates HTML wrapper for an admin details page |
|
2369 | + * @access public |
|
2370 | + * @return void |
|
2371 | + */ |
|
2373 | 2372 | public function display_admin_page_with_sidebar() { |
2374 | 2373 | |
2375 | 2374 | $this->_display_admin_page(TRUE); |
@@ -2379,10 +2378,10 @@ discard block |
||
2379 | 2378 | |
2380 | 2379 | |
2381 | 2380 | /** |
2382 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2383 | - * @access public |
|
2384 | - * @return void |
|
2385 | - */ |
|
2381 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2382 | + * @access public |
|
2383 | + * @return void |
|
2384 | + */ |
|
2386 | 2385 | public function display_admin_page_with_no_sidebar() { |
2387 | 2386 | $this->_display_admin_page(); |
2388 | 2387 | } |
@@ -2617,11 +2616,11 @@ discard block |
||
2617 | 2616 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2618 | 2617 | if ( NULL === error_get_last() || ! headers_sent() ) |
2619 | 2618 | header('Content-Type: application/json; charset=UTF-8'); |
2620 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2621 | - echo wp_json_encode( $json ); |
|
2622 | - } else { |
|
2623 | - echo json_encode( $json ); |
|
2624 | - } |
|
2619 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2620 | + echo wp_json_encode( $json ); |
|
2621 | + } else { |
|
2622 | + echo json_encode( $json ); |
|
2623 | + } |
|
2625 | 2624 | exit(); |
2626 | 2625 | } |
2627 | 2626 | |
@@ -2660,11 +2659,11 @@ discard block |
||
2660 | 2659 | |
2661 | 2660 | |
2662 | 2661 | /** |
2663 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2664 | - * @access public |
|
2665 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2666 | - * @return void |
|
2667 | - */ |
|
2662 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2663 | + * @access public |
|
2664 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2665 | + * @return void |
|
2666 | + */ |
|
2668 | 2667 | public function admin_page_wrapper($about = FALSE) { |
2669 | 2668 | |
2670 | 2669 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2718,15 +2717,15 @@ discard block |
||
2718 | 2717 | |
2719 | 2718 | |
2720 | 2719 | /** |
2721 | - * sort nav tabs |
|
2722 | - * @access public |
|
2723 | - * @return void |
|
2724 | - */ |
|
2720 | + * sort nav tabs |
|
2721 | + * @access public |
|
2722 | + * @return void |
|
2723 | + */ |
|
2725 | 2724 | private function _sort_nav_tabs( $a, $b ) { |
2726 | 2725 | if ($a['order'] == $b['order']) { |
2727 | - return 0; |
|
2728 | - } |
|
2729 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2726 | + return 0; |
|
2727 | + } |
|
2728 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2730 | 2729 | } |
2731 | 2730 | |
2732 | 2731 |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | * |
484 | 484 | * @final |
485 | 485 | * @access protected |
486 | - * @return void |
|
486 | + * @return false|null |
|
487 | 487 | */ |
488 | 488 | final protected function _page_setup() { |
489 | 489 | |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | * All this method does is verify the incoming request and make sure that routes exist for it. We do this early so we know if we need to drop out. |
758 | 758 | * |
759 | 759 | * @access protected |
760 | - * @return void |
|
760 | + * @return false|null |
|
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | 763 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | /** |
820 | 820 | * this method simply verifies a given route and makes sure its an actual route available for the loaded page |
821 | 821 | * @param string $route the route name we're verifying |
822 | - * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
822 | + * @return boolean (bool|Exception) we'll throw an exception if this isn't a valid route. |
|
823 | 823 | */ |
824 | 824 | protected function _verify_route( $route ) { |
825 | 825 | if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
@@ -2761,7 +2761,7 @@ discard block |
||
2761 | 2761 | /** |
2762 | 2762 | * sort nav tabs |
2763 | 2763 | * @access public |
2764 | - * @return void |
|
2764 | + * @return integer |
|
2765 | 2765 | */ |
2766 | 2766 | private function _sort_nav_tabs( $a, $b ) { |
2767 | 2767 | if ($a['order'] == $b['order']) { |
@@ -3394,7 +3394,7 @@ discard block |
||
3394 | 3394 | |
3395 | 3395 | |
3396 | 3396 | /** |
3397 | - * @return mixed |
|
3397 | + * @return string[] |
|
3398 | 3398 | */ |
3399 | 3399 | public function default_espresso_metaboxes() { |
3400 | 3400 | return $this->_default_espresso_metaboxes; |
@@ -3412,7 +3412,7 @@ discard block |
||
3412 | 3412 | |
3413 | 3413 | |
3414 | 3414 | /** |
3415 | - * @return mixed |
|
3415 | + * @return string |
|
3416 | 3416 | */ |
3417 | 3417 | public function wp_page_slug() { |
3418 | 3418 | return $this->_wp_page_slug; |
@@ -3425,7 +3425,6 @@ discard block |
||
3425 | 3425 | * |
3426 | 3426 | * @access protected |
3427 | 3427 | * @param string $tab |
3428 | - * @param array $data |
|
3429 | 3428 | * @param string $file file where error occurred |
3430 | 3429 | * @param string $func function where error occurred |
3431 | 3430 | * @param string $line line no where error occurred |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //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. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // 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 |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $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'; |
|
511 | + $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'; |
|
512 | 512 | |
513 | 513 | //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. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //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 |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //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. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //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 |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $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 ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $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); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //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 |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $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 ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $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); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $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' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $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'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $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 ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $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); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $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__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $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__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,63 +872,63 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
875 | + if ( ! $this->_is_UI_request) |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
879 | 879 | |
880 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
880 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
881 | 881 | // set nonce from post data |
882 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
883 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
882 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
883 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
884 | 884 | } |
885 | 885 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
886 | + if ($this->_is_UI_request) |
|
887 | 887 | $this->_set_nav_tabs(); |
888 | 888 | |
889 | 889 | // grab callback function |
890 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
890 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
891 | 891 | |
892 | 892 | // check if callback has args |
893 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
893 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
894 | 894 | |
895 | 895 | $error_msg = ''; |
896 | 896 | |
897 | 897 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
898 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
898 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //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). |
903 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
903 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
904 | 904 | |
905 | - if ( ! empty( $func )) { |
|
905 | + if ( ! empty($func)) { |
|
906 | 906 | $base_call = $addon_call = FALSE; |
907 | 907 | //try to access page route via this class |
908 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
908 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
909 | 909 | // user error msg |
910 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
910 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
911 | 911 | // developer error msg |
912 | - $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 ); |
|
912 | + $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); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | //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) |
916 | 916 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
917 | 917 | |
918 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
919 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
920 | - $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 ); |
|
918 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
919 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
920 | + $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); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
924 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
925 | + throw new EE_Error($error_msg); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | //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. |
929 | 929 | //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. |
930 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
931 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
930 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
931 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * @param string $new_route New (non header) route to redirect to. |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - protected function _reset_routing_properties( $new_route ) { |
|
947 | + protected function _reset_routing_properties($new_route) { |
|
948 | 948 | $this->_is_UI_request = TRUE; |
949 | 949 | //now we set the current route to whatever the headers_sent_route is set at |
950 | 950 | $this->_req_data['action'] = $new_route; |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
991 | 991 | * @return string |
992 | 992 | */ |
993 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
993 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
994 | 994 | |
995 | 995 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
996 | - if ( $sticky ) { |
|
996 | + if ($sticky) { |
|
997 | 997 | $request = $_REQUEST; |
998 | - unset( $request['_wp_http_referer'] ); |
|
999 | - unset( $request['wp_referer'] ); |
|
1000 | - foreach ( $request as $key => $value ) { |
|
998 | + unset($request['_wp_http_referer']); |
|
999 | + unset($request['wp_referer']); |
|
1000 | + foreach ($request as $key => $value) { |
|
1001 | 1001 | //do not add nonces |
1002 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1002 | + if (strpos($key, 'nonce') !== false) { |
|
1003 | 1003 | continue; |
1004 | 1004 | } |
1005 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1005 | + $args['wp_referer['.$key.']'] = $value; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1009 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @uses EEH_Template::get_help_tab_link() |
1023 | 1023 | * @return string generated link |
1024 | 1024 | */ |
1025 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1026 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1025 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1026 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1040,30 +1040,30 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | protected function _add_help_tabs() { |
1042 | 1042 | $tour_buttons = ''; |
1043 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1043 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1044 | 1044 | $config = $this->_page_config[$this->_req_action]; |
1045 | 1045 | |
1046 | 1046 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1047 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1047 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1048 | 1048 | $tb = array(); |
1049 | 1049 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1050 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1051 | 1051 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1052 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1053 | 1053 | continue; |
1054 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1054 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1055 | 1055 | } |
1056 | 1056 | $tour_buttons .= implode('<br />', $tb); |
1057 | 1057 | $tour_buttons .= '</div></div>'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1061 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1062 | 1062 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - 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) ) ); |
|
1063 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1064 | + 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))); |
|
1065 | 1065 | |
1066 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1066 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1067 | 1067 | |
1068 | 1068 | $content .= $tour_buttons; //add help tour buttons. |
1069 | 1069 | |
@@ -1072,49 +1072,49 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1075 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1075 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1076 | 1076 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1080 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1080 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1081 | 1081 | $_ht['id'] = $this->page_slug; |
1082 | 1082 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1083 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1083 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1084 | 1084 | $this->_current_screen->add_help_tab($_ht); |
1085 | 1085 | }/**/ |
1086 | 1086 | |
1087 | 1087 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1088 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1089 | 1089 | |
1090 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1090 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1091 | 1091 | //we're here so there ARE help tabs! |
1092 | 1092 | |
1093 | 1093 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['title'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - 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') ); |
|
1098 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1099 | + 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')); |
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | //first priority goes to content. |
1104 | - if ( !empty($cfg['content'] ) ) { |
|
1105 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | + if ( ! empty($cfg['content'])) { |
|
1105 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1106 | 1106 | |
1107 | 1107 | //second priority goes to filename |
1108 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1109 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1108 | + } else if ( ! empty($cfg['filename'])) { |
|
1109 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | //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) |
1113 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1113 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1114 | 1114 | |
1115 | 1115 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1116 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1117 | - 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__ ); |
|
1116 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1117 | + 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__); |
|
1118 | 1118 | return; |
1119 | 1119 | } |
1120 | 1120 | $template_args['admin_page_obj'] = $this; |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | //check if callback is valid |
1128 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1129 | - 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__ ); |
|
1128 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1129 | + 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__); |
|
1130 | 1130 | return; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | //setup config array for help tab method |
1134 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1134 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1135 | 1135 | $_ht = array( |
1136 | 1136 | 'id' => $id, |
1137 | 1137 | 'title' => $cfg['title'], |
1138 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1138 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1139 | 1139 | 'content' => $content |
1140 | 1140 | ); |
1141 | 1141 | |
1142 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1142 | + $this->_current_screen->add_help_tab($_ht); |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1159,49 +1159,49 @@ discard block |
||
1159 | 1159 | $this->_help_tour = array(); |
1160 | 1160 | |
1161 | 1161 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1162 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1163 | 1163 | return; |
1164 | 1164 | |
1165 | 1165 | //loop through _page_config to find any help_tour defined |
1166 | - foreach ( $this->_page_config as $route => $config ) { |
|
1166 | + foreach ($this->_page_config as $route => $config) { |
|
1167 | 1167 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1168 | + if ($route !== $this->_req_action) |
|
1169 | 1169 | continue; |
1170 | 1170 | |
1171 | - if ( isset( $config['help_tour'] ) ) { |
|
1171 | + if (isset($config['help_tour'])) { |
|
1172 | 1172 | |
1173 | - foreach( $config['help_tour'] as $tour ) { |
|
1174 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1173 | + foreach ($config['help_tour'] as $tour) { |
|
1174 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1175 | 1175 | //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 |
1176 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1176 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1177 | 1177 | |
1178 | 1178 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1179 | - if ( !is_readable($file_path) ) { |
|
1180 | - 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__ ); |
|
1179 | + if ( ! is_readable($file_path)) { |
|
1180 | + 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__); |
|
1181 | 1181 | return; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | require_once $file_path; |
1185 | - if ( !class_exists( $tour ) ) { |
|
1186 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1187 | - $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) ); |
|
1188 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1185 | + if ( ! class_exists($tour)) { |
|
1186 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1187 | + $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)); |
|
1188 | + throw new EE_Error(implode('||', $error_msg)); |
|
1189 | 1189 | } |
1190 | 1190 | $a = new ReflectionClass($tour); |
1191 | 1191 | $tour_obj = $a->newInstance($this->_is_caf); |
1192 | 1192 | |
1193 | 1193 | $tours[] = $tour_obj; |
1194 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1194 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1198 | 1198 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1199 | 1199 | $tours[] = $end_stop_tour; |
1200 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1200 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - if ( !empty( $tours ) ) |
|
1204 | + if ( ! empty($tours)) |
|
1205 | 1205 | $this->_help_tour['tours'] = $tours; |
1206 | 1206 | |
1207 | 1207 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @return void |
1218 | 1218 | */ |
1219 | 1219 | protected function _add_qtips() { |
1220 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1220 | + if (isset($this->_route_config['qtips'])) { |
|
1221 | 1221 | $qtips = (array) $this->_route_config['qtips']; |
1222 | 1222 | //load qtip loader |
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,19 +1426,19 @@ 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 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1441 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | |
@@ -1462,18 +1462,18 @@ discard block |
||
1462 | 1462 | * @access protected |
1463 | 1463 | * @return string content |
1464 | 1464 | */ |
1465 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1465 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1466 | 1466 | $content = ''; |
1467 | 1467 | |
1468 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1469 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1468 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1469 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1470 | 1470 | |
1471 | 1471 | |
1472 | 1472 | //loop through the array and setup content |
1473 | - foreach ( $help_array as $trigger => $help ) { |
|
1473 | + foreach ($help_array as $trigger => $help) { |
|
1474 | 1474 | //make sure the array is setup properly |
1475 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1476 | - 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') ); |
|
1475 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1476 | + 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')); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1483,10 +1483,10 @@ discard block |
||
1483 | 1483 | 'help_popup_content' => $help['content'] |
1484 | 1484 | ); |
1485 | 1485 | |
1486 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1486 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | - if ( $display ) |
|
1489 | + if ($display) |
|
1490 | 1490 | echo $content; |
1491 | 1491 | else |
1492 | 1492 | return $content; |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | */ |
1504 | 1504 | private function _get_help_content() { |
1505 | 1505 | //what is the method we're looking for? |
1506 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1506 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1507 | 1507 | |
1508 | 1508 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1509 | + if ( ! method_exists($this, $method_name)) |
|
1510 | 1510 | return array(); |
1511 | 1511 | |
1512 | 1512 | //k we're good to go let's retrieve the help array |
1513 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1513 | + $help_array = call_user_func(array($this, $method_name)); |
|
1514 | 1514 | |
1515 | 1515 | //make sure we've got an array! |
1516 | - if ( !is_array($help_array) ) { |
|
1517 | - 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' ) ); |
|
1516 | + if ( ! is_array($help_array)) { |
|
1517 | + 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')); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | return $help_array; |
@@ -1536,27 +1536,27 @@ discard block |
||
1536 | 1536 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1539 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1540 | 1540 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1541 | + if (defined('DOING_AJAX')) return; |
|
1542 | 1542 | |
1543 | 1543 | //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 |
1544 | 1544 | $help_array = $this->_get_help_content(); |
1545 | 1545 | $help_content = ''; |
1546 | 1546 | |
1547 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1547 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1548 | 1548 | $help_array[$trigger_id] = array( |
1549 | 1549 | 'title' => __('Missing Content', 'event_espresso'), |
1550 | 1550 | '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') |
1551 | 1551 | ); |
1552 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1552 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | //let's setup the trigger |
1556 | - $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>'; |
|
1557 | - $content = $content . $help_content; |
|
1556 | + $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>'; |
|
1557 | + $content = $content.$help_content; |
|
1558 | 1558 | |
1559 | - if ( $display ) |
|
1559 | + if ($display) |
|
1560 | 1560 | echo $content; |
1561 | 1561 | else |
1562 | 1562 | return $content; |
@@ -1613,15 +1613,15 @@ discard block |
||
1613 | 1613 | public function load_global_scripts_styles() { |
1614 | 1614 | /** STYLES **/ |
1615 | 1615 | // add debugging styles |
1616 | - if ( WP_DEBUG ) { |
|
1617 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1616 | + if (WP_DEBUG) { |
|
1617 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | //register all styles |
1621 | - 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 ); |
|
1622 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | + 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); |
|
1622 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //helpers styles |
1624 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1624 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1625 | 1625 | //enqueue global styles |
1626 | 1626 | wp_enqueue_style('ee-admin-css'); |
1627 | 1627 | |
@@ -1629,66 +1629,66 @@ discard block |
||
1629 | 1629 | /** SCRIPTS **/ |
1630 | 1630 | |
1631 | 1631 | //register all scripts |
1632 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - 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 ); |
|
1632 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1633 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + 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); |
|
1635 | 1635 | |
1636 | - 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 ); |
|
1636 | + 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 | 1637 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1638 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1638 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1639 | 1639 | add_filter('FHEE_load_joyride', '__return_true'); |
1640 | 1640 | |
1641 | 1641 | //script for sorting tables |
1642 | - 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); |
|
1642 | + 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 | 1643 | //script for parsing uri's |
1644 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //and parsing associative serialized form elements |
1646 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | 1647 | //helpers scripts |
1648 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | 1652 | |
1653 | 1653 | //google charts |
1654 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1654 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1655 | 1655 | |
1656 | 1656 | //enqueue global scripts |
1657 | 1657 | |
1658 | 1658 | //taking care of metaboxes |
1659 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1659 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1660 | 1660 | wp_enqueue_script('dashboard'); |
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | //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 |
1664 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1664 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1665 | 1665 | wp_enqueue_script('ee_admin_js'); |
1666 | 1666 | wp_enqueue_style('ee-admin-css'); |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | //localize script for ajax lazy loading |
1671 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1672 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1672 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | /** |
1676 | 1676 | * help tour stuff |
1677 | 1677 | */ |
1678 | - if ( !empty( $this->_help_tour ) ) { |
|
1678 | + if ( ! empty($this->_help_tour)) { |
|
1679 | 1679 | |
1680 | 1680 | //register the js for kicking things off |
1681 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1681 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1682 | 1682 | |
1683 | 1683 | //setup tours for the js tour object |
1684 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1684 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1685 | 1685 | $tours[] = array( |
1686 | 1686 | 'id' => $tour->get_slug(), |
1687 | 1687 | 'options' => $tour->get_options() |
1688 | 1688 | ); |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1691 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1692 | 1692 | |
1693 | 1693 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1694 | 1694 | } |
@@ -1706,52 +1706,52 @@ discard block |
||
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1709 | - 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' ); |
|
1710 | - |
|
1711 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1735 | - |
|
1736 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1709 | + 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'); |
|
1710 | + |
|
1711 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1735 | + |
|
1736 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1750 | 1750 | |
1751 | 1751 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1752 | 1752 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1753 | 1753 | //espresso_core is listed as a dependency of ee_admin_js. |
1754 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1754 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1755 | 1755 | |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1785,23 +1785,23 @@ discard block |
||
1785 | 1785 | protected function _set_list_table() { |
1786 | 1786 | |
1787 | 1787 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1788 | + if ( ! isset($this->_route_config['list_table'])) |
|
1789 | 1789 | return; //not a list_table view so get out. |
1790 | 1790 | |
1791 | 1791 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1792 | |
1793 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1793 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1794 | 1794 | //user error msg |
1795 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1795 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1796 | 1796 | //developer error msg |
1797 | - $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 ); |
|
1798 | - throw new EE_Error( $error_msg ); |
|
1797 | + $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); |
|
1798 | + throw new EE_Error($error_msg); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1805 | 1805 | |
1806 | 1806 | $this->_set_list_table_view(); |
1807 | 1807 | $this->_set_list_table_object(); |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | * @return array |
1824 | 1824 | */ |
1825 | 1825 | protected function _set_list_table_view() { |
1826 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1826 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | // looking at active items or dumpster diving ? |
1830 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1831 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1830 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1831 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1832 | 1832 | } else { |
1833 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1833 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @throws \EE_Error |
1844 | 1844 | */ |
1845 | 1845 | protected function _set_list_table_object() { |
1846 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1847 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1846 | + if (isset($this->_route_config['list_table'])) { |
|
1847 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1848 | 1848 | throw new EE_Error( |
1849 | 1849 | sprintf( |
1850 | 1850 | __( |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | 'event_espresso' |
1853 | 1853 | ), |
1854 | 1854 | $this->_route_config['list_table'], |
1855 | - get_class( $this ) |
|
1855 | + get_class($this) |
|
1856 | 1856 | ) |
1857 | 1857 | ); |
1858 | 1858 | } |
1859 | 1859 | $list_table = $this->_route_config['list_table']; |
1860 | - $this->_list_table_object = new $list_table( $this ); |
|
1860 | + $this->_list_table_object = new $list_table($this); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1874,27 +1874,27 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1877 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1878 | 1878 | |
1879 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1879 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1880 | 1880 | |
1881 | - if ( empty( $this->_views )) { |
|
1881 | + if (empty($this->_views)) { |
|
1882 | 1882 | $this->_views = array(); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // cycle thru views |
1886 | - foreach ( $this->_views as $key => $view ) { |
|
1886 | + foreach ($this->_views as $key => $view) { |
|
1887 | 1887 | $query_args = array(); |
1888 | 1888 | // check for current view |
1889 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1889 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1890 | 1890 | $query_args['action'] = $this->_req_action; |
1891 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1891 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1892 | 1892 | $query_args['status'] = $view['slug']; |
1893 | 1893 | //merge any other arguments sent in. |
1894 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1895 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1894 | + if (isset($extra_query_args[$view['slug']])) { |
|
1895 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1896 | 1896 | } |
1897 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1897 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return $this->_views; |
@@ -1911,15 +1911,15 @@ discard block |
||
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | 1913 | */ |
1914 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1914 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1915 | 1915 | |
1916 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1917 | - $values = array( 10, 25, 50, 100 ); |
|
1918 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1916 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1917 | + $values = array(10, 25, 50, 100); |
|
1918 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1919 | 1919 | |
1920 | - if ( $max_entries ) { |
|
1920 | + if ($max_entries) { |
|
1921 | 1921 | $values[] = $max_entries; |
1922 | - sort( $values ); |
|
1922 | + sort($values); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | $entries_per_page_dropdown = ' |
@@ -1928,15 +1928,15 @@ discard block |
||
1928 | 1928 | Show |
1929 | 1929 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1930 | 1930 | |
1931 | - foreach ( $values as $value ) { |
|
1932 | - if ( $value < $max_entries ) { |
|
1933 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1931 | + foreach ($values as $value) { |
|
1932 | + if ($value < $max_entries) { |
|
1933 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1934 | 1934 | $entries_per_page_dropdown .= ' |
1935 | 1935 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1936 | 1936 | } |
1937 | 1937 | } |
1938 | 1938 | |
1939 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1939 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1940 | 1940 | $entries_per_page_dropdown .= ' |
1941 | 1941 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1942 | 1942 | |
@@ -1959,8 +1959,8 @@ discard block |
||
1959 | 1959 | * @return void |
1960 | 1960 | */ |
1961 | 1961 | public function _set_search_attributes() { |
1962 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1963 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1962 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1963 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | /*** END LIST TABLE METHODS **/ |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | * @return void |
1980 | 1980 | */ |
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1982 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1983 | 1983 | |
1984 | 1984 | //we only add meta boxes if the page_route calls for it |
1985 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1985 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1986 | 1986 | && is_array( |
1987 | 1987 | $this->_route_config['metaboxes'] |
1988 | 1988 | ) |
@@ -1990,27 +1990,27 @@ discard block |
||
1990 | 1990 | // this simply loops through the callbacks provided |
1991 | 1991 | // and checks if there is a corresponding callback registered by the child |
1992 | 1992 | // if there is then we go ahead and process the metabox loader. |
1993 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1993 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1994 | 1994 | // first check for Closures |
1995 | - if ( is_callable( $metabox_callback ) ) { |
|
1995 | + if (is_callable($metabox_callback)) { |
|
1996 | 1996 | $result = $metabox_callback(); |
1997 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1998 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1997 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1998 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1999 | 1999 | } else { |
2000 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2000 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2001 | 2001 | } |
2002 | - if ( $result === FALSE ) { |
|
2002 | + if ($result === FALSE) { |
|
2003 | 2003 | // user error msg |
2004 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2004 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2005 | 2005 | // developer error msg |
2006 | - $error_msg .= '||' . sprintf( |
|
2006 | + $error_msg .= '||'.sprintf( |
|
2007 | 2007 | __( |
2008 | 2008 | '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.', |
2009 | 2009 | 'event_espresso' |
2010 | 2010 | ), |
2011 | 2011 | $metabox_callback |
2012 | 2012 | ); |
2013 | - throw new EE_Error( $error_msg ); |
|
2013 | + throw new EE_Error($error_msg); |
|
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } |
@@ -2027,17 +2027,17 @@ discard block |
||
2027 | 2027 | * @return void |
2028 | 2028 | */ |
2029 | 2029 | private function _add_screen_columns() { |
2030 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
2030 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
2031 | 2031 | |
2032 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2032 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2033 | 2033 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2034 | 2034 | $screen_id = $this->_current_screen->id; |
2035 | 2035 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2036 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2037 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2036 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2037 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2038 | 2038 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2039 | 2039 | $this->_template_args['screen'] = $this->_current_screen; |
2040 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2040 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2041 | 2041 | |
2042 | 2042 | //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. |
2043 | 2043 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2054,11 +2054,11 @@ discard block |
||
2054 | 2054 | */ |
2055 | 2055 | |
2056 | 2056 | private function _espresso_news_post_box() { |
2057 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2058 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2057 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2058 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2059 | 2059 | $this, |
2060 | 2060 | 'espresso_news_post_box' |
2061 | - ), $this->_wp_page_slug, 'side' ); |
|
2061 | + ), $this->_wp_page_slug, 'side'); |
|
2062 | 2062 | } |
2063 | 2063 | |
2064 | 2064 | |
@@ -2066,14 +2066,14 @@ discard block |
||
2066 | 2066 | * Code for setting up espresso ratings request metabox. |
2067 | 2067 | */ |
2068 | 2068 | protected function _espresso_ratings_request() { |
2069 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2069 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2070 | 2070 | return ''; |
2071 | 2071 | } |
2072 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2073 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2072 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2073 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2074 | 2074 | $this, |
2075 | 2075 | 'espresso_ratings_request' |
2076 | - ), $this->_wp_page_slug, 'side' ); |
|
2076 | + ), $this->_wp_page_slug, 'side'); |
|
2077 | 2077 | } |
2078 | 2078 | |
2079 | 2079 | |
@@ -2081,34 +2081,34 @@ discard block |
||
2081 | 2081 | * Code for setting up espresso ratings request metabox content. |
2082 | 2082 | */ |
2083 | 2083 | public function espresso_ratings_request() { |
2084 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2085 | - EEH_Template::display_template( $template_path, array() ); |
|
2084 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2085 | + EEH_Template::display_template($template_path, array()); |
|
2086 | 2086 | } |
2087 | 2087 | |
2088 | 2088 | |
2089 | 2089 | |
2090 | 2090 | |
2091 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2092 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2093 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2094 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2095 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2096 | - $post = '</div>' . "\n"; |
|
2091 | + public static function cached_rss_display($rss_id, $url) { |
|
2092 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2093 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2094 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2095 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2096 | + $post = '</div>'."\n"; |
|
2097 | 2097 | |
2098 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2099 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2100 | - echo $pre . $output . $post; |
|
2098 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2099 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2100 | + echo $pre.$output.$post; |
|
2101 | 2101 | return TRUE; |
2102 | 2102 | } |
2103 | 2103 | |
2104 | - if ( ! $doing_ajax ) { |
|
2105 | - echo $pre . $loading . $post; |
|
2104 | + if ( ! $doing_ajax) { |
|
2105 | + echo $pre.$loading.$post; |
|
2106 | 2106 | return FALSE; |
2107 | 2107 | } |
2108 | 2108 | |
2109 | 2109 | ob_start(); |
2110 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2111 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2110 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2111 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2112 | 2112 | return TRUE; |
2113 | 2113 | |
2114 | 2114 | } |
@@ -2120,13 +2120,13 @@ discard block |
||
2120 | 2120 | <div id="espresso_news_post_box_content" class="infolinks"> |
2121 | 2121 | <?php |
2122 | 2122 | // Get RSS Feed(s) |
2123 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2123 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2124 | 2124 | $url = urlencode($feed_url); |
2125 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2125 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2126 | 2126 | |
2127 | 2127 | ?> |
2128 | 2128 | </div> |
2129 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2129 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2130 | 2130 | </div> |
2131 | 2131 | <?php |
2132 | 2132 | } |
@@ -2147,32 +2147,32 @@ discard block |
||
2147 | 2147 | |
2148 | 2148 | protected function _espresso_sponsors_post_box() { |
2149 | 2149 | |
2150 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2151 | - if ( $show_sponsors ) |
|
2152 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2150 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2151 | + if ($show_sponsors) |
|
2152 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2153 | 2153 | } |
2154 | 2154 | |
2155 | 2155 | |
2156 | 2156 | public function espresso_sponsors_post_box() { |
2157 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2158 | - EEH_Template::display_template( $templatepath ); |
|
2157 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2158 | + EEH_Template::display_template($templatepath); |
|
2159 | 2159 | } |
2160 | 2160 | |
2161 | 2161 | |
2162 | 2162 | |
2163 | 2163 | private function _publish_post_box() { |
2164 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2164 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2165 | 2165 | |
2166 | 2166 | //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) |
2167 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2168 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2167 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2168 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2169 | 2169 | } else { |
2170 | 2170 | $box_label = __('Publish', 'event_espresso'); |
2171 | 2171 | } |
2172 | 2172 | |
2173 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2173 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2174 | 2174 | |
2175 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2175 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2176 | 2176 | |
2177 | 2177 | } |
2178 | 2178 | |
@@ -2180,9 +2180,9 @@ discard block |
||
2180 | 2180 | |
2181 | 2181 | public function editor_overview() { |
2182 | 2182 | //if we have extra content set let's add it in if not make sure its empty |
2183 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2184 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2185 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2183 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2184 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2185 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2186 | 2186 | } |
2187 | 2187 | |
2188 | 2188 | |
@@ -2198,8 +2198,8 @@ discard block |
||
2198 | 2198 | * @see $this->_set_publish_post_box_vars for param details |
2199 | 2199 | * @since 4.6.0 |
2200 | 2200 | */ |
2201 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2202 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2201 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2202 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2203 | 2203 | } |
2204 | 2204 | |
2205 | 2205 | |
@@ -2227,17 +2227,17 @@ discard block |
||
2227 | 2227 | $both_btns = true |
2228 | 2228 | ) { |
2229 | 2229 | // if Save & Close, use a custom redirect URL or default to the main page? |
2230 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2230 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2231 | 2231 | // create the Save & Close and Save buttons |
2232 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2232 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2233 | 2233 | //if we have extra content set let's add it in if not make sure its empty |
2234 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2234 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2235 | 2235 | |
2236 | 2236 | |
2237 | - if ( $delete && ! empty( $id ) ) { |
|
2237 | + if ($delete && ! empty($id)) { |
|
2238 | 2238 | //make sure we have a default if just true is sent. |
2239 | 2239 | $delete = ! empty($delete) ? $delete : 'delete'; |
2240 | - $delete_link_args = array( $name => $id ); |
|
2240 | + $delete_link_args = array($name => $id); |
|
2241 | 2241 | $delete = $this->get_action_link_or_button( |
2242 | 2242 | $delete, |
2243 | 2243 | $delete, |
@@ -2248,8 +2248,8 @@ discard block |
||
2248 | 2248 | ); |
2249 | 2249 | } |
2250 | 2250 | |
2251 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2252 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2251 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2252 | + if ( ! empty($name) && ! empty($id)) { |
|
2253 | 2253 | $hidden_field_arr[$name] = array( |
2254 | 2254 | 'type' => 'hidden', |
2255 | 2255 | 'value' => $id |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | $hf = ''; |
2260 | 2260 | } |
2261 | 2261 | // add hidden field |
2262 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2262 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2263 | 2263 | |
2264 | 2264 | } |
2265 | 2265 | |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | <noscript> |
2277 | 2277 | <div id="no-js-message" class="error"> |
2278 | 2278 | <p style="font-size:1.3em;"> |
2279 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2280 | - <?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' ); ?> |
|
2279 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2280 | + <?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'); ?> |
|
2281 | 2281 | </p> |
2282 | 2282 | </div> |
2283 | 2283 | </noscript> |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | * @return string |
2298 | 2298 | */ |
2299 | 2299 | private function _display_espresso_notices() { |
2300 | - $notices = $this->_get_transient( TRUE ); |
|
2300 | + $notices = $this->_get_transient(TRUE); |
|
2301 | 2301 | echo stripslashes($notices); |
2302 | 2302 | } |
2303 | 2303 | |
@@ -2349,11 +2349,11 @@ discard block |
||
2349 | 2349 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2350 | 2350 | * @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. |
2351 | 2351 | */ |
2352 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2353 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2352 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2353 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2354 | 2354 | |
2355 | 2355 | //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. |
2356 | - if ( empty( $callback_args ) && $create_func ) { |
|
2356 | + if (empty($callback_args) && $create_func) { |
|
2357 | 2357 | $callback_args = array( |
2358 | 2358 | 'template_path' => $this->_template_path, |
2359 | 2359 | 'template_args' => $this->_template_args, |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | //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) |
2364 | 2364 | $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; |
2365 | 2365 | |
2366 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2366 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2367 | 2367 | } |
2368 | 2368 | |
2369 | 2369 | |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | */ |
2377 | 2377 | public function display_admin_page_with_metabox_columns() { |
2378 | 2378 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2379 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2379 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2380 | 2380 | |
2381 | 2381 | //the final wrapper |
2382 | 2382 | $this->admin_page_wrapper(); |
@@ -2419,7 +2419,7 @@ discard block |
||
2419 | 2419 | * @return void |
2420 | 2420 | */ |
2421 | 2421 | public function display_about_admin_page() { |
2422 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2422 | + $this->_display_admin_page(FALSE, TRUE); |
|
2423 | 2423 | } |
2424 | 2424 | |
2425 | 2425 | |
@@ -2435,26 +2435,26 @@ discard block |
||
2435 | 2435 | * @return html admin_page |
2436 | 2436 | */ |
2437 | 2437 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2438 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2438 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2439 | 2439 | |
2440 | 2440 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2441 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2441 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2442 | 2442 | |
2443 | 2443 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2444 | 2444 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2445 | 2445 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2446 | 2446 | |
2447 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2447 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2448 | 2448 | |
2449 | - if ( defined('DOING_AJAX' ) ) |
|
2450 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2449 | + if (defined('DOING_AJAX')) |
|
2450 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2451 | 2451 | |
2452 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2452 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2453 | 2453 | |
2454 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2454 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2455 | 2455 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2456 | 2456 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2457 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2457 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2458 | 2458 | |
2459 | 2459 | |
2460 | 2460 | // the final template wrapper |
@@ -2472,7 +2472,7 @@ discard block |
||
2472 | 2472 | * @return void |
2473 | 2473 | * @throws \EE_Error |
2474 | 2474 | */ |
2475 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2475 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2476 | 2476 | //let's generate a default preview action button if there isn't one already present. |
2477 | 2477 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2478 | 2478 | $buy_now_url = add_query_arg( |
@@ -2485,7 +2485,7 @@ discard block |
||
2485 | 2485 | ), |
2486 | 2486 | 'http://eventespresso.com/pricing/' |
2487 | 2487 | ); |
2488 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2488 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2489 | 2489 | ? $this->get_action_link_or_button( |
2490 | 2490 | '', |
2491 | 2491 | 'buy_now', |
@@ -2495,13 +2495,13 @@ discard block |
||
2495 | 2495 | true |
2496 | 2496 | ) |
2497 | 2497 | : $this->_template_args['preview_action_button']; |
2498 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2498 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2499 | 2499 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2500 | 2500 | $template_path, |
2501 | 2501 | $this->_template_args, |
2502 | 2502 | true |
2503 | 2503 | ); |
2504 | - $this->_display_admin_page( $display_sidebar ); |
|
2504 | + $this->_display_admin_page($display_sidebar); |
|
2505 | 2505 | } |
2506 | 2506 | |
2507 | 2507 | |
@@ -2532,49 +2532,49 @@ discard block |
||
2532 | 2532 | * @access private |
2533 | 2533 | * @param boolean $sidebar whether to display with sidebar or not. |
2534 | 2534 | */ |
2535 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2535 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2536 | 2536 | //setup search attributes |
2537 | 2537 | $this->_set_search_attributes(); |
2538 | 2538 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2539 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2539 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2540 | 2540 | |
2541 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2542 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2543 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2541 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2542 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2543 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2544 | 2544 | $this->_template_args['list_table'] = $this->_list_table_object; |
2545 | 2545 | $this->_template_args['current_route'] = $this->_req_action; |
2546 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2546 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2547 | 2547 | |
2548 | 2548 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2549 | - if( ! empty( $ajax_sorting_callback )) { |
|
2549 | + if ( ! empty($ajax_sorting_callback)) { |
|
2550 | 2550 | $sortable_list_table_form_fields = wp_nonce_field( |
2551 | - $ajax_sorting_callback . '_nonce', |
|
2552 | - $ajax_sorting_callback . '_nonce', |
|
2551 | + $ajax_sorting_callback.'_nonce', |
|
2552 | + $ajax_sorting_callback.'_nonce', |
|
2553 | 2553 | FALSE, |
2554 | 2554 | FALSE |
2555 | 2555 | ); |
2556 | 2556 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2557 | 2557 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2558 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2559 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2558 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2559 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2560 | 2560 | } else { |
2561 | 2561 | $sortable_list_table_form_fields = ''; |
2562 | 2562 | } |
2563 | 2563 | |
2564 | 2564 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2565 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2566 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2567 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2565 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2566 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2567 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2568 | 2568 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2569 | 2569 | |
2570 | 2570 | //display message about search results? |
2571 | 2571 | $this->_template_args['before_list_table'] .= apply_filters( |
2572 | 2572 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2573 | - ! empty( $this->_req_data['s'] ) |
|
2574 | - ? '<p class="ee-search-results">' . sprintf( |
|
2575 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2576 | - trim( $this->_req_data['s'], '%' ) |
|
2577 | - ) . '</p>' |
|
2573 | + ! empty($this->_req_data['s']) |
|
2574 | + ? '<p class="ee-search-results">'.sprintf( |
|
2575 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2576 | + trim($this->_req_data['s'], '%') |
|
2577 | + ).'</p>' |
|
2578 | 2578 | : '', |
2579 | 2579 | $this->page_slug, |
2580 | 2580 | $this->_req_data, |
@@ -2586,7 +2586,7 @@ discard block |
||
2586 | 2586 | true |
2587 | 2587 | ); |
2588 | 2588 | // the final template wrapper |
2589 | - if ( $sidebar ) |
|
2589 | + if ($sidebar) |
|
2590 | 2590 | $this->display_admin_page_with_sidebar(); |
2591 | 2591 | else |
2592 | 2592 | $this->display_admin_page_with_no_sidebar(); |
@@ -2609,9 +2609,9 @@ discard block |
||
2609 | 2609 | * @param array $items see above for format of array |
2610 | 2610 | * @return string html string of legend |
2611 | 2611 | */ |
2612 | - protected function _display_legend( $items ) { |
|
2613 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2614 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2612 | + protected function _display_legend($items) { |
|
2613 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2614 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2615 | 2615 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2616 | 2616 | } |
2617 | 2617 | |
@@ -2636,33 +2636,33 @@ discard block |
||
2636 | 2636 | * |
2637 | 2637 | * @return string json object |
2638 | 2638 | */ |
2639 | - protected function _return_json( $sticky_notices = false ) { |
|
2639 | + protected function _return_json($sticky_notices = false) { |
|
2640 | 2640 | |
2641 | 2641 | //make sure any EE_Error notices have been handled. |
2642 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2642 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2643 | 2643 | |
2644 | 2644 | |
2645 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2645 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2646 | 2646 | unset($this->_template_args['data']); |
2647 | 2647 | $json = array( |
2648 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2649 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2650 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2651 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2648 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2649 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2650 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2651 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2652 | 2652 | 'notices' => EE_Error::get_notices(), |
2653 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2654 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2653 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2654 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2655 | 2655 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2656 | 2656 | ); |
2657 | 2657 | |
2658 | 2658 | |
2659 | 2659 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2660 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2660 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2661 | 2661 | header('Content-Type: application/json; charset=UTF-8'); |
2662 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2663 | - echo wp_json_encode( $json ); |
|
2662 | + if (function_exists('wp_json_encode')) { |
|
2663 | + echo wp_json_encode($json); |
|
2664 | 2664 | } else { |
2665 | - echo json_encode( $json ); |
|
2665 | + echo json_encode($json); |
|
2666 | 2666 | } |
2667 | 2667 | exit(); |
2668 | 2668 | } |
@@ -2674,11 +2674,11 @@ discard block |
||
2674 | 2674 | * @return json_obj|EE_Error |
2675 | 2675 | */ |
2676 | 2676 | public function return_json() { |
2677 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2677 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2678 | 2678 | $this->_return_json(); |
2679 | 2679 | |
2680 | 2680 | else { |
2681 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2681 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2682 | 2682 | } |
2683 | 2683 | } |
2684 | 2684 | |
@@ -2693,7 +2693,7 @@ discard block |
||
2693 | 2693 | * @access public |
2694 | 2694 | * @return void |
2695 | 2695 | */ |
2696 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2696 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2697 | 2697 | $this->_hook_obj = $hook_obj; |
2698 | 2698 | } |
2699 | 2699 | |
@@ -2709,33 +2709,33 @@ discard block |
||
2709 | 2709 | */ |
2710 | 2710 | public function admin_page_wrapper($about = FALSE) { |
2711 | 2711 | |
2712 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2712 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2713 | 2713 | |
2714 | 2714 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2715 | 2715 | |
2716 | 2716 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2717 | 2717 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2718 | 2718 | |
2719 | - $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'] : ''); |
|
2720 | - $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'] : ''); |
|
2719 | + $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'] : ''); |
|
2720 | + $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'] : ''); |
|
2721 | 2721 | |
2722 | 2722 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2723 | 2723 | |
2724 | 2724 | |
2725 | 2725 | |
2726 | 2726 | // load settings page wrapper template |
2727 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2727 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2728 | 2728 | |
2729 | 2729 | //about page? |
2730 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2730 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2731 | 2731 | |
2732 | 2732 | |
2733 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2734 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2733 | + if (defined('DOING_AJAX')) { |
|
2734 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2735 | 2735 | |
2736 | 2736 | $this->_return_json(); |
2737 | 2737 | } else { |
2738 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2738 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2739 | 2739 | } |
2740 | 2740 | |
2741 | 2741 | } |
@@ -2763,7 +2763,7 @@ discard block |
||
2763 | 2763 | * @access public |
2764 | 2764 | * @return void |
2765 | 2765 | */ |
2766 | - private function _sort_nav_tabs( $a, $b ) { |
|
2766 | + private function _sort_nav_tabs($a, $b) { |
|
2767 | 2767 | if ($a['order'] == $b['order']) { |
2768 | 2768 | return 0; |
2769 | 2769 | } |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2785 | 2785 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2786 | 2786 | */ |
2787 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2787 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2788 | 2788 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2789 | 2789 | return $content; |
2790 | 2790 | } |
@@ -2806,25 +2806,25 @@ discard block |
||
2806 | 2806 | * @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. |
2807 | 2807 | * @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). |
2808 | 2808 | */ |
2809 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2809 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2810 | 2810 | //make sure $text and $actions are in an array |
2811 | 2811 | $text = (array) $text; |
2812 | 2812 | $actions = (array) $actions; |
2813 | 2813 | $referrer_url = empty($referrer) ? '' : $referrer; |
2814 | - $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 .'" />'; |
|
2814 | + $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.'" />'; |
|
2815 | 2815 | |
2816 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2817 | - $default_names = array( 'save', 'save_and_close' ); |
|
2816 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2817 | + $default_names = array('save', 'save_and_close'); |
|
2818 | 2818 | |
2819 | 2819 | //add in a hidden index for the current page (so save and close redirects properly) |
2820 | 2820 | $this->_template_args['save_buttons'] = $referrer_url; |
2821 | 2821 | |
2822 | - foreach ( $button_text as $key => $button ) { |
|
2822 | + foreach ($button_text as $key => $button) { |
|
2823 | 2823 | $ref = $default_names[$key]; |
2824 | - $id = $this->_current_view . '_' . $ref; |
|
2825 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2826 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2827 | - if ( !$both ) break; |
|
2824 | + $id = $this->_current_view.'_'.$ref; |
|
2825 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2826 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2827 | + if ( ! $both) break; |
|
2828 | 2828 | } |
2829 | 2829 | |
2830 | 2830 | } |
@@ -2837,8 +2837,8 @@ discard block |
||
2837 | 2837 | * @since 4.6.0 |
2838 | 2838 | * |
2839 | 2839 | */ |
2840 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2841 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2840 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2841 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2842 | 2842 | } |
2843 | 2843 | |
2844 | 2844 | |
@@ -2851,30 +2851,30 @@ discard block |
||
2851 | 2851 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2852 | 2852 | * @return void |
2853 | 2853 | */ |
2854 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2854 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2855 | 2855 | |
2856 | - if ( empty( $route )) { |
|
2856 | + if (empty($route)) { |
|
2857 | 2857 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2858 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2859 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2858 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2859 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2860 | 2860 | } |
2861 | 2861 | // open form |
2862 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2862 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2863 | 2863 | // add nonce |
2864 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2864 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2865 | 2865 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2866 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2866 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2867 | 2867 | // add REQUIRED form action |
2868 | 2868 | $hidden_fields = array( |
2869 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2869 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2870 | 2870 | ); |
2871 | 2871 | // merge arrays |
2872 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2872 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2873 | 2873 | // generate form fields |
2874 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2874 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2875 | 2875 | // add fields to form |
2876 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2877 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2876 | + foreach ($form_fields as $field_name => $form_field) { |
|
2877 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2878 | 2878 | } |
2879 | 2879 | |
2880 | 2880 | // close form |
@@ -2891,8 +2891,8 @@ discard block |
||
2891 | 2891 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2892 | 2892 | * @since 4.5.0 |
2893 | 2893 | */ |
2894 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2895 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2894 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2895 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2896 | 2896 | } |
2897 | 2897 | |
2898 | 2898 | |
@@ -2908,32 +2908,32 @@ discard block |
||
2908 | 2908 | * @access protected |
2909 | 2909 | * @return void |
2910 | 2910 | */ |
2911 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2911 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2912 | 2912 | |
2913 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2913 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2914 | 2914 | |
2915 | 2915 | //class name for actions/filters. |
2916 | 2916 | $classname = get_class($this); |
2917 | 2917 | |
2918 | 2918 | //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 |
2919 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2920 | - $notices = EE_Error::get_notices( FALSE ); |
|
2919 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2920 | + $notices = EE_Error::get_notices(FALSE); |
|
2921 | 2921 | |
2922 | 2922 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2923 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2923 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2924 | 2924 | EE_Error::overwrite_success(); |
2925 | 2925 | } |
2926 | 2926 | // how many records affected ? more than one record ? or just one ? |
2927 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2927 | + if ($success > 1 && empty($notices['errors'])) { |
|
2928 | 2928 | // set plural msg |
2929 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2930 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2929 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2930 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2931 | 2931 | // set singular msg |
2932 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2932 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2933 | 2933 | } |
2934 | 2934 | |
2935 | 2935 | // check that $query_args isn't something crazy |
2936 | - if ( ! is_array( $query_args )) { |
|
2936 | + if ( ! is_array($query_args)) { |
|
2937 | 2937 | $query_args = array(); |
2938 | 2938 | } |
2939 | 2939 | |
@@ -2946,36 +2946,36 @@ discard block |
||
2946 | 2946 | * @param array $query_args The original query_args array coming into the |
2947 | 2947 | * method. |
2948 | 2948 | */ |
2949 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2949 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2950 | 2950 | |
2951 | 2951 | //calculate where we're going (if we have a "save and close" button pushed) |
2952 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2952 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2953 | 2953 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2954 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2954 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2955 | 2955 | // regenerate query args array from refferer URL |
2956 | - parse_str( $parsed_url['query'], $query_args ); |
|
2956 | + parse_str($parsed_url['query'], $query_args); |
|
2957 | 2957 | // correct page and action will be in the query args now |
2958 | - $redirect_url = admin_url( 'admin.php' ); |
|
2958 | + $redirect_url = admin_url('admin.php'); |
|
2959 | 2959 | } |
2960 | 2960 | |
2961 | 2961 | //merge any default query_args set in _default_route_query_args property |
2962 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2962 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2963 | 2963 | $args_to_merge = array(); |
2964 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2964 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2965 | 2965 | //is there a wp_referer array in our _default_route_query_args property? |
2966 | - if ( $query_param == 'wp_referer' ) { |
|
2966 | + if ($query_param == 'wp_referer') { |
|
2967 | 2967 | $query_value = (array) $query_value; |
2968 | - foreach ( $query_value as $reference => $value ) { |
|
2969 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2968 | + foreach ($query_value as $reference => $value) { |
|
2969 | + if (strpos($reference, 'nonce') !== false) { |
|
2970 | 2970 | continue; |
2971 | 2971 | } |
2972 | 2972 | |
2973 | 2973 | //finally we will override any arguments in the referer with |
2974 | 2974 | //what might be set on the _default_route_query_args array. |
2975 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2976 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2975 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2976 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2977 | 2977 | } else { |
2978 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2978 | + $args_to_merge[$reference] = urlencode($value); |
|
2979 | 2979 | } |
2980 | 2980 | } |
2981 | 2981 | continue; |
@@ -2986,7 +2986,7 @@ discard block |
||
2986 | 2986 | |
2987 | 2987 | //now let's merge these arguments but override with what was specifically sent in to the |
2988 | 2988 | //redirect. |
2989 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2989 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2990 | 2990 | } |
2991 | 2991 | |
2992 | 2992 | $this->_process_notices($query_args); |
@@ -2995,19 +2995,19 @@ discard block |
||
2995 | 2995 | // generate redirect url |
2996 | 2996 | |
2997 | 2997 | // if redirecting to anything other than the main page, add a nonce |
2998 | - if ( isset( $query_args['action'] )) { |
|
2998 | + if (isset($query_args['action'])) { |
|
2999 | 2999 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3000 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3000 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3001 | 3001 | } |
3002 | 3002 | |
3003 | 3003 | //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). |
3004 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3004 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3005 | 3005 | |
3006 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3006 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3007 | 3007 | |
3008 | 3008 | |
3009 | 3009 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3010 | - if ( defined('DOING_AJAX' ) ) { |
|
3010 | + if (defined('DOING_AJAX')) { |
|
3011 | 3011 | $default_data = array( |
3012 | 3012 | 'close' => TRUE, |
3013 | 3013 | 'redirect_url' => $redirect_url, |
@@ -3016,11 +3016,11 @@ discard block |
||
3016 | 3016 | ); |
3017 | 3017 | |
3018 | 3018 | $this->_template_args['success'] = $success; |
3019 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3019 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3020 | 3020 | $this->_return_json(); |
3021 | 3021 | } |
3022 | 3022 | |
3023 | - wp_safe_redirect( $redirect_url ); |
|
3023 | + wp_safe_redirect($redirect_url); |
|
3024 | 3024 | exit(); |
3025 | 3025 | } |
3026 | 3026 | |
@@ -3036,30 +3036,30 @@ discard block |
||
3036 | 3036 | * @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. |
3037 | 3037 | * @return void |
3038 | 3038 | */ |
3039 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3039 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3040 | 3040 | |
3041 | 3041 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3042 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3043 | - $notices = EE_Error::get_notices( false ); |
|
3044 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3045 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3042 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3043 | + $notices = EE_Error::get_notices(false); |
|
3044 | + if (empty($this->_template_args['success'])) { |
|
3045 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3046 | 3046 | } |
3047 | 3047 | |
3048 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3049 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3048 | + if (empty($this->_template_args['errors'])) { |
|
3049 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3050 | 3050 | } |
3051 | 3051 | |
3052 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3053 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3052 | + if (empty($this->_template_args['attention'])) { |
|
3053 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3054 | 3054 | } |
3055 | 3055 | } |
3056 | 3056 | |
3057 | 3057 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3058 | 3058 | |
3059 | 3059 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3060 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3061 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3062 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3060 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3061 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3062 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3063 | 3063 | } |
3064 | 3064 | } |
3065 | 3065 | |
@@ -3089,7 +3089,7 @@ discard block |
||
3089 | 3089 | $exclude_nonce = false |
3090 | 3090 | ) { |
3091 | 3091 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3092 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3092 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3093 | 3093 | throw new EE_Error( |
3094 | 3094 | sprintf( |
3095 | 3095 | __( |
@@ -3100,7 +3100,7 @@ discard block |
||
3100 | 3100 | ) |
3101 | 3101 | ); |
3102 | 3102 | } |
3103 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3103 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3104 | 3104 | throw new EE_Error( |
3105 | 3105 | sprintf( |
3106 | 3106 | __( |
@@ -3112,8 +3112,8 @@ discard block |
||
3112 | 3112 | ); |
3113 | 3113 | } |
3114 | 3114 | //finally check user access for this button. |
3115 | - $has_access = $this->check_user_access( $action, true ); |
|
3116 | - if ( ! $has_access ) { |
|
3115 | + $has_access = $this->check_user_access($action, true); |
|
3116 | + if ( ! $has_access) { |
|
3117 | 3117 | return ''; |
3118 | 3118 | } |
3119 | 3119 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3121,11 +3121,11 @@ discard block |
||
3121 | 3121 | 'action' => $action |
3122 | 3122 | ); |
3123 | 3123 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3124 | - if ( ! empty( $extra_request ) ) { |
|
3125 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3124 | + if ( ! empty($extra_request)) { |
|
3125 | + $query_args = array_merge($extra_request, $query_args); |
|
3126 | 3126 | } |
3127 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3128 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3127 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3128 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3129 | 3129 | } |
3130 | 3130 | |
3131 | 3131 | |
@@ -3140,11 +3140,11 @@ discard block |
||
3140 | 3140 | $args = array( |
3141 | 3141 | 'label' => $this->_admin_page_title, |
3142 | 3142 | 'default' => 10, |
3143 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3143 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3144 | 3144 | ); |
3145 | 3145 | //ONLY add the screen option if the user has access to it. |
3146 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3147 | - add_screen_option( $option, $args ); |
|
3146 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3147 | + add_screen_option($option, $args); |
|
3148 | 3148 | } |
3149 | 3149 | } |
3150 | 3150 | |
@@ -3160,36 +3160,36 @@ discard block |
||
3160 | 3160 | * @return void |
3161 | 3161 | */ |
3162 | 3162 | private function _set_per_page_screen_options() { |
3163 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3164 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3163 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3164 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3165 | 3165 | |
3166 | - if ( !$user = wp_get_current_user() ) |
|
3166 | + if ( ! $user = wp_get_current_user()) |
|
3167 | 3167 | return; |
3168 | 3168 | $option = $_POST['wp_screen_options']['option']; |
3169 | 3169 | $value = $_POST['wp_screen_options']['value']; |
3170 | 3170 | |
3171 | - if ( $option != sanitize_key( $option ) ) |
|
3171 | + if ($option != sanitize_key($option)) |
|
3172 | 3172 | return; |
3173 | 3173 | |
3174 | 3174 | $map_option = $option; |
3175 | 3175 | |
3176 | 3176 | $option = str_replace('-', '_', $option); |
3177 | 3177 | |
3178 | - switch ( $map_option ) { |
|
3179 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3178 | + switch ($map_option) { |
|
3179 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3180 | 3180 | $value = (int) $value; |
3181 | - if ( $value < 1 || $value > 999 ) |
|
3181 | + if ($value < 1 || $value > 999) |
|
3182 | 3182 | return; |
3183 | 3183 | break; |
3184 | 3184 | default: |
3185 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3186 | - if ( false === $value ) |
|
3185 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3186 | + if (false === $value) |
|
3187 | 3187 | return; |
3188 | 3188 | break; |
3189 | 3189 | } |
3190 | 3190 | |
3191 | 3191 | update_user_meta($user->ID, $option, $value); |
3192 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3192 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3193 | 3193 | exit; |
3194 | 3194 | } |
3195 | 3195 | } |
@@ -3200,8 +3200,8 @@ discard block |
||
3200 | 3200 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3201 | 3201 | * @param array $data array that will be assigned to template args. |
3202 | 3202 | */ |
3203 | - public function set_template_args( $data ) { |
|
3204 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3203 | + public function set_template_args($data) { |
|
3204 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3205 | 3205 | } |
3206 | 3206 | |
3207 | 3207 | |
@@ -3217,26 +3217,26 @@ discard block |
||
3217 | 3217 | * @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. |
3218 | 3218 | * @return void |
3219 | 3219 | */ |
3220 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3220 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3221 | 3221 | $user_id = get_current_user_id(); |
3222 | 3222 | |
3223 | - if ( !$skip_route_verify ) |
|
3223 | + if ( ! $skip_route_verify) |
|
3224 | 3224 | $this->_verify_route($route); |
3225 | 3225 | |
3226 | 3226 | |
3227 | 3227 | //now let's set the string for what kind of transient we're setting |
3228 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3229 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3228 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3229 | + $data = $notices ? array('notices' => $data) : $data; |
|
3230 | 3230 | //is there already a transient for this route? If there is then let's ADD to that transient |
3231 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3232 | - if ( $existing ) { |
|
3233 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3231 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3232 | + if ($existing) { |
|
3233 | + $data = array_merge((array) $data, (array) $existing); |
|
3234 | 3234 | } |
3235 | 3235 | |
3236 | - if ( is_multisite() && is_network_admin() ) { |
|
3237 | - set_site_transient( $transient, $data, 8 ); |
|
3236 | + if (is_multisite() && is_network_admin()) { |
|
3237 | + set_site_transient($transient, $data, 8); |
|
3238 | 3238 | } else { |
3239 | - set_transient( $transient, $data, 8 ); |
|
3239 | + set_transient($transient, $data, 8); |
|
3240 | 3240 | } |
3241 | 3241 | } |
3242 | 3242 | |
@@ -3248,18 +3248,18 @@ discard block |
||
3248 | 3248 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3249 | 3249 | * @return mixed data |
3250 | 3250 | */ |
3251 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3251 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3252 | 3252 | $user_id = get_current_user_id(); |
3253 | - $route = !$route ? $this->_req_action : $route; |
|
3254 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3255 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3253 | + $route = ! $route ? $this->_req_action : $route; |
|
3254 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3255 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3256 | 3256 | //delete transient after retrieval (just in case it hasn't expired); |
3257 | - if ( is_multisite() && is_network_admin() ) { |
|
3258 | - delete_site_transient( $transient ); |
|
3257 | + if (is_multisite() && is_network_admin()) { |
|
3258 | + delete_site_transient($transient); |
|
3259 | 3259 | } else { |
3260 | - delete_transient( $transient ); |
|
3260 | + delete_transient($transient); |
|
3261 | 3261 | } |
3262 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3262 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3263 | 3263 | } |
3264 | 3264 | |
3265 | 3265 | |
@@ -3276,12 +3276,12 @@ discard block |
||
3276 | 3276 | |
3277 | 3277 | //retrieve all existing transients |
3278 | 3278 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3279 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3280 | - foreach ( $results as $result ) { |
|
3281 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3282 | - get_transient( $transient ); |
|
3283 | - if ( is_multisite() && is_network_admin() ) { |
|
3284 | - get_site_transient( $transient ); |
|
3279 | + if ($results = $wpdb->get_results($query)) { |
|
3280 | + foreach ($results as $result) { |
|
3281 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3282 | + get_transient($transient); |
|
3283 | + if (is_multisite() && is_network_admin()) { |
|
3284 | + get_site_transient($transient); |
|
3285 | 3285 | } |
3286 | 3286 | } |
3287 | 3287 | } |
@@ -3431,23 +3431,23 @@ discard block |
||
3431 | 3431 | * @param string $line line no where error occurred |
3432 | 3432 | * @return boolean |
3433 | 3433 | */ |
3434 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3434 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3435 | 3435 | |
3436 | 3436 | //remove any options that are NOT going to be saved with the config settings. |
3437 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3437 | + if (isset($config->core->ee_ueip_optin)) { |
|
3438 | 3438 | $config->core->ee_ueip_has_notified = TRUE; |
3439 | 3439 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3440 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3441 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3440 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3441 | + update_option('ee_ueip_has_notified', TRUE); |
|
3442 | 3442 | } |
3443 | 3443 | // and save it (note we're also doing the network save here) |
3444 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3445 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3446 | - if ( $config_saved && $net_saved ) { |
|
3447 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3444 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3445 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3446 | + if ($config_saved && $net_saved) { |
|
3447 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3448 | 3448 | return TRUE; |
3449 | 3449 | } else { |
3450 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3450 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3451 | 3451 | return FALSE; |
3452 | 3452 | } |
3453 | 3453 | } |
@@ -3460,7 +3460,7 @@ discard block |
||
3460 | 3460 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3461 | 3461 | * @return array |
3462 | 3462 | */ |
3463 | - public function get_yes_no_values(){ |
|
3463 | + public function get_yes_no_values() { |
|
3464 | 3464 | return $this->_yes_no_values; |
3465 | 3465 | } |
3466 | 3466 | |
@@ -3482,8 +3482,8 @@ discard block |
||
3482 | 3482 | * |
3483 | 3483 | * @return string |
3484 | 3484 | */ |
3485 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3486 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3485 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3486 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3487 | 3487 | } |
3488 | 3488 | |
3489 | 3489 | |
@@ -3497,8 +3497,8 @@ discard block |
||
3497 | 3497 | * |
3498 | 3498 | * @return string |
3499 | 3499 | */ |
3500 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3501 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3500 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3501 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3502 | 3502 | } |
3503 | 3503 | |
3504 | 3504 | |
@@ -3517,8 +3517,8 @@ discard block |
||
3517 | 3517 | * @return bool success/fail |
3518 | 3518 | */ |
3519 | 3519 | protected function _process_resend_registration() { |
3520 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3521 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3520 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3521 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3522 | 3522 | return $this->_template_args['success']; |
3523 | 3523 | } |
3524 | 3524 | |
@@ -3531,11 +3531,11 @@ discard block |
||
3531 | 3531 | * @param \EE_Payment $payment |
3532 | 3532 | * @return bool success/fail |
3533 | 3533 | */ |
3534 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3535 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3536 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3537 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3538 | - return $this->_template_args[ 'success' ]; |
|
3534 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3535 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3536 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3537 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3538 | + return $this->_template_args['success']; |
|
3539 | 3539 | } |
3540 | 3540 | |
3541 | 3541 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -160,8 +162,9 @@ discard block |
||
160 | 162 | */ |
161 | 163 | public function __construct( $routing = TRUE ) { |
162 | 164 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
164 | - $this->_is_caf = TRUE; |
|
165 | + if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) { |
|
166 | + $this->_is_caf = TRUE; |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $this->_yes_no_values = array( |
167 | 170 | array('id' => TRUE, 'text' => __('Yes', 'event_espresso')), |
@@ -192,8 +195,9 @@ discard block |
||
192 | 195 | $this->_do_other_page_hooks(); |
193 | 196 | |
194 | 197 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
196 | - $this->_before_page_setup(); |
|
198 | + if ( method_exists( $this, '_before_page_setup' ) ) { |
|
199 | + $this->_before_page_setup(); |
|
200 | + } |
|
197 | 201 | |
198 | 202 | //set up page dependencies |
199 | 203 | $this->_page_setup(); |
@@ -500,7 +504,9 @@ discard block |
||
500 | 504 | global $ee_menu_slugs; |
501 | 505 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 506 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
507 | + if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) { |
|
508 | + return FALSE; |
|
509 | + } |
|
504 | 510 | |
505 | 511 | |
506 | 512 | // 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 |
@@ -535,12 +541,14 @@ discard block |
||
535 | 541 | } |
536 | 542 | |
537 | 543 | //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 |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
539 | - $this->_extend_page_config(); |
|
544 | + if ( method_exists( $this, '_extend_page_config' ) ) { |
|
545 | + $this->_extend_page_config(); |
|
546 | + } |
|
540 | 547 | |
541 | 548 | //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. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
543 | - $this->_extend_page_config_for_cpt(); |
|
549 | + if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) { |
|
550 | + $this->_extend_page_config_for_cpt(); |
|
551 | + } |
|
544 | 552 | |
545 | 553 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | 554 | $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
@@ -656,8 +664,9 @@ discard block |
||
656 | 664 | //add screen options - global, page child class, and view specific |
657 | 665 | $this->_add_global_screen_options(); |
658 | 666 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
667 | + if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) { |
|
668 | + call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
669 | + } |
|
661 | 670 | |
662 | 671 | |
663 | 672 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,28 +677,32 @@ discard block |
||
668 | 677 | //add feature_pointers - global, page child class, and view specific |
669 | 678 | $this->_add_feature_pointers(); |
670 | 679 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
680 | + if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) { |
|
681 | + call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
682 | + } |
|
673 | 683 | |
674 | 684 | //enqueue scripts/styles - global, page class, and view specific |
675 | 685 | add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
676 | 686 | add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
687 | + if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) { |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
689 | + } |
|
679 | 690 | |
680 | 691 | add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
681 | 692 | |
682 | 693 | //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 |
683 | 694 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
684 | 695 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
696 | + if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) { |
|
697 | + add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
698 | + } |
|
687 | 699 | |
688 | 700 | //admin footer scripts |
689 | 701 | add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
690 | 702 | add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
703 | + if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) { |
|
704 | + add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
705 | + } |
|
693 | 706 | |
694 | 707 | |
695 | 708 | do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
@@ -762,7 +775,9 @@ discard block |
||
762 | 775 | protected function _verify_routes() { |
763 | 776 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
764 | 777 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
778 | + if ( !$this->_current_page && !defined( 'DOING_AJAX')) { |
|
779 | + return FALSE; |
|
780 | + } |
|
766 | 781 | |
767 | 782 | $this->_route = FALSE; |
768 | 783 | $func = FALSE; |
@@ -872,8 +887,9 @@ discard block |
||
872 | 887 | * @return void |
873 | 888 | */ |
874 | 889 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
876 | - $this->_verify_routes(); |
|
890 | + if ( ! $this->_is_UI_request ) { |
|
891 | + $this->_verify_routes(); |
|
892 | + } |
|
877 | 893 | |
878 | 894 | $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
879 | 895 | |
@@ -883,8 +899,9 @@ discard block |
||
883 | 899 | $this->_verify_nonce( $nonce, $this->_req_nonce ); |
884 | 900 | } |
885 | 901 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
887 | - $this->_set_nav_tabs(); |
|
902 | + if ( $this->_is_UI_request ) { |
|
903 | + $this->_set_nav_tabs(); |
|
904 | + } |
|
888 | 905 | |
889 | 906 | // grab callback function |
890 | 907 | $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
@@ -921,8 +938,9 @@ discard block |
||
921 | 938 | } |
922 | 939 | |
923 | 940 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
941 | + if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) { |
|
942 | + throw new EE_Error( $error_msg ); |
|
943 | + } |
|
926 | 944 | } |
927 | 945 | |
928 | 946 | //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. |
@@ -1049,8 +1067,9 @@ discard block |
||
1049 | 1067 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | 1068 | foreach ( $this->_help_tour['tours'] as $tour ) { |
1051 | 1069 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1053 | - continue; |
|
1070 | + if ( $tour instanceof EE_Help_Tour_final_stop ) { |
|
1071 | + continue; |
|
1072 | + } |
|
1054 | 1073 | $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
1055 | 1074 | } |
1056 | 1075 | $tour_buttons .= implode('<br />', $tb); |
@@ -1060,8 +1079,9 @@ discard block |
||
1060 | 1079 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | 1080 | if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
1062 | 1081 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - 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) ) ); |
|
1082 | + if ( !method_exists($this, $config['help_sidebar'] ) ) { |
|
1083 | + 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) ) ); |
|
1084 | + } |
|
1065 | 1085 | |
1066 | 1086 | $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
1067 | 1087 | |
@@ -1085,18 +1105,23 @@ discard block |
||
1085 | 1105 | }/**/ |
1086 | 1106 | |
1087 | 1107 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1108 | + if ( !isset( $config['help_tabs'] ) ) { |
|
1109 | + return; |
|
1110 | + } |
|
1111 | + //no help tabs for this route |
|
1089 | 1112 | |
1090 | 1113 | foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
1091 | 1114 | //we're here so there ARE help tabs! |
1092 | 1115 | |
1093 | 1116 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1117 | + if ( !isset( $cfg['title'] ) ) { |
|
1118 | + throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1119 | + } |
|
1096 | 1120 | |
1097 | 1121 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - 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') ); |
|
1122 | + if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) { |
|
1123 | + 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') ); |
|
1124 | + } |
|
1100 | 1125 | |
1101 | 1126 | |
1102 | 1127 | |
@@ -1159,14 +1184,16 @@ discard block |
||
1159 | 1184 | $this->_help_tour = array(); |
1160 | 1185 | |
1161 | 1186 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1163 | - return; |
|
1187 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) { |
|
1188 | + return; |
|
1189 | + } |
|
1164 | 1190 | |
1165 | 1191 | //loop through _page_config to find any help_tour defined |
1166 | 1192 | foreach ( $this->_page_config as $route => $config ) { |
1167 | 1193 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1169 | - continue; |
|
1194 | + if ( $route !== $this->_req_action ) { |
|
1195 | + continue; |
|
1196 | + } |
|
1170 | 1197 | |
1171 | 1198 | if ( isset( $config['help_tour'] ) ) { |
1172 | 1199 | |
@@ -1201,8 +1228,9 @@ discard block |
||
1201 | 1228 | } |
1202 | 1229 | } |
1203 | 1230 | |
1204 | - if ( !empty( $tours ) ) |
|
1205 | - $this->_help_tour['tours'] = $tours; |
|
1231 | + if ( !empty( $tours ) ) { |
|
1232 | + $this->_help_tour['tours'] = $tours; |
|
1233 | + } |
|
1206 | 1234 | |
1207 | 1235 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
1208 | 1236 | } |
@@ -1242,15 +1270,21 @@ discard block |
||
1242 | 1270 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1243 | 1271 | $i = 0; |
1244 | 1272 | foreach ( $this->_page_config as $slug => $config ) { |
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1246 | - continue; //no nav tab for this config |
|
1273 | + if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) { |
|
1274 | + continue; |
|
1275 | + } |
|
1276 | + //no nav tab for this config |
|
1247 | 1277 | |
1248 | 1278 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1250 | - continue; //nav tab is only to appear when route requested. |
|
1279 | + if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) { |
|
1280 | + continue; |
|
1281 | + } |
|
1282 | + //nav tab is only to appear when route requested. |
|
1251 | 1283 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1253 | - continue; //no nav tab becasue current user does not have access. |
|
1284 | + if ( ! $this->check_user_access( $slug, TRUE ) ) { |
|
1285 | + continue; |
|
1286 | + } |
|
1287 | + //no nav tab becasue current user does not have access. |
|
1254 | 1288 | |
1255 | 1289 | $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
1256 | 1290 | $this->_nav_tabs[$slug] = array( |
@@ -1486,10 +1520,11 @@ discard block |
||
1486 | 1520 | $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
1487 | 1521 | } |
1488 | 1522 | |
1489 | - if ( $display ) |
|
1490 | - echo $content; |
|
1491 | - else |
|
1492 | - return $content; |
|
1523 | + if ( $display ) { |
|
1524 | + echo $content; |
|
1525 | + } else { |
|
1526 | + return $content; |
|
1527 | + } |
|
1493 | 1528 | } |
1494 | 1529 | |
1495 | 1530 | |
@@ -1506,8 +1541,9 @@ discard block |
||
1506 | 1541 | $method_name = '_help_popup_content_' . $this->_req_action; |
1507 | 1542 | |
1508 | 1543 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1510 | - return array(); |
|
1544 | + if ( !method_exists( $this, $method_name ) ) { |
|
1545 | + return array(); |
|
1546 | + } |
|
1511 | 1547 | |
1512 | 1548 | //k we're good to go let's retrieve the help array |
1513 | 1549 | $help_array = call_user_func( array( $this, $method_name ) ); |
@@ -1538,7 +1574,9 @@ discard block |
||
1538 | 1574 | */ |
1539 | 1575 | protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
1540 | 1576 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1577 | + if ( defined('DOING_AJAX') ) { |
|
1578 | + return; |
|
1579 | + } |
|
1542 | 1580 | |
1543 | 1581 | //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 |
1544 | 1582 | $help_array = $this->_get_help_content(); |
@@ -1556,10 +1594,11 @@ discard block |
||
1556 | 1594 | $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>'; |
1557 | 1595 | $content = $content . $help_content; |
1558 | 1596 | |
1559 | - if ( $display ) |
|
1560 | - echo $content; |
|
1561 | - else |
|
1562 | - return $content; |
|
1597 | + if ( $display ) { |
|
1598 | + echo $content; |
|
1599 | + } else { |
|
1600 | + return $content; |
|
1601 | + } |
|
1563 | 1602 | } |
1564 | 1603 | |
1565 | 1604 | |
@@ -1785,8 +1824,10 @@ discard block |
||
1785 | 1824 | protected function _set_list_table() { |
1786 | 1825 | |
1787 | 1826 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1789 | - return; //not a list_table view so get out. |
|
1827 | + if ( !isset($this->_route_config['list_table']) ) { |
|
1828 | + return; |
|
1829 | + } |
|
1830 | + //not a list_table view so get out. |
|
1790 | 1831 | |
1791 | 1832 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1833 | |
@@ -2148,8 +2189,9 @@ discard block |
||
2148 | 2189 | protected function _espresso_sponsors_post_box() { |
2149 | 2190 | |
2150 | 2191 | $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
2151 | - if ( $show_sponsors ) |
|
2152 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2192 | + if ( $show_sponsors ) { |
|
2193 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2194 | + } |
|
2153 | 2195 | } |
2154 | 2196 | |
2155 | 2197 | |
@@ -2446,8 +2488,9 @@ discard block |
||
2446 | 2488 | |
2447 | 2489 | $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
2448 | 2490 | |
2449 | - if ( defined('DOING_AJAX' ) ) |
|
2450 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2491 | + if ( defined('DOING_AJAX' ) ) { |
|
2492 | + $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2493 | + } |
|
2451 | 2494 | |
2452 | 2495 | $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
2453 | 2496 | |
@@ -2586,10 +2629,11 @@ discard block |
||
2586 | 2629 | true |
2587 | 2630 | ); |
2588 | 2631 | // the final template wrapper |
2589 | - if ( $sidebar ) |
|
2590 | - $this->display_admin_page_with_sidebar(); |
|
2591 | - else |
|
2592 | - $this->display_admin_page_with_no_sidebar(); |
|
2632 | + if ( $sidebar ) { |
|
2633 | + $this->display_admin_page_with_sidebar(); |
|
2634 | + } else { |
|
2635 | + $this->display_admin_page_with_no_sidebar(); |
|
2636 | + } |
|
2593 | 2637 | } |
2594 | 2638 | |
2595 | 2639 | |
@@ -2657,8 +2701,9 @@ discard block |
||
2657 | 2701 | |
2658 | 2702 | |
2659 | 2703 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2660 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2661 | - header('Content-Type: application/json; charset=UTF-8'); |
|
2704 | + if ( NULL === error_get_last() || ! headers_sent() ) { |
|
2705 | + header('Content-Type: application/json; charset=UTF-8'); |
|
2706 | + } |
|
2662 | 2707 | if( function_exists( 'wp_json_encode' ) ) { |
2663 | 2708 | echo wp_json_encode( $json ); |
2664 | 2709 | } else { |
@@ -2674,10 +2719,9 @@ discard block |
||
2674 | 2719 | * @return json_obj|EE_Error |
2675 | 2720 | */ |
2676 | 2721 | public function return_json() { |
2677 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2678 | - $this->_return_json(); |
|
2679 | - |
|
2680 | - else { |
|
2722 | + if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2723 | + $this->_return_json(); |
|
2724 | + } else { |
|
2681 | 2725 | throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
2682 | 2726 | } |
2683 | 2727 | } |
@@ -2824,7 +2868,9 @@ discard block |
||
2824 | 2868 | $id = $this->_current_view . '_' . $ref; |
2825 | 2869 | $name = !empty($actions) ? $actions[$key] : $ref; |
2826 | 2870 | $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
2827 | - if ( !$both ) break; |
|
2871 | + if ( !$both ) { |
|
2872 | + break; |
|
2873 | + } |
|
2828 | 2874 | } |
2829 | 2875 | |
2830 | 2876 | } |
@@ -3163,13 +3209,15 @@ discard block |
||
3163 | 3209 | if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
3164 | 3210 | check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
3165 | 3211 | |
3166 | - if ( !$user = wp_get_current_user() ) |
|
3167 | - return; |
|
3212 | + if ( !$user = wp_get_current_user() ) { |
|
3213 | + return; |
|
3214 | + } |
|
3168 | 3215 | $option = $_POST['wp_screen_options']['option']; |
3169 | 3216 | $value = $_POST['wp_screen_options']['value']; |
3170 | 3217 | |
3171 | - if ( $option != sanitize_key( $option ) ) |
|
3172 | - return; |
|
3218 | + if ( $option != sanitize_key( $option ) ) { |
|
3219 | + return; |
|
3220 | + } |
|
3173 | 3221 | |
3174 | 3222 | $map_option = $option; |
3175 | 3223 | |
@@ -3178,13 +3226,15 @@ discard block |
||
3178 | 3226 | switch ( $map_option ) { |
3179 | 3227 | case $this->_current_page . '_' . $this->_current_view . '_per_page': |
3180 | 3228 | $value = (int) $value; |
3181 | - if ( $value < 1 || $value > 999 ) |
|
3182 | - return; |
|
3229 | + if ( $value < 1 || $value > 999 ) { |
|
3230 | + return; |
|
3231 | + } |
|
3183 | 3232 | break; |
3184 | 3233 | default: |
3185 | 3234 | $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
3186 | - if ( false === $value ) |
|
3187 | - return; |
|
3235 | + if ( false === $value ) { |
|
3236 | + return; |
|
3237 | + } |
|
3188 | 3238 | break; |
3189 | 3239 | } |
3190 | 3240 | |
@@ -3220,8 +3270,9 @@ discard block |
||
3220 | 3270 | protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
3221 | 3271 | $user_id = get_current_user_id(); |
3222 | 3272 | |
3223 | - if ( !$skip_route_verify ) |
|
3224 | - $this->_verify_route($route); |
|
3273 | + if ( !$skip_route_verify ) { |
|
3274 | + $this->_verify_route($route); |
|
3275 | + } |
|
3225 | 3276 | |
3226 | 3277 | |
3227 | 3278 | //now let's set the string for what kind of transient we're setting |
@@ -680,14 +680,12 @@ discard block |
||
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | 681 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
682 | 682 | echo '</th>'; |
683 | - } |
|
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
683 | + } elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
685 | 684 | echo "<td $attributes>"; |
686 | 685 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
687 | 686 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
688 | 687 | echo "</td>"; |
689 | - } |
|
690 | - else { |
|
688 | + } else { |
|
691 | 689 | echo "<td $attributes>"; |
692 | 690 | echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
693 | 691 | echo $this->handle_row_actions( $item, $column_name, $primary ); |
@@ -709,7 +707,7 @@ discard block |
||
709 | 707 | if ( $which === 'top' ) { |
710 | 708 | $this->_filters(); |
711 | 709 | echo $this->_get_hidden_fields(); |
712 | - }else{ |
|
710 | + } else{ |
|
713 | 711 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | 712 | foreach($this->_bottom_buttons as $type => $action){ |
715 | 713 | $route = isset( $action['route'] ) ? $action['route'] : ''; |
@@ -784,19 +784,19 @@ |
||
784 | 784 | $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
785 | 785 | $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
786 | 786 | $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
787 | - try { |
|
788 | - $content .= apply_filters( |
|
789 | - 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
790 | - $action_items, |
|
791 | - $item, |
|
792 | - $this |
|
793 | - ); |
|
794 | - } catch (\Exception $e) { |
|
795 | - if (WP_DEBUG) { |
|
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
797 | - } |
|
798 | - $content .= $action_items; |
|
799 | - } |
|
787 | + try { |
|
788 | + $content .= apply_filters( |
|
789 | + 'FHEE__EE_Admin_List_Table___action_string__action_items', |
|
790 | + $action_items, |
|
791 | + $item, |
|
792 | + $this |
|
793 | + ); |
|
794 | + } catch (\Exception $e) { |
|
795 | + if (WP_DEBUG) { |
|
796 | + \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
797 | + } |
|
798 | + $content .= $action_items; |
|
799 | + } |
|
800 | 800 | $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
801 | 801 | return $content; |
802 | 802 | } |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'NO direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('NO direct script access allowed'); |
|
4 | 4 | } |
5 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
6 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
5 | +if ( ! class_exists('WP_List_Table')) { |
|
6 | + require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | /** |
207 | 207 | * @param \EE_Admin_Page $admin_page we use this for obtaining everything we need in the list table |
208 | 208 | */ |
209 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
209 | + public function __construct(EE_Admin_Page $admin_page) { |
|
210 | 210 | $this->_admin_page = $admin_page; |
211 | 211 | $this->_req_data = $this->_admin_page->get_request_data(); |
212 | 212 | $this->_view = $this->_admin_page->get_view(); |
213 | - $this->_views = empty( $this->_views ) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
213 | + $this->_views = empty($this->_views) ? $this->_admin_page->get_list_table_view_RLs() : $this->_views; |
|
214 | 214 | $this->_current_page = $this->get_pagenum(); |
215 | - $this->_screen = $this->_admin_page->get_current_page() . '_' . $this->_admin_page->get_current_view(); |
|
216 | - $this->_yes_no = array( __('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
215 | + $this->_screen = $this->_admin_page->get_current_page().'_'.$this->_admin_page->get_current_view(); |
|
216 | + $this->_yes_no = array(__('No', 'event_espresso'), __('Yes', 'event_espresso')); |
|
217 | 217 | |
218 | - $this->_per_page = $this->get_items_per_page( $this->_screen . '_per_page', 10 ); |
|
218 | + $this->_per_page = $this->get_items_per_page($this->_screen.'_per_page', 10); |
|
219 | 219 | |
220 | 220 | $this->_setup_data(); |
221 | 221 | $this->_add_view_counts(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $this->_set_properties(); |
226 | 226 | |
227 | 227 | //set primary column |
228 | - add_filter( 'list_table_primary_column', array( $this, 'set_primary_column' ) ); |
|
228 | + add_filter('list_table_primary_column', array($this, 'set_primary_column')); |
|
229 | 229 | |
230 | 230 | //set parent defaults |
231 | 231 | parent::__construct($this->_wp_list_args); |
@@ -301,17 +301,17 @@ discard block |
||
301 | 301 | * @return string |
302 | 302 | */ |
303 | 303 | protected function _get_hidden_fields() { |
304 | - $action = isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : ''; |
|
305 | - $action = empty( $action ) && isset( $this->_req_data['action'] ) ? $this->_req_data['action'] : $action; |
|
304 | + $action = isset($this->_req_data['route']) ? $this->_req_data['route'] : ''; |
|
305 | + $action = empty($action) && isset($this->_req_data['action']) ? $this->_req_data['action'] : $action; |
|
306 | 306 | //if action is STILL empty, then we set it to default |
307 | - $action = empty( $action ) ? 'default' : $action; |
|
308 | - $field = '<input type="hidden" name="page" value="' . $this->_req_data['page'] . '" />' . "\n"; |
|
309 | - $field .= '<input type="hidden" name="route" value="'. $action .'" />' . "\n";/**/ |
|
310 | - $field .= '<input type="hidden" name="perpage" value="' . $this->_per_page . '" />' . "\n"; |
|
307 | + $action = empty($action) ? 'default' : $action; |
|
308 | + $field = '<input type="hidden" name="page" value="'.$this->_req_data['page'].'" />'."\n"; |
|
309 | + $field .= '<input type="hidden" name="route" value="'.$action.'" />'."\n"; /**/ |
|
310 | + $field .= '<input type="hidden" name="perpage" value="'.$this->_per_page.'" />'."\n"; |
|
311 | 311 | |
312 | 312 | $bulk_actions = $this->_get_bulk_actions(); |
313 | - foreach ( $bulk_actions as $bulk_action => $label ) { |
|
314 | - $field .= '<input type="hidden" name="' . $bulk_action . '_nonce" value="' . wp_create_nonce ( $bulk_action . '_nonce' ) . '" />' . "\n"; |
|
313 | + foreach ($bulk_actions as $bulk_action => $label) { |
|
314 | + $field .= '<input type="hidden" name="'.$bulk_action.'_nonce" value="'.wp_create_nonce($bulk_action.'_nonce').'" />'."\n"; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | return $field; |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | * |
342 | 342 | * @var array |
343 | 343 | */ |
344 | - $_sortable = apply_filters( "FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen ); |
|
344 | + $_sortable = apply_filters("FHEE_manage_{$this->screen->id}_sortable_columns", $_sortable, $this->_screen); |
|
345 | 345 | |
346 | 346 | $sortable = array(); |
347 | - foreach ( $_sortable as $id => $data ) { |
|
348 | - if ( empty( $data ) ) { |
|
347 | + foreach ($_sortable as $id => $data) { |
|
348 | + if (empty($data)) { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | //fix for offset errors with WP_List_Table default get_columninfo() |
352 | - if ( is_array($data) ) { |
|
352 | + if (is_array($data)) { |
|
353 | 353 | $_data[0] = key($data); |
354 | 354 | $_data[1] = isset($data[1]) ? $data[1] : false; |
355 | 355 | } else { |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | |
359 | 359 | $data = (array) $data; |
360 | 360 | |
361 | - if ( !isset( $data[1] ) ) { |
|
361 | + if ( ! isset($data[1])) { |
|
362 | 362 | $_data[1] = false; |
363 | 363 | } |
364 | 364 | |
365 | 365 | $sortable[$id] = $_data; |
366 | 366 | } |
367 | 367 | $primary = $this->get_primary_column_name(); |
368 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); |
|
368 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | * @return string |
375 | 375 | */ |
376 | 376 | protected function get_primary_column_name() { |
377 | - foreach( class_parents( $this ) as $parent ) { |
|
378 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'get_primary_column_name' ) ) { |
|
377 | + foreach (class_parents($this) as $parent) { |
|
378 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'get_primary_column_name')) { |
|
379 | 379 | return parent::get_primary_column_name(); |
380 | 380 | } |
381 | 381 | } |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | * @param string $primary |
393 | 393 | * @return string |
394 | 394 | */ |
395 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
396 | - foreach( class_parents( $this ) as $parent ) { |
|
397 | - if ( $parent === 'WP_List_Table' && method_exists( $parent, 'handle_row_actions' ) ) { |
|
398 | - return parent::handle_row_actions( $item, $column_name, $primary ); |
|
395 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
396 | + foreach (class_parents($this) as $parent) { |
|
397 | + if ($parent === 'WP_List_Table' && method_exists($parent, 'handle_row_actions')) { |
|
398 | + return parent::handle_row_actions($item, $column_name, $primary); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | return ''; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | protected function _get_bulk_actions() { |
414 | 414 | $actions = array(); |
415 | 415 | //the _views property should have the bulk_actions, so let's go through and extract them into a properly formatted array for the wp_list_table(); |
416 | - foreach ( $this->_views as $view => $args) { |
|
417 | - if ( $this->_view === $view && isset( $args['bulk_action']) && is_array($args['bulk_action']) ) { |
|
416 | + foreach ($this->_views as $view => $args) { |
|
417 | + if ($this->_view === $view && isset($args['bulk_action']) && is_array($args['bulk_action'])) { |
|
418 | 418 | //each bulk action will correspond with a admin page route, so we can check whatever the capability is for that page route and skip adding the bulk action if no access for the current logged in user. |
419 | - foreach ( $args['bulk_action'] as $route =>$label ) { |
|
420 | - if ( $this->_admin_page->check_user_access( $route, true ) ) { |
|
419 | + foreach ($args['bulk_action'] as $route =>$label) { |
|
420 | + if ($this->_admin_page->check_user_access($route, true)) { |
|
421 | 421 | $actions[$route] = $label; |
422 | 422 | } |
423 | 423 | } |
@@ -436,18 +436,18 @@ discard block |
||
436 | 436 | */ |
437 | 437 | private function _filters() { |
438 | 438 | $classname = get_class($this); |
439 | - $filters = apply_filters( "FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen ); |
|
439 | + $filters = apply_filters("FHEE__{$classname}__filters", (array) $this->_get_table_filters(), $this, $this->_screen); |
|
440 | 440 | |
441 | - if ( empty( $filters )) { |
|
441 | + if (empty($filters)) { |
|
442 | 442 | return; |
443 | 443 | } |
444 | - foreach ( $filters as $filter ) { |
|
444 | + foreach ($filters as $filter) { |
|
445 | 445 | echo $filter; |
446 | 446 | } |
447 | 447 | //add filter button at end |
448 | - echo '<input type="submit" class="button-secondary" value="' . __('Filter', 'event_espresso') . '" id="post-query-submit" />'; |
|
448 | + echo '<input type="submit" class="button-secondary" value="'.__('Filter', 'event_espresso').'" id="post-query-submit" />'; |
|
449 | 449 | //add reset filters button at end |
450 | - echo '<a class="button button-secondary" href="' . $this->_admin_page->get_current_page_view_url() . '" style="display:inline-block">' . __('Reset Filters', 'event_espresso') . '</a>'; |
|
450 | + echo '<a class="button button-secondary" href="'.$this->_admin_page->get_current_page_view_url().'" style="display:inline-block">'.__('Reset Filters', 'event_espresso').'</a>'; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -461,8 +461,8 @@ discard block |
||
461 | 461 | * @param string $column_name |
462 | 462 | * @return string |
463 | 463 | */ |
464 | - public function set_primary_column( $column_name ) { |
|
465 | - return ! empty( $this->_primary_column ) ? $this->_primary_column : $column_name; |
|
464 | + public function set_primary_column($column_name) { |
|
465 | + return ! empty($this->_primary_column) ? $this->_primary_column : $column_name; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | array( |
483 | 483 | 'total_items' => $total_items, |
484 | 484 | 'per_page' => $this->_per_page, |
485 | - 'total_pages' => ceil($total_items / $this->_per_page ) |
|
485 | + 'total_pages' => ceil($total_items / $this->_per_page) |
|
486 | 486 | ) |
487 | 487 | ); |
488 | 488 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @param string $column_name The column being called. |
497 | 497 | * @return string html content for the column |
498 | 498 | */ |
499 | - public function column_default( $item, $column_name ) { |
|
499 | + public function column_default($item, $column_name) { |
|
500 | 500 | /** |
501 | 501 | * Dynamic hook allowing for adding additional column content in this list table. |
502 | 502 | * Note that $this->screen->id is in the format |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * hook prefix ("event-espresso") will be different. |
507 | 507 | * |
508 | 508 | */ |
509 | - do_action( 'AHEE__EE_Admin_List_Table__column_' . $column_name . '__' . $this->screen->id, $item, $this->_screen ); |
|
509 | + do_action('AHEE__EE_Admin_List_Table__column_'.$column_name.'__'.$this->screen->id, $item, $this->_screen); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @var array |
534 | 534 | */ |
535 | - $columns = apply_filters( 'FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen ); |
|
535 | + $columns = apply_filters('FHEE_manage_'.$this->screen->id.'_columns', $this->_columns, $this->_screen); |
|
536 | 536 | return $columns; |
537 | 537 | } |
538 | 538 | |
@@ -555,18 +555,18 @@ discard block |
||
555 | 555 | $views = $this->get_views(); |
556 | 556 | $assembled_views = ''; |
557 | 557 | |
558 | - if ( empty( $views )) { |
|
558 | + if (empty($views)) { |
|
559 | 559 | return; |
560 | 560 | } |
561 | 561 | echo "<ul class='subsubsub'>\n"; |
562 | - foreach ( $views as $view ) { |
|
563 | - $count = isset($view['count'] ) && !empty($view['count']) ? absint( $view['count'] ) : 0; |
|
564 | - if ( isset( $view['slug'], $view['class'], $view['url'], $view['label']) ) { |
|
565 | - $assembled_views[ $view['slug'] ] = "\t<li class='" . $view['class'] . "'>" . '<a href="' . $view['url'] . '">' . $view['label'] . '</a> <span class="count">(' . $count . ')</span>'; |
|
562 | + foreach ($views as $view) { |
|
563 | + $count = isset($view['count']) && ! empty($view['count']) ? absint($view['count']) : 0; |
|
564 | + if (isset($view['slug'], $view['class'], $view['url'], $view['label'])) { |
|
565 | + $assembled_views[$view['slug']] = "\t<li class='".$view['class']."'>".'<a href="'.$view['url'].'">'.$view['label'].'</a> <span class="count">('.$count.')</span>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | |
569 | - echo is_array( $assembled_views) && ! empty( $assembled_views ) ? implode( " |</li>\n", $assembled_views ) . "</li>\n" : ''; |
|
569 | + echo is_array($assembled_views) && ! empty($assembled_views) ? implode(" |</li>\n", $assembled_views)."</li>\n" : ''; |
|
570 | 570 | echo "</ul>"; |
571 | 571 | } |
572 | 572 | |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | * @access public |
579 | 579 | * @param EE_Base_Class $item The current item |
580 | 580 | */ |
581 | - public function single_row( $item ) { |
|
582 | - $row_class = $this->_get_row_class( $item ); |
|
583 | - echo '<tr class="' . esc_attr( $row_class ) . '">'; |
|
584 | - $this->single_row_columns( $item ); |
|
581 | + public function single_row($item) { |
|
582 | + $row_class = $this->_get_row_class($item); |
|
583 | + echo '<tr class="'.esc_attr($row_class).'">'; |
|
584 | + $this->single_row_columns($item); |
|
585 | 585 | echo '</tr>'; |
586 | 586 | } |
587 | 587 | |
@@ -593,13 +593,13 @@ discard block |
||
593 | 593 | * @param EE_Base_Class $item the current item |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - protected function _get_row_class( $item ) { |
|
596 | + protected function _get_row_class($item) { |
|
597 | 597 | static $row_class = ''; |
598 | - $row_class = ( $row_class === '' ? 'alternate' : '' ); |
|
598 | + $row_class = ($row_class === '' ? 'alternate' : ''); |
|
599 | 599 | |
600 | 600 | $new_row_class = $row_class; |
601 | 601 | |
602 | - if ( !empty($this->_ajax_sorting_callback) ) { |
|
602 | + if ( ! empty($this->_ajax_sorting_callback)) { |
|
603 | 603 | $new_row_class .= ' rowsortable'; |
604 | 604 | } |
605 | 605 | |
@@ -631,13 +631,13 @@ discard block |
||
631 | 631 | */ |
632 | 632 | public function get_hidden_columns() { |
633 | 633 | $user_id = get_current_user_id(); |
634 | - $has_default = get_user_option('default'. $this->screen->id . 'columnshidden', $user_id); |
|
635 | - if ( empty( $has_default ) && !empty($this->_hidden_columns ) ) { |
|
636 | - update_user_option($user_id, 'default'.$this->screen->id . 'columnshidden', TRUE); |
|
637 | - update_user_option($user_id, 'manage' . $this->screen->id . 'columnshidden', $this->_hidden_columns, TRUE ); |
|
634 | + $has_default = get_user_option('default'.$this->screen->id.'columnshidden', $user_id); |
|
635 | + if (empty($has_default) && ! empty($this->_hidden_columns)) { |
|
636 | + update_user_option($user_id, 'default'.$this->screen->id.'columnshidden', TRUE); |
|
637 | + update_user_option($user_id, 'manage'.$this->screen->id.'columnshidden', $this->_hidden_columns, TRUE); |
|
638 | 638 | } |
639 | - $ref = 'manage' . $this->screen->id . 'columnshidden'; |
|
640 | - return (array) get_user_option( $ref, $user_id ); |
|
639 | + $ref = 'manage'.$this->screen->id.'columnshidden'; |
|
640 | + return (array) get_user_option($ref, $user_id); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | |
@@ -650,47 +650,47 @@ discard block |
||
650 | 650 | * @since 3.1.0 |
651 | 651 | * @param EE_Base_Class $item The current item |
652 | 652 | */ |
653 | - public function single_row_columns( $item ) { |
|
654 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
653 | + public function single_row_columns($item) { |
|
654 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
655 | 655 | |
656 | 656 | global $wp_version; |
657 | - $use_hidden_class = version_compare( $wp_version, '4.3-RC', '>=' ); |
|
657 | + $use_hidden_class = version_compare($wp_version, '4.3-RC', '>='); |
|
658 | 658 | |
659 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
659 | + foreach ($columns as $column_name => $column_display_name) { |
|
660 | 660 | |
661 | 661 | /** |
662 | 662 | * With WordPress version 4.3.RC+ WordPress started using the hidden css class to control whether columns are |
663 | 663 | * hidden or not instead of using "display:none;". This bit of code provides backward compat. |
664 | 664 | */ |
665 | - $hidden_class = $use_hidden_class && in_array( $column_name, $hidden ) ? ' hidden' : ''; |
|
666 | - $style = ! $use_hidden_class && in_array( $column_name, $hidden ) ? ' style="display:none;"' : ''; |
|
665 | + $hidden_class = $use_hidden_class && in_array($column_name, $hidden) ? ' hidden' : ''; |
|
666 | + $style = ! $use_hidden_class && in_array($column_name, $hidden) ? ' style="display:none;"' : ''; |
|
667 | 667 | |
668 | - $classes = $column_name . ' column-' . $column_name.$hidden_class; |
|
669 | - if ( $primary === $column_name ) { |
|
668 | + $classes = $column_name.' column-'.$column_name.$hidden_class; |
|
669 | + if ($primary === $column_name) { |
|
670 | 670 | $classes .= ' has-row-actions column-primary'; |
671 | 671 | } |
672 | 672 | |
673 | - $data = ' data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
673 | + $data = ' data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
674 | 674 | |
675 | 675 | $class = "class='$classes'"; |
676 | 676 | |
677 | 677 | $attributes = "$class$style$data"; |
678 | 678 | |
679 | - if ( $column_name === 'cb' ) { |
|
679 | + if ($column_name === 'cb') { |
|
680 | 680 | echo '<th scope="row" class="check-column">'; |
681 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb( $item ), $item, $this ); |
|
681 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_cb_content', $this->column_cb($item), $item, $this); |
|
682 | 682 | echo '</th>'; |
683 | 683 | } |
684 | - elseif ( method_exists( $this, 'column_' . $column_name ) ) { |
|
684 | + elseif (method_exists($this, 'column_'.$column_name)) { |
|
685 | 685 | echo "<td $attributes>"; |
686 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_' . $column_name . '__column_content', call_user_func( array( $this, 'column_' . $column_name ), $item ), $item, $this ); |
|
687 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
686 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_'.$column_name.'__column_content', call_user_func(array($this, 'column_'.$column_name), $item), $item, $this); |
|
687 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
688 | 688 | echo "</td>"; |
689 | 689 | } |
690 | 690 | else { |
691 | 691 | echo "<td $attributes>"; |
692 | - echo apply_filters( 'FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default( $item, $column_name ), $item, $column_name, $this ); |
|
693 | - echo $this->handle_row_actions( $item, $column_name, $primary ); |
|
692 | + echo apply_filters('FHEE__EE_Admin_List_Table__single_row_columns__column_default__column_content', $this->column_default($item, $column_name), $item, $column_name, $this); |
|
693 | + echo $this->handle_row_actions($item, $column_name, $primary); |
|
694 | 694 | echo "</td>"; |
695 | 695 | } |
696 | 696 | } |
@@ -705,15 +705,15 @@ discard block |
||
705 | 705 | * @param string $which |
706 | 706 | * @throws \EE_Error |
707 | 707 | */ |
708 | - public function extra_tablenav( $which ) { |
|
709 | - if ( $which === 'top' ) { |
|
708 | + public function extra_tablenav($which) { |
|
709 | + if ($which === 'top') { |
|
710 | 710 | $this->_filters(); |
711 | 711 | echo $this->_get_hidden_fields(); |
712 | - }else{ |
|
712 | + } else { |
|
713 | 713 | echo '<div class="list-table-bottom-buttons alignleft actions">'; |
714 | - foreach($this->_bottom_buttons as $type => $action){ |
|
715 | - $route = isset( $action['route'] ) ? $action['route'] : ''; |
|
716 | - $extra_request = isset( $action['extra_request'] ) ? $action['extra_request'] : ''; |
|
714 | + foreach ($this->_bottom_buttons as $type => $action) { |
|
715 | + $route = isset($action['route']) ? $action['route'] : ''; |
|
716 | + $extra_request = isset($action['extra_request']) ? $action['extra_request'] : ''; |
|
717 | 717 | echo $this->_admin_page->get_action_link_or_button( |
718 | 718 | $route, |
719 | 719 | $type, |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | false |
724 | 724 | ); |
725 | 725 | } |
726 | - do_action( 'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen ); |
|
726 | + do_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', $this, $this->_screen); |
|
727 | 727 | echo '</div>'; |
728 | 728 | } |
729 | 729 | //echo $this->_entries_per_page_dropdown; |
@@ -779,11 +779,11 @@ discard block |
||
779 | 779 | * the actions. |
780 | 780 | * @return string The assembled action elements container. |
781 | 781 | */ |
782 | - protected function _action_string( $action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '' ) { |
|
782 | + protected function _action_string($action_items, $item, $action_container = 'ul', $action_class = '', $action_id = '') { |
|
783 | 783 | $content = ''; |
784 | - $action_class = ! empty( $action_class ) ? ' class="' . $action_class . '"' : ''; |
|
785 | - $action_id = ! empty( $action_id ) ? ' id="' . $action_id . '"' : ''; |
|
786 | - $content .= ! empty( $action_container ) ? '<' . $action_container . $action_class . $action_id . '>' : ''; |
|
784 | + $action_class = ! empty($action_class) ? ' class="'.$action_class.'"' : ''; |
|
785 | + $action_id = ! empty($action_id) ? ' id="'.$action_id.'"' : ''; |
|
786 | + $content .= ! empty($action_container) ? '<'.$action_container.$action_class.$action_id.'>' : ''; |
|
787 | 787 | try { |
788 | 788 | $content .= apply_filters( |
789 | 789 | 'FHEE__EE_Admin_List_Table___action_string__action_items', |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | ); |
794 | 794 | } catch (\Exception $e) { |
795 | 795 | if (WP_DEBUG) { |
796 | - \EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
796 | + \EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 797 | } |
798 | 798 | $content .= $action_items; |
799 | 799 | } |
800 | - $content .= ! empty( $action_container ) ? '</' . $action_container . '>' : ''; |
|
800 | + $content .= ! empty($action_container) ? '</'.$action_container.'>' : ''; |
|
801 | 801 | return $content; |
802 | 802 | } |
803 | 803 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\libraries\rest_api\Model_Data_Translator; |
5 | 5 | |
6 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | /** |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | * @param \WP_REST_Request $request |
26 | 26 | * @return array|\WP_REST_Response |
27 | 27 | */ |
28 | - public static function handle_request_models_meta( \WP_REST_Request $request ) { |
|
28 | + public static function handle_request_models_meta(\WP_REST_Request $request) { |
|
29 | 29 | $controller = new Meta(); |
30 | - try{ |
|
30 | + try { |
|
31 | 31 | $matches = $controller->parse_route( |
32 | 32 | $request->get_route(), |
33 | - '~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~', |
|
34 | - array( 'version' ) ); |
|
35 | - if( $matches instanceof \WP_REST_Response ) { |
|
33 | + '~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~', |
|
34 | + array('version') ); |
|
35 | + if ($matches instanceof \WP_REST_Response) { |
|
36 | 36 | return $matches; |
37 | 37 | } |
38 | - $controller->set_requested_version( $matches[ 'version' ] ); |
|
39 | - return $controller->send_response( $controller->_get_models_metadata_entity() ); |
|
40 | - } catch( \Exception $e ) { |
|
41 | - return $controller->send_response( $e ); |
|
38 | + $controller->set_requested_version($matches['version']); |
|
39 | + return $controller->send_response($controller->_get_models_metadata_entity()); |
|
40 | + } catch (\Exception $e) { |
|
41 | + return $controller->send_response($e); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * Gets the model metadata resource entity |
47 | 47 | * @return array for JSON response, describing all the models available in teh requested version |
48 | 48 | */ |
49 | - protected function _get_models_metadata_entity(){ |
|
49 | + protected function _get_models_metadata_entity() { |
|
50 | 50 | $response = array(); |
51 | - foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){ |
|
52 | - $model = $this->get_model_version_info()->load_model( $model_name ); |
|
51 | + foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) { |
|
52 | + $model = $this->get_model_version_info()->load_model($model_name); |
|
53 | 53 | $fields_json = array(); |
54 | - foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) { |
|
55 | - if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) { |
|
54 | + foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) { |
|
55 | + if ($this->get_model_version_info()->field_is_ignored($field_obj)) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | - if( $field_obj instanceof \EE_Boolean_Field ) { |
|
58 | + if ($field_obj instanceof \EE_Boolean_Field) { |
|
59 | 59 | $datatype = 'Boolean'; |
60 | - }elseif( $field_obj->get_wpdb_data_type() == '%d' ) { |
|
60 | + }elseif ($field_obj->get_wpdb_data_type() == '%d') { |
|
61 | 61 | $datatype = 'Number'; |
62 | - }elseif( $field_name instanceof \EE_Serialized_Text_Field ) { |
|
62 | + }elseif ($field_name instanceof \EE_Serialized_Text_Field) { |
|
63 | 63 | $datatype = 'Object'; |
64 | - }else{ |
|
64 | + } else { |
|
65 | 65 | $datatype = 'String'; |
66 | 66 | } |
67 | 67 | $default_value = Model_Data_Translator::prepare_field_value_for_json( |
@@ -72,30 +72,30 @@ discard block |
||
72 | 72 | $field_json = array( |
73 | 73 | 'name' => $field_name, |
74 | 74 | 'nicename' => $field_obj->get_nicename(), |
75 | - 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ), |
|
76 | - 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ), |
|
77 | - 'type' => str_replace('EE_', '', get_class( $field_obj ) ), |
|
75 | + 'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj), |
|
76 | + 'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj), |
|
77 | + 'type' => str_replace('EE_', '', get_class($field_obj)), |
|
78 | 78 | 'datatype' => $datatype, |
79 | 79 | 'nullable' => $field_obj->is_nullable(), |
80 | 80 | 'default' => $default_value, |
81 | 81 | 'table_alias' => $field_obj->get_table_alias(), |
82 | 82 | 'table_column' => $field_obj->get_table_column(), |
83 | 83 | ); |
84 | - $fields_json[ $field_json[ 'name' ] ] = $field_json; |
|
84 | + $fields_json[$field_json['name']] = $field_json; |
|
85 | 85 | |
86 | 86 | } |
87 | - $fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) ); |
|
88 | - $response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model ); |
|
87 | + $fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model)); |
|
88 | + $response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model); |
|
89 | 89 | $relations_json = array(); |
90 | - foreach( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
90 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
91 | 91 | $relation_json = array( |
92 | 92 | 'name' => $relation_name, |
93 | - 'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ), |
|
93 | + 'type' => str_replace('EE_', '', get_class($relation_obj)), |
|
94 | 94 | 'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false, |
95 | 95 | ); |
96 | - $relations_json[ $relation_name ] = $relation_json; |
|
96 | + $relations_json[$relation_name] = $relation_json; |
|
97 | 97 | } |
98 | - $response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model ); |
|
98 | + $response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model); |
|
99 | 99 | } |
100 | 100 | return $response; |
101 | 101 | } |
@@ -105,24 +105,24 @@ discard block |
||
105 | 105 | * @param \WP_REST_Response $rest_response_obj |
106 | 106 | * @return \WP_REST_Response |
107 | 107 | */ |
108 | - public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) { |
|
108 | + public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) { |
|
109 | 109 | $response_data = $rest_response_obj->get_data(); |
110 | 110 | $addons = array(); |
111 | - foreach( \EE_Registry::instance()->addons as $addon){ |
|
111 | + foreach (\EE_Registry::instance()->addons as $addon) { |
|
112 | 112 | $addon_json = array( |
113 | 113 | 'name' => $addon->name(), |
114 | 114 | 'version' => $addon->version() |
115 | 115 | ); |
116 | - $addons[ $addon_json[ 'name' ] ] = $addon_json; |
|
116 | + $addons[$addon_json['name']] = $addon_json; |
|
117 | 117 | } |
118 | - $response_data[ 'ee' ] = array( |
|
118 | + $response_data['ee'] = array( |
|
119 | 119 | 'version' => \EEM_System_Status::instance()->get_ee_version(), |
120 | 120 | 'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API', |
121 | 121 | 'addons' => $addons, |
122 | 122 | 'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(), |
123 | - 'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ), |
|
123 | + 'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()), |
|
124 | 124 | ); |
125 | - $rest_response_obj->set_data( $response_data ); |
|
125 | + $rest_response_obj->set_data($response_data); |
|
126 | 126 | return $rest_response_obj; |
127 | 127 | } |
128 | 128 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\libraries\rest_api\controllers\config; |
3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @param \WP_REST_Request $request |
22 | 22 | * @return \EE_Config|\WP_Error |
23 | 23 | */ |
24 | - public static function handle_request( \WP_REST_Request $request) { |
|
24 | + public static function handle_request(\WP_REST_Request $request) { |
|
25 | 25 | $cap = \EE_Restriction_Generator_Base::get_default_restrictions_cap(); |
26 | - if( \EE_Capabilities::instance()->current_user_can( $cap, 'read_over_api' ) ){ |
|
26 | + if (\EE_Capabilities::instance()->current_user_can($cap, 'read_over_api')) { |
|
27 | 27 | return \EE_Config::instance(); |
28 | - }else{ |
|
28 | + } else { |
|
29 | 29 | return new \WP_Error( |
30 | 30 | 'cannot_read_config', |
31 | 31 | sprintf( |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ), |
36 | 36 | $cap |
37 | 37 | ), |
38 | - array( 'status' => 403 ) |
|
38 | + array('status' => 403) |
|
39 | 39 | ); |
40 | 40 | } |
41 | 41 | } |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | * @param \WP_REST_Request $request |
46 | 46 | * @return \EE_Config|\WP_Error |
47 | 47 | */ |
48 | - public static function handle_request_site_info( \WP_REST_Request $request) { |
|
48 | + public static function handle_request_site_info(\WP_REST_Request $request) { |
|
49 | 49 | return array( |
50 | 50 | 'default_timezone' => array( |
51 | 51 | 'pretty' => \EEH_DTT_Helper::get_timezone_string_for_display(), |
52 | - 'string' => get_option( 'timezone_string' ), |
|
52 | + 'string' => get_option('timezone_string'), |
|
53 | 53 | 'offset' => \EEH_DTT_Helper::get_site_timezone_gmt_offset(), |
54 | 54 | ), |
55 | 55 | 'default_currency' => \EE_Config::instance()->currency |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @return string |
54 | 54 | * @throws \EE_Error |
55 | 55 | */ |
56 | - public static function get_valid_timezone_string( $timezone_string = '' ) { |
|
56 | + public static function get_valid_timezone_string($timezone_string = '') { |
|
57 | 57 | // if passed a value, then use that, else get WP option |
58 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
58 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
59 | 59 | // value from above exists, use that, else get timezone string from gmt_offset |
60 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
61 | - EEH_DTT_Helper::validate_timezone( $timezone_string ); |
|
60 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
61 | + EEH_DTT_Helper::validate_timezone($timezone_string); |
|
62 | 62 | return $timezone_string; |
63 | 63 | } |
64 | 64 | |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | * @return bool |
75 | 75 | * @throws \EE_Error |
76 | 76 | */ |
77 | - public static function validate_timezone( $timezone_string, $throw_error = true ) { |
|
77 | + public static function validate_timezone($timezone_string, $throw_error = true) { |
|
78 | 78 | // easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it |
79 | 79 | try { |
80 | - new DateTimeZone( $timezone_string ); |
|
81 | - } catch ( Exception $e ) { |
|
80 | + new DateTimeZone($timezone_string); |
|
81 | + } catch (Exception $e) { |
|
82 | 82 | // sometimes we take exception to exceptions |
83 | - if ( ! $throw_error ) { |
|
83 | + if ( ! $throw_error) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | throw new EE_Error( |
87 | 87 | sprintf( |
88 | - __( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
88 | + __('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
89 | 89 | $timezone_string, |
90 | 90 | '<a href="http://www.php.net/manual/en/timezones.php">', |
91 | 91 | '</a>' |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | * @param string $gmt_offset |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) { |
|
107 | + public static function get_timezone_string_from_gmt_offset($gmt_offset = '') { |
|
108 | 108 | $timezone_string = 'UTC'; |
109 | - $gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' ); |
|
110 | - if ( $gmt_offset !== '' ) { |
|
109 | + $gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset'); |
|
110 | + if ($gmt_offset !== '') { |
|
111 | 111 | // convert GMT offset to seconds |
112 | 112 | $gmt_offset = $gmt_offset * HOUR_IN_SECONDS; |
113 | 113 | // account for WP offsets that aren't valid UTC |
114 | - $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset ); |
|
114 | + $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset); |
|
115 | 115 | // although we don't know the TZ abbreviation, we know the UTC offset |
116 | - $timezone_string = timezone_name_from_abbr( null, $gmt_offset ); |
|
116 | + $timezone_string = timezone_name_from_abbr(null, $gmt_offset); |
|
117 | 117 | } |
118 | 118 | // better have a valid timezone string by now, but if not, sigh... loop thru the timezone_abbreviations_list()... |
119 | - $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset ); |
|
119 | + $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset); |
|
120 | 120 | return $timezone_string; |
121 | 121 | } |
122 | 122 | |
@@ -127,15 +127,15 @@ discard block |
||
127 | 127 | * @return int seconds offset |
128 | 128 | */ |
129 | 129 | public static function get_site_timezone_gmt_offset() { |
130 | - $timezone_string = get_option( 'timezone_string' ); |
|
131 | - if ( $timezone_string ) { |
|
130 | + $timezone_string = get_option('timezone_string'); |
|
131 | + if ($timezone_string) { |
|
132 | 132 | try { |
133 | - $timezone = new DateTimeZone( $timezone_string ); |
|
134 | - return $timezone->getOffset( new DateTime() ); //in WordPress DateTime defaults to UTC |
|
135 | - } catch( Exception $e ){} |
|
133 | + $timezone = new DateTimeZone($timezone_string); |
|
134 | + return $timezone->getOffset(new DateTime()); //in WordPress DateTime defaults to UTC |
|
135 | + } catch (Exception $e) {} |
|
136 | 136 | } |
137 | - $offset = get_option( 'gmt_offset' ); |
|
138 | - return (int) ( $offset * HOUR_IN_SECONDS ); |
|
137 | + $offset = get_option('gmt_offset'); |
|
138 | + return (int) ($offset * HOUR_IN_SECONDS); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | * @param int $gmt_offset |
148 | 148 | * @return int |
149 | 149 | */ |
150 | - public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) { |
|
150 | + public static function adjust_invalid_gmt_offsets($gmt_offset = 0) { |
|
151 | 151 | //make sure $gmt_offset is int |
152 | 152 | $gmt_offset = (int) $gmt_offset; |
153 | - switch ( $gmt_offset ) { |
|
153 | + switch ($gmt_offset) { |
|
154 | 154 | |
155 | 155 | // case -30600 : |
156 | 156 | // $gmt_offset = -28800; |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | * @return string |
203 | 203 | * @throws \EE_Error |
204 | 204 | */ |
205 | - public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) { |
|
205 | + public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) { |
|
206 | 206 | $abbreviations = timezone_abbreviations_list(); |
207 | - foreach ( $abbreviations as $abbreviation ) { |
|
208 | - foreach ( $abbreviation as $city ) { |
|
209 | - if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) { |
|
207 | + foreach ($abbreviations as $abbreviation) { |
|
208 | + foreach ($abbreviation as $city) { |
|
209 | + if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) { |
|
210 | 210 | // check if the timezone is valid but don't throw any errors if it isn't |
211 | - if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) { |
|
211 | + if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) { |
|
212 | 212 | return $city['timezone_id']; |
213 | 213 | } |
214 | 214 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | throw new EE_Error( |
218 | 218 | sprintf( |
219 | - __( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
219 | + __('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
220 | 220 | $gmt_offset, |
221 | 221 | '<a href="http://www.php.net/manual/en/timezones.php">', |
222 | 222 | '</a>' |
@@ -230,23 +230,23 @@ discard block |
||
230 | 230 | * @access public |
231 | 231 | * @param string $timezone_string |
232 | 232 | */ |
233 | - public static function timezone_select_input( $timezone_string = '' ) { |
|
233 | + public static function timezone_select_input($timezone_string = '') { |
|
234 | 234 | // get WP date time format |
235 | - $datetime_format = get_option('date_format') . ' ' . get_option('time_format'); |
|
235 | + $datetime_format = get_option('date_format').' '.get_option('time_format'); |
|
236 | 236 | // if passed a value, then use that, else get WP option |
237 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
237 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
238 | 238 | // check if the timezone is valid but don't throw any errors if it isn't |
239 | - $timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false ); |
|
239 | + $timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false); |
|
240 | 240 | $gmt_offset = get_option('gmt_offset'); |
241 | 241 | |
242 | 242 | $check_zone_info = true; |
243 | - if ( empty( $timezone_string )) { |
|
243 | + if (empty($timezone_string)) { |
|
244 | 244 | // Create a UTC+- zone if no timezone string exists |
245 | 245 | $check_zone_info = false; |
246 | - if ( $gmt_offset > 0 ) { |
|
247 | - $timezone_string = 'UTC+' . $gmt_offset; |
|
248 | - } elseif ( $gmt_offset < 0 ) { |
|
249 | - $timezone_string = 'UTC' . $gmt_offset; |
|
246 | + if ($gmt_offset > 0) { |
|
247 | + $timezone_string = 'UTC+'.$gmt_offset; |
|
248 | + } elseif ($gmt_offset < 0) { |
|
249 | + $timezone_string = 'UTC'.$gmt_offset; |
|
250 | 250 | } else { |
251 | 251 | $timezone_string = 'UTC'; |
252 | 252 | } |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | __('%1$sUTC%2$s time is %3$s'), |
269 | 269 | '<abbr title="Coordinated Universal Time">', |
270 | 270 | '</abbr>', |
271 | - '<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>' |
|
271 | + '<code>'.date_i18n($datetime_format, false, 'gmt').'</code>' |
|
272 | 272 | ); |
273 | 273 | ?></span> |
274 | - <?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?> |
|
275 | - <br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span> |
|
274 | + <?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?> |
|
275 | + <br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span> |
|
276 | 276 | <?php endif; ?> |
277 | 277 | |
278 | 278 | <?php if ($check_zone_info && $timezone_string) : ?> |
@@ -304,10 +304,9 @@ discard block |
||
304 | 304 | |
305 | 305 | if ($found) { |
306 | 306 | $message = $tr['isdst'] ? |
307 | - __(' Daylight saving time begins on: %s.' ) : |
|
308 | - __(' Standard time begins on: %s.'); |
|
307 | + __(' Daylight saving time begins on: %s.') : __(' Standard time begins on: %s.'); |
|
309 | 308 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
310 | - printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' ); |
|
309 | + printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >'); |
|
311 | 310 | } else { |
312 | 311 | _e('This timezone does not observe daylight saving time.'); |
313 | 312 | } |
@@ -337,14 +336,14 @@ discard block |
||
337 | 336 | * |
338 | 337 | * @return int $unix_timestamp with the offset applied for the given timezone. |
339 | 338 | */ |
340 | - public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) { |
|
339 | + public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') { |
|
341 | 340 | $unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp; |
342 | - $timezone_string = self::get_valid_timezone_string( $timezone_string ); |
|
343 | - $TimeZone = new DateTimeZone( $timezone_string ); |
|
341 | + $timezone_string = self::get_valid_timezone_string($timezone_string); |
|
342 | + $TimeZone = new DateTimeZone($timezone_string); |
|
344 | 343 | |
345 | - $DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone ); |
|
346 | - $offset = timezone_offset_get( $TimeZone, $DateTime ); |
|
347 | - return (int)$DateTime->format( 'U' ) + (int)$offset; |
|
344 | + $DateTime = new DateTime('@'.$unix_timestamp, $TimeZone); |
|
345 | + $offset = timezone_offset_get($TimeZone, $DateTime); |
|
346 | + return (int) $DateTime->format('U') + (int) $offset; |
|
348 | 347 | } |
349 | 348 | |
350 | 349 | |
@@ -359,17 +358,17 @@ discard block |
||
359 | 358 | * @param string $datetime_field_name the datetime fieldname to be manipulated |
360 | 359 | * @return EE_Base_Class |
361 | 360 | */ |
362 | - protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) { |
|
361 | + protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) { |
|
363 | 362 | // grab current datetime format |
364 | 363 | $current_format = $obj->get_format(); |
365 | 364 | // set new full timestamp format |
366 | - $obj->set_date_format( EE_Datetime_Field::mysql_date_format ); |
|
367 | - $obj->set_time_format( EE_Datetime_Field::mysql_time_format ); |
|
365 | + $obj->set_date_format(EE_Datetime_Field::mysql_date_format); |
|
366 | + $obj->set_time_format(EE_Datetime_Field::mysql_time_format); |
|
368 | 367 | // set the new date value using a full timestamp format so that no data is lost |
369 | - $obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) ); |
|
368 | + $obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format)); |
|
370 | 369 | // reset datetime formats |
371 | - $obj->set_date_format( $current_format[0] ); |
|
372 | - $obj->set_time_format( $current_format[1] ); |
|
370 | + $obj->set_date_format($current_format[0]); |
|
371 | + $obj->set_time_format($current_format[1]); |
|
373 | 372 | return $obj; |
374 | 373 | } |
375 | 374 | |
@@ -386,11 +385,11 @@ discard block |
||
386 | 385 | * @param integer $value what you want to increment the time by |
387 | 386 | * @return EE_Base_Class return the EE_Base_Class object so right away you can do something with it (chaining) |
388 | 387 | */ |
389 | - public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
388 | + public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
390 | 389 | //get the raw UTC date. |
391 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
392 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value ); |
|
393 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
390 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
391 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value); |
|
392 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
394 | 393 | } |
395 | 394 | |
396 | 395 | |
@@ -405,11 +404,11 @@ discard block |
||
405 | 404 | * @param int $value |
406 | 405 | * @return \EE_Base_Class |
407 | 406 | */ |
408 | - public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
407 | + public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
409 | 408 | //get the raw UTC date |
410 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
411 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' ); |
|
412 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
409 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
410 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-'); |
|
411 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
413 | 412 | } |
414 | 413 | |
415 | 414 | |
@@ -422,44 +421,44 @@ discard block |
||
422 | 421 | * @return \DateTime return whatever type came in. |
423 | 422 | * @throws \EE_Error |
424 | 423 | */ |
425 | - protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) { |
|
426 | - if ( ! $DateTime instanceof DateTime ) { |
|
424 | + protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') { |
|
425 | + if ( ! $DateTime instanceof DateTime) { |
|
427 | 426 | throw new EE_Error( |
428 | 427 | sprintf( |
429 | - __( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ), |
|
430 | - print_r( $DateTime, true ) |
|
428 | + __('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'), |
|
429 | + print_r($DateTime, true) |
|
431 | 430 | ) |
432 | 431 | ); |
433 | 432 | } |
434 | - switch ( $period ) { |
|
433 | + switch ($period) { |
|
435 | 434 | case 'years' : |
436 | - $value = 'P' . $value . 'Y'; |
|
435 | + $value = 'P'.$value.'Y'; |
|
437 | 436 | break; |
438 | 437 | case 'months' : |
439 | - $value = 'P' . $value . 'M'; |
|
438 | + $value = 'P'.$value.'M'; |
|
440 | 439 | break; |
441 | 440 | case 'weeks' : |
442 | - $value = 'P' . $value . 'W'; |
|
441 | + $value = 'P'.$value.'W'; |
|
443 | 442 | break; |
444 | 443 | case 'days' : |
445 | - $value = 'P' . $value . 'D'; |
|
444 | + $value = 'P'.$value.'D'; |
|
446 | 445 | break; |
447 | 446 | case 'hours' : |
448 | - $value = 'PT' . $value . 'H'; |
|
447 | + $value = 'PT'.$value.'H'; |
|
449 | 448 | break; |
450 | 449 | case 'minutes' : |
451 | - $value = 'PT' . $value . 'M'; |
|
450 | + $value = 'PT'.$value.'M'; |
|
452 | 451 | break; |
453 | 452 | case 'seconds' : |
454 | - $value = 'PT' . $value . 'S'; |
|
453 | + $value = 'PT'.$value.'S'; |
|
455 | 454 | break; |
456 | 455 | } |
457 | - switch ( $operand ) { |
|
456 | + switch ($operand) { |
|
458 | 457 | case '+': |
459 | - $DateTime->add( new DateInterval( $value ) ); |
|
458 | + $DateTime->add(new DateInterval($value)); |
|
460 | 459 | break; |
461 | 460 | case '-': |
462 | - $DateTime->sub( new DateInterval( $value ) ); |
|
461 | + $DateTime->sub(new DateInterval($value)); |
|
463 | 462 | break; |
464 | 463 | } |
465 | 464 | return $DateTime; |
@@ -475,16 +474,16 @@ discard block |
||
475 | 474 | * @return \DateTime return whatever type came in. |
476 | 475 | * @throws \EE_Error |
477 | 476 | */ |
478 | - protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
479 | - if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) { |
|
477 | + protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
478 | + if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) { |
|
480 | 479 | throw new EE_Error( |
481 | 480 | sprintf( |
482 | - __( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ), |
|
483 | - print_r( $timestamp, true ) |
|
481 | + __('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'), |
|
482 | + print_r($timestamp, true) |
|
484 | 483 | ) |
485 | 484 | ); |
486 | 485 | } |
487 | - switch ( $period ) { |
|
486 | + switch ($period) { |
|
488 | 487 | case 'years' : |
489 | 488 | $value = YEAR_IN_SECONDS * $value; |
490 | 489 | break; |
@@ -504,9 +503,9 @@ discard block |
||
504 | 503 | $value = MINUTE_IN_SECONDS * $value; |
505 | 504 | break; |
506 | 505 | } |
507 | - switch ( $operand ) { |
|
506 | + switch ($operand) { |
|
508 | 507 | case '+': |
509 | - $timestamp += $value; |
|
508 | + $timestamp += $value; |
|
510 | 509 | break; |
511 | 510 | case '-': |
512 | 511 | $timestamp -= $value; |
@@ -526,11 +525,11 @@ discard block |
||
526 | 525 | * @param string $operand What operand you wish to use for the calculation |
527 | 526 | * @return mixed string|DateTime return whatever type came in. |
528 | 527 | */ |
529 | - public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
530 | - if ( $DateTime_or_timestamp instanceof DateTime ) { |
|
531 | - return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand ); |
|
532 | - } else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) { |
|
533 | - return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand ); |
|
528 | + public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
529 | + if ($DateTime_or_timestamp instanceof DateTime) { |
|
530 | + return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand); |
|
531 | + } else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) { |
|
532 | + return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand); |
|
534 | 533 | } else { |
535 | 534 | //error |
536 | 535 | return $DateTime_or_timestamp; |
@@ -560,24 +559,24 @@ discard block |
||
560 | 559 | * 'moment' => //date and time format. |
561 | 560 | * ) |
562 | 561 | */ |
563 | - public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) { |
|
564 | - if ( $date_format_string === null ) { |
|
565 | - $date_format_string = get_option( 'date_format' ); |
|
562 | + public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) { |
|
563 | + if ($date_format_string === null) { |
|
564 | + $date_format_string = get_option('date_format'); |
|
566 | 565 | } |
567 | 566 | |
568 | - if ( $time_format_string === null ) { |
|
569 | - $time_format_string = get_option( 'time_format' ); |
|
567 | + if ($time_format_string === null) { |
|
568 | + $time_format_string = get_option('time_format'); |
|
570 | 569 | } |
571 | 570 | |
572 | - $date_format = self::_php_to_js_moment_converter( $date_format_string ); |
|
573 | - $time_format = self::_php_to_js_moment_converter( $time_format_string ); |
|
571 | + $date_format = self::_php_to_js_moment_converter($date_format_string); |
|
572 | + $time_format = self::_php_to_js_moment_converter($time_format_string); |
|
574 | 573 | |
575 | 574 | return array( |
576 | 575 | 'js' => array( |
577 | 576 | 'date' => $date_format['js'], |
578 | 577 | 'time' => $time_format['js'] |
579 | 578 | ), |
580 | - 'moment' => $date_format['moment'] . ' ' . $time_format['moment' ] |
|
579 | + 'moment' => $date_format['moment'].' '.$time_format['moment'] |
|
581 | 580 | ); |
582 | 581 | } |
583 | 582 | |
@@ -591,7 +590,7 @@ discard block |
||
591 | 590 | * |
592 | 591 | * @return array js and moment formats. |
593 | 592 | */ |
594 | - protected static function _php_to_js_moment_converter( $format_string ) { |
|
593 | + protected static function _php_to_js_moment_converter($format_string) { |
|
595 | 594 | /** |
596 | 595 | * This is a map of symbols for formats. |
597 | 596 | * The index is the php symbol, the equivalent values are in the array. |
@@ -748,15 +747,15 @@ discard block |
||
748 | 747 | $jquery_ui_format = ""; |
749 | 748 | $moment_format = ""; |
750 | 749 | $escaping = false; |
751 | - for ( $i = 0; $i < strlen($format_string); $i++ ) { |
|
750 | + for ($i = 0; $i < strlen($format_string); $i++) { |
|
752 | 751 | $char = $format_string[$i]; |
753 | - if ( $char === '\\' ) { // PHP date format escaping character |
|
752 | + if ($char === '\\') { // PHP date format escaping character |
|
754 | 753 | $i++; |
755 | - if ( $escaping ) { |
|
754 | + if ($escaping) { |
|
756 | 755 | $jquery_ui_format .= $format_string[$i]; |
757 | 756 | $moment_format .= $format_string[$i]; |
758 | 757 | } else { |
759 | - $jquery_ui_format .= '\'' . $format_string[$i]; |
|
758 | + $jquery_ui_format .= '\''.$format_string[$i]; |
|
760 | 759 | $moment_format .= $format_string[$i]; |
761 | 760 | } |
762 | 761 | $escaping = true; |
@@ -775,7 +774,7 @@ discard block |
||
775 | 774 | } |
776 | 775 | } |
777 | 776 | } |
778 | - return array( 'js' => $jquery_ui_format, 'moment' => $moment_format ); |
|
777 | + return array('js' => $jquery_ui_format, 'moment' => $moment_format); |
|
779 | 778 | } |
780 | 779 | |
781 | 780 | |
@@ -790,25 +789,25 @@ discard block |
||
790 | 789 | * errors is returned. So for client code calling, check for is_array() to |
791 | 790 | * indicate failed validations. |
792 | 791 | */ |
793 | - public static function validate_format_string( $format_string ) { |
|
792 | + public static function validate_format_string($format_string) { |
|
794 | 793 | $error_msg = array(); |
795 | 794 | //time format checks |
796 | - switch ( true ) { |
|
797 | - case strpos( $format_string, 'h' ) !== false : |
|
798 | - case strpos( $format_string, 'g' ) !== false : |
|
795 | + switch (true) { |
|
796 | + case strpos($format_string, 'h') !== false : |
|
797 | + case strpos($format_string, 'g') !== false : |
|
799 | 798 | /** |
800 | 799 | * if the time string has a lowercase 'h' which == 12 hour time format and there |
801 | 800 | * is not any ante meridiem format ('a' or 'A'). Then throw an error because its |
802 | 801 | * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am. |
803 | 802 | */ |
804 | - if ( strpos( strtoupper( $format_string ), 'A' ) === false ) { |
|
805 | - $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' ); |
|
803 | + if (strpos(strtoupper($format_string), 'A') === false) { |
|
804 | + $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso'); |
|
806 | 805 | } |
807 | 806 | break; |
808 | 807 | |
809 | 808 | } |
810 | 809 | |
811 | - return empty( $error_msg ) ? true : $error_msg; |
|
810 | + return empty($error_msg) ? true : $error_msg; |
|
812 | 811 | } |
813 | 812 | |
814 | 813 | |
@@ -830,11 +829,11 @@ discard block |
||
830 | 829 | * @param mixed $date_2 |
831 | 830 | * @return bool |
832 | 831 | */ |
833 | - public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) { |
|
832 | + public static function dates_represent_one_24_hour_date($date_1, $date_2) { |
|
834 | 833 | |
835 | 834 | if ( |
836 | - ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) || |
|
837 | - ( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' ) |
|
835 | + ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) || |
|
836 | + ($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00') |
|
838 | 837 | ) { |
839 | 838 | return false; |
840 | 839 | } |
@@ -851,11 +850,11 @@ discard block |
||
851 | 850 | * @param string $field_for_interval The Database field that is the interval is applied to in the query. |
852 | 851 | * @return string |
853 | 852 | */ |
854 | - public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) { |
|
853 | + public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) { |
|
855 | 854 | try { |
856 | 855 | /** need to account for timezone offset on the selects */ |
857 | - $DateTimeZone = new DateTimeZone( $timezone_string ); |
|
858 | - } catch ( Exception $e ) { |
|
856 | + $DateTimeZone = new DateTimeZone($timezone_string); |
|
857 | + } catch (Exception $e) { |
|
859 | 858 | $DateTimeZone = null; |
860 | 859 | } |
861 | 860 | |
@@ -863,10 +862,10 @@ discard block |
||
863 | 862 | * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds. |
864 | 863 | * Hence we do the calc for DateTimeZone::getOffset. |
865 | 864 | */ |
866 | - $offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' ); |
|
865 | + $offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset'); |
|
867 | 866 | $query_interval = $offset < 0 |
868 | - ? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)' |
|
869 | - : 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)'; |
|
867 | + ? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)' |
|
868 | + : 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)'; |
|
870 | 869 | return $query_interval; |
871 | 870 | } |
872 | 871 | |
@@ -878,47 +877,47 @@ discard block |
||
878 | 877 | * @return string |
879 | 878 | */ |
880 | 879 | public static function get_timezone_string_for_display() { |
881 | - $pretty_timezone = apply_filters( 'FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '' ); |
|
882 | - if( ! empty( $pretty_timezone ) ) { |
|
883 | - return esc_html( $pretty_timezone ); |
|
880 | + $pretty_timezone = apply_filters('FHEE__EEH_DTT_Helper__get_timezone_string_for_display', ''); |
|
881 | + if ( ! empty($pretty_timezone)) { |
|
882 | + return esc_html($pretty_timezone); |
|
884 | 883 | } |
885 | - $timezone_string = get_option( 'timezone_string' ); |
|
886 | - if( $timezone_string ) { |
|
884 | + $timezone_string = get_option('timezone_string'); |
|
885 | + if ($timezone_string) { |
|
887 | 886 | static $mo_loaded = false; |
888 | 887 | // Load translations for continents and cities just like wp_timezone_choice does |
889 | - if ( ! $mo_loaded ) { |
|
888 | + if ( ! $mo_loaded) { |
|
890 | 889 | $locale = get_locale(); |
891 | - $mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo'; |
|
892 | - load_textdomain( 'continents-cities', $mofile ); |
|
890 | + $mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo'; |
|
891 | + load_textdomain('continents-cities', $mofile); |
|
893 | 892 | $mo_loaded = true; |
894 | 893 | } |
895 | 894 | //well that was easy. |
896 | - $parts = explode('/', $timezone_string ); |
|
895 | + $parts = explode('/', $timezone_string); |
|
897 | 896 | //remove the continent |
898 | - unset( $parts[0] ); |
|
897 | + unset($parts[0]); |
|
899 | 898 | $t_parts = array(); |
900 | - foreach( $parts as $part ) { |
|
901 | - $t_parts[] = translate( str_replace( '_', ' ', $part ), 'continents-cities' ); |
|
899 | + foreach ($parts as $part) { |
|
900 | + $t_parts[] = translate(str_replace('_', ' ', $part), 'continents-cities'); |
|
902 | 901 | } |
903 | - return implode( ' - ', $t_parts ); |
|
902 | + return implode(' - ', $t_parts); |
|
904 | 903 | } |
905 | 904 | //they haven't set the timezone string, so let's return a string like "UTC+1" |
906 | - $gmt_offset = get_option( 'gmt_offset' ); |
|
907 | - if( intval( $gmt_offset ) >= 0 ) { |
|
905 | + $gmt_offset = get_option('gmt_offset'); |
|
906 | + if (intval($gmt_offset) >= 0) { |
|
908 | 907 | $prefix = '+'; |
909 | 908 | } else { |
910 | 909 | $prefix = ''; |
911 | 910 | } |
912 | - $parts = explode( '.', (string) $gmt_offset ); |
|
913 | - if( count( $parts ) === 1 ) { |
|
911 | + $parts = explode('.', (string) $gmt_offset); |
|
912 | + if (count($parts) === 1) { |
|
914 | 913 | $parts[1] = '00'; |
915 | 914 | } else { |
916 | 915 | //convert the part after the decimal, eg "5" (from x.5) or "25" (from x.25) |
917 | 916 | //to minutes, eg 30 or 15, respectively |
918 | - $hour_fraction = (float)( '0.' . $parts[1] ); |
|
919 | - $parts[1] = (string)$hour_fraction * 60; |
|
917 | + $hour_fraction = (float) ('0.'.$parts[1]); |
|
918 | + $parts[1] = (string) $hour_fraction * 60; |
|
920 | 919 | } |
921 | - return sprintf( __( 'UTC%1$s', 'event_espresso' ), $prefix . implode( ':', $parts ) ); |
|
920 | + return sprintf(__('UTC%1$s', 'event_espresso'), $prefix.implode(':', $parts)); |
|
922 | 921 | } |
923 | 922 | |
924 | 923 |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @param \EE_Registry $Registry |
89 | 89 | * @return \EE_System |
90 | 90 | */ |
91 | - public static function instance( EE_Registry $Registry = null ) { |
|
91 | + public static function instance(EE_Registry $Registry = null) { |
|
92 | 92 | // check if class object is instantiated |
93 | - if ( ! self::$_instance instanceof EE_System ) { |
|
94 | - self::$_instance = new self( $Registry ); |
|
93 | + if ( ! self::$_instance instanceof EE_System) { |
|
94 | + self::$_instance = new self($Registry); |
|
95 | 95 | } |
96 | 96 | return self::$_instance; |
97 | 97 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * resets the instance and returns it |
102 | 102 | * @return EE_System |
103 | 103 | */ |
104 | - public static function reset(){ |
|
104 | + public static function reset() { |
|
105 | 105 | self::$_instance->_req_type = NULL; |
106 | 106 | |
107 | 107 | //make sure none of the old hooks are left hanging around |
108 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
108 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
109 | 109 | |
110 | 110 | //we need to reset the migration manager in order for it to detect DMSs properly |
111 | 111 | EE_Data_Migration_Manager::reset(); |
@@ -125,28 +125,28 @@ discard block |
||
125 | 125 | * @access private |
126 | 126 | * @param \EE_Registry $Registry |
127 | 127 | */ |
128 | - private function __construct( EE_Registry $Registry ) { |
|
128 | + private function __construct(EE_Registry $Registry) { |
|
129 | 129 | $this->registry = $Registry; |
130 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
130 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
131 | 131 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
132 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
132 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
133 | 133 | // when an ee addon is activated, we want to call the core hook(s) again |
134 | 134 | // because the newly-activated addon didn't get a chance to run at all |
135 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
135 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
136 | 136 | // detect whether install or upgrade |
137 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
137 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
138 | 138 | // load EE_Config, EE_Textdomain, etc |
139 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
139 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
140 | 140 | // load EE_Config, EE_Textdomain, etc |
141 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
141 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
142 | 142 | // you wanna get going? I wanna get going... let's get going! |
143 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
143 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
144 | 144 | //other housekeeping |
145 | 145 | //exclude EE critical pages from wp_list_pages |
146 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
146 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
147 | 147 | // ALL EE Addons should use the following hook point to attach their initial setup too |
148 | 148 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
149 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
149 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -166,30 +166,30 @@ discard block |
||
166 | 166 | public function load_espresso_addons() { |
167 | 167 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
168 | 168 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
169 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
169 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
170 | 170 | //load and setup EE_Capabilities |
171 | - $this->registry->load_core( 'Capabilities' ); |
|
171 | + $this->registry->load_core('Capabilities'); |
|
172 | 172 | //caps need to be initialized on every request so that capability maps are set. |
173 | 173 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
174 | 174 | $this->registry->CAP->init_caps(); |
175 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
175 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
176 | 176 | //if the WP API basic auth plugin isn't already loaded, load it now. |
177 | 177 | //We want it for mobile apps. Just include the entire plugin |
178 | 178 | //also, don't load the basic auth when a plugin is getting activated, because |
179 | 179 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
180 | 180 | //and causes a fatal error |
181 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
182 | - && ! function_exists( 'json_basic_auth_error' ) |
|
181 | + if ( ! function_exists('json_basic_auth_handler') |
|
182 | + && ! function_exists('json_basic_auth_error') |
|
183 | 183 | && ! ( |
184 | - isset( $_GET[ 'action'] ) |
|
185 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
184 | + isset($_GET['action']) |
|
185 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
186 | 186 | ) |
187 | 187 | && ! ( |
188 | - isset( $_GET['activate' ] ) |
|
189 | - && $_GET['activate' ] === 'true' |
|
188 | + isset($_GET['activate']) |
|
189 | + && $_GET['activate'] === 'true' |
|
190 | 190 | ) |
191 | 191 | ) { |
192 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
192 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @access public |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - public function detect_activations_or_upgrades(){ |
|
208 | + public function detect_activations_or_upgrades() { |
|
209 | 209 | //first off: let's make sure to handle core |
210 | 210 | $this->detect_if_activation_or_upgrade(); |
211 | - foreach($this->registry->addons as $addon){ |
|
211 | + foreach ($this->registry->addons as $addon) { |
|
212 | 212 | //detect teh request type for that addon |
213 | 213 | $addon->detect_activation_or_upgrade(); |
214 | 214 | } |
@@ -229,41 +229,41 @@ discard block |
||
229 | 229 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
230 | 230 | |
231 | 231 | // load M-Mode class |
232 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
232 | + $this->registry->load_core('Maintenance_Mode'); |
|
233 | 233 | // check if db has been updated, or if its a brand-new installation |
234 | 234 | |
235 | 235 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
236 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
236 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
237 | 237 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
238 | 238 | |
239 | - switch($request_type){ |
|
239 | + switch ($request_type) { |
|
240 | 240 | case EE_System::req_type_new_activation: |
241 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
242 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
242 | + $this->_handle_core_version_change($espresso_db_update); |
|
243 | 243 | break; |
244 | 244 | case EE_System::req_type_reactivation: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
246 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
246 | + $this->_handle_core_version_change($espresso_db_update); |
|
247 | 247 | break; |
248 | 248 | case EE_System::req_type_upgrade: |
249 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
249 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
250 | 250 | //migrations may be required now that we've upgraded |
251 | 251 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
252 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
252 | + $this->_handle_core_version_change($espresso_db_update); |
|
253 | 253 | // echo "done upgrade";die; |
254 | 254 | break; |
255 | 255 | case EE_System::req_type_downgrade: |
256 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
256 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
257 | 257 | //its possible migrations are no longer required |
258 | 258 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
259 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
259 | + $this->_handle_core_version_change($espresso_db_update); |
|
260 | 260 | break; |
261 | 261 | case EE_System::req_type_normal: |
262 | 262 | default: |
263 | 263 | // $this->_maybe_redirect_to_ee_about(); |
264 | 264 | break; |
265 | 265 | } |
266 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
266 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * initializing the database later during the request |
272 | 272 | * @param array $espresso_db_update |
273 | 273 | */ |
274 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
275 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
274 | + protected function _handle_core_version_change($espresso_db_update) { |
|
275 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
276 | 276 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
277 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
277 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -289,44 +289,44 @@ discard block |
||
289 | 289 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
290 | 290 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
291 | 291 | */ |
292 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
293 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
294 | - if( ! $espresso_db_update){ |
|
295 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
292 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
293 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
294 | + if ( ! $espresso_db_update) { |
|
295 | + $espresso_db_update = get_option('espresso_db_update'); |
|
296 | 296 | } |
297 | 297 | // check that option is an array |
298 | - if( ! is_array( $espresso_db_update )) { |
|
298 | + if ( ! is_array($espresso_db_update)) { |
|
299 | 299 | // if option is FALSE, then it never existed |
300 | - if ( $espresso_db_update === FALSE ) { |
|
300 | + if ($espresso_db_update === FALSE) { |
|
301 | 301 | // make $espresso_db_update an array and save option with autoload OFF |
302 | - $espresso_db_update = array(); |
|
303 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
302 | + $espresso_db_update = array(); |
|
303 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
304 | 304 | } else { |
305 | 305 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
306 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
307 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
306 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
307 | + update_option('espresso_db_update', $espresso_db_update); |
|
308 | 308 | } |
309 | - }else{ |
|
309 | + } else { |
|
310 | 310 | $corrected_db_update = array(); |
311 | 311 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
312 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
313 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
312 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
313 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
314 | 314 | //the key is an int, and the value IS NOT an array |
315 | 315 | //so it must be numerically-indexed, where values are versions installed... |
316 | 316 | //fix it! |
317 | 317 | $version_string = $should_be_array; |
318 | 318 | $corrected_db_update[$version_string] = array('unknown-date'); |
319 | - }else{ |
|
319 | + } else { |
|
320 | 320 | //ok it checks out |
321 | 321 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $espresso_db_update = $corrected_db_update; |
325 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
325 | + update_option('espresso_db_update', $espresso_db_update); |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
329 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
329 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
330 | 330 | return $espresso_db_update; |
331 | 331 | } |
332 | 332 | |
@@ -346,34 +346,34 @@ discard block |
||
346 | 346 | * so we prefer to only do it when necessary |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
349 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
350 | 350 | $request_type = $this->detect_req_type(); |
351 | 351 | //only initialize system if we're not in maintenance mode. |
352 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
353 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
352 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
353 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
354 | 354 | |
355 | - if( $verify_schema ) { |
|
355 | + if ($verify_schema) { |
|
356 | 356 | EEH_Activation::initialize_db_and_folders(); |
357 | 357 | } |
358 | 358 | EEH_Activation::initialize_db_content(); |
359 | 359 | EEH_Activation::system_initialization(); |
360 | - if( $initialize_addons_too ) { |
|
360 | + if ($initialize_addons_too) { |
|
361 | 361 | $this->initialize_addons(); |
362 | 362 | } |
363 | - }else{ |
|
364 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
363 | + } else { |
|
364 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
365 | 365 | } |
366 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
367 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
366 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
367 | + add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Initializes the db for all registered addons |
373 | 373 | */ |
374 | - public function initialize_addons(){ |
|
374 | + public function initialize_addons() { |
|
375 | 375 | //foreach registered addon, make sure its db is up-to-date too |
376 | - foreach($this->registry->addons as $addon){ |
|
376 | + foreach ($this->registry->addons as $addon) { |
|
377 | 377 | $addon->initialize_db_if_no_migrations_required(); |
378 | 378 | } |
379 | 379 | } |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param string $current_version_to_add version to be added to the version history |
386 | 386 | * @return boolean success as to whether or not this option was changed |
387 | 387 | */ |
388 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
389 | - if( ! $version_history ) { |
|
388 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
389 | + if ( ! $version_history) { |
|
390 | 390 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
391 | 391 | } |
392 | - if( $current_version_to_add == NULL){ |
|
392 | + if ($current_version_to_add == NULL) { |
|
393 | 393 | $current_version_to_add = espresso_version(); |
394 | 394 | } |
395 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
395 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
396 | 396 | // re-save |
397 | - return update_option( 'espresso_db_update', $version_history ); |
|
397 | + return update_option('espresso_db_update', $version_history); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * but still know if this is a new install or not |
412 | 412 | * @return int one of the constants on EE_System::req_type_ |
413 | 413 | */ |
414 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
415 | - if ( $this->_req_type === NULL ){ |
|
416 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
414 | + public function detect_req_type($espresso_db_update = NULL) { |
|
415 | + if ($this->_req_type === NULL) { |
|
416 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
418 | 418 | } |
419 | 419 | return $this->_req_type; |
420 | 420 | } |
@@ -430,39 +430,39 @@ discard block |
||
430 | 430 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
431 | 431 | * @return int one of the constants on EE_System::req_type_* |
432 | 432 | */ |
433 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
434 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
435 | - if( $activation_history_for_addon ){ |
|
433 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
434 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
435 | + if ($activation_history_for_addon) { |
|
436 | 436 | //it exists, so this isn't a completely new install |
437 | 437 | //check if this version already in that list of previously installed versions |
438 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
438 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
439 | 439 | //it a version we haven't seen before |
440 | - if( $version_is_higher === 1 ){ |
|
440 | + if ($version_is_higher === 1) { |
|
441 | 441 | $req_type = EE_System::req_type_upgrade; |
442 | - }else{ |
|
442 | + } else { |
|
443 | 443 | $req_type = EE_System::req_type_downgrade; |
444 | 444 | } |
445 | - delete_option( $activation_indicator_option_name ); |
|
445 | + delete_option($activation_indicator_option_name); |
|
446 | 446 | } else { |
447 | 447 | // its not an update. maybe a reactivation? |
448 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
449 | - if ( $version_is_higher === -1 ){ |
|
448 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
449 | + if ($version_is_higher === -1) { |
|
450 | 450 | $req_type = EE_System::req_type_downgrade; |
451 | - }elseif( $version_is_higher === 0 ){ |
|
451 | + }elseif ($version_is_higher === 0) { |
|
452 | 452 | //we've seen this version before, but it's an activation. must be a reactivation |
453 | 453 | $req_type = EE_System::req_type_reactivation; |
454 | - }else{//$version_is_higher === 1 |
|
454 | + } else {//$version_is_higher === 1 |
|
455 | 455 | $req_type = EE_System::req_type_upgrade; |
456 | 456 | } |
457 | - delete_option( $activation_indicator_option_name ); |
|
457 | + delete_option($activation_indicator_option_name); |
|
458 | 458 | } else { |
459 | 459 | //we've seen this version before and the activation indicate doesn't show it was just activated |
460 | - if ( $version_is_higher === -1 ){ |
|
460 | + if ($version_is_higher === -1) { |
|
461 | 461 | $req_type = EE_System::req_type_downgrade; |
462 | - }elseif( $version_is_higher === 0 ){ |
|
462 | + }elseif ($version_is_higher === 0) { |
|
463 | 463 | //we've seen this version before and it's not an activation. its normal request |
464 | 464 | $req_type = EE_System::req_type_normal; |
465 | - }else{//$version_is_higher === 1 |
|
465 | + } else {//$version_is_higher === 1 |
|
466 | 466 | $req_type = EE_System::req_type_upgrade; |
467 | 467 | } |
468 | 468 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | } else { |
471 | 471 | //brand new install |
472 | 472 | $req_type = EE_System::req_type_new_activation; |
473 | - delete_option( $activation_indicator_option_name ); |
|
473 | + delete_option($activation_indicator_option_name); |
|
474 | 474 | } |
475 | 475 | return $req_type; |
476 | 476 | } |
@@ -488,30 +488,30 @@ discard block |
||
488 | 488 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
489 | 489 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
490 | 490 | */ |
491 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
491 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
492 | 492 | //find the most recently-activated version |
493 | 493 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
494 | 494 | $most_recently_active_version = '0.0.0.dev.000'; |
495 | - if( is_array( $activation_history_for_addon ) ){ |
|
496 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
495 | + if (is_array($activation_history_for_addon)) { |
|
496 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
497 | 497 | //check there is a record of when this version was activated. Otherwise, |
498 | 498 | //mark it as unknown |
499 | - if( ! $times_activated ){ |
|
500 | - $times_activated = array( 'unknown-date'); |
|
499 | + if ( ! $times_activated) { |
|
500 | + $times_activated = array('unknown-date'); |
|
501 | 501 | } |
502 | - if( is_string( $times_activated ) ){ |
|
503 | - $times_activated = array( $times_activated ); |
|
502 | + if (is_string($times_activated)) { |
|
503 | + $times_activated = array($times_activated); |
|
504 | 504 | } |
505 | - foreach( $times_activated as $an_activation ){ |
|
506 | - if( $an_activation != 'unknown-date' && |
|
507 | - $an_activation > $most_recently_active_version_activation ){ |
|
505 | + foreach ($times_activated as $an_activation) { |
|
506 | + if ($an_activation != 'unknown-date' && |
|
507 | + $an_activation > $most_recently_active_version_activation) { |
|
508 | 508 | $most_recently_active_version = $version; |
509 | 509 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
514 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | * @return void |
522 | 522 | */ |
523 | 523 | public function redirect_to_about_ee() { |
524 | - $notices = EE_Error::get_notices( FALSE ); |
|
524 | + $notices = EE_Error::get_notices(FALSE); |
|
525 | 525 | //if current user is an admin and it's not an ajax request |
526 | 526 | if ( |
527 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
528 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
529 | - && ! isset( $notices[ 'errors' ] ) |
|
527 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
528 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
529 | + && ! isset($notices['errors']) |
|
530 | 530 | ) { |
531 | - $query_params = array( 'page' => 'espresso_about' ); |
|
531 | + $query_params = array('page' => 'espresso_about'); |
|
532 | 532 | |
533 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
533 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
534 | 534 | $query_params['new_activation'] = TRUE; |
535 | 535 | } |
536 | 536 | |
537 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
537 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
538 | 538 | $query_params['reactivation'] = TRUE; |
539 | 539 | } |
540 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
541 | - wp_safe_redirect( $url ); |
|
540 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
541 | + wp_safe_redirect($url); |
|
542 | 542 | exit(); |
543 | 543 | } |
544 | 544 | } |
@@ -552,31 +552,31 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return void |
554 | 554 | */ |
555 | - public function load_core_configuration(){ |
|
556 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
557 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
555 | + public function load_core_configuration() { |
|
556 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
557 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
558 | 558 | //load textdomain |
559 | 559 | EE_Load_Textdomain::load_textdomain(); |
560 | 560 | // load and setup EE_Config and EE_Network_Config |
561 | - $this->registry->load_core( 'Config' ); |
|
562 | - $this->registry->load_core( 'Network_Config' ); |
|
561 | + $this->registry->load_core('Config'); |
|
562 | + $this->registry->load_core('Network_Config'); |
|
563 | 563 | // setup autoloaders |
564 | 564 | // enable logging? |
565 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
566 | - $this->registry->load_core( 'Log' ); |
|
565 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
566 | + $this->registry->load_core('Log'); |
|
567 | 567 | } |
568 | 568 | // check for activation errors |
569 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
570 | - if ( $activation_errors ) { |
|
571 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
572 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
569 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
570 | + if ($activation_errors) { |
|
571 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
572 | + update_option('ee_plugin_activation_errors', FALSE); |
|
573 | 573 | } |
574 | 574 | // get model names |
575 | 575 | $this->_parse_model_names(); |
576 | 576 | |
577 | 577 | //load caf stuff a chance to play during the activation process too. |
578 | 578 | $this->_maybe_brew_regular(); |
579 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
579 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -585,23 +585,23 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return void |
587 | 587 | */ |
588 | - private function _parse_model_names(){ |
|
588 | + private function _parse_model_names() { |
|
589 | 589 | //get all the files in the EE_MODELS folder that end in .model.php |
590 | - $models = glob( EE_MODELS.'*.model.php'); |
|
590 | + $models = glob(EE_MODELS.'*.model.php'); |
|
591 | 591 | $model_names = array(); |
592 | 592 | $non_abstract_db_models = array(); |
593 | - foreach( $models as $model ){ |
|
593 | + foreach ($models as $model) { |
|
594 | 594 | // get model classname |
595 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
596 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
595 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
596 | + $short_name = str_replace('EEM_', '', $classname); |
|
597 | 597 | $reflectionClass = new ReflectionClass($classname); |
598 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
599 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
598 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
599 | + $non_abstract_db_models[$short_name] = $classname; |
|
600 | 600 | } |
601 | - $model_names[ $short_name ] = $classname; |
|
601 | + $model_names[$short_name] = $classname; |
|
602 | 602 | } |
603 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
604 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
603 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
604 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -611,8 +611,8 @@ discard block |
||
611 | 611 | * @return void |
612 | 612 | */ |
613 | 613 | private function _maybe_brew_regular() { |
614 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
615 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
614 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
615 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
@@ -629,9 +629,9 @@ discard block |
||
629 | 629 | * @return void |
630 | 630 | */ |
631 | 631 | public function register_shortcodes_modules_and_widgets() { |
632 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
632 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
633 | 633 | // check for addons using old hookpoint |
634 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
634 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
635 | 635 | $this->_incompatible_addon_error(); |
636 | 636 | } |
637 | 637 | } |
@@ -645,19 +645,19 @@ discard block |
||
645 | 645 | */ |
646 | 646 | private function _incompatible_addon_error() { |
647 | 647 | // get array of classes hooking into here |
648 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
649 | - if ( ! empty( $class_names )) { |
|
650 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
648 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
649 | + if ( ! empty($class_names)) { |
|
650 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
651 | 651 | $msg .= '<ul>'; |
652 | - foreach ( $class_names as $class_name ) { |
|
653 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
652 | + foreach ($class_names as $class_name) { |
|
653 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
654 | 654 | } |
655 | 655 | $msg .= '</ul>'; |
656 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
656 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
657 | 657 | // save list of incompatible addons to wp-options for later use |
658 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
659 | - if ( is_admin() ) { |
|
660 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
658 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
659 | + if (is_admin()) { |
|
660 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
@@ -674,26 +674,26 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function brew_espresso(){ |
|
678 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
677 | + public function brew_espresso() { |
|
678 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
679 | 679 | // load some final core systems |
680 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
681 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
682 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
683 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
684 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
685 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
686 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
687 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
688 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
689 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
690 | - |
|
691 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
680 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
681 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
682 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
683 | + add_action('init', array($this, 'load_controllers'), 7); |
|
684 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
685 | + add_action('init', array($this, 'initialize'), 10); |
|
686 | + add_action('init', array($this, 'initialize_last'), 100); |
|
687 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
689 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
690 | + |
|
691 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
692 | 692 | // pew pew pew |
693 | - $this->registry->load_core( 'PUE' ); |
|
694 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
693 | + $this->registry->load_core('PUE'); |
|
694 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
695 | 695 | } |
696 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
696 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function set_hooks_for_core() { |
709 | 709 | $this->_deactivate_incompatible_addons(); |
710 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
710 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | * Using the information gathered in EE_System::_incompatible_addon_error, |
717 | 717 | * deactivates any addons considered incompatible with the current version of EE |
718 | 718 | */ |
719 | - private function _deactivate_incompatible_addons(){ |
|
720 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
721 | - if ( ! empty( $incompatible_addons )) { |
|
722 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
723 | - foreach ( $active_plugins as $active_plugin ) { |
|
724 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
725 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
726 | - unset( $_GET['activate'] ); |
|
727 | - espresso_deactivate_plugin( $active_plugin ); |
|
719 | + private function _deactivate_incompatible_addons() { |
|
720 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
721 | + if ( ! empty($incompatible_addons)) { |
|
722 | + $active_plugins = get_option('active_plugins', array()); |
|
723 | + foreach ($active_plugins as $active_plugin) { |
|
724 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
725 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
726 | + unset($_GET['activate']); |
|
727 | + espresso_deactivate_plugin($active_plugin); |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
@@ -741,10 +741,10 @@ discard block |
||
741 | 741 | */ |
742 | 742 | public function perform_activations_upgrades_and_migrations() { |
743 | 743 | //first check if we had previously attempted to setup EE's directories but failed |
744 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
744 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
745 | 745 | EEH_Activation::create_upload_directories(); |
746 | 746 | } |
747 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
747 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | public function load_CPTs_and_session() { |
759 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
759 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
760 | 760 | // register Custom Post Types |
761 | - $this->registry->load_core( 'Register_CPTs' ); |
|
762 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
761 | + $this->registry->load_core('Register_CPTs'); |
|
762 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -774,16 +774,16 @@ discard block |
||
774 | 774 | * @return void |
775 | 775 | */ |
776 | 776 | public function load_controllers() { |
777 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
777 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
778 | 778 | // let's get it started |
779 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
780 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
781 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
782 | - } else if ( ! EE_FRONT_AJAX ) { |
|
783 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
784 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
779 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
780 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
781 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
782 | + } else if ( ! EE_FRONT_AJAX) { |
|
783 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
784 | + EE_Registry::instance()->load_core('Admin'); |
|
785 | 785 | } |
786 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
786 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | |
@@ -797,9 +797,9 @@ discard block |
||
797 | 797 | * @return void |
798 | 798 | */ |
799 | 799 | public function core_loaded_and_ready() { |
800 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
801 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
802 | - $this->registry->load_core( 'Session' ); |
|
800 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
801 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
802 | + $this->registry->load_core('Session'); |
|
803 | 803 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
804 | 804 | } |
805 | 805 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | * @return void |
815 | 815 | */ |
816 | 816 | public function initialize() { |
817 | - do_action( 'AHEE__EE_System__initialize' ); |
|
817 | + do_action('AHEE__EE_System__initialize'); |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | * @return void |
829 | 829 | */ |
830 | 830 | public function initialize_last() { |
831 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
831 | + do_action('AHEE__EE_System__initialize_last'); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -860,21 +860,21 @@ discard block |
||
860 | 860 | */ |
861 | 861 | public static function do_not_cache() { |
862 | 862 | // set no cache constants |
863 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
864 | - define( 'DONOTCACHEPAGE', true ); |
|
863 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
864 | + define('DONOTCACHEPAGE', true); |
|
865 | 865 | } |
866 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
867 | - define( 'DONOTCACHCEOBJECT', true ); |
|
866 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
867 | + define('DONOTCACHCEOBJECT', true); |
|
868 | 868 | } |
869 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
870 | - define( 'DONOTCACHEDB', true ); |
|
869 | + if ( ! defined('DONOTCACHEDB')) { |
|
870 | + define('DONOTCACHEDB', true); |
|
871 | 871 | } |
872 | 872 | // add no cache headers |
873 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
873 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
874 | 874 | // plus a little extra for nginx and Google Chrome |
875 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
875 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
876 | 876 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
877 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
877 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param $headers |
887 | 887 | * @return array |
888 | 888 | */ |
889 | - public static function extra_nocache_headers ( $headers ) { |
|
889 | + public static function extra_nocache_headers($headers) { |
|
890 | 890 | // for NGINX |
891 | 891 | $headers['X-Accel-Expires'] = 0; |
892 | 892 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -915,14 +915,14 @@ discard block |
||
915 | 915 | * @param WP_Admin_Bar $admin_bar |
916 | 916 | * @return void |
917 | 917 | */ |
918 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
918 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
919 | 919 | |
920 | 920 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
921 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
921 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | |
925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
926 | 926 | $menu_class = 'espresso_menu_item_class'; |
927 | 927 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
928 | 928 | //because they're only defined in each of their respective constructors |
@@ -934,20 +934,20 @@ discard block |
||
934 | 934 | //Top Level |
935 | 935 | $admin_bar->add_menu(array( |
936 | 936 | 'id' => 'espresso-toolbar', |
937 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
937 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
938 | 938 | 'href' => $events_admin_url, |
939 | 939 | 'meta' => array( |
940 | 940 | 'title' => __('Event Espresso', 'event_espresso'), |
941 | - 'class' => $menu_class . 'first' |
|
941 | + 'class' => $menu_class.'first' |
|
942 | 942 | ), |
943 | 943 | )); |
944 | 944 | |
945 | 945 | //Events |
946 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
946 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
947 | 947 | $admin_bar->add_menu(array( |
948 | 948 | 'id' => 'espresso-toolbar-events', |
949 | 949 | 'parent' => 'espresso-toolbar', |
950 | - 'title' => __( 'Events', 'event_espresso' ), |
|
950 | + 'title' => __('Events', 'event_espresso'), |
|
951 | 951 | 'href' => $events_admin_url, |
952 | 952 | 'meta' => array( |
953 | 953 | 'title' => __('Events', 'event_espresso'), |
@@ -958,13 +958,13 @@ discard block |
||
958 | 958 | } |
959 | 959 | |
960 | 960 | |
961 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
961 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
962 | 962 | //Events Add New |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-new', |
965 | 965 | 'parent' => 'espresso-toolbar-events', |
966 | 966 | 'title' => __('Add New', 'event_espresso'), |
967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
968 | 968 | 'meta' => array( |
969 | 969 | 'title' => __('Add New', 'event_espresso'), |
970 | 970 | 'target' => '', |
@@ -973,18 +973,18 @@ discard block |
||
973 | 973 | )); |
974 | 974 | } |
975 | 975 | |
976 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
976 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
977 | 977 | |
978 | 978 | //Current post |
979 | 979 | global $post; |
980 | 980 | |
981 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
981 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
982 | 982 | //Events Edit Current Event |
983 | 983 | $admin_bar->add_menu(array( |
984 | 984 | 'id' => 'espresso-toolbar-events-edit', |
985 | 985 | 'parent' => 'espresso-toolbar-events', |
986 | 986 | 'title' => __('Edit Event', 'event_espresso'), |
987 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
987 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
988 | 988 | 'meta' => array( |
989 | 989 | 'title' => __('Edit Event', 'event_espresso'), |
990 | 990 | 'target' => '', |
@@ -996,11 +996,11 @@ discard block |
||
996 | 996 | } |
997 | 997 | |
998 | 998 | //Events View |
999 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
999 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1000 | 1000 | $admin_bar->add_menu(array( |
1001 | 1001 | 'id' => 'espresso-toolbar-events-view', |
1002 | 1002 | 'parent' => 'espresso-toolbar-events', |
1003 | - 'title' => __( 'View', 'event_espresso' ), |
|
1003 | + 'title' => __('View', 'event_espresso'), |
|
1004 | 1004 | 'href' => $events_admin_url, |
1005 | 1005 | 'meta' => array( |
1006 | 1006 | 'title' => __('View', 'event_espresso'), |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | )); |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1013 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1014 | 1014 | //Events View All |
1015 | 1015 | $admin_bar->add_menu(array( |
1016 | 1016 | 'id' => 'espresso-toolbar-events-all', |
1017 | 1017 | 'parent' => 'espresso-toolbar-events-view', |
1018 | - 'title' => __( 'All', 'event_espresso' ), |
|
1018 | + 'title' => __('All', 'event_espresso'), |
|
1019 | 1019 | 'href' => $events_admin_url, |
1020 | 1020 | 'meta' => array( |
1021 | 1021 | 'title' => __('All', 'event_espresso'), |
@@ -1026,13 +1026,13 @@ discard block |
||
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | |
1029 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1029 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1030 | 1030 | //Events View Today |
1031 | 1031 | $admin_bar->add_menu(array( |
1032 | 1032 | 'id' => 'espresso-toolbar-events-today', |
1033 | 1033 | 'parent' => 'espresso-toolbar-events-view', |
1034 | 1034 | 'title' => __('Today', 'event_espresso'), |
1035 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1035 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1036 | 1036 | 'meta' => array( |
1037 | 1037 | 'title' => __('Today', 'event_espresso'), |
1038 | 1038 | 'target' => '', |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
1045 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1045 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1046 | 1046 | //Events View This Month |
1047 | 1047 | $admin_bar->add_menu(array( |
1048 | 1048 | 'id' => 'espresso-toolbar-events-month', |
1049 | 1049 | 'parent' => 'espresso-toolbar-events-view', |
1050 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1051 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1050 | + 'title' => __('This Month', 'event_espresso'), |
|
1051 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1052 | 1052 | 'meta' => array( |
1053 | 1053 | 'title' => __('This Month', 'event_espresso'), |
1054 | 1054 | 'target' => '', |
@@ -1058,11 +1058,11 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | //Registration Overview |
1061 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1061 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1062 | 1062 | $admin_bar->add_menu(array( |
1063 | 1063 | 'id' => 'espresso-toolbar-registrations', |
1064 | 1064 | 'parent' => 'espresso-toolbar', |
1065 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1065 | + 'title' => __('Registrations', 'event_espresso'), |
|
1066 | 1066 | 'href' => $reg_admin_url, |
1067 | 1067 | 'meta' => array( |
1068 | 1068 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1073,12 +1073,12 @@ discard block |
||
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | //Registration Overview Today |
1076 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1076 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1077 | 1077 | $admin_bar->add_menu(array( |
1078 | 1078 | 'id' => 'espresso-toolbar-registrations-today', |
1079 | 1079 | 'parent' => 'espresso-toolbar-registrations', |
1080 | - 'title' => __( 'Today', 'event_espresso'), |
|
1081 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1080 | + 'title' => __('Today', 'event_espresso'), |
|
1081 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1082 | 1082 | 'meta' => array( |
1083 | 1083 | 'title' => __('Today', 'event_espresso'), |
1084 | 1084 | 'target' => '', |
@@ -1088,14 +1088,14 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | //Registration Overview Today Completed |
1091 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1091 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1092 | 1092 | $admin_bar->add_menu(array( |
1093 | 1093 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1094 | 1094 | 'parent' => 'espresso-toolbar-registrations-today', |
1095 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1096 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1095 | + 'title' => __('Approved', 'event_espresso'), |
|
1096 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1097 | 1097 | 'meta' => array( |
1098 | - 'title' => __('Approved', 'event_espresso' ), |
|
1098 | + 'title' => __('Approved', 'event_espresso'), |
|
1099 | 1099 | 'target' => '', |
1100 | 1100 | 'class' => $menu_class |
1101 | 1101 | ), |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | //Registration Overview Today Pending\ |
1106 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1106 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1107 | 1107 | $admin_bar->add_menu(array( |
1108 | 1108 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1109 | 1109 | 'parent' => 'espresso-toolbar-registrations-today', |
1110 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1111 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1110 | + 'title' => __('Pending', 'event_espresso'), |
|
1111 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1112 | 1112 | 'meta' => array( |
1113 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1113 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1114 | 1114 | 'target' => '', |
1115 | 1115 | 'class' => $menu_class |
1116 | 1116 | ), |
@@ -1118,14 +1118,14 @@ discard block |
||
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | //Registration Overview Today Incomplete |
1121 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1121 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1122 | 1122 | $admin_bar->add_menu(array( |
1123 | 1123 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1124 | 1124 | 'parent' => 'espresso-toolbar-registrations-today', |
1125 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1126 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1125 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1126 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1127 | 1127 | 'meta' => array( |
1128 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1128 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1129 | 1129 | 'target' => '', |
1130 | 1130 | 'class' => $menu_class |
1131 | 1131 | ), |
@@ -1133,12 +1133,12 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | //Registration Overview Today Incomplete |
1136 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1136 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1137 | 1137 | $admin_bar->add_menu(array( |
1138 | 1138 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1139 | 1139 | 'parent' => 'espresso-toolbar-registrations-today', |
1140 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1141 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1140 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1141 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1142 | 1142 | 'meta' => array( |
1143 | 1143 | 'title' => __('Cancelled', 'event_espresso'), |
1144 | 1144 | 'target' => '', |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | //Registration Overview This Month |
1151 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1151 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1152 | 1152 | $admin_bar->add_menu(array( |
1153 | 1153 | 'id' => 'espresso-toolbar-registrations-month', |
1154 | 1154 | 'parent' => 'espresso-toolbar-registrations', |
1155 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1156 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1155 | + 'title' => __('This Month', 'event_espresso'), |
|
1156 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1157 | 1157 | 'meta' => array( |
1158 | 1158 | 'title' => __('This Month', 'event_espresso'), |
1159 | 1159 | 'target' => '', |
@@ -1163,12 +1163,12 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | //Registration Overview This Month Approved |
1166 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1166 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1167 | 1167 | $admin_bar->add_menu(array( |
1168 | 1168 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1169 | 1169 | 'parent' => 'espresso-toolbar-registrations-month', |
1170 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1171 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1170 | + 'title' => __('Approved', 'event_espresso'), |
|
1171 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1172 | 1172 | 'meta' => array( |
1173 | 1173 | 'title' => __('Approved', 'event_espresso'), |
1174 | 1174 | 'target' => '', |
@@ -1178,12 +1178,12 @@ discard block |
||
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | //Registration Overview This Month Pending |
1181 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1181 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1182 | 1182 | $admin_bar->add_menu(array( |
1183 | 1183 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1184 | 1184 | 'parent' => 'espresso-toolbar-registrations-month', |
1185 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1186 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1185 | + 'title' => __('Pending', 'event_espresso'), |
|
1186 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1187 | 1187 | 'meta' => array( |
1188 | 1188 | 'title' => __('Pending', 'event_espresso'), |
1189 | 1189 | 'target' => '', |
@@ -1193,14 +1193,14 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | //Registration Overview This Month Not Approved |
1196 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1196 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1197 | 1197 | $admin_bar->add_menu(array( |
1198 | 1198 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1199 | 1199 | 'parent' => 'espresso-toolbar-registrations-month', |
1200 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1201 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1200 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1201 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1202 | 1202 | 'meta' => array( |
1203 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1203 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1204 | 1204 | 'target' => '', |
1205 | 1205 | 'class' => $menu_class |
1206 | 1206 | ), |
@@ -1209,12 +1209,12 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | //Registration Overview This Month Cancelled |
1212 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1212 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1213 | 1213 | $admin_bar->add_menu(array( |
1214 | 1214 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1215 | 1215 | 'parent' => 'espresso-toolbar-registrations-month', |
1216 | 1216 | 'title' => __('Cancelled', 'event_espresso'), |
1217 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1217 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1218 | 1218 | 'meta' => array( |
1219 | 1219 | 'title' => __('Cancelled', 'event_espresso'), |
1220 | 1220 | 'target' => '', |
@@ -1224,11 +1224,11 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | //Extensions & Services |
1227 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1227 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1228 | 1228 | $admin_bar->add_menu(array( |
1229 | 1229 | 'id' => 'espresso-toolbar-extensions-and-services', |
1230 | 1230 | 'parent' => 'espresso-toolbar', |
1231 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1231 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1232 | 1232 | 'href' => $extensions_admin_url, |
1233 | 1233 | 'meta' => array( |
1234 | 1234 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | * @param array $exclude_array any existing pages being excluded are in this array. |
1251 | 1251 | * @return array |
1252 | 1252 | */ |
1253 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1254 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1253 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1254 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
@@ -1271,15 +1271,15 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | public function wp_enqueue_scripts() { |
1273 | 1273 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1274 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1274 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1275 | 1275 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1276 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1276 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1277 | 1277 | // register jQuery Validate and additional methods |
1278 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
1279 | - wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE ); |
|
1278 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1279 | + wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE); |
|
1280 | 1280 | } |
1281 | - wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true ); |
|
1282 | - wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
1281 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
1282 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 |
@@ -1229,11 +1229,11 @@ |
||
1229 | 1229 | protected function _category_list_table() { |
1230 | 1230 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1231 | 1231 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
1232 | - 'add_category', |
|
1233 | - 'add_category', |
|
1234 | - array(), |
|
1235 | - 'add-new-h2' |
|
1236 | - ); |
|
1232 | + 'add_category', |
|
1233 | + 'add_category', |
|
1234 | + array(), |
|
1235 | + 'add-new-h2' |
|
1236 | + ); |
|
1237 | 1237 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1238 | 1238 | $this->display_admin_list_table_page_with_sidebar(); |
1239 | 1239 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
68 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | //load field generator helper |
124 | 124 | |
125 | 125 | //is there a vnu_id in the request? |
126 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
126 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
128 | 128 | |
129 | 129 | $this->_page_routes = array( |
130 | 130 | 'default' => array( |
@@ -142,27 +142,27 @@ discard block |
||
142 | 142 | ), |
143 | 143 | 'trash_venue' => array( |
144 | 144 | 'func' => '_trash_or_restore_venue', |
145 | - 'args' => array( 'venue_status' => 'trash' ), |
|
145 | + 'args' => array('venue_status' => 'trash'), |
|
146 | 146 | 'noheader' => TRUE, |
147 | 147 | 'capability' => 'ee_delete_venue', |
148 | 148 | 'obj_id' => $vnu_id |
149 | 149 | ), |
150 | 150 | 'trash_venues' => array( |
151 | 151 | 'func' => '_trash_or_restore_venues', |
152 | - 'args' => array( 'venue_status' => 'trash' ), |
|
152 | + 'args' => array('venue_status' => 'trash'), |
|
153 | 153 | 'noheader' => TRUE, |
154 | 154 | 'capability' => 'ee_delete_venues' |
155 | 155 | ), |
156 | 156 | 'restore_venue' => array( |
157 | 157 | 'func' => '_trash_or_restore_venue', |
158 | - 'args' => array( 'venue_status' => 'draft' ), |
|
158 | + 'args' => array('venue_status' => 'draft'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_delete_venue', |
161 | 161 | 'obj_id' => $vnu_id |
162 | 162 | ), |
163 | 163 | 'restore_venues' => array( |
164 | 164 | 'func' => '_trash_or_restore_venues', |
165 | - 'args' => array( 'venue_status' => 'draft' ), |
|
165 | + 'args' => array('venue_status' => 'draft'), |
|
166 | 166 | 'noheader' => TRUE, |
167 | 167 | 'capability' => 'ee_delete_venues' |
168 | 168 | ), |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'filename' => 'venues_overview_views_bulk_actions_search' |
265 | 265 | ) |
266 | 266 | ), |
267 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
267 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
268 | 268 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
269 | 269 | 'require_nonce' => FALSE |
270 | 270 | ), |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'filename' => 'venues_editor_other' |
301 | 301 | ) |
302 | 302 | ), |
303 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
303 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
304 | 304 | 'metaboxes' => array('_venue_editor_metaboxes'), |
305 | 305 | 'require_nonce' => FALSE |
306 | 306 | ), |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'label' => __('Edit Venue', 'event_espresso'), |
310 | 310 | 'order' => 5, |
311 | 311 | 'persistent' => FALSE, |
312 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
312 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
313 | 313 | ), |
314 | 314 | 'help_tabs' => array( |
315 | 315 | 'venues_editor_help_tab' => array( |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | ), |
344 | 344 | 'google_map_settings' => array( |
345 | 345 | 'nav' => array( |
346 | - 'label' => esc_html__('Google Maps', 'event_espresso' ), |
|
346 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
347 | 347 | 'order' => 40 |
348 | 348 | ), |
349 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
349 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
350 | 350 | 'help_tabs' => array( |
351 | 351 | 'general_settings_google_maps_help_tab' => array( |
352 | 352 | 'title' => __('Google Maps', 'event_espresso'), |
353 | 353 | 'filename' => 'general_settings_google_maps' |
354 | 354 | ) |
355 | 355 | ), |
356 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
356 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
357 | 357 | 'require_nonce' => FALSE |
358 | 358 | ), |
359 | 359 | //venue category stuff |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | 'filename' => 'venues_add_category' |
370 | 370 | ) |
371 | 371 | ), |
372 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
372 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
373 | 373 | 'require_nonce' => FALSE |
374 | 374 | ), |
375 | 375 | 'edit_category' => array( |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'label' => __('Edit Category', 'event_espresso'), |
378 | 378 | 'order' => 15, |
379 | 379 | 'persistent' => FALSE, |
380 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
380 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
381 | 381 | ), |
382 | 382 | 'metaboxes' => array('_publish_post_box'), |
383 | 383 | 'help_tabs' => array( |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | 'filename' => 'venues_categories_other' |
414 | 414 | ) |
415 | 415 | ), |
416 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
416 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
417 | 417 | 'metaboxes' => $this->_default_espresso_metaboxes, |
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ) |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | |
472 | 472 | public function load_scripts_styles() { |
473 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
473 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
474 | 474 | wp_enqueue_style('ee-cat-admin'); |
475 | 475 | } |
476 | 476 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | public function load_scripts_styles_edit() { |
494 | 494 | //styles |
495 | 495 | wp_enqueue_style('espresso-ui-theme'); |
496 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
496 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
497 | 497 | wp_enqueue_style('espresso_venues'); |
498 | 498 | } |
499 | 499 | |
@@ -512,13 +512,13 @@ discard block |
||
512 | 512 | ) |
513 | 513 | ); |
514 | 514 | |
515 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
515 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
516 | 516 | $this->_views['all']['bulk_action'] = array( |
517 | 517 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
518 | 518 | ); |
519 | 519 | $this->_views['trash'] = array( |
520 | 520 | 'slug' => 'trash', |
521 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
521 | + 'label' => __('Trash', 'event_espresso'), |
|
522 | 522 | 'count' => 0, |
523 | 523 | 'bulk_action' => array( |
524 | 524 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | |
552 | 552 | |
553 | 553 | protected function _overview_list_table() { |
554 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
555 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' ); |
|
556 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
554 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
555 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button'); |
|
556 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
557 | 557 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
558 | 558 | $this->display_admin_list_table_page_with_sidebar(); |
559 | 559 | } |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
567 | 567 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
568 | 568 | ); |
569 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
570 | - EEH_Template::display_template( $template, $extra_rows ); |
|
569 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
570 | + EEH_Template::display_template($template, $extra_rows); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -583,31 +583,31 @@ discard block |
||
583 | 583 | $default_map_settings->use_google_maps = TRUE; |
584 | 584 | $default_map_settings->google_map_api_key = ''; |
585 | 585 | // for event details pages (reg page) |
586 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
586 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
593 | 593 | // for event list pages |
594 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
594 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
601 | 601 | |
602 | 602 | $this->_template_args['map_settings'] = |
603 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
604 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
603 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
604 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
605 | 605 | : $default_map_settings; |
606 | 606 | |
607 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
608 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
607 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
608 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
609 | 609 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
610 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
610 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
611 | 611 | $this->_template_args, |
612 | 612 | true |
613 | 613 | ); |
@@ -617,83 +617,83 @@ discard block |
||
617 | 617 | protected function _update_google_map_settings() { |
618 | 618 | |
619 | 619 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
620 | - isset( $this->_req_data['use_google_maps'] ) |
|
621 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
620 | + isset($this->_req_data['use_google_maps']) |
|
621 | + ? absint($this->_req_data['use_google_maps']) |
|
622 | 622 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
623 | 623 | |
624 | 624 | EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
625 | - isset( $this->_req_data['google_map_api_key'] ) |
|
626 | - ? sanitize_text_field( $this->_req_data['google_map_api_key'] ) |
|
625 | + isset($this->_req_data['google_map_api_key']) |
|
626 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
627 | 627 | : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
628 | 628 | |
629 | 629 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
630 | - isset( $this->_req_data['event_details_map_width'] ) |
|
631 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
630 | + isset($this->_req_data['event_details_map_width']) |
|
631 | + ? absint($this->_req_data['event_details_map_width']) |
|
632 | 632 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
633 | 633 | |
634 | 634 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
635 | - isset( $this->_req_data['event_details_map_height'] ) |
|
636 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
635 | + isset($this->_req_data['event_details_map_height']) |
|
636 | + ? absint($this->_req_data['event_details_map_height']) |
|
637 | 637 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
638 | 638 | |
639 | 639 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
640 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
641 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
640 | + isset($this->_req_data['event_details_map_zoom']) |
|
641 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
642 | 642 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
643 | 643 | |
644 | 644 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
645 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
646 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
645 | + isset($this->_req_data['event_details_display_nav']) |
|
646 | + ? absint($this->_req_data['event_details_display_nav']) |
|
647 | 647 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
648 | 648 | |
649 | 649 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
650 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
651 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
650 | + isset($this->_req_data['event_details_nav_size']) |
|
651 | + ? absint($this->_req_data['event_details_nav_size']) |
|
652 | 652 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
653 | 653 | |
654 | 654 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
655 | - isset( $this->_req_data['event_details_control_type'] ) |
|
656 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
655 | + isset($this->_req_data['event_details_control_type']) |
|
656 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
657 | 657 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
658 | 658 | |
659 | 659 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
660 | - isset( $this->_req_data['event_details_map_align'] ) |
|
661 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
660 | + isset($this->_req_data['event_details_map_align']) |
|
661 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
662 | 662 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
663 | 663 | |
664 | 664 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
665 | - isset( $this->_req_data['event_list_map_width'] ) |
|
666 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
665 | + isset($this->_req_data['event_list_map_width']) |
|
666 | + ? absint($this->_req_data['event_list_map_width']) |
|
667 | 667 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
668 | 668 | |
669 | 669 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
670 | - isset( $this->_req_data['event_list_map_height'] ) |
|
671 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
670 | + isset($this->_req_data['event_list_map_height']) |
|
671 | + ? absint($this->_req_data['event_list_map_height']) |
|
672 | 672 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
673 | 673 | |
674 | 674 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
675 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
676 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
675 | + isset($this->_req_data['event_list_map_zoom']) |
|
676 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
677 | 677 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
678 | 678 | |
679 | 679 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
680 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
681 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
680 | + isset($this->_req_data['event_list_display_nav']) |
|
681 | + ? absint($this->_req_data['event_list_display_nav']) |
|
682 | 682 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
683 | 683 | |
684 | 684 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
685 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
686 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
685 | + isset($this->_req_data['event_list_nav_size']) |
|
686 | + ? absint($this->_req_data['event_list_nav_size']) |
|
687 | 687 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
688 | 688 | |
689 | 689 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
690 | - isset( $this->_req_data['event_list_control_type'] ) |
|
691 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
690 | + isset($this->_req_data['event_list_control_type']) |
|
691 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
692 | 692 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
693 | 693 | |
694 | 694 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
695 | - isset( $this->_req_data['event_list_map_align'] ) |
|
696 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
695 | + isset($this->_req_data['event_list_map_align']) |
|
696 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
697 | 697 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
698 | 698 | |
699 | 699 | EE_Registry::instance()->CFG->map_settings = apply_filters( |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | EE_Registry::instance()->CFG->map_settings, |
708 | 708 | __FILE__, __FUNCTION__, __LINE__ |
709 | 709 | ); |
710 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
710 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
711 | 711 | |
712 | 712 | } |
713 | 713 | |
@@ -716,9 +716,9 @@ discard block |
||
716 | 716 | protected function _venue_editor_metaboxes() { |
717 | 717 | $this->verify_cpt_object(); |
718 | 718 | |
719 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
720 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
721 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
719 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
720 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
721 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
722 | 722 | |
723 | 723 | } |
724 | 724 | |
@@ -726,23 +726,23 @@ discard block |
||
726 | 726 | |
727 | 727 | public function venue_gmap_metabox() { |
728 | 728 | $template_args = array( |
729 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
729 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
730 | 730 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
731 | 731 | ); |
732 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
733 | - EEH_Template::display_template( $template, $template_args ); |
|
732 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
733 | + EEH_Template::display_template($template, $template_args); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
737 | 737 | |
738 | 738 | public function venue_address_metabox() { |
739 | 739 | |
740 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
740 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
741 | 741 | |
742 | 742 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
743 | 743 | $QFI = new EE_Question_Form_Input( |
744 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
745 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
744 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
745 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
746 | 746 | array( |
747 | 747 | 'input_name' => 'sta_id', |
748 | 748 | 'input_id' => 'sta_id', |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | ); |
755 | 755 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
756 | 756 | $QFI = new EE_Question_Form_Input( |
757 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
758 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
757 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
758 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
759 | 759 | array( |
760 | 760 | 'input_name' => 'cnt_iso', |
761 | 761 | 'input_id' => 'cnt_iso', |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | ) |
767 | 767 | ); |
768 | 768 | |
769 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
770 | - EEH_Template::display_template( $template, $template_args ); |
|
769 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
770 | + EEH_Template::display_template($template, $template_args); |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | $template_args = array( |
780 | 780 | '_venue' => $this->_cpt_model_obj |
781 | 781 | ); |
782 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
783 | - EEH_Template::display_template( $template, $template_args ); |
|
782 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
783 | + EEH_Template::display_template($template, $template_args); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | |
@@ -803,52 +803,52 @@ discard block |
||
803 | 803 | * @param object $post Post object (with "blessed" WP properties) |
804 | 804 | * @return void |
805 | 805 | */ |
806 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
806 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
807 | 807 | |
808 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) { |
|
809 | - return;// get out we're not processing the saving of venues. |
|
808 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
809 | + return; // get out we're not processing the saving of venues. |
|
810 | 810 | } |
811 | 811 | |
812 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
812 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
813 | 813 | |
814 | 814 | $venue_values = array( |
815 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
816 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
817 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
818 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
819 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
820 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
821 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
822 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF, |
|
823 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
824 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
825 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
826 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
827 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
815 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
816 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
817 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
818 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
819 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
820 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
821 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
822 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF, |
|
823 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
824 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
825 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
826 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
827 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
828 | 828 | ); |
829 | 829 | |
830 | 830 | //update venue |
831 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
831 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
832 | 832 | |
833 | 833 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
834 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
835 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
834 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
835 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
836 | 836 | |
837 | 837 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
838 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
838 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
839 | 839 | |
840 | 840 | $att_success = TRUE; |
841 | 841 | |
842 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
843 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
844 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
842 | + foreach ($venue_update_callbacks as $v_callback) { |
|
843 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
844 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | //any errors? |
848 | - if ( $success && !$att_success ) { |
|
849 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
850 | - } else if ( $success === FALSE ) { |
|
851 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ($success && ! $att_success) { |
|
849 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | + } else if ($success === FALSE) { |
|
851 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
@@ -856,9 +856,9 @@ discard block |
||
856 | 856 | |
857 | 857 | |
858 | 858 | |
859 | - public function trash_cpt_item( $post_id ) { |
|
859 | + public function trash_cpt_item($post_id) { |
|
860 | 860 | $this->_req_data['VNU_ID'] = $post_id; |
861 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
861 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
862 | 862 | } |
863 | 863 | |
864 | 864 | |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | |
867 | 867 | |
868 | 868 | |
869 | - public function restore_cpt_item( $post_id ) { |
|
869 | + public function restore_cpt_item($post_id) { |
|
870 | 870 | $this->_req_data['VNU_ID'] = $post_id; |
871 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
871 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
875 | 875 | |
876 | 876 | |
877 | 877 | |
878 | - public function delete_cpt_item( $post_id ) { |
|
878 | + public function delete_cpt_item($post_id) { |
|
879 | 879 | $this->_req_data['VNU_ID'] = $post_id; |
880 | - $this->_delete_venue( FALSE ); |
|
880 | + $this->_delete_venue(FALSE); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | |
@@ -892,15 +892,15 @@ discard block |
||
892 | 892 | |
893 | 893 | |
894 | 894 | |
895 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
896 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
895 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
896 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
897 | 897 | |
898 | 898 | //loop thru venues |
899 | - if ( $VNU_ID ) { |
|
899 | + if ($VNU_ID) { |
|
900 | 900 | //clean status |
901 | - $venue_status = sanitize_key( $venue_status ); |
|
901 | + $venue_status = sanitize_key($venue_status); |
|
902 | 902 | // grab status |
903 | - if (!empty($venue_status)) { |
|
903 | + if ( ! empty($venue_status)) { |
|
904 | 904 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
905 | 905 | } else { |
906 | 906 | $success = FALSE; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
916 | 916 | |
917 | - if ( $redirect_after ) |
|
917 | + if ($redirect_after) |
|
918 | 918 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
919 | 919 | |
920 | 920 | } |
@@ -923,11 +923,11 @@ discard block |
||
923 | 923 | |
924 | 924 | |
925 | 925 | |
926 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
926 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
927 | 927 | // clean status |
928 | 928 | $venue_status = sanitize_key($venue_status); |
929 | 929 | // grab status |
930 | - if (!empty($venue_status)) { |
|
930 | + if ( ! empty($venue_status)) { |
|
931 | 931 | $success = TRUE; |
932 | 932 | //determine the event id and set to array. |
933 | 933 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -967,20 +967,20 @@ discard block |
||
967 | 967 | * @param string $venue_status |
968 | 968 | * @return void |
969 | 969 | */ |
970 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
970 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
971 | 971 | // grab venue id |
972 | - if (! $VNU_ID) { |
|
972 | + if ( ! $VNU_ID) { |
|
973 | 973 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
974 | 974 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
975 | 975 | return FALSE; |
976 | 976 | } |
977 | 977 | |
978 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
978 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
979 | 979 | |
980 | 980 | // clean status |
981 | 981 | $venue_status = sanitize_key($venue_status); |
982 | 982 | // grab status |
983 | - if ( ! $venue_status ) { |
|
983 | + if ( ! $venue_status) { |
|
984 | 984 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
985 | 985 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
986 | 986 | return FALSE; |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | $hook = FALSE; |
1002 | 1002 | } |
1003 | 1003 | //use class to change status |
1004 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
1004 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1005 | 1005 | $success = $this->_cpt_model_obj->save(); |
1006 | 1006 | |
1007 | 1007 | if ($success === FALSE) { |
@@ -1020,21 +1020,21 @@ discard block |
||
1020 | 1020 | * @param bool $redirect_after |
1021 | 1021 | * @return void |
1022 | 1022 | */ |
1023 | - protected function _delete_venue( $redirect_after = true ) { |
|
1023 | + protected function _delete_venue($redirect_after = true) { |
|
1024 | 1024 | //determine the venue id and set to array. |
1025 | 1025 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1026 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1026 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1027 | 1027 | |
1028 | 1028 | |
1029 | 1029 | // loop thru venues |
1030 | 1030 | if ($VNU_ID) { |
1031 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1031 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1032 | 1032 | } else { |
1033 | 1033 | $success = FALSE; |
1034 | 1034 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1035 | 1035 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1036 | 1036 | } |
1037 | - if ( $redirect_after ) |
|
1037 | + if ($redirect_after) |
|
1038 | 1038 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | //todo: put in parent |
1067 | 1067 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1068 | 1068 | // grab event id |
1069 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1069 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1070 | 1070 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1071 | 1071 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1072 | 1072 | return FALSE; |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1087 | 1087 | return FALSE; |
1088 | 1088 | } |
1089 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1089 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1090 | 1090 | return TRUE; |
1091 | 1091 | } |
1092 | 1092 | |
@@ -1097,11 +1097,11 @@ discard block |
||
1097 | 1097 | /* QUERIES */ |
1098 | 1098 | |
1099 | 1099 | |
1100 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1100 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1101 | 1101 | |
1102 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1102 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1103 | 1103 | |
1104 | - switch ( $_orderby ) { |
|
1104 | + switch ($_orderby) { |
|
1105 | 1105 | case 'id': |
1106 | 1106 | $orderby = 'VNU_ID'; |
1107 | 1107 | break; |
@@ -1119,43 +1119,43 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
1122 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1122 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1123 | 1123 | |
1124 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1125 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1126 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1124 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1125 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1126 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | - $offset = ($current_page-1)*$per_page; |
|
1129 | + $offset = ($current_page - 1) * $per_page; |
|
1130 | 1130 | $limit = array($offset, $per_page); |
1131 | 1131 | |
1132 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1132 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1133 | 1133 | $where = array(); |
1134 | 1134 | |
1135 | 1135 | //only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
1136 | - if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) { |
|
1136 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1137 | 1137 | $where['status'] = $this->_req_data['status']; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( isset( $this->_req_data['venue_status'] ) ) { |
|
1140 | + if (isset($this->_req_data['venue_status'])) { |
|
1141 | 1141 | $where['status'] = $this->_req_data['venue_status']; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
1145 | - if ( $category ) { |
|
1145 | + if ($category) { |
|
1146 | 1146 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1147 | 1147 | $where['Term_Taxonomy.term_id'] = $category; |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | |
1151 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1152 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1151 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1152 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1153 | 1153 | } else { |
1154 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
1154 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1155 | 1155 | $where['OR'] = array( |
1156 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1156 | + 'status*restrict_private' => array('!=', 'private'), |
|
1157 | 1157 | 'AND' => array( |
1158 | - 'status*inclusive' => array( '=', 'private' ), |
|
1158 | + 'status*inclusive' => array('=', 'private'), |
|
1159 | 1159 | 'VNU_wp_user' => get_current_user_id() |
1160 | 1160 | ) |
1161 | 1161 | ); |
@@ -1165,30 +1165,30 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | |
1167 | 1167 | |
1168 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1169 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1168 | + if (isset($this->_req_data['s'])) { |
|
1169 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1170 | 1170 | $where['OR'] = array( |
1171 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1172 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1173 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1174 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1175 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1176 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1177 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1178 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1179 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1180 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1181 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1182 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1183 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1184 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1185 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1186 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1171 | + 'VNU_name' => array('LIKE', $sstr), |
|
1172 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1173 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1174 | + 'VNU_address' => array('LIKE', $sstr), |
|
1175 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1176 | + 'VNU_city' => array('LIKE', $sstr), |
|
1177 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1178 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1179 | + 'VNU_url' => array('LIKE', $sstr), |
|
1180 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1181 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1182 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1183 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1184 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1185 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1186 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1187 | 1187 | ); |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | |
1191 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1191 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1192 | 1192 | |
1193 | 1193 | return $venues; |
1194 | 1194 | |
@@ -1206,22 +1206,22 @@ discard block |
||
1206 | 1206 | * @return void |
1207 | 1207 | */ |
1208 | 1208 | private function _set_category_object() { |
1209 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1209 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1210 | 1210 | return; //already have the category object so get out. |
1211 | 1211 | |
1212 | 1212 | //set default category object |
1213 | 1213 | $this->_set_empty_category_object(); |
1214 | 1214 | |
1215 | 1215 | //only set if we've got an id |
1216 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1216 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1217 | 1217 | return; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1221 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1221 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1222 | 1222 | |
1223 | 1223 | |
1224 | - if ( !empty( $term ) ) { |
|
1224 | + if ( ! empty($term)) { |
|
1225 | 1225 | $this->_category->category_name = $term->name; |
1226 | 1226 | $this->_category->category_identifier = $term->slug; |
1227 | 1227 | $this->_category->category_desc = $term->description; |
@@ -1235,15 +1235,15 @@ discard block |
||
1235 | 1235 | |
1236 | 1236 | private function _set_empty_category_object() { |
1237 | 1237 | $this->_category = new stdClass(); |
1238 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1238 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1239 | 1239 | $this->_category->id = $this->_category->parent = 0; |
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | |
1243 | 1243 | |
1244 | 1244 | protected function _category_list_table() { |
1245 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1246 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1245 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1246 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
1247 | 1247 | 'add_category', |
1248 | 1248 | 'add_category', |
1249 | 1249 | array(), |
@@ -1263,13 +1263,13 @@ discard block |
||
1263 | 1263 | $this->_set_add_edit_form_tags($route); |
1264 | 1264 | |
1265 | 1265 | $this->_set_category_object(); |
1266 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1266 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1267 | 1267 | |
1268 | 1268 | $delete_action = 'delete_category'; |
1269 | 1269 | |
1270 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1270 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1271 | 1271 | |
1272 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1272 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1273 | 1273 | |
1274 | 1274 | //take care of contents |
1275 | 1275 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1283,25 +1283,25 @@ discard block |
||
1283 | 1283 | 'type' => 'wp_editor', |
1284 | 1284 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1285 | 1285 | 'class' => 'my_editor_custom', |
1286 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1286 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1287 | 1287 | ); |
1288 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1288 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1289 | 1289 | |
1290 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1290 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1291 | 1291 | |
1292 | 1292 | //setup category select for term parents. |
1293 | 1293 | $category_select_values[] = array( |
1294 | 1294 | 'text' => __('No Parent', 'event_espresso'), |
1295 | 1295 | 'id' => 0 |
1296 | 1296 | ); |
1297 | - foreach ( $all_terms as $term ) { |
|
1297 | + foreach ($all_terms as $term) { |
|
1298 | 1298 | $category_select_values[] = array( |
1299 | 1299 | 'text' => $term->name, |
1300 | 1300 | 'id' => $term->term_id |
1301 | 1301 | ); |
1302 | 1302 | } |
1303 | 1303 | |
1304 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1304 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1305 | 1305 | $template_args = array( |
1306 | 1306 | 'category' => $this->_category, |
1307 | 1307 | 'category_select' => $category_select, |
@@ -1310,15 +1310,15 @@ discard block |
||
1310 | 1310 | 'disable' => '', |
1311 | 1311 | 'disabled_message' =>FALSE |
1312 | 1312 | ); |
1313 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1314 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1313 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1314 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | |
1318 | 1318 | protected function _delete_categories() { |
1319 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1319 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1320 | 1320 | |
1321 | - foreach ( $cat_ids as $cat_id ) { |
|
1321 | + foreach ($cat_ids as $cat_id) { |
|
1322 | 1322 | $this->_delete_category($cat_id); |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | $query_args = array( |
1327 | 1327 | 'action' => 'category_list' |
1328 | 1328 | ); |
1329 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1329 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1330 | 1330 | |
1331 | 1331 | } |
1332 | 1332 | |
@@ -1335,58 +1335,58 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | |
1337 | 1337 | protected function _delete_category($cat_id) { |
1338 | - $cat_id = absint( $cat_id ); |
|
1339 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1338 | + $cat_id = absint($cat_id); |
|
1339 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
1343 | 1343 | |
1344 | 1344 | protected function _insert_or_update_category($new_category) { |
1345 | 1345 | |
1346 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1346 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1347 | 1347 | $success = 0; //we already have a success message so lets not send another. |
1348 | - if ( $cat_id ) { |
|
1348 | + if ($cat_id) { |
|
1349 | 1349 | $query_args = array( |
1350 | 1350 | 'action' => 'edit_category', |
1351 | 1351 | 'VEN_CAT_ID' => $cat_id |
1352 | 1352 | ); |
1353 | 1353 | } else { |
1354 | - $query_args = array( 'action' => 'add_category' ); |
|
1354 | + $query_args = array('action' => 'add_category'); |
|
1355 | 1355 | } |
1356 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1356 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1357 | 1357 | |
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | |
1361 | 1361 | |
1362 | - private function _insert_category( $update = FALSE ) { |
|
1362 | + private function _insert_category($update = FALSE) { |
|
1363 | 1363 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1364 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1365 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1366 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1364 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1365 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1366 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1367 | 1367 | |
1368 | - if ( empty( $category_name ) ) { |
|
1369 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1370 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1368 | + if (empty($category_name)) { |
|
1369 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1370 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1371 | 1371 | return false; |
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | |
1375 | - $term_args=array( |
|
1375 | + $term_args = array( |
|
1376 | 1376 | 'name'=>$category_name, |
1377 | 1377 | 'description'=>$category_desc, |
1378 | 1378 | 'parent'=>$category_parent |
1379 | 1379 | ); |
1380 | 1380 | |
1381 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1381 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1382 | 1382 | |
1383 | - if ( !is_array( $insert_ids ) ) { |
|
1384 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1385 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1383 | + if ( ! is_array($insert_ids)) { |
|
1384 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1385 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1386 | 1386 | } else { |
1387 | 1387 | $cat_id = $insert_ids['term_id']; |
1388 | - $msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name ); |
|
1389 | - EE_Error::add_success( $msg ); |
|
1388 | + $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1389 | + EE_Error::add_success($msg); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | return $cat_id; |
@@ -1406,11 +1406,11 @@ discard block |
||
1406 | 1406 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1407 | 1407 | ); |
1408 | 1408 | |
1409 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1409 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1410 | 1410 | |
1411 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1412 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1413 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1411 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1412 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1413 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1414 | 1414 | $EE_Export->export(); |
1415 | 1415 | } |
1416 | 1416 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | |
1423 | 1423 | protected function _import_categories() { |
1424 | 1424 | |
1425 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1425 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1426 | 1426 | EE_Import::instance()->import(); |
1427 | 1427 | |
1428 | 1428 | } |
@@ -1430,29 +1430,29 @@ discard block |
||
1430 | 1430 | |
1431 | 1431 | |
1432 | 1432 | |
1433 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1433 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1434 | 1434 | |
1435 | 1435 | //testing term stuff |
1436 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1437 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1438 | - $limit = ($current_page-1)*$per_page; |
|
1439 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1440 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1441 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1436 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1437 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1438 | + $limit = ($current_page - 1) * $per_page; |
|
1439 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1440 | + if (isset($this->_req_data['s'])) { |
|
1441 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1442 | 1442 | $where['OR'] = array( |
1443 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1444 | - 'description' => array( 'LIKE', $sstr ) |
|
1443 | + 'Term.name' => array('LIKE', $sstr), |
|
1444 | + 'description' => array('LIKE', $sstr) |
|
1445 | 1445 | ); |
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | $query_params = array( |
1449 | 1449 | $where, |
1450 | - 'order_by' => array( $orderby => $order ), |
|
1451 | - 'limit' => $limit . ',' . $per_page, |
|
1450 | + 'order_by' => array($orderby => $order), |
|
1451 | + 'limit' => $limit.','.$per_page, |
|
1452 | 1452 | 'force_join' => array('Term') |
1453 | 1453 | ); |
1454 | 1454 | |
1455 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1455 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1456 | 1456 | |
1457 | 1457 | return $categories; |
1458 | 1458 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'order' => 10 |
201 | 201 | ), |
202 | 202 | 'list_table' => 'Prices_List_Table', |
203 | - 'help_tabs' => array( |
|
203 | + 'help_tabs' => array( |
|
204 | 204 | 'pricing_default_pricing_help_tab' => array( |
205 | 205 | 'title' => __('Default Pricing', 'event_espresso'), |
206 | 206 | 'filename' => 'pricing_default_pricing' |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | 'order' => 20, |
224 | 224 | 'persistent' => FALSE |
225 | 225 | ), |
226 | - 'help_tabs' => array( |
|
226 | + 'help_tabs' => array( |
|
227 | 227 | 'add_new_default_price_help_tab' => array( |
228 | 228 | 'title' => __('Add New Default Price', 'event_espresso'), |
229 | 229 | 'filename' => 'pricing_add_new_default_price' |
230 | 230 | ) |
231 | 231 | ), |
232 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
232 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
233 | 233 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | 243 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
244 | - 'help_tabs' => array( |
|
244 | + 'help_tabs' => array( |
|
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'order' => 30 |
257 | 257 | ), |
258 | 258 | 'list_table' => 'Price_Types_List_Table', |
259 | - 'help_tabs' => array( |
|
259 | + 'help_tabs' => array( |
|
260 | 260 | 'pricing_price_types_help_tab' => array( |
261 | 261 | 'title' => __('Price Types', 'event_espresso'), |
262 | 262 | 'filename' => 'pricing_price_types' |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | 'order' => 40, |
281 | 281 | 'persistent' => FALSE |
282 | 282 | ), |
283 | - 'help_tabs' => array( |
|
283 | + 'help_tabs' => array( |
|
284 | 284 | 'add_new_price_type_help_tab' => array( |
285 | 285 | 'title' => __('Add New Price Type', 'event_espresso'), |
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
289 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | 290 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | 'order' => 40, |
297 | 297 | 'persistent' => FALSE |
298 | 298 | ), |
299 | - 'help_tabs' => array( |
|
299 | + 'help_tabs' => array( |
|
300 | 300 | 'edit_price_type_help_tab' => array( |
301 | 301 | 'title' => __('Edit Price Type', 'event_espresso'), |
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
305 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | 306 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
@@ -433,16 +433,16 @@ discard block |
||
433 | 433 | |
434 | 434 | /** |
435 | 435 | * generates HTML for main Prices Admin page |
436 | - * @access protected |
|
437 | - * @return void |
|
438 | - */ |
|
436 | + * @access protected |
|
437 | + * @return void |
|
438 | + */ |
|
439 | 439 | protected function _price_overview_list_table() { |
440 | 440 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
441 | - 'add_new_price', |
|
442 | - 'add', |
|
443 | - array(), |
|
444 | - 'add-new-h2' |
|
445 | - ); |
|
441 | + 'add_new_price', |
|
442 | + 'add', |
|
443 | + array(), |
|
444 | + 'add-new-h2' |
|
445 | + ); |
|
446 | 446 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
447 | 447 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
448 | 448 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -454,13 +454,13 @@ discard block |
||
454 | 454 | |
455 | 455 | |
456 | 456 | /** |
457 | - * retrieve data for Prices List table |
|
458 | - * @access public |
|
459 | - * @param int $per_page how many prices displayed per page |
|
460 | - * @param boolean $count return the count or objects |
|
461 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
462 | - * @return mixed (int|array) int = count || array of price objects |
|
463 | - */ |
|
457 | + * retrieve data for Prices List table |
|
458 | + * @access public |
|
459 | + * @param int $per_page how many prices displayed per page |
|
460 | + * @param boolean $count return the count or objects |
|
461 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
462 | + * @return mixed (int|array) int = count || array of price objects |
|
463 | + */ |
|
464 | 464 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
465 | 465 | |
466 | 466 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | |
531 | 531 | /** |
532 | 532 | * _price_details |
533 | - * @access protected |
|
534 | - * @return void |
|
535 | - */ |
|
533 | + * @access protected |
|
534 | + * @return void |
|
535 | + */ |
|
536 | 536 | protected function _edit_price_details() { |
537 | 537 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
538 | 538 | // grab price ID |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | |
593 | 593 | /** |
594 | 594 | * declare price details page metaboxes |
595 | - * @access protected |
|
596 | - * @return void |
|
597 | - */ |
|
595 | + * @access protected |
|
596 | + * @return void |
|
597 | + */ |
|
598 | 598 | protected function _price_details_meta_boxes() { |
599 | 599 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
600 | 600 | } |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | |
607 | 607 | /** |
608 | 608 | * _edit_price_details_meta_box |
609 | - * @access public |
|
610 | - * @return void |
|
611 | - */ |
|
609 | + * @access public |
|
610 | + * @return void |
|
611 | + */ |
|
612 | 612 | public function _edit_price_details_meta_box() { |
613 | 613 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
614 | 614 | } |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | |
620 | 620 | /** |
621 | 621 | * set_price_column_values |
622 | - * @access protected |
|
623 | - * @return array |
|
624 | - */ |
|
622 | + * @access protected |
|
623 | + * @return array |
|
624 | + */ |
|
625 | 625 | protected function set_price_column_values() { |
626 | 626 | |
627 | 627 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | |
649 | 649 | /** |
650 | 650 | * insert_or_update_price |
651 | - * @param boolean $insert - whether to insert or update |
|
652 | - * @access protected |
|
653 | - * @return void |
|
654 | - */ |
|
651 | + * @param boolean $insert - whether to insert or update |
|
652 | + * @access protected |
|
653 | + * @return void |
|
654 | + */ |
|
655 | 655 | protected function _insert_or_update_price( $insert = FALSE ) { |
656 | 656 | |
657 | 657 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -724,10 +724,10 @@ discard block |
||
724 | 724 | |
725 | 725 | /** |
726 | 726 | * _trash_or_restore_price |
727 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
728 | - * @access protected |
|
729 | - * @return void |
|
730 | - */ |
|
727 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
728 | + * @access protected |
|
729 | + * @return void |
|
730 | + */ |
|
731 | 731 | protected function _trash_or_restore_price( $trash = TRUE ) { |
732 | 732 | |
733 | 733 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | |
808 | 808 | /** |
809 | 809 | * _delete_price |
810 | - * @access protected |
|
811 | - * @return void |
|
812 | - */ |
|
810 | + * @access protected |
|
811 | + * @return void |
|
812 | + */ |
|
813 | 813 | protected function _delete_price() { |
814 | 814 | |
815 | 815 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -886,16 +886,16 @@ discard block |
||
886 | 886 | |
887 | 887 | /** |
888 | 888 | * generates HTML for main Prices Admin page |
889 | - * @access protected |
|
890 | - * @return void |
|
891 | - */ |
|
889 | + * @access protected |
|
890 | + * @return void |
|
891 | + */ |
|
892 | 892 | protected function _price_types_overview_list_table() { |
893 | 893 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
894 | - 'add_new_price_type', |
|
895 | - 'add_type', |
|
896 | - array(), |
|
897 | - 'add-new-h2' |
|
898 | - ); |
|
894 | + 'add_new_price_type', |
|
895 | + 'add_type', |
|
896 | + array(), |
|
897 | + 'add-new-h2' |
|
898 | + ); |
|
899 | 899 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
900 | 900 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
901 | 901 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -907,13 +907,13 @@ discard block |
||
907 | 907 | |
908 | 908 | |
909 | 909 | /** |
910 | - * retrieve data for Price Types List table |
|
911 | - * @access public |
|
912 | - * @param int $per_page how many prices displayed per page |
|
913 | - * @param boolean $count return the count or objects |
|
914 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
915 | - * @return mixed (int|array) int = count || array of price objects |
|
916 | - */ |
|
910 | + * retrieve data for Price Types List table |
|
911 | + * @access public |
|
912 | + * @param int $per_page how many prices displayed per page |
|
913 | + * @param boolean $count return the count or objects |
|
914 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
915 | + * @return mixed (int|array) int = count || array of price objects |
|
916 | + */ |
|
917 | 917 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
918 | 918 | |
919 | 919 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -968,9 +968,9 @@ discard block |
||
968 | 968 | |
969 | 969 | /** |
970 | 970 | * _edit_price_type_details |
971 | - * @access protected |
|
972 | - * @return void |
|
973 | - */ |
|
971 | + * @access protected |
|
972 | + * @return void |
|
973 | + */ |
|
974 | 974 | protected function _edit_price_type_details() { |
975 | 975 | |
976 | 976 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | /** |
1027 | 1027 | * declare price type details page metaboxes |
1028 | - * @access protected |
|
1029 | - * @return void |
|
1030 | - */ |
|
1028 | + * @access protected |
|
1029 | + * @return void |
|
1030 | + */ |
|
1031 | 1031 | protected function _price_type_details_meta_boxes() { |
1032 | 1032 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1033 | 1033 | } |
@@ -1038,9 +1038,9 @@ discard block |
||
1038 | 1038 | |
1039 | 1039 | /** |
1040 | 1040 | * _edit_price_type_details_meta_box |
1041 | - * @access public |
|
1042 | - * @return void |
|
1043 | - */ |
|
1041 | + * @access public |
|
1042 | + * @return void |
|
1043 | + */ |
|
1044 | 1044 | public function _edit_price_type_details_meta_box() { |
1045 | 1045 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1046 | 1046 | } |
@@ -1050,9 +1050,9 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | /** |
1052 | 1052 | * set_price_type_column_values |
1053 | - * @access protected |
|
1054 | - * @return void |
|
1055 | - */ |
|
1053 | + * @access protected |
|
1054 | + * @return void |
|
1055 | + */ |
|
1056 | 1056 | protected function set_price_type_column_values() { |
1057 | 1057 | |
1058 | 1058 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1100,10 +1100,10 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | /** |
1102 | 1102 | * _insert_or_update_price_type |
1103 | - * @param boolean $new_price_type - whether to insert or update |
|
1104 | - * @access protected |
|
1105 | - * @return void |
|
1106 | - */ |
|
1103 | + * @param boolean $new_price_type - whether to insert or update |
|
1104 | + * @access protected |
|
1105 | + * @return void |
|
1106 | + */ |
|
1107 | 1107 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1108 | 1108 | |
1109 | 1109 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1144,10 +1144,10 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | /** |
1146 | 1146 | * _trash_or_restore_price_type |
1147 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1148 | - * @access protected |
|
1149 | - * @return void |
|
1150 | - */ |
|
1147 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1148 | + * @access protected |
|
1149 | + * @return void |
|
1150 | + */ |
|
1151 | 1151 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1152 | 1152 | |
1153 | 1153 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1201,9 +1201,9 @@ discard block |
||
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * _delete_price_type |
1204 | - * @access protected |
|
1205 | - * @return void |
|
1206 | - */ |
|
1204 | + * @access protected |
|
1205 | + * @return void |
|
1206 | + */ |
|
1207 | 1207 | protected function _delete_price_type() { |
1208 | 1208 | |
1209 | 1209 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1240,9 +1240,9 @@ discard block |
||
1240 | 1240 | |
1241 | 1241 | /** |
1242 | 1242 | * _learn_more_about_pricing_link |
1243 | - * @access protected |
|
1244 | - * @return string |
|
1245 | - */ |
|
1243 | + * @access protected |
|
1244 | + * @return string |
|
1245 | + */ |
|
1246 | 1246 | protected function _learn_more_about_pricing_link() { |
1247 | 1247 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1248 | 1248 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @return void |
438 | 438 | */ |
439 | 439 | protected function _price_overview_list_table() { |
440 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
440 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
441 | 441 | 'add_new_price', |
442 | 442 | 'add', |
443 | 443 | array(), |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
462 | 462 | * @return mixed (int|array) int = count || array of price objects |
463 | 463 | */ |
464 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
464 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
465 | 465 | |
466 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
466 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
467 | 467 | // start with an empty array |
468 | 468 | $event_pricing = array(); |
469 | 469 | |
470 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
471 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
470 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
471 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
472 | 472 | //$PRC = EEM_Price::instance(); |
473 | 473 | |
474 | 474 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
475 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
475 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
476 | 476 | |
477 | 477 | switch ($this->_req_data['orderby']) { |
478 | 478 | case 'name': |
@@ -485,27 +485,27 @@ discard block |
||
485 | 485 | $orderby = array('PRC_amount'=>$order); |
486 | 486 | break; |
487 | 487 | default: |
488 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
488 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
489 | 489 | } |
490 | 490 | |
491 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
492 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
491 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
492 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
493 | 493 | |
494 | 494 | $_where = array( |
495 | 495 | 'PRC_is_default' => 1, |
496 | 496 | 'PRC_deleted' => $trashed |
497 | 497 | ); |
498 | 498 | |
499 | - $offset = ($current_page-1)*$per_page; |
|
500 | - $limit = array( $offset, $per_page ); |
|
499 | + $offset = ($current_page - 1) * $per_page; |
|
500 | + $limit = array($offset, $per_page); |
|
501 | 501 | |
502 | - if ( isset( $this->_req_data['s'] ) ) { |
|
503 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
502 | + if (isset($this->_req_data['s'])) { |
|
503 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
504 | 504 | $_where['OR'] = array( |
505 | - 'PRC_name' => array('LIKE',$sstr ), |
|
506 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
507 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
508 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
505 | + 'PRC_name' => array('LIKE', $sstr), |
|
506 | + 'PRC_desc' => array('LIKE', $sstr), |
|
507 | + 'PRC_amount' => array('LIKE', $sstr), |
|
508 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
509 | 509 | ); |
510 | 510 | } |
511 | 511 | |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | 'group_by'=>'PRC_ID' |
517 | 517 | ); |
518 | 518 | |
519 | - if($count){ |
|
520 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
521 | - }else{ |
|
519 | + if ($count) { |
|
520 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
521 | + } else { |
|
522 | 522 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
523 | 523 | } |
524 | 524 | } |
@@ -534,49 +534,49 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | protected function _edit_price_details() { |
537 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
537 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
538 | 538 | // grab price ID |
539 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
539 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
540 | 540 | // change page title based on request action |
541 | - switch( $this->_req_action ) { |
|
541 | + switch ($this->_req_action) { |
|
542 | 542 | case 'add_new_price' : |
543 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
543 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
544 | 544 | break; |
545 | 545 | case 'edit_price' : |
546 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
546 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
547 | 547 | break; |
548 | 548 | default : |
549 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
549 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
550 | 550 | } |
551 | 551 | // add PRC_ID to title if editing |
552 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
552 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
553 | 553 | |
554 | 554 | // get prices |
555 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
555 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
556 | 556 | $PRC = EEM_Price::instance(); |
557 | 557 | |
558 | - if ( $PRC_ID ) { |
|
559 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
558 | + if ($PRC_ID) { |
|
559 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
560 | 560 | $additional_hidden_fields = array( |
561 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
561 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
562 | 562 | ); |
563 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
563 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
564 | 564 | } else { |
565 | 565 | $price = $PRC->get_new_price(); |
566 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
566 | + $this->_set_add_edit_form_tags('insert_price'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | $this->_template_args['PRC_ID'] = $PRC_ID; |
570 | 570 | $this->_template_args['price'] = $price; |
571 | 571 | |
572 | 572 | // get price types |
573 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
573 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
574 | 574 | $PRT = EEM_Price_Type::instance(); |
575 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
575 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
576 | 576 | $price_type_names = array(); |
577 | 577 | if (empty($price_types)) { |
578 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
579 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
578 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
579 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
580 | 580 | exit(); |
581 | 581 | } else { |
582 | 582 | foreach ($price_types as $type) { |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $this->_template_args['price_types'] = $price_type_names; |
590 | 590 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
591 | 591 | |
592 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
592 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
593 | 593 | // the details template wrapper |
594 | 594 | $this->display_admin_page_with_sidebar(); |
595 | 595 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | protected function _price_details_meta_boxes() { |
608 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
608 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | * @return void |
620 | 620 | */ |
621 | 621 | public function _edit_price_details_meta_box() { |
622 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
622 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | protected function set_price_column_values() { |
635 | 635 | |
636 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
636 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
637 | 637 | |
638 | 638 | $set_column_values = array( |
639 | 639 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -661,12 +661,12 @@ discard block |
||
661 | 661 | * @access protected |
662 | 662 | * @return void |
663 | 663 | */ |
664 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
664 | + protected function _insert_or_update_price($insert = FALSE) { |
|
665 | 665 | |
666 | 666 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
667 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
667 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
668 | 668 | |
669 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
669 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
670 | 670 | $PRC = EEM_Price::instance(); |
671 | 671 | |
672 | 672 | // why be so pessimistic ??? : ( |
@@ -674,14 +674,14 @@ discard block |
||
674 | 674 | |
675 | 675 | $set_column_values = $this->set_price_column_values(); |
676 | 676 | // is this a new Price ? |
677 | - if ( $insert ) { |
|
677 | + if ($insert) { |
|
678 | 678 | // run the insert |
679 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
679 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
680 | 680 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
681 | 681 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
682 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
682 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
683 | 683 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
684 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
684 | + $ticket->_add_relation_to($PR, 'Price'); |
|
685 | 685 | $ticket->save(); |
686 | 686 | } |
687 | 687 | $success = 1; |
@@ -691,29 +691,29 @@ discard block |
||
691 | 691 | } |
692 | 692 | $action_desc = 'created'; |
693 | 693 | } else { |
694 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
694 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
695 | 695 | // run the update |
696 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
697 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
696 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
697 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
698 | 698 | $success = 1; |
699 | 699 | } |
700 | 700 | |
701 | 701 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
702 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
702 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
703 | 703 | |
704 | 704 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
705 | - if ( $PRC_ID === 1 ) { |
|
705 | + if ($PRC_ID === 1) { |
|
706 | 706 | $ticket = $PR->get_first_related('Ticket'); |
707 | - if ( $ticket ) { |
|
708 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
709 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
707 | + if ($ticket) { |
|
708 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
709 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
710 | 710 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
711 | 711 | $ticket->save(); |
712 | 712 | } |
713 | 713 | } else { |
714 | 714 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
715 | 715 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
716 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
716 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
717 | 717 | $ticket->save(); |
718 | 718 | } |
719 | 719 | } |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | $action_desc = 'updated'; |
722 | 722 | } |
723 | 723 | |
724 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
724 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
725 | 725 | |
726 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
726 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | |
@@ -737,12 +737,12 @@ discard block |
||
737 | 737 | * @access protected |
738 | 738 | * @return void |
739 | 739 | */ |
740 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
740 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
741 | 741 | |
742 | 742 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
743 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
743 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
744 | 744 | |
745 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
745 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
746 | 746 | $PRC = EEM_Price::instance(); |
747 | 747 | |
748 | 748 | $success = 1; |
@@ -751,18 +751,18 @@ discard block |
||
751 | 751 | //get base ticket for updating |
752 | 752 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
753 | 753 | //Checkboxes |
754 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
754 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
755 | 755 | // if array has more than one element than success message should be plural |
756 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
756 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
757 | 757 | // cycle thru checkboxes |
758 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
759 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
758 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
759 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
760 | 760 | $success = 0; |
761 | 761 | } else { |
762 | 762 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
763 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
763 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
764 | 764 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
765 | - if ( $PRC_deleted ) { |
|
765 | + if ($PRC_deleted) { |
|
766 | 766 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
767 | 767 | } else { |
768 | 768 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -774,14 +774,14 @@ discard block |
||
774 | 774 | |
775 | 775 | } else { |
776 | 776 | // grab single id and delete |
777 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
778 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
777 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
778 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
779 | 779 | $success = 0; |
780 | 780 | } else { |
781 | 781 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
782 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
782 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
783 | 783 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
784 | - if ( $PRC_deleted ) { |
|
784 | + if ($PRC_deleted) { |
|
785 | 785 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
786 | 786 | } else { |
787 | 787 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -795,17 +795,17 @@ discard block |
||
795 | 795 | 'action' => 'default' |
796 | 796 | ); |
797 | 797 | |
798 | - if ( $success ) { |
|
799 | - if ( $trash ) { |
|
798 | + if ($success) { |
|
799 | + if ($trash) { |
|
800 | 800 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
801 | 801 | } else { |
802 | 802 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
803 | 803 | } |
804 | 804 | |
805 | - EE_Error::add_success( $msg ); |
|
805 | + EE_Error::add_success($msg); |
|
806 | 806 | } |
807 | 807 | |
808 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
808 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
809 | 809 | |
810 | 810 | } |
811 | 811 | |
@@ -822,19 +822,19 @@ discard block |
||
822 | 822 | protected function _delete_price() { |
823 | 823 | |
824 | 824 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
825 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
825 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
826 | 826 | |
827 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
827 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
828 | 828 | $PRC = EEM_Price::instance(); |
829 | 829 | |
830 | 830 | $success = 1; |
831 | 831 | //Checkboxes |
832 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
832 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
833 | 833 | // if array has more than one element than success message should be plural |
834 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
834 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
835 | 835 | // cycle thru bulk action checkboxes |
836 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
837 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
836 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
837 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
838 | 838 | $success = 0; |
839 | 839 | } |
840 | 840 | } |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | |
849 | 849 | } |
850 | 850 | |
851 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
851 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
852 | 852 | |
853 | 853 | } |
854 | 854 | |
@@ -856,16 +856,16 @@ discard block |
||
856 | 856 | |
857 | 857 | |
858 | 858 | public function update_price_order() { |
859 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
859 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
860 | 860 | |
861 | 861 | // grab our row IDs |
862 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
862 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
863 | 863 | |
864 | - if ( is_array( $row_ids )) { |
|
865 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
864 | + if (is_array($row_ids)) { |
|
865 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
866 | 866 | //Update the prices when re-ordering |
867 | 867 | $id = absint($row_ids[$i]); |
868 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
868 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
869 | 869 | $success = FALSE; |
870 | 870 | } |
871 | 871 | } |
@@ -873,9 +873,9 @@ discard block |
||
873 | 873 | $success = FALSE; |
874 | 874 | } |
875 | 875 | |
876 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
876 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
877 | 877 | |
878 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
878 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
879 | 879 | die(); |
880 | 880 | } |
881 | 881 | |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @return void |
900 | 900 | */ |
901 | 901 | protected function _price_types_overview_list_table() { |
902 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
902 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
903 | 903 | 'add_new_price_type', |
904 | 904 | 'add_type', |
905 | 905 | array(), |
@@ -923,46 +923,46 @@ discard block |
||
923 | 923 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
924 | 924 | * @return mixed (int|array) int = count || array of price objects |
925 | 925 | */ |
926 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
926 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
927 | 927 | |
928 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
928 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
929 | 929 | // start with an empty array |
930 | 930 | |
931 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
932 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
931 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
932 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
933 | 933 | |
934 | 934 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
935 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
935 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
936 | 936 | switch ($this->_req_data['orderby']) { |
937 | 937 | case 'name': |
938 | - $orderby = array( 'PRT_name' => $order); |
|
938 | + $orderby = array('PRT_name' => $order); |
|
939 | 939 | break; |
940 | 940 | default: |
941 | - $orderby = array( 'PRT_order' => $order); |
|
941 | + $orderby = array('PRT_order' => $order); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
945 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
946 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
945 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
946 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
947 | 947 | |
948 | - $offset = ($current_page-1)*$per_page; |
|
949 | - $limit = array( $offset, $per_page ); |
|
948 | + $offset = ($current_page - 1) * $per_page; |
|
949 | + $limit = array($offset, $per_page); |
|
950 | 950 | |
951 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
951 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
952 | 952 | |
953 | - if ( isset( $this->_req_data['s'] ) ) { |
|
954 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
953 | + if (isset($this->_req_data['s'])) { |
|
954 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
955 | 955 | $_where['OR'] = array( |
956 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
956 | + 'PRT_name' => array('LIKE', $sstr) |
|
957 | 957 | ); |
958 | 958 | } |
959 | 959 | $query_params = array( |
960 | 960 | $_where, |
961 | 961 | 'order_by'=>$orderby, |
962 | 962 | 'limit'=>$limit); |
963 | - if($count){ |
|
963 | + if ($count) { |
|
964 | 964 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
965 | - }else{ |
|
965 | + } else { |
|
966 | 966 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
967 | 967 | } |
968 | 968 | |
@@ -982,34 +982,34 @@ discard block |
||
982 | 982 | */ |
983 | 983 | protected function _edit_price_type_details() { |
984 | 984 | |
985 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
985 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
986 | 986 | |
987 | 987 | |
988 | 988 | // grab price type ID |
989 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
989 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
990 | 990 | // change page title based on request action |
991 | - switch( $this->_req_action ) { |
|
991 | + switch ($this->_req_action) { |
|
992 | 992 | case 'add_new_price_type' : |
993 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
993 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
994 | 994 | break; |
995 | 995 | case 'edit_price_type' : |
996 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
996 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
997 | 997 | break; |
998 | 998 | default : |
999 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
999 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1000 | 1000 | } |
1001 | 1001 | // add PRT_ID to title if editing |
1002 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1002 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1003 | 1003 | |
1004 | 1004 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1005 | 1005 | |
1006 | - if ( $PRT_ID ) { |
|
1007 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1008 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1009 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1006 | + if ($PRT_ID) { |
|
1007 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1008 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1009 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1010 | 1010 | } else { |
1011 | 1011 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1012 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1012 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1018,19 +1018,19 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1020 | 1020 | $select_values = array(); |
1021 | - foreach ( $base_types as $ref => $text ) { |
|
1022 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1021 | + foreach ($base_types as $ref => $text) { |
|
1022 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1023 | 1023 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1024 | 1024 | continue; |
1025 | 1025 | } |
1026 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1026 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
1030 | 1030 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1031 | 1031 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1032 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1033 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1032 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1033 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1034 | 1034 | // the details template wrapper |
1035 | 1035 | $this->display_admin_page_with_sidebar(); |
1036 | 1036 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | * @return void |
1048 | 1048 | */ |
1049 | 1049 | protected function _price_type_details_meta_boxes() { |
1050 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1050 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @return void |
1061 | 1061 | */ |
1062 | 1062 | public function _edit_price_type_details_meta_box() { |
1063 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1063 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | |
@@ -1073,9 +1073,9 @@ discard block |
||
1073 | 1073 | */ |
1074 | 1074 | protected function set_price_type_column_values() { |
1075 | 1075 | |
1076 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1076 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1077 | 1077 | |
1078 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1078 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1079 | 1079 | |
1080 | 1080 | switch ($base_type) { |
1081 | 1081 | |
@@ -1122,12 +1122,12 @@ discard block |
||
1122 | 1122 | * @access protected |
1123 | 1123 | * @return void |
1124 | 1124 | */ |
1125 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1125 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1126 | 1126 | |
1127 | 1127 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1128 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1128 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1129 | 1129 | |
1130 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1130 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1131 | 1131 | $PRT = EEM_Price_Type::instance(); |
1132 | 1132 | |
1133 | 1133 | // why be so pessimistic ??? : ( |
@@ -1135,24 +1135,24 @@ discard block |
||
1135 | 1135 | |
1136 | 1136 | $set_column_values = $this->set_price_type_column_values(); |
1137 | 1137 | // is this a new Price ? |
1138 | - if ( $new_price_type ) { |
|
1138 | + if ($new_price_type) { |
|
1139 | 1139 | // run the insert |
1140 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1140 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1141 | 1141 | $success = 1; |
1142 | 1142 | } |
1143 | 1143 | $action_desc = 'created'; |
1144 | 1144 | } else { |
1145 | 1145 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1146 | 1146 | // run the update |
1147 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1148 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1147 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1148 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1149 | 1149 | $success = 1; |
1150 | 1150 | } |
1151 | 1151 | $action_desc = 'updated'; |
1152 | 1152 | } |
1153 | 1153 | |
1154 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1155 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1154 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1155 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1156 | 1156 | |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1166,49 +1166,49 @@ discard block |
||
1166 | 1166 | * @access protected |
1167 | 1167 | * @return void |
1168 | 1168 | */ |
1169 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1169 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1170 | 1170 | |
1171 | 1171 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1172 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1172 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1173 | 1173 | |
1174 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1174 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1175 | 1175 | $PRT = EEM_Price_Type::instance(); |
1176 | 1176 | |
1177 | 1177 | $success = 1; |
1178 | 1178 | $PRT_deleted = $trash ? TRUE : FALSE; |
1179 | 1179 | //Checkboxes |
1180 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1180 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1181 | 1181 | // if array has more than one element than success message should be plural |
1182 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1183 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1182 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1183 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1184 | 1184 | // cycle thru checkboxes |
1185 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1186 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1185 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1186 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1187 | 1187 | $success = 0; |
1188 | 1188 | } |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | } else { |
1192 | 1192 | // grab single id and delete |
1193 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1194 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1193 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1194 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1195 | 1195 | $success = 0; |
1196 | 1196 | } |
1197 | 1197 | $what = 'Price Type'; |
1198 | 1198 | |
1199 | 1199 | } |
1200 | 1200 | |
1201 | - $query_args = array( 'action' => 'price_types' ); |
|
1202 | - if ( $success ) { |
|
1203 | - if ( $trash ) { |
|
1201 | + $query_args = array('action' => 'price_types'); |
|
1202 | + if ($success) { |
|
1203 | + if ($trash) { |
|
1204 | 1204 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1205 | 1205 | } else { |
1206 | 1206 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1207 | 1207 | } |
1208 | - EE_Error::add_success( $msg ); |
|
1208 | + EE_Error::add_success($msg); |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1211 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1212 | 1212 | |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1225,19 +1225,19 @@ discard block |
||
1225 | 1225 | protected function _delete_price_type() { |
1226 | 1226 | |
1227 | 1227 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1228 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1228 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1229 | 1229 | |
1230 | 1230 | $PRT = EEM_Price_Type::instance(); |
1231 | 1231 | |
1232 | 1232 | $success = 1; |
1233 | 1233 | //Checkboxes |
1234 | - if (!empty($this->_req_data['checkbox'])) { |
|
1234 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1235 | 1235 | // if array has more than one element than success message should be plural |
1236 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1236 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1237 | 1237 | $what = $PRT->item_name($success); |
1238 | 1238 | // cycle thru bulk action checkboxes |
1239 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1240 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1239 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1240 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1241 | 1241 | $success = 0; |
1242 | 1242 | } |
1243 | 1243 | } |
@@ -1245,8 +1245,8 @@ discard block |
||
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | |
1248 | - $query_args = array( 'action'=> 'price_types' ); |
|
1249 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1248 | + $query_args = array('action'=> 'price_types'); |
|
1249 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1250 | 1250 | |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | * @return string |
1263 | 1263 | */ |
1264 | 1264 | protected function _learn_more_about_pricing_link() { |
1265 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1265 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 |