\s*
|', '', $text); } return $text; } /** * Strips given text of all links (_engine->stripLinks($text); } /** * Truncates text. * * Cuts a string to the length of $length and replaces the last characters * with the ellipsis if the text is longer than length. * * ### Options: * * - `ellipsis` Will be used as Ending and appended to the trimmed string (`ending` is deprecated) * - `exact` If false, $text will not be cut mid-word * - `html` If true, HTML tags would be handled correctly * * @param string $text String to truncate. * @param int $length Length of returned string, including ellipsis. * @param array $options An array of html attributes and options. * @return string Trimmed string. * @see String::truncate() * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::truncate */ public function truncate($text, $length = 100, $options = array()) { return $this->_engine->truncate($text, $length, $options); } /** * Truncates text starting from the end. * * Cuts a string to the length of $length and replaces the first characters * with the ellipsis if the text is longer than length. * * ### Options: * * - `ellipsis` Will be used as Beginning and prepended to the trimmed string * - `exact` If false, $text will not be cut mid-word * * @param string $text String to truncate. * @param int $length Length of returned string, including ellipsis. * @param array $options An array of html attributes and options. * @return string Trimmed string. * @see String::tail() * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::tail */ public function tail($text, $length = 100, $options = array()) { return $this->_engine->tail($text, $length, $options); } /** * Extracts an excerpt from the text surrounding the phrase with a number of characters on each side * determined by radius. * * @param string $text String to search the phrase in * @param string $phrase Phrase that will be searched for * @param int $radius The amount of characters that will be returned on each side of the founded phrase * @param string $ending Ending that will be appended * @return string Modified string * @see String::excerpt() * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::excerpt */ public function excerpt($text, $phrase, $radius = 100, $ending = '...') { return $this->_engine->excerpt($text, $phrase, $radius, $ending); } /** * Creates a comma separated list where the last two items are joined with 'and', forming natural English * * @param array $list The list to be joined * @param string $and The word used to join the last and second last items together with. Defaults to 'and' * @param string $separator The separator used to join all the other items together. Defaults to ', ' * @return string The glued together string. * @see String::toList() * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/text.html#TextHelper::toList */ public function toList($list, $and = 'and', $separator = ', ') { return $this->_engine->toList($list, $and, $separator); } }