Changeset 48433
- Timestamp:
- 07/11/2020 12:11:57 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r48432 r48433 5497 5497 5498 5498 /** 5499 * Add slashes to a string or array of strings .5499 * Add slashes to a string or array of strings, in a recursive manner. 5500 5500 * 5501 5501 * This should be used when preparing data for core API that expects slashed data. … … 5503 5503 * 5504 5504 * @since 3.6.0 5505 * @since 5.5.0 Leave a non-string value untouched. 5505 5506 * 5506 5507 * @param string|array $value String or array of strings to slash. … … 5509 5510 function wp_slash( $value ) { 5510 5511 if ( is_array( $value ) ) { 5511 foreach ( $value as $k => $v ) { 5512 if ( is_array( $v ) ) { 5513 $value[ $k ] = wp_slash( $v ); 5514 } else { 5515 $value[ $k ] = addslashes( $v ); 5516 } 5517 } 5518 } else { 5519 $value = addslashes( $value ); 5512 $value = array_map( 'wp_slash', $value ); 5513 } 5514 5515 if ( is_string( $value ) ) { 5516 return addslashes( $value ); 5520 5517 } 5521 5518 -
trunk/tests/phpunit/tests/formatting/StripSlashesDeep.php
r47122 r48433 3 3 /** 4 4 * @group formatting 5 * @group slashes 5 6 */ 6 7 class Tests_Formatting_StripSlashesDeep extends WP_UnitTestCase {
Note: See TracChangeset
for help on using the changeset viewer.