@@ -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 | } |
@@ -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 |
@@ -506,9 +506,9 @@ discard block |
||
506 | 506 | |
507 | 507 | /** |
508 | 508 | * generates Business Reports regarding Registrations |
509 | - * @access protected |
|
510 | - * @return void |
|
511 | - */ |
|
509 | + * @access protected |
|
510 | + * @return void |
|
511 | + */ |
|
512 | 512 | protected function _registration_reports() { |
513 | 513 | $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
514 | 514 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true ); |
@@ -676,14 +676,14 @@ discard block |
||
676 | 676 | protected function _registration_checkin_list_table() { |
677 | 677 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
678 | 678 | $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
679 | - /** @var EE_Registration $reg */ |
|
680 | - $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
679 | + /** @var EE_Registration $reg */ |
|
680 | + $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
681 | 681 | $this->_admin_page_title .= $this->get_action_link_or_button( |
682 | - 'new_registration', |
|
683 | - 'add-registrant', |
|
684 | - array('event_id' => $reg->event_ID()), |
|
685 | - 'add-new-h2' |
|
686 | - ); |
|
682 | + 'new_registration', |
|
683 | + 'add-registrant', |
|
684 | + array('event_id' => $reg->event_ID()), |
|
685 | + 'add-new-h2' |
|
686 | + ); |
|
687 | 687 | |
688 | 688 | $legend_items = array( |
689 | 689 | 'checkin' => array( |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | |
746 | 746 | /** |
747 | 747 | * handles toggleing the checkin status for the registration, |
748 | - * @access protected |
|
749 | - * @param boolean $check_in |
|
750 | - * @return void |
|
751 | - */ |
|
748 | + * @access protected |
|
749 | + * @param boolean $check_in |
|
750 | + * @return void |
|
751 | + */ |
|
752 | 752 | protected function _toggle_checkin_status() { |
753 | 753 | //first let's get the query args out of the way for the redirect |
754 | 754 | $query_args = array( |
@@ -910,11 +910,11 @@ discard block |
||
910 | 910 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
911 | 911 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
912 | 912 | ), |
913 | - 'cancelled_status' => array( |
|
913 | + 'cancelled_status' => array( |
|
914 | 914 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
915 | 915 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
916 | 916 | ), |
917 | - 'declined_status' => array( |
|
917 | + 'declined_status' => array( |
|
918 | 918 | 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
919 | 919 | 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
920 | 920 | ), |
@@ -942,9 +942,9 @@ discard block |
||
942 | 942 | /** |
943 | 943 | * get_attendees |
944 | 944 | * @param bool $count whether to return count or data. |
945 | - * @access public |
|
946 | - * @return array |
|
947 | - */ |
|
945 | + * @access public |
|
946 | + * @return array |
|
947 | + */ |
|
948 | 948 | public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
949 | 949 | |
950 | 950 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -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 | /** |
@@ -37,20 +37,20 @@ discard block |
||
37 | 37 | protected $_reports_template_data = array(); |
38 | 38 | |
39 | 39 | |
40 | - public function __construct( $routing = TRUE ) { |
|
41 | - parent::__construct( $routing ); |
|
42 | - define( 'REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/'); |
|
43 | - define( 'REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/'); |
|
44 | - define( 'REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/'); |
|
40 | + public function __construct($routing = TRUE) { |
|
41 | + parent::__construct($routing); |
|
42 | + define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/'); |
|
43 | + define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/'); |
|
44 | + define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/'); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
48 | 48 | protected function _extend_page_config() { |
49 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations'; |
|
49 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations'; |
|
50 | 50 | |
51 | - $reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0; |
|
52 | - $att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0; |
|
53 | - $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id; |
|
51 | + $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0; |
|
52 | + $att_id = ! empty($this->_req_data['ATT_ID']) ? ! is_array($this->_req_data['ATT_ID']) : 0; |
|
53 | + $att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id; |
|
54 | 54 | |
55 | 55 | $new_page_routes = array( |
56 | 56 | 'reports' => array( |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ) |
90 | 90 | ); |
91 | 91 | |
92 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
92 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
93 | 93 | |
94 | 94 | $new_page_config = array( |
95 | 95 | 'reports' => array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | 'filename' => 'registrations_event_checkin_other' |
135 | 135 | ) |
136 | 136 | ), |
137 | - 'help_tour' => array( 'Event_Checkin_Help_Tour' ), |
|
138 | - 'qtips' => array('Registration_List_Table_Tips' ), |
|
137 | + 'help_tour' => array('Event_Checkin_Help_Tour'), |
|
138 | + 'qtips' => array('Registration_List_Table_Tips'), |
|
139 | 139 | 'list_table' => 'EE_Event_Registrations_List_Table', |
140 | 140 | 'metaboxes' => array(), |
141 | 141 | 'require_nonce' => FALSE |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | ), |
154 | 154 | ); |
155 | 155 | |
156 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
156 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
157 | 157 | $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table'; |
158 | 158 | $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table'; |
159 | 159 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | protected function _ajax_hooks() { |
164 | 164 | parent::_ajax_hooks(); |
165 | - add_action( 'wp_ajax_get_newsletter_form_content', array( $this, 'get_newsletter_form_content' ) ); |
|
165 | + add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content')); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | parent::load_scripts_styles(); |
172 | 172 | |
173 | 173 | //if newsletter message type is active then let's add filter and load js for it. |
174 | - if ( EEH_MSG_Template::is_mt_active('newsletter') ) { |
|
174 | + if (EEH_MSG_Template::is_mt_active('newsletter')) { |
|
175 | 175 | //enqueue newsletter js |
176 | - wp_enqueue_script( 'ee-newsletter-trigger', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
177 | - wp_enqueue_style( 'ee-newsletter-trigger-css', REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION ); |
|
176 | + wp_enqueue_script('ee-newsletter-trigger', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, TRUE); |
|
177 | + wp_enqueue_style('ee-newsletter-trigger-css', REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css', array(), EVENT_ESPRESSO_VERSION); |
|
178 | 178 | //hook in buttons for newsletter message type trigger. |
179 | - add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array( $this, 'add_newsletter_action_buttons'), 10 ); |
|
179 | + add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_newsletter_action_buttons'), 10); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | 183 | |
184 | 184 | |
185 | 185 | public function load_scripts_styles_reports() { |
186 | - wp_register_script( 'ee-reg-reports-js', REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true ); |
|
187 | - wp_enqueue_script( 'ee-reg-reports-js' ); |
|
186 | + wp_register_script('ee-reg-reports-js', REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true); |
|
187 | + wp_enqueue_script('ee-reg-reports-js'); |
|
188 | 188 | $this->_registration_reports_js_setup(); |
189 | 189 | } |
190 | 190 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | 'slug' => 'all', |
217 | 217 | 'label' => __('All', 'event_espresso'), |
218 | 218 | 'count' => 0, |
219 | - 'bulk_action' => !isset( $this->_req_data['event_id'] ) ? array() : array( |
|
219 | + 'bulk_action' => ! isset($this->_req_data['event_id']) ? array() : array( |
|
220 | 220 | 'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'), |
221 | 221 | //'trash_registrations' => __('Trash Registrations', 'event_espresso') |
222 | 222 | ) |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | 'slug' => 'all', |
235 | 235 | 'label' => __('All', 'event_espresso'), |
236 | 236 | 'count' => 0, |
237 | - 'bulk_action' => array( 'delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso') ) |
|
237 | + 'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')) |
|
238 | 238 | ), |
239 | 239 | ); |
240 | 240 | } |
@@ -250,20 +250,20 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function get_newsletter_form_content() { |
252 | 252 | //do a nonce check cause we're not coming in from an normal route here. |
253 | - $nonce = isset( $this->_req_data['get_newsletter_form_content_nonce'] ) ? sanitize_text_field( $this->_req_data['get_newsletter_form_content_nonce'] ) : ''; |
|
253 | + $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field($this->_req_data['get_newsletter_form_content_nonce']) : ''; |
|
254 | 254 | $nonce_ref = 'get_newsletter_form_content_nonce'; |
255 | 255 | |
256 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
256 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
257 | 257 | //let's get the mtp for the incoming MTP_ ID |
258 | - if ( !isset( $this->_req_data['GRP_ID'] ) ) { |
|
259 | - EE_Error::add_error( __('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
258 | + if ( ! isset($this->_req_data['GRP_ID'])) { |
|
259 | + EE_Error::add_error(__('There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
260 | 260 | $this->_template_args['success'] = FALSE; |
261 | 261 | $this->_template_args['error'] = TRUE; |
262 | 262 | $this->_return_json(); |
263 | 263 | } |
264 | - $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID( $this->_req_data['GRP_ID'] ); |
|
265 | - if ( ! $MTPG instanceof EE_Message_Template_Group ) { |
|
266 | - EE_Error::add_error( sprintf( __('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
264 | + $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']); |
|
265 | + if ( ! $MTPG instanceof EE_Message_Template_Group) { |
|
266 | + EE_Error::add_error(sprintf(__('The GRP_ID given (%d) does not appear to have a corresponding row in the database.', 'event_espresso'), $this->_req_data['GRP_ID']), __FILE__, __FUNCTION__, __LINE__); |
|
267 | 267 | $this->_template_args['success'] = FALSE; |
268 | 268 | $this->_template_args['error'] = TRUE; |
269 | 269 | $this->_return_json(); |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | $MTPs = $MTPG->context_templates(); |
273 | 273 | $MTPs = $MTPs['attendee']; |
274 | 274 | $template_fields = array(); |
275 | - foreach ( $MTPs as $MTP ) { |
|
275 | + foreach ($MTPs as $MTP) { |
|
276 | 276 | $field = $MTP->get('MTP_template_field'); |
277 | - if ( $field == 'content' ) { |
|
277 | + if ($field == 'content') { |
|
278 | 278 | $content = $MTP->get('MTP_content'); |
279 | - if ( !empty( $content['newsletter_content'] ) ) { |
|
279 | + if ( ! empty($content['newsletter_content'])) { |
|
280 | 280 | $template_fields['newsletter_content'] = $content['newsletter_content']; |
281 | 281 | } |
282 | 282 | continue; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $this->_template_args['data'] = array( |
290 | 290 | 'batch_message_from' => isset($template_fields['from']) ? $template_fields['from'] : '', |
291 | 291 | 'batch_message_subject' => isset($template_fields['subject']) ? $template_fields['subject'] : '', |
292 | - 'batch_message_content' => isset( $template_fields['newsletter_content'] ) ? $template_fields['newsletter_content'] : '' |
|
292 | + 'batch_message_content' => isset($template_fields['newsletter_content']) ? $template_fields['newsletter_content'] : '' |
|
293 | 293 | ); |
294 | 294 | $this->_return_json(); |
295 | 295 | } |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | * @param EE_Admin_List_Table $list_table |
306 | 306 | * @return string html string for extra buttons |
307 | 307 | */ |
308 | - public function add_newsletter_action_buttons( EE_Admin_List_Table $list_table ) { |
|
309 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_newsletter_selected_send' ) ) { |
|
308 | + public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table) { |
|
309 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_newsletter_selected_send')) { |
|
310 | 310 | return ''; |
311 | 311 | } |
312 | 312 | |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | 'event_registrations', |
316 | 316 | 'default' |
317 | 317 | ); |
318 | - if ( $this->_current_page == 'espresso_registrations' && in_array( $this->_req_action, $routes_to_add_to ) ) { |
|
319 | - if ( ( $this->_req_action == 'event_registrations' && empty( $this->_req_data['event_id'] ) ) || ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'trash' ) ) { |
|
318 | + if ($this->_current_page == 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) { |
|
319 | + if (($this->_req_action == 'event_registrations' && empty($this->_req_data['event_id'])) || (isset($this->_req_data['status']) && $this->_req_data['status'] == 'trash')) { |
|
320 | 320 | echo ''; |
321 | 321 | } else { |
322 | - $button_text = sprintf( __('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>' ); |
|
323 | - echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>' . $button_text . '</button>'; |
|
324 | - add_action('admin_footer', array( $this, 'newsletter_send_form_skeleton') ); |
|
322 | + $button_text = sprintf(__('Send Batch Message (%s selected)', 'event_espresso'), '<span class="send-selected-newsletter-count">0</span>'); |
|
323 | + echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'.$button_text.'</button>'; |
|
324 | + add_action('admin_footer', array($this, 'newsletter_send_form_skeleton')); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | } |
@@ -333,37 +333,37 @@ discard block |
||
333 | 333 | $list_table = $this->_list_table_object; |
334 | 334 | $codes = array(); |
335 | 335 | //need to templates for the newsletter message type for the template selector. |
336 | - $values[] = array( 'text' => __('Select Template to Use', 'event_espresso'), 'id' => 0 ); |
|
337 | - $mtps = EEM_Message_Template_Group::instance()->get_all( array( array( 'MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email' ) ) ); |
|
338 | - foreach ( $mtps as $mtp ) { |
|
336 | + $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0); |
|
337 | + $mtps = EEM_Message_Template_Group::instance()->get_all(array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))); |
|
338 | + foreach ($mtps as $mtp) { |
|
339 | 339 | $name = $mtp->name(); |
340 | 340 | $values[] = array( |
341 | - 'text' => empty( $name ) ? __('Global', 'event_espresso') : $name, |
|
341 | + 'text' => empty($name) ? __('Global', 'event_espresso') : $name, |
|
342 | 342 | 'id' => $mtp->ID() |
343 | 343 | ); |
344 | 344 | } |
345 | 345 | |
346 | 346 | //need to get a list of shortcodes that are available for the newsletter message type. |
347 | - $shortcodes = EEH_MSG_Template::get_shortcodes( 'newsletter', 'email', array(), 'attendee', FALSE ); |
|
348 | - foreach ( $shortcodes as $field => $shortcode_array ) { |
|
349 | - $codes[$field] = implode(', ', array_keys($shortcode_array ) ); |
|
347 | + $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', FALSE); |
|
348 | + foreach ($shortcodes as $field => $shortcode_array) { |
|
349 | + $codes[$field] = implode(', ', array_keys($shortcode_array)); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | $shortcodes = $codes; |
353 | 353 | |
354 | - $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php'; |
|
354 | + $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php'; |
|
355 | 355 | $form_template_args = array( |
356 | 356 | 'form_action' => admin_url('admin.php?page=espresso_registrations'), |
357 | 357 | 'form_route' => 'newsletter_selected_send', |
358 | 358 | 'form_nonce_name' => 'newsletter_selected_send_nonce', |
359 | - 'form_nonce' => wp_create_nonce( 'newsletter_selected_send_nonce' ), |
|
359 | + 'form_nonce' => wp_create_nonce('newsletter_selected_send_nonce'), |
|
360 | 360 | 'redirect_back_to' => $this->_req_action, |
361 | - 'ajax_nonce' => wp_create_nonce( 'get_newsletter_form_content_nonce'), |
|
362 | - 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values ), |
|
361 | + 'ajax_nonce' => wp_create_nonce('get_newsletter_form_content_nonce'), |
|
362 | + 'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values), |
|
363 | 363 | 'shortcodes' => $shortcodes, |
364 | 364 | 'id_type' => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration' |
365 | 365 | ); |
366 | - EEH_Template::display_template( $form_template, $form_template_args ); |
|
366 | + EEH_Template::display_template($form_template, $form_template_args); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | protected function _newsletter_selected_send() { |
379 | 379 | $success = TRUE; |
380 | 380 | //first we need to make sure we have a GRP_ID so we know what template we're sending and updating! |
381 | - if ( empty( $this->_req_data['newsletter_mtp_selected'] ) ) { |
|
381 | + if (empty($this->_req_data['newsletter_mtp_selected'])) { |
|
382 | 382 | EE_Error::add_error( |
383 | 383 | __( |
384 | 384 | 'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.', |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $success = FALSE; |
390 | 390 | } |
391 | 391 | |
392 | - if ( $success ) { |
|
392 | + if ($success) { |
|
393 | 393 | //update Message template in case there are any changes |
394 | 394 | $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID( |
395 | 395 | $this->_req_data['newsletter_mtp_selected'] |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group |
398 | 398 | ? $Message_Template_Group->context_templates() |
399 | 399 | : array(); |
400 | - if ( empty( $Message_Templates ) ) { |
|
400 | + if (empty($Message_Templates)) { |
|
401 | 401 | EE_Error::add_error( |
402 | 402 | __( |
403 | 403 | 'Unable to retrieve message template fields from the db. Messages not sent.', |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | //let's just update the specific fields |
411 | - foreach ( $Message_Templates['attendee'] as $Message_Template ) { |
|
412 | - if ( $Message_Template instanceof EE_Message_Template ) { |
|
413 | - $field = $Message_Template->get( 'MTP_template_field' ); |
|
414 | - $content = $Message_Template->get( 'MTP_content' ); |
|
411 | + foreach ($Message_Templates['attendee'] as $Message_Template) { |
|
412 | + if ($Message_Template instanceof EE_Message_Template) { |
|
413 | + $field = $Message_Template->get('MTP_template_field'); |
|
414 | + $content = $Message_Template->get('MTP_content'); |
|
415 | 415 | $new_content = $content; |
416 | - switch ( $field ) { |
|
416 | + switch ($field) { |
|
417 | 417 | case 'from' : |
418 | - $new_content = ! empty( $this->_req_data['batch_message']['from'] ) |
|
418 | + $new_content = ! empty($this->_req_data['batch_message']['from']) |
|
419 | 419 | ? $this->_req_data['batch_message']['from'] |
420 | 420 | : $content; |
421 | 421 | break; |
422 | 422 | case 'subject' : |
423 | - $new_content = ! empty( $this->_req_data['batch_message']['subject'] ) |
|
423 | + $new_content = ! empty($this->_req_data['batch_message']['subject']) |
|
424 | 424 | ? $this->_req_data['batch_message']['subject'] |
425 | 425 | : $content; |
426 | 426 | break; |
427 | 427 | case 'content' : |
428 | 428 | $new_content = $content; |
429 | - $new_content['newsletter_content'] = ! empty( $this->_req_data['batch_message']['content'] ) |
|
429 | + $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content']) |
|
430 | 430 | ? $this->_req_data['batch_message']['content'] |
431 | 431 | : $content['newsletter_content']; |
432 | 432 | break; |
@@ -434,35 +434,35 @@ discard block |
||
434 | 434 | continue; |
435 | 435 | break; |
436 | 436 | } |
437 | - $Message_Template->set( 'MTP_content', $new_content ); |
|
437 | + $Message_Template->set('MTP_content', $new_content); |
|
438 | 438 | $Message_Template->save(); |
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | 442 | //great fields are updated! now let's make sure we just have contact objects (EE_Attendee). |
443 | - $id_type = ! empty( $this->_req_data['batch_message']['id_type'] ) |
|
443 | + $id_type = ! empty($this->_req_data['batch_message']['id_type']) |
|
444 | 444 | ? $this->_req_data['batch_message']['id_type'] |
445 | 445 | : 'registration'; |
446 | 446 | |
447 | 447 | //id_type will affect how we assemble the ids. |
448 | - $ids = ! empty( $this->_req_data['batch_message']['ids'] ) |
|
449 | - ? json_decode( stripslashes($this->_req_data['batch_message']['ids']) ) |
|
448 | + $ids = ! empty($this->_req_data['batch_message']['ids']) |
|
449 | + ? json_decode(stripslashes($this->_req_data['batch_message']['ids'])) |
|
450 | 450 | : array(); |
451 | 451 | |
452 | 452 | $registrations_used_for_contact_data = array(); |
453 | 453 | //using switch because eventually we'll have other contexts that will be used for generating messages. |
454 | - switch ( $id_type ) { |
|
454 | + switch ($id_type) { |
|
455 | 455 | case 'registration' : |
456 | 456 | $registrations_used_for_contact_data = EEM_Registration::instance()->get_all( |
457 | 457 | array( |
458 | 458 | array( |
459 | - 'REG_ID' => array( 'IN', $ids ) |
|
459 | + 'REG_ID' => array('IN', $ids) |
|
460 | 460 | ) |
461 | 461 | ) |
462 | 462 | ); |
463 | 463 | break; |
464 | 464 | case 'contact' : |
465 | - $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts( $ids ); |
|
465 | + $registrations_used_for_contact_data = EEM_Registration::instance()->get_latest_registration_for_each_of_given_contacts($ids); |
|
466 | 466 | break; |
467 | 467 | } |
468 | 468 | do_action( |
@@ -473,8 +473,8 @@ discard block |
||
473 | 473 | //kept for backward compat, internally we no longer use this action. |
474 | 474 | //@deprecated 4.8.36.rc.002 |
475 | 475 | $contacts = $id_type == 'registration' |
476 | - ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids( $ids ) |
|
477 | - : EEM_Attendee::instance()->get_all( array( array( 'ATT_ID' => array('in', $ids ) ) ) ); |
|
476 | + ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids) |
|
477 | + : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids)))); |
|
478 | 478 | do_action( |
479 | 479 | 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send', |
480 | 480 | $contacts, |
@@ -482,11 +482,11 @@ discard block |
||
482 | 482 | ); |
483 | 483 | } |
484 | 484 | $query_args = array( |
485 | - 'action' => !empty( $this->_req_data['redirect_back_to'] ) |
|
485 | + 'action' => ! empty($this->_req_data['redirect_back_to']) |
|
486 | 486 | ? $this->_req_data['redirect_back_to'] |
487 | 487 | : 'default' |
488 | 488 | ); |
489 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
489 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | * @return void |
509 | 509 | */ |
510 | 510 | protected function _registration_reports() { |
511 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php'; |
|
512 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, true ); |
|
511 | + $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php'; |
|
512 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, true); |
|
513 | 513 | // the final template wrapper |
514 | 514 | $this->display_admin_page_with_no_sidebar(); |
515 | 515 | |
@@ -522,28 +522,28 @@ discard block |
||
522 | 522 | * |
523 | 523 | * @return string |
524 | 524 | */ |
525 | - private function _registrations_per_day_report( $period = '-1 month' ) { |
|
525 | + private function _registrations_per_day_report($period = '-1 month') { |
|
526 | 526 | $report_ID = 'reg-admin-registrations-per-day-report-dv'; |
527 | 527 | |
528 | - $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report( $period ); |
|
528 | + $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period); |
|
529 | 529 | |
530 | 530 | $results = (array) $results; |
531 | 531 | $regs = array(); |
532 | 532 | $subtitle = ''; |
533 | 533 | |
534 | - if( $results ) { |
|
534 | + if ($results) { |
|
535 | 535 | $column_titles = array(); |
536 | 536 | $tracker = 0; |
537 | - foreach ( $results as $result ) { |
|
537 | + foreach ($results as $result) { |
|
538 | 538 | $report_column_values = array(); |
539 | - foreach( $result as $property_name => $property_value ) { |
|
539 | + foreach ($result as $property_name => $property_value) { |
|
540 | 540 | $property_value = $property_name == 'Registration_REG_date' ? $property_value : (int) $property_value; |
541 | 541 | $report_column_values[] = $property_value; |
542 | - if ( $tracker === 0 ) { |
|
543 | - if ( $property_name == 'Registration_REG_date' ) { |
|
544 | - $column_titles[] = __( 'Date (only days with registrations are shown)', 'event_espresso' ); |
|
542 | + if ($tracker === 0) { |
|
543 | + if ($property_name == 'Registration_REG_date') { |
|
544 | + $column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso'); |
|
545 | 545 | } else { |
546 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
546 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | } |
@@ -552,36 +552,36 @@ discard block |
||
552 | 552 | } |
553 | 553 | |
554 | 554 | //make sure the column_titles is pushed to the beginning of the array |
555 | - array_unshift( $regs, $column_titles ); |
|
555 | + array_unshift($regs, $column_titles); |
|
556 | 556 | //setup the date range. |
557 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
558 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
559 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
557 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
558 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
559 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
560 | 560 | $subtitle = sprintf( |
561 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
562 | - $beginning_date->format( 'Y-m-d' ), |
|
563 | - $ending_date->format( 'Y-m-d' ) |
|
561 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
562 | + $beginning_date->format('Y-m-d'), |
|
563 | + $ending_date->format('Y-m-d') |
|
564 | 564 | ); |
565 | 565 | } |
566 | 566 | |
567 | - $report_title = __( 'Total Registrations per Day', 'event_espresso' ); |
|
567 | + $report_title = __('Total Registrations per Day', 'event_espresso'); |
|
568 | 568 | |
569 | 569 | $report_params = array( |
570 | 570 | 'title' => $report_title, |
571 | 571 | 'subtitle' => $subtitle, |
572 | 572 | 'id' => $report_ID, |
573 | 573 | 'regs' => $regs, |
574 | - 'noResults' => empty( $regs ), |
|
574 | + 'noResults' => empty($regs), |
|
575 | 575 | 'noRegsMsg' => sprintf( |
576 | 576 | __( |
577 | 577 | '%sThere are currently no registration records in the last month for this report.%s', |
578 | 578 | 'event_espresso' |
579 | 579 | ), |
580 | - '<h2>' . $report_title . '</h2><p>', |
|
580 | + '<h2>'.$report_title.'</h2><p>', |
|
581 | 581 | '</p>' |
582 | 582 | ), |
583 | 583 | ); |
584 | - wp_localize_script( 'ee-reg-reports-js', 'regPerDay', $report_params ); |
|
584 | + wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params); |
|
585 | 585 | |
586 | 586 | return $report_ID; |
587 | 587 | } |
@@ -593,29 +593,29 @@ discard block |
||
593 | 593 | * |
594 | 594 | * @return string |
595 | 595 | */ |
596 | - private function _registrations_per_event_report( $period = '-1 month' ) { |
|
596 | + private function _registrations_per_event_report($period = '-1 month') { |
|
597 | 597 | |
598 | 598 | $report_ID = 'reg-admin-registrations-per-event-report-dv'; |
599 | 599 | |
600 | - $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report( $period ); |
|
600 | + $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period); |
|
601 | 601 | |
602 | 602 | $results = (array) $results; |
603 | 603 | $regs = array(); |
604 | 604 | $subtitle = ''; |
605 | 605 | |
606 | - if ( $results ) { |
|
606 | + if ($results) { |
|
607 | 607 | $column_titles = array(); |
608 | 608 | $tracker = 0; |
609 | - foreach ( $results as $result ) { |
|
609 | + foreach ($results as $result) { |
|
610 | 610 | $report_column_values = array(); |
611 | - foreach( $result as $property_name => $property_value ) { |
|
612 | - $property_value = $property_name == 'Registration_Event' ? wp_trim_words( $property_value, 4, '...' ) : (int) $property_value; |
|
611 | + foreach ($result as $property_name => $property_value) { |
|
612 | + $property_value = $property_name == 'Registration_Event' ? wp_trim_words($property_value, 4, '...') : (int) $property_value; |
|
613 | 613 | $report_column_values[] = $property_value; |
614 | - if ( $tracker === 0 ) { |
|
615 | - if ( $property_name == 'Registration_Event' ) { |
|
616 | - $column_titles[] = __( 'Event', 'event_espresso' ); |
|
614 | + if ($tracker === 0) { |
|
615 | + if ($property_name == 'Registration_Event') { |
|
616 | + $column_titles[] = __('Event', 'event_espresso'); |
|
617 | 617 | } else { |
618 | - $column_titles[] = EEH_Template::pretty_status( $property_name, false, 'sentence' ); |
|
618 | + $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence'); |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 | } |
@@ -624,37 +624,37 @@ discard block |
||
624 | 624 | } |
625 | 625 | |
626 | 626 | //make sure the column_titles is pushed to the beginning of the array |
627 | - array_unshift( $regs, $column_titles ); |
|
627 | + array_unshift($regs, $column_titles); |
|
628 | 628 | |
629 | 629 | //setup the date range. |
630 | - $DateTimeZone = new DateTimeZone( EEH_DTT_Helper::get_timezone() ); |
|
631 | - $beginning_date = new DateTime( "now " . $period, $DateTimeZone ); |
|
632 | - $ending_date = new DateTime( "now", $DateTimeZone ); |
|
630 | + $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone()); |
|
631 | + $beginning_date = new DateTime("now ".$period, $DateTimeZone); |
|
632 | + $ending_date = new DateTime("now", $DateTimeZone); |
|
633 | 633 | $subtitle = sprintf( |
634 | - _x( 'For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso' ), |
|
635 | - $beginning_date->format( 'Y-m-d' ), |
|
636 | - $ending_date->format( 'Y-m-d' ) |
|
634 | + _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'), |
|
635 | + $beginning_date->format('Y-m-d'), |
|
636 | + $ending_date->format('Y-m-d') |
|
637 | 637 | ); |
638 | 638 | } |
639 | 639 | |
640 | - $report_title = __( 'Total Registrations per Event', 'event_espresso' ); |
|
640 | + $report_title = __('Total Registrations per Event', 'event_espresso'); |
|
641 | 641 | |
642 | 642 | $report_params = array( |
643 | 643 | 'title' => $report_title, |
644 | 644 | 'subtitle' => $subtitle, |
645 | 645 | 'id' => $report_ID, |
646 | 646 | 'regs' => $regs, |
647 | - 'noResults' => empty( $regs ), |
|
647 | + 'noResults' => empty($regs), |
|
648 | 648 | 'noRegsMsg' => sprintf( |
649 | 649 | __( |
650 | 650 | '%sThere are currently no registration records in the last month for this report.%s', |
651 | 651 | 'event_espresso' |
652 | 652 | ), |
653 | - '<h2>' . $report_title . '</h2><p>', |
|
653 | + '<h2>'.$report_title.'</h2><p>', |
|
654 | 654 | '</p>' |
655 | 655 | ), |
656 | 656 | ); |
657 | - wp_localize_script( 'ee-reg-reports-js', 'regPerEvent', $report_params ); |
|
657 | + wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params); |
|
658 | 658 | |
659 | 659 | return $report_ID; |
660 | 660 | } |
@@ -668,8 +668,8 @@ discard block |
||
668 | 668 | * @return void |
669 | 669 | */ |
670 | 670 | protected function _registration_checkin_list_table() { |
671 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
672 | - $reg_id = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : null; |
|
671 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
672 | + $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null; |
|
673 | 673 | /** @var EE_Registration $reg */ |
674 | 674 | $reg = EEM_Registration::instance()->get_one_by_ID($reg_id); |
675 | 675 | $this->_admin_page_title .= $this->get_action_link_or_button( |
@@ -689,15 +689,15 @@ discard block |
||
689 | 689 | 'desc' => __('This indicates the attendee has been checked out', 'event_espresso') |
690 | 690 | ) |
691 | 691 | ); |
692 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
692 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
693 | 693 | |
694 | 694 | |
695 | - $dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
696 | - $go_back_url = !empty( $reg_id ) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id ), $this->_admin_base_url ) : ''; |
|
695 | + $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
696 | + $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'event_registrations', 'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(), 'DTT_ID' => $dtt_id), $this->_admin_base_url) : ''; |
|
697 | 697 | |
698 | - $this->_template_args['before_list_table'] = !empty( $reg_id ) && !empty( $dtt_id ) ? '<h2>' . sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">' . EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name() . '</span>', '<span id="checkin-dtt"><a href="' . $go_back_url . '">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time() . ' - ' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time() . '</a></span>', '<span id="checkin-event-name">' . EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name') . '</span>' ) . '</h2>' : ''; |
|
699 | - $this->_template_args['list_table_hidden_fields'] = !empty( $reg_id ) ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : ''; |
|
700 | - $this->_template_args['list_table_hidden_fields'] .= !empty( $dtt_id ) ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : ''; |
|
698 | + $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id) ? '<h2>'.sprintf(__("%s's check in records for %s at the event, %s", 'event_espresso'), '<span id="checkin-attendee-name">'.EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Attendee')->full_name().'</span>', '<span id="checkin-dtt"><a href="'.$go_back_url.'">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->start_date_and_time().' - '.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->end_date_and_time().'</a></span>', '<span id="checkin-event-name">'.EEM_Datetime::instance()->get_one_by_ID($dtt_id)->get_first_related('Event')->get('EVT_name').'</span>').'</h2>' : ''; |
|
699 | + $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id) ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : ''; |
|
700 | + $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id) ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : ''; |
|
701 | 701 | |
702 | 702 | $this->display_admin_list_table_page_with_no_sidebar(); |
703 | 703 | } |
@@ -710,24 +710,24 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public function toggle_checkin_status() { |
712 | 712 | //first make sure we have the necessary data |
713 | - if ( !isset( $this->_req_data['_regid'] ) ) { |
|
714 | - EE_Error::add_error( __('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
713 | + if ( ! isset($this->_req_data['_regid'])) { |
|
714 | + EE_Error::add_error(__('There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
715 | 715 | $this->_template_args['success'] = FALSE; |
716 | 716 | $this->_template_args['error'] = TRUE; |
717 | 717 | $this->_return_json(); |
718 | 718 | }; |
719 | 719 | |
720 | 720 | //do a nonce check cause we're not coming in from an normal route here. |
721 | - $nonce = isset( $this->_req_data['checkinnonce'] ) ? sanitize_text_field( $this->_req_data['checkinnonce'] ) : ''; |
|
721 | + $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce']) : ''; |
|
722 | 722 | $nonce_ref = 'checkin_nonce'; |
723 | 723 | |
724 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
724 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
725 | 725 | |
726 | 726 | //beautiful! Made it this far so let's get the status. |
727 | 727 | $new_status = $this->_toggle_checkin_status(); |
728 | 728 | |
729 | 729 | //setup new class to return via ajax |
730 | - $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-' . $new_status; |
|
730 | + $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'.$new_status; |
|
731 | 731 | $this->_template_args['success'] = TRUE; |
732 | 732 | $this->_return_json(); |
733 | 733 | } |
@@ -747,32 +747,32 @@ discard block |
||
747 | 747 | //first let's get the query args out of the way for the redirect |
748 | 748 | $query_args = array( |
749 | 749 | 'action' => 'event_registrations', |
750 | - 'event_id' => isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL, |
|
751 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL |
|
750 | + 'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL, |
|
751 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL |
|
752 | 752 | ); |
753 | 753 | $new_status = FALSE; |
754 | 754 | |
755 | 755 | // bulk action check in toggle |
756 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
756 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
757 | 757 | // cycle thru checkboxes |
758 | - while ( list( $REG_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
759 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
758 | + while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) { |
|
759 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
760 | 760 | $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID); |
761 | 761 | } |
762 | 762 | |
763 | - } elseif ( isset( $this->_req_data['_regid'] ) ) { |
|
763 | + } elseif (isset($this->_req_data['_regid'])) { |
|
764 | 764 | //coming from ajax request |
765 | - $DTT_ID = isset( $this->_req_data['dttid'] ) ? $this->_req_data['dttid'] : NULL; |
|
765 | + $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : NULL; |
|
766 | 766 | $query_args['DTT_ID'] = $DTT_ID; |
767 | 767 | $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID); |
768 | 768 | } else { |
769 | - EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
769 | + EE_Error::add_error(__('Missing some required data to toggle the Check-in', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
770 | 770 | } |
771 | 771 | |
772 | - if ( defined('DOING_AJAX' ) ) |
|
772 | + if (defined('DOING_AJAX')) |
|
773 | 773 | return $new_status; |
774 | 774 | |
775 | - $this->_redirect_after_action( FALSE,'', '', $query_args, TRUE ); |
|
775 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
776 | 776 | |
777 | 777 | } |
778 | 778 | |
@@ -788,11 +788,11 @@ discard block |
||
788 | 788 | */ |
789 | 789 | private function _toggle_checkin($REG_ID, $DTT_ID) { |
790 | 790 | $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID); |
791 | - $new_status = $REG->toggle_checkin_status( $DTT_ID ); |
|
792 | - if ( $new_status !== FALSE ) { |
|
793 | - EE_Error::add_success($REG->get_checkin_msg($DTT_ID) ); |
|
791 | + $new_status = $REG->toggle_checkin_status($DTT_ID); |
|
792 | + if ($new_status !== FALSE) { |
|
793 | + EE_Error::add_success($REG->get_checkin_msg($DTT_ID)); |
|
794 | 794 | } else { |
795 | - EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__ ); |
|
795 | + EE_Error::add_error($REG->get_checkin_msg($DTT_ID, TRUE), __FILE__, __FUNCTION__, __LINE__); |
|
796 | 796 | $new_status = FALSE; |
797 | 797 | } |
798 | 798 | return $new_status; |
@@ -808,28 +808,28 @@ discard block |
||
808 | 808 | protected function _delete_checkin_rows() { |
809 | 809 | $query_args = array( |
810 | 810 | 'action' => 'registration_checkins', |
811 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
812 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
811 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
812 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
813 | 813 | ); |
814 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
815 | - while ( list( $CHK_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
814 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
815 | + while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) { |
|
816 | 816 | $errors = 0; |
817 | - if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID ) ) { |
|
817 | + if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) { |
|
818 | 818 | $errors++; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | } else { |
822 | - EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
823 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
822 | + EE_Error::add_error(__('So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
823 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
824 | 824 | } |
825 | 825 | |
826 | - if ( $errors > 0 ) { |
|
827 | - EE_Error::add_error( sprintf( __('There were %d records that did not delete successfully', 'event_espresso'), $errors ), __FILE__, __FUNCTION__, __LINE__ ); |
|
826 | + if ($errors > 0) { |
|
827 | + EE_Error::add_error(sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors), __FILE__, __FUNCTION__, __LINE__); |
|
828 | 828 | } else { |
829 | - EE_Error::add_success( __('Records were successfully deleted', 'event_espresso') ); |
|
829 | + EE_Error::add_success(__('Records were successfully deleted', 'event_espresso')); |
|
830 | 830 | } |
831 | 831 | |
832 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
832 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | |
@@ -841,20 +841,20 @@ discard block |
||
841 | 841 | protected function _delete_checkin_row() { |
842 | 842 | $query_args = array( |
843 | 843 | 'action' => 'registration_checkins', |
844 | - 'DTT_ID' => isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0, |
|
845 | - '_REGID' => isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : 0 |
|
844 | + 'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0, |
|
845 | + '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0 |
|
846 | 846 | ); |
847 | 847 | |
848 | - if ( !empty( $this->_req_data['CHK_ID'] ) ) { |
|
849 | - if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'] ) ) { |
|
850 | - EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ( ! empty($this->_req_data['CHK_ID'])) { |
|
849 | + if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) { |
|
850 | + EE_Error::add_error(__('Something went wrong and this check-in record was not deleted', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
851 | 851 | } else { |
852 | - EE_Error::add_success( __('Check-In record successfully deleted', 'event_espresso') ); |
|
852 | + EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso')); |
|
853 | 853 | } |
854 | 854 | } else { |
855 | - EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
855 | + EE_Error::add_error(__('In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
856 | 856 | } |
857 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
857 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | |
@@ -867,12 +867,12 @@ discard block |
||
867 | 867 | * @throws \EE_Error |
868 | 868 | */ |
869 | 869 | protected function _event_registrations_list_table() { |
870 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
871 | - $this->_admin_page_title .= isset( $this->_req_data['event_id'] ) |
|
870 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
871 | + $this->_admin_page_title .= isset($this->_req_data['event_id']) |
|
872 | 872 | ? $this->get_action_link_or_button( |
873 | 873 | 'new_registration', |
874 | 874 | 'add-registrant', |
875 | - array( 'event_id' => $this->_req_data['event_id'] ), |
|
875 | + array('event_id' => $this->_req_data['event_id']), |
|
876 | 876 | 'add-new-h2', |
877 | 877 | '', |
878 | 878 | false |
@@ -901,35 +901,35 @@ discard block |
||
901 | 901 | 'desc' => __('View All Check-in Records for this Registrant', 'event_espresso') |
902 | 902 | ), |
903 | 903 | 'approved_status' => array( |
904 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved, |
|
905 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) |
|
904 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved, |
|
905 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') |
|
906 | 906 | ), |
907 | 907 | 'cancelled_status' => array( |
908 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled, |
|
909 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) |
|
908 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled, |
|
909 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence') |
|
910 | 910 | ), |
911 | 911 | 'declined_status' => array( |
912 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined, |
|
913 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) |
|
912 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined, |
|
913 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence') |
|
914 | 914 | ), |
915 | 915 | 'not_approved' => array( |
916 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved, |
|
917 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) |
|
916 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved, |
|
917 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence') |
|
918 | 918 | ), |
919 | 919 | 'pending_status' => array( |
920 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment, |
|
921 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) |
|
920 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment, |
|
921 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence') |
|
922 | 922 | ), |
923 | 923 | 'wait_list' => array( |
924 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list, |
|
925 | - 'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_wait_list, FALSE, 'sentence' ) |
|
924 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list, |
|
925 | + 'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, FALSE, 'sentence') |
|
926 | 926 | ), |
927 | 927 | ); |
928 | - $this->_template_args['after_list_table'] = $this->_display_legend( $legend_items ); |
|
928 | + $this->_template_args['after_list_table'] = $this->_display_legend($legend_items); |
|
929 | 929 | |
930 | - $event_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null; |
|
931 | - $this->_template_args['before_list_table'] = !empty( $event_id ) ? '<h2>' . sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name') ) . '</h2>' : ''; |
|
932 | - $this->_template_args['list_table_hidden_fields'] = !empty( $event_id ) ? '<input type="hidden" name="event_id" value="' . $event_id . '">' : ''; |
|
930 | + $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null; |
|
931 | + $this->_template_args['before_list_table'] = ! empty($event_id) ? '<h2>'.sprintf(__('Viewing Registrations for Event: %s', 'event_espresso'), EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')).'</h2>' : ''; |
|
932 | + $this->_template_args['list_table_hidden_fields'] = ! empty($event_id) ? '<input type="hidden" name="event_id" value="'.$event_id.'">' : ''; |
|
933 | 933 | |
934 | 934 | $this->display_admin_list_table_page_with_no_sidebar(); |
935 | 935 | } |
@@ -943,15 +943,15 @@ discard block |
||
943 | 943 | * @access public |
944 | 944 | * @return array |
945 | 945 | */ |
946 | - public function get_event_attendees( $per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '' ) { |
|
946 | + public function get_event_attendees($per_page = 10, $count = FALSE, $trash = FALSE, $orderby = '') { |
|
947 | 947 | |
948 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
949 | - require_once(EE_MODELS . 'EEM_Attendee.model.php'); |
|
948 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
949 | + require_once(EE_MODELS.'EEM_Attendee.model.php'); |
|
950 | 950 | //$ATT_MDL = EEM_Attendee::instance(); |
951 | 951 | |
952 | - $EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE; |
|
953 | - $CAT_ID = isset($this->_req_data['category_id']) ? absint( $this->_req_data['category_id'] ) : FALSE; |
|
954 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL; |
|
952 | + $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE; |
|
953 | + $CAT_ID = isset($this->_req_data['category_id']) ? absint($this->_req_data['category_id']) : FALSE; |
|
954 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; |
|
955 | 955 | |
956 | 956 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby; |
957 | 957 | |
@@ -964,94 +964,94 @@ discard block |
||
964 | 964 | // $orderby = 'reg.REG_final_price'; |
965 | 965 | } |
966 | 966 | |
967 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
967 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
968 | 968 | |
969 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
970 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
969 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
970 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
971 | 971 | |
972 | 972 | |
973 | - $offset = ($current_page-1)*$per_page; |
|
974 | - $limit = $count ? NULL : array( $offset, $per_page ); |
|
975 | - $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
976 | - if ($EVT_ID){ |
|
977 | - $query_params[0]['EVT_ID']=$EVT_ID; |
|
973 | + $offset = ($current_page - 1) * $per_page; |
|
974 | + $limit = $count ? NULL : array($offset, $per_page); |
|
975 | + $query_params = array(array('Event.status'=>array('IN', array_keys(EEM_Event::instance()->get_status_array())))); |
|
976 | + if ($EVT_ID) { |
|
977 | + $query_params[0]['EVT_ID'] = $EVT_ID; |
|
978 | 978 | } |
979 | - if($CAT_ID){ |
|
979 | + if ($CAT_ID) { |
|
980 | 980 | throw new EE_Error("You specified a Category Id for this query. Thats odd because we are now using terms and taxonomies. So did you mean the term taxonomy id o rthe term id?"); |
981 | 981 | } |
982 | 982 | |
983 | 983 | //if DTT is included we do multiple datetimes. |
984 | - if ( $DTT_ID ) { |
|
984 | + if ($DTT_ID) { |
|
985 | 985 | $query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID; |
986 | 986 | } |
987 | 987 | |
988 | 988 | //make sure we only have default where on the current regs |
989 | 989 | $query_params['default_where_conditions'] = 'this_model_only'; |
990 | 990 | |
991 | - $status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) ); |
|
991 | + $status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)); |
|
992 | 992 | |
993 | - $query_params[0]['STS_ID']= array('IN', $status_ids_array ); |
|
993 | + $query_params[0]['STS_ID'] = array('IN', $status_ids_array); |
|
994 | 994 | |
995 | - if($trash){ |
|
996 | - $query_params[0]['Attendee.status']= EEM_CPT_Base::post_status_trashed; |
|
995 | + if ($trash) { |
|
996 | + $query_params[0]['Attendee.status'] = EEM_CPT_Base::post_status_trashed; |
|
997 | 997 | } |
998 | 998 | |
999 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1000 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
999 | + if (isset($this->_req_data['s'])) { |
|
1000 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1001 | 1001 | $query_params[0]['OR'] = array( |
1002 | - 'Event.EVT_name' => array( 'LIKE', $sstr), |
|
1003 | - 'Event.EVT_desc' => array( 'LIKE', $sstr ), |
|
1004 | - 'Event.EVT_short_desc' => array( 'LIKE' , $sstr ), |
|
1005 | - 'Attendee.ATT_fname' => array( 'LIKE', $sstr ), |
|
1006 | - 'Attendee.ATT_lname' => array( 'LIKE', $sstr ), |
|
1007 | - 'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ), |
|
1008 | - 'Attendee.ATT_email' => array('LIKE', $sstr ), |
|
1009 | - 'Attendee.ATT_address' => array( 'LIKE', $sstr ), |
|
1010 | - 'Attendee.ATT_address2' => array( 'LIKE', $sstr ), |
|
1011 | - 'Attendee.ATT_city' => array( 'LIKE', $sstr ), |
|
1012 | - 'REG_final_price' => array( 'LIKE', $sstr ), |
|
1013 | - 'REG_code' => array( 'LIKE', $sstr ), |
|
1014 | - 'REG_count' => array( 'LIKE' , $sstr ), |
|
1015 | - 'REG_group_size' => array( 'LIKE' , $sstr ), |
|
1016 | - 'Ticket.TKT_name' => array( 'LIKE', $sstr ), |
|
1017 | - 'Ticket.TKT_description' => array( 'LIKE', $sstr ) |
|
1002 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1003 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1004 | + 'Event.EVT_short_desc' => array('LIKE', $sstr), |
|
1005 | + 'Attendee.ATT_fname' => array('LIKE', $sstr), |
|
1006 | + 'Attendee.ATT_lname' => array('LIKE', $sstr), |
|
1007 | + 'Attendee.ATT_short_bio' => array('LIKE', $sstr), |
|
1008 | + 'Attendee.ATT_email' => array('LIKE', $sstr), |
|
1009 | + 'Attendee.ATT_address' => array('LIKE', $sstr), |
|
1010 | + 'Attendee.ATT_address2' => array('LIKE', $sstr), |
|
1011 | + 'Attendee.ATT_city' => array('LIKE', $sstr), |
|
1012 | + 'REG_final_price' => array('LIKE', $sstr), |
|
1013 | + 'REG_code' => array('LIKE', $sstr), |
|
1014 | + 'REG_count' => array('LIKE', $sstr), |
|
1015 | + 'REG_group_size' => array('LIKE', $sstr), |
|
1016 | + 'Ticket.TKT_name' => array('LIKE', $sstr), |
|
1017 | + 'Ticket.TKT_description' => array('LIKE', $sstr) |
|
1018 | 1018 | ); |
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | $query_params['order_by'][$orderby] = $sort; |
1022 | 1022 | $query_params['limit'] = $limit; |
1023 | - $query_params['force_join'] = array('Attendee');//force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
1024 | - if($count){ |
|
1025 | - $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only' )); |
|
1026 | - }else{ |
|
1023 | + $query_params['force_join'] = array('Attendee'); //force join to attendee model so that it gets cached, because we're going to need the attendee for each registration |
|
1024 | + if ($count) { |
|
1025 | + $registrations = EEM_Registration::instance()->count(array($query_params[0], 'default_where_conditions' => 'this_model_only')); |
|
1026 | + } else { |
|
1027 | 1027 | $registrations = EEM_Registration::instance()->get_all($query_params); |
1028 | 1028 | |
1029 | 1029 | |
1030 | 1030 | // $registrations = EEM_Registration::instance(); |
1031 | 1031 | // $all_attendees = EEM_Attendee::instance()->get_event_attendees( $EVT_ID, $CAT_ID, $reg_status, $trash, $orderby, $sort, $limit, $output ); |
1032 | - if ( isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration ) { |
|
1032 | + if (isset($registrations[0]) && $registrations[0] instanceof EE_Registration) { |
|
1033 | 1033 | //EEH_Debug_Tools::printr( $all_attendees[0], '$all_attendees[0] <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
1034 | 1034 | // name |
1035 | 1035 | $first_registration = $registrations[0]; |
1036 | 1036 | $event_obj = $first_registration->event_obj(); |
1037 | - if($event_obj){ |
|
1037 | + if ($event_obj) { |
|
1038 | 1038 | $event_name = $first_registration->event_obj()->name(); |
1039 | - $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?';//$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1039 | + $event_date = 'TODO: we need to get date from earliest price date or should this be the actual event date?'; //$first_registration->date_obj()->reg_start_date_and_time('l F j, Y,', ' g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y, g:i:s a', $registrations[0]->DTT_EVT_start ) : ''; |
|
1040 | 1040 | // edit event link |
1041 | - if ( $event_name != '' ) { |
|
1042 | - $edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL ); |
|
1043 | - $edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>'; |
|
1044 | - $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ; |
|
1041 | + if ($event_name != '') { |
|
1042 | + $edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL); |
|
1043 | + $edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>'; |
|
1044 | + $event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>'; |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | - $back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL ); |
|
1048 | - $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">« ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>'; |
|
1047 | + $back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL); |
|
1048 | + $back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">« '.__('Back to All Registrations', 'event_espresso').'</a>'; |
|
1049 | 1049 | |
1050 | 1050 | $this->_template_args['before_admin_page_content'] = ' |
1051 | 1051 | <div id="admin-page-header"> |
1052 | - <h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1> |
|
1053 | - <h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3> |
|
1054 | - <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span> |
|
1052 | + <h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1> |
|
1053 | + <h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3> |
|
1054 | + <span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span> |
|
1055 | 1055 | </div> |
1056 | 1056 | '; |
1057 | 1057 | } |
@@ -31,29 +31,29 @@ discard block |
||
31 | 31 | <tbody> |
32 | 32 | <tr> |
33 | 33 | <td> |
34 | - <h2><?php printf( esc_html__( 'Hello, %s:', 'event_espresso' ), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]' ); ?></h2> |
|
35 | - <p class="lead"><?php esc_html_e( "We'd like to remind you that you still owe money for the following transaction:", 'event_espresso' ); ?></p> |
|
36 | - <h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3> |
|
34 | + <h2><?php printf(esc_html__('Hello, %s:', 'event_espresso'), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]'); ?></h2> |
|
35 | + <p class="lead"><?php esc_html_e("We'd like to remind you that you still owe money for the following transaction:", 'event_espresso'); ?></p> |
|
36 | + <h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3> |
|
37 | 37 | <ul> |
38 | 38 | <li> |
39 | - <strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS] |
|
39 | + <strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS] |
|
40 | 40 | </li> |
41 | 41 | <li> |
42 | - <strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> [TXN_ID] |
|
42 | + <strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> [TXN_ID] |
|
43 | 43 | </li> |
44 | 44 | <li> |
45 | - <strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST] |
|
45 | + <strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST] |
|
46 | 46 | </li> |
47 | 47 | <li> |
48 | - <strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING] |
|
48 | + <strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING] |
|
49 | 49 | </li> |
50 | 50 | </ul> |
51 | 51 | <p class="callout"> |
52 | - <?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?> |
|
52 | + <?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?> |
|
53 | 53 | </p> |
54 | 54 | [EVENT_LIST] |
55 | 55 | <p class="callout"> |
56 | - <?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?> |
|
56 | + <?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?> |
|
57 | 57 | </p> |
58 | 58 | </td> |
59 | 59 | </tr> |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | <tbody> |
79 | 79 | <tr> |
80 | 80 | <td> |
81 | - <h3><?php esc_html_e( 'Connect with Us:', 'event_espresso' ); ?></h3> |
|
82 | - <a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e( 'Facebook', 'event_espresso' ); ?></a> |
|
83 | - <a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e( 'Twitter', 'event_espresso' ); ?></a> |
|
84 | - <a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e( 'Google+', 'event_espresso' ); ?></a> |
|
81 | + <h3><?php esc_html_e('Connect with Us:', 'event_espresso'); ?></h3> |
|
82 | + <a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e('Facebook', 'event_espresso'); ?></a> |
|
83 | + <a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e('Twitter', 'event_espresso'); ?></a> |
|
84 | + <a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e('Google+', 'event_espresso'); ?></a> |
|
85 | 85 | </td> |
86 | 86 | </tr> |
87 | 87 | </tbody> |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | <tbody> |
92 | 92 | <tr> |
93 | 93 | <td> |
94 | - <h3><?php esc_html_e( 'Contact Info:', 'event_espresso' ); ?></h3> |
|
95 | - <?php esc_html_e( 'Phone:', 'event_espresso' ); ?> <strong>[CO_PHONE]</strong> |
|
96 | - <?php esc_html_e( 'Email:', 'event_espresso' ); ?> |
|
94 | + <h3><?php esc_html_e('Contact Info:', 'event_espresso'); ?></h3> |
|
95 | + <?php esc_html_e('Phone:', 'event_espresso'); ?> <strong>[CO_PHONE]</strong> |
|
96 | + <?php esc_html_e('Email:', 'event_espresso'); ?> |
|
97 | 97 | <strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong> |
98 | 98 | </td> |
99 | 99 | </tr> |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | <tbody> |
32 | 32 | <tr> |
33 | 33 | <td> |
34 | - <h1><?php esc_html_e( 'Payment Reminder Notification', 'event_espresso' ); ?></h1> |
|
35 | - <?php esc_html_e( 'The following message was sent to the Primary Registrant of this transaction:', 'event_espresso' ); ?> |
|
36 | - <h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3> |
|
34 | + <h1><?php esc_html_e('Payment Reminder Notification', 'event_espresso'); ?></h1> |
|
35 | + <?php esc_html_e('The following message was sent to the Primary Registrant of this transaction:', 'event_espresso'); ?> |
|
36 | + <h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3> |
|
37 | 37 | <ul> |
38 | 38 | <li> |
39 | - <strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS] |
|
39 | + <strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS] |
|
40 | 40 | </li> |
41 | - <li><strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> |
|
41 | + <li><strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> |
|
42 | 42 | <a href="[TRANSACTION_ADMIN_URL]">[TXN_ID]</a></li> |
43 | 43 | <li> |
44 | - <strong><?php esc_html_e( 'Payment Gateway:', 'event_espresso' ); ?></strong> [PAYMENT_GATEWAY] |
|
44 | + <strong><?php esc_html_e('Payment Gateway:', 'event_espresso'); ?></strong> [PAYMENT_GATEWAY] |
|
45 | 45 | </li> |
46 | 46 | <li> |
47 | - <strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST] |
|
47 | + <strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST] |
|
48 | 48 | </li> |
49 | 49 | <li> |
50 | - <strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING] |
|
50 | + <strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING] |
|
51 | 51 | </li> |
52 | 52 | </ul> |
53 | 53 | </td> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | </table> |
57 | 57 | </div> |
58 | 58 | <div class="content"> |
59 | - <h2><?php esc_html_e( 'Registrant Details:', 'event_espresso' ); ?></h2> |
|
59 | + <h2><?php esc_html_e('Registrant Details:', 'event_espresso'); ?></h2> |
|
60 | 60 | <p class="callout"><strong>[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]:</strong> |
61 | 61 | <a href="mailto:[PRIMARY_REGISTRANT_EMAIL]">[PRIMARY_REGISTRANT_EMAIL]</a></p> |
62 | 62 | </div> |
@@ -64,14 +64,14 @@ |
||
64 | 64 | //make sure we end up with a copy of the EE_Messages_Addressee object |
65 | 65 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
66 | 66 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
67 | - && is_array( $this->_data ) |
|
68 | - && isset( $this->_data['data'] ) |
|
69 | - && $this->_data['data'] instanceof EE_Messages_Addressee |
|
67 | + && is_array( $this->_data ) |
|
68 | + && isset( $this->_data['data'] ) |
|
69 | + && $this->_data['data'] instanceof EE_Messages_Addressee |
|
70 | 70 | ? $this->_data['data'] : |
71 | 71 | $this->_recipient; |
72 | 72 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && ! empty( $this->_extra_data['data'] ) |
|
74 | - && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
73 | + && ! empty( $this->_extra_data['data'] ) |
|
74 | + && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
75 | 75 | ? $this->_extra_data['data'] |
76 | 76 | : $this->_recipient; |
77 | 77 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -37,58 +37,57 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | protected function _init_props() { |
40 | - $this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' ); |
|
41 | - $this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' ); |
|
40 | + $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
41 | + $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
42 | 42 | $this->_shortcodes = array( |
43 | - '[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ), |
|
44 | - '[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ), |
|
45 | - '[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ), |
|
46 | - '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ), |
|
47 | - '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ), |
|
48 | - '[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ), |
|
49 | - '[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ), |
|
50 | - '[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ), |
|
51 | - '[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ), |
|
52 | - '[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ), |
|
53 | - '[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ), |
|
54 | - '[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ), |
|
55 | - '[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ), |
|
56 | - '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso' ) |
|
43 | + '[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'), |
|
44 | + '[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'), |
|
45 | + '[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'), |
|
46 | + '[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'), |
|
47 | + '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'), |
|
48 | + '[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'), |
|
49 | + '[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'), |
|
50 | + '[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
|
51 | + '[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'), |
|
52 | + '[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
|
53 | + '[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'), |
|
54 | + '[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'), |
|
55 | + '[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'), |
|
56 | + '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso') |
|
57 | 57 | ); |
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | - protected function _parser( $shortcode ) { |
|
62 | + protected function _parser($shortcode) { |
|
63 | 63 | |
64 | 64 | //make sure we end up with a copy of the EE_Messages_Addressee object |
65 | 65 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
66 | 66 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
67 | - && is_array( $this->_data ) |
|
68 | - && isset( $this->_data['data'] ) |
|
67 | + && is_array($this->_data) |
|
68 | + && isset($this->_data['data']) |
|
69 | 69 | && $this->_data['data'] instanceof EE_Messages_Addressee |
70 | - ? $this->_data['data'] : |
|
71 | - $this->_recipient; |
|
70 | + ? $this->_data['data'] : $this->_recipient; |
|
72 | 71 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && ! empty( $this->_extra_data['data'] ) |
|
72 | + && ! empty($this->_extra_data['data']) |
|
74 | 73 | && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
75 | 74 | ? $this->_extra_data['data'] |
76 | 75 | : $this->_recipient; |
77 | 76 | |
78 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) { |
|
77 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) { |
|
79 | 78 | return ''; |
80 | 79 | } |
81 | 80 | |
82 | 81 | $attendee = $this->_recipient->att_obj; |
83 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
82 | + if ( ! $attendee instanceof EE_Attendee) { |
|
84 | 83 | return ''; |
85 | 84 | } |
86 | 85 | |
87 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
88 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
86 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) |
|
87 | + ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] |
|
89 | 88 | : array(); |
90 | 89 | |
91 | - switch ( $shortcode ) { |
|
90 | + switch ($shortcode) { |
|
92 | 91 | case '[RECIPIENT_FNAME]' : |
93 | 92 | return $attendee->fname(); |
94 | 93 | break; |
@@ -102,14 +101,14 @@ discard block |
||
102 | 101 | break; |
103 | 102 | |
104 | 103 | case '[RECIPIENT_REGISTRATION_CODE]' : |
105 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
104 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
106 | 105 | return ''; |
107 | 106 | } |
108 | 107 | return $this->_get_reg_code(); |
109 | 108 | break; |
110 | 109 | |
111 | 110 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
112 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
111 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
113 | 112 | return ''; |
114 | 113 | } |
115 | 114 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
@@ -151,23 +150,23 @@ discard block |
||
151 | 150 | break; |
152 | 151 | } |
153 | 152 | |
154 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
155 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
156 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
153 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
154 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
155 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
157 | 156 | |
158 | 157 | |
159 | 158 | //now let's figure out what question has this text |
160 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
159 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
161 | 160 | return ''; |
162 | 161 | } |
163 | 162 | |
164 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
163 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
165 | 164 | if ( |
166 | 165 | $question instanceof EE_Question |
167 | 166 | && $question->display_text() == $shortcode |
168 | - && isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] ) |
|
167 | + && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]) |
|
169 | 168 | ) { |
170 | - return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
169 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
171 | 170 | } |
172 | 171 | } |
173 | 172 | } |
@@ -198,53 +197,53 @@ discard block |
||
198 | 197 | protected function _get_reg_code() { |
199 | 198 | |
200 | 199 | //if only one related registration for the recipient then just return that reg code. |
201 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
200 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
202 | 201 | return $this->_recipient->reg_obj->reg_code(); |
203 | 202 | } |
204 | 203 | |
205 | 204 | //k more than one registration so let's see if we can get specific to context |
206 | 205 | //are we parsing event_list? |
207 | - if ( $this->_data instanceof EE_Event ) { |
|
206 | + if ($this->_data instanceof EE_Event) { |
|
208 | 207 | $reg_code = array(); |
209 | 208 | //loop through registrations for recipient and see if there is a match for this event |
210 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
211 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
209 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
210 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
212 | 211 | $reg_code[] = $reg->reg_code(); |
213 | 212 | } |
214 | 213 | } |
215 | - return implode( ', ', $reg_code ); |
|
214 | + return implode(', ', $reg_code); |
|
216 | 215 | } |
217 | 216 | |
218 | 217 | //are we parsing ticket list? |
219 | - if ( $this->_data instanceof EE_Ticket ) { |
|
218 | + if ($this->_data instanceof EE_Ticket) { |
|
220 | 219 | $reg_code = array(); |
221 | 220 | //loop through each registration for recipient and see if there is a match for this ticket |
222 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
223 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
221 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
222 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
224 | 223 | $reg_code = $reg->reg_code(); |
225 | 224 | } |
226 | 225 | } |
227 | - return implode( ', ', $reg_code ); |
|
226 | + return implode(', ', $reg_code); |
|
228 | 227 | } |
229 | 228 | |
230 | 229 | //do we have a specific reg_obj? Let's use it |
231 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
230 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
232 | 231 | return $this->_data->reg_obj->reg_code(); |
233 | 232 | } |
234 | 233 | |
235 | 234 | //do we have a specific reg_obj? Let's use it |
236 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
235 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
237 | 236 | return $this->_data->reg_obj->reg_code(); |
238 | 237 | } |
239 | 238 | |
240 | 239 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
241 | 240 | $reg_code = array(); |
242 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
243 | - if ( $reg instanceof EE_Registration ) { |
|
241 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
242 | + if ($reg instanceof EE_Registration) { |
|
244 | 243 | $reg_code[] = $reg->reg_code(); |
245 | 244 | } |
246 | 245 | } |
247 | - return implode( ', ', $reg_code ); |
|
246 | + return implode(', ', $reg_code); |
|
248 | 247 | } |
249 | 248 | |
250 | 249 |