public static function getInstance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
static function summarize($text, $limit = null) { $text = SeoPurifier::purify($text); $summary = ''; foreach (self::$_split_tags as $tag) { if ($i = strpos($text, $tag)) { $summary = substr($text, 0, $i); break; } } $length = $limit && $limit < self::$_maxlen ? $limit : self::$_maxlen; $summary = $summary && $limit ? self::truncate(strip_tags($summary), $limit) : ($text ? self::truncate(strip_tags($text), $length) : ''); return $summary; }