Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordpres.../src/wrappers
File: wp-remote-handler.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Wrappers;
[2] Fix | Delete
[3] Fix | Delete
use Exception;
[4] Fix | Delete
use YoastSEO_Vendor\GuzzleHttp\Promise\FulfilledPromise;
[5] Fix | Delete
use YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface;
[6] Fix | Delete
use YoastSEO_Vendor\GuzzleHttp\Promise\RejectedPromise;
[7] Fix | Delete
use YoastSEO_Vendor\GuzzleHttp\Psr7\Response;
[8] Fix | Delete
use YoastSEO_Vendor\Psr\Http\Message\RequestInterface;
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* Wraps wp_remote_get in an interface compatible with Guzzle.
[12] Fix | Delete
*/
[13] Fix | Delete
class WP_Remote_Handler {
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Calls the handler.
[17] Fix | Delete
* Cookies are currently not supported as they are not used by OAuth.
[18] Fix | Delete
* Writing responses to files is also not supported for the same reason.
[19] Fix | Delete
*
[20] Fix | Delete
* @param RequestInterface $request The request.
[21] Fix | Delete
* @param array $options The request options.
[22] Fix | Delete
*
[23] Fix | Delete
* @return PromiseInterface The promise interface.
[24] Fix | Delete
*
[25] Fix | Delete
* @throws Exception If the request fails.
[26] Fix | Delete
*/
[27] Fix | Delete
public function __invoke( RequestInterface $request, array $options ) {
[28] Fix | Delete
$headers = [];
[29] Fix | Delete
foreach ( $request->getHeaders() as $name => $values ) {
[30] Fix | Delete
$headers[ $name ] = \implode( ',', $values );
[31] Fix | Delete
}
[32] Fix | Delete
[33] Fix | Delete
$args = [
[34] Fix | Delete
'method' => $request->getMethod(),
[35] Fix | Delete
'headers' => $headers,
[36] Fix | Delete
'body' => (string) $request->getBody(),
[37] Fix | Delete
'httpVersion' => $request->getProtocolVersion(),
[38] Fix | Delete
];
[39] Fix | Delete
[40] Fix | Delete
if ( isset( $options['verify'] ) && $options['verify'] === false ) {
[41] Fix | Delete
$args['sslverify'] = false;
[42] Fix | Delete
}
[43] Fix | Delete
if ( isset( $options['timeout'] ) ) {
[44] Fix | Delete
$args['timeout'] = ( $options['timeout'] * 1000 );
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
$raw_response = \wp_remote_request( (string) $request->getUri(), $args );
[48] Fix | Delete
if ( \is_wp_error( $raw_response ) ) {
[49] Fix | Delete
$exception = new Exception( $raw_response->get_error_message() );
[50] Fix | Delete
return new RejectedPromise( $exception );
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
$response = new Response(
[54] Fix | Delete
$raw_response['response']['code'],
[55] Fix | Delete
$raw_response['headers']->getAll(),
[56] Fix | Delete
$raw_response['body'],
[57] Fix | Delete
$args['httpVersion'],
[58] Fix | Delete
$raw_response['response']['message']
[59] Fix | Delete
);
[60] Fix | Delete
[61] Fix | Delete
return new FulfilledPromise( $response );
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function