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

See #27881, #22234.


git-svn-id: https://develop.svn.wordpress.org/trunk@28514 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-05-19 05:59:07 +00:00
parent f297dcba9a
commit f716ff94e4
5 changed files with 47 additions and 36 deletions

View File

@@ -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;