Make WordPress Core


Ignore:
Timestamp:
01/10/2015 11:43:43 PM (9 years ago)
Author:
wonderboymusic
Message:

In Walker:

  • Every subclass of Walker overrides $db_fields and makes it public
  • wp_list_comments() accesses ->max_pages on an instance of Walker, it must be public
  • $has_children was added as protected in 4.0. doesn't need BC

Make $db_fields and $max_pages public and remove magic methods.

See #30891.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-walker.php

    r29479 r31137  
    2626     *
    2727     * @since 2.1.0
    28      * @access protected
    2928     * @var array
    3029     */
    31     protected $db_fields;
     30    public $db_fields;
    3231
    3332    /**
     
    3534     *
    3635     * @since 2.7.0
    37      * @access protected
    3836     * @var int
    3937     */
    40     protected $max_pages = 1;
     38    public $max_pages = 1;
    4139
    4240    /**
     
    5048     */
    5149    protected $has_children;
    52 
    53     /**
    54      * Make private properties readable for backwards compatibility.
    55      *
    56      * @since 4.0.0
    57      * @access public
    58      *
    59      * @param string $name Property to get.
    60      * @return mixed Property.
    61      */
    62     public function __get( $name ) {
    63         return $this->$name;
    64     }
    65 
    66     /**
    67      * Make private properties settable for backwards compatibility.
    68      *
    69      * @since 4.0.0
    70      * @access public
    71      *
    72      * @param string $name  Property to set.
    73      * @param mixed  $value Property value.
    74      * @return mixed Newly-set property.
    75      */
    76     public function __set( $name, $value ) {
    77         return $this->$name = $value;
    78     }
    79 
    80     /**
    81      * Make private properties checkable for backwards compatibility.
    82      *
    83      * @since 4.0.0
    84      * @access public
    85      *
    86      * @param string $name Property to check if set.
    87      * @return bool Whether the property is set.
    88      */
    89     public function __isset( $name ) {
    90         return isset( $this->$name );
    91     }
    92 
    93     /**
    94      * Make private properties un-settable for backwards compatibility.
    95      *
    96      * @since 4.0.0
    97      * @access public
    98      *
    99      * @param string $name Property to unset.
    100      */
    101     public function __unset( $name ) {
    102         unset( $this->$name );
    103     }
    10450
    10551    /**
Note: See TracChangeset for help on using the changeset viewer.