Ticket #20506: 20506.3.diff
File 20506.3.diff, 5.6 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/dashboard.php
193 193 * @since 2.5.0 194 194 */ 195 195 function wp_dashboard() { 196 global $screen_layout_columns;197 198 196 $screen = get_current_screen(); 199 $class = 'columns-' . $screen_layout_columns;197 $class = 'columns-' . get_current_screen()->get_columns(); 200 198 201 199 ?> 202 200 <div id="dashboard-widgets" class="metabox-holder <?php echo $class; ?>"> -
wp-admin/includes/screen.php
566 566 * 567 567 * @param string $option Option ID. 568 568 * @param mixed $key Optional. Specific array key for when the option is an array. 569 * @param mixed $default Optional. The value to return if the option is not set. Default is null. 569 570 */ 570 public function get_option( $option, $key = false ) {571 public function get_option( $option, $key = false, $default = null ) { 571 572 if ( ! isset( $this->_options[ $option ] ) ) 572 return null;573 return $default; 573 574 if ( $key ) { 574 575 if ( isset( $this->_options[ $option ][ $key ] ) ) 575 576 return $this->_options[ $option ][ $key ]; 576 return null;577 return $default; 577 578 } 578 579 return $this->_options[ $option ]; 579 580 } … … 665 666 public function get_help_sidebar() { 666 667 return $this->_help_sidebar; 667 668 } 668 669 669 670 /** 670 671 * Add a sidebar to the contextual help for the screen. 671 672 * Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help. … … 679 680 } 680 681 681 682 /** 683 * Gets the number of layout columns the user has selected. 684 * 685 * The layout_columns option controls the max number and default number of 686 * columns. This method returns the number of columns within that range selected 687 * by the user via Screen Options. If no selection has been made, the default 688 * provisioned in layout_columns is returned. 689 * 690 * @since 3.4.0 691 * 692 * @return int Number of columns to display. 693 */ 694 public function get_columns() { 695 return $this->get_option( 'user_num_columns' ); 696 } 697 698 /** 682 699 * Render the screen's help section. 683 700 * 684 701 * This will trigger the deprecated filters for backwards compatibility. … … 773 790 </div> 774 791 </div> 775 792 <?php 793 // Setup layout columns 794 795 // Back compat for plugins using the filter instead of add_screen_option() 796 $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); 797 798 if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) 799 $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); 800 801 global $screen_layout_columns; // Global for back-compat. 802 $screen_layout_columns = 0; 803 if ( $this->get_option( 'layout_columns' ) ) { 804 $screen_layout_columns = (int) get_user_option("screen_layout_$this->id"); 805 $num = $this->get_option( 'layout_columns', 'max' ); 806 807 if ( ! $screen_layout_columns ) { 808 if ( $this->get_option( 'layout_columns', 'default' ) ) 809 $screen_layout_columns = $this->get_option( 'layout_columns', 'default' ); 810 } 811 } 812 $this->add_option( 'user_num_columns', $screen_layout_columns ); 813 776 814 // Add screen options 777 815 if ( $this->show_screen_options() ) 778 816 $this->render_screen_options(); … … 907 945 * @since 3.3.0 908 946 */ 909 947 function render_screen_layout() { 910 global $screen_layout_columns; 911 912 // Back compat for plugins using the filter instead of add_screen_option() 913 $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); 914 915 if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) 916 $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); 917 918 if ( ! $this->get_option('layout_columns') ) { 919 $screen_layout_columns = 0; 948 if ( ! $this->get_option('layout_columns') ) 920 949 return; 921 }922 950 923 $screen_layout_columns = get_user_option("screen_layout_$this->id");951 $screen_layout_columns = $this->get_columns(); 924 952 $num = $this->get_option( 'layout_columns', 'max' ); 925 953 926 if ( ! $screen_layout_columns || 'auto' == $screen_layout_columns ) {927 if ( $this->get_option( 'layout_columns', 'default' ) )928 $screen_layout_columns = $this->get_option( 'layout_columns', 'default' );929 }930 931 954 ?> 932 955 <h5 class="screen-layout"><?php _e('Screen Layout'); ?></h5> 933 956 <div class='columns-prefs'><?php -
wp-admin/edit-link-form.php
77 77 78 78 <div id="poststuff"> 79 79 80 <div id="post-body" class="metabox-holder columns-<?php echo 1 == $screen_layout_columns? '1' : '2'; ?>">80 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 81 81 <div id="post-body-content"> 82 82 <div id="namediv" class="stuffbox"> 83 83 <h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3> -
wp-admin/edit-form-advanced.php
277 277 278 278 <div id="poststuff"> 279 279 280 <div id="post-body" class="metabox-holder columns-<?php echo 1 == $screen_layout_columns? '1' : '2'; ?>">280 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> 281 281 <div id="post-body-content"> 282 282 <?php if ( post_type_supports($post_type, 'title') ) { ?> 283 283 <div id="titlediv">