/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
/**
* @param array $items
* @param array $path
* @return string
*/
protected function deepInit(array &$items, $path = [])
{
$ordering = '';
$order = [];
$field = end($path) === 'fields';
foreach ($items as $key => &$item) {
// Set name for nested field.
if ($field && isset($item['type'])) {
$item['name'] = $key;
}
// Handle special instructions in the form.
if (!empty($key) && ($key[0] === '@' || $key[strlen($key) - 1] === '@')) {
$list = explode('-', trim($key, '@'), 2);
$action = array_shift($list);
$property = array_shift($list);
switch ($action) {
case 'unset':
unset($items[$key]);
if (empty($items)) {
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
Arguments
"Trying to access array offset on value of type int"
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
/**
* @param array $items
* @param array $path
* @return string
*/
protected function deepInit(array &$items, $path = [])
{
$ordering = '';
$order = [];
$field = end($path) === 'fields';
foreach ($items as $key => &$item) {
// Set name for nested field.
if ($field && isset($item['type'])) {
$item['name'] = $key;
}
// Handle special instructions in the form.
if (!empty($key) && ($key[0] === '@' || $key[strlen($key) - 1] === '@')) {
$list = explode('-', trim($key, '@'), 2);
$action = array_shift($list);
$property = array_shift($list);
switch ($action) {
case 'unset':
unset($items[$key]);
if (empty($items)) {
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
$this->dynamic[implode('/', $path)][$property] = ['action' => $action, 'params' => $item];
}
} elseif (is_array($item)) {
// Recursively initialize form.
$newPath = array_merge($path, [$key]);
$location = $this->deepInit($item, $newPath);
if ($location) {
$order[$key] = $location;
} elseif ($location === null) {
unset($items[$key]);
}
}
}
if ($order) {
// Reorder fields if needed.
$items = $this->doReorder($items, $order);
}
return $ordering;
}
/**
* @param array|string $value
* @param array $path
*/
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
$this->dynamic[implode('/', $path)][$property] = ['action' => $action, 'params' => $item];
}
} elseif (is_array($item)) {
// Recursively initialize form.
$newPath = array_merge($path, [$key]);
$location = $this->deepInit($item, $newPath);
if ($location) {
$order[$key] = $location;
} elseif ($location === null) {
unset($items[$key]);
}
}
}
if ($order) {
// Reorder fields if needed.
$items = $this->doReorder($items, $order);
}
return $ordering;
}
/**
* @param array|string $value
* @param array $path
*/
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
$this->dynamic[implode('/', $path)][$property] = ['action' => $action, 'params' => $item];
}
} elseif (is_array($item)) {
// Recursively initialize form.
$newPath = array_merge($path, [$key]);
$location = $this->deepInit($item, $newPath);
if ($location) {
$order[$key] = $location;
} elseif ($location === null) {
unset($items[$key]);
}
}
}
if ($order) {
// Reorder fields if needed.
$items = $this->doReorder($items, $order);
}
return $ordering;
}
/**
* @param array|string $value
* @param array $path
*/
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
$this->dynamic[implode('/', $path)][$property] = ['action' => $action, 'params' => $item];
}
} elseif (is_array($item)) {
// Recursively initialize form.
$newPath = array_merge($path, [$key]);
$location = $this->deepInit($item, $newPath);
if ($location) {
$order[$key] = $location;
} elseif ($location === null) {
unset($items[$key]);
}
}
}
if ($order) {
// Reorder fields if needed.
$items = $this->doReorder($items, $order);
}
return $ordering;
}
/**
* @param array|string $value
* @param array $path
*/
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
return null;
}
break;
case 'import':
$this->doImport($item, $path);
unset($items[$key]);
break;
case 'ordering':
$ordering = $item;
unset($items[$key]);
break;
default:
$this->dynamic[implode('/', $path)][$property] = ['action' => $action, 'params' => $item];
}
} elseif (is_array($item)) {
// Recursively initialize form.
$newPath = array_merge($path, [$key]);
$location = $this->deepInit($item, $newPath);
if ($location) {
$order[$key] = $location;
} elseif ($location === null) {
unset($items[$key]);
}
}
}
if ($order) {
// Reorder fields if needed.
$items = $this->doReorder($items, $order);
}
return $ordering;
}
/**
* @param array|string $value
* @param array $path
*/
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/vendor
/rockettheme
/toolbox
/Blueprints
/src
/BlueprintForm.php
*/
public function load()
{
// Only load and extend blueprint if it has not yet been loaded.
if (empty($this->items) && $this->filename) {
// Get list of files.
$files = $this->getFiles($this->filename);
// Load and extend blueprints.
$data = $this->doLoad($files);
$this->items = (array) array_shift($data);
foreach ($data as $content) {
$this->extend($content, true);
}
}
// Import blueprints.
$this->deepInit($this->items);
return $this;
}
/**
* Initialize blueprints with its dynamic fields.
*
* @return $this
*/
public function init()
{
foreach ($this->dynamic as $key => $data) {
// Locate field.
$path = explode('/', $key);
$current = &$this->items;
foreach ($path as $field) {
if (is_object($current)) {
// Handle objects.
if (!isset($current->{$field})) {
$current->{$field} = array();
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/user
/plugins
/form
/classes
/Form.php
/**
* Reset data.
*/
public function reset()
{
$name = $this->items['name'];
$grav = Grav::instance();
// Fix naming for fields (supports nested fields now!)
if (isset($this->items['fields'])) {
$this->items['fields'] = $this->processFields($this->items['fields']);
}
$items = $this->items;
$rules = $this->rules;
$blueprint = function() use ($name, $items, $rules) {
$blueprint = new Blueprint($name, ['form' => $items, 'rules' => $rules]);
return $blueprint->load()->init();
};
$this->data = new Data($this->header_data, $blueprint);
$this->values = new Data();
// Reset fields to null before calling fields() -- Do not remove:
$this->fields = null;
$this->fields = $this->fields();
// Fire event
$grav->fireEvent('onFormInitialized', new Event(['form' => $this]));
}
protected function processFields($fields)
{
$types = Grav::instance()['plugins']->formFieldTypes;
$return = array();
foreach ($fields as $key => $value) {
// default to text if not set
if (!isset($value['type'])) {
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Data
/Data.php
* @return array
*/
public function extra()
{
return $this->blueprints()->extra($this->items);
}
/**
* Return blueprints.
*
* @return Blueprint
*/
public function blueprints()
{
if (!$this->blueprints){
$this->blueprints = new Blueprint;
} elseif (is_callable($this->blueprints)) {
// Lazy load blueprints.
$blueprints = $this->blueprints;
$this->blueprints = $blueprints();
}
return $this->blueprints;
}
/**
* Save data if storage has been defined.
*/
public function save()
{
$file = $this->file();
if ($file) {
$file->save($this->items);
}
}
/**
* Returns whether the data already exists in the storage.
*
* NOTE: This method does not check if the data is current.
*
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/user
/plugins
/form
/classes
/Form.php
$value += $types[$value['type']];
}
// Fix numeric indexes
if (is_numeric($key) && isset($value['name'])) {
$key = $value['name'];
}
if (isset($value['fields']) && is_array($value['fields'])) {
$value['fields'] = $this->processFields($value['fields']);
}
$return[$key] = $value;
}
return $return;
}
public function fields()
{
if (null === $this->fields) {
$blueprint = $this->data->blueprints();
if (method_exists($blueprint, 'load')) {
// init the form to process directives
$blueprint->load()->init();
// fields set to processed blueprint fields
$this->fields = $blueprint->fields();
}
}
return $this->fields;
}
/**
* Return page object for the form.
*
* @return Page
*/
public function page()
{
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/user
/plugins
/form
/classes
/Form.php
$grav = Grav::instance();
// Fix naming for fields (supports nested fields now!)
if (isset($this->items['fields'])) {
$this->items['fields'] = $this->processFields($this->items['fields']);
}
$items = $this->items;
$rules = $this->rules;
$blueprint = function() use ($name, $items, $rules) {
$blueprint = new Blueprint($name, ['form' => $items, 'rules' => $rules]);
return $blueprint->load()->init();
};
$this->data = new Data($this->header_data, $blueprint);
$this->values = new Data();
// Reset fields to null before calling fields() -- Do not remove:
$this->fields = null;
$this->fields = $this->fields();
// Fire event
$grav->fireEvent('onFormInitialized', new Event(['form' => $this]));
}
protected function processFields($fields)
{
$types = Grav::instance()['plugins']->formFieldTypes;
$return = array();
foreach ($fields as $key => $value) {
// default to text if not set
if (!isset($value['type'])) {
$value['type'] = 'text';
}
// manually merging the field types
if ($types !== null && array_key_exists($value['type'], $types)) {
$value += $types[$value['type']];
}
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/user
/plugins
/form
/classes
/Form.php
// Add form specific rules.
if (!empty($this->items['rules']) && is_array($this->items['rules'])) {
$this->rules += $this->items['rules'];
}
// Set form name if not set.
if ($name && !is_int($name)) {
$this->items['name'] = $name;
} elseif (empty($this->items['name'])) {
$this->items['name'] = $page->slug();
}
// Set form id if not set.
if (empty($this->items['id'])) {
$inflector = new Inflector();
$this->items['id'] = $inflector->hyphenize($this->items['name']);
}
// Reset and initialize the form
$this->reset();
}
/**
* Custom serializer for this complex object
*
* @return string
*/
public function serialize()
{
$data = [
'items' => $this->items,
'message' => $this->message,
'status' => $this->status,
'header_data' => $this->header_data,
'rules' => $this->rules,
'data' => $this->data->toArray(),
'values' => $this->values->toArray(),
'page' => $this->page
];
return serialize($data);
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/user
/plugins
/form
/form.php
if ((isset($header->forms) && is_array($header->forms)) ||
(isset($header->form) && is_array($header->form))) {
$page_forms = [];
// Force never_cache_twig if modular form
if ($page->modular()) {
$header->never_cache_twig = true;
}
// Get the forms from the page headers
if (isset($header->forms)) {
$page_forms = $header->forms;
} elseif (isset($header->form)) {
$page_forms[] = $header->form;
}
// Store the page forms in the forms instance
foreach ($page_forms as $name => $page_form) {
$form = new Form($page, $name, $page_form);
$this->addForm($page_route, $form);
}
}
}
/**
* Initialize all the forms
*/
public function onPagesInitialized()
{
$this->loadCachedForms();
}
/**
* Catches form processing if user posts the form.
*/
public function onPageInitialized()
{
$submitted = false;
$this->json_response = [];
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/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]);
}
}
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/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]);
}
}
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/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];
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Page
/Pages.php
if ($found->isDir()) {
continue;
}
$regex = '/^[^\.]*' . preg_quote($extension, '/') . '$/';
if (preg_match($regex, $found->getFilename())) {
$page_found = $found;
$page_extension = $extension;
break 2;
}
}
}
}
if ($parent && !empty($page_found)) {
$page->init($page_found, $page_extension);
$content_exists = true;
if ($config->get('system.pages.events.page')) {
$this->grav->fireEvent('onPageProcessed', new Event(['page' => $page]));
}
}
// set current modified of page
$last_modified = $page->modified();
$iterator = new \FilesystemIterator($directory);
/** @var \DirectoryIterator $file */
foreach ($iterator as $file) {
$name = $file->getFilename();
// Ignore all hidden files if set.
if ($this->ignore_hidden && $name && $name[0] === '.') {
continue;
}
if ($file->isFile()) {
// Update the last modified if it's newer than already found
if (!in_array($file->getBasename(), $this->ignore_files) && ($modified = $file->getMTime()) > $last_modified) {
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Page
/Pages.php
}
if ($file->isFile()) {
// Update the last modified if it's newer than already found
if (!in_array($file->getBasename(), $this->ignore_files) && ($modified = $file->getMTime()) > $last_modified) {
$last_modified = $modified;
}
} elseif ($file->isDir() && !in_array($file->getFilename(), $this->ignore_folders)) {
// if folder contains separator, continue
if (Utils::contains($file->getFilename(), $config->get('system.param_sep', ':'))) {
continue;
}
if (!$page->path()) {
$page->path($file->getPath());
}
$path = $directory . DS . $name;
$child = $this->recurse($path, $page);
if (Utils::startsWith($name, '_')) {
$child->routable(false);
}
$this->children[$page->path()][$child->path()] = ['slug' => $child->slug()];
if ($config->get('system.pages.events.page')) {
$this->grav->fireEvent('onFolderProcessed', new Event(['page' => $page]));
}
}
}
// Set routability to false if no page found
if (!$content_exists) {
$page->routable(false);
}
// Override the modified time if modular
if ($page->template() === 'modular') {
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Page
/Pages.php
} else {
// If pages was found in cache, set the taxonomy
$this->grav['debugger']->addMessage('Page cache hit.');
$taxonomy->taxonomy($taxonomy_map);
}
} else {
$this->recurse($pages_dir);
$this->buildRoutes();
}
}
/**
* Accessible method to manually reset the pages cache
*
* @param $pages_dir
*/
public function resetPages($pages_dir)
{
$this->recurse($pages_dir);
$this->buildRoutes();
// cache if needed
if ($this->grav['config']->get('system.cache.enabled')) {
/** @var Cache $cache */
$cache = $this->grav['cache'];
/** @var Taxonomy $taxonomy */
$taxonomy = $this->grav['taxonomy'];
// save pages, routes, taxonomy, and sort to cache
$cache->save($this->pages_cache_id, [$this->instances, $this->routes, $this->children, $taxonomy->taxonomy(), $this->sort]);
}
}
/**
* Recursive function to load & build page relationships.
*
* @param string $directory
* @param Page|null $parent
*
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Page
/Pages.php
$hash = 0;
break;
case 'folder':
$hash = Folder::lastModifiedFolder($pages_dir);
break;
case 'hash':
$hash = Folder::hashAllFiles($pages_dir);
break;
default:
$hash = Folder::lastModifiedFile($pages_dir);
}
$this->pages_cache_id = md5($pages_dir . $hash . $language->getActive() . $config->checksum());
list($this->instances, $this->routes, $this->children, $taxonomy_map, $this->sort) = $cache->fetch($this->pages_cache_id);
if (!$this->instances) {
$this->grav['debugger']->addMessage('Page cache missed, rebuilding pages..');
// recurse pages and cache result
$this->resetPages($pages_dir, $this->pages_cache_id);
} else {
// If pages was found in cache, set the taxonomy
$this->grav['debugger']->addMessage('Page cache hit.');
$taxonomy->taxonomy($taxonomy_map);
}
} else {
$this->recurse($pages_dir);
$this->buildRoutes();
}
}
/**
* Accessible method to manually reset the pages cache
*
* @param $pages_dir
*/
public function resetPages($pages_dir)
{
$this->recurse($pages_dir);
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Page
/Pages.php
}
return $this->baseUrl($lang, $absolute) . Uri::filterPath($route);
}
/**
* Class initialization. Must be called before using this class.
*/
public function init()
{
$config = $this->grav['config'];
$this->ignore_files = $config->get('system.pages.ignore_files');
$this->ignore_folders = $config->get('system.pages.ignore_folders');
$this->ignore_hidden = $config->get('system.pages.ignore_hidden');
$this->instances = [];
$this->children = [];
$this->routes = [];
$this->buildPages();
}
/**
* Get or set last modification time.
*
* @param int $modified
*
* @return int|null
*/
public function lastModified($modified = null)
{
if ($modified && $modified > $this->last_modified) {
$this->last_modified = $modified;
}
return $this->last_modified;
}
/**
* Returns a list of all pages.
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/system
/src
/Grav
/Common
/Processors
/PagesProcessor.php
* @copyright Copyright (C) 2014 - 2017 RocketTheme, LLC. All rights reserved.
* @license MIT License; see LICENSE file for details.
*/
namespace Grav\Common\Processors;
use Grav\Common\Page\Page;
use RocketTheme\Toolbox\Event\Event;
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', new Event(['pages' => $this->container['pages']]));
$this->container->fireEvent('onPageInitialized', new Event(['page' => $this->container['page']]));
/** @var Page $page */
$page = $this->container['page'];
if (!$page->routable()) {
// If no page found, fire event
$event = $this->container->fireEvent('onPageNotFound', new Event(['page' => $page]));
if (isset($event->page)) {
unset ($this->container['page']);
$this->container['page'] = $event->page;
} else {
throw new \RuntimeException('Page Not Found', 404);
}
}
}
}
/mnt
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/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
/efs
/www
/fintech-business-awards
/httpdocs
/index.php
$grav = Grav::instance(
array(
'loader' => $loader
)
);
// if(preg_match('/\/fintech-business-awards.*/', $_SERVER['REQUEST_URI']) && !preg_match('/.*\/fintech-business-awards-2020/', $_SERVER['REQUEST_URI']) && !preg_match('/.*\/awards\/highlights/', $_SERVER['REQUEST_URI']) && !preg_match('/.*\/register-your-interest/', $_SERVER['REQUEST_URI']) && !preg_match('/.*\/partners/', $_SERVER['REQUEST_URI']))
// {
// header('Status: 301 Moved Permanently');
// header('Location:https://www.fintechbusiness.com/fintech-business-awards/fintech-business-awards-2020');
// exit;
// }
// Process the page
try {
$grav->process();
} catch (\Exception $e) {
$grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
throw $e;
}