wordpress-importer
Last commit date
parsers
8 months ago
class-wp-import.php
1 year ago
compat.php
3 years ago
parsers.php
8 months ago
readme.txt
8 months ago
wordpress-importer.php
8 months ago
compat.php
40 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Implementation for WordPress functions missing in older WordPress versions. |
| 4 | * |
| 5 | * @package WordPress |
| 6 | * @subpackage Importer |
| 7 | */ |
| 8 | |
| 9 | if ( ! function_exists( 'wp_slash_strings_only' ) ) { |
| 10 | /** |
| 11 | * Adds slashes to only string values in an array of values. |
| 12 | * |
| 13 | * Compat for WordPress < 5.3.0. |
| 14 | * |
| 15 | * @since 0.7.0 |
| 16 | * |
| 17 | * @param mixed $value Scalar or array of scalars. |
| 18 | * @return mixed Slashes $value |
| 19 | */ |
| 20 | function wp_slash_strings_only( $value ) { |
| 21 | return map_deep( $value, 'addslashes_strings_only' ); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | if ( ! function_exists( 'addslashes_strings_only' ) ) { |
| 26 | /** |
| 27 | * Adds slashes only if the provided value is a string. |
| 28 | * |
| 29 | * Compat for WordPress < 5.3.0. |
| 30 | * |
| 31 | * @since 0.7.0 |
| 32 | * |
| 33 | * @param mixed $value |
| 34 | * @return mixed |
| 35 | */ |
| 36 | function addslashes_strings_only( $value ) { |
| 37 | return is_string( $value ) ? addslashes( $value ) : $value; |
| 38 | } |
| 39 | } |
| 40 |