Make WordPress Core

Changeset 2508


Ignore:
Timestamp:
04/02/2005 07:51:12 PM (19 years ago)
Author:
ryan
Message:

Don't use i18n unfriendly substr operations in date_i18n. http://mosquito.wordpress.org/view.php?id=1200 Props: nbachiyski

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r2506 r2508  
    6060
    6161function date_i18n($dateformatstring, $unixtimestamp) {
    62     global $month, $weekday;
     62    global $month, $weekday, $month_abbrev, $weekday_abbrev;
    6363    $i = $unixtimestamp;
    6464    if ((!empty($month)) && (!empty($weekday))) {
    6565        $datemonth = $month[date('m', $i)];
     66        $datemonth_abbrev = $month_abbrev[$datemonth];
    6667        $dateweekday = $weekday[date('w', $i)];
     68        $dateweekday_abbrev = $weekday_abbrev[$dateweekday];       
    6769        $dateformatstring = ' '.$dateformatstring;
    68         $dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit(substr($dateweekday, 0, 3)), $dateformatstring);
     70        $dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit($dateweekday_abbrev), $dateformatstring);
    6971        $dateformatstring = preg_replace("/([^\\\])F/", "\\1".backslashit($datemonth), $dateformatstring);
    7072        $dateformatstring = preg_replace("/([^\\\])l/", "\\1".backslashit($dateweekday), $dateformatstring);
    71         $dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit(substr($datemonth, 0, 3)), $dateformatstring);
     73        $dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit($datemonth_abbrev), $dateformatstring);
    7274        $dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring)-1);
    7375    }
Note: See TracChangeset for help on using the changeset viewer.