{% extends "partials/page_head.html.twig" %}
{% block head_application -%}
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{{ errorcode|default(500) }} {{ error|default('GANTRY5_ENGINE_UNKNOWN_ERROR'|trans) }}</title>
{% do gantry.document.errorPage(true) -%}
{% do gantry.platform.finalize() -%}
{{ gantry.styles('head', true)|join("\n ")|raw }}
{{ gantry.scripts('head', true)|join("\n ")|raw }}
{%- endblock %}
Arguments
"An exception has been thrown during the rendering of a template ("Creation of dynamic property Leafo\ScssPhp\Block::$name is deprecated")."
$this->displayBlock('head_overrides', $context, $blocks);
$content = ob_get_clean();
$assetFunction($content, $location, $priority);
// line 50
echo "<head>
";
// line 51
echo twig_join_filter($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "getHtml", [0 => "head_top"], "method"), "
");
echo "
";
// line 52
$this->displayBlock('head_meta', $context, $blocks);
// line 78
$this->displayBlock('head_title', $context, $blocks);
// line 82
echo "
";
// line 83
$this->displayBlock('head_application', $context, $blocks);
// line 87
echo "
";
// line 88
$this->displayBlock('head_ie_stylesheets', $context, $blocks);
// line 91
$this->displayBlock('head', $context, $blocks);
// line 92
$this->displayBlock('head_custom', $context, $blocks);
// line 97
echo twig_join_filter($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "getHtml", [0 => "head_bottom"], "method"), "
");
echo "
</head>
";
}
// line 7
public function block_head_stylesheets($context, array $blocks = [])
{
parent::__construct($env);
$this->blocks = [
'head_title' => [$this, 'block_head_title'],
'head_application' => [$this, 'block_head_application'],
'head_platform' => [$this, 'block_head_platform'],
'head' => [$this, 'block_head'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "@nucleus/page_head.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("@nucleus/page_head.html.twig", "partials/page_head.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_head_title($context, array $blocks = [])
{
}
// line 6
public function block_head_application($context, array $blocks = [])
{
// line 7
if ($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "platform", []), "checkVersion", [0 => 4], "method")) {
echo " ";
// line 8
echo " <jdoc:include type=\"metas\" />
<jdoc:include type=\"styles\" />
<jdoc:include type=\"scripts\" />
";
} elseif ($this->getAttribute($this->getAttribute( // line 11
($context["gantry"] ?? null), "platform", []), "checkVersion", [0 => 3], "method")) {
{
public function __construct(Environment $env)
{
parent::__construct($env);
$this->blocks = [
'head_application' => [$this, 'block_head_application'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "partials/page_head.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("partials/page_head.html.twig", "partials/error_head.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_head_application($context, array $blocks = [])
{
// line 4
echo "<meta charset=\"utf-8\" />
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />
<title>";
// line 6
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), $this->env->getExtension('Gantry\Component\Twig\TwigExtension')->transFilter("GANTRY5_ENGINE_UNKNOWN_ERROR"))) : ($this->env->getExtension('Gantry\Component\Twig\TwigExtension')->transFilter("GANTRY5_ENGINE_UNKNOWN_ERROR"))), "html", null, true);
echo "</title>
";
// line 7
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "errorPage", [0 => true], "method");
// line 8
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "platform", []), "finalize", [], "method");
// line 9
];
}
protected function doGetParent(array $context)
{
// line 1
return "partials/page.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("partials/page.html.twig", "error.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_page_head($context, array $blocks = [])
{
// line 4
$this->loadTemplate("partials/error_head.html.twig", "error.html.twig", 4)->display($context);
}
// line 7
public function block_content($context, array $blocks = [])
{
// line 8
echo " <h1>";
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), "Unknown Error")) : ("Unknown Error")), "html", null, true);
echo "</h1>
";
// line 9
echo ($context["backtrace"] ?? null);
echo "
";
}
public function getTemplateName()
{
if ($useBlocks && isset($blocks[$name])) {
$template = $blocks[$name][0];
$block = $blocks[$name][1];
} elseif (isset($this->blocks[$name])) {
$template = $this->blocks[$name][0];
$block = $this->blocks[$name][1];
} else {
$template = null;
$block = null;
}
// avoid RCEs when sandbox is enabled
if (null !== $template && !$template instanceof self) {
throw new \LogicException('A block must be a method on a \Twig\Template instance.');
}
if (null !== $template) {
try {
$template->$block($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($template->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
$e->guess();
throw $e;
}
} elseif (false !== $parent = $this->getParent($context)) {
$parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
$context["body_top"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 59
ob_start(function () { return ''; });
// line 60
echo " ";
$this->displayBlock('body_bottom', $context, $blocks);
// line 62
echo " ";
echo twig_join_filter($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "getHtml", [0 => "body_bottom"], "method"), "
");
echo "
";
$context["body_bottom"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 65
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "addScript", [0 => $this->env->getExtension('Gantry\Component\Twig\TwigExtension')->urlFunc("gantry-assets://js/main.js"), 1 => 11, 2 => "footer"], "method");
// line 69
ob_start(function () { return ''; });
// line 70
echo " ";
$this->displayBlock('page_head', $context, $blocks);
$context["page_head"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 75
ob_start(function () { return ''; });
// line 76
echo " ";
$this->displayBlock('page_footer', $context, $blocks);
// line 80
echo "
";
// line 81
echo $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "debugger", []), "render", [], "method");
echo "
";
$context["page_footer"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 84
$this->displayBlock('page', $context, $blocks);
}
// line 8
public function block_content($context, array $blocks = [])
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
{
public function __construct(Environment $env)
{
parent::__construct($env);
$this->blocks = [
'page_footer' => [$this, 'block_page_footer'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "@nucleus/page.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("@nucleus/page.html.twig", "partials/page.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_page_footer($context, array $blocks = [])
{
// line 4
echo " ";
$this->displayParentBlock("page_footer", $context, $blocks);
echo "
<jdoc:include type=\"modules\" name=\"debug\" />
";
}
public function getTemplateName()
{
return "partials/page.html.twig";
}
public function isTraitable()
{
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
public function __construct(Environment $env)
{
parent::__construct($env);
$this->blocks = [
'page_head' => [$this, 'block_page_head'],
'content' => [$this, 'block_content'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "partials/page.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("partials/page.html.twig", "error.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_page_head($context, array $blocks = [])
{
// line 4
$this->loadTemplate("partials/error_head.html.twig", "error.html.twig", 4)->display($context);
}
// line 7
public function block_content($context, array $blocks = [])
{
// line 8
echo " <h1>";
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), "Unknown Error")) : ("Unknown Error")), "html", null, true);
echo "</h1>
";
// line 9
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
* @internal
*/
public function __construct(Environment $env, Template $template)
{
$this->env = $env;
$this->template = $template;
}
/**
* Renders the template.
*
* @param array $context An array of parameters to pass to the template
*
* @return string The rendered template
*/
public function render($context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_num_args() > 1 ? func_get_arg(1) : []);
}
/**
* Displays the template.
*
* @param array $context An array of parameters to pass to the template
*/
public function display($context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
$this->template->display($context, \func_num_args() > 1 ? func_get_arg(1) : []);
}
/**
* Checks if a block is defined.
*
* @param string $name The block name
* @param array $context An array of parameters to pass to the template
*
@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
return $this->templateClassPrefix;
}
/**
* Renders a template.
*
* @param string|TemplateWrapper $name The template name
* @param array $context An array of parameters to pass to the template
*
* @return string The rendered template
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function render($name, array $context = [])
{
return $this->load($name)->render($context);
}
/**
* Displays a template.
*
* @param string|TemplateWrapper $name The template name
* @param array $context An array of parameters to pass to the template
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function display($name, array $context = [])
{
$this->load($name)->display($context);
}
/**
* Loads a template.
*
$this->renderer = $this->extendTwig($twig, $loader);
}
return $this->renderer;
}
/**
* Render a template file by using given context.
*
* @param string $file
* @param array $context
* @return string
*/
public function render($file, array $context = [])
{
// Include Gantry specific things to the context.
$context = $this->getContext($context);
return $this->renderer()->render($file, $context);
}
/**
* Compile and render twig string.
*
* @param string $string
* @param array $context
* @return string
*/
public function compile($string, array $context = [])
{
$renderer = $this->renderer();
$template = $renderer->createTemplate($string);
// Include Gantry specific things to the context.
$context = $this->getContext($context);
return $template->render($context);
}
// Bootstrap Gantry framework or fail gracefully (inside included file).
$gantry = include __DIR__ . '/includes/gantry.php';
/** @var \Gantry\Framework\Theme $theme */
$theme = $gantry['theme'];
$context = array(
'errorcode' => isset($this->error) ? $this->error->getCode() : null,
'error' => isset($this->error) ? $this->error->getMessage() : null,
'debug' => $app->get('debug_lang', '0') == '1' || $app->get('debug', '0') == '1',
'backtrace' => $this->debug ? $this->renderBacktrace() : null
);
// Reset used outline configuration.
unset($gantry['configuration']);
// Render the page.
echo $theme
->setLayout('_error', true)
->render('error.html.twig', $context);
*
* @param string $directory The name of the template
* @param string $filename The actual filename
*
* @return string The contents of the template
*
* @since 1.7.0
*/
protected function _loadTemplate($directory, $filename)
{
$contents = '';
// Check to see if we have a valid template file
if (is_file($directory . '/' . $filename)) {
// Store the file path
$this->_file = $directory . '/' . $filename;
// Get the file content
ob_start();
require $directory . '/' . $filename;
$contents = ob_get_contents();
ob_end_clean();
}
return $contents;
}
/**
* Fetch the template, and initialise the params
*
* @param array $params Parameters to determine the template
*
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
protected function _fetchTemplate($params = [])
{
// Check
$directory = $params['directory'] ?? 'templates';
Arguments
"/data/web/e65384/html/fluhm-at405/templates/g5_myriad/error.php"
}
}
}
// Load the language file for the template
$lang = CmsFactory::getLanguage();
// 1.5 or core then 1.6
$lang->load('tpl_' . $template, JPATH_BASE)
|| ($inherits !== '' && $lang->load('tpl_' . $inherits, JPATH_BASE))
|| $lang->load('tpl_' . $template, $directory . '/' . $template)
|| ($inherits !== '' && $lang->load('tpl_' . $inherits, $directory . '/' . $inherits));
// Assign the variables
$this->baseurl = Uri::base(true);
$this->params = $params['params'] ?? new Registry();
$this->template = $template;
// Load
$this->_template = $this->_loadTemplate($baseDir, $file);
return $this;
}
/**
* Parse a document template
*
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
protected function _parseTemplate()
{
$matches = [];
if (preg_match_all('#<jdoc:include\ type="([^"]+)"(.*)\/>#iU', $this->_template, $matches)) {
$messages = [];
$template_tags_first = [];
$template_tags_last = [];
$name = $options['name'] ?? '';
$title = $options['title'] ?? '';
parent::$_buffer[$type][$name][$title] = $content;
return $this;
}
/**
* Parses the template and populates the buffer
*
* @param array $params Parameters for fetching the template
*
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
public function parse($params = [])
{
return $this->_fetchTemplate($params)->_parseTemplate();
}
/**
* Outputs the template to the browser.
*
* @param boolean $caching If true, cache the output
* @param array $params Associative array of attributes
*
* @return string The rendered data
*
* @since 1.7.0
*/
public function render($caching = false, $params = [])
{
$this->_caching = $caching;
if (empty($this->_template)) {
$this->parse($params);
}
{
return $this->_fetchTemplate($params)->_parseTemplate();
}
/**
* Outputs the template to the browser.
*
* @param boolean $caching If true, cache the output
* @param array $params Associative array of attributes
*
* @return string The rendered data
*
* @since 1.7.0
*/
public function render($caching = false, $params = [])
{
$this->_caching = $caching;
if (empty($this->_template)) {
$this->parse($params);
}
if (\array_key_exists('csp_nonce', $params) && $params['csp_nonce'] !== null) {
$this->cspNonce = $params['csp_nonce'];
}
$data = $this->_renderTemplate();
parent::render($caching, $params);
return $data;
}
/**
* Count the modules in the given position
*
* @param string $positionName The position to use
* @param boolean $withContentOnly Count only a modules which actually has a content
*
* @return integer Number of modules found
*
if ($status < 400 || $status > 599) {
$status = 500;
}
$errorReporting = CmsFactory::getApplication()->get('error_reporting');
if ($errorReporting === "development" || $errorReporting === "maximum") {
$status .= ' ' . str_replace("\n", ' ', $this->_error->getMessage());
}
CmsFactory::getApplication()->setHeader('status', $status);
// Set variables
$this->debug = $params['debug'] ?? false;
$this->error = $this->_error;
$params['file'] = 'error.php';
return parent::render($cache, $params);
}
/**
* Render the backtrace
*
* @return string The contents of the backtrace
*
* @since 1.7.0
*/
public function renderBacktrace()
{
// If no error object is set return null
if (!isset($this->_error)) {
return;
}
// The back trace
$backtrace = $this->_error->getTrace();
// Add the position of the actual file
// Push the error object into the document
$this->getDocument()->setError($error);
// Add registry file for the template asset
$wa = $this->getDocument()->getWebAssetManager()->getRegistry();
$wa->addTemplateRegistryFile($template->template, $app->getClientId());
if (!empty($template->parent)) {
$wa->addTemplateRegistryFile($template->parent, $app->getClientId());
}
if (ob_get_contents()) {
ob_end_clean();
}
$this->getDocument()->setTitle(Text::_('Error') . ': ' . $error->getCode());
return $this->getDocument()->render(
false,
[
'template' => $template->template,
'directory' => JPATH_THEMES,
'debug' => JDEBUG,
'csp_nonce' => $app->get('csp_nonce'),
'templateInherits' => $template->parent,
'params' => $template->params,
]
);
}
}
* Lastly, if all else fails, we default onto the HTML format to at least render something
*/
if (Factory::$document) {
$format = Factory::$document->getType();
} else {
$format = $app->getInput()->getString('format', 'html');
}
try {
$renderer = AbstractRenderer::getRenderer($format);
} catch (\InvalidArgumentException $e) {
// Default to the HTML renderer
$renderer = AbstractRenderer::getRenderer('html');
}
// Reset the document object in the factory, this gives us a clean slate and lets everything render properly
Factory::$document = $renderer->getDocument();
Factory::getApplication()->loadDocument(Factory::$document);
$data = $renderer->render($error);
// If nothing was rendered, just use the message from the Exception
if (empty($data)) {
$data = $error->getMessage();
}
if ($isCli) {
echo $data;
} else {
/** @var CMSApplication $app */
// Do not allow cache
$app->allowCache(false);
$app->setBody($data);
}
// This return is needed to ensure the test suite does not trigger the non-Exception handling below
return;
} catch (\Throwable $errorRendererError) {
}
}
// Always return false, this will tell PHP to handle the error internally
return false;
}
/**
* Handles exceptions: logs errors and renders error page.
*
* @param \Exception|\Throwable $error An Exception or Throwable (PHP 7+) object for which to render the error page.
*
* @return void
*
* @since 3.10.0
*/
public static function handleException(\Throwable $error)
{
static::logException($error);
static::render($error);
}
/**
* Render the error page based on an exception.
*
* @param \Throwable $error An Exception or Throwable (PHP 7+) object for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(\Throwable $error)
{
try {
$app = Factory::getApplication();
// Flag if we are on cli
$isCli = $app->isClient('cli');
// If site is offline and it's a 404 error, just go to index (to see offline message, instead of 404)
$this->compress();
// Trigger the onAfterCompress event.
$this->triggerEvent('onAfterCompress');
}
} catch (\Throwable $throwable) {
/** @var ErrorEvent $event */
$event = AbstractEvent::create(
'onError',
[
'subject' => $throwable,
'eventClass' => ErrorEvent::class,
'application' => $this,
]
);
// Trigger the onError event.
$this->triggerEvent('onError', $event);
ExceptionHandler::handleException($event->getError());
}
// Trigger the onBeforeRespond event.
$this->getDispatcher()->dispatch('onBeforeRespond');
// Send the application response.
$this->respond();
// Trigger the onAfterRespond event.
$this->getDispatcher()->dispatch('onAfterRespond');
}
/**
* Check if the user is required to reset their password.
*
* If the user is required to reset their password will be redirected to the page that manage the password reset.
*
* @param string $option The option that manage the password reset
* @param string $view The view that manage the password reset
* @param string $layout The layout of the view that manage the password reset
}
$this->seek($s);
if ($this->literal('@media', 6) && $this->mediaQueryList($mediaQueryList) && $this->matchChar('{')) {
$media = $this->pushSpecialBlock(Type::T_MEDIA, $s);
$media->queryList = $mediaQueryList[2];
return true;
}
$this->seek($s);
if ($this->literal('@mixin', 6) &&
$this->keyword($mixinName) &&
($this->argumentDef($args) || true) &&
$this->matchChar('{')
) {
$mixin = $this->pushSpecialBlock(Type::T_MIXIN, $s);
$mixin->name = $mixinName;
$mixin->args = $args;
return true;
}
$this->seek($s);
if ($this->literal('@include', 8) &&
$this->keyword($mixinName) &&
($this->matchChar('(') &&
($this->argValues($argValues) || true) &&
$this->matchChar(')') || true) &&
($this->end() ||
$this->matchChar('{') && $hasBlock = true)
) {
$child = [Type::T_INCLUDE, $mixinName, isset($argValues) ? $argValues : null, null];
if (! empty($hasBlock)) {
$include = $this->pushSpecialBlock(Type::T_INCLUDE, $s);
$include->child = $child;
Arguments
"Creation of dynamic property Leafo\ScssPhp\Block::$name is deprecated"
}
$this->seek($s);
if ($this->literal('@media', 6) && $this->mediaQueryList($mediaQueryList) && $this->matchChar('{')) {
$media = $this->pushSpecialBlock(Type::T_MEDIA, $s);
$media->queryList = $mediaQueryList[2];
return true;
}
$this->seek($s);
if ($this->literal('@mixin', 6) &&
$this->keyword($mixinName) &&
($this->argumentDef($args) || true) &&
$this->matchChar('{')
) {
$mixin = $this->pushSpecialBlock(Type::T_MIXIN, $s);
$mixin->name = $mixinName;
$mixin->args = $args;
return true;
}
$this->seek($s);
if ($this->literal('@include', 8) &&
$this->keyword($mixinName) &&
($this->matchChar('(') &&
($this->argValues($argValues) || true) &&
$this->matchChar(')') || true) &&
($this->end() ||
$this->matchChar('{') && $hasBlock = true)
) {
$child = [Type::T_INCLUDE, $mixinName, isset($argValues) ? $argValues : null, null];
if (! empty($hasBlock)) {
$include = $this->pushSpecialBlock(Type::T_INCLUDE, $s);
$include->child = $child;
// strip BOM (byte order marker)
if (substr($buffer, 0, 3) === "\xef\xbb\xbf") {
$buffer = substr($buffer, 3);
}
$this->buffer = rtrim($buffer, "\x00..\x1f");
$this->count = 0;
$this->env = null;
$this->inParens = false;
$this->eatWhiteDefault = true;
$this->saveEncoding();
$this->extractLineNumbers($buffer);
$this->pushBlock(null); // root block
$this->whitespace();
$this->pushBlock(null);
$this->popBlock();
while ($this->parseChunk()) {
;
}
if ($this->count !== strlen($this->buffer)) {
$this->throwParseError();
}
if (! empty($this->env->parent)) {
$this->throwParseError('unclosed block');
}
if ($this->charset) {
array_unshift($this->env->children, $this->charset);
}
$this->restoreEncoding();
if ($this->cache) {
$this->cache->setCache("parse", $cacheKey, $this->env, $parseOptions);
}
/** @var UniformResourceLocator $locator */
$locator = Gantry::instance()['locator'];
// see if tree is cached
$realPath = $locator($path);
if (isset($this->importCache[$realPath])) {
$this->handleImportLoop($realPath);
$tree = $this->importCache[$realPath];
} else {
$code = file_get_contents($realPath);
// Work around a bug in the compiler.
if (strpos($realPath, '/_bourbon-deprecate.scss') !== false) {
$code = preg_replace('/@content;/u', '', $code);
}
$parser = $this->parserFactory($path);
$tree = $parser->parse($code);
$this->importCache[$realPath] = $tree;
}
$dirname = dirname($path);
array_unshift($this->importPaths, $dirname);
$this->compileChildrenNoReturn($tree->children, $out);
array_shift($this->importPaths);
}
}
return [empty($m1)? $m2 : $m1, $t1];
}
/**
* Compile import; returns true if the value was something that could be imported
*
* @param array $rawPath
* @param \Leafo\ScssPhp\Formatter\OutputBlock $out
* @param boolean $once
*
* @return boolean
*/
protected function compileImport($rawPath, OutputBlock $out, $once = false)
{
if ($rawPath[0] === Type::T_STRING) {
$path = $this->compileStringContent($rawPath);
if ($path = $this->findImport($path)) {
if (! $once || ! in_array($path, $this->importedFiles)) {
$this->importFile($path, $out);
$this->importedFiles[] = $path;
}
return true;
}
return false;
}
if ($rawPath[0] === Type::T_LIST) {
// handle a list of strings
if (count($rawPath[2]) === 0) {
return false;
}
foreach ($rawPath[2] as $path) {
if ($path[0] !== Type::T_STRING) {
return false;
}
}
$this->sourceIndex = array_search($out->sourceName, $this->sourceNames);
if ($this->sourceIndex === false) {
$this->sourceIndex = null;
}
}
switch ($child[0]) {
case Type::T_SCSSPHP_IMPORT_ONCE:
$rawPath = $this->reduce($child[1]);
if (! $this->compileImport($rawPath, $out, true)) {
$out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
}
break;
case Type::T_IMPORT:
$rawPath = $this->reduce($child[1]);
if (! $this->compileImport($rawPath, $out)) {
$out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
}
break;
case Type::T_DIRECTIVE:
$this->compileDirective($child[1]);
break;
case Type::T_AT_ROOT:
$this->compileAtRoot($child[1]);
break;
case Type::T_MEDIA:
$this->compileMedia($child[1]);
break;
case Type::T_BLOCK:
$this->compileBlock($child[1]);
break;
* @param \Leafo\ScssPhp\Block $selfParent
* @param string $traceName
*
* @throws \Exception
*/
protected function compileChildrenNoReturn($stms, OutputBlock $out, $selfParent = null, $traceName = '')
{
$this->pushCallStack($traceName);
foreach ($stms as $stm) {
if ($selfParent && isset($stm[1]) && is_object($stm[1]) && $stm[1] instanceof Block) {
$stm[1]->selfParent = $selfParent;
$ret = $this->compileChild($stm, $out);
$stm[1]->selfParent = null;
} elseif ($selfParent && $stm[0] === TYPE::T_INCLUDE) {
$stm['selfParent'] = $selfParent;
$ret = $this->compileChild($stm, $out);
unset($stm['selfParent']);
} else {
$ret = $this->compileChild($stm, $out);
}
if (isset($ret)) {
$this->throwError('@return may only be used within a function');
return;
}
}
$this->popCallStack();
}
/**
* evaluate media query : compile internal value keeping the structure inchanged
*
* @param array $queryList
*
* @return array
*/
$this->handleImportLoop($realPath);
$tree = $this->importCache[$realPath];
} else {
$code = file_get_contents($realPath);
// Work around a bug in the compiler.
if (strpos($realPath, '/_bourbon-deprecate.scss') !== false) {
$code = preg_replace('/@content;/u', '', $code);
}
$parser = $this->parserFactory($path);
$tree = $parser->parse($code);
$this->importCache[$realPath] = $tree;
}
$dirname = dirname($path);
array_unshift($this->importPaths, $dirname);
$this->compileChildrenNoReturn($tree->children, $out);
array_shift($this->importPaths);
}
}
return [empty($m1)? $m2 : $m1, $t1];
}
/**
* Compile import; returns true if the value was something that could be imported
*
* @param array $rawPath
* @param \Leafo\ScssPhp\Formatter\OutputBlock $out
* @param boolean $once
*
* @return boolean
*/
protected function compileImport($rawPath, OutputBlock $out, $once = false)
{
if ($rawPath[0] === Type::T_STRING) {
$path = $this->compileStringContent($rawPath);
if ($path = $this->findImport($path)) {
if (! $once || ! in_array($path, $this->importedFiles)) {
$this->importFile($path, $out);
$this->importedFiles[] = $path;
}
return true;
}
return false;
}
if ($rawPath[0] === Type::T_LIST) {
// handle a list of strings
if (count($rawPath[2]) === 0) {
return false;
}
foreach ($rawPath[2] as $path) {
if ($path[0] !== Type::T_STRING) {
return false;
}
}
$this->sourceIndex = array_search($out->sourceName, $this->sourceNames);
if ($this->sourceIndex === false) {
$this->sourceIndex = null;
}
}
switch ($child[0]) {
case Type::T_SCSSPHP_IMPORT_ONCE:
$rawPath = $this->reduce($child[1]);
if (! $this->compileImport($rawPath, $out, true)) {
$out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
}
break;
case Type::T_IMPORT:
$rawPath = $this->reduce($child[1]);
if (! $this->compileImport($rawPath, $out)) {
$out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
}
break;
case Type::T_DIRECTIVE:
$this->compileDirective($child[1]);
break;
case Type::T_AT_ROOT:
$this->compileAtRoot($child[1]);
break;
case Type::T_MEDIA:
$this->compileMedia($child[1]);
break;
case Type::T_BLOCK:
$this->compileBlock($child[1]);
break;
* @param \Leafo\ScssPhp\Block $selfParent
* @param string $traceName
*
* @throws \Exception
*/
protected function compileChildrenNoReturn($stms, OutputBlock $out, $selfParent = null, $traceName = '')
{
$this->pushCallStack($traceName);
foreach ($stms as $stm) {
if ($selfParent && isset($stm[1]) && is_object($stm[1]) && $stm[1] instanceof Block) {
$stm[1]->selfParent = $selfParent;
$ret = $this->compileChild($stm, $out);
$stm[1]->selfParent = null;
} elseif ($selfParent && $stm[0] === TYPE::T_INCLUDE) {
$stm['selfParent'] = $selfParent;
$ret = $this->compileChild($stm, $out);
unset($stm['selfParent']);
} else {
$ret = $this->compileChild($stm, $out);
}
if (isset($ret)) {
$this->throwError('@return may only be used within a function');
return;
}
}
$this->popCallStack();
}
/**
* evaluate media query : compile internal value keeping the structure inchanged
*
* @param array $queryList
*
* @return array
*/
$this->handleImportLoop($realPath);
$tree = $this->importCache[$realPath];
} else {
$code = file_get_contents($realPath);
// Work around a bug in the compiler.
if (strpos($realPath, '/_bourbon-deprecate.scss') !== false) {
$code = preg_replace('/@content;/u', '', $code);
}
$parser = $this->parserFactory($path);
$tree = $parser->parse($code);
$this->importCache[$realPath] = $tree;
}
$dirname = dirname($path);
array_unshift($this->importPaths, $dirname);
$this->compileChildrenNoReturn($tree->children, $out);
array_shift($this->importPaths);
}
}
return [empty($m1)? $m2 : $m1, $t1];
}
/**
* Compile import; returns true if the value was something that could be imported
*
* @param array $rawPath
* @param \Leafo\ScssPhp\Formatter\OutputBlock $out
* @param boolean $once
*
* @return boolean
*/
protected function compileImport($rawPath, OutputBlock $out, $once = false)
{
if ($rawPath[0] === Type::T_STRING) {
$path = $this->compileStringContent($rawPath);
if ($path = $this->findImport($path)) {
if (! $once || ! in_array($path, $this->importedFiles)) {
$this->importFile($path, $out);
$this->importedFiles[] = $path;
}
return true;
}
return false;
}
if ($rawPath[0] === Type::T_LIST) {
// handle a list of strings
if (count($rawPath[2]) === 0) {
return false;
}
foreach ($rawPath[2] as $path) {
if ($path[0] !== Type::T_STRING) {
return false;
}
}
$this->sourceIndex = array_search($out->sourceName, $this->sourceNames);
if ($this->sourceIndex === false) {
$this->sourceIndex = null;
}
}
switch ($child[0]) {
case Type::T_SCSSPHP_IMPORT_ONCE:
$rawPath = $this->reduce($child[1]);
if (! $this->compileImport($rawPath, $out, true)) {
$out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
}
break;
case Type::T_IMPORT:
$rawPath = $this->reduce($child[1]);
if (! $this->compileImport($rawPath, $out)) {
$out->lines[] = '@import ' . $this->compileValue($rawPath) . ';';
}
break;
case Type::T_DIRECTIVE:
$this->compileDirective($child[1]);
break;
case Type::T_AT_ROOT:
$this->compileAtRoot($child[1]);
break;
case Type::T_MEDIA:
$this->compileMedia($child[1]);
break;
case Type::T_BLOCK:
$this->compileBlock($child[1]);
break;
* @param \Leafo\ScssPhp\Block $selfParent
* @param string $traceName
*
* @throws \Exception
*/
protected function compileChildrenNoReturn($stms, OutputBlock $out, $selfParent = null, $traceName = '')
{
$this->pushCallStack($traceName);
foreach ($stms as $stm) {
if ($selfParent && isset($stm[1]) && is_object($stm[1]) && $stm[1] instanceof Block) {
$stm[1]->selfParent = $selfParent;
$ret = $this->compileChild($stm, $out);
$stm[1]->selfParent = null;
} elseif ($selfParent && $stm[0] === TYPE::T_INCLUDE) {
$stm['selfParent'] = $selfParent;
$ret = $this->compileChild($stm, $out);
unset($stm['selfParent']);
} else {
$ret = $this->compileChild($stm, $out);
}
if (isset($ret)) {
$this->throwError('@return may only be used within a function');
return;
}
}
$this->popCallStack();
}
/**
* evaluate media query : compile internal value keeping the structure inchanged
*
* @param array $queryList
*
* @return array
*/
$out->sourceColumn = $this->env->block->sourceColumn;
} else {
$out->sourceName = null;
$out->sourceLine = null;
$out->sourceColumn = null;
}
return $out;
}
/**
* Compile root
*
* @param \Leafo\ScssPhp\Block $rootBlock
*/
protected function compileRoot(Block $rootBlock)
{
$this->rootBlock = $this->scope = $this->makeOutputBlock(Type::T_ROOT);
$this->compileChildrenNoReturn($rootBlock->children, $this->scope);
$this->flattenSelectors($this->scope);
$this->missingSelectors();
}
/**
* Report missing selectors
*/
protected function missingSelectors()
{
foreach ($this->extends as $extend) {
if (isset($extend[3])) {
continue;
}
list($target, $origin, $block) = $extend;
// ignore if !optional
if ($block[2]) {
continue;
}
$this->sourceIndex = null;
$this->sourceLine = null;
$this->sourceColumn = null;
$this->env = null;
$this->scope = null;
$this->storeEnv = null;
$this->charsetSeen = null;
$this->shouldEvaluate = null;
$this->stderr = fopen('php://stderr', 'w');
$this->parser = $this->parserFactory($path);
$tree = $this->parser->parse($code);
$this->parser = null;
$this->formatter = new $this->formatter();
$this->rootBlock = null;
$this->rootEnv = $this->pushEnv($tree);
$this->injectVariables($this->registeredVars);
$this->compileRoot($tree);
$this->popEnv();
$sourceMapGenerator = null;
if ($this->sourceMap) {
if (is_object($this->sourceMap) && $this->sourceMap instanceof SourceMapGenerator) {
$sourceMapGenerator = $this->sourceMap;
$this->sourceMap = self::SOURCE_MAP_FILE;
} elseif ($this->sourceMap !== self::SOURCE_MAP_NONE) {
$sourceMapGenerator = new SourceMapGenerator($this->sourceMapOptions);
}
}
$out = $this->formatter->format($this->scope, $sourceMapGenerator);
if (! empty($out) && $this->sourceMap && $this->sourceMap !== self::SOURCE_MAP_NONE) {
$sourceMap = $sourceMapGenerator->generateJson();
$sourceMapUrl = null;
switch ($this->sourceMap) {
$file->lock(false);
} catch (\Exception $e) {
// Another process has locked the file; we will check this in a bit.
}
if ($file->locked() === false) {
// File was already locked by another process, lets avoid compiling the same file twice.
return false;
}
// Set the lookup paths.
$compiler = $this->getLegacyCompiler();
$compiler->setBasePath($path);
$compiler->setImportPaths([[$this, 'findLegacyImport']]);
// Run the compiler.
$compiler->setVariables($this->getVariables());
$scss = '@import "' . $in . '.scss"';
try {
$css = $compiler->compile($scss);
} catch (CompilerException $e) {
throw new \RuntimeException("CSS Compilation on file '{$in}.scss' failed on error: {$e->getMessage()}", 500, $e);
}
if (strpos($css, $scss) === 0) {
$css = '/* ' . $scss . ' */';
}
// Extract map from css and save it as separate file.
if ($pos = strrpos($css, '/*# sourceMappingURL=')) {
$map = json_decode(urldecode(substr($css, $pos + 43, -3)), true);
/** @var Document $document */
$document = $gantry['document'];
foreach ($map['sources'] as &$source) {
$source = $document->url($source, false, -1);
}
unset($source);
$mapFile = JsonFile::instance($path . '.map');
$compiler = $this->getCompiler();
$compiler->setLogger($logger);
// Set the lookup paths.
$this->functions->setBasePath($path);
$compiler->setImportPaths([[$this, 'findImport']]);
// Run the compiler.
$compiler->addVariables($this->getVariables(true));
$scss = '$output-bourbon-deprecation-warnings: false;' . "\n" . '@import "' . $in . '.scss"';
try {
$this->result = $compiler->compileString($scss);
$css = $this->result->getCss();
} catch (CompilerException $e) {
if (version_compare(static::$options['compatibility'], '5.5', '<')) {
static::$options['legacy'][$in] = true;
$this->warnings['__TITLE__'] = 'Please update your theme!';
$this->warnings[$in] = ['WARNING: ' . $e->getMessage()];
return $this->compileLegacyFile($in);
}
throw new \RuntimeException("ERROR: CSS Compilation on file '{$in}.scss' failed on error: {$e->getMessage()}", 500, $e);
} catch (\Exception $e) {
throw new \RuntimeException("ERROR: CSS Compilation on file '{$in}.scss' failed on fatal error: {$e->getMessage()}", 500, $e);
}
if (strpos($css, $scss) === 0) {
$css = '/* ' . $scss . ' */';
}
// Extract map from css and save it as separate file.
$pos = strrpos($css, '/*# sourceMappingURL=');
if ($pos !== false) {
$map = json_decode(urldecode(substr($css, $pos + 43, -3)), true);
/** @var Document $document */
$document = $gantry['document'];
foreach ($map['sources'] as &$source) {
$source = $document::url($source, false, -1);
/**
* Returns URL to CSS file.
*
* If file does not exist, it will be created by using CSS compiler.
*
* @param string $name
* @return string
*/
public function css($name)
{
if (!isset($this->cssCache[$name])) {
$compiler = $this->compiler();
if ($compiler->needsCompile($name, [$this, 'getCssVariables'])) {
if (\GANTRY_DEBUGGER) {
Debugger::startTimer("css-{$name}", "Compiling CSS: {$name}");
Debugger::addMessage("Compiling CSS: {$name}");
}
$compiler->compileFile($name);
if (\GANTRY_DEBUGGER) {
Debugger::stopTimer("css-{$name}");
}
}
$this->cssCache[$name] = $compiler->getCssUrl($name);
}
return $this->cssCache[$name];
}
/**
* @return array
*/
public function getCssVariables()
{
if ($this->preset) {
$variables = $this->presets()->flatten($this->preset . '.styles', '-');
} else {
$styles = $this->getAssetsInLocation('styles', $location);
if (!$styles) {
return [];
}
$gantry = Gantry::instance();
/** @var Theme|null $theme */
$theme = isset($gantry['theme']) ? $gantry['theme'] : null;
/** @var Document $document */
$document = $gantry['document'];
foreach ($styles as $key => $style) {
if (isset($style['href'])) {
$url = $style['href'];
if ($theme && preg_match('|\.scss$|', $url)) {
// Compile SCSS files.
$url = $theme->css(Gantry::basename($url, '.scss'));
}
// Deal with streams and relative paths.
$url = $document::url($url, null, null, false);
$styles[$key]['href'] = $url;
}
}
return $styles;
}
/**
* @param string $location
* @return array
* @since 5.4.3
*/
public function getScripts($location = 'head')
{
$scripts = $this->getAssetsInLocation('scripts', $location);
if (!empty($element['src'])) {
$success = static::addScript($element, $priority, $location);
} elseif (!empty($element['content'])) {
$success = static::addInlineScript($element, $priority, $location);
}
break;
}
return $success;
}
/**
* @param string $location
* @return array
*/
public static function getStyles($location = 'head')
{
static::getObject();
$styles = static::$stack[0]->getStyles($location);
$output = [];
foreach ($styles as $style) {
switch ($style[':type']) {
case 'file':
$attribs = '';
if ($style['media']) {
$attribs .= ' media="' . static::escape($style['media']) . '"';
}
$output[] = sprintf(
'<link rel="stylesheet" href="%s" type="%s"%s />',
static::escape($style['href']),
static::escape($style['type']),
$attribs
);
break;
case 'inline':
$attribs = '';
if ($style['type'] !== 'text/css') {
* @return string
*/
public function siteUrl()
{
/** @var Document $document */
$document = $this['document'];
return $document::siteUrl();
}
/**
* @param string $location
* @return array
*/
public function styles($location = 'head')
{
/** @var Document $document */
$document = $this['document'];
return $document::getStyles($location);
}
/**
* @param string $location
* @return array
*/
public function scripts($location = 'head')
{
/** @var Document $document */
$document = $this['document'];
return $document::getScripts($location);
}
/**
* Load Javascript framework / extension in platform independent way.
*
* @param string $framework
* @return bool
*/
/**
* @return bool
*/
public function admin()
{
/** @var CMSApplication $application */
$app = Factory::getApplication();
return $app->isClient('administrator');
}
/**
* @param string $location
* @param bool $force
* @return array
*/
public function styles($location = 'head', $force = false)
{
// Do not display head, Joomla will take care of it (most of the time).
return (!$force && $location === 'head') ? [] : parent::styles($location);
}
/**
* @param string $location
* @param bool $force
* @return array
*/
public function scripts($location = 'head', $force = false)
{
// Do not display head, Joomla will take care of it (most of the time).
return (!$force && $location === 'head') ? [] : parent::scripts($location);
}
/**
* @return array
*/
protected function loadGlobal()
{
$global = null;
}
throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), -1, $this->getSourceContext());
}
if ($isDefinedTest) {
return true;
}
if ($this->env->hasExtension('\Twig\Extension\SandboxExtension')) {
$this->env->getExtension('\Twig\Extension\SandboxExtension')->checkMethodAllowed($object, $method);
}
// Some objects throw exceptions when they have __call, and the method we try
// to call is not supported. If ignoreStrictCheck is true, we should return null.
try {
if (!$arguments) {
$ret = $object->$method();
} else {
$ret = \call_user_func_array([$object, $method], $arguments);
}
} catch (\BadMethodCallException $e) {
if ($call && ($ignoreStrictCheck || !$this->env->isStrictVariables())) {
return;
}
throw $e;
}
// @deprecated in 1.28
if ($object instanceof \Twig_TemplateInterface) {
$self = $object->getTemplateName() === $this->getTemplateName();
$message = sprintf('Calling "%s" on template "%s" from template "%s" is deprecated since version 1.28 and won\'t be supported anymore in 2.0.', $item, $object->getTemplateName(), $this->getTemplateName());
if ('renderBlock' === $method || 'displayBlock' === $method) {
$message .= sprintf(' Use block("%s"%s) instead).', $arguments[0], $self ? '' : ', template');
} elseif ('hasBlock' === $method) {
$message .= sprintf(' Use "block("%s"%s) is defined" instead).', $arguments[0], $self ? '' : ', template');
} elseif ('render' === $method || 'display' === $method) {
$message .= sprintf(' Use include("%s") instead).', $object->getTemplateName());
}
@trigger_error($message, \E_USER_DEPRECATED);
// line 3
public function block_head_application($context, array $blocks = [])
{
// line 4
echo "<meta charset=\"utf-8\" />
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />
<title>";
// line 6
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), $this->env->getExtension('Gantry\Component\Twig\TwigExtension')->transFilter("GANTRY5_ENGINE_UNKNOWN_ERROR"))) : ($this->env->getExtension('Gantry\Component\Twig\TwigExtension')->transFilter("GANTRY5_ENGINE_UNKNOWN_ERROR"))), "html", null, true);
echo "</title>
";
// line 7
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "errorPage", [0 => true], "method");
// line 8
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "platform", []), "finalize", [], "method");
// line 9
echo twig_join_filter($this->getAttribute(($context["gantry"] ?? null), "styles", [0 => "head", 1 => true], "method"), "
");
echo "
";
// line 10
echo twig_join_filter($this->getAttribute(($context["gantry"] ?? null), "scripts", [0 => "head", 1 => true], "method"), "
");
}
public function getTemplateName()
{
return "partials/error_head.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
if ($useBlocks && isset($blocks[$name])) {
$template = $blocks[$name][0];
$block = $blocks[$name][1];
} elseif (isset($this->blocks[$name])) {
$template = $this->blocks[$name][0];
$block = $this->blocks[$name][1];
} else {
$template = null;
$block = null;
}
// avoid RCEs when sandbox is enabled
if (null !== $template && !$template instanceof self) {
throw new \LogicException('A block must be a method on a \Twig\Template instance.');
}
if (null !== $template) {
try {
$template->$block($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($template->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
$e->guess();
throw $e;
}
} elseif (false !== $parent = $this->getParent($context)) {
$parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
$this->displayBlock('head_overrides', $context, $blocks);
$content = ob_get_clean();
$assetFunction($content, $location, $priority);
// line 50
echo "<head>
";
// line 51
echo twig_join_filter($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "getHtml", [0 => "head_top"], "method"), "
");
echo "
";
// line 52
$this->displayBlock('head_meta', $context, $blocks);
// line 78
$this->displayBlock('head_title', $context, $blocks);
// line 82
echo "
";
// line 83
$this->displayBlock('head_application', $context, $blocks);
// line 87
echo "
";
// line 88
$this->displayBlock('head_ie_stylesheets', $context, $blocks);
// line 91
$this->displayBlock('head', $context, $blocks);
// line 92
$this->displayBlock('head_custom', $context, $blocks);
// line 97
echo twig_join_filter($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "getHtml", [0 => "head_bottom"], "method"), "
");
echo "
</head>
";
}
// line 7
public function block_head_stylesheets($context, array $blocks = [])
{
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
parent::__construct($env);
$this->blocks = [
'head_title' => [$this, 'block_head_title'],
'head_application' => [$this, 'block_head_application'],
'head_platform' => [$this, 'block_head_platform'],
'head' => [$this, 'block_head'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "@nucleus/page_head.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("@nucleus/page_head.html.twig", "partials/page_head.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_head_title($context, array $blocks = [])
{
}
// line 6
public function block_head_application($context, array $blocks = [])
{
// line 7
if ($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "platform", []), "checkVersion", [0 => 4], "method")) {
echo " ";
// line 8
echo " <jdoc:include type=\"metas\" />
<jdoc:include type=\"styles\" />
<jdoc:include type=\"scripts\" />
";
} elseif ($this->getAttribute($this->getAttribute( // line 11
($context["gantry"] ?? null), "platform", []), "checkVersion", [0 => 3], "method")) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
{
public function __construct(Environment $env)
{
parent::__construct($env);
$this->blocks = [
'head_application' => [$this, 'block_head_application'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "partials/page_head.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("partials/page_head.html.twig", "partials/error_head.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_head_application($context, array $blocks = [])
{
// line 4
echo "<meta charset=\"utf-8\" />
<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />
<title>";
// line 6
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), $this->env->getExtension('Gantry\Component\Twig\TwigExtension')->transFilter("GANTRY5_ENGINE_UNKNOWN_ERROR"))) : ($this->env->getExtension('Gantry\Component\Twig\TwigExtension')->transFilter("GANTRY5_ENGINE_UNKNOWN_ERROR"))), "html", null, true);
echo "</title>
";
// line 7
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "errorPage", [0 => true], "method");
// line 8
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "platform", []), "finalize", [], "method");
// line 9
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
];
}
protected function doGetParent(array $context)
{
// line 1
return "partials/page.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("partials/page.html.twig", "error.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_page_head($context, array $blocks = [])
{
// line 4
$this->loadTemplate("partials/error_head.html.twig", "error.html.twig", 4)->display($context);
}
// line 7
public function block_content($context, array $blocks = [])
{
// line 8
echo " <h1>";
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), "Unknown Error")) : ("Unknown Error")), "html", null, true);
echo "</h1>
";
// line 9
echo ($context["backtrace"] ?? null);
echo "
";
}
public function getTemplateName()
{
if ($useBlocks && isset($blocks[$name])) {
$template = $blocks[$name][0];
$block = $blocks[$name][1];
} elseif (isset($this->blocks[$name])) {
$template = $this->blocks[$name][0];
$block = $this->blocks[$name][1];
} else {
$template = null;
$block = null;
}
// avoid RCEs when sandbox is enabled
if (null !== $template && !$template instanceof self) {
throw new \LogicException('A block must be a method on a \Twig\Template instance.');
}
if (null !== $template) {
try {
$template->$block($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($template->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
$e->guess();
throw $e;
}
} elseif (false !== $parent = $this->getParent($context)) {
$parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false);
$context["body_top"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 59
ob_start(function () { return ''; });
// line 60
echo " ";
$this->displayBlock('body_bottom', $context, $blocks);
// line 62
echo " ";
echo twig_join_filter($this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "getHtml", [0 => "body_bottom"], "method"), "
");
echo "
";
$context["body_bottom"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 65
$this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "document", []), "addScript", [0 => $this->env->getExtension('Gantry\Component\Twig\TwigExtension')->urlFunc("gantry-assets://js/main.js"), 1 => 11, 2 => "footer"], "method");
// line 69
ob_start(function () { return ''; });
// line 70
echo " ";
$this->displayBlock('page_head', $context, $blocks);
$context["page_head"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 75
ob_start(function () { return ''; });
// line 76
echo " ";
$this->displayBlock('page_footer', $context, $blocks);
// line 80
echo "
";
// line 81
echo $this->getAttribute($this->getAttribute(($context["gantry"] ?? null), "debugger", []), "render", [], "method");
echo "
";
$context["page_footer"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset());
// line 84
$this->displayBlock('page', $context, $blocks);
}
// line 8
public function block_content($context, array $blocks = [])
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
{
public function __construct(Environment $env)
{
parent::__construct($env);
$this->blocks = [
'page_footer' => [$this, 'block_page_footer'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "@nucleus/page.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("@nucleus/page.html.twig", "partials/page.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_page_footer($context, array $blocks = [])
{
// line 4
echo " ";
$this->displayParentBlock("page_footer", $context, $blocks);
echo "
<jdoc:include type=\"modules\" name=\"debug\" />
";
}
public function getTemplateName()
{
return "partials/page.html.twig";
}
public function isTraitable()
{
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
public function __construct(Environment $env)
{
parent::__construct($env);
$this->blocks = [
'page_head' => [$this, 'block_page_head'],
'content' => [$this, 'block_content'],
];
}
protected function doGetParent(array $context)
{
// line 1
return "partials/page.html.twig";
}
protected function doDisplay(array $context, array $blocks = [])
{
$this->parent = $this->loadTemplate("partials/page.html.twig", "error.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_page_head($context, array $blocks = [])
{
// line 4
$this->loadTemplate("partials/error_head.html.twig", "error.html.twig", 4)->display($context);
}
// line 7
public function block_content($context, array $blocks = [])
{
// line 8
echo " <h1>";
echo twig_escape_filter($this->env, ((array_key_exists("errorcode", $context)) ? (_twig_default_filter(($context["errorcode"] ?? null), 500)) : (500)), "html", null, true);
echo " ";
echo twig_escape_filter($this->env, ((array_key_exists("error", $context)) ? (_twig_default_filter(($context["error"] ?? null), "Unknown Error")) : ("Unknown Error")), "html", null, true);
echo "</h1>
";
// line 9
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
// this is mostly useful for \Twig\Error\LoaderError exceptions
// see \Twig\Error\LoaderError
if (-1 === $e->getTemplateLine()) {
$e->guess();
}
throw $e;
} catch (\Exception $e) {
$e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
$e->guess();
throw $e;
}
}
{
return $this;
}
/**
* Returns all blocks.
*
* This method is for internal use only and should never be called
* directly.
*
* @return array An array of blocks
*/
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
public function getBlocks()
{
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
if ($this->env->isDebug()) {
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
throw $e;
}
return ob_get_clean();
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
* @internal
*/
public function __construct(Environment $env, Template $template)
{
$this->env = $env;
$this->template = $template;
}
/**
* Renders the template.
*
* @param array $context An array of parameters to pass to the template
*
* @return string The rendered template
*/
public function render($context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_num_args() > 1 ? func_get_arg(1) : []);
}
/**
* Displays the template.
*
* @param array $context An array of parameters to pass to the template
*/
public function display($context = [])
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
$this->template->display($context, \func_num_args() > 1 ? func_get_arg(1) : []);
}
/**
* Checks if a block is defined.
*
* @param string $name The block name
* @param array $context An array of parameters to pass to the template
*
@trigger_error(sprintf('The %s method is deprecated since version 1.22 and will be removed in Twig 2.0.', __METHOD__), \E_USER_DEPRECATED);
return $this->templateClassPrefix;
}
/**
* Renders a template.
*
* @param string|TemplateWrapper $name The template name
* @param array $context An array of parameters to pass to the template
*
* @return string The rendered template
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function render($name, array $context = [])
{
return $this->load($name)->render($context);
}
/**
* Displays a template.
*
* @param string|TemplateWrapper $name The template name
* @param array $context An array of parameters to pass to the template
*
* @throws LoaderError When the template cannot be found
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function display($name, array $context = [])
{
$this->load($name)->display($context);
}
/**
* Loads a template.
*
$this->renderer = $this->extendTwig($twig, $loader);
}
return $this->renderer;
}
/**
* Render a template file by using given context.
*
* @param string $file
* @param array $context
* @return string
*/
public function render($file, array $context = [])
{
// Include Gantry specific things to the context.
$context = $this->getContext($context);
return $this->renderer()->render($file, $context);
}
/**
* Compile and render twig string.
*
* @param string $string
* @param array $context
* @return string
*/
public function compile($string, array $context = [])
{
$renderer = $this->renderer();
$template = $renderer->createTemplate($string);
// Include Gantry specific things to the context.
$context = $this->getContext($context);
return $template->render($context);
}
// Bootstrap Gantry framework or fail gracefully (inside included file).
$gantry = include __DIR__ . '/includes/gantry.php';
/** @var \Gantry\Framework\Theme $theme */
$theme = $gantry['theme'];
$context = array(
'errorcode' => isset($this->error) ? $this->error->getCode() : null,
'error' => isset($this->error) ? $this->error->getMessage() : null,
'debug' => $app->get('debug_lang', '0') == '1' || $app->get('debug', '0') == '1',
'backtrace' => $this->debug ? $this->renderBacktrace() : null
);
// Reset used outline configuration.
unset($gantry['configuration']);
// Render the page.
echo $theme
->setLayout('_error', true)
->render('error.html.twig', $context);
*
* @param string $directory The name of the template
* @param string $filename The actual filename
*
* @return string The contents of the template
*
* @since 1.7.0
*/
protected function _loadTemplate($directory, $filename)
{
$contents = '';
// Check to see if we have a valid template file
if (is_file($directory . '/' . $filename)) {
// Store the file path
$this->_file = $directory . '/' . $filename;
// Get the file content
ob_start();
require $directory . '/' . $filename;
$contents = ob_get_contents();
ob_end_clean();
}
return $contents;
}
/**
* Fetch the template, and initialise the params
*
* @param array $params Parameters to determine the template
*
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
protected function _fetchTemplate($params = [])
{
// Check
$directory = $params['directory'] ?? 'templates';
Arguments
"/data/web/e65384/html/fluhm-at405/templates/g5_myriad/error.php"
}
}
}
// Load the language file for the template
$lang = CmsFactory::getLanguage();
// 1.5 or core then 1.6
$lang->load('tpl_' . $template, JPATH_BASE)
|| ($inherits !== '' && $lang->load('tpl_' . $inherits, JPATH_BASE))
|| $lang->load('tpl_' . $template, $directory . '/' . $template)
|| ($inherits !== '' && $lang->load('tpl_' . $inherits, $directory . '/' . $inherits));
// Assign the variables
$this->baseurl = Uri::base(true);
$this->params = $params['params'] ?? new Registry();
$this->template = $template;
// Load
$this->_template = $this->_loadTemplate($baseDir, $file);
return $this;
}
/**
* Parse a document template
*
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
protected function _parseTemplate()
{
$matches = [];
if (preg_match_all('#<jdoc:include\ type="([^"]+)"(.*)\/>#iU', $this->_template, $matches)) {
$messages = [];
$template_tags_first = [];
$template_tags_last = [];
$name = $options['name'] ?? '';
$title = $options['title'] ?? '';
parent::$_buffer[$type][$name][$title] = $content;
return $this;
}
/**
* Parses the template and populates the buffer
*
* @param array $params Parameters for fetching the template
*
* @return HtmlDocument instance of $this to allow chaining
*
* @since 1.7.0
*/
public function parse($params = [])
{
return $this->_fetchTemplate($params)->_parseTemplate();
}
/**
* Outputs the template to the browser.
*
* @param boolean $caching If true, cache the output
* @param array $params Associative array of attributes
*
* @return string The rendered data
*
* @since 1.7.0
*/
public function render($caching = false, $params = [])
{
$this->_caching = $caching;
if (empty($this->_template)) {
$this->parse($params);
}
{
return $this->_fetchTemplate($params)->_parseTemplate();
}
/**
* Outputs the template to the browser.
*
* @param boolean $caching If true, cache the output
* @param array $params Associative array of attributes
*
* @return string The rendered data
*
* @since 1.7.0
*/
public function render($caching = false, $params = [])
{
$this->_caching = $caching;
if (empty($this->_template)) {
$this->parse($params);
}
if (\array_key_exists('csp_nonce', $params) && $params['csp_nonce'] !== null) {
$this->cspNonce = $params['csp_nonce'];
}
$data = $this->_renderTemplate();
parent::render($caching, $params);
return $data;
}
/**
* Count the modules in the given position
*
* @param string $positionName The position to use
* @param boolean $withContentOnly Count only a modules which actually has a content
*
* @return integer Number of modules found
*
if ($status < 400 || $status > 599) {
$status = 500;
}
$errorReporting = CmsFactory::getApplication()->get('error_reporting');
if ($errorReporting === "development" || $errorReporting === "maximum") {
$status .= ' ' . str_replace("\n", ' ', $this->_error->getMessage());
}
CmsFactory::getApplication()->setHeader('status', $status);
// Set variables
$this->debug = $params['debug'] ?? false;
$this->error = $this->_error;
$params['file'] = 'error.php';
return parent::render($cache, $params);
}
/**
* Render the backtrace
*
* @return string The contents of the backtrace
*
* @since 1.7.0
*/
public function renderBacktrace()
{
// If no error object is set return null
if (!isset($this->_error)) {
return;
}
// The back trace
$backtrace = $this->_error->getTrace();
// Add the position of the actual file
// Push the error object into the document
$this->getDocument()->setError($error);
// Add registry file for the template asset
$wa = $this->getDocument()->getWebAssetManager()->getRegistry();
$wa->addTemplateRegistryFile($template->template, $app->getClientId());
if (!empty($template->parent)) {
$wa->addTemplateRegistryFile($template->parent, $app->getClientId());
}
if (ob_get_contents()) {
ob_end_clean();
}
$this->getDocument()->setTitle(Text::_('Error') . ': ' . $error->getCode());
return $this->getDocument()->render(
false,
[
'template' => $template->template,
'directory' => JPATH_THEMES,
'debug' => JDEBUG,
'csp_nonce' => $app->get('csp_nonce'),
'templateInherits' => $template->parent,
'params' => $template->params,
]
);
}
}
* Lastly, if all else fails, we default onto the HTML format to at least render something
*/
if (Factory::$document) {
$format = Factory::$document->getType();
} else {
$format = $app->getInput()->getString('format', 'html');
}
try {
$renderer = AbstractRenderer::getRenderer($format);
} catch (\InvalidArgumentException $e) {
// Default to the HTML renderer
$renderer = AbstractRenderer::getRenderer('html');
}
// Reset the document object in the factory, this gives us a clean slate and lets everything render properly
Factory::$document = $renderer->getDocument();
Factory::getApplication()->loadDocument(Factory::$document);
$data = $renderer->render($error);
// If nothing was rendered, just use the message from the Exception
if (empty($data)) {
$data = $error->getMessage();
}
if ($isCli) {
echo $data;
} else {
/** @var CMSApplication $app */
// Do not allow cache
$app->allowCache(false);
$app->setBody($data);
}
// This return is needed to ensure the test suite does not trigger the non-Exception handling below
return;
} catch (\Throwable $errorRendererError) {
}
}
// Always return false, this will tell PHP to handle the error internally
return false;
}
/**
* Handles exceptions: logs errors and renders error page.
*
* @param \Exception|\Throwable $error An Exception or Throwable (PHP 7+) object for which to render the error page.
*
* @return void
*
* @since 3.10.0
*/
public static function handleException(\Throwable $error)
{
static::logException($error);
static::render($error);
}
/**
* Render the error page based on an exception.
*
* @param \Throwable $error An Exception or Throwable (PHP 7+) object for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(\Throwable $error)
{
try {
$app = Factory::getApplication();
// Flag if we are on cli
$isCli = $app->isClient('cli');
// If site is offline and it's a 404 error, just go to index (to see offline message, instead of 404)
$this->compress();
// Trigger the onAfterCompress event.
$this->triggerEvent('onAfterCompress');
}
} catch (\Throwable $throwable) {
/** @var ErrorEvent $event */
$event = AbstractEvent::create(
'onError',
[
'subject' => $throwable,
'eventClass' => ErrorEvent::class,
'application' => $this,
]
);
// Trigger the onError event.
$this->triggerEvent('onError', $event);
ExceptionHandler::handleException($event->getError());
}
// Trigger the onBeforeRespond event.
$this->getDispatcher()->dispatch('onBeforeRespond');
// Send the application response.
$this->respond();
// Trigger the onAfterRespond event.
$this->getDispatcher()->dispatch('onAfterRespond');
}
/**
* Check if the user is required to reset their password.
*
* If the user is required to reset their password will be redirected to the page that manage the password reset.
*
* @param string $option The option that manage the password reset
* @param string $view The view that manage the password reset
* @param string $layout The layout of the view that manage the password reset
$this->_addPath('template', JPATH_COMPONENT . '/themes/' . $theme . '/views/eventslist');
}
}
function display($tpl = null)
{
$this->state = $this->get('State');
$this->item = $this->get('Item');
$this->params = DJEventsHelper::getParams();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$menus = $app->getMenu('site');
$menu = $menus->getActive();
if (empty($this->item)) {
throw new Exception(JText::_('COM_DJEVENTS_EVENT_NOT_FOUND'), 404);
}
if ($this->item->published != 1 && ($user->guest || $this->item->created_by != $user->id)) {
throw new Exception(JText::_('COM_DJEVENTS_NO_PERMISSIONS'), 403);
}
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
if (!empty($this->item->image)) {
if (!$this->item->thumb = DJEventsImageResizer::createThumbnail($this->item->image, 'media/djevents/images', $this->params->get('width'),
$this->params->get('height'), $this->params->get('resizing'), $this->params->get('quality'))) {
$this->item->thumb = $this->item->image;
}
if (strcasecmp(substr($this->item->thumb, 0, 4), 'http') != 0 && !empty($this->item->thumb)) {
$this->item->thumb = JURI::root(true) . '/' . $this->item->thumb;
Arguments
"Die Wort Gottes konnte nicht gefunden werden"
$registeredurlparams = new \stdClass();
}
foreach ($urlparams as $key => $value) {
// Add your safe URL parameters with variable type as value {@see InputFilter::clean()}.
$registeredurlparams->$key = $value;
}
$this->app->registeredurlparams = $registeredurlparams;
}
try {
/** @var \Joomla\CMS\Cache\Controller\ViewController $cache */
$cache = Factory::getCache($option, 'view');
$cache->get($view, 'display');
} catch (CacheExceptionInterface $exception) {
$view->display();
}
} else {
$view->display();
}
return $this;
}
/**
* Execute a task by triggering a method in the derived class.
*
* @param string $task The task to perform. If no matching task is found, the '__default' task is executed, if defined.
*
* @return mixed The value returned by the called method.
*
* @since 3.0
* @throws \Exception
*/
public function execute($task)
{
$this->task = $task;
$task = strtolower((string) $task);
$urlparams = array(
'format' => 'WORD',
'option' => 'WORD',
'view' => 'WORD',
'layout' => 'WORD',
'tpl' => 'CMD',
'id' => 'INT',
'day' => 'STRING',
'search' => 'STRING',
'from' => 'STRING',
'to' => 'STRING',
'cid' => 'STRING',
'city' => 'STRING',
'tag' => 'STRING',
'return' => 'BASE64',
'limitstart' => 'UINT',
'limit' => 'UINT'
);
return parent::display($cachable, $urlparams);
}
public function getvideo() {
$app = JFactory::getApplication();
// decode passed video url
$link = urldecode($app->input->get('video','','raw'));
// get video object
$video = DJEventsVideoHelper::getVideo($link);
// clear the buffer from any output
@ob_clean();
// return the JSON representation of $video object
echo json_encode($video);
// exit application
$app->close();
* @throws \Exception
*/
public function execute($task)
{
$this->task = $task;
$task = strtolower((string) $task);
if (isset($this->taskMap[$task])) {
$doTask = $this->taskMap[$task];
} elseif (isset($this->taskMap['__default'])) {
$doTask = $this->taskMap['__default'];
} else {
throw new \Exception(Text::sprintf('JLIB_APPLICATION_ERROR_TASK_NOT_FOUND', $task), 404);
}
// Record the actual task being fired
$this->doTask = $doTask;
return $this->$doTask();
}
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return BaseDatabaseModel|boolean Model object on success; otherwise false on failure.
*
* @since 3.0
*/
public function getModel($name = '', $prefix = '', $config = [])
{
if (empty($name)) {
$name = $this->getName();
}
if (!$prefix) {
$lang = JFactory::getLanguage();
if ($lang->get('lang') != 'en-GB') {
$lang = JFactory::getLanguage();
$lang->load('com_djevents', JPATH_ROOT, $lang->get('lang'), false, false);
}
require_once(JPath::clean(JPATH_ROOT.'/components/com_djevents/controller.php'));
require_once(JPath::clean(JPATH_ROOT.'/components/com_djevents/helpers/djevents.php'));
require_once(JPath::clean(JPATH_ROOT.'/components/com_djevents/helpers/route.php'));
require_once(JPath::clean(JPATH_COMPONENT_ADMINISTRATOR.'/lib/image.php'));
require_once(JPath::clean(JPATH_COMPONENT_ADMINISTRATOR.'/lib/djlicense.php'));
require_once(JPath::clean(JPATH_COMPONENT_ADMINISTRATOR.'/lib/video.php'));
require_once(JPath::clean(JPATH_COMPONENT_ADMINISTRATOR.'/lib/upload.php'));
$controller = JControllerLegacy::getInstance('DJEvents');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
if(!function_exists('dd')) {
function dd($msg, $exit = false) {
if($exit) {
echo "<pre>".print_r($msg, true)."</pre>"; die();
} else {
JFactory::getApplication()->enqueueMessage("<pre>".print_r($msg, true)."</pre>");
}
}
}
*
* @since 4.0.0
*/
public function dispatch()
{
$path = JPATH_COMPONENT . '/' . substr($this->app->scope, 4) . '.php';
// If component file doesn't exist throw error
if (!is_file($path)) {
throw new \Exception(Text::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'), 404);
}
$lang = $this->app->getLanguage();
// Load common and local language files.
$lang->load($this->app->scope, JPATH_BASE) || $lang->load($this->app->scope, JPATH_COMPONENT);
// Execute the component
$loader = static function ($path) {
require_once $path;
};
$loader($path);
}
}
Arguments
"/data/web/e65384/html/fluhm-at405/components/com_djevents/djevents.php"
*/
public function dispatch()
{
$path = JPATH_COMPONENT . '/' . substr($this->app->scope, 4) . '.php';
// If component file doesn't exist throw error
if (!is_file($path)) {
throw new \Exception(Text::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'), 404);
}
$lang = $this->app->getLanguage();
// Load common and local language files.
$lang->load($this->app->scope, JPATH_BASE) || $lang->load($this->app->scope, JPATH_COMPONENT);
// Execute the component
$loader = static function ($path) {
require_once $path;
};
$loader($path);
}
}
if (!\defined('JPATH_COMPONENT_ADMINISTRATOR')) {
/**
* Defines the path to the admin element of the active component for the request
*
* @var string
* @since 1.5
*
* @deprecated 4.3 will be removed in 6.0
* Will be removed without replacement
*/
\define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option);
}
// If component is disabled throw error
if (!static::isEnabled($option)) {
throw new MissingComponentException(Text::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'), 404);
}
ob_start();
$app->bootComponent($option)->getDispatcher($app)->dispatch();
$contents = ob_get_clean();
// Revert the scope
$app->scope = $scope;
if (JDEBUG) {
Profiler::getInstance('Application')->mark('afterRenderComponent ' . $option);
}
return $contents;
}
/**
* Load the installed components into the components property.
*
* @return boolean True on success
*
* @since 3.2
*/
protected static function load()
$wr->addTemplateRegistryFile($template->template, $this->getClientId());
break;
case 'feed':
$document->setBase(htmlspecialchars(Uri::current()));
break;
}
$document->setTitle($params->get('page_title'));
$document->setDescription($params->get('page_description'));
// Add version number or not based on global configuration
if ($this->get('MetaVersion', 0)) {
$document->setGenerator('Joomla! - Open Source Content Management - Version ' . JVERSION);
} else {
$document->setGenerator('Joomla! - Open Source Content Management');
}
$contents = ComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');
// Trigger the onAfterDispatch event.
PluginHelper::importPlugin('system');
$this->triggerEvent('onAfterDispatch');
}
/**
* Method to run the Web application routines.
*
* @return void
*
* @since 3.2
*/
protected function doExecute()
{
// Initialise the application
$this->initialiseApp();
// Mark afterInitialise in the profiler.
// Route the application
$this->route();
// Mark afterRoute in the profiler.
JDEBUG ? $this->profiler->mark('afterRoute') : null;
if (!$this->isHandlingMultiFactorAuthentication()) {
/*
* Check if the user is required to reset their password
*
* Before $this->route(); "option" and "view" can't be safely read using:
* $this->input->getCmd('option'); or $this->input->getCmd('view');
* ex: due of the sef urls
*/
$this->checkUserRequireReset('com_users', 'profile', 'edit', 'com_users/profile.save,com_users/profile.apply,com_users/user.logout');
}
// Dispatch the application
$this->dispatch();
// Mark afterDispatch in the profiler.
JDEBUG ? $this->profiler->mark('afterDispatch') : null;
}
/**
* Return the current state of the detect browser option.
*
* @return boolean
*
* @since 3.2
*/
public function getDetectBrowser()
{
return $this->detect_browser;
}
/**
* Return the current state of the language filter.
*
throw new \RuntimeException('Invalid input, aborting application.');
}
}
/**
* Execute the application.
*
* @return void
*
* @since 3.2
*/
public function execute()
{
try {
$this->sanityCheckSystemVariables();
$this->setupLogging();
$this->createExtensionNamespaceMap();
// Perform application routines.
$this->doExecute();
// If we have an application document object, render it.
if ($this->document instanceof \Joomla\CMS\Document\Document) {
// Render the application output.
$this->render();
}
// If gzip compression is enabled in configuration and the server is compliant, compress the output.
if ($this->get('gzip') && !ini_get('zlib.output_compression') && ini_get('output_handler') !== 'ob_gzhandler') {
$this->compress();
// Trigger the onAfterCompress event.
$this->triggerEvent('onAfterCompress');
}
} catch (\Throwable $throwable) {
/** @var ErrorEvent $event */
$event = AbstractEvent::create(
'onError',
[
'subject' => $throwable,
*
* In addition to aliasing "common" service keys, we also create aliases for the PHP classes to ensure autowiring objects
* is supported. This includes aliases for aliased class names, and the keys for aliased class names should be considered
* deprecated to be removed when the class name alias is removed as well.
*/
$container->alias('session.web', 'session.web.site')
->alias('session', 'session.web.site')
->alias('JSession', 'session.web.site')
->alias(\Joomla\CMS\Session\Session::class, 'session.web.site')
->alias(\Joomla\Session\Session::class, 'session.web.site')
->alias(\Joomla\Session\SessionInterface::class, 'session.web.site');
// Instantiate the application.
$app = $container->get(\Joomla\CMS\Application\SiteApplication::class);
// Set the application as global app
\Joomla\CMS\Factory::$application = $app;
// Execute the application.
$app->execute();
define('JOOMLA_MINIMUM_PHP', '7.2.5');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
die(
str_replace(
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/templates/system/incompatible.html')
)
);
}
/**
* Constant that is checked in included files to prevent direct access.
* define() is used rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
// Run the application - All executable code should be triggered through this file
require_once dirname(__FILE__) . '/includes/app.php';
Arguments
"/data/web/e65384/html/fluhm-at405/includes/app.php"