]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-wp-http-ixr-client.php
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-includes / class-wp-http-ixr-client.php
index e0309bf9f46fede1f21d255cfb85cabc92223258..e4ed55020fcd48ff67440de0972aae29fa5e75a1 100644 (file)
@@ -64,15 +64,27 @@ class WP_HTTP_IXR_Client extends IXR_Client {
                );
 
                // Merge Custom headers ala #8145
                );
 
                // Merge Custom headers ala #8145
-               foreach ( $this->headers as $header => $value )
+               foreach ( $this->headers as $header => $value ) {
                        $args['headers'][$header] = $value;
                        $args['headers'][$header] = $value;
+               }
+
+               /**
+                * Filters the headers collection to be sent to the XML-RPC server.
+                *
+                * @since 4.4.0
+                *
+                * @param array $headers Array of headers to be sent.
+                */
+               $args['headers'] = apply_filters( 'wp_http_ixr_client_headers', $args['headers'] );
 
 
-               if ( $this->timeout !== false )
+               if ( $this->timeout !== false ) {
                        $args['timeout'] = $this->timeout;
                        $args['timeout'] = $this->timeout;
+               }
 
                // Now send the request
 
                // Now send the request
-               if ( $this->debug )
+               if ( $this->debug ) {
                        echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
                        echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
+               }
 
                $response = wp_remote_post($url, $args);
 
 
                $response = wp_remote_post($url, $args);
 
@@ -88,8 +100,9 @@ class WP_HTTP_IXR_Client extends IXR_Client {
                        return false;
                }
 
                        return false;
                }
 
-               if ( $this->debug )
+               if ( $this->debug ) {
                        echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
                        echo '<pre class="ixr_response">' . htmlspecialchars( wp_remote_retrieve_body( $response ) ) . "\n</pre>\n\n";
+               }
 
                // Now parse what we've got back
                $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );
 
                // Now parse what we've got back
                $this->message = new IXR_Message( wp_remote_retrieve_body( $response ) );