Changeset 45555
- Timestamp:
- 06/20/2019 01:46:20 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r45473 r45555 220 220 */ 221 221 if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) { 222 223 $months = $wp_locale->month; 224 $months_genitive = $wp_locale->month_genitive; 225 222 226 // Match a format like 'j F Y' or 'j. F' 223 227 if ( @preg_match( '#^\d{1,2}\.? [^\d ]+#u', $date ) ) { 224 $months = $wp_locale->month;225 $months_genitive = $wp_locale->month_genitive;226 228 227 229 foreach ( $months as $key => $month ) { … … 231 233 foreach ( $months_genitive as $key => $month ) { 232 234 $months_genitive[ $key ] = ' ' . $month . '$1'; 235 } 236 237 $date = preg_replace( $months, $months_genitive, $date ); 238 } 239 240 // Match a format like 'F jS' or 'F j' and change it to 'j F' 241 if ( @preg_match( '#^[^\d ]+ \d{1,2}(st|nd|rd|th)? #u', trim( $date ) ) ) { 242 foreach ( $months as $key => $month ) { 243 $months[ $key ] = '#' . $month . ' (\d{1,2})(st|nd|rd|th)?#u'; 244 } 245 246 foreach ( $months_genitive as $key => $month ) { 247 $months_genitive[ $key ] = '$1 ' . $month; 233 248 } 234 249 -
trunk/tests/phpunit/tests/functions/maybeDeclineDate.php
r42343 r45555 4 4 * @group functions.php 5 5 * @group i18n 6 * @group datetime 6 7 */ 7 8 class Tests_Functions_MaybeDeclineDate extends WP_UnitTestCase { … … 69 70 array( 'ru_RU', '21 Июнь', '21 июня' ), 70 71 array( 'ru_RU', '1 Январь 2016', '1 января 2016' ), 72 array( 'ru_RU', 'Январь 1st 2016', '1 января 2016' ), 73 array( 'ru_RU', 'Январь 1 2016', '1 января 2016' ), 71 74 array( 'pl_PL', '1 Styczeń', '1 stycznia' ), 72 75 array( 'hr', '1. Siječanj', '1. siječnja' ),
Note: See TracChangeset
for help on using the changeset viewer.