diff options
Diffstat (limited to 'plugins/jetpack/jetpack_vendor/automattic/jetpack-waf/src/functions.php')
-rw-r--r-- | plugins/jetpack/jetpack_vendor/automattic/jetpack-waf/src/functions.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-waf/src/functions.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-waf/src/functions.php new file mode 100644 index 00000000..a8112fd9 --- /dev/null +++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-waf/src/functions.php @@ -0,0 +1,27 @@ +<?php +/** + * Utility functions for WAF. + * + * @package automattic/jetpack-waf + */ + +namespace Automattic\Jetpack\Waf; + +/** + * 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. If not, assume it doesn't. + * + * @param string|array $value String or array of data to unslash. + * @return string|array Possibly unslashed $value. + */ +function wp_unslash( $value ) { + if ( function_exists( '\\wp_unslash' ) ) { + return \wp_unslash( $value ); + } else { + return $value; + } +} |