Skip to content

Commit

Permalink
Merge branch 'feature/html-parser' of github.com:Yoast/wordpress-seo …
Browse files Browse the repository at this point in the history
…into make-em-and-en-dashes-word-boundaries

# Conflicts:
#	packages/yoastseo/src/languageProcessing/helpers/word/getWordsForHTMLParser.js
  • Loading branch information
Agnieszka Szuba authored and Agnieszka Szuba committed Oct 17, 2023
2 parents 09900f9 + dacddab commit 33a6cf3
Show file tree
Hide file tree
Showing 156 changed files with 1,679 additions and 717 deletions.
5 changes: 5 additions & 0 deletions admin/class-admin-asset-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,11 @@ protected function styles_to_be_registered() {
'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,
Expand Down
1 change: 1 addition & 0 deletions admin/class-admin-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public static function get_install_link( $plugin ) {
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' )
);
}
Expand Down
7 changes: 4 additions & 3 deletions admin/class-bulk-editor-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ public function extra_tablenav( $which ) {
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(
Expand Down Expand Up @@ -809,7 +810,7 @@ protected function parse_page_title_column( $rec ) {
$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' )
);
Expand All @@ -821,7 +822,7 @@ protected function parse_page_title_column( $rec ) {
$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' )
);
Expand All @@ -831,7 +832,7 @@ protected function parse_page_title_column( $rec ) {
$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' )
);
Expand Down
3 changes: 2 additions & 1 deletion admin/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ public function config_page_scripts() {
'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' ),
'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(),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
];

Expand Down
4 changes: 2 additions & 2 deletions admin/class-gutenberg-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
*
* @var string
*/
const CURRENT_RELEASE = '16.6.0';
const CURRENT_RELEASE = '16.7.0';

/**
* The minimally supported version of Gutenberg by the plugin.
*
* @var string
*/
const MINIMUM_SUPPORTED = '16.6.0';
const MINIMUM_SUPPORTED = '16.7.0';

/**
* Holds the current version.
Expand Down
16 changes: 14 additions & 2 deletions admin/class-meta-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,19 @@ public function column_heading( $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' );
Expand Down Expand Up @@ -154,6 +162,7 @@ public function column_content( $column_name, $post_id ) {
}
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>';

Expand All @@ -169,6 +178,7 @@ public function column_content( $column_name, $post_id ) {

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>';

Expand Down Expand Up @@ -238,6 +248,7 @@ public function posts_filter_dropdown() {

$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">';

Expand Down Expand Up @@ -266,6 +277,7 @@ public function posts_filter_dropdown_readability() {

$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">';

Expand Down
3 changes: 2 additions & 1 deletion admin/class-premium-popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function get_premium_message( $popup = true ) {
$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 = '';
Expand Down
13 changes: 11 additions & 2 deletions admin/class-premium-upsell-admin-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @package WPSEO\Admin
*/

use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;

/**
* Class WPSEO_Premium_Upsell_Admin_Block
*/
Expand Down Expand Up @@ -66,7 +68,8 @@ public function render() {
$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>';

Expand All @@ -77,8 +80,14 @@ public function render() {
$button_text
);

echo '<div class="' . esc_attr( $class ) . '">';
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 ) . '">';
echo '<div>';
echo '<h2 class="' . esc_attr( $class . '--header' ) . '">' .
sprintf(
Expand Down
2 changes: 1 addition & 1 deletion admin/class-suggested-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected function create_more_information_link( $url, $name ) {
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 )
);
}
Expand Down
9 changes: 7 additions & 2 deletions admin/class-yoast-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,10 +909,15 @@ public function toggle_switch( $variable, $values, $label, $help = '', $attr = [

$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;
}

Expand Down
1 change: 1 addition & 0 deletions admin/formatter/class-metabox-formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ private function get_content_analysis_component_translations() {
'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' ),
];
}
Expand Down
6 changes: 2 additions & 4 deletions admin/menu/class-admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,10 @@ protected function get_notification_counter() {
$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 );
}

/**
Expand Down
6 changes: 6 additions & 0 deletions admin/menu/class-base-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @package WPSEO\Admin\Menu
*/

use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;

/**
* Admin menu base class.
*/
Expand Down Expand Up @@ -258,6 +260,10 @@ protected function get_license_page_title() {
$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;
}

Expand Down
5 changes: 2 additions & 3 deletions admin/metabox/class-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -893,8 +893,7 @@ public function enqueue() {
'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(),
],
];

Expand Down Expand Up @@ -931,7 +930,7 @@ public function enqueue() {
'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' ) : '',
'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,
Expand Down
6 changes: 4 additions & 2 deletions admin/taxonomy/class-taxonomy-columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ public function add_columns( array $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>';
}
}

Expand Down
18 changes: 18 additions & 0 deletions admin/taxonomy/class-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ public function admin_enqueue_scripts() {
'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' ),
Expand Down Expand Up @@ -446,4 +449,19 @@ private function get_recommended_replace_vars() {

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;
}
}
2 changes: 1 addition & 1 deletion admin/views/js-templates-primary-term.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<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,
Expand Down
Loading

0 comments on commit 33a6cf3

Please sign in to comment.