/** * Render the screen's help section. * * This will trigger the deprecated filters for backwards compatibility. * * @since 3.3.0 */ public function render_screen_meta() { /** * Filter the legacy contextual help list. * * @since 2.7.0 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or * get_current_screen()->remove_help_tab() instead. * * @param array $old_compat_help Old contextual help. * @param WP_Screen $this Current WP_Screen instance. */ self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; /** * Filter the legacy contextual help text. * * @since 2.7.0 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or * get_current_screen()->remove_help_tab() instead. * * @param string $old_help Help text that appears on the screen. * @param string $screen_id Screen ID. * @param WP_Screen $this Current WP_Screen instance. * */ $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); // Default help only if there is no old-style block of text and no new-style help tabs. if (empty($old_help) && !$this->get_help_tabs()) { /** * Filter the default legacy contextual help text. * * @since 2.8.0 * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or * get_current_screen()->remove_help_tab() instead. * * @param string $old_help_default Default contextual help text. */ $default_help = apply_filters('default_contextual_help', ''); if ($default_help) { $old_help = '<p>' . $default_help . '</p>'; } } if ($old_help) { $this->add_help_tab(array('id' => 'old-contextual-help', 'title' => __('Overview'), 'content' => $old_help)); } $help_sidebar = $this->get_help_sidebar(); $help_class = 'hidden'; if (!$help_sidebar) { $help_class .= ' no-sidebar'; } // Time to render! ?> <div id="screen-meta" class="metabox-prefs"> <div id="contextual-help-wrap" class="<?php echo esc_attr($help_class); ?> " tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?> "> <div id="contextual-help-back"></div> <div id="contextual-help-columns"> <div class="contextual-help-tabs"> <ul> <?php $class = ' class="active"'; foreach ($this->get_help_tabs() as $tab) { $link_id = "tab-link-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}"; ?> <li id="<?php echo esc_attr($link_id); ?> "<?php echo $class; ?> > <a href="<?php echo esc_url("#{$panel_id}"); ?> " aria-controls="<?php echo esc_attr($panel_id); ?> "> <?php echo esc_html($tab['title']); ?> </a> </li> <?php $class = ''; } ?> </ul> </div> <?php if ($help_sidebar) { ?> <div class="contextual-help-sidebar"> <?php echo $help_sidebar; ?> </div> <?php } ?> <div class="contextual-help-tabs-wrap"> <?php $classes = 'help-tab-content active'; foreach ($this->get_help_tabs() as $tab) { $panel_id = "tab-panel-{$tab['id']}"; ?> <div id="<?php echo esc_attr($panel_id); ?> " class="<?php echo $classes; ?> "> <?php // Print tab content. echo $tab['content']; // If it exists, fire tab callback. if (!empty($tab['callback'])) { call_user_func_array($tab['callback'], array($this, $tab)); } ?> </div> <?php $classes = 'help-tab-content'; } ?> </div> </div> </div> <?php // Setup layout columns /** * Filter the array of screen layout columns. * * This hook provides back-compat for plugins using the back-compat * filter instead of add_screen_option(). * * @since 2.8.0 * * @param array $empty_columns Empty array. * @param string $screen_id Screen ID. * @param WP_Screen $this Current WP_Screen instance. */ $columns = apply_filters('screen_layout_columns', array(), $this->id, $this); if (!empty($columns) && isset($columns[$this->id])) { $this->add_option('layout_columns', array('max' => $columns[$this->id])); } if ($this->get_option('layout_columns')) { $this->columns = (int) get_user_option("screen_layout_{$this->id}"); if (!$this->columns && $this->get_option('layout_columns', 'default')) { $this->columns = $this->get_option('layout_columns', 'default'); } } $GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat. // Add screen options if ($this->show_screen_options()) { $this->render_screen_options(); } ?> </div> <?php if (!$this->get_help_tabs() && !$this->show_screen_options()) { return; } ?> <div id="screen-meta-links"> <?php if ($this->get_help_tabs()) { ?> <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e('Help'); ?> </a> </div> <?php } if ($this->show_screen_options()) { ?> <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e('Screen Options'); ?> </a> </div> <?php } ?> </div> <?php }
/** * Render the screen's help section. * * This will trigger the deprecated filters for backwards compatibility. * * @since 3.3.0 */ public function render_screen_meta() { // Call old contextual_help_list filter. self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); // Default help only if there is no old-style block of text and no new-style help tabs. if (empty($old_help) && !$this->get_help_tabs()) { $default_help = apply_filters('default_contextual_help', ''); if ($default_help) { $old_help = '<p>' . $default_help . '</p>'; } } if ($old_help) { $this->add_help_tab(array('id' => 'old-contextual-help', 'title' => __('Overview'), 'content' => $old_help)); } $help_sidebar = $this->get_help_sidebar(); $help_class = 'hidden'; if (!$help_sidebar) { $help_class .= ' no-sidebar'; } // Time to render! ?> <div id="screen-meta" class="metabox-prefs"> <div id="contextual-help-wrap" class="<?php echo esc_attr($help_class); ?> "> <div id="contextual-help-back"></div> <div id="contextual-help-columns"> <div class="contextual-help-tabs"> <ul> <?php $class = ' class="active"'; foreach ($this->get_help_tabs() as $tab) { $link_id = "tab-link-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}"; ?> <li id="<?php echo esc_attr($link_id); ?> "<?php echo $class; ?> > <a href="<?php echo esc_url("#{$panel_id}"); ?> "> <?php echo esc_html($tab['title']); ?> </a> </li> <?php $class = ''; } ?> </ul> </div> <?php if ($help_sidebar) { ?> <div class="contextual-help-sidebar"> <?php echo $help_sidebar; ?> </div> <?php } ?> <div class="contextual-help-tabs-wrap"> <?php $classes = 'help-tab-content active'; foreach ($this->get_help_tabs() as $tab) { $panel_id = "tab-panel-{$tab['id']}"; ?> <div id="<?php echo esc_attr($panel_id); ?> " class="<?php echo $classes; ?> "> <?php // Print tab content. echo $tab['content']; // If it exists, fire tab callback. if (!empty($tab['callback'])) { call_user_func_array($tab['callback'], array($this, $tab)); } ?> </div> <?php $classes = 'help-tab-content'; } ?> </div> </div> </div> <?php // Setup layout columns // Back compat for plugins using the filter instead of add_screen_option() $columns = apply_filters('screen_layout_columns', array(), $this->id, $this); if (!empty($columns) && isset($columns[$this->id])) { $this->add_option('layout_columns', array('max' => $columns[$this->id])); } if ($this->get_option('layout_columns')) { $this->columns = (int) get_user_option("screen_layout_{$this->id}"); if (!$this->columns && $this->get_option('layout_columns', 'default')) { $this->columns = $this->get_option('layout_columns', 'default'); } } $GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat. // Add screen options if ($this->show_screen_options()) { $this->render_screen_options(); } ?> </div> <?php if (!$this->get_help_tabs() && !$this->show_screen_options()) { return; } ?> <div id="screen-meta-links"> <?php if ($this->get_help_tabs()) { ?> <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings"><?php _e('Help'); ?> </a> </div> <?php } if ($this->show_screen_options()) { ?> <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#screen-options-wrap" id="show-settings-link" class="show-settings"><?php _e('Screen Options'); ?> </a> </div> <?php } ?> </div> <?php }
/** * Render the screen's help section. * * This will trigger the deprecated filters for backwards compatibility. * * @since 3.3.0 */ public function render_screen_meta() { // Call old contextual_help_list filter. self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); // Default help only if there is no old-style block of text and no new-style help tabs. if (empty($old_help) && empty($this->_help_tabs)) { $default_help = apply_filters('default_contextual_help', ''); if ($default_help) { $old_help = '<p>' . $default_help . '</p>'; } } if ($old_help) { $this->add_help_tab(array('id' => 'old-contextual-help', 'title' => __('Overview'), 'content' => $old_help)); } $has_sidebar = !empty($this->_help_sidebar); $help_class = 'hidden'; if (!$has_sidebar) { $help_class .= ' no-sidebar'; } // Time to render! ?> <div id="screen-meta" class="metabox-prefs"> <div id="contextual-help-wrap" class="<?php echo esc_attr($help_class); ?> "> <div id="contextual-help-back"></div> <div id="contextual-help-columns"> <div class="contextual-help-tabs"> <ul> <?php foreach ($this->_help_tabs as $i => $tab) { $link_id = "tab-link-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}"; $classes = $i == 0 ? 'active' : ''; ?> <li id="<?php echo esc_attr($link_id); ?> " class="<?php echo esc_attr($classes); ?> "> <a href="<?php echo esc_url("#{$panel_id}"); ?> "> <?php echo esc_html($tab['title']); ?> </a> </li> <?php } ?> </ul> </div> <?php if ($has_sidebar) { ?> <div class="contextual-help-sidebar"> <?php echo $this->_help_sidebar; ?> </div> <?php } ?> <div class="contextual-help-tabs-wrap"> <?php foreach ($this->_help_tabs as $i => $tab) { $panel_id = "tab-panel-{$tab['id']}"; $classes = $i == 0 ? 'active' : ''; $classes .= ' help-tab-content'; ?> <div id="<?php echo esc_attr($panel_id); ?> " class="<?php echo esc_attr($classes); ?> "> <?php // Print tab content. echo $tab['content']; // If it exists, fire tab callback. if (!empty($tab['callback'])) { call_user_func_array($tab['callback'], array($this, $tab)); } ?> </div> <?php } ?> </div> </div> </div> <?php // Add screen options if ($this->show_screen_options()) { $this->render_screen_options(); } ?> </div> <?php if (!$this->_help_tabs && !$this->show_screen_options()) { return; } ?> <div id="screen-meta-links"> <?php if ($this->_help_tabs) { ?> <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings"><?php _e('Help'); ?> </a> </div> <?php } if ($this->show_screen_options()) { ?> <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#screen-options-wrap" id="show-settings-link" class="show-settings"><?php _e('Screen Options'); ?> </a> </div> <?php } ?> </div> <?php }
/** * Render the screen's help section. * * This will trigger the deprecated filters for backwards compatibility. * * @since 3.3.0 */ public function render_screen_meta() { // Call old contextual_help_list filter. self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); // Default help only if there is no old-style block of text and no new-style help tabs. if (empty($old_help) && empty($this->_help_tabs)) { $default_help = __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>'); $default_help .= '<br />'; $default_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>'); $old_help = '<p>' . apply_filters('default_contextual_help', $default_help) . '</p>'; } if ($old_help) { $this->add_help_tab(array('id' => 'contextual-help', 'title' => __('Screen Info'), 'content' => $old_help)); } // Time to render! ?> <div id="screen-meta" class="metabox-prefs"> <div id="contextual-help-wrap" class="hidden"> <div class="contextual-help-tabs"> <ul> <?php foreach ($this->_help_tabs as $i => $tab) { $link_id = "tab-link-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}"; $classes = $i == 0 ? 'active' : ''; ?> <li id="<?php echo esc_attr($link_id); ?> " class="<?php echo esc_attr($classes); ?> "> <a href="<?php echo esc_url("#{$panel_id}"); ?> "> <?php echo esc_html($tab['title']); ?> </a> </li> <?php } ?> </ul> </div> <?php if (!empty($this->_help_sidebar)) { ?> <div class="contextual-help-sidebar"> <?php echo self::$this->_help_sidebar; ?> </div> <?php } ?> <div class="contextual-help-tabs-wrap"> <?php foreach ($this->_help_tabs as $i => $tab) { $panel_id = "tab-panel-{$tab['id']}"; $classes = $i == 0 ? 'active' : ''; $classes .= ' help-tab-content'; ?> <div id="<?php echo esc_attr($panel_id); ?> " class="<?php echo esc_attr($classes); ?> "> <?php // Print tab content. echo $tab['content']; // If it exists, fire tab callback. if (!empty($tab['callback'])) { call_user_func_array($tab['callback'], array($this, $tab)); } ?> </div> <?php } ?> </div> </div> <?php // Add screen options if ($this->show_screen_options()) { $this->render_screen_options(); } ?> </div> <div id="screen-meta-links"> <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings"><?php _e('Help'); ?> </a> </div> <?php if ($this->show_screen_options()) { ?> <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> <a href="#screen-options-wrap" id="show-settings-link" class="show-settings"><?php _e('Screen Options'); ?> </a> </div> <?php } ?> </div> <?php }