Functions

Smarty capitalize modifier plugin

smarty_modifier_capitalize(string $string, boolean $uc_digits, boolean $lc_rest) : string

Type: modifier
Name: capitalize
Purpose: capitalize words in the string

author Monte Ohrt <monte at ohrt dot com>
author Rodney Rehm

Parameters

$string

string

string to capitalize

$uc_digits

boolean

also capitalize "x123" to "X123"

$lc_rest

boolean

capitalize first letters, lowercase all following letters "aAa" to "Aaa"

Returns

stringcapitalized string

Smarty date_format modifier plugin

smarty_modifier_date_format(string $string, string $format, string $default_date, string $formatter) : string

Type: modifier
Name: date_format
Purpose: format datestamps via strftime
Input:
- string: input date string - format: strftime format for output - default_date: default date if $string is empty

link date_format (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>
uses \global\smarty_make_timestamp()

Parameters

$string

string

input date string

$format

string

strftime format for output

$default_date

string

default date if $string is empty

$formatter

string

either 'strftime' or 'auto'

Returns

string|void

Smarty escape modifier plugin

smarty_modifier_escape(string $string, string $esc_type, string $char_set, boolean $double_encode) : string

Type: modifier
Name: escape
Purpose: escape string for output

link count_characters (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

string

input string

$esc_type

string

escape type

$char_set

string

character set, used for htmlspecialchars() or htmlentities()

$double_encode

boolean

encode already encoded entitites again, used for htmlspecialchars() or htmlentities()

Returns

stringescaped input string

Smarty regex_replace modifier plugin

smarty_modifier_regex_replace(string $string, string | array $search, string | array $replace) : string

Type: modifier
Name: regex_replace
Purpose: regular expression search/replace

link regex_replace (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

string

input string

$search

stringarray

regular expression(s) to search for

$replace

stringarray

string(s) that should be replaced

Returns

string

Smarty replace modifier plugin

smarty_modifier_replace(string $string, string $search, string $replace) : string

Type: modifier
Name: replace
Purpose: simple search/replace

link replace (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>
author Uwe Tews

Parameters

$string

string

input string

$search

string

text to search for

$replace

string

replacement text

Returns

string

Smarty spacify modifier plugin

smarty_modifier_spacify(string $string, string $spacify_char) : string

Type: modifier
Name: spacify
Purpose: add spaces between characters in a string

link spacify (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

string

input string

$spacify_char

string

string to insert between characters.

Returns

string

Smarty truncate modifier plugin

smarty_modifier_truncate(string $string, integer $length, string $etc, boolean $break_words, boolean $middle) : string

Type: modifier
Name: truncate
Purpose: Truncate a string to a certain length if necessary, optionally splitting in the middle of a word, and appending the $etc string or inserting $etc into the middle.

link truncate (Smarty online manual)
author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

string

input string

$length

integer

length of truncated text

$etc

string

end string

$break_words

boolean

truncate at word boundary

$middle

boolean

truncate in the middle of text

Returns

stringtruncated string