summaryrefslogtreecommitdiffstats
path: root/wp-includes/classes.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/classes.php')
-rw-r--r--wp-includes/classes.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index 6e55c45..c79442b 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -696,11 +696,13 @@ class WP_Ajax_Response {
$defaults = array(
'what' => 'object', 'action' => false,
'id' => '0', 'old_id' => false,
+ 'position' => 1, // -1 = top, 1 = bottom, html ID = after, -html ID = before
'data' => '', 'supplemental' => array()
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
+ $postition = preg_replace( '/[^a-z0-9:_-]/i', '', $position );
if ( is_wp_error($id) ) {
$data = $id;
@@ -724,7 +726,7 @@ class WP_Ajax_Response {
$x = '';
$x .= "<response action='{$action}_$id'>"; // The action attribute in the xml output is formatted like a nonce action
- $x .= "<$what id='$id'" . ( false !== $old_id ? "old_id='$old_id'>" : '>' );
+ $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>";
$x .= $response;
$x .= $s;
$x .= "</$what>";