PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 19.0
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v19.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 / actions / semrush / semrush-options-action.php

semrush-options-action.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 19.0, at src/actions/semrush/semrush-options-action.php

52 lines 1.1 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\Actions\SEMrush;
4
5 use Yoast\WP\SEO\Helpers\Options_Helper;
6
7 /**
8 * Class SEMrush_Options_Action
9 */
10 class SEMrush_Options_Action {
11
12 /**
13 * The Options_Helper instance.
14 *
15 * @var Options_Helper
16 */
17 protected $options_helper;
18
19 /**
20 * SEMrush_Options_Action constructor.
21 *
22 * @param Options_Helper $options_helper The WPSEO options helper.
23 */
24 public function __construct( Options_Helper $options_helper ) {
25 $this->options_helper = $options_helper;
26 }
27
28 /**
29 * Stores SEMrush country code in the WPSEO options.
30 *
31 * @param string $country_code The country code to store.
32 *
33 * @return object The response object.
34 */
35 public function set_country_code( $country_code ) {
36 // The country code has already been validated at this point. No need to do that again.
37 $success = $this->options_helper->set( 'semrush_country_code', $country_code );
38
39 if ( $success ) {
40 return (object) [
41 'success' => true,
42 'status' => 200,
43 ];
44 }
45 return (object) [
46 'success' => false,
47 'status' => 500,
48 'error' => 'Could not save option in the database',
49 ];
50 }
51 }
52