WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/19/2014 05:59:07 AM (6 years ago)
Author:
wonderboymusic
Message:

Add missing access modifiers to methods/members in Walker and subclasses. Add a magic __get() method.

See #27881, #22234.

File:
1 edited

Legend:

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

    r28322 r28514  
    2020     * @access public
    2121     */
    22     var $tree_type;
     22    public $tree_type;
    2323
    2424    /**
     
    2929     * @access protected
    3030     */
    31     var $db_fields;
     31    protected $db_fields;
    3232
    3333    /**
     
    3838     * @access protected
    3939     */
    40     var $max_pages = 1;
     40    protected $max_pages = 1;
     41
     42    /**
     43     * Make private properties readable for backwards compatibility
     44     *
     45     * @since 4.0.0
     46     * @param string $name
     47     * @return mixed
     48     */
     49    public function __get( $name ) {
     50        return $this->$name;
     51    }
    4152
    4253    /**
     
    5364     * @param array  $args   An array of additional arguments.
    5465     */
    55     function start_lvl( &$output, $depth = 0, $args = array() ) {}
     66    public function start_lvl( &$output, $depth = 0, $args = array() ) {}
    5667
    5768    /**
     
    6879     * @param array  $args   An array of additional arguments.
    6980     */
    70     function end_lvl( &$output, $depth = 0, $args = array() ) {}
     81    public function end_lvl( &$output, $depth = 0, $args = array() ) {}
    7182
    7283    /**
     
    8596     * @param int    $current_object_id ID of the current item.
    8697     */
    87     function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {}
     98    public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {}
    8899
    89100    /**
     
    100111     * @param array  $args   An array of additional arguments.
    101112     */
    102     function end_el( &$output, $object, $depth = 0, $args = array() ) {}
     113    public function end_el( &$output, $object, $depth = 0, $args = array() ) {}
    103114
    104115    /**
     
    122133     * @return null Null on failure with no changes to parameters.
    123134     */
    124     function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
     135    public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
    125136
    126137        if ( !$element )
     
    179190     * @return string The hierarchical item output.
    180191     */
    181     function walk( $elements, $max_depth) {
     192    public function walk( $elements, $max_depth) {
    182193
    183194        $args = array_slice(func_get_args(), 2);
     
    267278     * @return string XHTML of the specified page of elements
    268279     */
    269     function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
     280    public function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
    270281
    271282        /* sanity check */
     
    374385    }
    375386
    376     function get_number_of_root_elements( $elements ){
     387    public function get_number_of_root_elements( $elements ){
    377388
    378389        $num = 0;
     
    387398
    388399    // Unset all the children for a given top level element.
    389     function unset_children( $e, &$children_elements ){
     400    public function unset_children( $e, &$children_elements ){
    390401
    391402        if ( !$e || !$children_elements )
Note: See TracChangeset for help on using the changeset viewer.