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

Class Concrete5_Helper_Text

Direct known subclasses

TextHelper

Package: Helpers
Copyright: Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
License: MIT License
Author: Andrew Embler andrew@concrete5.org
Located at core/helpers/text.php

Methods summary

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
# sanitizeFileSystem( string $handle )
public string
# urlify( string $handle, string $maxlength = PAGE_PATH_SEGMENT_MAX_LENGTH, string $locale = '', boolean $removeExcludedWords = true )

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

public string
# sanitize( string $string, integer $maxlength = 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
# 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
# shortenTextWord( string $textStr, integer $numChars = 255, string $tail = '…' )

Shortens and sanitizes a string but only cuts at word boundaries

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 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
# handle( $handle, $leaveSlashes = false )

Takes a string and turns it into a handle.

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

alias of shortenTextWord()

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( string $xml )

Formats a passed XML string nicely

public
# appendXML( $root, $new )

Appends a SimpleXMLElement to a SimpleXMLElement