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. */
|
||||
|
||||
Reference in New Issue
Block a user