Changeset 6858 for trunk/wp-includes/classes.php
- Timestamp:
- 02/15/2008 07:34:52 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/classes.php
r6839 r6858 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 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 414 426 415 //display this element … … 428 417 $output = call_user_func_array(array(&$this, 'start_el'), $cb_args); 429 418 430 for ( $i = 0; $i < sizeof( $children_elements ); $i++ ) { 431 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; 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 ) { 426 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 440 441 if ( isset($newlevel) && $newlevel ){ 442 //end the child delimiter 443 $cb_args = array_merge( array($output, $depth), $args); 444 $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args); 445 } 446 441 447 //end this element 442 448 $cb_args = array_merge( array($output, $element, $depth), $args); 443 449 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 444 445 if ($depth > 0) {446 //end the child delimiter447 $cb_args = array_merge( array($output, $depth), $args);448 $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);449 }450 450 451 451 return $output;
Note: See TracChangeset
for help on using the changeset viewer.