*/
class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface
{
/** Identifier of the main namespace. */
const MAIN_NAMESPACE = '__main__';
protected $paths = [];
protected $cache = [];
protected $errorCache = [];
private $rootPath;
/**
* @param string|array $paths A path or an array of paths where to look for templates
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*/
public function __construct($paths = [], $rootPath = null)
{
$this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
if (false !== $realPath = realpath($rootPath)) {
$this->rootPath = $realPath.\DIRECTORY_SEPARATOR;
}
if ($paths) {
$this->setPaths($paths);
}
}
/**
* Returns the paths to the templates.
*
* @param string $namespace A path namespace
*
* @return array The array of paths where to look for templates
*/
public function getPaths($namespace = self::MAIN_NAMESPACE)
{
return isset($this->paths[$namespace]) ? $this->paths[$namespace] : [];
}
Arguments
"realpath(): Passing null to parameter #1 ($path) of type string is deprecated"
*/
class FilesystemLoader implements LoaderInterface, ExistsLoaderInterface, SourceContextLoaderInterface
{
/** Identifier of the main namespace. */
const MAIN_NAMESPACE = '__main__';
protected $paths = [];
protected $cache = [];
protected $errorCache = [];
private $rootPath;
/**
* @param string|array $paths A path or an array of paths where to look for templates
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*/
public function __construct($paths = [], $rootPath = null)
{
$this->rootPath = (null === $rootPath ? getcwd() : $rootPath).\DIRECTORY_SEPARATOR;
if (false !== $realPath = realpath($rootPath)) {
$this->rootPath = $realPath.\DIRECTORY_SEPARATOR;
}
if ($paths) {
$this->setPaths($paths);
}
}
/**
* Returns the paths to the templates.
*
* @param string $namespace A path namespace
*
* @return array The array of paths where to look for templates
*/
public function getPaths($namespace = self::MAIN_NAMESPACE)
{
return isset($this->paths[$namespace]) ? $this->paths[$namespace] : [];
}
Arguments
/** @var Config $global */
$global = $gantry['global'];
$cachePath = $global->get('compile_twig', 1) ? $this->getCachePath('twig') : null;
if ($cachePath) {
/** @phpstan-ignore-next-line */
if (Environment::VERSION_ID > 3) {
// Twig 3 support.
$cache = new FilesystemCache($cachePath, FilesystemCache::FORCE_BYTECODE_INVALIDATION);
/** @phpstan-ignore-next-line */
} else {
$cache = new TwigCacheFilesystem($cachePath, FilesystemCache::FORCE_BYTECODE_INVALIDATION);
}
} else {
$cache = null;
}
$debug = $gantry->debug();
$production = (bool) $global->get('production', 1);
$loader = new FilesystemLoader();
$params = [
'cache' => $cache,
'debug' => $debug,
'auto_reload' => !$production,
'autoescape' => 'html'
];
$twig = new Environment($loader, $params);
$this->setTwigLoaderPaths($loader);
if ($debug) {
$twig->addExtension(new DebugExtension());
}
$this->renderer = $this->extendTwig($twig, $loader);
}
return $this->renderer;
}
$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);
}
$joomla->document = $this;
/** @var Theme $theme */
$theme = $gantry['theme'];
$app = Factory::getApplication();
$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
"error.html.twig"
array:7 [
"errorcode" => 8192
"error" => "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated"
"debug" => false
"backtrace" => null
"theme" => GantryTheme {#787}
"site" => Gantry\Framework\Site {#819}
"joomla" => Gantry\Framework\Platform {#836}
]
* @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
"/www/a/i/u68802/public_html/_sub/test/templates/g5_helium/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
"/www/a/i/u68802/public_html/_sub/test/templates/g5_helium"
"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" => "g5_helium"
"directory" => "/www/a/i/u68802/public_html/_sub/test/templates"
"debug" => false
"csp_nonce" => "ZDY5NmUwZTY0MmNjMTRhZTA1NTc2MmIyYmM3YmNmMDE5NDBiMTNhMzQwYWU4ODg4ZTc0ZWUwODUyNjk1NWNhMjc2ZjI4YWM3ZDE1NjI1NTZlMmNhZmQ5NTQ2NjMyNDdhODc4YTdkYjcwNzM5OGNhMjJlNjRlOGYzNjQ0YTYwNjI="
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#797}
"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" => "g5_helium"
"directory" => "/www/a/i/u68802/public_html/_sub/test/templates"
"debug" => false
"csp_nonce" => "ZDY5NmUwZTY0MmNjMTRhZTA1NTc2MmIyYmM3YmNmMDE5NDBiMTNhMzQwYWU4ODg4ZTc0ZWUwODUyNjk1NWNhMjc2ZjI4YWM3ZDE1NjI1NTZlMmNhZmQ5NTQ2NjMyNDdhODc4YTdkYjcwNzM5OGNhMjJlNjRlOGYzNjQ0YTYwNjI="
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#797}
"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" => "g5_helium"
"directory" => "/www/a/i/u68802/public_html/_sub/test/templates"
"debug" => false
"csp_nonce" => "ZDY5NmUwZTY0MmNjMTRhZTA1NTc2MmIyYmM3YmNmMDE5NDBiMTNhMzQwYWU4ODg4ZTc0ZWUwODUyNjk1NWNhMjc2ZjI4YWM3ZDE1NjI1NTZlMmNhZmQ5NTQ2NjMyNDdhODc4YTdkYjcwNzM5OGNhMjJlNjRlOGYzNjQ0YTYwNjI="
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#797}
"file" => "error.php"
]
{
$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" => "g5_helium"
"directory" => "/www/a/i/u68802/public_html/_sub/test/templates"
"debug" => false
"csp_nonce" => "ZDY5NmUwZTY0MmNjMTRhZTA1NTc2MmIyYmM3YmNmMDE5NDBiMTNhMzQwYWU4ODg4ZTc0ZWUwODUyNjk1NWNhMjc2ZjI4YWM3ZDE1NjI1NTZlMmNhZmQ5NTQ2NjMyNDdhODc4YTdkYjcwNzM5OGNhMjJlNjRlOGYzNjQ0YTYwNjI="
"templateInherits" => ""
"params" => Joomla\Registry\Registry {#797}
"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
Whoops\Exception\ErrorException {#812
#message: "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated"
#code: 8192
#file: "/www/a/i/u68802/public_html/_sub/test/components/com_gantry5/gantry5.php"
#line: 102
#severity: E_DEPRECATED
}
}
}
// 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
Whoops\Exception\ErrorException {#812
#message: "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated"
#code: 8192
#file: "/www/a/i/u68802/public_html/_sub/test/components/com_gantry5/gantry5.php"
#line: 102
#severity: E_DEPRECATED
}
// 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());
}
// Send the application response.
$this->respond();
// Trigger the onAfterRespond event.
$this->triggerEvent('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
* @param string $tasks Permitted tasks
*
* @return void
Arguments
Whoops\Exception\ErrorException {#812
#message: "json_decode(): Passing null to parameter #1 ($json) of type string is deprecated"
#code: 8192
#file: "/www/a/i/u68802/public_html/_sub/test/components/com_gantry5/gantry5.php"
#line: 102
#severity: E_DEPRECATED
}
}
$document->setTitle($title);
// Set description.
if ($params->get('menu-meta_description')) {
$document->setDescription($params->get('menu-meta_description'));
}
// Set Keywords.
if ($params->get('menu-meta_keywords')) {
$document->setMetaData('keywords', $params->get('menu-meta_keywords'));
}
// Set robots.
if ($params->get('robots')) {
$document->setMetaData('robots', $params->get('robots'));
}
/** @var object $params */
$data = json_decode($params->get('particle'), true);
if (!$data) {
// No component output.
return;
}
$context = [
'gantry' => $gantry,
'noConfig' => true,
'inContent' => true,
'segment' => [
'id' => 'main-particle',
'type' => $data['type'],
'classes' => $params->get('pageclass_sfx'),
'subtype' => $data['particle'],
'attributes' => $data['options']['particle'],
]
];
// Render the particle.
echo trim($theme->render('@nucleus/content/particle.html.twig', $context));
Arguments
"json_decode(): Passing null to parameter #1 ($json) of type string is deprecated"
}
$document->setTitle($title);
// Set description.
if ($params->get('menu-meta_description')) {
$document->setDescription($params->get('menu-meta_description'));
}
// Set Keywords.
if ($params->get('menu-meta_keywords')) {
$document->setMetaData('keywords', $params->get('menu-meta_keywords'));
}
// Set robots.
if ($params->get('robots')) {
$document->setMetaData('robots', $params->get('robots'));
}
/** @var object $params */
$data = json_decode($params->get('particle'), true);
if (!$data) {
// No component output.
return;
}
$context = [
'gantry' => $gantry,
'noConfig' => true,
'inContent' => true,
'segment' => [
'id' => 'main-particle',
'type' => $data['type'],
'classes' => $params->get('pageclass_sfx'),
'subtype' => $data['particle'],
'attributes' => $data['options']['particle'],
]
];
// Render the particle.
echo trim($theme->render('@nucleus/content/particle.html.twig', $context));
Arguments
* @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
"/www/a/i/u68802/public_html/_sub/test/components/com_gantry5/gantry5.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);
}
}
Arguments
"/www/a/i/u68802/public_html/_sub/test/components/com_gantry5/gantry5.php"
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 5.0 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
*/
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.
Arguments
// 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;
}
/**
* 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.
*
}
}
/**
* 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
"/www/a/i/u68802/public_html/_sub/test/includes/app.php"