/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/user
/plugins
/shortcode-core
/classes
/ShortcodeManager.php
* returns the current event container object
*
* @return EventContainer
*/
public function getEvents()
{
return $this->events;
}
/**
* register an individual shortcode with the manager so it can be
* operated on by the Shortcode library
*
* @param string $name the name of the shortcode (should match the classname)
* @param string $directory directory where the shortcode is located
*/
public function registerShortcode($name, $directory)
{
$path = rtrim($directory, '/').'/'.$name;
require_once($path);
$name = "Grav\\Plugin\\Shortcodes\\" . basename($name, '.php');
if (class_exists($name)) {
$shortcode = new $name();
$shortcode->init();
}
}
/**
* register all files as shortcodes in a particular directory
* @param string $directory directory where the shortcodes are located
*/
public function registerAllShortcodes($directory)
{
try {
foreach (new \DirectoryIterator($directory) as $file) {
if ($file->isDot()) {
continue;
}
Arguments
"require_once(): RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream::stream_set_option is not implemented!"
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/user
/plugins
/shortcode-core
/classes
/ShortcodeManager.php
* returns the current event container object
*
* @return EventContainer
*/
public function getEvents()
{
return $this->events;
}
/**
* register an individual shortcode with the manager so it can be
* operated on by the Shortcode library
*
* @param string $name the name of the shortcode (should match the classname)
* @param string $directory directory where the shortcode is located
*/
public function registerShortcode($name, $directory)
{
$path = rtrim($directory, '/').'/'.$name;
require_once($path);
$name = "Grav\\Plugin\\Shortcodes\\" . basename($name, '.php');
if (class_exists($name)) {
$shortcode = new $name();
$shortcode->init();
}
}
/**
* register all files as shortcodes in a particular directory
* @param string $directory directory where the shortcodes are located
*/
public function registerAllShortcodes($directory)
{
try {
foreach (new \DirectoryIterator($directory) as $file) {
if ($file->isDot()) {
continue;
}
Arguments
"/mnt/web216/a1/46/534646/htdocs/vff/system/src/Grav/Common/Debugger.php"
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/user
/plugins
/shortcode-core
/classes
/ShortcodeManager.php
$name = "Grav\\Plugin\\Shortcodes\\" . basename($name, '.php');
if (class_exists($name)) {
$shortcode = new $name();
$shortcode->init();
}
}
/**
* register all files as shortcodes in a particular directory
* @param string $directory directory where the shortcodes are located
*/
public function registerAllShortcodes($directory)
{
try {
foreach (new \DirectoryIterator($directory) as $file) {
if ($file->isDot()) {
continue;
}
$this->registerShortcode($file->getFilename(), $directory);
}
} catch (\UnexpectedValueException $e) {
Grav::instance()['log']->error('ShortcodeCore Plugin: Directory not found => ' . $directory);
}
}
/**
* setup the markdown parser to handle shortcodes properly
*
* @param mixed $markdown the markdown parser object
*/
public function setupMarkdown($markdown)
{
$markdown->addBlockType('[', 'ShortCodes', true, false);
$markdown->blockShortCodes = function($Line) {
$valid_shortcodes = implode('|', $this->handlers->getNames());
$regex = '/^\[\/?(?:'.$valid_shortcodes.')[^\]]*\]$/';
if (preg_match($regex, $Line['body'], $matches)) {
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/user
/themes
/bootstrap4-open-matter
/bootstrap4-open-matter.php
// Boostrap plugin will look for this class var to know it should load
public $load_bootstrapper_plugin = true;
public static function getSubscribedEvents()
{
return [
'onThemeInitialized' => ['onThemeInitialized', 0],
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0]
];
}
public function onThemeInitialized()
{
$this->config->set('plugins.bootstrapper.version', 'v4');
}
public function onShortcodeHandlers()
{
$this->grav['shortcode']->registerAllShortcodes('theme://shortcodes');
}
public function onTwigSiteVariables()
{
if ($this->isAdmin() && ($this->grav['config']->get('plugins.shortcode-core.enabled'))) {
$this->grav['assets']->add('theme://editor-buttons/admin/js/shortcode-pdf.js');
$this->grav['assets']->add('theme://editor-buttons/admin/js/shortcode-h5p.js');
}
}
}
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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] = array();
foreach ($this->listeners[$eventName] as $priority => $listeners) {
foreach ($listeners as $k => $listener) {
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
$listener[0] = $listener[0]();
$this->listeners[$eventName][$priority][$k] = $listener;
}
$this->sorted[$eventName][] = $listener;
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/vendor
/symfony
/event-dispatcher
/EventDispatcher.php
* @author Jordi Boggiano <j.boggiano@seld.be>
* @author Jordan Alliot <jordan.alliot@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class EventDispatcher implements EventDispatcherInterface
{
private $listeners = array();
private $sorted = array();
/**
* {@inheritdoc}
*/
public function dispatch($eventName, Event $event = null)
{
if (null === $event) {
$event = new Event();
}
if ($listeners = $this->getListeners($eventName)) {
$this->doDispatch($listeners, $eventName, $event);
}
return $event;
}
/**
* {@inheritdoc}
*/
public function getListeners($eventName = null)
{
if (null !== $eventName) {
if (empty($this->listeners[$eventName])) {
return array();
}
if (!isset($this->sorted[$eventName])) {
$this->sortListeners($eventName);
}
return $this->sorted[$eventName];
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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);
}
}
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/user
/plugins
/shortcode-core
/shortcode-core.php
$this->enable([
'onThemeInitialized' => ['onThemeInitialized', 0],
'onMarkdownInitialized' => ['onMarkdownInitialized', 0],
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
'onPageContentProcessed' => ['onPageContentProcessed', 0],
'onPageInitialized' => ['onPageInitialized', 0],
'onTwigInitialized' => ['onTwigInitialized', 0],
'onTwigPageVariables' => ['onTwigPageVariables', 0],
'onTwigSiteVariables' => ['onTwigSiteVariables', 0],
]);
$this->grav['shortcode'] = $this->shortcodes = new ShortcodeManager();
}
/**
* Theme initialization is best place to fire onShortcodeHandler event
* in order to support both plugins and themes
*/
public function onThemeInitialized() {
$this->grav->fireEvent('onShortcodeHandlers');
}
/**
* Handle the markdown Initialized event by setting up shortcode block tags
*
* @param Event $event the event containing the markdown parser
*/
public function onMarkdownInitialized(Event $event)
{
$this->shortcodes->setupMarkdown($event['markdown']);
}
/**
* Process shortcodes after Grav's processing, but before caching
*
* @param Event $e
*/
public function onPageContentProcessed(Event $e)
{
/** @var Page $page */
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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] = array();
foreach ($this->listeners[$eventName] as $priority => $listeners) {
foreach ($listeners as $k => $listener) {
if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
$listener[0] = $listener[0]();
$this->listeners[$eventName][$priority][$k] = $listener;
}
$this->sorted[$eventName][] = $listener;
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/vendor
/symfony
/event-dispatcher
/EventDispatcher.php
* @author Jordi Boggiano <j.boggiano@seld.be>
* @author Jordan Alliot <jordan.alliot@gmail.com>
* @author Nicolas Grekas <p@tchwork.com>
*/
class EventDispatcher implements EventDispatcherInterface
{
private $listeners = array();
private $sorted = array();
/**
* {@inheritdoc}
*/
public function dispatch($eventName, Event $event = null)
{
if (null === $event) {
$event = new Event();
}
if ($listeners = $this->getListeners($eventName)) {
$this->doDispatch($listeners, $eventName, $event);
}
return $event;
}
/**
* {@inheritdoc}
*/
public function getListeners($eventName = null)
{
if (null !== $eventName) {
if (empty($this->listeners[$eventName])) {
return array();
}
if (!isset($this->sorted[$eventName])) {
$this->sortListeners($eventName);
}
return $this->sorted[$eventName];
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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);
}
}
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/system
/src
/Grav
/Common
/Themes.php
if ($this->inited === false) {
/** @var Themes $themes */
$themes = $this->grav['themes'];
try {
$instance = $themes->load();
} catch (\InvalidArgumentException $e) {
throw new \RuntimeException($this->current() . ' theme could not be found');
}
if ($instance instanceof EventSubscriberInterface) {
/** @var EventDispatcher $events */
$events = $this->grav['events'];
$events->addSubscriber($instance);
}
$this->grav['theme'] = $instance;
$this->grav->fireEvent('onThemeInitialized');
$this->inited = true;
}
}
/**
* Return list of all theme data with their blueprints.
*
* @return array
*/
public function all()
{
$list = [];
/** @var UniformResourceLocator $locator */
$locator = $this->grav['locator'];
$iterator = $locator->getIterator('themes://');
/** @var \DirectoryIterator $directory */
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/system
/src
/Grav
/Common
/Themes.php
* @param Grav $grav
*/
public function __construct(Grav $grav)
{
parent::__construct();
$this->grav = $grav;
$this->config = $grav['config'];
// Register instance as autoloader for theme inheritance
spl_autoload_register([$this, 'autoloadTheme']);
}
public function init()
{
/** @var Themes $themes */
$themes = $this->grav['themes'];
$themes->configure();
$this->initTheme();
}
public function initTheme()
{
if ($this->inited === false) {
/** @var Themes $themes */
$themes = $this->grav['themes'];
try {
$instance = $themes->load();
} catch (\InvalidArgumentException $e) {
throw new \RuntimeException($this->current() . ' theme could not be found');
}
if ($instance instanceof EventSubscriberInterface) {
/** @var EventDispatcher $events */
$events = $this->grav['events'];
$events->addSubscriber($instance);
}
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/system
/src
/Grav
/Common
/Processors
/ThemesProcessor.php
<?php
/**
* @package Grav.Common.Processors
*
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Processors;
class ThemesProcessor extends ProcessorBase implements ProcessorInterface
{
public $id = 'themes';
public $title = 'Themes';
public function process()
{
$this->container['themes']->init();
}
}
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/system
/src
/Grav
/Common
/Grav.php
} elseif ($values) {
$instance = self::$instance;
foreach ($values as $key => $value) {
$instance->offsetSet($key, $value);
}
}
return self::$instance;
}
/**
* Process a request
*/
public function process()
{
// 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();
});
}
/** @var Debugger $debugger */
$debugger = $this['debugger'];
$debugger->render();
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')) {
$language = $this['language']->getLanguage();
setlocale(LC_ALL, strlen($language) < 3 ? ($language . '_' . strtoupper($language)) : $language);
} elseif ($this['config']->get('system.default_locale')) {
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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()
{
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/system
/src
/Grav
/Common
/Grav.php
$instance = self::$instance;
foreach ($values as $key => $value) {
$instance->offsetSet($key, $value);
}
}
return self::$instance;
}
/**
* Process a request
*/
public function process()
{
// 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();
});
}
/** @var Debugger $debugger */
$debugger = $this['debugger'];
$debugger->render();
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')) {
$language = $this['language']->getLanguage();
setlocale(LC_ALL, strlen($language) < 3 ? ($language . '_' . strtoupper($language)) : $language);
} elseif ($this['config']->get('system.default_locale')) {
setlocale(LC_ALL, $this['config']->get('system.default_locale'));
/mnt
/web216
/a1
/46
/534646
/htdocs
/vff
/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(array('exception' => $e)));
throw $e;
}