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:
Tony Volpe
2024-01-25 04:11:47 +00:00
parent 6b67473553
commit 68dbe860e9
540 changed files with 3445 additions and 2131 deletions

View File

@@ -28,6 +28,8 @@ class WPSEO_Admin_Settings_Changed_Listener implements WPSEO_WordPress_Integrati
/**
* Checks and overwrites the wp_settings_errors global to determine whether the Yoast SEO settings have been saved.
*
* @return void
*/
public function intercept_save_update_notification() {
global $pagenow;
@@ -74,6 +76,8 @@ class WPSEO_Admin_Settings_Changed_Listener implements WPSEO_WordPress_Integrati
/**
* Renders a success message if the Yoast SEO settings have been saved.
*
* @return void
*/
public function show_success_message() {
if ( $this->have_settings_been_saved() ) {

View File

@@ -15,6 +15,8 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
* Convenience function to JSON encode and echo results and then die.
*
* @param array $results Results array for encoding.
*
* @return void
*/
function wpseo_ajax_json_echo_die( $results ) {
// phpcs:ignore WordPress.Security.EscapeOutput -- Reason: WPSEO_Utils::format_json_encode is safe.
@@ -24,6 +26,8 @@ function wpseo_ajax_json_echo_die( $results ) {
/**
* Function used from AJAX calls, takes it variables from $_POST, dies on exit.
*
* @return void
*/
function wpseo_set_option() {
if ( ! current_user_can( 'manage_options' ) ) {
@@ -54,6 +58,8 @@ add_action( 'wp_ajax_yoast_dismiss_notification', [ 'Yoast_Notification_Center',
/**
* Function used to remove the admin notices for several purposes, dies on exit.
*
* @return void
*/
function wpseo_set_ignore() {
if ( ! current_user_can( 'manage_options' ) ) {
@@ -76,6 +82,8 @@ add_action( 'wp_ajax_wpseo_set_ignore', 'wpseo_set_ignore' );
/**
* Save an individual SEO title from the Bulk Editor.
*
* @return void
*/
function wpseo_save_title() {
wpseo_save_what( 'title' );
@@ -85,6 +93,8 @@ add_action( 'wp_ajax_wpseo_save_title', 'wpseo_save_title' );
/**
* Save an individual meta description from the Bulk Editor.
*
* @return void
*/
function wpseo_save_description() {
wpseo_save_what( 'metadesc' );
@@ -96,6 +106,8 @@ add_action( 'wp_ajax_wpseo_save_metadesc', 'wpseo_save_description' );
* Save titles & descriptions.
*
* @param string $what Type of item to save (title, description).
*
* @return void
*/
function wpseo_save_what( $what ) {
check_ajax_referer( 'wpseo-bulk-editor' );
@@ -206,6 +218,8 @@ function wpseo_upsert_meta( $post_id, $new_meta_value, $orig_meta_value, $meta_k
/**
* Save all titles sent from the Bulk Editor.
*
* @return void
*/
function wpseo_save_all_titles() {
wpseo_save_all( 'title' );
@@ -215,6 +229,8 @@ add_action( 'wp_ajax_wpseo_save_all_titles', 'wpseo_save_all_titles' );
/**
* Save all description sent from the Bulk Editor.
*
* @return void
*/
function wpseo_save_all_descriptions() {
wpseo_save_all( 'metadesc' );
@@ -226,6 +242,8 @@ add_action( 'wp_ajax_wpseo_save_all_descriptions', 'wpseo_save_all_descriptions'
* Utility function to save values.
*
* @param string $what Type of item so save.
*
* @return void
*/
function wpseo_save_all( $what ) {
check_ajax_referer( 'wpseo-bulk-editor' );
@@ -264,6 +282,8 @@ function wpseo_upsert_new( $what, $post_id, $new_value, $original ) {
/**
* Retrieves the post ids where the keyword is used before as well as the types of those posts.
*
* @return void
*/
function ajax_get_keyword_usage_and_post_types() {
check_ajax_referer( 'wpseo-keyword-usage-and-post-types', 'nonce' );
@@ -306,6 +326,8 @@ add_action( 'wp_ajax_get_focus_keyword_usage_and_post_types', 'ajax_get_keyword_
/**
* Retrieves the keyword for the keyword doubles of the termpages.
*
* @return void
*/
function ajax_get_term_keyword_usage() {
check_ajax_referer( 'wpseo-keyword-usage', 'nonce' );
@@ -370,6 +392,8 @@ new WPSEO_Taxonomy_Columns();
/**
* Retrieves the keyword for the keyword doubles.
*
* @return void
*/
function ajax_get_keyword_usage() {
_deprecated_function( __METHOD__, 'WPSEO 20.4' );

View File

@@ -21,6 +21,8 @@ class WPSEO_Shortcode_Filter {
/**
* Parse the shortcodes.
*
* @return void
*/
public function do_filter() {
check_ajax_referer( 'wpseo-filter-shortcodes', 'nonce' );

View File

@@ -16,21 +16,21 @@ class Yoast_Dismissable_Notice_Ajax {
*
* @var string
*/
const FOR_USER = 'user_meta';
public const FOR_USER = 'user_meta';
/**
* Notice type toggle value for network notices.
*
* @var string
*/
const FOR_NETWORK = 'site_option';
public const FOR_NETWORK = 'site_option';
/**
* Notice type toggle value for site notices.
*
* @var string
*/
const FOR_SITE = 'option';
public const FOR_SITE = 'option';
/**
* Name of the notice that will be dismissed.
@@ -61,6 +61,8 @@ class Yoast_Dismissable_Notice_Ajax {
/**
* Handles the dismiss notice request.
*
* @return void
*/
public function dismiss_notice() {
check_ajax_referer( 'wpseo-dismiss-' . $this->notice_name );
@@ -72,6 +74,8 @@ class Yoast_Dismissable_Notice_Ajax {
/**
* Storing the dismissed value in the database. The target location is based on the set notification type.
*
* @return void
*/
private function save_dismissed() {
if ( $this->notice_type === self::FOR_SITE ) {

View File

@@ -33,6 +33,8 @@ class Yoast_Plugin_Conflict_Ajax {
/**
* Handles the dismiss notice request.
*
* @return void
*/
public function dismiss_notice() {
check_ajax_referer( 'dismiss-plugin-conflict' );
@@ -89,6 +91,8 @@ class Yoast_Plugin_Conflict_Ajax {
* Storing the conflicting plugins as an user option in the database.
*
* @param string $plugin_section Plugin conflict type (such as Open Graph or sitemap).
*
* @return void
*/
private function save_dismissed_conflicts( $plugin_section ) {
$dismissed_conflicts = $this->get_dismissed_option();
@@ -102,6 +106,8 @@ class Yoast_Plugin_Conflict_Ajax {
* Loop through the plugins to compare them with the already stored dismissed plugin conflicts.
*
* @param array $posted_plugins Plugin set to check.
*
* @return void
*/
public function compare_plugins( array $posted_plugins ) {
foreach ( $posted_plugins as $posted_plugin ) {
@@ -113,6 +119,8 @@ class Yoast_Plugin_Conflict_Ajax {
* Check if plugin is already dismissed, if not store it in the array that will be saved later.
*
* @param string $posted_plugin Plugin to check against dismissed conflicts.
*
* @return void
*/
private function compare_plugin( $posted_plugin ) {
if ( ! in_array( $posted_plugin, $this->dismissed_conflicts, true ) ) {

View File

@@ -23,6 +23,8 @@ abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Man
* @param string $capability Capability to register.
* @param array $roles Roles to add the capability to.
* @param bool $overwrite Optional. Use add or overwrite as registration method.
*
* @return void
*/
public function register( $capability, array $roles, $overwrite = false ) {
if ( $overwrite || ! isset( $this->capabilities[ $capability ] ) ) {
@@ -75,7 +77,7 @@ abstract class WPSEO_Abstract_Capability_Manager implements WPSEO_Capability_Man
/**
* Filter: Allow changing roles that a capability is added to.
*
* @api array $roles The default roles to be filtered.
* @param array $roles The default roles to be filtered.
*/
$filtered = apply_filters( $capability . '_roles', $roles );

View File

@@ -61,6 +61,8 @@ class WPSEO_Capability_Manager_Integration implements WPSEO_WordPress_Integratio
* Add capabilities to its own group in the Members plugin.
*
* @see members_register_cap_group()
*
* @return void
*/
public function action_members_register_cap_group() {
if ( ! function_exists( 'members_register_cap_group' ) ) {

View File

@@ -15,7 +15,7 @@ final class WPSEO_Admin_Asset_Dev_Server_Location implements WPSEO_Admin_Asset_L
*
* @var string
*/
const DEFAULT_URL = 'http://localhost:8080';
public const DEFAULT_URL = 'http://localhost:8080';
/**
* Holds the url where the server is located.

View File

@@ -18,7 +18,7 @@ class WPSEO_Admin_Asset_Manager {
*
* @var string
*/
const PREFIX = 'yoast-seo-';
public const PREFIX = 'yoast-seo-';
/**
* Class that manages the assets' location.
@@ -40,7 +40,7 @@ class WPSEO_Admin_Asset_Manager {
* @param WPSEO_Admin_Asset_Location|null $asset_location The provider of the asset location.
* @param string $prefix The prefix for naming assets.
*/
public function __construct( WPSEO_Admin_Asset_Location $asset_location = null, $prefix = self::PREFIX ) {
public function __construct( ?WPSEO_Admin_Asset_Location $asset_location = null, $prefix = self::PREFIX ) {
if ( $asset_location === null ) {
$asset_location = self::create_default_location();
}
@@ -53,6 +53,8 @@ class WPSEO_Admin_Asset_Manager {
* Enqueues scripts.
*
* @param string $script The name of the script to enqueue.
*
* @return void
*/
public function enqueue_script( $script ) {
wp_enqueue_script( $this->prefix . $script );
@@ -62,6 +64,8 @@ class WPSEO_Admin_Asset_Manager {
* Enqueues styles.
*
* @param string $style The name of the style to enqueue.
*
* @return void
*/
public function enqueue_style( $style ) {
wp_enqueue_style( $this->prefix . $style );
@@ -69,6 +73,8 @@ class WPSEO_Admin_Asset_Manager {
/**
* Enqueues the appropriate language for the user.
*
* @return void
*/
public function enqueue_user_language_script() {
$this->enqueue_script( 'language-' . YoastSEO()->helpers->language->get_researcher_language() );
@@ -78,6 +84,8 @@ class WPSEO_Admin_Asset_Manager {
* Registers scripts based on it's parameters.
*
* @param WPSEO_Admin_Asset $script The script to register.
*
* @return void
*/
public function register_script( WPSEO_Admin_Asset $script ) {
$url = $script->get_src() ? $this->get_url( $script, WPSEO_Admin_Asset::TYPE_JS ) : false;
@@ -99,6 +107,8 @@ class WPSEO_Admin_Asset_Manager {
* Registers styles based on it's parameters.
*
* @param WPSEO_Admin_Asset $style The style to register.
*
* @return void
*/
public function register_style( WPSEO_Admin_Asset $style ) {
wp_register_style(
@@ -112,6 +122,8 @@ class WPSEO_Admin_Asset_Manager {
/**
* Calls the functions that register scripts and styles with the scripts and styles to be registered as arguments.
*
* @return void
*/
public function register_assets() {
$this->register_scripts( $this->scripts_to_be_registered() );
@@ -122,6 +134,8 @@ class WPSEO_Admin_Asset_Manager {
* Registers all the scripts passed to it.
*
* @param array $scripts The scripts passed to it.
*
* @return void
*/
public function register_scripts( $scripts ) {
foreach ( $scripts as $script ) {
@@ -134,6 +148,8 @@ class WPSEO_Admin_Asset_Manager {
* Registers all the styles it receives.
*
* @param array $styles Styles that need to be registered.
*
* @return void
*/
public function register_styles( $styles ) {
foreach ( $styles as $style ) {
@@ -148,9 +164,11 @@ class WPSEO_Admin_Asset_Manager {
* @param string $handle The script handle.
* @param string $object_name The object name.
* @param array $data The l10n data.
*
* @return void
*/
public function localize_script( $handle, $object_name, $data ) {
\wp_localize_script( $this->prefix . $handle, $object_name, $data );
wp_localize_script( $this->prefix . $handle, $object_name, $data );
}
/**
@@ -159,9 +177,11 @@ class WPSEO_Admin_Asset_Manager {
* @param string $handle The script handle.
* @param string $data The l10n data.
* @param string $position Optional. Whether to add the inline script before the handle or after.
*
* @return void
*/
public function add_inline_script( $handle, $data, $position = 'after' ) {
\wp_add_inline_script( $this->prefix . $handle, $data, $position );
wp_add_inline_script( $this->prefix . $handle, $data, $position );
}
/**
@@ -219,7 +239,7 @@ class WPSEO_Admin_Asset_Manager {
* @return bool True when the script is enqueued.
*/
public function is_script_enqueued( $script ) {
return \wp_script_is( $this->prefix . $script );
return wp_script_is( $this->prefix . $script );
}
/**
@@ -351,7 +371,7 @@ class WPSEO_Admin_Asset_Manager {
'name' => 'post-edit-classic',
'src' => $scripts['post-edit']['src'],
'deps' => array_map(
static function( $dep ) {
static function ( $dep ) {
if ( $dep === self::PREFIX . 'block-editor' ) {
return self::PREFIX . 'classic-editor';
}

View File

@@ -59,7 +59,7 @@ class WPSEO_Admin_Editor_Specific_Replace_Vars {
/**
* Filter: Adds the possibility to add extra editor specific replacement variables.
*
* @api array $replacement_variables Array of editor specific replace vars.
* @param array $replacement_variables Array of editor specific replace vars.
*/
$replacement_variables = apply_filters(
'wpseo_editor_specific_replace_vars',

View File

@@ -58,7 +58,7 @@ class WPSEO_Admin_Gutenberg_Compatibility_Notification implements WPSEO_WordPres
* Filter: 'yoast_display_gutenberg_compat_notification' - Allows developer to disable the Gutenberg compatibility
* notification.
*
* @api bool
* @param bool $display_notification
*/
$display_notification = apply_filters( 'yoast_display_gutenberg_compat_notification', true );

View File

@@ -53,6 +53,8 @@ class WPSEO_Admin_Init {
/**
* Enqueue our styling for dismissible yoast notifications.
*
* @return void
*/
public function enqueue_dismissible() {
$this->asset_manager->enqueue_style( 'dismissible' );
@@ -132,7 +134,7 @@ class WPSEO_Admin_Init {
* the WPSEO metaboxes are only registered on the typical pages (lean loading) or always
* registered when in admin.
*
* @api bool Whether to always register the metaboxes or not. Defaults to false.
* @param bool $register_metaboxes Whether to always register the metaboxes or not. Defaults to false.
*/
if ( apply_filters( 'wpseo_always_register_metaboxes_on_admin', false ) ) {
return true;
@@ -153,6 +155,8 @@ class WPSEO_Admin_Init {
/**
* Determine whether we should load the meta box class and if so, load it.
*
* @return void
*/
private function load_meta_boxes() {
if ( $this->should_load_meta_boxes() ) {
@@ -163,6 +167,8 @@ class WPSEO_Admin_Init {
/**
* Determine if we should load our taxonomy edit class and if so, load it.
*
* @return void
*/
private function load_taxonomy_class() {
if (
@@ -177,6 +183,8 @@ class WPSEO_Admin_Init {
* Determine if we should load our admin pages class and if so, load it.
*
* Loads admin page class for all admin pages starting with `wpseo_`.
*
* @return void
*/
private function load_admin_user_class() {
if ( in_array( $this->pagenow, [ 'user-edit.php', 'profile.php' ], true )
@@ -190,6 +198,8 @@ class WPSEO_Admin_Init {
* Determine if we should load our admin pages class and if so, load it.
*
* Loads admin page class for all admin pages starting with `wpseo_`.
*
* @return void
*/
private function load_admin_page_class() {
@@ -214,6 +224,8 @@ class WPSEO_Admin_Init {
/**
* Loads the plugin suggestions.
*
* @return void
*/
private function load_plugin_suggestions() {
$suggestions = new WPSEO_Suggested_Plugins( new WPSEO_Plugin_Availability(), Yoast_Notification_Center::get() );
@@ -234,6 +246,8 @@ class WPSEO_Admin_Init {
/**
* See if we should start our XML Sitemaps Admin class.
*
* @return void
*/
private function load_xml_sitemaps_admin() {
if ( WPSEO_Options::get( 'enable_xml_sitemap', false ) ) {
@@ -243,6 +257,8 @@ class WPSEO_Admin_Init {
/**
* Shows deprecation warnings to the user if a plugin has registered a filter we have deprecated.
*
* @return void
*/
public function show_hook_deprecation_warnings() {
global $wp_filter;
@@ -317,6 +333,8 @@ class WPSEO_Admin_Init {
/**
* Shows a notice on the permalink settings page.
*
* @return void
*/
public function permalink_settings_notice() {
global $pagenow;
@@ -341,7 +359,7 @@ class WPSEO_Admin_Init {
/**
* Adds a custom Yoast section within the Classic Editor publish box.
*
* @param \WP_Post $post The current post object.
* @param WP_Post $post The current post object.
*
* @return void
*/
@@ -353,7 +371,7 @@ class WPSEO_Admin_Init {
/**
* Fires after the post time/date setting in the Publish meta box.
*
* @api \WP_Post The current post object.
* @param WP_Post $post The current post object.
*/
do_action( 'wpseo_publishbox_misc_actions', $post );
}

View File

@@ -149,7 +149,7 @@ class WPSEO_Admin_Recommended_Replace_Vars {
/**
* Filter: Adds the possibility to add extra recommended replacement variables.
*
* @api array $additional_replace_vars Empty array to add the replacevars to.
* @param array $additional_replace_vars Empty array to add the replacevars to.
*/
$recommended_replace_vars = apply_filters( 'wpseo_recommended_replace_vars', $this->recommended_replace_vars );

View File

@@ -31,6 +31,8 @@ class WPSEO_Admin_User_Profile {
* @param int $meta_id The ID of the meta option changed.
* @param int $object_id The ID of the user.
* @param string $meta_key The key of the meta field changed.
*
* @return void
*/
public function clear_author_sitemap_cache( $meta_id, $object_id, $meta_key ) {
if ( $meta_key === '_yoast_wpseo_profile_updated' ) {
@@ -42,6 +44,8 @@ class WPSEO_Admin_User_Profile {
* Updates the user metas that (might) have been set on the user profile page.
*
* @param int $user_id User ID of the updated user.
*
* @return void
*/
public function process_user_option_update( $user_id ) {
update_user_meta( $user_id, '_yoast_wpseo_profile_updated', time() );
@@ -69,6 +73,8 @@ class WPSEO_Admin_User_Profile {
* Add the inputs needed for SEO values to the User Profile page.
*
* @param WP_User $user User instance to output for.
*
* @return void
*/
public function user_profile( $user ) {
wp_nonce_field( 'wpseo_user_profile_update', 'wpseo_nonce' );

View File

@@ -19,7 +19,7 @@ class WPSEO_Admin {
*
* @var string
*/
const PAGE_IDENTIFIER = 'wpseo_dashboard';
public const PAGE_IDENTIFIER = 'wpseo_dashboard';
/**
* Array of classes that add admin functionality.
@@ -117,6 +117,8 @@ class WPSEO_Admin {
/**
* Schedules a rewrite flush to happen at shutdown.
*
* @return void
*/
public function schedule_rewrite_flush() {
// Bail if this is a multisite installation and the site has been switched.
@@ -138,6 +140,8 @@ class WPSEO_Admin {
/**
* Register assets needed on admin pages.
*
* @return void
*/
public function enqueue_assets() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form data.
@@ -157,13 +161,15 @@ class WPSEO_Admin {
/**
* Filter: 'wpseo_manage_options_capability' - Allow changing the capability users need to view the settings pages.
*
* @api string unsigned The capability.
* @param string $capability The capability.
*/
return apply_filters( 'wpseo_manage_options_capability', 'wpseo_manage_options' );
}
/**
* Maps the manage_options cap on saving an options page to wpseo_manage_options.
*
* @return void
*/
public function map_manage_options_cap() {
// phpcs:ignore WordPress.Security -- The variable is only used in strpos and thus safe to not unslash or sanitize.
@@ -177,6 +183,8 @@ class WPSEO_Admin {
/**
* Adds the ability to choose how many posts are displayed per page
* on the bulk edit pages.
*
* @return void
*/
public function bulk_edit_options() {
$option = 'per_page';
@@ -214,7 +222,7 @@ class WPSEO_Admin {
* @return array
*/
public function add_action_link( $links, $file ) {
$first_time_configuration_notice_helper = \YoastSEO()->helpers->first_time_configuration_notice;
$first_time_configuration_notice_helper = YoastSEO()->helpers->first_time_configuration_notice;
if ( $file === WPSEO_BASENAME && WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
if ( is_network_admin() ) {
@@ -272,6 +280,8 @@ class WPSEO_Admin {
/**
* Enqueues the (tiny) global JS needed for the plugin.
*
* @return void
*/
public function config_page_scripts() {
$asset_manager = new WPSEO_Admin_Asset_Manager();
@@ -281,6 +291,8 @@ class WPSEO_Admin {
/**
* Enqueues the (tiny) global stylesheet needed for the plugin.
*
* @return void
*/
public function enqueue_global_style() {
$asset_manager = new WPSEO_Admin_Asset_Manager();
@@ -313,6 +325,8 @@ class WPSEO_Admin {
/**
* Log the updated timestamp for user profiles when theme is changed.
*
* @return void
*/
public function switch_theme() {
@@ -351,6 +365,8 @@ class WPSEO_Admin {
/**
* Sets the upsell notice.
*
* @return void
*/
protected function set_upsell_notice() {
$upsell = new WPSEO_Product_Upsell_Notice();

View File

@@ -15,42 +15,42 @@ class WPSEO_Admin_Asset {
*
* @var string
*/
const TYPE_JS = 'js';
public const TYPE_JS = 'js';
/**
* Constant used to identify file type as a CSS file.
*
* @var string
*/
const TYPE_CSS = 'css';
public const TYPE_CSS = 'css';
/**
* The name option identifier.
*
* @var string
*/
const NAME = 'name';
public const NAME = 'name';
/**
* The source option identifier.
*
* @var string
*/
const SRC = 'src';
public const SRC = 'src';
/**
* The dependencies option identifier.
*
* @var string
*/
const DEPS = 'deps';
public const DEPS = 'deps';
/**
* The version option identifier.
*
* @var string
*/
const VERSION = 'version';
public const VERSION = 'version';
/* Style specific. */
@@ -59,14 +59,14 @@ class WPSEO_Admin_Asset {
*
* @var string
*/
const MEDIA = 'media';
public const MEDIA = 'media';
/**
* The rtl option identifier.
*
* @var string
*/
const RTL = 'rtl';
public const RTL = 'rtl';
/* Script specific. */
@@ -75,7 +75,7 @@ class WPSEO_Admin_Asset {
*
* @var string
*/
const IN_FOOTER = 'in_footer';
public const IN_FOOTER = 'in_footer';
/**
* Asset identifier.

View File

@@ -110,6 +110,15 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
*/
protected $input_fields = [];
/**
* The field in the database where meta field is saved.
*
* Should be set in the child class.
*
* @var string
*/
protected $target_db_field = '';
/**
* Class constructor.
*
@@ -147,6 +156,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
/**
* Prepares the data and renders the page.
*
* @return void
*/
public function show_page() {
$this->prepare_page_navigation();
@@ -158,6 +169,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
/**
* Used in the constructor to build a reference list of post types the current user can edit.
*
* @return void
*/
protected function populate_editable_post_types() {
$post_types = get_post_types(
@@ -191,6 +204,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
* Will show the navigation for the table like page navigation and page filter.
*
* @param string $which Table nav location (such as top).
*
* @return void
*/
public function display_tablenav( $which ) {
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
@@ -279,9 +294,9 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
$total_posts = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(ID) FROM {$subquery}
WHERE post_status IN (" .
implode( ', ', array_fill( 0, count( $states ), '%s' ) ) .
')',
WHERE post_status IN ("
. implode( ', ', array_fill( 0, count( $states ), '%s' ) )
. ')',
$states
)
);
@@ -352,6 +367,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
* Outputs extra table navigation.
*
* @param string $which Table nav location (such as top).
*
* @return void
*/
public function extra_tablenav( $which ) {
@@ -381,9 +398,9 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
$post_types = $wpdb->get_results(
$wpdb->prepare(
"SELECT DISTINCT post_type FROM {$subquery}
WHERE post_status IN (" .
implode( ', ', array_fill( 0, count( $states ), '%s' ) ) .
') ORDER BY post_type ASC',
WHERE post_status IN ("
. implode( ', ', array_fill( 0, count( $states ), '%s' ) )
. ') ORDER BY post_type ASC',
$states
)
);
@@ -441,6 +458,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
/**
* Sets the correct pagenumber and pageurl for the navigation.
*
* @return void
*/
public function prepare_page_navigation() {
@@ -485,6 +504,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
/**
* Preparing the requested pagerows and setting the needed variables.
*
* @return void
*/
public function prepare_items() {
@@ -518,6 +539,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
/**
* Setting the column headers.
*
* @return void
*/
protected function set_column_headers() {
$columns = $this->get_columns();
@@ -570,6 +593,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
* Total items is the number of all visible items.
*
* @param int $total_items Total items counts.
*
* @return void
*/
protected function set_pagination( $total_items ) {
// Calculate items per page.
@@ -679,6 +704,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
* Getting all the items.
*
* @param string $query SQL query to use.
*
* @return void
*/
protected function get_items( $query ) {
global $wpdb;
@@ -722,6 +749,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
/**
* Based on $this->items and the defined columns, the table rows will be displayed.
*
* @return void
*/
public function display_rows() {
@@ -931,6 +960,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
*
* This method will loop through the current items ($this->items) for getting the post_id. With this data
* ($needed_ids) the method will query the meta-data table for getting the title.
*
* @return void
*/
protected function get_meta_data() {
@@ -982,6 +1013,8 @@ class WPSEO_Bulk_List_Table extends WP_List_Table {
* Setting $this->meta_data.
*
* @param array $meta_data Meta data set.
*
* @return void
*/
protected function parse_meta_data( $meta_data ) {

View File

@@ -21,6 +21,8 @@ class WPSEO_Collector {
* Adds a collection object to the collections.
*
* @param WPSEO_Collection $collection The collection object to add.
*
* @return void
*/
public function add_collection( WPSEO_Collection $collection ) {
$this->collections[] = $collection;

View File

@@ -5,10 +5,12 @@
* @package WPSEO\Admin
*/
use Yoast\WP\SEO\Actions\Alert_Dismissal_Action;
use Yoast\WP\SEO\Conditionals\WooCommerce_Conditional;
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;
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* Class WPSEO_Admin_Pages.
@@ -42,11 +44,13 @@ class WPSEO_Admin_Pages {
/**
* Make sure the needed scripts are loaded for admin pages.
*
* @return void
*/
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 ( \in_array( $page, [ Settings_Integration::PAGE, Academy_Integration::PAGE, Support_Integration::PAGE ], true ) ) {
if ( in_array( $page, [ Settings_Integration::PAGE, Academy_Integration::PAGE, Support_Integration::PAGE ], true ) ) {
// Bail, this is managed in the applicable integration.
return;
}
@@ -57,6 +61,8 @@ class WPSEO_Admin_Pages {
/**
* Loads the required styles for the config page.
*
* @return void
*/
public function config_page_styles() {
wp_enqueue_style( 'dashboard' );
@@ -75,27 +81,29 @@ class WPSEO_Admin_Pages {
/**
* Loads the required scripts for the config page.
*
* @return void
*/
public function config_page_scripts() {
$this->asset_manager->enqueue_script( 'settings' );
wp_enqueue_script( 'dashboard' );
wp_enqueue_script( 'thickbox' );
$alert_dismissal_action = YoastSEO()->classes->get( \Yoast\WP\SEO\Actions\Alert_Dismissal_Action::class );
$alert_dismissal_action = YoastSEO()->classes->get( 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() ),
'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(),
'currentPromotions' => YoastSEO()->classes->get( Yoast\WP\SEO\Promotions\Application\Promotion_Manager::class )->get_current_promotions(),
'currentPromotions' => YoastSEO()->classes->get( Promotion_Manager::class )->get_current_promotions(),
'webinarIntroSettingsUrl' => WPSEO_Shortlinker::get( 'https://yoa.st/webinar-intro-settings' ),
'webinarIntroFirstTimeConfigUrl' => $this->get_webinar_shortlink(),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
'pluginUrl' => \plugins_url( '', \WPSEO_FILE ),
'pluginUrl' => plugins_url( '', WPSEO_FILE ),
];
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
@@ -145,6 +153,8 @@ class WPSEO_Admin_Pages {
/**
* Enqueues and handles all the tool dependencies.
*
* @return void
*/
private function enqueue_tools_scripts() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.

View File

@@ -59,6 +59,8 @@ class WPSEO_Customizer {
* Function to support WordPress Customizer.
*
* @param WP_Customize_Manager $wp_customize Manager class instance.
*
* @return void
*/
public function wpseo_customize_register( $wp_customize ) {
if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
@@ -79,6 +81,8 @@ class WPSEO_Customizer {
/**
* Add the breadcrumbs section to the customizer.
*
* @return void
*/
private function breadcrumbs_section() {
$section_args = [
@@ -102,6 +106,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumbs show blog checkbox.
*
* @return void
*/
private function breadcrumbs_blog_show_setting() {
$index = 'breadcrumbs-display-blog-page';
@@ -125,6 +131,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumbs separator text field.
*
* @return void
*/
private function breadcrumbs_separator_setting() {
$index = 'breadcrumbs-sep';
@@ -138,6 +146,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumbs home anchor text field.
*
* @return void
*/
private function breadcrumbs_home_setting() {
$index = 'breadcrumbs-home';
@@ -150,6 +160,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumbs prefix text field.
*
* @return void
*/
private function breadcrumbs_prefix_setting() {
$index = 'breadcrumbs-prefix';
@@ -162,6 +174,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumbs archive prefix text field.
*
* @return void
*/
private function breadcrumbs_archiveprefix_setting() {
$index = 'breadcrumbs-archiveprefix';
@@ -174,6 +188,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumbs search prefix text field.
*
* @return void
*/
private function breadcrumbs_searchprefix_setting() {
$index = 'breadcrumbs-searchprefix';
@@ -186,6 +202,8 @@ class WPSEO_Customizer {
/**
* Adds the breadcrumb 404 prefix text field.
*
* @return void
*/
private function breadcrumbs_404_setting() {
$index = 'breadcrumbs-404crumb';
@@ -206,6 +224,8 @@ class WPSEO_Customizer {
* Will default to 'wpseo-' . $index.
* @param array $custom_settings Optional. Customizer setting arguments.
* Only those different from the default need to be passed.
*
* @return void
*/
private function add_setting_and_control( $index, $control_args, $id = null, $custom_settings = [] ) {
$setting = sprintf( $this->setting_template, $index );

View File

@@ -45,6 +45,13 @@ class WPSEO_Database_Proxy {
*/
protected $database;
/**
* Holds the table prefix.
*
* @var string
*/
protected $table_prefix;
/**
* Sets the class attributes and registers the table.
*
@@ -120,7 +127,7 @@ class WPSEO_Database_Proxy {
*
* @return false|int False when the upsert request is invalid, int on number of rows changed.
*/
public function upsert( array $data, array $where = null, $format = null, $where_format = null ) {
public function upsert( array $data, ?array $where = null, $format = null, $where_format = null ) {
if ( $where_format !== null ) {
_deprecated_argument( __METHOD__, '7.7.0', 'The where_format argument is deprecated' );
}
@@ -226,6 +233,8 @@ class WPSEO_Database_Proxy {
/**
* Executed before a query will be ran.
*
* @return void
*/
protected function pre_execution() {
if ( $this->suppress_errors ) {
@@ -235,6 +244,8 @@ class WPSEO_Database_Proxy {
/**
* Executed after a query has been ran.
*
* @return void
*/
protected function post_execution() {
if ( $this->suppress_errors ) {

View File

@@ -17,7 +17,7 @@ class WPSEO_Export {
*
* @var string
*/
const NONCE_ACTION = 'wpseo_export';
public const NONCE_ACTION = 'wpseo_export';
/**
* Holds the export data.
@@ -35,6 +35,8 @@ class WPSEO_Export {
/**
* Handles the export request.
*
* @return void
*/
public function export() {
check_admin_referer( self::NONCE_ACTION );
@@ -44,6 +46,8 @@ class WPSEO_Export {
/**
* Outputs the export.
*
* @return void
*/
public function output() {
if ( ! WPSEO_Capability_Utils::current_user_can( 'wpseo_manage_options' ) ) {
@@ -71,6 +75,8 @@ class WPSEO_Export {
/**
* Exports the current site's WP SEO settings.
*
* @return void
*/
private function export_settings() {
$this->export_header();
@@ -82,6 +88,8 @@ class WPSEO_Export {
/**
* Writes the header of the export.
*
* @return void
*/
private function export_header() {
$header = sprintf(
@@ -98,6 +106,8 @@ class WPSEO_Export {
*
* @param string $line Line string.
* @param bool $newline_first Boolean flag whether to prepend with new line.
*
* @return void
*/
private function write_line( $line, $newline_first = false ) {
if ( $newline_first ) {
@@ -110,6 +120,8 @@ class WPSEO_Export {
* Writes an entire option group to the export.
*
* @param string $opt_group Option group name.
*
* @return void
*/
private function write_opt_group( $opt_group ) {
@@ -125,7 +137,7 @@ class WPSEO_Export {
if ( is_array( $elem ) ) {
$count = count( $elem );
for ( $i = 0; $i < $count; $i++ ) {
$elem_check = isset( $elem[ $i ] ) ? $elem[ $i ] : null;
$elem_check = ( $elem[ $i ] ?? null );
$this->write_setting( $key . '[]', $elem_check );
}
}
@@ -140,6 +152,8 @@ class WPSEO_Export {
*
* @param string $key Key string.
* @param string $val Value string.
*
* @return void
*/
private function write_setting( $key, $val ) {
if ( is_string( $val ) ) {

View File

@@ -15,14 +15,14 @@ class WPSEO_Gutenberg_Compatibility {
*
* @var string
*/
const CURRENT_RELEASE = '17.4.0';
public const CURRENT_RELEASE = '17.5.0';
/**
* The minimally supported version of Gutenberg by the plugin.
*
* @var string
*/
const MINIMUM_SUPPORTED = '17.4.0';
public const MINIMUM_SUPPORTED = '17.5.0';
/**
* Holds the current version.

View File

@@ -66,6 +66,8 @@ class WPSEO_Meta_Columns {
/**
* Sets up up the hooks.
*
* @return void
*/
public function setup_hooks() {
$this->set_post_type_hooks();
@@ -97,19 +99,19 @@ class WPSEO_Meta_Columns {
$added_columns = [];
if ( $this->analysis_seo->is_enabled() ) {
$added_columns['wpseo-score'] = '<span class="yoast-column-seo-score yoast-column-header-has-tooltip" data-tooltip-text="' .
esc_attr__( 'SEO score', 'wordpress-seo' ) .
'"><span class="screen-reader-text">' .
__( 'SEO score', 'wordpress-seo' ) .
'</span></span></span>';
$added_columns['wpseo-score'] = '<span class="yoast-column-seo-score yoast-column-header-has-tooltip" data-tooltip-text="'
. esc_attr__( 'SEO score', 'wordpress-seo' )
. '"><span class="screen-reader-text">'
. __( 'SEO score', 'wordpress-seo' )
. '</span></span></span>';
}
if ( $this->analysis_readability->is_enabled() ) {
$added_columns['wpseo-score-readability'] = '<span class="yoast-column-readability yoast-column-header-has-tooltip" data-tooltip-text="' .
esc_attr__( 'Readability score', 'wordpress-seo' ) .
'"><span class="screen-reader-text">' .
__( 'Readability score', 'wordpress-seo' ) .
'</span></span></span>';
$added_columns['wpseo-score-readability'] = '<span class="yoast-column-readability yoast-column-header-has-tooltip" data-tooltip-text="'
. esc_attr__( 'Readability score', 'wordpress-seo' )
. '"><span class="screen-reader-text">'
. __( 'Readability score', 'wordpress-seo' )
. '</span></span></span>';
}
$added_columns['wpseo-title'] = __( 'SEO Title', 'wordpress-seo' );
@@ -127,6 +129,8 @@ class WPSEO_Meta_Columns {
*
* @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 ) {
if ( $this->display_metabox() === false ) {
@@ -240,6 +244,8 @@ class WPSEO_Meta_Columns {
/**
* Adds a dropdown that allows filtering on the posts SEO Quality.
*
* @return void
*/
public function posts_filter_dropdown() {
if ( ! $this->can_display_filter() ) {
@@ -412,17 +418,16 @@ class WPSEO_Meta_Columns {
*
* @internal
*
* @api array $keyword_filter The current keyword filter.
*
* @param array $keyphrase The keyphrase used in the filter.
* @param array $keyword_filter The current keyword filter.
*/
$keyphrase_filter = \apply_filters(
$keyphrase_filter = apply_filters(
'wpseo_change_keyphrase_filter_in_request',
$this->get_keyword_filter( $current_keyword_filter ),
$current_keyword_filter
);
if ( \is_array( $keyphrase_filter ) ) {
if ( is_array( $keyphrase_filter ) ) {
$active_filters = array_merge(
$active_filters,
[ $keyphrase_filter ]
@@ -437,7 +442,7 @@ class WPSEO_Meta_Columns {
*
* @param array $active_filters The current applicable filters.
*/
return \apply_filters( 'wpseo_change_applicable_filters', $active_filters );
return apply_filters( 'wpseo_change_applicable_filters', $active_filters );
}
/**
@@ -463,7 +468,7 @@ class WPSEO_Meta_Columns {
* @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 );
$order_by = apply_filters( 'wpseo_change_order_by', $order_by, $order_by_column );
$vars = array_merge( $vars, $order_by );
}
@@ -767,6 +772,8 @@ class WPSEO_Meta_Columns {
/**
* Sets up the hooks for the post_types.
*
* @return void
*/
private function set_post_type_hooks() {
$post_types = WPSEO_Post_Type::get_accessible_post_types();

View File

@@ -18,14 +18,14 @@ class WPSEO_MyYoast_Proxy implements WPSEO_WordPress_Integration {
*
* @var string
*/
const PAGE_IDENTIFIER = 'wpseo_myyoast_proxy';
public const PAGE_IDENTIFIER = 'wpseo_myyoast_proxy';
/**
* The cache control's max age. Used in the header of a successful proxy response.
*
* @var int
*/
const CACHE_CONTROL_MAX_AGE = DAY_IN_SECONDS;
public const CACHE_CONTROL_MAX_AGE = DAY_IN_SECONDS;
/**
* Registers the hooks when the user is on the right page.

View File

@@ -29,6 +29,8 @@ class WPSEO_Option_Tabs_Formatter {
* Outputs the option tabs.
*
* @param WPSEO_Option_Tabs $option_tabs Option Tabs to get tabs from.
*
* @return void
*/
public function run( WPSEO_Option_Tabs $option_tabs ) {
@@ -66,8 +68,7 @@ class WPSEO_Option_Tabs_Formatter {
*
* @internal For internal Yoast SEO use only.
*
* @api string|null The content that should be displayed for this tab. Leave empty for default behaviour.
*
* @param string|null $tab_contents The content that should be displayed for this tab. Leave empty for default behaviour.
* @param WPSEO_Option_Tabs $option_tabs The registered option tabs.
* @param WPSEO_Option_Tab $tab The tab that is being displayed.
*/

View File

@@ -114,6 +114,8 @@ class WPSEO_Option_Tabs {
* Display the tabs.
*
* @param Yoast_Form $yform Yoast Form needed in the views.
*
* @return void
*/
public function display( Yoast_Form $yform ) {
$formatter = new WPSEO_Option_Tabs_Formatter();

View File

@@ -19,6 +19,8 @@ class WPSEO_Plugin_Availability {
/**
* Registers the plugins so we can access them.
*
* @return void
*/
public function register() {
$this->register_yoast_plugins();
@@ -27,6 +29,8 @@ class WPSEO_Plugin_Availability {
/**
* Registers all the available Yoast SEO plugins.
*
* @return void
*/
protected function register_yoast_plugins() {
$this->plugins = [
@@ -97,6 +101,8 @@ class WPSEO_Plugin_Availability {
/**
* Sets certain plugin properties based on WordPress' status.
*
* @return void
*/
protected function register_yoast_plugins_status() {

View File

@@ -20,7 +20,7 @@ class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
*
* NOTE: when changing this array, be sure to update the array in Conflicting_Plugins_Service too.
*
* @var array
* @var array<string, array<string>>
*/
protected $plugins = [
// The plugin which are writing OG metadata.
@@ -37,7 +37,7 @@ class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
*
* @return Yoast_Plugin_Conflict
*/
public static function get_instance( $class_name = __CLASS__ ) {
public static function get_instance( $class_name = self::class ) {
return parent::get_instance( $class_name );
}
@@ -47,6 +47,8 @@ class WPSEO_Plugin_Conflict extends Yoast_Plugin_Conflict {
* If the activated plugin is conflicting with ours a notice will be shown.
*
* @param string|bool $plugin Optional plugin basename to check.
*
* @return void
*/
public static function hook_check_for_plugin_conflicts( $plugin = false ) {
// The instance of the plugin.

View File

@@ -97,10 +97,10 @@ class WPSEO_Premium_Upsell_Admin_Block {
$class = $this->get_html_class();
/* translators: %s expands to Yoast SEO Premium */
$button_text = YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ? \esc_html__( 'Claim your 30% off now!', 'wordpress-seo' ) : sprintf( esc_html__( 'Explore %s now!', 'wordpress-seo' ), 'Yoast SEO Premium' );
$button_text = YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ? esc_html__( 'Claim your 30% off now!', 'wordpress-seo' ) : sprintf( esc_html__( 'Explore %s now!', 'wordpress-seo' ), 'Yoast SEO Premium' );
/* translators: Hidden accessibility text. */
$button_text .= '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' .
'<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
$button_text .= '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
. '<span aria-hidden="true" class="yoast-button-upsell__caret"></span>';
$upgrade_button = sprintf(
'<a id="%1$s" class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="%2$s" target="_blank">%3$s</a>',
@@ -112,20 +112,20 @@ class WPSEO_Premium_Upsell_Admin_Block {
echo '<div class="' . esc_attr( $class ) . '">';
if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-2023-promotion' ) ) {
$bf_label = \esc_html__( 'BLACK FRIDAY', 'wordpress-seo' );
$sale_label = \esc_html__( '30% OFF', 'wordpress-seo' );
$bf_label = esc_html__( 'BLACK FRIDAY', 'wordpress-seo' );
$sale_label = esc_html__( '30% OFF', 'wordpress-seo' );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped above.
echo "<div class='black-friday-container'><span>$bf_label</span> <span style='margin-left: auto;'>$sale_label</span> </div>";
}
echo '<div class="' . esc_attr( $class . '--container' ) . '">';
echo '<h2 class="' . esc_attr( $class . '--header' ) . '">' .
sprintf(
echo '<h2 class="' . esc_attr( $class . '--header' ) . '">'
. sprintf(
/* translators: %s expands to Yoast SEO Premium */
esc_html__( 'Upgrade to %s', 'wordpress-seo' ),
'Yoast SEO Premium'
) .
'</h2>';
)
. '</h2>';
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Correctly escaped in $this->get_argument_html() method.
echo '<ul class="' . esc_attr( $class . '--motivation' ) . '">' . $arguments_html . '</ul>';

View File

@@ -12,6 +12,8 @@ class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {
/**
* Constructor.
*
* @return void
*/
public function register_hooks() {
add_filter( 'wpseo_content_meta_section_content', [ $this, 'add_input_fields' ] );
@@ -94,6 +96,8 @@ class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {
/**
* Adds primary term templates.
*
* @return void
*/
public function wp_footer() {
$taxonomies = $this->get_primary_term_taxonomies();
@@ -173,6 +177,8 @@ class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {
/**
* Includes templates file.
*
* @return void
*/
protected function include_js_templates() {
include_once WPSEO_PATH . 'admin/views/js-templates-primary-term.php';
@@ -193,8 +199,7 @@ class WPSEO_Primary_Term_Admin implements WPSEO_WordPress_Integration {
/**
* Filters which taxonomies for which the user can choose the primary term.
*
* @api array $taxonomies An array of taxonomy objects that are primary_term enabled.
*
* @param array $taxonomies An array of taxonomy objects that are primary_term enabled.
* @param string $post_type The post type for which to filter the taxonomies.
* @param array $all_taxonomies All taxonomies for this post types, even ones that don't have primary term
* enabled.

View File

@@ -17,14 +17,14 @@ class WPSEO_Product_Upsell_Notice {
*
* @var string
*/
const USER_META_DISMISSED = 'wpseo-remove-upsell-notice';
public const USER_META_DISMISSED = 'wpseo-remove-upsell-notice';
/**
* Holds the option name.
*
* @var string
*/
const OPTION_NAME = 'wpseo';
public const OPTION_NAME = 'wpseo';
/**
* Holds the options.
@@ -42,6 +42,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Checks if the notice should be added or removed.
*
* @return void
*/
public function initialize() {
$this->remove_notification();
@@ -49,6 +51,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Sets the upgrade notice.
*
* @return void
*/
public function set_upgrade_notice() {
@@ -62,9 +66,11 @@ class WPSEO_Product_Upsell_Notice {
/**
* Listener for the upsell notice.
*
* @return void
*/
public function dismiss_notice_listener() {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are validating a nonce here.
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are validating a nonce here.
if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'dismiss-5star-upsell' ) ) {
return;
}
@@ -102,6 +108,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Sets the first activated on.
*
* @return void
*/
protected function set_first_activated_on() {
$this->options['first_activated_on'] = strtotime( '-2weeks' );
@@ -111,6 +119,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Adds a notification to the notification center.
*
* @return void
*/
protected function add_notification() {
$notification_center = Yoast_Notification_Center::get();
@@ -119,6 +129,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Removes a notification to the notification center.
*
* @return void
*/
protected function remove_notification() {
$notification_center = Yoast_Notification_Center::get();
@@ -192,6 +204,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Dismisses the notice.
*
* @return void
*/
protected function dismiss_notice() {
update_user_meta( get_current_user_id(), self::USER_META_DISMISSED, true );
@@ -208,6 +222,8 @@ class WPSEO_Product_Upsell_Notice {
/**
* Saves the options to the database.
*
* @return void
*/
protected function save_options() {
update_option( self::OPTION_NAME, $this->options );

View File

@@ -15,14 +15,14 @@ class WPSEO_Remote_Request {
*
* @var string
*/
const METHOD_POST = 'post';
public const METHOD_POST = 'post';
/**
* Holds the get method.
*
* @var string
*/
const METHOD_GET = 'get';
public const METHOD_GET = 'get';
/**
* Holds the endpoint to send the request to.
@@ -70,6 +70,8 @@ class WPSEO_Remote_Request {
* Sets the request body.
*
* @param mixed $body The body to set.
*
* @return void
*/
public function set_body( $body ) {
$this->args['body'] = $body;

View File

@@ -22,6 +22,8 @@ class WPSEO_Schema_Person_Upgrade_Notification implements WPSEO_WordPress_Integr
/**
* Handles if the notification should be added or removed.
*
* @return void
*/
public function handle_notification() {
$company_or_person_user_id = WPSEO_Options::get( 'company_or_person_user_id', false );
@@ -35,6 +37,8 @@ class WPSEO_Schema_Person_Upgrade_Notification implements WPSEO_WordPress_Integr
/**
* Adds a notification to the notification center.
*
* @return void
*/
protected function add_notification() {
$notification_center = Yoast_Notification_Center::get();
@@ -43,6 +47,8 @@ class WPSEO_Schema_Person_Upgrade_Notification implements WPSEO_WordPress_Integr
/**
* Removes a notification to the notification center.
*
* @return void
*/
protected function remove_notification() {
$notification_center = Yoast_Notification_Center::get();

View File

@@ -26,6 +26,8 @@ class Wincher_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Register WordPress hooks.
*
* @return void
*/
public function register_hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_wincher_dashboard_assets' ] );
@@ -45,6 +47,8 @@ class Wincher_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Adds the Wincher dashboard widget to WordPress.
*
* @return void
*/
public function add_wincher_dashboard_widget() {
add_filter( 'postbox_classes_dashboard_wpseo-wincher-dashboard-overview', [ $this, 'wpseo_wincher_dashboard_overview_class' ] );
@@ -70,6 +74,8 @@ class Wincher_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Displays the Wincher dashboard widget.
*
* @return void
*/
public function display_wincher_dashboard_widget() {
echo '<div id="yoast-seo-wincher-dashboard-widget"></div>';
@@ -77,6 +83,8 @@ class Wincher_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Enqueues assets for the dashboard if the current page is the dashboard.
*
* @return void
*/
public function enqueue_wincher_dashboard_assets() {
if ( ! $this->is_dashboard_screen() ) {

View File

@@ -12,6 +12,8 @@ class WPSEO_Yoast_Columns implements WPSEO_WordPress_Integration {
/**
* Registers all hooks to WordPress.
*
* @return void
*/
public function register_hooks() {
add_action( 'load-edit.php', [ $this, 'add_help_tab' ] );
@@ -19,6 +21,8 @@ class WPSEO_Yoast_Columns implements WPSEO_WordPress_Integration {
/**
* Adds the help tab to the help center for current screen.
*
* @return void
*/
public function add_help_tab() {
$link_columns_present = $this->display_links();

View File

@@ -15,7 +15,7 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
*
* @var string
*/
const CACHE_TRANSIENT_KEY = 'wpseo-dashboard-totals';
public const CACHE_TRANSIENT_KEY = 'wpseo-dashboard-totals';
/**
* Holds an instance of the admin asset manager.
@@ -36,7 +36,7 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
*
* @param WPSEO_Statistics|null $statistics WPSEO_Statistics instance.
*/
public function __construct( WPSEO_Statistics $statistics = null ) {
public function __construct( ?WPSEO_Statistics $statistics = null ) {
if ( $statistics === null ) {
$statistics = new WPSEO_Statistics();
}
@@ -47,6 +47,8 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Register WordPress hooks.
*
* @return void
*/
public function register_hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_dashboard_assets' ] );
@@ -66,6 +68,8 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Adds dashboard widget to WordPress.
*
* @return void
*/
public function add_dashboard_widget() {
add_filter( 'postbox_classes_dashboard_wpseo-dashboard-overview', [ $this, 'wpseo_dashboard_overview_class' ] );
@@ -91,6 +95,8 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Displays the dashboard widget.
*
* @return void
*/
public function display_dashboard_widget() {
echo '<div id="yoast-seo-dashboard-widget"></div>';
@@ -98,6 +104,8 @@ class Yoast_Dashboard_Widget implements WPSEO_WordPress_Integration {
/**
* Enqueues assets for the dashboard if the current page is the dashboard.
*
* @return void
*/
public function enqueue_dashboard_assets() {
if ( ! $this->is_dashboard_screen() ) {

View File

@@ -63,6 +63,8 @@ class Yoast_Form {
* @param string $option The short name of the option to use for the current page.
* @param bool $contains_files Whether the form should allow for file uploads.
* @param bool $option_long_name Group name of the option.
*
* @return void
*/
public function admin_header( $form = true, $option = 'wpseo', $contains_files = false, $option_long_name = false ) {
if ( ! $option_long_name ) {
@@ -97,12 +99,12 @@ class Yoast_Form {
$hidden_fields_cb = 'settings_fields';
}
echo '<form action="' .
esc_url( $action_url ) .
'" method="post" id="wpseo-conf"' .
$enctype . ' accept-charset="' . // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- nothing to escape.
esc_attr( get_bloginfo( 'charset' ) ) .
'" novalidate="novalidate">';
echo '<form action="'
. esc_url( $action_url )
. '" method="post" id="wpseo-conf"'
. $enctype . ' accept-charset="' // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- nothing to escape.
. esc_attr( get_bloginfo( 'charset' ) )
. '" novalidate="novalidate">';
call_user_func( $hidden_fields_cb, $option_long_name );
}
$this->set_option( $option );
@@ -114,6 +116,8 @@ class Yoast_Form {
* @since 2.0
*
* @param string $option_name Option key.
*
* @return void
*/
public function set_option( $option_name ) {
$this->option_name = $option_name;
@@ -131,6 +135,8 @@ class Yoast_Form {
*
* @param bool $submit Whether or not a submit button and form end tag should be shown.
* @param bool $show_sidebar Whether or not to show the banner sidebar - used by premium plugins to disable it.
*
* @return void
*/
public function admin_footer( $submit = true, $show_sidebar = true ) {
if ( $submit ) {
@@ -182,6 +188,8 @@ class Yoast_Form {
* Generates the sidebar for admin pages.
*
* @since 2.0
*
* @return void
*/
public function admin_sidebar() {
// No banners in Premium.
@@ -202,6 +210,8 @@ class Yoast_Form {
*
* @param string $text Label text string, which can contain escaped html.
* @param array $attr HTML attributes set.
*
* @return void
*/
public function label( $text, $attr ) {
$defaults = [
@@ -231,6 +241,8 @@ class Yoast_Form {
*
* @param string $text Legend text string.
* @param array $attr HTML attributes set.
*
* @return void
*/
public function legend( $text, $attr ) {
$defaults = [
@@ -253,6 +265,8 @@ class Yoast_Form {
* @param string $label The label to show for the variable.
* @param bool $label_left Whether the label should be left (true) or right (false).
* @param array $attr Extra attributes to add to the checkbox.
*
* @return void
*/
public function checkbox( $variable, $label, $label_left = false, $attr = [] ) {
$val = $this->get_field_value( $variable, false );
@@ -294,6 +308,8 @@ class Yoast_Form {
* @param string $variable The variables within the option to create the checkbox list for.
* @param string $labels The labels to show for the variable.
* @param array $attr Extra attributes to add to the checkbox list.
*
* @return void
*/
public function checkbox_list( $variable, $labels, $attr = [] ) {
$defaults = [
@@ -335,6 +351,8 @@ class Yoast_Form {
* @param bool $strong Whether the visual label is displayed in strong text. Default is false.
* Starting from Yoast SEO 16.5, the visual label is forced to bold via CSS.
* @param array $attr Extra attributes to add to the light switch.
*
* @return void
*/
public function light_switch( $variable, $label, $buttons = [], $reverse = true, $help = '', $strong = false, $attr = [] ) {
$val = $this->get_field_value( $variable, false );
@@ -375,6 +393,8 @@ class Yoast_Form {
* @param string $variable The variable within the option to create the text input field for.
* @param string $label The label to show for the variable.
* @param array|string $attr Extra attributes to add to the input field. Can be class, disabled, autocomplete.
*
* @return void
*/
public function textinput( $variable, $label, $attr = [] ) {
$type = 'text';
@@ -424,6 +444,8 @@ class Yoast_Form {
* @param string $variable The variable within the option to create the text input field for.
* @param string $label The label to show for the variable.
* @param array|string $attr Extra attributes to add to the input field. Can be class, disabled, autocomplete.
*
* @return void
*/
public function number( $variable, $label, $attr = [] ) {
$type = 'number';
@@ -475,7 +497,7 @@ class Yoast_Form {
'disabled' => false,
];
$attr = \wp_parse_args( $attr, $defaults );
$attr = wp_parse_args( $attr, $defaults );
$val = $this->get_field_value( $variable, '' );
if ( isset( $attr['type'] ) && $attr['type'] === 'url' ) {
@@ -508,13 +530,13 @@ class Yoast_Form {
printf(
'<input type="%1$s" name="%2$s" id="%3$s" class="%4$s"%5$s%6$s%7$s value="%8$s"%9$s>',
$type,
\esc_attr( $this->option_name . '[' . $variable . ']' ),
\esc_attr( $variable ),
\esc_attr( $attr['class'] ),
isset( $attr['placeholder'] ) ? ' placeholder="' . \esc_attr( $attr['placeholder'] ) . '"' : '',
isset( $attr['autocomplete'] ) ? ' autocomplete="' . \esc_attr( $attr['autocomplete'] ) . '"' : '',
esc_attr( $this->option_name . '[' . $variable . ']' ),
esc_attr( $variable ),
esc_attr( $attr['class'] ),
isset( $attr['placeholder'] ) ? ' placeholder="' . esc_attr( $attr['placeholder'] ) . '"' : '',
isset( $attr['autocomplete'] ) ? ' autocomplete="' . esc_attr( $attr['autocomplete'] ) . '"' : '',
$aria_attributes,
\esc_attr( $val ),
esc_attr( $val ),
$this->get_disabled_attribute( $variable, $attr )
);
// phpcs:enable
@@ -530,6 +552,8 @@ class Yoast_Form {
* @param string $variable The variable within the option to create the textarea for.
* @param string $label The label to show for the variable.
* @param string|array $attr The CSS class or an array of attributes to assign to the textarea.
*
* @return void
*/
public function textarea( $variable, $label, $attr = [] ) {
if ( ! is_array( $attr ) ) {
@@ -569,6 +593,8 @@ class Yoast_Form {
* @param string $variable The variable within the option to create the hidden input for.
* @param string $id The ID of the element.
* @param mixed $val Optional. The value to set in the input field. Otherwise the value from the options will be used.
*
* @return void
*/
public function hidden( $variable, $id = '', $val = null ) {
if ( is_null( $val ) ) {
@@ -598,6 +624,8 @@ class Yoast_Form {
* @param bool $show_label Whether or not to show the label, if not, it will be applied as an aria-label.
* @param array $attr Extra attributes to add to the select.
* @param string $help Optional. Inline Help HTML that will be printed after the label. Default is empty.
*
* @return void
*/
public function select( $variable, $label, array $select_options, $styled = 'unstyled', $show_label = true, $attr = [], $help = '' ) {
if ( empty( $select_options ) ) {
@@ -658,6 +686,8 @@ class Yoast_Form {
* @param string $variable The variable within the option to create the file upload field for.
* @param string $label The label to show for the variable.
* @param array $attr Extra attributes to add to the file upload input.
*
* @return void
*/
public function file_upload( $variable, $label, $attr = [] ) {
$val = $this->get_field_value( $variable, '' );
@@ -701,6 +731,8 @@ class Yoast_Form {
* @param string $variable Option name.
* @param string $label Label message.
* @param array $attr Extra attributes to add to the media input and buttons.
*
* @return void
*/
public function media_input( $variable, $label, $attr = [] ) {
$val = $this->get_field_value( $variable, '' );
@@ -771,6 +803,8 @@ class Yoast_Form {
* @param string $legend Optional. The legend to show for the field set, if any.
* @param array $legend_attr Optional. The attributes for the legend, if any.
* @param array $attr Extra attributes to add to the radio button.
*
* @return void
*/
public function radio( $variable, $values, $legend = '', $legend_attr = [], $attr = [] ) {
if ( ! is_array( $values ) || $values === [] ) {
@@ -805,8 +839,8 @@ class Yoast_Form {
$aria_label = '';
if ( is_array( $value ) ) {
$label = isset( $value['label'] ) ? $value['label'] : '';
$aria_label = isset( $value['aria_label'] ) ? $value['aria_label'] : '';
$label = ( $value['label'] ?? '' );
$aria_label = ( $value['aria_label'] ?? '' );
}
$key_esc = esc_attr( $key );
@@ -839,6 +873,8 @@ class Yoast_Form {
* @param string $label The visual label for the radio buttons group, used as the fieldset legend.
* @param string $help Inline Help that will be printed out before the visible toggles text.
* @param array $attr Extra attributes to add to the toggle switch.
*
* @return void
*/
public function toggle_switch( $variable, $values, $label, $help = '', $attr = [] ) {
if ( ! is_array( $values ) || $values === [] ) {
@@ -909,12 +945,12 @@ class Yoast_Form {
$upsell_button = '';
if ( $has_premium_upsell ) {
$upsell_button = '<a class="yoast-button yoast-button--buy yoast-button--small" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href=' .
esc_url( $attr['premium_upsell_url'] ) . ' target="_blank">' .
esc_html__( 'Unlock with Premium!', 'wordpress-seo' ) .
$upsell_button = '<a class="yoast-button yoast-button--buy yoast-button--small" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href='
. esc_url( $attr['premium_upsell_url'] ) . ' target="_blank">'
. esc_html__( 'Unlock with Premium!', 'wordpress-seo' )
/* translators: Hidden accessibility text. */
'<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>' .
'<span aria-hidden="true" class="yoast-button--buy__caret"></span></a>';
. '<span class="screen-reader-text">' . esc_html__( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>'
. '<span aria-hidden="true" class="yoast-button--buy__caret"></span></a>';
}
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- All variable output is escaped above.

View File

@@ -99,6 +99,8 @@ class Yoast_Input_Validation {
*
* @param array $descriptions An associative array of error descriptions.
* For each entry, the key must be the setting variable.
*
* @return void
*/
public static function set_error_descriptions( $descriptions = [] ) {
$defaults = [

View File

@@ -15,14 +15,14 @@ class Yoast_Network_Admin implements WPSEO_WordPress_AJAX_Integration, WPSEO_Wor
*
* @var string
*/
const UPDATE_OPTIONS_ACTION = 'yoast_handle_network_options';
public const UPDATE_OPTIONS_ACTION = 'yoast_handle_network_options';
/**
* Action identifier for restoring a site.
*
* @var string
*/
const RESTORE_SITE_ACTION = 'yoast_restore_site';
public const RESTORE_SITE_ACTION = 'yoast_restore_site';
/**
* Gets the available sites as choices, e.g. for a dropdown.

View File

@@ -17,19 +17,19 @@ class Yoast_Notification_Center {
*
* @var string
*/
const STORAGE_KEY = 'yoast_notifications';
public const STORAGE_KEY = 'yoast_notifications';
/**
* The singleton instance of this object.
*
* @var \Yoast_Notification_Center
* @var Yoast_Notification_Center
*/
private static $instance = null;
/**
* Holds the notifications.
*
* @var \Yoast_Notification[][]
* @var Yoast_Notification[][]
*/
private $notifications = [];
@@ -99,6 +99,8 @@ class Yoast_Notification_Center {
/**
* Dismiss a notification.
*
* @return void
*/
public static function ajax_dismiss_notification() {
$notification_center = self::get();
@@ -304,6 +306,8 @@ class Yoast_Notification_Center {
* Add notification to the cookie.
*
* @param Yoast_Notification $notification Notification object instance.
*
* @return void
*/
public function add_notification( Yoast_Notification $notification ) {
@@ -411,6 +415,8 @@ class Yoast_Notification_Center {
*
* @param Yoast_Notification $notification Notification to remove.
* @param bool $resolve Resolve as fixed.
*
* @return void
*/
public function remove_notification( Yoast_Notification $notification, $resolve = true ) {
@@ -523,12 +529,14 @@ class Yoast_Notification_Center {
/**
* AJAX display notifications.
*
* @return void
*/
public function ajax_get_notifications() {
$echo = false;
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form data.
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form data.
if ( isset( $_POST['version'] ) && is_string( $_POST['version'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing the variable in a condition.
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are only comparing the variable in a condition.
$echo = wp_unslash( $_POST['version'] ) === '2';
}
@@ -541,6 +549,8 @@ class Yoast_Notification_Center {
/**
* Remove storage when the plugin is deactivated.
*
* @return void
*/
public function deactivate_hook() {
@@ -606,7 +616,7 @@ class Yoast_Notification_Center {
/**
* Filter: 'yoast_notifications_before_storage' - Allows developer to filter notifications before saving them.
*
* @api Yoast_Notification[] $notifications
* @param Yoast_Notification[] $notifications
*/
$filtered_merged_notifications = apply_filters( 'yoast_notifications_before_storage', $merged_notifications );
@@ -693,18 +703,16 @@ class Yoast_Notification_Center {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.NonceVerification.Missing -- Reason: We are not processing form information and only using this variable in a comparison.
$request_method = isset( $_SERVER['REQUEST_METHOD'] ) && is_string( $_SERVER['REQUEST_METHOD'] ) ? strtoupper( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) : '';
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: This function does not sanitize variables.
// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- Reason: This function does not verify a nonce.
// phpcs:disable WordPress.Security.NonceVerification.Recommended,WordPress.Security.NonceVerification.Missing -- Reason: This function does not verify a nonce.
if ( $request_method === 'POST' ) {
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
return wp_unslash( $_POST[ $key ] );
}
}
else {
if ( isset( $_GET[ $key ] ) && is_string( $_GET[ $key ] ) ) {
elseif ( isset( $_GET[ $key ] ) && is_string( $_GET[ $key ] ) ) {
return wp_unslash( $_GET[ $key ] );
}
}
// phpcs:enable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
// phpcs:enable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
return '';
}
@@ -769,6 +777,8 @@ class Yoast_Notification_Center {
/**
* Clear local stored notifications.
*
* @return void
*/
private function clear_notifications() {
@@ -836,7 +846,7 @@ class Yoast_Notification_Center {
}
if ( isset( $notification_data['message'] )
&& \is_subclass_of( $notification_data['message'], Abstract_Presenter::class, false )
&& is_subclass_of( $notification_data['message'], Abstract_Presenter::class, false )
) {
$notification_data['message'] = $notification_data['message']->present();
}
@@ -899,6 +909,8 @@ class Yoast_Notification_Center {
*
* @param callable $callback Callback that performs the transaction.
* @param array $args Arguments to pass to the callback.
*
* @return void
*/
private function add_transaction_to_queue( $callback, $args ) {
$this->queued_transactions[] = [ $callback, $args ];

View File

@@ -16,35 +16,35 @@ class Yoast_Notification {
*
* @var string
*/
const MATCH_ALL = 'all';
public const MATCH_ALL = 'all';
/**
* Type of capability check.
*
* @var string
*/
const MATCH_ANY = 'any';
public const MATCH_ANY = 'any';
/**
* Notification type.
*
* @var string
*/
const ERROR = 'error';
public const ERROR = 'error';
/**
* Notification type.
*
* @var string
*/
const WARNING = 'warning';
public const WARNING = 'warning';
/**
* Notification type.
*
* @var string
*/
const UPDATED = 'updated';
public const UPDATED = 'updated';
/**
* Options of this Notification.
@@ -118,7 +118,7 @@ class Yoast_Notification {
* @return WP_User The user to show this notification for.
*/
public function get_user() {
\_deprecated_function( __METHOD__, 'Yoast SEO 21.6' );
_deprecated_function( __METHOD__, 'Yoast SEO 21.6' );
return null;
}
@@ -148,6 +148,8 @@ class Yoast_Notification {
/**
* Make sure the nonce is up to date.
*
* @return void
*/
public function refresh_nonce() {
if ( $this->options['id'] ) {
@@ -418,6 +420,8 @@ class Yoast_Notification {
*
* @param string $value Attribute value.
* @param string $key Attribute name.
*
* @return void
*/
private function parse_attributes( &$value, $key ) {
$value = sprintf( '%s="%s"', sanitize_key( $key ), esc_attr( $value ) );

View File

@@ -15,7 +15,7 @@ class Yoast_Notifications {
*
* @var string
*/
const ADMIN_PAGE = 'wpseo_dashboard';
public const ADMIN_PAGE = 'wpseo_dashboard';
/**
* Total notifications count.
@@ -76,6 +76,8 @@ class Yoast_Notifications {
/**
* Add hooks
*
* @return void
*/
private function add_hooks() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
@@ -88,7 +90,7 @@ class Yoast_Notifications {
}
// Needed for adminbar and Notifications page.
add_action( 'admin_init', [ __CLASS__, 'collect_notifications' ], 99 );
add_action( 'admin_init', [ self::class, 'collect_notifications' ], 99 );
// Add AJAX hooks.
add_action( 'wp_ajax_yoast_dismiss_notification', [ $this, 'ajax_dismiss_notification' ] );
@@ -97,6 +99,8 @@ class Yoast_Notifications {
/**
* Enqueue assets.
*
* @return void
*/
public function enqueue_assets() {
$asset_manager = new WPSEO_Admin_Asset_Manager();
@@ -106,6 +110,8 @@ class Yoast_Notifications {
/**
* Handle ajax request to dismiss a notification.
*
* @return void
*/
public function ajax_dismiss_notification() {
@@ -122,6 +128,8 @@ class Yoast_Notifications {
/**
* Handle ajax request to restore a notification.
*
* @return void
*/
public function ajax_restore_notification() {
@@ -140,6 +148,8 @@ class Yoast_Notifications {
* Create AJAX response data.
*
* @param string $type Notification type.
*
* @return void
*/
private function output_ajax_response( $type ) {
@@ -215,6 +225,8 @@ class Yoast_Notifications {
/**
* Collect the notifications and group them together.
*
* @return void
*/
public static function collect_notifications() {
@@ -223,12 +235,12 @@ class Yoast_Notifications {
$notifications = $notification_center->get_sorted_notifications();
self::$notification_count = count( $notifications );
self::$errors = array_filter( $notifications, [ __CLASS__, 'filter_error_notifications' ] );
self::$dismissed_errors = array_filter( self::$errors, [ __CLASS__, 'filter_dismissed_notifications' ] );
self::$errors = array_filter( $notifications, [ self::class, 'filter_error_notifications' ] );
self::$dismissed_errors = array_filter( self::$errors, [ self::class, 'filter_dismissed_notifications' ] );
self::$active_errors = array_diff( self::$errors, self::$dismissed_errors );
self::$warnings = array_filter( $notifications, [ __CLASS__, 'filter_warning_notifications' ] );
self::$dismissed_warnings = array_filter( self::$warnings, [ __CLASS__, 'filter_dismissed_notifications' ] );
self::$warnings = array_filter( $notifications, [ self::class, 'filter_warning_notifications' ] );
self::$dismissed_warnings = array_filter( self::$warnings, [ self::class, 'filter_dismissed_notifications' ] );
self::$active_warnings = array_diff( self::$warnings, self::$dismissed_warnings );
}

View File

@@ -54,7 +54,7 @@ class Yoast_Plugin_Conflict {
if ( is_null( self::$instance ) ) {
if ( ! is_string( $class_name ) || $class_name === '' ) {
$class_name = __CLASS__;
$class_name = self::class;
}
self::$instance = new $class_name();
@@ -75,7 +75,7 @@ class Yoast_Plugin_Conflict {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['action'] ) && is_string( $_GET['action'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information and only comparing the variable in a condition.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information and only comparing the variable in a condition.
$action = wp_unslash( $_GET['action'] );
if ( $action === 'deactivate' ) {
$this->remove_deactivated_plugin();
@@ -106,7 +106,7 @@ class Yoast_Plugin_Conflict {
$sections_checked = [];
}
if ( ! \in_array( $plugin_section, $sections_checked, true ) ) {
if ( ! in_array( $plugin_section, $sections_checked, true ) ) {
$sections_checked[] = $plugin_section;
return ( ! empty( $this->active_conflicting_plugins[ $plugin_section ] ) );
}
@@ -118,6 +118,8 @@ class Yoast_Plugin_Conflict {
* Checks for given $plugin_sections for conflicts.
*
* @param array $plugin_sections Set of sections.
*
* @return void
*/
public function check_plugin_conflicts( $plugin_sections ) {
foreach ( $plugin_sections as $plugin_section => $readable_plugin_section ) {
@@ -128,9 +130,9 @@ class Yoast_Plugin_Conflict {
}
// List of all active sections.
$sections = \array_keys( $plugin_sections );
$sections = array_keys( $plugin_sections );
// List of all sections.
$all_plugin_sections = \array_keys( $this->plugins );
$all_plugin_sections = array_keys( $this->plugins );
/*
* Get all sections that are inactive.
@@ -138,10 +140,10 @@ class Yoast_Plugin_Conflict {
*
* This happens when Sitemaps or OpenGraph implementations toggle active/disabled.
*/
$inactive_sections = \array_diff( $all_plugin_sections, $sections );
$inactive_sections = array_diff( $all_plugin_sections, $sections );
if ( ! empty( $inactive_sections ) ) {
foreach ( $inactive_sections as $section ) {
\array_walk( $this->plugins[ $section ], [ $this, 'clear_error' ] );
array_walk( $this->plugins[ $section ], [ $this, 'clear_error' ] );
}
}
@@ -152,10 +154,10 @@ class Yoast_Plugin_Conflict {
// If there are active plugins, filter them from being cleared.
if ( isset( $this->active_conflicting_plugins[ $section ] ) ) {
$inactive_plugins = \array_diff( $this->plugins[ $section ], $this->active_conflicting_plugins[ $section ] );
$inactive_plugins = array_diff( $this->plugins[ $section ], $this->active_conflicting_plugins[ $section ] );
}
\array_walk( $inactive_plugins, [ $this, 'clear_error' ] );
array_walk( $inactive_plugins, [ $this, 'clear_error' ] );
}
}
@@ -164,6 +166,8 @@ class Yoast_Plugin_Conflict {
*
* @param string $plugin_section Type of conflict group (such as Open Graph or sitemap).
* @param string $readable_plugin_section This is the value for the translation.
*
* @return void
*/
protected function set_error( $plugin_section, $readable_plugin_section ) {
@@ -200,6 +204,8 @@ class Yoast_Plugin_Conflict {
* Clear the notification for a plugin.
*
* @param string $plugin_file Clear the optional notification for this plugin.
*
* @return void
*/
public function clear_error( $plugin_file ) {
$identifier = $this->get_notification_identifier( $plugin_file );
@@ -212,6 +218,8 @@ class Yoast_Plugin_Conflict {
* Loop through the $this->plugins to check if one of the plugins is active.
*
* This method will store the active plugins in $this->active_plugins.
*
* @return void
*/
protected function search_active_plugins() {
foreach ( $this->plugins as $plugin_section => $plugins ) {
@@ -224,6 +232,8 @@ class Yoast_Plugin_Conflict {
*
* @param array $plugins Set of plugins.
* @param string $plugin_section Type of conflict group (such as Open Graph or sitemap).
*
* @return void
*/
protected function check_plugins_active( $plugins, $plugin_section ) {
foreach ( $plugins as $plugin ) {
@@ -241,7 +251,7 @@ class Yoast_Plugin_Conflict {
* @return bool
*/
protected function check_plugin_is_active( $plugin ) {
return \in_array( $plugin, $this->all_active_plugins, true );
return in_array( $plugin, $this->all_active_plugins, true );
}
/**
@@ -252,13 +262,15 @@ class Yoast_Plugin_Conflict {
*
* @param string $plugin_section Type of conflict group (such as Open Graph or sitemap).
* @param string $plugin Plugin basename string.
*
* @return void
*/
protected function add_active_plugin( $plugin_section, $plugin ) {
if ( ! \array_key_exists( $plugin_section, $this->active_conflicting_plugins ) ) {
if ( ! array_key_exists( $plugin_section, $this->active_conflicting_plugins ) ) {
$this->active_conflicting_plugins[ $plugin_section ] = [];
}
if ( ! \in_array( $plugin, $this->active_conflicting_plugins[ $plugin_section ], true ) ) {
if ( ! in_array( $plugin, $this->active_conflicting_plugins[ $plugin_section ], true ) ) {
$this->active_conflicting_plugins[ $plugin_section ][] = $plugin;
}
}
@@ -274,7 +286,7 @@ class Yoast_Plugin_Conflict {
*/
protected function find_plugin_category( $plugin ) {
foreach ( $this->plugins as $plugin_section => $plugins ) {
if ( \in_array( $plugin, $plugins, true ) ) {
if ( in_array( $plugin, $plugins, true ) ) {
return $plugin_section;
}
}
@@ -288,7 +300,7 @@ class Yoast_Plugin_Conflict {
* @return string|bool Plugin name or false when no name is set.
*/
protected function get_plugin_name( $plugin ) {
$plugin_details = \get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$plugin_details = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
if ( $plugin_details['Name'] !== '' ) {
return $plugin_details['Name'];
@@ -299,6 +311,8 @@ class Yoast_Plugin_Conflict {
/**
* When being in the deactivation process the currently deactivated plugin has to be removed.
*
* @return void
*/
private function remove_deactivated_plugin() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: On the deactivation screen the nonce is already checked by WordPress itself.
@@ -308,7 +322,7 @@ class Yoast_Plugin_Conflict {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: On the deactivation screen the nonce is already checked by WordPress itself.
$deactivated_plugin = sanitize_text_field( wp_unslash( $_GET['plugin'] ) );
$key_to_remove = \array_search( $deactivated_plugin, $this->all_active_plugins, true );
$key_to_remove = array_search( $deactivated_plugin, $this->all_active_plugins, true );
if ( $key_to_remove !== false ) {
unset( $this->all_active_plugins[ $key_to_remove ] );
@@ -323,6 +337,6 @@ class Yoast_Plugin_Conflict {
* @return string
*/
private function get_notification_identifier( $plugin_file ) {
return \md5( $plugin_file );
return md5( $plugin_file );
}
}

View File

@@ -15,21 +15,21 @@ class WPSEO_Endpoint_File_Size implements WPSEO_Endpoint {
*
* @var string
*/
const REST_NAMESPACE = 'yoast/v1';
public const REST_NAMESPACE = 'yoast/v1';
/**
* The route of the endpoint to retrieve the file size.
*
* @var string
*/
const ENDPOINT_SINGULAR = 'file_size';
public const ENDPOINT_SINGULAR = 'file_size';
/**
* The name of the capability needed to retrieve data using the endpoints.
*
* @var string
*/
const CAPABILITY_RETRIEVE = 'manage_options';
public const CAPABILITY_RETRIEVE = 'manage_options';
/**
* The service provider.

View File

@@ -15,21 +15,21 @@ class WPSEO_Endpoint_Statistics implements WPSEO_Endpoint {
*
* @var string
*/
const REST_NAMESPACE = 'yoast/v1';
public const REST_NAMESPACE = 'yoast/v1';
/**
* The route of the statistics endpoint.
*
* @var string
*/
const ENDPOINT_RETRIEVE = 'statistics';
public const ENDPOINT_RETRIEVE = 'statistics';
/**
* The name of the capability needed to retrieve data using the endpoints.
*
* @var string
*/
const CAPABILITY_RETRIEVE = 'read';
public const CAPABILITY_RETRIEVE = 'read';
/**
* Service to use.
@@ -49,6 +49,8 @@ class WPSEO_Endpoint_Statistics implements WPSEO_Endpoint {
/**
* Registers the REST routes that are available on the endpoint.
*
* @return void
*/
public function register() {
// Register fetch config.

View File

@@ -15,7 +15,7 @@ abstract class WPSEO_Abstract_Post_Filter implements WPSEO_WordPress_Integration
*
* @var string
*/
const FILTER_QUERY_ARG = 'yoast_filter';
public const FILTER_QUERY_ARG = 'yoast_filter';
/**
* Modify the query based on the FILTER_QUERY_ARG variable in $_GET.
@@ -49,6 +49,8 @@ abstract class WPSEO_Abstract_Post_Filter implements WPSEO_WordPress_Integration
/**
* Registers the hooks.
*
* @return void
*/
public function register_hooks() {
add_action( 'admin_init', [ $this, 'add_filter_links' ], 11 );

View File

@@ -15,7 +15,7 @@ class WPSEO_Cornerstone_Filter extends WPSEO_Abstract_Post_Filter {
*
* @var string
*/
const META_NAME = 'is_cornerstone';
public const META_NAME = 'is_cornerstone';
/**
* Registers the hooks.
@@ -138,7 +138,7 @@ class WPSEO_Cornerstone_Filter extends WPSEO_Abstract_Post_Filter {
/**
* Filter: 'wpseo_cornerstone_post_types' - Filters post types to exclude the cornerstone feature for.
*
* @api array - The accessible post types to filter.
* @param array $post_types The accessible post types to filter.
*/
$post_types = apply_filters( 'wpseo_cornerstone_post_types', parent::get_post_types() );
if ( ! is_array( $post_types ) ) {

View File

@@ -71,7 +71,7 @@ class WPSEO_Metabox_Formatter {
'keywordTab' => __( 'Keyphrase:', 'wordpress-seo' ),
'removeKeyword' => __( 'Remove keyphrase', 'wordpress-seo' ),
'contentLocale' => get_locale(),
'userLocale' => \get_user_locale(),
'userLocale' => get_user_locale(),
'translations' => $this->get_translations(),
'keyword_usage' => [],
'title_template' => '',
@@ -231,7 +231,7 @@ class WPSEO_Metabox_Formatter {
private function get_content_analysis_component_translations() {
// Esc_html is not needed because React already handles HTML in the (translations of) these strings.
return [
'locale' => \get_user_locale(),
'locale' => get_user_locale(),
'content-analysis.errors' => __( 'Errors', 'wordpress-seo' ),
'content-analysis.problems' => __( 'Problems', 'wordpress-seo' ),
'content-analysis.improvements' => __( 'Improvements', 'wordpress-seo' ),
@@ -251,7 +251,7 @@ class WPSEO_Metabox_Formatter {
* @return array
*/
private function get_translations() {
$locale = \get_user_locale();
$locale = get_user_locale();
$file = WPSEO_PATH . 'languages/wordpress-seo-' . $locale . '.json';
if ( file_exists( $file ) ) {

View File

@@ -91,11 +91,10 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
/**
* Filter: 'wpseo_post_edit_values' - Allows changing the values Yoast SEO uses inside the post editor.
*
* @api array $values The key-value map Yoast SEO uses inside the post editor.
*
* @param array $values The key-value map Yoast SEO uses inside the post editor.
* @param WP_Post $post The post opened in the editor.
*/
return \apply_filters( 'wpseo_post_edit_values', $values, $this->post );
return apply_filters( 'wpseo_post_edit_values', $values, $this->post );
}
/**
@@ -295,7 +294,7 @@ class WPSEO_Post_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
* @param string $template_option_name The subname of the option in which the template you want to get is saved.
* @param string $post_type The name of the post type.
*/
return \apply_filters( 'wpseo_social_template_post_type', '', $template_option_name, $this->post->post_type );
return apply_filters( 'wpseo_social_template_post_type', '', $template_option_name, $this->post->post_type );
}
/**

View File

@@ -241,7 +241,7 @@ class WPSEO_Term_Metabox_Formatter implements WPSEO_Metabox_Formatter_Interface
* @param string $template_option_name The subname of the option in which the template you want to get is saved.
* @param string $taxonomy The name of the taxonomy.
*/
return \apply_filters( 'wpseo_social_template_taxonomy', '', $template_option_name, $this->term->taxonomy );
return apply_filters( 'wpseo_social_template_taxonomy', '', $template_option_name, $this->term->taxonomy );
}
/**

View File

@@ -15,7 +15,7 @@ class WPSEO_GSC {
*
* @var string
*/
const OPTION_WPSEO_GSC = 'wpseo-gsc';
public const OPTION_WPSEO_GSC = 'wpseo-gsc';
/**
* Outputs the HTML for the redirect page.

View File

@@ -21,6 +21,8 @@ class WPSEO_Import_Plugins_Detector {
/**
* Detects whether we need to import anything.
*
* @return void
*/
public function detect() {
foreach ( WPSEO_Plugin_Importers::get() as $importer_class ) {

View File

@@ -17,7 +17,7 @@ class WPSEO_Import_Settings {
*
* @var string
*/
const NONCE_ACTION = 'wpseo-import-settings';
public const NONCE_ACTION = 'wpseo-import-settings';
/**
* Holds the import status instance.
@@ -91,6 +91,8 @@ class WPSEO_Import_Settings {
* @param string $name Name string.
* @param array $option_group Option group data.
* @param array $options Options data.
*
* @return void
*/
protected function parse_option_group( $name, $option_group, $options ) {
// Make sure that the imported options are cleaned/converted on import.
@@ -104,6 +106,8 @@ class WPSEO_Import_Settings {
* Imports the options if found.
*
* @param array $options The options parsed from the provided settings.
*
* @return void
*/
protected function import_options( $options ) {
if ( isset( $options['wpseo']['version'] ) && $options['wpseo']['version'] !== '' ) {

View File

@@ -240,7 +240,7 @@ abstract class WPSEO_Plugin_Importer {
*/
protected function meta_keys_clone( $clone_keys ) {
foreach ( $clone_keys as $clone_key ) {
$result = $this->meta_key_clone( $clone_key['old_key'], $clone_key['new_key'], isset( $clone_key['convert'] ) ? $clone_key['convert'] : [] );
$result = $this->meta_key_clone( $clone_key['old_key'], $clone_key['new_key'], ( $clone_key['convert'] ?? [] ) );
if ( ! $result ) {
return false;
}
@@ -250,6 +250,8 @@ abstract class WPSEO_Plugin_Importer {
/**
* Sets the import status to false and returns a message about why it failed.
*
* @return void
*/
protected function set_missing_db_rights_status() {
$this->status->set_status( false );
@@ -279,6 +281,8 @@ abstract class WPSEO_Plugin_Importer {
* @param string $new_key The key to save.
* @param mixed $value The value to set the key to.
* @param int $post_id The Post to save the meta for.
*
* @return void
*/
protected function maybe_save_post_meta( $new_key, $value, $post_id ) {
// Big. Fat. Sigh. Mostly used for _yst_is_cornerstone, but might be useful for other hidden meta's.

View File

@@ -107,7 +107,7 @@ class WPSEO_Import_AIOSEO_V4 extends WPSEO_Plugin_Importer {
// Now, we'll also loop through the replace_vars array, which holds the mappings between the AiOSEO variables and the Yoast variables.
// We'll replace all the AiOSEO variables in the temporary table with their Yoast equivalents.
foreach ( $this->replace_vars as $aioseo_variable => $yoast_variable ) {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: We need this query and this is done at many other places as well, for example class-import-rankmath.
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: We need this query and this is done at many other places as well, for example class-import-rankmath.
$wpdb->query(
$wpdb->prepare(
'UPDATE tmp_meta_table SET meta_value = REPLACE( meta_value, %s, %s )',
@@ -146,7 +146,7 @@ class WPSEO_Import_AIOSEO_V4 extends WPSEO_Plugin_Importer {
foreach ( $meta_values as $meta_value ) {
// Find all custom field replace vars, store them in `$matches`.
\preg_match_all(
preg_match_all(
"/#$aioseo_prefix-([\w-]+)/",
$meta_value,
$matches
@@ -159,11 +159,11 @@ class WPSEO_Import_AIOSEO_V4 extends WPSEO_Plugin_Importer {
$custom_fields_or_taxonomies = $matches[1];
foreach ( $custom_fields_or_taxonomies as $custom_field_or_taxonomy ) {
$unique_custom_fields_or_taxonomies[ \trim( $custom_field_or_taxonomy ) ] = 1;
$unique_custom_fields_or_taxonomies[ trim( $custom_field_or_taxonomy ) ] = 1;
}
}
return \array_keys( $unique_custom_fields_or_taxonomies );
return array_keys( $unique_custom_fields_or_taxonomies );
}
/**
@@ -176,13 +176,15 @@ class WPSEO_Import_AIOSEO_V4 extends WPSEO_Plugin_Importer {
* @param string $aioseo_prefix The AiOSEO prefix to use
* (e.g. `custom-field` for custom fields or `tax_name` for custom taxonomies).
* @param string $yoast_prefix The Yoast prefix to use (e.g. `cf` for custom fields).
*
* @return void
*/
protected function replace_custom_field_or_taxonomy_replace_vars( $unique_custom_fields_or_taxonomies, $wpdb, $aioseo_prefix, $yoast_prefix ) {
foreach ( $unique_custom_fields_or_taxonomies as $unique_custom_field_or_taxonomy ) {
$aioseo_variable = "#{$aioseo_prefix}-{$unique_custom_field_or_taxonomy}";
$yoast_variable = "%%{$yoast_prefix}_{$unique_custom_field_or_taxonomy}%%";
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->query(
$wpdb->prepare(
'UPDATE tmp_meta_table SET meta_value = REPLACE( meta_value, %s, %s )',
@@ -193,7 +195,7 @@ class WPSEO_Import_AIOSEO_V4 extends WPSEO_Plugin_Importer {
}
}
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
// phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
/**
* Retrieve all the meta values from the temporary meta table that contain
@@ -214,7 +216,7 @@ class WPSEO_Import_AIOSEO_V4 extends WPSEO_Plugin_Importer {
);
}
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
// phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching
/**
* Detects whether there is AIOSEO data to import by looking whether the AIOSEO data have been cleaned up.

View File

@@ -96,6 +96,8 @@ class WPSEO_Import_AIOSEO extends WPSEO_Plugin_Importer {
* Imports the OpenGraph and Twitter settings for a single post.
*
* @param int $post_id Post ID.
*
* @return void
*/
private function import_post_opengraph( $post_id ) {
$meta = get_post_meta( $post_id, '_aioseop_opengraph_settings', true );

View File

@@ -109,6 +109,8 @@ class WPSEO_Import_RankMath extends WPSEO_Plugin_Importer {
/**
* RankMath stores robots meta quite differently, so we have to parse it out.
*
* @return void
*/
private function import_meta_robots() {
global $wpdb;
@@ -132,6 +134,8 @@ class WPSEO_Import_RankMath extends WPSEO_Plugin_Importer {
/**
* Imports some of the RankMath settings.
*
* @return void
*/
private function import_settings() {
$settings = [

View File

@@ -193,7 +193,12 @@ class WPSEO_Import_WPSEO extends WPSEO_Plugin_Importer {
* @return void
*/
private function import_taxonomy_metas() {
$terms = get_terms( get_taxonomies(), [ 'hide_empty' => false ] );
$terms = get_terms(
[
'taxonomy' => get_taxonomies(),
'hide_empty' => false,
]
);
$tax_meta = get_option( 'wpseo_taxonomy_meta' );
foreach ( $terms as $term ) {
@@ -291,7 +296,13 @@ class WPSEO_Import_WPSEO extends WPSEO_Plugin_Importer {
* @return void
*/
private function cleanup_term_meta() {
$terms = get_terms( get_taxonomies(), [ 'hide_empty' => false ] );
$terms = get_terms(
[
'taxonomy' => get_taxonomies(),
'hide_empty' => false,
]
);
foreach ( $terms as $term ) {
$this->delete_taxonomy_metas( $term->taxonomy, $term->term_id );
}

View File

@@ -22,6 +22,8 @@ class WPSEO_Admin_Menu extends WPSEO_Base_Menu {
/**
* Registers the menu item submenus.
*
* @return void
*/
public function register_settings_page() {
$manage_capability = $this->get_manage_capability();
@@ -99,7 +101,7 @@ class WPSEO_Admin_Menu extends WPSEO_Base_Menu {
/**
* Filter: 'wpseo_submenu_pages' - Collects all submenus that need to be shown.
*
* @api array $submenu_pages List with all submenu pages.
* @param array $submenu_pages List with all submenu pages.
*/
return (array) apply_filters( 'wpseo_submenu_pages', $submenu_pages );
}

View File

@@ -17,7 +17,7 @@ class WPSEO_Menu implements WPSEO_WordPress_Integration {
*
* @var string
*/
const PAGE_IDENTIFIER = 'wpseo_dashboard';
public const PAGE_IDENTIFIER = 'wpseo_dashboard';
/**
* List of classes that add admin functionality.

View File

@@ -132,6 +132,8 @@ class WPSEO_Replacevar_Editor {
* @param array $arguments The arguments to validate.
*
* @throws InvalidArgumentException Thrown when not all required arguments are present.
*
* @return void
*/
protected function validate_arguments( array $arguments ) {
$required_arguments = [

View File

@@ -72,6 +72,8 @@ abstract class WPSEO_Abstract_Metabox_Tab_With_Sections implements WPSEO_Metabox
/**
* Outputs the section link if any section has been added.
*
* @return void
*/
public function display_link() {
if ( $this->has_sections() ) {

View File

@@ -17,7 +17,7 @@ class WPSEO_Metabox_Analysis_Inclusive_Language implements WPSEO_Metabox_Analysi
*/
public function is_enabled() {
return $this->is_globally_enabled() && $this->is_user_enabled() && $this->is_current_version_supported()
&& YoastSEO()->helpers->language->has_inclusive_language_support( \WPSEO_Language_Utils::get_language( \get_locale() ) );
&& YoastSEO()->helpers->language->has_inclusive_language_support( WPSEO_Language_Utils::get_language( get_locale() ) );
}
/**
@@ -52,7 +52,7 @@ class WPSEO_Metabox_Analysis_Inclusive_Language implements WPSEO_Metabox_Analysi
$premium_version = YoastSEO()->helpers->product->get_premium_version();
return ! $is_premium
|| \version_compare( $premium_version, '19.6-RC0', '>=' )
|| \version_compare( $premium_version, '19.2', '==' );
|| version_compare( $premium_version, '19.6-RC0', '>=' )
|| version_compare( $premium_version, '19.2', '==' );
}
}

View File

@@ -34,6 +34,8 @@ class WPSEO_Metabox_Collapsibles_Sections extends WPSEO_Abstract_Metabox_Tab_Wit
/**
* Outputs the section content if any tab has been added.
*
* @return void
*/
public function display_content() {
if ( $this->has_sections() ) {

View File

@@ -14,6 +14,8 @@ class WPSEO_Metabox_Editor {
* Registers hooks to WordPress.
*
* @codeCoverageIgnore
*
* @return void
*/
public function register_hooks() {
// For the Classic editor.
@@ -51,6 +53,8 @@ class WPSEO_Metabox_Editor {
/**
* Enqueues the CSS to use in the TinyMCE editor.
*
* @return void
*/
public function add_editor_styles() {
$asset_manager = new WPSEO_Admin_Asset_Manager();

View File

@@ -19,6 +19,8 @@ class WPSEO_Metabox_Section_Inclusive_Language implements WPSEO_Metabox_Section
/**
* Outputs the section link.
*
* @return void
*/
public function display_link() {
printf(
@@ -31,6 +33,8 @@ class WPSEO_Metabox_Section_Inclusive_Language implements WPSEO_Metabox_Section
/**
* Outputs the section content.
*
* @return void
*/
public function display_content() {
printf(

View File

@@ -19,6 +19,8 @@ class WPSEO_Metabox_Section_Readability implements WPSEO_Metabox_Section {
/**
* Outputs the section link.
*
* @return void
*/
public function display_link() {
printf(
@@ -31,6 +33,8 @@ class WPSEO_Metabox_Section_Readability implements WPSEO_Metabox_Section {
/**
* Outputs the section content.
*
* @return void
*/
public function display_content() {
printf(

View File

@@ -12,6 +12,7 @@ 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;
use Yoast\WP\SEO\Promotions\Application\Promotion_Manager;
/**
* This class generates the metabox on the edit post / page as well as contains all page analysis functionality.
@@ -116,6 +117,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
/**
* Adds an alternative metabox for internet explorer users.
*
* @return void
*/
public function internet_explorer_metabox() {
$post_types = WPSEO_Post_Type::get_accessible_post_types();
@@ -166,6 +169,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
*
* IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
* the main meta box definition array in the class WPSEO_Meta() as well!!!!
*
* @return void
*/
public static function translate_meta_boxes() {
WPSEO_Meta::$meta_fields['general']['title']['title'] = __( 'SEO title', 'wordpress-seo' );
@@ -337,6 +342,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
/**
* Outputs the meta box.
*
* @return void
*/
public function meta_box() {
$this->render_hidden_fields();
@@ -370,7 +377,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
/**
* Filter: 'wpseo_content_meta_section_content' - Allow filtering the metabox content before outputting.
*
* @api string $post_content The metabox content string.
* @param string $post_content The metabox content string.
*/
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output should be escaped in the filter.
echo apply_filters( 'wpseo_content_meta_section_content', '' );
@@ -632,28 +639,28 @@ class WPSEO_Metabox extends WPSEO_Meta {
break;
case 'upload':
$content .= '<input' .
' id="' . $esc_form_key . '"' .
' type="text"' .
' size="36"' .
' class="' . $class . '"' .
' name="' . $esc_form_key . '"' .
' value="' . esc_attr( $meta_value ) . '"' . $aria_describedby .
' readonly="readonly"' .
' /> ';
$content .= '<input' .
' id="' . esc_attr( $esc_form_key ) . '_button"' .
' class="wpseo_image_upload_button button"' .
' data-target="' . esc_attr( $esc_form_key ) . '"' .
' data-target-id="' . esc_attr( $esc_form_key ) . '-id"' .
' type="button"' .
' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"' .
' /> ';
$content .= '<input' .
' class="wpseo_image_remove_button button"' .
' type="button"' .
' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"' .
' />';
$content .= '<input'
. ' id="' . $esc_form_key . '"'
. ' type="text"'
. ' size="36"'
. ' class="' . $class . '"'
. ' name="' . $esc_form_key . '"'
. ' value="' . esc_attr( $meta_value ) . '"' . $aria_describedby
. ' readonly="readonly"'
. ' /> ';
$content .= '<input'
. ' id="' . esc_attr( $esc_form_key ) . '_button"'
. ' class="wpseo_image_upload_button button"'
. ' data-target="' . esc_attr( $esc_form_key ) . '"'
. ' data-target-id="' . esc_attr( $esc_form_key ) . '-id"'
. ' type="button"'
. ' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"'
. ' /> ';
$content .= '<input'
. ' class="wpseo_image_remove_button button"'
. ' type="button"'
. ' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"'
. ' />';
break;
}
@@ -830,6 +837,8 @@ class WPSEO_Metabox extends WPSEO_Meta {
* Enqueues all the needed JS and CSS.
*
* @todo [JRF => whomever] Create css/metabox-mp6.css file and add it to the below allowed colors array when done.
*
* @return void
*/
public function enqueue() {
global $pagenow;
@@ -894,7 +903,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
],
'shortcodes' => [
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
],
];
@@ -917,28 +926,28 @@ class WPSEO_Metabox extends WPSEO_Meta {
// @todo replace this translation with JavaScript translations.
'media' => [ 'choose_image' => __( 'Use Image', 'wordpress-seo' ) ],
'metabox' => $this->get_metabox_script_data(),
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
'userLanguageCode' => WPSEO_Language_Utils::get_language( get_user_locale() ),
'isPost' => true,
'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' ),
'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(),
'currentPromotions' => YoastSEO()->classes->get( 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' ) : '',
'blackFridayBlockEditorUrl' => ( YoastSEO()->classes->get( 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,
'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() ),
'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' ) ) {
@@ -966,7 +975,7 @@ class WPSEO_Metabox extends WPSEO_Meta {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['post'] ) && is_string( $_GET['post'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, Sanitization happens in the validate_int function.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, Sanitization happens in the validate_int function.
$post_id = (int) WPSEO_Utils::validate_int( wp_unslash( $_GET['post'] ) );
$this->post = get_post( $post_id );

View File

@@ -12,11 +12,15 @@ interface WPSEO_Metabox_Section {
/**
* Outputs the section link.
*
* @return void
*/
public function display_link();
/**
* Outputs the section content.
*
* @return void
*/
public function display_content();
}

View File

@@ -71,19 +71,6 @@ if ( $tool_page === '' ) {
*/
do_action( 'wpseo_tools_overview_list_items_internal' );
/**
* Action: 'wpseo_tools_overview_list_items' - Hook to add additional tools to the overview.
*
* @deprecated 19.10 No replacement available.
*/
do_action_deprecated(
'wpseo_tools_overview_list_items',
[],
'19.10',
'',
'This action is going away with no replacement. If you want to add settings that interact with Yoast SEO, please create your own settings page.'
);
echo '</ul>';
}
else {

View File

@@ -15,7 +15,7 @@ class WPSEO_Statistics_Service {
*
* @var string
*/
const CACHE_TRANSIENT_KEY = 'wpseo-statistics-totals';
public const CACHE_TRANSIENT_KEY = 'wpseo-statistics-totals';
/**
* Class that generates interesting statistics about things.
@@ -47,7 +47,7 @@ class WPSEO_Statistics_Service {
*/
public function get_statistics() {
// Switch to the user locale with fallback to the site locale.
switch_to_locale( \get_user_locale() );
switch_to_locale( get_user_locale() );
$this->labels = $this->labels();
$statistics = $this->statistic_items();

View File

@@ -84,13 +84,13 @@ class WPSEO_Taxonomy_Columns {
$new_columns[ $column_name ] = $column_value;
if ( $column_name === 'description' && $this->analysis_seo->is_enabled() ) {
$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">' .
__( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
$new_columns['wpseo-score'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'SEO score', 'wordpress-seo' ) . '"><span class="yoast-column-seo-score yoast-column-header-has-tooltip"><span class="screen-reader-text">'
. __( 'SEO score', 'wordpress-seo' ) . '</span></span></span>';
}
if ( $column_name === 'description' && $this->analysis_readability->is_enabled() ) {
$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">' .
__( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
$new_columns['wpseo-score-readability'] = '<span class="yoast-tooltip yoast-tooltip-n yoast-tooltip-alt" data-label="' . esc_attr__( 'Readability score', 'wordpress-seo' ) . '"><span class="yoast-column-readability yoast-column-header-has-tooltip"><span class="screen-reader-text">'
. __( 'Readability score', 'wordpress-seo' ) . '</span></span></span>';
}
}
@@ -125,18 +125,16 @@ class WPSEO_Taxonomy_Columns {
* @return string|null The current taxonomy or null when it is not set.
*/
public function get_current_taxonomy() {
// phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
// phpcs:disable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( ! empty( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) {
if ( isset( $_POST['taxonomy'] ) && is_string( $_POST['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_POST['taxonomy'] ) );
}
}
else {
if ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
elseif ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
}
// phpcs:enable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
// phpcs:enable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended
return null;
}
@@ -146,18 +144,16 @@ class WPSEO_Taxonomy_Columns {
* @return string|null
*/
private function get_taxonomy() {
// phpcs:disable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
// phpcs:disable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( wp_doing_ajax() ) {
if ( isset( $_POST['taxonomy'] ) && is_string( $_POST['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_POST['taxonomy'] ) );
}
}
else {
if ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
elseif ( isset( $_GET['taxonomy'] ) && is_string( $_GET['taxonomy'] ) ) {
return sanitize_text_field( wp_unslash( $_GET['taxonomy'] ) );
}
}
// phpcs:enable WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
// phpcs:enable WordPress.Security.NonceVerification.Missing,WordPress.Security.NonceVerification.Recommended
return null;
}

View File

@@ -60,8 +60,8 @@ class WPSEO_Taxonomy_Fields_Presenter {
$label = $this->get_label( $field_configuration['label'], $esc_field_name );
$field = $this->get_field( $field_configuration['type'], $esc_field_name, $this->get_field_value( $field_name ), $options );
$help_content = isset( $field_configuration['options']['help'] ) ? $field_configuration['options']['help'] : '';
$help_button_text = isset( $field_configuration['options']['help-button'] ) ? $field_configuration['options']['help-button'] : '';
$help_content = ( $field_configuration['options']['help'] ?? '' );
$help_button_text = ( $field_configuration['options']['help-button'] ?? '' );
$help = new WPSEO_Admin_Help_Panel( $field_name, $help_button_text, $help_content );
return $this->parse_row( $label, $help, $field );
@@ -110,28 +110,28 @@ class WPSEO_Taxonomy_Fields_Presenter {
$field .= '<textarea class="large-text" rows="' . esc_attr( $rows ) . '" id="' . $field_name . '" name="' . $field_name . '"' . $aria_describedby . '>' . esc_textarea( $field_value ) . '</textarea>';
break;
case 'upload':
$field .= '<input' .
' id="' . $field_name . '"' .
' type="text"' .
' size="36"' .
' name="' . $field_name . '"' .
' value="' . esc_attr( $field_value ) . '"' . $aria_describedby . '' .
' readonly="readonly"' .
' /> ';
$field .= '<input' .
' id="' . esc_attr( $field_name ) . '_button"' .
' class="wpseo_image_upload_button button"' .
' data-target="' . esc_attr( $field_name ) . '"' .
' data-target-id="hidden_' . esc_attr( $field_name ) . '-id"' .
' type="button"' .
' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"' .
' /> ';
$field .= '<input' .
' id="' . esc_attr( $field_name ) . '_button"' .
' class="wpseo_image_remove_button button"' .
' type="button"' .
' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"' .
' />';
$field .= '<input'
. ' id="' . $field_name . '"'
. ' type="text"'
. ' size="36"'
. ' name="' . $field_name . '"'
. ' value="' . esc_attr( $field_value ) . '"' . $aria_describedby . ''
. ' readonly="readonly"'
. ' /> ';
$field .= '<input'
. ' id="' . esc_attr( $field_name ) . '_button"'
. ' class="wpseo_image_upload_button button"'
. ' data-target="' . esc_attr( $field_name ) . '"'
. ' data-target-id="hidden_' . esc_attr( $field_name ) . '-id"'
. ' type="button"'
. ' value="' . esc_attr__( 'Upload Image', 'wordpress-seo' ) . '"'
. ' /> ';
$field .= '<input'
. ' id="' . esc_attr( $field_name ) . '_button"'
. ' class="wpseo_image_remove_button button"'
. ' type="button"'
. ' value="' . esc_attr__( 'Clear Image', 'wordpress-seo' ) . '"'
. ' />';
break;
case 'select':
if ( is_array( $options ) && $options !== [] ) {

View File

@@ -98,7 +98,7 @@ class WPSEO_Taxonomy_Fields {
/**
* Filter: 'wpseo_taxonomy_content_fields' - Adds the possibility to register additional content fields.
*
* @api array - The additional fields.
* @param array $additional_fields The additional fields.
*/
$additional_fields = apply_filters( 'wpseo_taxonomy_content_fields', [] );

View File

@@ -70,6 +70,8 @@ class WPSEO_Taxonomy_Metabox {
/**
* Shows the Yoast SEO metabox for the term.
*
* @return void
*/
public function display() {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Reason: $this->get_product_title() returns a hard-coded string.

View File

@@ -60,6 +60,8 @@ class WPSEO_Taxonomy {
/**
* Add hooks late enough for taxonomy object to be available for checks.
*
* @return void
*/
public function admin_init() {
@@ -80,6 +82,8 @@ class WPSEO_Taxonomy {
* Show the SEO inputs for term.
*
* @param stdClass|WP_Term $term Term to show the edit boxes for.
*
* @return void
*/
public function term_metabox( $term ) {
if ( WPSEO_Metabox::is_internet_explorer() ) {
@@ -121,6 +125,8 @@ class WPSEO_Taxonomy {
* Queue assets for taxonomy screens.
*
* @since 1.5.0
*
* @return void
*/
public function admin_enqueue_scripts() {
@@ -165,7 +171,7 @@ class WPSEO_Taxonomy {
],
'shortcodes' => [
'wpseo_shortcode_tags' => $this->get_valid_shortcode_tags(),
'wpseo_filter_shortcodes_nonce' => \wp_create_nonce( 'wpseo-filter-shortcodes' ),
'wpseo_filter_shortcodes_nonce' => wp_create_nonce( 'wpseo-filter-shortcodes' ),
],
],
'worker' => [
@@ -180,10 +186,10 @@ class WPSEO_Taxonomy {
'choose_image' => __( 'Use Image', 'wordpress-seo' ),
],
'metabox' => $this->localize_term_scraper_script( $tag_id ),
'userLanguageCode' => WPSEO_Language_Utils::get_language( \get_user_locale() ),
'userLanguageCode' => WPSEO_Language_Utils::get_language( get_user_locale() ),
'isTerm' => true,
'postId' => $tag_id,
'usedKeywordsNonce' => \wp_create_nonce( 'wpseo-keyword-usage' ),
'usedKeywordsNonce' => wp_create_nonce( 'wpseo-keyword-usage' ),
'linkParams' => WPSEO_Shortlinker::get_query_params(),
];
$asset_manager->localize_script( 'term-edit', 'wpseoScriptData', $script_data );
@@ -201,6 +207,8 @@ class WPSEO_Taxonomy {
* @param int $term_id ID of the term to save data for.
* @param int $tt_id The taxonomy_term_id for the term.
* @param string $taxonomy The taxonomy the term belongs to.
*
* @return void
*/
public function update_term( $term_id, $tt_id, $taxonomy ) {
// Bail if this is a multisite installation and the site has been switched.
@@ -213,8 +221,8 @@ class WPSEO_Taxonomy {
foreach ( WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: Nonce is already checked by WordPress before executing this action.
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $data is getting sanitized later.
$data = \wp_unslash( $_POST[ $key ] );
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $data is getting sanitized later.
$data = wp_unslash( $_POST[ $key ] );
$new_meta_data[ $key ] = ( $key !== 'wpseo_canonical' ) ? WPSEO_Utils::sanitize_text_field( $data ) : WPSEO_Utils::sanitize_url( $data );
}
@@ -252,6 +260,8 @@ class WPSEO_Taxonomy {
/**
* Allows post-kses-filtered HTML in term descriptions.
*
* @return void
*/
public function custom_category_descriptions_allow_html() {
remove_filter( 'term_description', 'wp_kses_data' );
@@ -262,6 +272,8 @@ class WPSEO_Taxonomy {
/**
* Output the WordPress editor.
*
* @return void
*/
public function custom_category_description_editor() {
wp_editor( '', 'description' );
@@ -389,7 +401,7 @@ class WPSEO_Taxonomy {
private static function get_tag_id() {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: We are not processing form information.
if ( isset( $_GET['tag_ID'] ) && is_string( $_GET['tag_ID'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are casting to an integer.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information, We are casting to an integer.
$tag_id = (int) wp_unslash( $_GET['tag_ID'] );
if ( $tag_id > 0 ) {
return $tag_id;

View File

@@ -85,11 +85,11 @@ class WPSEO_Tracking_Addon_Data implements WPSEO_Collection {
* @return array
*/
public function get_addon_settings( array $addon_settings, $source_name, $slug, $option_include_list ) {
$source_options = \get_option( $source_name, [] );
if ( ! \is_array( $source_options ) || empty( $source_options ) ) {
$source_options = get_option( $source_name, [] );
if ( ! is_array( $source_options ) || empty( $source_options ) ) {
return $addon_settings;
}
$addon_settings[ $slug ] = \array_intersect_key( $source_options, \array_flip( $option_include_list ) );
$addon_settings[ $slug ] = array_intersect_key( $source_options, array_flip( $option_include_list ) );
return $addon_settings;
}
@@ -107,13 +107,13 @@ class WPSEO_Tracking_Addon_Data implements WPSEO_Collection {
* @return array
*/
public function get_local_addon_settings( array $addon_settings, $source_name, $slug, $option_include_list ) {
$source_options = \get_option( $source_name, [] );
if ( ! \is_array( $source_options ) || empty( $source_options ) ) {
$source_options = get_option( $source_name, [] );
if ( ! is_array( $source_options ) || empty( $source_options ) ) {
return $addon_settings;
}
$addon_settings[ $slug ] = \array_intersect_key( $source_options, \array_flip( $option_include_list ) );
$addon_settings[ $slug ] = array_intersect_key( $source_options, array_flip( $option_include_list ) );
if ( \array_key_exists( 'use_multiple_locations', $source_options ) && \array_key_exists( 'business_type', $addon_settings[ $slug ] ) && $source_options['use_multiple_locations'] === 'on' && $source_options['multiple_locations_shared_business_info'] === 'off' ) {
if ( array_key_exists( 'use_multiple_locations', $source_options ) && array_key_exists( 'business_type', $addon_settings[ $slug ] ) && $source_options['use_multiple_locations'] === 'on' && $source_options['multiple_locations_shared_business_info'] === 'off' ) {
$addon_settings[ $slug ]['business_type'] = 'multiple_locations';
}

View File

@@ -61,7 +61,7 @@ class WPSEO_Tracking_Plugin_Data implements WPSEO_Collection {
public function set_auto_update_plugin_list() {
$auto_update_plugins = [];
$auto_update_plugin_files = \get_option( 'auto_update_plugins' );
$auto_update_plugin_files = get_option( 'auto_update_plugins' );
if ( $auto_update_plugin_files ) {
foreach ( $auto_update_plugin_files as $auto_update_plugin ) {
$data = get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $auto_update_plugin );
@@ -84,7 +84,7 @@ class WPSEO_Tracking_Plugin_Data implements WPSEO_Collection {
return [
'name' => $plugin['Name'],
'version' => $plugin['Version'],
'auto_updating' => \array_key_exists( $plugin['Name'], $this->auto_update_plugin_list ),
'auto_updating' => array_key_exists( $plugin['Name'], $this->auto_update_plugin_list ),
];
}
}

View File

@@ -246,7 +246,7 @@ class WPSEO_Tracking_Settings_Data implements WPSEO_Collection {
/**
* Filter: 'wpseo_tracking_settings_include_list' - Allow filtering the settings included in tracking.
*
* @api string $include_list the list with included setting names.
* @param string $include_list The list with included setting names.
*/
$this->include_list = apply_filters( 'wpseo_tracking_settings_include_list', $this->include_list );

View File

@@ -59,6 +59,8 @@ class WPSEO_Tracking implements WPSEO_WordPress_Integration {
/**
* Registers all hooks to WordPress.
*
* @return void
*/
public function register_hooks() {
if ( ! $this->tracking_enabled() ) {
@@ -110,6 +112,8 @@ class WPSEO_Tracking implements WPSEO_WordPress_Integration {
*
* @param bool $force Whether to send the tracking data ignoring the two
* weeks time threshold. Default false.
*
* @return void
*/
public function send( $force = false ) {
if ( ! $this->should_send_tracking( $force ) ) {
@@ -216,7 +220,7 @@ class WPSEO_Tracking implements WPSEO_WordPress_Integration {
/**
* Filter: 'wpseo_enable_tracking' - Enables the data tracking of Yoast SEO Premium and add-ons.
*
* @api string $is_enabled The enabled state. Default is false.
* @param string $is_enabled The enabled state. Default is false.
*/
$tracking = apply_filters( 'wpseo_enable_tracking', false );

View File

@@ -238,7 +238,7 @@ class Yoast_Feature_Toggles {
$out = '<div id="yoast-seo-sitemaps-disabled-warning" style="display:none;">';
$alert = new Alert_Presenter(
/* translators: %1$s: expands to an opening anchor tag, %2$s: expands to a closing anchor tag */
\sprintf( esc_html__( 'Disabling Yoast SEO\'s XML sitemaps will not disable WordPress\' core sitemaps. In some cases, this %1$s may result in SEO errors on your site%2$s. These may be reported in Google Search Console and other tools.', 'wordpress-seo' ), '<a target="_blank" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/44z' ) . '">', '</a>' ),
sprintf( esc_html__( 'Disabling Yoast SEO\'s XML sitemaps will not disable WordPress\' core sitemaps. In some cases, this %1$s may result in SEO errors on your site%2$s. These may be reported in Google Search Console and other tools.', 'wordpress-seo' ), '<a target="_blank" href="' . WPSEO_Shortlinker::get( 'https://yoa.st/44z' ) . '">', '</a>' ),
'warning'
);
$out .= $alert->present();

View File

@@ -62,6 +62,8 @@ class Yoast_Input_Select {
/**
* Print the rendered view.
*
* @return void
*/
public function output_html() {
// Extract it, because we want each value accessible via a variable instead of accessing it as an array.
@@ -91,6 +93,8 @@ class Yoast_Input_Select {
*
* @param string $attribute The name of the attribute to add.
* @param string $value The value of the attribute.
*
* @return void
*/
public function add_attribute( $attribute, $value ) {
$this->select_attributes[ $attribute ] = $value;
@@ -133,6 +137,8 @@ class Yoast_Input_Select {
*
* @param string $value The value of the attribute.
* @param string $attribute The attribute to look for.
*
* @return void
*/
private function parse_attribute( &$value, $attribute ) {
$value = sprintf( '%s="%s"', sanitize_key( $attribute ), esc_attr( $value ) );

View File

@@ -75,12 +75,12 @@ class Yoast_Integration_Toggles {
],
(object) [
/* translators: %s: Algolia. */
'name' => \sprintf( \esc_html__( '%s integration', 'wordpress-seo' ), 'Algolia' ),
'name' => sprintf( esc_html__( '%s integration', 'wordpress-seo' ), 'Algolia' ),
'premium' => true,
'setting' => 'algolia_integration_active',
'label' => __( 'Improve the quality of your site search! Automatically helps your users find your cornerstone and most important content in your internal search results. It also removes noindexed posts & pages from your sites search results.', 'wordpress-seo' ),
/* translators: %s: Algolia. */
'read_more_label' => \sprintf( \__( 'Find out more about our %s integration.', 'wordpress-seo' ), 'Algolia' ),
'read_more_label' => sprintf( __( 'Find out more about our %s integration.', 'wordpress-seo' ), 'Algolia' ),
'read_more_url' => 'https://yoa.st/4eu',
'premium_url' => 'https://yoa.st/4ex',
'premium_upsell_url' => 'https://yoa.st/get-algolia-integration',

View File

@@ -140,7 +140,6 @@ if ( YoastSEO()->classes->get( Promotion_Manager::class )->is( 'black-friday-202
$sale_badge = '<div class="yoast-seo-premium-extension-sale-badge">' . $sale_badge_span . '</div>';
$premium_sale_badge = ( $has_valid_premium_subscription ) ? '' : $sale_badge;
}
?>

View File

@@ -14,12 +14,12 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
?>
<div class="wrap yoast wpseo-admin-page page-wpseo_redirects">
<h1 id="wpseo-title"><?php echo \esc_html( \get_admin_page_title() ); ?></h1>
<h1 id="wpseo-title"><?php echo esc_html( get_admin_page_title() ); ?></h1>
<div class="wpseo_content_wrapper" style="position: relative;">
<div style="position: absolute;top: 0;bottom: 0;left: 0;right: 0;z-index: 100; display: flex;justify-content: center;align-items: center;background: radial-gradient(#ffffffcf 20%, #ffffff00 50%);">
<a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo \esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/redirect-manager-upsell' ) ); ?>" target="_blank">
<a class="yoast-button-upsell" data-action="load-nfd-ctb" data-ctb-id="f6a84663-465f-4cb5-8ba5-f7a6d72224b2" href="<?php echo esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/redirect-manager-upsell' ) ); ?>" target="_blank">
<?php
echo \esc_html__( 'Unlock with Premium', 'wordpress-seo' )
echo esc_html__( 'Unlock with Premium', 'wordpress-seo' )
// phpcs:ignore WordPress.Security.EscapeOutput -- Already escapes correctly.
. WPSEO_Admin_Utils::get_new_tab_message();
?>
@@ -29,17 +29,17 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<h2 class="nav-tab-wrapper" id="wpseo-tabs">
<a class="nav-tab nav-tab-active" id="tab-url-tab" href="#" tabindex="-1">
<?php
\esc_html_e( 'Redirects', 'wordpress-seo' )
esc_html_e( 'Redirects', 'wordpress-seo' )
?>
</a>
<a class="nav-tab" id="tab-url-tab" href="" tabindex="-1">
<?php
\esc_html_e( 'Regex Redirects', 'wordpress-seo' )
esc_html_e( 'Regex Redirects', 'wordpress-seo' )
?>
</a>
<a class="nav-tab" id="tab-url-tab" href="#" tabindex="-1">
<?php
\esc_html_e( 'Settings', 'wordpress-seo' )
esc_html_e( 'Settings', 'wordpress-seo' )
?>
</a>
</h2>
@@ -47,7 +47,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<div id="table-plain" class="tab-url redirect-table-tab">
<h2>
<?php
\esc_html_e( 'Plain redirects', 'wordpress-seo' )
esc_html_e( 'Plain redirects', 'wordpress-seo' )
?>
</h2>
<form class="wpseo-new-redirect-form" method="post">
@@ -56,14 +56,14 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<label class="textinput" for="wpseo_redirects_type">
<span class="title">
<?php
\esc_html_e( 'Type', 'wordpress-seo' )
esc_html_e( 'Type', 'wordpress-seo' )
?>
</span>
</label>
<select name="wpseo_redirects_type" id="wpseo_redirects_type" class="select select2-hidden-accessible" data-select2-id="wpseo_redirects_type" tabindex="-1" aria-hidden="true">
<option value="301" data-select2-id="2">
<?php
\esc_html_e( '301 Moved Permanently', 'wordpress-seo' )
esc_html_e( '301 Moved Permanently', 'wordpress-seo' )
?>
</option>
</select>
@@ -72,7 +72,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<span class="select2-selection select2-selection--single" role="combobox" aria-haspopup="true" aria-expanded="false" tabindex="-1" aria-disabled="false" aria-labelledby="select2-wpseo_redirects_type-container">
<span class="select2-selection__rendered" id="select2-wpseo_redirects_type-container" role="textbox" aria-readonly="true" title="301 Moved Permanently">
<?php
\esc_html_e( '301 Moved Permanently', 'wordpress-seo' )
esc_html_e( '301 Moved Permanently', 'wordpress-seo' )
?>
</span>
<span class="select2-selection__arrow" role="presentation">
@@ -97,7 +97,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<label class="textinput" for="wpseo_redirects_origin">
<span class="title">
<?php
\esc_html_e( 'Old URL', 'wordpress-seo' )
esc_html_e( 'Old URL', 'wordpress-seo' )
?>
</span>
</label>
@@ -109,7 +109,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<label class="textinput" for="wpseo_redirects_target">
<span class="title">
<?php
\esc_html_e( 'URL', 'wordpress-seo' )
esc_html_e( 'URL', 'wordpress-seo' )
?>
</span>
</label>
@@ -119,7 +119,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<button type="button" class="button button-primary" tabindex="-1">
<?php
\esc_html_e( 'Add Redirect', 'wordpress-seo' )
esc_html_e( 'Add Redirect', 'wordpress-seo' )
?>
</button>
</div>
@@ -134,11 +134,11 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<select name="redirect-type" id="filter-by-redirect" tabindex="-1">
<option selected="selected" value="0">
<?php
\esc_html_e( 'All redirect types', 'wordpress-seo' )
esc_html_e( 'All redirect types', 'wordpress-seo' )
?>
</option>
</select>
<input type="button" name="filter_action" id="post-query-submit" class="button" value="<?php \esc_attr_e( 'Filter', 'wordpress-seo' ); ?>" tabindex="-1">
<input type="button" name="filter_action" id="post-query-submit" class="button" value="<?php esc_attr_e( 'Filter', 'wordpress-seo' ); ?>" tabindex="-1">
</div>
<br class="clear">
</div>
@@ -152,7 +152,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<a href="#" tabindex="-1">
<span>
<?php
\esc_html_e( 'Type', 'wordpress-seo' )
esc_html_e( 'Type', 'wordpress-seo' )
?>
</span>
<span class="sorting-indicator"></span>
@@ -162,7 +162,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<a href="#" tabindex="-1">
<span>
<?php
\esc_html_e( 'Old URL', 'wordpress-seo' )
esc_html_e( 'Old URL', 'wordpress-seo' )
?>
</span>
<span class="sorting-indicator"></span>
@@ -172,7 +172,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<a href="#" tabindex="-1">
<span>
<?php
\esc_html_e( 'New URL', 'wordpress-seo' )
esc_html_e( 'New URL', 'wordpress-seo' )
?>
</span>
<span class="sorting-indicator"></span>
@@ -185,7 +185,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<tr class="no-items">
<td class="colspanchange" colspan="4">
<?php
\esc_html_e( 'No items found.', 'wordpress-seo' )
esc_html_e( 'No items found.', 'wordpress-seo' )
?>
</td>
</tr>
@@ -200,7 +200,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<a href="#" tabindex="-1">
<span>
<?php
\esc_html_e( 'Type', 'wordpress-seo' )
esc_html_e( 'Type', 'wordpress-seo' )
?>
</span>
<span class="sorting-indicator"></span></a>
@@ -209,7 +209,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<a href="#" tabindex="-1">
<span>
<?php
\esc_html_e( 'Old URL', 'wordpress-seo' )
esc_html_e( 'Old URL', 'wordpress-seo' )
?>
</span>
<span class="sorting-indicator"></span>
@@ -219,7 +219,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
<a href="#" tabindex="-1">
<span>
<?php
\esc_html_e( 'New URL', 'wordpress-seo' )
esc_html_e( 'New URL', 'wordpress-seo' )
?>
</span>
<span class="sorting-indicator"></span></a>

View File

@@ -18,18 +18,3 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
* Don't use it in your code as it will be removed shortly.
*/
do_action( 'wpseo_settings_tab_site_analysis_internal', $yform );
/**
* Fires when displaying the site wide analysis tab.
*
* @deprecated 19.10 No replacement available.
*
* @param Yoast_Form $yform The yoast form object.
*/
do_action_deprecated(
'wpseo_settings_tab_site_analysis',
[ $yform ],
'19.10',
'',
'This action is going away with no replacement. If you want to add settings that interact with Yoast SEO, please create your own settings page.'
);

View File

@@ -19,14 +19,14 @@ $feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
<h2><?php esc_html_e( 'Crawl settings', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
echo sprintf(
printf(
/* translators: %s expands to Yoast SEO */
esc_html__( 'This tab allows you to selectively disable %s features for all sites in the network. By default all features are enabled, which allows site admins to choose for themselves if they want to toggle a feature on or off for their site. When you disable a feature here, site admins will not be able to use that feature at all.', 'wordpress-seo' ),
'Yoast SEO'
);
echo '<p style="margin: 0.5em 0 1em;">';
echo sprintf(
printf(
/* translators: %1$s opens the link to the Yoast.com article about Crawl settings, %2$s closes the link, */
esc_html__( '%1$sLearn more about crawl settings.%2$s', 'wordpress-seo' ),
'<a href="' . esc_url( WPSEO_Shortlinker::get( 'https://yoa.st/crawl-settings' ) ) . '" target="_blank" rel="noopener noreferrer">',

View File

@@ -22,7 +22,7 @@ $feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
<h2><?php esc_html_e( 'Features', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
echo sprintf(
printf(
/* translators: %s expands to Yoast SEO */
esc_html__( 'This tab allows you to selectively disable %s features for all sites in the network. By default all features are enabled, which allows site admins to choose for themselves if they want to toggle a feature on or off for their site. When you disable a feature here, site admins will not be able to use that feature at all.', 'wordpress-seo' ),
'Yoast SEO'
@@ -33,7 +33,7 @@ $feature_toggles = Yoast_Feature_Toggles::instance()->get_all();
$premium_version = YoastSEO()->helpers->product->get_premium_version();
if ( $feature->premium && $feature->premium_version ) {
$not_supported_in_current_premium_version = $is_premium && \version_compare( $premium_version, $feature->premium_version, '<' );
$not_supported_in_current_premium_version = $is_premium && version_compare( $premium_version, $feature->premium_version, '<' );
if ( $not_supported_in_current_premium_version ) {
continue;

View File

@@ -22,7 +22,7 @@ $integration_toggles = Yoast_Integration_Toggles::instance()->get_all();
<h2><?php esc_html_e( 'Integrations', 'wordpress-seo' ); ?></h2>
<div class="yoast-measure">
<?php
echo sprintf(
printf(
/* translators: %1$s expands to Yoast SEO */
esc_html__( 'This tab allows you to selectively disable %1$s integrations with third-party products for all sites in the network. By default all integrations are enabled, which allows site admins to choose for themselves if they want to toggle an integration on or off for their site. When you disable an integration here, site admins will not be able to use that integration at all.', 'wordpress-seo' ),
'Yoast SEO'

View File

@@ -83,18 +83,6 @@ function wpseo_import_external_select( $name, $plugins ) {
*/
do_action( 'wpseo_import_other_plugins_internal' );
/**
* Hook used to import other plugins.
*
* @deprecated 19.10 No replacement available.
*/
do_action_deprecated(
'wpseo_import_other_plugins',
[],
'19.10',
'',
'This action is going away with no replacement. If you want to add settings that interact with Yoast SEO, please create your own settings page.'
);
?>
<input type="submit" class="button button-primary" name="import_external"
value="<?php esc_attr_e( 'Import', 'wordpress-seo' ); ?>"/>

View File

@@ -14,7 +14,7 @@ if ( ! defined( 'WPSEO_VERSION' ) ) {
/* translators: %1$s expands to Yoast SEO */
$submit_button_value = sprintf( __( 'Export your %1$s settings', 'wordpress-seo' ), 'Yoast SEO' );
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: The nonce will be verified in WPSEO_Export below, We are only strictly comparing with '1'.
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: The nonce will be verified in WPSEO_Export below, We are only strictly comparing with '1'.
if ( isset( $_POST['do_export'] ) && wp_unslash( $_POST['do_export'] ) === '1' ) {
$export = new WPSEO_Export();
$export->export();

View File

@@ -81,6 +81,8 @@ if ( ! empty( $_REQUEST['_wp_http_referer'] ) && isset( $_SERVER['REQUEST_URI']
*
* @param WPSEO_Bulk_List_Table $table The table to render.
* @param string $id The id for the tab.
*
* @return void
*/
function wpseo_get_rendered_tab( $table, $id ) {
?>

View File

@@ -51,7 +51,7 @@ elseif ( isset( $_POST['settings_import'] ) && wp_unslash( $_POST['settings_impo
/**
* Allow custom import actions.
*
* @api WPSEO_Import_Status $yoast_seo_import Contains info about the handled import.
* @param WPSEO_Import_Status $yoast_seo_import Contains info about the handled import.
*/
$yoast_seo_import = apply_filters( 'wpseo_handle_import', $yoast_seo_import );
@@ -65,7 +65,7 @@ if ( $yoast_seo_import ) {
/**
* Allow customization of import/export message.
*
* @api string $yoast_seo_msg The message.
* @param string $yoast_seo_msg The message.
*/
$yoast_seo_msg = apply_filters( 'wpseo_import_message', $yoast_seo_message );

View File

@@ -105,7 +105,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
return;
}
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
$term = get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
$term_label = $this->get_taxonomy_label_for_term( $term->term_id );
/* translators: %1$s expands to the translated name of the term. */
@@ -145,7 +145,7 @@ class WPSEO_Slug_Change_Watcher implements WPSEO_WordPress_Integration {
* @return bool Whether the term is viewable or not.
*/
protected function is_term_viewable( $term_taxonomy_id ) {
$term = \get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
$term = get_term_by( 'term_taxonomy_id', (int) $term_taxonomy_id );
if ( ! $term || is_wp_error( $term ) ) {
return false;

View File

@@ -0,0 +1 @@
.seo_page_wpseo_page_academy{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity));z-index:-1}.seo_page_wpseo_page_academy #wpcontent{padding-right:0!important}.seo_page_wpseo_page_academy #wpfooter{padding-left:1rem}@media (min-width:768px){.seo_page_wpseo_page_academy #wpfooter{padding-right:17rem;padding-left:2rem}}@media screen and (max-width:782px){.seo_page_wpseo_page_academy .wp-responsive-open #wpbody{left:-190px}}

View File

@@ -0,0 +1 @@
.seo_page_wpseo_page_academy{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity));z-index:-1}.seo_page_wpseo_page_academy #wpcontent{padding-left:0!important}.seo_page_wpseo_page_academy #wpfooter{padding-right:1rem}@media (min-width:768px){.seo_page_wpseo_page_academy #wpfooter{padding-left:17rem;padding-right:2rem}}@media screen and (max-width:782px){.seo_page_wpseo_page_academy .wp-responsive-open #wpbody{right:-190px}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
.wpseo-score-icon{background:#888;border-radius:50%!important;display:inline-block!important;height:12px!important;margin:3px 3px 0 10px;vertical-align:top;width:12px!important}.wpseo-score-icon.good{background-color:#7ad03a}.wpseo-score-icon.ok{background-color:#ee7c1b}.wpseo-score-icon.bad{background-color:#dc3232}.wpseo-score-icon.na{background-color:#888}.wpseo-score-icon.noindex{background-color:#1e8cbe}#wp-admin-bar-wpseo-menu .wpseo-score-icon{margin:10px 4px 0 0!important}#wp-admin-bar-wpseo-menu .wpseo-score-icon.adminbar-sub-menu-score{margin:11px 4px 0 0!important}#wp-admin-bar-wpseo-menu-default .ab-item{line-height:2.46153846!important}#wp-admin-bar-wpseo-menu .ab-submenu{margin-bottom:5px}#wpadminbar .quicklinks #wp-admin-bar-wpseo-menu #wp-admin-bar-wpseo-menu-default li#wp-admin-bar-wpseo-get-premium a{color:#fff!important;font-weight:700!important}#wpadminbar .quicklinks #wp-admin-bar-wpseo-menu #wp-admin-bar-wpseo-menu-default li#wp-admin-bar-wpseo-get-premium span{background:#1f2937;border:1px solid #fcd34d;border-radius:14px;color:#fcd34d;font-size:13px;font-weight:600;padding:1px 4px}#wpadminbar .yoast-menu-bf-sale-badge{background-color:#1f2937;border:1px solid #fcd34d;border-radius:8px;color:#fcd34d;font-size:10px;font-weight:600;line-height:normal;margin-right:5px;padding:2px 8px}#wpadminbar .quicklinks #wp-admin-bar-wpseo-menu .wpseo-focus-keyword{display:inline-block!important;max-width:100px!important;overflow:hidden;text-overflow:ellipsis!important;vertical-align:bottom;white-space:nowrap}#wpadminbar .yoast-badge{border-radius:8px;display:inline-block;font-weight:600;line-height:1.6;margin-right:4px;padding:0 8px}#wpadminbar .yoast-beta-badge{background-color:#cce5ff;color:#004973}#wpadminbar .yoast-premium-badge{background-color:#fff3cd;color:#674e00}#wpadminbar .yoast-issue-added,#wpadminbar .yoast-issue-added:hover{background-color:#a4286a;border-radius:10px 0 10px 10px;box-shadow:-1px 1px 1px 1px grey;color:#fff;right:0;padding:2px 12px;position:absolute;top:32px;white-space:nowrap}#wpadminbar .yoast-issue-added{display:none}#wpadminbar .yoast-issue-counter{background-color:#d63638;border-radius:9px;color:#fff;display:inline;padding:1px 6px 1px 7px!important}#wpadminbar .yoast-logo.svg{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHN0eWxlPSJmaWxsOiM4Mjg3OGMiIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMjAzLjYgMzk1YzYuOC0xNy40IDYuOC0zNi42IDAtNTRsLTc5LjQtMjA0aDcwLjlsNDcuNyAxNDkuNCA3NC44LTIwNy42SDExNi40Yy00MS44IDAtNzYgMzQuMi03NiA3NlYzNTdjMCA0MS44IDM0LjIgNzYgNzYgNzZIMTczYzE2LTguOSAyNC42LTIyLjcgMzAuNi0zOHpNNDcxLjYgMTU0LjhjMC00MS44LTM0LjItNzYtNzYtNzZoLTNMMjg1LjcgMzY1Yy05LjYgMjYuNy0xOS40IDQ5LjMtMzAuMyA2OGgyMTYuMlYxNTQuOHoiLz48cGF0aCBkPSJtMzM4IDEuMy05My4zIDI1OS4xLTQyLjEtMTMxLjloLTg5LjFsODMuOCAyMTUuMmM2IDE1LjUgNiAzMi41IDAgNDgtNy40IDE5LTE5IDM3LjMtNTMgNDEuOWwtNy4yIDF2NzZoOC4zYzgxLjcgMCAxMTguOS01Ny4yIDE0OS42LTE0Mi45TDQzMS42IDEuM0gzMzh6TTI3OS40IDM2MmMtMzIuOSA5Mi02Ny42IDEyOC43LTEyNS43IDEzMS44di00NWMzNy41LTcuNSA1MS4zLTMxIDU5LjEtNTEuMSA3LjUtMTkuMyA3LjUtNDAuNyAwLTYwbC03NS0xOTIuN2g1Mi44bDUzLjMgMTY2LjggMTA1LjktMjk0aDU4LjFMMjc5LjQgMzYyeiIvPjwvc3ZnPg==");background-position:100% 6px;background-repeat:no-repeat;background-size:20px;float:right;height:30px;width:26px}#wpadminbar #wp-admin-bar-wpseo-licenses .ab-item{color:#f18500}@media screen and (max-width:782px){#wp-admin-bar-wpseo-menu .wpseo-score-icon{margin:16px 2px 0 10px!important}#wpadminbar #wp-admin-bar-wpseo-menu{display:block;position:static}#wpadminbar .yoast-logo.svg{background-position:50% 8px;background-size:30px;height:46px;width:52px}#wpadminbar .yoast-logo+.yoast-issue-counter{margin-right:-5px;margin-left:10px}#wpadminbar .ab-sub-wrapper .yoast-issue-counter{position:relative;top:-5px;vertical-align:text-top}#wpadminbar .yoast-issue-added,#wpadminbar .yoast-issue-added:hover{line-height:1.8;top:46px;white-space:normal}#wp-admin-bar-wpseo-menu.menupop .ab-sub-wrapper #wp-admin-bar-wpseo-kwresearch,#wp-admin-bar-wpseo-menu.menupop .ab-sub-wrapper #wp-admin-bar-wpseo-settings{display:none}}

Some files were not shown because too many files have changed in this diff Show More