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

@@ -15,7 +15,7 @@ if ( ! function_exists( 'add_filter' ) ) {
* {@internal Nobody should be able to overrule the real version number as this can cause
* serious issues with the options, so no if ( ! defined() ).}}
*/
define( 'WPSEO_VERSION', '21.8.1' );
define( 'WPSEO_VERSION', '21.9' );
if ( ! defined( 'WPSEO_PATH' ) ) {
@@ -36,7 +36,7 @@ define( 'YOAST_VENDOR_PREFIX_DIRECTORY', 'vendor_prefixed' );
define( 'YOAST_SEO_PHP_REQUIRED', '7.2.5' );
define( 'YOAST_SEO_WP_TESTED', '6.4.2' );
define( 'YOAST_SEO_WP_REQUIRED', '6.2' );
define( 'YOAST_SEO_WP_REQUIRED', '6.3' );
if ( ! defined( 'WPSEO_NAMESPACES' ) ) {
define( 'WPSEO_NAMESPACES', true );
@@ -116,7 +116,7 @@ if ( YOAST_ENVIRONMENT === 'development' && isset( $yoast_autoloader ) ) {
*
* @return void
*/
static function() use ( $yoast_autoloader ) {
static function () use ( $yoast_autoloader ) {
$yoast_autoloader->unregister();
$yoast_autoloader->register( true );
},
@@ -137,6 +137,8 @@ if ( ! defined( 'WPSEO_CSSJS_SUFFIX' ) ) {
* Run single site / network-wide activation of the plugin.
*
* @param bool $networkwide Whether the plugin is being activated network-wide.
*
* @return void
*/
function wpseo_activate( $networkwide = false ) {
if ( ! is_multisite() || ! $networkwide ) {
@@ -155,6 +157,8 @@ function wpseo_activate( $networkwide = false ) {
* Run single site / network-wide de-activation of the plugin.
*
* @param bool $networkwide Whether the plugin is being de-activated network-wide.
*
* @return void
*/
function wpseo_deactivate( $networkwide = false ) {
if ( ! is_multisite() || ! $networkwide ) {
@@ -170,6 +174,8 @@ function wpseo_deactivate( $networkwide = false ) {
* Run network-wide (de-)activation of the plugin.
*
* @param bool $activate True for plugin activation, false for de-activation.
*
* @return void
*/
function wpseo_network_activate_deactivate( $activate = true ) {
global $wpdb;
@@ -194,6 +200,8 @@ function wpseo_network_activate_deactivate( $activate = true ) {
/**
* Runs on activation of the plugin.
*
* @return void
*/
function _wpseo_activate() {
require_once WPSEO_PATH . 'inc/wpseo-functions.php';
@@ -212,16 +220,13 @@ function _wpseo_activate() {
}
WPSEO_Options::ensure_options_exist();
if ( is_multisite() && ms_is_switched() ) {
update_option( 'rewrite_rules', '' );
}
else {
if ( ! is_multisite() || ! ms_is_switched() ) {
if ( WPSEO_Options::get( 'stripcategorybase' ) === true ) {
// Constructor has side effects so this registers all hooks.
$GLOBALS['wpseo_rewrite'] = new WPSEO_Rewrite();
}
add_action( 'shutdown', 'flush_rewrite_rules' );
}
add_action( 'shutdown', 'flush_rewrite_rules' );
WPSEO_Options::set( 'indexing_reason', 'first_install' );
WPSEO_Options::set( 'first_time_install', true );
@@ -250,16 +255,13 @@ function _wpseo_activate() {
/**
* On deactivation, flush the rewrite rules so XML sitemaps stop working.
*
* @return void
*/
function _wpseo_deactivate() {
require_once WPSEO_PATH . 'inc/wpseo-functions.php';
if ( is_multisite() && ms_is_switched() ) {
update_option( 'rewrite_rules', '' );
}
else {
add_action( 'shutdown', 'flush_rewrite_rules' );
}
add_action( 'shutdown', 'flush_rewrite_rules' );
// Register capabilities, to make sure they are cleaned up.
do_action( 'wpseo_register_roles' );
@@ -285,6 +287,8 @@ function _wpseo_deactivate() {
* {@link https://core.trac.wordpress.org/ticket/24205} }}
*
* @param int|WP_Site $blog_id Blog ID.
*
* @return void
*/
function wpseo_on_activate_blog( $blog_id ) {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
@@ -306,6 +310,8 @@ function wpseo_on_activate_blog( $blog_id ) {
/**
* Load translations.
*
* @return void
*/
function wpseo_load_textdomain() {
$wpseo_path = str_replace( '\\', '/', WPSEO_PATH );
@@ -324,6 +330,8 @@ add_action( 'plugins_loaded', 'wpseo_load_textdomain' );
/**
* On plugins_loaded: load the minimum amount of essential files for this plugin.
*
* @return void
*/
function wpseo_init() {
require_once WPSEO_PATH . 'inc/wpseo-functions.php';
@@ -334,9 +342,28 @@ function wpseo_init() {
WPSEO_Meta::init();
if ( version_compare( WPSEO_Options::get( 'version', 1 ), WPSEO_VERSION, '<' ) ) {
if ( function_exists( 'opcache_reset' ) ) {
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- Prevent notices when opcache.restrict_api is set.
@opcache_reset();
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
require_once ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
require_once ABSPATH . 'wp-admin/includes/file.php';
WP_Filesystem();
/*
* We invalidate each subdir and the main files instead of the whole `wordpress-seo` dir
* to avoid any timeout or resource exhaustion when building from source.
*/
if ( function_exists( 'wp_opcache_invalidate' ) ) {
// Since WP 5.5.
wp_opcache_invalidate( WPSEO_PATH . 'wp-seo-main.php' );
wp_opcache_invalidate( WPSEO_PATH . 'wp-seo.php' );
}
if ( function_exists( 'wp_opcache_invalidate_directory' ) ) {
// Since WP 6.2.
wp_opcache_invalidate_directory( WPSEO_PATH . 'admin' );
wp_opcache_invalidate_directory( WPSEO_PATH . 'inc' );
wp_opcache_invalidate_directory( WPSEO_PATH . 'lib' );
wp_opcache_invalidate_directory( WPSEO_PATH . 'src' );
wp_opcache_invalidate_directory( WPSEO_PATH . 'vendor' );
wp_opcache_invalidate_directory( WPSEO_PATH . 'vendor_prefixed' );
}
new WPSEO_Upgrade();
@@ -368,6 +395,8 @@ function wpseo_init() {
/**
* Loads the rest api endpoints.
*
* @return void
*/
function wpseo_init_rest_api() {
// We can't do anything when requirements are not met.
@@ -389,6 +418,8 @@ function wpseo_init_rest_api() {
/**
* Used to load the required files on the plugins_loaded hook, instead of immediately.
*
* @return void
*/
function wpseo_admin_init() {
new WPSEO_Admin_Init();
@@ -408,6 +439,7 @@ if ( ! $filter_exists ) {
if ( ! wp_installing() && ( $spl_autoload_exists && $filter_exists ) ) {
add_action( 'plugins_loaded', 'wpseo_init', 14 );
add_action( 'setup_theme', [ 'Yoast_Dynamic_Rewrites', 'instance' ], 1 );
add_action( 'rest_api_init', 'wpseo_init_rest_api' );
if ( is_admin() ) {
@@ -425,7 +457,7 @@ if ( ! wp_installing() && ( $spl_autoload_exists && $filter_exists ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: We are not processing form information but only loading the admin init class.
if ( isset( $_POST['action'] ) && is_string( $_POST['action'] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information but only loading the admin init class, We are strictly comparing only.
// phpcs:ignore WordPress.Security.NonceVerification.Missing,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are not processing form information but only loading the admin init class, We are strictly comparing only.
if ( wp_unslash( $_POST['action'] ) === 'inline-save' ) {
add_action( 'plugins_loaded', 'wpseo_admin_init', 15 );
}
@@ -466,6 +498,8 @@ $wpseo_register_capabilities->register_hooks();
/**
* Wraps for notifications center class.
*
* @return void
*/
function load_yoast_notifications() {
// Init Yoast_Notification_Center class.
@@ -490,6 +524,8 @@ function yoast_wpseo_missing_spl() {
/**
* Returns the notice in case of missing spl extension.
*
* @return void
*/
function yoast_wpseo_missing_spl_notice() {
$message = esc_html__( 'The Standard PHP Library (SPL) extension seem to be unavailable. Please ask your web host to enable it.', 'wordpress-seo' );
@@ -511,6 +547,8 @@ function yoast_wpseo_missing_autoload() {
/**
* Returns the notice in case of missing Composer autoload.
*
* @return void
*/
function yoast_wpseo_missing_autoload_notice() {
/* translators: %1$s expands to Yoast SEO, %2$s / %3$s: links to the installation manual in the Readme for the Yoast SEO code repository on GitHub */
@@ -536,6 +574,8 @@ function yoast_wpseo_missing_filter() {
/**
* Returns the notice in case of missing filter extension.
*
* @return void
*/
function yoast_wpseo_missing_filter_notice() {
$message = esc_html__( 'The filter extension seem to be unavailable. Please ask your web host to enable it.', 'wordpress-seo' );
@@ -546,6 +586,8 @@ function yoast_wpseo_missing_filter_notice() {
* Echo's the Activation failed notice with any given message.
*
* @param string $message Message string.
*
* @return void
*/
function yoast_wpseo_activation_failed_notice( $message ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- This function is only called in 3 places that are safe.
@@ -554,6 +596,8 @@ function yoast_wpseo_activation_failed_notice( $message ) {
/**
* The method will deactivate the plugin, but only once, done by the static $is_deactivated.
*
* @return void
*/
function yoast_wpseo_self_deactivate() {
static $is_deactivated;