Text
class Text (View source)
Methods
URL-encodes collection path.
Determine if a given string matches a given pattern.
Remove unsafe characters for URL slug.
Strips tags and optionally reduces string to specified length.
Leaves only characters that are valid in email addresses (RFC).
Leaves only characters that are alpha-numeric.
always use in place of htmlentites(), so it works with different languages.
Decodes html-encoded entities (for instance: from '>' to '>').
A concrete5 specific version of htmlspecialchars(). Double encoding is OFF, and the character set is set to your site's.
An alias for shortText().
Like sanitize, but requiring a certain number characters, and assuming a tail.
Takes a string and turns it into the CamelCase or StudlyCaps version.
automatically add hyperlinks to any twitter style @usernames in a string.
Runs a number of text functions, including autolink, nl2br, strip_tags. Assumes that you want simple text comments but with a few niceties.
Runs strip_tags but ensures that spaces are kept between the stripped tags.
Scans passed text and automatically hyperlinks any URL inside it.
A wrapper for PHP's fnmatch() function, which some installations don't have.
Takes a CamelCase string and turns it into camel_case.
Takes a handle-based string like "blah_blah" or "blah-blah" or "blah/blah" and turns it into "Blah Blah".
Takes a string and turns it into a handle.
No description
Takes text and returns it in the "lowercase-and-dashed-with-no-punctuation" format.
Takes text and converts it to an ASCII-only string (characters with code between 32 and 127, plus \t, \n and \r).
alias of shortenTextWord().
Shortens and sanitizes a string but only cuts at word boundaries.
Strips out non-alpha-numeric characters.
Highlights a string within a string with the class ccm-highlight-search.
Formats a passed XML string nicely.
Appends a SimpleXMLElement to a SimpleXMLElement.
Details
static string
encodePath(string $path)
URL-encodes collection path.
static bool
match(string $pattern, string $value)
Determine if a given string matches a given pattern.
string
slugSafeString(string $handle, int $maxlength = 128)
Remove unsafe characters for URL slug.
string
sanitize(string $string, int $max_length = 0, string $allowed = '')
Strips tags and optionally reduces string to specified length.
string
email(string $email)
Leaves only characters that are valid in email addresses (RFC).
string
alphanum(string $string)
Leaves only characters that are alpha-numeric.
string
entities(string $v)
always use in place of htmlentites(), so it works with different languages.
string
decodeEntities(string $v)
Decodes html-encoded entities (for instance: from '>' to '>').
string
specialchars(string $v)
A concrete5 specific version of htmlspecialchars(). Double encoding is OFF, and the character set is set to your site's.
string
shorten(string $textStr, int $numChars = 255, string $tail = '…')
An alias for shortText().
string
shortText(string $textStr, int $numChars = 255, string $tail = '…')
Like sanitize, but requiring a certain number characters, and assuming a tail.
string
camelcase(string $string)
Takes a string and turns it into the CamelCase or StudlyCaps version.
string
twitterAutolink(string $input, int $newWindow = 0, int $withSearch = 0)
automatically add hyperlinks to any twitter style @usernames in a string.
string
makenice(string $input)
Runs a number of text functions, including autolink, nl2br, strip_tags. Assumes that you want simple text comments but with a few niceties.
prettyStripTags($input, $allowedTags = null)
Runs strip_tags but ensures that spaces are kept between the stripped tags.
string
autolink(string $input, bool $newWindow = false, string $defaultProtocol = 'http://')
Scans passed text and automatically hyperlinks any URL inside it.
bool
fnmatch(string $pattern, string $string)
A wrapper for PHP's fnmatch() function, which some installations don't have.
string
uncamelcase(string $string)
Takes a CamelCase string and turns it into camel_case.
string
unhandle(string $string)
Takes a handle-based string like "blah_blah" or "blah-blah" or "blah/blah" and turns it into "Blah Blah".
string
handle($handle, bool $leaveSlashes = false)
Takes a string and turns it into a handle.
string
sanitizeFileSystem(string $handle)
No description
string
urlify(string $handle, int $max_length = null, string $locale = '', bool $removeExcludedWords = true)
Takes text and returns it in the "lowercase-and-dashed-with-no-punctuation" format.
string
asciify(string $text, string $locale = '')
Takes text and converts it to an ASCII-only string (characters with code between 32 and 127, plus \t, \n and \r).
string
wordSafeShortText(string $textStr, int $numChars = 255, string $tail = '…')
alias of shortenTextWord().
string
shortenTextWord($textStr, int $numChars = 255, string $tail = '…')
Shortens and sanitizes a string but only cuts at word boundaries.
string
filterNonAlphaNum(string $val)
Strips out non-alpha-numeric characters.
string
highlightSearch(string $value, string $searchString)
Highlights a string within a string with the class ccm-highlight-search.
string
formatXML($xml)
Formats a passed XML string nicely.
appendXML(SimpleXMLElement $root, SimpleXMLElement $new)
Appends a SimpleXMLElement to a SimpleXMLElement.