Changeset 46862 for trunk/src/wp-includes/functions.php
- Timestamp:
- 12/09/2019 06:48:50 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r46822 r46862 336 336 $months_genitive = $wp_locale->month_genitive; 337 337 338 // Match a format like 'j F Y' or 'j. F' 339 if ( preg_match( '#^\d{1,2}\.? [^\d ]+#u', $date ) ) { 340 338 /* 339 * Match a format like 'j F Y' or 'j. F' (day of the month, followed by month name) 340 * and decline the month. 341 */ 342 if ( preg_match( '#\b\d{1,2}\.? [^\d ]+\b#u', $date ) ) { 341 343 foreach ( $months as $key => $month ) { 342 $months[ $key ] = '# ' . $month . '( |$)#u';344 $months[ $key ] = '# ' . preg_quote( $month, '#' ) . '\b#u'; 343 345 } 344 346 345 347 foreach ( $months_genitive as $key => $month ) { 346 $months_genitive[ $key ] = ' ' . $month . '$1';348 $months_genitive[ $key ] = ' ' . $month; 347 349 } 348 350 … … 350 352 } 351 353 352 // Match a format like 'F jS' or 'F j' and change it to 'j F' 353 if ( preg_match( '#^[^\d ]+ \d{1,2}(st|nd|rd|th)? #u', trim( $date ) ) ) { 354 /* 355 * Match a format like 'F jS' or 'F j' (month name, followed by day with an optional ordinal suffix) 356 * and change it to declined 'j F'. 357 */ 358 if ( preg_match( '#\b[^\d ]+ \d{1,2}(st|nd|rd|th)?\b#u', trim( $date ) ) ) { 354 359 foreach ( $months as $key => $month ) { 355 $months[ $key ] = '# ' . $month . ' (\d{1,2})(st|nd|rd|th)?#u';360 $months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?\b#u'; 356 361 } 357 362
Note: See TracChangeset
for help on using the changeset viewer.