/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Twig
/Twig.php
$this->twig->setCache(false);
}
// Get Twig template layout
$template = $this->template($page->template() . $ext);
try {
$output = $this->twig->render($template, $twig_vars);
} catch (\Twig_Error_Loader $e) {
$error_msg = $e->getMessage();
// Try html version of this template if initial template was NOT html
if ($ext != '.html' . TWIG_EXT) {
try {
$page->templateFormat('html');
$output = $this->twig->render($page->template() . '.html' . TWIG_EXT, $twig_vars);
} catch (\Twig_Error_Loader $e) {
throw new \RuntimeException($error_msg, 400, $e);
}
} else {
throw new \RuntimeException($error_msg, 400, $e);
}
}
return $output;
}
/**
* Simple helper method to get the twig template if it has already been set, else return
* the one being passed in
*
* @param string $template the template name
*
* @return string the template name
*/
public function template($template)
{
if (isset($this->template)) {
return $this->template;
} else {
return $template;
Arguments
"Template "features_and_options.html.twig" is not defined."
/home2
/egretozv
/public_html
/vendor
/twig
/twig
/lib
/Twig
/Loader
/Chain.php
/**
* {@inheritdoc}
*/
public function getCacheKey($name)
{
$exceptions = array();
foreach ($this->loaders as $loader) {
if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
continue;
}
try {
return $loader->getCacheKey($name);
} catch (Twig_Error_Loader $e) {
$exceptions[] = get_class($loader).': '.$e->getMessage();
}
}
throw new Twig_Error_Loader(sprintf('Template "%s" is not defined%s.', $name, $exceptions ? ' ('.implode(', ', $exceptions).')' : ''));
}
/**
* {@inheritdoc}
*/
public function isFresh($name, $time)
{
$exceptions = array();
foreach ($this->loaders as $loader) {
if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) {
continue;
}
try {
return $loader->isFresh($name, $time);
} catch (Twig_Error_Loader $e) {
$exceptions[] = get_class($loader).': '.$e->getMessage();
}
}
Arguments
"Template "features_and_options.html.twig" is not defined."
/home2
/egretozv
/public_html
/vendor
/twig
/twig
/lib
/Twig
/Environment.php
/**
* Gets the template class associated with the given string.
*
* The generated template class is based on the following parameters:
*
* * The cache key for the given template;
* * The currently enabled extensions;
* * Whether the Twig C extension is available or not;
* * PHP version;
* * Twig version;
* * Options with what environment was created.
*
* @param string $name The name for which to calculate the template class name
* @param int|null $index The index if it is an embedded template
*
* @return string The template class name
*/
public function getTemplateClass($name, $index = null)
{
$key = $this->getLoader()->getCacheKey($name).$this->optionsHash;
return $this->templateClassPrefix.hash('sha256', $key).(null === $index ? '' : '_'.$index);
}
/**
* Gets the template class prefix.
*
* @return string The template class prefix
*
* @deprecated since 1.22 (to be removed in 2.0)
*/
public function getTemplateClassPrefix()
{
@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.
Arguments
"features_and_options.html.twig"
/home2
/egretozv
/public_html
/vendor
/twig
/twig
/lib
/Twig
/Environment.php
/**
* Loads a template internal representation.
*
* This method is for internal use only and should never be called
* directly.
*
* @param string $name The template name
* @param int $index The index if it is an embedded template
*
* @return Twig_TemplateInterface A template instance representing the given template name
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
*
* @internal
*/
public function loadTemplate($name, $index = null)
{
$cls = $this->getTemplateClass($name, $index);
if (isset($this->loadedTemplates[$cls])) {
return $this->loadedTemplates[$cls];
}
if (!class_exists($cls, false)) {
if ($this->bcGetCacheFilename) {
$key = $this->getCacheFilename($name);
} else {
$key = $this->cache->generateKey($name, $cls);
}
if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
$this->cache->load($key);
}
if (!class_exists($cls, false)) {
$loader = $this->getLoader();
if (!$loader instanceof Twig_SourceContextLoaderInterface) {
$source = new Twig_Source($loader->getSource($name), $name);
Arguments
"features_and_options.html.twig"
null
/home2
/egretozv
/public_html
/vendor
/twig
/twig
/lib
/Twig
/Environment.php
@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 $name The template name
* @param array $context An array of parameters to pass to the template
*
* @return string The rendered template
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
* @throws Twig_Error_Runtime When an error occurred during rendering
*/
public function render($name, array $context = array())
{
return $this->loadTemplate($name)->render($context);
}
/**
* Displays a template.
*
* @param string $name The template name
* @param array $context An array of parameters to pass to the template
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
* @throws Twig_Error_Runtime When an error occurred during rendering
*/
public function display($name, array $context = array())
{
$this->loadTemplate($name)->display($context);
}
/**
* Loads a template.
*
Arguments
"features_and_options.html.twig"
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Twig
/Twig.php
$twig_vars = $this->twig_vars;
$twig_vars['pages'] = $pages->root();
$twig_vars['page'] = $page;
$twig_vars['header'] = $page->header();
$twig_vars['media'] = $page->media();
$twig_vars['content'] = $content;
$ext = '.' . ($format ? $format : 'html') . TWIG_EXT;
// determine if params are set, if so disable twig cache
$params = $this->grav['uri']->params(null, true);
if (!empty($params)) {
$this->twig->setCache(false);
}
// Get Twig template layout
$template = $this->template($page->template() . $ext);
try {
$output = $this->twig->render($template, $twig_vars);
} catch (\Twig_Error_Loader $e) {
$error_msg = $e->getMessage();
// Try html version of this template if initial template was NOT html
if ($ext != '.html' . TWIG_EXT) {
try {
$page->templateFormat('html');
$output = $this->twig->render($page->template() . '.html' . TWIG_EXT, $twig_vars);
} catch (\Twig_Error_Loader $e) {
throw new \RuntimeException($error_msg, 400, $e);
}
} else {
throw new \RuntimeException($error_msg, 400, $e);
}
}
return $output;
}
/**
* Simple helper method to get the twig template if it has already been set, else return
Arguments
"features_and_options.html.twig"
array:21 [
"config" => Config {}
"uri" => Uri {}
"base_dir" => "/home2/egretozv/public_html"
"base_url" => "/en"
"base_url_simple" => ""
"base_url_absolute" => "https://www.egret.aero/en"
"base_url_relative" => "/en"
"theme_dir" => "/home2/egretozv/public_html/user/themes/egret"
"theme_url" => "/user/themes/egret"
"site" => array:9 [
"title" => "Egret Aviation"
"author" => array:2 [
"name" => "Egret "
"email" => "info@egret.aero"
]
"taxonomies" => array:3 [
0 => "category"
1 => "size"
2 => "type"
]
"metadata" => array:1 [
"description" => ""
]
"summary" => array:4 [
"enabled" => true
"format" => "short"
"size" => 300
"delimiter" => "==="
]
"redirects" => null
"routes" => null
"blog" => array:1 [
"route" => "/blog"
]
"instagram_url" => "http://www.some.url/bbb"
]
"assets" => Assets {}
"taxonomy" => Taxonomy {}
"browser" => Browser {}
"langswitcher" => {}
"form" => null
"form_json_response" => []
"pages" => Page {}
"page" => Page {}
"header" => {}
"media" => Media {}
"content" => """
<h1>Error: Invalid Frontmatter</h1>\n
<p>Path: <code>C:/phpStudy/PHPTutorial/WWW/egret/user/pages/99.catalog/05.addons/features_and_options/features_and_options.en.md</code></p>\n
<p><strong>Multiple documents are not supported at line 2 (near "---").</strong></p>\n
<pre><code>---\n
\n
---\n
---\n
---</code></pre>
"""
]
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Service
/OutputServiceProvider.php
<?php
/**
* @package Grav.Common.Service
*
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Service;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
class OutputServiceProvider implements ServiceProviderInterface
{
public function register(Container $container) {
$container['output'] = function ($c) {
return $c['twig']->processSite($c['page']->templateFormat());
};
}
}
Arguments
/home2
/egretozv
/public_html
/vendor
/pimple
/pimple
/src
/Pimple
/Container.php
{
if (!isset($this->keys[$id])) {
throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $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
*/
public function offsetExists($id)
{
return isset($this->keys[$id]);
}
/**
Arguments
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Processors
/RenderProcessor.php
<?php
/**
* @package Grav.Common.Processors
*
* @copyright Copyright (C) 2014 - 2016 RocketTheme, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Processors;
class RenderProcessor extends ProcessorBase implements ProcessorInterface {
public $id = 'render';
public $title = 'Render';
public function process() {
$this->container->output = $this->container['output'];
$this->container->fireEvent('onOutputGenerated');
}
}
Arguments
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Grav.php
$instance->offsetSet($key, $value);
}
}
return self::$instance;
}
/**
* Process a request
*/
public function process()
{
/** @var Debugger $debugger */
$debugger = $this['debugger'];
// process all processors (e.g. config, initialize, assets, ..., render)
foreach ($this->processors as $processor) {
$processor = $this[$processor];
$this->measureTime($processor->id, $processor->title, function () use ($processor) {
$processor->process();
});
}
// Set the header type
$this->header();
echo $this->output;
$debugger->render();
$this->fireEvent('onOutputRendered');
register_shutdown_function([$this, 'shutdown']);
}
/**
* Set the system locale based on the language and configuration
*/
public function setLocale()
{
// Initialize Locale if set and configured.
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Grav.php
*
* @param array $values
*
* @return static
*/
protected static function load(array $values)
{
$container = new static($values);
$container['grav'] = $container;
$container['debugger'] = new Debugger();
$debugger = $container['debugger'];
// closure that measures time by wrapping a function into startTimer and stopTimer
// The debugger can be passed to the closure. Should be more performant
// then to get it from the container all time.
$container->measureTime = function ($timerId, $timerTitle, $callback) use ($debugger) {
$debugger->startTimer($timerId, $timerTitle);
$callback();
$debugger->stopTimer($timerId);
};
$container->measureTime('_services', 'Services', function () use ($container) {
$container->registerServices($container);
});
return $container;
}
/**
* Register all services
* Services are defined in the diMap. They can either only the class
* of a Service Provider or a pair of serviceKey => serviceClass that
* gets directly mapped into the container.
*
* @return void
*/
protected function registerServices()
{
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Grav.php
ob_end_flush();
@ob_flush();
flush();
}
}
// Run any time consuming tasks.
$this->fireEvent('onShutdown');
}
/**
* Magic Catch All Function
* Used to call closures like measureTime on the instance.
* Source: http://stackoverflow.com/questions/419804/closures-as-class-members
*/
public function __call($method, $args)
{
$closure = $this->$method;
call_user_func_array($closure, $args);
}
/**
* Initialize and return a Grav instance
*
* @param array $values
*
* @return static
*/
protected static function load(array $values)
{
$container = new static($values);
$container['grav'] = $container;
$container['debugger'] = new Debugger();
$debugger = $container['debugger'];
// closure that measures time by wrapping a function into startTimer and stopTimer
// The debugger can be passed to the closure. Should be more performant
Arguments
"render"
"Render"
Closure {
class: "Grav\Common\Grav"
this: Grav { …}
use: {
$processor: RenderProcessor {}
}
file: "/home2/egretozv/public_html/system/src/Grav/Common/Grav.php"
line: "121 to 123"
}
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Grav.php
ob_end_flush();
@ob_flush();
flush();
}
}
// Run any time consuming tasks.
$this->fireEvent('onShutdown');
}
/**
* Magic Catch All Function
* Used to call closures like measureTime on the instance.
* Source: http://stackoverflow.com/questions/419804/closures-as-class-members
*/
public function __call($method, $args)
{
$closure = $this->$method;
call_user_func_array($closure, $args);
}
/**
* Initialize and return a Grav instance
*
* @param array $values
*
* @return static
*/
protected static function load(array $values)
{
$container = new static($values);
$container['grav'] = $container;
$container['debugger'] = new Debugger();
$debugger = $container['debugger'];
// closure that measures time by wrapping a function into startTimer and stopTimer
// The debugger can be passed to the closure. Should be more performant
Arguments
Closure {
class: "Grav\Common\Grav"
parameters: {
$timerId: {}
$timerTitle: {}
$callback: {}
}
use: {
$debugger: Debugger {}
}
file: "/home2/egretozv/public_html/system/src/Grav/Common/Grav.php"
line: "357 to 361"
}
array:3 [
0 => "render"
1 => "Render"
2 => Closure {
class: "Grav\Common\Grav"
this: Grav { …}
use: {
$processor: RenderProcessor {}
}
file: "/home2/egretozv/public_html/system/src/Grav/Common/Grav.php"
line: "121 to 123"
}
]
/home2
/egretozv
/public_html
/system
/src
/Grav
/Common
/Grav.php
}
}
return self::$instance;
}
/**
* Process a request
*/
public function process()
{
/** @var Debugger $debugger */
$debugger = $this['debugger'];
// process all processors (e.g. config, initialize, assets, ..., render)
foreach ($this->processors as $processor) {
$processor = $this[$processor];
$this->measureTime($processor->id, $processor->title, function () use ($processor) {
$processor->process();
});
}
// Set the header type
$this->header();
echo $this->output;
$debugger->render();
$this->fireEvent('onOutputRendered');
register_shutdown_function([$this, 'shutdown']);
}
/**
* Set the system locale based on the language and configuration
*/
public function setLocale()
{
// Initialize Locale if set and configured.
if ($this['language']->enabled() && $this['config']->get('system.languages.override_locale')) {
Arguments
"measureTime"
array:3 [
0 => "render"
1 => "Render"
2 => Closure {
class: "Grav\Common\Grav"
this: Grav { …}
use: {
$processor: RenderProcessor {}
}
file: "/home2/egretozv/public_html/system/src/Grav/Common/Grav.php"
line: "121 to 123"
}
]
/home2
/egretozv
/public_html
/index.php
// Set timezone to default, falls back to system if php.ini not set
date_default_timezone_set(@date_default_timezone_get());
// Set internal encoding if mbstring loaded
if (!extension_loaded('mbstring')) {
die("'mbstring' extension is not loaded. This is required for Grav to run correctly");
}
mb_internal_encoding('UTF-8');
// Get the Grav instance
$grav = Grav::instance(
array(
'loader' => $loader
)
);
// Process the page
try {
$grav->process();
} catch (\Exception $e) {
$grav->fireEvent('onFatalException', new Event(['exception' => $e]));
throw $e;
}