本文整理汇总了PHP中WP_Screen::_old_compat_help方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Screen::_old_compat_help方法的具体用法?PHP WP_Screen::_old_compat_help怎么用?PHP WP_Screen::_old_compat_help使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Screen
的用法示例。
在下文中一共展示了WP_Screen::_old_compat_help方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_screen_meta
/**
* 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
//.........这里部分代码省略.........
示例2: render_screen_meta
/**
* 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.
//.........这里部分代码省略.........
示例3: render_screen_meta
/**
* 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.
//.........这里部分代码省略.........
示例4: render_screen_meta
/**
* 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
//.........这里部分代码省略.........