• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / 5066322038

pending completion
5066322038

push

github

GitHub
Merge pull request #20316 from Yoast/JRF/ghactions-run-more-selectively

2550 of 29012 relevant lines covered (8.79%)

0.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/integrations/third-party/wincher.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations\Third_Party;
4

5
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
6
use Yoast\WP\SEO\Helpers\Wincher_Helper;
7
use Yoast\WP\SEO\Integrations\Integration_Interface;
8
use Yoast_Feature_Toggle;
9

10
/**
11
 * Adds the Wincher integration.
12
 */
13
class Wincher implements Integration_Interface {
14

15
        /**
16
         * The Wincher helper instance.
17
         *
18
         * @var Wincher_Helper
19
         */
20
        protected $wincher;
21

22
        /**
23
         * The Wincher integration toggle constructor.
24
         *
25
         * @param Wincher_Helper $wincher The Wincher helper instance.
26
         */
27
        public function __construct( Wincher_Helper $wincher ) {
28
                $this->wincher = $wincher;
×
29
        }
30

31
        /**
32
         * Initializes the integration.
33
         *
34
         * @return void
35
         */
36
        public function register_hooks() {
37
                /**
38
                 * Called by Yoast_Integration_Toggles to add extra toggles to the ones defined there.
39
                 */
40
                \add_filter( 'wpseo_integration_toggles', [ $this, 'add_integration_toggle' ] );
×
41

42
                /**
43
                 * Add extra text after the network integration toggle if the toggle is disabled.
44
                 */
45
                \add_action( 'Yoast\WP\SEO\admin_network_integration_after', [ $this, 'after_network_integration_toggle' ] );
×
46
        }
47

48
        /**
49
         * Returns the conditionals based in which this loadable should be active.
50
         *
51
         * @return array The conditionals.
52
         */
53
        public static function get_conditionals() {
54
                return [ Admin_Conditional::class ];
×
55
        }
56

57
        /**
58
         * Adds the Wincher integration toggle to the $integration_toggles array.
59
         *
60
         * @param array $integration_toggles The integration toggles array.
61
         *
62
         * @return array The updated integration toggles array.
63
         */
64
        public function add_integration_toggle( $integration_toggles ) {
65
                if ( \is_array( $integration_toggles ) ) {
×
66
                        $integration_toggles[] = (object) [
×
67
                                /* translators: %s: 'Wincher' */
68
                                'name'     => \sprintf( \__( '%s integration', 'wordpress-seo' ), 'Wincher' ),
×
69
                                'setting'  => 'wincher_integration_active',
×
70
                                'label'    => \sprintf(
×
71
                                /* translators: %s: 'Wincher' */
72
                                        \__( 'The %s integration offers the option to track specific keyphrases and gain insights in their positions.', 'wordpress-seo' ),
×
73
                                        'Wincher'
×
74
                                ),
×
75
                                'order'    => 11,
×
76
                                'disabled' => \is_multisite(),
×
77
                        ];
×
78
                }
79

80
                return $integration_toggles;
×
81
        }
82

83
        /**
84
         * Adds the disabled note when the integration toggle is disabled.
85
         *
86
         * @deprecated 20.3
87
         * @codeCoverageIgnore
88
         *
89
         * @param Yoast_Feature_Toggle $integration The integration toggle class.
90
         */
91
        public function after_integration_toggle( $integration ) {
92
                \_deprecated_function( __METHOD__, 'Yoast SEO 20.3' );
93
                if ( $integration->setting === 'wincher_integration_active' ) {
94
                        if ( \is_multisite() ) {
95
                                $this->get_disabled_note();
96
                        }
97
                }
98
        }
99

100
        /**
101
         * Adds the disabled note to the network integration toggle.
102
         *
103
         * @param Yoast_Feature_Toggle $integration The integration toggle class.
104
         */
105
        public function after_network_integration_toggle( $integration ) {
106
                if ( $integration->setting === 'wincher_integration_active' ) {
×
107
                        $this->get_disabled_note();
×
108
                }
109
        }
110

111
        /**
112
         * Outputs the disabled note.
113
         *
114
         * @codeCoverageIgnore
115
         *
116
         * @return void
117
         */
118
        protected function get_disabled_note() {
119
                echo '<p>', \sprintf(
120
                /* translators: %s expands to Wincher */
121
                        \esc_html__( 'Currently, the %s integration is not available for multisites.', 'wordpress-seo' ),
122
                        'Wincher'
123
                ), '</p>';
124
        }
125
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc