Code Modernization: Rename parameters that use reserved keywords in `wp-includes/formatting.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit: * Renames the `$string` parameter to `$text` in: * `_wp_specialchars()` * `wp_specialchars_decode()` * `wp_check_invalid_utf8()` * `remove_accents()` * `_split_str_by_whitespace()` * `wp_strip_all_tags()` * Renames the `$string` parameter to `$value` in: * `backslashit()` * `trailingslashit()` * `untrailingslashit()` * Renames the `$string` parameter to `$subject` in `wp_iso_descrambler()`. * Renames the `$match` parameter to `$matches` in `_wp_iso_convert()`. * Renames the `$string` parameter to `$date_string` in: * `get_gmt_from_date()` * `get_date_from_gmt()` * Renames the `$string` parameter to`$input` in `wp_parse_str()`. * Renames the `$string` parameter to `$content` in `wp_pre_kses_block_attributes()`. * Amends the `$text` parameter in `wp_pre_kses_less_than()` for consistency. Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #56788. Built from https://develop.svn.wordpress.org/trunk@54927 git-svn-id: http://core.svn.wordpress.org/trunk@54479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
73bd837100
commit
868f939367
|
@ -918,7 +918,7 @@ function seems_utf8( $str ) {
|
||||||
* @since 5.5.0 `$quote_style` also accepts `ENT_XML1`.
|
* @since 5.5.0 `$quote_style` also accepts `ENT_XML1`.
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param string $string The text which is to be encoded.
|
* @param string $text The text which is to be encoded.
|
||||||
* @param int|string $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
|
* @param int|string $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
|
||||||
* both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
|
* both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES.
|
||||||
* Converts single and double quotes, as well as converting HTML
|
* Converts single and double quotes, as well as converting HTML
|
||||||
|
@ -931,16 +931,16 @@ function seems_utf8( $str ) {
|
||||||
* @param bool $double_encode Optional. Whether to encode existing HTML entities. Default false.
|
* @param bool $double_encode Optional. Whether to encode existing HTML entities. Default false.
|
||||||
* @return string The encoded text with HTML entities.
|
* @return string The encoded text with HTML entities.
|
||||||
*/
|
*/
|
||||||
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
function _wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
||||||
$string = (string) $string;
|
$text = (string) $text;
|
||||||
|
|
||||||
if ( 0 === strlen( $string ) ) {
|
if ( 0 === strlen( $text ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't bother if there are no specialchars - saves some processing.
|
// Don't bother if there are no specialchars - saves some processing.
|
||||||
if ( ! preg_match( '/[&<>"\']/', $string ) ) {
|
if ( ! preg_match( '/[&<>"\']/', $text ) ) {
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Account for the previous behavior of the function when the $quote_style is not an accepted value.
|
// Account for the previous behavior of the function when the $quote_style is not an accepted value.
|
||||||
|
@ -978,17 +978,17 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
|
||||||
if ( ! $double_encode ) {
|
if ( ! $double_encode ) {
|
||||||
// Guarantee every &entity; is valid, convert &garbage; into &garbage;
|
// Guarantee every &entity; is valid, convert &garbage; into &garbage;
|
||||||
// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
|
// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
|
||||||
$string = wp_kses_normalize_entities( $string, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
|
$text = wp_kses_normalize_entities( $text, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$string = htmlspecialchars( $string, $quote_style, $charset, $double_encode );
|
$text = htmlspecialchars( $text, $quote_style, $charset, $double_encode );
|
||||||
|
|
||||||
// Back-compat.
|
// Back-compat.
|
||||||
if ( 'single' === $_quote_style ) {
|
if ( 'single' === $_quote_style ) {
|
||||||
$string = str_replace( "'", ''', $string );
|
$text = str_replace( "'", ''', $text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1001,7 +1001,7 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param string $string The text which is to be decoded.
|
* @param string $text The text which is to be decoded.
|
||||||
* @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
|
* @param string|int $quote_style Optional. Converts double quotes if set to ENT_COMPAT,
|
||||||
* both single and double if set to ENT_QUOTES or
|
* both single and double if set to ENT_QUOTES or
|
||||||
* none if set to ENT_NOQUOTES.
|
* none if set to ENT_NOQUOTES.
|
||||||
|
@ -1011,16 +1011,16 @@ function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = fals
|
||||||
* Default is ENT_NOQUOTES.
|
* Default is ENT_NOQUOTES.
|
||||||
* @return string The decoded text without HTML entities.
|
* @return string The decoded text without HTML entities.
|
||||||
*/
|
*/
|
||||||
function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
|
function wp_specialchars_decode( $text, $quote_style = ENT_NOQUOTES ) {
|
||||||
$string = (string) $string;
|
$text = (string) $text;
|
||||||
|
|
||||||
if ( 0 === strlen( $string ) ) {
|
if ( 0 === strlen( $text ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't bother if there are no entities - saves a lot of processing.
|
// Don't bother if there are no entities - saves a lot of processing.
|
||||||
if ( strpos( $string, '&' ) === false ) {
|
if ( strpos( $text, '&' ) === false ) {
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match the previous behavior of _wp_specialchars() when the $quote_style is not an accepted value.
|
// Match the previous behavior of _wp_specialchars() when the $quote_style is not an accepted value.
|
||||||
|
@ -1079,10 +1079,10 @@ function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove zero padding on numeric entities.
|
// Remove zero padding on numeric entities.
|
||||||
$string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
|
$text = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $text );
|
||||||
|
|
||||||
// Replace characters according to translation table.
|
// Replace characters according to translation table.
|
||||||
return strtr( $string, $translation );
|
return strtr( $text, $translation );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1090,14 +1090,14 @@ function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param string $string The text which is to be checked.
|
* @param string $text The text which is to be checked.
|
||||||
* @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default false.
|
* @param bool $strip Optional. Whether to attempt to strip out invalid UTF8. Default false.
|
||||||
* @return string The checked text.
|
* @return string The checked text.
|
||||||
*/
|
*/
|
||||||
function wp_check_invalid_utf8( $string, $strip = false ) {
|
function wp_check_invalid_utf8( $text, $strip = false ) {
|
||||||
$string = (string) $string;
|
$text = (string) $text;
|
||||||
|
|
||||||
if ( 0 === strlen( $string ) ) {
|
if ( 0 === strlen( $text ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1107,7 +1107,7 @@ function wp_check_invalid_utf8( $string, $strip = false ) {
|
||||||
$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true );
|
$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ), true );
|
||||||
}
|
}
|
||||||
if ( ! $is_utf8 ) {
|
if ( ! $is_utf8 ) {
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for support for utf8 in the installed PCRE library once and store the result in a static.
|
// Check for support for utf8 in the installed PCRE library once and store the result in a static.
|
||||||
|
@ -1118,17 +1118,17 @@ function wp_check_invalid_utf8( $string, $strip = false ) {
|
||||||
}
|
}
|
||||||
// We can't demand utf8 in the PCRE installation, so just return the string in those cases.
|
// We can't demand utf8 in the PCRE installation, so just return the string in those cases.
|
||||||
if ( ! $utf8_pcre ) {
|
if ( ! $utf8_pcre ) {
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- preg_match fails when it encounters invalid UTF8 in $string.
|
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- preg_match fails when it encounters invalid UTF8 in $text.
|
||||||
if ( 1 === @preg_match( '/^./us', $string ) ) {
|
if ( 1 === @preg_match( '/^./us', $text ) ) {
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to strip the bad chars if requested (not recommended).
|
// Attempt to strip the bad chars if requested (not recommended).
|
||||||
if ( $strip && function_exists( 'iconv' ) ) {
|
if ( $strip && function_exists( 'iconv' ) ) {
|
||||||
return iconv( 'utf-8', 'utf-8', $string );
|
return iconv( 'utf-8', 'utf-8', $text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
@ -1586,26 +1586,26 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
|
||||||
* @since 6.0.0 Added the `$locale` parameter.
|
* @since 6.0.0 Added the `$locale` parameter.
|
||||||
* @since 6.1.0 Added Unicode NFC encoding normalization support.
|
* @since 6.1.0 Added Unicode NFC encoding normalization support.
|
||||||
*
|
*
|
||||||
* @param string $string Text that might have accent characters.
|
* @param string $text Text that might have accent characters.
|
||||||
* @param string $locale Optional. The locale to use for accent removal. Some character
|
* @param string $locale Optional. The locale to use for accent removal. Some character
|
||||||
* replacements depend on the locale being used (e.g. 'de_DE').
|
* replacements depend on the locale being used (e.g. 'de_DE').
|
||||||
* Defaults to the current locale.
|
* Defaults to the current locale.
|
||||||
* @return string Filtered string with replaced "nice" characters.
|
* @return string Filtered string with replaced "nice" characters.
|
||||||
*/
|
*/
|
||||||
function remove_accents( $string, $locale = '' ) {
|
function remove_accents( $text, $locale = '' ) {
|
||||||
if ( ! preg_match( '/[\x80-\xff]/', $string ) ) {
|
if ( ! preg_match( '/[\x80-\xff]/', $text ) ) {
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( seems_utf8( $string ) ) {
|
if ( seems_utf8( $text ) ) {
|
||||||
|
|
||||||
// Unicode sequence normalization from NFD (Normalization Form Decomposed)
|
// Unicode sequence normalization from NFD (Normalization Form Decomposed)
|
||||||
// to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
|
// to NFC (Normalization Form [Pre]Composed), the encoding used in this function.
|
||||||
if ( function_exists( 'normalizer_is_normalized' )
|
if ( function_exists( 'normalizer_is_normalized' )
|
||||||
&& function_exists( 'normalizer_normalize' )
|
&& function_exists( 'normalizer_normalize' )
|
||||||
) {
|
) {
|
||||||
if ( ! normalizer_is_normalized( $string ) ) {
|
if ( ! normalizer_is_normalized( $text ) ) {
|
||||||
$string = normalizer_normalize( $string );
|
$text = normalizer_normalize( $text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1970,7 +1970,7 @@ function remove_accents( $string, $locale = '' ) {
|
||||||
$chars['đ'] = 'dj';
|
$chars['đ'] = 'dj';
|
||||||
}
|
}
|
||||||
|
|
||||||
$string = strtr( $string, $chars );
|
$text = strtr( $text, $chars );
|
||||||
} else {
|
} else {
|
||||||
$chars = array();
|
$chars = array();
|
||||||
// Assume ISO-8859-1 if not UTF-8.
|
// Assume ISO-8859-1 if not UTF-8.
|
||||||
|
@ -1987,14 +1987,14 @@ function remove_accents( $string, $locale = '' ) {
|
||||||
|
|
||||||
$chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy';
|
$chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy';
|
||||||
|
|
||||||
$string = strtr( $string, $chars['in'], $chars['out'] );
|
$text = strtr( $text, $chars['in'], $chars['out'] );
|
||||||
$double_chars = array();
|
$double_chars = array();
|
||||||
$double_chars['in'] = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" );
|
$double_chars['in'] = array( "\x8c", "\x9c", "\xc6", "\xd0", "\xde", "\xdf", "\xe6", "\xf0", "\xfe" );
|
||||||
$double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' );
|
$double_chars['out'] = array( 'OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th' );
|
||||||
$string = str_replace( $double_chars['in'], $double_chars['out'], $string );
|
$text = str_replace( $double_chars['in'], $double_chars['out'], $text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2742,14 +2742,14 @@ function zeroise( $number, $threshold ) {
|
||||||
*
|
*
|
||||||
* @since 0.71
|
* @since 0.71
|
||||||
*
|
*
|
||||||
* @param string $string Value to which backslashes will be added.
|
* @param string $value Value to which backslashes will be added.
|
||||||
* @return string String with backslashes inserted.
|
* @return string String with backslashes inserted.
|
||||||
*/
|
*/
|
||||||
function backslashit( $string ) {
|
function backslashit( $value ) {
|
||||||
if ( isset( $string[0] ) && $string[0] >= '0' && $string[0] <= '9' ) {
|
if ( isset( $value[0] ) && $value[0] >= '0' && $value[0] <= '9' ) {
|
||||||
$string = '\\\\' . $string;
|
$value = '\\\\' . $value;
|
||||||
}
|
}
|
||||||
return addcslashes( $string, 'A..Za..z' );
|
return addcslashes( $value, 'A..Za..z' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2763,11 +2763,11 @@ function backslashit( $string ) {
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*
|
*
|
||||||
* @param string $string What to add the trailing slash to.
|
* @param string $value Value to which trailing slash will be added.
|
||||||
* @return string String with trailing slash added.
|
* @return string String with trailing slash added.
|
||||||
*/
|
*/
|
||||||
function trailingslashit( $string ) {
|
function trailingslashit( $value ) {
|
||||||
return untrailingslashit( $string ) . '/';
|
return untrailingslashit( $value ) . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2778,11 +2778,11 @@ function trailingslashit( $string ) {
|
||||||
*
|
*
|
||||||
* @since 2.2.0
|
* @since 2.2.0
|
||||||
*
|
*
|
||||||
* @param string $string What to remove the trailing slashes from.
|
* @param string $text Value from which trailing slashes will be removed.
|
||||||
* @return string String without the trailing slashes.
|
* @return string String without the trailing slashes.
|
||||||
*/
|
*/
|
||||||
function untrailingslashit( $string ) {
|
function untrailingslashit( $value ) {
|
||||||
return rtrim( $string, '/\\' );
|
return rtrim( $value, '/\\' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3084,20 +3084,20 @@ function make_clickable( $text ) {
|
||||||
* 4 => '123456789 ', // 10 characters: '123456789 1234567890a' was too long.
|
* 4 => '123456789 ', // 10 characters: '123456789 1234567890a' was too long.
|
||||||
* 5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split.
|
* 5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split.
|
||||||
* 6 => ' 45678 ', // 11 characters: Perfect split.
|
* 6 => ' 45678 ', // 11 characters: Perfect split.
|
||||||
* 7 => '1 3 5 7 90 ', // 11 characters: End of $string.
|
* 7 => '1 3 5 7 90 ', // 11 characters: End of $text.
|
||||||
* );
|
* );
|
||||||
*
|
*
|
||||||
* @since 3.4.0
|
* @since 3.4.0
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param string $string The string to split.
|
* @param string $text The string to split.
|
||||||
* @param int $goal The desired chunk length.
|
* @param int $goal The desired chunk length.
|
||||||
* @return array Numeric array of chunks.
|
* @return array Numeric array of chunks.
|
||||||
*/
|
*/
|
||||||
function _split_str_by_whitespace( $string, $goal ) {
|
function _split_str_by_whitespace( $text, $goal ) {
|
||||||
$chunks = array();
|
$chunks = array();
|
||||||
|
|
||||||
$string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
|
$string_nullspace = strtr( $text, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
|
||||||
|
|
||||||
while ( $goal < strlen( $string_nullspace ) ) {
|
while ( $goal < strlen( $string_nullspace ) ) {
|
||||||
$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
|
$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
|
||||||
|
@ -3109,13 +3109,13 @@ function _split_str_by_whitespace( $string, $goal ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$chunks[] = substr( $string, 0, $pos + 1 );
|
$chunks[] = substr( $text, 0, $pos + 1 );
|
||||||
$string = substr( $string, $pos + 1 );
|
$text = substr( $text, $pos + 1 );
|
||||||
$string_nullspace = substr( $string_nullspace, $pos + 1 );
|
$string_nullspace = substr( $string_nullspace, $pos + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $string ) {
|
if ( $text ) {
|
||||||
$chunks[] = $string;
|
$chunks[] = $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $chunks;
|
return $chunks;
|
||||||
|
@ -3552,18 +3552,18 @@ function is_email( $email, $deprecated = false ) {
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*
|
*
|
||||||
* @param string $string Subject line.
|
* @param string $subject Subject line.
|
||||||
* @return string Converted string to ASCII.
|
* @return string Converted string to ASCII.
|
||||||
*/
|
*/
|
||||||
function wp_iso_descrambler( $string ) {
|
function wp_iso_descrambler( $subject ) {
|
||||||
/* this may only work with iso-8859-1, I'm afraid */
|
/* this may only work with iso-8859-1, I'm afraid */
|
||||||
if ( ! preg_match( '#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches ) ) {
|
if ( ! preg_match( '#\=\?(.+)\?Q\?(.+)\?\=#i', $subject, $matches ) ) {
|
||||||
return $string;
|
return $subject;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
$subject = str_replace( '_', ' ', $matches[2] );
|
$subject = str_replace( '_', ' ', $matches[2] );
|
||||||
return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
|
return preg_replace_callback( '#\=([0-9a-f]{2})#i', '_wp_iso_convert', $subject );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to convert hex encoded chars to ASCII.
|
* Helper function to convert hex encoded chars to ASCII.
|
||||||
|
@ -3571,11 +3571,11 @@ function wp_iso_descrambler( $string ) {
|
||||||
* @since 3.1.0
|
* @since 3.1.0
|
||||||
* @access private
|
* @access private
|
||||||
*
|
*
|
||||||
* @param array $match The preg_replace_callback matches array.
|
* @param array $matches The preg_replace_callback matches array.
|
||||||
* @return string Converted chars.
|
* @return string Converted chars.
|
||||||
*/
|
*/
|
||||||
function _wp_iso_convert( $match ) {
|
function _wp_iso_convert( $matches ) {
|
||||||
return chr( hexdec( strtolower( $match[1] ) ) );
|
return chr( hexdec( strtolower( $matches[1] ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3586,12 +3586,12 @@ function _wp_iso_convert( $match ) {
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*
|
*
|
||||||
* @param string $string The date to be converted, in the timezone of the site.
|
* @param string $date_string The date to be converted, in the timezone of the site.
|
||||||
* @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
|
* @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
|
||||||
* @return string Formatted version of the date, in UTC.
|
* @return string Formatted version of the date, in UTC.
|
||||||
*/
|
*/
|
||||||
function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
|
function get_gmt_from_date( $date_string, $format = 'Y-m-d H:i:s' ) {
|
||||||
$datetime = date_create( $string, wp_timezone() );
|
$datetime = date_create( $date_string, wp_timezone() );
|
||||||
|
|
||||||
if ( false === $datetime ) {
|
if ( false === $datetime ) {
|
||||||
return gmdate( $format, 0 );
|
return gmdate( $format, 0 );
|
||||||
|
@ -3608,12 +3608,12 @@ function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) {
|
||||||
*
|
*
|
||||||
* @since 1.2.0
|
* @since 1.2.0
|
||||||
*
|
*
|
||||||
* @param string $string The date to be converted, in UTC or GMT timezone.
|
* @param string $date_string The date to be converted, in UTC or GMT timezone.
|
||||||
* @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
|
* @param string $format The format string for the returned date. Default 'Y-m-d H:i:s'.
|
||||||
* @return string Formatted version of the date, in the site's timezone.
|
* @return string Formatted version of the date, in the site's timezone.
|
||||||
*/
|
*/
|
||||||
function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
|
function get_date_from_gmt( $date_string, $format = 'Y-m-d H:i:s' ) {
|
||||||
$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
|
$datetime = date_create( $date_string, new DateTimeZone( 'UTC' ) );
|
||||||
|
|
||||||
if ( false === $datetime ) {
|
if ( false === $datetime ) {
|
||||||
return gmdate( $format, 0 );
|
return gmdate( $format, 0 );
|
||||||
|
@ -5033,20 +5033,20 @@ function map_deep( $value, $callback ) {
|
||||||
*
|
*
|
||||||
* @since 2.2.1
|
* @since 2.2.1
|
||||||
*
|
*
|
||||||
* @param string $string The string to be parsed.
|
* @param string $input The string to be parsed.
|
||||||
* @param array $array Variables will be stored in this array.
|
* @param array $result Variables will be stored in this array.
|
||||||
*/
|
*/
|
||||||
function wp_parse_str( $string, &$array ) {
|
function wp_parse_str( $input, &$result ) {
|
||||||
parse_str( (string) $string, $array );
|
parse_str( (string) $input, $result );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the array of variables derived from a parsed string.
|
* Filters the array of variables derived from a parsed string.
|
||||||
*
|
*
|
||||||
* @since 2.2.1
|
* @since 2.2.1
|
||||||
*
|
*
|
||||||
* @param array $array The array populated with variables.
|
* @param array $result The array populated with variables.
|
||||||
*/
|
*/
|
||||||
$array = apply_filters( 'wp_parse_str', $array );
|
$result = apply_filters( 'wp_parse_str', $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5056,11 +5056,11 @@ function wp_parse_str( $string, &$array ) {
|
||||||
*
|
*
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
*
|
*
|
||||||
* @param string $text Text to be converted.
|
* @param string $content Text to be converted.
|
||||||
* @return string Converted text.
|
* @return string Converted text.
|
||||||
*/
|
*/
|
||||||
function wp_pre_kses_less_than( $text ) {
|
function wp_pre_kses_less_than( $content ) {
|
||||||
return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text );
|
return preg_replace_callback( '%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $content );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5084,23 +5084,23 @@ function wp_pre_kses_less_than_callback( $matches ) {
|
||||||
*
|
*
|
||||||
* @since 5.3.1
|
* @since 5.3.1
|
||||||
*
|
*
|
||||||
* @param string $string Content to be run through KSES.
|
* @param string $content Content to be run through KSES.
|
||||||
* @param array[]|string $allowed_html An array of allowed HTML elements
|
* @param array[]|string $allowed_html An array of allowed HTML elements
|
||||||
* and attributes, or a context name
|
* and attributes, or a context name
|
||||||
* such as 'post'.
|
* such as 'post'.
|
||||||
* @param string[] $allowed_protocols Array of allowed URL protocols.
|
* @param string[] $allowed_protocols Array of allowed URL protocols.
|
||||||
* @return string Filtered text to run through KSES.
|
* @return string Filtered text to run through KSES.
|
||||||
*/
|
*/
|
||||||
function wp_pre_kses_block_attributes( $string, $allowed_html, $allowed_protocols ) {
|
function wp_pre_kses_block_attributes( $content, $allowed_html, $allowed_protocols ) {
|
||||||
/*
|
/*
|
||||||
* `filter_block_content` is expected to call `wp_kses`. Temporarily remove
|
* `filter_block_content` is expected to call `wp_kses`. Temporarily remove
|
||||||
* the filter to avoid recursion.
|
* the filter to avoid recursion.
|
||||||
*/
|
*/
|
||||||
remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
|
remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
|
||||||
$string = filter_block_content( $string, $allowed_html, $allowed_protocols );
|
$content = filter_block_content( $content, $allowed_html, $allowed_protocols );
|
||||||
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
|
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
|
||||||
|
|
||||||
return $string;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -5389,19 +5389,19 @@ function normalize_whitespace( $str ) {
|
||||||
*
|
*
|
||||||
* @since 2.9.0
|
* @since 2.9.0
|
||||||
*
|
*
|
||||||
* @param string $string String containing HTML tags
|
* @param string $text String containing HTML tags
|
||||||
* @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars
|
* @param bool $remove_breaks Optional. Whether to remove left over line breaks and white space chars
|
||||||
* @return string The processed string.
|
* @return string The processed string.
|
||||||
*/
|
*/
|
||||||
function wp_strip_all_tags( $string, $remove_breaks = false ) {
|
function wp_strip_all_tags( $text, $remove_breaks = false ) {
|
||||||
$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
|
$text = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $text );
|
||||||
$string = strip_tags( $string );
|
$text = strip_tags( $text );
|
||||||
|
|
||||||
if ( $remove_breaks ) {
|
if ( $remove_breaks ) {
|
||||||
$string = preg_replace( '/[\r\n\t ]+/', ' ', $string );
|
$text = preg_replace( '/[\r\n\t ]+/', ' ', $text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return trim( $string );
|
return trim( $text );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-alpha-54926';
|
$wp_version = '6.2-alpha-54927';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue