rebase code on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:51:46 -04:00
parent b16ad94b69
commit 8f1a2c3a66
2197 changed files with 184921 additions and 35568 deletions

View File

@@ -552,19 +552,6 @@ class WPSEO_Admin_Asset_Manager {
'wp-components',
],
],
[
'name' => 'ai-generator',
'src' => 'ai-generator-' . $flat_version,
'deps' => [
self::PREFIX . 'tailwind',
self::PREFIX . 'introductions',
],
],
[
'name' => 'introductions',
'src' => 'introductions-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'wp-dashboard',
'src' => 'dashboard-' . $flat_version,
@@ -619,17 +606,14 @@ class WPSEO_Admin_Asset_Manager {
[
'name' => 'new-settings',
'src' => 'new-settings-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'academy',
'src' => 'academy-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'support',
'src' => 'support-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'workouts',
@@ -638,15 +622,14 @@ class WPSEO_Admin_Asset_Manager {
self::PREFIX . 'monorepo',
],
],
[
'name' => 'first-time-configuration',
'src' => 'first-time-configuration-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'inside-editor',
'src' => 'inside-editor-' . $flat_version,
],
[
'name' => 'editor',
'src' => 'editor-' . $flat_version,
],
];
}

View File

@@ -0,0 +1,78 @@
<?php
/**
* WPSEO plugin file.
*
* @package WPSEO\Admin
*/
/**
* Localizes JavaScript files.
*
* @codeCoverageIgnore
* @deprecated 18.0
*/
final class WPSEO_Admin_Asset_Yoast_Components_L10n {
/**
* Represents the asset manager.
*
* @var WPSEO_Admin_Asset_Manager
*/
protected $asset_manager;
/**
* WPSEO_Admin_Asset_Yoast_Components_L10n constructor.
*
* @codeCoverageIgnore
* @deprecated 18.0
*/
public function __construct() {
_deprecated_constructor( __CLASS__, '18.0' );
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
}
/**
* Localizes the given script with the JavaScript translations.
*
* @codeCoverageIgnore
* @deprecated 18.0
*
* @param string $script_handle The script handle to localize for.
*
* @return void
*/
public function localize_script( $script_handle ) {
_deprecated_function( __FUNCTION__, '18.0' );
$translations = [
'yoast-components' => $this->get_translations( 'yoast-components' ),
'wordpress-seo' => $this->get_translations( 'wordpress-seojs' ),
'yoast-schema-blocks' => $this->get_translations( 'yoast-schema-blocks' ),
];
$this->asset_manager->localize_script( $script_handle, 'wpseoYoastJSL10n', $translations );
}
/**
* Returns translations necessary for JS files.
*
* @codeCoverageIgnore
* @deprecated 18.0
*
* @param string $component The component to retrieve the translations for.
* @return object|null The translations in a Jed format for JS files.
*/
protected function get_translations( $component ) {
_deprecated_function( __FUNCTION__, '18.0' );
$locale = \get_user_locale();
$file = WPSEO_PATH . 'languages/' . $component . '-' . $locale . '.json';
if ( file_exists( $file ) ) {
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
$file = file_get_contents( $file );
if ( is_string( $file ) && $file !== '' ) {
return json_decode( $file, true );
}
}
return null;
}
}

View File

@@ -8,7 +8,6 @@
use Yoast\WP\SEO\Integrations\Academy_Integration;
use Yoast\WP\SEO\Integrations\Settings_Integration;
use Yoast\WP\SEO\Integrations\Support_Integration;
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
/**
* Class WPSEO_Admin_Pages.
@@ -36,7 +35,6 @@ class WPSEO_Admin_Pages {
*/
public function __construct() {
add_action( 'init', [ $this, 'init' ], 20 );
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
}
@@ -81,20 +79,16 @@ class WPSEO_Admin_Pages {
wp_enqueue_script( 'dashboard' );
wp_enqueue_script( 'thickbox' );
$alert_dismissal_action = YoastSEO()->classes->get( \Yoast\WP\SEO\Actions\Alert_Dismissal_Action::class );
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
$woocommerce_conditional = new WooCommerce_Conditional();
$alert_dismissal_action = YoastSEO()->classes->get( \Yoast\WP\SEO\Actions\Alert_Dismissal_Action::class );
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
$script_data = [
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
'dismissedAlerts' => $dismissed_alerts,
'isRtl' => is_rtl(),
'isPremium' => YoastSEO()->helpers->product->is_premium(),
'isWooCommerceActive' => $woocommerce_conditional->is_met(),
'webinarIntroSettingsUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-settings' ),
'blackFridayBlockEditorUrl' => ( YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->is( 'black_friday_2023_checklist' ) ) ? WPSEO_Shortlinker::get( 'https://yoa.st/black-friday-checklist' ) : '',
'webinarIntroFirstTimeConfigUrl' => $this->get_webinar_shortlink(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
];
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.

View File

@@ -28,7 +28,7 @@ class WPSEO_Expose_Shortlinks implements WPSEO_WordPress_Integration {
'shortlinks.nofollow_sponsored' => 'https://yoa.st/nofollow-sponsored',
'shortlinks.snippet_preview_info' => 'https://yoa.st/snippet-preview',
'shortlinks.cornerstone_content_info' => 'https://yoa.st/1i9',
'shortlinks.upsell.social_preview.social' => 'https://yoa.st/social-preview-facebook',
'shortlinks.upsell.social_preview.facebook' => 'https://yoa.st/social-preview-facebook',
'shortlinks.upsell.social_preview.twitter' => 'https://yoa.st/social-preview-twitter',
'shortlinks.upsell.sidebar.news' => 'https://yoa.st/get-news-sidebar',
'shortlinks.upsell.sidebar.focus_keyword_synonyms_link' => 'https://yoa.st/textlink-synonyms-popup-sidebar',

View File

@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
*
* @var string
*/
const CURRENT_RELEASE = '16.7.0';
const CURRENT_RELEASE = '16.3.0';
/**
* The minimally supported version of Gutenberg by the plugin.
*
* @var string
*/
const MINIMUM_SUPPORTED = '16.7.0';
const MINIMUM_SUPPORTED = '16.3.0';
/**
* Holds the current version.

View File

@@ -51,12 +51,10 @@ class WPSEO_Premium_Upsell_Admin_Block {
$url = WPSEO_Shortlinker::get( 'https://yoa.st/17h' );
$arguments = [
'<strong>' . esc_html__( 'Use AI', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Quickly create titles & meta descriptions', 'wordpress-seo' ),
'<strong>' . esc_html__( 'Multiple keyphrases', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Increase your SEO reach', 'wordpress-seo' ),
'<strong>' . esc_html__( 'No more dead links', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Easy redirect manager', 'wordpress-seo' ),
'<strong>' . esc_html__( 'Superfast internal linking suggestions', 'wordpress-seo' ) . '</strong>',
'<strong>' . esc_html__( 'Social media preview', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Facebook & Twitter', 'wordpress-seo' ),
'<strong>' . esc_html__( 'Multiple keyphrases', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Increase your SEO reach', 'wordpress-seo' ),
'<strong>' . esc_html__( 'SEO Workouts', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Get guided in routine SEO tasks', 'wordpress-seo' ),
'<strong>' . esc_html__( '24/7 email support', 'wordpress-seo' ) . '</strong>',
'<strong>' . esc_html__( 'No ads!', 'wordpress-seo' ) . '</strong>',
];

View File

@@ -9,7 +9,6 @@ use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
use Yoast\WP\SEO\Conditionals\Third_Party\Jetpack_Boost_Active_Conditional;
use Yoast\WP\SEO\Conditionals\Third_Party\Jetpack_Boost_Not_Premium_Conditional;
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
use Yoast\WP\SEO\Introductions\Infrastructure\Wistia_Embed_Permission_Repository;
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
use Yoast\WP\SEO\Presenters\Admin\Meta_Fields_Presenter;
@@ -866,7 +865,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
$asset_manager->enqueue_style( 'scoring' );
$asset_manager->enqueue_style( 'monorepo' );
$asset_manager->enqueue_style( 'tailwind' );
$asset_manager->enqueue_style( 'ai-generator' );
$is_block_editor = WP_Screen::get()->is_block_editor();
$post_edit_handle = 'post-edit';
@@ -923,24 +921,16 @@ class WPSEO_Metabox extends WPSEO_Meta {
'isBlockEditor' => $is_block_editor,
'postId' => $post_id,
'postStatus' => get_post_status( $post_id ),
'postType' => get_post_type( $post_id ),
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage-and-post-types' ),
'analysis' => [
'plugins' => $plugins_script_data,
'worker' => $worker_script_data,
],
'dismissedAlerts' => $dismissed_alerts,
'currentPromotions' => YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->get_current_promotions(),
'webinarIntroBlockEditorUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-block-editor' ),
'blackFridayBlockEditorUrl' => ( YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->is( 'black_friday_2023_checklist' ) ) ? WPSEO_Shortlinker::get( 'https://yoa.st/black-friday-checklist' ) : '',
'isJetpackBoostActive' => ( $is_block_editor ) ? YoastSEO()->classes->get( Jetpack_Boost_Active_Conditional::class )->is_met() : false,
'isJetpackBoostNotPremium' => ( $is_block_editor ) ? YoastSEO()->classes->get( Jetpack_Boost_Not_Premium_Conditional::class )->is_met() : false,
'isWooCommerceActive' => $woocommerce_active,
'woocommerceUpsell' => get_post_type( $post_id ) === 'product' && ! $woocommerce_seo_active && $woocommerce_active,
'isWooCommerceActive' => $woocommerce_active,
'linkParams' => WPSEO_Shortlinker::get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => YoastSEO()->classes->get( Wistia_Embed_Permission_Repository::class )->get_value_for_user( \get_current_user_id() ),
];
if ( post_type_supports( get_post_type(), 'thumbnail' ) ) {

View File

@@ -144,7 +144,6 @@ class WPSEO_Taxonomy {
$asset_manager->enqueue_style( 'metabox-css' );
$asset_manager->enqueue_style( 'scoring' );
$asset_manager->enqueue_style( 'tailwind' );
$asset_manager->enqueue_script( 'term-edit' );
/**
@@ -181,7 +180,6 @@ class WPSEO_Taxonomy {
'isTerm' => true,
'postId' => $tag_id,
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage' ),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
];
$asset_manager->localize_script( 'term-edit', 'wpseoScriptData', $script_data );
$asset_manager->enqueue_user_language_script();

View File

@@ -192,7 +192,6 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
'enable_metabox_insights',
'enable_link_suggestions',
'enable_index_now',
'enable_ai_generator',
'workouts',
'wincher_integration_active',
'wincher_tokens',

View File

@@ -202,17 +202,6 @@ class Yoast_Feature_Toggles {
'premium_upsell_url' => 'https://yoa.st/get-indexnow',
'order' => 110,
],
(object) [
'name' => __( 'AI title & description generator', 'wordpress-seo' ),
'premium' => true,
'setting' => 'enable_ai_generator',
'label' => __( 'Use the power of Yoast AI to automatically generate compelling titles and descriptions for your posts and pages.', 'wordpress-seo' ),
'read_more_label' => __( 'Learn more', 'wordpress-seo' ),
'read_more_url' => 'https://yoa.st/ai-generator-read-more',
'premium_url' => 'https://yoa.st/ai-generator-feature',
'premium_upsell_url' => 'https://yoa.st/get-ai-generator',
'order' => 115,
],
];
/**

View File

@@ -150,10 +150,6 @@ $new_tab_message = sprintf(
if ( ! $has_valid_premium_subscription ) :
?>
<ul class="yoast-seo-premium-benefits yoast-list--usp">
<li class="yoast-seo-premium-benefits__item">
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Be more efficient in creating content', 'wordpress-seo' ); ?></span>
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Use AI to create high-quality titles and meta descriptions for posts and pages', 'wordpress-seo' ); ?></span>
</li>
<li class="yoast-seo-premium-benefits__item">
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Reach bigger audiences', 'wordpress-seo' ); ?></span>
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Optimize a single post for synonyms and related keyphrases and get extra checks with the Premium SEO analysis', 'wordpress-seo' ); ?></span>

View File

@@ -39,6 +39,6 @@ $wpseo_contributors_phrase = sprintf(
<div class="tab-block">
<h2><?php esc_html_e( 'Credits', 'wordpress-seo' ); ?></h2>
<p>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/yoast-seo-credits' ); ?>" target="_blank"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/yoast-seo-credits' ); ?>"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
</p>
</div>

View File

@@ -50,7 +50,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
}
/**
* Shows a message when a post is about to get trashed.
* Shows an message when a post is about to get trashed.
*
* @param int $post_id The current post ID.
*
@@ -61,17 +61,15 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
return;
}
$post_label = $this->get_post_type_label( get_post_type( $post_id ) );
/* translators: %1$s expands to the translated name of the post type. */
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $post_label );
$message = $this->get_message( $first_sentence, 'trashed', $post_label );
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
$message = $this->get_message( $first_sentence );
$this->add_notification( $message );
}
/**
* Shows a message when a post is about to get trashed.
* Shows an message when a post is about to get trashed.
*
* @param int $post_id The current post ID.
*
@@ -82,11 +80,9 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
return;
}
$post_label = $this->get_post_type_label( get_post_type( $post_id ) );
/* translators: %1$s expands to the translated name of the post type. */
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_label );
$message = $this->get_message( $first_sentence, 'deleted', $post_label );
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
$message = $this->get_message( $first_sentence );
$this->add_notification( $message );
}
@@ -102,13 +98,15 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
if ( ! $this->is_term_viewable( $term_taxonomy_id ) ) {
return;
}
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
$term_label = $this->get_taxonomy_label_for_term( $term->term_id );
$first_sentence = sprintf(
/* translators: 1: term label */
__( 'You just deleted a %1$s.', 'wordpress-seo' ),
$this->get_taxonomy_label_for_term( $term->term_id )
);
/* translators: %1$s expands to the translated name of the term. */
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $term_label );
$message = $this->get_message( $first_sentence, 'deleted', $term_label );
$message = $this->get_message( $first_sentence );
$this->add_notification( $message );
}
@@ -209,17 +207,14 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
* Returns the message around changed URLs.
*
* @param string $first_sentence The first sentence of the notification.
* @param string $action The action performed, either "deleted" or "trashed".
* @param string $object_label The label of the object that was deleted or trashed.
*
* @return string The full notification.
*/
protected function get_message( $first_sentence, $action, $object_label ) {
protected function get_message( $first_sentence ) {
return '<h2>' . __( 'Make sure you don\'t miss out on traffic!', 'wordpress-seo' ) . '</h2>'
. '<p>'
. $first_sentence
/* translators: %1$s expands to either "deleted" or "trashed". %2$s expands to the name of the post or term. */
. ' ' . sprintf( __( 'Search engines and other websites can still send traffic to your %1$s %2$s.', 'wordpress-seo' ), $action, $object_label )
. ' ' . __( 'Search engines and other websites can still send traffic to your deleted post.', 'wordpress-seo' )
. ' ' . __( 'You should create a redirect to ensure your visitors do not get a 404 error when they click on the no longer working URL.', 'wordpress-seo' )
/* translators: %s expands to Yoast SEO Premium */
. ' ' . sprintf( __( 'With %s, you can easily create such redirects.', 'wordpress-seo' ), 'Yoast SEO Premium' )