Date/Time: Make sure wp_date() does not unnecessarily escape localized numbers, but keeps localized slashes.

Props Rarst, tmatsuur, remcotolsma, peterwilsoncc.
Reviewed by peterwilsoncc.
Fixes #48319.

git-svn-id: https://develop.svn.wordpress.org/trunk@46569 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
SergeyBiryukov
2019-10-22 17:29:02 +00:00
parent 99d5986b0c
commit 747f8e2186
2 changed files with 54 additions and 6 deletions
+6 -6
View File
@@ -254,22 +254,22 @@ function wp_date( $format, $timestamp = null, $timezone = null ) {
for ( $i = 0; $i < $format_length; $i ++ ) {
switch ( $format[ $i ] ) {
case 'D':
$new_format .= backslashit( $wp_locale->get_weekday_abbrev( $weekday ) );
$new_format .= addcslashes( $wp_locale->get_weekday_abbrev( $weekday ), '\\A..Za..z' );
break;
case 'F':
$new_format .= backslashit( $month );
$new_format .= addcslashes( $month, '\\A..Za..z' );
break;
case 'l':
$new_format .= backslashit( $weekday );
$new_format .= addcslashes( $weekday, '\\A..Za..z' );
break;
case 'M':
$new_format .= backslashit( $wp_locale->get_month_abbrev( $month ) );
$new_format .= addcslashes( $wp_locale->get_month_abbrev( $month ), '\\A..Za..z' );
break;
case 'a':
$new_format .= backslashit( $wp_locale->get_meridiem( $datetime->format( 'a' ) ) );
$new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'a' ) ), '\\A..Za..z' );
break;
case 'A':
$new_format .= backslashit( $wp_locale->get_meridiem( $datetime->format( 'A' ) ) );
$new_format .= addcslashes( $wp_locale->get_meridiem( $datetime->format( 'A' ) ), '\\A..Za..z' );
break;
case '\\':
$new_format .= $format[ $i ];