[ Index ] |
|
Code source de CakePHP 1.1.13.4450 |
[Code source] [Imprimer] [Statistiques]
Text Helper Text manipulations: Highlight, excerpt, truncate, strip of links, convert email addresses to mailto: links...
Copyright: | Copyright 2005-2007, Cake Software Foundation, Inc. |
License: | http://www.opensource.org/licenses/mit-license.php The MIT License |
Version: | $Revision: 4409 $ |
Poids: | 238 lignes (7 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
TextHelper:: (9 méthodes):
highlight()
stripLinks()
autoLinkUrls()
autoLinkEmails()
autoLink()
truncate()
trim()
excerpt()
flay()
Classe: TextHelper - X-Ref
Text helper library.highlight($text, $phrase, $highlighter = '<span class="highlight">\1</span>') X-Ref |
Highlights a given phrase in a text. param: string $text Text to search the phrase in param: string $phrase The phrase that will be searched param: string $highlighter The piece of html with that the phrase will be highlighted return: string The highlighted text |
stripLinks($text) X-Ref |
Strips given text of all links (<a href=....) param: string $text Text return: string The text without links |
autoLinkUrls($text, $htmlOptions = array() X-Ref |
Adds links (<a href=....) to a given text, by finding text that begins with strings like http:// and ftp://. param: string $text Text to add links to param: array $htmlOptions Array of HTML options. return: string The text with links |
autoLinkEmails($text, $htmlOptions = array() X-Ref |
Adds email links (<a href="mailto:....) to a given text. param: string $text Text param: array $htmlOptions Array of HTML options. return: string The text with links |
autoLink($text, $htmlOptions = array() X-Ref |
Convert all links and email adresses to HTML links. param: string $text Text param: array $htmlOptions Array of HTML options. return: string The text with links |
truncate($text, $length, $ending = '...', $exact = true) X-Ref |
Truncates text. Cuts a string to the length of $length and replaces the last characters with the ending if the text is longer than length. param: string $text String to truncate. param: integer $length Length of returned string, including ellipsis. param: string $ending Ending to be appended to the trimmed string. param: boolean $exact If false, $test will not be cut mid-word return: string Trimmed string. |
trim() X-Ref |
Alias for truncate(). return: Text::truncate() |
excerpt($text, $phrase, $radius = 100, $ending = "...") X-Ref |
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: integer $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 |
flay($text, $allowHtml = false) X-Ref |
Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax. param: string $text String to "flay" param: boolean $allowHtml Set to true if if html is allowed return: string "Flayed" text |
Généré le : Sun Feb 25 19:27:47 2007 | par Balluche grâce à PHPXref 0.7 |