PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.0
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / config / semrush-client.php

semrush-client.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.0, at src/config/semrush-client.php

54 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Config;
4
5 use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Property_Exception;
6 use Yoast\WP\SEO\Helpers\Options_Helper;
7 use Yoast\WP\SEO\Wrappers\WP_Remote_Handler;
8 use YoastSEO_Vendor\GuzzleHttp\Client;
9 use YoastSEO_Vendor\League\OAuth2\Client\Provider\GenericProvider;
10
11 /**
12 * Class SEMrush_Client
13 */
14 class SEMrush_Client extends OAuth_Client {
15
16 /**
17 * The option's key.
18 */
19 const TOKEN_OPTION = 'semrush_tokens';
20
21 /**
22 * SEMrush_Client constructor.
23 *
24 * @param Options_Helper $options_helper The Options_Helper instance.
25 * @param WP_Remote_Handler $wp_remote_handler The request handler.
26 *
27 * @throws Empty_Property_Exception Throws when one of the required properties is empty.
28 */
29 public function __construct(
30 Options_Helper $options_helper,
31 WP_Remote_Handler $wp_remote_handler
32 ) {
33 $provider = new GenericProvider(
34 [
35 'clientId' => 'yoast',
36 'clientSecret' => 'YdqNsWwnP4vE54WO1ugThKEjGMxMAHJt',
37 'redirectUri' => 'https://oauth.semrush.com/oauth2/yoast/success',
38 'urlAuthorize' => 'https://oauth.semrush.com/oauth2/authorize',
39 'urlAccessToken' => 'https://oauth.semrush.com/oauth2/access_token',
40 'urlResourceOwnerDetails' => 'https://oauth.semrush.com/oauth2/resource',
41 ],
42 [
43 'httpClient' => new Client( [ 'handler' => $wp_remote_handler ] ),
44 ]
45 );
46
47 parent::__construct(
48 self::TOKEN_OPTION,
49 $provider,
50 $options_helper
51 );
52 }
53 }
54