Class Text

Methods summary

public static string
# encodePath( string $path )

URL-encodes collection path

public static boolean
# match( string $pattern, string $value )

Determine if a given string matches a given pattern.

public string
# slugSafeString( string $handle, integer $maxlength = 128 )

Remove unsafe characters for URL slug

public string
# sanitize( string $string, integer $max_length = 0, string $allowed = '' )

Strips tags and optionally reduces string to specified length.

public string
# email( string $email )

Leaves only characters that are valid in email addresses (RFC)

public string
# alphanum( string $string )

Leaves only characters that are alpha-numeric

public string
# entities( string $v )

always use in place of htmlentites(), so it works with different languages

public string
# decodeEntities( string $v )

Decodes html-encoded entities (for instance: from '>' to '>')

public string
# specialchars( $v )

A concrete5 specific version of htmlspecialchars(). Double encoding is OFF, and the character set is set to your site's.

public string
# shorten( string $textStr, integer $numChars = 255, string $tail = '…' )

An alias for shorten()

public string
# shortText( string $textStr, integer $numChars = 255, string $tail = '…' )

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

public string
# camelcase( string $string )

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

public 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.

public
# prettyStripTags( $input, $allowedTags = null )

Runs strip_tags but ensures that spaces are kept between the stripped tags.

public boolean
# fnmatch( string $pattern, string $string )

A wrapper for PHP's fnmatch() function, which some installations don't have.

public string
# uncamelcase( string $string )

Takes a CamelCase string and turns it into camel_case

public string
# unhandle( string $string )

Takes a handle-based string like "blah_blah" or "blah-blah" or "blah/blah" and turns it into "Blah Blah"

public string
# handle( $handle, boolean $leaveSlashes = false )

Takes a string and turns it into a handle.

public string
# sanitizeFileSystem( string $handle )
public string
# urlify( string $handle, integer $max_length = null, string $locale = '', boolean $removeExcludedWords = true )

Takes text and returns it in the "lowercase-and-dashed-with-no-punctuation" format

public 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).

public string
# wordSafeShortText( string $textStr, integer $numChars = 255, string $tail = '…' )

alias of shortenTextWord()

public string
# shortenTextWord( $textStr, integer $numChars = 255, string $tail = '…' )

Shortens and sanitizes a string but only cuts at word boundaries

public string
# filterNonAlphaNum( string $val )

Strips out non-alpha-numeric characters

public string
# highlightSearch( string $value, string $searchString )

Highlights a string within a string with the class ccm-highlight-search

public string
# formatXML( $xml )

Formats a passed XML string nicely

public
# appendXML( SimpleXMLElement $root, SimpleXMLElement $new )

Appends a SimpleXMLElement to a SimpleXMLElement