Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions plugins/wordpress-seo/admin/class-admin-asset-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,18 @@ protected function scripts_to_be_registered() {
self::PREFIX . 'yoast-components',
],
],
[
/**
* Yoast dynamic blocks
*/
'name' => 'dynamic-blocks',
'src' => 'dynamic-blocks-' . $flat_version,
'deps' => [
'wp-blocks',
'wp-i18n',
'wp-server-side-render',
],
],
[
// The `@yoast/components` package.
'name' => 'yoast-components',
Expand Down
101 changes: 0 additions & 101 deletions plugins/wordpress-seo/admin/class-admin-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public function __construct() {

add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_dismissible' ] );
add_action( 'admin_init', [ $this, 'yoast_plugin_suggestions_notification' ], 15 );
add_action( 'admin_init', [ $this, 'yoast_plugin_update_notification' ] );
add_action( 'admin_init', [ $this, 'unsupported_php_notice' ], 15 );
add_action( 'admin_init', [ $this->asset_manager, 'register_assets' ] );
add_action( 'admin_init', [ $this, 'show_hook_deprecation_warnings' ] );
Expand Down Expand Up @@ -132,106 +131,6 @@ private function get_yoast_seo_suggested_plugins_notification( $name, $plugin, $
);
}

/**
* Determines whether a update notification needs to be displayed.
*
* @return void
*/
public function yoast_plugin_update_notification() {
$notification_center = Yoast_Notification_Center::get();
$current_minor_version = $this->get_major_minor_version( WPSEO_Options::get( 'version', WPSEO_VERSION ) );
$file = plugin_dir_path( WPSEO_FILE ) . 'release-info.json';

// Remove if file is not present.
if ( ! file_exists( $file ) ) {
$notification_center->remove_notification_by_id( 'wpseo-plugin-updated' );
return;
}

// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
$release_json = file_get_contents( $file );

/**
* Filter: 'wpseo_update_notice_content' - Allow filtering of the content
* of the update notice read from the release-info.json file.
*
* @api object The object from the release-info.json file.
*/
$release_info = apply_filters( 'wpseo_update_notice_content', json_decode( $release_json ) );

// Remove if file is malformed or for a different version.
if ( is_null( $release_info )
|| empty( $release_info->version )
|| version_compare( $this->get_major_minor_version( $release_info->version ), $current_minor_version, '!=' )
|| empty( $release_info->release_description )
) {
$notification_center->remove_notification_by_id( 'wpseo-plugin-updated' );
return;
}

$notification = $this->get_yoast_seo_update_notification( $release_info );

// Restore notification if it was dismissed in a previous minor version.
$last_dismissed_version = get_user_option( $notification->get_dismissal_key() );
if ( ! $last_dismissed_version
|| version_compare( $this->get_major_minor_version( $last_dismissed_version ), $current_minor_version, '<' )
) {
Yoast_Notification_Center::restore_notification( $notification );
}
$notification_center->add_notification( $notification );
}

/**
* Helper to truncate the version string up to the minor number
*
* @param string $version The version string to extract the major.minor number from.
* @return string The version string up to the minor number.
*/
private function get_major_minor_version( $version ) {
$version_parts = preg_split( '/[^0-9]+/', $version, 3 );
return join( '.', array_slice( $version_parts, 0, 2 ) );
}

/**
* Builds Yoast SEO update notification.
*
* @param object $release_info The release information.
*
* @return Yoast_Notification The notification for the present version
*/
private function get_yoast_seo_update_notification( $release_info ) {
$info_message = '<strong>';
$info_message .= sprintf(
/* translators: %1$s expands to Yoast SEO, %2$s expands to the plugin version. */
__( 'New in %1$s %2$s: ', 'wordpress-seo' ),
'Yoast SEO',
$release_info->version
);
$info_message .= '</strong>';
$info_message .= $release_info->release_description;

if ( ! empty( $release_info->shortlink ) ) {
$link = esc_url( WPSEO_Shortlinker::get( $release_info->shortlink ) );
$info_message .= ' <a href="' . esc_url( $link ) . '" target="_blank">';
$info_message .= sprintf(
/* translators: %s expands to the plugin version. */
__( 'Read all about version %s here', 'wordpress-seo' ),
$release_info->version
);
$info_message .= '</a>';
}

return new Yoast_Notification(
$info_message,
[
'id' => 'wpseo-plugin-updated',
'type' => Yoast_Notification::UPDATED,
'data_json' => [ 'dismiss_value' => WPSEO_Options::get( 'version', WPSEO_VERSION ) ],
'dismissal_key' => 'wpseo-plugin-updated',
]
);
}

/**
* Creates an unsupported PHP version notification in the notification center.
*
Expand Down
4 changes: 2 additions & 2 deletions plugins/wordpress-seo/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 = '9.7.0';
const CURRENT_RELEASE = '9.7.4';

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

/**
* Holds the current version.
Expand Down
12 changes: 2 additions & 10 deletions plugins/wordpress-seo/admin/class-yoast-notification-center.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ public static function maybe_dismiss_notification( Yoast_Notification $notificat
return true;
}

$dismissal_key = $notification->get_dismissal_key();
$notification_id = $notification->get_id();
$notification_json = $notification->get_json();
$dismissal_key = $notification->get_dismissal_key();
$notification_id = $notification->get_id();

$is_dismissing = ( $dismissal_key === self::get_user_input( 'notification' ) );
if ( ! $is_dismissing ) {
Expand All @@ -187,13 +186,6 @@ public static function maybe_dismiss_notification( Yoast_Notification $notificat
return false;
}

if ( ! empty( $notification_json ) ) {
$notification_data = json_decode( $notification_json );
if ( ! is_null( $notification_data ) && isset( $notification_data->dismiss_value ) ) {
$meta_value = $notification_data->dismiss_value;
}
}

return self::dismiss_notification( $notification, $meta_value );
}

Expand Down
1 change: 0 additions & 1 deletion plugins/wordpress-seo/css/dist/schema-blocks-1562-rtl.css

This file was deleted.

1 change: 0 additions & 1 deletion plugins/wordpress-seo/css/dist/schema-blocks-1562.css

This file was deleted.

1 change: 1 addition & 0 deletions plugins/wordpress-seo/css/dist/schema-blocks-1570-rtl.css

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

1 change: 1 addition & 0 deletions plugins/wordpress-seo/css/dist/schema-blocks-1570.css

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

19 changes: 19 additions & 0 deletions plugins/wordpress-seo/inc/class-upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function __construct() {
'15.1-RC0' => 'upgrade_151',
'15.3-RC0' => 'upgrade_153',
'15.5-RC0' => 'upgrade_155',
'15.7-RC0' => 'upgrade_157',
];

array_walk( $routines, [ $this, 'run_upgrade_routine' ], $version );
Expand Down Expand Up @@ -786,6 +787,15 @@ private function upgrade_155() {
}
}

/**
* Performs the 15.7 upgrade.
*
* @return void
*/
private function upgrade_157() {
add_action( 'init', [ $this, 'remove_plugin_updated_notification_for_157' ] );
}

/**
* Sets the home_url option for the 15.1 upgrade routine.
*
Expand Down Expand Up @@ -892,6 +902,15 @@ public function remove_acf_notification_for_142() {
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-suggested-plugin-yoast-acf-analysis' );
}

/**
* Removes the wpseo-plugin-updated notification from the Notification center for the 15.7 upgrade.
*
* @return void
*/
public function remove_plugin_updated_notification_for_157() {
Yoast_Notification_Center::get()->remove_notification_by_id( 'wpseo-plugin-updated' );
}

/**
* Removes all notifications saved in the database under 'wp_yoast_notifications'.
*
Expand Down
34 changes: 19 additions & 15 deletions plugins/wordpress-seo/inc/health-check-curl-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,21 @@ public function run() {

if ( ! $this->is_my_yoast_api_reachable() && $this->is_recent_curl_version() ) {
$this->label = sprintf(
/* translators: %1$s expands to 'my.yoast.com'. */
esc_html__( 'Your site can not connect to %1$s', 'wordpress-seo' ),
'my.yoast.com'
/* translators: %1$s expands to 'Yoast'. */
esc_html__( '%1$s premium plugins cannot update', 'wordpress-seo' ),
'Yoast'
);
$this->status = self::STATUS_CRITICAL;
$this->badge['color'] = 'red';
$this->description = sprintf(
/* translators: %1$s Emphasis open tag, %2$s: Emphasis close tag, %3$s Link start tag to the Yoast knowledge base, %4$s Link closing tag. */
esc_html__( 'You can %1$snot%2$s activate your premium plugin(s) and receive updates. A common cause for not being able to connect is an out-of-date version of cURL, software used to connect to other servers. However, your cURL version seems fine. Please talk to your host and, if needed, the Yoast support team to figure out what is broken. %3$sRead more about cURL in our knowledge base%4$s.', 'wordpress-seo' ),
/* translators: %1$s Emphasis open tag, %2$s: Emphasis close tag, %3$s Link start tag to the Yoast knowledge base, %4$s Link closing tag, %5$s to Yoast SEO, %6$s to my.yoast.com. */
esc_html__( 'You can %1$snot%2$s activate your premium plugin(s) and receive updates because %5$s cannot connect to %6$s. A common cause for not being able to connect is an out-of-date version of cURL, software used to connect to other servers. However, your cURL version seems fine. Please talk to your host and, if needed, the Yoast support team to figure out what is broken. %3$sRead more about cURL in our knowledge base%4$s.', 'wordpress-seo' ),
'<em>',
'</em>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/3u8' ) ) . '" target="_blank">',
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
WPSEO_Admin_Utils::get_new_tab_message() . '</a>',
'Yoast SEO',
'my.yoast.com'
);

return;
Expand All @@ -50,27 +52,29 @@ public function run() {
// Note: as of January 2020, the most recent cURL version is 7.67.0.
if ( ! $this->is_my_yoast_api_reachable() && ! $this->is_recent_curl_version() ) {
$this->label = sprintf(
/* translators: %1$s expands to 'my.yoast.com'. */
esc_html__( 'Your site can not connect to %1$s', 'wordpress-seo' ),
'my.yoast.com'
/* translators: %1$s expands to 'Yoast'. */
esc_html__( '%1$s premium plugins cannot update', 'wordpress-seo' ),
'Yoast'
);
$this->status = self::STATUS_CRITICAL;
$this->badge['color'] = 'red';
$this->description = sprintf(
/* translators: %1$s Emphasis open tag, %2$s: Emphasis close tag, %3$s Link start tag to the Yoast knowledge base, %4$s Link closing tag. */
esc_html__( 'You can %1$snot%2$s activate your premium plugin(s) and receive updates. The cause for this error is probably that the cURL software on your server is too old. Please contact your host and ask them to update it to at least version 7.34. %3$sRead more about cURL in our knowledge base%4$s.', 'wordpress-seo' ),
/* translators: %1$s Emphasis open tag, %2$s: Emphasis close tag, %3$s Link start tag to the Yoast knowledge base, %4$s Link closing tag, %5$s to Yoast SEO, %6$s to my.yoast.com. */
esc_html__( 'You can %1$snot%2$s activate your premium plugin(s) and receive updates because %5$s cannot connect to %6$s. The cause for this error is probably that the cURL software on your server is too old. Please contact your host and ask them to update it to at least version 7.34. %3$sRead more about cURL in our knowledge base%4$s.', 'wordpress-seo' ),
'<em>',
'</em>',
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/3u8' ) ) . '" target="_blank">',
WPSEO_Admin_Utils::get_new_tab_message() . '</a>'
WPSEO_Admin_Utils::get_new_tab_message() . '</a>',
'Yoast SEO',
'my.yoast.com'
);
return;
}

$this->label = sprintf(
/* translators: %1$s expands to 'my.yoast.com'. */
esc_html__( 'Your site can connect to %1$s', 'wordpress-seo' ),
'my.yoast.com'
/* translators: %1$s expands to 'Yoast'. */
esc_html__( '%1$s premium plugin updates work fine', 'wordpress-seo' ),
'Yoast'
);
$this->status = self::STATUS_GOOD;
$this->badge['color'] = 'blue';
Expand Down
Loading