summaryrefslogtreecommitdiffstats
path: root/wp-includes/classes.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2008-04-24 11:45:39 +0000
commitcf9f85dc8121a359d550ffa3b735fb48859eee88 (patch)
tree9f90be15fc46163f5656f019f2a2866414b7c9f2 /wp-includes/classes.php
parentf10f9f5b05e23ce4c07479b094bd3ff4bbfd86d0 (diff)
downloadwordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.gz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.tar.xz
wordpress-mu-cf9f85dc8121a359d550ffa3b735fb48859eee88.zip
Merged with WP 2.5, revision 7806
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1260 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/classes.php')
-rw-r--r--wp-includes/classes.php97
1 files changed, 40 insertions, 57 deletions
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 9b12742..0d866fa 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -395,26 +395,26 @@ class Walker {
var $db_fields;
//abstract callbacks
- function start_lvl($output) { return $output; }
- function end_lvl($output) { return $output; }
- function start_el($output) { return $output; }
- function end_el($output) { return $output; }
+ function start_lvl(&$output) {}
+ function end_lvl(&$output) {}
+ function start_el(&$output) {}
+ function end_el(&$output) {}
/*
* display one element if the element doesn't have any children
* otherwise, display the element and its children
*/
- function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, $output ) {
+ function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
- if ( !$element)
- return $output;
+ if ( !$element )
+ return;
$id_field = $this->db_fields['id'];
$parent_field = $this->db_fields['parent'];
//display this element
- $cb_args = array_merge( array($output, $element, $depth), $args);
- $output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
+ $cb_args = array_merge( array(&$output, $element, $depth), $args);
+ call_user_func_array(array(&$this, 'start_el'), $cb_args);
if ( $max_depth == 0 ||
($max_depth != 0 && $max_depth > $depth+1 )) { //whether to descend
@@ -427,12 +427,12 @@ class Walker {
if ( !isset($newlevel) ) {
$newlevel = true;
//start the child delimiter
- $cb_args = array_merge( array($output, $depth), $args);
- $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
+ $cb_args = array_merge( array(&$output, $depth), $args);
+ call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
}
array_splice( $children_elements, $i, 1 );
- $output = $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
+ $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
$i = -1;
}
}
@@ -440,15 +440,13 @@ class Walker {
if ( isset($newlevel) && $newlevel ){
//end the child delimiter
- $cb_args = array_merge( array($output, $depth), $args);
- $output = call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
+ $cb_args = array_merge( array(&$output, $depth), $args);
+ call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
}
//end this element
- $cb_args = array_merge( array($output, $element, $depth), $args);
- $output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
-
- return $output;
+ $cb_args = array_merge( array(&$output, $element, $depth), $args);
+ call_user_func_array(array(&$this, 'end_el'), $cb_args);
}
/*
@@ -476,7 +474,7 @@ class Walker {
if ( -1 == $max_depth ) {
$empty_array = array();
foreach ( $elements as $e )
- $output = $this->display_element( $e, $empty_array, 1, 0, $args, $output );
+ $this->display_element( $e, $empty_array, 1, 0, $args, $output );
return $output;
}
@@ -512,7 +510,7 @@ class Walker {
}
foreach ( $top_level_elements as $e )
- $output = $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+ $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
/*
* if we are displaying all levels, and remaining children_elements is not empty,
@@ -521,7 +519,7 @@ class Walker {
if ( ( $max_depth == 0 ) && sizeof( $children_elements ) > 0 ) {
$empty_array = array();
foreach ( $children_elements as $orphan_e )
- $output = $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output );
+ $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output );
}
return $output;
}
@@ -531,19 +529,17 @@ class Walker_Page extends Walker {
var $tree_type = 'page';
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
- function start_lvl($output, $depth) {
+ function start_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul>\n";
- return $output;
}
- function end_lvl($output, $depth) {
+ function end_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n";
- return $output;
}
- function start_el($output, $page, $depth, $current_page, $args) {
+ function start_el(&$output, $page, $depth, $current_page, $args) {
if ( $depth )
$indent = str_repeat("\t", $depth);
else
@@ -571,14 +567,10 @@ class Walker_Page extends Walker {
$output .= " " . mysql2date($date_format, $time);
}
-
- return $output;
}
- function end_el($output, $page, $depth) {
+ function end_el(&$output, $page, $depth) {
$output .= "</li>\n";
-
- return $output;
}
}
@@ -587,18 +579,16 @@ class Walker_PageDropdown extends Walker {
var $tree_type = 'page';
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
- function start_el($output, $page, $depth, $args) {
- $pad = str_repeat('&nbsp;', $depth * 3);
-
- $output .= "\t<option value=\"$page->ID\"";
- if ( $page->ID == $args['selected'] )
- $output .= ' selected="selected"';
- $output .= '>';
- $title = wp_specialchars($page->post_title);
- $output .= "$pad$title";
- $output .= "</option>\n";
+ function start_el(&$output, $page, $depth, $args) {
+ $pad = str_repeat('&nbsp;', $depth * 3);
- return $output;
+ $output .= "\t<option value=\"$page->ID\"";
+ if ( $page->ID == $args['selected'] )
+ $output .= ' selected="selected"';
+ $output .= '>';
+ $title = wp_specialchars($page->post_title);
+ $output .= "$pad$title";
+ $output .= "</option>\n";
}
}
@@ -606,25 +596,23 @@ class Walker_Category extends Walker {
var $tree_type = 'category';
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
- function start_lvl($output, $depth, $args) {
+ function start_lvl(&$output, $depth, $args) {
if ( 'list' != $args['style'] )
- return $output;
+ return;
$indent = str_repeat("\t", $depth);
$output .= "$indent<ul class='children'>\n";
- return $output;
}
- function end_lvl($output, $depth, $args) {
+ function end_lvl(&$output, $depth, $args) {
if ( 'list' != $args['style'] )
- return $output;
+ return;
$indent = str_repeat("\t", $depth);
$output .= "$indent</ul>\n";
- return $output;
}
- function start_el($output, $category, $depth, $args) {
+ function start_el(&$output, $category, $depth, $args) {
extract($args);
$cat_name = attribute_escape( $category->name);
@@ -687,16 +675,13 @@ class Walker_Category extends Walker {
} else {
$output .= "\t$link<br />\n";
}
-
- return $output;
}
- function end_el($output, $page, $depth, $args) {
+ function end_el(&$output, $page, $depth, $args) {
if ( 'list' != $args['style'] )
- return $output;
+ return;
$output .= "</li>\n";
- return $output;
}
}
@@ -705,7 +690,7 @@ class Walker_CategoryDropdown extends Walker {
var $tree_type = 'category';
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
- function start_el($output, $category, $depth, $args) {
+ function start_el(&$output, $category, $depth, $args) {
$pad = str_repeat('&nbsp;', $depth * 3);
$cat_name = apply_filters('list_cats', $category->name, $category);
@@ -721,8 +706,6 @@ class Walker_CategoryDropdown extends Walker {
$output .= '&nbsp;&nbsp;' . gmdate($format, $category->last_update_timestamp);
}
$output .= "</option>\n";
-
- return $output;
}
}