Smarty
[ class tree: Smarty ] [ index: Smarty ] [ all elements ]

Source for file modifier.cal_date_format.php

Documentation is available at modifier.cal_date_format.php

  1. <?php
  2. /**
  3.  * Smarty plugin
  4.  * @package Smarty
  5.  * @subpackage plugins
  6.  */
  7.  
  8. /**
  9.  * required setup
  10.  */
  11. global $gBitSmarty;
  12. $gBitSmarty->loadPlugin('smarty_shared_make_timestamp');
  13.  
  14. /**
  15.  * Smarty plugin
  16.  * -------------------------------------------------------------
  17.  * Type:     modifier
  18.  * Name:     cal_date_format
  19.  * Purpose:  format datestamps via strftime, (timezone adjusted to calendar specified timezone)
  20.  * Input:    string: input date string
  21.  *           format: strftime format for output
  22.  *           default_date: default date if $string is empty
  23.  * -------------------------------------------------------------
  24.  */
  25. function smarty_modifier_cal_date_format($string$format "%b %e, %Y"$default_date=null$tra_format=null)
  26. {
  27.     $mDate new BitDate(0);
  28.     if $mDate->get_display_offset()) $format preg_replace("/ ?%Z/","",$format);
  29.        else $format preg_replace("/%Z/","UTC",$format);
  30.  
  31.     $disptime $mDate->getTimestampFromISO($string);
  32.  
  33.     global $gBitSystem$gBitLanguage//$gBitLanguage->mLanguage= $gBitSystem->getConfig("language", "en");
  34.     if ($gBitSystem->getConfig("language""en"!= $gBitLanguage->mLanguage && $tra_format{
  35.         $format $tra_format;
  36.     }
  37.     return $mDate->strftime($format$disptimetrue);
  38. }
  39.  
  40. /* vim: set expandtab: */
  41.  
  42. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:09 +0000 by phpDocumentor 1.5.0-lsces