Add date_i18n filter. Props Denis-de-Bernardy. fixes #9396

git-svn-id: http://svn.automattic.com/wordpress/trunk@10897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-04-08 19:56:58 +00:00
parent eb1824b0a5
commit 1b975b73c7
1 changed files with 7 additions and 1 deletions

View File

@ -96,7 +96,11 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
// specially computed timestamp // specially computed timestamp
$gmt = true; $gmt = true;
} }
// store original value for language with untypical grammars
// see http://core.trac.wordpress.org/ticket/9396
$req_format = $dateformatstring;
$datefunc = $gmt? 'gmdate' : 'date'; $datefunc = $gmt? 'gmdate' : 'date';
if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) { if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
@ -117,6 +121,8 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 ); $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
} }
$j = @$datefunc( $dateformatstring, $i ); $j = @$datefunc( $dateformatstring, $i );
// allow plugins to redo this entirely for languages with untypical grammars
$j = apply_filters('date_i18n', $j, $req_format, $unixtimestamp, $gmt);
return $j; return $j;
} }