PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / jetpack_vendor / automattic / jetpack-device-detection / src / functions.php

functions.php in Jetpack – WP Security, Backup, Speed, & Growth 16.2, at jetpack_vendor/automattic/jetpack-device-detection/src/functions.php

37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Utility functions for device detection.
4 *
5 * @package automattic/jetpack-device-detection
6 */
7
8 namespace Automattic\Jetpack\Device_Detection;
9
10 // Check if the function is already defined, in case someone bypassed the autoloader or something
11 // to get the two classes from different copies of the package.
12 if ( ! function_exists( __NAMESPACE__ . '\\wp_unslash' ) ) {
13
14 /**
15 * A wrapper for WordPress's `wp_unslash()`.
16 *
17 * Even though PHP itself dropped the option to add slashes to superglobals a decade ago,
18 * WordPress still does it through some misguided extreme backwards compatibility. 🙄
19 *
20 * If WordPress's function exists, assume it needs to be called.
21 * Else if on WordPress.com, do a simplified version because we're running really early.
22 * Else, assume it's not needed.
23 *
24 * @param string $value String of data to unslash.
25 * @return string Possibly unslashed $value.
26 */
27 function wp_unslash( $value ) {
28 if ( function_exists( '\\wp_unslash' ) ) {
29 return \wp_unslash( $value );
30 } elseif ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
31 return stripslashes( $value );
32 } else {
33 return $value;
34 }
35 }
36 }
37