Source for file filters.inc.php

Documentation is available at filters.inc.php

  1. <?php
  2. /*
  3.  * Limb PHP Framework
  4.  *
  5.  * @link http://limb-project.com
  6.  * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
  7.  * @license    LGPL http://www.gnu.org/copyleft/lesser.html
  8.  */
  9.  
  10. require_once('limb/i18n/src/datetime/lmbLocaleDateTime.class.php');
  11. require_once('limb/datetime/src/lmbDateTime.class.php');
  12.  
  13. function lmb_i18n_date_filter($params,$value)
  14. {
  15.   $toolkit lmbToolkit :: instance();
  16.   if(isset($params[0]&& $params[0])
  17.   {
  18.     $locale=$toolkit->getLocaleObject($params[0]);
  19.   }
  20.   else
  21.     $locale=$toolkit->getLocaleObject();
  22.  
  23.   if(isset($params[3]&& $params[3])
  24.     $format=$params[3];
  25.   else
  26.   {
  27.     if(isset($params[2]&& $params[2])
  28.       $format_type $params[2];
  29.     else
  30.       $format_type 'short_date';
  31.  
  32.     $property $format_type '_format';
  33.     $format=$locale->$property;
  34.   }
  35.  
  36.   if(isset($params[1]&& $params[1])
  37.     $date_type $params[1];
  38.   else
  39.     $date_type 'stamp';
  40.  
  41.   switch($date_type)
  42.   {
  43.     case 'string'$date new lmbLocaleDateTime($value);      break;
  44.     case 'stamp':  $date new lmbLocaleDateTime((int)$value)break;
  45.     default:       $date new lmbLocaleDateTime($value);      break;
  46.   }
  47.  
  48.   return $date->localeStrftime($format$locale);
  49. }

Documentation generated on Tue, 06 Jan 2009 03:47:16 +0300 by phpDocumentor 1.3.2