$languages = Config::get('languages');
?>
<!DOCTYPE html>
<html lang="<?= $language; ?>">
<head>
<meta charset="utf-8">
<title><?= $title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="<?= $metaDescription; ?>">
<meta name="keywords" content="<?= $metaKeywords; ?>">
<?php
echo isset($meta) ? $meta : ''; // Place to pass data / plugable hook zone
?>
<!-- ==============================================
Favicons
=============================================== -->
<link rel="icon" type="image/png" href="<?php echo Url::templatePath(); ?>images/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="<?php echo Url::templatePath(); ?>images/favicon-16x16.png" sizes="16x16" />
<?php
$languages = Config::get('languages');
?>
<!DOCTYPE html>
<html lang="<?= $language; ?>">
<head>
<meta charset="utf-8">
<title><?= $title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="<?= $metaDescription; ?>">
<meta name="keywords" content="<?= $metaKeywords; ?>">
<?php
echo isset($meta) ? $meta : ''; // Place to pass data / plugable hook zone
?>
<!-- ==============================================
Favicons
=============================================== -->
<link rel="icon" type="image/png" href="<?php echo Url::templatePath(); ?>images/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="<?php echo Url::templatePath(); ?>images/favicon-16x16.png" sizes="16x16" />
<?php
${$__variable} = $__value;
}
unset($__variable, $__value);
// We'll evaluate the contents of the view inside a try/catch block so we can
// flush out any stray output that might get out before an error occurs or
// an exception is thrown. This prevents any partial views from leaking.
try {
include $__path;
} catch (\Exception $e) {
$this->handleViewException($e);
}
return ltrim(ob_get_clean());
}
/**
* Handle a View Exception.
*
/**
* Get the evaluated contents of the View.
*
* @param string $path
* @param array $data
* @return string
*/
public function get($path, array $data = array())
{
return $this->evaluatePath($path, $data);
}
/**
* Get the evaluated contents of the View at the given path.
*
* @param string $__path
* @param array $__data
* @return string
*/
protected function evaluatePath($__path, $__data)
}
/**
* Render the View and return the result.
*
* @return string
*/
public function renderContents()
{
return $this->engine->get($this->path, $this->gatherData());
}
/**
* Return all variables stored on local and shared data.
*
* @return array
*/
public function gatherData()
{
$data = array_merge($this->factory->getShared(), $this->data);
/**
* Get the string contents of the View.
*
* @param \Closure $callback
* @return string
*/
public function render(Closure $callback = null)
{
$contents = $this->renderContents();
$response = isset($callback) ? $callback($this, $contents) : null;
return $response ?: $contents;
}
/**
* Render the View and return the result.
*
* @return string
$this->headers->set('Content-Type', 'application/json');
$content = $this->morphToJson($content);
}
// If this content implements the "RenderableInterface", then we will call the
// render method on the object so we will avoid any "__toString" exceptions
// that might be thrown and have their errors obscured by PHP's handling.
else if ($content instanceof RenderableInterface) {
$content = $content->render();
}
return parent::setContent($content);
}
/**
* Morph the given content into JSON.
*
* @param mixed $content
* @return string
* @param mixed $content The response content, see setContent()
* @param int $status The response status code
* @param array $headers An array of response headers
*
* @throws \InvalidArgumentException When the HTTP status code is not valid
*/
public function __construct($content = '', $status = 200, $headers = array())
{
$this->headers = new ResponseHeaderBag($headers);
$this->setContent($content);
$this->setStatusCode($status);
$this->setProtocolVersion('1.0');
}
/**
* Factory method for chainability.
*
* Example:
*
* return Response::create($body, 200)
* Return a new Response from the application.
*
* @param string $content
* @param int $status
* @param array $headers
* @return \Http\Response
*/
public static function make($content = '', $status = 200, array $headers = array())
{
return new HttpResponse($content, $status, $headers);
}
/**
* Return a new View Response from the application.
*
* @param string $view
* @param array $data
* @param int $status
* @param array $headers
* @return \Http\Response
* @param array $data
* @return Response
*/
public static function error($status, array $data = array(), $headers = array())
{
$view = Template::make('default')
->shares('title', 'Error ' .$status)
->nest('content', 'Error/' .$status, $data);
return static::make($view, $status, $headers);
}
/**
* Register a macro with the Response class.
*
* @param string $name
* @param callable $callback
* @return void
*/
public static function macro($name, $callback)
});
// Referer checking Filter.
Route::filter('referer', function($route, $request) {
// Check if the visitor come to this Route from another site.
$referer = $request->header('referer');
if(! str_starts_with($referer, Config::get('app.url'))) {
// When Referrer is invalid, respond with Error 400 Page (Bad Request)
return Response::error(400);
}
});
// Authentication Filters.
Route::filter('auth', function($route, $request) {
if (! Auth::check()) {
// User is not logged in, redirect him to Login Page.
return Redirect::to('login');
}
});
{
$responses = array();
//
if (! is_array($payload)) $payload = array($payload);
$this->firing[] = $event;
foreach ($this->getListeners($event) as $listener) {
$response = call_user_func_array($listener, $payload);
if (! is_null($response) && $halt) {
array_pop($this->firing);
return $response;
}
if ($response === false) break;
$responses[] = $response;
{
$responses = array();
//
if (! is_array($payload)) $payload = array($payload);
$this->firing[] = $event;
foreach ($this->getListeners($event) as $listener) {
$response = call_user_func_array($listener, $payload);
if (! is_null($response) && $halt) {
array_pop($this->firing);
return $response;
}
if ($response === false) break;
$responses[] = $response;
/**
* Fire an event until the first non-null response is returned.
*
* @param string $event
* @param array $payload
* @return mixed
*/
public function until($event, $payload = array())
{
return $this->fire($event, $payload, true);
}
/**
* Flush a set of queued events.
*
* @param string $event
* @return void
*/
public function flush($event)
{
* @param \Http\Request $request
* @return mixed
*/
public function callRouteFilter($filter, $parameters, $route, $request, $response = null)
{
if (! $this->filtering) return null;
$data = array_merge(array($route, $request, $response), $parameters);
return $this->events->until('router.filter: '.$filter, $this->cleanFilterParameters($data));
}
/**
* Clean the parameters being passed to a filter callback.
*
* @param array $parameters
* @return array
*/
protected function cleanFilterParameters(array $parameters)
{
* Call the given route's before filters.
*
* @param \Routing\Route $route
* @param \Http\Request $request
* @return mixed
*/
public function callRouteBefore($route, $request)
{
foreach ($route->beforeFilters() as $filter => $parameters) {
$response = $this->callRouteFilter($filter, $parameters, $route, $request);
if (! is_null($response)) return $response;
}
}
/**
* Call the given route's before filters.
*
* @param \Routing\Route $route
* @param \Http\Request $request
*/
public function dispatchToRoute(Request $request)
{
// Execute the Routes matching.
$route = $this->findRoute($request);
$this->events->fire('router.matched', array($route, $request));
// Call the Route's Before Filters.
$response = $this->callRouteBefore($route, $request);
if (is_null($response)) {
// Run the Route Callback.
$response = $route->run();
}
// Prepare the Reesponse.
$response = $this->prepareResponse($request, $response);
// Call the Route's After Filters.
if (! is_null($response)) {
return $this->prepareResponse($request, $response);
}
// Request Dispatching to Routes.
$response = $this->callFilter('before', $request);
if (is_null($response)) {
$response = $this->dispatchToRoute($request);
}
$response = $this->prepareResponse($request, $response);
$this->callFilter('after', $request, $response);
return $response;
}
/**
$response = $this['events']->until('nova.app.down');
if (! is_null($response)) return $this->prepareResponse($response, $request);
}
if ($this->runningUnitTests() && ! $this['session']->isStarted()) {
$this['session']->start();
}
return $this['router']->dispatch($this->prepareRequest($request));
}
/**
* Call the "finish" and "shutdown" callbacks assigned to the application.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param \Symfony\Component\HttpFoundation\Response $response
* @return void
*/
public function terminate(SymfonyRequest $request, SymfonyResponse $response)
* @throws \Exception
*/
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
try {
$this->refreshRequest($request = Request::createFromBase($request));
$this->boot();
return $this->dispatch($request);
}
catch (\Exception $e) {
if (! $catch || $this->runningUnitTests()) throw $e;
return $this['exception']->handleException($e);
}
}
/**
* Handle the given request and get the response.
* @implements HttpKernelInterface::handle
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param int $type
* @param bool $catch
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$response = $this->app->handle($request, $type, $catch);
// Minify the Response's Content.
$this->processContent($response);
return $response;
}
/**
* Minify the Response instance Content.
*
// If a session driver has been configured, we will need to start the session here
// so that the data is ready for an application. Note that the Laravel sessions
// do not make use of PHP "native" sessions in any way since they are crappy.
if ($this->sessionConfigured()) {
$session = $this->startSession($request);
$request->setSession($session);
}
$response = $this->app->handle($request, $type, $catch);
// Again, if the session has been configured we will need to close out the session
// so that the attributes may be persisted to some storage medium. We will also
// add the session identifier cookie to the application response headers now.
if ($this->sessionConfigured()) {
$this->closeSession($session);
$this->addCookieToResponse($response, $session);
}
* @implements HttpKernelInterface::handle
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param int $type
* @param bool $catch
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$response = $this->app->handle($request, $type, $catch);
foreach ($this->cookies->getQueuedCookies() as $cookie) {
$response->headers->setCookie($cookie);
}
return $response;
}
}
* @implements HttpKernelInterface::handle
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param int $type
* @param bool $catch
* @return \Symfony\Component\HttpFoundation\Response
*/
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$response = $this->app->handle($this->decrypt($request), $type, $catch);
return $this->encrypt($response);
}
/**
* Decrypt the cookies on the request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Request
*/
public function __construct(HttpKernelInterface $app, array $middlewares)
{
$this->app = $app;
$this->middlewares = $middlewares;
}
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
return $this->app->handle($request, $type, $catch);
}
public function terminate(Request $request, Response $response)
{
$prevKernel = null;
foreach ($this->middlewares as $kernel) {
// if prev kernel was terminable we can assume this middleware has already been called
if (!$prevKernel instanceof TerminableInterface && $kernel instanceof TerminableInterface) {
$kernel->terminate($request, $response);
}
* Run the application and send the response.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return void
*/
public function run(SymfonyRequest $request = null)
{
$request = $request ?: $this['request'];
$response = with($stack = $this->getStackedClient())->handle($request);
$response->send();
$stack->terminate($request, $response);
}
/**
* Get the stacked HTTP kernel for the application.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
if (is_readable($path)) require $path;
});
//--------------------------------------------------------------------------
// Execute The Application
//--------------------------------------------------------------------------
$app->run();
/** Composer installation check. */
if (! file_exists(ROOTDIR .'vendor/autoload.php')) {
echo "<h1>Please install via composer.json</h1>";
echo "<p>Install Composer instructions: <a href='https://getcomposer.org/doc/00-intro.md#globally'>https://getcomposer.org/doc/00-intro.md#globally</a></p>";
echo "<p>Once composer is installed, navigate to the working directory in your terminal/command prompt and enter 'composer install'</p>";
exit;
}
/** Boot the Application. */
require APPDIR .'Boot' .DS .'Start.php';