diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 0a6b9f1eb1..92adcd19eb 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -21,8 +21,8 @@ * @since 2.5.1 */ class Walker_Category_Checklist extends Walker { - var $tree_type = 'category'; - var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this + public $tree_type = 'category'; + public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this /** * Starts the list before the elements are added. diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php index 6373db57a0..7ee5faf1fa 100644 --- a/wp-includes/class-wp-walker.php +++ b/wp-includes/class-wp-walker.php @@ -19,7 +19,7 @@ class Walker { * @var string * @access public */ - var $tree_type; + public $tree_type; /** * DB fields to use. @@ -28,7 +28,7 @@ class Walker { * @var array * @access protected */ - var $db_fields; + protected $db_fields; /** * Max number of pages walked by the paged walker @@ -37,7 +37,18 @@ class Walker { * @var int * @access protected */ - var $max_pages = 1; + protected $max_pages = 1; + + /** + * Make private properties readable for backwards compatibility + * + * @since 4.0.0 + * @param string $name + * @return mixed + */ + public function __get( $name ) { + return $this->$name; + } /** * Starts the list before the elements are added. @@ -52,7 +63,7 @@ class Walker { * @param int $depth Depth of the item. * @param array $args An array of additional arguments. */ - function start_lvl( &$output, $depth = 0, $args = array() ) {} + public function start_lvl( &$output, $depth = 0, $args = array() ) {} /** * Ends the list of after the elements are added. @@ -67,7 +78,7 @@ class Walker { * @param int $depth Depth of the item. * @param array $args An array of additional arguments. */ - function end_lvl( &$output, $depth = 0, $args = array() ) {} + public function end_lvl( &$output, $depth = 0, $args = array() ) {} /** * Start the element output. @@ -84,7 +95,7 @@ class Walker { * @param array $args An array of additional arguments. * @param int $current_object_id ID of the current item. */ - function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {} + public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {} /** * Ends the element output, if needed. @@ -99,7 +110,7 @@ class Walker { * @param int $depth Depth of the item. * @param array $args An array of additional arguments. */ - function end_el( &$output, $object, $depth = 0, $args = array() ) {} + public function end_el( &$output, $object, $depth = 0, $args = array() ) {} /** * Traverse elements to create list from elements. @@ -121,7 +132,7 @@ class Walker { * @param string $output Passed by reference. Used to append additional content. * @return null Null on failure with no changes to parameters. */ - function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { + public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { if ( !$element ) return; @@ -178,7 +189,7 @@ class Walker { * @param int $max_depth The maximum hierarchical depth. * @return string The hierarchical item output. */ - function walk( $elements, $max_depth) { + public function walk( $elements, $max_depth) { $args = array_slice(func_get_args(), 2); $output = ''; @@ -266,7 +277,7 @@ class Walker { * @param int $page_num The specific page number, beginning with 1. * @return string XHTML of the specified page of elements */ - function paged_walk( $elements, $max_depth, $page_num, $per_page ) { + public function paged_walk( $elements, $max_depth, $page_num, $per_page ) { /* sanity check */ if ( empty($elements) || $max_depth < -1 ) @@ -373,7 +384,7 @@ class Walker { return $output; } - function get_number_of_root_elements( $elements ){ + public function get_number_of_root_elements( $elements ){ $num = 0; $parent_field = $this->db_fields['parent']; @@ -386,7 +397,7 @@ class Walker { } // Unset all the children for a given top level element. - function unset_children( $e, &$children_elements ){ + public function unset_children( $e, &$children_elements ){ if ( !$e || !$children_elements ) return; diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index fb519634e3..18f3fdff4a 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -1558,7 +1558,7 @@ class Walker_Comment extends Walker { * @since 2.7.0 * @var string */ - var $tree_type = 'comment'; + public $tree_type = 'comment'; /** * DB fields to use. @@ -1568,7 +1568,7 @@ class Walker_Comment extends Walker { * @since 2.7.0 * @var array */ - var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); + public $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID'); /** * Start the list before the elements are added. @@ -1581,7 +1581,7 @@ class Walker_Comment extends Walker { * @param int $depth Depth of comment. * @param array $args Uses 'style' argument for type of HTML list. */ - function start_lvl( &$output, $depth = 0, $args = array() ) { + public function start_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { @@ -1608,7 +1608,7 @@ class Walker_Comment extends Walker { * @param int $depth Depth of comment. * @param array $args Will only append content if style argument value is 'ol' or 'ul'. */ - function end_lvl( &$output, $depth = 0, $args = array() ) { + public function end_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { @@ -1656,7 +1656,7 @@ class Walker_Comment extends Walker { * @param string $output Passed by reference. Used to append additional content. * @return null Null on failure with no changes to parameters. */ - function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { + public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { if ( !$element ) return; @@ -1690,7 +1690,7 @@ class Walker_Comment extends Walker { * @param int $depth Depth of comment in reference to parents. * @param array $args An array of arguments. */ - function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) { + public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) { $depth++; $GLOBALS['comment_depth'] = $depth; $GLOBALS['comment'] = $comment; @@ -1730,7 +1730,7 @@ class Walker_Comment extends Walker { * @param int $depth Depth of comment. * @param array $args An array of arguments. */ - function end_el( &$output, $comment, $depth = 0, $args = array() ) { + public function end_el( &$output, $comment, $depth = 0, $args = array() ) { if ( !empty( $args['end-callback'] ) ) { ob_start(); call_user_func( $args['end-callback'], $comment, $args, $depth ); diff --git a/wp-includes/nav-menu-template.php b/wp-includes/nav-menu-template.php index 3778142470..7956bc6c52 100644 --- a/wp-includes/nav-menu-template.php +++ b/wp-includes/nav-menu-template.php @@ -21,7 +21,7 @@ class Walker_Nav_Menu extends Walker { * @since 3.0.0 * @var string */ - var $tree_type = array( 'post_type', 'taxonomy', 'custom' ); + public $tree_type = array( 'post_type', 'taxonomy', 'custom' ); /** * Database fields to use. @@ -31,7 +31,7 @@ class Walker_Nav_Menu extends Walker { * @todo Decouple this. * @var array */ - var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); + public $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); /** * Starts the list before the elements are added. @@ -44,7 +44,7 @@ class Walker_Nav_Menu extends Walker { * @param int $depth Depth of menu item. Used for padding. * @param array $args An array of arguments. @see wp_nav_menu() */ - function start_lvl( &$output, $depth = 0, $args = array() ) { + public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent
\n"; } @@ -78,7 +78,7 @@ class Walker_Nav_Menu extends Walker { * @param array $args An array of arguments. @see wp_nav_menu() * @param int $id Current item ID. */ - function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { + public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; @@ -186,7 +186,7 @@ class Walker_Nav_Menu extends Walker { * @param int $depth Depth of page. Not Used. * @param array $args An array of arguments. @see wp_nav_menu() */ - function end_el( &$output, $item, $depth = 0, $args = array() ) { + public function end_el( &$output, $item, $depth = 0, $args = array() ) { $output .= "\n"; } diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 4f85a6e7b7..bec04075e6 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1226,7 +1226,7 @@ class Walker_Page extends Walker { * @since 2.1.0 * @var string */ - var $tree_type = 'page'; + public $tree_type = 'page'; /** * @see Walker::$db_fields @@ -1234,7 +1234,7 @@ class Walker_Page extends Walker { * @todo Decouple this. * @var array */ - var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); + public $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); /** * @see Walker::start_lvl() @@ -1244,7 +1244,7 @@ class Walker_Page extends Walker { * @param int $depth Depth of page. Used for padding. * @param array $args */ - function start_lvl( &$output, $depth = 0, $args = array() ) { + public function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent