Ticket #8153: proper-current-time-for-date_i18n.diff
File proper-current-time-for-date_i18n.diff, 1.8 KB (added by , 16 years ago) |
---|
-
wp-includes/functions.php
116 116 global $wp_locale; 117 117 $i = $unixtimestamp; 118 118 // Sanity check for PHP 5.1.0- 119 if ( false === $i || intval($i) < 0 ) 120 $i = time(); 119 if ( false === $i || intval($i) < 0 ) { 120 $i = current_time( 'timestamp' ); 121 // we should not let date() interfere with our 122 // specially computed timestamp 123 $gmt = true; 124 } 121 125 126 $datefunc = $gmt? 'gmdate' : 'date'; 127 122 128 if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { 123 $datemonth = $wp_locale->get_month( date( 'm', $i ) );129 $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) ); 124 130 $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth ); 125 $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) );131 $dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) ); 126 132 $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday ); 127 $datemeridiem = $wp_locale->get_meridiem( date( 'a', $i ) );128 $datemeridiem_capital = $wp_locale->get_meridiem( date( 'A', $i ) );133 $datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) ); 134 $datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i ) ); 129 135 $dateformatstring = ' '.$dateformatstring; 130 136 $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring ); 131 137 $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring ); … … 136 142 137 143 $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); 138 144 } 139 $j = $gmt? @gmdate( $dateformatstring, $i ) : @date( $dateformatstring, $i );145 $j = @$datefunc( $dateformatstring, $i ); 140 146 return $j; 141 147 } 142 148