From bd63a83145aa930da34bd6cd140bbca8d6e62de2 Mon Sep 17 00:00:00 2001 From: ejikharev Date: Thu, 15 Jan 2009 15:56:24 +0000 Subject: [PATCH] add function truncate git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@44 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/Sublimer.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/classes/Sublimer.class.php b/classes/Sublimer.class.php index 855cd14..13284d0 100644 --- a/classes/Sublimer.class.php +++ b/classes/Sublimer.class.php @@ -94,6 +94,19 @@ final class Sublimer { return $this->head_array; } + + /** + * обрезает текст до заданной длинны + * + * @param string $text + * @param int $count + * @param string $postfix + */ + protected function trimString($text, $count = 15, $postfix = "...") + { + return mb_substr($text, 0, $count).$postfix; + } + } ?> \ No newline at end of file