web/wp-includes/class-wp-walker.php
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
   124 
   124 
   125 		//display this element
   125 		//display this element
   126 		if ( is_array( $args[0] ) )
   126 		if ( is_array( $args[0] ) )
   127 			$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
   127 			$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
   128 		$cb_args = array_merge( array(&$output, $element, $depth), $args);
   128 		$cb_args = array_merge( array(&$output, $element, $depth), $args);
   129 		call_user_func_array(array(&$this, 'start_el'), $cb_args);
   129 		call_user_func_array(array($this, 'start_el'), $cb_args);
   130 
   130 
   131 		$id = $element->$id_field;
   131 		$id = $element->$id_field;
   132 
   132 
   133 		// descend only when the depth is right and there are childrens for this element
   133 		// descend only when the depth is right and there are childrens for this element
   134 		if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
   134 		if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
   137 
   137 
   138 				if ( !isset($newlevel) ) {
   138 				if ( !isset($newlevel) ) {
   139 					$newlevel = true;
   139 					$newlevel = true;
   140 					//start the child delimiter
   140 					//start the child delimiter
   141 					$cb_args = array_merge( array(&$output, $depth), $args);
   141 					$cb_args = array_merge( array(&$output, $depth), $args);
   142 					call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
   142 					call_user_func_array(array($this, 'start_lvl'), $cb_args);
   143 				}
   143 				}
   144 				$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
   144 				$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
   145 			}
   145 			}
   146 			unset( $children_elements[ $id ] );
   146 			unset( $children_elements[ $id ] );
   147 		}
   147 		}
   148 
   148 
   149 		if ( isset($newlevel) && $newlevel ){
   149 		if ( isset($newlevel) && $newlevel ){
   150 			//end the child delimiter
   150 			//end the child delimiter
   151 			$cb_args = array_merge( array(&$output, $depth), $args);
   151 			$cb_args = array_merge( array(&$output, $depth), $args);
   152 			call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
   152 			call_user_func_array(array($this, 'end_lvl'), $cb_args);
   153 		}
   153 		}
   154 
   154 
   155 		//end this element
   155 		//end this element
   156 		$cb_args = array_merge( array(&$output, $element, $depth), $args);
   156 		$cb_args = array_merge( array(&$output, $element, $depth), $args);
   157 		call_user_func_array(array(&$this, 'end_el'), $cb_args);
   157 		call_user_func_array(array($this, 'end_el'), $cb_args);
   158 	}
   158 	}
   159 
   159 
   160 	/**
   160 	/**
   161 	 * Display array of elements hierarchically.
   161 	 * Display array of elements hierarchically.
   162 	 *
   162 	 *