I18N: Adjust the regex in wp_maybe_decline_date()
to avoid \w
and \b
, as they don't work with Unicode characters correctly in PHP 5.3.3 and earlier versions.
See [37975] for unit tests. See #36790. git-svn-id: https://develop.svn.wordpress.org/trunk@37979 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fdb54dfe7b
commit
eb176b40b8
@ -182,14 +182,19 @@ function wp_maybe_decline_date( $date ) {
|
||||
*/
|
||||
if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) {
|
||||
// Match a format like 'j F Y' or 'j. F'
|
||||
if ( @preg_match( '#^\d{1,2}\.? \w+#u', $date ) ) {
|
||||
$months = $wp_locale->month;
|
||||
if ( @preg_match( '#^\d{1,2}\.? [^\d ]+#u', $date ) ) {
|
||||
$months = $wp_locale->month;
|
||||
$months_genitive = $wp_locale->month_genitive;
|
||||
|
||||
foreach ( $months as $key => $month ) {
|
||||
$months[ $key ] = '#\b' . $month . '\b#u';
|
||||
$months[ $key ] = '# ' . $month . '( |$)#u';
|
||||
}
|
||||
|
||||
$date = preg_replace( $months, $wp_locale->month_genitive, $date );
|
||||
foreach ( $months_genitive as $key => $month ) {
|
||||
$months_genitive[ $key ] = ' ' . $month . '$1';
|
||||
}
|
||||
|
||||
$date = preg_replace( $months, $months_genitive, $date );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user