| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
/** |
| 6 |
* Implementation for WordPress functions missing in older WordPress versions. |
| 7 |
* |
| 8 |
* @package WordPress |
| 9 |
* @subpackage Importer |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! function_exists( 'solace_extra_wp_slash_strings_only' ) ) { |
| 13 |
/** |
| 14 |
* Adds slashes to only string values in an array of values. |
| 15 |
* |
| 16 |
* Compat for WordPress < 5.3.0. |
| 17 |
* |
| 18 |
* @since 0.7.0 |
| 19 |
* |
| 20 |
* @param mixed $value Scalar or array of scalars. |
| 21 |
* @return mixed Slashes $value |
| 22 |
*/ |
| 23 |
function solace_extra_wp_slash_strings_only( $value ) { |
| 24 |
return map_deep( $value, 'solace_extra_addslashes_strings_only' ); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
if ( ! function_exists( 'solace_extra_addslashes_strings_only' ) ) { |
| 29 |
/** |
| 30 |
* Adds slashes only if the provided value is a string. |
| 31 |
* |
| 32 |
* Compat for WordPress < 5.3.0. |
| 33 |
* |
| 34 |
* @since 0.7.0 |
| 35 |
* |
| 36 |
* @param mixed $value |
| 37 |
* @return mixed |
| 38 |
*/ |
| 39 |
function solace_extra_addslashes_strings_only( $value ) { |
| 40 |
return is_string( $value ) ? addslashes( $value ) : $value; |
| 41 |
} |
| 42 |
} |
| 43 |
|