Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:Yoast/wordpress-seo into experimen…
Browse files Browse the repository at this point in the history
…t/do-not-expose-non-free-code
  • Loading branch information
mhkuu committed Oct 4, 2024
2 parents 3a161f4 + 827c263 commit d4de1c6
Show file tree
Hide file tree
Showing 242 changed files with 9,391 additions and 5,897 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
matrix:
include:
- php_version: "7.2"
wp_version: "6.4"
wp_version: "6.5"
multisite: true
coverage: true

Expand All @@ -151,7 +151,7 @@ jobs:
coverage: false

- php_version: "8.0"
wp_version: "6.4"
wp_version: "6.5"
multisite: false
coverage: false

Expand All @@ -161,7 +161,7 @@ jobs:
coverage: false

- php_version: '8.2'
wp_version: '6.4'
wp_version: '6.5'
multisite: true
coverage: false

Expand Down
8 changes: 8 additions & 0 deletions admin/class-admin-asset-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ protected function scripts_to_be_registered() {
self::PREFIX . 'externals-contexts',
self::PREFIX . 'externals-redux',
],
'new-dashboard' => [
self::PREFIX . 'api-client',
],
];

$plugin_scripts = $this->load_generated_asset_file(
Expand Down Expand Up @@ -660,6 +663,11 @@ protected function styles_to_be_registered() {
'src' => 'academy-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'new-dashboard',
'src' => 'new-dashboard-' . $flat_version,
'deps' => [ self::PREFIX . 'tailwind' ],
],
[
'name' => 'support',
'src' => 'support-' . $flat_version,
Expand Down
4 changes: 3 additions & 1 deletion admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @package WPSEO\Admin
*/

use Yoast\WP\SEO\Conditionals\New_Dashboard_Ui_Conditional;
use Yoast\WP\SEO\Integrations\Settings_Integration;

/**
Expand Down Expand Up @@ -241,7 +242,8 @@ public function add_action_link( $links, $file ) {
$configuration_title = ( ! $first_time_configuration_notice_helper->should_show_alternate_message() ) ? 'first-time configuration' : 'SEO configuration';
/* translators: CTA to finish the first time configuration. %s: Either first-time SEO configuration or SEO configuration. */
$message = sprintf( __( 'Finish your %s', 'wordpress-seo' ), $configuration_title );
$ftc_link = '<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ) ) . '" target="_blank">' . $message . '</a>';
$ftc_page = ( ( new New_Dashboard_Ui_Conditional() )->is_met() ) ? 'admin.php?page=wpseo_dashboard#/first-time-configuration' : 'admin.php?page=wpseo_dashboard#top#first-time-configuration';
$ftc_link = '<a href="' . esc_url( admin_url( $ftc_page ) ) . '" target="_blank">' . $message . '</a>';
array_unshift( $links, $ftc_link );
}

Expand Down
20 changes: 12 additions & 8 deletions admin/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/

use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
use Yoast\WP\SEO\Conditionals\New_Dashboard_Ui_Conditional;
use Yoast\WP\SEO\Dashboard\User_Interface\New_Dashboard_Page_Integration;
use Yoast\WP\SEO\Integrations\Academy_Integration;
use Yoast\WP\SEO\Integrations\Settings_Integration;
use Yoast\WP\SEO\Integrations\Support_Integration;
Expand Down Expand Up @@ -50,11 +51,17 @@ public function __construct() {
public function init() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
$page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
if ( in_array( $page, [ Settings_Integration::PAGE, Academy_Integration::PAGE, Support_Integration::PAGE ], true ) ) {

// Don't load the scripts for the following pages.
$page_exceptions = in_array( $page, [ Settings_Integration::PAGE, Academy_Integration::PAGE, Support_Integration::PAGE ], true );
// Don't load the scripts for the new dashboard page, but only if the feature flag is enabled.
$new_dashboard_conditional = new New_Dashboard_Ui_Conditional();
$new_dashboard_page = ( $page === New_Dashboard_Page_Integration::PAGE && $new_dashboard_conditional->is_met() );

if ( $page_exceptions || $new_dashboard_page ) {
// Bail, this is managed in the applicable integration.
return;
}

add_action( 'admin_enqueue_scripts', [ $this, 'config_page_scripts' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'config_page_styles' ] );
}
Expand Down Expand Up @@ -89,16 +96,13 @@ public function config_page_scripts() {
wp_enqueue_script( 'dashboard' );
wp_enqueue_script( 'thickbox' );

$alert_dismissal_action = YoastSEO()->classes->get( Alert_Dismissal_Action::class );
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
$woocommerce_conditional = new WooCommerce_Conditional();
$alert_dismissal_action = YoastSEO()->classes->get( 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(),
'currentPromotions' => YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(),
'webinarIntroFirstTimeConfigUrl' => $this->get_webinar_shortlink(),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
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
*/
public const CURRENT_RELEASE = '19.1.0';
public const CURRENT_RELEASE = '19.3.0';

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

/**
* Holds the current version.
Expand Down
5 changes: 3 additions & 2 deletions admin/class-premium-upsell-admin-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ public function render() {
echo '<div class="' . esc_attr( $class ) . '">';

if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2024-promotion' ) ) {
$bf_label = esc_html__( '30% OFF | Code: BF2024', 'wordpress-seo' );
$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></div>";
echo "<div class='black-friday-container'><span>$sale_label</span> <span style='margin-left: auto;'>$bf_label</span> </div>";
}

echo '<div class="' . esc_attr( $class . '--container' ) . '">';
Expand Down
6 changes: 6 additions & 0 deletions admin/class-yoast-notification-center.php
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,12 @@ private function split_on_user_id( $notifications ) {
* @return void
*/
public function update_storage() {
/**
* Plugins might exit on the plugins_loaded hook.
* This prevents the pluggable.php file from loading, as it's loaded after the plugins_loaded hook.
* As we need functions defined in pluggable.php, make sure it's loaded.
*/
require_once ABSPATH . WPINC . '/pluggable.php';

$notifications = $this->notifications;

Expand Down
9 changes: 9 additions & 0 deletions admin/class-yoast-notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,15 @@ public function render() {
return '<div ' . implode( ' ', $attributes ) . '>' . $message . '</div>' . PHP_EOL;
}

/**
* Get the message for the notification.
*
* @return string The message.
*/
public function get_message() {
return wpautop( $this->message );
}

/**
* Wraps the message with a Yoast SEO icon.
*
Expand Down
5 changes: 0 additions & 5 deletions admin/formatter/class-metabox-formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,9 @@ private function get_defaults() {

$defaults = [
'author_name' => get_the_author_meta( 'display_name' ),
'sitewide_social_image' => WPSEO_Options::get( 'og_default_image' ),
'keyword_usage' => [],
'title_template' => '',
'metadesc_template' => '',
'showSocial' => [
'facebook' => WPSEO_Options::get( 'opengraph', false ),
'twitter' => WPSEO_Options::get( 'twitter', false ),
],
'schema' => [
'displayFooter' => WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ),
'pageTypeOptions' => $schema_types->get_page_type_options(),
Expand Down
6 changes: 5 additions & 1 deletion admin/menu/class-admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* @package WPSEO\Admin\Menu
*/

use Yoast\WP\SEO\Conditionals\New_Dashboard_Ui_Conditional;
/**
* Registers the admin menu on the left of the admin area.
*/
Expand Down Expand Up @@ -88,7 +89,6 @@ public function get_submenu_pages() {

// Submenu pages.
$submenu_pages = [
$this->get_submenu_page( __( 'General', 'wordpress-seo' ), $this->get_page_identifier() ),
$this->get_submenu_page(
__( 'Search Console', 'wordpress-seo' ),
'wpseo_search_console',
Expand All @@ -98,6 +98,10 @@ public function get_submenu_pages() {
$this->get_submenu_page( $this->get_license_page_title(), 'wpseo_licenses' ),
];

if ( ! ( new New_Dashboard_Ui_Conditional() )->is_met() ) {
array_unshift( $submenu_pages, $this->get_submenu_page( __( 'General', 'wordpress-seo' ), $this->get_page_identifier() ) );
}

/**
* Filter: 'wpseo_submenu_pages' - Collects all submenus that need to be shown.
*
Expand Down
16 changes: 4 additions & 12 deletions admin/metabox/class-metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
* @package WPSEO\Admin
*/

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\Editors\Application\Site\Website_Information_Repository;
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
use Yoast\WP\SEO\Presenters\Admin\Meta_Fields_Presenter;
Expand Down Expand Up @@ -882,14 +879,12 @@ public function enqueue() {
'log_level' => WPSEO_Utils::get_analysis_worker_log_level(),
];

$woocommerce_conditional = new WooCommerce_Conditional();
$woocommerce_active = $woocommerce_conditional->is_met();
$addon_manager = new WPSEO_Addon_Manager();
$woocommerce_seo_active = is_plugin_active( $addon_manager->get_plugin_file( WPSEO_Addon_Manager::WOOCOMMERCE_SLUG ) );
$page_on_front = (int) get_option( 'page_on_front' );
$homepage_is_page = get_option( 'show_on_front' ) === 'page';
$is_front_page = $homepage_is_page && $page_on_front === (int) $post_id;

$script_data = [
'metabox' => $this->get_metabox_script_data(),
'userLanguageCode' => WPSEO_Language_Utils::get_language( get_user_locale() ),
'isPost' => true,
'isBlockEditor' => $is_block_editor,
'postId' => $post_id,
Expand All @@ -900,10 +895,7 @@ public function enqueue() {
'plugins' => $plugins_script_data,
'worker' => $worker_script_data,
],
'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,
'isWooCommerceSeoActive' => $woocommerce_seo_active,
'isWooCommerceActive' => $woocommerce_active,
'isFrontPage' => $is_front_page,
];

/**
Expand Down
1 change: 0 additions & 1 deletion admin/taxonomy/class-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ public function admin_enqueue_scripts() {
],
],
'metabox' => $this->localize_term_scraper_script( $tag_id ),
'userLanguageCode' => WPSEO_Language_Utils::get_language( get_user_locale() ),
'isTerm' => true,
'postId' => $tag_id,
'termType' => $this->get_taxonomy(),
Expand Down
2 changes: 1 addition & 1 deletion admin/views/licenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@

if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2024-promotion' ) ) {
/* translators: %1$s expands to opening span, %2$s expands to closing span */
$sale_badge_span = sprintf( esc_html__( '%1$s30%% OFF | Use code: BF2024%2$s', 'wordpress-seo' ), '<span>', '</span>' );
$sale_badge_span = sprintf( esc_html__( '%1$s30%% OFF%2$s', 'wordpress-seo' ), '<span>', '</span>' );

$sale_badge = '<div class="yoast-seo-premium-extension-sale-badge">' . $sale_badge_span . '</div>';

Expand Down
5 changes: 4 additions & 1 deletion admin/views/tabs/tool/import-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @package WPSEO\Admin\Views
*/

use Yoast\WP\SEO\Conditionals\New_Dashboard_Ui_Conditional;

if ( ! defined( 'WPSEO_VERSION' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
Expand Down Expand Up @@ -100,10 +102,11 @@ function wpseo_import_external_select( $name, $plugins ) {
<h3><?php esc_html_e( 'Step 4: Go through the first time configuration', 'wordpress-seo' ); ?></h3>
<p>
<?php
$ftc_page = ( ( new New_Dashboard_Ui_Conditional() )->is_met() ) ? 'admin.php?page=wpseo_dashboard#/first-time-configuration' : 'admin.php?page=wpseo_dashboard#top#first-time-configuration';
printf(
/* translators: 1: Link start tag to the First time configuration tab in the General page, 2: Link closing tag. */
esc_html__( 'You should finish the %1$sfirst time configuration%2$s to make sure your SEO data has been optimized and you’ve set the essential Yoast SEO settings for your site.', 'wordpress-seo' ),
'<a href="' . esc_url( admin_url( 'admin.php?page=wpseo_dashboard#top#first-time-configuration' ) ) . '">',
'<a href="' . esc_url( admin_url( $ftc_page ) ) . '">',
'</a>'
);
?>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"Yoast\\WP\\SEO\\Composer\\Actions::check_coding_standards"
],
"check-cs-thresholds": [
"@putenv YOASTCS_THRESHOLD_ERRORS=2482",
"@putenv YOASTCS_THRESHOLD_ERRORS=2479",
"@putenv YOASTCS_THRESHOLD_WARNINGS=252",
"Yoast\\WP\\SEO\\Composer\\Actions::check_cs_thresholds"
],
Expand Down
2 changes: 2 additions & 0 deletions config/dependency-injection/deprecated-classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Yoast\WP\SEO\Conditionals\Third_Party\Wordproof_Plugin_Inactive_Conditional;
use Yoast\WP\SEO\Config\Wordproof_App_Config;
use Yoast\WP\SEO\Config\Wordproof_Translations;
use Yoast\WP\SEO\Helpers\Request_Helper;
use Yoast\WP\SEO\Helpers\Wordproof_Helper;
use Yoast\WP\SEO\Integrations\Admin\Disable_Concatenate_Scripts_Integration;
use Yoast\WP\SEO\Integrations\Admin\Old_Premium_Integration;
Expand All @@ -45,6 +46,7 @@
Ai_Generate_Titles_And_Descriptions_Introduction_Upsell::class => '23.2',
Disable_Concatenate_Scripts_Integration::class => '23.2',
Duplicate_Post_Integration::class => '23.4',
Request_Helper::class => '23.6',
];

foreach ( $deprecated_classes as $original_class => $version ) {
Expand Down
1 change: 1 addition & 0 deletions config/webpack/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const getEntries = ( sourceDirectory = "./packages/js/src" ) => ( {
settings: `${ sourceDirectory }/settings.js`,
"new-settings": `${ sourceDirectory }/settings/initialize.js`,
academy: `${ sourceDirectory }/academy/initialize.js`,
"new-dashboard": `${ sourceDirectory }/dashboard/initialize.js`,
support: `${ sourceDirectory }/support/initialize.js`,
"how-to-block": `${ sourceDirectory }/structured-data-blocks/how-to/block.js`,
"faq-block": `${ sourceDirectory }/structured-data-blocks/faq/block.js`,
Expand Down
4 changes: 4 additions & 0 deletions css/src/admin-global.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions css/src/first-time-configuration.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#wpseo-first-time-configuration {
.yst-root {
#yoast-configuration {
/* Override aggressive WordPress inputs styling */

.yst-input {
Expand Down Expand Up @@ -60,5 +59,4 @@
.yst-checkbox__input {
@apply before:yst-content-none !important;
}
}
}
Loading

0 comments on commit d4de1c6

Please sign in to comment.