/[cvs]/nfo/php/libs/net.php.smarty/plugins/modifier.date_format.php
ViewVC logotype

Diff of /nfo/php/libs/net.php.smarty/plugins/modifier.date_format.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cvsjoko, Wed Oct 9 00:53:36 2002 UTC revision 1.2 by joko, Wed Jun 16 21:58:17 2004 UTC
# Line 1  Line 1 
1  <?php  <?php
2    /**
 /*  
3   * Smarty plugin   * Smarty plugin
4   * -------------------------------------------------------------   * @package Smarty
5   * Type:     modifier   * @subpackage plugins
6   * Name:     date_format   */
7   * Purpose:  format datestamps via strftime  
8   * Input:    string: input date string  /**
9   *           format: strftime format for output   * Include the {@link shared.make_timestamp.php} plugin
10   *           default_date: default date if $string is empty   */
11   * -------------------------------------------------------------  require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
12    /**
13     * Smarty date_format modifier plugin
14     *
15     * Type:     modifier<br>
16     * Name:     date_format<br>
17     * Purpose:  format datestamps via strftime<br>
18     * Input:<br>
19     *         - string: input date string
20     *         - format: strftime format for output
21     *         - default_date: default date if $string is empty
22     * @link http://smarty.php.net/manual/en/language.modifier.date.format.php
23     *          date_format (Smarty online manual)
24     * @param string
25     * @param string
26     * @param string
27     * @return string|void
28     * @uses smarty_make_timestamp()
29   */   */
 require_once $this->_get_plugin_filepath('shared','make_timestamp');  
30  function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)  function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
31  {  {
32          if($string != '') {      if($string != '') {
33          return strftime($format, smarty_make_timestamp($string));          return strftime($format, smarty_make_timestamp($string));
34          } elseif (isset($default_date) && $default_date != '') {                      } elseif (isset($default_date) && $default_date != '') {
35          return strftime($format, smarty_make_timestamp($default_date));          return strftime($format, smarty_make_timestamp($default_date));
36          } else {      } else {
37                  return;          return;
38          }      }
39  }  }
40    
41  /* vim: set expandtab: */  /* vim: set expandtab: */

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed