@@ -1,18 +1,18 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | 2 | /** |
3 | - * Event Espresso |
|
4 | - * |
|
5 | - * Event Registration and Management Plugin for WordPress |
|
6 | - * |
|
7 | - * @ package Event Espresso |
|
8 | - * @ author Seth Shoultes |
|
9 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | - * @ link {@link http://www.eventespresso.com} |
|
12 | - * @ since 4.0 |
|
13 | - * |
|
14 | - * ------------------------------------------------------------------------ |
|
15 | - */ |
|
3 | + * Event Espresso |
|
4 | + * |
|
5 | + * Event Registration and Management Plugin for WordPress |
|
6 | + * |
|
7 | + * @ package Event Espresso |
|
8 | + * @ author Seth Shoultes |
|
9 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
10 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
11 | + * @ link {@link http://www.eventespresso.com} |
|
12 | + * @ since 4.0 |
|
13 | + * |
|
14 | + * ------------------------------------------------------------------------ |
|
15 | + */ |
|
16 | 16 | |
17 | 17 | |
18 | 18 | |
@@ -1301,8 +1301,8 @@ discard block |
||
1301 | 1301 | * verifies user access for this admin page |
1302 | 1302 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1303 | 1303 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1304 | - * @return BOOL|wp_die() |
|
1305 | - */ |
|
1304 | + * @return BOOL|wp_die() |
|
1305 | + */ |
|
1306 | 1306 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1307 | 1307 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1308 | 1308 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1689,11 +1689,11 @@ discard block |
||
1689 | 1689 | |
1690 | 1690 | |
1691 | 1691 | /** |
1692 | - * admin_footer_scripts_eei18n_js_strings |
|
1693 | - * |
|
1694 | - * @access public |
|
1695 | - * @return void |
|
1696 | - */ |
|
1692 | + * admin_footer_scripts_eei18n_js_strings |
|
1693 | + * |
|
1694 | + * @access public |
|
1695 | + * @return void |
|
1696 | + */ |
|
1697 | 1697 | public function admin_footer_scripts_eei18n_js_strings() { |
1698 | 1698 | |
1699 | 1699 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1749,11 +1749,11 @@ discard block |
||
1749 | 1749 | |
1750 | 1750 | |
1751 | 1751 | /** |
1752 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1753 | - * |
|
1754 | - * @access public |
|
1755 | - * @return void |
|
1756 | - */ |
|
1752 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1753 | + * |
|
1754 | + * @access public |
|
1755 | + * @return void |
|
1756 | + */ |
|
1757 | 1757 | public function add_xdebug_style() { |
1758 | 1758 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1759 | 1759 | } |
@@ -1810,9 +1810,9 @@ discard block |
||
1810 | 1810 | |
1811 | 1811 | /** |
1812 | 1812 | * set current view for List Table |
1813 | - * @access public |
|
1814 | - * @return array |
|
1815 | - */ |
|
1813 | + * @access public |
|
1814 | + * @return array |
|
1815 | + */ |
|
1816 | 1816 | protected function _set_list_table_view() { |
1817 | 1817 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1818 | 1818 | |
@@ -1889,7 +1889,7 @@ discard block |
||
1889 | 1889 | * @access protected |
1890 | 1890 | * @param int $max_entries total number of rows in the table |
1891 | 1891 | * @return string |
1892 | - */ |
|
1892 | + */ |
|
1893 | 1893 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1894 | 1894 | |
1895 | 1895 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1934,9 +1934,9 @@ discard block |
||
1934 | 1934 | |
1935 | 1935 | /** |
1936 | 1936 | * _set_search_attributes |
1937 | - * @access protected |
|
1938 | - * @return void |
|
1939 | - */ |
|
1937 | + * @access protected |
|
1938 | + * @return void |
|
1939 | + */ |
|
1940 | 1940 | public function _set_search_attributes() { |
1941 | 1941 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1942 | 1942 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1957 | 1957 | * @access private |
1958 | 1958 | * @return void |
1959 | - */ |
|
1959 | + */ |
|
1960 | 1960 | private function _add_registered_meta_boxes() { |
1961 | 1961 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1962 | 1962 | |
@@ -2216,9 +2216,9 @@ discard block |
||
2216 | 2216 | |
2217 | 2217 | /** |
2218 | 2218 | * displays an error message to ppl who have javascript disabled |
2219 | - * @access private |
|
2220 | - * @return string |
|
2221 | - */ |
|
2219 | + * @access private |
|
2220 | + * @return string |
|
2221 | + */ |
|
2222 | 2222 | private function _display_no_javascript_warning() { |
2223 | 2223 | ?> |
2224 | 2224 | <noscript> |
@@ -2241,9 +2241,9 @@ discard block |
||
2241 | 2241 | |
2242 | 2242 | /** |
2243 | 2243 | * displays espresso success and/or error notices |
2244 | - * @access private |
|
2245 | - * @return string |
|
2246 | - */ |
|
2244 | + * @access private |
|
2245 | + * @return string |
|
2246 | + */ |
|
2247 | 2247 | private function _display_espresso_notices() { |
2248 | 2248 | $notices = $this->_get_transient( TRUE ); |
2249 | 2249 | echo stripslashes($notices); |
@@ -2255,10 +2255,10 @@ discard block |
||
2255 | 2255 | |
2256 | 2256 | |
2257 | 2257 | /** |
2258 | - * spinny things pacify the masses |
|
2259 | - * @access private |
|
2260 | - * @return string |
|
2261 | - */ |
|
2258 | + * spinny things pacify the masses |
|
2259 | + * @access private |
|
2260 | + * @return string |
|
2261 | + */ |
|
2262 | 2262 | protected function _add_admin_page_ajax_loading_img() { |
2263 | 2263 | ?> |
2264 | 2264 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2272,10 +2272,10 @@ discard block |
||
2272 | 2272 | |
2273 | 2273 | |
2274 | 2274 | /** |
2275 | - * add admin page overlay for modal boxes |
|
2276 | - * @access private |
|
2277 | - * @return string |
|
2278 | - */ |
|
2275 | + * add admin page overlay for modal boxes |
|
2276 | + * @access private |
|
2277 | + * @return string |
|
2278 | + */ |
|
2279 | 2279 | protected function _add_admin_page_overlay() { |
2280 | 2280 | ?> |
2281 | 2281 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2337,10 +2337,10 @@ discard block |
||
2337 | 2337 | |
2338 | 2338 | |
2339 | 2339 | /** |
2340 | - * generates HTML wrapper for an admin details page |
|
2341 | - * @access public |
|
2342 | - * @return void |
|
2343 | - */ |
|
2340 | + * generates HTML wrapper for an admin details page |
|
2341 | + * @access public |
|
2342 | + * @return void |
|
2343 | + */ |
|
2344 | 2344 | public function display_admin_page_with_sidebar() { |
2345 | 2345 | |
2346 | 2346 | $this->_display_admin_page(TRUE); |
@@ -2350,10 +2350,10 @@ discard block |
||
2350 | 2350 | |
2351 | 2351 | |
2352 | 2352 | /** |
2353 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2354 | - * @access public |
|
2355 | - * @return void |
|
2356 | - */ |
|
2353 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2354 | + * @access public |
|
2355 | + * @return void |
|
2356 | + */ |
|
2357 | 2357 | public function display_admin_page_with_no_sidebar() { |
2358 | 2358 | $this->_display_admin_page(); |
2359 | 2359 | } |
@@ -2577,11 +2577,11 @@ discard block |
||
2577 | 2577 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2578 | 2578 | if ( NULL === error_get_last() || ! headers_sent() ) |
2579 | 2579 | header('Content-Type: application/json; charset=UTF-8'); |
2580 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2581 | - echo wp_json_encode( $json ); |
|
2582 | - } else { |
|
2583 | - echo json_encode( $json ); |
|
2584 | - } |
|
2580 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2581 | + echo wp_json_encode( $json ); |
|
2582 | + } else { |
|
2583 | + echo json_encode( $json ); |
|
2584 | + } |
|
2585 | 2585 | exit(); |
2586 | 2586 | } |
2587 | 2587 | |
@@ -2620,11 +2620,11 @@ discard block |
||
2620 | 2620 | |
2621 | 2621 | |
2622 | 2622 | /** |
2623 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2624 | - * @access public |
|
2625 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2626 | - * @return void |
|
2627 | - */ |
|
2623 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2624 | + * @access public |
|
2625 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2626 | + * @return void |
|
2627 | + */ |
|
2628 | 2628 | public function admin_page_wrapper($about = FALSE) { |
2629 | 2629 | |
2630 | 2630 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2678,15 +2678,15 @@ discard block |
||
2678 | 2678 | |
2679 | 2679 | |
2680 | 2680 | /** |
2681 | - * sort nav tabs |
|
2682 | - * @access public |
|
2683 | - * @return void |
|
2684 | - */ |
|
2681 | + * sort nav tabs |
|
2682 | + * @access public |
|
2683 | + * @return void |
|
2684 | + */ |
|
2685 | 2685 | private function _sort_nav_tabs( $a, $b ) { |
2686 | 2686 | if ($a['order'] == $b['order']) { |
2687 | - return 0; |
|
2688 | - } |
|
2689 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2687 | + return 0; |
|
2688 | + } |
|
2689 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2690 | 2690 | } |
2691 | 2691 | |
2692 | 2692 |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
148 | 148 | * @access public |
149 | 149 | */ |
150 | - public function __construct( $routing = TRUE ) { |
|
150 | + public function __construct($routing = TRUE) { |
|
151 | 151 | |
152 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
152 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
153 | 153 | $this->_is_caf = TRUE; |
154 | 154 | |
155 | 155 | $this->_yes_no_values = array( |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | |
162 | 162 | //set the _req_data property. |
163 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
163 | + $this->_req_data = array_merge($_GET, $_POST); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | //routing enabled? |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->_do_other_page_hooks(); |
182 | 182 | |
183 | 183 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
184 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
184 | + if (method_exists($this, '_before_page_setup')) |
|
185 | 185 | $this->_before_page_setup(); |
186 | 186 | |
187 | 187 | //set up page dependencies |
@@ -451,16 +451,16 @@ discard block |
||
451 | 451 | */ |
452 | 452 | protected function _global_ajax_hooks() { |
453 | 453 | //for lazy loading of metabox content |
454 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
454 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | 459 | public function ajax_metabox_content() { |
460 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
461 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
460 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
461 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
462 | 462 | |
463 | - self::cached_rss_display( $contentid, $url ); |
|
463 | + self::cached_rss_display($contentid, $url); |
|
464 | 464 | wp_die(); |
465 | 465 | } |
466 | 466 | |
@@ -479,87 +479,87 @@ discard block |
||
479 | 479 | //requires? |
480 | 480 | |
481 | 481 | //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. |
482 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
482 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
483 | 483 | |
484 | 484 | |
485 | 485 | //next verify if we need to load anything... |
486 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : FALSE; |
|
487 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
486 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : FALSE; |
|
487 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
488 | 488 | |
489 | 489 | global $ee_menu_slugs; |
490 | 490 | $ee_menu_slugs = (array) $ee_menu_slugs; |
491 | 491 | |
492 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
492 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
493 | 493 | |
494 | 494 | |
495 | 495 | // 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 |
496 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
497 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
496 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
497 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
498 | 498 | } |
499 | 499 | // then set blank or -1 action values to 'default' |
500 | - $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'; |
|
500 | + $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'; |
|
501 | 501 | |
502 | 502 | //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. |
503 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
503 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
504 | 504 | |
505 | 505 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
506 | 506 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
507 | 507 | |
508 | 508 | $this->_current_view = $this->_req_action; |
509 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
509 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
510 | 510 | $this->_define_page_props(); |
511 | 511 | |
512 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
512 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
513 | 513 | |
514 | 514 | //default things |
515 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
515 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
516 | 516 | |
517 | 517 | //set page configs |
518 | 518 | $this->_set_page_routes(); |
519 | 519 | $this->_set_page_config(); |
520 | 520 | |
521 | 521 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
522 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
522 | + if (isset($this->_req_data['wp_referer'])) { |
|
523 | 523 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
524 | 524 | } |
525 | 525 | |
526 | 526 | //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 |
527 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
527 | + if (method_exists($this, '_extend_page_config')) |
|
528 | 528 | $this->_extend_page_config(); |
529 | 529 | |
530 | 530 | //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. |
531 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
531 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
532 | 532 | $this->_extend_page_config_for_cpt(); |
533 | 533 | |
534 | 534 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
535 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
536 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
535 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
536 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
537 | 537 | |
538 | 538 | |
539 | 539 | //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 |
540 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
541 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
540 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
541 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
545 | 545 | //next route only if routing enabled |
546 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
546 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
547 | 547 | |
548 | 548 | $this->_verify_routes(); |
549 | 549 | |
550 | 550 | //next let's just check user_access and kill if no access |
551 | 551 | $this->check_user_access(); |
552 | 552 | |
553 | - if ( $this->_is_UI_request ) { |
|
553 | + if ($this->_is_UI_request) { |
|
554 | 554 | //admin_init stuff - global, all views for this page class, specific view |
555 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
556 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
557 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
555 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
556 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
557 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | } else { |
561 | 561 | //hijack regular WP loading and route admin request immediately |
562 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
562 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
563 | 563 | $this->route_admin_request(); |
564 | 564 | } |
565 | 565 | } |
@@ -576,18 +576,18 @@ discard block |
||
576 | 576 | * @return void |
577 | 577 | */ |
578 | 578 | private function _do_other_page_hooks() { |
579 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
579 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
580 | 580 | |
581 | - foreach ( $registered_pages as $page ) { |
|
581 | + foreach ($registered_pages as $page) { |
|
582 | 582 | |
583 | 583 | //now let's setup the file name and class that should be present |
584 | 584 | $classname = str_replace('.class.php', '', $page); |
585 | 585 | |
586 | 586 | //autoloaders should take care of loading file |
587 | - if ( !class_exists( $classname ) ) { |
|
588 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
589 | - $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 ); |
|
590 | - throw new EE_Error( implode( '||', $error_msg )); |
|
587 | + if ( ! class_exists($classname)) { |
|
588 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
589 | + $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); |
|
590 | + throw new EE_Error(implode('||', $error_msg)); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | $a = new ReflectionClass($classname); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | public function load_page_dependencies() { |
603 | 603 | try { |
604 | 604 | $this->_load_page_dependencies(); |
605 | - } catch ( EE_Error $e ) { |
|
605 | + } catch (EE_Error $e) { |
|
606 | 606 | $e->get_error(); |
607 | 607 | } |
608 | 608 | } |
@@ -620,16 +620,16 @@ discard block |
||
620 | 620 | $this->_current_screen = get_current_screen(); |
621 | 621 | |
622 | 622 | //load admin_notices - global, page class, and view specific |
623 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
624 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
625 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
626 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
623 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
624 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
625 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
626 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | //load network admin_notices - global, page class, and view specific |
630 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
631 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
632 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
630 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
631 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
632 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | //this will save any per_page screen options if they are present |
@@ -645,8 +645,8 @@ discard block |
||
645 | 645 | //add screen options - global, page child class, and view specific |
646 | 646 | $this->_add_global_screen_options(); |
647 | 647 | $this->_add_screen_options(); |
648 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
649 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
648 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
649 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
650 | 650 | |
651 | 651 | |
652 | 652 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -657,33 +657,33 @@ discard block |
||
657 | 657 | //add feature_pointers - global, page child class, and view specific |
658 | 658 | $this->_add_feature_pointers(); |
659 | 659 | $this->_add_global_feature_pointers(); |
660 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
661 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
660 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
661 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
662 | 662 | |
663 | 663 | //enqueue scripts/styles - global, page class, and view specific |
664 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
665 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
666 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
667 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
664 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
665 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
666 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
667 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
668 | 668 | |
669 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
669 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
670 | 670 | |
671 | 671 | //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 |
672 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
673 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
674 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
675 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
672 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
673 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
674 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
675 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
676 | 676 | |
677 | 677 | //admin footer scripts |
678 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
679 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
680 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
681 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
678 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
679 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
680 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
681 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
682 | 682 | |
683 | 683 | |
684 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
684 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
685 | 685 | //targeted hook |
686 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
686 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
687 | 687 | |
688 | 688 | } |
689 | 689 | |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | private function _set_defaults() { |
699 | 699 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
700 | 700 | |
701 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
701 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
702 | 702 | |
703 | 703 | $this->default_nav_tab_name = 'overview'; |
704 | 704 | |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | public function route_admin_request() { |
726 | 726 | try { |
727 | 727 | $this->_route_admin_request(); |
728 | - } catch ( EE_Error $e ) { |
|
728 | + } catch (EE_Error $e) { |
|
729 | 729 | $e->get_error(); |
730 | 730 | } |
731 | 731 | } |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $this->_wp_page_slug = $wp_page_slug; |
737 | 737 | |
738 | 738 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
739 | - if ( is_network_admin() ) { |
|
739 | + if (is_network_admin()) { |
|
740 | 740 | $this->_wp_page_slug .= '-network'; |
741 | 741 | } |
742 | 742 | } |
@@ -749,53 +749,53 @@ discard block |
||
749 | 749 | * @return void |
750 | 750 | */ |
751 | 751 | protected function _verify_routes() { |
752 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
752 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
753 | 753 | |
754 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
754 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
755 | 755 | |
756 | 756 | $this->_route = FALSE; |
757 | 757 | $func = FALSE; |
758 | 758 | $args = array(); |
759 | 759 | |
760 | 760 | // check that the page_routes array is not empty |
761 | - if ( empty( $this->_page_routes )) { |
|
761 | + if (empty($this->_page_routes)) { |
|
762 | 762 | // user error msg |
763 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
763 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
764 | 764 | // developer error msg |
765 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
766 | - throw new EE_Error( $error_msg ); |
|
765 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
766 | + throw new EE_Error($error_msg); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | // and that the requested page route exists |
770 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
771 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
770 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
771 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
772 | 772 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
773 | 773 | } else { |
774 | 774 | // user error msg |
775 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
775 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
776 | 776 | // developer error msg |
777 | - $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 ); |
|
778 | - throw new EE_Error( $error_msg ); |
|
777 | + $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); |
|
778 | + throw new EE_Error($error_msg); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | // and that a default route exists |
782 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
782 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
783 | 783 | // user error msg |
784 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
784 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
785 | 785 | // developer error msg |
786 | - $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' ); |
|
787 | - throw new EE_Error( $error_msg ); |
|
786 | + $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'); |
|
787 | + throw new EE_Error($error_msg); |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | |
791 | 791 | //first lets' catch if the UI request has EVER been set. |
792 | - if ( $this->_is_UI_request === NULL ) { |
|
792 | + if ($this->_is_UI_request === NULL) { |
|
793 | 793 | //lets set if this is a UI request or not. |
794 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
794 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
795 | 795 | |
796 | 796 | |
797 | 797 | //wait a minute... we might have a noheader in the route array |
798 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
798 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | $this->_set_current_labels(); |
@@ -810,15 +810,15 @@ discard block |
||
810 | 810 | * @param string $route the route name we're verifying |
811 | 811 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
812 | 812 | */ |
813 | - protected function _verify_route( $route ) { |
|
814 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
813 | + protected function _verify_route($route) { |
|
814 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
815 | 815 | return true; |
816 | 816 | } else { |
817 | 817 | // user error msg |
818 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
818 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
819 | 819 | // developer error msg |
820 | - $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 ); |
|
821 | - throw new EE_Error( $error_msg ); |
|
820 | + $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); |
|
821 | + throw new EE_Error($error_msg); |
|
822 | 822 | } |
823 | 823 | } |
824 | 824 | |
@@ -832,18 +832,18 @@ discard block |
||
832 | 832 | * @param string $nonce_ref The nonce reference string (name0) |
833 | 833 | * @return mixed (bool|die) |
834 | 834 | */ |
835 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
835 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
836 | 836 | // verify nonce against expected value |
837 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
837 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
838 | 838 | // these are not the droids you are looking for !!! |
839 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
840 | - if ( WP_DEBUG ) { |
|
841 | - $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__ ); |
|
839 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
840 | + if (WP_DEBUG) { |
|
841 | + $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__); |
|
842 | 842 | } |
843 | - if ( ! defined( 'DOING_AJAX' )) { |
|
844 | - wp_die( $msg ); |
|
843 | + if ( ! defined('DOING_AJAX')) { |
|
844 | + wp_die($msg); |
|
845 | 845 | } else { |
846 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
846 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
847 | 847 | $this->_return_json(); |
848 | 848 | } |
849 | 849 | } |
@@ -861,63 +861,63 @@ discard block |
||
861 | 861 | * @return void |
862 | 862 | */ |
863 | 863 | protected function _route_admin_request() { |
864 | - if ( ! $this->_is_UI_request ) |
|
864 | + if ( ! $this->_is_UI_request) |
|
865 | 865 | $this->_verify_routes(); |
866 | 866 | |
867 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
867 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
868 | 868 | |
869 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
869 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
870 | 870 | // set nonce from post data |
871 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
872 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
871 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
872 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
873 | 873 | } |
874 | 874 | //set the nav_tabs array but ONLY if this is UI_request |
875 | - if ( $this->_is_UI_request ) |
|
875 | + if ($this->_is_UI_request) |
|
876 | 876 | $this->_set_nav_tabs(); |
877 | 877 | |
878 | 878 | // grab callback function |
879 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
879 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
880 | 880 | |
881 | 881 | // check if callback has args |
882 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
882 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
883 | 883 | |
884 | 884 | $error_msg = ''; |
885 | 885 | |
886 | 886 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
887 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
888 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
887 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
888 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | //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). |
892 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
892 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
893 | 893 | |
894 | - if ( ! empty( $func )) { |
|
894 | + if ( ! empty($func)) { |
|
895 | 895 | $base_call = $addon_call = FALSE; |
896 | 896 | //try to access page route via this class |
897 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
897 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
898 | 898 | // user error msg |
899 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
899 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
900 | 900 | // developer error msg |
901 | - $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 ); |
|
901 | + $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); |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | //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) |
905 | 905 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
906 | 906 | |
907 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
908 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
909 | - $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 ); |
|
907 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
908 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
909 | + $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); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | |
913 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
914 | - throw new EE_Error( $error_msg ); |
|
913 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
914 | + throw new EE_Error($error_msg); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | //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. |
918 | 918 | //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. |
919 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
920 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
919 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
920 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
921 | 921 | } |
922 | 922 | } |
923 | 923 | |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | * @param string $new_route New (non header) route to redirect to. |
934 | 934 | * @return void |
935 | 935 | */ |
936 | - protected function _reset_routing_properties( $new_route ) { |
|
936 | + protected function _reset_routing_properties($new_route) { |
|
937 | 937 | $this->_is_UI_request = TRUE; |
938 | 938 | //now we set the current route to whatever the headers_sent_route is set at |
939 | 939 | $this->_req_data['action'] = $new_route; |
@@ -979,23 +979,23 @@ discard block |
||
979 | 979 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
980 | 980 | * @return string |
981 | 981 | */ |
982 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
982 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
983 | 983 | |
984 | 984 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
985 | - if ( $sticky ) { |
|
985 | + if ($sticky) { |
|
986 | 986 | $request = $_REQUEST; |
987 | - unset( $request['_wp_http_referer'] ); |
|
988 | - unset( $request['wp_referer'] ); |
|
989 | - foreach ( $request as $key => $value ) { |
|
987 | + unset($request['_wp_http_referer']); |
|
988 | + unset($request['wp_referer']); |
|
989 | + foreach ($request as $key => $value) { |
|
990 | 990 | //do not add nonces |
991 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
991 | + if (strpos($key, 'nonce') !== false) { |
|
992 | 992 | continue; |
993 | 993 | } |
994 | - $args['wp_referer[' . $key . ']'] = $value; |
|
994 | + $args['wp_referer['.$key.']'] = $value; |
|
995 | 995 | } |
996 | 996 | } |
997 | 997 | |
998 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
998 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | |
@@ -1011,8 +1011,8 @@ discard block |
||
1011 | 1011 | * @uses EEH_Template::get_help_tab_link() |
1012 | 1012 | * @return string generated link |
1013 | 1013 | */ |
1014 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1015 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1014 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1015 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1029,30 +1029,30 @@ discard block |
||
1029 | 1029 | */ |
1030 | 1030 | protected function _add_help_tabs() { |
1031 | 1031 | $tour_buttons = ''; |
1032 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1032 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1033 | 1033 | $config = $this->_page_config[$this->_req_action]; |
1034 | 1034 | |
1035 | 1035 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1036 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1036 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1037 | 1037 | $tb = array(); |
1038 | 1038 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1039 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1039 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1040 | 1040 | //if this is the end tour then we don't need to setup a button |
1041 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1041 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1042 | 1042 | continue; |
1043 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1043 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1044 | 1044 | } |
1045 | 1045 | $tour_buttons .= implode('<br />', $tb); |
1046 | 1046 | $tour_buttons .= '</div></div>'; |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1050 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1050 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1051 | 1051 | //check that the callback given is valid |
1052 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1053 | - 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) ) ); |
|
1052 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1053 | + 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))); |
|
1054 | 1054 | |
1055 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1055 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1056 | 1056 | |
1057 | 1057 | $content .= $tour_buttons; //add help tour buttons. |
1058 | 1058 | |
@@ -1061,49 +1061,49 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1064 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1064 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1065 | 1065 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1069 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1069 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1070 | 1070 | $_ht['id'] = $this->page_slug; |
1071 | 1071 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1072 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1072 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1073 | 1073 | $this->_current_screen->add_help_tab($_ht); |
1074 | 1074 | }/**/ |
1075 | 1075 | |
1076 | 1076 | |
1077 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1077 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1078 | 1078 | |
1079 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1079 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1080 | 1080 | //we're here so there ARE help tabs! |
1081 | 1081 | |
1082 | 1082 | //make sure we've got what we need |
1083 | - if ( !isset( $cfg['title'] ) ) |
|
1084 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1083 | + if ( ! isset($cfg['title'])) |
|
1084 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1085 | 1085 | |
1086 | 1086 | |
1087 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1088 | - 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') ); |
|
1087 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1088 | + 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')); |
|
1089 | 1089 | |
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | //first priority goes to content. |
1093 | - if ( !empty($cfg['content'] ) ) { |
|
1094 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1093 | + if ( ! empty($cfg['content'])) { |
|
1094 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1095 | 1095 | |
1096 | 1096 | //second priority goes to filename |
1097 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1098 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1097 | + } else if ( ! empty($cfg['filename'])) { |
|
1098 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1099 | 1099 | |
1100 | 1100 | |
1101 | 1101 | //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) |
1102 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1102 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1103 | 1103 | |
1104 | 1104 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1105 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1106 | - 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__ ); |
|
1105 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1106 | + 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__); |
|
1107 | 1107 | return; |
1108 | 1108 | } |
1109 | 1109 | $template_args['admin_page_obj'] = $this; |
@@ -1114,21 +1114,21 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | |
1116 | 1116 | //check if callback is valid |
1117 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1118 | - 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__ ); |
|
1117 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1118 | + 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__); |
|
1119 | 1119 | return; |
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | //setup config array for help tab method |
1123 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1123 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1124 | 1124 | $_ht = array( |
1125 | 1125 | 'id' => $id, |
1126 | 1126 | 'title' => $cfg['title'], |
1127 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1127 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1128 | 1128 | 'content' => $content |
1129 | 1129 | ); |
1130 | 1130 | |
1131 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1131 | + $this->_current_screen->add_help_tab($_ht); |
|
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | } |
@@ -1148,49 +1148,49 @@ discard block |
||
1148 | 1148 | $this->_help_tour = array(); |
1149 | 1149 | |
1150 | 1150 | //exit early if help tours are turned off globally |
1151 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1151 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1152 | 1152 | return; |
1153 | 1153 | |
1154 | 1154 | //loop through _page_config to find any help_tour defined |
1155 | - foreach ( $this->_page_config as $route => $config ) { |
|
1155 | + foreach ($this->_page_config as $route => $config) { |
|
1156 | 1156 | //we're only going to set things up for this route |
1157 | - if ( $route !== $this->_req_action ) |
|
1157 | + if ($route !== $this->_req_action) |
|
1158 | 1158 | continue; |
1159 | 1159 | |
1160 | - if ( isset( $config['help_tour'] ) ) { |
|
1160 | + if (isset($config['help_tour'])) { |
|
1161 | 1161 | |
1162 | - foreach( $config['help_tour'] as $tour ) { |
|
1163 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1162 | + foreach ($config['help_tour'] as $tour) { |
|
1163 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1164 | 1164 | //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 |
1165 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1165 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1166 | 1166 | |
1167 | 1167 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1168 | - if ( !is_readable($file_path) ) { |
|
1169 | - 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__ ); |
|
1168 | + if ( ! is_readable($file_path)) { |
|
1169 | + 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__); |
|
1170 | 1170 | return; |
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | require_once $file_path; |
1174 | - if ( !class_exists( $tour ) ) { |
|
1175 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1176 | - $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) ); |
|
1177 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1174 | + if ( ! class_exists($tour)) { |
|
1175 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1176 | + $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)); |
|
1177 | + throw new EE_Error(implode('||', $error_msg)); |
|
1178 | 1178 | } |
1179 | 1179 | $a = new ReflectionClass($tour); |
1180 | 1180 | $tour_obj = $a->newInstance($this->_is_caf); |
1181 | 1181 | |
1182 | 1182 | $tours[] = $tour_obj; |
1183 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1183 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1187 | 1187 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1188 | 1188 | $tours[] = $end_stop_tour; |
1189 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1189 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1190 | 1190 | } |
1191 | 1191 | } |
1192 | 1192 | |
1193 | - if ( !empty( $tours ) ) |
|
1193 | + if ( ! empty($tours)) |
|
1194 | 1194 | $this->_help_tour['tours'] = $tours; |
1195 | 1195 | |
1196 | 1196 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1206,12 +1206,12 @@ discard block |
||
1206 | 1206 | * @return void |
1207 | 1207 | */ |
1208 | 1208 | protected function _add_qtips() { |
1209 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1209 | + if (isset($this->_route_config['qtips'])) { |
|
1210 | 1210 | $qtips = (array) $this->_route_config['qtips']; |
1211 | 1211 | //load qtip loader |
1212 | 1212 | $path = array( |
1213 | - $this->_get_dir() . '/qtips/', |
|
1214 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1213 | + $this->_get_dir().'/qtips/', |
|
1214 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1215 | 1215 | ); |
1216 | 1216 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1217 | 1217 | } |
@@ -1228,41 +1228,41 @@ discard block |
||
1228 | 1228 | * @return void |
1229 | 1229 | */ |
1230 | 1230 | protected function _set_nav_tabs() { |
1231 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1231 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1232 | 1232 | $i = 0; |
1233 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1234 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1233 | + foreach ($this->_page_config as $slug => $config) { |
|
1234 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1235 | 1235 | continue; //no nav tab for this config |
1236 | 1236 | |
1237 | 1237 | //check for persistent flag |
1238 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1238 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1239 | 1239 | continue; //nav tab is only to appear when route requested. |
1240 | 1240 | |
1241 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1241 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1242 | 1242 | continue; //no nav tab becasue current user does not have access. |
1243 | 1243 | |
1244 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1244 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1245 | 1245 | $this->_nav_tabs[$slug] = array( |
1246 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1247 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1248 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1249 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1246 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1247 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1248 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1249 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1250 | 1250 | ); |
1251 | 1251 | $i++; |
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | //if $this->_nav_tabs is empty then lets set the default |
1255 | - if ( empty( $this->_nav_tabs ) ) { |
|
1255 | + if (empty($this->_nav_tabs)) { |
|
1256 | 1256 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1257 | 1257 | 'url' => $this->admin_base_url, |
1258 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1258 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1259 | 1259 | 'css_class' => 'nav-tab-active', |
1260 | 1260 | 'order' => 10 |
1261 | 1261 | ); |
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | //now let's sort the tabs according to order |
1265 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1265 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1266 | 1266 | |
1267 | 1267 | } |
1268 | 1268 | |
@@ -1278,10 +1278,10 @@ discard block |
||
1278 | 1278 | * @return void |
1279 | 1279 | */ |
1280 | 1280 | private function _set_current_labels() { |
1281 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1282 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1283 | - if ( is_array($text) ) { |
|
1284 | - foreach ( $text as $sublabel => $subtext ) { |
|
1281 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1282 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1283 | + if (is_array($text)) { |
|
1284 | + foreach ($text as $sublabel => $subtext) { |
|
1285 | 1285 | $this->_labels[$label][$sublabel] = $subtext; |
1286 | 1286 | } |
1287 | 1287 | } else { |
@@ -1302,24 +1302,24 @@ discard block |
||
1302 | 1302 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1303 | 1303 | * @return BOOL|wp_die() |
1304 | 1304 | */ |
1305 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1306 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1307 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1308 | - $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; |
|
1305 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1306 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1307 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1308 | + $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; |
|
1309 | 1309 | |
1310 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1311 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1310 | + if (empty($capability) && empty($route_to_check)) { |
|
1311 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1312 | 1312 | } else { |
1313 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1313 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1316 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1317 | 1317 | |
1318 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1319 | - if ( $verify_only ) { |
|
1318 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1319 | + if ($verify_only) { |
|
1320 | 1320 | return FALSE; |
1321 | 1321 | } else { |
1322 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1322 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1323 | 1323 | } |
1324 | 1324 | } |
1325 | 1325 | return TRUE; |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | $this->_add_admin_page_overlay(); |
1397 | 1397 | |
1398 | 1398 | //if metaboxes are present we need to add the nonce field |
1399 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1399 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1400 | 1400 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1401 | 1401 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1402 | 1402 | } |
@@ -1415,19 +1415,19 @@ discard block |
||
1415 | 1415 | */ |
1416 | 1416 | public function admin_footer_global() { |
1417 | 1417 | //dialog container for dialog helper |
1418 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1418 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1419 | 1419 | $d_cont .= '<div class="ee-notices"></div>'; |
1420 | 1420 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1421 | 1421 | $d_cont .= '</div>'; |
1422 | 1422 | echo $d_cont; |
1423 | 1423 | |
1424 | 1424 | //help tour stuff? |
1425 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1425 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1426 | 1426 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | //current set timezone for timezone js |
1430 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1430 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1431 | 1431 | } |
1432 | 1432 | |
1433 | 1433 | |
@@ -1451,18 +1451,18 @@ discard block |
||
1451 | 1451 | * @access protected |
1452 | 1452 | * @return string content |
1453 | 1453 | */ |
1454 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1454 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1455 | 1455 | $content = ''; |
1456 | 1456 | |
1457 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1458 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1457 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1458 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1459 | 1459 | |
1460 | 1460 | |
1461 | 1461 | //loop through the array and setup content |
1462 | - foreach ( $help_array as $trigger => $help ) { |
|
1462 | + foreach ($help_array as $trigger => $help) { |
|
1463 | 1463 | //make sure the array is setup properly |
1464 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1465 | - 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') ); |
|
1464 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1465 | + 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')); |
|
1466 | 1466 | } |
1467 | 1467 | |
1468 | 1468 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1472,10 +1472,10 @@ discard block |
||
1472 | 1472 | 'help_popup_content' => $help['content'] |
1473 | 1473 | ); |
1474 | 1474 | |
1475 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1475 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | - if ( $display ) |
|
1478 | + if ($display) |
|
1479 | 1479 | echo $content; |
1480 | 1480 | else |
1481 | 1481 | return $content; |
@@ -1492,18 +1492,18 @@ discard block |
||
1492 | 1492 | */ |
1493 | 1493 | private function _get_help_content() { |
1494 | 1494 | //what is the method we're looking for? |
1495 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1495 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1496 | 1496 | |
1497 | 1497 | //if method doesn't exist let's get out. |
1498 | - if ( !method_exists( $this, $method_name ) ) |
|
1498 | + if ( ! method_exists($this, $method_name)) |
|
1499 | 1499 | return array(); |
1500 | 1500 | |
1501 | 1501 | //k we're good to go let's retrieve the help array |
1502 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1502 | + $help_array = call_user_func(array($this, $method_name)); |
|
1503 | 1503 | |
1504 | 1504 | //make sure we've got an array! |
1505 | - if ( !is_array($help_array) ) { |
|
1506 | - 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' ) ); |
|
1505 | + if ( ! is_array($help_array)) { |
|
1506 | + 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')); |
|
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | return $help_array; |
@@ -1525,27 +1525,27 @@ discard block |
||
1525 | 1525 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1526 | 1526 | * @return string |
1527 | 1527 | */ |
1528 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1528 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1529 | 1529 | |
1530 | - if ( defined('DOING_AJAX') ) return; |
|
1530 | + if (defined('DOING_AJAX')) return; |
|
1531 | 1531 | |
1532 | 1532 | //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 |
1533 | 1533 | $help_array = $this->_get_help_content(); |
1534 | 1534 | $help_content = ''; |
1535 | 1535 | |
1536 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1536 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1537 | 1537 | $help_array[$trigger_id] = array( |
1538 | 1538 | 'title' => __('Missing Content', 'event_espresso'), |
1539 | 1539 | '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') |
1540 | 1540 | ); |
1541 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1541 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1542 | 1542 | } |
1543 | 1543 | |
1544 | 1544 | //let's setup the trigger |
1545 | - $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>'; |
|
1546 | - $content = $content . $help_content; |
|
1545 | + $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>'; |
|
1546 | + $content = $content.$help_content; |
|
1547 | 1547 | |
1548 | - if ( $display ) |
|
1548 | + if ($display) |
|
1549 | 1549 | echo $content; |
1550 | 1550 | else |
1551 | 1551 | return $content; |
@@ -1602,15 +1602,15 @@ discard block |
||
1602 | 1602 | public function load_global_scripts_styles() { |
1603 | 1603 | /** STYLES **/ |
1604 | 1604 | // add debugging styles |
1605 | - if ( WP_DEBUG ) { |
|
1606 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1605 | + if (WP_DEBUG) { |
|
1606 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1607 | 1607 | } |
1608 | 1608 | |
1609 | 1609 | //register all styles |
1610 | - 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 ); |
|
1611 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1610 | + 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); |
|
1611 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1612 | 1612 | //helpers styles |
1613 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1613 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1614 | 1614 | //enqueue global styles |
1615 | 1615 | wp_enqueue_style('ee-admin-css'); |
1616 | 1616 | |
@@ -1618,66 +1618,66 @@ discard block |
||
1618 | 1618 | /** SCRIPTS **/ |
1619 | 1619 | |
1620 | 1620 | //register all scripts |
1621 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1622 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1623 | - 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 ); |
|
1621 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1622 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1623 | + 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); |
|
1624 | 1624 | |
1625 | - 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 ); |
|
1625 | + 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); |
|
1626 | 1626 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1627 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1627 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1628 | 1628 | add_filter('FHEE_load_joyride', '__return_true'); |
1629 | 1629 | |
1630 | 1630 | //script for sorting tables |
1631 | - 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); |
|
1631 | + 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); |
|
1632 | 1632 | //script for parsing uri's |
1633 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | 1634 | //and parsing associative serialized form elements |
1635 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1635 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1636 | 1636 | //helpers scripts |
1637 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1638 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1639 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1640 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1637 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1638 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1639 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1640 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1641 | 1641 | |
1642 | 1642 | //google charts |
1643 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1643 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1644 | 1644 | |
1645 | 1645 | //enqueue global scripts |
1646 | 1646 | |
1647 | 1647 | //taking care of metaboxes |
1648 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1648 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1649 | 1649 | wp_enqueue_script('dashboard'); |
1650 | 1650 | } |
1651 | 1651 | |
1652 | 1652 | //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 |
1653 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1653 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1654 | 1654 | wp_enqueue_script('ee_admin_js'); |
1655 | 1655 | wp_enqueue_style('ee-admin-css'); |
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | |
1659 | 1659 | //localize script for ajax lazy loading |
1660 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1661 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1660 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1661 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1662 | 1662 | |
1663 | 1663 | |
1664 | 1664 | /** |
1665 | 1665 | * help tour stuff |
1666 | 1666 | */ |
1667 | - if ( !empty( $this->_help_tour ) ) { |
|
1667 | + if ( ! empty($this->_help_tour)) { |
|
1668 | 1668 | |
1669 | 1669 | //register the js for kicking things off |
1670 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1670 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1671 | 1671 | |
1672 | 1672 | //setup tours for the js tour object |
1673 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1673 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1674 | 1674 | $tours[] = array( |
1675 | 1675 | 'id' => $tour->get_slug(), |
1676 | 1676 | 'options' => $tour->get_options() |
1677 | 1677 | ); |
1678 | 1678 | } |
1679 | 1679 | |
1680 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1680 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1681 | 1681 | |
1682 | 1682 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1683 | 1683 | } |
@@ -1695,52 +1695,52 @@ discard block |
||
1695 | 1695 | public function admin_footer_scripts_eei18n_js_strings() { |
1696 | 1696 | |
1697 | 1697 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1698 | - 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' ); |
|
1699 | - |
|
1700 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1701 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1702 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1703 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1704 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1705 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1706 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1707 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1708 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1709 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1710 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1711 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1724 | - |
|
1725 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1735 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1736 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1698 | + 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'); |
|
1699 | + |
|
1700 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1701 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1702 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1703 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1704 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1705 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1706 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1707 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1708 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1709 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1710 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1711 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1724 | + |
|
1725 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1735 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1736 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1739 | 1739 | |
1740 | 1740 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1741 | 1741 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1742 | 1742 | //espresso_core is listed as a dependency of ee_admin_js. |
1743 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1743 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1744 | 1744 | |
1745 | 1745 | } |
1746 | 1746 | |
@@ -1774,23 +1774,23 @@ discard block |
||
1774 | 1774 | protected function _set_list_table() { |
1775 | 1775 | |
1776 | 1776 | //first is this a list_table view? |
1777 | - if ( !isset($this->_route_config['list_table']) ) |
|
1777 | + if ( ! isset($this->_route_config['list_table'])) |
|
1778 | 1778 | return; //not a list_table view so get out. |
1779 | 1779 | |
1780 | 1780 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1781 | 1781 | |
1782 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1782 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1783 | 1783 | //user error msg |
1784 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1784 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1785 | 1785 | //developer error msg |
1786 | - $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 ); |
|
1787 | - throw new EE_Error( $error_msg ); |
|
1786 | + $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); |
|
1787 | + throw new EE_Error($error_msg); |
|
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1791 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1792 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1793 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1791 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1792 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1793 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1794 | 1794 | |
1795 | 1795 | $this->_set_list_table_view(); |
1796 | 1796 | $this->_set_list_table_object(); |
@@ -1812,14 +1812,14 @@ discard block |
||
1812 | 1812 | * @return array |
1813 | 1813 | */ |
1814 | 1814 | protected function _set_list_table_view() { |
1815 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1815 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1816 | 1816 | |
1817 | 1817 | |
1818 | 1818 | // looking at active items or dumpster diving ? |
1819 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1820 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1819 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1820 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1821 | 1821 | } else { |
1822 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1822 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1823 | 1823 | } |
1824 | 1824 | } |
1825 | 1825 | |
@@ -1830,9 +1830,9 @@ discard block |
||
1830 | 1830 | * WP_List_Table objects need to be loaded fairly early so automatic stuff WP does is taken care of. |
1831 | 1831 | */ |
1832 | 1832 | protected function _set_list_table_object() { |
1833 | - if ( isset($this->_route_config['list_table'] ) ) { |
|
1834 | - if ( !class_exists( $this->_route_config['list_table'] ) ) |
|
1835 | - throw new EE_Error( sprintf( __('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this) ) ); |
|
1833 | + if (isset($this->_route_config['list_table'])) { |
|
1834 | + if ( ! class_exists($this->_route_config['list_table'])) |
|
1835 | + throw new EE_Error(sprintf(__('The %s class defined for the list table does not exist. Please check the spelling of the class ref in the $_page_config property on %s.', 'event_espresso'), $this->_route_config['list_table'], get_class($this))); |
|
1836 | 1836 | $a = new ReflectionClass($this->_route_config['list_table']); |
1837 | 1837 | $this->_list_table_object = $a->newInstance($this); |
1838 | 1838 | } |
@@ -1851,27 +1851,27 @@ discard block |
||
1851 | 1851 | * |
1852 | 1852 | * @return array |
1853 | 1853 | */ |
1854 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1854 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1855 | 1855 | |
1856 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1856 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1857 | 1857 | |
1858 | - if ( empty( $this->_views )) { |
|
1858 | + if (empty($this->_views)) { |
|
1859 | 1859 | $this->_views = array(); |
1860 | 1860 | } |
1861 | 1861 | |
1862 | 1862 | // cycle thru views |
1863 | - foreach ( $this->_views as $key => $view ) { |
|
1863 | + foreach ($this->_views as $key => $view) { |
|
1864 | 1864 | $query_args = array(); |
1865 | 1865 | // check for current view |
1866 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1866 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1867 | 1867 | $query_args['action'] = $this->_req_action; |
1868 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1868 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1869 | 1869 | $query_args['status'] = $view['slug']; |
1870 | 1870 | //merge any other arguments sent in. |
1871 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1872 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1871 | + if (isset($extra_query_args[$view['slug']])) { |
|
1872 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1873 | 1873 | } |
1874 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1874 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1875 | 1875 | } |
1876 | 1876 | |
1877 | 1877 | return $this->_views; |
@@ -1888,15 +1888,15 @@ discard block |
||
1888 | 1888 | * @param int $max_entries total number of rows in the table |
1889 | 1889 | * @return string |
1890 | 1890 | */ |
1891 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1891 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1892 | 1892 | |
1893 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1894 | - $values = array( 10, 25, 50, 100 ); |
|
1895 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1893 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1894 | + $values = array(10, 25, 50, 100); |
|
1895 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1896 | 1896 | |
1897 | - if ( $max_entries ) { |
|
1897 | + if ($max_entries) { |
|
1898 | 1898 | $values[] = $max_entries; |
1899 | - sort( $values ); |
|
1899 | + sort($values); |
|
1900 | 1900 | } |
1901 | 1901 | |
1902 | 1902 | $entries_per_page_dropdown = ' |
@@ -1905,15 +1905,15 @@ discard block |
||
1905 | 1905 | Show |
1906 | 1906 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1907 | 1907 | |
1908 | - foreach ( $values as $value ) { |
|
1909 | - if ( $value < $max_entries ) { |
|
1910 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1908 | + foreach ($values as $value) { |
|
1909 | + if ($value < $max_entries) { |
|
1910 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1911 | 1911 | $entries_per_page_dropdown .= ' |
1912 | 1912 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1913 | 1913 | } |
1914 | 1914 | } |
1915 | 1915 | |
1916 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1916 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1917 | 1917 | $entries_per_page_dropdown .= ' |
1918 | 1918 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1919 | 1919 | |
@@ -1936,8 +1936,8 @@ discard block |
||
1936 | 1936 | * @return void |
1937 | 1937 | */ |
1938 | 1938 | public function _set_search_attributes() { |
1939 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1940 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1939 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1940 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1941 | 1941 | } |
1942 | 1942 | |
1943 | 1943 | /*** END LIST TABLE METHODS **/ |
@@ -1956,20 +1956,20 @@ discard block |
||
1956 | 1956 | * @return void |
1957 | 1957 | */ |
1958 | 1958 | private function _add_registered_meta_boxes() { |
1959 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1959 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1960 | 1960 | |
1961 | 1961 | //we only add meta boxes if the page_route calls for it |
1962 | - if ( is_array($this->_route_config) && isset( $this->_route_config['metaboxes'] ) && is_array($this->_route_config['metaboxes']) ) { |
|
1962 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) && is_array($this->_route_config['metaboxes'])) { |
|
1963 | 1963 | |
1964 | 1964 | |
1965 | 1965 | //this simply loops through the callbacks provided and checks if there is a corresponding callback registered by the child - if there is then we go ahead and process the metabox loader. |
1966 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1967 | - if ( call_user_func( array($this, &$metabox_callback) ) === FALSE ) { |
|
1966 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1967 | + if (call_user_func(array($this, &$metabox_callback)) === FALSE) { |
|
1968 | 1968 | // user error msg |
1969 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
1969 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
1970 | 1970 | // developer error msg |
1971 | - $error_msg .= '||' . sprintf( __( 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso' ), $metabox_callback ); |
|
1972 | - throw new EE_Error( $error_msg ); |
|
1971 | + $error_msg .= '||'.sprintf(__('The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', 'event_espresso'), $metabox_callback); |
|
1972 | + throw new EE_Error($error_msg); |
|
1973 | 1973 | } |
1974 | 1974 | } |
1975 | 1975 | } |
@@ -1986,17 +1986,17 @@ discard block |
||
1986 | 1986 | * @return void |
1987 | 1987 | */ |
1988 | 1988 | private function _add_screen_columns() { |
1989 | - if ( is_array($this->_route_config) && isset( $this->_route_config['columns'] ) && is_array($this->_route_config['columns']) && count( $this->_route_config['columns'] == 2 ) ) { |
|
1989 | + if (is_array($this->_route_config) && isset($this->_route_config['columns']) && is_array($this->_route_config['columns']) && count($this->_route_config['columns'] == 2)) { |
|
1990 | 1990 | |
1991 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
1991 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
1992 | 1992 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
1993 | 1993 | $screen_id = $this->_current_screen->id; |
1994 | 1994 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
1995 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
1996 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
1995 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
1996 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
1997 | 1997 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
1998 | 1998 | $this->_template_args['screen'] = $this->_current_screen; |
1999 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
1999 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2000 | 2000 | |
2001 | 2001 | //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. |
2002 | 2002 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2013,11 +2013,11 @@ discard block |
||
2013 | 2013 | */ |
2014 | 2014 | |
2015 | 2015 | private function _espresso_news_post_box() { |
2016 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2017 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2016 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2017 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2018 | 2018 | $this, |
2019 | 2019 | 'espresso_news_post_box' |
2020 | - ), $this->_wp_page_slug, 'side' ); |
|
2020 | + ), $this->_wp_page_slug, 'side'); |
|
2021 | 2021 | } |
2022 | 2022 | |
2023 | 2023 | |
@@ -2025,14 +2025,14 @@ discard block |
||
2025 | 2025 | * Code for setting up espresso ratings request metabox. |
2026 | 2026 | */ |
2027 | 2027 | protected function _espresso_ratings_request() { |
2028 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2028 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2029 | 2029 | return ''; |
2030 | 2030 | } |
2031 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2032 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2031 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2032 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2033 | 2033 | $this, |
2034 | 2034 | 'espresso_ratings_request' |
2035 | - ), $this->_wp_page_slug, 'side' ); |
|
2035 | + ), $this->_wp_page_slug, 'side'); |
|
2036 | 2036 | } |
2037 | 2037 | |
2038 | 2038 | |
@@ -2040,34 +2040,34 @@ discard block |
||
2040 | 2040 | * Code for setting up espresso ratings request metabox content. |
2041 | 2041 | */ |
2042 | 2042 | public function espresso_ratings_request() { |
2043 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2044 | - EEH_Template::display_template( $template_path, array() ); |
|
2043 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2044 | + EEH_Template::display_template($template_path, array()); |
|
2045 | 2045 | } |
2046 | 2046 | |
2047 | 2047 | |
2048 | 2048 | |
2049 | 2049 | |
2050 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2051 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2052 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2053 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2054 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2055 | - $post = '</div>' . "\n"; |
|
2050 | + public static function cached_rss_display($rss_id, $url) { |
|
2051 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2052 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2053 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2054 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2055 | + $post = '</div>'."\n"; |
|
2056 | 2056 | |
2057 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2058 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2059 | - echo $pre . $output . $post; |
|
2057 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2058 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2059 | + echo $pre.$output.$post; |
|
2060 | 2060 | return TRUE; |
2061 | 2061 | } |
2062 | 2062 | |
2063 | - if ( ! $doing_ajax ) { |
|
2064 | - echo $pre . $loading . $post; |
|
2063 | + if ( ! $doing_ajax) { |
|
2064 | + echo $pre.$loading.$post; |
|
2065 | 2065 | return FALSE; |
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | ob_start(); |
2069 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2070 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2069 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2070 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2071 | 2071 | return TRUE; |
2072 | 2072 | |
2073 | 2073 | } |
@@ -2079,13 +2079,13 @@ discard block |
||
2079 | 2079 | <div id="espresso_news_post_box_content" class="infolinks"> |
2080 | 2080 | <?php |
2081 | 2081 | // Get RSS Feed(s) |
2082 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2082 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2083 | 2083 | $url = urlencode($feed_url); |
2084 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2084 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2085 | 2085 | |
2086 | 2086 | ?> |
2087 | 2087 | </div> |
2088 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2088 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2089 | 2089 | </div> |
2090 | 2090 | <?php |
2091 | 2091 | } |
@@ -2106,32 +2106,32 @@ discard block |
||
2106 | 2106 | |
2107 | 2107 | protected function _espresso_sponsors_post_box() { |
2108 | 2108 | |
2109 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2110 | - if ( $show_sponsors ) |
|
2111 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2109 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2110 | + if ($show_sponsors) |
|
2111 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2112 | 2112 | } |
2113 | 2113 | |
2114 | 2114 | |
2115 | 2115 | public function espresso_sponsors_post_box() { |
2116 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2117 | - EEH_Template::display_template( $templatepath ); |
|
2116 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2117 | + EEH_Template::display_template($templatepath); |
|
2118 | 2118 | } |
2119 | 2119 | |
2120 | 2120 | |
2121 | 2121 | |
2122 | 2122 | private function _publish_post_box() { |
2123 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2123 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2124 | 2124 | |
2125 | 2125 | //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) |
2126 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2127 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2126 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2127 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2128 | 2128 | } else { |
2129 | 2129 | $box_label = __('Publish', 'event_espresso'); |
2130 | 2130 | } |
2131 | 2131 | |
2132 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2132 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2133 | 2133 | |
2134 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2134 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2135 | 2135 | |
2136 | 2136 | } |
2137 | 2137 | |
@@ -2139,9 +2139,9 @@ discard block |
||
2139 | 2139 | |
2140 | 2140 | public function editor_overview() { |
2141 | 2141 | //if we have extra content set let's add it in if not make sure its empty |
2142 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2143 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2144 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2142 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2143 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2144 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2145 | 2145 | } |
2146 | 2146 | |
2147 | 2147 | |
@@ -2157,8 +2157,8 @@ discard block |
||
2157 | 2157 | * @see $this->_set_publish_post_box_vars for param details |
2158 | 2158 | * @since 4.6.0 |
2159 | 2159 | */ |
2160 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2161 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2160 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2161 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2162 | 2162 | } |
2163 | 2163 | |
2164 | 2164 | |
@@ -2177,24 +2177,24 @@ discard block |
||
2177 | 2177 | * @param string $post_save_redirect_URL custom URL to redirect to after Save & Close has been completed |
2178 | 2178 | * @param boolean $both_btns whether to display BOTH the "Save & Close" and "Save" buttons or just the Save button |
2179 | 2179 | */ |
2180 | - protected function _set_publish_post_box_vars( $name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE ) { |
|
2180 | + protected function _set_publish_post_box_vars($name = NULL, $id = FALSE, $delete = FALSE, $save_close_redirect_URL = NULL, $both_btns = TRUE) { |
|
2181 | 2181 | |
2182 | 2182 | // if Save & Close, use a custom redirect URL or default to the main page? |
2183 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2183 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2184 | 2184 | // create the Save & Close and Save buttons |
2185 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2185 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2186 | 2186 | //if we have extra content set let's add it in if not make sure its empty |
2187 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2187 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | 2188 | |
2189 | 2189 | |
2190 | - if ( $delete && ! empty( $id ) ) { |
|
2190 | + if ($delete && ! empty($id)) { |
|
2191 | 2191 | $delete = is_bool($delete) ? 'delete' : $delete; //make sure we have a default if just true is sent. |
2192 | - $delete_link_args = array( $name => $id ); |
|
2193 | - $delete = $this->get_action_link_or_button( $delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2192 | + $delete_link_args = array($name => $id); |
|
2193 | + $delete = $this->get_action_link_or_button($delete, $delete, $delete_link_args, 'submitdelete deletion'); |
|
2194 | 2194 | } |
2195 | 2195 | |
2196 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2197 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2196 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2197 | + if ( ! empty($name) && ! empty($id)) { |
|
2198 | 2198 | $hidden_field_arr[$name] = array( |
2199 | 2199 | 'type' => 'hidden', |
2200 | 2200 | 'value' => $id |
@@ -2204,7 +2204,7 @@ discard block |
||
2204 | 2204 | $hf = ''; |
2205 | 2205 | } |
2206 | 2206 | // add hidden field |
2207 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2207 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2208 | 2208 | |
2209 | 2209 | } |
2210 | 2210 | |
@@ -2221,8 +2221,8 @@ discard block |
||
2221 | 2221 | <noscript> |
2222 | 2222 | <div id="no-js-message" class="error"> |
2223 | 2223 | <p style="font-size:1.3em;"> |
2224 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2225 | - <?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' ); ?> |
|
2224 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2225 | + <?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'); ?> |
|
2226 | 2226 | </p> |
2227 | 2227 | </div> |
2228 | 2228 | </noscript> |
@@ -2242,7 +2242,7 @@ discard block |
||
2242 | 2242 | * @return string |
2243 | 2243 | */ |
2244 | 2244 | private function _display_espresso_notices() { |
2245 | - $notices = $this->_get_transient( TRUE ); |
|
2245 | + $notices = $this->_get_transient(TRUE); |
|
2246 | 2246 | echo stripslashes($notices); |
2247 | 2247 | } |
2248 | 2248 | |
@@ -2294,11 +2294,11 @@ discard block |
||
2294 | 2294 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2295 | 2295 | * @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. |
2296 | 2296 | */ |
2297 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2298 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2297 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2298 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2299 | 2299 | |
2300 | 2300 | //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. |
2301 | - if ( empty( $callback_args ) && $create_func ) { |
|
2301 | + if (empty($callback_args) && $create_func) { |
|
2302 | 2302 | $callback_args = array( |
2303 | 2303 | 'template_path' => $this->_template_path, |
2304 | 2304 | 'template_args' => $this->_template_args, |
@@ -2308,7 +2308,7 @@ discard block |
||
2308 | 2308 | //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) |
2309 | 2309 | $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; |
2310 | 2310 | |
2311 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2311 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2312 | 2312 | } |
2313 | 2313 | |
2314 | 2314 | |
@@ -2321,7 +2321,7 @@ discard block |
||
2321 | 2321 | */ |
2322 | 2322 | public function display_admin_page_with_metabox_columns() { |
2323 | 2323 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2324 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2324 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2325 | 2325 | |
2326 | 2326 | //the final wrapper |
2327 | 2327 | $this->admin_page_wrapper(); |
@@ -2364,7 +2364,7 @@ discard block |
||
2364 | 2364 | * @return void |
2365 | 2365 | */ |
2366 | 2366 | public function display_about_admin_page() { |
2367 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2367 | + $this->_display_admin_page(FALSE, TRUE); |
|
2368 | 2368 | } |
2369 | 2369 | |
2370 | 2370 | |
@@ -2380,26 +2380,26 @@ discard block |
||
2380 | 2380 | * @return html admin_page |
2381 | 2381 | */ |
2382 | 2382 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2383 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2383 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2384 | 2384 | |
2385 | 2385 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2386 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2386 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2387 | 2387 | |
2388 | 2388 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2389 | 2389 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2390 | 2390 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2391 | 2391 | |
2392 | - $template_path = $sidebar ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2392 | + $template_path = $sidebar ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2393 | 2393 | |
2394 | - if ( defined('DOING_AJAX' ) ) |
|
2395 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2394 | + if (defined('DOING_AJAX')) |
|
2395 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2396 | 2396 | |
2397 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2397 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2398 | 2398 | |
2399 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2399 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2400 | 2400 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2401 | 2401 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2402 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2402 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2403 | 2403 | |
2404 | 2404 | |
2405 | 2405 | // the final template wrapper |
@@ -2419,7 +2419,7 @@ discard block |
||
2419 | 2419 | * @param bool $display_sidebar whether to use the sidebar template or the full template for the page. TRUE = SHOW sidebar, FALSE = no sidebar. Default no sidebar. |
2420 | 2420 | * @return void |
2421 | 2421 | */ |
2422 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2422 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2423 | 2423 | //let's generate a default preview action button if there isn't one already present. |
2424 | 2424 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2425 | 2425 | $buy_now_url = add_query_arg( |
@@ -2432,10 +2432,10 @@ discard block |
||
2432 | 2432 | ), |
2433 | 2433 | 'http://eventespresso.com/pricing/' |
2434 | 2434 | ); |
2435 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) ? $this->get_action_link_or_button( '', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true ) : $this->_template_args['preview_action_button']; |
|
2436 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2437 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2438 | - $this->_display_admin_page( $display_sidebar ); |
|
2435 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) ? $this->get_action_link_or_button('', 'buy_now', array(), 'button-primary button-large', $buy_now_url, true) : $this->_template_args['preview_action_button']; |
|
2436 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2437 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2438 | + $this->_display_admin_page($display_sidebar); |
|
2439 | 2439 | } |
2440 | 2440 | |
2441 | 2441 | |
@@ -2469,41 +2469,41 @@ discard block |
||
2469 | 2469 | * @param boolean $sidebar whether to display with sidebar or not. |
2470 | 2470 | * @return html |
2471 | 2471 | */ |
2472 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2472 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2473 | 2473 | //setup search attributes |
2474 | 2474 | $this->_set_search_attributes(); |
2475 | 2475 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2476 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2476 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2477 | 2477 | |
2478 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2478 | + $this->_template_args['table_url'] = defined('DOING_AJAX') ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2479 | 2479 | $this->_template_args['list_table'] = $this->_list_table_object; |
2480 | 2480 | $this->_template_args['current_route'] = $this->_req_action; |
2481 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2481 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2482 | 2482 | |
2483 | 2483 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2484 | - if( ! empty( $ajax_sorting_callback )) { |
|
2485 | - $sortable_list_table_form_fields = wp_nonce_field( $ajax_sorting_callback . '_nonce', $ajax_sorting_callback . '_nonce', FALSE, FALSE ); |
|
2484 | + if ( ! empty($ajax_sorting_callback)) { |
|
2485 | + $sortable_list_table_form_fields = wp_nonce_field($ajax_sorting_callback.'_nonce', $ajax_sorting_callback.'_nonce', FALSE, FALSE); |
|
2486 | 2486 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2487 | 2487 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2488 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2489 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2488 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2489 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2490 | 2490 | } else { |
2491 | 2491 | $sortable_list_table_form_fields = ''; |
2492 | 2492 | } |
2493 | 2493 | |
2494 | 2494 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2495 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2496 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2497 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2495 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2496 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2497 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2498 | 2498 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2499 | 2499 | |
2500 | 2500 | //display message about search results? |
2501 | - $this->_template_args['before_list_table'] .= apply_filters( 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', !empty( $this->_req_data['s'] ) ? '<p class="ee-search-results">' . sprintf( __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%') ) . '</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action ); |
|
2501 | + $this->_template_args['before_list_table'] .= apply_filters('FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', ! empty($this->_req_data['s']) ? '<p class="ee-search-results">'.sprintf(__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), trim($this->_req_data['s'], '%')).'</p>' : '', $this->page_slug, $this->_req_data, $this->_req_action); |
|
2502 | 2502 | |
2503 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2503 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2504 | 2504 | |
2505 | 2505 | // the final template wrapper |
2506 | - if ( $sidebar ) |
|
2506 | + if ($sidebar) |
|
2507 | 2507 | $this->display_admin_page_with_sidebar(); |
2508 | 2508 | else |
2509 | 2509 | $this->display_admin_page_with_no_sidebar(); |
@@ -2526,9 +2526,9 @@ discard block |
||
2526 | 2526 | * @param array $items see above for format of array |
2527 | 2527 | * @return string html string of legend |
2528 | 2528 | */ |
2529 | - protected function _display_legend( $items ) { |
|
2530 | - $template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2531 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2529 | + protected function _display_legend($items) { |
|
2530 | + $template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2531 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2532 | 2532 | return EEH_Template::display_template($legend_template, $template_args, TRUE); |
2533 | 2533 | } |
2534 | 2534 | |
@@ -2553,31 +2553,31 @@ discard block |
||
2553 | 2553 | * |
2554 | 2554 | * @return json object |
2555 | 2555 | */ |
2556 | - protected function _return_json( $sticky_notices = FALSE ) { |
|
2556 | + protected function _return_json($sticky_notices = FALSE) { |
|
2557 | 2557 | |
2558 | 2558 | //make sure any EE_Error notices have been handled. |
2559 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2559 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2560 | 2560 | |
2561 | 2561 | |
2562 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2562 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2563 | 2563 | unset($this->_template_args['data']); |
2564 | 2564 | $json = array( |
2565 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : FALSE, |
|
2566 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : FALSE, |
|
2565 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : FALSE, |
|
2566 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : FALSE, |
|
2567 | 2567 | 'notices' => EE_Error::get_notices(), |
2568 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2569 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2568 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2569 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2570 | 2570 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2571 | 2571 | ); |
2572 | 2572 | |
2573 | 2573 | |
2574 | 2574 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2575 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2575 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2576 | 2576 | header('Content-Type: application/json; charset=UTF-8'); |
2577 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2578 | - echo wp_json_encode( $json ); |
|
2577 | + if (function_exists('wp_json_encode')) { |
|
2578 | + echo wp_json_encode($json); |
|
2579 | 2579 | } else { |
2580 | - echo json_encode( $json ); |
|
2580 | + echo json_encode($json); |
|
2581 | 2581 | } |
2582 | 2582 | exit(); |
2583 | 2583 | } |
@@ -2589,11 +2589,11 @@ discard block |
||
2589 | 2589 | * @return json_obj|EE_Error |
2590 | 2590 | */ |
2591 | 2591 | public function return_json() { |
2592 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2592 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2593 | 2593 | $this->_return_json(); |
2594 | 2594 | |
2595 | 2595 | else { |
2596 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2596 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2597 | 2597 | } |
2598 | 2598 | } |
2599 | 2599 | |
@@ -2608,7 +2608,7 @@ discard block |
||
2608 | 2608 | * @access public |
2609 | 2609 | * @return void |
2610 | 2610 | */ |
2611 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2611 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2612 | 2612 | $this->_hook_obj = $hook_obj; |
2613 | 2613 | } |
2614 | 2614 | |
@@ -2624,33 +2624,33 @@ discard block |
||
2624 | 2624 | */ |
2625 | 2625 | public function admin_page_wrapper($about = FALSE) { |
2626 | 2626 | |
2627 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2627 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2628 | 2628 | |
2629 | 2629 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2630 | 2630 | |
2631 | 2631 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2632 | 2632 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2633 | 2633 | |
2634 | - $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'] : ''); |
|
2635 | - $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'] : ''); |
|
2634 | + $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'] : ''); |
|
2635 | + $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'] : ''); |
|
2636 | 2636 | |
2637 | 2637 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2638 | 2638 | |
2639 | 2639 | |
2640 | 2640 | |
2641 | 2641 | // load settings page wrapper template |
2642 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2642 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2643 | 2643 | |
2644 | 2644 | //about page? |
2645 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2645 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2646 | 2646 | |
2647 | 2647 | |
2648 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2649 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2648 | + if (defined('DOING_AJAX')) { |
|
2649 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2650 | 2650 | |
2651 | 2651 | $this->_return_json(); |
2652 | 2652 | } else { |
2653 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2653 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2654 | 2654 | } |
2655 | 2655 | |
2656 | 2656 | } |
@@ -2678,7 +2678,7 @@ discard block |
||
2678 | 2678 | * @access public |
2679 | 2679 | * @return void |
2680 | 2680 | */ |
2681 | - private function _sort_nav_tabs( $a, $b ) { |
|
2681 | + private function _sort_nav_tabs($a, $b) { |
|
2682 | 2682 | if ($a['order'] == $b['order']) { |
2683 | 2683 | return 0; |
2684 | 2684 | } |
@@ -2699,7 +2699,7 @@ discard block |
||
2699 | 2699 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2700 | 2700 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2701 | 2701 | */ |
2702 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2702 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2703 | 2703 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2704 | 2704 | return $content; |
2705 | 2705 | } |
@@ -2721,25 +2721,25 @@ discard block |
||
2721 | 2721 | * @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. |
2722 | 2722 | * @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). |
2723 | 2723 | */ |
2724 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2724 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2725 | 2725 | //make sure $text and $actions are in an array |
2726 | 2726 | $text = (array) $text; |
2727 | 2727 | $actions = (array) $actions; |
2728 | 2728 | $referrer_url = empty($referrer) ? '' : $referrer; |
2729 | - $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 .'" />'; |
|
2729 | + $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.'" />'; |
|
2730 | 2730 | |
2731 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2732 | - $default_names = array( 'save', 'save_and_close' ); |
|
2731 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2732 | + $default_names = array('save', 'save_and_close'); |
|
2733 | 2733 | |
2734 | 2734 | //add in a hidden index for the current page (so save and close redirects properly) |
2735 | 2735 | $this->_template_args['save_buttons'] = $referrer_url; |
2736 | 2736 | |
2737 | - foreach ( $button_text as $key => $button ) { |
|
2737 | + foreach ($button_text as $key => $button) { |
|
2738 | 2738 | $ref = $default_names[$key]; |
2739 | - $id = $this->_current_view . '_' . $ref; |
|
2740 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2741 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2742 | - if ( !$both ) break; |
|
2739 | + $id = $this->_current_view.'_'.$ref; |
|
2740 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2741 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2742 | + if ( ! $both) break; |
|
2743 | 2743 | } |
2744 | 2744 | |
2745 | 2745 | } |
@@ -2752,8 +2752,8 @@ discard block |
||
2752 | 2752 | * @since 4.6.0 |
2753 | 2753 | * |
2754 | 2754 | */ |
2755 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2756 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2755 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2756 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2757 | 2757 | } |
2758 | 2758 | |
2759 | 2759 | |
@@ -2766,30 +2766,30 @@ discard block |
||
2766 | 2766 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2767 | 2767 | * @return void |
2768 | 2768 | */ |
2769 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2769 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2770 | 2770 | |
2771 | - if ( empty( $route )) { |
|
2771 | + if (empty($route)) { |
|
2772 | 2772 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2773 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2774 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2773 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2774 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2775 | 2775 | } |
2776 | 2776 | // open form |
2777 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2777 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2778 | 2778 | // add nonce |
2779 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2779 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2780 | 2780 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2781 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2781 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2782 | 2782 | // add REQUIRED form action |
2783 | 2783 | $hidden_fields = array( |
2784 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2784 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2785 | 2785 | ); |
2786 | 2786 | // merge arrays |
2787 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2787 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2788 | 2788 | // generate form fields |
2789 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2789 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2790 | 2790 | // add fields to form |
2791 | - foreach ( $form_fields as $field_name => $form_field ) { |
|
2792 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2791 | + foreach ($form_fields as $field_name => $form_field) { |
|
2792 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2793 | 2793 | } |
2794 | 2794 | |
2795 | 2795 | // close form |
@@ -2806,8 +2806,8 @@ discard block |
||
2806 | 2806 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2807 | 2807 | * @since 4.5.0 |
2808 | 2808 | */ |
2809 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2810 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2809 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2810 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2811 | 2811 | } |
2812 | 2812 | |
2813 | 2813 | |
@@ -2823,32 +2823,32 @@ discard block |
||
2823 | 2823 | * @access protected |
2824 | 2824 | * @return void |
2825 | 2825 | */ |
2826 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2826 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2827 | 2827 | |
2828 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2828 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2829 | 2829 | |
2830 | 2830 | //class name for actions/filters. |
2831 | 2831 | $classname = get_class($this); |
2832 | 2832 | |
2833 | 2833 | //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 |
2834 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2835 | - $notices = EE_Error::get_notices( FALSE ); |
|
2834 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2835 | + $notices = EE_Error::get_notices(FALSE); |
|
2836 | 2836 | |
2837 | 2837 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2838 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2838 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2839 | 2839 | EE_Error::overwrite_success(); |
2840 | 2840 | } |
2841 | 2841 | // how many records affected ? more than one record ? or just one ? |
2842 | - if ( $success > 1 && empty( $notices['errors'] )) { |
|
2842 | + if ($success > 1 && empty($notices['errors'])) { |
|
2843 | 2843 | // set plural msg |
2844 | - EE_Error::add_success( sprintf( __('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc ), __FILE__, __FUNCTION__, __LINE__); |
|
2845 | - } else if ( $success == 1 && empty( $notices['errors'] )) { |
|
2844 | + EE_Error::add_success(sprintf(__('The "%s" have been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2845 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2846 | 2846 | // set singular msg |
2847 | - EE_Error::add_success( sprintf( __('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__ ); |
|
2847 | + EE_Error::add_success(sprintf(__('The "%s" has been successfully %s.', 'event_espresso'), $what, $action_desc), __FILE__, __FUNCTION__, __LINE__); |
|
2848 | 2848 | } |
2849 | 2849 | |
2850 | 2850 | // check that $query_args isn't something crazy |
2851 | - if ( ! is_array( $query_args )) { |
|
2851 | + if ( ! is_array($query_args)) { |
|
2852 | 2852 | $query_args = array(); |
2853 | 2853 | } |
2854 | 2854 | |
@@ -2861,36 +2861,36 @@ discard block |
||
2861 | 2861 | * @param array $query_args The original query_args array coming into the |
2862 | 2862 | * method. |
2863 | 2863 | */ |
2864 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2864 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2865 | 2865 | |
2866 | 2866 | //calculate where we're going (if we have a "save and close" button pushed) |
2867 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2867 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2868 | 2868 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2869 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2869 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2870 | 2870 | // regenerate query args array from refferer URL |
2871 | - parse_str( $parsed_url['query'], $query_args ); |
|
2871 | + parse_str($parsed_url['query'], $query_args); |
|
2872 | 2872 | // correct page and action will be in the query args now |
2873 | - $redirect_url = admin_url( 'admin.php' ); |
|
2873 | + $redirect_url = admin_url('admin.php'); |
|
2874 | 2874 | } |
2875 | 2875 | |
2876 | 2876 | //merge any default query_args set in _default_route_query_args property |
2877 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2877 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2878 | 2878 | $args_to_merge = array(); |
2879 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2879 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2880 | 2880 | //is there a wp_referer array in our _default_route_query_args property? |
2881 | - if ( $query_param == 'wp_referer' ) { |
|
2881 | + if ($query_param == 'wp_referer') { |
|
2882 | 2882 | $query_value = (array) $query_value; |
2883 | - foreach ( $query_value as $reference => $value ) { |
|
2884 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2883 | + foreach ($query_value as $reference => $value) { |
|
2884 | + if (strpos($reference, 'nonce') !== false) { |
|
2885 | 2885 | continue; |
2886 | 2886 | } |
2887 | 2887 | |
2888 | 2888 | //finally we will override any arguments in the referer with |
2889 | 2889 | //what might be set on the _default_route_query_args array. |
2890 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
2891 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
2890 | + if (isset($this->_default_route_query_args[$reference])) { |
|
2891 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
2892 | 2892 | } else { |
2893 | - $args_to_merge[$reference] = urlencode( $value ); |
|
2893 | + $args_to_merge[$reference] = urlencode($value); |
|
2894 | 2894 | } |
2895 | 2895 | } |
2896 | 2896 | continue; |
@@ -2901,7 +2901,7 @@ discard block |
||
2901 | 2901 | |
2902 | 2902 | //now let's merge these arguments but override with what was specifically sent in to the |
2903 | 2903 | //redirect. |
2904 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
2904 | + $query_args = array_merge($args_to_merge, $query_args); |
|
2905 | 2905 | } |
2906 | 2906 | |
2907 | 2907 | $this->_process_notices($query_args); |
@@ -2910,19 +2910,19 @@ discard block |
||
2910 | 2910 | // generate redirect url |
2911 | 2911 | |
2912 | 2912 | // if redirecting to anything other than the main page, add a nonce |
2913 | - if ( isset( $query_args['action'] )) { |
|
2913 | + if (isset($query_args['action'])) { |
|
2914 | 2914 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
2915 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
2915 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
2916 | 2916 | } |
2917 | 2917 | |
2918 | 2918 | //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). |
2919 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
2919 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
2920 | 2920 | |
2921 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
2921 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
2922 | 2922 | |
2923 | 2923 | |
2924 | 2924 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
2925 | - if ( defined('DOING_AJAX' ) ) { |
|
2925 | + if (defined('DOING_AJAX')) { |
|
2926 | 2926 | $default_data = array( |
2927 | 2927 | 'close' => TRUE, |
2928 | 2928 | 'redirect_url' => $redirect_url, |
@@ -2931,11 +2931,11 @@ discard block |
||
2931 | 2931 | ); |
2932 | 2932 | |
2933 | 2933 | $this->_template_args['success'] = $success; |
2934 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
2934 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
2935 | 2935 | $this->_return_json(); |
2936 | 2936 | } |
2937 | 2937 | |
2938 | - wp_safe_redirect( $redirect_url ); |
|
2938 | + wp_safe_redirect($redirect_url); |
|
2939 | 2939 | exit(); |
2940 | 2940 | } |
2941 | 2941 | |
@@ -2951,14 +2951,14 @@ discard block |
||
2951 | 2951 | * @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. |
2952 | 2952 | * @return void |
2953 | 2953 | */ |
2954 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
2954 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
2955 | 2955 | |
2956 | 2956 | $this->_template_args['notices'] = EE_Error::get_notices(); |
2957 | 2957 | |
2958 | 2958 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
2959 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
2960 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
2961 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
2959 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
2960 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
2961 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
2962 | 2962 | } |
2963 | 2963 | } |
2964 | 2964 | |
@@ -2980,32 +2980,32 @@ discard block |
||
2980 | 2980 | * |
2981 | 2981 | * @return string html for button |
2982 | 2982 | */ |
2983 | - public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false ) { |
|
2983 | + public function get_action_link_or_button($action, $type = 'add', $extra_request = array(), $class = 'button-primary', $base_url = FALSE, $exclude_nonce = false) { |
|
2984 | 2984 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
2985 | - if ( !isset($this->_page_routes[$action]) && !$base_url ) |
|
2986 | - throw new EE_Error( sprintf( __('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action) ); |
|
2985 | + if ( ! isset($this->_page_routes[$action]) && ! $base_url) |
|
2986 | + throw new EE_Error(sprintf(__('There is no page route for given action for the button. This action was given: %s', 'event_espresso'), $action)); |
|
2987 | 2987 | |
2988 | - if ( !isset( $this->_labels['buttons'][$type] ) ) |
|
2989 | - throw new EE_Error( sprintf( __('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type) ); |
|
2988 | + if ( ! isset($this->_labels['buttons'][$type])) |
|
2989 | + throw new EE_Error(sprintf(__('There is no label for the given button type (%s). Labels are set in the <code>_page_config</code> property.', 'event_espresso'), $type)); |
|
2990 | 2990 | |
2991 | 2991 | //finally check user access for this button. |
2992 | - $has_access = $this->check_user_access( $action, TRUE ); |
|
2993 | - if ( ! $has_access ) { |
|
2992 | + $has_access = $this->check_user_access($action, TRUE); |
|
2993 | + if ( ! $has_access) { |
|
2994 | 2994 | return ''; |
2995 | 2995 | } |
2996 | 2996 | |
2997 | - $_base_url = !$base_url ? $this->_admin_base_url : $base_url; |
|
2997 | + $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
|
2998 | 2998 | |
2999 | 2999 | $query_args = array( |
3000 | 3000 | 'action' => $action ); |
3001 | 3001 | |
3002 | 3002 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3003 | - if ( !empty($extra_request) ) |
|
3004 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3003 | + if ( ! empty($extra_request)) |
|
3004 | + $query_args = array_merge($extra_request, $query_args); |
|
3005 | 3005 | |
3006 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3006 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3007 | 3007 | |
3008 | - $button = EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][$type], $class ); |
|
3008 | + $button = EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3009 | 3009 | |
3010 | 3010 | return $button; |
3011 | 3011 | } |
@@ -3025,11 +3025,11 @@ discard block |
||
3025 | 3025 | $args = array( |
3026 | 3026 | 'label' => $this->_admin_page_title, |
3027 | 3027 | 'default' => 10, |
3028 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3028 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3029 | 3029 | ); |
3030 | 3030 | //ONLY add the screen option if the user has access to it. |
3031 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3032 | - add_screen_option( $option, $args ); |
|
3031 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3032 | + add_screen_option($option, $args); |
|
3033 | 3033 | } |
3034 | 3034 | } |
3035 | 3035 | |
@@ -3045,36 +3045,36 @@ discard block |
||
3045 | 3045 | * @return void |
3046 | 3046 | */ |
3047 | 3047 | private function _set_per_page_screen_options() { |
3048 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3049 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3048 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3049 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3050 | 3050 | |
3051 | - if ( !$user = wp_get_current_user() ) |
|
3051 | + if ( ! $user = wp_get_current_user()) |
|
3052 | 3052 | return; |
3053 | 3053 | $option = $_POST['wp_screen_options']['option']; |
3054 | 3054 | $value = $_POST['wp_screen_options']['value']; |
3055 | 3055 | |
3056 | - if ( $option != sanitize_key( $option ) ) |
|
3056 | + if ($option != sanitize_key($option)) |
|
3057 | 3057 | return; |
3058 | 3058 | |
3059 | 3059 | $map_option = $option; |
3060 | 3060 | |
3061 | 3061 | $option = str_replace('-', '_', $option); |
3062 | 3062 | |
3063 | - switch ( $map_option ) { |
|
3064 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3063 | + switch ($map_option) { |
|
3064 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3065 | 3065 | $value = (int) $value; |
3066 | - if ( $value < 1 || $value > 999 ) |
|
3066 | + if ($value < 1 || $value > 999) |
|
3067 | 3067 | return; |
3068 | 3068 | break; |
3069 | 3069 | default: |
3070 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3071 | - if ( false === $value ) |
|
3070 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3071 | + if (false === $value) |
|
3072 | 3072 | return; |
3073 | 3073 | break; |
3074 | 3074 | } |
3075 | 3075 | |
3076 | 3076 | update_user_meta($user->ID, $option, $value); |
3077 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3077 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3078 | 3078 | exit; |
3079 | 3079 | } |
3080 | 3080 | } |
@@ -3085,8 +3085,8 @@ discard block |
||
3085 | 3085 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3086 | 3086 | * @param array $data array that will be assigned to template args. |
3087 | 3087 | */ |
3088 | - public function set_template_args( $data ) { |
|
3089 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3088 | + public function set_template_args($data) { |
|
3089 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3090 | 3090 | } |
3091 | 3091 | |
3092 | 3092 | |
@@ -3102,26 +3102,26 @@ discard block |
||
3102 | 3102 | * @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. |
3103 | 3103 | * @return void |
3104 | 3104 | */ |
3105 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3105 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3106 | 3106 | $user_id = get_current_user_id(); |
3107 | 3107 | |
3108 | - if ( !$skip_route_verify ) |
|
3108 | + if ( ! $skip_route_verify) |
|
3109 | 3109 | $this->_verify_route($route); |
3110 | 3110 | |
3111 | 3111 | |
3112 | 3112 | //now let's set the string for what kind of transient we're setting |
3113 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3114 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3113 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3114 | + $data = $notices ? array('notices' => $data) : $data; |
|
3115 | 3115 | //is there already a transient for this route? If there is then let's ADD to that transient |
3116 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3117 | - if ( $existing ) { |
|
3118 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3116 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3117 | + if ($existing) { |
|
3118 | + $data = array_merge((array) $data, (array) $existing); |
|
3119 | 3119 | } |
3120 | 3120 | |
3121 | - if ( is_multisite() && is_network_admin() ) { |
|
3122 | - set_site_transient( $transient, $data, 8 ); |
|
3121 | + if (is_multisite() && is_network_admin()) { |
|
3122 | + set_site_transient($transient, $data, 8); |
|
3123 | 3123 | } else { |
3124 | - set_transient( $transient, $data, 8 ); |
|
3124 | + set_transient($transient, $data, 8); |
|
3125 | 3125 | } |
3126 | 3126 | } |
3127 | 3127 | |
@@ -3133,18 +3133,18 @@ discard block |
||
3133 | 3133 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3134 | 3134 | * @return mixed data |
3135 | 3135 | */ |
3136 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3136 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3137 | 3137 | $user_id = get_current_user_id(); |
3138 | - $route = !$route ? $this->_req_action : $route; |
|
3139 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3140 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3138 | + $route = ! $route ? $this->_req_action : $route; |
|
3139 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3140 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3141 | 3141 | //delete transient after retrieval (just in case it hasn't expired); |
3142 | - if ( is_multisite() && is_network_admin() ) { |
|
3143 | - delete_site_transient( $transient ); |
|
3142 | + if (is_multisite() && is_network_admin()) { |
|
3143 | + delete_site_transient($transient); |
|
3144 | 3144 | } else { |
3145 | - delete_transient( $transient ); |
|
3145 | + delete_transient($transient); |
|
3146 | 3146 | } |
3147 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3147 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3148 | 3148 | } |
3149 | 3149 | |
3150 | 3150 | |
@@ -3161,12 +3161,12 @@ discard block |
||
3161 | 3161 | |
3162 | 3162 | //retrieve all existing transients |
3163 | 3163 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3164 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3165 | - foreach ( $results as $result ) { |
|
3166 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3167 | - get_transient( $transient ); |
|
3168 | - if ( is_multisite() && is_network_admin() ) { |
|
3169 | - get_site_transient( $transient ); |
|
3164 | + if ($results = $wpdb->get_results($query)) { |
|
3165 | + foreach ($results as $result) { |
|
3166 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3167 | + get_transient($transient); |
|
3168 | + if (is_multisite() && is_network_admin()) { |
|
3169 | + get_site_transient($transient); |
|
3170 | 3170 | } |
3171 | 3171 | } |
3172 | 3172 | } |
@@ -3290,23 +3290,23 @@ discard block |
||
3290 | 3290 | * @param string $line line no where error occurred |
3291 | 3291 | * @return boolean |
3292 | 3292 | */ |
3293 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3293 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3294 | 3294 | |
3295 | 3295 | //remove any options that are NOT going to be saved with the config settings. |
3296 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3296 | + if (isset($config->core->ee_ueip_optin)) { |
|
3297 | 3297 | $config->core->ee_ueip_has_notified = TRUE; |
3298 | 3298 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3299 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3300 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3299 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3300 | + update_option('ee_ueip_has_notified', TRUE); |
|
3301 | 3301 | } |
3302 | 3302 | // and save it (note we're also doing the network save here) |
3303 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3304 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3305 | - if ( $config_saved && $net_saved ) { |
|
3306 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3303 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3304 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3305 | + if ($config_saved && $net_saved) { |
|
3306 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3307 | 3307 | return TRUE; |
3308 | 3308 | } else { |
3309 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3309 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3310 | 3310 | return FALSE; |
3311 | 3311 | } |
3312 | 3312 | } |
@@ -3319,7 +3319,7 @@ discard block |
||
3319 | 3319 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3320 | 3320 | * @return array |
3321 | 3321 | */ |
3322 | - public function get_yes_no_values(){ |
|
3322 | + public function get_yes_no_values() { |
|
3323 | 3323 | return $this->_yes_no_values; |
3324 | 3324 | } |
3325 | 3325 | |
@@ -3341,8 +3341,8 @@ discard block |
||
3341 | 3341 | * |
3342 | 3342 | * @return string |
3343 | 3343 | */ |
3344 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3345 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3344 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3345 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3346 | 3346 | } |
3347 | 3347 | |
3348 | 3348 | |
@@ -3356,8 +3356,8 @@ discard block |
||
3356 | 3356 | * |
3357 | 3357 | * @return string |
3358 | 3358 | */ |
3359 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3360 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3359 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3360 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3361 | 3361 | } |
3362 | 3362 | |
3363 | 3363 | |
@@ -3376,8 +3376,8 @@ discard block |
||
3376 | 3376 | * @return bool success/fail |
3377 | 3377 | */ |
3378 | 3378 | protected function _process_resend_registration() { |
3379 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3380 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3379 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3380 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3381 | 3381 | return $this->_template_args['success']; |
3382 | 3382 | } |
3383 | 3383 | |
@@ -3390,9 +3390,9 @@ discard block |
||
3390 | 3390 | * @param \EE_Payment $payment |
3391 | 3391 | * @return bool success/fail |
3392 | 3392 | */ |
3393 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3394 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3395 | - $success = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment ); |
|
3393 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3394 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3395 | + $success = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', FALSE, $payment); |
|
3396 | 3396 | $this->_template_args['success'] = $success; |
3397 | 3397 | return $success; |
3398 | 3398 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if ( is_array( $hooks_to_fire_at_time ) ) { |
208 | 208 | foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
209 | 209 | if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
210 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
210 | + && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
211 | 211 | ) { |
212 | 212 | unset( $crons[ $timestamp ][ $hook_name ] ); |
213 | 213 | } |
@@ -1124,14 +1124,14 @@ discard block |
||
1124 | 1124 | $QSG_ID = reset( $id_col ); |
1125 | 1125 | } else { |
1126 | 1126 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1127 | - EE_Log::instance()->log( |
|
1128 | - __FILE__, |
|
1129 | - __FUNCTION__, |
|
1130 | - sprintf( |
|
1131 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1132 | - $QST_ID ), |
|
1133 | - 'error' ); |
|
1134 | - continue; |
|
1127 | + EE_Log::instance()->log( |
|
1128 | + __FILE__, |
|
1129 | + __FUNCTION__, |
|
1130 | + sprintf( |
|
1131 | + __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1132 | + $QST_ID ), |
|
1133 | + 'error' ); |
|
1134 | + continue; |
|
1135 | 1135 | } |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1139,8 +1139,8 @@ discard block |
||
1139 | 1139 | $wpdb->insert( |
1140 | 1140 | EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
1141 | 1141 | array( 'QSG_ID' => $QSG_ID, |
1142 | - 'QST_ID' => $QST_ID, |
|
1143 | - 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1142 | + 'QST_ID' => $QST_ID, |
|
1143 | + 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1144 | 1144 | ), |
1145 | 1145 | array( '%d', '%d', '%d' ) |
1146 | 1146 | ); |
@@ -1678,8 +1678,8 @@ discard block |
||
1678 | 1678 | } |
1679 | 1679 | } |
1680 | 1680 | } |
1681 | - //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1682 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1681 | + //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
|
1682 | + remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1683 | 1683 | |
1684 | 1684 | if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
1685 | 1685 | $db_update_sans_ee4 = array(); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * EEH_Activation Helper |
4 | 4 | * |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | * @param $table_name |
49 | 49 | * @return string |
50 | 50 | */ |
51 | - public static function ensure_table_name_has_prefix( $table_name ) { |
|
51 | + public static function ensure_table_name_has_prefix($table_name) { |
|
52 | 52 | global $wpdb; |
53 | - return strpos( $table_name, $wpdb->prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
53 | + return strpos($table_name, $wpdb->prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return boolean success, whether the database and folders are setup properly |
79 | 79 | * @throws \EE_Error |
80 | 80 | */ |
81 | - public static function initialize_db_and_folders(){ |
|
81 | + public static function initialize_db_and_folders() { |
|
82 | 82 | $good_filesystem = EEH_Activation::create_upload_directories(); |
83 | 83 | $good_db = EEH_Activation::create_database_tables(); |
84 | 84 | return $good_filesystem && $good_db; |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @throws \EE_Error |
96 | 96 | */ |
97 | - public static function initialize_db_content(){ |
|
97 | + public static function initialize_db_content() { |
|
98 | 98 | //let's avoid doing all this logic repeatedly, especially when addons are requesting it |
99 | - if( EEH_Activation::$_initialized_db_content_already_in_this_request ) { |
|
99 | + if (EEH_Activation::$_initialized_db_content_already_in_this_request) { |
|
100 | 100 | return; |
101 | 101 | } |
102 | 102 | EEH_Activation::$_initialized_db_content_already_in_this_request = true; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | EEH_Activation::remove_cron_tasks(); |
114 | 114 | EEH_Activation::create_cron_tasks(); |
115 | 115 | // remove all TXN locks since that is being done via extra meta now |
116 | - delete_option( 'ee_locked_transactions' ); |
|
116 | + delete_option('ee_locked_transactions'); |
|
117 | 117 | //also, check for CAF default db content |
118 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
118 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
119 | 119 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
120 | 120 | //which users really won't care about on initial activation |
121 | 121 | EE_Error::overwrite_success(); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return array |
135 | 135 | * @throws \EE_Error |
136 | 136 | */ |
137 | - public static function get_cron_tasks( $which_to_include ) { |
|
137 | + public static function get_cron_tasks($which_to_include) { |
|
138 | 138 | $cron_tasks = apply_filters( |
139 | 139 | 'FHEE__EEH_Activation__get_cron_tasks', |
140 | 140 | array( |
@@ -143,16 +143,16 @@ discard block |
||
143 | 143 | 'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates |
144 | 144 | ) |
145 | 145 | ); |
146 | - if ( $which_to_include === 'old' ) { |
|
146 | + if ($which_to_include === 'old') { |
|
147 | 147 | $cron_tasks = array_filter( |
148 | 148 | $cron_tasks, |
149 | - function ( $value ) { |
|
149 | + function($value) { |
|
150 | 150 | return $value === EEH_Activation::cron_task_no_longer_in_use; |
151 | 151 | } |
152 | 152 | ); |
153 | - } elseif ( $which_to_include === 'current' ) { |
|
154 | - $cron_tasks = array_filter( $cron_tasks ); |
|
155 | - } elseif ( WP_DEBUG && $which_to_include !== 'all' ) { |
|
153 | + } elseif ($which_to_include === 'current') { |
|
154 | + $cron_tasks = array_filter($cron_tasks); |
|
155 | + } elseif (WP_DEBUG && $which_to_include !== 'all') { |
|
156 | 156 | throw new EE_Error( |
157 | 157 | sprintf( |
158 | 158 | __( |
@@ -175,9 +175,9 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public static function create_cron_tasks() { |
177 | 177 | |
178 | - foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) { |
|
179 | - if( ! wp_next_scheduled( $hook_name ) ) { |
|
180 | - wp_schedule_event( time(), $frequency, $hook_name ); |
|
178 | + foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) { |
|
179 | + if ( ! wp_next_scheduled($hook_name)) { |
|
180 | + wp_schedule_event(time(), $frequency, $hook_name); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public static function remove_cron_tasks( $remove_all = true ) { |
|
194 | + public static function remove_cron_tasks($remove_all = true) { |
|
195 | 195 | $cron_tasks_to_remove = $remove_all ? 'all' : 'old'; |
196 | 196 | $crons = _get_cron_array(); |
197 | - $crons = is_array( $crons ) ? $crons : array(); |
|
197 | + $crons = is_array($crons) ? $crons : array(); |
|
198 | 198 | /* reminder of what $crons look like: |
199 | 199 | * Top-level keys are timestamps, and their values are arrays. |
200 | 200 | * The 2nd level arrays have keys with each of the cron task hook names to run at that time |
@@ -212,23 +212,23 @@ discard block |
||
212 | 212 | * ... |
213 | 213 | * ... |
214 | 214 | */ |
215 | - $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ); |
|
216 | - foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) { |
|
217 | - if ( is_array( $hooks_to_fire_at_time ) ) { |
|
218 | - foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) { |
|
219 | - if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
220 | - && is_array( $ee_cron_tasks_to_remove[ $hook_name ] ) |
|
215 | + $ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove); |
|
216 | + foreach ($crons as $timestamp => $hooks_to_fire_at_time) { |
|
217 | + if (is_array($hooks_to_fire_at_time)) { |
|
218 | + foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) { |
|
219 | + if (isset($ee_cron_tasks_to_remove[$hook_name]) |
|
220 | + && is_array($ee_cron_tasks_to_remove[$hook_name]) |
|
221 | 221 | ) { |
222 | - unset( $crons[ $timestamp ][ $hook_name ] ); |
|
222 | + unset($crons[$timestamp][$hook_name]); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | //also take care of any empty cron timestamps. |
226 | - if ( empty( $hooks_to_fire_at_time ) ) { |
|
227 | - unset( $crons[ $timestamp ] ); |
|
226 | + if (empty($hooks_to_fire_at_time)) { |
|
227 | + unset($crons[$timestamp]); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
231 | - _set_cron_array( $crons ); |
|
231 | + _set_cron_array($crons); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public static function CPT_initialization() { |
245 | 245 | // register Custom Post Types |
246 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
246 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
247 | 247 | flush_rewrite_rules(); |
248 | 248 | } |
249 | 249 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | * @return void |
262 | 262 | */ |
263 | 263 | public static function reset_and_update_config() { |
264 | - do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) ); |
|
265 | - add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 ); |
|
264 | + do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config')); |
|
265 | + add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3); |
|
266 | 266 | //EE_Config::reset(); |
267 | 267 | } |
268 | 268 | |
@@ -275,28 +275,28 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public static function load_calendar_config() { |
277 | 277 | // grab array of all plugin folders and loop thru it |
278 | - $plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR ); |
|
279 | - if ( empty( $plugins ) ) { |
|
278 | + $plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR); |
|
279 | + if (empty($plugins)) { |
|
280 | 280 | return; |
281 | 281 | } |
282 | - foreach ( $plugins as $plugin_path ) { |
|
282 | + foreach ($plugins as $plugin_path) { |
|
283 | 283 | // grab plugin folder name from path |
284 | - $plugin = basename( $plugin_path ); |
|
284 | + $plugin = basename($plugin_path); |
|
285 | 285 | // drill down to Espresso plugins |
286 | 286 | // then to calendar related plugins |
287 | 287 | if ( |
288 | - strpos( $plugin, 'espresso' ) !== FALSE |
|
289 | - || strpos( $plugin, 'Espresso' ) !== FALSE |
|
290 | - || strpos( $plugin, 'ee4' ) !== FALSE |
|
291 | - || strpos( $plugin, 'EE4' ) !== FALSE |
|
292 | - || strpos( $plugin, 'calendar' ) !== false |
|
288 | + strpos($plugin, 'espresso') !== FALSE |
|
289 | + || strpos($plugin, 'Espresso') !== FALSE |
|
290 | + || strpos($plugin, 'ee4') !== FALSE |
|
291 | + || strpos($plugin, 'EE4') !== FALSE |
|
292 | + || strpos($plugin, 'calendar') !== false |
|
293 | 293 | ) { |
294 | 294 | // this is what we are looking for |
295 | - $calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php'; |
|
295 | + $calendar_config = $plugin_path.DS.'EE_Calendar_Config.php'; |
|
296 | 296 | // does it exist in this folder ? |
297 | - if ( is_readable( $calendar_config )) { |
|
297 | + if (is_readable($calendar_config)) { |
|
298 | 298 | // YEAH! let's load it |
299 | - require_once( $calendar_config ); |
|
299 | + require_once($calendar_config); |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | } |
@@ -312,21 +312,21 @@ discard block |
||
312 | 312 | * @param \EE_Config $EE_Config |
313 | 313 | * @return \stdClass |
314 | 314 | */ |
315 | - public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) { |
|
316 | - $convert_from_array = array( 'addons' ); |
|
315 | + public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) { |
|
316 | + $convert_from_array = array('addons'); |
|
317 | 317 | // in case old settings were saved as an array |
318 | - if ( is_array( $settings ) && in_array( $config, $convert_from_array )) { |
|
318 | + if (is_array($settings) && in_array($config, $convert_from_array)) { |
|
319 | 319 | // convert existing settings to an object |
320 | 320 | $config_array = $settings; |
321 | 321 | $settings = new stdClass(); |
322 | - foreach ( $config_array as $key => $value ){ |
|
323 | - if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) { |
|
324 | - $EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value ); |
|
322 | + foreach ($config_array as $key => $value) { |
|
323 | + if ($key === 'calendar' && class_exists('EE_Calendar_Config')) { |
|
324 | + $EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value); |
|
325 | 325 | } else { |
326 | 326 | $settings->{$key} = $value; |
327 | 327 | } |
328 | 328 | } |
329 | - add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' ); |
|
329 | + add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true'); |
|
330 | 330 | } |
331 | 331 | return $settings; |
332 | 332 | } |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public static function deactivate_event_espresso() { |
344 | 344 | // check permissions |
345 | - if ( current_user_can( 'activate_plugins' )) { |
|
346 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
345 | + if (current_user_can('activate_plugins')) { |
|
346 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
@@ -365,25 +365,25 @@ discard block |
||
365 | 365 | $critical_pages = array( |
366 | 366 | array( |
367 | 367 | 'id' =>'reg_page_id', |
368 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
368 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
369 | 369 | 'post' => NULL, |
370 | 370 | 'code' => 'ESPRESSO_CHECKOUT' |
371 | 371 | ), |
372 | 372 | array( |
373 | 373 | 'id' => 'txn_page_id', |
374 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
374 | + 'name' => __('Transactions', 'event_espresso'), |
|
375 | 375 | 'post' => NULL, |
376 | 376 | 'code' => 'ESPRESSO_TXN_PAGE' |
377 | 377 | ), |
378 | 378 | array( |
379 | 379 | 'id' => 'thank_you_page_id', |
380 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
380 | + 'name' => __('Thank You', 'event_espresso'), |
|
381 | 381 | 'post' => NULL, |
382 | 382 | 'code' => 'ESPRESSO_THANK_YOU' |
383 | 383 | ), |
384 | 384 | array( |
385 | 385 | 'id' => 'cancel_page_id', |
386 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
386 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
387 | 387 | 'post' => NULL, |
388 | 388 | 'code' => 'ESPRESSO_CANCELLED' |
389 | 389 | ), |
@@ -391,62 +391,62 @@ discard block |
||
391 | 391 | |
392 | 392 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
393 | 393 | |
394 | - foreach ( $critical_pages as $critical_page ) { |
|
394 | + foreach ($critical_pages as $critical_page) { |
|
395 | 395 | // is critical page ID set in config ? |
396 | - if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) { |
|
396 | + if ($EE_Core_Config->{$critical_page['id']} !== FALSE) { |
|
397 | 397 | // attempt to find post by ID |
398 | - $critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} ); |
|
398 | + $critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} ); |
|
399 | 399 | } |
400 | 400 | // no dice? |
401 | - if ( $critical_page['post'] === null ) { |
|
401 | + if ($critical_page['post'] === null) { |
|
402 | 402 | // attempt to find post by title |
403 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
403 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
404 | 404 | // still nothing? |
405 | - if ( $critical_page['post'] === null ) { |
|
406 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
405 | + if ($critical_page['post'] === null) { |
|
406 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
407 | 407 | // REALLY? Still nothing ??!?!? |
408 | - if ( $critical_page['post'] === null ) { |
|
409 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
410 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
408 | + if ($critical_page['post'] === null) { |
|
409 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
410 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
411 | 411 | break; |
412 | 412 | } |
413 | 413 | } |
414 | 414 | } |
415 | 415 | // track post_shortcodes |
416 | - if ( $critical_page['post'] ) { |
|
417 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
416 | + if ($critical_page['post']) { |
|
417 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
418 | 418 | } |
419 | 419 | // check that Post ID matches critical page ID in config |
420 | 420 | if ( |
421 | - isset( $critical_page['post']->ID ) |
|
422 | - && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]} |
|
421 | + isset($critical_page['post']->ID) |
|
422 | + && $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']} |
|
423 | 423 | ) { |
424 | 424 | //update Config with post ID |
425 | - $EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID; |
|
426 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
427 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
428 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
425 | + $EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID; |
|
426 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
427 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
428 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | 432 | $critical_page_problem = |
433 | - ! isset( $critical_page['post']->post_status ) |
|
433 | + ! isset($critical_page['post']->post_status) |
|
434 | 434 | || $critical_page['post']->post_status !== 'publish' |
435 | - || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE |
|
435 | + || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE |
|
436 | 436 | ? TRUE |
437 | 437 | : $critical_page_problem; |
438 | 438 | |
439 | 439 | } |
440 | 440 | |
441 | - if ( $critical_page_problem ) { |
|
441 | + if ($critical_page_problem) { |
|
442 | 442 | $msg = sprintf( |
443 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
444 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
443 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
444 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
445 | 445 | ); |
446 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
446 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
447 | 447 | } |
448 | - if ( EE_Error::has_notices() ) { |
|
449 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
448 | + if (EE_Error::has_notices()) { |
|
449 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | * parameter to the shortcode |
459 | 459 | * @return WP_Post or NULl |
460 | 460 | */ |
461 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
461 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
462 | 462 | global $wpdb; |
463 | 463 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
464 | 464 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
465 | - if($post_id){ |
|
465 | + if ($post_id) { |
|
466 | 466 | return get_post($post_id); |
467 | - }else{ |
|
467 | + } else { |
|
468 | 468 | return NULL; |
469 | 469 | } |
470 | 470 | |
@@ -481,32 +481,32 @@ discard block |
||
481 | 481 | * @param array $critical_page |
482 | 482 | * @return array |
483 | 483 | */ |
484 | - public static function create_critical_page( $critical_page ) { |
|
484 | + public static function create_critical_page($critical_page) { |
|
485 | 485 | |
486 | 486 | $post_args = array( |
487 | 487 | 'post_title' => $critical_page['name'], |
488 | 488 | 'post_status' => 'publish', |
489 | 489 | 'post_type' => 'page', |
490 | 490 | 'comment_status' => 'closed', |
491 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
491 | + 'post_content' => '['.$critical_page['code'].']' |
|
492 | 492 | ); |
493 | 493 | |
494 | - $post_id = wp_insert_post( $post_args ); |
|
495 | - if ( ! $post_id ) { |
|
494 | + $post_id = wp_insert_post($post_args); |
|
495 | + if ( ! $post_id) { |
|
496 | 496 | $msg = sprintf( |
497 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
497 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
498 | 498 | $critical_page['name'] |
499 | 499 | ); |
500 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
500 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
501 | 501 | return $critical_page; |
502 | 502 | } |
503 | 503 | // get newly created post's details |
504 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
504 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
505 | 505 | $msg = sprintf( |
506 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
506 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
507 | 507 | $critical_page['name'] |
508 | 508 | ); |
509 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
509 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | return $critical_page; |
@@ -525,35 +525,35 @@ discard block |
||
525 | 525 | * @param array $critical_page |
526 | 526 | * @return void |
527 | 527 | */ |
528 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
528 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
529 | 529 | // check the goods |
530 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
530 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
531 | 531 | $msg = sprintf( |
532 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
532 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
533 | 533 | $critical_page['name'] |
534 | 534 | ); |
535 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
535 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
536 | 536 | return; |
537 | 537 | } |
538 | 538 | $EE_Core_Config = EE_Registry::instance()->CFG->core; |
539 | 539 | // map shortcode to post |
540 | - $EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
540 | + $EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
541 | 541 | // and make sure it's NOT added to the WP "Posts Page" |
542 | 542 | // name of the WP Posts Page |
543 | 543 | $posts_page = EE_Config::get_page_for_posts(); |
544 | - if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) { |
|
545 | - unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
544 | + if (isset($EE_Core_Config->post_shortcodes[$posts_page])) { |
|
545 | + unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]); |
|
546 | 546 | } |
547 | - if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) { |
|
548 | - unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
547 | + if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) { |
|
548 | + unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]); |
|
549 | 549 | } |
550 | 550 | // update post_shortcode CFG |
551 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
551 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
552 | 552 | $msg = sprintf( |
553 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
553 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
554 | 554 | $critical_page['name'] |
555 | 555 | ); |
556 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
556 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
@@ -571,24 +571,24 @@ discard block |
||
571 | 571 | public static function get_default_creator_id() { |
572 | 572 | global $wpdb; |
573 | 573 | |
574 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
574 | + if ( ! empty(self::$_default_creator_id)) { |
|
575 | 575 | return self::$_default_creator_id; |
576 | 576 | }/**/ |
577 | 577 | |
578 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
578 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
579 | 579 | |
580 | 580 | //let's allow pre_filtering for early exits by alternative methods for getting id. We check for truthy result and if so then exit early. |
581 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
582 | - if ( $pre_filtered_id !== false ) { |
|
581 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
582 | + if ($pre_filtered_id !== false) { |
|
583 | 583 | return (int) $pre_filtered_id; |
584 | 584 | } |
585 | 585 | |
586 | - $capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' ); |
|
587 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
588 | - $user_id = $wpdb->get_var( $query ); |
|
589 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
590 | - if ( $user_id && (int)$user_id ) { |
|
591 | - self::$_default_creator_id = (int)$user_id; |
|
586 | + $capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities'); |
|
587 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
588 | + $user_id = $wpdb->get_var($query); |
|
589 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
590 | + if ($user_id && (int) $user_id) { |
|
591 | + self::$_default_creator_id = (int) $user_id; |
|
592 | 592 | return self::$_default_creator_id; |
593 | 593 | } else { |
594 | 594 | return NULL; |
@@ -615,29 +615,29 @@ discard block |
||
615 | 615 | * @return void |
616 | 616 | * @throws EE_Error if there are database errors |
617 | 617 | */ |
618 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) { |
|
619 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
618 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) { |
|
619 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
620 | 620 | return; |
621 | 621 | } |
622 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
623 | - if ( ! function_exists( 'dbDelta' )) { |
|
624 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
622 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
623 | + if ( ! function_exists('dbDelta')) { |
|
624 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
625 | 625 | } |
626 | 626 | /** @var WPDB $wpdb */ |
627 | 627 | global $wpdb; |
628 | - $wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
628 | + $wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
629 | 629 | // do we need to first delete an existing version of this table ? |
630 | - if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
630 | + if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) { |
|
631 | 631 | // ok, delete the table... but ONLY if it's empty |
632 | - $deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name ); |
|
632 | + $deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name); |
|
633 | 633 | // table is NOT empty, are you SURE you want to delete this table ??? |
634 | - if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
635 | - EEH_Activation::delete_unused_db_table( $wp_table_name ); |
|
636 | - } else if ( ! $deleted_safely ) { |
|
634 | + if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
635 | + EEH_Activation::delete_unused_db_table($wp_table_name); |
|
636 | + } else if ( ! $deleted_safely) { |
|
637 | 637 | // so we should be more cautious rather than just dropping tables so easily |
638 | 638 | EE_Error::add_persistent_admin_notice( |
639 | - 'bad_table_' . $wp_table_name . '_detected', |
|
640 | - sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
639 | + 'bad_table_'.$wp_table_name.'_detected', |
|
640 | + sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
641 | 641 | $wp_table_name, |
642 | 642 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
643 | 643 | '<b>wp-config.php</b>', |
@@ -646,25 +646,25 @@ discard block |
||
646 | 646 | } |
647 | 647 | } |
648 | 648 | // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns ) |
649 | - if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) { |
|
649 | + if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) { |
|
650 | 650 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
651 | 651 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
652 | 652 | //happened. And then we can choose to tell the end user |
653 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
654 | - $old_error_suppression_policy = $wpdb->suppress_errors( FALSE ); |
|
653 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
654 | + $old_error_suppression_policy = $wpdb->suppress_errors(FALSE); |
|
655 | 655 | ob_start(); |
656 | - dbDelta( $SQL ); |
|
656 | + dbDelta($SQL); |
|
657 | 657 | $output = ob_get_contents(); |
658 | 658 | ob_end_clean(); |
659 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
660 | - $wpdb->suppress_errors( $old_error_suppression_policy ); |
|
661 | - if( ! empty( $output ) ){ |
|
662 | - throw new EE_Error( $output ); |
|
659 | + $wpdb->show_errors($old_show_errors_policy); |
|
660 | + $wpdb->suppress_errors($old_error_suppression_policy); |
|
661 | + if ( ! empty($output)) { |
|
662 | + throw new EE_Error($output); |
|
663 | 663 | } |
664 | 664 | } else { |
665 | 665 | throw new EE_Error( |
666 | 666 | sprintf( |
667 | - __( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ), |
|
667 | + __('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'), |
|
668 | 668 | '<br />', |
669 | 669 | $sql |
670 | 670 | ) |
@@ -686,15 +686,15 @@ discard block |
||
686 | 686 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
687 | 687 | * @return bool|int |
688 | 688 | */ |
689 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
690 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
689 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
690 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
691 | 691 | return FALSE; |
692 | 692 | } |
693 | 693 | global $wpdb; |
694 | - $full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
694 | + $full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
695 | 695 | $fields = self::get_fields_on_table($table_name); |
696 | - if (!in_array($column_name, $fields)){ |
|
697 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
696 | + if ( ! in_array($column_name, $fields)) { |
|
697 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
698 | 698 | //echo "alter query:$alter_query"; |
699 | 699 | return $wpdb->query($alter_query); |
700 | 700 | } |
@@ -713,14 +713,14 @@ discard block |
||
713 | 713 | * @param string $table_name, without prefixed $wpdb->prefix |
714 | 714 | * @return array of database column names |
715 | 715 | */ |
716 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
716 | + public static function get_fields_on_table($table_name = NULL) { |
|
717 | 717 | global $wpdb; |
718 | - $table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
719 | - if ( ! empty( $table_name )) { |
|
718 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
719 | + if ( ! empty($table_name)) { |
|
720 | 720 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
721 | 721 | if ($columns !== FALSE) { |
722 | 722 | $field_array = array(); |
723 | - foreach($columns as $column ){ |
|
723 | + foreach ($columns as $column) { |
|
724 | 724 | $field_array[] = $column->Field; |
725 | 725 | } |
726 | 726 | return $field_array; |
@@ -739,12 +739,12 @@ discard block |
||
739 | 739 | * @param string $table_name |
740 | 740 | * @return bool |
741 | 741 | */ |
742 | - public static function db_table_is_empty( $table_name ) { |
|
742 | + public static function db_table_is_empty($table_name) { |
|
743 | 743 | global $wpdb; |
744 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
745 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
746 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
747 | - return absint( $count ) === 0 ? true : false; |
|
744 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
745 | + if (EEH_Activation::table_exists($table_name)) { |
|
746 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
747 | + return absint($count) === 0 ? true : false; |
|
748 | 748 | } |
749 | 749 | return false; |
750 | 750 | } |
@@ -759,9 +759,9 @@ discard block |
||
759 | 759 | * @param string $table_name |
760 | 760 | * @return bool | int |
761 | 761 | */ |
762 | - public static function delete_db_table_if_empty( $table_name ) { |
|
763 | - if ( EEH_Activation::db_table_is_empty( $table_name ) ) { |
|
764 | - return EEH_Activation::delete_unused_db_table( $table_name ); |
|
762 | + public static function delete_db_table_if_empty($table_name) { |
|
763 | + if (EEH_Activation::db_table_is_empty($table_name)) { |
|
764 | + return EEH_Activation::delete_unused_db_table($table_name); |
|
765 | 765 | } |
766 | 766 | return false; |
767 | 767 | } |
@@ -776,11 +776,11 @@ discard block |
||
776 | 776 | * @param string $table_name |
777 | 777 | * @return bool | int |
778 | 778 | */ |
779 | - public static function delete_unused_db_table( $table_name ) { |
|
779 | + public static function delete_unused_db_table($table_name) { |
|
780 | 780 | global $wpdb; |
781 | - if ( EEH_Activation::table_exists( $table_name ) ) { |
|
782 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
783 | - return $wpdb->query( "DROP TABLE IF EXISTS $table_name" ); |
|
781 | + if (EEH_Activation::table_exists($table_name)) { |
|
782 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
783 | + return $wpdb->query("DROP TABLE IF EXISTS $table_name"); |
|
784 | 784 | } |
785 | 785 | return false; |
786 | 786 | } |
@@ -796,18 +796,18 @@ discard block |
||
796 | 796 | * @param string $index_name |
797 | 797 | * @return bool | int |
798 | 798 | */ |
799 | - public static function drop_index( $table_name, $index_name ) { |
|
800 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
799 | + public static function drop_index($table_name, $index_name) { |
|
800 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
801 | 801 | return FALSE; |
802 | 802 | } |
803 | 803 | global $wpdb; |
804 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
804 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
805 | 805 | $index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'"; |
806 | 806 | if ( |
807 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) === $table_name |
|
808 | - && $wpdb->get_var( $index_exists_query ) === $table_name //using get_var with the $index_exists_query returns the table's name |
|
807 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name'") === $table_name |
|
808 | + && $wpdb->get_var($index_exists_query) === $table_name //using get_var with the $index_exists_query returns the table's name |
|
809 | 809 | ) { |
810 | - return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" ); |
|
810 | + return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name"); |
|
811 | 811 | } |
812 | 812 | return TRUE; |
813 | 813 | } |
@@ -823,27 +823,27 @@ discard block |
||
823 | 823 | * @return boolean success (whether database is setup properly or not) |
824 | 824 | */ |
825 | 825 | public static function create_database_tables() { |
826 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
826 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
827 | 827 | //find the migration script that sets the database to be compatible with the code |
828 | 828 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
829 | - if( $dms_name ){ |
|
830 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
831 | - $current_data_migration_script->set_migrating( false ); |
|
829 | + if ($dms_name) { |
|
830 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
831 | + $current_data_migration_script->set_migrating(false); |
|
832 | 832 | $current_data_migration_script->schema_changes_before_migration(); |
833 | 833 | $current_data_migration_script->schema_changes_after_migration(); |
834 | - if( $current_data_migration_script->get_errors() ){ |
|
835 | - if( WP_DEBUG ){ |
|
836 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
837 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
834 | + if ($current_data_migration_script->get_errors()) { |
|
835 | + if (WP_DEBUG) { |
|
836 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
837 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
838 | 838 | } |
839 | - }else{ |
|
840 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
839 | + } else { |
|
840 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
841 | 841 | } |
842 | 842 | return false; |
843 | 843 | } |
844 | 844 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
845 | - }else{ |
|
846 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
845 | + } else { |
|
846 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
847 | 847 | return false; |
848 | 848 | } |
849 | 849 | return true; |
@@ -863,27 +863,27 @@ discard block |
||
863 | 863 | public static function initialize_system_questions() { |
864 | 864 | // QUESTION GROUPS |
865 | 865 | global $wpdb; |
866 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' ); |
|
866 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group'); |
|
867 | 867 | $SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0"; |
868 | 868 | // what we have |
869 | - $question_groups = $wpdb->get_col( $SQL ); |
|
869 | + $question_groups = $wpdb->get_col($SQL); |
|
870 | 870 | // check the response |
871 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
871 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
872 | 872 | // what we should have |
873 | - $QSG_systems = array( 1, 2 ); |
|
873 | + $QSG_systems = array(1, 2); |
|
874 | 874 | // loop thru what we should have and compare to what we have |
875 | - foreach ( $QSG_systems as $QSG_system ) { |
|
875 | + foreach ($QSG_systems as $QSG_system) { |
|
876 | 876 | // reset values array |
877 | 877 | $QSG_values = array(); |
878 | 878 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
879 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
879 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
880 | 880 | // add it |
881 | - switch ( $QSG_system ) { |
|
881 | + switch ($QSG_system) { |
|
882 | 882 | |
883 | 883 | case 1: |
884 | 884 | $QSG_values = array( |
885 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
886 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
885 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
886 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
887 | 887 | 'QSG_desc' => '', |
888 | 888 | 'QSG_order' => 1, |
889 | 889 | 'QSG_show_group_name' => 1, |
@@ -895,8 +895,8 @@ discard block |
||
895 | 895 | |
896 | 896 | case 2: |
897 | 897 | $QSG_values = array( |
898 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
899 | - 'QSG_identifier' => 'address-information-' . time(), |
|
898 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
899 | + 'QSG_identifier' => 'address-information-'.time(), |
|
900 | 900 | 'QSG_desc' => '', |
901 | 901 | 'QSG_order' => 2, |
902 | 902 | 'QSG_show_group_name' => 1, |
@@ -908,14 +908,14 @@ discard block |
||
908 | 908 | |
909 | 909 | } |
910 | 910 | // make sure we have some values before inserting them |
911 | - if ( ! empty( $QSG_values )) { |
|
911 | + if ( ! empty($QSG_values)) { |
|
912 | 912 | // insert system question |
913 | 913 | $wpdb->insert( |
914 | 914 | $table_name, |
915 | 915 | $QSG_values, |
916 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
916 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
917 | 917 | ); |
918 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
918 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | } |
@@ -924,10 +924,10 @@ discard block |
||
924 | 924 | |
925 | 925 | // QUESTIONS |
926 | 926 | global $wpdb; |
927 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' ); |
|
927 | + $table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question'); |
|
928 | 928 | $SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''"; |
929 | 929 | // what we have |
930 | - $questions = $wpdb->get_col( $SQL ); |
|
930 | + $questions = $wpdb->get_col($SQL); |
|
931 | 931 | // what we should have |
932 | 932 | $QST_systems = array( |
933 | 933 | 'fname', |
@@ -944,25 +944,25 @@ discard block |
||
944 | 944 | $order_for_group_1 = 1; |
945 | 945 | $order_for_group_2 = 1; |
946 | 946 | // loop thru what we should have and compare to what we have |
947 | - foreach ( $QST_systems as $QST_system ) { |
|
947 | + foreach ($QST_systems as $QST_system) { |
|
948 | 948 | // reset values array |
949 | 949 | $QST_values = array(); |
950 | 950 | // if we don't have what we should have |
951 | - if ( ! in_array( $QST_system, $questions )) { |
|
951 | + if ( ! in_array($QST_system, $questions)) { |
|
952 | 952 | // add it |
953 | - switch ( $QST_system ) { |
|
953 | + switch ($QST_system) { |
|
954 | 954 | |
955 | 955 | case 'fname': |
956 | 956 | $QST_values = array( |
957 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
958 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
957 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
958 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
959 | 959 | 'QST_system' => 'fname', |
960 | 960 | 'QST_type' => 'TEXT', |
961 | 961 | 'QST_required' => 1, |
962 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
962 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
963 | 963 | 'QST_order' => 1, |
964 | 964 | 'QST_admin_only' => 0, |
965 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
965 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
966 | 966 | 'QST_wp_user' => self::get_default_creator_id(), |
967 | 967 | 'QST_deleted' => 0 |
968 | 968 | ); |
@@ -970,15 +970,15 @@ discard block |
||
970 | 970 | |
971 | 971 | case 'lname': |
972 | 972 | $QST_values = array( |
973 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
974 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
973 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
974 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
975 | 975 | 'QST_system' => 'lname', |
976 | 976 | 'QST_type' => 'TEXT', |
977 | 977 | 'QST_required' => 1, |
978 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
978 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
979 | 979 | 'QST_order' => 2, |
980 | 980 | 'QST_admin_only' => 0, |
981 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
981 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
982 | 982 | 'QST_wp_user' => self::get_default_creator_id(), |
983 | 983 | 'QST_deleted' => 0 |
984 | 984 | ); |
@@ -986,15 +986,15 @@ discard block |
||
986 | 986 | |
987 | 987 | case 'email': |
988 | 988 | $QST_values = array( |
989 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
990 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
989 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
990 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
991 | 991 | 'QST_system' => 'email', |
992 | 992 | 'QST_type' => 'TEXT', |
993 | 993 | 'QST_required' => 1, |
994 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
994 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
995 | 995 | 'QST_order' => 3, |
996 | 996 | 'QST_admin_only' => 0, |
997 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
997 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
998 | 998 | 'QST_wp_user' => self::get_default_creator_id(), |
999 | 999 | 'QST_deleted' => 0 |
1000 | 1000 | ); |
@@ -1002,15 +1002,15 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | case 'address': |
1004 | 1004 | $QST_values = array( |
1005 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
1006 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
1005 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
1006 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
1007 | 1007 | 'QST_system' => 'address', |
1008 | 1008 | 'QST_type' => 'TEXT', |
1009 | 1009 | 'QST_required' => 0, |
1010 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1010 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1011 | 1011 | 'QST_order' => 4, |
1012 | 1012 | 'QST_admin_only' => 0, |
1013 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1013 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1014 | 1014 | 'QST_wp_user' => self::get_default_creator_id(), |
1015 | 1015 | 'QST_deleted' => 0 |
1016 | 1016 | ); |
@@ -1018,15 +1018,15 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | case 'address2': |
1020 | 1020 | $QST_values = array( |
1021 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
1022 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
1021 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
1022 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
1023 | 1023 | 'QST_system' => 'address2', |
1024 | 1024 | 'QST_type' => 'TEXT', |
1025 | 1025 | 'QST_required' => 0, |
1026 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1026 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1027 | 1027 | 'QST_order' => 5, |
1028 | 1028 | 'QST_admin_only' => 0, |
1029 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1029 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1030 | 1030 | 'QST_wp_user' => self::get_default_creator_id(), |
1031 | 1031 | 'QST_deleted' => 0 |
1032 | 1032 | ); |
@@ -1034,15 +1034,15 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | case 'city': |
1036 | 1036 | $QST_values = array( |
1037 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
1038 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
1037 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
1038 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
1039 | 1039 | 'QST_system' => 'city', |
1040 | 1040 | 'QST_type' => 'TEXT', |
1041 | 1041 | 'QST_required' => 0, |
1042 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1042 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1043 | 1043 | 'QST_order' => 6, |
1044 | 1044 | 'QST_admin_only' => 0, |
1045 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1045 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1046 | 1046 | 'QST_wp_user' => self::get_default_creator_id(), |
1047 | 1047 | 'QST_deleted' => 0 |
1048 | 1048 | ); |
@@ -1050,12 +1050,12 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | case 'state': |
1052 | 1052 | $QST_values = array( |
1053 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
1054 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
1053 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
1054 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
1055 | 1055 | 'QST_system' => 'state', |
1056 | 1056 | 'QST_type' => 'STATE', |
1057 | 1057 | 'QST_required' => 0, |
1058 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1058 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1059 | 1059 | 'QST_order' => 7, |
1060 | 1060 | 'QST_admin_only' => 0, |
1061 | 1061 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1065,12 +1065,12 @@ discard block |
||
1065 | 1065 | |
1066 | 1066 | case 'country' : |
1067 | 1067 | $QST_values = array( |
1068 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
1069 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
1068 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
1069 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
1070 | 1070 | 'QST_system' => 'country', |
1071 | 1071 | 'QST_type' => 'COUNTRY', |
1072 | 1072 | 'QST_required' => 0, |
1073 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1073 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1074 | 1074 | 'QST_order' => 8, |
1075 | 1075 | 'QST_admin_only' => 0, |
1076 | 1076 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -1080,15 +1080,15 @@ discard block |
||
1080 | 1080 | |
1081 | 1081 | case 'zip': |
1082 | 1082 | $QST_values = array( |
1083 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
1084 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
1083 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
1084 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
1085 | 1085 | 'QST_system' => 'zip', |
1086 | 1086 | 'QST_type' => 'TEXT', |
1087 | 1087 | 'QST_required' => 0, |
1088 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1088 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1089 | 1089 | 'QST_order' => 9, |
1090 | 1090 | 'QST_admin_only' => 0, |
1091 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1091 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1092 | 1092 | 'QST_wp_user' => self::get_default_creator_id(), |
1093 | 1093 | 'QST_deleted' => 0 |
1094 | 1094 | ); |
@@ -1096,49 +1096,49 @@ discard block |
||
1096 | 1096 | |
1097 | 1097 | case 'phone': |
1098 | 1098 | $QST_values = array( |
1099 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
1100 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
1099 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
1100 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
1101 | 1101 | 'QST_system' => 'phone', |
1102 | 1102 | 'QST_type' => 'TEXT', |
1103 | 1103 | 'QST_required' => 0, |
1104 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
1104 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
1105 | 1105 | 'QST_order' => 10, |
1106 | 1106 | 'QST_admin_only' => 0, |
1107 | - 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ), |
|
1107 | + 'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system), |
|
1108 | 1108 | 'QST_wp_user' => self::get_default_creator_id(), |
1109 | 1109 | 'QST_deleted' => 0 |
1110 | 1110 | ); |
1111 | 1111 | break; |
1112 | 1112 | |
1113 | 1113 | } |
1114 | - if ( ! empty( $QST_values )) { |
|
1114 | + if ( ! empty($QST_values)) { |
|
1115 | 1115 | // insert system question |
1116 | 1116 | $wpdb->insert( |
1117 | 1117 | $table_name, |
1118 | 1118 | $QST_values, |
1119 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
1119 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
1120 | 1120 | ); |
1121 | 1121 | $QST_ID = $wpdb->insert_id; |
1122 | 1122 | |
1123 | 1123 | // QUESTION GROUP QUESTIONS |
1124 | - if( in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) { |
|
1124 | + if (in_array($QST_system, array('fname', 'lname', 'email'))) { |
|
1125 | 1125 | $system_question_we_want = EEM_Question_Group::system_personal; |
1126 | 1126 | } else { |
1127 | 1127 | $system_question_we_want = EEM_Question_Group::system_address; |
1128 | 1128 | } |
1129 | - if( isset( $QSG_IDs[ $system_question_we_want ] ) ) { |
|
1130 | - $QSG_ID = $QSG_IDs[ $system_question_we_want ]; |
|
1129 | + if (isset($QSG_IDs[$system_question_we_want])) { |
|
1130 | + $QSG_ID = $QSG_IDs[$system_question_we_want]; |
|
1131 | 1131 | } else { |
1132 | - $id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) ); |
|
1133 | - if( is_array( $id_col ) ) { |
|
1134 | - $QSG_ID = reset( $id_col ); |
|
1132 | + $id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want))); |
|
1133 | + if (is_array($id_col)) { |
|
1134 | + $QSG_ID = reset($id_col); |
|
1135 | 1135 | } else { |
1136 | 1136 | //ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method |
1137 | 1137 | EE_Log::instance()->log( |
1138 | 1138 | __FILE__, |
1139 | 1139 | __FUNCTION__, |
1140 | 1140 | sprintf( |
1141 | - __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1141 | + __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'), |
|
1142 | 1142 | $QST_ID ), |
1143 | 1143 | 'error' ); |
1144 | 1144 | continue; |
@@ -1147,12 +1147,12 @@ discard block |
||
1147 | 1147 | |
1148 | 1148 | // add system questions to groups |
1149 | 1149 | $wpdb->insert( |
1150 | - EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ), |
|
1151 | - array( 'QSG_ID' => $QSG_ID, |
|
1150 | + EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'), |
|
1151 | + array('QSG_ID' => $QSG_ID, |
|
1152 | 1152 | 'QST_ID' => $QST_ID, |
1153 | - 'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++ |
|
1153 | + 'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++ |
|
1154 | 1154 | ), |
1155 | - array( '%d', '%d', '%d' ) |
|
1155 | + array('%d', '%d', '%d') |
|
1156 | 1156 | ); |
1157 | 1157 | } |
1158 | 1158 | } |
@@ -1168,11 +1168,11 @@ discard block |
||
1168 | 1168 | * |
1169 | 1169 | * @throws \EE_Error |
1170 | 1170 | */ |
1171 | - public static function insert_default_payment_methods(){ |
|
1172 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
1173 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
1174 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
1175 | - }else{ |
|
1171 | + public static function insert_default_payment_methods() { |
|
1172 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
1173 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
1174 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
1175 | + } else { |
|
1176 | 1176 | EEM_Payment_Method::instance()->verify_button_urls(); |
1177 | 1177 | } |
1178 | 1178 | } |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | |
1189 | 1189 | global $wpdb; |
1190 | 1190 | |
1191 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
1191 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
1192 | 1192 | |
1193 | 1193 | $table_name = EEM_Status::instance()->table(); |
1194 | 1194 | |
@@ -1258,33 +1258,33 @@ discard block |
||
1258 | 1258 | $folders = array( |
1259 | 1259 | EVENT_ESPRESSO_TEMPLATE_DIR, |
1260 | 1260 | EVENT_ESPRESSO_GATEWAY_DIR, |
1261 | - EVENT_ESPRESSO_UPLOAD_DIR . 'logs/', |
|
1262 | - EVENT_ESPRESSO_UPLOAD_DIR . 'css/', |
|
1263 | - EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/' |
|
1261 | + EVENT_ESPRESSO_UPLOAD_DIR.'logs/', |
|
1262 | + EVENT_ESPRESSO_UPLOAD_DIR.'css/', |
|
1263 | + EVENT_ESPRESSO_UPLOAD_DIR.'tickets/' |
|
1264 | 1264 | ); |
1265 | - foreach ( $folders as $folder ) { |
|
1265 | + foreach ($folders as $folder) { |
|
1266 | 1266 | try { |
1267 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
1268 | - @ chmod( $folder, 0755 ); |
|
1269 | - } catch( EE_Error $e ){ |
|
1267 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
1268 | + @ chmod($folder, 0755); |
|
1269 | + } catch (EE_Error $e) { |
|
1270 | 1270 | EE_Error::add_error( |
1271 | 1271 | sprintf( |
1272 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
1272 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
1273 | 1273 | $folder, |
1274 | - '<br />' . $e->getMessage() |
|
1274 | + '<br />'.$e->getMessage() |
|
1275 | 1275 | ), |
1276 | 1276 | __FILE__, __FUNCTION__, __LINE__ |
1277 | 1277 | ); |
1278 | 1278 | //indicate we'll need to fix this later |
1279 | - update_option( EEH_Activation::upload_directories_incomplete_option_name, true ); |
|
1279 | + update_option(EEH_Activation::upload_directories_incomplete_option_name, true); |
|
1280 | 1280 | return FALSE; |
1281 | 1281 | } |
1282 | 1282 | } |
1283 | 1283 | //just add the .htaccess file to the logs directory to begin with. Even if logging |
1284 | 1284 | //is disabled, there might be activation errors recorded in there |
1285 | - EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' ); |
|
1285 | + EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/'); |
|
1286 | 1286 | //remember EE's folders are all good |
1287 | - delete_option( EEH_Activation::upload_directories_incomplete_option_name ); |
|
1287 | + delete_option(EEH_Activation::upload_directories_incomplete_option_name); |
|
1288 | 1288 | return TRUE; |
1289 | 1289 | } |
1290 | 1290 | |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | * @return boolean |
1298 | 1298 | */ |
1299 | 1299 | public static function upload_directories_incomplete() { |
1300 | - return get_option( EEH_Activation::upload_directories_incomplete_option_name, false ); |
|
1300 | + return get_option(EEH_Activation::upload_directories_incomplete_option_name, false); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | |
@@ -1321,10 +1321,10 @@ discard block |
||
1321 | 1321 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1322 | 1322 | |
1323 | 1323 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
1324 | - foreach ( $installed['messengers'] as $msgr ) { |
|
1325 | - if ( $msgr instanceof EE_messenger ) { |
|
1324 | + foreach ($installed['messengers'] as $msgr) { |
|
1325 | + if ($msgr instanceof EE_messenger) { |
|
1326 | 1326 | $installed_messengers[$msgr->name] = $msgr; |
1327 | - if ( $msgr->activate_on_install ) { |
|
1327 | + if ($msgr->activate_on_install) { |
|
1328 | 1328 | $default_messengers[] = $msgr->name; |
1329 | 1329 | } |
1330 | 1330 | } |
@@ -1334,38 +1334,38 @@ discard block |
||
1334 | 1334 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
1335 | 1335 | |
1336 | 1336 | //things that have already been activated before |
1337 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
1337 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
1338 | 1338 | |
1339 | 1339 | //do an initial loop to determine if we need to continue |
1340 | 1340 | $def_ms = array(); |
1341 | - foreach ( $default_messengers as $msgr ) { |
|
1342 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) { |
|
1341 | + foreach ($default_messengers as $msgr) { |
|
1342 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) { |
|
1343 | 1343 | continue; |
1344 | 1344 | } |
1345 | 1345 | $def_ms[] = $msgr; |
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | //setup the $installed_mts in an array |
1349 | - foreach ( $installed['message_types'] as $imt ) { |
|
1350 | - if ( $imt instanceof EE_message_type ) { |
|
1349 | + foreach ($installed['message_types'] as $imt) { |
|
1350 | + if ($imt instanceof EE_message_type) { |
|
1351 | 1351 | $installed_mts[$imt->name] = $imt; |
1352 | 1352 | } |
1353 | 1353 | } |
1354 | 1354 | |
1355 | 1355 | //loop through default array for default messengers (if present) |
1356 | - if ( ! empty( $def_ms ) ) { |
|
1357 | - foreach ( $def_ms as $messenger ) { |
|
1356 | + if ( ! empty($def_ms)) { |
|
1357 | + foreach ($def_ms as $messenger) { |
|
1358 | 1358 | //all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger. |
1359 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
1359 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1360 | 1360 | continue; |
1361 | 1361 | } |
1362 | 1362 | /** @var EE_messenger[] $installed_messengers */ |
1363 | 1363 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
1364 | 1364 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
1365 | - foreach ( $default_mts as $index => $mt ) { |
|
1365 | + foreach ($default_mts as $index => $mt) { |
|
1366 | 1366 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1367 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1368 | - unset( $default_mts[$index] ); |
|
1367 | + if ( ! isset($installed_mts[$mt])) { |
|
1368 | + unset($default_mts[$index]); |
|
1369 | 1369 | continue; |
1370 | 1370 | } |
1371 | 1371 | |
@@ -1374,41 +1374,41 @@ discard block |
||
1374 | 1374 | /** @var EE_message_type[] $installed_mts */ |
1375 | 1375 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1376 | 1376 | $settings = array(); |
1377 | - if ( is_array( $settings_fields ) ) { |
|
1378 | - foreach ( $settings_fields as $field => $values ) { |
|
1379 | - if ( isset( $values['default'] ) ) { |
|
1377 | + if (is_array($settings_fields)) { |
|
1378 | + foreach ($settings_fields as $field => $values) { |
|
1379 | + if (isset($values['default'])) { |
|
1380 | 1380 | $settings[$field] = $values['default']; |
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | } |
1384 | 1384 | |
1385 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1385 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1386 | 1386 | $has_activated[$messenger][] = $mt; |
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | //setup any initial settings for the messenger |
1390 | 1390 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
1391 | 1391 | |
1392 | - if ( !empty( $msgr_settings ) ) { |
|
1393 | - foreach ( $msgr_settings as $field => $value ) { |
|
1392 | + if ( ! empty($msgr_settings)) { |
|
1393 | + foreach ($msgr_settings as $field => $value) { |
|
1394 | 1394 | $active_messengers[$messenger]['settings'][$field] = $value; |
1395 | 1395 | } |
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
1399 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1399 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1400 | 1400 | |
1401 | 1401 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
1402 | - if ( !empty( $default_mts ) ) { |
|
1403 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
1402 | + if ( ! empty($default_mts)) { |
|
1403 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
1404 | 1404 | } |
1405 | 1405 | } |
1406 | 1406 | } //end check for empty( $def_ms ) |
1407 | 1407 | |
1408 | 1408 | //still need to see if there are any message types to activate for active messengers |
1409 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
1409 | + foreach ($active_messengers as $messenger => $settings) { |
|
1410 | 1410 | $msg_obj = $settings['obj']; |
1411 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
1411 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
1412 | 1412 | continue; |
1413 | 1413 | } |
1414 | 1414 | |
@@ -1416,49 +1416,49 @@ discard block |
||
1416 | 1416 | $new_default_mts = array(); |
1417 | 1417 | |
1418 | 1418 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
1419 | - foreach( $all_default_mts as $index => $mt ) { |
|
1419 | + foreach ($all_default_mts as $index => $mt) { |
|
1420 | 1420 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
1421 | 1421 | if ( |
1422 | - isset( $active_messengers[ $messenger ]['settings'][ $messenger . '-message_types' ][ $mt ] ) |
|
1423 | - || ( isset( $has_activated[ $messenger ] ) && in_array( $mt, $has_activated[ $messenger ] ) ) |
|
1424 | - || EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) |
|
1422 | + isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) |
|
1423 | + || (isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) |
|
1424 | + || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE) |
|
1425 | 1425 | ) { |
1426 | 1426 | continue; |
1427 | 1427 | } |
1428 | 1428 | |
1429 | 1429 | //is there an installed_mt matching the default string? If not then nothing to do here. |
1430 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
1431 | - unset( $all_default_mts[$mt] ); |
|
1430 | + if ( ! isset($installed_mts[$mt])) { |
|
1431 | + unset($all_default_mts[$mt]); |
|
1432 | 1432 | continue; |
1433 | 1433 | } |
1434 | 1434 | |
1435 | 1435 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
1436 | 1436 | $settings = array(); |
1437 | - if ( is_array( $settings_fields ) ) { |
|
1438 | - foreach ( $settings_fields as $field => $values ) { |
|
1439 | - if ( isset( $values['default'] ) ) { |
|
1437 | + if (is_array($settings_fields)) { |
|
1438 | + foreach ($settings_fields as $field => $values) { |
|
1439 | + if (isset($values['default'])) { |
|
1440 | 1440 | $settings[$field] = $values['default']; |
1441 | 1441 | } |
1442 | 1442 | } |
1443 | 1443 | } |
1444 | 1444 | |
1445 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
1445 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
1446 | 1446 | $new_default_mts[] = $mt; |
1447 | 1447 | $has_activated[$messenger][] = $mt; |
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | |
1451 | - if ( ! empty( $new_default_mts ) ) { |
|
1452 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
1451 | + if ( ! empty($new_default_mts)) { |
|
1452 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | //now let's save the settings for this messenger! |
1458 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1458 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1459 | 1459 | |
1460 | 1460 | //update $has_activated record |
1461 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
1461 | + update_option('ee_has_activated_messenger', $has_activated); |
|
1462 | 1462 | |
1463 | 1463 | //that's it! |
1464 | 1464 | return $success; |
@@ -1482,40 +1482,40 @@ discard block |
||
1482 | 1482 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
1483 | 1483 | $installed_messengers = $installed_mts = array(); |
1484 | 1484 | //set up the arrays so they can be handled easier. |
1485 | - foreach( $installed['messengers'] as $im ) { |
|
1486 | - if ( $im instanceof EE_messenger ) { |
|
1485 | + foreach ($installed['messengers'] as $im) { |
|
1486 | + if ($im instanceof EE_messenger) { |
|
1487 | 1487 | $installed_messengers[$im->name] = $im; |
1488 | 1488 | } |
1489 | 1489 | } |
1490 | - foreach( $installed['message_types'] as $imt ) { |
|
1491 | - if ( $imt instanceof EE_message_type ) { |
|
1490 | + foreach ($installed['message_types'] as $imt) { |
|
1491 | + if ($imt instanceof EE_message_type) { |
|
1492 | 1492 | $installed_mts[$imt->name] = $imt; |
1493 | 1493 | } |
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | //now let's loop through the active array and validate |
1497 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
1497 | + foreach ($active_messengers as $messenger => $active_details) { |
|
1498 | 1498 | //first let's see if this messenger is installed. |
1499 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
1499 | + if ( ! isset($installed_messengers[$messenger])) { |
|
1500 | 1500 | //not set so let's just remove from actives and make sure templates are inactive. |
1501 | - unset( $active_messengers[$messenger] ); |
|
1502 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
1501 | + unset($active_messengers[$messenger]); |
|
1502 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
1503 | 1503 | continue; |
1504 | 1504 | } |
1505 | 1505 | |
1506 | 1506 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
1507 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
1508 | - foreach ( $mts as $mt_name => $mt ) { |
|
1509 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
1510 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
1511 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
1507 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
1508 | + foreach ($mts as $mt_name => $mt) { |
|
1509 | + if ( ! isset($installed_mts[$mt_name])) { |
|
1510 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
1511 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
1512 | 1512 | } |
1513 | 1513 | } |
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | //all done! let's update the active_messengers. |
1517 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
1518 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
1517 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
1518 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
1519 | 1519 | } |
1520 | 1520 | |
1521 | 1521 | |
@@ -1528,12 +1528,12 @@ discard block |
||
1528 | 1528 | * @static |
1529 | 1529 | * @return void |
1530 | 1530 | */ |
1531 | - public static function create_no_ticket_prices_array(){ |
|
1531 | + public static function create_no_ticket_prices_array() { |
|
1532 | 1532 | // this creates an array for tracking events that have no active ticket prices created |
1533 | 1533 | // this allows us to warn admins of the situation so that it can be corrected |
1534 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
1535 | - if ( ! $espresso_no_ticket_prices ) { |
|
1536 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
1534 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
1535 | + if ( ! $espresso_no_ticket_prices) { |
|
1536 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
1537 | 1537 | } |
1538 | 1538 | } |
1539 | 1539 | |
@@ -1557,24 +1557,24 @@ discard block |
||
1557 | 1557 | * @global wpdb $wpdb |
1558 | 1558 | * @throws \EE_Error |
1559 | 1559 | */ |
1560 | - public static function delete_all_espresso_cpt_data(){ |
|
1560 | + public static function delete_all_espresso_cpt_data() { |
|
1561 | 1561 | global $wpdb; |
1562 | 1562 | //get all the CPT post_types |
1563 | 1563 | $ee_post_types = array(); |
1564 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
1565 | - if ( method_exists( $model_name, 'instance' )) { |
|
1566 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1567 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
1568 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
1564 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1565 | + if (method_exists($model_name, 'instance')) { |
|
1566 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1567 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
1568 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
1569 | 1569 | } |
1570 | 1570 | } |
1571 | 1571 | } |
1572 | 1572 | //get all our CPTs |
1573 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
1573 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
1574 | 1574 | $cpt_ids = $wpdb->get_col($query); |
1575 | 1575 | //delete each post meta and term relations too |
1576 | - foreach($cpt_ids as $post_id){ |
|
1577 | - wp_delete_post($post_id,true); |
|
1576 | + foreach ($cpt_ids as $post_id) { |
|
1577 | + wp_delete_post($post_id, true); |
|
1578 | 1578 | } |
1579 | 1579 | } |
1580 | 1580 | |
@@ -1588,18 +1588,18 @@ discard block |
||
1588 | 1588 | * @param bool $remove_all |
1589 | 1589 | * @return void |
1590 | 1590 | */ |
1591 | - public static function delete_all_espresso_tables_and_data( $remove_all = true ) { |
|
1591 | + public static function delete_all_espresso_tables_and_data($remove_all = true) { |
|
1592 | 1592 | global $wpdb; |
1593 | 1593 | $undeleted_tables = array(); |
1594 | 1594 | |
1595 | 1595 | // load registry |
1596 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
1597 | - if ( method_exists( $model_name, 'instance' )) { |
|
1598 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
1599 | - if ( $model_obj instanceof EEM_Base ) { |
|
1600 | - foreach ( $model_obj->get_tables() as $table ) { |
|
1601 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
1602 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
1596 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
1597 | + if (method_exists($model_name, 'instance')) { |
|
1598 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
1599 | + if ($model_obj instanceof EEM_Base) { |
|
1600 | + foreach ($model_obj->get_tables() as $table) { |
|
1601 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
1602 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
1603 | 1603 | case false : |
1604 | 1604 | $undeleted_tables[] = $table->get_table_name(); |
1605 | 1605 | break; |
@@ -1624,8 +1624,8 @@ discard block |
||
1624 | 1624 | 'esp_promotion_rule', |
1625 | 1625 | 'esp_rule' |
1626 | 1626 | ); |
1627 | - foreach( $tables_without_models as $table ){ |
|
1628 | - EEH_Activation::delete_db_table_if_empty( $table ); |
|
1627 | + foreach ($tables_without_models as $table) { |
|
1628 | + EEH_Activation::delete_db_table_if_empty($table); |
|
1629 | 1629 | } |
1630 | 1630 | |
1631 | 1631 | |
@@ -1663,58 +1663,58 @@ discard block |
||
1663 | 1663 | 'ee_job_parameters_' => false, |
1664 | 1664 | 'ee_upload_directories_incomplete' => true, |
1665 | 1665 | ); |
1666 | - if( is_main_site() ) { |
|
1667 | - $wp_options_to_delete[ 'ee_network_config' ] = true; |
|
1666 | + if (is_main_site()) { |
|
1667 | + $wp_options_to_delete['ee_network_config'] = true; |
|
1668 | 1668 | } |
1669 | 1669 | |
1670 | 1670 | $undeleted_options = array(); |
1671 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
1671 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
1672 | 1672 | |
1673 | - if( $no_wildcard ){ |
|
1674 | - if( ! delete_option( $option_name ) ){ |
|
1673 | + if ($no_wildcard) { |
|
1674 | + if ( ! delete_option($option_name)) { |
|
1675 | 1675 | $undeleted_options[] = $option_name; |
1676 | 1676 | } |
1677 | - }else{ |
|
1678 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
1679 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
1680 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
1677 | + } else { |
|
1678 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
1679 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
1680 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
1681 | 1681 | $undeleted_options[] = $option_name_from_wildcard; |
1682 | 1682 | } |
1683 | 1683 | } |
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it |
1687 | - remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 ); |
|
1687 | + remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10); |
|
1688 | 1688 | |
1689 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
1689 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
1690 | 1690 | $db_update_sans_ee4 = array(); |
1691 | - foreach($espresso_db_update as $version => $times_activated){ |
|
1692 | - if( (string)$version[0] === '3'){//if its NON EE4 |
|
1691 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
1692 | + if ((string) $version[0] === '3') {//if its NON EE4 |
|
1693 | 1693 | $db_update_sans_ee4[$version] = $times_activated; |
1694 | 1694 | } |
1695 | 1695 | } |
1696 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
1696 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | $errors = ''; |
1700 | - if ( ! empty( $undeleted_tables )) { |
|
1700 | + if ( ! empty($undeleted_tables)) { |
|
1701 | 1701 | $errors .= sprintf( |
1702 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
1702 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
1703 | 1703 | '<br/>', |
1704 | - implode( ',<br/>', $undeleted_tables ) |
|
1704 | + implode(',<br/>', $undeleted_tables) |
|
1705 | 1705 | ); |
1706 | 1706 | } |
1707 | - if ( ! empty( $undeleted_options )) { |
|
1708 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
1707 | + if ( ! empty($undeleted_options)) { |
|
1708 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
1709 | 1709 | $errors .= sprintf( |
1710 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
1710 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
1711 | 1711 | '<br/>', |
1712 | - implode( ',<br/>', $undeleted_options ) |
|
1712 | + implode(',<br/>', $undeleted_options) |
|
1713 | 1713 | ); |
1714 | 1714 | |
1715 | 1715 | } |
1716 | - if ( ! empty( $errors ) ) { |
|
1717 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
1716 | + if ( ! empty($errors)) { |
|
1717 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
1718 | 1718 | } |
1719 | 1719 | } |
1720 | 1720 | |
@@ -1724,23 +1724,23 @@ discard block |
||
1724 | 1724 | * @param string $table_name with or without $wpdb->prefix |
1725 | 1725 | * @return boolean |
1726 | 1726 | */ |
1727 | - public static function table_exists( $table_name ){ |
|
1727 | + public static function table_exists($table_name) { |
|
1728 | 1728 | global $wpdb, $EZSQL_ERROR; |
1729 | - $table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name ); |
|
1729 | + $table_name = EEH_Activation::ensure_table_name_has_prefix($table_name); |
|
1730 | 1730 | //ignore if this causes an sql error |
1731 | 1731 | $old_error = $wpdb->last_error; |
1732 | 1732 | $old_suppress_errors = $wpdb->suppress_errors(); |
1733 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
1733 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
1734 | 1734 | $ezsql_error_cache = $EZSQL_ERROR; |
1735 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
1736 | - $wpdb->show_errors( $old_show_errors_value ); |
|
1737 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
1735 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
1736 | + $wpdb->show_errors($old_show_errors_value); |
|
1737 | + $wpdb->suppress_errors($old_suppress_errors); |
|
1738 | 1738 | $new_error = $wpdb->last_error; |
1739 | 1739 | $wpdb->last_error = $old_error; |
1740 | 1740 | $EZSQL_ERROR = $ezsql_error_cache; |
1741 | - if( empty( $new_error ) ){ |
|
1741 | + if (empty($new_error)) { |
|
1742 | 1742 | return TRUE; |
1743 | - }else{ |
|
1743 | + } else { |
|
1744 | 1744 | return FALSE; |
1745 | 1745 | } |
1746 | 1746 | } |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | /** |
1749 | 1749 | * Resets the cache on EEH_Activation |
1750 | 1750 | */ |
1751 | - public static function reset(){ |
|
1751 | + public static function reset() { |
|
1752 | 1752 | self::$_default_creator_id = NULL; |
1753 | 1753 | self::$_initialized_db_content_already_in_this_request = false; |
1754 | 1754 | } |
@@ -42,6 +42,8 @@ discard block |
||
42 | 42 | * @param \EE_State | string $state |
43 | 43 | * @param string $zip |
44 | 44 | * @param \EE_Country | string $country |
45 | + * @param integer $state |
|
46 | + * @param string $country |
|
45 | 47 | * @return GenericAddress |
46 | 48 | */ |
47 | 49 | public function __construct( $address, $address2, $city, $state, $zip, $country ) { |
@@ -135,7 +137,7 @@ discard block |
||
135 | 137 | |
136 | 138 | |
137 | 139 | /** |
138 | - * @return \EE_State |
|
140 | + * @return string |
|
139 | 141 | */ |
140 | 142 | public function state_obj() { |
141 | 143 | return $this->_state_obj; |
@@ -188,7 +190,7 @@ discard block |
||
188 | 190 | |
189 | 191 | |
190 | 192 | /** |
191 | - * @return \EE_Country |
|
193 | + * @return string |
|
192 | 194 | */ |
193 | 195 | public function country_obj() { |
194 | 196 | return $this->_country_obj; |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\entities; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | * @param \EE_Country | string $country |
45 | 45 | * @return GenericAddress |
46 | 46 | */ |
47 | - public function __construct( $address, $address2, $city, $state, $zip, $country ) { |
|
47 | + public function __construct($address, $address2, $city, $state, $zip, $country) { |
|
48 | 48 | $this->_address = $address; |
49 | 49 | $this->_address2 = $address2; |
50 | 50 | $this->_city = $city; |
51 | - if ( $state instanceof \EE_State ) { |
|
51 | + if ($state instanceof \EE_State) { |
|
52 | 52 | $this->_state_obj = $state; |
53 | 53 | } else { |
54 | 54 | $this->_state_ID = $state; |
55 | 55 | $this->_state_obj = $this->_get_state_obj(); |
56 | 56 | } |
57 | 57 | $this->_zip = $zip; |
58 | - if ( $country instanceof \EE_Country ) { |
|
58 | + if ($country instanceof \EE_Country) { |
|
59 | 59 | $this->_country_obj = $country; |
60 | 60 | } else { |
61 | 61 | $this->_country_ID = $country; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | private function _get_state_obj() { |
99 | 99 | return $this->_state_obj instanceof \EE_State |
100 | 100 | ? $this->_state_obj |
101 | - : \EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $this->_state_ID ); |
|
101 | + : \EE_Registry::instance()->load_model('State')->get_one_by_ID($this->_state_ID); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @return string |
148 | 148 | */ |
149 | 149 | public function state() { |
150 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
150 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
151 | 151 | return $this->state_obj()->abbrev(); |
152 | 152 | } else { |
153 | 153 | return $this->state_name(); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | private function _get_country_obj() { |
163 | 163 | return $this->_country_obj instanceof \EE_Country |
164 | 164 | ? $this->_country_obj |
165 | - : \EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $this->_country_ID ); |
|
165 | + : \EE_Registry::instance()->load_model('Country')->get_one_by_ID($this->_country_ID); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @return string |
201 | 201 | */ |
202 | 202 | public function country() { |
203 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
203 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
204 | 204 | return $this->country_ID(); |
205 | 205 | } else { |
206 | 206 | return $this->country_name(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | /** |
189 | 189 | * start_timer |
190 | - * @param null $timer_name |
|
190 | + * @param string $timer_name |
|
191 | 191 | */ |
192 | 192 | public function start_timer( $timer_name = NULL ){ |
193 | 193 | $this->_start_times[$timer_name] = microtime( TRUE ); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | |
446 | 446 | /** |
447 | - * @param mixed $var |
|
447 | + * @param string $var |
|
448 | 448 | * @param string $var_name |
449 | 449 | * @param string $file |
450 | 450 | * @param int $line |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EEH_Debug_Tools |
4 | 4 | * |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.0 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEH_Debug_Tools{ |
|
11 | +class EEH_Debug_Tools { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * instance of the EEH_Autoloader object |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function instance() { |
43 | 43 | // check if class object is instantiated, and instantiated properly |
44 | - if ( ! self::$_instance instanceof EEH_Debug_Tools ) { |
|
44 | + if ( ! self::$_instance instanceof EEH_Debug_Tools) { |
|
45 | 45 | self::$_instance = new self(); |
46 | 46 | } |
47 | 47 | return self::$_instance; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | */ |
58 | 58 | private function __construct() { |
59 | 59 | // load Kint PHP debugging library |
60 | - if ( ! class_exists( 'Kint' ) && file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){ |
|
60 | + if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) { |
|
61 | 61 | // despite EE4 having a check for an existing copy of the Kint debugging class, |
62 | 62 | // if another plugin was loaded AFTER EE4 and they did NOT perform a similar check, |
63 | 63 | // then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error |
64 | 64 | // so we've moved it to our test folder so that it is not included with production releases |
65 | 65 | // plz use https://wordpress.org/plugins/kint-debugger/ if testing production versions of EE |
66 | - require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' ); |
|
66 | + require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php'); |
|
67 | 67 | } |
68 | 68 | // if ( ! defined('DOING_AJAX') || $_REQUEST['noheader'] !== 'true' || ! isset( $_REQUEST['noheader'], $_REQUEST['TB_iframe'] ) ) { |
69 | 69 | //add_action( 'shutdown', array($this,'espresso_session_footer_dump') ); |
70 | 70 | // } |
71 | - $plugin = basename( EE_PLUGIN_DIR_PATH ); |
|
72 | - add_action( "activate_{$plugin}", array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
73 | - add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
74 | - add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' )); |
|
71 | + $plugin = basename(EE_PLUGIN_DIR_PATH); |
|
72 | + add_action("activate_{$plugin}", array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
73 | + add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
74 | + add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name')); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | public static function show_db_name() { |
85 | - if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) { |
|
86 | - echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>'; |
|
85 | + if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) { |
|
86 | + echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>'; |
|
87 | 87 | } |
88 | - if ( EE_DEBUG ) { |
|
88 | + if (EE_DEBUG) { |
|
89 | 89 | EEH_Debug_Tools::instance()->show_times(); |
90 | 90 | } |
91 | 91 | } |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function espresso_session_footer_dump() { |
101 | 101 | if ( |
102 | - ( defined( 'WP_DEBUG' ) && WP_DEBUG ) |
|
103 | - && ! defined( 'DOING_AJAX' ) |
|
104 | - && class_exists( 'Kint' ) |
|
105 | - && function_exists( 'wp_get_current_user' ) |
|
106 | - && current_user_can( 'update_core' ) |
|
107 | - && class_exists( 'EE_Registry' ) |
|
102 | + (defined('WP_DEBUG') && WP_DEBUG) |
|
103 | + && ! defined('DOING_AJAX') |
|
104 | + && class_exists('Kint') |
|
105 | + && function_exists('wp_get_current_user') |
|
106 | + && current_user_can('update_core') |
|
107 | + && class_exists('EE_Registry') |
|
108 | 108 | ) { |
109 | - Kint::dump( EE_Registry::instance()->SSN->id() ); |
|
110 | - Kint::dump( EE_Registry::instance()->SSN ); |
|
109 | + Kint::dump(EE_Registry::instance()->SSN->id()); |
|
110 | + Kint::dump(EE_Registry::instance()->SSN); |
|
111 | 111 | // Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() ); |
112 | 112 | $this->espresso_list_hooked_functions(); |
113 | 113 | $this->show_times(); |
@@ -124,27 +124,27 @@ discard block |
||
124 | 124 | * @param string $tag |
125 | 125 | * @return void |
126 | 126 | */ |
127 | - public function espresso_list_hooked_functions( $tag='' ){ |
|
127 | + public function espresso_list_hooked_functions($tag = '') { |
|
128 | 128 | global $wp_filter; |
129 | 129 | echo '<br/><br/><br/><h3>Hooked Functions</h3>'; |
130 | - if ( $tag ) { |
|
131 | - $hook[$tag]=$wp_filter[$tag]; |
|
132 | - if ( ! is_array( $hook[$tag] )) { |
|
133 | - trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING ); |
|
130 | + if ($tag) { |
|
131 | + $hook[$tag] = $wp_filter[$tag]; |
|
132 | + if ( ! is_array($hook[$tag])) { |
|
133 | + trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); |
|
134 | 134 | return; |
135 | 135 | } |
136 | - echo '<h5>For Tag: '. $tag .'</h5>'; |
|
136 | + echo '<h5>For Tag: '.$tag.'</h5>'; |
|
137 | 137 | } |
138 | 138 | else { |
139 | - $hook=$wp_filter; |
|
140 | - ksort( $hook ); |
|
139 | + $hook = $wp_filter; |
|
140 | + ksort($hook); |
|
141 | 141 | } |
142 | - foreach( $hook as $tag_name => $priorities ) { |
|
142 | + foreach ($hook as $tag_name => $priorities) { |
|
143 | 143 | echo "<br />>>>>>\t<strong>$tag_name</strong><br />"; |
144 | - ksort( $priorities ); |
|
145 | - foreach( $priorities as $priority => $function ){ |
|
144 | + ksort($priorities); |
|
145 | + foreach ($priorities as $priority => $function) { |
|
146 | 146 | echo $priority; |
147 | - foreach( $function as $name => $properties ) { |
|
147 | + foreach ($function as $name => $properties) { |
|
148 | 148 | echo "\t$name<br />"; |
149 | 149 | } |
150 | 150 | } |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | * @param string $hook_name |
160 | 160 | * @return array |
161 | 161 | */ |
162 | - public static function registered_filter_callbacks( $hook_name = '' ) { |
|
162 | + public static function registered_filter_callbacks($hook_name = '') { |
|
163 | 163 | $filters = array(); |
164 | 164 | global $wp_filter; |
165 | - if ( isset( $wp_filter[ $hook_name ] ) ) { |
|
166 | - $filters[ $hook_name ] = array(); |
|
167 | - foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) { |
|
168 | - $filters[ $hook_name ][ $priority ] = array(); |
|
169 | - foreach ( $callbacks as $callback ) { |
|
170 | - $filters[ $hook_name ][ $priority ][] = $callback['function']; |
|
165 | + if (isset($wp_filter[$hook_name])) { |
|
166 | + $filters[$hook_name] = array(); |
|
167 | + foreach ($wp_filter[$hook_name] as $priority => $callbacks) { |
|
168 | + $filters[$hook_name][$priority] = array(); |
|
169 | + foreach ($callbacks as $callback) { |
|
170 | + $filters[$hook_name][$priority][] = $callback['function']; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | /** |
180 | 180 | * reset_times |
181 | 181 | */ |
182 | - public function reset_times(){ |
|
182 | + public function reset_times() { |
|
183 | 183 | $this->_times = array(); |
184 | 184 | } |
185 | 185 | |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * start_timer |
190 | 190 | * @param null $timer_name |
191 | 191 | */ |
192 | - public function start_timer( $timer_name = NULL ){ |
|
193 | - $this->_start_times[$timer_name] = microtime( TRUE ); |
|
192 | + public function start_timer($timer_name = NULL) { |
|
193 | + $this->_start_times[$timer_name] = microtime(TRUE); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | * stop_timer |
200 | 200 | * @param string $timer_name |
201 | 201 | */ |
202 | - public function stop_timer( $timer_name = '' ){ |
|
202 | + public function stop_timer($timer_name = '') { |
|
203 | 203 | $timer_name = $timer_name !== '' ? $timer_name : get_called_class(); |
204 | - if( isset( $this->_start_times[ $timer_name ] ) ){ |
|
205 | - $start_time = $this->_start_times[ $timer_name ]; |
|
206 | - unset( $this->_start_times[ $timer_name ] ); |
|
207 | - }else{ |
|
208 | - $start_time = array_pop( $this->_start_times ); |
|
204 | + if (isset($this->_start_times[$timer_name])) { |
|
205 | + $start_time = $this->_start_times[$timer_name]; |
|
206 | + unset($this->_start_times[$timer_name]); |
|
207 | + } else { |
|
208 | + $start_time = array_pop($this->_start_times); |
|
209 | 209 | } |
210 | - $this->_times[ $timer_name ] = number_format( microtime( true ) - $start_time, 8 ); |
|
210 | + $this->_times[$timer_name] = number_format(microtime(true) - $start_time, 8); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | * @param boolean $output_now whether to echo now, or wait until EEH_Debug_Tools::show_times() is called |
218 | 218 | * @return void |
219 | 219 | */ |
220 | - public function measure_memory( $label, $output_now = false ) { |
|
221 | - $memory_used = $this->convert( memory_get_peak_usage( true ) ); |
|
222 | - $this->_memory_usage_points[ $label ] = $memory_used; |
|
223 | - if( $output_now ) { |
|
220 | + public function measure_memory($label, $output_now = false) { |
|
221 | + $memory_used = $this->convert(memory_get_peak_usage(true)); |
|
222 | + $this->_memory_usage_points[$label] = $memory_used; |
|
223 | + if ($output_now) { |
|
224 | 224 | echo "\r\n<br>$label : $memory_used"; |
225 | 225 | } |
226 | 226 | } |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | * @param int $size |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - public function convert( $size ) { |
|
234 | - $unit=array('b','kb','mb','gb','tb','pb'); |
|
235 | - return @round( $size / pow( 1024, $i = floor( log( $size, 1024 ) ) ), 2 ) . ' ' . $unit[ absint( $i ) ]; |
|
233 | + public function convert($size) { |
|
234 | + $unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); |
|
235 | + return @round($size / pow(1024, $i = floor(log($size, 1024))), 2).' '.$unit[absint($i)]; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -242,25 +242,25 @@ discard block |
||
242 | 242 | * @param bool $output_now |
243 | 243 | * @return string |
244 | 244 | */ |
245 | - public function show_times($output_now=true){ |
|
245 | + public function show_times($output_now = true) { |
|
246 | 246 | $output = ''; |
247 | - if ( ! empty( $this->_times )) { |
|
247 | + if ( ! empty($this->_times)) { |
|
248 | 248 | $total = 0; |
249 | 249 | $output .= '<h2 style="margin:1em .5em 0;">Times:</h2>'; |
250 | 250 | $output .= '<span style="color:#9999CC; font-size:.8em; margin:0 1.5em 0;">( in milliseconds )</span><br />'; |
251 | - foreach( $this->_times as $timer_name => $total_time ) { |
|
252 | - $output .= $this->format_time( $timer_name, $total_time ); |
|
251 | + foreach ($this->_times as $timer_name => $total_time) { |
|
252 | + $output .= $this->format_time($timer_name, $total_time); |
|
253 | 253 | $total += $total_time; |
254 | 254 | } |
255 | 255 | $output .= '<br />'; |
256 | 256 | $output .= '<h4 style="margin:1em .5em 0;">TOTAL TIME</h4>'; |
257 | - $output .= $this->format_time( '', $total ); |
|
257 | + $output .= $this->format_time('', $total); |
|
258 | 258 | $output .= '<br />'; |
259 | 259 | } |
260 | - if ( ! empty( $this->_memory_usage_points )) { |
|
261 | - $output .= '<h2 style="margin:1em .5em 0;">Memory</h2>' . implode( '<br />', $this->_memory_usage_points ); |
|
260 | + if ( ! empty($this->_memory_usage_points)) { |
|
261 | + $output .= '<h2 style="margin:1em .5em 0;">Memory</h2>'.implode('<br />', $this->_memory_usage_points); |
|
262 | 262 | } |
263 | - if( $output_now ){ |
|
263 | + if ($output_now) { |
|
264 | 264 | echo $output; |
265 | 265 | return ''; |
266 | 266 | } |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @param float $total_time |
275 | 275 | * @return string |
276 | 276 | */ |
277 | - public function format_time( $timer_name, $total_time ) { |
|
277 | + public function format_time($timer_name, $total_time) { |
|
278 | 278 | $total_time = $total_time * 1000; |
279 | - switch ( $total_time ) { |
|
279 | + switch ($total_time) { |
|
280 | 280 | case $total_time < 0.01 : |
281 | 281 | $color = '#8A549A'; |
282 | 282 | $bold = 'normal'; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | . '; font-weight:' |
308 | 308 | . $bold |
309 | 309 | . '; font-size:1.2em;">' |
310 | - . str_pad( number_format( $total_time, 5 ), 11, '0', STR_PAD_LEFT ) |
|
310 | + . str_pad(number_format($total_time, 5), 11, '0', STR_PAD_LEFT) |
|
311 | 311 | . '</span> ' |
312 | 312 | . $timer_name |
313 | 313 | . '<br />'; |
@@ -321,25 +321,25 @@ discard block |
||
321 | 321 | * @return void |
322 | 322 | */ |
323 | 323 | public static function ee_plugin_activation_errors() { |
324 | - if ( WP_DEBUG ) { |
|
324 | + if (WP_DEBUG) { |
|
325 | 325 | $activation_errors = ob_get_contents(); |
326 | - if ( ! empty( $activation_errors ) ) { |
|
327 | - $activation_errors = date( 'Y-m-d H:i:s' ) . "\n" . $activation_errors; |
|
326 | + if ( ! empty($activation_errors)) { |
|
327 | + $activation_errors = date('Y-m-d H:i:s')."\n".$activation_errors; |
|
328 | 328 | } |
329 | - espresso_load_required( 'EEH_File', EE_HELPERS . 'EEH_File.helper.php' ); |
|
330 | - if ( class_exists( 'EEH_File' )) { |
|
329 | + espresso_load_required('EEH_File', EE_HELPERS.'EEH_File.helper.php'); |
|
330 | + if (class_exists('EEH_File')) { |
|
331 | 331 | try { |
332 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' ); |
|
333 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
334 | - } catch( EE_Error $e ){ |
|
335 | - EE_Error::add_error( sprintf( __( 'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
332 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html'); |
|
333 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
334 | + } catch (EE_Error $e) { |
|
335 | + EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__); |
|
336 | 336 | } |
337 | 337 | } else { |
338 | 338 | // old school attempt |
339 | - file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
339 | + file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
340 | 340 | } |
341 | - $activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors; |
|
342 | - update_option( 'ee_plugin_activation_errors', $activation_errors ); |
|
341 | + $activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors; |
|
342 | + update_option('ee_plugin_activation_errors', $activation_errors); |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | |
@@ -355,22 +355,22 @@ discard block |
||
355 | 355 | * @param int $error_type |
356 | 356 | * @uses trigger_error() |
357 | 357 | */ |
358 | - public function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) { |
|
359 | - do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
360 | - $version = $version === null ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version ); |
|
361 | - $error_message = sprintf( esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s','event_espresso' ), $function, '<strong>', '</strong>', $message, $version ); |
|
358 | + public function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) { |
|
359 | + do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
360 | + $version = $version === null ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version); |
|
361 | + $error_message = sprintf(esc_html__('%1$s was called %2$sincorrectly%3$s. %4$s %5$s', 'event_espresso'), $function, '<strong>', '</strong>', $message, $version); |
|
362 | 362 | |
363 | 363 | //don't trigger error if doing ajax, instead we'll add a transient EE_Error notice that in theory should show on the next request. |
364 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
365 | - $error_message .= esc_html__( 'This is a doing_it_wrong message that was triggered during an ajax request. The request params on this request were: ', 'event_espresso' ); |
|
364 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
365 | + $error_message .= esc_html__('This is a doing_it_wrong message that was triggered during an ajax request. The request params on this request were: ', 'event_espresso'); |
|
366 | 366 | $error_message .= '<ul><li>'; |
367 | - $error_message .= implode( '</li><li>', EE_Registry::instance()->REQ->params() ); |
|
367 | + $error_message .= implode('</li><li>', EE_Registry::instance()->REQ->params()); |
|
368 | 368 | $error_message .= '</ul>'; |
369 | - EE_Error::add_error( $error_message, 'debug::doing_it_wrong', $function, '42' ); |
|
369 | + EE_Error::add_error($error_message, 'debug::doing_it_wrong', $function, '42'); |
|
370 | 370 | //now we set this on the transient so it shows up on the next request. |
371 | - EE_Error::get_notices( is_admin(), true ); |
|
371 | + EE_Error::get_notices(is_admin(), true); |
|
372 | 372 | } else { |
373 | - trigger_error( $error_message, $error_type ); |
|
373 | + trigger_error($error_message, $error_type); |
|
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
@@ -392,22 +392,22 @@ discard block |
||
392 | 392 | * @param string $debug_index |
393 | 393 | * @param string $debug_key |
394 | 394 | */ |
395 | - public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) { |
|
396 | - if ( WP_DEBUG && false ) { |
|
397 | - $debug_key = $debug_key . '_' . EE_Session::instance()->id(); |
|
398 | - $debug_data = get_option( $debug_key, array() ); |
|
395 | + public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') { |
|
396 | + if (WP_DEBUG && false) { |
|
397 | + $debug_key = $debug_key.'_'.EE_Session::instance()->id(); |
|
398 | + $debug_data = get_option($debug_key, array()); |
|
399 | 399 | $default_data = array( |
400 | - $class => $func . '() : ' . $line, |
|
400 | + $class => $func.'() : '.$line, |
|
401 | 401 | 'REQ' => $display_request ? $_REQUEST : '', |
402 | 402 | ); |
403 | 403 | // don't serialize objects |
404 | - $info = self::strip_objects( $info ); |
|
405 | - $index = ! empty( $debug_index ) ? $debug_index : 0; |
|
406 | - if ( ! isset( $debug_data[$index] ) ) { |
|
404 | + $info = self::strip_objects($info); |
|
405 | + $index = ! empty($debug_index) ? $debug_index : 0; |
|
406 | + if ( ! isset($debug_data[$index])) { |
|
407 | 407 | $debug_data[$index] = array(); |
408 | 408 | } |
409 | - $debug_data[$index][microtime()] = array_merge( $default_data, $info ); |
|
410 | - update_option( $debug_key, $debug_data ); |
|
409 | + $debug_data[$index][microtime()] = array_merge($default_data, $info); |
|
410 | + update_option($debug_key, $debug_data); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -419,26 +419,26 @@ discard block |
||
419 | 419 | * @param array $info |
420 | 420 | * @return array |
421 | 421 | */ |
422 | - public static function strip_objects( $info = array() ) { |
|
423 | - foreach ( $info as $key => $value ) { |
|
424 | - if ( is_array( $value ) ) { |
|
425 | - $info[ $key ] = self::strip_objects( $value ); |
|
426 | - } else if ( is_object( $value ) ) { |
|
427 | - $object_class = get_class( $value ); |
|
428 | - $info[ $object_class ] = array(); |
|
429 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value ); |
|
430 | - if ( method_exists( $value, 'ID' ) ) { |
|
431 | - $info[ $object_class ][ 'ID' ] = $value->ID(); |
|
422 | + public static function strip_objects($info = array()) { |
|
423 | + foreach ($info as $key => $value) { |
|
424 | + if (is_array($value)) { |
|
425 | + $info[$key] = self::strip_objects($value); |
|
426 | + } else if (is_object($value)) { |
|
427 | + $object_class = get_class($value); |
|
428 | + $info[$object_class] = array(); |
|
429 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value); |
|
430 | + if (method_exists($value, 'ID')) { |
|
431 | + $info[$object_class]['ID'] = $value->ID(); |
|
432 | 432 | } |
433 | - if ( method_exists( $value, 'status' ) ) { |
|
434 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
435 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
436 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
433 | + if (method_exists($value, 'status')) { |
|
434 | + $info[$object_class]['status'] = $value->status(); |
|
435 | + } else if (method_exists($value, 'status_ID')) { |
|
436 | + $info[$object_class]['status'] = $value->status_ID(); |
|
437 | 437 | } |
438 | - unset( $info[ $key ] ); |
|
438 | + unset($info[$key]); |
|
439 | 439 | } |
440 | 440 | } |
441 | - return (array)$info; |
|
441 | + return (array) $info; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -451,22 +451,22 @@ discard block |
||
451 | 451 | * @param int $header |
452 | 452 | * @param bool $die |
453 | 453 | */ |
454 | - public static function printv( $var, $var_name = '', $file = __FILE__, $line = __LINE__, $header = 5, $die = false ) { |
|
454 | + public static function printv($var, $var_name = '', $file = __FILE__, $line = __LINE__, $header = 5, $die = false) { |
|
455 | 455 | $var_name = ! $var_name ? 'string' : $var_name; |
456 | 456 | $heading_tag = 'h'; |
457 | - $heading_tag .= is_int( $header ) ? $header : 5; |
|
458 | - $var_name = ucwords( str_replace( '$', '', $var_name ) ); |
|
459 | - $is_method = method_exists( $var_name, $var ); |
|
460 | - $var_name = ucwords( str_replace( '_', ' ', $var_name ) ); |
|
461 | - $result = '<' . $heading_tag . ' style="color:#2EA2CC; margin:25px 0 0;"><b>' . $var_name . '</b>'; |
|
457 | + $heading_tag .= is_int($header) ? $header : 5; |
|
458 | + $var_name = ucwords(str_replace('$', '', $var_name)); |
|
459 | + $is_method = method_exists($var_name, $var); |
|
460 | + $var_name = ucwords(str_replace('_', ' ', $var_name)); |
|
461 | + $result = '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0;"><b>'.$var_name.'</b>'; |
|
462 | 462 | $result .= $is_method |
463 | - ? '<span style="color:#999">::</span><span style="color:#E76700">' . $var . '()</span><br />' |
|
464 | - : '<span style="color:#999"> : </span><span style="color:#E76700">' . $var . '</span><br />'; |
|
465 | - $result .= '<span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file; |
|
466 | - $result .= '<br />line no: ' . $line . '</span>'; |
|
467 | - $result .= '</' . $heading_tag . '>'; |
|
468 | - if ( $die ) { |
|
469 | - die( $result ); |
|
463 | + ? '<span style="color:#999">::</span><span style="color:#E76700">'.$var.'()</span><br />' |
|
464 | + : '<span style="color:#999"> : </span><span style="color:#E76700">'.$var.'</span><br />'; |
|
465 | + $result .= '<span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file; |
|
466 | + $result .= '<br />line no: '.$line.'</span>'; |
|
467 | + $result .= '</'.$heading_tag.'>'; |
|
468 | + if ($die) { |
|
469 | + die($result); |
|
470 | 470 | } else { |
471 | 471 | echo $result; |
472 | 472 | } |
@@ -481,35 +481,35 @@ discard block |
||
481 | 481 | * @param int $header |
482 | 482 | * @param bool $die |
483 | 483 | */ |
484 | - public static function printr( $var, $var_name = '', $file = __FILE__, $line = __LINE__, $header = 5, $die = false ) { |
|
484 | + public static function printr($var, $var_name = '', $file = __FILE__, $line = __LINE__, $header = 5, $die = false) { |
|
485 | 485 | // return; |
486 | - $file = str_replace( rtrim( ABSPATH, '\\/' ), '', $file ); |
|
486 | + $file = str_replace(rtrim(ABSPATH, '\\/'), '', $file); |
|
487 | 487 | //$print_r = false; |
488 | - if ( is_string( $var ) ) { |
|
489 | - EEH_Debug_Tools::printv( $var, $var_name, $file, $line, $header, $die ); |
|
488 | + if (is_string($var)) { |
|
489 | + EEH_Debug_Tools::printv($var, $var_name, $file, $line, $header, $die); |
|
490 | 490 | return; |
491 | - } else if ( is_object( $var ) ) { |
|
491 | + } else if (is_object($var)) { |
|
492 | 492 | $var_name = ! $var_name ? 'object' : $var_name; |
493 | 493 | //$print_r = true; |
494 | - } else if ( is_array( $var ) ) { |
|
494 | + } else if (is_array($var)) { |
|
495 | 495 | $var_name = ! $var_name ? 'array' : $var_name; |
496 | 496 | //$print_r = true; |
497 | - } else if ( is_numeric( $var ) ) { |
|
497 | + } else if (is_numeric($var)) { |
|
498 | 498 | $var_name = ! $var_name ? 'numeric' : $var_name; |
499 | - } else if ( is_null( $var ) ) { |
|
499 | + } else if (is_null($var)) { |
|
500 | 500 | $var_name = ! $var_name ? 'null' : $var_name; |
501 | 501 | } |
502 | 502 | $heading_tag = 'h'; |
503 | - $heading_tag .= is_int( $header ) ? $header : 5; |
|
504 | - $var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) ); |
|
505 | - $result = '<' . $heading_tag . ' style="color:#2EA2CC; margin:25px 0 0;"><b>' . $var_name . '</b>'; |
|
503 | + $heading_tag .= is_int($header) ? $header : 5; |
|
504 | + $var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name)); |
|
505 | + $result = '<'.$heading_tag.' style="color:#2EA2CC; margin:25px 0 0;"><b>'.$var_name.'</b>'; |
|
506 | 506 | $result .= '<span style="color:#999;"> : </span><span style="color:#E76700;">'; |
507 | 507 | $result .= '<pre style="color:#999; padding:1em; background: #fff">'; |
508 | - $result .= var_export( $var, true ); |
|
509 | - $result .= '</pre></span><br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">' . $file; |
|
510 | - $result .= '<br />line no: ' . $line . '</span></' . $heading_tag . '>'; |
|
511 | - if ( $die ) { |
|
512 | - die( $result ); |
|
508 | + $result .= var_export($var, true); |
|
509 | + $result .= '</pre></span><br /><span style="font-size:9px;font-weight:normal;color:#666;line-height: 12px;">'.$file; |
|
510 | + $result .= '<br />line no: '.$line.'</span></'.$heading_tag.'>'; |
|
511 | + if ($die) { |
|
512 | + die($result); |
|
513 | 513 | } else { |
514 | 514 | echo $result; |
515 | 515 | } |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | * borrowed from Kint Debugger |
527 | 527 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
528 | 528 | */ |
529 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) { |
|
530 | - function dump_wp_query(){ |
|
529 | +if (class_exists('Kint') && ! function_exists('dump_wp_query')) { |
|
530 | + function dump_wp_query() { |
|
531 | 531 | global $wp_query; |
532 | 532 | d($wp_query); |
533 | 533 | } |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * borrowed from Kint Debugger |
538 | 538 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
539 | 539 | */ |
540 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) { |
|
541 | - function dump_wp(){ |
|
540 | +if (class_exists('Kint') && ! function_exists('dump_wp')) { |
|
541 | + function dump_wp() { |
|
542 | 542 | global $wp; |
543 | 543 | d($wp); |
544 | 544 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * borrowed from Kint Debugger |
549 | 549 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
550 | 550 | */ |
551 | -if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) { |
|
552 | - function dump_post(){ |
|
551 | +if (class_exists('Kint') && ! function_exists('dump_post')) { |
|
552 | + function dump_post() { |
|
553 | 553 | global $post; |
554 | 554 | d($post); |
555 | 555 | } |
@@ -74,6 +74,7 @@ |
||
74 | 74 | * [ee_tep_not_null description] |
75 | 75 | * |
76 | 76 | * @param string | array $value [description] |
77 | + * @param string $value |
|
77 | 78 | * @return bool [description] |
78 | 79 | */ |
79 | 80 | static public function ee_tep_not_null( $value ) { |
@@ -1,6 +1,6 @@ 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 | 5 | |
6 | 6 | |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * @param string $content content to format |
27 | 27 | * @return string formatted content |
28 | 28 | */ |
29 | - static public function admin_format_content( $content = '' ) { |
|
30 | - return wpautop( stripslashes_deep( html_entity_decode( $content, ENT_QUOTES, "UTF-8" ) ) ); |
|
29 | + static public function admin_format_content($content = '') { |
|
30 | + return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8"))); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | * @param boolean $protected true then we run htmlspecialchars and return |
44 | 44 | * @return string |
45 | 45 | */ |
46 | - static public function ee_tep_output_string( $string, $translate = false, $protected = false ) { |
|
47 | - if ( $protected === true ) { |
|
48 | - return htmlspecialchars( $string ); |
|
46 | + static public function ee_tep_output_string($string, $translate = false, $protected = false) { |
|
47 | + if ($protected === true) { |
|
48 | + return htmlspecialchars($string); |
|
49 | 49 | } else { |
50 | - if ( $translate === false ) { |
|
51 | - return self::ee_tep_parse_input_field_data( $string, array( '"' => '"' ) ); |
|
50 | + if ($translate === false) { |
|
51 | + return self::ee_tep_parse_input_field_data($string, array('"' => '"')); |
|
52 | 52 | } else { |
53 | - return self::ee_tep_parse_input_field_data( $string, $translate ); |
|
53 | + return self::ee_tep_parse_input_field_data($string, $translate); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param array ] $parse array in the form array( 'from' => 'to', ... ) |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - static public function ee_tep_parse_input_field_data( $data, $parse ) { |
|
68 | - return strtr( trim( $data ), $parse ); |
|
67 | + static public function ee_tep_parse_input_field_data($data, $parse) { |
|
68 | + return strtr(trim($data), $parse); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | * @param string | array $value [description] |
77 | 77 | * @return bool [description] |
78 | 78 | */ |
79 | - static public function ee_tep_not_null( $value ) { |
|
80 | - if ( is_array( $value ) ) { |
|
81 | - if ( count( $value ) > 0 ) { |
|
79 | + static public function ee_tep_not_null($value) { |
|
80 | + if (is_array($value)) { |
|
81 | + if (count($value) > 0) { |
|
82 | 82 | return true; |
83 | 83 | } else { |
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | } else { |
87 | - if ( ( $value !== '' ) && ( strtolower( $value ) !== 'null' ) && ( strlen( trim( $value ) ) > 0 ) ) { |
|
87 | + if (($value !== '') && (strtolower($value) !== 'null') && (strlen(trim($value)) > 0)) { |
|
88 | 88 | return true; |
89 | 89 | } else { |
90 | 90 | return false; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return string |
105 | 105 | * @deprecated v4.6.21 |
106 | 106 | */ |
107 | - static public function event_date_display( $date, $format = '' ) { |
|
107 | + static public function event_date_display($date, $format = '') { |
|
108 | 108 | EE_Error::doing_it_wrong( |
109 | 109 | __METHOD__, |
110 | 110 | __( |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | */ |
43 | 43 | |
44 | -if ( function_exists( 'espresso_version' ) ) { |
|
44 | +if (function_exists('espresso_version')) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * espresso_duplicate_plugin_error |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function espresso_duplicate_plugin_error() { |
51 | 51 | ?> |
52 | 52 | <div class="error"> |
53 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
53 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
54 | 54 | </div> |
55 | 55 | <?php |
56 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
56 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
57 | 57 | } |
58 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
58 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | 59 | |
60 | 60 | } else { |
61 | 61 | |
@@ -70,99 +70,99 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // define versions |
73 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
74 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
75 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
76 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
77 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
78 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
73 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
74 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
75 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
76 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
77 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
78 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ] ); |
|
252 | - unset( $_REQUEST[ 'activate' ] ); |
|
253 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate']); |
|
252 | + unset($_REQUEST['activate']); |
|
253 | + deactivate_plugins($plugin_basename); |
|
254 | 254 | } |
255 | 255 | } |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * @param int | \EE_Event $event |
28 | 28 | * @return bool |
29 | 29 | */ |
30 | -function is_espresso_event( $event = NULL ) { |
|
31 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
30 | +function is_espresso_event($event = NULL) { |
|
31 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
32 | 32 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
33 | - $event = EEH_Event_View::get_event( $event ); |
|
33 | + $event = EEH_Event_View::get_event($event); |
|
34 | 34 | // do we have a valid event ? |
35 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
35 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
36 | 36 | } |
37 | 37 | return FALSE; |
38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return bool |
45 | 45 | */ |
46 | 46 | function is_espresso_event_single() { |
47 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
47 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
48 | 48 | global $wp_query; |
49 | 49 | // return conditionals set by CPTs |
50 | 50 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return bool |
60 | 60 | */ |
61 | 61 | function is_espresso_event_archive() { |
62 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
62 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
63 | 63 | global $wp_query; |
64 | 64 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
65 | 65 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return bool |
74 | 74 | */ |
75 | 75 | function is_espresso_event_taxonomy() { |
76 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
76 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
77 | 77 | global $wp_query; |
78 | 78 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
79 | 79 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param int | \EE_Venue $venue |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | -function is_espresso_venue( $venue = NULL ) { |
|
91 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
90 | +function is_espresso_venue($venue = NULL) { |
|
91 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
92 | 92 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
93 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
93 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
94 | 94 | // do we have a valid event ? |
95 | 95 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return bool |
105 | 105 | */ |
106 | 106 | function is_espresso_venue_single() { |
107 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
107 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
108 | 108 | global $wp_query; |
109 | 109 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
110 | 110 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return bool |
119 | 119 | */ |
120 | 120 | function is_espresso_venue_archive() { |
121 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
121 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
122 | 122 | global $wp_query; |
123 | 123 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return bool |
133 | 133 | */ |
134 | 134 | function is_espresso_venue_taxonomy() { |
135 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
135 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
136 | 136 | global $wp_query; |
137 | 137 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
138 | 138 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * @param $conditional_tag |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
150 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
149 | +function can_use_espresso_conditionals($conditional_tag) { |
|
150 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
151 | 151 | EE_Error::doing_it_wrong( |
152 | 152 | __FUNCTION__, |
153 | 153 | sprintf( |
154 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
154 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
155 | 155 | $conditional_tag |
156 | 156 | ), |
157 | 157 | '4.4.0' |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | |
167 | 167 | /*************************** Event Queries ***************************/ |
168 | 168 | |
169 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
169 | +if ( ! function_exists('espresso_get_events')) { |
|
170 | 170 | /** |
171 | 171 | * espresso_get_events |
172 | 172 | * @param array $params |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - function espresso_get_events( $params = array() ) { |
|
175 | + function espresso_get_events($params = array()) { |
|
176 | 176 | //set default params |
177 | 177 | $default_espresso_events_params = array( |
178 | 178 | 'limit' => 10, |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | 'sort' => 'ASC' |
184 | 184 | ); |
185 | 185 | // allow the defaults to be filtered |
186 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
186 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
187 | 187 | // grab params and merge with defaults, then extract |
188 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
188 | + $params = array_merge($default_espresso_events_params, $params); |
|
189 | 189 | // run the query |
190 | - $events_query = new EE_Event_List_Query( $params ); |
|
190 | + $events_query = new EE_Event_List_Query($params); |
|
191 | 191 | // assign results to a variable so we can return it |
192 | 192 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
193 | 193 | // but first reset the query and postdata |
194 | 194 | wp_reset_query(); |
195 | 195 | wp_reset_postdata(); |
196 | 196 | EED_Events_Archive::remove_all_events_archive_filters(); |
197 | - unset( $events_query ); |
|
197 | + unset($events_query); |
|
198 | 198 | return $events; |
199 | 199 | } |
200 | 200 | } |
@@ -208,32 +208,32 @@ discard block |
||
208 | 208 | * espresso_load_ticket_selector |
209 | 209 | */ |
210 | 210 | function espresso_load_ticket_selector() { |
211 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
211 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
212 | 212 | } |
213 | 213 | |
214 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
214 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
215 | 215 | /** |
216 | 216 | * espresso_ticket_selector |
217 | 217 | * @param null $event |
218 | 218 | */ |
219 | - function espresso_ticket_selector( $event = NULL ) { |
|
220 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
219 | + function espresso_ticket_selector($event = NULL) { |
|
220 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
221 | 221 | espresso_load_ticket_selector(); |
222 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
222 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
228 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
229 | 229 | /** |
230 | 230 | * espresso_view_details_btn |
231 | 231 | * @param null $event |
232 | 232 | */ |
233 | - function espresso_view_details_btn( $event = NULL ) { |
|
234 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
233 | + function espresso_view_details_btn($event = NULL) { |
|
234 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
235 | 235 | espresso_load_ticket_selector(); |
236 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
236 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | /*************************** EEH_Event_View ***************************/ |
245 | 245 | |
246 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
246 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
247 | 247 | /** |
248 | 248 | * espresso_load_event_list_assets |
249 | 249 | * ensures that event list styles and scripts are loaded |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function espresso_load_event_list_assets() { |
254 | 254 | $event_list = EED_Events_Archive::instance(); |
255 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
256 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
255 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
256 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
261 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
262 | 262 | /** |
263 | 263 | * espresso_event_reg_button |
264 | 264 | * returns the "Register Now" button if event is active, |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param bool $EVT_ID |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
274 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
275 | - switch ( $event_status ) { |
|
273 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
274 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
275 | + switch ($event_status) { |
|
276 | 276 | case EE_Datetime::sold_out : |
277 | 277 | $btn_text = __('Sold Out', 'event_espresso'); |
278 | 278 | $class = 'ee-pink'; |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | case EE_Datetime::upcoming : |
289 | 289 | case EE_Datetime::active : |
290 | 290 | default : |
291 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
291 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
292 | 292 | $class = 'ee-green'; |
293 | 293 | } |
294 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
294 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
295 | 295 | $btn_text = $btn_text_if_inactive; |
296 | 296 | $class = 'ee-grey'; |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | |
307 | 307 | |
308 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
308 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
309 | 309 | /** |
310 | 310 | * espresso_display_ticket_selector |
311 | 311 | * whether or not to display the Ticket Selector for an event |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | * @param bool $EVT_ID |
314 | 314 | * @return boolean |
315 | 315 | */ |
316 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
317 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
316 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
317 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
323 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
324 | 324 | /** |
325 | 325 | * espresso_event_status |
326 | 326 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * @param bool $EVT_ID |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
332 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
331 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
332 | + return EEH_Event_View::event_status($EVT_ID); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
337 | +if ( ! function_exists('espresso_event_status')) { |
|
338 | 338 | /** |
339 | 339 | * espresso_event_status |
340 | 340 | * returns the event status if it is sold out, expired, or inactive |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | * @param bool $echo |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
347 | - if ( $echo ) { |
|
348 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
346 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
347 | + if ($echo) { |
|
348 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
349 | 349 | return ''; |
350 | 350 | } |
351 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
351 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
356 | +if ( ! function_exists('espresso_event_categories')) { |
|
357 | 357 | /** |
358 | 358 | * espresso_event_categories |
359 | 359 | * returns the terms associated with an event |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | * @param bool $echo |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
367 | - if ( $echo ) { |
|
368 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
366 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
367 | + if ($echo) { |
|
368 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
369 | 369 | return ''; |
370 | 370 | } |
371 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
371 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
376 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
377 | 377 | /** |
378 | 378 | * espresso_event_tickets_available |
379 | 379 | * returns the ticket types available for purchase for an event |
@@ -383,26 +383,26 @@ discard block |
||
383 | 383 | * @param bool $format |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
387 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
388 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
386 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
387 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
388 | + if (is_array($tickets) && ! empty($tickets)) { |
|
389 | 389 | // if formatting then $html will be a string, else it will be an array of ticket objects |
390 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
391 | - foreach ( $tickets as $ticket ) { |
|
392 | - if ( $ticket instanceof EE_Ticket ) { |
|
393 | - if ( $format ) { |
|
394 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
395 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
390 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
391 | + foreach ($tickets as $ticket) { |
|
392 | + if ($ticket instanceof EE_Ticket) { |
|
393 | + if ($format) { |
|
394 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
395 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
396 | 396 | $html .= '</li>'; |
397 | 397 | } else { |
398 | 398 | $html[] = $ticket; |
399 | 399 | } |
400 | 400 | } |
401 | 401 | } |
402 | - if ( $format ) { |
|
402 | + if ($format) { |
|
403 | 403 | $html .= '</ul>'; |
404 | 404 | } |
405 | - if ( $echo && ! $format ) { |
|
405 | + if ($echo && ! $format) { |
|
406 | 406 | echo $html; |
407 | 407 | return ''; |
408 | 408 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
415 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
416 | 416 | /** |
417 | 417 | * espresso_event_date_obj |
418 | 418 | * returns the primary date object for an event |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | * @param bool $EVT_ID |
421 | 421 | * @return object |
422 | 422 | */ |
423 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
424 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
423 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
424 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | 428 | |
429 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
429 | +if ( ! function_exists('espresso_event_date')) { |
|
430 | 430 | /** |
431 | 431 | * espresso_event_date |
432 | 432 | * returns the primary date for an event |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | * @param bool $echo |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
441 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
442 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
443 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
444 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
445 | - if($echo){ |
|
446 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
440 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
441 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
442 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
443 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
444 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
445 | + if ($echo) { |
|
446 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
447 | 447 | return ''; |
448 | 448 | } |
449 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
449 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
450 | 450 | |
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | 454 | |
455 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
455 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
456 | 456 | /** |
457 | 457 | * espresso_list_of_event_dates |
458 | 458 | * returns a unordered list of dates for an event |
@@ -467,40 +467,40 @@ discard block |
||
467 | 467 | * @param null $limit |
468 | 468 | * @return string |
469 | 469 | */ |
470 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
471 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
472 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
473 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
474 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
475 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
476 | - if ( ! $format ) { |
|
477 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
470 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
471 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
472 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
473 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
474 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
475 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
476 | + if ( ! $format) { |
|
477 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
478 | 478 | } |
479 | 479 | //d( $datetimes ); |
480 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
480 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
481 | 481 | global $post; |
482 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul">' : ''; |
|
483 | - foreach ( $datetimes as $datetime ) { |
|
484 | - if ( $datetime instanceof EE_Datetime ) { |
|
485 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
486 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
482 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul">' : ''; |
|
483 | + foreach ($datetimes as $datetime) { |
|
484 | + if ($datetime instanceof EE_Datetime) { |
|
485 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
486 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
487 | 487 | $datetime_name = $datetime->name(); |
488 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
489 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
490 | - $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>'; |
|
491 | - $html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format ); |
|
488 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
489 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
490 | + $html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>'; |
|
491 | + $html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format); |
|
492 | 492 | $datetime_description = $datetime->description(); |
493 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
494 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
495 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
493 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
494 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
495 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
496 | 496 | $html .= '</li>'; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | $html .= $format ? '</ul>' : ''; |
500 | 500 | } else { |
501 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
501 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
502 | 502 | } |
503 | - if ( $echo ) { |
|
503 | + if ($echo) { |
|
504 | 504 | echo $html; |
505 | 505 | return ''; |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
512 | +if ( ! function_exists('espresso_event_end_date')) { |
|
513 | 513 | /** |
514 | 514 | * espresso_event_end_date |
515 | 515 | * returns the last date for an event |
@@ -520,20 +520,20 @@ discard block |
||
520 | 520 | * @param bool $echo |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
524 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
525 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
526 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
527 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
528 | - if($echo){ |
|
529 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
523 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
524 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
525 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
526 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
527 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
528 | + if ($echo) { |
|
529 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
530 | 530 | return ''; |
531 | 531 | } |
532 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
532 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
536 | +if ( ! function_exists('espresso_event_date_range')) { |
|
537 | 537 | /** |
538 | 538 | * espresso_event_date_range |
539 | 539 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param bool $EVT_ID |
546 | 546 | * @return string |
547 | 547 | */ |
548 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
548 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
549 | 549 | // set and filter date and time formats when a range is returned |
550 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
551 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
550 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
551 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
552 | 552 | // get the start and end date with NO time portion |
553 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
554 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
553 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
554 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
555 | 555 | // now we can determine if date range spans more than one day |
556 | - if ( $the_event_date != $the_event_end_date ) { |
|
557 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
558 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
556 | + if ($the_event_date != $the_event_end_date) { |
|
557 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
558 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
559 | 559 | $html = sprintf( |
560 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
561 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
562 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
560 | + __('%1$s - %2$s', 'event_espresso'), |
|
561 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
562 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
563 | 563 | ); |
564 | 564 | } else { |
565 | 565 | // set and filter date and time formats when only a single datetime is returned |
566 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
567 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
568 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
569 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
570 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
566 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
567 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
568 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
569 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
570 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
571 | 571 | } |
572 | - if ( $echo ) { |
|
572 | + if ($echo) { |
|
573 | 573 | echo $html; |
574 | 574 | return ''; |
575 | 575 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | } |
579 | 579 | |
580 | 580 | |
581 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
581 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
582 | 582 | /** |
583 | 583 | * espresso_event_date_as_calendar_page |
584 | 584 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -586,15 +586,15 @@ discard block |
||
586 | 586 | * @param bool $EVT_ID |
587 | 587 | * @return string |
588 | 588 | */ |
589 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
590 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
589 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
590 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
597 | +if ( ! function_exists('espresso_event_link_url')) { |
|
598 | 598 | /** |
599 | 599 | * espresso_event_link_url |
600 | 600 | * |
@@ -602,18 +602,18 @@ discard block |
||
602 | 602 | * @param bool $echo |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
606 | - if ( $echo ) { |
|
607 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
605 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
606 | + if ($echo) { |
|
607 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
608 | 608 | return ''; |
609 | 609 | } |
610 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
610 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | 614 | |
615 | 615 | |
616 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
616 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
617 | 617 | /** |
618 | 618 | * espresso_event_has_content_or_excerpt |
619 | 619 | * |
@@ -621,15 +621,15 @@ discard block |
||
621 | 621 | * @param bool $EVT_ID |
622 | 622 | * @return boolean |
623 | 623 | */ |
624 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
625 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
624 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
625 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | 629 | |
630 | 630 | |
631 | 631 | |
632 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
632 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
633 | 633 | /** |
634 | 634 | * espresso_event_content_or_excerpt |
635 | 635 | * |
@@ -638,18 +638,18 @@ discard block |
||
638 | 638 | * @param bool $echo |
639 | 639 | * @return string |
640 | 640 | */ |
641 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
642 | - if ( $echo ) { |
|
643 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
641 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
642 | + if ($echo) { |
|
643 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
644 | 644 | return ''; |
645 | 645 | } |
646 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
646 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
650 | 650 | |
651 | 651 | |
652 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
652 | +if ( ! function_exists('espresso_event_phone')) { |
|
653 | 653 | /** |
654 | 654 | * espresso_event_phone |
655 | 655 | * |
@@ -657,18 +657,18 @@ discard block |
||
657 | 657 | * @param bool $echo |
658 | 658 | * @return string |
659 | 659 | */ |
660 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
661 | - if ( $echo ) { |
|
662 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
660 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
661 | + if ($echo) { |
|
662 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
663 | 663 | return ''; |
664 | 664 | } |
665 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
665 | + return EEH_Event_View::event_phone($EVT_ID); |
|
666 | 666 | } |
667 | 667 | } |
668 | 668 | |
669 | 669 | |
670 | 670 | |
671 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
671 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
672 | 672 | /** |
673 | 673 | * espresso_edit_event_link |
674 | 674 | * returns a link to edit an event |
@@ -677,39 +677,39 @@ discard block |
||
677 | 677 | * @param bool $echo |
678 | 678 | * @return string |
679 | 679 | */ |
680 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
681 | - if ( $echo ) { |
|
682 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
680 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
681 | + if ($echo) { |
|
682 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
683 | 683 | return ''; |
684 | 684 | } |
685 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
685 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
686 | 686 | } |
687 | 687 | } |
688 | 688 | |
689 | 689 | |
690 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
690 | +if ( ! function_exists('espresso_organization_name')) { |
|
691 | 691 | /** |
692 | 692 | * espresso_organization_name |
693 | 693 | * @param bool $echo |
694 | 694 | * @return string |
695 | 695 | */ |
696 | 696 | function espresso_organization_name($echo = TRUE) { |
697 | - if($echo){ |
|
698 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
697 | + if ($echo) { |
|
698 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
699 | 699 | return ''; |
700 | 700 | } |
701 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
701 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
705 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
705 | +if ( ! function_exists('espresso_organization_address')) { |
|
706 | 706 | /** |
707 | 707 | * espresso_organization_address |
708 | 708 | * @param string $type |
709 | 709 | * @return string |
710 | 710 | */ |
711 | - function espresso_organization_address( $type = 'inline' ) { |
|
712 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
711 | + function espresso_organization_address($type = 'inline') { |
|
712 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
713 | 713 | $address = new EventEspresso\core\entities\GenericAddress( |
714 | 714 | EE_Registry::instance()->CFG->organization->address_1, |
715 | 715 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -718,129 +718,129 @@ discard block |
||
718 | 718 | EE_Registry::instance()->CFG->organization->zip, |
719 | 719 | EE_Registry::instance()->CFG->organization->CNT_ISO |
720 | 720 | ); |
721 | - return EEH_Address::format( $address, $type ); |
|
721 | + return EEH_Address::format($address, $type); |
|
722 | 722 | } |
723 | 723 | return ''; |
724 | 724 | } |
725 | 725 | } |
726 | 726 | |
727 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
727 | +if ( ! function_exists('espresso_organization_email')) { |
|
728 | 728 | /** |
729 | 729 | * espresso_organization_email |
730 | 730 | * @param bool $echo |
731 | 731 | * @return string |
732 | 732 | */ |
733 | - function espresso_organization_email( $echo = TRUE ) { |
|
734 | - if($echo){ |
|
735 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
733 | + function espresso_organization_email($echo = TRUE) { |
|
734 | + if ($echo) { |
|
735 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
736 | 736 | return ''; |
737 | 737 | } |
738 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
738 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
739 | 739 | } |
740 | 740 | } |
741 | 741 | |
742 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
742 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
743 | 743 | /** |
744 | 744 | * espresso_organization_logo_url |
745 | 745 | * @param bool $echo |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
749 | - if($echo){ |
|
750 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
748 | + function espresso_organization_logo_url($echo = TRUE) { |
|
749 | + if ($echo) { |
|
750 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
751 | 751 | return ''; |
752 | 752 | } |
753 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
753 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
754 | 754 | } |
755 | 755 | } |
756 | 756 | |
757 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
757 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
758 | 758 | /** |
759 | 759 | * espresso_organization_facebook |
760 | 760 | * @param bool $echo |
761 | 761 | * @return string |
762 | 762 | */ |
763 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
764 | - if($echo){ |
|
765 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
763 | + function espresso_organization_facebook($echo = TRUE) { |
|
764 | + if ($echo) { |
|
765 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
766 | 766 | return ''; |
767 | 767 | } |
768 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
768 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
772 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
772 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
773 | 773 | /** |
774 | 774 | * espresso_organization_twitter |
775 | 775 | * @param bool $echo |
776 | 776 | * @return string |
777 | 777 | */ |
778 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
779 | - if($echo){ |
|
780 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
778 | + function espresso_organization_twitter($echo = TRUE) { |
|
779 | + if ($echo) { |
|
780 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
781 | 781 | return ''; |
782 | 782 | } |
783 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
783 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
784 | 784 | } |
785 | 785 | } |
786 | 786 | |
787 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
787 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
788 | 788 | /** |
789 | 789 | * espresso_organization_linkedin |
790 | 790 | * @param bool $echo |
791 | 791 | * @return string |
792 | 792 | */ |
793 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
794 | - if($echo){ |
|
795 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
793 | + function espresso_organization_linkedin($echo = TRUE) { |
|
794 | + if ($echo) { |
|
795 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
796 | 796 | return ''; |
797 | 797 | } |
798 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
798 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
802 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
802 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
803 | 803 | /** |
804 | 804 | * espresso_organization_pinterest |
805 | 805 | * @param bool $echo |
806 | 806 | * @return string |
807 | 807 | */ |
808 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
809 | - if($echo){ |
|
810 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
808 | + function espresso_organization_pinterest($echo = TRUE) { |
|
809 | + if ($echo) { |
|
810 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
811 | 811 | return ''; |
812 | 812 | } |
813 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
813 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
814 | 814 | } |
815 | 815 | } |
816 | 816 | |
817 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
817 | +if ( ! function_exists('espresso_organization_google')) { |
|
818 | 818 | /** |
819 | 819 | * espresso_organization_google |
820 | 820 | * @param bool $echo |
821 | 821 | * @return string |
822 | 822 | */ |
823 | - function espresso_organization_google( $echo = TRUE ) { |
|
824 | - if($echo){ |
|
825 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
823 | + function espresso_organization_google($echo = TRUE) { |
|
824 | + if ($echo) { |
|
825 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
826 | 826 | return ''; |
827 | 827 | } |
828 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
828 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
832 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
832 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
833 | 833 | /** |
834 | 834 | * espresso_organization_instagram |
835 | 835 | * @param bool $echo |
836 | 836 | * @return string |
837 | 837 | */ |
838 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
839 | - if($echo){ |
|
840 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
838 | + function espresso_organization_instagram($echo = TRUE) { |
|
839 | + if ($echo) { |
|
840 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
841 | 841 | return ''; |
842 | 842 | } |
843 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
843 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
844 | 844 | } |
845 | 845 | } |
846 | 846 | |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | |
851 | 851 | |
852 | 852 | |
853 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
853 | +if ( ! function_exists('espresso_event_venues')) { |
|
854 | 854 | /** |
855 | 855 | * espresso_event_venues |
856 | 856 | * |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | |
865 | 865 | |
866 | 866 | |
867 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
867 | +if ( ! function_exists('espresso_venue_id')) { |
|
868 | 868 | /** |
869 | 869 | * espresso_venue_name |
870 | 870 | * |
@@ -872,15 +872,15 @@ discard block |
||
872 | 872 | * @param int $EVT_ID |
873 | 873 | * @return string |
874 | 874 | */ |
875 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
876 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
875 | + function espresso_venue_id($EVT_ID = 0) { |
|
876 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
877 | 877 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | 881 | |
882 | 882 | |
883 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
883 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
884 | 884 | /** |
885 | 885 | * Return whether a venue is private or not. |
886 | 886 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -889,15 +889,15 @@ discard block |
||
889 | 889 | * |
890 | 890 | * @return bool | null |
891 | 891 | */ |
892 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
893 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
892 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
893 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
894 | 894 | } |
895 | 895 | } |
896 | 896 | |
897 | 897 | |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
900 | +if ( ! function_exists('espresso_venue_name')) { |
|
901 | 901 | /** |
902 | 902 | * espresso_venue_name |
903 | 903 | * |
@@ -907,19 +907,19 @@ discard block |
||
907 | 907 | * @param bool $echo |
908 | 908 | * @return string |
909 | 909 | */ |
910 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
911 | - if($echo){ |
|
912 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
910 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
911 | + if ($echo) { |
|
912 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
913 | 913 | return ''; |
914 | 914 | } |
915 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
915 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
916 | 916 | } |
917 | 917 | } |
918 | 918 | |
919 | 919 | |
920 | 920 | |
921 | 921 | |
922 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
922 | +if ( ! function_exists('espresso_venue_link')) { |
|
923 | 923 | /** |
924 | 924 | * espresso_venue_link |
925 | 925 | * |
@@ -928,14 +928,14 @@ discard block |
||
928 | 928 | * @param string $text |
929 | 929 | * @return string |
930 | 930 | */ |
931 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
932 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
931 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
932 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
933 | 933 | } |
934 | 934 | } |
935 | 935 | |
936 | 936 | |
937 | 937 | |
938 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
938 | +if ( ! function_exists('espresso_venue_description')) { |
|
939 | 939 | /** |
940 | 940 | * espresso_venue_description |
941 | 941 | * |
@@ -944,17 +944,17 @@ discard block |
||
944 | 944 | * @param bool $echo |
945 | 945 | * @return string |
946 | 946 | */ |
947 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
948 | - if($echo){ |
|
949 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
947 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
948 | + if ($echo) { |
|
949 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
950 | 950 | return ''; |
951 | 951 | } |
952 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
952 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
953 | 953 | } |
954 | 954 | } |
955 | 955 | |
956 | 956 | |
957 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
957 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
958 | 958 | /** |
959 | 959 | * espresso_venue_excerpt |
960 | 960 | * |
@@ -963,18 +963,18 @@ discard block |
||
963 | 963 | * @param bool $echo |
964 | 964 | * @return string |
965 | 965 | */ |
966 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
967 | - if ( $echo ) { |
|
968 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
966 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
967 | + if ($echo) { |
|
968 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); |
|
969 | 969 | return ''; |
970 | 970 | } |
971 | - return EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
971 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
972 | 972 | } |
973 | 973 | } |
974 | 974 | |
975 | 975 | |
976 | 976 | |
977 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
977 | +if ( ! function_exists('espresso_venue_categories')) { |
|
978 | 978 | /** |
979 | 979 | * espresso_venue_categories |
980 | 980 | * returns the terms associated with a venue |
@@ -984,17 +984,17 @@ discard block |
||
984 | 984 | * @param bool $echo |
985 | 985 | * @return string |
986 | 986 | */ |
987 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
988 | - if ( $echo ) { |
|
989 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
987 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
988 | + if ($echo) { |
|
989 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
990 | 990 | return ''; |
991 | 991 | } |
992 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
992 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
993 | 993 | } |
994 | 994 | } |
995 | 995 | |
996 | 996 | |
997 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
997 | +if ( ! function_exists('espresso_venue_address')) { |
|
998 | 998 | /** |
999 | 999 | * espresso_venue_address |
1000 | 1000 | * returns a formatted block of html for displaying a venue's address |
@@ -1004,17 +1004,17 @@ discard block |
||
1004 | 1004 | * @param bool $echo |
1005 | 1005 | * @return string |
1006 | 1006 | */ |
1007 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1008 | - if ( $echo ) { |
|
1009 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1007 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1008 | + if ($echo) { |
|
1009 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1010 | 1010 | return ''; |
1011 | 1011 | } |
1012 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1012 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | |
1017 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1017 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1018 | 1018 | /** |
1019 | 1019 | * espresso_venue_address |
1020 | 1020 | * returns an UN-formatted string containing a venue's address |
@@ -1024,17 +1024,17 @@ discard block |
||
1024 | 1024 | * @param bool $echo |
1025 | 1025 | * @return string |
1026 | 1026 | */ |
1027 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1028 | - if ( $echo ) { |
|
1029 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1027 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1028 | + if ($echo) { |
|
1029 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1030 | 1030 | return ''; |
1031 | 1031 | } |
1032 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1032 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1033 | 1033 | } |
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | |
1037 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1037 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1038 | 1038 | /** |
1039 | 1039 | * espresso_venue_has_address |
1040 | 1040 | * returns TRUE or FALSE if a Venue has address information |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | * @param int $VNU_ID |
1043 | 1043 | * @return bool |
1044 | 1044 | */ |
1045 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1046 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1045 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1046 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1047 | 1047 | } |
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | |
1051 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1051 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1052 | 1052 | /** |
1053 | 1053 | * espresso_venue_gmap |
1054 | 1054 | * returns a google map for the venue address |
@@ -1059,17 +1059,17 @@ discard block |
||
1059 | 1059 | * @param bool $echo |
1060 | 1060 | * @return string |
1061 | 1061 | */ |
1062 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1063 | - if ( $echo ) { |
|
1064 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1062 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1063 | + if ($echo) { |
|
1064 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1065 | 1065 | return ''; |
1066 | 1066 | } |
1067 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1067 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1068 | 1068 | } |
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | |
1072 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1072 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1073 | 1073 | /** |
1074 | 1074 | * espresso_venue_phone |
1075 | 1075 | * |
@@ -1077,18 +1077,18 @@ discard block |
||
1077 | 1077 | * @param bool $echo |
1078 | 1078 | * @return string |
1079 | 1079 | */ |
1080 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1081 | - if ( $echo ) { |
|
1082 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1080 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1081 | + if ($echo) { |
|
1082 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1083 | 1083 | return ''; |
1084 | 1084 | } |
1085 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1085 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1086 | 1086 | } |
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | |
1090 | 1090 | |
1091 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1091 | +if ( ! function_exists('espresso_venue_website')) { |
|
1092 | 1092 | /** |
1093 | 1093 | * espresso_venue_website |
1094 | 1094 | * |
@@ -1096,18 +1096,18 @@ discard block |
||
1096 | 1096 | * @param bool $echo |
1097 | 1097 | * @return string |
1098 | 1098 | */ |
1099 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1100 | - if ( $echo ) { |
|
1101 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1099 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1100 | + if ($echo) { |
|
1101 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1102 | 1102 | return ''; |
1103 | 1103 | } |
1104 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1104 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1105 | 1105 | } |
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | |
1109 | 1109 | |
1110 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1110 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1111 | 1111 | /** |
1112 | 1112 | * espresso_edit_venue_link |
1113 | 1113 | * |
@@ -1115,12 +1115,12 @@ discard block |
||
1115 | 1115 | * @param bool $echo |
1116 | 1116 | * @return string |
1117 | 1117 | */ |
1118 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1119 | - if($echo){ |
|
1120 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1118 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1119 | + if ($echo) { |
|
1120 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1121 | 1121 | return ''; |
1122 | 1122 | } |
1123 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1123 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1124 | 1124 | } |
1125 | 1125 | } |
1126 | 1126 |
@@ -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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | class Custom_Messages_Template_List_Table extends EE_Admin_List_Table { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $admin_page ) { |
|
33 | + public function __construct($admin_page) { |
|
34 | 34 | //Set parent defaults |
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | - $this->_data = $this->_admin_page->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE ); |
|
43 | - $this->_all_data_count = $this->_admin_page->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE ); |
|
42 | + $this->_data = $this->_admin_page->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE); |
|
43 | + $this->_all_data_count = $this->_admin_page->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function _set_properties() { |
51 | 51 | $this->_wp_list_args = array( |
52 | - 'singular' => __('Message Template Group', 'event_espresso' ), |
|
53 | - 'plural' => __('Message Template', 'event_espresso' ), |
|
52 | + 'singular' => __('Message Template Group', 'event_espresso'), |
|
53 | + 'plural' => __('Message Template', 'event_espresso'), |
|
54 | 54 | 'ajax' => TRUE, //for now, |
55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
56 | 56 | ); |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | 'cb' => '<input type="checkbox" />', |
60 | 60 | 'name' => __('Template Name', 'event_espresso'), |
61 | 61 | 'message_type' => __('Message Type', 'event_espresso'), |
62 | - 'messenger' => __( 'Messenger', 'event_espresso'), |
|
63 | - 'description' => __( 'Description', 'event_espresso' ), |
|
64 | - 'events' => __( 'Events', 'event_espresso'), //count of events using this template. |
|
62 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
63 | + 'description' => __('Description', 'event_espresso'), |
|
64 | + 'events' => __('Events', 'event_espresso'), //count of events using this template. |
|
65 | 65 | 'actions' => '' |
66 | 66 | //'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place. |
67 | 67 | ); |
68 | 68 | |
69 | 69 | $this->_sortable_columns = array( |
70 | - 'messenger' => array( 'MTP_messenger' => TRUE ), |
|
70 | + 'messenger' => array('MTP_messenger' => TRUE), |
|
71 | 71 | //'message_type' => array( 'MTP_message_type' => FALSE ) |
72 | 72 | ); |
73 | 73 | |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return string |
88 | 88 | */ |
89 | - public function single_row( $item ) { |
|
89 | + public function single_row($item) { |
|
90 | 90 | $message_type = $item->message_type_obj(); |
91 | 91 | $messenger = $item->messenger_obj(); |
92 | 92 | |
93 | - if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) { |
|
93 | + if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
94 | 94 | echo ''; |
95 | 95 | return; |
96 | 96 | } |
97 | 97 | |
98 | - parent::single_row( $item ); |
|
98 | + parent::single_row($item); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | |
109 | 109 | |
110 | 110 | //setup messengers for selects |
111 | - $i=1; |
|
111 | + $i = 1; |
|
112 | 112 | $m_values[0]['id'] = 'all'; |
113 | - $m_values[0]['text'] = __('All Messengers', 'event_espresso' ); |
|
114 | - foreach ( $messengers as $messenger => $args ) { |
|
113 | + $m_values[0]['text'] = __('All Messengers', 'event_espresso'); |
|
114 | + foreach ($messengers as $messenger => $args) { |
|
115 | 115 | $m_values[$i]['id'] = $messenger; |
116 | 116 | $m_values[$i]['text'] = ucwords($args['obj']->label['singular']); |
117 | 117 | $i++; |
118 | 118 | } |
119 | - foreach ( $messengers as $messenger => $args ) { |
|
119 | + foreach ($messengers as $messenger => $args) { |
|
120 | 120 | $m_values[$i]['id'] = $messenger; |
121 | 121 | $m_values[$i]['text'] = ucwords($args['obj']->label['singular']); |
122 | 122 | $i++; |
123 | 123 | } |
124 | 124 | |
125 | 125 | //lets do the same for message types |
126 | - $i=1; |
|
127 | - foreach ( $message_types as $message_type => $args ) { |
|
126 | + $i = 1; |
|
127 | + foreach ($message_types as $message_type => $args) { |
|
128 | 128 | $mt_values[$i]['id'] = $message_type; |
129 | 129 | $mt_values[$i]['text'] = ucwords($args['obj']->label['singular']); |
130 | 130 | $i++; |
@@ -140,28 +140,28 @@ discard block |
||
140 | 140 | 'text' => __('Show All', 'event_espresso') |
141 | 141 | ); |
142 | 142 | |
143 | - $msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array(); |
|
144 | - $mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array(); |
|
143 | + $msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array(); |
|
144 | + $mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array(); |
|
145 | 145 | |
146 | - if ( empty( $m_values ) ) |
|
146 | + if (empty($m_values)) |
|
147 | 147 | $msgr_filters[0] = array( |
148 | 148 | 'id' => 'no_messenger_options', |
149 | 149 | 'text' => __('No Messengers active', 'event_espresso') |
150 | 150 | ); |
151 | 151 | |
152 | - if ( empty($mt_values) ) |
|
152 | + if (empty($mt_values)) |
|
153 | 153 | $mt_filters[0] = array( |
154 | 154 | 'id' => 'no_message_type_options', |
155 | 155 | 'text' => __('No Message Types active', 'event_espresso') |
156 | 156 | ); |
157 | 157 | |
158 | - if ( count( $messengers ) >= 1 && !empty( $m_values ) ) { |
|
159 | - unset( $msgr_filters[0] ); |
|
160 | - $msgr_filters = array_values( $msgr_filters ); //reindex keys |
|
158 | + if (count($messengers) >= 1 && ! empty($m_values)) { |
|
159 | + unset($msgr_filters[0]); |
|
160 | + $msgr_filters = array_values($msgr_filters); //reindex keys |
|
161 | 161 | } |
162 | 162 | |
163 | - $filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key( $this->_req_data['ee_messenger_filter_by']) : '' ); |
|
164 | - $filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key( $this->_req_data['ee_message_type_filter_by']) : ''); |
|
163 | + $filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : ''); |
|
164 | + $filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : ''); |
|
165 | 165 | return $filters; |
166 | 166 | } |
167 | 167 | |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | * we're just removing the search box for message templates, not needed. |
170 | 170 | * @return string (empty); |
171 | 171 | */ |
172 | - function search_box( $text, $input_id ) { |
|
172 | + function search_box($text, $input_id) { |
|
173 | 173 | return ''; |
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | 177 | protected function _add_view_counts() { |
178 | - foreach ( $this->_views as $view => $args ) { |
|
179 | - $this->_views[$view]['count'] = $this->_admin_page->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE ); |
|
178 | + foreach ($this->_views as $view => $args) { |
|
179 | + $this->_views[$view]['count'] = $this->_admin_page->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | * @return string |
191 | 191 | */ |
192 | 192 | public function no_items() { |
193 | - if ( $this->_view !== 'trashed' ) |
|
194 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
193 | + if ($this->_view !== 'trashed') |
|
194 | + printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>'); |
|
195 | 195 | else |
196 | 196 | parent::no_items(); |
197 | 197 | } |
198 | 198 | |
199 | 199 | |
200 | 200 | |
201 | - public function column_cb( $item ) { |
|
202 | - return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() ); |
|
201 | + public function column_cb($item) { |
|
202 | + return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID()); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -207,29 +207,29 @@ discard block |
||
207 | 207 | |
208 | 208 | |
209 | 209 | |
210 | - function column_name( $item ) { |
|
211 | - return '<p>' . $item->name() . '</p>'; |
|
210 | + function column_name($item) { |
|
211 | + return '<p>'.$item->name().'</p>'; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
215 | 215 | |
216 | 216 | |
217 | - function column_description( $item ) { |
|
218 | - return '<p>' . $item->description() . '</p>'; |
|
217 | + function column_description($item) { |
|
218 | + return '<p>'.$item->description().'</p>'; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
222 | 222 | |
223 | - function column_actions( $item ) { |
|
224 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) { |
|
223 | + function column_actions($item) { |
|
224 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) { |
|
225 | 225 | $create_args = array( |
226 | 226 | 'GRP_ID' => $item->ID(), |
227 | 227 | 'messenger' => $item->messenger(), |
228 | 228 | 'message_type' => $item->message_type(), |
229 | 229 | 'action' => 'add_new_message_template' |
230 | 230 | ); |
231 | - $create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL ); |
|
232 | - return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') ); |
|
231 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
232 | + return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso')); |
|
233 | 233 | } |
234 | 234 | return ''; |
235 | 235 | } |
@@ -246,27 +246,27 @@ discard block |
||
246 | 246 | $actions = array(); |
247 | 247 | |
248 | 248 | // edit link but only if item isn't trashed. |
249 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) { |
|
250 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL ); |
|
251 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
249 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) { |
|
250 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL); |
|
251 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
252 | 252 | } |
253 | 253 | |
254 | - $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() )? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] ); |
|
255 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
254 | + $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']); |
|
255 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
256 | 256 | // restore link |
257 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
257 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
258 | 258 | // delete price link |
259 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
259 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
260 | 260 | |
261 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) { |
|
262 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
261 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) { |
|
262 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
263 | 263 | } else { |
264 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) { |
|
265 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
264 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) { |
|
265 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
266 | 266 | } |
267 | 267 | |
268 | - if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) { |
|
269 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
268 | + if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) { |
|
269 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | $c_configs = $item->contexts_config(); |
276 | 276 | $ctxt = array(); |
277 | 277 | $context_templates = $item->context_templates(); |
278 | - foreach ( $context_templates as $context => $template_fields ) { |
|
279 | - $mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
280 | - $inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : ''; |
|
278 | + foreach ($context_templates as $context => $template_fields) { |
|
279 | + $mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
280 | + $inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : ''; |
|
281 | 281 | $context_title = ucwords($c_configs[$context]['label']); |
282 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL ); |
|
283 | - $ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title; |
|
282 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL); |
|
283 | + $ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title; |
|
284 | 284 | } |
285 | 285 | |
286 | - $ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : ''; |
|
286 | + $ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : ''; |
|
287 | 287 | |
288 | 288 | |
289 | 289 | //Return the name contents |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | /* $1%s */ $name_link, |
292 | 292 | /* $2%s */ $item->GRP_ID(), |
293 | 293 | /* %4$s */ $ctx_content, |
294 | - /* $3%s */ $this->row_actions( $actions ) |
|
294 | + /* $3%s */ $this->row_actions($actions) |
|
295 | 295 | ); |
296 | 296 | } |
297 | 297 | |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return string message_type name |
313 | 313 | */ |
314 | 314 | function column_message_type($item) { |
315 | - return ucwords($item->message_type_obj()->label['singular'] ); |
|
315 | + return ucwords($item->message_type_obj()->label['singular']); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 |
@@ -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 | /** |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( EE_Admin_Page $adminpage ) { |
|
33 | + public function __construct(EE_Admin_Page $adminpage) { |
|
34 | 34 | /** |
35 | 35 | * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages |
36 | 36 | */ |
37 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) { |
|
37 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | - add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 ); |
|
41 | - parent::__construct( $adminpage ); |
|
40 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10); |
|
41 | + parent::__construct($adminpage); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | */ |
50 | 50 | protected function _extend_properties() { |
51 | 51 | |
52 | - define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' ); |
|
52 | + define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
53 | 53 | $this->_ajax_func = array( |
54 | 54 | 'ee_msgs_create_new_custom' => 'create_new_custom' |
55 | 55 | ); |
56 | 56 | $this->_metaboxes = array( |
57 | 57 | 0 => array( |
58 | - 'page_route' => array('edit','create_new'), |
|
58 | + 'page_route' => array('edit', 'create_new'), |
|
59 | 59 | 'func' => 'messages_metabox', |
60 | 60 | 'label' => __('Notifications', 'event_espresso'), |
61 | 61 | 'priority' => 'high' |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $this->_scripts_styles = array( |
67 | 67 | 'registers' => array( |
68 | 68 | 'events_msg_admin' => array( |
69 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js', |
|
69 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js', |
|
70 | 70 | 'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array') |
71 | 71 | ), |
72 | 72 | 'events_msg_admin_css' => array( |
73 | - 'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css', |
|
73 | + 'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css', |
|
74 | 74 | 'type' => 'css' |
75 | 75 | ) |
76 | 76 | ), |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | - public function caf_updates( $update_callbacks ) { |
|
86 | - $update_callbacks[] = array( $this, 'attach_evt_message_templates' ); |
|
85 | + public function caf_updates($update_callbacks) { |
|
86 | + $update_callbacks[] = array($this, 'attach_evt_message_templates'); |
|
87 | 87 | return $update_callbacks; |
88 | 88 | } |
89 | 89 | |
@@ -96,13 +96,13 @@ discard block |
||
96 | 96 | * @param array $data The request data from the form |
97 | 97 | * @return bool success or fail |
98 | 98 | */ |
99 | - public function attach_evt_message_templates( $evtobj, $data ) { |
|
99 | + public function attach_evt_message_templates($evtobj, $data) { |
|
100 | 100 | //first we remove all existing relations on the Event for message types. |
101 | 101 | $evtobj->_remove_relations('Message_Template_Group'); |
102 | 102 | |
103 | 103 | //now let's just loop throught the selected templates and add relations! |
104 | - foreach( $data['event_message_templates_relation'] as $grp_ID ) { |
|
105 | - $evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' ); |
|
104 | + foreach ($data['event_message_templates_relation'] as $grp_ID) { |
|
105 | + $evtobj->_add_relation_to($grp_ID, 'Message_Template_Group'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | //now save |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | |
116 | 116 | //let's get the active messengers (b/c messenger objects have the active message templates) |
117 | 117 | //convert 'evt_id' to 'EVT_ID' |
118 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL; |
|
119 | - $this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; |
|
118 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; |
|
119 | + $this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID']; |
|
120 | 120 | |
121 | - $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; |
|
121 | + $this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID']; |
|
122 | 122 | |
123 | 123 | |
124 | 124 | $EEM_controller = new EE_messages; |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | |
128 | 128 | //empty messengers? |
129 | 129 | //Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected. |
130 | - if ( empty( $active_messengers ) ) { |
|
131 | - $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL ); |
|
132 | - $error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>'); |
|
133 | - $error_content = '<div class="error"><p>' . $error_msg . '</p></div>'; |
|
134 | - $internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>'; |
|
130 | + if (empty($active_messengers)) { |
|
131 | + $msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL); |
|
132 | + $error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events. You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>'); |
|
133 | + $error_content = '<div class="error"><p>'.$error_msg.'</p></div>'; |
|
134 | + $internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>'; |
|
135 | 135 | |
136 | 136 | echo $error_content; |
137 | 137 | echo $internal_content; |
@@ -140,16 +140,16 @@ discard block |
||
140 | 140 | |
141 | 141 | $event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL; |
142 | 142 | //get content for active messengers |
143 | - foreach ( $active_messengers as $name => $messenger ) { |
|
143 | + foreach ($active_messengers as $name => $messenger) { |
|
144 | 144 | //first check if there are any active message types for this messenger. |
145 | - $active_mts = $EEM_controller->get_active_message_types_per_messenger( $name ); |
|
146 | - if ( empty( $active_mts ) ) { |
|
145 | + $active_mts = $EEM_controller->get_active_message_types_per_messenger($name); |
|
146 | + if (empty($active_mts)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | - $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) ); |
|
150 | + $tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id)); |
|
151 | 151 | |
152 | - if ( ! empty( $tcont ) ) { |
|
152 | + if ( ! empty($tcont)) { |
|
153 | 153 | $tabs[$name] = $tcont; |
154 | 154 | } |
155 | 155 | } |
@@ -157,21 +157,21 @@ discard block |
||
157 | 157 | |
158 | 158 | //we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper. |
159 | 159 | $tabbed_content = EEH_Tabbed_Content::display($tabs); |
160 | - if ( is_wp_error($tabbed_content) ) { |
|
160 | + if (is_wp_error($tabbed_content)) { |
|
161 | 161 | $tabbed_content = $tabbed_content->get_error_message(); |
162 | 162 | } |
163 | 163 | |
164 | 164 | $notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey"> |
165 | - <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span> |
|
165 | + <span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span> |
|
166 | 166 | </div><div class="ee-notices"></div>'; |
167 | 167 | |
168 | - if ( defined('DOING_AJAX' ) ) { |
|
168 | + if (defined('DOING_AJAX')) { |
|
169 | 169 | return $tabbed_content; |
170 | 170 | } |
171 | 171 | |
172 | - do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' ); |
|
173 | - echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>'; |
|
174 | - do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' ); |
|
172 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content'); |
|
173 | + echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>'; |
|
174 | + do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content'); |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function create_new_custom() { |
187 | 187 | |
188 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) { |
|
189 | - wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) ); |
|
188 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) { |
|
189 | + wp_die(__('You don\'t have privileges to do this action', 'event_espresso')); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | //let's clean up the _POST global a bit for downstream usage of name and description. |
193 | - $_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : ''; |
|
194 | - $_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : ''; |
|
193 | + $_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : ''; |
|
194 | + $_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : ''; |
|
195 | 195 | |
196 | 196 | |
197 | 197 | //set EE_Admin_Page object (see method details in EE_Admin_Hooks parent |
198 | 198 | $this->_set_page_object(); |
199 | 199 | |
200 | 200 | //is this a template switch if so EE_Admin_Page child needs this object |
201 | - $this->_page_object->set_hook_object( $this ); |
|
201 | + $this->_page_object->set_hook_object($this); |
|
202 | 202 | |
203 | - $this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] ); |
|
203 | + $this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return string (admin_footer contents) |
216 | 216 | */ |
217 | 217 | public function edit_admin_footer() { |
218 | - $template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'; |
|
218 | + $template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'; |
|
219 | 219 | EEH_Template::display_template($template_path, array()); |
220 | 220 | } |
221 | 221 |