Changeset 35010
- Timestamp:
- 10/10/2015 03:19:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-screen.php
r34991 r35010 966 966 * @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true. 967 967 * } 968 * @global array $wp_meta_boxes969 968 */ 970 969 public function render_screen_options( $options = array() ) { 971 global $wp_meta_boxes;972 973 970 $options = wp_parse_args( $options, array( 974 971 'wrap' => true, … … 1004 1001 * 1005 1002 * @since 4.4.0 1003 * 1004 * @global array $wp_meta_boxes 1006 1005 */ 1007 1006 public function render_meta_boxes_preferences() { 1008 1007 global $wp_meta_boxes; 1009 1008 1010 if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?> 1011 <fieldset class="metabox-prefs"> 1012 <legend><?php _e( 'Boxes' ); ?></legend> 1013 <?php 1014 meta_box_prefs( $this ); 1015 1016 if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { 1017 if ( isset( $_GET['welcome'] ) ) { 1018 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; 1019 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); 1020 } else { 1021 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); 1022 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) 1023 $welcome_checked = false; 1009 if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) { 1010 return; 1011 } 1012 ?> 1013 <fieldset class="metabox-prefs"> 1014 <legend><?php _e( 'Boxes' ); ?></legend> 1015 <?php 1016 meta_box_prefs( $this ); 1017 1018 if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { 1019 if ( isset( $_GET['welcome'] ) ) { 1020 $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; 1021 update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); 1022 } else { 1023 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); 1024 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) { 1025 $welcome_checked = false; 1024 1026 } 1025 echo '<label for="wp_welcome_panel-hide">';1026 echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';1027 echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";1028 1027 } 1029 ?> 1030 </fieldset> 1031 <?php endif; 1028 echo '<label for="wp_welcome_panel-hide">'; 1029 echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />'; 1030 echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; 1031 } 1032 ?> 1033 </fieldset> 1034 <?php 1032 1035 } 1033 1036 … … 1042 1045 $hidden = get_hidden_columns( $this ); 1043 1046 1044 if ( $columns ) { 1045 $legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' ); 1046 ?> 1047 <fieldset class="metabox-prefs"> 1048 <legend><?php echo $legend; ?></legend> 1049 <?php 1050 $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); 1051 1052 foreach ( $columns as $column => $title ) { 1053 // Can't hide these for they are special 1054 if ( in_array( $column, $special ) ) { 1055 continue; 1056 } 1057 1058 if ( empty( $title ) ) { 1059 continue; 1060 } 1061 1062 if ( 'comments' == $column ) { 1063 $title = __( 'Comments' ); 1064 } 1065 1066 $id = "$column-hide"; 1067 echo '<label>'; 1068 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />'; 1069 echo "$title</label>\n"; 1047 if ( ! $columns ) { 1048 return; 1049 } 1050 1051 $legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' ); 1052 ?> 1053 <fieldset class="metabox-prefs"> 1054 <legend><?php echo $legend; ?></legend> 1055 <?php 1056 $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); 1057 1058 foreach ( $columns as $column => $title ) { 1059 // Can't hide these for they are special 1060 if ( in_array( $column, $special ) ) { 1061 continue; 1070 1062 } 1071 ?> 1072 </fieldset> 1063 1064 if ( empty( $title ) ) { 1065 continue; 1066 } 1067 1068 if ( 'comments' == $column ) { 1069 $title = __( 'Comments' ); 1070 } 1071 1072 $id = "$column-hide"; 1073 echo '<label>'; 1074 echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />'; 1075 echo "$title</label>\n"; 1076 } 1077 ?> 1078 </fieldset> 1073 1079 <?php 1074 }1075 1080 } 1076 1081
Note: See TracChangeset
for help on using the changeset viewer.