Make WordPress Core

Changeset 18857


Ignore:
Timestamp:
10/01/2011 05:59:46 PM (15 years ago)
Author:
nacin
Message:

Move all new WP_Screen properties to private. We should introduce getters. Correct legacy (and ideally read-only) properties to @access public. see #18785.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/screen.php

    r18854 r18857  
    401401         * @since 3.3.0
    402402         * @var string
    403          * @access private
     403         * @access public
    404404         */
    405405        public $action = '';
     
    411411         * @since 3.3.0
    412412         * @var string
    413          * @access private
     413         * @access public
    414414         */
    415415        public $base;
     
    420420         * @since 3.3.0
    421421         * @var string
    422          * @access private
     422         * @access public
    423423         */
    424424        public $id;
     
    429429         * @since 3.3.0
    430430         * @var bool
    431          * @access private
     431         * @access public
    432432         */
    433433        public $is_network;
     
    438438         * @since 3.3.0
    439439         * @var bool
    440          * @access private
     440         * @access public
    441441         */
    442442        public $is_user;
     
    449449         * @since 3.3.0
    450450         * @var string
    451          * @access private
     451         * @access public
    452452         */
    453453        public $parent_base;
     
    459459         * @since 3.3.0
    460460         * @var string
    461          * @access private
     461         * @access public
    462462         */
    463463        public $parent_file;
     
    469469         * @since 3.3.0
    470470         * @var string
    471          * @access private
     471         * @access public
    472472         */
    473473        public $post_type;
     
    478478         * @since 3.3.0
    479479         * @var string
    480          * @access private
     480         * @access public
    481481         */
    482482        public $taxonomy;
     
    489489         * @access private
    490490         */
    491         public $help_tabs = array();
     491        private $_help_tabs = array();
    492492
    493493        /**
     
    498498         * @access private
    499499         */
    500         public $help_sidebar = '';
     500        private $_help_sidebar = '';
    501501
    502502        /**
     
    507507         * @access private
    508508         */
    509         public $options = array();
     509        private $_options = array();
    510510
    511511
     
    622622         */
    623623        public function add_option( $option, $args = array() ) {
    624                 $this->options[ $option ] = $args;
     624                $this->_options[ $option ] = $args;
    625625        }
    626626
     
    655655                        $args['id'] = sanitize_html_class( $args['title'] );
    656656
    657                 $this->help_tabs[] = $args;
     657                $this->_help_tabs[] = $args;
    658658        }
    659659
     
    667667         */
    668668        public function add_help_sidebar( $content ) {
    669                 $this->help_sidebar = $content;
     669                $this->_help_sidebar = $content;
    670670        }
    671671
     
    708708                        <div id="contextual-help-wrap" class="hidden">
    709709                                <ul class="contextual-help-tabs">
    710                                         <?php foreach ( $this->help_tabs as $i => $tab ):
     710                                        <?php foreach ( $this->_help_tabs as $i => $tab ):
    711711                                                $link_id  = "tab-link-{$tab['id']}";
    712712                                                $panel_id = "tab-panel-{$tab['id']}";
     
    723723
    724724                                <div class="contextual-help-sidebar">
    725                                         <?php echo $this->help_sidebar; ?>
     725                                        <?php echo $this->_help_sidebar; ?>
    726726                                </div>
    727727
    728728                                <div class="contextual-help-tabs-wrap">
    729                                         <?php foreach ( $this->help_tabs as $i => $tab ):
     729                                        <?php foreach ( $this->_help_tabs as $i => $tab ):
    730730                                                $panel_id = "tab-panel-{$tab['id']}";
    731731                                                $classes  = ( $i == 0 ) ? 'active' : '';
     
    764764
    765765                // Check if there are per-page options.
    766                 $show_screen = $show_screen || isset( $this->options['per_page'] );
     766                $show_screen = $show_screen || isset( $this->_options['per_page'] );
    767767
    768768                $this->_screen_settings = apply_filters( 'screen_settings', '', $this );
     
    778778                        $show_screen = true;
    779779
    780                 if ( ! empty( $this->options ) )
     780                if ( ! empty( $this->_options ) )
    781781                        $show_screen = true;
    782782
     
    849849                        add_screen_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
    850850
    851                 if ( ! isset( $this->options['layout_columns'] ) ) {
     851                if ( ! isset( $this->_options['layout_columns'] ) ) {
    852852                        $screen_layout_columns = 0;
    853853                        return;
     
    855855
    856856                $screen_layout_columns = get_user_option("screen_layout_$this->id");
    857                 $num = $this->options['layout_columns']['max'];
     857                $num = $this->_options['layout_columns']['max'];
    858858
    859859                if ( ! $screen_layout_columns ) {
    860                         if ( isset( $this->options['layout_columns']['default'] ) )
    861                                 $screen_layout_columns = $this->options['layout_columns']['default'];
     860                        if ( isset( $this->_options['layout_columns']['default'] ) )
     861                                $screen_layout_columns = $this->_options['layout_columns']['default'];
    862862                        else
    863863                                $screen_layout_columns = 'auto';
     
    887887
    888888        function render_per_page_options() {
    889                 if ( ! isset( $this->options['per_page'] ) )
     889                if ( ! isset( $this->_options['per_page'] ) )
    890890                        return;
    891891
    892                 $per_page_label = $this->options['per_page']['label'];
    893 
    894                 if ( empty( $this->options['per_page']['option'] ) ) {
     892                $per_page_label = $this->_options['per_page']['label'];
     893
     894                if ( empty( $this->_options['per_page']['option'] ) ) {
    895895                        $option = str_replace( '-', '_', "{$this->id}_per_page" );
    896896                } else {
    897                         $option = $this->options['per_page']['option'];
     897                        $option = $this->_options['per_page']['option'];
    898898                }
    899899
    900900                $per_page = (int) get_user_option( $option );
    901901                if ( empty( $per_page ) || $per_page < 1 ) {
    902                         if ( isset($this->options['per_page']['default']) )
    903                                 $per_page = $this->options['per_page']['default'];
     902                        if ( isset($this->_options['per_page']['default']) )
     903                                $per_page = $this->_options['per_page']['default'];
    904904                        else
    905905                                $per_page = 20;
Note: See TracChangeset for help on using the changeset viewer.