diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index fc1b68873f..e58e585dad 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -126,33 +126,25 @@ class Walker_Category_Checklist 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) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
- return $output;
}
- function end_lvl($output, $depth, $args) {
+ function end_lvl(&$output, $depth, $args) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\n";
- return $output;
}
- function start_el($output, $category, $depth, $args) {
+ function start_el(&$output, $category, $depth, $args) {
extract($args);
$class = in_array( $category->term_id, $popular_cats ) ? ' class="popular-category"' : '';
$output .= "\n" . '';
-
- return $output;
}
- function end_el($output, $category, $depth, $args) {
- if ( 'list' != $args['style'] )
- return $output;
-
+ function end_el(&$output, $category, $depth, $args) {
$output .= "\n";
- return $output;
}
}
diff --git a/wp-admin/post.php b/wp-admin/post.php
index 506a5635c6..5ed51c86e2 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -35,6 +35,7 @@ function redirect_post($post_ID = '') {
$location = $location[0] . '#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
+ $location = remove_query_arg('_wp_original_http_referer', $location);
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $post_ID );
elseif ( false !== strpos($location, 'edit.php') )
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 9b127424c4..0d866faac9 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\n";
- return $output;
}
- function end_lvl($output, $depth) {
+ function end_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "$indent
\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 .= "\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(' ', $depth * 3);
+ function start_el(&$output, $page, $depth, $args) {
+ $pad = str_repeat(' ', $depth * 3);
- $output .= "\t\n";
-
- return $output;
+ $output .= "\t\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\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
\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
\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 .= "\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(' ', $depth * 3);
$cat_name = apply_filters('list_cats', $category->name, $category);
@@ -721,8 +706,6 @@ class Walker_CategoryDropdown extends Walker {
$output .= ' ' . gmdate($format, $category->last_update_timestamp);
}
$output .= "\n";
-
- return $output;
}
}