rebase from live enviornment
This commit is contained in:
@@ -434,7 +434,8 @@ class Elementor implements Integration_Interface {
|
||||
'has_taxonomies' => $this->current_post_type_has_taxonomies(),
|
||||
],
|
||||
'shortcodes' => [
|
||||
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
|
||||
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
|
||||
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Third_Party;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Wincher_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast_Feature_Toggle;
|
||||
|
||||
/**
|
||||
* Adds the Wincher integration.
|
||||
*/
|
||||
class Wincher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The Wincher helper instance.
|
||||
*
|
||||
* @var Wincher_Helper
|
||||
*/
|
||||
protected $wincher;
|
||||
|
||||
/**
|
||||
* The Wincher integration toggle constructor.
|
||||
*
|
||||
* @param Wincher_Helper $wincher The Wincher helper instance.
|
||||
*/
|
||||
public function __construct( Wincher_Helper $wincher ) {
|
||||
$this->wincher = $wincher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* @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' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @return array The conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
return [ Admin_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the Wincher integration toggle to the $integration_toggles array.
|
||||
*
|
||||
* @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(),
|
||||
];
|
||||
}
|
||||
|
||||
return $integration_toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the disabled note when the integration toggle is disabled.
|
||||
*
|
||||
* @deprecated 20.3
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function get_disabled_note() {
|
||||
echo '<p>', \sprintf(
|
||||
/* translators: %s expands to Wincher */
|
||||
\esc_html__( 'Currently, the %s integration is not available for multisites.', 'wordpress-seo' ),
|
||||
'Wincher'
|
||||
), '</p>';
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Third_Party;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Wordproof_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast_Feature_Toggle;
|
||||
|
||||
/**
|
||||
* Class WordProofIntegrationToggle.
|
||||
*
|
||||
* @package Yoast\WP\SEO\Integrations\Third_Party
|
||||
*/
|
||||
class Wordproof_Integration_Toggle implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The WordProof helper instance.
|
||||
*
|
||||
* @var Wordproof_Helper
|
||||
*/
|
||||
protected $wordproof;
|
||||
|
||||
/**
|
||||
* The WordProof integration toggle constructor.
|
||||
*
|
||||
* @param Wordproof_Helper $wordproof The WordProof helper instance.
|
||||
*/
|
||||
public function __construct( Wordproof_Helper $wordproof ) {
|
||||
$this->wordproof = $wordproof;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
return [ Admin_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @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' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the WordProof integration toggle to the array.
|
||||
*
|
||||
* @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,
|
||||
];
|
||||
}
|
||||
|
||||
return $integration_toggles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default WordProof integration option value depending if the integration is disabled or not.
|
||||
*
|
||||
* @param array $defaults Array containing default wpseo options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function default_values( $defaults ) {
|
||||
if ( $this->wordproof->integration_is_disabled() ) {
|
||||
$defaults['wordproof_integration_active'] = false;
|
||||
}
|
||||
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an explainer when the integration toggle is disabled.
|
||||
*
|
||||
* @deprecated 20.3
|
||||
* @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 === 'wordproof_integration_active' ) {
|
||||
if ( $integration->disabled ) {
|
||||
|
||||
$conditional = $this->wordproof->integration_is_disabled( true );
|
||||
|
||||
if ( $conditional === 'Non_Multisite_Conditional' ) {
|
||||
echo '<p>' . \sprintf(
|
||||
/* translators: %s expands to WordProof */
|
||||
\esc_html__( 'Currently, the %s integration is not available for multisites.', 'wordpress-seo' ),
|
||||
'WordProof'
|
||||
) . '</p>';
|
||||
}
|
||||
|
||||
if ( $conditional === 'Wordproof_Plugin_Inactive_Conditional' ) {
|
||||
echo '<p>' . \esc_html__( 'The WordProof Timestamp plugin needs to be disabled before you can activate this integration.', 'wordpress-seo' ) . '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an explainer when the network integration toggle is disabled.
|
||||
*
|
||||
* @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 '<p>' . \sprintf(
|
||||
/* translators: %s expands to WordProof */
|
||||
\esc_html__( 'Currently, the %s integration is not available for multisites.', 'wordpress-seo' ),
|
||||
'WordProof'
|
||||
) . '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Watchers;
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\Not_Admin_Ajax_Conditional;
|
||||
use Yoast\WP\SEO\Helpers\Notification_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
|
||||
use Yoast\WP\SEO\Integrations\Integration_Interface;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Woocommerce_Beta_Editor_Presenter;
|
||||
use Yoast_Notification;
|
||||
use Yoast_Notification_Center;
|
||||
|
||||
/**
|
||||
* Shows a notification for users who have Woocommerce product beta editor enabled.
|
||||
*
|
||||
* @class Woocommerce_Beta_Editor_Watcher
|
||||
*/
|
||||
class Woocommerce_Beta_Editor_Watcher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The notification ID.
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpseo-woocommerce-beta-editor-warning';
|
||||
|
||||
/**
|
||||
* The short link helper.
|
||||
*
|
||||
* @var Short_Link_Helper
|
||||
*/
|
||||
protected $short_link_helper;
|
||||
|
||||
/**
|
||||
* The Yoast notification center.
|
||||
*
|
||||
* @var Yoast_Notification_Center
|
||||
*/
|
||||
protected $notification_center;
|
||||
|
||||
/**
|
||||
* The notification helper.
|
||||
*
|
||||
* @var Notification_Helper
|
||||
*/
|
||||
protected $notification_helper;
|
||||
|
||||
/**
|
||||
* The Woocommerce beta editor presenter.
|
||||
*
|
||||
* @var Woocommerce_Beta_Editor_Presenter
|
||||
*/
|
||||
protected $presenter;
|
||||
|
||||
/**
|
||||
* Woocommerce_Beta_Editor_Watcher constructor.
|
||||
*
|
||||
* @param Yoast_Notification_Center $notification_center The notification center.
|
||||
* @param Notification_Helper $notification_helper The notification helper.
|
||||
* @param Short_Link_Helper $short_link_helper The short link helper.
|
||||
*/
|
||||
public function __construct(
|
||||
Yoast_Notification_Center $notification_center,
|
||||
Notification_Helper $notification_helper,
|
||||
Short_Link_Helper $short_link_helper
|
||||
) {
|
||||
$this->notification_center = $notification_center;
|
||||
$this->notification_helper = $notification_helper;
|
||||
$this->short_link_helper = $short_link_helper;
|
||||
$this->presenter = new Woocommerce_Beta_Editor_Presenter( $this->short_link_helper );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the conditionals based on which this loadable should be active.
|
||||
*
|
||||
* @return string[] The conditionals.
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
return [ Admin_Conditional::class, Not_Admin_Ajax_Conditional::class ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* On admin_init, it is checked whether the notification about Woocommerce product beta editor enabled should be shown.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'admin_init', [ $this, 'manage_woocommerce_beta_editor_notification' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Manage the Woocommerce product beta editor notification.
|
||||
*
|
||||
* Shows the notification if needed and deletes it if needed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function manage_woocommerce_beta_editor_notification() {
|
||||
if ( \get_option( 'woocommerce_feature_product_block_editor_enabled' ) === 'yes' ) {
|
||||
$this->maybe_add_woocommerce_beta_editor_notification();
|
||||
}
|
||||
else {
|
||||
$this->notification_center->remove_notification_by_id( self::NOTIFICATION_ID );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the Woocommerce product beta editor enabled notification if it does not exist yet.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_add_woocommerce_beta_editor_notification() {
|
||||
if ( ! $this->notification_center->get_notification_by_id( self::NOTIFICATION_ID ) ) {
|
||||
$notification = $this->notification();
|
||||
$this->notification_helper->restore_notification( $notification );
|
||||
$this->notification_center->add_notification( $notification );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of the notification.
|
||||
*
|
||||
* @return Yoast_Notification The notification to show.
|
||||
*/
|
||||
protected function notification() {
|
||||
return new Yoast_Notification(
|
||||
$this->presenter->present(),
|
||||
[
|
||||
'type' => Yoast_Notification::ERROR,
|
||||
'id' => self::NOTIFICATION_ID,
|
||||
'capabilities' => 'wpseo_manage_options',
|
||||
'priority' => 1,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user