From 1b975b73c7149e92d47e1b056dde7a2d76b0ee9b Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 8 Apr 2009 19:56:58 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 03b4cc3aa..9d46e8e42 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -96,7 +96,11 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) { // specially computed timestamp $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'; 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 ); } $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; }