Ticket #27421: formatting.php.patch
File formatting.php.patch, 1.3 KB (added by , 9 years ago) |
---|
-
formatting.php
2041 2041 } 2042 2042 2043 2043 /** 2044 * Navigates through an array, object, or scalar, and adds slashes to the values. 2045 * 2046 * @since 4.4.3 2047 * 2048 * @param mixed $value The value to be slashed. 2049 * @return mixed Slashed value. 2050 */ 2051 function addslashes_deep( $value ) { 2052 return map_deep( $value, 'addslashes_to_strings_only' ); 2053 } 2054 2055 /** 2056 * Callback function for `addslashes_deep()` which adds slashes to strings. 2057 * 2058 * @since 4.4.3 2059 * 2060 * @param mixed $value The array or string to be slashed. 2061 * @return mixed $value The slashed value. 2062 */ 2063 function addslashes_to_strings_only( $value ) { 2064 return is_string( $value ) ? addslashes( $value ) : $value; 2065 } 2066 2067 /** 2044 2068 * Navigates through an array, object, or scalar, and encodes the values to be used in a URL. 2045 2069 * 2046 2070 * @since 2.2.0 … … 4394 4418 * @return string|array Slashed $value 4395 4419 */ 4396 4420 function wp_slash( $value ) { 4397 if ( is_array( $value ) ) { 4398 foreach ( $value as $k => $v ) { 4399 if ( is_array( $v ) ) { 4400 $value[$k] = wp_slash( $v ); 4401 } else { 4402 $value[$k] = addslashes( $v ); 4403 } 4404 } 4405 } else { 4406 $value = addslashes( $value ); 4407 } 4408 4409 return $value; 4421 return addslashes_deep( $value ); 4410 4422 } 4411 4423 4412 4424 /**