diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-08-27 10:27:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-27 10:27:34 +0200 |
commit | af41d5ab5d2bd3ba64d052c997bc6afa6966a63c (patch) | |
tree | 8fad2829c55f94022e359fa8914e11f80a2afc2a /application/Utils.php | |
parent | b8e3630f2ecd142d397b1b062a346a667bb78595 (diff) | |
parent | 0c6fdbe12bbbb336348666b14b82096f24d5858b (diff) | |
download | Shaarli-af41d5ab5d2bd3ba64d052c997bc6afa6966a63c.tar.gz Shaarli-af41d5ab5d2bd3ba64d052c997bc6afa6966a63c.tar.zst Shaarli-af41d5ab5d2bd3ba64d052c997bc6afa6966a63c.zip |
Merge pull request #1511 from ArthurHoaro/wip-slim-routing
Diffstat (limited to 'application/Utils.php')
-rw-r--r-- | application/Utils.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/application/Utils.php b/application/Utils.php index 4b7fc546..9c9eaaa2 100644 --- a/application/Utils.php +++ b/application/Utils.php | |||
@@ -87,10 +87,14 @@ function endsWith($haystack, $needle, $case = true) | |||
87 | * | 87 | * |
88 | * @param mixed $input Data to escape: a single string or an array of strings. | 88 | * @param mixed $input Data to escape: a single string or an array of strings. |
89 | * | 89 | * |
90 | * @return string escaped. | 90 | * @return string|array escaped. |
91 | */ | 91 | */ |
92 | function escape($input) | 92 | function escape($input) |
93 | { | 93 | { |
94 | if (null === $input) { | ||
95 | return null; | ||
96 | } | ||
97 | |||
94 | if (is_bool($input)) { | 98 | if (is_bool($input)) { |
95 | return $input; | 99 | return $input; |
96 | } | 100 | } |
@@ -294,15 +298,15 @@ function normalize_spaces($string) | |||
294 | * Requires php-intl to display international datetimes, | 298 | * Requires php-intl to display international datetimes, |
295 | * otherwise default format '%c' will be returned. | 299 | * otherwise default format '%c' will be returned. |
296 | * | 300 | * |
297 | * @param DateTime $date to format. | 301 | * @param DateTimeInterface $date to format. |
298 | * @param bool $time Displays time if true. | 302 | * @param bool $time Displays time if true. |
299 | * @param bool $intl Use international format if true. | 303 | * @param bool $intl Use international format if true. |
300 | * | 304 | * |
301 | * @return bool|string Formatted date, or false if the input is invalid. | 305 | * @return bool|string Formatted date, or false if the input is invalid. |
302 | */ | 306 | */ |
303 | function format_date($date, $time = true, $intl = true) | 307 | function format_date($date, $time = true, $intl = true) |
304 | { | 308 | { |
305 | if (! $date instanceof DateTime) { | 309 | if (! $date instanceof DateTimeInterface) { |
306 | return false; | 310 | return false; |
307 | } | 311 | } |
308 | 312 | ||