Ticket #5844: 5844_walker_ul.diff
File 5844_walker_ul.diff, 2.5 KB (added by , 17 years ago) |
---|
-
C:/xampp/htdocs/wordpress_trunk/wp-includes/classes.php
409 409 if ( !$element) 410 410 return $output; 411 411 412 if ( $max_depth != 0 ) {413 if ($depth >= $max_depth)414 return $output;415 }416 417 412 $id_field = $this->db_fields['id']; 418 413 $parent_field = $this->db_fields['parent']; 419 414 420 if ($depth > 0) {421 //start the child delimiter422 $cb_args = array_merge( array($output, $depth), $args);423 $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);424 }425 426 415 //display this element 427 416 $cb_args = array_merge( array($output, $element, $depth), $args); 428 417 $output = call_user_func_array(array(&$this, 'start_el'), $cb_args); 429 418 430 for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) { 419 if ( $max_depth == 0 || 420 ($max_depth != 0 && $max_depth > $depth+1 )) { //whether to descend 421 422 for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) { 423 424 $child = $children_elements[$i]; 425 if ( $child->$parent_field == $element->$id_field ) { 431 426 432 $child = $children_elements[$i]; 433 if ( $child->$parent_field == $element->$id_field ) { 434 435 array_splice( $children_elements, $i, 1 ); 436 $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); 437 $i = -1; 427 if ( !isset($newlevel) ) { 428 $newlevel = true; 429 //start the child delimiter 430 $cb_args = array_merge( array($output, $depth), $args); 431 $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args); 432 } 433 434 array_splice( $children_elements, $i, 1 ); 435 $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); 436 $i = -1; 437 } 438 438 } 439 439 } 440 441 //end this element 442 $cb_args = array_merge( array($output, $element, $depth), $args); 443 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 444 445 if ($depth > 0) { 440 441 if ( isset($newlevel) && $newlevel ){ 446 442 //end the child delimiter 447 443 $cb_args = array_merge( array($output, $depth), $args); 448 444 $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args); 449 445 } 446 447 //end this element 448 $cb_args = array_merge( array($output, $element, $depth), $args); 449 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 450 450 451 451 return $output; 452 452 }