Changeset 7770 for branches/2.5/wp-includes/classes.php
- Timestamp:
- 04/22/2008 09:06:00 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/wp-includes/classes.php
r7551 r7770 396 396 397 397 //abstract callbacks 398 function start_lvl( $output) { return $output;}399 function end_lvl( $output) { return $output;}400 function start_el( $output) { return $output;}401 function end_el( $output) { return $output;}398 function start_lvl(&$output) {} 399 function end_lvl(&$output) {} 400 function start_el(&$output) {} 401 function end_el(&$output) {} 402 402 403 403 /* … … 405 405 * otherwise, display the element and its children 406 406 */ 407 function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, $output ) {408 409 if ( !$element )410 return $output;407 function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { 408 409 if ( !$element ) 410 return; 411 411 412 412 $id_field = $this->db_fields['id']; … … 414 414 415 415 //display this element 416 $cb_args = array_merge( array( $output, $element, $depth), $args);417 $output =call_user_func_array(array(&$this, 'start_el'), $cb_args);416 $cb_args = array_merge( array(&$output, $element, $depth), $args); 417 call_user_func_array(array(&$this, 'start_el'), $cb_args); 418 418 419 419 if ( $max_depth == 0 || … … 428 428 $newlevel = true; 429 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);430 $cb_args = array_merge( array(&$output, $depth), $args); 431 call_user_func_array(array(&$this, 'start_lvl'), $cb_args); 432 432 } 433 433 434 434 array_splice( $children_elements, $i, 1 ); 435 $ output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );435 $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); 436 436 $i = -1; 437 437 } … … 441 441 if ( isset($newlevel) && $newlevel ){ 442 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);443 $cb_args = array_merge( array(&$output, $depth), $args); 444 call_user_func_array(array(&$this, 'end_lvl'), $cb_args); 445 445 } 446 446 447 447 //end this element 448 $cb_args = array_merge( array($output, $element, $depth), $args); 449 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 450 451 return $output; 448 $cb_args = array_merge( array(&$output, $element, $depth), $args); 449 call_user_func_array(array(&$this, 'end_el'), $cb_args); 452 450 } 453 451 … … 477 475 $empty_array = array(); 478 476 foreach ( $elements as $e ) 479 $ output = $this->display_element( $e, $empty_array, 1, 0, $args, $output );477 $this->display_element( $e, $empty_array, 1, 0, $args, $output ); 480 478 return $output; 481 479 } … … 513 511 514 512 foreach ( $top_level_elements as $e ) 515 $ output = $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );513 $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); 516 514 517 515 /* … … 522 520 $empty_array = array(); 523 521 foreach ( $children_elements as $orphan_e ) 524 $ output = $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output );522 $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output ); 525 523 } 526 524 return $output; … … 532 530 var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this 533 531 534 function start_lvl( $output, $depth) {532 function start_lvl(&$output, $depth) { 535 533 $indent = str_repeat("\t", $depth); 536 534 $output .= "\n$indent<ul>\n"; 537 return $output; 538 } 539 540 function end_lvl($output, $depth) { 535 } 536 537 function end_lvl(&$output, $depth) { 541 538 $indent = str_repeat("\t", $depth); 542 539 $output .= "$indent</ul>\n"; 543 return $output; 544 } 545 546 function start_el($output, $page, $depth, $current_page, $args) { 540 } 541 542 function start_el(&$output, $page, $depth, $current_page, $args) { 547 543 if ( $depth ) 548 544 $indent = str_repeat("\t", $depth); … … 572 568 $output .= " " . mysql2date($date_format, $time); 573 569 } 574 575 return $output; 576 } 577 578 function end_el($output, $page, $depth) { 570 } 571 572 function end_el(&$output, $page, $depth) { 579 573 $output .= "</li>\n"; 580 581 return $output;582 574 } 583 575 … … 588 580 var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this 589 581 590 function start_el($output, $page, $depth, $args) { 591 $pad = str_repeat(' ', $depth * 3); 592 593 $output .= "\t<option value=\"$page->ID\""; 594 if ( $page->ID == $args['selected'] ) 595 $output .= ' selected="selected"'; 596 $output .= '>'; 597 $title = wp_specialchars($page->post_title); 598 $output .= "$pad$title"; 599 $output .= "</option>\n"; 600 601 return $output; 582 function start_el(&$output, $page, $depth, $args) { 583 $pad = str_repeat(' ', $depth * 3); 584 585 $output .= "\t<option value=\"$page->ID\""; 586 if ( $page->ID == $args['selected'] ) 587 $output .= ' selected="selected"'; 588 $output .= '>'; 589 $title = wp_specialchars($page->post_title); 590 $output .= "$pad$title"; 591 $output .= "</option>\n"; 602 592 } 603 593 } … … 607 597 var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this 608 598 609 function start_lvl( $output, $depth, $args) {599 function start_lvl(&$output, $depth, $args) { 610 600 if ( 'list' != $args['style'] ) 611 return $output;601 return; 612 602 613 603 $indent = str_repeat("\t", $depth); 614 604 $output .= "$indent<ul class='children'>\n"; 615 return $output; 616 } 617 618 function end_lvl($output, $depth, $args) { 605 } 606 607 function end_lvl(&$output, $depth, $args) { 619 608 if ( 'list' != $args['style'] ) 620 return $output;609 return; 621 610 622 611 $indent = str_repeat("\t", $depth); 623 612 $output .= "$indent</ul>\n"; 624 return $output; 625 } 626 627 function start_el($output, $category, $depth, $args) { 613 } 614 615 function start_el(&$output, $category, $depth, $args) { 628 616 extract($args); 629 617 … … 688 676 $output .= "\t$link<br />\n"; 689 677 } 690 691 return $output; 692 } 693 694 function end_el($output, $page, $depth, $args) { 678 } 679 680 function end_el(&$output, $page, $depth, $args) { 695 681 if ( 'list' != $args['style'] ) 696 return $output;682 return; 697 683 698 684 $output .= "</li>\n"; 699 return $output;700 685 } 701 686 … … 706 691 var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this 707 692 708 function start_el( $output, $category, $depth, $args) {693 function start_el(&$output, $category, $depth, $args) { 709 694 $pad = str_repeat(' ', $depth * 3); 710 695 … … 722 707 } 723 708 $output .= "</option>\n"; 724 725 return $output;726 709 } 727 710 }
Note: See TracChangeset
for help on using the changeset viewer.