mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-18 04:25:07 +00:00
WP Screen: after [34991], avoid unnecessary nesting levels and remove unused global import.
See #33646. Built from https://develop.svn.wordpress.org/trunk@35010 git-svn-id: http://core.svn.wordpress.org/trunk@34975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6ec8174ca1
commit
d021cb8bc0
@ -965,11 +965,8 @@ final class WP_Screen {
|
|||||||
* @param array $options {
|
* @param array $options {
|
||||||
* @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true.
|
* @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true.
|
||||||
* }
|
* }
|
||||||
* @global array $wp_meta_boxes
|
|
||||||
*/
|
*/
|
||||||
public function render_screen_options( $options = array() ) {
|
public function render_screen_options( $options = array() ) {
|
||||||
global $wp_meta_boxes;
|
|
||||||
|
|
||||||
$options = wp_parse_args( $options, array(
|
$options = wp_parse_args( $options, array(
|
||||||
'wrap' => true,
|
'wrap' => true,
|
||||||
) );
|
) );
|
||||||
@ -1003,32 +1000,38 @@ final class WP_Screen {
|
|||||||
* Render the meta boxes preferences.
|
* Render the meta boxes preferences.
|
||||||
*
|
*
|
||||||
* @since 4.4.0
|
* @since 4.4.0
|
||||||
|
*
|
||||||
|
* @global array $wp_meta_boxes
|
||||||
*/
|
*/
|
||||||
public function render_meta_boxes_preferences() {
|
public function render_meta_boxes_preferences() {
|
||||||
global $wp_meta_boxes;
|
global $wp_meta_boxes;
|
||||||
|
|
||||||
if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?>
|
if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) {
|
||||||
<fieldset class="metabox-prefs">
|
return;
|
||||||
<legend><?php _e( 'Boxes' ); ?></legend>
|
}
|
||||||
<?php
|
?>
|
||||||
meta_box_prefs( $this );
|
<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 ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) {
|
||||||
if ( isset( $_GET['welcome'] ) ) {
|
if ( isset( $_GET['welcome'] ) ) {
|
||||||
$welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
|
$welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
|
||||||
update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
|
update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
|
||||||
} else {
|
} else {
|
||||||
$welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
|
$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' ) )
|
if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
|
||||||
$welcome_checked = false;
|
$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";
|
|
||||||
}
|
}
|
||||||
?>
|
echo '<label for="wp_welcome_panel-hide">';
|
||||||
</fieldset>
|
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
|
||||||
<?php endif;
|
echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</fieldset>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1041,37 +1044,39 @@ final class WP_Screen {
|
|||||||
$columns = get_column_headers( $this );
|
$columns = get_column_headers( $this );
|
||||||
$hidden = get_hidden_columns( $this );
|
$hidden = get_hidden_columns( $this );
|
||||||
|
|
||||||
if ( $columns ) {
|
if ( ! $columns ) {
|
||||||
$legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' );
|
return;
|
||||||
?>
|
|
||||||
<fieldset class="metabox-prefs">
|
|
||||||
<legend><?php echo $legend; ?></legend>
|
|
||||||
<?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>';
|
|
||||||
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />';
|
|
||||||
echo "$title</label>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</fieldset>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' );
|
||||||
|
?>
|
||||||
|
<fieldset class="metabox-prefs">
|
||||||
|
<legend><?php echo $legend; ?></legend>
|
||||||
|
<?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>';
|
||||||
|
echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />';
|
||||||
|
echo "$title</label>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</fieldset>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-35009';
|
$wp_version = '4.4-alpha-35010';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user