Make WordPress Core

Ticket #36790: 36790.patch

File 36790.patch, 1000 bytes (added by SergeyBiryukov, 7 years ago)
  • src/wp-includes/functions.php

     
    182182         */
    183183        if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) {
    184184                // Match a format like 'j F Y' or 'j. F'
    185                 if ( @preg_match( '#^\d{1,2}\.? \w+#u', $date ) ) {
    186                         $months = $wp_locale->month;
     185                if ( @preg_match( '#^\d{1,2}\.? [^\d ]+#u', $date ) ) {
     186                        $months          = $wp_locale->month;
     187                        $months_genitive = $wp_locale->month_genitive;
    187188
    188189                        foreach ( $months as $key => $month ) {
    189                                 $months[ $key ] = '#\b' . $month . '\b#u';
     190                                $months[ $key ] = '# ' . $month . '( |$)#u';
    190191                        }
    191192
    192                         $date = preg_replace( $months, $wp_locale->month_genitive, $date );
     193                        foreach ( $months_genitive as $key => $month ) {
     194                                $months_genitive[ $key ] = ' ' . $month . '$1';
     195                        }
     196
     197                        $date = preg_replace( $months, $months_genitive, $date );
    193198                }
    194199        }
    195200