// If compiled file wasn't already locked by another process, save it.
if ($file->locked() !== false) {
$file->save($cache);
$file->unlock();
// Compile cached file into bytecode cache
if (function_exists('opcache_invalidate')) {
// Silence error in case if `opcache.restrict_api` directive is set.
@opcache_invalidate($file->filename(), true);
}
}
}
$file->free();
$this->content = $cache['data'];
}
} catch (\Exception $e) {
throw new \RuntimeException(sprintf('Failed to read %s: %s', Gantry::basename($this->filename), $e->getMessage()), 500, $e);
}
return parent::content($var);
}
}
Arguments
"Failed to read theme.yaml: Failed to parse time string (2019-25-05) at position 6 (5): Unexpected character"
*
* @param string $theme
*/
public function __construct($theme)
{
$gantry = Gantry::instance();
/** @var UniformResourceLocator $locator */
$locator = $gantry['locator'];
$filename = $locator->findResource("gantry-themes://{$theme}/custom/gantry/theme.yaml") ?: $locator->findResource("gantry-themes://{$theme}/gantry/theme.yaml");
if (!$filename) {
throw new \RuntimeException(sprintf('Theme %s not found', $theme), 404);
}
/** @var string $cache */
$cache = $locator->findResource("gantry-cache://{$theme}/compiled/yaml", true, true);
$file = CompiledYamlFile::instance($filename);
$this->items = (array)$file->setCachePath($cache)->content();
$file->free();
$this->offsetSet('name', $theme);
$parent = (string) $this->get('configuration.theme.parent', $theme);
$parent = $parent !== $theme ? $parent : null;
$this->offsetSet('parent', $parent);
}
/**
* @return string
*/
public function addStreams()
{
$gantry = Gantry::instance();
// Initialize theme stream.
$streamName = $this->addStream($this->offsetGet('name'), $this->getPaths());
return $this->segments;
}
/**
* Prepare layout for rendering. Initializes all CSS/JS in particles.
*/
public function prepare()
{
$this->segments();
}
/**
* Returns details of the theme.
*
* @return ThemeDetails
*/
public function details()
{
if (!$this->details) {
$this->details = new ThemeDetails($this->name);
}
return $this->details;
}
/**
* Returns configuration of the theme.
*
* @return array
*/
public function configuration()
{
return (array) $this->details()['configuration'];
}
/**
* Function to convert block sizes into CSS classes.
*
* @param $text
* @return string
*/
Arguments
'9.1' => 'size-9-1',
'8.3' => 'size-8-3'
];
return isset($sizes[$number]) ? ' ' . $sizes[$number] : 'size-' . (int) $number;
}
/**
* Magic setter method
*
* @param mixed $offset Asset name value
* @param mixed $value Asset value
*/
public function __set($offset, $value)
{
if ($offset === 'title') {
$offset = 'name';
}
$this->details()->offsetSet('details.' . $offset, $value);
}
/**
* Magic getter method
*
* @param mixed $offset Asset name value
* @return mixed Asset value
*/
public function __get($offset)
{
if ($offset === 'title') {
$offset = 'name';
}
$value = $this->details()->offsetGet('details.' . $offset);
if ($offset === 'version' && is_int($value)) {
$value .= '.0';
}
// FIXME: Do not hardcode this file.
$language->load('files_gantry5_nucleus', JPATH_SITE);
if ($application->isClient('site')) {
// Load our custom positions file as frontend requires the strings to be there.
$filename = $locator("gantry-theme://language/en-GB/en-GB.tpl_{$this->name}_positions.ini");
if ($filename) {
$language->load("tpl_{$this->name}_positions", \dirname(\dirname(\dirname($filename))), 'en-GB');
}
// Load template language files, including overrides.
$paths = $locator->findResources('gantry-theme://language');
foreach (array_reverse($paths) as $path) {
$language->load("tpl_{$this->name}", \dirname($path));
}
}
$this->language = 'en-gb';
$this->direction = 'ltr';
$this->url = Uri::root(true) . '/templates/' . $this->name;
PluginHelper::importPlugin('gantry5');
// Trigger the onGantryThemeInit event.
$application->triggerEvent('onGantry5ThemeInit', ['theme' => $this]);
}
/**
* Get list of twig paths.
*
* @return array
*/
public static function getTwigPaths()
{
/** @var UniformResourceLocator $locator */
$locator = static::gantry()['locator'];
return $locator->mergeResources(['gantry-theme://twig', 'gantry-engine://twig']);
Arguments
/** @var Environment|null */
protected $renderer;
/**
* Construct theme object.
*
* @param string $path
* @param string $name
*/
public function __construct($path, $name = null)
{
if (!is_dir($path)) {
throw new \LogicException('Theme not found!');
}
$this->name = $name ?: Gantry::basename($path);
$this->path = $path;
$this->init();
}
/**
* Get context for render().
*
* @param array $context
* @return array
*/
public function getContext(array $context)
{
$context['theme'] = $this;
return $context;
}
/**
* Define twig environment.
*
* @param Environment $twig
* @param LoaderInterface $loader
class_exists('\\Gantry\\Framework\\Gantry') or die;
// Define the template.
class GantryTheme extends \Gantry\Framework\Theme {}
// Initialize theme stream.
$gantry['platform']->set(
'streams.gantry-theme.prefixes',
['' => [
"gantry-themes://{$gantry['theme.name']}/custom",
"gantry-themes://{$gantry['theme.name']}/phoca",
"gantry-themes://{$gantry['theme.name']}",
"gantry-themes://{$gantry['theme.name']}/common"
]]
);
// Define Gantry services.
$gantry['theme'] = function ($c) {
return new GantryTheme($c['theme.path'], $c['theme.name']);
};
require_once (dirname(__FILE__).'/phoca.php');
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix"
"phoca_pix"
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
if (
isset($this->raw[$id])
|| !\is_object($this->values[$id])
|| isset($this->protected[$this->values[$id]])
|| !\method_exists($this->values[$id], '__invoke')
) {
return $this->values[$id];
}
if (isset($this->factories[$this->values[$id]])) {
return $this->values[$id]($this);
}
$raw = $this->values[$id];
$val = $this->values[$id] = $raw($this);
$this->raw[$id] = $raw;
$this->frozen[$id] = true;
return $val;
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
Arguments
Gantry\Framework\Gantry {#704}
<?php
/**
* @package Gantry 5 Theme
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2017 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('_JEXEC') or die;
// 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);
Arguments
* @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 = array())
{
// Check
$directory = $params['directory'] ?? 'templates';
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix/error.php"
$file = 'index.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, $directory . '/' . $inherits))
|| $lang->load('tpl_' . $template, $directory . '/' . $template);
// 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 = array();
if (preg_match_all('#<jdoc:include\ type="([^"]+)"(.*)\/>#iU', $this->_template, $matches))
{
$messages = [];
$template_tags_first = [];
$template_tags_last = [];
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix"
"error.php"
$options['title'] = $args[3] ?? null;
}
parent::$_buffer[$options['type']][$options['name']][$options['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 = array())
{
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 = array())
{
$this->_caching = $caching;
if (empty($this->_template))
{
$this->parse($params);
}
Arguments
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
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 = array())
{
$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
Arguments
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
{
$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();
Arguments
false
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
$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,
]
);
}
}
Arguments
false
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
else
{
$format = $app->input->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);
}
Arguments
Error {#720
#message: "Call to a member function getWebAssetManager() on null"
#code: 0
#file: "/var/www/virtual/sauwald.info/htdocs/libraries/src/HTML/Helpers/Jquery.php"
#line: 48
}
}
}
// 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');
Arguments
Error {#720
#message: "Call to a member function getWebAssetManager() on null"
#code: 0
#file: "/var/www/virtual/sauwald.info/htdocs/libraries/src/HTML/Helpers/Jquery.php"
#line: 48
}
// 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
Arguments
Error {#720
#message: "Call to a member function getWebAssetManager() on null"
#code: 0
#file: "/var/www/virtual/sauwald.info/htdocs/libraries/src/HTML/Helpers/Jquery.php"
#line: 48
}
}
$cast = (int) $scalar;
return ($scalar === (string) $cast) ? $cast : $scalar;
case is_numeric($scalar):
case Parser::preg_match(self::getHexRegex(), $scalar):
$scalar = str_replace('_', '', $scalar);
return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
case '.inf' === $scalarLower:
case '.nan' === $scalarLower:
return -log(0);
case '-.inf' === $scalarLower:
return log(0);
case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar):
return (float) str_replace('_', '', $scalar);
case Parser::preg_match(self::getTimestampRegex(), $scalar):
// When no timezone is provided in the parsed date, YAML spec says we must assume UTC.
$time = new \DateTime($scalar, new \DateTimeZone('UTC'));
if (Yaml::PARSE_DATETIME & $flags) {
return $time;
}
try {
if (false !== $scalar = $time->getTimestamp()) {
return $scalar;
}
} catch (\ValueError $e) {
// no-op
}
return $time->format('U');
}
}
return (string) $scalar;
}
Arguments
"Failed to parse time string (2019-25-05) at position 6 (5): Unexpected character"
}
$cast = (int) $scalar;
return ($scalar === (string) $cast) ? $cast : $scalar;
case is_numeric($scalar):
case Parser::preg_match(self::getHexRegex(), $scalar):
$scalar = str_replace('_', '', $scalar);
return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar;
case '.inf' === $scalarLower:
case '.nan' === $scalarLower:
return -log(0);
case '-.inf' === $scalarLower:
return log(0);
case Parser::preg_match('/^(-|\+)?[0-9][0-9_]*(\.[0-9_]+)?$/', $scalar):
return (float) str_replace('_', '', $scalar);
case Parser::preg_match(self::getTimestampRegex(), $scalar):
// When no timezone is provided in the parsed date, YAML spec says we must assume UTC.
$time = new \DateTime($scalar, new \DateTimeZone('UTC'));
if (Yaml::PARSE_DATETIME & $flags) {
return $time;
}
try {
if (false !== $scalar = $time->getTimestamp()) {
return $scalar;
}
} catch (\ValueError $e) {
// no-op
}
return $time->format('U');
}
}
return (string) $scalar;
}
Arguments
"2019-25-05"
DateTimeZone {#747
timezone: UTC (+00:00)
}
// remove comments
if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) {
$output = substr($output, 0, $match[0][1]);
}
} elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
$output = $match[1];
$i += \strlen($output);
$output = trim($output);
} else {
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', $scalar), self::$parsedLineNumber + 1, null, self::$parsedFilename);
}
// a non-quoted string cannot start with @ or ` (reserved) nor with a scalar indicator (| or >)
if ($output && ('@' === $output[0] || '`' === $output[0] || '|' === $output[0] || '>' === $output[0] || '%' === $output[0])) {
throw new ParseException(sprintf('The reserved indicator "%s" cannot start a plain scalar; you need to quote the scalar.', $output[0]), self::$parsedLineNumber + 1, $output, self::$parsedFilename);
}
if ($evaluate) {
$output = self::evaluateScalar($output, $flags, $references, $isQuoted);
}
}
return $output;
}
/**
* Parses a YAML quoted scalar.
*
* @throws ParseException When malformed inline YAML string is parsed
*/
private static function parseQuotedScalar(string $scalar, int &$i = 0): string
{
if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename);
}
$output = substr($match[0], 1, -1);
$unescaper = new Unescaper();
Arguments
if (2 /* MB_OVERLOAD_STRING */ & (int) \ini_get('mbstring.func_overload')) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('ASCII');
}
try {
$i = 0;
$tag = self::parseTag($value, $i, $flags);
switch ($value[$i]) {
case '[':
$result = self::parseSequence($value, $flags, $i, $references);
++$i;
break;
case '{':
$result = self::parseMapping($value, $flags, $i, $references);
++$i;
break;
default:
$result = self::parseScalar($value, $flags, null, $i, true, $references);
}
// some comments are allowed at the end
if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) {
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
}
if (null !== $tag && '' !== $tag) {
return new TaggedValue($tag, $result);
}
return $result;
} finally {
if (isset($mbEncoding)) {
mb_internal_encoding($mbEncoding);
}
}
}
/**
Arguments
"2019-25-05"
0
null
10
true
[]
$lines[] = trim($this->currentLine);
}
for ($i = 0, $linesCount = \count($lines), $previousLineBlank = false; $i < $linesCount; ++$i) {
if ('' === $lines[$i]) {
$value .= "\n";
$previousLineBlank = true;
} elseif ($previousLineBlank) {
$value .= $lines[$i];
$previousLineBlank = false;
} else {
$value .= ' '.$lines[$i];
$previousLineBlank = false;
}
}
Inline::$parsedLineNumber = $this->getRealCurrentLineNb();
$parsedValue = Inline::parse($value, $flags, $this->refs);
if ('mapping' === $context && \is_string($parsedValue) && '"' !== $value[0] && "'" !== $value[0] && '[' !== $value[0] && '{' !== $value[0] && '!' !== $value[0] && false !== strpos($parsedValue, ': ')) {
throw new ParseException('A colon cannot be used in an unquoted mapping value.', $this->getRealCurrentLineNb() + 1, $value, $this->filename);
}
return $parsedValue;
}
} catch (ParseException $e) {
$e->setParsedLine($this->getRealCurrentLineNb() + 1);
$e->setSnippet($this->currentLine);
throw $e;
}
}
/**
* Parses a block scalar.
*
* @param string $style The style indicator that was used to begin this block scalar (| or >)
* @param string $chomping The chomping indicator that was used to begin this block scalar (+ or -)
Arguments
if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) {
$value = (array) $value;
}
$data += $value;
} elseif ($allowOverwrite || !isset($data[$key])) {
// Spec: Keys MUST be unique; first one wins.
// But overwriting is allowed when a merge node is used in current block.
if (null !== $subTag) {
$data[$key] = new TaggedValue($subTag, $value);
} else {
$data[$key] = $value;
}
} else {
throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine);
}
}
} else {
$value = $this->parseValue(rtrim($values['value']), $flags, $context);
// Spec: Keys MUST be unique; first one wins.
// But overwriting is allowed when a merge node is used in current block.
if ($allowOverwrite || !isset($data[$key])) {
$data[$key] = $value;
} else {
throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine);
}
}
if ($isRef) {
$this->refs[$isRef] = $data[$key];
array_pop($this->refsBeingParsed);
}
} elseif ('"' === $this->currentLine[0] || "'" === $this->currentLine[0]) {
if (null !== $context) {
throw new ParseException('Unable to parse.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
}
try {
return Inline::parse($this->lexInlineQuotedString(), $flags, $this->refs);
} catch (ParseException $e) {
Arguments
private function parseBlock(int $offset, string $yaml, int $flags)
{
$skippedLineNumbers = $this->skippedLineNumbers;
foreach ($this->locallySkippedLineNumbers as $lineNumber) {
if ($lineNumber < $offset) {
continue;
}
$skippedLineNumbers[] = $lineNumber;
}
$parser = new self();
$parser->offset = $offset;
$parser->totalNumberOfLines = $this->totalNumberOfLines;
$parser->skippedLineNumbers = $skippedLineNumbers;
$parser->refs = &$this->refs;
$parser->refsBeingParsed = $this->refsBeingParsed;
return $parser->doParse($yaml, $flags);
}
/**
* Returns the current line number (takes the offset into account).
*
* @internal
*/
public function getRealCurrentLineNb(): int
{
$realCurrentLineNumber = $this->currentLineNb + $this->offset;
foreach ($this->skippedLineNumbers as $skippedLineNumber) {
if ($skippedLineNumber > $realCurrentLineNumber) {
break;
}
++$realCurrentLineNumber;
}
return $realCurrentLineNumber;
Arguments
// Merge keys
} elseif (!isset($values['value']) || '' === $values['value'] || 0 === strpos($values['value'], '#') || (null !== $subTag = $this->getLineTag($values['value'], $flags)) || '<<' === $key) {
// hash
// if next line is less indented or equal, then it means that the current value is null
if (!$this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) {
// Spec: Keys MUST be unique; first one wins.
// But overwriting is allowed when a merge node is used in current block.
if ($allowOverwrite || !isset($data[$key])) {
if (null !== $subTag) {
$data[$key] = new TaggedValue($subTag, '');
} else {
$data[$key] = null;
}
} else {
throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine);
}
} else {
// remember the parsed line number here in case we need it to provide some contexts in error messages below
$realCurrentLineNbKey = $this->getRealCurrentLineNb();
$value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $flags);
if ('<<' === $key) {
$this->refs[$refMatches['ref']] = $value;
if (Yaml::PARSE_OBJECT_FOR_MAP & $flags && $value instanceof \stdClass) {
$value = (array) $value;
}
$data += $value;
} elseif ($allowOverwrite || !isset($data[$key])) {
// Spec: Keys MUST be unique; first one wins.
// But overwriting is allowed when a merge node is used in current block.
if (null !== $subTag) {
$data[$key] = new TaggedValue($subTag, $value);
} else {
$data[$key] = $value;
}
} else {
throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $realCurrentLineNbKey + 1, $this->currentLine);
}
}
Arguments
1
"""
name: Pix\n
version: "1.0.0"\n
icon: paper-plane\n
date: 2019-25-05\n
author:\n
name: Phoca\n
email: \n
link: https://www.phoca.cz\n
\n
documentation:\n
link: https://www.phoca.cz/documentation\n
\n
support:\n
link: https://www.phoca.cz/forum\n
\n
updates:\n
link: \n
\n
copyright: (C) 2005 - 2019 Jan Pavelka. All rights reserved.\n
license: GPLv2\n
description: Pix theme\n
images:\n
thumbnail: admin/images/preset1.png\n
preview: admin/images/preset1.png\n
"""
0
*
* @throws ParseException If the YAML is not valid
*/
public function parse(string $value, int $flags = 0)
{
if (false === preg_match('//u', $value)) {
throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename);
}
$this->refs = [];
$mbEncoding = null;
if (2 /* MB_OVERLOAD_STRING */ & (int) \ini_get('mbstring.func_overload')) {
$mbEncoding = mb_internal_encoding();
mb_internal_encoding('UTF-8');
}
try {
$data = $this->doParse($value, $flags);
} finally {
if (null !== $mbEncoding) {
mb_internal_encoding($mbEncoding);
}
$this->refsBeingParsed = [];
$this->offset = 0;
$this->lines = [];
$this->currentLine = '';
$this->numberOfParsedLines = 0;
$this->refs = [];
$this->skippedLineNumbers = [];
$this->locallySkippedLineNumbers = [];
$this->totalNumberOfLines = null;
}
return $data;
}
private function doParse(string $value, int $flags)
{
Arguments
"""
details:\n
name: Pix\n
version: "1.0.0"\n
icon: paper-plane\n
date: 2019-25-05\n
author:\n
name: Phoca\n
email: \n
link: https://www.phoca.cz\n
\n
documentation:\n
link: https://www.phoca.cz/documentation\n
\n
support:\n
link: https://www.phoca.cz/forum\n
\n
updates:\n
link: \n
\n
copyright: (C) 2005 - 2019 Jan Pavelka. All rights reserved.\n
license: GPLv2\n
description: Pix theme\n
images:\n
thumbnail: admin/images/preset1.png\n
preview: admin/images/preset1.png\n
\n
configuration:\n
gantry:\n
platform: joomla\n
engine: nucleus\n
\n
theme:\n
parent: phoca_pix\n
base: gantry-theme://common\n
file: gantry-theme://include/theme.php\n
class: \Gantry\Framework\Theme\n
\n
fonts:\n
roboto:\n
400: 'gantry-theme://fonts/roboto_regular_macroman/Roboto-Regular-webfont'\n
500: 'gantry-theme://fonts/roboto_medium_macroman/Roboto-Medium-webfont'\n
700: 'gantry-theme://fonts/roboto_bold_macroman/Roboto-Bold-webfont'\n
phoca:\n
normal: 'gantry-theme://fonts/phoca/phoca'\n
css:\n
compiler: \Gantry\Component\Stylesheet\ScssCompiler\n
paths:\n
- gantry-theme://scss\n
- gantry-engine://scss\n
- gantry-theme://scss/pix/options\n
- gantry-theme://scss/pix/particles\n
- gantry-theme://scss/pix/sections\n
files:\n
- pix\n
- pix-joomla\n
- custom\n
persistent:\n
- pix\n
overrides:\n
- pix-joomla\n
- phoca-font\n
- phoca\n
- phocacart\n
- custom\n
\n
block-variations:\n
Box Variations:\n
box1: Box 1\n
box2: Box 2\n
box3: Box 3\n
box4: Box 4\n
Effects:\n
shadow: Shadow 1\n
shadow2: Shadow 2\n
rounded: Rounded\n
square: Square\n
Utility:\n
disabled: Disabled\n
align-right: Align Right\n
align-left: Align Left\n
center: Center\n
full-width: Full Width\n
equal-height: Equal Height\n
nomarginall: No Margin\n
nopaddingall: No Padding\n
\n
dependencies:\n
gantry: 5.4.0\n
\n
admin:\n
styles:\n
core:\n
- base\n
- accent\n
section:\n
- header\n
- navigation\n
- navigationtopmodules\n
- showcase\n
- maintop\n
- main\n
- mainbottom\n
- bottom\n
- utility\n
- feature\n
- subfeature\n
- footer\n
configuration:\n
- breakpoints\n
"""
0
* Parses YAML into a PHP value.
*
* Usage:
* <code>
* $array = Yaml::parse(file_get_contents('config.yml'));
* print_r($array);
* </code>
*
* @param string $input A string containing YAML
* @param int $flags A bit field of PARSE_* constants to customize the YAML parser behavior
*
* @return mixed
*
* @throws ParseException If the YAML is not valid
*/
public static function parse(string $input, int $flags = 0)
{
$yaml = new Parser();
return $yaml->parse($input, $flags);
}
/**
* Dumps a PHP value to a YAML string.
*
* The dump method, when supplied with an array, will do its best
* to convert the array into friendly YAML.
*
* @param mixed $input The PHP value
* @param int $inline The level where you switch to inline YAML
* @param int $indent The amount of spaces to use for indentation of nested nodes
* @param int $flags A bit field of DUMP_* constants to customize the dumped YAML string
*/
public static function dump($input, int $inline = 2, int $indent = 4, int $flags = 0): string
{
$yaml = new Dumper($indent);
return $yaml->dump($input, $inline, 0, $flags);
}
}
Arguments
"""
details:\n
name: Pix\n
version: "1.0.0"\n
icon: paper-plane\n
date: 2019-25-05\n
author:\n
name: Phoca\n
email: \n
link: https://www.phoca.cz\n
\n
documentation:\n
link: https://www.phoca.cz/documentation\n
\n
support:\n
link: https://www.phoca.cz/forum\n
\n
updates:\n
link: \n
\n
copyright: (C) 2005 - 2019 Jan Pavelka. All rights reserved.\n
license: GPLv2\n
description: Pix theme\n
images:\n
thumbnail: admin/images/preset1.png\n
preview: admin/images/preset1.png\n
\n
configuration:\n
gantry:\n
platform: joomla\n
engine: nucleus\n
\n
theme:\n
parent: phoca_pix\n
base: gantry-theme://common\n
file: gantry-theme://include/theme.php\n
class: \Gantry\Framework\Theme\n
\n
fonts:\n
roboto:\n
400: 'gantry-theme://fonts/roboto_regular_macroman/Roboto-Regular-webfont'\n
500: 'gantry-theme://fonts/roboto_medium_macroman/Roboto-Medium-webfont'\n
700: 'gantry-theme://fonts/roboto_bold_macroman/Roboto-Bold-webfont'\n
phoca:\n
normal: 'gantry-theme://fonts/phoca/phoca'\n
css:\n
compiler: \Gantry\Component\Stylesheet\ScssCompiler\n
paths:\n
- gantry-theme://scss\n
- gantry-engine://scss\n
- gantry-theme://scss/pix/options\n
- gantry-theme://scss/pix/particles\n
- gantry-theme://scss/pix/sections\n
files:\n
- pix\n
- pix-joomla\n
- custom\n
persistent:\n
- pix\n
overrides:\n
- pix-joomla\n
- phoca-font\n
- phoca\n
- phocacart\n
- custom\n
\n
block-variations:\n
Box Variations:\n
box1: Box 1\n
box2: Box 2\n
box3: Box 3\n
box4: Box 4\n
Effects:\n
shadow: Shadow 1\n
shadow2: Shadow 2\n
rounded: Rounded\n
square: Square\n
Utility:\n
disabled: Disabled\n
align-right: Align Right\n
align-left: Align Left\n
center: Center\n
full-width: Full Width\n
equal-height: Equal Height\n
nomarginall: No Margin\n
nopaddingall: No Padding\n
\n
dependencies:\n
gantry: 5.4.0\n
\n
admin:\n
styles:\n
core:\n
- base\n
- accent\n
section:\n
- header\n
- navigation\n
- navigationtopmodules\n
- showcase\n
- maintop\n
- main\n
- mainbottom\n
- bottom\n
- utility\n
- feature\n
- subfeature\n
- footer\n
configuration:\n
- breakpoints\n
"""
0
*/
protected function decode($var)
{
// Try native PECL YAML PHP extension first if available.
if (function_exists('yaml_parse') && $this->setting('native', true)) {
// Safely decode YAML.
$saved = @ini_get('yaml.decode_php');
@ini_set('yaml.decode_php', '0');
$data = @yaml_parse($var);
if ($saved !== false) {
@ini_set('yaml.decode_php', $saved);
}
if ($data !== false) {
return (array)$data;
}
}
try {
return (array)YamlParser::parse($var);
} catch (ParseException $e) {
if ($this->setting('compat', true)) {
return (array)FallbackYamlParser::parse($var);
}
throw $e;
}
}
}
Arguments
"""
details:\n
name: Pix\n
version: "1.0.0"\n
icon: paper-plane\n
date: 2019-25-05\n
author:\n
name: Phoca\n
email: \n
link: https://www.phoca.cz\n
\n
documentation:\n
link: https://www.phoca.cz/documentation\n
\n
support:\n
link: https://www.phoca.cz/forum\n
\n
updates:\n
link: \n
\n
copyright: (C) 2005 - 2019 Jan Pavelka. All rights reserved.\n
license: GPLv2\n
description: Pix theme\n
images:\n
thumbnail: admin/images/preset1.png\n
preview: admin/images/preset1.png\n
\n
configuration:\n
gantry:\n
platform: joomla\n
engine: nucleus\n
\n
theme:\n
parent: phoca_pix\n
base: gantry-theme://common\n
file: gantry-theme://include/theme.php\n
class: \Gantry\Framework\Theme\n
\n
fonts:\n
roboto:\n
400: 'gantry-theme://fonts/roboto_regular_macroman/Roboto-Regular-webfont'\n
500: 'gantry-theme://fonts/roboto_medium_macroman/Roboto-Medium-webfont'\n
700: 'gantry-theme://fonts/roboto_bold_macroman/Roboto-Bold-webfont'\n
phoca:\n
normal: 'gantry-theme://fonts/phoca/phoca'\n
css:\n
compiler: \Gantry\Component\Stylesheet\ScssCompiler\n
paths:\n
- gantry-theme://scss\n
- gantry-engine://scss\n
- gantry-theme://scss/pix/options\n
- gantry-theme://scss/pix/particles\n
- gantry-theme://scss/pix/sections\n
files:\n
- pix\n
- pix-joomla\n
- custom\n
persistent:\n
- pix\n
overrides:\n
- pix-joomla\n
- phoca-font\n
- phoca\n
- phocacart\n
- custom\n
\n
block-variations:\n
Box Variations:\n
box1: Box 1\n
box2: Box 2\n
box3: Box 3\n
box4: Box 4\n
Effects:\n
shadow: Shadow 1\n
shadow2: Shadow 2\n
rounded: Rounded\n
square: Square\n
Utility:\n
disabled: Disabled\n
align-right: Align Right\n
align-left: Align Left\n
center: Center\n
full-width: Full Width\n
equal-height: Equal Height\n
nomarginall: No Margin\n
nopaddingall: No Padding\n
\n
dependencies:\n
gantry: 5.4.0\n
\n
admin:\n
styles:\n
core:\n
- base\n
- accent\n
section:\n
- header\n
- navigation\n
- navigationtopmodules\n
- showcase\n
- maintop\n
- main\n
- mainbottom\n
- bottom\n
- utility\n
- feature\n
- subfeature\n
- footer\n
configuration:\n
- breakpoints\n
"""
$class = get_class($this);
$cache = $file->exists() ? $file->content() : null;
// Load real file if cache isn't up to date (or is invalid).
if (!isset($cache['@class'])
|| $cache['@class'] !== $class
|| $cache['modified'] !== $modified
|| $cache['filename'] !== $this->filename
) {
// Attempt to lock the file for writing.
try {
$file->lock(false);
} catch (\Exception $e) {
// Another process has locked the file; we will check this in a bit.
}
// Decode RAW file into compiled array.
$data = $this->decode($this->raw());
$cache = [
'@class' => $class,
'filename' => $this->filename,
'modified' => $modified,
'data' => $data
];
// If compiled file wasn't already locked by another process, save it.
if ($file->locked() !== false) {
$file->save($cache);
$file->unlock();
// Compile cached file into bytecode cache
if (function_exists('opcache_invalidate')) {
// Silence error in case if `opcache.restrict_api` directive is set.
@opcache_invalidate($file->filename(), true);
}
}
}
$file->free();
Arguments
"""
details:\n
name: Pix\n
version: "1.0.0"\n
icon: paper-plane\n
date: 2019-25-05\n
author:\n
name: Phoca\n
email: \n
link: https://www.phoca.cz\n
\n
documentation:\n
link: https://www.phoca.cz/documentation\n
\n
support:\n
link: https://www.phoca.cz/forum\n
\n
updates:\n
link: \n
\n
copyright: (C) 2005 - 2019 Jan Pavelka. All rights reserved.\n
license: GPLv2\n
description: Pix theme\n
images:\n
thumbnail: admin/images/preset1.png\n
preview: admin/images/preset1.png\n
\n
configuration:\n
gantry:\n
platform: joomla\n
engine: nucleus\n
\n
theme:\n
parent: phoca_pix\n
base: gantry-theme://common\n
file: gantry-theme://include/theme.php\n
class: \Gantry\Framework\Theme\n
\n
fonts:\n
roboto:\n
400: 'gantry-theme://fonts/roboto_regular_macroman/Roboto-Regular-webfont'\n
500: 'gantry-theme://fonts/roboto_medium_macroman/Roboto-Medium-webfont'\n
700: 'gantry-theme://fonts/roboto_bold_macroman/Roboto-Bold-webfont'\n
phoca:\n
normal: 'gantry-theme://fonts/phoca/phoca'\n
css:\n
compiler: \Gantry\Component\Stylesheet\ScssCompiler\n
paths:\n
- gantry-theme://scss\n
- gantry-engine://scss\n
- gantry-theme://scss/pix/options\n
- gantry-theme://scss/pix/particles\n
- gantry-theme://scss/pix/sections\n
files:\n
- pix\n
- pix-joomla\n
- custom\n
persistent:\n
- pix\n
overrides:\n
- pix-joomla\n
- phoca-font\n
- phoca\n
- phocacart\n
- custom\n
\n
block-variations:\n
Box Variations:\n
box1: Box 1\n
box2: Box 2\n
box3: Box 3\n
box4: Box 4\n
Effects:\n
shadow: Shadow 1\n
shadow2: Shadow 2\n
rounded: Rounded\n
square: Square\n
Utility:\n
disabled: Disabled\n
align-right: Align Right\n
align-left: Align Left\n
center: Center\n
full-width: Full Width\n
equal-height: Equal Height\n
nomarginall: No Margin\n
nopaddingall: No Padding\n
\n
dependencies:\n
gantry: 5.4.0\n
\n
admin:\n
styles:\n
core:\n
- base\n
- accent\n
section:\n
- header\n
- navigation\n
- navigationtopmodules\n
- showcase\n
- maintop\n
- main\n
- mainbottom\n
- bottom\n
- utility\n
- feature\n
- subfeature\n
- footer\n
configuration:\n
- breakpoints\n
"""
*
* @param string $theme
*/
public function __construct($theme)
{
$gantry = Gantry::instance();
/** @var UniformResourceLocator $locator */
$locator = $gantry['locator'];
$filename = $locator->findResource("gantry-themes://{$theme}/custom/gantry/theme.yaml") ?: $locator->findResource("gantry-themes://{$theme}/gantry/theme.yaml");
if (!$filename) {
throw new \RuntimeException(sprintf('Theme %s not found', $theme), 404);
}
/** @var string $cache */
$cache = $locator->findResource("gantry-cache://{$theme}/compiled/yaml", true, true);
$file = CompiledYamlFile::instance($filename);
$this->items = (array)$file->setCachePath($cache)->content();
$file->free();
$this->offsetSet('name', $theme);
$parent = (string) $this->get('configuration.theme.parent', $theme);
$parent = $parent !== $theme ? $parent : null;
$this->offsetSet('parent', $parent);
}
/**
* @return string
*/
public function addStreams()
{
$gantry = Gantry::instance();
// Initialize theme stream.
$streamName = $this->addStream($this->offsetGet('name'), $this->getPaths());
return $this->segments;
}
/**
* Prepare layout for rendering. Initializes all CSS/JS in particles.
*/
public function prepare()
{
$this->segments();
}
/**
* Returns details of the theme.
*
* @return ThemeDetails
*/
public function details()
{
if (!$this->details) {
$this->details = new ThemeDetails($this->name);
}
return $this->details;
}
/**
* Returns configuration of the theme.
*
* @return array
*/
public function configuration()
{
return (array) $this->details()['configuration'];
}
/**
* Function to convert block sizes into CSS classes.
*
* @param $text
* @return string
*/
Arguments
'9.1' => 'size-9-1',
'8.3' => 'size-8-3'
];
return isset($sizes[$number]) ? ' ' . $sizes[$number] : 'size-' . (int) $number;
}
/**
* Magic setter method
*
* @param mixed $offset Asset name value
* @param mixed $value Asset value
*/
public function __set($offset, $value)
{
if ($offset === 'title') {
$offset = 'name';
}
$this->details()->offsetSet('details.' . $offset, $value);
}
/**
* Magic getter method
*
* @param mixed $offset Asset name value
* @return mixed Asset value
*/
public function __get($offset)
{
if ($offset === 'title') {
$offset = 'name';
}
$value = $this->details()->offsetGet('details.' . $offset);
if ($offset === 'version' && is_int($value)) {
$value .= '.0';
}
// FIXME: Do not hardcode this file.
$language->load('files_gantry5_nucleus', JPATH_SITE);
if ($application->isClient('site')) {
// Load our custom positions file as frontend requires the strings to be there.
$filename = $locator("gantry-theme://language/en-GB/en-GB.tpl_{$this->name}_positions.ini");
if ($filename) {
$language->load("tpl_{$this->name}_positions", \dirname(\dirname(\dirname($filename))), 'en-GB');
}
// Load template language files, including overrides.
$paths = $locator->findResources('gantry-theme://language');
foreach (array_reverse($paths) as $path) {
$language->load("tpl_{$this->name}", \dirname($path));
}
}
$this->language = 'en-gb';
$this->direction = 'ltr';
$this->url = Uri::root(true) . '/templates/' . $this->name;
PluginHelper::importPlugin('gantry5');
// Trigger the onGantryThemeInit event.
$application->triggerEvent('onGantry5ThemeInit', ['theme' => $this]);
}
/**
* Get list of twig paths.
*
* @return array
*/
public static function getTwigPaths()
{
/** @var UniformResourceLocator $locator */
$locator = static::gantry()['locator'];
return $locator->mergeResources(['gantry-theme://twig', 'gantry-engine://twig']);
Arguments
/** @var Environment|null */
protected $renderer;
/**
* Construct theme object.
*
* @param string $path
* @param string $name
*/
public function __construct($path, $name = null)
{
if (!is_dir($path)) {
throw new \LogicException('Theme not found!');
}
$this->name = $name ?: Gantry::basename($path);
$this->path = $path;
$this->init();
}
/**
* Get context for render().
*
* @param array $context
* @return array
*/
public function getContext(array $context)
{
$context['theme'] = $this;
return $context;
}
/**
* Define twig environment.
*
* @param Environment $twig
* @param LoaderInterface $loader
class_exists('\\Gantry\\Framework\\Gantry') or die;
// Define the template.
class GantryTheme extends \Gantry\Framework\Theme {}
// Initialize theme stream.
$gantry['platform']->set(
'streams.gantry-theme.prefixes',
['' => [
"gantry-themes://{$gantry['theme.name']}/custom",
"gantry-themes://{$gantry['theme.name']}/phoca",
"gantry-themes://{$gantry['theme.name']}",
"gantry-themes://{$gantry['theme.name']}/common"
]]
);
// Define Gantry services.
$gantry['theme'] = function ($c) {
return new GantryTheme($c['theme.path'], $c['theme.name']);
};
require_once (dirname(__FILE__).'/phoca.php');
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix"
"phoca_pix"
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
if (
isset($this->raw[$id])
|| !\is_object($this->values[$id])
|| isset($this->protected[$this->values[$id]])
|| !\method_exists($this->values[$id], '__invoke')
) {
return $this->values[$id];
}
if (isset($this->factories[$this->values[$id]])) {
return $this->values[$id]($this);
}
$raw = $this->values[$id];
$val = $this->values[$id] = $raw($this);
$this->raw[$id] = $raw;
$this->frozen[$id] = true;
return $val;
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
Arguments
Gantry\Framework\Gantry {#704}
<?php
/**
* @package Gantry 5 Theme
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2017 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('_JEXEC') or die;
// 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);
Arguments
* @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 = array())
{
// Check
$directory = $params['directory'] ?? 'templates';
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix/error.php"
$file = 'index.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, $directory . '/' . $inherits))
|| $lang->load('tpl_' . $template, $directory . '/' . $template);
// 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 = array();
if (preg_match_all('#<jdoc:include\ type="([^"]+)"(.*)\/>#iU', $this->_template, $matches))
{
$messages = [];
$template_tags_first = [];
$template_tags_last = [];
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix"
"error.php"
$options['title'] = $args[3] ?? null;
}
parent::$_buffer[$options['type']][$options['name']][$options['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 = array())
{
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 = array())
{
$this->_caching = $caching;
if (empty($this->_template))
{
$this->parse($params);
}
Arguments
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
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 = array())
{
$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
Arguments
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
{
$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();
Arguments
false
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
$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,
]
);
}
}
Arguments
false
array:7 [
"template" => "phoca_pix"
"directory" => "/var/www/virtual/sauwald.info/htdocs/templates"
"debug" => "0"
"csp_nonce" => null
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#698}
"file" => "error.php"
]
else
{
$format = $app->input->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);
}
Arguments
Error {#720
#message: "Call to a member function getWebAssetManager() on null"
#code: 0
#file: "/var/www/virtual/sauwald.info/htdocs/libraries/src/HTML/Helpers/Jquery.php"
#line: 48
}
}
}
// 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');
Arguments
Error {#720
#message: "Call to a member function getWebAssetManager() on null"
#code: 0
#file: "/var/www/virtual/sauwald.info/htdocs/libraries/src/HTML/Helpers/Jquery.php"
#line: 48
}
// 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
Arguments
Error {#720
#message: "Call to a member function getWebAssetManager() on null"
#code: 0
#file: "/var/www/virtual/sauwald.info/htdocs/libraries/src/HTML/Helpers/Jquery.php"
#line: 48
}
protected static $loaded = array();
/**
* Method to load the jQuery JavaScript framework into the document head
*
* If debugging mode is on an uncompressed version of jQuery is included for easier debugging.
*
* @param boolean $noConflict True to load jQuery in noConflict mode [optional]
* @param mixed $debug Is debugging mode on? [optional]
* @param boolean $migrate True to enable the jQuery Migrate plugin
*
* @return void
*
* @since 3.0
*
* @deprecated 5.0 Use Joomla\CMS\WebAsset\WebAssetManager::useAsset();
*/
public static function framework($noConflict = true, $debug = null, $migrate = false)
{
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
$wa->useScript('jquery');
// Check if we are loading in noConflict
if ($noConflict)
{
$wa->useScript('jquery-noconflict');
}
// Check if we are loading Migrate
if ($migrate)
{
$wa->useScript('jquery-migrate');
}
}
/**
* Auto set CSRF token to ajaxSetup so all jQuery ajax call will contains CSRF token.
*
* @param string $name The CSRF meta tag name.
*
Arguments
"Call to a member function getWebAssetManager() on null"
* @param callable $function Function or method to call
* @param array $args Arguments to be passed to function
*
* @return mixed Function result or false on error.
*
* @link https://www.php.net/manual/en/function.call-user-func-array.php
* @since 1.6
* @throws \InvalidArgumentException
*/
protected static function call(callable $function, $args)
{
// PHP 5.3 workaround
$temp = array();
foreach ($args as &$arg)
{
$temp[] = &$arg;
}
return \call_user_func_array($function, $temp);
}
/**
* Write a `<a>` element
*
* @param string $url The relative URL to use for the href attribute
* @param string $text The target attribute to use
* @param array|string $attribs Attributes to be added to the `<a>` element
*
* @return string
*
* @since 1.5
*/
public static function link($url, $text, $attribs = null)
{
if (\is_array($attribs))
{
$attribs = ArrayHelper::toString($attribs);
}
}
/*
* Support fetching services from the registry if a custom class prefix was not given (a three segment key),
* the service comes from a class other than this one, and a service has been registered for the file.
*/
if ($prefix === 'JHtml' && $file !== '' && static::getServiceRegistry()->hasService($file))
{
$service = static::getServiceRegistry()->getService($file);
$toCall = array($service, $func);
if (!\is_callable($toCall))
{
throw new \InvalidArgumentException(sprintf('%s::%s not found.', $file, $func), 500);
}
static::register($key, $toCall);
return static::call($toCall, $methodArgs);
}
$className = $prefix . ucfirst($file);
if (!class_exists($className))
{
$path = Path::find(static::$includePaths, strtolower($file) . '.php');
if (!$path)
{
throw new \InvalidArgumentException(sprintf('%s %s not found.', $prefix, $file), 500);
}
\JLoader::register($className, $path);
if (!class_exists($className))
{
throw new \InvalidArgumentException(sprintf('%s not found.', $className), 500);
}
}
Arguments
array:2 [
0 => "Joomla\CMS\HTML\Helpers\Jquery"
1 => "framework"
]
[]
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Theme
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
JHtml::_('jquery.framework');
JHtml::_('bootstrap.tooltip');
class PhocaTheme {
protected $name = '';
protected $name_short = '';
public function __construct() {
$app = JFactory::getApplication();
$this->name = $app->getTemplate();
$this->name_short = str_replace('phoca_', '',$this->name);
}
function getCssPath() {
return JURI::base(true).'/templates/'.$this->name.'/css/';
}
function getJsPath() {
return JURI::base(true).'/templates/'.$this->name.'/js/';
}
function getOptionPath($item) {
return JURI::base(true).'/templates/'.$this->name.'/options/'.htmlspecialchars($item).'/';
}
/*
* CSS and JS is stored in Options folder BUT SCSS not because of compiling
* and setting in YAML: templates\phoca_pix\gantry\theme.yaml (only one folder will be set, not a folder for each option/particle)
*/
Arguments
// Define the template.
class GantryTheme extends \Gantry\Framework\Theme {}
// Initialize theme stream.
$gantry['platform']->set(
'streams.gantry-theme.prefixes',
['' => [
"gantry-themes://{$gantry['theme.name']}/custom",
"gantry-themes://{$gantry['theme.name']}/phoca",
"gantry-themes://{$gantry['theme.name']}",
"gantry-themes://{$gantry['theme.name']}/common"
]]
);
// Define Gantry services.
$gantry['theme'] = function ($c) {
return new GantryTheme($c['theme.path'], $c['theme.name']);
};
require_once (dirname(__FILE__).'/phoca.php');
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix/includes/phoca.php"
throw new RuntimeException(JText::_('GANTRY5_THEME_INSTALL_GANTRY'));
}
// Setup Gantry 5 Framework or throw exception.
Gantry5\Loader::setup();
// Get Gantry instance and return it.
$gantry = Gantry::instance();
// Initialize the template if not done already.
if (!isset($gantry['theme.name']))
{
$gantry['theme.path'] = dirname(__DIR__);
$gantry['theme.name'] = $template->template;
}
// Only a single template can be loaded at any time.
if (!isset($gantry['theme']) && file_exists(__DIR__ . '/theme.php'))
{
include_once __DIR__ . '/theme.php';
}
return $gantry;
}
catch (Exception $e)
{
// Oops, something went wrong!
header("HTTP/1.0 500 Internal Server Error");
$message = JText::sprintf("GANTRY5_THEME_LOADING_FAILED", $template->template, $e->getMessage());
echo <<<html
<html>
<head>
<title>500 Internal Server Error</title>
<style>
.alert {
padding: 8px 35px 8px 14px;
margin-bottom: 18px;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5);
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix/includes/theme.php"
/**
* Load Gantry framework before dispatching to the component.
*
* @throws \RuntimeException
*/
private function onAfterRouteSite()
{
$templateName = $this->app->getTemplate();
if (!$this->isGantryTemplate($templateName)) {
return;
}
$gantryPath = JPATH_THEMES . "/{$templateName}/custom/includes/gantry.php";
if (!is_file($gantryPath)) {
$gantryPath = JPATH_THEMES . "/{$templateName}/includes/gantry.php";
}
if (is_file($gantryPath)) {
// Manually setup Gantry 5 Framework from the template.
$gantry = include $gantryPath;
if (!$gantry) {
throw new \RuntimeException(
Text::sprintf('GANTRY5_THEME_LOADING_FAILED', $templateName, Text::_('GANTRY5_THEME_INCLUDE_FAILED')),
500
);
}
} else {
// Setup Gantry 5 Framework or throw exception.
Loader::setup();
// Get Gantry instance.
$gantry = Gantry::instance();
// Initialize the template.
$gantry['theme.path'] = JPATH_THEMES . "/{$templateName}";
$gantry['theme.name'] = $templateName;
Arguments
"/var/www/virtual/sauwald.info/htdocs/templates/phoca_pix/includes/gantry.php"
/**
* Return global configuration for Gantry5.
*
* @param array $global
*/
public function onGantryGlobalConfig(&$global)
{
$global = $this->params->toArray();
}
public function onAfterRoute()
{
if (version_compare(JVERSION, '4.0', '<')) {
// In Joomla 3.9 we need to make sure that user identity has been loaded.
$this->app->loadIdentity();
}
if ($this->app->isClient('site')) {
$this->onAfterRouteSite();
} elseif ($this->app->isClient('administrator')) {
$this->onAfterRouteAdmin();
}
}
/**
* Document gets set during dispatch, we need language and direction.
*/
public function onAfterDispatch()
{
if (class_exists('Gantry\Framework\Gantry')) {
$this->onAfterDispatchSiteAdmin();
}
}
public function onAfterRender()
{
if ($this->app->isClient('site') && class_exists('Gantry\Framework\Gantry')) {
$this->onAfterRenderSite();
$methodName,
function (AbstractEvent $event) use ($methodName)
{
// Get the event arguments
$arguments = $event->getArguments();
// Extract any old results; they must not be part of the method call.
$allResults = [];
if (isset($arguments['result']))
{
$allResults = $arguments['result'];
unset($arguments['result']);
}
// Convert to indexed array for unpacking.
$arguments = \array_values($arguments);
$result = $this->{$methodName}(...$arguments);
// Ignore null results
if ($result === null)
{
return;
}
// Restore the old results and add the new result from our method call
$allResults[] = $result;
$event['result'] = $allResults;
}
);
}
/**
* Registers a proper event listener, i.e. a method which accepts an AbstractEvent as its sole argument. This is the
* preferred way to implement plugins in Joomla! 4.x and will be the only possible method with Joomla! 5.x onwards.
*
* @param string $methodName The method name to register
*
trigger_deprecation(
'joomla/event',
'2.0.0',
'Not passing an event object to %s() is deprecated, as of 3.0 the $event argument will be required.',
__METHOD__
);
$event = $this->getDefaultEvent($name);
}
if (isset($this->listeners[$event->getName()]))
{
foreach ($this->listeners[$event->getName()] as $listener)
{
if ($event->isStopped())
{
return $event;
}
$listener($event);
}
}
return $event;
}
/**
* Trigger an event.
*
* @param EventInterface|string $event The event object or name.
*
* @return EventInterface The event after being passed through all listeners.
*
* @since 1.0
* @deprecated 3.0 Use dispatch() instead.
*/
public function triggerEvent($event)
{
trigger_deprecation(
'joomla/event',
Arguments
Joomla\Event\Event {#684}
{
$this->getLogger()->error(sprintf('Dispatcher not set in %s, cannot trigger events.', \get_class($this)));
return [];
}
if ($args instanceof Event)
{
$event = $args;
}
elseif (\is_array($args))
{
$event = new Event($eventName, $args);
}
else
{
throw new \InvalidArgumentException('The arguments must either be an event or an array');
}
$result = $dispatcher->dispatch($eventName, $event);
// @todo - There are still test cases where the result isn't defined, temporarily leave the isset check in place
return !isset($result['result']) || \is_null($result['result']) ? [] : $result['result'];
}
}
Arguments
"onAfterRoute"
Joomla\Event\Event {#684}
$this->sendHeaders();
$this->redirect((string) $oldUri, 301);
}
}
}
foreach ($result as $key => $value)
{
$this->input->def($key, $value);
}
if ($this->isTwoFactorAuthenticationRequired())
{
$this->redirectIfTwoFactorAuthenticationRequired();
}
// Trigger the onAfterRoute event.
PluginHelper::importPlugin('system');
$this->triggerEvent('onAfterRoute');
}
/**
* Sets the value of a user state variable.
*
* @param string $key The path of the state.
* @param mixed $value The value of the variable.
*
* @return mixed|void The previous state, if one existed.
*
* @since 3.2
*/
public function setUserState($key, $value)
{
$session = Factory::getSession();
$registry = $session->get('registry');
if ($registry !== null)
{
return $registry->set($key, $value);
Arguments
parent::render();
}
/**
* Route the application.
*
* Routing is the process of examining the request environment to determine which
* component should receive the request. The component optional parameters
* are then set in the request object to be processed when the application is being
* dispatched.
*
* @return void
*
* @since 3.2
*/
protected function route()
{
// Execute the parent method
parent::route();
$Itemid = $this->input->getInt('Itemid', null);
$this->authorise($Itemid);
}
/**
* Set the current state of the detect browser option.
*
* @param boolean $state The new state of the detect browser option
*
* @return boolean The previous state
*
* @since 3.2
*/
public function setDetectBrowser($state = false)
{
$old = $this->getDetectBrowser();
$this->detect_browser = $state;
return $old;
$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.
JDEBUG ? $this->profiler->mark('afterInitialise') : null;
// Route the application
$this->route();
// Mark afterRoute in the profiler.
JDEBUG ? $this->profiler->mark('afterRoute') : null;
/*
* 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;
}
}
}
/**
* 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 */
*
* 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();
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
"/var/www/virtual/sauwald.info/htdocs/includes/app.php"