Changeset 32549
- Timestamp:
- 05/22/2015 05:58:42 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-walker.php
r32545 r32549 128 128 * @param array $args An array of arguments. 129 129 * @param string $output Passed by reference. Used to append additional content. 130 * @return null Null on failure with no changes to parameters.131 130 */ 132 131 public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { 133 134 if ( !$element ) 132 if ( ! $element ) { 135 133 return; 134 } 136 135 137 136 $id_field = $this->db_fields['id']; … … 189 188 * @return string The hierarchical item output. 190 189 */ 191 public function walk( $elements, $max_depth) { 192 190 public function walk( $elements, $max_depth ) { 193 191 $args = array_slice(func_get_args(), 2); 194 192 $output = ''; 195 193 196 if ($max_depth < -1) //invalid parameter 194 //invalid parameter or nothing to walk 195 if ( $max_depth < -1 || empty( $elements ) ) { 197 196 return $output; 198 199 if (empty($elements)) //nothing to walk 200 return $output; 197 } 201 198 202 199 $parent_field = $this->db_fields['parent']; … … 273 270 * @since 2.7.0 274 271 * 275 * @param int $max_depth The maximum hierarchical depth. 276 * @param int $page_num The specific page number, beginning with 1. 277 * @return string XHTML of the specified page of elements 278 */ 272 * @param array $elements 273 * @param int $max_depth The maximum hierarchical depth. 274 * @param int $page_num The specific page number, beginning with 1. 275 * @param int $per_page 276 * @return string XHTML of the specified page of elements 277 */ 279 278 public function paged_walk( $elements, $max_depth, $page_num, $per_page ) { 280 281 /* sanity check */ 282 if ( empty($elements) || $max_depth < -1 ) 279 if ( empty( $elements ) || $max_depth < -1 ) { 283 280 return ''; 281 } 284 282 285 283 $args = array_slice( func_get_args(), 4 ); … … 384 382 } 385 383 384 /** 385 * 386 * @param array $elements 387 * @return int 388 */ 386 389 public function get_number_of_root_elements( $elements ){ 387 388 390 $num = 0; 389 391 $parent_field = $this->db_fields['parent']; … … 396 398 } 397 399 398 // Unset all the children for a given top level element. 400 /** 401 * Unset all the children for a given top level element. 402 * 403 * @param object $e 404 * @param array $children_elements 405 */ 399 406 public function unset_children( $e, &$children_elements ){ 400 401 if ( !$e || !$children_elements ) 407 if ( ! $e || ! $children_elements ) { 402 408 return; 409 } 403 410 404 411 $id_field = $this->db_fields['id'];
Note: See TracChangeset
for help on using the changeset viewer.