/var
/www
/vhosts
/2dave.de
/2dave.de
/user
/plugins
/feed
/feed.php
'onCollectionProcessed' => ['onCollectionProcessed', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
}
/**
* Initialize feed configuration.
*/
public function onPageInitialized()
{
/** @var Page $page */
$page = $this->grav['page'];
if (isset($page->header()->feed)) {
$this->feed_config = array_merge($this->feed_config, $page->header()->feed);
}
// Overwrite regular content with feed config, so you can influence the collection processing with feed config
$page->header()->content = array_merge($page->header()->content, $this->feed_config);
}
/**
* Feed consists of all sub-pages.
*
* @param Event $event
*/
public function onCollectionProcessed(Event $event)
{
/** @var Collection $collection */
$collection = $event['collection'];
foreach ($collection as $slug => $page) {
$header = $page->header();
if (isset($header->feed) && !empty($header->feed['skip'])) {
$collection->remove($page);
}
}
}
Arguments
"array_merge(): Expected parameter 1 to be an array, null given"
/var
/www
/vhosts
/2dave.de
/2dave.de
/user
/plugins
/feed
/feed.php
'onCollectionProcessed' => ['onCollectionProcessed', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
]);
}
}
/**
* Initialize feed configuration.
*/
public function onPageInitialized()
{
/** @var Page $page */
$page = $this->grav['page'];
if (isset($page->header()->feed)) {
$this->feed_config = array_merge($this->feed_config, $page->header()->feed);
}
// Overwrite regular content with feed config, so you can influence the collection processing with feed config
$page->header()->content = array_merge($page->header()->content, $this->feed_config);
}
/**
* Feed consists of all sub-pages.
*
* @param Event $event
*/
public function onCollectionProcessed(Event $event)
{
/** @var Collection $collection */
$collection = $event['collection'];
foreach ($collection as $slug => $page) {
$header = $page->header();
if (isset($header->feed) && !empty($header->feed['skip'])) {
$collection->remove($page);
}
}
}
Arguments
null
array:5 [
"enabled" => true
"limit" => 10
"description" => "My Feed Description"
"lang" => "en-us"
"length" => 500
]
/var
/www
/vhosts
/2dave.de
/2dave.de
/vendor
/symfony
/event-dispatcher
/EventDispatcher.php
}
}
/**
* Triggers the listeners of an event.
*
* This method can be overridden to add functionality that is executed
* for each listener.
*
* @param callable[] $listeners The event listeners
* @param string $eventName The name of the event to dispatch
* @param Event $event The event object to pass to the event handlers/listeners
*/
protected function doDispatch($listeners, $eventName, Event $event)
{
foreach ($listeners as $listener) {
if ($event->isPropagationStopped()) {
break;
}
call_user_func($listener, $event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
*
* @param string $eventName The name of the event
*/
private function sortListeners($eventName)
{
krsort($this->listeners[$eventName]);
$this->sorted[$eventName] = call_user_func_array('array_merge', $this->listeners[$eventName]);
}
}
Arguments
Event {}
"onPageInitialized"
EventDispatcher {}
/var
/www
/vhosts
/2dave.de
/2dave.de
/vendor
/symfony
/event-dispatcher
/EventDispatcher.php
}
}
/**
* Triggers the listeners of an event.
*
* This method can be overridden to add functionality that is executed
* for each listener.
*
* @param callable[] $listeners The event listeners
* @param string $eventName The name of the event to dispatch
* @param Event $event The event object to pass to the event handlers/listeners
*/
protected function doDispatch($listeners, $eventName, Event $event)
{
foreach ($listeners as $listener) {
if ($event->isPropagationStopped()) {
break;
}
call_user_func($listener, $event, $eventName, $this);
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
*
* @param string $eventName The name of the event
*/
private function sortListeners($eventName)
{
krsort($this->listeners[$eventName]);
$this->sorted[$eventName] = call_user_func_array('array_merge', $this->listeners[$eventName]);
}
}
Arguments
array:2 [
0 => FeedPlugin {}
1 => "onPageInitialized"
]
Event {}
"onPageInitialized"
EventDispatcher {}
/var
/www
/vhosts
/2dave.de
/2dave.de
/vendor
/symfony
/event-dispatcher
/EventDispatcher.php
*/
class EventDispatcher implements EventDispatcherInterface
{
private $listeners = array();
private $sorted = array();
/**
* {@inheritdoc}
*/
public function dispatch($eventName, Event $event = null)
{
if (null === $event) {
$event = new Event();
}
$event->setDispatcher($this);
$event->setName($eventName);
if ($listeners = $this->getListeners($eventName)) {
$this->doDispatch($listeners, $eventName, $event);
}
return $event;
}
/**
* {@inheritdoc}
*/
public function getListeners($eventName = null)
{
if (null !== $eventName) {
if (!isset($this->listeners[$eventName])) {
return array();
}
if (!isset($this->sorted[$eventName])) {
$this->sortListeners($eventName);
}
return $this->sorted[$eventName];
Arguments
array:5 [
0 => array:2 [
0 => LoginPlugin {}
1 => "authorizePage"
]
1 => array:2 [
0 => HighlightPlugin {}
1 => "onPageInitialized"
]
2 => array:2 [
0 => FeedPlugin {}
1 => "onPageInitialized"
]
3 => array:2 [
0 => RelatedPagesPlugin {}
1 => "onPageInitialized"
]
4 => array:2 [
0 => PaginationPlugin {}
1 => "onPageInitialized"
]
]
"onPageInitialized"
Event {}
/var
/www
/vhosts
/2dave.de
/2dave.de
/vendor
/rockettheme
/toolbox
/Event
/src
/EventDispatcher.php
use Symfony\Component\EventDispatcher\Event as BaseEvent;
use Symfony\Component\EventDispatcher\EventDispatcher as BaseEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Implements Symfony EventDispatcher interface.
*
* @package RocketTheme\Toolbox\Event
* @author RocketTheme
* @license MIT
*/
class EventDispatcher extends BaseEventDispatcher implements EventDispatcherInterface
{
public function dispatch($eventName, BaseEvent $event = null)
{
if (null === $event) {
$event = new Event();
}
return parent::dispatch($eventName, $event);
}
}
Arguments
"onPageInitialized"
Event {}
/var
/www
/vhosts
/2dave.de
/2dave.de
/system
/src
/Grav
/Common
/Grav.php
// Vary: Accept-Encoding
if ($this['config']->get('system.pages.vary_accept_encoding', false)) {
header('Vary: Accept-Encoding');
}
}
/**
* Fires an event with optional parameters.
*
* @param string $eventName
* @param Event $event
*
* @return Event
*/
public function fireEvent($eventName, Event $event = null)
{
/** @var EventDispatcher $events */
$events = $this['events'];
return $events->dispatch($eventName, $event);
}
/**
* Set the final content length for the page and flush the buffer
*
*/
public function shutdown()
{
// Prevent user abort allowing onShutdown event to run without interruptions.
if (function_exists('ignore_user_abort')) {
@ignore_user_abort(true);
}
// Close the session allowing new requests to be handled.
if (isset($this['session'])) {
$this['session']->close();
}
if ($this['config']->get('system.debugger.shutdown.close_connection', true)) {
// Flush the response and close the connection to allow time consuming tasks to be performed without leaving
Arguments
"onPageInitialized"
Event {}
/var
/www
/vhosts
/2dave.de
/2dave.de
/system
/src
/Grav
/Common
/Processors
/PagesProcessor.php
*/
namespace Grav\Common\Processors;
use Grav\Common\Page\Page;
class PagesProcessor extends ProcessorBase implements ProcessorInterface
{
public $id = 'pages';
public $title = 'Pages';
public function process()
{
// Dump Cache state
$this->container['debugger']->addMessage($this->container['cache']->getCacheStatus());
$this->container['pages']->init();
$this->container->fireEvent('onPagesInitialized');
$this->container->fireEvent('onPageInitialized');
/** @var Page $page */
$page = $this->container['page'];
if (!$page->routable()) {
// If no page found, fire event
$event = $this->container->fireEvent('onPageNotFound');
if (isset($event->page)) {
unset ($this->container['page']);
$this->container['page'] = $event->page;
} else {
throw new \RuntimeException('Page Not Found', 404);
}
}
}
}
Arguments
/var
/www
/vhosts
/2dave.de
/2dave.de
/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.
/var
/www
/vhosts
/2dave.de
/2dave.de
/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()
{
/var
/www
/vhosts
/2dave.de
/2dave.de
/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
"pages"
"Pages"
Closure {
class: "Grav\Common\Grav"
this: Grav { …}
use: {
$processor: PagesProcessor {}
}
file: "/var/www/vhosts/2dave.de/2dave.de/system/src/Grav/Common/Grav.php"
line: "121 to 123"
}
/var
/www
/vhosts
/2dave.de
/2dave.de
/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: "/var/www/vhosts/2dave.de/2dave.de/system/src/Grav/Common/Grav.php"
line: "362 to 366"
}
array:3 [
0 => "pages"
1 => "Pages"
2 => Closure {
class: "Grav\Common\Grav"
this: Grav { …}
use: {
$processor: PagesProcessor {}
}
file: "/var/www/vhosts/2dave.de/2dave.de/system/src/Grav/Common/Grav.php"
line: "121 to 123"
}
]
/var
/www
/vhosts
/2dave.de
/2dave.de
/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 => "pages"
1 => "Pages"
2 => Closure {
class: "Grav\Common\Grav"
this: Grav { …}
use: {
$processor: PagesProcessor {}
}
file: "/var/www/vhosts/2dave.de/2dave.de/system/src/Grav/Common/Grav.php"
line: "121 to 123"
}
]
/var
/www
/vhosts
/2dave.de
/2dave.de
/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;
}