This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The text helper contains functions useful when working with text, apart from validation.

Loading the Helper

$th = Loader::helper(‘text’);

Methods

$r = $th->sanitizeFileSystem($text, $leaveSlashes=false)

Takes text and returns it in the "lowercase_and_underscored_with_no_punctuation" format. Tries to be sensible about internationalized characters, converting umlauts, etc…

$text = $th->sanitize($text, $maxlength = 0)

Strips tags and optionally reduces string to specified length.

$text = $th->entities($text)

Runs htmlentities on $text, but uses the built-in concrete5 APP_CHARSET constant.

$text = $th->shorten($text, $numChars = 255, $tail = ‘…’)

Like sanitize, but requiring a certain number characters, and assuming a tail

$text = $th->camelcase($text)

Takes a string and turns it into the CamelCase or StudlyCaps version.

$text = $th->autolink($text, $newWindow = 0)

Scans passed text and automatically hyperlinks any URL inside it.

$text = $th->twitterAutoLink($text, $newWindow = 0, $withSearch = 0)

Automatically add hyperlinks to any twitter style @usernames in a string.

$text = $th->makenice($text)

Runs a number of text functions, including autolink, nl2br, strip_tags. Assumes that you want simple text comments but witih a few niceties.

$text = $th->fnmatch($text)

A wrapper for PHP’s fnmatch() function, which some installations don’t have. Supports these installations by using a simple regular expression.

$text = $th->uncamelcase($text)

Takes a CamelCase string and turns it into camel_case.

$text = $th->unhandle($text)

Takes a handle-based string like "blah_blah" and turns it into "Blah Blah".

$text = $th->filterNonAlphaNum($text)

Strips out non-alpha-numeric characters.

$text = $th->highlightSearch($text, $searchString)

Useful for highlighting search strings within results (for nice display). Wraps matches in an EM tag with a class of “ccm-highlight-search.”

Loading Conversation