32 if (defined(
"ENT_SUBSTITUTE") && !defined(
"HHVM_VERSION")) {
33 $flags |= ENT_SUBSTITUTE;
42 return htmlspecialchars($raw, $flags,
"UTF-8");
54 $escaped = $this->
escape($raw);
56 "@([A-z]+?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@",
57 "<a href=\"$1\" target=\"_blank\">$1</a>", $escaped
67 public function slug($original)
69 $slug = str_replace(
" ",
"-", $original);
70 $slug = preg_replace(
'/[^\w\d\-\_]/i',
'', $slug);
71 return strtolower($slug);
82 public function render($template, array $additionalVariables = null)
89 if ($additionalVariables !== null) {
93 call_user_func(
function () {
94 extract(func_get_arg(1));
95 require func_get_arg(0);
118 $this->variables[$variableName] = $variableValue;
131 return isset($this->variables[$variableName]) ?
132 $this->variables[$variableName] : $defaultValue;
142 unset($this->variables[$variableName]);
slug($original)
Convert a string to a slug version of itself.
escape($raw)
Escapes a string for output in an HTML document.
Exposes useful tools for working with/in templates.
delVariable($variableName)
Unsets a single template variable, by its name.
setVariables(array $variables)
Sets the variables to be passed to all templates rendered by this template helper.
getVariable($variableName, $defaultValue=null)
Gets a single template variable, by its name, or $defaultValue if the variable does not exist...
render($template, array $additionalVariables=null)
Given a template path, render it within its own scope.
setVariable($variableName, $variableValue)
Sets a single template variable, by its name:
escapeButPreserveUris($raw)
Escapes a string for output in an HTML document, but preserves URIs within it, and converts them to c...
getVariables()
Returns all variables for this helper.
Whoops - php errors for cool kids.