Dotclear

Changeset 2252


Ignore:
Timestamp:
05/21/10 14:52:30 (14 years ago)
Author:
bruno
Message:

TimeAgo? v1.2 : removed php 5.3 -specific code. Should now work with older versions of PHP

Location:
plugins/timeago
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/timeago/_define.php

    r2249 r2252  
    1818     /* Description*/         "Adds twitter-like dates for posts and comments, such as '3 hours ago'", 
    1919     /* Author */             "Bruno Hondelatte", 
    20      /* Version */            "1.1", 
     20     /* Version */            "1.2", 
    2121     /* Permissions */        null 
    2222); 
  • plugins/timeago/_public.php

    r2250 r2252  
    6363           
    6464          $plur = ($delta==1)?'':'s'; 
    65           $res = sprintf($l10n[$unit.$plur],$delta); 
     65          if (isset($l10n[$unit.$plur])) { 
     66               $res = sprintf($l10n[$unit.$plur],$delta); 
     67          } else { 
     68               $res = sprintf(TimeAgoTpl::$l10n[$unit.$plur],$delta); 
     69          } 
    6670          if ($cap) 
    6771               $res = ucfirst($res); 
     
    7276 
    7377          // Parse l10n attributes, if specified 
    74           $inter = array_intersect_key($attr->getArrayCopy(),TimeAgoTpl::$l10n); 
    75           if (sizeof($inter)==0) { 
     78          $l10n = array(); 
     79          foreach(TimeAgoTpl::$l10n as $k=>$v) { 
     80               if (isset($attr[$k])) 
     81                    $l10n[$k]=$attr[$k]; 
     82          } 
     83          if (sizeof($l10n)==0) { 
    7684               $l10nArgs = ''; 
    7785          } else { 
    78                $l10n = array_replace(TimeAgoTpl::$l10n,$inter); 
    7986               array_walk($l10n,create_function('&$v, $k', '$v = addslashes($v);')); 
    8087               $args = array(); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map