Merged in feature/314-dev-dev01 (pull request #24)
auto-patch 314-dev-dev01-2024-01-25T04_09_02 * auto-patch 314-dev-dev01-2024-01-25T04_09_02
This commit is contained in:
@@ -9,6 +9,8 @@ abstract class Abstract_Exclude_Post_Type implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Initializes the integration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_filter( 'wpseo_indexable_excluded_post_types', [ $this, 'exclude_post_types' ] );
|
||||
|
||||
@@ -15,7 +15,7 @@ use Yoast\WP\SEO\Helpers\Short_Link_Helper;
|
||||
*/
|
||||
class Academy_Integration implements Integration_Interface {
|
||||
|
||||
const PAGE = 'wpseo_page_academy';
|
||||
public const PAGE = 'wpseo_page_academy';
|
||||
|
||||
/**
|
||||
* Holds the WPSEO_Admin_Asset_Manager.
|
||||
@@ -121,6 +121,8 @@ class Academy_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Displays the page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function display_page() {
|
||||
echo '<div id="yoast-seo-academy"></div>';
|
||||
|
||||
@@ -52,6 +52,8 @@ class Dialog_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers all hooks to WordPress.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'admin_init', [ $this, 'start_addon_installation' ] );
|
||||
@@ -86,16 +88,16 @@ class Dialog_Integration implements Integration_Interface {
|
||||
* @return void
|
||||
*/
|
||||
public function throw_no_owned_addons_warning() {
|
||||
echo '<div class="notice notice-warning"><p>' .
|
||||
\sprintf(
|
||||
echo '<div class="notice notice-warning"><p>'
|
||||
. \sprintf(
|
||||
/* translators: %1$s expands to Yoast SEO */
|
||||
\esc_html__(
|
||||
'No %1$s plugins have been installed. You don\'t seem to own any active subscriptions.',
|
||||
'wordpress-seo'
|
||||
),
|
||||
'Yoast SEO'
|
||||
) .
|
||||
'</p></div>';
|
||||
)
|
||||
. '</p></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,6 +73,8 @@ class Installation_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers all hooks to WordPress.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'wpseo_install_and_activate_addons', [ $this, 'install_and_activate_addons' ] );
|
||||
|
||||
@@ -53,6 +53,8 @@ class Admin_Columns_Cache_Integration implements Integration_Interface {
|
||||
*
|
||||
* This cache is used in showing the Yoast SEO columns on the posts overview
|
||||
* page (e.g. keyword score, incoming link count, etc.)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
// Hook into tablenav to calculate links and linked.
|
||||
@@ -63,6 +65,8 @@ class Admin_Columns_Cache_Integration implements Integration_Interface {
|
||||
* Makes sure we calculate all values in one query by filling our cache beforehand.
|
||||
*
|
||||
* @param string $target Extra table navigation location which is triggered.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_fill_cache( $target ) {
|
||||
if ( $target === 'top' ) {
|
||||
@@ -72,6 +76,8 @@ class Admin_Columns_Cache_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Fills the cache of indexables for all known post IDs.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fill_cache() {
|
||||
global $wp_query;
|
||||
|
||||
@@ -165,6 +165,8 @@ class Background_Indexing_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Register hooks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'admin_init', [ $this, 'register_shutdown_indexing' ] );
|
||||
@@ -238,7 +240,7 @@ class Background_Indexing_Integration implements Integration_Interface {
|
||||
}
|
||||
|
||||
$schedules['fifteen_minutes'] = [
|
||||
'interval' => ( 15 * MINUTE_IN_SECONDS ),
|
||||
'interval' => ( 15 * \MINUTE_IN_SECONDS ),
|
||||
'display' => \esc_html__( 'Every fifteen minutes', 'wordpress-seo' ),
|
||||
];
|
||||
|
||||
@@ -255,7 +257,8 @@ class Background_Indexing_Integration implements Integration_Interface {
|
||||
* Filter: 'wpseo_unindexed_count_queries_ran' - Informs whether the expensive unindexed count queries have been ran already.
|
||||
*
|
||||
* @internal
|
||||
* @api bool
|
||||
*
|
||||
* @param bool $have_queries_ran
|
||||
*/
|
||||
$have_queries_ran = \apply_filters( 'wpseo_unindexed_count_queries_ran', false );
|
||||
|
||||
@@ -280,7 +283,7 @@ class Background_Indexing_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter: 'wpseo_cron_indexing_limit_size' - Adds the possibility to limit the number of items that are indexed when in cron action.
|
||||
*
|
||||
* @api int $limit Maximum number of indexables to be indexed per indexing action.
|
||||
* @param int $limit Maximum number of indexables to be indexed per indexing action.
|
||||
*/
|
||||
return \apply_filters( 'wpseo_cron_indexing_limit_size', 15 );
|
||||
}
|
||||
@@ -300,7 +303,7 @@ class Background_Indexing_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter: 'wpseo_cron_link_indexing_limit_size' - Adds the possibility to limit the number of links that are indexed when in cron action.
|
||||
*
|
||||
* @api int $limit Maximum number of link indexables to be indexed per link indexing action.
|
||||
* @param int $limit Maximum number of link indexables to be indexed per link indexing action.
|
||||
*/
|
||||
return \apply_filters( 'wpseo_cron_link_indexing_limit_size', 3 );
|
||||
}
|
||||
@@ -363,7 +366,7 @@ class Background_Indexing_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter 'wpseo_shutdown_indexation_limit' - Allow filtering the number of objects that can be indexed during shutdown.
|
||||
*
|
||||
* @api int The maximum number of objects indexed.
|
||||
* @param int $limit The maximum number of objects indexed.
|
||||
*/
|
||||
return \apply_filters( 'wpseo_shutdown_indexation_limit', 25 );
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ class Crawl_Settings_Integration implements Integration_Interface {
|
||||
* Returns the conditionals based in which this loadable should be active.
|
||||
*
|
||||
* In this case: when on an admin page.
|
||||
*
|
||||
* @return array<string>
|
||||
*/
|
||||
public static function get_conditionals() {
|
||||
return [ Admin_Conditional::class ];
|
||||
@@ -86,6 +88,8 @@ class Crawl_Settings_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers an action to add a new tab to the General page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
$this->register_setting_labels();
|
||||
@@ -96,6 +100,8 @@ class Crawl_Settings_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueue the workouts app.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
if ( ! \is_network_admin() ) {
|
||||
@@ -165,6 +171,8 @@ class Crawl_Settings_Integration implements Integration_Interface {
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Yoast_Form $yform The yoast form object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add_crawl_settings_tab_content( $yform ) {
|
||||
\_deprecated_function( __METHOD__, 'Yoast SEO 20.4' );
|
||||
@@ -175,6 +183,8 @@ class Crawl_Settings_Integration implements Integration_Interface {
|
||||
* Adds content to the Crawl Cleanup network tab.
|
||||
*
|
||||
* @param Yoast_Form $yform The yoast form object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add_crawl_settings_tab_content_network( $yform ) {
|
||||
$this->add_crawl_settings( $yform );
|
||||
@@ -286,7 +296,7 @@ class Crawl_Settings_Integration implements Integration_Interface {
|
||||
if ( $this->should_feature_be_disabled_permalink( $setting ) ) {
|
||||
echo '<p class="yoast-crawl-settings-help">';
|
||||
if ( \current_user_can( 'manage_options' ) ) {
|
||||
echo \sprintf(
|
||||
\printf(
|
||||
/* translators: 1: Link start tag to the Permalinks settings page, 2: Link closing tag. */
|
||||
\esc_html__( 'This feature is disabled when your site is not using %1$spretty permalinks%2$s.', 'wordpress-seo' ),
|
||||
'<a href="' . \esc_url( \admin_url( 'options-permalink.php' ) ) . '">',
|
||||
|
||||
@@ -93,7 +93,7 @@ class Deactivated_Premium_Integration implements Integration_Interface {
|
||||
) . '">',
|
||||
'</a>'
|
||||
);
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped above.
|
||||
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped above.
|
||||
echo new Notice_Presenter(
|
||||
/* translators: 1: Yoast SEO Premium */
|
||||
\sprintf( \__( 'Activate %1$s!', 'wordpress-seo' ), 'Yoast SEO Premium' ),
|
||||
@@ -103,7 +103,7 @@ class Deactivated_Premium_Integration implements Integration_Interface {
|
||||
true,
|
||||
'yoast-premium-deactivated-notice'
|
||||
);
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
|
||||
// Enable permanently dismissing the notice.
|
||||
echo "<script>
|
||||
|
||||
@@ -23,6 +23,8 @@ class Disable_Concatenate_Scripts_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers an action to disable script concatenation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'wp_print_scripts', [ $this, 'disable_concatenate_scripts' ] );
|
||||
|
||||
@@ -117,6 +117,8 @@ class First_Time_Configuration_Integration implements Integration_Interface {
|
||||
* Adds a dedicated tab in the General sub-page.
|
||||
*
|
||||
* @param WPSEO_Options_Tabs $dashboard_tabs Object representing the tabs of the General sub-page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add_first_time_configuration_tab( $dashboard_tabs ) {
|
||||
$dashboard_tabs->add_tab(
|
||||
@@ -130,6 +132,8 @@ class First_Time_Configuration_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Adds the data for the first-time configuration to the wpseoFirstTimeConfigurationData object.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
|
||||
|
||||
@@ -26,6 +26,8 @@ class Fix_News_Dependencies_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers an action to disable script concatenation.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
global $pagenow;
|
||||
|
||||
@@ -141,6 +141,8 @@ class HelpScout_Beacon implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueues the HelpScout script.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_help_scout_script() {
|
||||
// Make sure plugins can filter in their "stuff", before we check whether we're outputting a beacon.
|
||||
@@ -154,6 +156,8 @@ class HelpScout_Beacon implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Outputs a small piece of javascript for the beacon.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function output_beacon_js() {
|
||||
if ( ! $this->is_beacon_page() ) {
|
||||
@@ -183,7 +187,7 @@ class HelpScout_Beacon implements Integration_Interface {
|
||||
/**
|
||||
* Filter: 'wpseo_helpscout_show_beacon' - Allows overriding whether we show the HelpScout beacon.
|
||||
*
|
||||
* @api bool - Whether we show the beacon or not.
|
||||
* @param bool $show_beacon Whether we show the beacon or not.
|
||||
*/
|
||||
return \apply_filters( 'wpseo_helpscout_show_beacon', $return );
|
||||
}
|
||||
@@ -444,18 +448,20 @@ class HelpScout_Beacon implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Allows filtering of the HelpScout settings. Hooked to admin_head to prevent timing issues, not too early, not too late.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function filter_settings() {
|
||||
/**
|
||||
* Filter: 'wpseo_helpscout_beacon_settings' - Allows overriding the HelpScout beacon settings.
|
||||
*
|
||||
* @api string - The HelpScout beacon settings.
|
||||
*/
|
||||
$filterable_helpscout_setting = [
|
||||
'products' => $this->products,
|
||||
'pages_ids' => $this->pages_ids,
|
||||
];
|
||||
|
||||
/**
|
||||
* Filter: 'wpseo_helpscout_beacon_settings' - Allows overriding the HelpScout beacon settings.
|
||||
*
|
||||
* @param string $beacon_settings The HelpScout beacon settings.
|
||||
*/
|
||||
$helpscout_settings = \apply_filters( 'wpseo_helpscout_beacon_settings', $filterable_helpscout_setting );
|
||||
|
||||
$this->products = $helpscout_settings['products'];
|
||||
|
||||
@@ -78,6 +78,8 @@ class Import_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueues the Import script.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_import_script() {
|
||||
\wp_enqueue_style( 'dashicons' );
|
||||
|
||||
@@ -29,7 +29,7 @@ class Indexing_Notification_Integration implements Integration_Interface {
|
||||
/**
|
||||
* The notification ID.
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpseo-reindex';
|
||||
public const NOTIFICATION_ID = 'wpseo-reindex';
|
||||
|
||||
/**
|
||||
* The Yoast notification center.
|
||||
@@ -154,6 +154,8 @@ class Indexing_Notification_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Checks whether the notification should be shown and adds
|
||||
* it to the notification center if this is the case.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_create_notification() {
|
||||
if ( ! $this->should_show_notification() ) {
|
||||
@@ -170,6 +172,8 @@ class Indexing_Notification_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Checks whether the notification should not be shown anymore and removes
|
||||
* it from the notification center if this is the case.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_cleanup_notification() {
|
||||
$notification = $this->notification_center->get_notification_by_id( self::NOTIFICATION_ID );
|
||||
|
||||
@@ -128,6 +128,8 @@ class Indexing_Tool_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Register hooks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'wpseo_tools_overview_list_items_internal', [ $this, 'render_indexing_list_item' ], 10 );
|
||||
|
||||
@@ -113,6 +113,8 @@ class Installation_Success_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueue assets on the Installation success page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
|
||||
@@ -137,6 +139,8 @@ class Installation_Success_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Renders the installation success page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render_page() {
|
||||
echo '<div id="wpseo-installation-successful-free" class="yoast"></div>';
|
||||
@@ -144,6 +148,8 @@ class Installation_Success_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Wrap the `exit` function to make unit testing easier.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function terminate_execution() {
|
||||
exit;
|
||||
|
||||
@@ -90,6 +90,8 @@ class Integrations_Page implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueue the integrations app.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
|
||||
@@ -202,6 +204,8 @@ class Integrations_Page implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Renders the target for the React to mount to.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render_target() {
|
||||
?>
|
||||
|
||||
@@ -22,14 +22,14 @@ class Link_Count_Columns_Integration implements Integration_Interface {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const COLUMN_LINKED = 'linked';
|
||||
public const COLUMN_LINKED = 'linked';
|
||||
|
||||
/**
|
||||
* Partial column name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const COLUMN_LINKS = 'links';
|
||||
public const COLUMN_LINKS = 'links';
|
||||
|
||||
/**
|
||||
* The post type helper.
|
||||
@@ -105,6 +105,8 @@ class Link_Count_Columns_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Register hooks that need to be registered after `init` due to all post types not yet being registered.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_init_hooks() {
|
||||
$public_post_types = \apply_filters( 'wpseo_link_count_post_types', $this->post_type_helper->get_accessible_post_types() );
|
||||
@@ -219,6 +221,8 @@ class Link_Count_Columns_Integration implements Integration_Interface {
|
||||
*
|
||||
* @param string $column_name Column to display the content for.
|
||||
* @param int $post_id Post to display the column content for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function column_content( $column_name, $post_id ) {
|
||||
$indexable = $this->admin_columns_cache->get_indexable( $post_id );
|
||||
|
||||
@@ -31,8 +31,8 @@ class Menu_Badge_Integration implements Integration_Interface {
|
||||
* @return void
|
||||
*/
|
||||
public function add_inline_styles() {
|
||||
$custom_css = 'ul.wp-submenu span.yoast-premium-badge::after, #wpadminbar span.yoast-premium-badge::after { content:"' .
|
||||
\__( 'Premium', 'wordpress-seo' ) . '"}';
|
||||
$custom_css = 'ul.wp-submenu span.yoast-premium-badge::after, #wpadminbar span.yoast-premium-badge::after { content:"'
|
||||
. \__( 'Premium', 'wordpress-seo' ) . '"}';
|
||||
\wp_add_inline_style( WPSEO_Admin_Asset_Manager::PREFIX . 'admin-global', $custom_css );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ class Old_Configuration_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Renders the old configuration page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render_page() {
|
||||
// This page is never to be displayed.
|
||||
@@ -54,6 +56,8 @@ class Old_Configuration_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Redirects from the old configuration page to the new configuration page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function redirect_to_new_configuration() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Data is not processed or saved.
|
||||
|
||||
@@ -128,6 +128,8 @@ class Workouts_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueue the workouts app.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_assets() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Date is not processed or saved.
|
||||
@@ -164,6 +166,8 @@ class Workouts_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Renders the target for the React to mount to.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function render_target() {
|
||||
if ( $this->should_update_premium() ) {
|
||||
|
||||
@@ -65,6 +65,8 @@ class Structured_Data_Blocks implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers hooks for Structured Data Blocks with WordPress.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_assets' ] );
|
||||
@@ -142,12 +144,14 @@ class Structured_Data_Blocks implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Enqueue Gutenberg block assets for backend editor.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function enqueue_block_editor_assets() {
|
||||
/**
|
||||
* Filter: 'wpseo_enable_structured_data_blocks' - Allows disabling Yoast's schema blocks entirely.
|
||||
*
|
||||
* @api bool If false, our structured data blocks won't show.
|
||||
* @param bool $enable If false, our structured data blocks won't show.
|
||||
*/
|
||||
if ( ! \apply_filters( 'wpseo_enable_structured_data_blocks', true ) ) {
|
||||
return;
|
||||
@@ -178,8 +182,8 @@ class Structured_Data_Blocks implements Integration_Interface {
|
||||
* For example (in en-US): If 'days' is 1, it returns "1 day". If 'days' is 2, it returns "2 days".
|
||||
* If a number value is 0, we don't output the string.
|
||||
*
|
||||
* @param number $days Number of days.
|
||||
* @param number $hours Number of hours.
|
||||
* @param number $days Number of days.
|
||||
* @param number $hours Number of hours.
|
||||
* @param number $minutes Number of minutes.
|
||||
* @return array Array of pluralized durations.
|
||||
*/
|
||||
@@ -220,7 +224,7 @@ class Structured_Data_Blocks implements Integration_Interface {
|
||||
$hours = ( $attributes['hours'] ?? 0 );
|
||||
$minutes = ( $attributes['minutes'] ?? 0 );
|
||||
$elements = $this->transform_duration_to_string( $days, $hours, $minutes );
|
||||
$elements_length = count( $elements );
|
||||
$elements_length = \count( $elements );
|
||||
|
||||
switch ( $elements_length ) {
|
||||
case 1:
|
||||
|
||||
@@ -57,6 +57,8 @@ class Breadcrumbs_Integration implements Integration_Interface {
|
||||
* Registers the `wpseo_breadcrumb` shortcode.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_shortcode( 'wpseo_breadcrumb', [ $this, 'render' ] );
|
||||
|
||||
@@ -13,17 +13,17 @@ class Cleanup_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Identifier used to determine the current task.
|
||||
*/
|
||||
const CURRENT_TASK_OPTION = 'wpseo-cleanup-current-task';
|
||||
public const CURRENT_TASK_OPTION = 'wpseo-cleanup-current-task';
|
||||
|
||||
/**
|
||||
* Identifier for the cron job.
|
||||
*/
|
||||
const CRON_HOOK = 'wpseo_cleanup_cron';
|
||||
public const CRON_HOOK = 'wpseo_cleanup_cron';
|
||||
|
||||
/**
|
||||
* Identifier for starting the cleanup.
|
||||
*/
|
||||
const START_HOOK = 'wpseo_start_cleanup_indexables';
|
||||
public const START_HOOK = 'wpseo_start_cleanup_indexables';
|
||||
|
||||
/**
|
||||
* The cleanup repository.
|
||||
@@ -161,7 +161,7 @@ class Cleanup_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter: Adds the possibility to add addition cleanup functions.
|
||||
*
|
||||
* @api array Associative array with unique keys. Value should be a cleanup function that receives a limit.
|
||||
* @param array $additional_tasks Associative array with unique keys. Value should be a cleanup function that receives a limit.
|
||||
*/
|
||||
$additional_tasks = \apply_filters( 'wpseo_cleanup_tasks', [] );
|
||||
|
||||
@@ -190,7 +190,7 @@ class Cleanup_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter: Adds the possibility to limit the number of items that are deleted from the database on cleanup.
|
||||
*
|
||||
* @api int $limit Maximum number of indexables to be cleaned up per query.
|
||||
* @param int $limit Maximum number of indexables to be cleaned up per query.
|
||||
*/
|
||||
$limit = \apply_filters( 'wpseo_cron_query_limit_size', 1000 );
|
||||
|
||||
|
||||
@@ -232,6 +232,8 @@ class Front_End_Integration implements Integration_Interface {
|
||||
*
|
||||
* Removes some actions to remove metadata that WordPress shows on the frontend,
|
||||
* to avoid duplicate and/or mismatched metadata.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_filter( 'render_block', [ $this, 'query_loop_next_prev' ], 1, 2 );
|
||||
@@ -327,7 +329,7 @@ class Front_End_Integration implements Integration_Interface {
|
||||
while ( $processor->next_tag( [ 'tag_name' => 'a' ] ) ) {
|
||||
$href = $processor->get_attribute( 'href' );
|
||||
if ( $href ) {
|
||||
return $presentation->permalink . substr( $href, 1 );
|
||||
return $presentation->permalink . \substr( $href, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -372,6 +374,8 @@ class Front_End_Integration implements Integration_Interface {
|
||||
* Presents the head in the front-end. Resets wp_query if it's not the main query.
|
||||
*
|
||||
* @codeCoverageIgnore It just calls a WordPress function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function call_wpseo_head() {
|
||||
global $wp_query;
|
||||
@@ -388,6 +392,8 @@ class Front_End_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Echoes all applicable presenters for a page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function present_head() {
|
||||
$context = $this->context_memoizer->for_current_page();
|
||||
@@ -396,7 +402,8 @@ class Front_End_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter 'wpseo_frontend_presentation' - Allow filtering the presentation used to output our meta values.
|
||||
*
|
||||
* @api Indexable_Presention The indexable presentation.
|
||||
* @param Indexable_Presention $presentation The indexable presentation.
|
||||
* @param Meta_Tags_Context $context The meta tags context for the current page.
|
||||
*/
|
||||
$presentation = \apply_filters( 'wpseo_frontend_presentation', $context->presentation, $context );
|
||||
|
||||
@@ -430,7 +437,7 @@ class Front_End_Integration implements Integration_Interface {
|
||||
|
||||
$needed_presenters = $this->get_needed_presenters( $page_type );
|
||||
|
||||
$callback = static function( $presenter ) {
|
||||
$callback = static function ( $presenter ) {
|
||||
if ( ! \class_exists( $presenter ) ) {
|
||||
return null;
|
||||
}
|
||||
@@ -441,10 +448,8 @@ class Front_End_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Filter 'wpseo_frontend_presenters' - Allow filtering the presenter instances in or out of the request.
|
||||
*
|
||||
* @param array $presenters The presenters.
|
||||
* @param Meta_Tags_Context $context The meta tags context for the current page.
|
||||
*
|
||||
* @api Abstract_Indexable_Presenter[] List of presenter instances.
|
||||
* @param Abstract_Indexable_Presenter[] $presenters List of presenter instances.
|
||||
* @param Meta_Tags_Context $context The meta tags context for the current page.
|
||||
*/
|
||||
$presenter_instances = \apply_filters( 'wpseo_frontend_presenters', $presenters, $context );
|
||||
|
||||
|
||||
@@ -43,9 +43,7 @@ class Comment_Link_Fixer implements Integration_Interface {
|
||||
* @param Redirect_Helper $redirect The redirect helper.
|
||||
* @param Robots_Helper $robots The robots helper.
|
||||
*/
|
||||
public function __construct(
|
||||
Redirect_Helper $redirect, Robots_Helper $robots
|
||||
) {
|
||||
public function __construct( Redirect_Helper $redirect, Robots_Helper $robots ) {
|
||||
$this->redirect = $redirect;
|
||||
$this->robots = $robots;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ class Crawl_Cleanup_Basic implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Removes X-Pingback and X-Powered-By headers as they're unneeded.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clean_headers() {
|
||||
if ( \headers_sent() ) {
|
||||
@@ -115,10 +117,8 @@ class Crawl_Cleanup_Basic implements Integration_Interface {
|
||||
unset( $hints[ $key ] );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( \strpos( $hint, '//s.w.org' ) !== false ) {
|
||||
elseif ( \strpos( $hint, '//s.w.org' ) !== false ) {
|
||||
unset( $hints[ $key ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ class Crawl_Cleanup_Rss implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Register our RSS related hooks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
if ( $this->is_true( 'remove_feed_global' ) ) {
|
||||
@@ -54,6 +56,8 @@ class Crawl_Cleanup_Rss implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Disable feeds on selected cases.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_disable_feeds() {
|
||||
if ( \is_singular() && $this->is_true( 'remove_feed_post_comments' )
|
||||
@@ -69,6 +73,8 @@ class Crawl_Cleanup_Rss implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Redirect feeds we don't want away.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_redirect_feeds() {
|
||||
global $wp_query;
|
||||
@@ -131,6 +137,8 @@ class Crawl_Cleanup_Rss implements Integration_Interface {
|
||||
* Sends a cache control header.
|
||||
*
|
||||
* @param int $expiration The expiration time.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function cache_control_header( $expiration ) {
|
||||
\header_remove( 'Expires' );
|
||||
@@ -153,6 +161,8 @@ class Crawl_Cleanup_Rss implements Integration_Interface {
|
||||
*
|
||||
* @param string $url The location we're redirecting to.
|
||||
* @param string $reason The reason we're redirecting.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function redirect_feed( $url, $reason ) {
|
||||
\header_remove( 'Content-Type' );
|
||||
|
||||
@@ -95,6 +95,8 @@ class Crawl_Cleanup_Searches implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Redirect pretty search URLs to the "raw" equivalent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function maybe_redirect_searches() {
|
||||
if ( ! \is_search() ) {
|
||||
|
||||
@@ -114,6 +114,8 @@ class Force_Rewrite_Title implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Starts the output buffer so it can later be fixed by flush_cache().
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function force_rewrite_output_buffer() {
|
||||
$this->ob_started = true;
|
||||
@@ -159,6 +161,8 @@ class Force_Rewrite_Title implements Integration_Interface {
|
||||
* Starts the output buffering.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function start_output_buffering() {
|
||||
\ob_start();
|
||||
|
||||
@@ -97,6 +97,8 @@ class Handle_404 implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Sets the 404 status code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_404() {
|
||||
$wp_query = $this->query_wrapper->get_query();
|
||||
@@ -109,6 +111,8 @@ class Handle_404 implements Integration_Interface {
|
||||
* Sets the headers for http.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_headers() {
|
||||
// Overwrite Content-Type header.
|
||||
|
||||
@@ -100,6 +100,8 @@ class Open_Graph_OEmbed implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Sets the OpenGraph title if configured.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_title() {
|
||||
$opengraph_title = $this->post_meta->open_graph_title;
|
||||
@@ -111,6 +113,8 @@ class Open_Graph_OEmbed implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Sets the OpenGraph description if configured.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_description() {
|
||||
$opengraph_description = $this->post_meta->open_graph_description;
|
||||
@@ -122,6 +126,8 @@ class Open_Graph_OEmbed implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Sets the image if it has been configured.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set_image() {
|
||||
$images = $this->post_meta->open_graph_images;
|
||||
|
||||
@@ -128,6 +128,8 @@ class Redirects implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* When certain archives are disabled, this redirects those to the homepage.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function archive_redirect() {
|
||||
if ( $this->need_archive_redirect() ) {
|
||||
@@ -137,6 +139,8 @@ class Redirects implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Based on the redirect meta value, this function determines whether it should redirect the current post / page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function page_redirect() {
|
||||
if ( ! $this->current_page->is_simple_page() ) {
|
||||
@@ -158,6 +162,8 @@ class Redirects implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* If the option to disable attachment URLs is checked, this performs the redirect to the attachment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function attachment_redirect() {
|
||||
if ( ! $this->current_page->is_attachment() ) {
|
||||
@@ -210,10 +216,10 @@ class Redirects implements Integration_Interface {
|
||||
/**
|
||||
* Allows the developer to change the target redirection URL for attachments.
|
||||
*
|
||||
* @api string $attachment_url The attachment URL for the queried object.
|
||||
* @api object $queried_object The queried object.
|
||||
*
|
||||
* @since 7.5.3
|
||||
*
|
||||
* @param string $attachment_url The attachment URL for the queried object.
|
||||
* @param object $queried_object The queried object.
|
||||
*/
|
||||
return \apply_filters(
|
||||
'wpseo_attachment_redirect_url',
|
||||
@@ -244,6 +250,8 @@ class Redirects implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Strips `cat=-1` from the URL and redirects to the resulting URL.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function category_redirect() {
|
||||
/**
|
||||
|
||||
@@ -95,9 +95,8 @@ class RSS_Footer_Embed implements Integration_Interface {
|
||||
/**
|
||||
* Filter: 'wpseo_include_rss_footer' - Allow the RSS footer to be dynamically shown/hidden.
|
||||
*
|
||||
* @api boolean $show_embed Indicates if the RSS footer should be shown or not.
|
||||
*
|
||||
* @param string $context The context of the RSS content - 'full' or 'excerpt'.
|
||||
* @param bool $show_embed Indicates if the RSS footer should be shown or not.
|
||||
* @param string $context The context of the RSS content - 'full' or 'excerpt'.
|
||||
*/
|
||||
if ( ! \apply_filters( 'wpseo_include_rss_footer', true, $context ) ) {
|
||||
return false;
|
||||
@@ -184,9 +183,9 @@ class RSS_Footer_Embed implements Integration_Interface {
|
||||
* 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 false.
|
||||
*
|
||||
* @api bool $unsigned Whether or not to follow the links in RSS feed, defaults to true.
|
||||
*
|
||||
* @since 1.4.20
|
||||
*
|
||||
* @param bool $unsigned Whether or not to follow the links in RSS feed, defaults to true.
|
||||
*/
|
||||
if ( \apply_filters( 'nofollow_rss_links', false ) ) {
|
||||
return '<a rel="nofollow" href="%1$s">%2$s</a>';
|
||||
|
||||
@@ -191,8 +191,8 @@ class WP_Robots_Integration implements Integration_Interface {
|
||||
'follow' => 2,
|
||||
'nofollow' => 3,
|
||||
];
|
||||
$ai = isset( $order[ $a ] ) ? $order[ $a ] : 4;
|
||||
$bi = isset( $order[ $b ] ) ? $order[ $b ] : 4;
|
||||
$ai = ( $order[ $a ] ?? 4 );
|
||||
$bi = ( $order[ $b ] ?? 4 );
|
||||
|
||||
return ( $ai - $bi );
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations;
|
||||
|
||||
use WP_Post;
|
||||
use WP_Post_Type;
|
||||
use WP_Taxonomy;
|
||||
use WP_User;
|
||||
@@ -15,46 +16,45 @@ use WPSEO_Shortlinker;
|
||||
use WPSEO_Sitemaps_Router;
|
||||
use Yoast\WP\SEO\Conditionals\Settings_Conditional;
|
||||
use Yoast\WP\SEO\Config\Schema_Types;
|
||||
use Yoast\WP\SEO\Content_Type_Visibility\Application\Content_Type_Visibility_Dismiss_Notifications;
|
||||
use Yoast\WP\SEO\Helpers\Current_Page_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Language_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Options_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Post_Type_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Product_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Schema\Article_Helper;
|
||||
use Yoast\WP\SEO\Helpers\Taxonomy_Helper;
|
||||
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.
|
||||
*/
|
||||
class Settings_Integration implements Integration_Interface {
|
||||
|
||||
const PAGE = 'wpseo_page_settings';
|
||||
public const PAGE = 'wpseo_page_settings';
|
||||
|
||||
/**
|
||||
* Holds the included WordPress options.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
const WP_OPTIONS = [ 'blogdescription' ];
|
||||
public const WP_OPTIONS = [ 'blogdescription' ];
|
||||
|
||||
/**
|
||||
* Holds the allowed option groups.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
const ALLOWED_OPTION_GROUPS = [ 'wpseo', 'wpseo_titles', 'wpseo_social' ];
|
||||
public const ALLOWED_OPTION_GROUPS = [ 'wpseo', 'wpseo_titles', 'wpseo_social' ];
|
||||
|
||||
/**
|
||||
* Holds the disallowed settings, per option group.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
const DISALLOWED_SETTINGS = [
|
||||
public const DISALLOWED_SETTINGS = [
|
||||
'wpseo' => [
|
||||
'myyoast-oauth',
|
||||
'semrush_tokens',
|
||||
@@ -85,7 +85,7 @@ class Settings_Integration implements Integration_Interface {
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
const DISABLED_ON_MULTISITE_SETTINGS = [
|
||||
public const DISABLED_ON_MULTISITE_SETTINGS = [
|
||||
'wpseo' => [
|
||||
'deny_search_crawling',
|
||||
'deny_wp_json_crawling',
|
||||
@@ -190,18 +190,18 @@ class Settings_Integration implements Integration_Interface {
|
||||
/**
|
||||
* Constructs Settings_Integration.
|
||||
*
|
||||
* @param WPSEO_Admin_Asset_Manager $asset_manager The WPSEO_Admin_Asset_Manager.
|
||||
* @param WPSEO_Replace_Vars $replace_vars The WPSEO_Replace_Vars.
|
||||
* @param Schema_Types $schema_types The Schema_Types.
|
||||
* @param Current_Page_Helper $current_page_helper The Current_Page_Helper.
|
||||
* @param Post_Type_Helper $post_type_helper The Post_Type_Helper.
|
||||
* @param Language_Helper $language_helper The Language_Helper.
|
||||
* @param Taxonomy_Helper $taxonomy_helper The Taxonomy_Helper.
|
||||
* @param Product_Helper $product_helper The Product_Helper.
|
||||
* @param Woocommerce_Helper $woocommerce_helper The Woocommerce_Helper.
|
||||
* @param Article_Helper $article_helper The Article_Helper.
|
||||
* @param User_Helper $user_helper The User_Helper.
|
||||
* @param Options_Helper $options The options helper.
|
||||
* @param WPSEO_Admin_Asset_Manager $asset_manager The WPSEO_Admin_Asset_Manager.
|
||||
* @param WPSEO_Replace_Vars $replace_vars The WPSEO_Replace_Vars.
|
||||
* @param Schema_Types $schema_types The Schema_Types.
|
||||
* @param Current_Page_Helper $current_page_helper The Current_Page_Helper.
|
||||
* @param Post_Type_Helper $post_type_helper The Post_Type_Helper.
|
||||
* @param Language_Helper $language_helper The Language_Helper.
|
||||
* @param Taxonomy_Helper $taxonomy_helper The Taxonomy_Helper.
|
||||
* @param Product_Helper $product_helper The Product_Helper.
|
||||
* @param Woocommerce_Helper $woocommerce_helper The Woocommerce_Helper.
|
||||
* @param Article_Helper $article_helper The Article_Helper.
|
||||
* @param User_Helper $user_helper The User_Helper.
|
||||
* @param Options_Helper $options The options helper.
|
||||
* @param Content_Type_Visibility_Dismiss_Notifications $content_type_visibility The Content_Type_Visibility_Dismiss_Notifications instance.
|
||||
*/
|
||||
public function __construct(
|
||||
@@ -275,7 +275,6 @@ class Settings_Integration implements Integration_Interface {
|
||||
\add_action( 'admin_init', [ $this, 'register_setting' ] );
|
||||
\add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
|
||||
\add_action( 'in_admin_header', [ $this, 'remove_notices' ], \PHP_INT_MAX );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,6 +352,8 @@ class Settings_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Displays the page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function display_page() {
|
||||
echo '<div id="yoast-seo-settings"></div>';
|
||||
@@ -369,7 +370,7 @@ 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' ) ) {
|
||||
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() );
|
||||
@@ -465,7 +466,7 @@ class Settings_Integration implements Integration_Interface {
|
||||
'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(),
|
||||
'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' ),
|
||||
@@ -529,7 +530,6 @@ class Settings_Integration implements Integration_Interface {
|
||||
private function get_site_basics_policies( $settings ) {
|
||||
$policies = [];
|
||||
|
||||
|
||||
$policies = $this->maybe_add_policy( $policies, $settings['wpseo_titles']['publishing_principles_id'], 'publishing_principles_id' );
|
||||
$policies = $this->maybe_add_policy( $policies, $settings['wpseo_titles']['ownership_funding_info_id'], 'ownership_funding_info_id' );
|
||||
$policies = $this->maybe_add_policy( $policies, $settings['wpseo_titles']['actionable_feedback_policy_id'], 'actionable_feedback_policy_id' );
|
||||
@@ -559,7 +559,7 @@ class Settings_Integration implements Integration_Interface {
|
||||
if ( isset( $policy ) && \is_int( $policy ) ) {
|
||||
$policy_array['id'] = $policy;
|
||||
$post = \get_post( $policy );
|
||||
if ( $post instanceof \WP_Post ) {
|
||||
if ( $post instanceof WP_Post ) {
|
||||
if ( $post->post_status !== 'publish' || $post->post_password !== '' ) {
|
||||
return $policies;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
|
||||
*/
|
||||
class Support_Integration implements Integration_Interface {
|
||||
|
||||
const PAGE = 'wpseo_page_support';
|
||||
public const PAGE = 'wpseo_page_support';
|
||||
|
||||
const CAPABILITY = 'wpseo_manage_options';
|
||||
public const CAPABILITY = 'wpseo_manage_options';
|
||||
|
||||
/**
|
||||
* Holds the WPSEO_Admin_Asset_Manager.
|
||||
@@ -116,6 +116,8 @@ class Support_Integration implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Displays the page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function display_page() {
|
||||
echo '<div id="yoast-seo-support"></div>';
|
||||
@@ -131,7 +133,7 @@ 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' ) ) {
|
||||
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() );
|
||||
@@ -159,7 +161,7 @@ class Support_Integration implements Integration_Interface {
|
||||
'preferences' => [
|
||||
'isPremium' => $this->product_helper->is_premium(),
|
||||
'isRtl' => \is_rtl(),
|
||||
'promotions' => YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(),
|
||||
'promotions' => \YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(),
|
||||
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
|
||||
'upsellSettings' => [
|
||||
'actionId' => 'load-nfd-ctb',
|
||||
|
||||
@@ -36,7 +36,7 @@ class Elementor implements Integration_Interface {
|
||||
/**
|
||||
* The identifier for the elementor tab.
|
||||
*/
|
||||
const YOAST_TAB = 'yoast-tab';
|
||||
public const YOAST_TAB = 'yoast-tab';
|
||||
|
||||
/**
|
||||
* Represents the post.
|
||||
@@ -120,9 +120,9 @@ class Elementor implements Integration_Interface {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @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 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(
|
||||
@@ -160,6 +160,8 @@ class Elementor implements Integration_Interface {
|
||||
/**
|
||||
* Registers our Elementor hooks.
|
||||
* This is done for pages with metabox on page load and not on ajax request.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_elementor_hooks() {
|
||||
|
||||
@@ -192,6 +194,8 @@ class Elementor implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Register a panel tab slug, in order to allow adding controls to this tab.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add_yoast_panel_tab() {
|
||||
Controls_Manager::add_tab( $this::YOAST_TAB, 'Yoast SEO' );
|
||||
@@ -201,6 +205,8 @@ class Elementor implements Integration_Interface {
|
||||
* Register additional document controls.
|
||||
*
|
||||
* @param PageBase $document The PageBase document.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_document_controls( $document ) {
|
||||
// PageBase is the base class for documents like `post` `page` and etc.
|
||||
|
||||
@@ -41,6 +41,8 @@ class Woocommerce_Permalinks implements Integration_Interface {
|
||||
* Registers the hooks.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_filter( 'wpseo_post_types_reset_permalinks', [ $this, 'filter_product_from_post_types' ] );
|
||||
@@ -65,6 +67,8 @@ class Woocommerce_Permalinks implements Integration_Interface {
|
||||
*
|
||||
* @param array $old_value The old value.
|
||||
* @param array $new_value The new value.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset_woocommerce_permalinks( $old_value, $new_value ) {
|
||||
$changed_options = \array_diff( $old_value, $new_value );
|
||||
|
||||
@@ -49,7 +49,7 @@ class Wordproof implements Integration_Interface {
|
||||
* @param Wordproof_Helper $wordproof The WordProof helper instance.
|
||||
* @param WPSEO_Admin_Asset_Manager $asset_manager The WPSEO admin asset manager instance.
|
||||
*/
|
||||
public function __construct( Wordproof_Helper $wordproof, WPSEO_Admin_Asset_Manager $asset_manager = null ) {
|
||||
public function __construct( Wordproof_Helper $wordproof, ?WPSEO_Admin_Asset_Manager $asset_manager = null ) {
|
||||
if ( ! $asset_manager ) {
|
||||
$asset_manager = new WPSEO_Admin_Asset_Manager();
|
||||
}
|
||||
@@ -89,10 +89,10 @@ class Wordproof implements Integration_Interface {
|
||||
*/
|
||||
\add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_assets' ], 10, 0 );
|
||||
|
||||
if ( version_compare( strtok( get_bloginfo( 'version' ), '-' ), '6.3', '>=' ) ) {
|
||||
if ( \version_compare( \strtok( \get_bloginfo( 'version' ), '-' ), '6.3', '>=' ) ) {
|
||||
\add_action(
|
||||
'wp_enqueue_scripts',
|
||||
function() {
|
||||
static function () {
|
||||
\wp_script_add_data( WPSEO_Admin_Asset_Manager::PREFIX . 'wordproof-uikit', 'strategy', 'async' );
|
||||
},
|
||||
11,
|
||||
@@ -136,6 +136,8 @@ class Wordproof implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Initializes the WordProof WordPress SDK.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function sdk_setup() {
|
||||
|
||||
@@ -152,6 +154,8 @@ class Wordproof implements Integration_Interface {
|
||||
*
|
||||
* @param int $old_post_id The old post id.
|
||||
* @param int $new_post_id The new post id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function disable_timestamp_for_previous_legal_page( $old_post_id, $new_post_id ) {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class WPML_WPSEO_Notification implements Integration_Interface {
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpml-wpseo-not-installed';
|
||||
public const NOTIFICATION_ID = 'wpml-wpseo-not-installed';
|
||||
|
||||
/**
|
||||
* The short link helper.
|
||||
@@ -107,7 +107,7 @@ class WPML_WPSEO_Notification implements Integration_Interface {
|
||||
return new Yoast_Notification(
|
||||
\sprintf(
|
||||
/* translators: %1$s expands to an opening anchor tag, %2$s expands to an closing anchor tag. */
|
||||
\__( 'We notice that you have installed WPML. To make sure your canonical URLs are set correctly, %1$sinstall and activate the Yoast SEO Multilingual add-on%2$s as well!', 'wordpress-seo' ),
|
||||
\__( 'We notice that you have installed WPML. To make sure your canonical URLs are set correctly, %1$sinstall and activate the WPML SEO add-on%2$s as well!', 'wordpress-seo' ),
|
||||
'<a href="' . \esc_url( $this->short_link_helper->get( 'https://yoa.st/wpml-yoast-seo' ) ) . '" target="_blank">',
|
||||
'</a>'
|
||||
),
|
||||
|
||||
@@ -35,6 +35,8 @@ class WPML implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Adds a filter to WPML's wpml_get_home_url filter to ensure we get the unmanipulated home URL.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function filter_home_url_before() {
|
||||
\add_filter( 'wpml_get_home_url', [ $this, 'wpml_get_home_url' ], 10, 2 );
|
||||
|
||||
@@ -17,14 +17,14 @@ class Addon_Update_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const WPSEO_FREE_PLUGIN_ID = 'wordpress-seo/wp-seo.php';
|
||||
public const WPSEO_FREE_PLUGIN_ID = 'wordpress-seo/wp-seo.php';
|
||||
|
||||
/**
|
||||
* A list of Yoast add-on identifiers.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
const ADD_ON_PLUGIN_FILES = [
|
||||
public const ADD_ON_PLUGIN_FILES = [
|
||||
'wordpress-seo-premium/wp-seo-premium.php',
|
||||
'wpseo-video/video-seo.php',
|
||||
'wpseo-local/local-seo.php', // When installing Local through a released zip, the path is different from the path on a dev environment.
|
||||
@@ -35,6 +35,8 @@ class Addon_Update_Watcher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers the hooks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'add_site_option_auto_update_plugins', [ $this, 'call_toggle_auto_updates_with_empty_array' ], 10, 2 );
|
||||
@@ -101,6 +103,8 @@ class Addon_Update_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @param string $option The name of the option that is being created.
|
||||
* @param array|mixed $value The new (and first) value of the option that is being created.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function call_toggle_auto_updates_with_empty_array( $option, $value ) {
|
||||
if ( $option !== 'auto_update_plugins' ) {
|
||||
@@ -187,6 +191,8 @@ class Addon_Update_Watcher implements Integration_Interface {
|
||||
* Enables auto-updates for all addons.
|
||||
*
|
||||
* @param string[] $auto_updated_plugins The current list of auto-updated plugins.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function enable_auto_updates_for_addons( $auto_updated_plugins ) {
|
||||
$plugins = \array_unique( \array_merge( $auto_updated_plugins, self::ADD_ON_PLUGIN_FILES ) );
|
||||
@@ -197,6 +203,8 @@ class Addon_Update_Watcher implements Integration_Interface {
|
||||
* Disables auto-updates for all addons.
|
||||
*
|
||||
* @param string[] $auto_updated_plugins The current list of auto-updated plugins.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function disable_auto_updates_for_addons( $auto_updated_plugins ) {
|
||||
$plugins = \array_values( \array_diff( $auto_updated_plugins, self::ADD_ON_PLUGIN_FILES ) );
|
||||
|
||||
@@ -16,7 +16,7 @@ class Auto_Update_Watcher implements Integration_Interface {
|
||||
/**
|
||||
* The notification ID.
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpseo-auto-update';
|
||||
public const NOTIFICATION_ID = 'wpseo-auto-update';
|
||||
|
||||
/**
|
||||
* The Yoast notification center.
|
||||
|
||||
@@ -89,6 +89,8 @@ class Indexable_Ancestor_Watcher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Registers the appropriate hooks.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'wpseo_save_indexable', [ $this, 'reset_children' ], \PHP_INT_MAX, 2 );
|
||||
@@ -149,7 +151,7 @@ class Indexable_Ancestor_Watcher implements Integration_Interface {
|
||||
// Removes the objects that are already present in the children.
|
||||
$existing_post_indexables = \array_filter(
|
||||
$child_indexables,
|
||||
static function( $indexable ) {
|
||||
static function ( $indexable ) {
|
||||
return $indexable->object_type === 'post';
|
||||
}
|
||||
);
|
||||
@@ -178,6 +180,8 @@ class Indexable_Ancestor_Watcher implements Integration_Interface {
|
||||
* Updates the indexable hierarchy and indexable permalink.
|
||||
*
|
||||
* @param Indexable $indexable The indexable to update the hierarchy and permalink for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function update_hierarchy_and_permalink( $indexable ) {
|
||||
if ( \is_a( $indexable, Indexable::class ) ) {
|
||||
@@ -197,7 +201,7 @@ class Indexable_Ancestor_Watcher implements Integration_Interface {
|
||||
* @return array List with object ids for the term.
|
||||
*/
|
||||
protected function get_object_ids_for_term( $term_id, $child_indexables ) {
|
||||
$filter_terms = static function( $child ) {
|
||||
$filter_terms = static function ( $child ) {
|
||||
return $child->object_type === 'term';
|
||||
};
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ class Indexable_Author_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'user_register', [ $this, 'build_indexable' ], \PHP_INT_MAX );
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Yoast\WP\SEO\Integrations\Watchers;
|
||||
|
||||
use WPSEO_Utils;
|
||||
use Yoast\WP\SEO\Config\Indexing_Reasons;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,8 @@ class Indexable_Category_Permalink_Watcher extends Indexable_Permalink_Watcher {
|
||||
// If a new value has been set for 'stripcategorybase', clear the category permalinks.
|
||||
if ( $old_value['stripcategorybase'] !== $new_value['stripcategorybase'] ) {
|
||||
$this->indexable_helper->reset_permalink_indexables( 'term', 'category', Indexing_Reasons::REASON_CATEGORY_BASE_PREFIX );
|
||||
// Clear the rewrites, so the new permalink structure is used.
|
||||
WPSEO_Utils::clear_rewrites();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ class Indexable_Date_Archive_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'update_option_wpseo_titles', [ $this, 'check_option' ], 10, 2 );
|
||||
|
||||
@@ -52,6 +52,8 @@ class Indexable_Home_Page_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'update_option_wpseo_titles', [ $this, 'check_option' ], 15, 3 );
|
||||
|
||||
@@ -86,6 +86,8 @@ class Indexable_Permalink_Watcher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* Resets the permalinks for everything that is related to the permalink structure.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset_permalinks() {
|
||||
|
||||
@@ -111,6 +113,8 @@ class Indexable_Permalink_Watcher implements Integration_Interface {
|
||||
* Resets the permalink for the given post type.
|
||||
*
|
||||
* @param string $post_type The post type to reset.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset_permalinks_post_type( $post_type ) {
|
||||
$this->indexable_helper->reset_permalink_indexables( 'post', $post_type );
|
||||
@@ -123,6 +127,8 @@ class Indexable_Permalink_Watcher implements Integration_Interface {
|
||||
* @param string $old_value Unused. The old option value.
|
||||
* @param string $new_value Unused. The new option value.
|
||||
* @param string $type The option name.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reset_permalinks_term( $old_value, $new_value, $type ) {
|
||||
$subtype = $type;
|
||||
|
||||
@@ -47,6 +47,8 @@ class Indexable_Post_Meta_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
// Register all posts whose meta have changed.
|
||||
|
||||
@@ -52,6 +52,8 @@ class Indexable_Post_Type_Archive_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'update_option_wpseo_titles', [ $this, 'check_option' ], 10, 2 );
|
||||
|
||||
@@ -109,7 +109,6 @@ 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.
|
||||
@@ -132,7 +131,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
|
||||
$this->indexing_helper->set_reason( Indexing_Reasons::REASON_POST_TYPE_MADE_PUBLIC );
|
||||
|
||||
do_action( 'new_public_post_type_notifications', $newly_made_public_post_types );
|
||||
\do_action( 'new_public_post_type_notifications', $newly_made_public_post_types );
|
||||
}
|
||||
|
||||
// There are post types that have been made private.
|
||||
@@ -143,7 +142,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
\wp_schedule_single_event( ( \time() + ( \MINUTE_IN_SECONDS * 5 ) ), Cleanup_Integration::START_HOOK );
|
||||
}
|
||||
|
||||
do_action( 'clean_new_public_post_type_notifications', $newly_made_non_public_post_types );
|
||||
\do_action( 'clean_new_public_post_type_notifications', $newly_made_non_public_post_types );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +157,8 @@ class Indexable_Post_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @param Indexable $indexable The indexable.
|
||||
* @param WP_Post $post The post.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updated_indexable( $indexable, $post ) {
|
||||
// Only interested in post indexables.
|
||||
@@ -218,6 +220,8 @@ class Indexable_Post_Watcher implements Integration_Interface {
|
||||
* Updates the has_public_posts when the post indexable is built.
|
||||
*
|
||||
* @param Indexable $indexable The indexable to check.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function update_has_public_posts( $indexable ) {
|
||||
// Update the author indexable's has public posts value.
|
||||
@@ -259,6 +263,8 @@ class Indexable_Post_Watcher implements Integration_Interface {
|
||||
* Updates the relations on post save or post status change.
|
||||
*
|
||||
* @param WP_Post $post The post that has been updated.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function update_relations( $post ) {
|
||||
$related_indexables = $this->get_related_indexables( $post );
|
||||
|
||||
@@ -44,6 +44,8 @@ class Indexable_Static_Home_Page_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'update_option_page_on_front', [ $this, 'update_static_homepage_permalink' ], 10, 2 );
|
||||
@@ -54,6 +56,8 @@ class Indexable_Static_Home_Page_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @param string $old_value The previous homepage's ID.
|
||||
* @param int $value The new homepage's ID.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function update_static_homepage_permalink( $old_value, $value ) {
|
||||
if ( \is_string( $old_value ) ) {
|
||||
@@ -72,6 +76,8 @@ class Indexable_Static_Home_Page_Watcher implements Integration_Interface {
|
||||
* Updates the permalink based on the selected homepage settings.
|
||||
*
|
||||
* @param int $page_id The page's id.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function update_permalink_for_page( $page_id ) {
|
||||
if ( $page_id === 0 ) {
|
||||
|
||||
@@ -53,6 +53,8 @@ class Indexable_System_Page_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'update_option_wpseo_titles', [ $this, 'check_option' ], 10, 2 );
|
||||
|
||||
@@ -133,7 +133,7 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
|
||||
\delete_transient( Indexable_Term_Indexation_Action::UNINDEXED_LIMITED_COUNT_TRANSIENT );
|
||||
|
||||
$this->indexing_helper->set_reason( Indexing_Reasons::REASON_TAXONOMY_MADE_PUBLIC );
|
||||
do_action( 'new_public_taxonomy_notifications', $newly_made_public_taxonomies );
|
||||
\do_action( 'new_public_taxonomy_notifications', $newly_made_public_taxonomies );
|
||||
}
|
||||
|
||||
// There are taxonomies that have been made private.
|
||||
@@ -144,7 +144,7 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
|
||||
\wp_schedule_single_event( ( \time() + ( \MINUTE_IN_SECONDS * 5 ) ), Cleanup_Integration::START_HOOK );
|
||||
}
|
||||
|
||||
do_action( 'clean_new_public_taxonomy_notifications', $newly_made_non_public_taxonomies );
|
||||
\do_action( 'clean_new_public_taxonomy_notifications', $newly_made_non_public_taxonomies );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +104,8 @@ class Primary_Category_Quick_Edit_Watcher implements Integration_Interface {
|
||||
* @param array $terms Unused. An array of object terms.
|
||||
* @param array $tt_ids An array of term taxonomy IDs.
|
||||
* @param string $taxonomy Taxonomy slug.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function validate_primary_category( $object_id, $terms, $tt_ids, $taxonomy ) {
|
||||
$post = \get_post( $object_id );
|
||||
@@ -159,6 +161,8 @@ class Primary_Category_Quick_Edit_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @param int $post_id The post id to set primary taxonomy for.
|
||||
* @param string $main_taxonomy Name of the taxonomy that is set to be the primary one.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function remove_primary_term( $post_id, $main_taxonomy ) {
|
||||
$primary_term = $this->primary_term_repository->find_by_post_id_and_taxonomy( $post_id, $main_taxonomy, false );
|
||||
@@ -174,6 +178,8 @@ class Primary_Category_Quick_Edit_Watcher implements Integration_Interface {
|
||||
* Builds the hierarchy for a post.
|
||||
*
|
||||
* @param WP_Post $post The post.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function build_post_hierarchy( $post ) {
|
||||
if ( $this->post_type_helper->is_excluded( $post->post_type ) ) {
|
||||
|
||||
@@ -82,6 +82,8 @@ class Primary_Term_Watcher implements Integration_Interface {
|
||||
* Initializes the integration.
|
||||
*
|
||||
* This is the place to register hooks and filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register_hooks() {
|
||||
\add_action( 'save_post', [ $this, 'save_primary_terms' ], \PHP_INT_MAX );
|
||||
@@ -92,6 +94,8 @@ class Primary_Term_Watcher implements Integration_Interface {
|
||||
* Saves all selected primary terms.
|
||||
*
|
||||
* @param int $post_id Post ID to save primary terms for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function save_primary_terms( $post_id ) {
|
||||
// Bail if this is a multisite installation and the site has been switched.
|
||||
@@ -113,6 +117,8 @@ class Primary_Term_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @param int $post_id Post ID to save primary term for.
|
||||
* @param WP_Term $taxonomy Taxonomy to save primary term for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function save_primary_term( $post_id, $taxonomy ) {
|
||||
if ( isset( $_POST[ WPSEO_Meta::$form_prefix . 'primary_' . $taxonomy->name . '_term' ] ) && \is_string( $_POST[ WPSEO_Meta::$form_prefix . 'primary_' . $taxonomy->name . '_term' ] ) ) {
|
||||
|
||||
@@ -14,8 +14,6 @@ use Yoast_Notification_Center;
|
||||
|
||||
/**
|
||||
* Shows a notification for users who have access for robots disabled.
|
||||
*
|
||||
* @class Search_Engines_Discouraged_Watcher
|
||||
*/
|
||||
class Search_Engines_Discouraged_Watcher implements Integration_Interface {
|
||||
|
||||
@@ -24,7 +22,7 @@ class Search_Engines_Discouraged_Watcher implements Integration_Interface {
|
||||
/**
|
||||
* The notification ID.
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpseo-search-engines-discouraged';
|
||||
public const NOTIFICATION_ID = 'wpseo-search-engines-discouraged';
|
||||
|
||||
/**
|
||||
* The Yoast notification center.
|
||||
|
||||
@@ -13,15 +13,13 @@ use Yoast_Notification_Center;
|
||||
|
||||
/**
|
||||
* Shows a notification for users who have Woocommerce product beta editor enabled.
|
||||
*
|
||||
* @class Woocommerce_Beta_Editor_Watcher
|
||||
*/
|
||||
class Woocommerce_Beta_Editor_Watcher implements Integration_Interface {
|
||||
|
||||
/**
|
||||
* The notification ID.
|
||||
*/
|
||||
const NOTIFICATION_ID = 'wpseo-woocommerce-beta-editor-warning';
|
||||
public const NOTIFICATION_ID = 'wpseo-woocommerce-beta-editor-warning';
|
||||
|
||||
/**
|
||||
* The short link helper.
|
||||
@@ -56,7 +54,7 @@ class Woocommerce_Beta_Editor_Watcher implements Integration_Interface {
|
||||
*
|
||||
* @param Yoast_Notification_Center $notification_center The notification center.
|
||||
* @param Notification_Helper $notification_helper The notification helper.
|
||||
* @param Short_Link_Helper $short_link_helper The short link helper.
|
||||
* @param Short_Link_Helper $short_link_helper The short link helper.
|
||||
*/
|
||||
public function __construct(
|
||||
Yoast_Notification_Center $notification_center,
|
||||
|
||||
Reference in New Issue
Block a user