PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.3
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.3
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 / integrations / third-party / wincher.php

wincher.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.3, at src/integrations/third-party/wincher.php

80 lines 2.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\Integrations\Third_Party;
4
5 use Yoast\WP\SEO\Conditionals\Wincher_Conditional;
6 use Yoast\WP\SEO\Integrations\Integration_Interface;
7
8 /**
9 * Adds the Wincher integration.
10 */
11 class Wincher implements Integration_Interface {
12
13 /**
14 * Initializes the integration.
15 *
16 * @return void
17 */
18 public function register_hooks() {
19 /**
20 * Called by Yoast_Integration_Toggles to add extra toggles to the ones defined there.
21 */
22 \add_filter( 'wpseo_integration_toggles', [ $this, 'add_integration_toggle' ] );
23 /**
24 * Called in dashboard/integrations.php to put additional content after the toggle.
25 */
26 \add_action( 'Yoast\WP\SEO\admin_integration_after', [ $this, 'load_toggle_additional_content' ] );
27 }
28
29 /**
30 * Returns the conditionals based in which this loadable should be active.
31 *
32 * @return array The conditionals.
33 */
34 public static function get_conditionals() {
35 return [ Wincher_Conditional::class ];
36 }
37
38 /**
39 * Adds the Wincher integration toggle to the array.
40 *
41 * @param array $integration_toggles The integration toggles array.
42 *
43 * @return array The updated integration toggles array.
44 */
45 public function add_integration_toggle( $integration_toggles ) {
46 if ( \is_array( $integration_toggles ) ) {
47 $integration_toggles[] = (object) [
48 /* translators: %s: 'Wincher' */
49 'name' => \sprintf( \__( '%s integration', 'wordpress-seo' ), 'Wincher' ),
50 'setting' => 'wincher_integration_active',
51 'label' => \sprintf(
52 /* translators: %s: 'Wincher' */
53 \__( 'The %s integration offers the option to track specific keyphrases and gain insights in their positions.', 'wordpress-seo' ),
54 'Wincher'
55 ),
56 'order' => 11,
57 ];
58 }
59
60 return $integration_toggles;
61 }
62
63 /**
64 * Loads additional content for the passed integration.
65 *
66 * @param Object $integration The integration object.
67 *
68 * @return void
69 */
70 public function load_toggle_additional_content( $integration ) {
71 switch ( $integration->setting ) {
72 case 'wincher_integration_active':
73 require WPSEO_PATH . 'admin/views/tabs/metas/paper-content/integrations/wincher.php';
74 break;
75 default:
76 break;
77 }
78 }
79 }
80