rebase from live enviornment
This commit is contained in:
@@ -482,6 +482,7 @@ class WPSEO_Admin_Asset_Manager {
|
||||
'feature-flag' => 'feature-flag-package',
|
||||
'helpers' => 'helpers-package',
|
||||
'jed' => 'jed-package',
|
||||
'chart.js' => 'chart.js-package',
|
||||
'legacy-components' => 'components-package',
|
||||
'network-admin-script' => 'network-admin',
|
||||
'redux' => 'redux-package',
|
||||
|
||||
@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CURRENT_RELEASE = '16.8.1';
|
||||
const CURRENT_RELEASE = '17.1.3';
|
||||
|
||||
/**
|
||||
* The minimally supported version of Gutenberg by the plugin.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MINIMUM_SUPPORTED = '16.8.1';
|
||||
const MINIMUM_SUPPORTED = '17.1.3';
|
||||
|
||||
/**
|
||||
* Holds the current version.
|
||||
|
||||
@@ -716,7 +716,6 @@ class Yoast_Notification_Center {
|
||||
* @return void
|
||||
*/
|
||||
private function retrieve_notifications_from_storage( $user_id ) {
|
||||
|
||||
if ( $this->notifications_retrieved ) {
|
||||
return;
|
||||
}
|
||||
@@ -732,6 +731,7 @@ class Yoast_Notification_Center {
|
||||
|
||||
if ( is_array( $stored_notifications ) ) {
|
||||
$notifications = array_map( [ $this, 'array_to_notification' ], $stored_notifications );
|
||||
|
||||
// Apply array_values to ensure we get a 0-indexed array.
|
||||
$notifications = array_values( array_filter( $notifications, [ $this, 'filter_notification_current_user' ] ) );
|
||||
|
||||
@@ -841,6 +841,13 @@ class Yoast_Notification_Center {
|
||||
$notification_data['message'] = $notification_data['message']->present();
|
||||
}
|
||||
|
||||
if ( isset( $notification_data['options']['user'] ) ) {
|
||||
$notification_data['options']['user_id'] = $notification_data['options']['user']->ID;
|
||||
unset( $notification_data['options']['user'] );
|
||||
|
||||
$this->notifications_need_storage = true;
|
||||
}
|
||||
|
||||
return new Yoast_Notification(
|
||||
$notification_data['message'],
|
||||
$notification_data['options']
|
||||
|
||||
@@ -72,7 +72,7 @@ class Yoast_Notification {
|
||||
private $defaults = [
|
||||
'type' => self::UPDATED,
|
||||
'id' => '',
|
||||
'user' => null,
|
||||
'user_id' => null,
|
||||
'nonce' => null,
|
||||
'priority' => 0.5,
|
||||
'data_json' => [],
|
||||
@@ -112,10 +112,14 @@ class Yoast_Notification {
|
||||
/**
|
||||
* Retrieve the user to show the notification for.
|
||||
*
|
||||
* @deprecated 21.6
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return WP_User The user to show this notification for.
|
||||
*/
|
||||
public function get_user() {
|
||||
return $this->options['user'];
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO 21.6' );
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,10 +130,7 @@ class Yoast_Notification {
|
||||
* @return int The user id
|
||||
*/
|
||||
public function get_user_id() {
|
||||
if ( $this->get_user() !== null ) {
|
||||
return $this->get_user()->ID;
|
||||
}
|
||||
return get_current_user_id();
|
||||
return ( $this->options['user_id'] ?? get_current_user_id() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +221,7 @@ class Yoast_Notification {
|
||||
*/
|
||||
public function match_capabilities() {
|
||||
// Super Admin can do anything.
|
||||
if ( is_multisite() && is_super_admin( $this->options['user']->ID ) ) {
|
||||
if ( is_multisite() && is_super_admin( $this->options['user_id'] ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -280,7 +281,15 @@ class Yoast_Notification {
|
||||
* @return bool
|
||||
*/
|
||||
private function has_capability( $capability ) {
|
||||
$user = $this->options['user'];
|
||||
$user_id = $this->options['user_id'];
|
||||
if ( ! is_numeric( $user_id ) ) {
|
||||
return false;
|
||||
}
|
||||
$user = get_user_by( 'id', $user_id );
|
||||
if ( ! $user ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $user->has_cap( $capability );
|
||||
}
|
||||
|
||||
@@ -396,9 +405,9 @@ class Yoast_Notification {
|
||||
$options['capabilities'] = [ 'wpseo_manage_options' ];
|
||||
}
|
||||
|
||||
// Set to the current user if not supplied.
|
||||
if ( $options['user'] === null ) {
|
||||
$options['user'] = wp_get_current_user();
|
||||
// Set to the id of the current user if not supplied.
|
||||
if ( $options['user_id'] === null ) {
|
||||
$options['user_id'] = get_current_user_id();
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
||||
@@ -893,7 +893,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
'has_taxonomies' => $this->current_post_type_has_taxonomies(),
|
||||
],
|
||||
'shortcodes' => [
|
||||
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
|
||||
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
|
||||
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
|
||||
],
|
||||
];
|
||||
|
||||
@@ -935,7 +936,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
'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() ),
|
||||
|
||||
@@ -164,7 +164,8 @@ class WPSEO_Taxonomy {
|
||||
'scope' => $this->determine_scope(),
|
||||
],
|
||||
'shortcodes' => [
|
||||
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
|
||||
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
|
||||
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
|
||||
],
|
||||
],
|
||||
'worker' => [
|
||||
@@ -212,8 +213,9 @@ class WPSEO_Taxonomy {
|
||||
foreach ( WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: Nonce is already checked by WordPress before executing this action.
|
||||
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: Nonce is already checked by WordPress before executing this action.
|
||||
$new_meta_data[ $key ] = sanitize_text_field( wp_unslash( $_POST[ $key ] ) );
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $data is getting sanitized later.
|
||||
$data = \wp_unslash( $_POST[ $key ] );
|
||||
$new_meta_data[ $key ] = ( $key !== 'wpseo_canonical' ) ? WPSEO_Utils::sanitize_text_field( $data ) : WPSEO_Utils::sanitize_url( $data );
|
||||
}
|
||||
|
||||
// If analysis is disabled remove that analysis score value from the DB.
|
||||
@@ -221,7 +223,6 @@ class WPSEO_Taxonomy {
|
||||
$new_meta_data[ $key ] = '';
|
||||
}
|
||||
}
|
||||
unset( $key, $default );
|
||||
|
||||
// Saving the values.
|
||||
WPSEO_Taxonomy_Meta::set_values( $term_id, $taxonomy, $new_meta_data );
|
||||
|
||||
@@ -17,7 +17,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
|
||||
<h1 id="wpseo-title"><?php echo \esc_html( \get_admin_page_title() ); ?></h1>
|
||||
<div class="wpseo_content_wrapper" style="position: relative;">
|
||||
<div style="position: absolute;top: 0;bottom: 0;left: 0;right: 0;z-index: 100; display: flex;justify-content: center;align-items: center;background: radial-gradient(#ffffffcf 20%, #ffffff00 50%);">
|
||||
<a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo \esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/4e0/' ) ); ?>" target="_blank">
|
||||
<a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo \esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/redirect-manager-upsell' ) ); ?>" target="_blank">
|
||||
<?php
|
||||
echo \esc_html__( 'Unlock with Premium', 'wordpress-seo' )
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput -- Already escapes correctly.
|
||||
|
||||
@@ -64,8 +64,9 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
$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' ), $post_label );
|
||||
$message = $this->get_message( $first_sentence, 'trashed', $post_label );
|
||||
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $post_label );
|
||||
$second_sentence = __( 'Search engines and other websites can still send traffic to your trashed content.', 'wordpress-seo' );
|
||||
$message = $this->get_message( $first_sentence, $second_sentence );
|
||||
|
||||
$this->add_notification( $message );
|
||||
}
|
||||
@@ -85,8 +86,9 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
$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' ), $post_label );
|
||||
$message = $this->get_message( $first_sentence, 'deleted', $post_label );
|
||||
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_label );
|
||||
$second_sentence = __( 'Search engines and other websites can still send traffic to your deleted content.', 'wordpress-seo' );
|
||||
$message = $this->get_message( $first_sentence, $second_sentence );
|
||||
|
||||
$this->add_notification( $message );
|
||||
}
|
||||
@@ -107,8 +109,9 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
$term_label = $this->get_taxonomy_label_for_term( $term->term_id );
|
||||
|
||||
/* 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 );
|
||||
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $term_label );
|
||||
$second_sentence = __( 'Search engines and other websites can still send traffic to your deleted content.', 'wordpress-seo' );
|
||||
$message = $this->get_message( $first_sentence, $second_sentence );
|
||||
|
||||
$this->add_notification( $message );
|
||||
}
|
||||
@@ -209,17 +212,15 @@ 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.
|
||||
* @param string $second_sentence The second sentence of the notification.
|
||||
*
|
||||
* @return string The full notification.
|
||||
*/
|
||||
protected function get_message( $first_sentence, $action, $object_label ) {
|
||||
protected function get_message( $first_sentence, $second_sentence ) {
|
||||
return '<h2>' . __( 'Make sure you don\'t miss out on traffic!', 'wordpress-seo' ) . '</h2>'
|
||||
. '<p>'
|
||||
. $first_sentence
|
||||
/* 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 )
|
||||
. ' ' . $second_sentence
|
||||
. ' ' . __( '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' )
|
||||
|
||||
Reference in New Issue
Block a user