From e5d1bed10c4652f39a11bac34aaa17f2d3be72f4 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 2 Apr 2005 19:51:12 +0000 Subject: [PATCH] Don't use i18n unfriendly substr operations in date_i18n. http://mosquito.wordpress.org/view.php?id=1200 Props: nbachiyski git-svn-id: http://svn.automattic.com/wordpress/trunk@2508 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 4ef9227c9f..160d24d4ed 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -59,16 +59,18 @@ function current_time($type, $gmt = 0) { } function date_i18n($dateformatstring, $unixtimestamp) { - global $month, $weekday; + global $month, $weekday, $month_abbrev, $weekday_abbrev; $i = $unixtimestamp; if ((!empty($month)) && (!empty($weekday))) { $datemonth = $month[date('m', $i)]; + $datemonth_abbrev = $month_abbrev[$datemonth]; $dateweekday = $weekday[date('w', $i)]; + $dateweekday_abbrev = $weekday_abbrev[$dateweekday]; $dateformatstring = ' '.$dateformatstring; - $dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit(substr($dateweekday, 0, 3)), $dateformatstring); + $dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit($dateweekday_abbrev), $dateformatstring); $dateformatstring = preg_replace("/([^\\\])F/", "\\1".backslashit($datemonth), $dateformatstring); $dateformatstring = preg_replace("/([^\\\])l/", "\\1".backslashit($dateweekday), $dateformatstring); - $dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit(substr($datemonth, 0, 3)), $dateformatstring); + $dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit($datemonth_abbrev), $dateformatstring); $dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring)-1); } $j = @date($dateformatstring, $i);