rebase on oct-10-2023
This commit is contained in:
@@ -367,6 +367,7 @@ new WPSEO_Shortcode_Filter();
|
||||
new WPSEO_Taxonomy_Columns();
|
||||
|
||||
/* ********************* DEPRECATED FUNCTIONS ********************* */
|
||||
|
||||
/**
|
||||
* Retrieves the keyword for the keyword doubles.
|
||||
*/
|
||||
|
||||
@@ -243,6 +243,7 @@ class WPSEO_Admin_Asset_Manager {
|
||||
'api-client' => [ 'wp-api' ],
|
||||
'crawl-settings' => [ 'jquery' ],
|
||||
'dashboard-widget' => [ self::PREFIX . 'api-client' ],
|
||||
'wincher-dashboard-widget' => [ self::PREFIX . 'api-client' ],
|
||||
'editor-modules' => [ 'jquery' ],
|
||||
'elementor' => [
|
||||
self::PREFIX . 'api-client',
|
||||
@@ -551,6 +552,19 @@ class WPSEO_Admin_Asset_Manager {
|
||||
'wp-components',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'ai-generator',
|
||||
'src' => 'ai-generator-' . $flat_version,
|
||||
'deps' => [
|
||||
self::PREFIX . 'tailwind',
|
||||
self::PREFIX . 'introductions',
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'introductions',
|
||||
'src' => 'introductions-' . $flat_version,
|
||||
'deps' => [ self::PREFIX . 'tailwind' ],
|
||||
],
|
||||
[
|
||||
'name' => 'wp-dashboard',
|
||||
'src' => 'dashboard-' . $flat_version,
|
||||
@@ -574,10 +588,6 @@ class WPSEO_Admin_Asset_Manager {
|
||||
'name' => 'admin-global',
|
||||
'src' => 'admin-global-' . $flat_version,
|
||||
],
|
||||
[
|
||||
'name' => 'yoast-components',
|
||||
'src' => 'yoast-components-' . $flat_version,
|
||||
],
|
||||
[
|
||||
'name' => 'extensions',
|
||||
'src' => 'yoast-extensions-' . $flat_version,
|
||||
@@ -609,10 +619,17 @@ class WPSEO_Admin_Asset_Manager {
|
||||
[
|
||||
'name' => 'new-settings',
|
||||
'src' => 'new-settings-' . $flat_version,
|
||||
'deps' => [ self::PREFIX . 'tailwind' ],
|
||||
],
|
||||
[
|
||||
'name' => 'academy',
|
||||
'src' => 'academy-' . $flat_version,
|
||||
'deps' => [ self::PREFIX . 'tailwind' ],
|
||||
],
|
||||
[
|
||||
'name' => 'support',
|
||||
'src' => 'support-' . $flat_version,
|
||||
'deps' => [ self::PREFIX . 'tailwind' ],
|
||||
],
|
||||
[
|
||||
'name' => 'workouts',
|
||||
@@ -622,12 +639,13 @@ class WPSEO_Admin_Asset_Manager {
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'inside-editor',
|
||||
'src' => 'inside-editor-' . $flat_version,
|
||||
'name' => 'first-time-configuration',
|
||||
'src' => 'first-time-configuration-' . $flat_version,
|
||||
'deps' => [ self::PREFIX . 'tailwind' ],
|
||||
],
|
||||
[
|
||||
'name' => 'editor',
|
||||
'src' => 'editor-' . $flat_version,
|
||||
'name' => 'inside-editor',
|
||||
'src' => 'inside-editor-' . $flat_version,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Localizes JavaScript files.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated 18.0
|
||||
*/
|
||||
final class WPSEO_Admin_Asset_Yoast_Components_L10n {
|
||||
|
||||
/**
|
||||
* Represents the asset manager.
|
||||
*
|
||||
* @var WPSEO_Admin_Asset_Manager
|
||||
*/
|
||||
protected $asset_manager;
|
||||
|
||||
/**
|
||||
* WPSEO_Admin_Asset_Yoast_Components_L10n constructor.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated 18.0
|
||||
*/
|
||||
public function __construct() {
|
||||
_deprecated_constructor( __CLASS__, '18.0' );
|
||||
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Localizes the given script with the JavaScript translations.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated 18.0
|
||||
*
|
||||
* @param string $script_handle The script handle to localize for.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function localize_script( $script_handle ) {
|
||||
_deprecated_function( __FUNCTION__, '18.0' );
|
||||
$translations = [
|
||||
'yoast-components' => $this->get_translations( 'yoast-components' ),
|
||||
'wordpress-seo' => $this->get_translations( 'wordpress-seojs' ),
|
||||
'yoast-schema-blocks' => $this->get_translations( 'yoast-schema-blocks' ),
|
||||
];
|
||||
$this->asset_manager->localize_script( $script_handle, 'wpseoYoastJSL10n', $translations );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns translations necessary for JS files.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated 18.0
|
||||
*
|
||||
* @param string $component The component to retrieve the translations for.
|
||||
* @return object|null The translations in a Jed format for JS files.
|
||||
*/
|
||||
protected function get_translations( $component ) {
|
||||
_deprecated_function( __FUNCTION__, '18.0' );
|
||||
$locale = \get_user_locale();
|
||||
|
||||
$file = WPSEO_PATH . 'languages/' . $component . '-' . $locale . '.json';
|
||||
if ( file_exists( $file ) ) {
|
||||
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Retrieving a local file.
|
||||
$file = file_get_contents( $file );
|
||||
if ( is_string( $file ) && $file !== '' ) {
|
||||
return json_decode( $file, true );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,8 @@ class WPSEO_Admin {
|
||||
}
|
||||
|
||||
$this->admin_features = [
|
||||
'dashboard_widget' => new Yoast_Dashboard_Widget(),
|
||||
'dashboard_widget' => new Yoast_Dashboard_Widget(),
|
||||
'wincher_dashboard_widget' => new Wincher_Dashboard_Widget(),
|
||||
];
|
||||
|
||||
if ( WPSEO_Metabox::is_post_overview( $pagenow ) || WPSEO_Metabox::is_post_edit( $pagenow ) ) {
|
||||
@@ -238,7 +239,6 @@ class WPSEO_Admin {
|
||||
array_unshift( $links, $ftc_link );
|
||||
}
|
||||
|
||||
|
||||
$addon_manager = new WPSEO_Addon_Manager();
|
||||
if ( YoastSEO()->helpers->product->is_premium() ) {
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Config\Schema_Types;
|
||||
use Yoast\WP\SEO\Integrations\Settings_Integration;
|
||||
use Yoast\WP\SEO\Integrations\Academy_Integration;
|
||||
use Yoast\WP\SEO\Integrations\Settings_Integration;
|
||||
use Yoast\WP\SEO\Integrations\Support_Integration;
|
||||
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
|
||||
|
||||
/**
|
||||
* Class WPSEO_Admin_Pages.
|
||||
@@ -35,6 +36,7 @@ class WPSEO_Admin_Pages {
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', [ $this, 'init' ], 20 );
|
||||
|
||||
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
|
||||
}
|
||||
|
||||
@@ -44,8 +46,8 @@ class WPSEO_Admin_Pages {
|
||||
public function init() {
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
|
||||
$page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
||||
if ( $page === Settings_Integration::PAGE || $page === Academy_Integration::PAGE ) {
|
||||
// Bail, this is managed in the Settings_Integration.
|
||||
if ( \in_array( $page, [ Settings_Integration::PAGE, Academy_Integration::PAGE, Support_Integration::PAGE ], true ) ) {
|
||||
// Bail, this is managed in the applicable integration.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,16 +81,20 @@ class WPSEO_Admin_Pages {
|
||||
wp_enqueue_script( 'dashboard' );
|
||||
wp_enqueue_script( 'thickbox' );
|
||||
|
||||
$alert_dismissal_action = YoastSEO()->classes->get( \Yoast\WP\SEO\Actions\Alert_Dismissal_Action::class );
|
||||
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
|
||||
$alert_dismissal_action = YoastSEO()->classes->get( \Yoast\WP\SEO\Actions\Alert_Dismissal_Action::class );
|
||||
$dismissed_alerts = $alert_dismissal_action->all_dismissed();
|
||||
$woocommerce_conditional = new WooCommerce_Conditional();
|
||||
|
||||
$script_data = [
|
||||
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
|
||||
'dismissedAlerts' => $dismissed_alerts,
|
||||
'isRtl' => is_rtl(),
|
||||
'isPremium' => YoastSEO()->helpers->product->is_premium(),
|
||||
'isWooCommerceActive' => $woocommerce_conditional->is_met(),
|
||||
'webinarIntroSettingsUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-settings' ),
|
||||
'blackFridayBlockEditorUrl' => ( YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->is( 'black_friday_2023_checklist' ) ) ? WPSEO_Shortlinker::get( 'https://yoa.st/black-friday-checklist' ) : '',
|
||||
'webinarIntroFirstTimeConfigUrl' => $this->get_webinar_shortlink(),
|
||||
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
|
||||
];
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
|
||||
|
||||
@@ -28,7 +28,7 @@ class WPSEO_Expose_Shortlinks implements WPSEO_WordPress_Integration {
|
||||
'shortlinks.nofollow_sponsored' => 'https://yoa.st/nofollow-sponsored',
|
||||
'shortlinks.snippet_preview_info' => 'https://yoa.st/snippet-preview',
|
||||
'shortlinks.cornerstone_content_info' => 'https://yoa.st/1i9',
|
||||
'shortlinks.upsell.social_preview.facebook' => 'https://yoa.st/social-preview-facebook',
|
||||
'shortlinks.upsell.social_preview.social' => 'https://yoa.st/social-preview-facebook',
|
||||
'shortlinks.upsell.social_preview.twitter' => 'https://yoa.st/social-preview-twitter',
|
||||
'shortlinks.upsell.sidebar.news' => 'https://yoa.st/get-news-sidebar',
|
||||
'shortlinks.upsell.sidebar.focus_keyword_synonyms_link' => 'https://yoa.st/textlink-synonyms-popup-sidebar',
|
||||
|
||||
@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const CURRENT_RELEASE = '15.7.0';
|
||||
const CURRENT_RELEASE = '16.7.0';
|
||||
|
||||
/**
|
||||
* The minimally supported version of Gutenberg by the plugin.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MINIMUM_SUPPORTED = '15.7.0';
|
||||
const MINIMUM_SUPPORTED = '16.7.0';
|
||||
|
||||
/**
|
||||
* Holds the current version.
|
||||
|
||||
@@ -418,7 +418,14 @@ class WPSEO_Meta_Columns {
|
||||
}
|
||||
}
|
||||
|
||||
return $active_filters;
|
||||
/**
|
||||
* Adapt the active applicable filters on the posts overview.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param array $active_filters The current applicable filters.
|
||||
*/
|
||||
return \apply_filters( 'wpseo_change_applicable_filters', $active_filters );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,8 +438,22 @@ class WPSEO_Meta_Columns {
|
||||
public function column_sort_orderby( $vars ) {
|
||||
$collected_filters = $this->collect_filters();
|
||||
|
||||
if ( isset( $vars['orderby'] ) ) {
|
||||
$vars = array_merge( $vars, $this->filter_order_by( $vars['orderby'] ) );
|
||||
$order_by_column = $vars['orderby'];
|
||||
if ( isset( $order_by_column ) ) {
|
||||
// Based on the selected column, create a meta query.
|
||||
$order_by = $this->filter_order_by( $order_by_column );
|
||||
|
||||
/**
|
||||
* Adapt the order by part of the query on the posts overview.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @param array $order_by The current order by.
|
||||
* @param string $order_by_column The current order by column.
|
||||
*/
|
||||
$order_by = \apply_filters( 'wpseo_change_order_by', $order_by, $order_by_column );
|
||||
|
||||
$vars = array_merge( $vars, $order_by );
|
||||
}
|
||||
|
||||
return $this->build_filter_query( $vars, $collected_filters );
|
||||
|
||||
@@ -51,10 +51,12 @@ class WPSEO_Premium_Upsell_Admin_Block {
|
||||
$url = WPSEO_Shortlinker::get( 'https://yoa.st/17h' );
|
||||
|
||||
$arguments = [
|
||||
'<strong>' . esc_html__( 'Multiple keyphrases', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Increase your SEO reach', 'wordpress-seo' ),
|
||||
'<strong>' . esc_html__( 'Use AI', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Quickly create titles & meta descriptions', 'wordpress-seo' ),
|
||||
'<strong>' . esc_html__( 'No more dead links', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Easy redirect manager', 'wordpress-seo' ),
|
||||
'<strong>' . esc_html__( 'Superfast internal linking suggestions', 'wordpress-seo' ) . '</strong>',
|
||||
'<strong>' . esc_html__( 'Social media preview', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Facebook & Twitter', 'wordpress-seo' ),
|
||||
'<strong>' . esc_html__( 'Multiple keyphrases', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Increase your SEO reach', 'wordpress-seo' ),
|
||||
'<strong>' . esc_html__( 'SEO Workouts', 'wordpress-seo' ) . '</strong>: ' . esc_html__( 'Get guided in routine SEO tasks', 'wordpress-seo' ),
|
||||
'<strong>' . esc_html__( '24/7 email support', 'wordpress-seo' ) . '</strong>',
|
||||
'<strong>' . esc_html__( 'No ads!', 'wordpress-seo' ) . '</strong>',
|
||||
];
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/**
|
||||
* WPSEO plugin file.
|
||||
*
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wincher dashboard widget.
|
||||
*/
|
||||
class Wincher_Dashboard_Widget implements WPSEO_WordPress_Integration {
|
||||
|
||||
/**
|
||||
* Holds an instance of the admin asset manager.
|
||||
*
|
||||
* @var WPSEO_Admin_Asset_Manager
|
||||
*/
|
||||
protected $asset_manager;
|
||||
|
||||
/**
|
||||
* Wincher_Dashboard_Widget constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->asset_manager = new WPSEO_Admin_Asset_Manager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register WordPress hooks.
|
||||
*/
|
||||
public function register_hooks() {
|
||||
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_wincher_dashboard_assets' ] );
|
||||
add_action( 'admin_init', [ $this, 'queue_wincher_dashboard_widget' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the Wincher dashboard widget if it should be shown.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function queue_wincher_dashboard_widget() {
|
||||
if ( $this->show_widget() ) {
|
||||
add_action( 'wp_dashboard_setup', [ $this, 'add_wincher_dashboard_widget' ] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the Wincher dashboard widget to WordPress.
|
||||
*/
|
||||
public function add_wincher_dashboard_widget() {
|
||||
add_filter( 'postbox_classes_dashboard_wpseo-wincher-dashboard-overview', [ $this, 'wpseo_wincher_dashboard_overview_class' ] );
|
||||
wp_add_dashboard_widget(
|
||||
'wpseo-wincher-dashboard-overview',
|
||||
/* translators: %1$s expands to Yoast SEO, %2$s to Wincher */
|
||||
sprintf( __( '%1$s / %2$s: Top Keyphrases', 'wordpress-seo' ), 'Yoast SEO', 'Wincher' ),
|
||||
[ $this, 'display_wincher_dashboard_widget' ]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds CSS classes to the dashboard widget.
|
||||
*
|
||||
* @param array $classes An array of postbox CSS classes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function wpseo_wincher_dashboard_overview_class( $classes ) {
|
||||
$classes[] = 'yoast wpseo-wincherdashboard-overview';
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the Wincher dashboard widget.
|
||||
*/
|
||||
public function display_wincher_dashboard_widget() {
|
||||
echo '<div id="yoast-seo-wincher-dashboard-widget"></div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues assets for the dashboard if the current page is the dashboard.
|
||||
*/
|
||||
public function enqueue_wincher_dashboard_assets() {
|
||||
if ( ! $this->is_dashboard_screen() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->asset_manager->localize_script( 'wincher-dashboard-widget', 'wpseoWincherDashboardWidgetL10n', $this->localize_wincher_dashboard_script() );
|
||||
$this->asset_manager->enqueue_script( 'wincher-dashboard-widget' );
|
||||
$this->asset_manager->enqueue_style( 'wp-dashboard' );
|
||||
$this->asset_manager->enqueue_style( 'monorepo' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates strings used in the Wincher dashboard widget.
|
||||
*
|
||||
* @return array The translated strings.
|
||||
*/
|
||||
public function localize_wincher_dashboard_script() {
|
||||
|
||||
return [
|
||||
'wincher_is_logged_in' => YoastSEO()->helpers->wincher->login_status(),
|
||||
'wincher_website_id' => WPSEO_Options::get( 'wincher_website_id', '' ),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current screen is the dashboard screen.
|
||||
*
|
||||
* @return bool Whether or not this is the dashboard screen.
|
||||
*/
|
||||
private function is_dashboard_screen() {
|
||||
$current_screen = get_current_screen();
|
||||
|
||||
return ( $current_screen instanceof WP_Screen && $current_screen->id === 'dashboard' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when the Wincher dashboard widget should be shown.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function show_widget() {
|
||||
$analysis_seo = new WPSEO_Metabox_Analysis_SEO();
|
||||
$user_can_edit = $analysis_seo->is_enabled() && current_user_can( 'edit_posts' );
|
||||
$is_wincher_active = YoastSEO()->helpers->wincher->is_active();
|
||||
|
||||
return $user_can_edit && $is_wincher_active;
|
||||
}
|
||||
}
|
||||
@@ -116,8 +116,6 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
|
||||
* @return array The translated strings.
|
||||
*/
|
||||
public function localize_dashboard_script() {
|
||||
$is_wincher_active = YoastSEO()->helpers->wincher->is_active();
|
||||
|
||||
return [
|
||||
'feed_header' => sprintf(
|
||||
/* translators: %1$s resolves to Yoast.com */
|
||||
@@ -127,9 +125,6 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
|
||||
'feed_footer' => __( 'Read more like this on our SEO blog', 'wordpress-seo' ),
|
||||
'wp_version' => substr( $GLOBALS['wp_version'], 0, 3 ) . '-' . ( is_plugin_active( 'classic-editor/classic-editor.php' ) ? '1' : '0' ),
|
||||
'php_version' => PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION,
|
||||
'is_wincher_active' => ( $is_wincher_active ) ? 1 : 0,
|
||||
'wincher_is_logged_in' => ( $is_wincher_active ) ? YoastSEO()->helpers->wincher->login_status() : false,
|
||||
'wincher_website_id' => WPSEO_Options::get( 'wincher_website_id', '' ),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -913,7 +913,6 @@ class Yoast_Form {
|
||||
'<span aria-hidden="true" class="yoast-button--buy__caret"></span></a>';
|
||||
}
|
||||
|
||||
|
||||
echo '<a></a></div></fieldset><div class="clear"></div>' . $upsell_button . '</div>' . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,51 +61,51 @@ class WPSEO_Metabox_Formatter {
|
||||
$host = YoastSEO()->helpers->url->get_url_host( get_site_url() );
|
||||
|
||||
return [
|
||||
'author_name' => get_the_author_meta( 'display_name' ),
|
||||
'site_name' => YoastSEO()->meta->for_current_page()->site_name,
|
||||
'sitewide_social_image' => WPSEO_Options::get( 'og_default_image' ),
|
||||
'search_url' => '',
|
||||
'post_edit_url' => '',
|
||||
'base_url' => '',
|
||||
'contentTab' => __( 'Readability', 'wordpress-seo' ),
|
||||
'keywordTab' => __( 'Keyphrase:', 'wordpress-seo' ),
|
||||
'removeKeyword' => __( 'Remove keyphrase', 'wordpress-seo' ),
|
||||
'contentLocale' => get_locale(),
|
||||
'userLocale' => \get_user_locale(),
|
||||
'translations' => $this->get_translations(),
|
||||
'keyword_usage' => [],
|
||||
'title_template' => '',
|
||||
'metadesc_template' => '',
|
||||
'contentAnalysisActive' => $analysis_readability->is_enabled() ? 1 : 0,
|
||||
'keywordAnalysisActive' => $analysis_seo->is_enabled() ? 1 : 0,
|
||||
'inclusiveLanguageAnalysisActive' => $analysis_inclusive_language->is_enabled() ? 1 : 0,
|
||||
'cornerstoneActive' => WPSEO_Options::get( 'enable_cornerstone_content', false ) ? 1 : 0,
|
||||
'semrushIntegrationActive' => WPSEO_Options::get( 'semrush_integration_active', true ) ? 1 : 0,
|
||||
'intl' => $this->get_content_analysis_component_translations(),
|
||||
'isRtl' => is_rtl(),
|
||||
'isPremium' => YoastSEO()->helpers->product->is_premium(),
|
||||
'wordFormRecognitionActive' => YoastSEO()->helpers->language->is_word_form_recognition_active( WPSEO_Language_Utils::get_language( get_locale() ) ),
|
||||
'siteIconUrl' => get_site_icon_url(),
|
||||
'countryCode' => WPSEO_Options::get( 'semrush_country_code', false ),
|
||||
'SEMrushLoginStatus' => WPSEO_Options::get( 'semrush_integration_active', true ) ? $this->get_semrush_login_status() : false,
|
||||
'showSocial' => [
|
||||
'author_name' => get_the_author_meta( 'display_name' ),
|
||||
'site_name' => YoastSEO()->meta->for_current_page()->site_name,
|
||||
'sitewide_social_image' => WPSEO_Options::get( 'og_default_image' ),
|
||||
'search_url' => '',
|
||||
'post_edit_url' => '',
|
||||
'base_url' => '',
|
||||
'contentTab' => __( 'Readability', 'wordpress-seo' ),
|
||||
'keywordTab' => __( 'Keyphrase:', 'wordpress-seo' ),
|
||||
'removeKeyword' => __( 'Remove keyphrase', 'wordpress-seo' ),
|
||||
'contentLocale' => get_locale(),
|
||||
'userLocale' => \get_user_locale(),
|
||||
'translations' => $this->get_translations(),
|
||||
'keyword_usage' => [],
|
||||
'title_template' => '',
|
||||
'metadesc_template' => '',
|
||||
'contentAnalysisActive' => $analysis_readability->is_enabled() ? 1 : 0,
|
||||
'keywordAnalysisActive' => $analysis_seo->is_enabled() ? 1 : 0,
|
||||
'inclusiveLanguageAnalysisActive' => $analysis_inclusive_language->is_enabled() ? 1 : 0,
|
||||
'cornerstoneActive' => WPSEO_Options::get( 'enable_cornerstone_content', false ) ? 1 : 0,
|
||||
'semrushIntegrationActive' => WPSEO_Options::get( 'semrush_integration_active', true ) ? 1 : 0,
|
||||
'intl' => $this->get_content_analysis_component_translations(),
|
||||
'isRtl' => is_rtl(),
|
||||
'isPremium' => YoastSEO()->helpers->product->is_premium(),
|
||||
'wordFormRecognitionActive' => YoastSEO()->helpers->language->is_word_form_recognition_active( WPSEO_Language_Utils::get_language( get_locale() ) ),
|
||||
'siteIconUrl' => get_site_icon_url(),
|
||||
'countryCode' => WPSEO_Options::get( 'semrush_country_code', false ),
|
||||
'SEMrushLoginStatus' => WPSEO_Options::get( 'semrush_integration_active', true ) ? $this->get_semrush_login_status() : false,
|
||||
'showSocial' => [
|
||||
'facebook' => WPSEO_Options::get( 'opengraph', false ),
|
||||
'twitter' => WPSEO_Options::get( 'twitter', false ),
|
||||
],
|
||||
'schema' => [
|
||||
'schema' => [
|
||||
'displayFooter' => WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ),
|
||||
'pageTypeOptions' => $schema_types->get_page_type_options(),
|
||||
'articleTypeOptions' => $schema_types->get_article_type_options(),
|
||||
],
|
||||
'twitterCardType' => 'summary_large_image',
|
||||
'twitterCardType' => 'summary_large_image',
|
||||
|
||||
/**
|
||||
* Filter to determine if the markers should be enabled or not.
|
||||
*
|
||||
* @param bool $showMarkers Should the markers being enabled. Default = true.
|
||||
*/
|
||||
'show_markers' => apply_filters( 'wpseo_enable_assessment_markers', true ),
|
||||
'publish_box' => [
|
||||
'show_markers' => apply_filters( 'wpseo_enable_assessment_markers', true ),
|
||||
'publish_box' => [
|
||||
'labels' => [
|
||||
'keyword' => [
|
||||
'na' => sprintf(
|
||||
@@ -199,24 +199,27 @@ class WPSEO_Metabox_Formatter {
|
||||
],
|
||||
],
|
||||
],
|
||||
'markdownEnabled' => $this->is_markdown_enabled(),
|
||||
'analysisHeadingTitle' => __( 'Analysis', 'wordpress-seo' ),
|
||||
'zapierIntegrationActive' => WPSEO_Options::get( 'zapier_integration_active', false ) ? 1 : 0,
|
||||
'zapierConnectedStatus' => ! empty( WPSEO_Options::get( 'zapier_subscription', [] ) ) ? 1 : 0,
|
||||
'wincherIntegrationActive' => ( $is_wincher_active ) ? 1 : 0,
|
||||
'wincherLoginStatus' => ( $is_wincher_active ) ? YoastSEO()->helpers->wincher->login_status() : false,
|
||||
'wincherWebsiteId' => WPSEO_Options::get( 'wincher_website_id', '' ),
|
||||
'wincherAutoAddKeyphrases' => WPSEO_Options::get( 'wincher_automatically_add_keyphrases', false ),
|
||||
'wordproofIntegrationActive' => YoastSEO()->helpers->wordproof->is_active() ? 1 : 0,
|
||||
'multilingualPluginActive' => $this->multilingual_plugin_active(),
|
||||
'markdownEnabled' => $this->is_markdown_enabled(),
|
||||
'analysisHeadingTitle' => __( 'Analysis', 'wordpress-seo' ),
|
||||
'zapierIntegrationActive' => WPSEO_Options::get( 'zapier_integration_active', false ) ? 1 : 0,
|
||||
'zapierConnectedStatus' => ! empty( WPSEO_Options::get( 'zapier_subscription', [] ) ) ? 1 : 0,
|
||||
'wincherIntegrationActive' => ( $is_wincher_active ) ? 1 : 0,
|
||||
'wincherLoginStatus' => ( $is_wincher_active ) ? YoastSEO()->helpers->wincher->login_status() : false,
|
||||
'wincherWebsiteId' => WPSEO_Options::get( 'wincher_website_id', '' ),
|
||||
'wincherAutoAddKeyphrases' => WPSEO_Options::get( 'wincher_automatically_add_keyphrases', false ),
|
||||
'wordproofIntegrationActive' => YoastSEO()->helpers->wordproof->is_active() ? 1 : 0,
|
||||
'multilingualPluginActive' => $this->multilingual_plugin_active(),
|
||||
|
||||
/**
|
||||
* Filter to determine whether the PreviouslyUsedKeyword assessment should run.
|
||||
*
|
||||
* @param bool $previouslyUsedKeywordActive Whether the PreviouslyUsedKeyword assessment should run.
|
||||
*/
|
||||
'previouslyUsedKeywordActive' => apply_filters( 'wpseo_previously_used_keyword_active', true ),
|
||||
'getJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-get-prepublish?domain=' . $host ),
|
||||
'upgradeJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-upgrade-prepublish?domain=' . $host ),
|
||||
'previouslyUsedKeywordActive' => apply_filters( 'wpseo_previously_used_keyword_active', true ),
|
||||
'getJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-get-prepublish?domain=' . $host ),
|
||||
'upgradeJetpackBoostPrePublishLink' => WPSEO_Shortlinker::get( 'https://yoa.st/jetpack-boost-upgrade-prepublish?domain=' . $host ),
|
||||
'woocommerceUpsellSchemaLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-schema-metabox' ),
|
||||
'woocommerceUpsellGooglePreviewLink' => WPSEO_Shortlinker::get( 'https://yoa.st/product-google-preview-metabox' ),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class WPSEO_Import_SEOPressor extends WPSEO_Plugin_Importer {
|
||||
protected function import() {
|
||||
// Query for all the posts that have an _seop_settings meta set.
|
||||
$query_posts = new WP_Query( 'post_type=any&meta_key=_seop_settings&order=ASC&fields=ids&nopaging=true' );
|
||||
foreach ( $query_posts->posts as $key => $post_id ) {
|
||||
foreach ( $query_posts->posts as $post_id ) {
|
||||
$this->import_post_focus_keywords( $post_id );
|
||||
$this->import_seopressor_post_settings( $post_id );
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ class WPSEO_Metabox_Analysis_Inclusive_Language implements WPSEO_Metabox_Analysi
|
||||
$is_premium = YoastSEO()->helpers->product->is_premium();
|
||||
$premium_version = YoastSEO()->helpers->product->get_premium_version();
|
||||
|
||||
return ! $is_premium || \version_compare( $premium_version, '19.6-RC0', '>=' ) ||
|
||||
\version_compare( $premium_version, '19.2', '==' );
|
||||
return ! $is_premium
|
||||
|| \version_compare( $premium_version, '19.6-RC0', '>=' )
|
||||
|| \version_compare( $premium_version, '19.2', '==' );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
* @package WPSEO\Admin
|
||||
*/
|
||||
|
||||
use Yoast\WP\SEO\Presenters\Admin\Beta_Badge_Presenter;
|
||||
|
||||
/**
|
||||
* Generates and displays the React root element for a metabox section.
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
|
||||
use Yoast\WP\SEO\Conditionals\Third_Party\Jetpack_Boost_Active_Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\Third_Party\Jetpack_Boost_Not_Premium_Conditional;
|
||||
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
|
||||
use Yoast\WP\SEO\Introductions\Infrastructure\Wistia_Embed_Permission_Repository;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Alert_Presenter;
|
||||
use Yoast\WP\SEO\Presenters\Admin\Meta_Fields_Presenter;
|
||||
|
||||
@@ -863,6 +865,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
$asset_manager->enqueue_style( 'metabox-css' );
|
||||
$asset_manager->enqueue_style( 'scoring' );
|
||||
$asset_manager->enqueue_style( 'monorepo' );
|
||||
$asset_manager->enqueue_style( 'tailwind' );
|
||||
$asset_manager->enqueue_style( 'ai-generator' );
|
||||
|
||||
$is_block_editor = WP_Screen::get()->is_block_editor();
|
||||
$post_edit_handle = 'post-edit';
|
||||
@@ -902,8 +906,13 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
'log_level' => WPSEO_Utils::get_analysis_worker_log_level(),
|
||||
];
|
||||
|
||||
$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();
|
||||
$woocommerce_active = $woocommerce_conditional->is_met();
|
||||
$wpseo_plugin_availability_checker = new WPSEO_Plugin_Availability();
|
||||
$woocommerce_seo_file = 'wpseo-woocommerce/wpseo-woocommerce.php';
|
||||
$woocommerce_seo_active = $wpseo_plugin_availability_checker->is_active( $woocommerce_seo_file );
|
||||
|
||||
$script_data = [
|
||||
// @todo replace this translation with JavaScript translations.
|
||||
@@ -914,15 +923,24 @@ class WPSEO_Metabox extends WPSEO_Meta {
|
||||
'isBlockEditor' => $is_block_editor,
|
||||
'postId' => $post_id,
|
||||
'postStatus' => get_post_status( $post_id ),
|
||||
'postType' => get_post_type( $post_id ),
|
||||
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage-and-post-types' ),
|
||||
'analysis' => [
|
||||
'plugins' => $plugins_script_data,
|
||||
'worker' => $worker_script_data,
|
||||
],
|
||||
'dismissedAlerts' => $dismissed_alerts,
|
||||
'currentPromotions' => YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->get_current_promotions(),
|
||||
'webinarIntroBlockEditorUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-block-editor' ),
|
||||
'blackFridayBlockEditorUrl' => ( YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->is( 'black_friday_2023_checklist' ) ) ? WPSEO_Shortlinker::get( 'https://yoa.st/black-friday-checklist' ) : '',
|
||||
'isJetpackBoostActive' => ( $is_block_editor ) ? YoastSEO()->classes->get( Jetpack_Boost_Active_Conditional::class )->is_met() : false,
|
||||
'isJetpackBoostNotPremium' => ( $is_block_editor ) ? YoastSEO()->classes->get( Jetpack_Boost_Not_Premium_Conditional::class )->is_met() : false,
|
||||
'isWooCommerceActive' => $woocommerce_active,
|
||||
'woocommerceUpsell' => get_post_type( $post_id ) === 'product' && ! $woocommerce_seo_active && $woocommerce_active,
|
||||
'isWooCommerceActive' => $woocommerce_active,
|
||||
'linkParams' => WPSEO_Shortlinker::get_query_params(),
|
||||
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
|
||||
'wistiaEmbedPermission' => YoastSEO()->classes->get( Wistia_Embed_Permission_Repository::class )->get_value_for_user( \get_current_user_id() ),
|
||||
];
|
||||
|
||||
if ( post_type_supports( get_post_type(), 'thumbnail' ) ) {
|
||||
|
||||
@@ -144,6 +144,7 @@ class WPSEO_Taxonomy {
|
||||
|
||||
$asset_manager->enqueue_style( 'metabox-css' );
|
||||
$asset_manager->enqueue_style( 'scoring' );
|
||||
$asset_manager->enqueue_style( 'tailwind' );
|
||||
$asset_manager->enqueue_script( 'term-edit' );
|
||||
|
||||
/**
|
||||
@@ -180,6 +181,7 @@ class WPSEO_Taxonomy {
|
||||
'isTerm' => true,
|
||||
'postId' => $tag_id,
|
||||
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage' ),
|
||||
'linkParams' => WPSEO_Shortlinker::get_query_params(),
|
||||
];
|
||||
$asset_manager->localize_script( 'term-edit', 'wpseoScriptData', $script_data );
|
||||
$asset_manager->enqueue_user_language_script();
|
||||
|
||||
@@ -121,7 +121,6 @@ class WPSEO_Tracking_Addon_Data implements WPSEO_Collection {
|
||||
unset( $addon_settings[ $slug ]['woocommerce_local_pickup_setting'] );
|
||||
}
|
||||
|
||||
|
||||
return $addon_settings;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,13 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
|
||||
'most_linked_ignore_list',
|
||||
'least_linked_ignore_list',
|
||||
'indexables_page_reading_list',
|
||||
'publishing_principles_id',
|
||||
'ownership_funding_info_id',
|
||||
'actionable_feedback_policy_id',
|
||||
'corrections_policy_id',
|
||||
'ethics_policy_id',
|
||||
'diversity_policy_id',
|
||||
'diversity_staffing_report_id',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -185,6 +192,7 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
|
||||
'enable_metabox_insights',
|
||||
'enable_link_suggestions',
|
||||
'enable_index_now',
|
||||
'enable_ai_generator',
|
||||
'workouts',
|
||||
'wincher_integration_active',
|
||||
'wincher_tokens',
|
||||
@@ -222,6 +230,7 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
|
||||
'indexables_overview_state',
|
||||
'deny_search_crawling',
|
||||
'deny_wp_json_crawling',
|
||||
'deny_adsbot_crawling',
|
||||
'last_known_no_unindexed',
|
||||
];
|
||||
|
||||
|
||||
@@ -202,6 +202,17 @@ class Yoast_Feature_Toggles {
|
||||
'premium_upsell_url' => 'https://yoa.st/get-indexnow',
|
||||
'order' => 110,
|
||||
],
|
||||
(object) [
|
||||
'name' => __( 'AI title & description generator', 'wordpress-seo' ),
|
||||
'premium' => true,
|
||||
'setting' => 'enable_ai_generator',
|
||||
'label' => __( 'Use the power of Yoast AI to automatically generate compelling titles and descriptions for your posts and pages.', 'wordpress-seo' ),
|
||||
'read_more_label' => __( 'Learn more', 'wordpress-seo' ),
|
||||
'read_more_url' => 'https://yoa.st/ai-generator-read-more',
|
||||
'premium_url' => 'https://yoa.st/ai-generator-feature',
|
||||
'premium_upsell_url' => 'https://yoa.st/get-ai-generator',
|
||||
'order' => 115,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -150,6 +150,10 @@ $new_tab_message = sprintf(
|
||||
if ( ! $has_valid_premium_subscription ) :
|
||||
?>
|
||||
<ul class="yoast-seo-premium-benefits yoast-list--usp">
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Be more efficient in creating content', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Use AI to create high-quality titles and meta descriptions for posts and pages', 'wordpress-seo' ); ?></span>
|
||||
</li>
|
||||
<li class="yoast-seo-premium-benefits__item">
|
||||
<span class="yoast-seo-premium-benefits__title"><?php esc_html_e( 'Reach bigger audiences', 'wordpress-seo' ); ?></span>
|
||||
<span class="yoast-seo-premium-benefits__description"><?php esc_html_e( 'Optimize a single post for synonyms and related keyphrases and get extra checks with the Premium SEO analysis', 'wordpress-seo' ); ?></span>
|
||||
@@ -185,7 +189,7 @@ $new_tab_message = sprintf(
|
||||
|
||||
<?php
|
||||
if ( $has_valid_premium_subscription ) :
|
||||
$number_plugins_active++;
|
||||
++$number_plugins_active;
|
||||
?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
|
||||
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" class="yoast-link--license">
|
||||
@@ -295,7 +299,7 @@ $new_tab_message = sprintf(
|
||||
|
||||
<?php
|
||||
if ( $addon_manager->has_valid_subscription( $slug ) ) :
|
||||
$number_plugins_active++;
|
||||
++$number_plugins_active;
|
||||
?>
|
||||
<div class="yoast-button yoast-button--noarrow yoast-button--extension yoast-button--extension-activated"><?php esc_html_e( 'Activated', 'wordpress-seo' ); ?></div>
|
||||
<a target="_blank" href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/13k' ); ?>" class="yoast-link--license">
|
||||
|
||||
@@ -39,6 +39,6 @@ $wpseo_contributors_phrase = sprintf(
|
||||
<div class="tab-block">
|
||||
<h2><?php esc_html_e( 'Credits', 'wordpress-seo' ); ?></h2>
|
||||
<p>
|
||||
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/yoast-seo-credits' ); ?>"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
|
||||
<a href="<?php WPSEO_Shortlinker::show( 'https://yoa.st/yoast-seo-credits' ); ?>" target="_blank"><?php echo esc_html( $wpseo_contributors_phrase ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -50,7 +50,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an message when a post is about to get trashed.
|
||||
* Shows a message when a post is about to get trashed.
|
||||
*
|
||||
* @param int $post_id The current post ID.
|
||||
*
|
||||
@@ -61,15 +61,17 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
return;
|
||||
}
|
||||
|
||||
$post_label = $this->get_post_type_label( get_post_type( $post_id ) );
|
||||
|
||||
/* translators: %1$s expands to the translated name of the post type. */
|
||||
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
|
||||
$message = $this->get_message( $first_sentence );
|
||||
$first_sentence = sprintf( __( 'You just trashed a %1$s.', 'wordpress-seo' ), $post_label );
|
||||
$message = $this->get_message( $first_sentence, 'trashed', $post_label );
|
||||
|
||||
$this->add_notification( $message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an message when a post is about to get trashed.
|
||||
* Shows a message when a post is about to get trashed.
|
||||
*
|
||||
* @param int $post_id The current post ID.
|
||||
*
|
||||
@@ -80,9 +82,11 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
return;
|
||||
}
|
||||
|
||||
$post_label = $this->get_post_type_label( get_post_type( $post_id ) );
|
||||
|
||||
/* translators: %1$s expands to the translated name of the post type. */
|
||||
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $this->get_post_type_label( get_post_type( $post_id ) ) );
|
||||
$message = $this->get_message( $first_sentence );
|
||||
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $post_label );
|
||||
$message = $this->get_message( $first_sentence, 'deleted', $post_label );
|
||||
|
||||
$this->add_notification( $message );
|
||||
}
|
||||
@@ -90,22 +94,21 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
/**
|
||||
* Shows a message when a term is about to get deleted.
|
||||
*
|
||||
* @param int $term_id The term ID that will be deleted.
|
||||
* @param int $term_taxonomy_id The term taxonomy ID that will be deleted.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function detect_term_delete( $term_id ) {
|
||||
if ( ! $this->is_term_viewable( $term_id ) ) {
|
||||
public function detect_term_delete( $term_taxonomy_id ) {
|
||||
if ( ! $this->is_term_viewable( $term_taxonomy_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$first_sentence = sprintf(
|
||||
/* translators: 1: term label */
|
||||
__( 'You just deleted a %1$s.', 'wordpress-seo' ),
|
||||
$this->get_taxonomy_label_for_term( $term_id )
|
||||
);
|
||||
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
|
||||
$term_label = $this->get_taxonomy_label_for_term( $term->term_id );
|
||||
|
||||
$message = $this->get_message( $first_sentence );
|
||||
/* translators: %1$s expands to the translated name of the term. */
|
||||
$first_sentence = sprintf( __( 'You just deleted a %1$s.', 'wordpress-seo' ), $term_label );
|
||||
$message = $this->get_message( $first_sentence, 'deleted', $term_label );
|
||||
|
||||
$this->add_notification( $message );
|
||||
}
|
||||
@@ -134,12 +137,12 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
/**
|
||||
* Checks if the term is viewable.
|
||||
*
|
||||
* @param string $term_id The term ID to check.
|
||||
* @param int $term_taxonomy_id The term taxonomy ID to check.
|
||||
*
|
||||
* @return bool Whether the term is viewable or not.
|
||||
*/
|
||||
protected function is_term_viewable( $term_id ) {
|
||||
$term = get_term( $term_id );
|
||||
protected function is_term_viewable( $term_taxonomy_id ) {
|
||||
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
|
||||
|
||||
if ( ! $term || is_wp_error( $term ) ) {
|
||||
return false;
|
||||
@@ -206,14 +209,17 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
|
||||
* Returns the message around changed URLs.
|
||||
*
|
||||
* @param string $first_sentence The first sentence of the notification.
|
||||
* @param string $action The action performed, either "deleted" or "trashed".
|
||||
* @param string $object_label The label of the object that was deleted or trashed.
|
||||
*
|
||||
* @return string The full notification.
|
||||
*/
|
||||
protected function get_message( $first_sentence ) {
|
||||
protected function get_message( $first_sentence, $action, $object_label ) {
|
||||
return '<h2>' . __( 'Make sure you don\'t miss out on traffic!', 'wordpress-seo' ) . '</h2>'
|
||||
. '<p>'
|
||||
. $first_sentence
|
||||
. ' ' . __( 'Search engines and other websites can still send traffic to your deleted post.', 'wordpress-seo' )
|
||||
/* translators: %1$s expands to either "deleted" or "trashed". %2$s expands to the name of the post or term. */
|
||||
. ' ' . sprintf( __( 'Search engines and other websites can still send traffic to your %1$s %2$s.', 'wordpress-seo' ), $action, $object_label )
|
||||
. ' ' . __( 'You should create a redirect to ensure your visitors do not get a 404 error when they click on the no longer working URL.', 'wordpress-seo' )
|
||||
/* translators: %s expands to Yoast SEO Premium */
|
||||
. ' ' . sprintf( __( 'With %s, you can easily create such redirects.', 'wordpress-seo' ), 'Yoast SEO Premium' )
|
||||
|
||||
Reference in New Issue
Block a user