mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-15 15:09:51 +01:00
code cleanup and optimizations 3.1.32-dev-34
This commit is contained in:
@@ -25,7 +25,7 @@ function smarty_make_timestamp($string)
|
||||
(interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
|
||||
) {
|
||||
return (int) $string->format('U'); // PHP 5.2 BC
|
||||
} elseif (strlen($string) == 14 && ctype_digit($string)) {
|
||||
} elseif (strlen($string) === 14 && ctype_digit($string)) {
|
||||
// it is mysql timestamp format of YYYYMMDDHHMMSS?
|
||||
return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2),
|
||||
substr($string, 6, 2), substr($string, 0, 4));
|
||||
@@ -35,7 +35,7 @@ function smarty_make_timestamp($string)
|
||||
} else {
|
||||
// strtotime should handle it
|
||||
$time = strtotime($string);
|
||||
if ($time == - 1 || $time === false) {
|
||||
if ($time === - 1 || $time === false) {
|
||||
// strtotime() was not able to parse $string, use "now":
|
||||
return time();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user