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

git-svn-id: http://svn.automattic.com/wordpress/trunk@18857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-10-01 17:59:46 +00:00
parent 8e8847e303
commit 5522818ed3
1 changed files with 30 additions and 30 deletions

View File

@ -400,7 +400,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $action = ''; public $action = '';
@ -410,7 +410,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $base; public $base;
@ -419,7 +419,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $id; public $id;
@ -428,7 +428,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var bool * @var bool
* @access private * @access public
*/ */
public $is_network; public $is_network;
@ -437,7 +437,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var bool * @var bool
* @access private * @access public
*/ */
public $is_user; public $is_user;
@ -448,7 +448,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $parent_base; public $parent_base;
@ -458,7 +458,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $parent_file; public $parent_file;
@ -468,7 +468,7 @@ final class WP_Screen {
* *
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $post_type; public $post_type;
@ -477,7 +477,7 @@ final class WP_Screen {
* The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'. * The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.
* @since 3.3.0 * @since 3.3.0
* @var string * @var string
* @access private * @access public
*/ */
public $taxonomy; public $taxonomy;
@ -488,7 +488,7 @@ final class WP_Screen {
* @var array * @var array
* @access private * @access private
*/ */
public $help_tabs = array(); private $_help_tabs = array();
/** /**
* The help sidebar data associated with the screen, if any. * The help sidebar data associated with the screen, if any.
@ -497,7 +497,7 @@ final class WP_Screen {
* @var string * @var string
* @access private * @access private
*/ */
public $help_sidebar = ''; private $_help_sidebar = '';
/** /**
* The screen options associated with the screen, if any. * The screen options associated with the screen, if any.
@ -506,7 +506,7 @@ final class WP_Screen {
* @var array * @var array
* @access private * @access private
*/ */
public $options = array(); private $_options = array();
/** /**
@ -621,7 +621,7 @@ final class WP_Screen {
* @param array $args Associative array of arguments particular to the given $option. * @param array $args Associative array of arguments particular to the given $option.
*/ */
public function add_option( $option, $args = array() ) { public function add_option( $option, $args = array() ) {
$this->options[ $option ] = $args; $this->_options[ $option ] = $args;
} }
/** /**
@ -654,7 +654,7 @@ final class WP_Screen {
if ( ! $args['id'] ) if ( ! $args['id'] )
$args['id'] = sanitize_html_class( $args['title'] ); $args['id'] = sanitize_html_class( $args['title'] );
$this->help_tabs[] = $args; $this->_help_tabs[] = $args;
} }
/** /**
@ -666,7 +666,7 @@ final class WP_Screen {
* @param string $content Sidebar content in plain text or HTML. * @param string $content Sidebar content in plain text or HTML.
*/ */
public function add_help_sidebar( $content ) { public function add_help_sidebar( $content ) {
$this->help_sidebar = $content; $this->_help_sidebar = $content;
} }
/** /**
@ -707,7 +707,7 @@ final class WP_Screen {
<div id="screen-meta" class='metabox-prefs'> <div id="screen-meta" class='metabox-prefs'>
<div id="contextual-help-wrap" class="hidden"> <div id="contextual-help-wrap" class="hidden">
<ul class="contextual-help-tabs"> <ul class="contextual-help-tabs">
<?php foreach ( $this->help_tabs as $i => $tab ): <?php foreach ( $this->_help_tabs as $i => $tab ):
$link_id = "tab-link-{$tab['id']}"; $link_id = "tab-link-{$tab['id']}";
$panel_id = "tab-panel-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}";
$classes = ( $i == 0 ) ? 'active' : ''; $classes = ( $i == 0 ) ? 'active' : '';
@ -722,11 +722,11 @@ final class WP_Screen {
</ul> </ul>
<div class="contextual-help-sidebar"> <div class="contextual-help-sidebar">
<?php echo $this->help_sidebar; ?> <?php echo $this->_help_sidebar; ?>
</div> </div>
<div class="contextual-help-tabs-wrap"> <div class="contextual-help-tabs-wrap">
<?php foreach ( $this->help_tabs as $i => $tab ): <?php foreach ( $this->_help_tabs as $i => $tab ):
$panel_id = "tab-panel-{$tab['id']}"; $panel_id = "tab-panel-{$tab['id']}";
$classes = ( $i == 0 ) ? 'active' : ''; $classes = ( $i == 0 ) ? 'active' : '';
$classes .= ' help-tab-content'; $classes .= ' help-tab-content';
@ -763,7 +763,7 @@ final class WP_Screen {
$show_screen = true; $show_screen = true;
// Check if there are per-page options. // Check if there are per-page options.
$show_screen = $show_screen || isset( $this->options['per_page'] ); $show_screen = $show_screen || isset( $this->_options['per_page'] );
$this->_screen_settings = apply_filters( 'screen_settings', '', $this ); $this->_screen_settings = apply_filters( 'screen_settings', '', $this );
@ -777,7 +777,7 @@ final class WP_Screen {
if ( ! empty( $this->_screen_settings ) ) if ( ! empty( $this->_screen_settings ) )
$show_screen = true; $show_screen = true;
if ( ! empty( $this->options ) ) if ( ! empty( $this->_options ) )
$show_screen = true; $show_screen = true;
$this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this );
@ -848,17 +848,17 @@ final class WP_Screen {
if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) )
add_screen_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); add_screen_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
if ( ! isset( $this->options['layout_columns'] ) ) { if ( ! isset( $this->_options['layout_columns'] ) ) {
$screen_layout_columns = 0; $screen_layout_columns = 0;
return; return;
} }
$screen_layout_columns = get_user_option("screen_layout_$this->id"); $screen_layout_columns = get_user_option("screen_layout_$this->id");
$num = $this->options['layout_columns']['max']; $num = $this->_options['layout_columns']['max'];
if ( ! $screen_layout_columns ) { if ( ! $screen_layout_columns ) {
if ( isset( $this->options['layout_columns']['default'] ) ) if ( isset( $this->_options['layout_columns']['default'] ) )
$screen_layout_columns = $this->options['layout_columns']['default']; $screen_layout_columns = $this->_options['layout_columns']['default'];
else else
$screen_layout_columns = 'auto'; $screen_layout_columns = 'auto';
} }
@ -886,21 +886,21 @@ final class WP_Screen {
} }
function render_per_page_options() { function render_per_page_options() {
if ( ! isset( $this->options['per_page'] ) ) if ( ! isset( $this->_options['per_page'] ) )
return; return;
$per_page_label = $this->options['per_page']['label']; $per_page_label = $this->_options['per_page']['label'];
if ( empty( $this->options['per_page']['option'] ) ) { if ( empty( $this->_options['per_page']['option'] ) ) {
$option = str_replace( '-', '_', "{$this->id}_per_page" ); $option = str_replace( '-', '_', "{$this->id}_per_page" );
} else { } else {
$option = $this->options['per_page']['option']; $option = $this->_options['per_page']['option'];
} }
$per_page = (int) get_user_option( $option ); $per_page = (int) get_user_option( $option );
if ( empty( $per_page ) || $per_page < 1 ) { if ( empty( $per_page ) || $per_page < 1 ) {
if ( isset($this->options['per_page']['default']) ) if ( isset($this->_options['per_page']['default']) )
$per_page = $this->options['per_page']['default']; $per_page = $this->_options['per_page']['default'];
else else
$per_page = 20; $per_page = 20;
} }