Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -549,9 +549,23 @@ class WPSEO_Admin_Asset_Manager {
'src' => 'metabox-' . $flat_version,
'deps' => [
self::PREFIX . 'admin-css',
self::PREFIX . 'tailwind',
'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,
@@ -606,14 +620,22 @@ class WPSEO_Admin_Asset_Manager {
[
'name' => 'new-settings',
'src' => 'new-settings-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'black-friday-banner',
'src' => 'black-friday-banner-' . $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',
@@ -623,12 +645,13 @@ class WPSEO_Admin_Asset_Manager {
],
],
[
'name' => 'inside-editor',
'src' => 'inside-editor-' . $flat_version,
'name' => 'first-time-configuration',
'src' => 'first-time-configuration-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'editor',
'src' => 'editor-' . $flat_version,
'name' => 'inside-editor',
'src' => 'inside-editor-' . $flat_version,
],
];
}

View File

@@ -1,78 +0,0 @@
<?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

@@ -75,6 +75,7 @@ class WPSEO_Admin_Utils {
public static function get_new_tab_message() {
return sprintf(
'<span class="screen-reader-text">%s</span>',
/* translators: Hidden accessibility text. */
esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
);
}

View File

@@ -408,6 +408,7 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
printf(
'<label for="%1$s" class="screen-reader-text">%2$s</label>',
esc_attr( 'post-type-filter-' . $instance_type ),
/* translators: Hidden accessibility text. */
esc_html__( 'Filter by content type', 'wordpress-seo' )
);
printf(
@@ -809,7 +810,7 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
$actions['edit'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
esc_url( get_edit_post_link( $rec->ID, true ) ),
/* translators: %s: post title */
/* translators: Hidden accessibility text; %s: post title. */
esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;', 'wordpress-seo' ), $title ) ),
__( 'Edit', 'wordpress-seo' )
);
@@ -821,7 +822,7 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
$actions['view'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
esc_url( add_query_arg( 'preview', 'true', get_permalink( $rec->ID ) ) ),
/* translators: %s: post title */
/* translators: Hidden accessibility text; %s: post title. */
esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;', 'wordpress-seo' ), $title ) ),
__( 'Preview', 'wordpress-seo' )
);
@@ -831,7 +832,7 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
$actions['view'] = sprintf(
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
esc_url( get_permalink( $rec->ID ) ),
/* translators: %s: post title */
/* translators: Hidden accessibility text; %s: post title. */
esc_attr( sprintf( __( 'View &#8220;%s&#8221;', 'wordpress-seo' ), $title ) ),
__( 'View', 'wordpress-seo' )
);

View File

@@ -8,6 +8,7 @@
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.
@@ -35,6 +36,7 @@ class WPSEO_Admin_Pages {
*/
public function __construct() {
add_action( 'init', [ $this, 'init' ], 20 );
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
}
@@ -79,16 +81,21 @@ 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();
$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();
$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(),
'currentPromotions' => YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->get_current_promotions(),
'webinarIntroSettingsUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-settings' ),
'webinarIntroFirstTimeConfigUrl' => $this->get_webinar_shortlink(),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
];
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.

View File

@@ -28,29 +28,27 @@ 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.facebook' => 'https://yoa.st/social-preview-facebook',
'shortlinks.upsell.social_preview.social' => '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',
'shortlinks.upsell.sidebar.focus_keyword_synonyms_button' => 'https://yoa.st/keyword-synonyms-popup-sidebar',
'shortlinks.upsell.sidebar.premium_seo_analysis_button' => 'https://yoa.st/premium-seo-analysis-sidebar',
'shortlinks.upsell.sidebar.focus_keyword_additional_link' => 'https://yoa.st/textlink-keywords-popup-sidebar',
'shortlinks.upsell.sidebar.focus_keyword_additional_button' => 'https://yoa.st/add-keywords-popup-sidebar',
'shortlinks.upsell.sidebar.additional_link' => 'https://yoa.st/textlink-keywords-sidebar',
'shortlinks.upsell.sidebar.additional_button' => 'https://yoa.st/add-keywords-sidebar',
'shortlinks.upsell.sidebar.keyphrase_distribution' => 'https://yoa.st/keyphrase-distribution-sidebar',
'shortlinks.upsell.sidebar.word_complexity' => 'https://yoa.st/word-complexity-sidebar',
'shortlinks.upsell.sidebar.internal_linking_suggestions' => 'https://yoa.st/internal-linking-suggestions-sidebar',
'shortlinks.upsell.metabox.news' => 'https://yoa.st/get-news-metabox',
'shortlinks.upsell.metabox.go_premium' => 'https://yoa.st/pe-premium-page',
'shortlinks.upsell.metabox.focus_keyword_synonyms_link' => 'https://yoa.st/textlink-synonyms-popup-metabox',
'shortlinks.upsell.metabox.focus_keyword_synonyms_button' => 'https://yoa.st/keyword-synonyms-popup',
'shortlinks.upsell.metabox.premium_seo_analysis_button' => 'https://yoa.st/premium-seo-analysis-metabox',
'shortlinks.upsell.metabox.focus_keyword_additional_link' => 'https://yoa.st/textlink-keywords-popup-metabox',
'shortlinks.upsell.metabox.focus_keyword_additional_button' => 'https://yoa.st/add-keywords-popup',
'shortlinks.upsell.metabox.additional_link' => 'https://yoa.st/textlink-keywords-metabox',
'shortlinks.upsell.metabox.additional_button' => 'https://yoa.st/add-keywords-metabox',
'shortlinks.upsell.metabox.keyphrase_distribution' => 'https://yoa.st/keyphrase-distribution-metabox',
'shortlinks.upsell.metabox.word_complexity' => 'https://yoa.st/word-complexity-metabox',
'shortlinks.upsell.metabox.internal_linking_suggestions' => 'https://yoa.st/internal-linking-suggestions-metabox',
'shortlinks.upsell.gsc.create_redirect_button' => 'https://yoa.st/redirects',
'shortlinks.readability_analysis_info' => 'https://yoa.st/readability-analysis',
'shortlinks.inclusive_language_analysis_info' => 'https://yoa.st/inclusive-language-analysis',
@@ -117,15 +115,14 @@ class WPSEO_Expose_Shortlinks implements WPSEO_WordPress_Integration {
$shortlinks = $this->shortlinks;
$shortlinks['shortlinks.upsell.metabox.focus_keyword_synonyms_link'] = 'https://yoa.st/textlink-synonyms-popup-metabox-term';
$shortlinks['shortlinks.upsell.metabox.focus_keyword_synonyms_button'] = 'https://yoa.st/keyword-synonyms-popup-term';
$shortlinks['shortlinks.upsell.metabox.focus_keyword_additional_link'] = 'https://yoa.st/textlink-keywords-popup-metabox-term';
$shortlinks['shortlinks.upsell.metabox.focus_keyword_additional_button'] = 'https://yoa.st/add-keywords-popup-term';
$shortlinks['shortlinks.upsell.metabox.additional_link'] = 'https://yoa.st/textlink-keywords-metabox-term';
$shortlinks['shortlinks.upsell.metabox.additional_button'] = 'https://yoa.st/add-keywords-metabox-term';
$shortlinks['shortlinks.upsell.sidebar.morphology_upsell_metabox'] = 'https://yoa.st/morphology-upsell-metabox-term';
$shortlinks['shortlinks.upsell.metabox.keyphrase_distribution'] = 'https://yoa.st/keyphrase-distribution-metabox-term';
$shortlinks['shortlinks.upsell.metabox.word_complexity'] = 'https://yoa.st/word-complexity-metabox-term';
$shortlinks['shortlinks.upsell.metabox.internal_linking_suggestions'] = 'https://yoa.st/internal-linking-suggestions-metabox-term';
return $shortlinks;
}

View File

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

View File

@@ -97,11 +97,19 @@ class WPSEO_Meta_Columns {
$added_columns = [];
if ( $this->analysis_seo->is_enabled() ) {
$added_columns['wpseo-score'] = '<span class="yoast-column-seo-score yoast-column-header-has-tooltip" data-tooltip-text="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="screen-reader-text">' . __( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
$added_columns['wpseo-score'] = '<span class="yoast-column-seo-score yoast-column-header-has-tooltip" data-tooltip-text="' .
esc_attr__( 'SEO score', 'wordpress-seo' ) .
'"><span class="screen-reader-text">' .
__( 'SEO score', 'wordpress-seo' ) .
'</span></span></span>';
}
if ( $this->analysis_readability->is_enabled() ) {
$added_columns['wpseo-score-readability'] = '<span class="yoast-column-readability yoast-column-header-has-tooltip" data-tooltip-text="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="screen-reader-text">' . __( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
$added_columns['wpseo-score-readability'] = '<span class="yoast-column-readability yoast-column-header-has-tooltip" data-tooltip-text="' .
esc_attr__( 'Readability score', 'wordpress-seo' ) .
'"><span class="screen-reader-text">' .
__( 'Readability score', 'wordpress-seo' ) .
'</span></span></span>';
}
$added_columns['wpseo-title'] = __( 'SEO Title', 'wordpress-seo' );
@@ -154,6 +162,7 @@ class WPSEO_Meta_Columns {
}
if ( $metadesc_val === '' ) {
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">',
/* translators: Hidden accessibility text. */
esc_html__( 'Meta description not set.', 'wordpress-seo' ),
'</span>';
@@ -169,6 +178,7 @@ class WPSEO_Meta_Columns {
if ( $focuskw_val === '' ) {
echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">',
/* translators: Hidden accessibility text. */
esc_html__( 'Focus keyphrase not set.', 'wordpress-seo' ),
'</span>';
@@ -238,6 +248,7 @@ class WPSEO_Meta_Columns {
$ranks = WPSEO_Rank::get_all_ranks();
/* translators: Hidden accessibility text. */
echo '<label class="screen-reader-text" for="wpseo-filter">' . esc_html__( 'Filter by SEO Score', 'wordpress-seo' ) . '</label>';
echo '<select name="seo_filter" id="wpseo-filter">';
@@ -266,6 +277,7 @@ class WPSEO_Meta_Columns {
$ranks = WPSEO_Rank::get_all_readability_ranks();
/* translators: Hidden accessibility text. */
echo '<label class="screen-reader-text" for="wpseo-readability-filter">' . esc_html__( 'Filter by Readability Score', 'wordpress-seo' ) . '</label>';
echo '<select name="readability_filter" id="wpseo-readability-filter">';

View File

@@ -78,7 +78,8 @@ class WPSEO_Premium_Popup {
$assets_uri = trailingslashit( plugin_dir_url( WPSEO_FILE ) );
/* translators: %s expands to Yoast SEO Premium */
$cta_text = esc_html( sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ) );
$cta_text = esc_html( sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' ) );
/* translators: Hidden accessibility text. */
$new_tab_message = '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>';
$caret_icon = '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
$classes = '';

View File

@@ -5,6 +5,8 @@
* @package WPSEO\Admin
*/
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* Class WPSEO_Premium_Upsell_Admin_Block
*/
@@ -51,10 +53,12 @@ class WPSEO_Premium_Upsell_Admin_Block {
$url = WPSEO_Shortlinker::get( 'https://yoa.st/17h' );
$arguments = [
'<strong>' . esc_html__( 'Multiple keyphrases', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Increase your SEO reach', 'wordpress-seo' ),
'<strong>' . esc_html__( 'Use AI', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Quickly create titles & meta descriptions', '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>',
];
@@ -64,7 +68,8 @@ class WPSEO_Premium_Upsell_Admin_Block {
$class = $this->get_html_class();
/* translators: %s expands to Yoast SEO Premium */
$button_text = sprintf( esc_html__( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
$button_text = YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ? \esc_html__( 'Claim your 30% off now!', 'wordpress-seo' ) : sprintf( esc_html__( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
/* translators: Hidden accessibility text. */
$button_text .= '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' .
'<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
@@ -77,7 +82,14 @@ class WPSEO_Premium_Upsell_Admin_Block {
echo '<div class="' . esc_attr( $class ) . '">';
echo '<div>';
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
$bf_label = \esc_html__( 'BLACK FRIDAY', 'wordpress-seo' );
$sale_label = \esc_html__( '30% OFF', 'wordpress-seo' );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped above.
echo "<div class='black-friday-container'><span>$bf_label</span> <span style='margin-left: auto;'>$sale_label</span> </div>";
}
echo '<div class="' . esc_attr( $class . '--container' ) . '">';
echo '<h2 class="' . esc_attr( $class . '--header' ) . '">' .
sprintf(
/* translators: %s expands to Yoast SEO Premium */

View File

@@ -132,7 +132,7 @@ class WPSEO_Suggested_Plugins implements WPSEO_WordPress_Integration {
return sprintf(
'<a href="%s" aria-label="%s" target="_blank" rel="noopener noreferrer">',
$url,
/* translators: %1$s expands to the dependency name. */
/* translators: Hidden accessibility text; %1$s expands to the dependency name */
sprintf( __( 'More information about %1$s', 'wordpress-seo' ), $name )
);
}

View File

@@ -909,10 +909,15 @@ class Yoast_Form {
$upsell_button = '';
if ( $has_premium_upsell ) {
$upsell_button = '<a class="yoast-button yoast-button--buy yoast-button--small" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href=' . esc_url( $attr['premium_upsell_url'] ) . ' target="_blank">' . esc_html__( 'Unlock with Premium!', 'wordpress-seo' ) . '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' .
'<span aria-hidden="true" class="yoast-button--buy__caret"></span></a>';
$upsell_button = '<a class="yoast-button yoast-button--buy yoast-button--small" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href=' .
esc_url( $attr['premium_upsell_url'] ) . ' target="_blank">' .
esc_html__( 'Unlock with Premium!', 'wordpress-seo' ) .
/* translators: Hidden accessibility text. */
'<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' .
'<span aria-hidden="true" class="yoast-button--buy__caret"></span></a>';
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All variable output is escaped above.
echo '<a></a></div></fieldset><div class="clear"></div>' . $upsell_button . '</div>' . PHP_EOL . PHP_EOL;
}

View File

@@ -240,6 +240,7 @@ class WPSEO_Metabox_Formatter {
'content-analysis.highlight' => __( 'Highlight this result in the text', 'wordpress-seo' ),
'content-analysis.nohighlight' => __( 'Remove highlight from the text', 'wordpress-seo' ),
'content-analysis.disabledButton' => __( 'Marks are disabled in current view', 'wordpress-seo' ),
/* translators: Hidden accessibility text. */
'a11yNotice.opensInNewTab' => __( '(Opens in a new browser tab)', 'wordpress-seo' ),
];
}

View File

@@ -114,12 +114,10 @@ class WPSEO_Admin_Menu extends WPSEO_Base_Menu {
$notification_count = $notification_center->get_notification_count();
// Add main page.
/* translators: %s: number of notifications */
/* translators: Hidden accessibility text; %s: number of notifications. */
$notifications = sprintf( _n( '%s notification', '%s notifications', $notification_count, 'wordpress-seo' ), number_format_i18n( $notification_count ) );
$counter = sprintf( '<span class="update-plugins count-%1$d"><span class="plugin-count" aria-hidden="true">%1$d</span><span class="screen-reader-text">%2$s</span></span>', $notification_count, $notifications );
return $counter;
return sprintf( '<span class="update-plugins count-%1$d"><span class="plugin-count" aria-hidden="true">%1$d</span><span class="screen-reader-text">%2$s</span></span>', $notification_count, $notifications );
}
/**

View File

@@ -5,6 +5,8 @@
* @package WPSEO\Admin\Menu
*/
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* Admin menu base class.
*/
@@ -258,6 +260,10 @@ abstract class WPSEO_Base_Menu implements WPSEO_WordPress_Integration {
$title = __( 'Premium', 'wordpress-seo' );
}
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) && ! YoastSEO()->helpers->product->is_premium() ) {
$title = __( 'Premium', 'wordpress-seo' ) . '<span class="yoast-menu-bf-sale-badge">' . __( '30% OFF', 'wordpress-seo' ) . '</span>';
}
return $title;
}

View File

@@ -9,6 +9,7 @@ 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;
@@ -864,7 +865,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
$asset_manager->enqueue_style( 'metabox-css' );
$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';
@@ -892,8 +893,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
'has_taxonomies' => $this->current_post_type_has_taxonomies(),
],
'shortcodes' => [
'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
],
];
@@ -921,16 +921,24 @@ 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

@@ -84,11 +84,13 @@ class WPSEO_Taxonomy_Columns {
$new_columns[ $column_name ] = $column_value;
if ( $column_name === 'description' && $this->analysis_seo->is_enabled() ) {
$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">' . __( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">' .
__( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
}
if ( $column_name === 'description' && $this->analysis_readability->is_enabled() ) {
$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">' . __( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">' .
__( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
}
}

View File

@@ -163,6 +163,9 @@ class WPSEO_Taxonomy {
'recommended_replace_vars' => $this->get_recommended_replace_vars(),
'scope' => $this->determine_scope(),
],
'shortcodes' => [
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
],
],
'worker' => [
'url' => YoastSEO()->helpers->asset->get_asset_url( 'yoast-seo-analysis-worker' ),
@@ -180,6 +183,7 @@ 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();
@@ -445,4 +449,19 @@ class WPSEO_Taxonomy {
return $recommended_replace_vars->get_recommended_replacevars_for( $page_type );
}
/**
* Returns an array with shortcode tags for all registered shortcodes.
*
* @return array
*/
private function get_valid_shortcode_tags() {
$shortcode_tags = [];
foreach ( $GLOBALS['shortcode_tags'] as $tag => $description ) {
$shortcode_tags[] = $tag;
}
return $shortcode_tags;
}
}

View File

@@ -192,6 +192,7 @@ 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',
@@ -230,6 +231,9 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
'deny_search_crawling',
'deny_wp_json_crawling',
'deny_adsbot_crawling',
'deny_ccbot_crawling',
'deny_google_extended_crawling',
'deny_gptbot_crawling',
'last_known_no_unindexed',
];

View File

@@ -202,6 +202,17 @@ 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

@@ -14,7 +14,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<script type="text/html" id="tmpl-primary-term-ui">
<?php
/* translators: accessibility text. %1$s expands to the term title, %2$s to the taxonomy title. */
/* translators: Hidden accessibility text; %1$s expands to the term title, %2$s to the taxonomy title. */
$yoast_free_js_button_label = __( 'Make %1$s primary %2$s', 'wordpress-seo' );
$yoast_free_js_button_label = sprintf(
$yoast_free_js_button_label,

View File

@@ -6,6 +6,8 @@
* @since 5.1
*/
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
@@ -20,6 +22,7 @@ $premium_extension = [
'title' => 'Yoast SEO Premium',
/* translators: %1$s expands to Yoast SEO */
'desc' => sprintf( __( 'The premium version of %1$s with more features & support.', 'wordpress-seo' ), 'Yoast SEO' ),
'image' => plugin_dir_url( WPSEO_FILE ) . 'packages/js/images/Yoast_SEO_Icon.svg',
'benefits' => [],
];
@@ -122,9 +125,23 @@ $has_valid_premium_subscription = YoastSEO()->helpers->product->is_premium() &&
$wpseo_extensions_header = sprintf( __( '%1$s Extensions', 'wordpress-seo' ), 'Yoast SEO' );
$new_tab_message = sprintf(
'<span class="screen-reader-text">%1$s</span>',
/* translators: Hidden accessibility text. */
esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' )
);
$sale_badge = '';
$premium_sale_badge = '';
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
/* translators: %1$s expands to opening span, %2$s expands to closing span */
$sale_badge_span = sprintf( esc_html__( '%1$sSALE 30%% OFF!%2$s', 'wordpress-seo' ), '<span>', '</span>' );
$sale_badge = '<div class="yoast-seo-premium-extension-sale-badge">' . $sale_badge_span . '</div>';
$premium_sale_badge = ( $has_valid_premium_subscription ) ? '' : $sale_badge;
}
?>
<div class="wrap yoast wpseo_table_page">
@@ -133,23 +150,26 @@ $new_tab_message = sprintf(
<div id="extensions">
<section class="yoast-seo-premium-extension">
<?php echo $premium_sale_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: Output is already escaped ?>
<h2>
<?php
printf(
/* translators: 1: expands to a opening span tag, 2: expands to a closing span tag, 3: expands to Yoast SEO Premium */
esc_html__( '%1$sDrive more traffic to your site%2$s with %3$s', 'wordpress-seo' ),
'<span class="yoast-heading-highlight">',
'</span>',
/* translators: 1: expands to Yoast SEO Premium */
esc_html__( 'Drive more traffic to your site with %1$s', 'wordpress-seo' ),
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: The `get_title` value is hardcoded; only passed through the WPSEO_Extensions class.
$premium_extension['title']
);
?>
<img alt="" width="100" height="100" src="<?php echo esc_url( $premium_extension['image'] ); ?>"/>
</h2>
<?php
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>
@@ -279,6 +299,9 @@ $new_tab_message = sprintf(
}
?>
<section class="yoast-promoblock secondary yoast-promo-extension">
<?php if ( ! $addon_manager->has_valid_subscription( $slug ) || ! $addon_manager->is_installed( $slug ) ) : ?>
<?php echo $sale_badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: Output already escaped ?>
<?php endif; ?>
<h3>
<img alt="" width="100" height="100" src="<?php echo esc_url( $extension['image'] ); ?>"/>
<?php echo esc_html( $extension['display_title'] ); ?>

View File

@@ -35,6 +35,7 @@ if ( ! function_exists( '_yoast_display_notifications' ) ) {
case 'active':
$button = sprintf(
'<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>',
/* translators: Hidden accessibility text. */
esc_html__( 'Hide this item.', 'wordpress-seo' )
);
break;
@@ -42,6 +43,7 @@ if ( ! function_exists( '_yoast_display_notifications' ) ) {
case 'dismissed':
$button = sprintf(
'<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons yoast-svg-icon-eye"></span></button>',
/* translators: Hidden accessibility text. */
esc_html__( 'Show this item.', 'wordpress-seo' )
);
break;

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' ); ?>"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/yoast-seo-credits' ); ?>" target="_blank"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
</p>
</div>

View File

@@ -58,7 +58,7 @@ $feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
$feature_help = new WPSEO_Admin_Help_Panel(
WPSEO_Option::ALLOW_KEY_PREFIX . $feature->setting,
/* translators: %s expands to a feature's name */
/* translators: Hidden accessibility text; %s expands to a feature's name. */
sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $feature->name ) ),
$help_text
);

View File

@@ -46,7 +46,7 @@ $integration_toggles = Yoast_Integration_Toggles::instance()->get_all();
$feature_help = new WPSEO_Admin_Help_Panel(
WPSEO_Option::ALLOW_KEY_PREFIX . $integration->setting,
/* translators: %s expands to an integration's name */
/* translators: Hidden accessibility text; %s expands to an integration's name. */
sprintf( esc_html__( 'Help on: %s', 'wordpress-seo' ), esc_html( $integration->name ) ),
$help_text
);

View File

@@ -50,7 +50,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
}
/**
* Shows an message when a post is about to get trashed.
* Shows a message when a post is about to get trashed.
*
* @param int $post_id The current post ID.
*
@@ -61,15 +61,17 @@ 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' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
$message = $this->get_message( $first_sentence );
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $post_label );
$message = $this->get_message( $first_sentence, 'trashed', $post_label );
$this->add_notification( $message );
}
/**
* Shows an message when a post is about to get trashed.
* Shows a message when a post is about to get trashed.
*
* @param int $post_id The current post ID.
*
@@ -80,9 +82,11 @@ 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' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
$message = $this->get_message( $first_sentence );
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_label );
$message = $this->get_message( $first_sentence, 'deleted', $post_label );
$this->add_notification( $message );
}
@@ -98,15 +102,13 @@ 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 );
$first_sentence = sprintf(
/* translators: 1: term label */
__( 'You just deleted a %1$s.', 'wordpress-seo' ),
$this->get_taxonomy_label_for_term( $term->term_id )
);
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
$term_label = $this->get_taxonomy_label_for_term( $term->term_id );
$message = $this->get_message( $first_sentence );
/* 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 );
$this->add_notification( $message );
}
@@ -207,14 +209,17 @@ 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 ) {
protected function get_message( $first_sentence, $action, $object_label ) {
return '<h2>' . __( 'Make sure you don\'t miss out on traffic!', 'wordpress-seo' ) . '</h2>'
. '<p>'
. $first_sentence
. ' ' . __( 'Search engines and other websites can still send traffic to your deleted post.', 'wordpress-seo' )
/* 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 )
. ' ' . __( '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' )
@@ -222,6 +227,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
. '<p><a class="yoast-button-upsell" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/1d0' ) . '" target="_blank">'
/* translators: %s expands to Yoast SEO Premium */
. sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' )
/* translators: Hidden accessibility text. */
. '<span class="screen-reader-text">' . __( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
. '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'
. '</a></p>';