Various text helpers such as limiting.
This is the code documentation for the SproutCMS project
Search documentation |
class TextVarious text helpers such as limiting.
Functions
public alternatestring Text::alternate ( ); Alternates between two or more strings. public autoLinkstring Text::autoLink ( string $text ); Converts text email addresses and anchors into links. public autoLinkEmailsstring Text::autoLinkEmails ( string $text ); Converts text email addresses into links. public autoLinkUrlsstring Text::autoLinkUrls ( string $text ); Converts text anchors into links. public autoPstring Text::autoP ( string $str ); Automatically applies and public bytesstring Text::bytes ( integer $bytes [, string $force_unit [, string $format [, boolean $si ]]] ); Returns human readable sizes. public camel2lcstring Text::camel2lc ( string $name ); Convert a CamelCaps or camelCase name into a lower_case names public censorstring Text::censor ( string $str , array $badwords [, string $replacement [, boolean $replace_partial_words ]] ); Replaces the given words with a string. public containsFormTagbool Text::containsFormTag ( string $html ); Determines whether given HTML contains a FORM tag, which can cause nested-forms issues Not tested with malformed input - should not be used as an XSS filter public copyrightstring Text::copyright ( string $year ); Returns current year or original year and current year of copyright public lc2camelcapsstring Text::lc2camelcaps ( string $name ); Convert a lower_case names into CamelCaps names public lc2camelcasestring Text::lc2camelcase ( string $name ); Convert a lower_case names into camelCase names public limitCharsstring Text::limitChars ( string $str [, int $limit [, string $end_char [, boolean $preserve_words ]]] ); Limits a plain-text phrase to a given number of characters. public limitWordsstring Text::limitWords ( string $str [, int $limit [, string $end_char ]] ); Limits a plain-text phrase to a given number of words. public limitWordsHtmlunknown Text::limitWordsHtml ( mixed $text [, mixed $limit ] ); Limits HTML to a certain number of words. Is aware of tags etc and will not count them in the word-count, as well as closing them properly. This doesn't actually pass all unit tests at the moment - an exact match in num words will still put in ... part. public limitedSubsetHtmlstring Text::limitedSubsetHtml ( string $html ); Encode HTML so it's suitable for direct output, but allow some HTML tags to be left as-is Only a limited subset of tags are left alone, all other tags are stripped. Allowed tags: A, B, I, STRONG, EM, BR, IMG, SPAN, ABBR, SUP, SUB The algorithm used in this method is quite simple, so this method should not be used as a defence against XSS attacks; it should only be used on trusted input such as Form helptext. public ordinalizeunknown Text::ordinalize ( mixed $number ); Returns a number with an english suffix appended (e.g. 1st, 5th, 12th, 123rd) public plainstring Text::plain ( string $html [, int $max_words ] ); Make a chunk of valid HTML into plain text, and (optionally) limit the number of words. public reduceSlashesstring Text::reduceSlashes ( string $str ); Reduces multiple slashes in a string to single slashes. public richtextstring Text::richtext ( string $text [, string $block_elem ] ); Make a chunk of plain text into HTML rich text The text will be wrapped within a block element (default is a P tag) public similarstring Text::similar ( array $words ); Finds the text that is similar between a set of words. public widontstring Text::widont ( string $str ); Prevents widow words by inserting a non-breaking space between the last two words. |
Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Monday, 3rd April, 2023 at 02:59 pm |