1 |
<?php |
2 |
|
3 |
/* |
4 |
* Smarty plugin |
5 |
* ------------------------------------------------------------- |
6 |
* Type: modifier |
7 |
* Name: date_format |
8 |
* Purpose: format datestamps via strftime |
9 |
* Input: string: input date string |
10 |
* format: strftime format for output |
11 |
* default_date: default date if $string is empty |
12 |
* ------------------------------------------------------------- |
13 |
*/ |
14 |
require_once $this->_get_plugin_filepath('shared','make_timestamp'); |
15 |
function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null) |
16 |
{ |
17 |
if($string != '') { |
18 |
return strftime($format, smarty_make_timestamp($string)); |
19 |
} elseif (isset($default_date) && $default_date != '') { |
20 |
return strftime($format, smarty_make_timestamp($default_date)); |
21 |
} else { |
22 |
return; |
23 |
} |
24 |
} |
25 |
|
26 |
/* vim: set expandtab: */ |
27 |
|
28 |
?> |