49 $this->applicationRootPath = dirname(dirname(dirname(dirname(dirname(dirname(__DIR__))))));
65 $flags |= ENT_SUBSTITUTE;
74 $raw = str_replace(chr(9),
' ', $raw);
76 return htmlspecialchars($raw, $flags,
"UTF-8");
88 $escaped = $this->
escape($raw);
90 "@([A-z]+?://([-\w\.]+[-\w])+(:\d+)?(/([\w/_\.#-]*(\?\S+)?[^\.\s])?)?)@",
91 "<a href=\"$1\" target=\"_blank\" rel=\"noreferrer noopener\">$1</a>",
106 foreach ($parts as &$part) {
107 $part =
'<div class="delimiter">' . $part .
'</div>';
121 if ($this->applicationRootPath !=
"/") {
122 $path = str_replace($this->applicationRootPath,
'…',
$path);
130 if (!$this->htmlDumper && class_exists(
'Symfony\Component\VarDumper\Cloner\VarCloner')) {
133 $this->htmlDumper =
new HtmlDumper($this->htmlDumperOutput);
136 'default' =>
'color:#FFFFFF; line-height:normal; font:12px "Inconsolata", "Fira Mono", "Source Code Pro", Monaco, Consolas, "Lucida Console", monospace !important; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: normal',
137 'num' =>
'color:#BCD42A',
138 'const' =>
'color: #4bb1b1;',
139 'str' =>
'color:#BCD42A',
140 'note' =>
'color:#ef7c61',
141 'ref' =>
'color:#A0A0A0',
142 'public' =>
'color:#FFFFFF',
143 'protected' =>
'color:#FFFFFF',
144 'private' =>
'color:#FFFFFF',
145 'meta' =>
'color:#FFFFFF',
146 'key' =>
'color:#BCD42A',
147 'index' =>
'color:#ef7c61',
149 $this->htmlDumper->setStyles(
$styles);
168 if (class_exists(
'Symfony\Component\VarDumper\Caster\Caster')) {
169 $cloneVar = $this->
getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE);
172 $cloneVar = $this->
getCloner()->cloneVar($value);
177 $this->htmlDumperOutput
180 $output = $this->htmlDumperOutput->getOutput();
181 $this->htmlDumperOutput->clear();
186 return htmlspecialchars(print_r($value,
true));
203 $numFrames = count($frame->
getArgs());
205 if ($numFrames > 0) {
206 $html =
'<ol class="linenums">';
207 foreach ($frame->
getArgs() as $j => $frameArg) {
208 $html .=
'<li>'. $this->
dump($frameArg) .
'</li>';
222 public function slug($original)
224 $slug = str_replace(
" ",
"-", $original);
225 $slug = preg_replace(
'/[^\w\d\-\_]/i',
'', $slug);
226 return strtolower($slug);
244 if ($additionalVariables !== null) {
248 call_user_func(
function () {
249 extract(func_get_arg(1));
250 require func_get_arg(0);
273 $this->variables[$variableName] = $variableValue;
286 return isset($this->variables[$variableName]) ?
287 $this->variables[$variableName] : $defaultValue;
297 unset($this->variables[$variableName]);
327 if (!$this->cloner) {
328 $this->cloner =
new VarCloner();
setCloner($cloner)
Set the cloner used for dumping variables.
breakOnDelimiter($delimiter, $s)
Makes sure that the given string breaks on the delimiter.
slug($original)
Convert a string to a slug version of itself.
Used as output callable for Symfony::dump()
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...
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
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...
getCloner()
Get the cloner used for dumping variables.
getApplicationRootPath()
Return the application root path.
dump($value)
Format the given value into a human readable string.
Create styles array
The data for the language used.
shorten($path)
Replace the part of the path that all files have in common.
getVariables()
Returns all variables for this helper.
setApplicationRootPath($applicationRootPath)
Set the application root path.
Whoops - php errors for cool kids.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
dumpArgs(Frame $frame)
Format the args of the given Frame as a human readable html string.