word_limiter()

word_limiter($str[, $limit = 100[, $end_char = '…']]) Parameters: $str (string) – Input string $limit (int) – Limit $end_char (string) – End character (usually an ellipsis) Returns: Word-limited string Return type: string Truncates a string to the number of words specified. Example: $string = "Here is a nice text string consisting of eleven words."; $string = word_limiter($string, 4); // Returns: Here is a nice The third parameter is an optional suffix added to the string. By de

word_wrap()

word_wrap($str[, $charlim = 76]) Parameters: $str (string) – Input string $charlim (int) – Character limit Returns: Word-wrapped string Return type: string Wraps text at the specified character count while maintaining complete words. Example: $string = "Here is a simple string of text that will help us demonstrate this function."; echo word_wrap($string, 25); // Would produce: // Here is a simple string // of text that will help us // demonstrate this // function.

quotes_to_entities()

quotes_to_entities($str) Parameters: $str (string) – Input string Returns: String with quotes converted to HTML entities Return type: string Converts single and double quotes in a string to the corresponding HTML entities. Example: $string = "Joe's \"dinner\""; $string = quotes_to_entities($string); //results in "Joe's "dinner""

increment_string()

increment_string($str[, $separator = '_'[, $first = 1]]) Parameters: $str (string) – Input string $separator (string) – Separator to append a duplicate number with $first (int) – Starting number Returns: An incremented string Return type: string Increments a string by appending a number to it or increasing the number. Useful for creating “copies” or a file or duplicating database content which has unique titles or slugs. Usage example: echo increment_string('file', '_'); // "file_

strip_slashes()

strip_slashes($data) Parameters: $data (mixed) – Input string or an array of strings Returns: String(s) with stripped slashes Return type: mixed Removes any slashes from an array of strings. Example: $str = array( 'question'  => 'Is your name O\'reilly?', 'answer' => 'No, my name is O\'connor.' ); $str = strip_slashes($str); The above will return the following array: array( 'question'  => "Is your name O'reilly?", 'answer' => "No, my nam

CI_Parser::set_delimiters()

set_delimiters([$l = '{'[, $r = '}']]) Parameters: $l (string) – Left delimiter $r (string) – Right delimiter Return type: void Sets the delimiters (opening and closing) for a pseudo-variable “tag” in a template.

prep_url()

prep_url($str = '') Parameters: $str (string) – URL string Returns: Protocol-prefixed URL string Return type: string This function will add http:// in the event that a protocol prefix is missing from a URL. Pass the URL string to the function like this: $url = prep_url('example.com');

reduce_double_slashes()

reduce_double_slashes($str) Parameters: $str (string) – Input string Returns: A string with normalized slashes Return type: string Converts double slashes in a string to a single slash, except those found in URL protocol prefixes (e.g. http://). Example: $string = "http://example.com//index.php"; echo reduce_double_slashes($string); // results in "http://example.com/index.php"

get_clickable_smileys()

get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]) Parameters: $image_url (string) – URL path to the smileys directory $alias (string) – Field alias Returns: An array of ready to use smileys Return type: array Returns an array containing your smiley images wrapped in a clickable link. You must supply the URL to your smiley folder and a field id or field alias. Example: $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comment');

parse_smileys()

parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]]) Parameters: $str (string) – Text containing smiley codes $image_url (string) – URL path to the smileys directory $smileys (array) – An array of smileys Returns: Parsed smileys Return type: string Takes a string of text as input and replaces any contained plain text smileys into the image equivalent. The first parameter must contain your string, the second must contain the URL to your smiley folder Example: $str = 'He