cvs: smarty / NEWS /libs/plugins modifier.date_format.php
[email protected] ("boots") Tue, 20 Jun 2006 16:38:36 -0000
| Newsgroups | php.smarty.cvs |
|---|---|
| Message-ID | <cvsboots1150821516@cvsserver> |
boots Tue Jun 20 16:38:36 2006 UTC
Modified files:
/smarty NEWS
/smarty/libs/plugins modifier.date_format.php
Log:
emulate %l in the date_format modifier on windows
thanks to Gibberish from the forums for reporting this
http://cvs.php.net/viewvc.cgi/smarty/NEWS?r1=1.533&r2=1.534&diff_format=u
Index: smarty/NEWS
diff -u smarty/NEWS:1.533 smarty/NEWS:1.534
--- smarty/NEWS:1.533 Wed Jun 14 14:14:23 2006
+++ smarty/NEWS Tue Jun 20 16:38:36 2006
@@ -1,3 +1,4 @@
+- add support for %l
- fix handling of apostrophes in capitalize modifier (Alec Smecher, boots)
Version 2.6.14 (May 28th, 2006)
http://cvs.php.net/viewvc.cgi/smarty/libs/plugins/modifier.date_format.php?r1=1.14&r2=1.15&diff_format=u
Index: smarty/libs/plugins/modifier.date_format.php
diff -u smarty/libs/plugins/modifier.date_format.php:1.14 smarty/libs/plugins/modifier.date_format.php:1.15
--- smarty/libs/plugins/modifier.date_format.php:1.14 Tue Oct 11 16:22:56 2005
+++ smarty/libs/plugins/modifier.date_format.php Tue Jun 20 16:38:36 2006
@@ -31,9 +31,11 @@
function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null)
{
if (substr(PHP_OS,0,3) == 'WIN') {
- $_win_from = array ('%e', '%T', '%D');
- $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y');
- $format = str_replace($_win_from, $_win_to, $format);
+ $hours = strftime('%I', $string);
+ $short_hours = ( $hours < 10 ) ? substr( $hours, -1) : $hours;
+ $_win_from = array ('%e', '%T', '%D', '%l');
+ $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y', $short_hours);
+ $format = str_replace($_win_from, $_win_to, $format);
}
if($string != '') {
return strftime($format, smarty_make_timestamp($string));