? sites/default/files ? sites/default/settings.php Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.925 diff -u -p -r1.925 common.inc --- includes/common.inc 18 Jun 2009 21:19:01 -0000 1.925 +++ includes/common.inc 24 Jun 2009 23:52:40 -0000 @@ -1909,35 +1909,32 @@ function format_date($timestamp, $type = $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); } - $max = strlen($format); - $date = ''; // Create a DateTime object from the timestamp. $date_time = date_create('@' . $timestamp); // Set the time zone for the DateTime object. date_timezone_set($date_time, $timezones[$timezone]); - for ($i = 0; $i < $max; $i++) { - $c = $format[$i]; - if (strpos('AaeDlMT', $c) !== FALSE) { - $date .= t(date_format($date_time, $c), array(), array('langcode' => $langcode)); - } - elseif ($c == 'F') { - // Special treatment for long month names: May is both an abbreviation - // and a full month name in English, but other languages have - // different abbreviations. - $date .= t(date_format($date_time, $c), array(), array('context' => 'Long month name', 'langcode' => $langcode)); - } - elseif (strpos('BcdGgHhIijLmNnOoPSstUuWwYyZz', $c) !== FALSE) { - $date .= date_format($date_time, $c); - } - elseif ($c == 'r') { - $date .= format_date($timestamp, 'custom', 'D, d M Y H:i:s O', $timezone, $langcode); - } - elseif ($c == '\\') { - $date .= $format[++$i]; - } - else { - $date .= $c; + // Replace characters in format string which need to be translated, 'X', with + // an arbitrary escape sequence '+=X=+'. The 'F' format character, long month + // name, requires special handling (see below). These patterns exclude any + // format characters which have been escaped with '\' (octal 134). + $format = preg_replace(array('@(? 'Long month name', 'langcode' => $langcode)), $date); + } + else { + $date = str_replace("+=$match=+", t($match, array(), array('langcode' => $langcode)), $date); + } } }