Make WordPress Core

Changeset 28514


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

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

See #27881, #22234.

Location:
trunk/src
Files:
5 edited

Legend:

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

    r28500 r28514  
    2222 */
    2323class Walker_Category_Checklist extends Walker {
    24     var $tree_type = 'category';
    25     var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
     24    public $tree_type = 'category';
     25    public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
    2626
    2727    /**
  • 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 )
  • trunk/src/wp-includes/comment-template.php

    r28431 r28514  
    15591559     * @var string
    15601560     */
    1561     var $tree_type = 'comment';
     1561    public $tree_type = 'comment';
    15621562
    15631563    /**
     
    15691569     * @var array
    15701570     */
    1571     var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
     1571    public $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
    15721572
    15731573    /**
     
    15821582     * @param array $args Uses 'style' argument for type of HTML list.
    15831583     */
    1584     function start_lvl( &$output, $depth = 0, $args = array() ) {
     1584    public function start_lvl( &$output, $depth = 0, $args = array() ) {
    15851585        $GLOBALS['comment_depth'] = $depth + 1;
    15861586
     
    16091609     * @param array  $args   Will only append content if style argument value is 'ol' or 'ul'.
    16101610     */
    1611     function end_lvl( &$output, $depth = 0, $args = array() ) {
     1611    public function end_lvl( &$output, $depth = 0, $args = array() ) {
    16121612        $GLOBALS['comment_depth'] = $depth + 1;
    16131613
     
    16571657     * @return null Null on failure with no changes to parameters.
    16581658     */
    1659     function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
     1659    public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
    16601660
    16611661        if ( !$element )
     
    16911691     * @param array  $args    An array of arguments.
    16921692     */
    1693     function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
     1693    public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
    16941694        $depth++;
    16951695        $GLOBALS['comment_depth'] = $depth;
     
    17311731     * @param array  $args    An array of arguments.
    17321732     */
    1733     function end_el( &$output, $comment, $depth = 0, $args = array() ) {
     1733    public function end_el( &$output, $comment, $depth = 0, $args = array() ) {
    17341734        if ( !empty( $args['end-callback'] ) ) {
    17351735            ob_start();
  • trunk/src/wp-includes/nav-menu-template.php

    r28330 r28514  
    2222     * @var string
    2323     */
    24     var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
     24    public $tree_type = array( 'post_type', 'taxonomy', 'custom' );
    2525
    2626    /**
     
    3232     * @var array
    3333     */
    34     var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
     34    public $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' );
    3535
    3636    /**
     
    4545     * @param array  $args   An array of arguments. @see wp_nav_menu()
    4646     */
    47     function start_lvl( &$output, $depth = 0, $args = array() ) {
     47    public function start_lvl( &$output, $depth = 0, $args = array() ) {
    4848        $indent = str_repeat("\t", $depth);
    4949        $output .= "\n$indent<ul class=\"sub-menu\">\n";
     
    6161     * @param array  $args   An array of arguments. @see wp_nav_menu()
    6262     */
    63     function end_lvl( &$output, $depth = 0, $args = array() ) {
     63    public function end_lvl( &$output, $depth = 0, $args = array() ) {
    6464        $indent = str_repeat("\t", $depth);
    6565        $output .= "$indent</ul>\n";
     
    7979     * @param int    $id     Current item ID.
    8080     */
    81     function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
     81    public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
    8282        $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    8383
     
    187187     * @param array  $args   An array of arguments. @see wp_nav_menu()
    188188     */
    189     function end_el( &$output, $item, $depth = 0, $args = array() ) {
     189    public function end_el( &$output, $item, $depth = 0, $args = array() ) {
    190190        $output .= "</li>\n";
    191191    }
  • trunk/src/wp-includes/post-template.php

    r28498 r28514  
    12271227     * @var string
    12281228     */
    1229     var $tree_type = 'page';
     1229    public $tree_type = 'page';
    12301230
    12311231    /**
     
    12351235     * @var array
    12361236     */
    1237     var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
     1237    public $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
    12381238
    12391239    /**
     
    12451245     * @param array $args
    12461246     */
    1247     function start_lvl( &$output, $depth = 0, $args = array() ) {
     1247    public function start_lvl( &$output, $depth = 0, $args = array() ) {
    12481248        $indent = str_repeat("\t", $depth);
    12491249        $output .= "\n$indent<ul class='children'>\n";
     
    12581258     * @param array $args
    12591259     */
    1260     function end_lvl( &$output, $depth = 0, $args = array() ) {
     1260    public function end_lvl( &$output, $depth = 0, $args = array() ) {
    12611261        $indent = str_repeat("\t", $depth);
    12621262        $output .= "$indent</ul>\n";
     
    12731273     * @param array $args
    12741274     */
    1275     function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
     1275    public function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
    12761276        if ( $depth ) {
    12771277            $indent = str_repeat( "\t", $depth );
     
    13541354     * @param array $args
    13551355     */
    1356     function end_el( &$output, $page, $depth = 0, $args = array() ) {
     1356    public function end_el( &$output, $page, $depth = 0, $args = array() ) {
    13571357        $output .= "</li>\n";
    13581358    }
     
    13721372     * @var string
    13731373     */
    1374     var $tree_type = 'page';
     1374    public $tree_type = 'page';
    13751375
    13761376    /**
     
    13801380     * @var array
    13811381     */
    1382     var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
     1382    public $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
    13831383
    13841384    /**
     
    13921392     * @param int $id
    13931393     */
    1394     function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) {
     1394    public function start_el( &$output, $page, $depth = 0, $args = array(), $id = 0 ) {
    13951395        $pad = str_repeat('&nbsp;', $depth * 3);
    13961396
Note: See TracChangeset for help on using the changeset viewer.