From cd8e8a1bb4184cec5b83b368175f9afc89e3c46b Mon Sep 17 00:00:00 2001 From: evseevnn Date: Sat, 21 Dec 2013 15:19:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D1=83=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BD=D1=83=D0=B6=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В регулярном выражении нет необходимости указывать "^", так как .* заякоривается автоматом. --- src/Fenom/Modifier.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Fenom/Modifier.php b/src/Fenom/Modifier.php index 3da9279..554da90 100644 --- a/src/Fenom/Modifier.php +++ b/src/Fenom/Modifier.php @@ -25,7 +25,7 @@ class Modifier */ public static function dateFormat($date, $format = "%b %e, %Y") { - if (is_string($date) && !is_numeric($date)) { + if (!is_numeric($date)) { $date = strtotime($date); if (!$date) $date = time(); } @@ -39,7 +39,7 @@ class Modifier */ public static function date($date, $format = "Y m d") { - if (is_string($date) && !is_numeric($date)) { + if (!is_numeric($date)) { $date = strtotime($date); if (!$date) $date = time(); } @@ -100,7 +100,7 @@ class Modifier if (preg_match('#^(.{' . $length . '}).*?(.{' . $length . '})?$#usS', $string, $match)) { if (count($match) == 3) { if ($by_words) { - return preg_replace('#\s.*$#usS', "", $match[1]) . $etc . preg_replace('#^.*\s#usS', "", $match[2]); + return preg_replace('#\s.*$#usS', "", $match[1]) . $etc . preg_replace('#.*\s#usS', "", $match[2]); } else { return $match[1] . $etc . $match[2]; }