diff -r c7c34916027a -r 177826044cd9 wp/wp-includes/class-wp-ajax-response.php --- a/wp/wp-includes/class-wp-ajax-response.php Mon Oct 14 18:06:33 2019 +0200 +++ b/wp/wp-includes/class-wp-ajax-response.php Mon Oct 14 18:28:13 2019 +0200 @@ -23,8 +23,9 @@ * @param string|array $args Optional. Will be passed to add() method. */ public function __construct( $args = '' ) { - if ( !empty($args) ) - $this->add($args); + if ( ! empty( $args ) ) { + $this->add( $args ); + } } /** @@ -63,36 +64,39 @@ */ public function add( $args = '' ) { $defaults = array( - 'what' => 'object', 'action' => false, - 'id' => '0', 'old_id' => false, - 'position' => 1, - 'data' => '', 'supplemental' => array() + 'what' => 'object', + 'action' => false, + 'id' => '0', + 'old_id' => false, + 'position' => 1, + 'data' => '', + 'supplemental' => array(), ); $r = wp_parse_args( $args, $defaults ); $position = preg_replace( '/[^a-z0-9:_-]/i', '', $r['position'] ); - $id = $r['id']; - $what = $r['what']; - $action = $r['action']; - $old_id = $r['old_id']; - $data = $r['data']; + $id = $r['id']; + $what = $r['what']; + $action = $r['action']; + $old_id = $r['old_id']; + $data = $r['data']; if ( is_wp_error( $id ) ) { $data = $id; - $id = 0; + $id = 0; } $response = ''; if ( is_wp_error( $data ) ) { foreach ( (array) $data->get_error_codes() as $code ) { - $response .= "get_error_message( $code ) . "]]>"; + $response .= "get_error_message( $code ) . ']]>'; if ( ! $error_data = $data->get_error_data( $code ) ) { continue; } $class = ''; if ( is_object( $error_data ) ) { - $class = ' class="' . get_class( $error_data ) . '"'; + $class = ' class="' . get_class( $error_data ) . '"'; $error_data = get_object_vars( $error_data ); } @@ -106,7 +110,7 @@ } } - $response .= ""; + $response .= ''; } } else { $response = ""; @@ -123,13 +127,13 @@ if ( false === $action ) { $action = $_POST['action']; } - $x = ''; + $x = ''; $x .= ""; // The action attribute in the xml output is formatted like a nonce action - $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; - $x .= $response; - $x .= $s; - $x .= ""; - $x .= ""; + $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; + $x .= $response; + $x .= $s; + $x .= ""; + $x .= ''; $this->responses[] = $x; return $x; @@ -145,12 +149,14 @@ public function send() { header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) ); echo ""; - foreach ( (array) $this->responses as $response ) + foreach ( (array) $this->responses as $response ) { echo $response; + } echo ''; - if ( wp_doing_ajax() ) + if ( wp_doing_ajax() ) { wp_die(); - else + } else { die(); + } } }