Ticket #5469: 5469_walk_cleanup.diff
File 5469_walk_cleanup.diff, 2.8 KB (added by , 17 years ago) |
---|
-
C:/xampp/htdocs/wordpress_trunk/wp-includes/classes.php
408 408 409 409 if ( !$element) 410 410 return $output; 411 411 412 412 if ( $max_depth != 0 ) { 413 413 if ($depth >= $max_depth) 414 414 return $output; 415 415 } 416 416 417 417 $id_field = $this->db_fields['id']; 418 418 $parent_field = $this->db_fields['parent']; 419 419 420 if ($depth > 0) { 421 //start the child delimiter 422 $cb_args = array_merge( array($output, $depth), $args); 423 $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args); 424 } 425 420 426 //display this element 421 427 $cb_args = array_merge( array($output, $element, $depth), $args); 422 428 $output = call_user_func_array(array(&$this, 'start_el'), $cb_args); 423 429 424 if ( !$children_elements ) {425 //close off this element426 $cb_args = array_merge( array($output, $element, $depth), $args);427 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);428 return $output;429 }430 431 430 for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) { 431 432 432 $child = $children_elements[$i]; 433 434 433 if ( $child->$parent_field == $element->$id_field ) { 435 434 436 array_splice( $children_elements, $i, 1 ); 437 438 //start the child delimiter 439 $cb_args = array_merge( array($output, $depth), $args); 440 $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args); 441 435 array_splice( $children_elements, $i, 1 ); 442 436 $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); 443 444 //end the child delimiter445 $cb_args = array_merge( array($output, $depth), $args);446 $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);447 437 $i--; 448 438 } 449 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) { 446 //end the child delimiter 447 $cb_args = array_merge( array($output, $depth), $args); 448 $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args); 449 } 450 450 451 return $output; 451 452 } 452 453 453 454 /* 454 455 * displays array of elements hierarchically 456 * it is a generic function which does not assume any existing order of elements 455 457 * max_depth = -1 means flatly display every element 456 458 * max_depth = 0 means display all levels 457 459 * max_depth > 0 specifies the number of display levels. … … 461 463 $args = array_slice(func_get_args(), 2); 462 464 $output = ''; 463 465 466 if ($max_depth < -1) //invalid parameter 467 return $output; 468 464 469 $id_field = $this->db_fields['id']; 465 470 $parent_field = $this->db_fields['parent']; 466 471