auto-patch 638-dev-dev01-2024-05-14T20_44_36
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
/**
|
||||
* This class registers all the necessary styles and scripts.
|
||||
*
|
||||
* Also has methods for the enqueing of scripts and styles.
|
||||
* It automatically adds a prefix to the handle.
|
||||
*/
|
||||
class WPSEO_Admin_Asset_Manager {
|
||||
@@ -361,7 +360,7 @@ class WPSEO_Admin_Asset_Manager {
|
||||
'wp-components',
|
||||
'wp-element',
|
||||
'wp-i18n',
|
||||
self::PREFIX . 'yoast-components',
|
||||
self::PREFIX . 'components-new-package',
|
||||
self::PREFIX . 'externals-components',
|
||||
],
|
||||
'version' => $scripts['installation-success']['version'],
|
||||
@@ -402,7 +401,7 @@ class WPSEO_Admin_Asset_Manager {
|
||||
self::PREFIX . 'externals-redux',
|
||||
self::PREFIX . 'analysis',
|
||||
self::PREFIX . 'react-select',
|
||||
self::PREFIX . 'yoast-components',
|
||||
self::PREFIX . 'components-new-package',
|
||||
],
|
||||
'version' => $scripts['workouts']['version'],
|
||||
];
|
||||
@@ -503,7 +502,6 @@ class WPSEO_Admin_Asset_Manager {
|
||||
'helpers' => 'helpers-package',
|
||||
'jed' => 'jed-package',
|
||||
'chart.js' => 'chart.js-package',
|
||||
'legacy-components' => 'components-package',
|
||||
'network-admin-script' => 'network-admin',
|
||||
'redux' => 'redux-package',
|
||||
'replacement-variable-editor' => 'replacement-variable-editor-package',
|
||||
@@ -572,6 +570,14 @@ class WPSEO_Admin_Asset_Manager {
|
||||
self::PREFIX . 'admin-css',
|
||||
self::PREFIX . 'tailwind',
|
||||
'wp-components',
|
||||
self::PREFIX . 'additional-mentions',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'additional-mentions',
|
||||
'src' => 'additional-mentions-' . $flat_version,
|
||||
'deps' => [
|
||||
self::PREFIX . 'tailwind',
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -628,7 +634,11 @@ class WPSEO_Admin_Asset_Manager {
|
||||
[
|
||||
'name' => 'structured-data-blocks',
|
||||
'src' => 'structured-data-blocks-' . $flat_version,
|
||||
'deps' => [ 'wp-edit-blocks' ],
|
||||
'deps' => [
|
||||
'dashicons',
|
||||
'forms',
|
||||
'wp-edit-blocks',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'elementor',
|
||||
@@ -641,7 +651,10 @@ class WPSEO_Admin_Asset_Manager {
|
||||
[
|
||||
'name' => 'new-settings',
|
||||
'src' => 'new-settings-' . $flat_version,
|
||||
'deps' => [ self::PREFIX . 'tailwind' ],
|
||||
'deps' => [
|
||||
self::PREFIX . 'tailwind',
|
||||
self::PREFIX . 'additional-mentions',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'black-friday-banner',
|
||||
|
||||
@@ -17,8 +17,6 @@ class WPSEO_Admin_User_Profile {
|
||||
public function __construct() {
|
||||
add_action( 'show_user_profile', [ $this, 'user_profile' ] );
|
||||
add_action( 'edit_user_profile', [ $this, 'user_profile' ] );
|
||||
add_action( 'personal_options_update', [ $this, 'process_user_option_update' ] );
|
||||
add_action( 'edit_user_profile_update', [ $this, 'process_user_option_update' ] );
|
||||
|
||||
add_action( 'update_user_meta', [ $this, 'clear_author_sitemap_cache' ], 10, 3 );
|
||||
}
|
||||
@@ -43,11 +41,16 @@ class WPSEO_Admin_User_Profile {
|
||||
/**
|
||||
* Updates the user metas that (might) have been set on the user profile page.
|
||||
*
|
||||
* @deprecated 22.6
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param int $user_id User ID of the updated user.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function process_user_option_update( $user_id ) {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO 22.6' );
|
||||
|
||||
update_user_meta( $user_id, '_yoast_wpseo_profile_updated', time() );
|
||||
|
||||
if ( ! check_admin_referer( 'wpseo_user_profile_update', 'wpseo_nonce' ) ) {
|
||||
|
||||
@@ -59,8 +59,6 @@ class WPSEO_Admin {
|
||||
add_action( 'admin_enqueue_scripts', [ $this, 'config_page_scripts' ] );
|
||||
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_global_style' ] );
|
||||
|
||||
add_filter( 'user_contactmethods', [ $this, 'update_contactmethods' ], 10, 1 );
|
||||
|
||||
add_action( 'after_switch_theme', [ $this, 'switch_theme' ] );
|
||||
add_action( 'switch_theme', [ $this, 'switch_theme' ] );
|
||||
|
||||
@@ -304,11 +302,16 @@ class WPSEO_Admin {
|
||||
*
|
||||
* These are used with the Facebook author, rel="author" and Twitter cards implementation.
|
||||
*
|
||||
* @param array $contactmethods Currently set contactmethods.
|
||||
* @deprecated 22.6
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return array Contactmethods with added contactmethods.
|
||||
* @param array<string, string> $contactmethods Currently set contactmethods.
|
||||
*
|
||||
* @return array<string, string> Contactmethods with added contactmethods.
|
||||
*/
|
||||
public function update_contactmethods( $contactmethods ) {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO 22.6' );
|
||||
|
||||
$contactmethods['facebook'] = __( 'Facebook profile URL', 'wordpress-seo' );
|
||||
$contactmethods['instagram'] = __( 'Instagram profile URL', 'wordpress-seo' );
|
||||
$contactmethods['linkedin'] = __( 'LinkedIn profile URL', 'wordpress-seo' );
|
||||
@@ -316,7 +319,7 @@ class WPSEO_Admin {
|
||||
$contactmethods['pinterest'] = __( 'Pinterest profile URL', 'wordpress-seo' );
|
||||
$contactmethods['soundcloud'] = __( 'SoundCloud profile URL', 'wordpress-seo' );
|
||||
$contactmethods['tumblr'] = __( 'Tumblr profile URL', 'wordpress-seo' );
|
||||
$contactmethods['twitter'] = __( 'Twitter username (without @)', 'wordpress-seo' );
|
||||
$contactmethods['twitter'] = __( 'X username (without @)', 'wordpress-seo' );
|
||||
$contactmethods['youtube'] = __( 'YouTube profile URL', 'wordpress-seo' );
|
||||
$contactmethods['wikipedia'] = __( 'Wikipedia page about you', 'wordpress-seo' ) . '<br/><small>' . __( '(if one exists)', 'wordpress-seo' ) . '</small>';
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class WPSEO_Expose_Shortlinks implements WPSEO_WordPress_Integration {
|
||||
'shortlinks.snippet_preview_info' => 'https://yoa.st/snippet-preview',
|
||||
'shortlinks.cornerstone_content_info' => 'https://yoa.st/1i9',
|
||||
'shortlinks.upsell.social_preview.social' => 'https://yoa.st/social-preview-facebook',
|
||||
'shortlinks.upsell.social_preview.twitter' => 'https://yoa.st/social-preview-twitter',
|
||||
'shortlinks.upsell.social_preview.x' => 'https://yoa.st/social-preview-twitter',
|
||||
'shortlinks.upsell.sidebar.news' => 'https://yoa.st/get-news-sidebar',
|
||||
'shortlinks.upsell.sidebar.focus_keyword_synonyms_button' => 'https://yoa.st/keyword-synonyms-popup-sidebar',
|
||||
'shortlinks.upsell.sidebar.premium_seo_analysis_button' => 'https://yoa.st/premium-seo-analysis-sidebar',
|
||||
|
||||
@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const CURRENT_RELEASE = '17.9.0';
|
||||
public const CURRENT_RELEASE = '18.2.0';
|
||||
|
||||
/**
|
||||
* The minimally supported version of Gutenberg by the plugin.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const MINIMUM_SUPPORTED = '17.9.0';
|
||||
public const MINIMUM_SUPPORTED = '18.2.0';
|
||||
|
||||
/**
|
||||
* Holds the current version.
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
* @package WPSEO\Plugin_Availability
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
|
||||
|
||||
/**
|
||||
* Class WPSEO_Plugin_Availability
|
||||
*/
|
||||
@@ -88,7 +91,8 @@ class WPSEO_Plugin_Availability {
|
||||
),
|
||||
'_dependencies' => [
|
||||
'WooCommerce' => [
|
||||
'slug' => 'woocommerce/woocommerce.php',
|
||||
'slug' => 'woocommerce/woocommerce.php', // Kept for backwards compatibility, in case external code uses get_dependencies(). Deprecated in 22.4.
|
||||
'conditional' => new WooCommerce_Conditional(),
|
||||
],
|
||||
],
|
||||
'installed' => false,
|
||||
@@ -208,10 +212,10 @@ class WPSEO_Plugin_Availability {
|
||||
return true;
|
||||
}
|
||||
|
||||
$dependencies = $this->get_dependencies( $plugin );
|
||||
$installed_dependencies = array_filter( $dependencies, [ $this, 'is_dependency_available' ] );
|
||||
$dependencies = $this->get_dependencies( $plugin );
|
||||
$active_dependencies = array_filter( $dependencies, [ $this, 'is_dependency_active' ] );
|
||||
|
||||
return count( $installed_dependencies ) === count( $dependencies );
|
||||
return count( $active_dependencies ) === count( $dependencies );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,14 +261,30 @@ class WPSEO_Plugin_Availability {
|
||||
return isset( $plugin['installed'] ) && $plugin['installed'] === true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a dependency is active.
|
||||
*
|
||||
* @param array<string, Conditional> $dependency The information about the dependency to look for.
|
||||
*
|
||||
* @return bool Whether or not the dependency is active.
|
||||
*/
|
||||
public function is_dependency_active( $dependency ) {
|
||||
return $dependency['conditional']->is_met();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a dependency is available.
|
||||
*
|
||||
* @deprecated 22.4
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param array $dependency The information about the dependency to look for.
|
||||
*
|
||||
* @return bool Whether or not the dependency is available.
|
||||
*/
|
||||
public function is_dependency_available( $dependency ) {
|
||||
_deprecated_function( __METHOD__, 'Yoast SEO 22.4' );
|
||||
|
||||
return isset( get_plugins()[ $dependency['slug'] ] );
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
|
||||
// Only check for open graph problems when they are enabled.
|
||||
if ( WPSEO_Options::get( 'opengraph' ) ) {
|
||||
/* translators: %1$s expands to Yoast SEO, %2$s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output. */
|
||||
$plugin_sections['open_graph'] = __( 'Both %1$s and %2$s create Open Graph output, which might make Facebook, Twitter, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo' )
|
||||
$plugin_sections['open_graph'] = __( 'Both %1$s and %2$s create Open Graph output, which might make Facebook, X, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo' )
|
||||
. '<br/><br/>'
|
||||
. '<a class="button" href="' . admin_url( 'admin.php?page=wpseo_page_settings#/site-features#card-wpseo_social-opengraph' ) . '">'
|
||||
/* translators: %1$s expands to Yoast SEO. */
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
* @package WPSEO\Suggested_Plugins
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Conditional;
|
||||
|
||||
/**
|
||||
* Class WPSEO_Suggested_Plugins
|
||||
*/
|
||||
@@ -57,41 +59,40 @@ class WPSEO_Suggested_Plugins implements WPSEO_WordPress_Integration {
|
||||
$plugins = $checker->get_plugins_with_dependencies();
|
||||
|
||||
foreach ( $plugins as $plugin_name => $plugin ) {
|
||||
$notification_id = 'wpseo-suggested-plugin-' . $plugin_name;
|
||||
|
||||
if ( ! $checker->dependencies_are_satisfied( $plugin ) ) {
|
||||
$this->notification_center->remove_notification_by_id( $notification_id );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$notification = $this->get_yoast_seo_suggested_plugins_notification( $plugin_name, $plugin );
|
||||
|
||||
if ( ! $checker->is_installed( $plugin ) ) {
|
||||
$notification = $this->get_yoast_seo_suggested_plugins_notification( $notification_id, $plugin );
|
||||
$this->notification_center->add_notification( $notification );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->notification_center->remove_notification( $notification );
|
||||
$this->notification_center->remove_notification_by_id( $notification_id );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Yoast SEO suggested plugins notification.
|
||||
*
|
||||
* @param string $name The plugin name to use for the unique ID.
|
||||
* @param array $plugin The plugin to retrieve the data from.
|
||||
* @param string $notification_id The id of the notification to be created.
|
||||
* @param array<string, string|bool|array<string, Conditional>> $plugin The plugin to retrieve the data from.
|
||||
*
|
||||
* @return Yoast_Notification The notification containing the suggested plugin.
|
||||
*/
|
||||
protected function get_yoast_seo_suggested_plugins_notification( $name, $plugin ) {
|
||||
protected function get_yoast_seo_suggested_plugins_notification( $notification_id, $plugin ) {
|
||||
$message = $this->create_install_suggested_plugin_message( $plugin );
|
||||
|
||||
if ( $this->availability_checker->is_installed( $plugin ) && ! $this->availability_checker->is_active( $plugin['slug'] ) ) {
|
||||
$message = '';
|
||||
}
|
||||
|
||||
return new Yoast_Notification(
|
||||
$message,
|
||||
[
|
||||
'id' => 'wpseo-suggested-plugin-' . $name,
|
||||
'id' => $notification_id,
|
||||
'type' => Yoast_Notification::WARNING,
|
||||
'capabilities' => [ 'install_plugins' ],
|
||||
]
|
||||
|
||||
@@ -5,14 +5,9 @@
|
||||
* @package WPSEO\Admin\Formatter
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Conditionals\Third_Party\Polylang_Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\Third_Party\TranslatePress_Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\Third_Party\WPML_Conditional;
|
||||
use Yoast\WP\SEO\Config\Schema_Types;
|
||||
use Yoast\WP\SEO\Config\SEMrush_Client;
|
||||
use Yoast\WP\SEO\Exceptions\OAuth\Authentication_Failed_Exception;
|
||||
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Property_Exception;
|
||||
use Yoast\WP\SEO\Exceptions\OAuth\Tokens\Empty_Token_Exception;
|
||||
use Yoast\WP\SEO\Editors\Application\Analysis_Features\Enabled_Analysis_Features_Repository;
|
||||
use Yoast\WP\SEO\Editors\Application\Integrations\Integration_Information_Repository;
|
||||
|
||||
/**
|
||||
* This class forces needed methods for the metabox localization.
|
||||
@@ -38,7 +33,7 @@ class WPSEO_Metabox_Formatter {
|
||||
/**
|
||||
* Returns the values.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string,string|array<string|int|bool>|bool|int>
|
||||
*/
|
||||
public function get_values() {
|
||||
$defaults = $this->get_defaults();
|
||||
@@ -50,17 +45,13 @@ class WPSEO_Metabox_Formatter {
|
||||
/**
|
||||
* Returns array with all the values always needed by a scraper object.
|
||||
*
|
||||
* @return array Default settings for the metabox.
|
||||
* @return array<string,string|array<string|int|bool>|bool|int> Default settings for the metabox.
|
||||
*/
|
||||
private function get_defaults() {
|
||||
$analysis_seo = new WPSEO_Metabox_Analysis_SEO();
|
||||
$analysis_readability = new WPSEO_Metabox_Analysis_Readability();
|
||||
$analysis_inclusive_language = new WPSEO_Metabox_Analysis_Inclusive_Language();
|
||||
$schema_types = new Schema_Types();
|
||||
$is_wincher_active = YoastSEO()->helpers->wincher->is_active();
|
||||
$host = YoastSEO()->helpers->url->get_url_host( get_site_url() );
|
||||
$schema_types = new Schema_Types();
|
||||
$host = YoastSEO()->helpers->url->get_url_host( get_site_url() );
|
||||
|
||||
return [
|
||||
$defaults = [
|
||||
'author_name' => get_the_author_meta( 'display_name' ),
|
||||
'site_name' => YoastSEO()->meta->for_current_page()->site_name,
|
||||
'sitewide_social_image' => WPSEO_Options::get( 'og_default_image' ),
|
||||
@@ -76,18 +67,10 @@ class WPSEO_Metabox_Formatter {
|
||||
'keyword_usage' => [],
|
||||
'title_template' => '',
|
||||
'metadesc_template' => '',
|
||||
'contentAnalysisActive' => $analysis_readability->is_enabled() ? 1 : 0,
|
||||
'keywordAnalysisActive' => $analysis_seo->is_enabled() ? 1 : 0,
|
||||
'inclusiveLanguageAnalysisActive' => $analysis_inclusive_language->is_enabled() ? 1 : 0,
|
||||
'cornerstoneActive' => WPSEO_Options::get( 'enable_cornerstone_content', false ) ? 1 : 0,
|
||||
'semrushIntegrationActive' => WPSEO_Options::get( 'semrush_integration_active', true ) ? 1 : 0,
|
||||
'intl' => $this->get_content_analysis_component_translations(),
|
||||
'isRtl' => is_rtl(),
|
||||
'isPremium' => YoastSEO()->helpers->product->is_premium(),
|
||||
'wordFormRecognitionActive' => YoastSEO()->helpers->language->is_word_form_recognition_active( WPSEO_Language_Utils::get_language( get_locale() ) ),
|
||||
'siteIconUrl' => get_site_icon_url(),
|
||||
'countryCode' => WPSEO_Options::get( 'semrush_country_code', false ),
|
||||
'SEMrushLoginStatus' => WPSEO_Options::get( 'semrush_integration_active', true ) ? $this->get_semrush_login_status() : false,
|
||||
'showSocial' => [
|
||||
'facebook' => WPSEO_Options::get( 'opengraph', false ),
|
||||
'twitter' => WPSEO_Options::get( 'twitter', false ),
|
||||
@@ -98,13 +81,6 @@ class WPSEO_Metabox_Formatter {
|
||||
'articleTypeOptions' => $schema_types->get_article_type_options(),
|
||||
],
|
||||
'twitterCardType' => 'summary_large_image',
|
||||
|
||||
/**
|
||||
* Filter to determine if the markers should be enabled or not.
|
||||
*
|
||||
* @param bool $showMarkers Should the markers being enabled. Default = true.
|
||||
*/
|
||||
'show_markers' => apply_filters( 'wpseo_enable_assessment_markers', true ),
|
||||
'publish_box' => [
|
||||
'labels' => [
|
||||
'keyword' => [
|
||||
@@ -199,34 +175,36 @@ class WPSEO_Metabox_Formatter {
|
||||
],
|
||||
],
|
||||
],
|
||||
'markdownEnabled' => $this->is_markdown_enabled(),
|
||||
/**
|
||||
* Filter to determine if the markers should be enabled or not.
|
||||
*
|
||||
* @param bool $showMarkers Should the markers being enabled. Default = true.
|
||||
*/
|
||||
'show_markers' => apply_filters( 'wpseo_enable_assessment_markers', true ),
|
||||
'analysisHeadingTitle' => __( 'Analysis', 'wordpress-seo' ),
|
||||
'zapierIntegrationActive' => WPSEO_Options::get( 'zapier_integration_active', false ) ? 1 : 0,
|
||||
'zapierConnectedStatus' => ! empty( WPSEO_Options::get( 'zapier_subscription', [] ) ) ? 1 : 0,
|
||||
'wincherIntegrationActive' => ( $is_wincher_active ) ? 1 : 0,
|
||||
'wincherLoginStatus' => ( $is_wincher_active ) ? YoastSEO()->helpers->wincher->login_status() : false,
|
||||
'wincherWebsiteId' => WPSEO_Options::get( 'wincher_website_id', '' ),
|
||||
'wincherAutoAddKeyphrases' => WPSEO_Options::get( 'wincher_automatically_add_keyphrases', false ),
|
||||
'wordproofIntegrationActive' => YoastSEO()->helpers->wordproof->is_active() ? 1 : 0,
|
||||
'multilingualPluginActive' => $this->multilingual_plugin_active(),
|
||||
|
||||
/**
|
||||
* Filter to determine whether the PreviouslyUsedKeyword assessment should run.
|
||||
*
|
||||
* @param bool $previouslyUsedKeywordActive Whether the PreviouslyUsedKeyword assessment should run.
|
||||
*/
|
||||
'previouslyUsedKeywordActive' => apply_filters( 'wpseo_previously_used_keyword_active', true ),
|
||||
'getJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-get-prepublish?domain=' . $host ),
|
||||
'upgradeJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-upgrade-prepublish?domain=' . $host ),
|
||||
'woocommerceUpsellSchemaLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-schema-metabox' ),
|
||||
'woocommerceUpsellGooglePreviewLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-google-preview-metabox' ),
|
||||
];
|
||||
|
||||
$integration_information_repo = YoastSEO()->classes->get( Integration_Information_Repository::class );
|
||||
|
||||
$enabled_integrations = $integration_information_repo->get_integration_information();
|
||||
$defaults = array_merge( $defaults, $enabled_integrations );
|
||||
$enabled_features_repo = YoastSEO()->classes->get( Enabled_Analysis_Features_Repository::class );
|
||||
|
||||
$enabled_features = $enabled_features_repo->get_enabled_features()->parse_to_legacy_array();
|
||||
return array_merge( $defaults, $enabled_features );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns required yoast-component translations.
|
||||
*
|
||||
* @return array
|
||||
* @return string[]
|
||||
*/
|
||||
private function get_content_analysis_component_translations() {
|
||||
// Esc_html is not needed because React already handles HTML in the (translations of) these strings.
|
||||
@@ -248,7 +226,7 @@ class WPSEO_Metabox_Formatter {
|
||||
/**
|
||||
* Returns Jed compatible YoastSEO.js translations.
|
||||
*
|
||||
* @return array
|
||||
* @return string[]
|
||||
*/
|
||||
private function get_translations() {
|
||||
$locale = get_user_locale();
|
||||
@@ -264,68 +242,4 @@ class WPSEO_Metabox_Formatter {
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if Jetpack's markdown module is enabled.
|
||||
* Can be extended to work with other plugins that parse markdown in the content.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_markdown_enabled() {
|
||||
$is_markdown = false;
|
||||
|
||||
if ( class_exists( 'Jetpack' ) && method_exists( 'Jetpack', 'get_active_modules' ) ) {
|
||||
$active_modules = Jetpack::get_active_modules();
|
||||
|
||||
// First at all, check if Jetpack's markdown module is active.
|
||||
$is_markdown = in_array( 'markdown', $active_modules, true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters whether markdown support is active in the readability- and seo-analysis.
|
||||
*
|
||||
* @since 11.3
|
||||
*
|
||||
* @param array $is_markdown Is markdown support for Yoast SEO active.
|
||||
*/
|
||||
return apply_filters( 'wpseo_is_markdown_enabled', $is_markdown );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the user is logged in to SEMrush.
|
||||
*
|
||||
* @return bool The SEMrush login status.
|
||||
*/
|
||||
private function get_semrush_login_status() {
|
||||
try {
|
||||
$semrush_client = YoastSEO()->classes->get( SEMrush_Client::class );
|
||||
} catch ( Empty_Property_Exception $e ) {
|
||||
// Return false if token is malformed (empty property).
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get token (and refresh it if it's expired).
|
||||
try {
|
||||
$semrush_client->get_tokens();
|
||||
} catch ( Authentication_Failed_Exception $e ) {
|
||||
return false;
|
||||
} catch ( Empty_Token_Exception $e ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $semrush_client->has_valid_tokens();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a multilingual plugin is currently active. Currently, we only check the following plugins: WPML, Polylang, and TranslatePress.
|
||||
*
|
||||
* @return bool Whether a multilingual plugin is currently active.
|
||||
*/
|
||||
private function multilingual_plugin_active() {
|
||||
$wpml_active = YoastSEO()->classes->get( WPML_Conditional::class )->is_met();
|
||||
$polylang_active = YoastSEO()->classes->get( Polylang_Conditional::class )->is_met();
|
||||
$translatepress_active = YoastSEO()->classes->get( TranslatePress_Conditional::class )->is_met();
|
||||
|
||||
return ( $wpml_active || $polylang_active || $translatepress_active );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,9 +269,9 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
/**
|
||||
* Adds CSS classes to the meta box.
|
||||
*
|
||||
* @param array $classes An array of postbox CSS classes.
|
||||
* @param string[] $classes An array of postbox CSS classes.
|
||||
*
|
||||
* @return array List of classes that will be applied to the editbox container.
|
||||
* @return string[] List of classes that will be applied to the editbox container.
|
||||
*/
|
||||
public function wpseo_metabox_class( $classes ) {
|
||||
$classes[] = 'yoast wpseo-metabox';
|
||||
@@ -282,7 +282,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
/**
|
||||
* Passes variables to js for use with the post-scraper.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string,string|array<string|int|bool>|bool|int>
|
||||
*/
|
||||
public function get_metabox_script_data() {
|
||||
$permalink = '';
|
||||
@@ -297,7 +297,6 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
);
|
||||
|
||||
$values = $post_formatter->get_values();
|
||||
|
||||
/** This filter is documented in admin/filters/class-cornerstone-filter.php. */
|
||||
$post_types = apply_filters( 'wpseo_cornerstone_post_types', WPSEO_Post_Type::get_accessible_post_types() );
|
||||
if ( $values['cornerstoneActive'] && ! in_array( $this->get_metabox_post()->post_type, $post_types, true ) ) {
|
||||
@@ -513,8 +512,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
*
|
||||
* @todo [JRF] Check if $class is added appropriately everywhere.
|
||||
*
|
||||
* @param array $meta_field_def Contains the vars based on which output is generated.
|
||||
* @param string $key Internal key (without prefix).
|
||||
* @param string[] $meta_field_def Contains the vars based on which output is generated.
|
||||
* @param string $key Internal key (without prefix).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -967,7 +966,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
/**
|
||||
* Returns post in metabox context.
|
||||
*
|
||||
* @return WP_Post|array
|
||||
* @return WP_Post|array<string|int|bool>
|
||||
*/
|
||||
protected function get_metabox_post() {
|
||||
if ( $this->post !== null ) {
|
||||
@@ -996,7 +995,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
/**
|
||||
* Returns an array with shortcode tags for all registered shortcodes.
|
||||
*
|
||||
* @return array
|
||||
* @return string[]
|
||||
*/
|
||||
private function get_valid_shortcode_tags() {
|
||||
$shortcode_tags = [];
|
||||
@@ -1011,7 +1010,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
/**
|
||||
* Prepares the replace vars for localization.
|
||||
*
|
||||
* @return array Replace vars.
|
||||
* @return string[] Replace vars.
|
||||
*/
|
||||
private function get_replace_vars() {
|
||||
$cached_replacement_vars = [];
|
||||
@@ -1060,7 +1059,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
/**
|
||||
* Prepares the recommended replace vars for localization.
|
||||
*
|
||||
* @return array Recommended replacement variables.
|
||||
* @return array<string[]> Recommended replacement variables.
|
||||
*/
|
||||
private function get_recommended_replace_vars() {
|
||||
$recommended_replace_vars = new WPSEO_Admin_Recommended_Replace_Vars();
|
||||
@@ -1076,7 +1075,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
*
|
||||
* @param WP_Post $post The post to check for custom taxonomies and fields.
|
||||
*
|
||||
* @return array Array containing all the replacement variables.
|
||||
* @return array<string[]> Array containing all the replacement variables.
|
||||
*/
|
||||
private function get_custom_replace_vars( $post ) {
|
||||
return [
|
||||
@@ -1090,7 +1089,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
*
|
||||
* @param WP_Post $post The post to check for custom taxonomies.
|
||||
*
|
||||
* @return array Array containing all the replacement variables.
|
||||
* @return array<string[]> Array containing all the replacement variables.
|
||||
*/
|
||||
private function get_custom_taxonomies_replace_vars( $post ) {
|
||||
$taxonomies = get_object_taxonomies( $post, 'objects' );
|
||||
@@ -1121,7 +1120,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
*
|
||||
* @param WP_Post $post The post to check for custom fields.
|
||||
*
|
||||
* @return array Array containing all the replacement variables.
|
||||
* @return array<string[]> Array containing all the replacement variables.
|
||||
*/
|
||||
private function get_custom_fields_replace_vars( $post ) {
|
||||
$custom_replace_vars = [];
|
||||
|
||||
@@ -225,7 +225,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
/* translators: %s expands to Yoast SEO Premium */
|
||||
. ' ' . sprintf( __( 'With %s, you can easily create such redirects.', 'wordpress-seo' ), 'Yoast SEO Premium' )
|
||||
. '</p>'
|
||||
. '<p><a class="yoast-button-upsell" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/1d0' ) . '" target="_blank">'
|
||||
. '<p><a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/1d0' ) . '" target="_blank">'
|
||||
/* translators: %s expands to Yoast SEO Premium */
|
||||
. sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' )
|
||||
/* translators: Hidden accessibility text. */
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"version": "22.7",
|
||||
"name": "yoast/faq-block",
|
||||
"title": "Yoast FAQ",
|
||||
"description": "List your Frequently Asked Questions in an SEO-friendly way.",
|
||||
"category": "yoast-structured-data-blocks",
|
||||
"icon": "editor-ul",
|
||||
"keywords": [
|
||||
"FAQ",
|
||||
"Frequently Asked Questions",
|
||||
"Schema",
|
||||
"SEO",
|
||||
"Structured Data"
|
||||
],
|
||||
"supports": {
|
||||
"multiple": false
|
||||
},
|
||||
"textdomain": "wordpress-seo",
|
||||
"attributes": {
|
||||
"questions": {
|
||||
"type": "array"
|
||||
},
|
||||
"additionalListCssClasses": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"attributes": {
|
||||
"steps": [
|
||||
{
|
||||
"id": "faq-question-1",
|
||||
"question": [ ],
|
||||
"answer": [ ]
|
||||
},
|
||||
{
|
||||
"id": "faq-question-2",
|
||||
"question": [ ],
|
||||
"answer": [ ]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"editorScript": "yoast-seo-faq-block",
|
||||
"editorStyle": "yoast-seo-structured-data-blocks"
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"version": "22.7",
|
||||
"name": "yoast/how-to-block",
|
||||
"title": "Yoast How-to",
|
||||
"description": "Create a How-to guide in an SEO-friendly way. You can only use one How-to block per post.",
|
||||
"category": "yoast-structured-data-blocks",
|
||||
"icon": "editor-ol",
|
||||
"keywords": [
|
||||
"How-to",
|
||||
"How to",
|
||||
"Schema",
|
||||
"SEO",
|
||||
"Structured Data"
|
||||
],
|
||||
"supports": {
|
||||
"multiple": false
|
||||
},
|
||||
"textdomain": "wordpress-seo",
|
||||
"attributes": {
|
||||
"hasDuration": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"days": {
|
||||
"type": "string"
|
||||
},
|
||||
"hours": {
|
||||
"type": "string"
|
||||
},
|
||||
"minutes": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"source": "html",
|
||||
"selector": ".schema-how-to-description"
|
||||
},
|
||||
"jsonDescription": {
|
||||
"type": "string"
|
||||
},
|
||||
"steps": {
|
||||
"type": "array"
|
||||
},
|
||||
"additionalListCssClasses": {
|
||||
"type": "string"
|
||||
},
|
||||
"unorderedList": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"durationText": {
|
||||
"type": "string"
|
||||
},
|
||||
"defaultDurationText": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"example": {
|
||||
"attributes": {
|
||||
"steps": [
|
||||
{
|
||||
"id": "how-to-step-example-1",
|
||||
"name": [ ],
|
||||
"text": [ ]
|
||||
},
|
||||
{
|
||||
"id": "how-to-step-example-2",
|
||||
"name": [ ],
|
||||
"text": [ ]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"editorScript": "yoast-seo-how-to-block",
|
||||
"editorStyle": "yoast-seo-structured-data-blocks"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.yst-replacevar__editor--description div{display:inline}.yst-replacevar__editor--description .yst-replacevar__editor-wrapper--description div{display:block}.yst-replacevar__editor--description .yst-root{margin-left:.25rem}.yst-replacevar__editor--description .yst-root .yst-badge{margin-bottom:.125rem}.yst-replacevar__editor--description .yst-root .yst-tooltip.yst-tooltip--top:before{--tw-translate-x:-14rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
|
||||
@@ -0,0 +1 @@
|
||||
.yst-replacevar__editor--description div{display:inline}.yst-replacevar__editor--description .yst-replacevar__editor-wrapper--description div{display:block}.yst-replacevar__editor--description .yst-root{margin-right:.25rem}.yst-replacevar__editor--description .yst-root .yst-badge{margin-bottom:.125rem}.yst-replacevar__editor--description .yst-root .yst-tooltip.yst-tooltip--top:before{--tw-translate-x:-14rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
.schema-faq-section,.schema-how-to-step{border:1px solid #9197a240;list-style-type:none;margin:4px 0;padding:8px 32px 8px 4px;position:relative}.schema-faq-buttons,.schema-how-to-buttons{display:flex;justify-content:center}.schema-faq-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-mover,.schema-how-to-step-mover{display:inline-block}.schema-faq-section-mover .editor-block-mover__control,.schema-how-to-step-mover .editor-block-mover__control{display:inline-flex;height:36px;width:36px}.schema-faq-question,.schema-how-to-step-name{font-weight:600}.schema-faq .schema-faq-answer,.schema-faq .schema-faq-question,.schema-how-to .schema-how-to-description,.schema-how-to .schema-how-to-step-name,.schema-how-to .schema-how-to-step-text,.schema-how-to .schema-how-to-steps{line-height:inherit;margin:0}.schema-how-to .schema-how-to-steps{padding-top:0}.schema-faq-section-button-container,.schema-how-to-step-button-container{display:inline-flex;text-align:left}.schema-faq-section-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-step-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-controls-container,.schema-how-to-step-controls-container{margin-right:-28px;text-align:left}.schema-faq-section-controls-container .dashicons-arrow-up-alt2,.schema-how-to-step-controls-container .dashicons-arrow-up-alt2{position:relative;top:-1px}.faq-section-add-media .dashicon,.how-to-step-add-media .dashicon,.schema-faq-add-question .dashicon,.schema-how-to-add-step .dashicon,.schema-how-to-duration-button .dashicon{margin-left:4px}.schema-how-to{padding-top:4px}.schema-how-to-step-number{right:4px;position:absolute;text-align:left;width:24px}.schema-how-to-duration-flex-container{align-items:center;display:flex}.schema-how-to-duration-time-input{align-items:center;display:inline-flex;flex-wrap:nowrap}legend.schema-how-to-duration-legend{margin-left:4px}#schema-how-to-duration-days{margin-left:8px}.schema-how-to-duration .schema-how-to-duration-input[type=number]{-moz-appearance:textfield;margin:0 2px;padding:6px 4px;text-align:center;width:40px}.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-inner-spin-button,.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.schema-how-to-duration-button.components-icon-button{margin-right:-8px;vertical-align:top}.schema-how-to-duration-button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-how-to-description{margin:8px 0}body.is-dark-theme .schema-faq-section-mover button.components-button,body.is-dark-theme .schema-how-to-step-mover button.components-button,body.is-dark-theme button.components-button.schema-faq-add-question,body.is-dark-theme button.components-button.schema-faq-section-button,body.is-dark-theme button.components-button.schema-how-to-add-step,body.is-dark-theme button.components-button.schema-how-to-duration-button,body.is-dark-theme button.components-button.schema-how-to-step-button{color:#e8eaed}
|
||||
.schema-faq-section,.schema-how-to-step{border:1px solid #9197a240;list-style-type:none;margin:4px 0;padding:8px 32px 8px 4px;position:relative}.schema-faq-buttons,.schema-how-to-buttons{display:flex;justify-content:center}.schema-faq-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-mover,.schema-how-to-step-mover{display:inline-block}.schema-faq-section-mover .editor-block-mover__control,.schema-how-to-step-mover .editor-block-mover__control{display:inline-flex;height:36px;width:36px}.schema-faq-question,.schema-how-to-step-name{font-weight:600}.schema-faq .schema-faq-answer,.schema-faq .schema-faq-question,.schema-how-to .schema-how-to-description,.schema-how-to .schema-how-to-step-name,.schema-how-to .schema-how-to-step-text,.schema-how-to .schema-how-to-steps{line-height:inherit;margin:0}.schema-how-to .schema-how-to-steps{padding-top:0}.schema-faq-section-button-container,.schema-how-to-step-button-container{display:inline-flex;text-align:left}.schema-faq-section-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-step-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-controls-container,.schema-how-to-step-controls-container{margin-right:-28px;text-align:left}.schema-faq-section-controls-container .dashicons-arrow-up-alt2,.schema-how-to-step-controls-container .dashicons-arrow-up-alt2{position:relative;top:-1px}.faq-section-add-media .dashicon,.how-to-step-add-media .dashicon,.schema-faq-add-question .dashicon,.schema-how-to-add-step .dashicon,.schema-how-to-duration-button .dashicon{margin-left:4px}.schema-how-to{padding-top:4px}.schema-how-to-step-number{right:4px;position:absolute;text-align:left;width:24px}.schema-how-to-duration{border:0;margin:0;padding:0}.schema-how-to-duration-flex-container{align-items:center;display:flex}.schema-how-to-duration-time-input{align-items:center;display:inline-flex;flex-wrap:nowrap}legend.schema-how-to-duration-legend{margin-left:4px}#schema-how-to-duration-days{margin-left:8px}.schema-how-to-duration .schema-how-to-duration-input[type=number]{-moz-appearance:textfield;margin:0 2px;padding:6px 4px;text-align:center;width:40px}.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-inner-spin-button,.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.schema-how-to-duration-button.components-icon-button{margin-right:-8px;vertical-align:top}.schema-how-to-duration-button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-how-to-description{margin:8px 0}body.is-dark-theme .schema-faq-section-mover button.components-button,body.is-dark-theme .schema-how-to-step-mover button.components-button,body.is-dark-theme button.components-button.schema-faq-add-question,body.is-dark-theme button.components-button.schema-faq-section-button,body.is-dark-theme button.components-button.schema-how-to-add-step,body.is-dark-theme button.components-button.schema-how-to-duration-button,body.is-dark-theme button.components-button.schema-how-to-step-button{color:#e8eaed}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
.schema-faq-section,.schema-how-to-step{border:1px solid #9197a240;list-style-type:none;margin:4px 0;padding:8px 4px 8px 32px;position:relative}.schema-faq-buttons,.schema-how-to-buttons{display:flex;justify-content:center}.schema-faq-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-mover,.schema-how-to-step-mover{display:inline-block}.schema-faq-section-mover .editor-block-mover__control,.schema-how-to-step-mover .editor-block-mover__control{display:inline-flex;height:36px;width:36px}.schema-faq-question,.schema-how-to-step-name{font-weight:600}.schema-faq .schema-faq-answer,.schema-faq .schema-faq-question,.schema-how-to .schema-how-to-description,.schema-how-to .schema-how-to-step-name,.schema-how-to .schema-how-to-step-text,.schema-how-to .schema-how-to-steps{line-height:inherit;margin:0}.schema-how-to .schema-how-to-steps{padding-top:0}.schema-faq-section-button-container,.schema-how-to-step-button-container{display:inline-flex;text-align:right}.schema-faq-section-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-step-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-controls-container,.schema-how-to-step-controls-container{margin-left:-28px;text-align:right}.schema-faq-section-controls-container .dashicons-arrow-up-alt2,.schema-how-to-step-controls-container .dashicons-arrow-up-alt2{position:relative;top:-1px}.faq-section-add-media .dashicon,.how-to-step-add-media .dashicon,.schema-faq-add-question .dashicon,.schema-how-to-add-step .dashicon,.schema-how-to-duration-button .dashicon{margin-right:4px}.schema-how-to{padding-top:4px}.schema-how-to-step-number{left:4px;position:absolute;text-align:right;width:24px}.schema-how-to-duration-flex-container{align-items:center;display:flex}.schema-how-to-duration-time-input{align-items:center;display:inline-flex;flex-wrap:nowrap}legend.schema-how-to-duration-legend{margin-right:4px}#schema-how-to-duration-days{margin-right:8px}.schema-how-to-duration .schema-how-to-duration-input[type=number]{-moz-appearance:textfield;margin:0 2px;padding:6px 4px;text-align:center;width:40px}.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-inner-spin-button,.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.schema-how-to-duration-button.components-icon-button{margin-left:-8px;vertical-align:top}.schema-how-to-duration-button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-how-to-description{margin:8px 0}body.is-dark-theme .schema-faq-section-mover button.components-button,body.is-dark-theme .schema-how-to-step-mover button.components-button,body.is-dark-theme button.components-button.schema-faq-add-question,body.is-dark-theme button.components-button.schema-faq-section-button,body.is-dark-theme button.components-button.schema-how-to-add-step,body.is-dark-theme button.components-button.schema-how-to-duration-button,body.is-dark-theme button.components-button.schema-how-to-step-button{color:#e8eaed}
|
||||
.schema-faq-section,.schema-how-to-step{border:1px solid #9197a240;list-style-type:none;margin:4px 0;padding:8px 4px 8px 32px;position:relative}.schema-faq-buttons,.schema-how-to-buttons{display:flex;justify-content:center}.schema-faq-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-buttons button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-mover,.schema-how-to-step-mover{display:inline-block}.schema-faq-section-mover .editor-block-mover__control,.schema-how-to-step-mover .editor-block-mover__control{display:inline-flex;height:36px;width:36px}.schema-faq-question,.schema-how-to-step-name{font-weight:600}.schema-faq .schema-faq-answer,.schema-faq .schema-faq-question,.schema-how-to .schema-how-to-description,.schema-how-to .schema-how-to-step-name,.schema-how-to .schema-how-to-step-text,.schema-how-to .schema-how-to-steps{line-height:inherit;margin:0}.schema-how-to .schema-how-to-steps{padding-top:0}.schema-faq-section-button-container,.schema-how-to-step-button-container{display:inline-flex;text-align:right}.schema-faq-section-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.schema-how-to-step-button-container button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-faq-section-controls-container,.schema-how-to-step-controls-container{margin-left:-28px;text-align:right}.schema-faq-section-controls-container .dashicons-arrow-up-alt2,.schema-how-to-step-controls-container .dashicons-arrow-up-alt2{position:relative;top:-1px}.faq-section-add-media .dashicon,.how-to-step-add-media .dashicon,.schema-faq-add-question .dashicon,.schema-how-to-add-step .dashicon,.schema-how-to-duration-button .dashicon{margin-right:4px}.schema-how-to{padding-top:4px}.schema-how-to-step-number{left:4px;position:absolute;text-align:right;width:24px}.schema-how-to-duration{border:0;margin:0;padding:0}.schema-how-to-duration-flex-container{align-items:center;display:flex}.schema-how-to-duration-time-input{align-items:center;display:inline-flex;flex-wrap:nowrap}legend.schema-how-to-duration-legend{margin-right:4px}#schema-how-to-duration-days{margin-right:8px}.schema-how-to-duration .schema-how-to-duration-input[type=number]{-moz-appearance:textfield;margin:0 2px;padding:6px 4px;text-align:center;width:40px}.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-inner-spin-button,.schema-how-to-duration .schema-how-to-duration-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.schema-how-to-duration-button.components-icon-button{margin-left:-8px;vertical-align:top}.schema-how-to-duration-button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{box-shadow:none;color:#007cba}.schema-how-to-description{margin:8px 0}body.is-dark-theme .schema-faq-section-mover button.components-button,body.is-dark-theme .schema-how-to-step-mover button.components-button,body.is-dark-theme button.components-button.schema-faq-add-question,body.is-dark-theme button.components-button.schema-faq-section-button,body.is-dark-theme button.components-button.schema-how-to-add-step,body.is-dark-theme button.components-button.schema-how-to-duration-button,body.is-dark-theme button.components-button.schema-how-to-step-button{color:#e8eaed}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -552,9 +552,12 @@ class WPSEO_Addon_Manager {
|
||||
* @return stdClass The converted subscription.
|
||||
*/
|
||||
protected function convert_subscription_to_plugin( $subscription, $yoast_free_data = null, $plugin_info = false, $plugin_file = '' ) {
|
||||
// We need to replace h2's and h3's with h4's because the styling expects that.
|
||||
$changelog = str_replace( '</h2', '</h4', str_replace( '<h2', '<h4', $subscription->product->changelog ) );
|
||||
$changelog = str_replace( '</h3', '</h4', str_replace( '<h3', '<h4', $changelog ) );
|
||||
$changelog = '';
|
||||
if ( isset( $subscription->product->changelog ) ) {
|
||||
// We need to replace h2's and h3's with h4's because the styling expects that.
|
||||
$changelog = str_replace( '</h2', '</h4', str_replace( '<h2', '<h4', $subscription->product->changelog ) );
|
||||
$changelog = str_replace( '</h3', '</h4', str_replace( '<h3', '<h4', $changelog ) );
|
||||
}
|
||||
|
||||
// If we're running this because we want to just show the plugin info in the version details modal, we can fallback to the Yoast Free constants, since that modal will not be accessible anyway in the event that the new Free version increases those constants.
|
||||
$defaults = [
|
||||
@@ -563,7 +566,7 @@ class WPSEO_Addon_Manager {
|
||||
];
|
||||
|
||||
return (object) [
|
||||
'new_version' => $subscription->product->version,
|
||||
'new_version' => ( $subscription->product->version ?? '' ),
|
||||
'name' => $subscription->product->name,
|
||||
'slug' => $subscription->product->slug,
|
||||
'plugin' => $plugin_file,
|
||||
|
||||
@@ -33,7 +33,7 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Retrieves the content of the history items currently stored.
|
||||
*
|
||||
* @return array The contents of the history option.
|
||||
* @return array<array<string>> The contents of the history option.
|
||||
*/
|
||||
public function get() {
|
||||
$data = get_option( $this->get_option_name(), [] );
|
||||
@@ -47,9 +47,9 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Adds a new history entry in the storage.
|
||||
*
|
||||
* @param string $old_version The version we are upgrading from.
|
||||
* @param string $new_version The version we are upgrading to.
|
||||
* @param array $option_names The options that need to be stored.
|
||||
* @param string $old_version The version we are upgrading from.
|
||||
* @param string $new_version The version we are upgrading to.
|
||||
* @param array<string> $option_names The options that need to be stored.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -76,23 +76,24 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Retrieves the data for the specified option names from the database.
|
||||
*
|
||||
* @param array $option_names The option names to retrieve.
|
||||
* @param array<string> $option_names The option names to retrieve.
|
||||
*
|
||||
* @return array
|
||||
* @return array<int|string|bool|float,array<string|int|bool|float>> The retrieved data.
|
||||
*/
|
||||
protected function get_options_data( array $option_names ) {
|
||||
$wpdb = $this->get_wpdb();
|
||||
|
||||
$sql = $wpdb->prepare(
|
||||
'
|
||||
SELECT option_value, option_name FROM ' . $wpdb->options . ' WHERE
|
||||
option_name IN ( ' . implode( ',', array_fill( 0, count( $option_names ), '%s' ) ) . ' )
|
||||
',
|
||||
$option_names
|
||||
$results = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
'
|
||||
SELECT %i, %i FROM ' . $wpdb->options . ' WHERE
|
||||
%i IN ( ' . implode( ',', array_fill( 0, count( $option_names ), '%s' ) ) . ' )
|
||||
',
|
||||
array_merge( [ 'option_value', 'option_name', 'option_name' ], $option_names )
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
$results = $wpdb->get_results( $sql, ARRAY_A );
|
||||
|
||||
$data = [];
|
||||
foreach ( $results as $result ) {
|
||||
$data[ $result['option_name'] ] = maybe_unserialize( $result['option_value'] );
|
||||
@@ -104,7 +105,7 @@ class WPSEO_Upgrade_History {
|
||||
/**
|
||||
* Stores the new history state.
|
||||
*
|
||||
* @param array $data The data to store.
|
||||
* @param array<array<string>> $data The data to store.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
@@ -90,6 +90,7 @@ class WPSEO_Upgrade {
|
||||
'20.5-RC0' => 'upgrade_205',
|
||||
'20.7-RC0' => 'upgrade_207',
|
||||
'20.8-RC0' => 'upgrade_208',
|
||||
'22.6-RC0' => 'upgrade_226',
|
||||
];
|
||||
|
||||
array_walk( $routines, [ $this, 'run_upgrade_routine' ], $version );
|
||||
@@ -252,6 +253,8 @@ class WPSEO_Upgrade {
|
||||
* @return void
|
||||
*/
|
||||
public function upgrade_23_query() {
|
||||
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Reason: executed only during the upgrade routine.
|
||||
// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value -- Reason: executed only during the upgrade routine.
|
||||
$wp_query = new WP_Query( 'post_type=any&meta_key=_yoast_wpseo_sitemap-include&meta_value=never&order=ASC' );
|
||||
|
||||
if ( ! empty( $wp_query->posts ) ) {
|
||||
@@ -304,11 +307,18 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function upgrade_36() {
|
||||
protected function upgrade_36() {
|
||||
global $wpdb;
|
||||
|
||||
// Between 3.2 and 3.4 the sitemap options were saved with autoloading enabled.
|
||||
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "wpseo_sitemap_%" AND autoload = "yes"' );
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
'DELETE FROM %i WHERE %i LIKE %s AND autoload IN ("on", "yes")',
|
||||
[ $wpdb->options, 'option_name', 'wpseo_sitemap_%' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,6 +355,8 @@ class WPSEO_Upgrade {
|
||||
global $wpdb;
|
||||
|
||||
// The meta key has to be private, so prefix it.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
'UPDATE ' . $wpdb->postmeta . ' SET meta_key = %s WHERE meta_key = "yst_is_cornerstone"',
|
||||
@@ -358,7 +370,7 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function upgrade_49() {
|
||||
protected function upgrade_49() {
|
||||
global $wpdb;
|
||||
|
||||
/*
|
||||
@@ -371,15 +383,16 @@ class WPSEO_Upgrade {
|
||||
|
||||
$meta_key = $wpdb->get_blog_prefix() . Yoast_Notification_Center::STORAGE_KEY;
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$usermetas = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
'
|
||||
SELECT user_id, meta_value
|
||||
FROM ' . $wpdb->usermeta . '
|
||||
WHERE meta_key = %s AND meta_value LIKE %s
|
||||
SELECT %i, %i
|
||||
FROM %i
|
||||
WHERE %i = %s AND %i LIKE %s
|
||||
',
|
||||
$meta_key,
|
||||
'%wpseo-dismiss-about%'
|
||||
[ 'user_id', 'meta_value', $wpdb->usermeta, 'meta_key', $meta_key, 'meta_value', '%wpseo-dismiss-about%' ]
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
@@ -423,11 +436,19 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function upgrade_50() {
|
||||
protected function upgrade_50() {
|
||||
global $wpdb;
|
||||
|
||||
// Deletes the post meta value, which might created in the RC.
|
||||
$wpdb->query( 'DELETE FROM ' . $wpdb->postmeta . ' WHERE meta_key = "_yst_content_links_processed"' );
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = '_yst_content_links_processed'",
|
||||
[ $wpdb->postmeta, 'meta_key' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -520,6 +541,8 @@ class WPSEO_Upgrade {
|
||||
|
||||
// Moves the user meta for excluding from the XML sitemap to a noindex.
|
||||
global $wpdb;
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query( "UPDATE $wpdb->usermeta SET meta_key = 'wpseo_noindex_author' WHERE meta_key = 'wpseo_excludeauthorsitemap'" );
|
||||
}
|
||||
|
||||
@@ -549,6 +572,8 @@ class WPSEO_Upgrade {
|
||||
private function upgrade_73() {
|
||||
global $wpdb;
|
||||
// We've moved the cornerstone checkbox to our proper namespace.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_yoast_wpseo_is_cornerstone' WHERE meta_key = '_yst_is_cornerstone'" );
|
||||
|
||||
// Remove the previous Whip dismissed message, as this is a new one regarding PHP 5.2.
|
||||
@@ -560,7 +585,7 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function upgrade_74() {
|
||||
protected function upgrade_74() {
|
||||
$this->remove_sitemap_validators();
|
||||
}
|
||||
|
||||
@@ -612,7 +637,7 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function upgrade_90() {
|
||||
protected function upgrade_90() {
|
||||
global $wpdb;
|
||||
|
||||
// Invalidate all sitemap cache transients.
|
||||
@@ -621,7 +646,15 @@ class WPSEO_Upgrade {
|
||||
// Removes all scheduled tasks for hitting the sitemap index.
|
||||
wp_clear_scheduled_hook( 'wpseo_hit_sitemap_index' );
|
||||
|
||||
$wpdb->query( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "wpseo_sitemap_%"' );
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
'DELETE FROM %i
|
||||
WHERE %i LIKE %s',
|
||||
[ $wpdb->options, 'option_name', 'wpseo_sitemap_%' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -698,7 +731,15 @@ class WPSEO_Upgrade {
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'wp_yoast_promo_hide_premium_upsell_admin_block'" );
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
'DELETE FROM %i
|
||||
WHERE %i = %s',
|
||||
[ $wpdb->usermeta, 'meta_key', 'wp_yoast_promo_hide_premium_upsell_admin_block' ]
|
||||
)
|
||||
);
|
||||
|
||||
// Removes the WordPress update notification, because it is no longer necessary when WordPress 5.3 is released.
|
||||
$center = Yoast_Notification_Center::get();
|
||||
@@ -1096,6 +1137,19 @@ class WPSEO_Upgrade {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the 22.6 upgrade routine.
|
||||
* Schedules another cleanup scheduled action, but starting from the last cleanup action we just added (if there aren't any running cleanups already).
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function upgrade_226() {
|
||||
if ( get_option( Cleanup_Integration::CURRENT_TASK_OPTION ) === false ) {
|
||||
$cleanup_integration = YoastSEO()->classes->get( Cleanup_Integration::class );
|
||||
$cleanup_integration->start_cron_job( 'clean_selected_empty_usermeta', DAY_IN_SECONDS );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the home_url option for the 15.1 upgrade routine.
|
||||
*
|
||||
@@ -1150,19 +1204,20 @@ class WPSEO_Upgrade {
|
||||
return;
|
||||
}
|
||||
|
||||
$indexable_table = Model::get_table_name( 'Indexable' );
|
||||
$replacements = array_merge( [ Model::get_table_name( 'Indexable' ), 'object_type', 'object_sub_type' ], $private_taxonomies );
|
||||
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
|
||||
$query = $wpdb->prepare(
|
||||
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: Too hard to fix.
|
||||
"DELETE FROM $indexable_table
|
||||
WHERE object_type = 'term'
|
||||
AND object_sub_type IN ("
|
||||
. implode( ', ', array_fill( 0, count( $private_taxonomies ), '%s' ) )
|
||||
. ')',
|
||||
$private_taxonomies
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = 'term'
|
||||
AND %i IN ("
|
||||
. implode( ', ', array_fill( 0, count( $private_taxonomies ), '%s' ) )
|
||||
. ')',
|
||||
$replacements
|
||||
)
|
||||
);
|
||||
$wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
|
||||
|
||||
$wpdb->show_errors = $show_errors;
|
||||
}
|
||||
@@ -1180,9 +1235,14 @@ class WPSEO_Upgrade {
|
||||
$wpdb->show_errors = false;
|
||||
|
||||
// Reset the permalinks of the attachments in the indexable table.
|
||||
$indexable_table = Model::get_table_name( 'Indexable' );
|
||||
$query = "UPDATE $indexable_table SET permalink = NULL WHERE object_type = 'post' AND object_sub_type = 'attachment'";
|
||||
$wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Reason: There is no user input.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"UPDATE %i SET %i = NULL WHERE %i = 'post' AND %i = 'attachment'",
|
||||
[ Model::get_table_name( 'Indexable' ), 'permalink', 'object_type', 'object_sub_type' ]
|
||||
)
|
||||
);
|
||||
|
||||
$wpdb->show_errors = $show_errors;
|
||||
}
|
||||
@@ -1254,7 +1314,14 @@ class WPSEO_Upgrade {
|
||||
global $wpdb;
|
||||
|
||||
// Remove all sitemap validators.
|
||||
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'wpseo_sitemap%validator%'" );
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
'DELETE FROM %i WHERE %i LIKE %s',
|
||||
[ $wpdb->options, 'option_name', 'wpseo_sitemap%validator%' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1262,14 +1329,22 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @param string $option_name Option to retrieve.
|
||||
*
|
||||
* @return array|mixed The content of the option if exists, otherwise an empty array.
|
||||
* @return int|string|bool|float|array<string|int|bool|float> The content of the option if exists, otherwise an empty array.
|
||||
*/
|
||||
protected function get_option_from_database( $option_name ) {
|
||||
global $wpdb;
|
||||
|
||||
// Load option directly from the database, to avoid filtering and sanitization.
|
||||
$sql = $wpdb->prepare( 'SELECT option_value FROM ' . $wpdb->options . ' WHERE option_name = %s', $option_name );
|
||||
$results = $wpdb->get_results( $sql, ARRAY_A ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is is already prepared.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$results = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
'SELECT %i FROM %i WHERE %i = %s',
|
||||
[ 'option_value', $wpdb->options, 'option_name', $option_name ]
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
if ( ! empty( $results ) ) {
|
||||
return maybe_unserialize( $results[0]['option_value'] );
|
||||
}
|
||||
@@ -1302,9 +1377,9 @@ class WPSEO_Upgrade {
|
||||
/**
|
||||
* Saves an option setting to where it should be stored.
|
||||
*
|
||||
* @param array $source_data The option containing the value to be migrated.
|
||||
* @param string $source_setting Name of the key in the "from" option.
|
||||
* @param string|null $target_setting Name of the key in the "to" option.
|
||||
* @param int|string|bool|float|array<string|int|bool|float> $source_data The option containing the value to be migrated.
|
||||
* @param string $source_setting Name of the key in the "from" option.
|
||||
* @param string|null $target_setting Name of the key in the "to" option.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -1513,29 +1588,31 @@ class WPSEO_Upgrade {
|
||||
|
||||
$included_post_types = YoastSEO()->helpers->post_type->get_indexable_post_types();
|
||||
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: Too hard to fix.
|
||||
if ( empty( $included_post_types ) ) {
|
||||
$delete_query = "
|
||||
DELETE FROM $indexable_table
|
||||
WHERE object_type = 'post'
|
||||
AND object_sub_type IS NOT NULL";
|
||||
}
|
||||
else {
|
||||
$delete_query = $wpdb->prepare(
|
||||
"DELETE FROM $indexable_table
|
||||
WHERE object_type = 'post'
|
||||
AND object_sub_type IS NOT NULL
|
||||
AND object_sub_type NOT IN ( " . implode( ', ', array_fill( 0, count( $included_post_types ), '%s' ) ) . ' )',
|
||||
$included_post_types
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = 'post'
|
||||
AND %i IS NOT NULL",
|
||||
[ $indexable_table, 'object_type', 'object_sub_type' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = 'post'
|
||||
AND %i IS NOT NULL
|
||||
AND %i NOT IN ( " . implode( ', ', array_fill( 0, count( $included_post_types ), '%s' ) ) . ' )',
|
||||
array_merge( [ $indexable_table, 'object_type', 'object_sub_type', 'object_sub_type' ], $included_post_types )
|
||||
)
|
||||
);
|
||||
}
|
||||
// phpcs:enable
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
|
||||
$wpdb->query( $delete_query );
|
||||
// phpcs:enable
|
||||
|
||||
$wpdb->show_errors = $show_errors;
|
||||
}
|
||||
@@ -1557,28 +1634,31 @@ class WPSEO_Upgrade {
|
||||
|
||||
$included_taxonomies = YoastSEO()->helpers->taxonomy->get_indexable_taxonomies();
|
||||
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: Too hard to fix.
|
||||
if ( empty( $included_taxonomies ) ) {
|
||||
$delete_query = "DELETE FROM $indexable_table
|
||||
WHERE object_type = 'term'
|
||||
AND object_sub_type IS NOT NULL";
|
||||
}
|
||||
else {
|
||||
$delete_query = $wpdb->prepare(
|
||||
"DELETE FROM $indexable_table
|
||||
WHERE object_type = 'term'
|
||||
AND object_sub_type IS NOT NULL
|
||||
AND object_sub_type NOT IN ( " . implode( ', ', array_fill( 0, count( $included_taxonomies ), '%s' ) ) . ' )',
|
||||
$included_taxonomies
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = 'term'
|
||||
AND %i IS NOT NULL",
|
||||
[ $indexable_table, 'object_type', 'object_sub_type' ]
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = 'term'
|
||||
AND %i IS NOT NULL
|
||||
AND %i NOT IN ( " . implode( ', ', array_fill( 0, count( $included_taxonomies ), '%s' ) ) . ' )',
|
||||
array_merge( [ $indexable_table, 'object_type', 'object_sub_type', 'object_sub_type' ], $included_taxonomies )
|
||||
)
|
||||
);
|
||||
}
|
||||
// phpcs:enable
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
|
||||
$wpdb->query( $delete_query );
|
||||
// phpcs:enable
|
||||
|
||||
$wpdb->show_errors = $show_errors;
|
||||
}
|
||||
@@ -1588,22 +1668,24 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function deduplicate_unindexed_indexable_rows() {
|
||||
protected function deduplicate_unindexed_indexable_rows() {
|
||||
global $wpdb;
|
||||
|
||||
// If migrations haven't been completed successfully the following may give false errors. So suppress them.
|
||||
$show_errors = $wpdb->show_errors;
|
||||
$wpdb->show_errors = false;
|
||||
|
||||
$indexable_table = Model::get_table_name( 'Indexable' );
|
||||
|
||||
$query = "
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$duplicates = $wpdb->get_results(
|
||||
$wpdb->prepare(
|
||||
"
|
||||
SELECT
|
||||
MAX(id) as newest_id,
|
||||
object_id,
|
||||
object_type
|
||||
FROM
|
||||
$indexable_table
|
||||
%i
|
||||
WHERE
|
||||
post_status = 'unindexed'
|
||||
AND object_type IN ( 'term', 'post', 'user' )
|
||||
@@ -1611,13 +1693,11 @@ class WPSEO_Upgrade {
|
||||
object_id,
|
||||
object_type
|
||||
HAVING
|
||||
count(*) > 1";
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
|
||||
$duplicates = $wpdb->get_results( $query, ARRAY_A );
|
||||
// phpcs:enable
|
||||
count(*) > 1",
|
||||
[ Model::get_table_name( 'Indexable' ) ]
|
||||
),
|
||||
ARRAY_A
|
||||
);
|
||||
|
||||
if ( empty( $duplicates ) ) {
|
||||
$wpdb->show_errors = $show_errors;
|
||||
@@ -1650,25 +1730,24 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function clean_unindexed_indexable_rows_with_no_object_id() {
|
||||
protected function clean_unindexed_indexable_rows_with_no_object_id() {
|
||||
global $wpdb;
|
||||
|
||||
// If migrations haven't been completed successfully the following may give false errors. So suppress them.
|
||||
$show_errors = $wpdb->show_errors;
|
||||
$wpdb->show_errors = false;
|
||||
|
||||
$indexable_table = Model::get_table_name( 'Indexable' );
|
||||
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: No user input, just a table name.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
$wpdb->query(
|
||||
"DELETE FROM $indexable_table
|
||||
WHERE post_status = 'unindexed'
|
||||
AND object_type NOT IN ( 'home-page', 'date-archive', 'post-type-archive', 'system-page' )
|
||||
AND object_id IS NULL"
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i
|
||||
WHERE %i = 'unindexed'
|
||||
AND %i NOT IN ( 'home-page', 'date-archive', 'post-type-archive', 'system-page' )
|
||||
AND %i IS NULL",
|
||||
[ Model::get_table_name( 'Indexable' ), 'post_status', 'object_type', 'object_id' ]
|
||||
)
|
||||
);
|
||||
// phpcs:enable
|
||||
|
||||
$wpdb->show_errors = $show_errors;
|
||||
}
|
||||
@@ -1678,7 +1757,7 @@ class WPSEO_Upgrade {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function remove_indexable_rows_for_disabled_authors_archive() {
|
||||
protected function remove_indexable_rows_for_disabled_authors_archive() {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! YoastSEO()->helpers->author_archive->are_disabled() ) {
|
||||
@@ -1689,16 +1768,14 @@ class WPSEO_Upgrade {
|
||||
$show_errors = $wpdb->show_errors;
|
||||
$wpdb->show_errors = false;
|
||||
|
||||
$indexable_table = Model::get_table_name( 'Indexable' );
|
||||
|
||||
$delete_query = "DELETE FROM $indexable_table WHERE object_type = 'user'";
|
||||
// phpcs:enable
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already.
|
||||
$wpdb->query( $delete_query );
|
||||
// phpcs:enable
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"DELETE FROM %i WHERE %i = 'user'",
|
||||
[ Model::get_table_name( 'Indexable' ), 'object_type' ]
|
||||
)
|
||||
);
|
||||
|
||||
$wpdb->show_errors = $show_errors;
|
||||
}
|
||||
@@ -1706,15 +1783,13 @@ class WPSEO_Upgrade {
|
||||
/**
|
||||
* Creates a query for de-duplicating indexables for a particular type.
|
||||
*
|
||||
* @param string $object_type The object type to deduplicate.
|
||||
* @param array $duplicates The result of the duplicate query.
|
||||
* @param wpdb $wpdb The wpdb object.
|
||||
* @param string $object_type The object type to deduplicate.
|
||||
* @param string|array<array<int,int,string>> $duplicates The result of the duplicate query.
|
||||
* @param wpdb $wpdb The wpdb object.
|
||||
*
|
||||
* @return string The query that removes all but one duplicate for each object of the object type.
|
||||
*/
|
||||
private function get_indexable_deduplication_query_for_type( $object_type, $duplicates, $wpdb ) {
|
||||
$indexable_table = Model::get_table_name( 'Indexable' );
|
||||
|
||||
protected function get_indexable_deduplication_query_for_type( $object_type, $duplicates, $wpdb ) {
|
||||
$filtered_duplicates = array_filter(
|
||||
$duplicates,
|
||||
static function ( $duplicate ) use ( $object_type ) {
|
||||
@@ -1729,18 +1804,20 @@ class WPSEO_Upgrade {
|
||||
$object_ids = wp_list_pluck( $filtered_duplicates, 'object_id' );
|
||||
$newest_indexable_ids = wp_list_pluck( $filtered_duplicates, 'newest_id' );
|
||||
|
||||
// phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: Too hard to fix.
|
||||
// phpcs:disable WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber -- Reason: we're passing an array instead.
|
||||
$replacements = array_merge( [ Model::get_table_name( 'Indexable' ), 'object_id' ], array_values( $object_ids ), array_values( $newest_indexable_ids ) );
|
||||
$replacements[] = $object_type;
|
||||
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
|
||||
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
|
||||
return $wpdb->prepare(
|
||||
"DELETE FROM
|
||||
$indexable_table
|
||||
'DELETE FROM
|
||||
%i
|
||||
WHERE
|
||||
object_id IN ( " . implode( ', ', array_fill( 0, count( $filtered_duplicates ), '%d' ) ) . ' )
|
||||
%i IN ( ' . implode( ', ', array_fill( 0, count( $filtered_duplicates ), '%d' ) ) . ' )
|
||||
AND id NOT IN ( ' . implode( ', ', array_fill( 0, count( $filtered_duplicates ), '%d' ) ) . ' )
|
||||
AND object_type = %s',
|
||||
array_merge( array_values( $object_ids ), array_values( $newest_indexable_ids ), [ $object_type ] )
|
||||
$replacements
|
||||
);
|
||||
// phpcs:enable
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -450,11 +450,6 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
'title' => __( 'Google Page Speed Test', 'wordpress-seo' ),
|
||||
'href' => '//developers.google.com/speed/pagespeed/insights/?url=' . $encoded_url,
|
||||
],
|
||||
[
|
||||
'id' => 'wpseo-google-mobile-friendly',
|
||||
'title' => __( 'Mobile-Friendly Test', 'wordpress-seo' ),
|
||||
'href' => 'https://www.google.com/webmasters/tools/mobile-friendly/?url=' . $encoded_url,
|
||||
],
|
||||
];
|
||||
|
||||
$this->add_submenu_items( $submenu_items, $wp_admin_bar, self::ANALYSIS_SUBMENU_IDENTIFIER );
|
||||
@@ -595,7 +590,7 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
|
||||
$sale_percentage = sprintf(
|
||||
'<span class="admin-bar-premium-promotion">%1$s</span>',
|
||||
__( '-30%', 'wordpress-seo' )
|
||||
esc_html__( '-30%', 'wordpress-seo' )
|
||||
);
|
||||
}
|
||||
$wp_admin_bar->add_menu(
|
||||
@@ -605,8 +600,8 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
// Circumvent an issue in the WP admin bar API in order to pass `data` attributes. See https://core.trac.wordpress.org/ticket/38636.
|
||||
'title' => sprintf(
|
||||
'<a href="%1$s" target="_blank" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" style="padding:0;">%2$s » %3$s</a>',
|
||||
$this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-get-premium' ),
|
||||
__( 'Get Yoast SEO Premium', 'wordpress-seo' ),
|
||||
esc_url( $this->shortlinker->build_shortlink( 'https://yoa.st/admin-bar-get-premium' ) ),
|
||||
esc_html__( 'Get Yoast SEO Premium', 'wordpress-seo' ),
|
||||
$sale_percentage
|
||||
),
|
||||
'meta' => [
|
||||
@@ -903,7 +898,8 @@ class WPSEO_Admin_Bar_Menu implements WPSEO_WordPress_Integration {
|
||||
* @return bool True if capabilities are sufficient, false otherwise.
|
||||
*/
|
||||
protected function can_manage_options() {
|
||||
return is_network_admin() && current_user_can( 'wpseo_manage_network_options' ) || ! is_network_admin() && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' );
|
||||
return ( is_network_admin() && current_user_can( 'wpseo_manage_network_options' ) )
|
||||
|| ( ! is_network_admin() && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -830,7 +830,7 @@ class WPSEO_Option_Titles extends WPSEO_Option {
|
||||
* {@internal This clean-up action can only be done effectively once the taxonomies
|
||||
* and post_types have been registered, i.e. at the end of the init action.}}
|
||||
*/
|
||||
if ( isset( $original ) && current_filter() === 'wpseo_double_clean_titles' || did_action( 'wpseo_double_clean_titles' ) > 0 ) {
|
||||
if ( ( isset( $original ) && current_filter() === 'wpseo_double_clean_titles' ) || did_action( 'wpseo_double_clean_titles' ) > 0 ) {
|
||||
$rename = [
|
||||
'title-' => 'title-tax-',
|
||||
'metadesc-' => 'metadesc-tax-',
|
||||
|
||||
@@ -194,7 +194,7 @@ class WPSEO_Sitemaps_Cache_Validator {
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
//phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized.
|
||||
'DELETE FROM %i WHERE ' . implode( ' OR', array_fill( 0, count( $where ), '%s' ) ),
|
||||
'DELETE FROM %i WHERE ' . implode( ' OR ', array_fill( 0, count( $where ), '%s' ) ),
|
||||
array_merge( [ $wpdb->options ], $where )
|
||||
)
|
||||
);
|
||||
|
||||
+6
-6
File diff suppressed because one or more lines are too long
+176
-176
File diff suppressed because one or more lines are too long
+164
-164
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+158
-156
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+358
-271
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+757
-750
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user