Merged in feature/MAW-855-import-code-into-aws (pull request #2)

code import from pantheon

* code import from pantheon
This commit is contained in:
Tony Volpe
2023-12-04 23:08:14 +00:00
parent 8c9b1312bc
commit 8f4b5efda6
4766 changed files with 185592 additions and 239967 deletions

View File

@@ -109,7 +109,9 @@ class Admin_Columns_Cache_Integration implements Integration_Interface {
$indexables = $this->indexable_repository->find_by_multiple_ids_and_type( $post_ids, 'post', false );
foreach ( $indexables as $indexable ) {
$this->indexable_cache[ $indexable->object_id ] = $indexable;
if ( $indexable instanceof Indexable ) {
$this->indexable_cache[ $indexable->object_id ] = $indexable;
}
}
}

View File

@@ -7,7 +7,6 @@ use WPSEO_Addon_Manager;
use WPSEO_Admin_Asset_Manager;
use WPSEO_Option_Tab;
use WPSEO_Shortlinker;
use WPSEO_Utils;
use Yoast\WP\SEO\Conditionals\Admin_Conditional;
use Yoast\WP\SEO\Context\Meta_Tags_Context;
use Yoast\WP\SEO\Helpers\Options_Helper;
@@ -140,8 +139,8 @@ class First_Time_Configuration_Integration implements Integration_Interface {
$this->admin_asset_manager->enqueue_script( 'indexation' );
$this->admin_asset_manager->enqueue_script( 'first-time-configuration' );
$this->admin_asset_manager->enqueue_style( 'first-time-configuration' );
$this->admin_asset_manager->enqueue_style( 'admin-css' );
$this->admin_asset_manager->enqueue_style( 'tailwind' );
$this->admin_asset_manager->enqueue_style( 'monorepo' );
$data = [
@@ -185,78 +184,44 @@ class First_Time_Configuration_Integration implements Integration_Interface {
$selected_option_label = $selected_option['label'];
}
$this->admin_asset_manager->add_inline_script(
'first-time-configuration',
\sprintf(
'window.wpseoFirstTimeConfigurationData = {
"canEditUser": %d,
"companyOrPerson": "%s",
"companyOrPersonLabel": "%s",
"companyName": "%s",
"fallbackCompanyName": "%s",
"websiteName": "%s",
"fallbackWebsiteName": "%s",
"companyLogo": "%s",
"companyLogoFallback": "%s",
"companyLogoId": %d,
"finishedSteps": %s,
"personId": %d,
"personName": "%s",
"personLogo": "%s",
"personLogoFallback": "%s",
"personLogoId": %d,
"siteTagline": "%s",
"socialProfiles": {
"facebookUrl": "%s",
"twitterUsername": "%s",
"otherSocialUrls": %s,
},
"isPremium": %d,
"tracking": %d,
"isTrackingAllowedMultisite": %d,
"isMainSite": %d,
"companyOrPersonOptions": %s,
"shouldForceCompany": %d,
"knowledgeGraphMessage": "%s",
"shortlinks": {
"gdpr": "%s",
"configIndexables": "%s",
"configIndexablesBenefits": "%s",
},
};',
$this->can_edit_profile( $person_id ),
$this->is_company_or_person(),
$selected_option_label,
$this->get_company_name(),
$this->get_fallback_company_name( $this->get_company_name() ),
$this->get_website_name(),
$this->get_fallback_website_name( $this->get_website_name() ),
$this->get_company_logo(),
$this->get_company_fallback_logo( $this->get_company_logo() ),
$this->get_company_logo_id(),
WPSEO_Utils::format_json_encode( $finished_steps ),
$person_id,
$this->get_person_name(),
$this->get_person_logo(),
$this->get_person_fallback_logo( $this->get_person_logo() ),
$this->get_person_logo_id(),
$this->get_site_tagline(),
$social_profiles['facebook_site'],
$social_profiles['twitter_site'],
WPSEO_Utils::format_json_encode( $social_profiles['other_social_urls'] ),
$this->product_helper->is_premium(),
$this->has_tracking_enabled(),
$this->is_tracking_enabled_multisite(),
$this->is_main_site(),
WPSEO_Utils::format_json_encode( $options ),
$this->should_force_company(),
$knowledge_graph_message,
$this->shortlinker->build_shortlink( 'https://yoa.st/gdpr-config-workout' ),
$this->shortlinker->build_shortlink( 'https://yoa.st/config-indexables' ),
$this->shortlinker->build_shortlink( 'https://yoa.st/config-indexables-benefits' )
),
'before'
);
$data_ftc = [
'canEditUser' => $this->can_edit_profile( $person_id ),
'companyOrPerson' => $this->is_company_or_person(),
'companyOrPersonLabel' => $selected_option_label,
'companyName' => $this->get_company_name(),
'fallbackCompanyName' => $this->get_fallback_company_name( $this->get_company_name() ),
'websiteName' => $this->get_website_name(),
'fallbackWebsiteName' => $this->get_fallback_website_name( $this->get_website_name() ),
'companyLogo' => $this->get_company_logo(),
'companyLogoFallback' => $this->get_company_fallback_logo( $this->get_company_logo() ),
'companyLogoId' => $this->get_person_logo_id(),
'finishedSteps' => $finished_steps,
'personId' => (int) $person_id,
'personName' => $this->get_person_name(),
'personLogo' => $this->get_person_logo(),
'personLogoFallback' => $this->get_person_fallback_logo( $this->get_person_logo() ),
'personLogoId' => $this->get_person_logo_id(),
'siteTagline' => $this->get_site_tagline(),
'socialProfiles' => [
'facebookUrl' => $social_profiles['facebook_site'],
'twitterUsername' => $social_profiles['twitter_site'],
'otherSocialUrls' => $social_profiles['other_social_urls'],
],
'isPremium' => $this->product_helper->is_premium(),
'tracking' => $this->has_tracking_enabled(),
'isTrackingAllowedMultisite' => $this->is_tracking_enabled_multisite(),
'isMainSite' => $this->is_main_site(),
'companyOrPersonOptions' => $options,
'shouldForceCompany' => $this->should_force_company(),
'knowledgeGraphMessage' => $knowledge_graph_message,
'shortlinks' => [
'gdpr' => $this->shortlinker->build_shortlink( 'https://yoa.st/gdpr-config-workout' ),
'configIndexables' => $this->shortlinker->build_shortlink( 'https://yoa.st/config-indexables' ),
'configIndexablesBenefits' => $this->shortlinker->build_shortlink( 'https://yoa.st/config-indexables-benefits' ),
],
];
$this->admin_asset_manager->localize_script( 'first-time-configuration', 'wpseoFirstTimeConfigurationData', $data_ftc );
}
/**

View File

@@ -41,13 +41,15 @@ class Indexables_Exclude_Taxonomy_Integration implements Integration_Interface {
*
* @param array $excluded_taxonomies The excluded taxonomies.
*
* @return array The excluded post types, including the specific post type.
* @return array The excluded taxonomies, including specific taxonomies.
*/
public function exclude_taxonomies_for_indexation( $excluded_taxonomies ) {
$taxonomies_to_exclude = \array_merge( $excluded_taxonomies, [ 'wp_pattern_category' ] );
if ( $this->options_helper->get( 'disable-post_format', false ) ) {
return \array_merge( $excluded_taxonomies, [ 'post_format' ] );
return \array_merge( $taxonomies_to_exclude, [ 'post_format' ] );
}
return $excluded_taxonomies;
return $taxonomies_to_exclude;
}
}

View File

@@ -135,6 +135,7 @@ class Link_Count_Columns_Integration implements Integration_Interface {
$columns[ 'wpseo-' . self::COLUMN_LINKS ] = \sprintf(
'<span class="yoast-linked-to yoast-column-header-has-tooltip" data-tooltip-text="%1$s"><span class="screen-reader-text">%2$s</span></span>',
\esc_attr__( 'Number of outgoing internal links in this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ),
/* translators: Hidden accessibility text. */
\esc_html__( 'Outgoing internal links', 'wordpress-seo' )
);
@@ -142,6 +143,7 @@ class Link_Count_Columns_Integration implements Integration_Interface {
$columns[ 'wpseo-' . self::COLUMN_LINKED ] = \sprintf(
'<span class="yoast-linked-from yoast-column-header-has-tooltip" data-tooltip-text="%1$s"><span class="screen-reader-text">%2$s</span></span>',
\esc_attr__( 'Number of internal links linking to this post. See "Yoast Columns" text in the help tab for more info.', 'wordpress-seo' ),
/* translators: Hidden accessibility text. */
\esc_html__( 'Received internal links', 'wordpress-seo' )
);
}

View File

@@ -207,6 +207,7 @@ class Workouts_Integration implements Integration_Interface {
);
$button = '<a class="yoast-button yoast-button-upsell yoast-button--small" href="' . \esc_url( $url ) . '" target="_blank">'
. \esc_html__( 'Renew your subscription', 'wordpress-seo' )
/* translators: Hidden accessibility text. */
. '<span class="screen-reader-text">' . \__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
. '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>'
. '</a>';
@@ -236,6 +237,7 @@ class Workouts_Integration implements Integration_Interface {
);
$button = '<a class="yoast-button yoast-button--primary yoast-button--small" href="' . \esc_url( $url_button ) . '" target="_blank">'
. \esc_html__( 'Get help activating your subscription', 'wordpress-seo' )
/* translators: Hidden accessibility text. */
. '<span class="screen-reader-text">' . \__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
. '</a>';
}
@@ -243,7 +245,7 @@ class Workouts_Integration implements Integration_Interface {
$notice = new Notice_Presenter(
$title,
$copy,
'Assistent_Time_bubble_500x570.png',
null,
$button
);

View File

@@ -0,0 +1,17 @@
<?php
namespace Yoast\WP\SEO\Integrations\Alerts;
/**
* Black_Friday_Product_Editor_Checklist_Notification class.
* @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
*/
class Black_Friday_Product_Editor_Checklist_Notification extends Abstract_Dismissable_Alert {
/**
* Holds the alert identifier.
*
* @var string
*/
protected $alert_identifier = 'black-friday-2023-product-editor-checklist';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace Yoast\WP\SEO\Integrations\Alerts;
/**
* Black_Friday_Promotion_Notification class.
*/
class Black_Friday_Promotion_Notification extends Abstract_Dismissable_Alert {
/**
* Holds the alert identifier.
*
* @var string
*/
protected $alert_identifier = 'black-friday-2023-promotion';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace Yoast\WP\SEO\Integrations\Alerts;
/**
* Black_Friday_Promo_Notification class.
*/
class Black_Friday_Sidebar_Checklist_Notification extends Abstract_Dismissable_Alert {
/**
* Holds the alert identifier.
*
* @var string
*/
protected $alert_identifier = 'black-friday-2023-sidebar-checklist';
}

View File

@@ -125,7 +125,7 @@ class Cleanup_Integration implements Integration_Interface {
return $this->cleanup_repository->update_indexables_author_to_reassigned( $limit );
},
'clean_orphaned_user_indexables_without_wp_user' => function ( $limit ) {
return $this->cleanup_repository->clean_indexables_for_object_type_and_source_table( 'users', 'ID', 'user', $limit );
return $this->cleanup_repository->clean_indexables_for_orphaned_users( $limit );
},
'clean_orphaned_user_indexables_without_wp_post' => function ( $limit ) {
return $this->cleanup_repository->clean_indexables_for_object_type_and_source_table( 'posts', 'ID', 'post', $limit );

View File

@@ -2,6 +2,7 @@
namespace Yoast\WP\SEO\Integrations;
use WP_HTML_Tag_Processor;
use WPSEO_Replace_Vars;
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
use Yoast\WP\SEO\Context\Meta_Tags_Context;
@@ -175,6 +176,20 @@ class Front_End_Integration implements Integration_Interface {
'Schema',
];
/**
* The next output.
*
* @var string
*/
protected $next;
/**
* The prev output.
*
* @var string
*/
protected $prev;
/**
* Returns the conditionals based on which this loadable should be active.
*
@@ -219,6 +234,8 @@ class Front_End_Integration implements Integration_Interface {
* to avoid duplicate and/or mismatched metadata.
*/
public function register_hooks() {
\add_filter( 'render_block', [ $this, 'query_loop_next_prev' ], 1, 2 );
\add_action( 'wp_head', [ $this, 'call_wpseo_head' ], 1 );
// Filter the title for compatibility with other plugins and themes.
\add_filter( 'wp_title', [ $this, 'filter_title' ], 15 );
@@ -262,6 +279,72 @@ class Front_End_Integration implements Integration_Interface {
return $title;
}
/**
* Filters the next and prev links in the query loop block.
*
* @param string $html The HTML output.
* @param array $block The block.
* @return string The filtered HTML output.
*/
public function query_loop_next_prev( $html, $block ) {
if ( $block['blockName'] === 'core/query' ) {
// Check that the query does not inherit the main query.
if ( isset( $block['attrs']['query']['inherit'] ) && ! $block['attrs']['query']['inherit'] ) {
\add_filter( 'wpseo_adjacent_rel_url', [ $this, 'adjacent_rel_url' ], 1, 3 );
}
}
if ( $block['blockName'] === 'core/query-pagination-next' ) {
$this->next = $html;
}
if ( $block['blockName'] === 'core/query-pagination-previous' ) {
$this->prev = $html;
}
return $html;
}
/**
* Returns correct adjacent pages when QUery loop block does not inherit query from template.
*
* @param string $link The current link.
* @param string $rel Link relationship, prev or next.
* @param Indexable_Presentation|null $presentation The indexable presentation.
*
* @return string The correct link.
*/
public function adjacent_rel_url( $link, $rel, $presentation = null ) {
if ( $link === \home_url( '/' ) ) {
return $link;
}
if ( $rel === 'next' || $rel === 'prev' ) {
// WP_HTML_Tag_Processor was introduced in WordPress 6.2.
if ( \class_exists( WP_HTML_Tag_Processor::class ) ) {
$processor = new WP_HTML_Tag_Processor( $this->$rel );
while ( $processor->next_tag( [ 'tag_name' => 'a' ] ) ) {
$href = $processor->get_attribute( 'href' );
if ( $href ) {
return $presentation->permalink . substr( $href, 1 );
}
}
}
// Remove else when dropping support for WordPress 6.1 and lower.
else {
$pattern = '/"(.*?)"/';
// Find all matches of the pattern in the HTML string.
\preg_match_all( $pattern, $this->$rel, $matches );
if ( isset( $matches[1] ) && isset( $matches[1][0] ) && $matches[1][0] ) {
return $presentation->permalink . \substr( $matches[1][0], 1 );
}
}
}
return $link;
}
/**
* Filters our robots presenter, but only when wp_robots is attached to the wp_head action.
*

View File

@@ -110,8 +110,15 @@ class Crawl_Cleanup_Basic implements Integration_Interface {
*/
public function resource_hints_plain_cleanup( $hints ) {
foreach ( $hints as $key => $hint ) {
if ( \strpos( $hint, '//s.w.org' ) !== false ) {
unset( $hints[ $key ] );
if ( \is_array( $hint ) && isset( $hint['href'] ) ) {
if ( \strpos( $hint['href'], '//s.w.org' ) !== false ) {
unset( $hints[ $key ] );
}
}
else {
if ( \strpos( $hint, '//s.w.org' ) !== false ) {
unset( $hints[ $key ] );
}
}
}

View File

@@ -182,13 +182,13 @@ class RSS_Footer_Embed implements Integration_Interface {
protected function get_link_template() {
/**
* Filter: 'nofollow_rss_links' - Allow the developer to determine whether or not to follow the links in
* the bits Yoast SEO adds to the RSS feed, defaults to true.
* the bits Yoast SEO adds to the RSS feed, defaults to false.
*
* @api bool $unsigned Whether or not to follow the links in RSS feed, defaults to true.
*
* @since 1.4.20
*/
if ( \apply_filters( 'nofollow_rss_links', true ) ) {
if ( \apply_filters( 'nofollow_rss_links', false ) ) {
return '<a rel="nofollow" href="%1$s">%2$s</a>';
}

View File

@@ -25,6 +25,8 @@ use Yoast\WP\SEO\Helpers\User_Helper;
use Yoast\WP\SEO\Helpers\Woocommerce_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Content_Type_Visibility\Application\Content_Type_Visibility_Dismiss_Notifications;
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* Class Settings_Integration.
@@ -88,6 +90,9 @@ class Settings_Integration implements Integration_Interface {
'deny_search_crawling',
'deny_wp_json_crawling',
'deny_adsbot_crawling',
'deny_ccbot_crawling',
'deny_google_extended_crawling',
'deny_gptbot_crawling',
],
];
@@ -364,6 +369,9 @@ class Settings_Integration implements Integration_Interface {
\wp_enqueue_media();
$this->asset_manager->enqueue_script( 'new-settings' );
$this->asset_manager->enqueue_style( 'new-settings' );
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
$this->asset_manager->enqueue_style( 'black-friday-banner' );
}
$this->asset_manager->localize_script( 'new-settings', 'wpseoScriptData', $this->get_script_data() );
}
@@ -453,9 +461,11 @@ class Settings_Integration implements Integration_Interface {
'isRtl' => \is_rtl(),
'isNetworkAdmin' => \is_network_admin(),
'isMainSite' => \is_main_site(),
'isMultisite' => \is_multisite(),
'isWooCommerceActive' => $this->woocommerce_helper->is_active(),
'isLocalSeoActive' => \defined( 'WPSEO_LOCAL_FILE' ),
'isNewsSeoActive' => \defined( 'WPSEO_NEWS_FILE' ),
'promotions' => YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(),
'siteUrl' => \get_bloginfo( 'url' ),
'siteTitle' => \get_bloginfo( 'name' ),
'sitemapUrl' => WPSEO_Sitemaps_Router::get_base_url( 'sitemap_index.xml' ),

View File

@@ -8,6 +8,7 @@ use Yoast\WP\SEO\Conditionals\User_Can_Manage_Wpseo_Options_Conditional;
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
use Yoast\WP\SEO\Helpers\Product_Helper;
use Yoast\WP\SEO\Helpers\Short_Link_Helper;
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* Class Support_Integration.
@@ -130,6 +131,9 @@ class Support_Integration implements Integration_Interface {
\remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
$this->asset_manager->enqueue_script( 'support' );
$this->asset_manager->enqueue_style( 'support' );
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
$this->asset_manager->enqueue_style( 'black-friday-banner' );
}
$this->asset_manager->localize_script( 'support', 'wpseoScriptData', $this->get_script_data() );
}
@@ -152,16 +156,17 @@ class Support_Integration implements Integration_Interface {
*/
public function get_script_data() {
return [
'preferences' => [
'preferences' => [
'isPremium' => $this->product_helper->is_premium(),
'isRtl' => \is_rtl(),
'promotions' => YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'upsellSettings' => [
'actionId' => 'load-nfd-ctb',
'premiumCtbId' => 'f6a84663-465f-4cb5-8ba5-f7a6d72224b2',
],
],
'linkParams' => $this->shortlink_helper->get_query_params(),
'linkParams' => $this->shortlink_helper->get_query_params(),
];
}
}

View File

@@ -20,10 +20,13 @@ use WPSEO_Shortlinker;
use WPSEO_Utils;
use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
use Yoast\WP\SEO\Conditionals\Third_Party\Elementor_Edit_Conditional;
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
use Yoast\WP\SEO\Helpers\Capability_Helper;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Integrations\Integration_Interface;
use Yoast\WP\SEO\Introductions\Infrastructure\Wistia_Embed_Permission_Repository;
use Yoast\WP\SEO\Presenters\Admin\Meta_Fields_Presenter;
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* Integrates the Yoast SEO metabox in the Elementor editor.
@@ -98,6 +101,13 @@ class Elementor implements Integration_Interface {
*/
protected $inclusive_language_analysis;
/**
* Holds the promotion manager.
*
* @var Promotion_Manager
*/
protected $promotion_manager;
/**
* Returns the conditionals based in which this loadable should be active.
*
@@ -113,15 +123,18 @@ class Elementor implements Integration_Interface {
* @param WPSEO_Admin_Asset_Manager $asset_manager The asset manager.
* @param Options_Helper $options The options helper.
* @param Capability_Helper $capability The capability helper.
* @param Promotion_Manager $promotion_manager The promotion manager.
*/
public function __construct(
WPSEO_Admin_Asset_Manager $asset_manager,
Options_Helper $options,
Capability_Helper $capability
Capability_Helper $capability,
Promotion_Manager $promotion_manager
) {
$this->asset_manager = $asset_manager;
$this->options = $options;
$this->capability = $capability;
$this->asset_manager = $asset_manager;
$this->options = $options;
$this->capability = $capability;
$this->promotion_manager = $promotion_manager;
$this->seo_analysis = new WPSEO_Metabox_Analysis_SEO();
$this->readability_analysis = new WPSEO_Metabox_Analysis_Readability();
@@ -401,6 +414,7 @@ class Elementor implements Integration_Interface {
$this->asset_manager->enqueue_style( 'scoring' );
$this->asset_manager->enqueue_style( 'monorepo' );
$this->asset_manager->enqueue_style( 'admin-css' );
$this->asset_manager->enqueue_style( 'ai-generator' );
$this->asset_manager->enqueue_style( 'elementor' );
$this->asset_manager->enqueue_script( 'admin-global' );
@@ -420,8 +434,7 @@ class Elementor implements Integration_Interface {
'has_taxonomies' => $this->current_post_type_has_taxonomies(),
],
'shortcodes' => [
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
],
];
@@ -434,24 +447,31 @@ class Elementor implements Integration_Interface {
'enabled_features' => WPSEO_Utils::retrieve_enabled_features(),
];
$alert_dismissal_action = \YoastSEO()->classes->get( Alert_Dismissal_Action::class );
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
$alert_dismissal_action = \YoastSEO()->classes->get( Alert_Dismissal_Action::class );
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
$woocommerce_conditional = new WooCommerce_Conditional();
$script_data = [
'media' => [ 'choose_image' => \__( 'Use Image', 'wordpress-seo' ) ],
'metabox' => $this->get_metabox_script_data(),
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
'isPost' => true,
'isBlockEditor' => WP_Screen::get()->is_block_editor(),
'isElementorEditor' => true,
'postStatus' => \get_post_status( $post_id ),
'analysis' => [
'media' => [ 'choose_image' => \__( 'Use Image', 'wordpress-seo' ) ],
'metabox' => $this->get_metabox_script_data(),
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
'isPost' => true,
'isBlockEditor' => WP_Screen::get()->is_block_editor(),
'isElementorEditor' => true,
'isWooCommerceActive' => $woocommerce_conditional->is_met(),
'postStatus' => \get_post_status( $post_id ),
'postType' => \get_post_type( $post_id ),
'analysis' => [
'plugins' => $plugins_script_data,
'worker' => $worker_script_data,
],
'dismissedAlerts' => $dismissed_alerts,
'webinarIntroElementorUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-elementor' ),
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage-and-post-types' ),
'dismissedAlerts' => $dismissed_alerts,
'webinarIntroElementorUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-elementor' ),
'currentPromotions' => $this->promotion_manager->get_current_promotions(),
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage-and-post-types' ),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'wistiaEmbedPermission' => \YoastSEO()->classes->get( Wistia_Embed_Permission_Repository::class )->get_value_for_user( \get_current_user_id() ),
];
if ( \post_type_supports( $this->get_metabox_post()->post_type, 'thumbnail' ) ) {

View File

@@ -89,10 +89,19 @@ class Wordproof implements Integration_Interface {
*/
\add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_assets' ], 10, 0 );
/**
* Add async to the wordproof scripts.
*/
\add_filter( 'script_loader_tag', [ $this, 'add_async_to_script' ], 10, 3 );
if ( version_compare( strtok( get_bloginfo( 'version' ), '-' ), '6.3', '>=' ) ) {
\add_action(
'wp_enqueue_scripts',
function() {
\wp_script_add_data( WPSEO_Admin_Asset_Manager::PREFIX . 'wordproof-uikit', 'strategy', 'async' );
},
11,
0
);
}
else {
\add_filter( 'script_loader_tag', [ $this, 'add_async_to_script' ], 10, 3 );
}
/**
* Removes the post meta timestamp key for the old privacy page.

View File

@@ -106,6 +106,11 @@ class Indexable_Attachment_Watcher implements Integration_Interface {
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_COUNT_TRANSIENT );
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_LIMITED_COUNT_TRANSIENT );
// Set this core option (introduced in WP 6.4) to ensure consistency.
if ( \get_option( 'wp_attachment_pages_enabled' ) !== false ) {
\update_option( 'wp_attachment_pages_enabled', (int) ! $new_value['disable-attachment'] );
}
switch ( $new_value['disable-attachment'] ) {
case false:
$this->indexing_helper->set_reason( Indexing_Reasons::REASON_ATTACHMENTS_MADE_ENABLED );

View File

@@ -99,7 +99,8 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
return;
}
$public_post_types = \array_keys( $this->post_type_helper->get_public_post_types() );
$public_post_types = $this->post_type_helper->get_indexable_post_types();
$last_known_public_post_types = $this->options->get( 'last_known_public_post_types', [] );
// Initializing the option on the first run.
@@ -108,6 +109,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
return;
}
// We look for new public post types.
$newly_made_public_post_types = \array_diff( $public_post_types, $last_known_public_post_types );
// We look for post types that from public have been made private.
@@ -122,7 +124,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
$this->options->set( 'last_known_public_post_types', $public_post_types );
// There are new post types that have been made public.
if ( ! empty( $newly_made_public_post_types ) ) {
if ( $newly_made_public_post_types ) {
// Force a notification requesting to start the SEO data optimization.
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_COUNT_TRANSIENT );
@@ -134,7 +136,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
}
// There are post types that have been made private.
if ( ! empty( $newly_made_non_public_post_types ) ) {
if ( $newly_made_non_public_post_types ) {
// Schedule a cron job to remove all the posts whose post type has been made private.
$cleanup_not_yet_scheduled = ! \wp_next_scheduled( Cleanup_Integration::START_HOOK );
if ( $cleanup_not_yet_scheduled ) {

View File

@@ -101,7 +101,8 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
return;
}
$public_taxonomies = \array_keys( $this->taxonomy_helper->get_public_taxonomies() );
$public_taxonomies = $this->taxonomy_helper->get_indexable_taxonomies();
$last_known_public_taxonomies = $this->options->get( 'last_known_public_taxonomies', [] );
// Initializing the option on the first run.
@@ -112,6 +113,7 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
// We look for new public taxonomies.
$newly_made_public_taxonomies = \array_diff( $public_taxonomies, $last_known_public_taxonomies );
// We look fortaxonomies that from public have been made private.
$newly_made_non_public_taxonomies = \array_diff( $last_known_public_taxonomies, $public_taxonomies );