@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | final class EE_Admin { |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * EE_Admin Object |
|
| 28 | - * @private _instance |
|
| 29 | - * @private protected |
|
| 30 | - */ |
|
| 27 | + * EE_Admin Object |
|
| 28 | + * @private _instance |
|
| 29 | + * @private protected |
|
| 30 | + */ |
|
| 31 | 31 | private static $_instance = NULL; |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * class constructor |
|
| 60 | - */ |
|
| 59 | + * class constructor |
|
| 60 | + */ |
|
| 61 | 61 | protected function __construct() { |
| 62 | 62 | // define global EE_Admin constants |
| 63 | 63 | $this->_define_all_constants(); |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | - * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
| 172 | - * |
|
| 173 | - * @access public |
|
| 174 | - * @return void |
|
| 175 | - */ |
|
| 171 | + * init- should fire after shortcode, module, addon, other plugin (default priority), and even EE_Front_Controller's init phases have run |
|
| 172 | + * |
|
| 173 | + * @access public |
|
| 174 | + * @return void |
|
| 175 | + */ |
|
| 176 | 176 | public function init() { |
| 177 | 177 | |
| 178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
@@ -463,11 +463,11 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | |
| 465 | 465 | /** |
| 466 | - * admin_init |
|
| 467 | - * |
|
| 468 | - * @access public |
|
| 469 | - * @return void |
|
| 470 | - */ |
|
| 466 | + * admin_init |
|
| 467 | + * |
|
| 468 | + * @access public |
|
| 469 | + * @return void |
|
| 470 | + */ |
|
| 471 | 471 | public function admin_init() { |
| 472 | 472 | |
| 473 | 473 | /** |
@@ -624,11 +624,11 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | |
| 626 | 626 | /** |
| 627 | - * dismiss_persistent_admin_notice |
|
| 628 | - * |
|
| 629 | - * @access public |
|
| 630 | - * @return void |
|
| 631 | - */ |
|
| 627 | + * dismiss_persistent_admin_notice |
|
| 628 | + * |
|
| 629 | + * @access public |
|
| 630 | + * @return void |
|
| 631 | + */ |
|
| 632 | 632 | public function dismiss_ee_nag_notice_callback() { |
| 633 | 633 | EE_Error::dismiss_persistent_admin_notice(); |
| 634 | 634 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public static function instance() { |
| 49 | 49 | // check if class object is instantiated |
| 50 | - if ( ! self::$_instance instanceof EE_Admin ) { |
|
| 50 | + if ( ! self::$_instance instanceof EE_Admin) { |
|
| 51 | 51 | self::$_instance = new self(); |
| 52 | 52 | } |
| 53 | 53 | return self::$_instance; |
@@ -62,25 +62,25 @@ discard block |
||
| 62 | 62 | // define global EE_Admin constants |
| 63 | 63 | $this->_define_all_constants(); |
| 64 | 64 | // set autoloaders for our admin page classes based on included path information |
| 65 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN ); |
|
| 65 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN); |
|
| 66 | 66 | // admin hooks |
| 67 | - add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 ); |
|
| 67 | + add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2); |
|
| 68 | 68 | // load EE_Request_Handler early |
| 69 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' )); |
|
| 70 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' )); |
|
| 71 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 ); |
|
| 72 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 ); |
|
| 73 | - add_action( 'admin_init', array( $this, 'admin_init' ), 100 ); |
|
| 74 | - add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 ); |
|
| 75 | - add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
| 76 | - add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 ); |
|
| 77 | - add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 ); |
|
| 78 | - add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' )); |
|
| 69 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request')); |
|
| 70 | + add_action('AHEE__EE_System__initialize_last', array($this, 'init')); |
|
| 71 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2); |
|
| 72 | + add_action('wp_loaded', array($this, 'wp_loaded'), 100); |
|
| 73 | + add_action('admin_init', array($this, 'admin_init'), 100); |
|
| 74 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20); |
|
| 75 | + add_action('admin_notices', array($this, 'display_admin_notices'), 10); |
|
| 76 | + add_action('network_admin_notices', array($this, 'display_admin_notices'), 10); |
|
| 77 | + add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2); |
|
| 78 | + add_filter('admin_footer_text', array($this, 'espresso_admin_footer')); |
|
| 79 | 79 | |
| 80 | 80 | //reset Environment config (we only do this on admin page loads); |
| 81 | 81 | EE_Registry::instance()->CFG->environment->recheck_values(); |
| 82 | 82 | |
| 83 | - do_action( 'AHEE__EE_Admin__loaded' ); |
|
| 83 | + do_action('AHEE__EE_Admin__loaded'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | private function _define_all_constants() { |
| 98 | - define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' ); |
|
| 99 | - define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' ); |
|
| 100 | - define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS ); |
|
| 101 | - define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' ); |
|
| 102 | - define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' )); |
|
| 103 | - define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' ); |
|
| 98 | + define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/'); |
|
| 99 | + define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/'); |
|
| 100 | + define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS); |
|
| 101 | + define('WP_ADMIN_PATH', ABSPATH.'wp-admin/'); |
|
| 102 | + define('WP_AJAX_URL', admin_url('admin-ajax.php')); |
|
| 103 | + define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/'); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -113,23 +113,23 @@ discard block |
||
| 113 | 113 | * @param string $plugin |
| 114 | 114 | * @return array |
| 115 | 115 | */ |
| 116 | - public function filter_plugin_actions( $links, $plugin ) { |
|
| 116 | + public function filter_plugin_actions($links, $plugin) { |
|
| 117 | 117 | // set $main_file in stone |
| 118 | 118 | static $main_file; |
| 119 | 119 | // if $main_file is not set yet |
| 120 | - if ( ! $main_file ) { |
|
| 121 | - $main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE ); |
|
| 120 | + if ( ! $main_file) { |
|
| 121 | + $main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE); |
|
| 122 | 122 | } |
| 123 | - if ( $plugin == $main_file ) { |
|
| 123 | + if ($plugin == $main_file) { |
|
| 124 | 124 | // compare current plugin to this one |
| 125 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
| 126 | - $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>'; |
|
| 127 | - array_unshift( $links, $maintenance_link ); |
|
| 125 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 126 | + $maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode. Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>'; |
|
| 127 | + array_unshift($links, $maintenance_link); |
|
| 128 | 128 | } else { |
| 129 | - $org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>'; |
|
| 130 | - $events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>'; |
|
| 129 | + $org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>'; |
|
| 130 | + $events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>'; |
|
| 131 | 131 | // add before other links |
| 132 | - array_unshift( $links, $org_settings_link, $events_link ); |
|
| 132 | + array_unshift($links, $org_settings_link, $events_link); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | return $links; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | 146 | public function get_request() { |
| 147 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
| 148 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
| 147 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
| 148 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | * @param array $admin_page_folder_names |
| 158 | 158 | * @return array |
| 159 | 159 | */ |
| 160 | - public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){ |
|
| 160 | + public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) { |
|
| 161 | 161 | return array( |
| 162 | - 'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS, |
|
| 163 | - 'about' => EE_ADMIN_PAGES . 'about' . DS, |
|
| 164 | - 'support' => EE_ADMIN_PAGES . 'support' . DS |
|
| 162 | + 'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS, |
|
| 163 | + 'about' => EE_ADMIN_PAGES.'about'.DS, |
|
| 164 | + 'support' => EE_ADMIN_PAGES.'support'.DS |
|
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -176,36 +176,36 @@ discard block |
||
| 176 | 176 | public function init() { |
| 177 | 177 | |
| 178 | 178 | //only enable most of the EE_Admin IF we're not in full maintenance mode |
| 179 | - if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
| 179 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
| 180 | 180 | //ok so we want to enable the entire admin |
| 181 | - add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' )); |
|
| 182 | - add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 ); |
|
| 183 | - add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 ); |
|
| 184 | - add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 ); |
|
| 185 | - add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
| 186 | - add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 ); |
|
| 181 | + add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback')); |
|
| 182 | + add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2); |
|
| 183 | + add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3); |
|
| 184 | + add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1); |
|
| 185 | + add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
| 186 | + add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9); |
|
| 187 | 187 | //at a glance dashboard widget |
| 188 | - add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 ); |
|
| 188 | + add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10); |
|
| 189 | 189 | //filter for get_edit_post_link used on comments for custom post types |
| 190 | - add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 ); |
|
| 190 | + add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // run the admin page factory but ONLY if we are doing an ee admin ajax request |
| 194 | - if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) { |
|
| 194 | + if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) { |
|
| 195 | 195 | try { |
| 196 | 196 | //this loads the controller for the admin pages which will setup routing etc |
| 197 | - EE_Registry::instance()->load_core( 'Admin_Page_Loader' ); |
|
| 198 | - } catch ( EE_Error $e ) { |
|
| 197 | + EE_Registry::instance()->load_core('Admin_Page_Loader'); |
|
| 198 | + } catch (EE_Error $e) { |
|
| 199 | 199 | $e->get_error(); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | //make sure our CPTs and custom taxonomy metaboxes get shown for first time users |
| 204 | - add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 ); |
|
| 205 | - add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 ); |
|
| 204 | + add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10); |
|
| 205 | + add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10); |
|
| 206 | 206 | |
| 207 | 207 | //exclude EE critical pages from all nav menus and wp_list_pages |
| 208 | - add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 ); |
|
| 208 | + add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | * @param object $post_type WP post type object |
| 219 | 219 | * @return object WP post type object |
| 220 | 220 | */ |
| 221 | - public function remove_pages_from_nav_menu( $post_type ) { |
|
| 221 | + public function remove_pages_from_nav_menu($post_type) { |
|
| 222 | 222 | //if this isn't the "pages" post type let's get out |
| 223 | - if ( $post_type->name !== 'page' ) |
|
| 223 | + if ($post_type->name !== 'page') |
|
| 224 | 224 | return $post_type; |
| 225 | 225 | |
| 226 | 226 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
@@ -240,26 +240,26 @@ discard block |
||
| 240 | 240 | */ |
| 241 | 241 | public function enable_hidden_ee_nav_menu_metaboxes() { |
| 242 | 242 | global $wp_meta_boxes, $pagenow; |
| 243 | - if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) { |
|
| 243 | + if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') { |
|
| 244 | 244 | return; |
| 245 | 245 | } |
| 246 | 246 | $user = wp_get_current_user(); |
| 247 | 247 | //has this been done yet? |
| 248 | - if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) { |
|
| 248 | + if (get_user_option('ee_nav_menu_initialized', $user->ID)) { |
|
| 249 | 249 | return; |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID ); |
|
| 253 | - $initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) ); |
|
| 252 | + $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID); |
|
| 253 | + $initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page')); |
|
| 254 | 254 | |
| 255 | - foreach( $hidden_meta_boxes as $key => $meta_box_id ) { |
|
| 256 | - if ( in_array( $meta_box_id, $initial_meta_boxes ) ) { |
|
| 257 | - unset( $hidden_meta_boxes[$key] ); |
|
| 255 | + foreach ($hidden_meta_boxes as $key => $meta_box_id) { |
|
| 256 | + if (in_array($meta_box_id, $initial_meta_boxes)) { |
|
| 257 | + unset($hidden_meta_boxes[$key]); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
| 262 | - update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true ); |
|
| 261 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
| 262 | + update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @return void |
| 279 | 279 | */ |
| 280 | 280 | public function register_custom_nav_menu_boxes() { |
| 281 | - add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' ); |
|
| 281 | + add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core'); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
@@ -295,17 +295,17 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @return string the (maybe) modified link |
| 297 | 297 | */ |
| 298 | - public function modify_edit_post_link( $link, $id, $context ) { |
|
| 299 | - if ( ! $post = get_post( $id ) ) |
|
| 298 | + public function modify_edit_post_link($link, $id, $context) { |
|
| 299 | + if ( ! $post = get_post($id)) |
|
| 300 | 300 | return $link; |
| 301 | 301 | |
| 302 | - if ( $post->post_type == 'espresso_attendees' ) { |
|
| 302 | + if ($post->post_type == 'espresso_attendees') { |
|
| 303 | 303 | $query_args = array( |
| 304 | 304 | 'action' => 'edit_attendee', |
| 305 | 305 | 'post' => $id |
| 306 | 306 | ); |
| 307 | 307 | EE_Registry::instance()->load_helper('URL'); |
| 308 | - return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') ); |
|
| 308 | + return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations')); |
|
| 309 | 309 | } |
| 310 | 310 | return $link; |
| 311 | 311 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | global $nav_menu_selected_id; |
| 318 | 318 | |
| 319 | 319 | $db_fields = false; |
| 320 | - $walker = new Walker_Nav_Menu_Checklist( $db_fields ); |
|
| 320 | + $walker = new Walker_Nav_Menu_Checklist($db_fields); |
|
| 321 | 321 | $current_tab = 'event-archives'; |
| 322 | 322 | |
| 323 | 323 | /*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) { |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | ?> |
| 337 | 337 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
| 338 | 338 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
| 339 | - <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
|
| 340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
| 341 | - <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
|
| 339 | + <li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>> |
|
| 340 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
| 341 | + <?php _e('Event Archive Pages', 'event_espresso'); ?> |
|
| 342 | 342 | </a> |
| 343 | 343 | </li> |
| 344 | 344 | <?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs. |
@@ -356,13 +356,13 @@ discard block |
||
| 356 | 356 | <?php */ ?> |
| 357 | 357 | |
| 358 | 358 | <div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php |
| 359 | - echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' ); |
|
| 359 | + echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive'); |
|
| 360 | 360 | ?>"> |
| 361 | 361 | <ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear"> |
| 362 | 362 | <?php |
| 363 | 363 | $pages = $this->_get_extra_nav_menu_pages_items(); |
| 364 | 364 | $args['walker'] = $walker; |
| 365 | - echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args ); |
|
| 365 | + echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args); |
|
| 366 | 366 | ?> |
| 367 | 367 | </ul> |
| 368 | 368 | </div><!-- /.tabs-panel --> |
@@ -370,18 +370,18 @@ discard block |
||
| 370 | 370 | <p class="button-controls"> |
| 371 | 371 | <span class="list-controls"> |
| 372 | 372 | <a href="<?php |
| 373 | - echo esc_url( add_query_arg( |
|
| 373 | + echo esc_url(add_query_arg( |
|
| 374 | 374 | array( |
| 375 | 375 | 'extra-nav-menu-pages-tab' => 'event-archives', |
| 376 | 376 | 'selectall' => 1, |
| 377 | 377 | ), |
| 378 | - remove_query_arg( $removed_args ) |
|
| 378 | + remove_query_arg($removed_args) |
|
| 379 | 379 | )); |
| 380 | 380 | ?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a> |
| 381 | 381 | </span> |
| 382 | 382 | |
| 383 | 383 | <span class="add-to-menu"> |
| 384 | - <input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" /> |
|
| 384 | + <input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" /> |
|
| 385 | 385 | <span class="spinner"></span> |
| 386 | 386 | </span> |
| 387 | 387 | </p> |
@@ -402,10 +402,10 @@ discard block |
||
| 402 | 402 | private function _get_extra_nav_menu_pages_items() { |
| 403 | 403 | $menuitems[] = array( |
| 404 | 404 | 'title' => __('Event List', 'event_espresso'), |
| 405 | - 'url' => get_post_type_archive_link( 'espresso_events' ), |
|
| 405 | + 'url' => get_post_type_archive_link('espresso_events'), |
|
| 406 | 406 | 'description' => __('Archive page for all events.', 'event_espresso') |
| 407 | 407 | ); |
| 408 | - return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems ); |
|
| 408 | + return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @param $menuitem |
| 418 | 418 | * @return stdClass |
| 419 | 419 | */ |
| 420 | - private function _setup_extra_nav_menu_pages_items( $menuitem ) { |
|
| 420 | + private function _setup_extra_nav_menu_pages_items($menuitem) { |
|
| 421 | 421 | $menu_item = new stdClass(); |
| 422 | 422 | $keys = array( |
| 423 | 423 | 'ID' => 0, |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | 'xfn' => '' |
| 438 | 438 | ); |
| 439 | 439 | |
| 440 | - foreach ( $keys as $key => $value) { |
|
| 440 | + foreach ($keys as $key => $value) { |
|
| 441 | 441 | $menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value; |
| 442 | 442 | } |
| 443 | 443 | return $menu_item; |
@@ -477,10 +477,10 @@ discard block |
||
| 477 | 477 | * - check if doing post processing of one of EE CPTs |
| 478 | 478 | * - instantiate the corresponding EE CPT model for the post_type being processed. |
| 479 | 479 | */ |
| 480 | - if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) { |
|
| 481 | - if ( isset( $_POST['post_type'] ) ) { |
|
| 482 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
| 483 | - EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] ); |
|
| 480 | + if (isset($_POST['action']) && $_POST['action'] == 'editpost') { |
|
| 481 | + if (isset($_POST['post_type'])) { |
|
| 482 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
| 483 | + EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']); |
|
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
@@ -490,8 +490,8 @@ discard block |
||
| 490 | 490 | * 'options-reading.php' core WordPress admin settings page. This is for user-proofing. |
| 491 | 491 | */ |
| 492 | 492 | global $pagenow; |
| 493 | - if ( $pagenow == 'options-reading.php' ) { |
|
| 494 | - add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) ); |
|
| 493 | + if ($pagenow == 'options-reading.php') { |
|
| 494 | + add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages')); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | } |
@@ -503,25 +503,25 @@ discard block |
||
| 503 | 503 | * @param string $output Current output. |
| 504 | 504 | * @return string |
| 505 | 505 | */ |
| 506 | - public function modify_dropdown_pages( $output ) { |
|
| 506 | + public function modify_dropdown_pages($output) { |
|
| 507 | 507 | //get critical pages |
| 508 | 508 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
| 509 | 509 | |
| 510 | 510 | //split current output by line break for easier parsing. |
| 511 | - $split_output = explode( "\n", $output ); |
|
| 511 | + $split_output = explode("\n", $output); |
|
| 512 | 512 | |
| 513 | 513 | //loop through to remove any critical pages from the array. |
| 514 | - foreach ( $critical_pages as $page_id ) { |
|
| 515 | - $needle = 'value="' . $page_id . '"'; |
|
| 516 | - foreach( $split_output as $key => $haystack ) { |
|
| 517 | - if( strpos( $haystack, $needle ) !== false ) { |
|
| 518 | - unset( $split_output[$key] ); |
|
| 514 | + foreach ($critical_pages as $page_id) { |
|
| 515 | + $needle = 'value="'.$page_id.'"'; |
|
| 516 | + foreach ($split_output as $key => $haystack) { |
|
| 517 | + if (strpos($haystack, $needle) !== false) { |
|
| 518 | + unset($split_output[$key]); |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | //replace output with the new contents |
| 524 | - $output = implode( "\n", $split_output ); |
|
| 524 | + $output = implode("\n", $split_output); |
|
| 525 | 525 | |
| 526 | 526 | return $output; |
| 527 | 527 | } |
@@ -537,37 +537,37 @@ discard block |
||
| 537 | 537 | public function enqueue_admin_scripts() { |
| 538 | 538 | // this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js. |
| 539 | 539 | // Note: the intention of this script is to only do TARGETED injections. I.E, only injecting on certain script calls. |
| 540 | - wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 540 | + wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 541 | 541 | // register cookie script for future dependencies |
| 542 | - wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE ); |
|
| 542 | + wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE); |
|
| 543 | 543 | // jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
| 544 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
| 544 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
| 545 | 545 | // register jQuery Validate |
| 546 | - wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
| 546 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE); |
|
| 547 | 547 | } |
| 548 | 548 | //joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' ); |
| 549 | - if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) { |
|
| 549 | + if (apply_filters('FHEE_load_joyride', FALSE)) { |
|
| 550 | 550 | //joyride style |
| 551 | - wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1'); |
|
| 552 | - wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION ); |
|
| 553 | - wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE ); |
|
| 551 | + wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1'); |
|
| 552 | + wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION); |
|
| 553 | + wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE); |
|
| 554 | 554 | //joyride JS |
| 555 | - wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE ); |
|
| 555 | + wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE); |
|
| 556 | 556 | // wanna go for a joyride? |
| 557 | 557 | wp_enqueue_style('ee-joyride-css'); |
| 558 | 558 | wp_enqueue_script('jquery-joyride'); |
| 559 | 559 | } |
| 560 | 560 | //qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' ); |
| 561 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
| 561 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
| 562 | 562 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
| 563 | 563 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
| 564 | 564 | } |
| 565 | 565 | //accounting.js library |
| 566 | 566 | // @link http://josscrowcroft.github.io/accounting.js/ |
| 567 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
| 568 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 569 | - wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE ); |
|
| 570 | - wp_enqueue_script( 'ee-accounting' ); |
|
| 567 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
| 568 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 569 | + wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE); |
|
| 570 | + wp_enqueue_script('ee-accounting'); |
|
| 571 | 571 | // array of settings to get converted to JSON array via wp_localize_script |
| 572 | 572 | $currency_config = array( |
| 573 | 573 | 'currency' => array( |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | public function get_persistent_admin_notices() { |
| 615 | 615 | // http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30 |
| 616 | 616 | $args = array( |
| 617 | - 'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '', |
|
| 618 | - 'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '', |
|
| 617 | + 'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '', |
|
| 618 | + 'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '', |
|
| 619 | 619 | ); |
| 620 | - $return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL ); |
|
| 621 | - echo EE_Error::get_persistent_admin_notices( $return_url ); |
|
| 620 | + $return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL); |
|
| 621 | + echo EE_Error::get_persistent_admin_notices($return_url); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -639,26 +639,26 @@ discard block |
||
| 639 | 639 | * @param $elements |
| 640 | 640 | * @return array |
| 641 | 641 | */ |
| 642 | - public function dashboard_glance_items( $elements ) { |
|
| 642 | + public function dashboard_glance_items($elements) { |
|
| 643 | 643 | $events = EEM_Event::instance()->count(); |
| 644 | - $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') ); |
|
| 645 | - $items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) ); |
|
| 644 | + $items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php')); |
|
| 645 | + $items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events)); |
|
| 646 | 646 | $items['events']['title'] = __('Click to view all Events', 'event_espresso'); |
| 647 | 647 | $registrations = EEM_Registration::instance()->count( |
| 648 | 648 | array( |
| 649 | 649 | array( |
| 650 | - 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) |
|
| 650 | + 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete) |
|
| 651 | 651 | ) |
| 652 | 652 | ) |
| 653 | 653 | ); |
| 654 | - $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') ); |
|
| 655 | - $items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) ); |
|
| 654 | + $items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php')); |
|
| 655 | + $items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations)); |
|
| 656 | 656 | $items['registrations']['title'] = __('Click to view all registrations', 'event_espresso'); |
| 657 | 657 | |
| 658 | - $items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items ); |
|
| 658 | + $items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items); |
|
| 659 | 659 | |
| 660 | - foreach ( $items as $type => $item_properties ) { |
|
| 661 | - $elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] ); |
|
| 660 | + foreach ($items as $type => $item_properties) { |
|
| 661 | + $elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']); |
|
| 662 | 662 | } |
| 663 | 663 | return $elements; |
| 664 | 664 | } |
@@ -677,63 +677,63 @@ discard block |
||
| 677 | 677 | * @param $post |
| 678 | 678 | * @return void |
| 679 | 679 | */ |
| 680 | - public static function parse_post_content_on_save( $post_ID, $post ) { |
|
| 680 | + public static function parse_post_content_on_save($post_ID, $post) { |
|
| 681 | 681 | // default post types |
| 682 | - $post_types = array( 'post' => 0, 'page' => 1 ); |
|
| 682 | + $post_types = array('post' => 0, 'page' => 1); |
|
| 683 | 683 | // add CPTs |
| 684 | 684 | $CPTs = EE_Register_CPTs::get_CPTs(); |
| 685 | - $post_types = array_merge( $post_types, $CPTs ); |
|
| 685 | + $post_types = array_merge($post_types, $CPTs); |
|
| 686 | 686 | // for default or CPT posts... |
| 687 | - if ( isset( $post_types[ $post->post_type ] )) { |
|
| 687 | + if (isset($post_types[$post->post_type])) { |
|
| 688 | 688 | // post on frontpage ? |
| 689 | 689 | $page_for_posts = EE_Config::get_page_for_posts(); |
| 690 | 690 | $maybe_remove_from_posts = array(); |
| 691 | 691 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
| 692 | 692 | $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array(); |
| 693 | 693 | // array of shortcodes indexed by post name |
| 694 | - EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
| 694 | + EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array(); |
|
| 695 | 695 | // whether to proceed with update, if an entry already exists for this post, then we want to update |
| 696 | - $update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false; |
|
| 696 | + $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false; |
|
| 697 | 697 | // empty both arrays |
| 698 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array(); |
|
| 698 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array(); |
|
| 699 | 699 | // check that posts page is already being tracked |
| 700 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) { |
|
| 700 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
| 701 | 701 | // if not, then ensure that it is properly added |
| 702 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array(); |
|
| 702 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array(); |
|
| 703 | 703 | } |
| 704 | 704 | // loop thru shortcodes |
| 705 | - foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) { |
|
| 705 | + foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) { |
|
| 706 | 706 | // convert to UPPERCASE to get actual shortcode |
| 707 | - $EES_Shortcode = strtoupper( $EES_Shortcode ); |
|
| 707 | + $EES_Shortcode = strtoupper($EES_Shortcode); |
|
| 708 | 708 | // is the shortcode in the post_content ? |
| 709 | - if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) { |
|
| 709 | + if (strpos($post->post_content, $EES_Shortcode) !== FALSE) { |
|
| 710 | 710 | // map shortcode to post names and post IDs |
| 711 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID; |
|
| 711 | + EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID; |
|
| 712 | 712 | // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE |
| 713 | - if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) { |
|
| 713 | + if ( ! in_array($EES_Shortcode, $critical_shortcodes)) { |
|
| 714 | 714 | // add shortcode to "Posts page" tracking |
| 715 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID; |
|
| 715 | + EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID; |
|
| 716 | 716 | } |
| 717 | 717 | $update_post_shortcodes = TRUE; |
| 718 | - unset( $maybe_remove_from_posts[ $EES_Shortcode ] ); |
|
| 718 | + unset($maybe_remove_from_posts[$EES_Shortcode]); |
|
| 719 | 719 | } else { |
| 720 | - $maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID; |
|
| 720 | + $maybe_remove_from_posts[$EES_Shortcode] = $post_ID; |
|
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | - if ( $update_post_shortcodes ) { |
|
| 723 | + if ($update_post_shortcodes) { |
|
| 724 | 724 | // remove shortcodes from $maybe_remove_from_posts that are still being used |
| 725 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) { |
|
| 726 | - if ( $post_name == $page_for_posts ) { |
|
| 725 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) { |
|
| 726 | + if ($post_name == $page_for_posts) { |
|
| 727 | 727 | continue; |
| 728 | 728 | } |
| 729 | 729 | // compute difference between active post_shortcodes array and $maybe_remove_from_posts array |
| 730 | - $maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes ); |
|
| 730 | + $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes); |
|
| 731 | 731 | } |
| 732 | 732 | // now unset unused shortcodes from the $page_for_posts post_shortcodes |
| 733 | - foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) { |
|
| 734 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] ); |
|
| 733 | + foreach ($maybe_remove_from_posts as $shortcode => $post_ID) { |
|
| 734 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]); |
|
| 735 | 735 | } |
| 736 | - EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts ); |
|
| 736 | + EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts); |
|
| 737 | 737 | } |
| 738 | 738 | } |
| 739 | 739 | } |
@@ -751,32 +751,32 @@ discard block |
||
| 751 | 751 | * @throws EE_Error |
| 752 | 752 | * @return string |
| 753 | 753 | */ |
| 754 | - public function check_for_invalid_datetime_formats( $value, $option ) { |
|
| 755 | - EE_Registry::instance()->load_helper( 'DTT_Helper' ); |
|
| 754 | + public function check_for_invalid_datetime_formats($value, $option) { |
|
| 755 | + EE_Registry::instance()->load_helper('DTT_Helper'); |
|
| 756 | 756 | // check for date_format or time_format |
| 757 | - switch ( $option ) { |
|
| 757 | + switch ($option) { |
|
| 758 | 758 | case 'date_format' : |
| 759 | - $date_time_format = $value . ' ' . get_option('time_format'); |
|
| 759 | + $date_time_format = $value.' '.get_option('time_format'); |
|
| 760 | 760 | break; |
| 761 | 761 | case 'time_format' : |
| 762 | - $date_time_format = get_option('date_format') . ' ' . $value; |
|
| 762 | + $date_time_format = get_option('date_format').' '.$value; |
|
| 763 | 763 | break; |
| 764 | 764 | default : |
| 765 | 765 | $date_time_format = FALSE; |
| 766 | 766 | } |
| 767 | 767 | // do we have a date_time format to check ? |
| 768 | - if ( $date_time_format ) { |
|
| 769 | - $error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format ); |
|
| 768 | + if ($date_time_format) { |
|
| 769 | + $error_msg = EEH_DTT_Helper::validate_format_string($date_time_format); |
|
| 770 | 770 | |
| 771 | - if ( is_array( $error_msg ) ) { |
|
| 772 | - $msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format ) . '</p><p><ul>'; |
|
| 771 | + if (is_array($error_msg)) { |
|
| 772 | + $msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>'; |
|
| 773 | 773 | |
| 774 | 774 | |
| 775 | - foreach ( $error_msg as $error ) { |
|
| 776 | - $msg .= '<li>' . $error . '</li>'; |
|
| 775 | + foreach ($error_msg as $error) { |
|
| 776 | + $msg .= '<li>'.$error.'</li>'; |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | - $msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>'; |
|
| 779 | + $msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>'; |
|
| 780 | 780 | |
| 781 | 781 | // trigger WP settings error |
| 782 | 782 | add_settings_error( |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | ); |
| 787 | 787 | |
| 788 | 788 | // set format to something valid |
| 789 | - switch ( $option ) { |
|
| 789 | + switch ($option) { |
|
| 790 | 790 | case 'date_format' : |
| 791 | 791 | $value = 'F j, Y'; |
| 792 | 792 | break; |
@@ -812,14 +812,14 @@ discard block |
||
| 812 | 812 | * @param $value |
| 813 | 813 | * @return void |
| 814 | 814 | */ |
| 815 | - public function reset_page_for_posts_on_change( $option, $old_value, $value ) { |
|
| 816 | - if ( $option == 'page_for_posts' ) { |
|
| 815 | + public function reset_page_for_posts_on_change($option, $old_value, $value) { |
|
| 816 | + if ($option == 'page_for_posts') { |
|
| 817 | 817 | global $wpdb; |
| 818 | - $SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
| 819 | - $old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts'; |
|
| 820 | - $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts'; |
|
| 821 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ]; |
|
| 822 | - EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts ); |
|
| 818 | + $SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s'; |
|
| 819 | + $old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts'; |
|
| 820 | + $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts'; |
|
| 821 | + EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts]; |
|
| 822 | + EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts); |
|
| 823 | 823 | } |
| 824 | 824 | } |
| 825 | 825 | |
@@ -832,8 +832,8 @@ discard block |
||
| 832 | 832 | * @param $content |
| 833 | 833 | * @return string |
| 834 | 834 | */ |
| 835 | - public function its_eSpresso( $content ) { |
|
| 836 | - return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content ); |
|
| 835 | + public function its_eSpresso($content) { |
|
| 836 | + return str_replace('[EXPRESSO_', '[ESPRESSO_', $content); |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | |
@@ -846,9 +846,9 @@ discard block |
||
| 846 | 846 | */ |
| 847 | 847 | public function espresso_admin_footer() { |
| 848 | 848 | return sprintf( |
| 849 | - __( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ), |
|
| 849 | + __('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'), |
|
| 850 | 850 | '<a href="http://eventespresso.com/" title="', |
| 851 | - '">' . EVENT_ESPRESSO_POWERED_BY . '</a>' |
|
| 851 | + '">'.EVENT_ESPRESSO_POWERED_BY.'</a>' |
|
| 852 | 852 | ); |
| 853 | 853 | } |
| 854 | 854 | |
@@ -868,11 +868,11 @@ discard block |
||
| 868 | 868 | * @param array $config |
| 869 | 869 | * @return void |
| 870 | 870 | */ |
| 871 | - public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
|
| 872 | - EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
|
| 873 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
| 871 | + public static function register_ee_admin_page($page_basename, $page_path, $config = array()) { |
|
| 872 | + EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3'); |
|
| 873 | + if (class_exists('EE_Register_Admin_Page')) |
|
| 874 | 874 | $config['page_path'] = $page_path; |
| 875 | - EE_Register_Admin_Page::register( $page_basename, $config ); |
|
| 875 | + EE_Register_Admin_Page::register($page_basename, $config); |
|
| 876 | 876 | } |
| 877 | 877 | |
| 878 | 878 | |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -220,8 +222,9 @@ discard block |
||
| 220 | 222 | */ |
| 221 | 223 | public function remove_pages_from_nav_menu( $post_type ) { |
| 222 | 224 | //if this isn't the "pages" post type let's get out |
| 223 | - if ( $post_type->name !== 'page' ) |
|
| 224 | - return $post_type; |
|
| 225 | + if ( $post_type->name !== 'page' ) { |
|
| 226 | + return $post_type; |
|
| 227 | + } |
|
| 225 | 228 | |
| 226 | 229 | $critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array(); |
| 227 | 230 | |
@@ -296,8 +299,9 @@ discard block |
||
| 296 | 299 | * @return string the (maybe) modified link |
| 297 | 300 | */ |
| 298 | 301 | public function modify_edit_post_link( $link, $id, $context ) { |
| 299 | - if ( ! $post = get_post( $id ) ) |
|
| 300 | - return $link; |
|
| 302 | + if ( ! $post = get_post( $id ) ) { |
|
| 303 | + return $link; |
|
| 304 | + } |
|
| 301 | 305 | |
| 302 | 306 | if ( $post->post_type == 'espresso_attendees' ) { |
| 303 | 307 | $query_args = array( |
@@ -337,7 +341,10 @@ discard block |
||
| 337 | 341 | <div id="posttype-extra-nav-menu-pages" class="posttypediv"> |
| 338 | 342 | <ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs"> |
| 339 | 343 | <li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 340 | - <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
| 344 | + <a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) { |
|
| 345 | + echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); |
|
| 346 | +} |
|
| 347 | +?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives"> |
|
| 341 | 348 | <?php _e( 'Event Archive Pages', 'event_espresso' ); ?> |
| 342 | 349 | </a> |
| 343 | 350 | </li> |
@@ -870,8 +877,9 @@ discard block |
||
| 870 | 877 | */ |
| 871 | 878 | public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) { |
| 872 | 879 | EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated. Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' ); |
| 873 | - if ( class_exists( 'EE_Register_Admin_Page' ) ) |
|
| 874 | - $config['page_path'] = $page_path; |
|
| 880 | + if ( class_exists( 'EE_Register_Admin_Page' ) ) { |
|
| 881 | + $config['page_path'] = $page_path; |
|
| 882 | + } |
|
| 875 | 883 | EE_Register_Admin_Page::register( $page_basename, $config ); |
| 876 | 884 | } |
| 877 | 885 | |