updated plugin Jetpack Protect version 1.1.2

This commit is contained in:
2022-12-19 23:08:19 +00:00
committed by Gitium
parent dcc5b4d910
commit 7b2202370c
91 changed files with 1019 additions and 656 deletions

View File

@ -7,25 +7,30 @@
namespace Automattic\Jetpack\Device_Detection;
/**
* A wrapper for WordPress's `wp_unslash()`.
*
* Even though PHP itself dropped the option to add slashes to superglobals a decade ago,
* WordPress still does it through some misguided extreme backwards compatibility. 🙄
*
* If WordPress's function exists, assume it needs to be called.
* Else if on WordPress.com, do a simplified version because we're running really early.
* Else, assume it's not needed.
*
* @param string $value String of data to unslash.
* @return string Possibly unslashed $value.
*/
function wp_unslash( $value ) {
if ( function_exists( '\\wp_unslash' ) ) {
return \wp_unslash( $value );
} elseif ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
return stripslashes( $value );
} else {
return $value;
// Check if the function is already defined, in case someone bypassed the autoloader or something
// to get the two classes from different copies of the package.
if ( ! function_exists( __NAMESPACE__ . '\\wp_unslash' ) ) {
/**
* A wrapper for WordPress's `wp_unslash()`.
*
* Even though PHP itself dropped the option to add slashes to superglobals a decade ago,
* WordPress still does it through some misguided extreme backwards compatibility. 🙄
*
* If WordPress's function exists, assume it needs to be called.
* Else if on WordPress.com, do a simplified version because we're running really early.
* Else, assume it's not needed.
*
* @param string $value String of data to unslash.
* @return string Possibly unslashed $value.
*/
function wp_unslash( $value ) {
if ( function_exists( '\\wp_unslash' ) ) {
return \wp_unslash( $value );
} elseif ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
return stripslashes( $value );
} else {
return $value;
}
}
}