SpamBlocker
Spam Blocker is a CakePHP Behavior that automatically before after a comment is made. Each comment is tested upon a point system to determine if it should be approved, set to pending (high points), or marked as spam / deleted (low points).
Truncate
Truncates a string to a certain length. Can pass arguments to determine the length and ending delimiter.
Function: truncate()
Category: PHP
Views: 902
Permalink -
Tinylink
/** * Truncates a string to a certain length * @param string $text * @param int $limit * @param string $ending * @return string */ function truncate($text, $limit = 25, $ending = '...') { if (mb_strlen($text) > $limit) { $text = strip_tags($text); $text = mb_substr($text, 0, $limit); $text = mb_substr($text, 0, -(mb_strlen(mb_strrchr($text, ' ')))); $text = $text . $ending; } return $text; }