diff --git a/config/dependency-injection/deprecated-classes.php b/config/dependency-injection/deprecated-classes.php index 0a20094b0f6..f731d54932b 100644 --- a/config/dependency-injection/deprecated-classes.php +++ b/config/dependency-injection/deprecated-classes.php @@ -35,6 +35,8 @@ use Yoast\WP\SEO\Integrations\Schema_Blocks; use Yoast\WP\SEO\Integrations\Third_Party\CoAuthors_Plus; use Yoast\WP\SEO\Integrations\Third_Party\The_Events_Calendar; +use Yoast\WP\SEO\Integrations\Third_Party\Wincher; +use Yoast\WP\SEO\Integrations\Third_Party\Wordproof_Integration_Toggle; use Yoast\WP\SEO\Routes\Indexables_Page_Route; use Yoast\WP\SEO\Schema_Templates\Assets\Icons; @@ -56,6 +58,8 @@ Schema_Blocks::class => '20.5', Icons::class => '20.5', Old_Premium_Integration::class => '20.10', + Wincher::class => '21.6', + Wordproof_Integration_Toggle::class => '21.6', ]; foreach ( $deprecated_classes as $original_class => $version ) { diff --git a/packages/js/src/initializers/admin.js b/packages/js/src/initializers/admin.js index a9397b37062..2b329b414f5 100644 --- a/packages/js/src/initializers/admin.js +++ b/packages/js/src/initializers/admin.js @@ -313,14 +313,6 @@ export default function initAdmin( jQuery ) { } } ).trigger( "change" ); - // Toggle the Wincher section. - jQuery( "#wincher_integration_active input[type='radio']" ).on( "change", function() { - // The value on is enabled, off is disabled. - if ( jQuery( this ).is( ":checked" ) ) { - jQuery( "#wincher-connection" ).toggle( jQuery( this ).val() === "on" ); - } - } ).trigger( "change" ); - // Handle the settings pages tabs. jQuery( "#wpseo-tabs" ).find( "a" ).on( "click", function( event ) { var canChangeTab = true; diff --git a/src/integrations/third-party/wincher.php b/src/deprecated/src/integrations/third-party/wincher.php similarity index 53% rename from src/integrations/third-party/wincher.php rename to src/deprecated/src/integrations/third-party/wincher.php index 6ce08e9f323..a9f09d493a1 100644 --- a/src/integrations/third-party/wincher.php +++ b/src/deprecated/src/integrations/third-party/wincher.php @@ -9,6 +9,9 @@ /** * Adds the Wincher integration. + * + * @deprecated 21.6 + * @codeCoverageIgnore */ class Wincher implements Integration_Interface { @@ -22,6 +25,9 @@ class Wincher implements Integration_Interface { /** * The Wincher integration toggle constructor. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @param Wincher_Helper $wincher The Wincher helper instance. */ public function __construct( Wincher_Helper $wincher ) { @@ -31,23 +37,21 @@ public function __construct( Wincher_Helper $wincher ) { /** * Initializes the integration. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @return void */ public function register_hooks() { - /** - * Called by Yoast_Integration_Toggles to add extra toggles to the ones defined there. - */ - \add_filter( 'wpseo_integration_toggles', [ $this, 'add_integration_toggle' ] ); - - /** - * Add extra text after the network integration toggle if the toggle is disabled. - */ - \add_action( 'Yoast\WP\SEO\admin_network_integration_after', [ $this, 'after_network_integration_toggle' ] ); + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); } /** * Returns the conditionals based in which this loadable should be active. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @return array The conditionals. */ public static function get_conditionals() { @@ -57,25 +61,15 @@ public static function get_conditionals() { /** * Adds the Wincher integration toggle to the $integration_toggles array. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @param array $integration_toggles The integration toggles array. * * @return array The updated integration toggles array. */ public function add_integration_toggle( $integration_toggles ) { - if ( \is_array( $integration_toggles ) ) { - $integration_toggles[] = (object) [ - /* translators: %s: 'Wincher' */ - 'name' => \sprintf( \__( '%s integration', 'wordpress-seo' ), 'Wincher' ), - 'setting' => 'wincher_integration_active', - 'label' => \sprintf( - /* translators: %s: 'Wincher' */ - \__( 'The %s integration offers the option to track specific keyphrases and gain insights in their positions.', 'wordpress-seo' ), - 'Wincher' - ), - 'order' => 11, - 'disabled' => \is_multisite(), - ]; - } + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); return $integration_toggles; } @@ -83,43 +77,24 @@ public function add_integration_toggle( $integration_toggles ) { /** * Adds the disabled note when the integration toggle is disabled. * - * @deprecated 20.3 + * @deprecated 21.6 * @codeCoverageIgnore * * @param Yoast_Feature_Toggle $integration The integration toggle class. */ public function after_integration_toggle( $integration ) { - \_deprecated_function( __METHOD__, 'Yoast SEO 20.3' ); - if ( $integration->setting === 'wincher_integration_active' ) { - if ( \is_multisite() ) { - $this->get_disabled_note(); - } - } + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); } /** * Adds the disabled note to the network integration toggle. * - * @param Yoast_Feature_Toggle $integration The integration toggle class. - */ - public function after_network_integration_toggle( $integration ) { - if ( $integration->setting === 'wincher_integration_active' ) { - $this->get_disabled_note(); - } - } - - /** - * Outputs the disabled note. - * + * @deprecated 21.6 * @codeCoverageIgnore * - * @return void + * @param Yoast_Feature_Toggle $integration The integration toggle class. */ - protected function get_disabled_note() { - echo '
', \sprintf( - /* translators: %s expands to Wincher */ - \esc_html__( 'Currently, the %s integration is not available for multisites.', 'wordpress-seo' ), - 'Wincher' - ), '
'; + public function after_network_integration_toggle( $integration ) { + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); } } diff --git a/src/integrations/third-party/wordproof-integration-toggle.php b/src/deprecated/src/integrations/third-party/wordproof-integration-toggle.php similarity index 63% rename from src/integrations/third-party/wordproof-integration-toggle.php rename to src/deprecated/src/integrations/third-party/wordproof-integration-toggle.php index d352e7f9045..7c8074f5cb9 100644 --- a/src/integrations/third-party/wordproof-integration-toggle.php +++ b/src/deprecated/src/integrations/third-party/wordproof-integration-toggle.php @@ -10,6 +10,9 @@ /** * Class WordProofIntegrationToggle. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @package Yoast\WP\SEO\Integrations\Third_Party */ class Wordproof_Integration_Toggle implements Integration_Interface { @@ -24,6 +27,9 @@ class Wordproof_Integration_Toggle implements Integration_Interface { /** * The WordProof integration toggle constructor. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @param Wordproof_Helper $wordproof The WordProof helper instance. */ public function __construct( Wordproof_Helper $wordproof ) { @@ -33,6 +39,9 @@ public function __construct( Wordproof_Helper $wordproof ) { /** * Returns the conditionals based in which this loadable should be active. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @return array */ public static function get_conditionals() { @@ -44,51 +53,27 @@ public static function get_conditionals() { * * This is the place to register hooks and filters. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @return void */ public function register_hooks() { - /** - * Called by Yoast_Integration_Toggles to add extra toggles to the ones defined there. - */ - \add_filter( 'wpseo_integration_toggles', [ $this, 'add_integration_toggle' ] ); - - /** - * Update the default wordproof_integration_active depending if the integration is disabled or not. - */ - \add_filter( 'wpseo_option_wpseo_defaults', [ $this, 'default_values' ] ); - - /** - * Add extra text after the network integration toggle if the toggle is disabled. - */ - \add_action( 'Yoast\WP\SEO\admin_network_integration_after', [ $this, 'after_network_integration_toggle' ] ); + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); } /** * Adds the WordProof integration toggle to the array. * + * @deprecated 21.6 + * @codeCoverageIgnore + * * @param array $integration_toggles The integration toggles array. * * @return array The updated integration toggles array. */ public function add_integration_toggle( $integration_toggles ) { - if ( \is_array( $integration_toggles ) ) { - $integration_toggles[] = (object) [ - /* translators: %s expands to WordProof */ - 'name' => \sprintf( \__( '%s integration', 'wordpress-seo' ), 'WordProof' ), - 'setting' => 'wordproof_integration_active', - 'label' => \sprintf( - /* translators: %s expands to WordProof */ - \__( '%1$s can be used to timestamp your privacy page.', 'wordpress-seo' ), - 'WordProof' - ), - /* translators: %s expands to WordProof */ - 'read_more_label' => \sprintf( \__( 'Read more about how %s works.', 'wordpress-seo' ), 'WordProof ' ), - 'read_more_url' => 'https://yoa.st/wordproof-integration', - 'order' => 16, - 'disabled' => $this->wordproof->integration_is_disabled(), - 'new' => true, - ]; - } + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); return $integration_toggles; } @@ -144,14 +129,6 @@ public function after_integration_toggle( $integration ) { * @param Yoast_Feature_Toggle $integration The integration toggle class. */ public function after_network_integration_toggle( $integration ) { - if ( $integration->setting === 'wordproof_integration_active' ) { - if ( $integration->disabled ) { - echo '' . \sprintf( - /* translators: %s expands to WordProof */ - \esc_html__( 'Currently, the %s integration is not available for multisites.', 'wordpress-seo' ), - 'WordProof' - ) . '
'; - } - } + \_deprecated_function( __METHOD__, 'Yoast SEO 21.6' ); } } diff --git a/tests/unit/integrations/third-party/wincher-test.php b/tests/unit/integrations/third-party/wincher-test.php deleted file mode 100644 index 0d2308f2ac7..00000000000 --- a/tests/unit/integrations/third-party/wincher-test.php +++ /dev/null @@ -1,168 +0,0 @@ -stubEscapeFunctions(); - $this->stubTranslationFunctions(); - - $this->wincher = Mockery::mock( Wincher_Helper::class ); - $this->instance = Mockery::mock( Wincher::class, [ $this->wincher ] ) - ->makePartial() - ->shouldAllowMockingProtectedMethods(); - } - - /** - * Tests if given dependencies are set as expected. - * - * @covers ::__construct - */ - public function test_constructor() { - $this->assertInstanceOf( Wincher::class, $this->instance ); - $this->assertInstanceOf( - Wincher_Helper::class, - $this->getPropertyValue( $this->instance, 'wincher' ) - ); - } - - /** - * Tests if the expected conditionals are in place. - * - * @covers ::get_conditionals - */ - public function test_get_conditionals() { - $this->assertEquals( - [ - Admin_Conditional::class, - ], - Wincher::get_conditionals() - ); - } - - /** - * Tests the registration of the hooks. - * - * @covers ::register_hooks - */ - public function test_register_hooks() { - $this->instance->register_hooks(); - - $this->assertNotFalse( Monkey\Filters\has( 'wpseo_integration_toggles', [ $this->instance, 'add_integration_toggle' ] ) ); - } - - /** - * Tests the add_integration_toggle request function. - * - * @covers ::add_integration_toggle - */ - public function test_add_integration_toggle() { - $result = $this->instance->add_integration_toggle( $this->get_integration_toggles() ); - $this->assertEquals( - (object) [ - 'name' => 'Wincher integration', - 'setting' => 'wincher_integration_active', - 'label' => 'The Wincher integration offers the option to track specific keyphrases and gain insights in their positions.', - 'order' => 11, - 'disabled' => false, - ], - $result[2] - ); - } - - /** - * Tests the disabled add_integration_toggle request function. - * - * @covers ::add_integration_toggle - */ - public function test_add_integration_toggle_disabled() { - Monkey\Functions\stubs( [ 'is_multisite' => true ] ); - - $result = $this->instance->add_integration_toggle( $this->get_integration_toggles() ); - $this->assertEquals( - (object) [ - 'name' => 'Wincher integration', - 'setting' => 'wincher_integration_active', - 'label' => 'The Wincher integration offers the option to track specific keyphrases and gain insights in their positions.', - 'order' => 11, - 'disabled' => true, - ], - $result[2] - ); - } - - /** - * Tests the after_network_integration_toggle method. - * - * @covers ::after_network_integration_toggle - */ - public function test_after_network_integration_toggle() { - - $wincher_integration_toggle = (object) [ - 'setting' => 'wincher_integration_active', - 'disabled' => true, - ]; - - $this->instance->expects( 'get_disabled_note' )->once(); - - $this->instance->after_network_integration_toggle( $wincher_integration_toggle ); - } - - /** - * The integration toggles to test with. - * - * @return array The integration toggles. - */ - private function get_integration_toggles() { - return [ - (object) [ - 'name' => 'Semrush integration', - 'setting' => 'semrush_integration_active', - 'label' => 'The Semrush integration offers suggestions and insights for keywords related to the entered focus keyphrase.', - 'order' => 10, - ], - (object) [ - 'name' => 'Ryte integration', - 'setting' => 'ryte_indexability', - 'label' => 'Ryte will check weekly if your site is still indexable by search engines and Yoast SEO will notify you when this is not the case.', - 'read_more_label' => 'Read more about how Ryte works.', - 'read_more_url' => 'https://yoa.st/2an', - 'order' => 15, - ], - ]; - } -}