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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 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 Expand Up @@ -831,6 +843,10 @@ protected function styles_to_be_registered() {
'name' => 'alert',
'src' => 'alerts-' . $flat_version,
],
[
'name' => 'badge',
'src' => 'badge-' . $flat_version,
],
[
'name' => 'edit-page',
'src' => 'edit-page-' . $flat_version,
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
36 changes: 0 additions & 36 deletions plugins/wordpress-seo/admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public function __construct() {
$integrations[] = new WPSEO_Schema_Person_Upgrade_Notification();
$integrations[] = new WPSEO_Tracking( 'https://tracking.yoast.com/stats', ( WEEK_IN_SECONDS * 2 ) );
$integrations[] = new WPSEO_Admin_Settings_Changed_Listener();
$integrations[] = $this->get_helpscout_beacon();

$integrations = array_merge(
$integrations,
Expand Down Expand Up @@ -352,39 +351,4 @@ protected function initialize_cornerstone_content() {
'cornerstone_filter' => new WPSEO_Cornerstone_Filter(),
];
}

/**
* Retrieves an instance of the HelpScout beacon class for Yoast SEO.
*
* @return WPSEO_HelpScout The instance of the HelpScout beacon.
*/
private function get_helpscout_beacon() {
$helpscout_settings = [
'beacon_id' => '2496aba6-0292-489c-8f5d-1c0fba417c2f',
'pages' => [
'wpseo_dashboard',
'wpseo_titles',
'wpseo_search_console',
'wpseo_social',
'wpseo_tools',
'wpseo_licenses',
],
'products' => [],
'ask_consent' => true,
];

/**
* Filter: 'wpseo_helpscout_beacon_settings' - Allows overriding the HelpScout beacon settings.
*
* @api string - The helpscout beacons settings.
*/
$helpscout_settings = apply_filters( 'wpseo_helpscout_beacon_settings', $helpscout_settings );

return new WPSEO_HelpScout(
$helpscout_settings['beacon_id'],
$helpscout_settings['pages'],
$helpscout_settings['products'],
$helpscout_settings['ask_consent']
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ protected function get_meta_data_result( $post_ids ) {
"
SELECT *
FROM {$wpdb->postmeta}
WHERE post_id IN({$post_ids}) && meta_key = '" . WPSEO_Meta::$meta_prefix . $this->target_db_field . "'
WHERE post_id IN({$post_ids}) AND meta_key = '" . WPSEO_Meta::$meta_prefix . $this->target_db_field . "'
"
);

Expand Down
8 changes: 8 additions & 0 deletions plugins/wordpress-seo/admin/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public function config_page_styles() {
if ( $page === 'wpseo_titles' ) {
$this->asset_manager->enqueue_style( 'search-appearance' );
}

if ( $page === 'wpseo_social' ) {
$this->asset_manager->enqueue_style( 'monorepo' );
}
}

/**
Expand Down Expand Up @@ -123,6 +127,10 @@ public function config_page_scripts() {
$this->enqueue_tools_scripts();
}

if ( $page === 'wpseo_social' ) {
$script_data['social'] = true;
}

$this->asset_manager->localize_script( 'settings', 'wpseoScriptData', $script_data );
}

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

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

/**
* Holds the current version.
Expand Down
2 changes: 1 addition & 1 deletion plugins/wordpress-seo/admin/class-helpscout.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __construct( $beacon_id, array $pages, array $products, $ask_con
}

/**
* @inheritDoc
* {@inheritDoc}
*/
public function register_hooks() {
if ( ! $this->is_beacon_page() ) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/wordpress-seo/admin/class-plugin-conflict.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
'seo' => [
'all-in-one-seo-pack/all_in_one_seo_pack.php', // All in One SEO Pack.
'seo-ultimate/seo-ultimate.php', // SEO Ultimate.
'seo-by-rank-math/rank-math.php', // Rank Math.
'seo-by-rank-math/rank-math.php', // Rank Math.
],
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ protected function get_notification() {
) . "\n\n";

$message .= sprintf(
/* translators: %1$s is a link start tag to the bugreport guidelines on the Yoast knowledge base, %2$s is the link closing tag. */
/* translators: %1$s is a link start tag to the bugreport guidelines on the Yoast help center, %2$s is the link closing tag. */
__( 'If you are experiencing issues, %1$splease file a bug report%2$s and we\'ll do our best to help you out.', 'wordpress-seo' ),
'<a href="' . WPSEO_Shortlinker::get( 'https://yoa.st/bugreport' ) . '">',
'</a>'
Expand Down
Loading