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.../public_h.../wp-conte.../plugins/wordpres.../src/config
File: semrush-client.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Config;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Exceptions\OAuth\Authentication_Failed_Exception;
[4] Fix | Delete
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Property_Exception;
[5] Fix | Delete
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Token_Exception;
[6] Fix | Delete
use Yoast\WP\SEO\Helpers\Options_Helper;
[7] Fix | Delete
use Yoast\WP\SEO\Wrappers\WP_Remote_Handler;
[8] Fix | Delete
use YoastSEO_Vendor\GuzzleHttp\Client;
[9] Fix | Delete
use YoastSEO_Vendor\League\OAuth2\Client\Provider\Exception\IdentityProviderException;
[10] Fix | Delete
use YoastSEO_Vendor\League\OAuth2\Client\Provider\GenericProvider;
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Class SEMrush_Client
[14] Fix | Delete
*/
[15] Fix | Delete
class SEMrush_Client extends OAuth_Client {
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* The option's key.
[19] Fix | Delete
*/
[20] Fix | Delete
public const TOKEN_OPTION = 'semrush_tokens';
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* SEMrush_Client constructor.
[24] Fix | Delete
*
[25] Fix | Delete
* @param Options_Helper $options_helper The Options_Helper instance.
[26] Fix | Delete
* @param WP_Remote_Handler $wp_remote_handler The request handler.
[27] Fix | Delete
*
[28] Fix | Delete
* @throws Empty_Property_Exception Throws when one of the required properties is empty.
[29] Fix | Delete
*/
[30] Fix | Delete
public function __construct(
[31] Fix | Delete
Options_Helper $options_helper,
[32] Fix | Delete
WP_Remote_Handler $wp_remote_handler
[33] Fix | Delete
) {
[34] Fix | Delete
$provider = new GenericProvider(
[35] Fix | Delete
[
[36] Fix | Delete
'clientId' => 'yoast',
[37] Fix | Delete
'clientSecret' => 'YdqNsWwnP4vE54WO1ugThKEjGMxMAHJt',
[38] Fix | Delete
'redirectUri' => 'https://oauth.semrush.com/oauth2/yoast/success',
[39] Fix | Delete
'urlAuthorize' => 'https://oauth.semrush.com/oauth2/authorize',
[40] Fix | Delete
'urlAccessToken' => 'https://oauth.semrush.com/oauth2/access_token',
[41] Fix | Delete
'urlResourceOwnerDetails' => 'https://oauth.semrush.com/oauth2/resource',
[42] Fix | Delete
],
[43] Fix | Delete
[
[44] Fix | Delete
'httpClient' => new Client( [ 'handler' => $wp_remote_handler ] ),
[45] Fix | Delete
]
[46] Fix | Delete
);
[47] Fix | Delete
[48] Fix | Delete
parent::__construct(
[49] Fix | Delete
self::TOKEN_OPTION,
[50] Fix | Delete
$provider,
[51] Fix | Delete
$options_helper
[52] Fix | Delete
);
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
/**
[56] Fix | Delete
* Performs the specified request.
[57] Fix | Delete
*
[58] Fix | Delete
* @codeCoverageIgnore
[59] Fix | Delete
*
[60] Fix | Delete
* @param string $method The HTTP method to use.
[61] Fix | Delete
* @param string $url The URL to send the request to.
[62] Fix | Delete
* @param array $options The options to pass along to the request.
[63] Fix | Delete
*
[64] Fix | Delete
* @return mixed The parsed API response.
[65] Fix | Delete
*
[66] Fix | Delete
* @throws IdentityProviderException Exception thrown if there's something wrong with the identifying data.
[67] Fix | Delete
* @throws Authentication_Failed_Exception Exception thrown if authentication has failed.
[68] Fix | Delete
* @throws Empty_Token_Exception Exception thrown if the token is empty.
[69] Fix | Delete
*/
[70] Fix | Delete
public function do_request( $method, $url, array $options ) {
[71] Fix | Delete
// Add the access token to the GET parameters as well since this is what
[72] Fix | Delete
// the SEMRush API expects.
[73] Fix | Delete
$options = \array_merge_recursive(
[74] Fix | Delete
$options,
[75] Fix | Delete
[
[76] Fix | Delete
'params' => [
[77] Fix | Delete
'access_token' => $this->get_tokens()->access_token,
[78] Fix | Delete
],
[79] Fix | Delete
]
[80] Fix | Delete
);
[81] Fix | Delete
[82] Fix | Delete
return parent::do_request( $method, $url, $options );
[83] Fix | Delete
}
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function