Walker markup fixes from hailin. fixes #5844
git-svn-id: https://develop.svn.wordpress.org/trunk@6858 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8f31db9af4
commit
d50b16fba6
@ -409,44 +409,44 @@ class Walker {
|
|||||||
if ( !$element)
|
if ( !$element)
|
||||||
return $output;
|
return $output;
|
||||||
|
|
||||||
if ( $max_depth != 0 ) {
|
|
||||||
if ($depth >= $max_depth)
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
|
|
||||||
$id_field = $this->db_fields['id'];
|
$id_field = $this->db_fields['id'];
|
||||||
$parent_field = $this->db_fields['parent'];
|
$parent_field = $this->db_fields['parent'];
|
||||||
|
|
||||||
if ($depth > 0) {
|
|
||||||
//start the child delimiter
|
|
||||||
$cb_args = array_merge( array($output, $depth), $args);
|
|
||||||
$output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
|
|
||||||
}
|
|
||||||
|
|
||||||
//display this element
|
//display this element
|
||||||
$cb_args = array_merge( array($output, $element, $depth), $args);
|
$cb_args = array_merge( array($output, $element, $depth), $args);
|
||||||
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
|
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
|
||||||
|
|
||||||
for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
|
if ( $max_depth == 0 ||
|
||||||
|
($max_depth != 0 && $max_depth > $depth+1 )) { //whether to descend
|
||||||
|
|
||||||
|
for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) {
|
||||||
|
|
||||||
|
$child = $children_elements[$i];
|
||||||
|
if ( $child->$parent_field == $element->$id_field ) {
|
||||||
|
|
||||||
$child = $children_elements[$i];
|
if ( !isset($newlevel) ) {
|
||||||
if ( $child->$parent_field == $element->$id_field ) {
|
$newlevel = true;
|
||||||
|
//start the child delimiter
|
||||||
array_splice( $children_elements, $i, 1 );
|
$cb_args = array_merge( array($output, $depth), $args);
|
||||||
$output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
|
$output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
|
||||||
$i = -1;
|
}
|
||||||
|
|
||||||
|
array_splice( $children_elements, $i, 1 );
|
||||||
|
$output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
|
||||||
|
$i = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//end this element
|
if ( isset($newlevel) && $newlevel ){
|
||||||
$cb_args = array_merge( array($output, $element, $depth), $args);
|
|
||||||
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
|
|
||||||
|
|
||||||
if ($depth > 0) {
|
|
||||||
//end the child delimiter
|
//end the child delimiter
|
||||||
$cb_args = array_merge( array($output, $depth), $args);
|
$cb_args = array_merge( array($output, $depth), $args);
|
||||||
$output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
|
$output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//end this element
|
||||||
|
$cb_args = array_merge( array($output, $element, $depth), $args);
|
||||||
|
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user