Make WordPress Core

Changeset 4779


Ignore:
Timestamp:
01/22/2007 07:05:48 AM (18 years ago)
Author:
ryan
Message:

Walker fix ups. fixes #3080

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r4753 r4779  
    429429                // Previous element is my parent. Descend a level.
    430430                array_unshift($parents, $previous_element);
     431                if ( !$to_depth || ($depth < $to_depth) ) { //only descend if we're below $to_depth
     432                    $cb_args = array_merge( array($output, $depth), $args);
     433                    $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
     434                } else if ( $to_depth && $depth == $to_depth  ) {  // If we've reached depth, end the previous element.
     435                    $cb_args = array_merge( array($output, $previous_element, $depth), $args);
     436                    $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
     437                }
    431438                $depth++; //always do this so when we start the element further down, we know where we are
    432                 if ( !$to_depth || ($depth < $to_depth) ) { //only descend if we're below $to_depth
    433                     $cb_args = array_merge( array($output, $depth - 1), $args);
    434                     $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
    435                 } else {  // If we've reached depth, end the previous element.
    436                     $cb_args = array_merge( array($output, $previous_element, $depth - 1), $args);
    437                     $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
    438                 }
    439439            } else if ( $element->$parent_field == $previous_element->$parent_field) {
    440440                // On the same level as previous element.
     
    453453                    $depth--;
    454454                    if ( !$to_depth || ($depth < $to_depth) ) {
    455                         $cb_args = array_merge( array($output, $depth - 1), $args);
     455                        $cb_args = array_merge( array($output, $depth), $args);
    456456                        $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
    457457                        $cb_args = array_merge( array($output, $parent, $depth - 1), $args);
     
    491491    function start_lvl($output, $depth) {
    492492        $indent = str_repeat("\t", $depth);
    493         $output .= "$indent<ul>\n";
     493        $output .= "\n$indent<ul>\n";
    494494        return $output;
    495495    }
Note: See TracChangeset for help on using the changeset viewer.