Functions

escape_special_chars common function

smarty_function_escape_special_chars(string $string) : string

Function: smarty_function_escape_special_chars
Purpose: used by other smarty functions to escape special chars except for already escaped ones

author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

string

text that should by escaped

Returns

string

escape_special_chars common function

smarty_function_escape_special_chars(string $string) : string

Function: smarty_function_escape_special_chars
Purpose: used by other smarty functions to escape special chars except for already escaped ones

author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

string

text that should by escaped

Returns

string

evaluate compiler parameter

smarty_literal_compiler_param(array $params, integer $index, mixed $default) : mixed
author Rodney Rehm

Parameters

$params

array

parameter array as given to the compiler function

$index

integer

array index of the parameter to convert

$default

mixed

value to be returned if the parameter is not present

Exceptions

\SmartyException if parameter is not a literal (but an expression, variable, …)

Returns

mixedevaluated value of parameter or $default

Function: smarty_make_timestamp<br> Purpose: used by other smarty functions to make a timestamp from a string.

smarty_make_timestamp(\DateTime | int | string $string) : int
author Monte Ohrt <monte at ohrt dot com>

Parameters

$string

\DateTimeintstring

date object, timestamp or string that can be converted using strtotime()

Returns

int

convert unicodes to the character of given encoding

smarty_mb_from_unicode(integer | array $unicode, string $encoding) : string
link for inspiration
author Rodney Rehm

Parameters

$unicode

integerarray

single unicode or list of unicodes to convert

$encoding

string

encoding of returned string, if null mb_internal_encoding() is used

Returns

stringunicode as character sequence in given $encoding

Multibyte string replace

smarty_mb_str_replace(string $search, string $replace, string $subject, int $count) : string
author Rodney Rehm

Parameters

$search

string

the string to be searched

$replace

string

the replacement string

$subject

string

the source string

$count

int

&$count number of matches found

Returns

stringreplaced string

convert characters to their decimal unicode equivalents

smarty_mb_to_unicode(string $string, string $encoding) : array
link for inspiration
author Rodney Rehm

Parameters

$string

string

characters to calculate unicode of

$encoding

string

encoding of $string, if null mb_internal_encoding() is used

Returns

arraysequence of unicodes

Wrap a string to a given number of characters

smarty_mb_wordwrap(string $str, int $width, string $break, boolean $cut) : string
link for similarity
author Rodney Rehm

Parameters

$str

string

the string to wrap

$width

int

the width of the output

$break

string

the character used to break the line

$cut

boolean

ignored parameter, just for the sake of

Returns

stringwrapped string