if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.30',
'unifunc' => 'content_5d0820f7b28921_64699343',
'has_nocache_code' => false,
'file_dependency' =>
array (
'02e15049d4b316a1d6b82185c1cd57b6a27855ba' =>
array (
0 => '/var/www/Boxgroove/Production/app/views/pages/club/reviews/index.tpl',
1 => 1560623179,
2 => 'file',
),
),
'includes' =>
array (
'file:pages/club/reviews/modules/review_form.tpl' => 1,
),
),false)) {
function content_5d0820f7b28921_64699343 (Smarty_Internal_Template $_smarty_tpl) {
if ((count($_smarty_tpl->tpl_vars['playedBookings']->value) > 0 || $_smarty_tpl->tpl_vars['isMember']->value == true) && $_smarty_tpl->tpl_vars['hasUserReviewedClub']->value == false) {?>
<?php $_smarty_tpl->_subTemplateRender("file:pages/club/reviews/modules/review_form.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('isMember'=>$_smarty_tpl->tpl_vars['isMember']->value), 0, false);
?>
<?php } else { ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.0.1/jquery.rateyo.min.css">
<?php echo '<script'; ?>
src="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.0.1/jquery.rateyo.min.js"><?php echo '</script'; ?>
>
<?php }?>
<div class="row large-margin-top">
<div class="small-12 columns">
<div class="alert-box info">
All reviews for <?php echo $_smarty_tpl->tpl_vars['club']->value->getName();?>
have been written by verified members of the club, or people who have used Boxgroove.com to play a round at <?php echo $_smarty_tpl->tpl_vars['club']->value->getName();?>
.
</div>
</div>
<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['reviews']->value, 'review');
if ($_from !== null) {
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
'version' => '3.1.30',
'unifunc' => 'content_5d0820f7b28921_64699343',
'has_nocache_code' => false,
'file_dependency' =>
array (
'02e15049d4b316a1d6b82185c1cd57b6a27855ba' =>
array (
0 => '/var/www/Boxgroove/Production/app/views/pages/club/reviews/index.tpl',
1 => 1560623179,
2 => 'file',
),
),
'includes' =>
array (
'file:pages/club/reviews/modules/review_form.tpl' => 1,
),
),false)) {
function content_5d0820f7b28921_64699343 (Smarty_Internal_Template $_smarty_tpl) {
if ((count($_smarty_tpl->tpl_vars['playedBookings']->value) > 0 || $_smarty_tpl->tpl_vars['isMember']->value == true) && $_smarty_tpl->tpl_vars['hasUserReviewedClub']->value == false) {?>
<?php $_smarty_tpl->_subTemplateRender("file:pages/club/reviews/modules/review_form.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('isMember'=>$_smarty_tpl->tpl_vars['isMember']->value), 0, false);
?>
<?php } else { ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.0.1/jquery.rateyo.min.css">
<?php echo '<script'; ?>
src="https://cdnjs.cloudflare.com/ajax/libs/rateYo/2.0.1/jquery.rateyo.min.js"><?php echo '</script'; ?>
>
<?php }?>
<div class="row large-margin-top">
<div class="small-12 columns">
<div class="alert-box info">
All reviews for <?php echo $_smarty_tpl->tpl_vars['club']->value->getName();?>
have been written by verified members of the club, or people who have used Boxgroove.com to play a round at <?php echo $_smarty_tpl->tpl_vars['club']->value->getName();?>
.
</div>
</div>
<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['reviews']->value, 'review');
if ($_from !== null) {
* @throws \Exception
*/
public function getRenderedTemplateCode(Smarty_Internal_Template $_template, $unifunc = null)
{
$smarty = &$_template->smarty;
$_template->isRenderingCache = $this->isCache;
$level = ob_get_level();
try {
if (!isset($unifunc)) {
$unifunc = $this->unifunc;
}
if (empty($unifunc) || !function_exists($unifunc)) {
throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");
}
if ($_template->startRenderCallbacks) {
foreach ($_template->startRenderCallbacks as $callback) {
call_user_func($callback, $_template);
}
}
$unifunc($_template);
foreach ($_template->endRenderCallbacks as $callback) {
call_user_func($callback, $_template);
}
$_template->isRenderingCache = false;
}
catch (Exception $e) {
$_template->isRenderingCache = false;
while (ob_get_level() > $level) {
ob_end_clean();
}
if (isset($smarty->security_policy)) {
$smarty->security_policy->endTemplate();
}
throw $e;
}
}
/**
* Get compiled time stamp
*
$type = $_template->source->isConfig ? 'config' : 'template';
throw new SmartyException("Unable to load {$type} '{$_template->source->type}:{$_template->source->name}'");
}
if ($_template->smarty->debugging) {
if (!isset($_template->smarty->_debug)) {
$_template->smarty->_debug = new Smarty_Internal_Debug();
}
$_template->smarty->_debug->start_render($_template);
}
if (!$this->processed) {
$this->process($_template);
}
if (isset($_template->cached)) {
$_template->cached->file_dependency =
array_merge($_template->cached->file_dependency, $this->file_dependency);
}
if ($_template->source->handler->uncompiled) {
$_template->source->handler->renderUncompiled($_template->source, $_template);
} else {
$this->getRenderedTemplateCode($_template);
}
if ($_template->caching && $this->has_nocache_code) {
$_template->cached->hashes[ $this->nocache_hash ] = true;
}
if ($_template->smarty->debugging) {
$_template->smarty->_debug->end_render($_template);
}
}
/**
* compile template from source
*
* @param Smarty_Internal_Template $_template
*
* @throws Exception
*/
public function compileTemplateSource(Smarty_Internal_Template $_template)
{
$this->file_dependency = array();
$this->includes = array();
}
// disable caching for evaluated code
if ($this->source->handler->recompiled) {
$this->caching = false;
}
// read from cache or render
$isCacheTpl =
$this->caching == Smarty::CACHING_LIFETIME_CURRENT || $this->caching == Smarty::CACHING_LIFETIME_SAVED;
if ($isCacheTpl) {
if (!isset($this->cached) || $this->cached->cache_id !== $this->cache_id ||
$this->cached->compile_id !== $this->compile_id
) {
$this->loadCached(true);
}
$this->cached->render($this, $no_output_filter);
} else {
if (!isset($this->compiled) || $this->compiled->compile_id !== $this->compile_id) {
$this->loadCompiled(true);
}
$this->compiled->render($this);
}
// display or fetch
if ($display) {
if ($this->caching && $this->smarty->cache_modified_check) {
$this->smarty->ext->_cacheModify->cacheModifiedCheck($this->cached, $this,
isset($content) ? $content : ob_get_clean());
} else {
if ((!$this->caching || $this->cached->has_nocache_code || $this->source->handler->recompiled) &&
!$no_output_filter && (isset($this->smarty->autoload_filters[ 'output' ]) ||
isset($this->smarty->registered_filters[ 'output' ]))
) {
echo $this->smarty->ext->_filterHandler->runFilter('output', ob_get_clean(), $this);
} else {
echo ob_get_clean();
}
}
if ($this->smarty->debugging) {
$this->smarty->_debug->end_template($this);
// debug output
// return cache status of template
if (!isset($template->cached)) {
$template->loadCached();
}
$result = $template->cached->isCached($template);
$template->smarty->_cache[ 'isCached' ][ $template->_getTemplateId() ] = $template;
} else {
return false;
}
} else {
if ($saveVars) {
$savedTplVars = $template->tpl_vars;
$savedConfigVars = $template->config_vars;
}
ob_start();
$template->_mergeVars();
if (!empty(Smarty::$global_tpl_vars)) {
$template->tpl_vars = array_merge(Smarty::$global_tpl_vars, $template->tpl_vars);
}
$result = $template->render(false, $function);
$template->_cleanUp();
if ($saveVars) {
$template->tpl_vars = $savedTplVars;
$template->config_vars = $savedConfigVars;
} else {
if (!$function && !isset($smarty->_cache[ 'tplObjects' ][ $template->templateId ])) {
$template->parent = null;
$template->tpl_vars = $template->config_vars = array();
$smarty->_cache[ 'tplObjects' ][ $template->templateId ] = $template;
}
}
}
if (isset($_smarty_old_error_level)) {
error_reporting($_smarty_old_error_level);
}
return $result;
}
catch (Exception $e) {
while (ob_get_level() > $level) {
ob_end_clean();
* @return string rendered template output
*/
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
$result = $this->_execute($template, $cache_id, $compile_id, $parent, 0);
return $result === null ? ob_get_clean() : $result;
}
/**
* displays a Smarty template
*
* @param string $template the resource handle of the template file or template object
* @param mixed $cache_id cache id to be used with this template
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
*/
public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
// display template
$this->_execute($template, $cache_id, $compile_id, $parent, 1);
}
/**
* test if cache is valid
*
* @api Smarty::isCached()
* @link http://www.smarty.net/docs/en/api.is.cached.tpl
*
* @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template object
* @param mixed $cache_id cache id to be used with this template
* @param mixed $compile_id compile id to be used with this template
* @param object $parent next higher level of Smarty variables
*
* @return boolean cache status
*/
public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
{
return $this->_execute($template, $cache_id, $compile_id, $parent, 2);
}
foreach ($typeFilters as $typeFilter) {
$Smarty->registerFilter($filterType, $typeFilter);
}
}
$Smarty->debugging = $debugging;
$Smarty->caching = $caching;
$Smarty->cache_lifetime = $cache_lifetime;
$Smarty->compile_check = true;
//$Smarty->escape_html = true;
$Smarty->error_reporting = E_ALL &~ E_NOTICE;
if ($caching==true && isset($__data['smarty']['config']['caching']['id'])){
print $Smarty->display($__path,$__data['smarty']['config']['caching']['id']);
}else{
foreach ($__data as $var => $val) {
$Smarty->assign($var, $val);
}
print $Smarty->display($__path);
}
} catch (\Exception $e) {
$this->handleViewException($e);
}
return ob_get_clean();
}
/**
* Handle a view exception.
*
* @param Exception $e
* @return void
*/
protected function handleViewException($e)
{
ob_get_clean(); throw $e;
}
class SmartyEngine implements Engines\EngineInterface {
protected $config;
public function __construct($config)
{
$this->config = $config;
}
/**
* Get the evaluated contents of the view.
*
* @param string $path
* @param array $data
* @return string
*/
public function get($path, array $data = [])
{
return $this->evaluatePath($path, $data);
}
private static function smartyNameToViewName($filename){
$viewPos = strpos($filename, "views" . DS);
$filename = str_replace('file:','',$filename);
if($viewPos !== false)
$filename = substr($filename, strpos($filename, "views" . DS) + 6);
return str_replace(DS, ".", str_replace(".tpl", "", $filename));
}
public static function integrateViewComposers($_template, $forceName = false,$data=null){
if(!is_a($_template, 'Smarty_Internal_Template'))
return;
$events = \App::make('events');
if($forceName !== false ){
// if($forceName !== false && empty($_template->properties['file_dependency'])){
$viewName = self::smartyNameToViewName($forceName);
*
* @return array
*/
public function renderSections()
{
$env = $this->factory;
return $this->render(function ($view) use ($env) {
return $env->getSections();
});
}
/**
* Get the evaluated contents of the view.
*
* @return string
*/
protected function getContents()
{
return $this->engine->get($this->path, $this->gatherData());
}
/**
* Get the data bound to the view instance.
*
* @return array
*/
protected function gatherData()
{
$data = array_merge($this->factory->getShared(), $this->data);
foreach ($data as $key => $value) {
if ($value instanceof Renderable) {
$data[$key] = $value->render();
}
}
return $data;
}
throw $e;
}
}
/**
* Get the contents of the view instance.
*
* @return string
*/
protected function renderContents()
{
// We will keep track of the amount of views being rendered so we can flush
// the section after the complete rendering operation is done. This will
// clear out the sections for any separate views that may be rendered.
$this->factory->incrementRender();
$this->factory->callComposer($this);
$contents = $this->getContents();
// Once we've finished rendering the view, we'll decrement the render count
// so that each sections get flushed out next time a view is created and
// no old sections are staying around in the memory of an environment.
$this->factory->decrementRender();
return $contents;
}
/**
* Get the sections of the rendered view.
*
* @return array
*/
public function renderSections()
{
$env = $this->factory;
return $this->render(function ($view) use ($env) {
return $env->getSections();
public function __construct(Factory $factory, EngineInterface $engine, $view, $path, $data = array())
{
$this->view = $view;
$this->path = $path;
$this->engine = $engine;
$this->factory = $factory;
$this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data;
}
/**
* Get the string contents of the view.
*
* @param \Closure $callback
* @return string
*/
public function render(Closure $callback = null)
{
try {
$contents = $this->renderContents();
$response = isset($callback) ? $callback($this, $contents) : null;
// Once we have the contents of the view, we will flush the sections if we are
// done rendering all views so that there is nothing left hanging over when
// another view gets rendered in the future by the application developer.
$this->factory->flushSectionsIfDoneRendering();
return $response ?: $contents;
} catch (Exception $e) {
$this->factory->flushSections();
throw $e;
}
}
/**
* Get the contents of the view instance.
*
* @return string
*
* @return string
*/
protected function getContents()
{
return $this->engine->get($this->path, $this->gatherData());
}
/**
* Get the data bound to the view instance.
*
* @return array
*/
protected function gatherData()
{
$data = array_merge($this->factory->getShared(), $this->data);
foreach ($data as $key => $value) {
if ($value instanceof Renderable) {
$data[$key] = $value->render();
}
}
return $data;
}
/**
* Add a piece of data to the view.
*
* @param string|array $key
* @param mixed $value
* @return $this
*/
public function with($key, $value = null)
{
if (is_array($key)) {
$this->data = array_merge($this->data, $key);
} else {
$this->data[$key] = $value;
}
*
* @return array
*/
public function renderSections()
{
$env = $this->factory;
return $this->render(function ($view) use ($env) {
return $env->getSections();
});
}
/**
* Get the evaluated contents of the view.
*
* @return string
*/
protected function getContents()
{
return $this->engine->get($this->path, $this->gatherData());
}
/**
* Get the data bound to the view instance.
*
* @return array
*/
protected function gatherData()
{
$data = array_merge($this->factory->getShared(), $this->data);
foreach ($data as $key => $value) {
if ($value instanceof Renderable) {
$data[$key] = $value->render();
}
}
return $data;
}
throw $e;
}
}
/**
* Get the contents of the view instance.
*
* @return string
*/
protected function renderContents()
{
// We will keep track of the amount of views being rendered so we can flush
// the section after the complete rendering operation is done. This will
// clear out the sections for any separate views that may be rendered.
$this->factory->incrementRender();
$this->factory->callComposer($this);
$contents = $this->getContents();
// Once we've finished rendering the view, we'll decrement the render count
// so that each sections get flushed out next time a view is created and
// no old sections are staying around in the memory of an environment.
$this->factory->decrementRender();
return $contents;
}
/**
* Get the sections of the rendered view.
*
* @return array
*/
public function renderSections()
{
$env = $this->factory;
return $this->render(function ($view) use ($env) {
return $env->getSections();
public function __construct(Factory $factory, EngineInterface $engine, $view, $path, $data = array())
{
$this->view = $view;
$this->path = $path;
$this->engine = $engine;
$this->factory = $factory;
$this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data;
}
/**
* Get the string contents of the view.
*
* @param \Closure $callback
* @return string
*/
public function render(Closure $callback = null)
{
try {
$contents = $this->renderContents();
$response = isset($callback) ? $callback($this, $contents) : null;
// Once we have the contents of the view, we will flush the sections if we are
// done rendering all views so that there is nothing left hanging over when
// another view gets rendered in the future by the application developer.
$this->factory->flushSectionsIfDoneRendering();
return $response ?: $contents;
} catch (Exception $e) {
$this->factory->flushSections();
throw $e;
}
}
/**
* Get the contents of the view instance.
*
* @return string
*
* @return string
*/
protected function getContents()
{
return $this->engine->get($this->path, $this->gatherData());
}
/**
* Get the data bound to the view instance.
*
* @return array
*/
protected function gatherData()
{
$data = array_merge($this->factory->getShared(), $this->data);
foreach ($data as $key => $value) {
if ($value instanceof Renderable) {
$data[$key] = $value->render();
}
}
return $data;
}
/**
* Add a piece of data to the view.
*
* @param string|array $key
* @param mixed $value
* @return $this
*/
public function with($key, $value = null)
{
if (is_array($key)) {
$this->data = array_merge($this->data, $key);
} else {
$this->data[$key] = $value;
}
*
* @return array
*/
public function renderSections()
{
$env = $this->factory;
return $this->render(function ($view) use ($env) {
return $env->getSections();
});
}
/**
* Get the evaluated contents of the view.
*
* @return string
*/
protected function getContents()
{
return $this->engine->get($this->path, $this->gatherData());
}
/**
* Get the data bound to the view instance.
*
* @return array
*/
protected function gatherData()
{
$data = array_merge($this->factory->getShared(), $this->data);
foreach ($data as $key => $value) {
if ($value instanceof Renderable) {
$data[$key] = $value->render();
}
}
return $data;
}
throw $e;
}
}
/**
* Get the contents of the view instance.
*
* @return string
*/
protected function renderContents()
{
// We will keep track of the amount of views being rendered so we can flush
// the section after the complete rendering operation is done. This will
// clear out the sections for any separate views that may be rendered.
$this->factory->incrementRender();
$this->factory->callComposer($this);
$contents = $this->getContents();
// Once we've finished rendering the view, we'll decrement the render count
// so that each sections get flushed out next time a view is created and
// no old sections are staying around in the memory of an environment.
$this->factory->decrementRender();
return $contents;
}
/**
* Get the sections of the rendered view.
*
* @return array
*/
public function renderSections()
{
$env = $this->factory;
return $this->render(function ($view) use ($env) {
return $env->getSections();
public function __construct(Factory $factory, EngineInterface $engine, $view, $path, $data = array())
{
$this->view = $view;
$this->path = $path;
$this->engine = $engine;
$this->factory = $factory;
$this->data = $data instanceof Arrayable ? $data->toArray() : (array) $data;
}
/**
* Get the string contents of the view.
*
* @param \Closure $callback
* @return string
*/
public function render(Closure $callback = null)
{
try {
$contents = $this->renderContents();
$response = isset($callback) ? $callback($this, $contents) : null;
// Once we have the contents of the view, we will flush the sections if we are
// done rendering all views so that there is nothing left hanging over when
// another view gets rendered in the future by the application developer.
$this->factory->flushSectionsIfDoneRendering();
return $response ?: $contents;
} catch (Exception $e) {
$this->factory->flushSections();
throw $e;
}
}
/**
* Get the contents of the view instance.
*
* @return string
public function setContent($content)
{
$this->original = $content;
// If the content is "JSONable" we will set the appropriate header and convert
// the content to JSON. This is useful when returning something like models
// from routes that will be automatically transformed to their JSON form.
if ($this->shouldBeJson($content))
{
$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.
elseif ($content instanceof RenderableInterface)
{
$content = $content->render();
}
return parent::setContent($content);
}
/**
* Morph the given content into JSON.
*
* @param mixed $content
* @return string
*/
protected function morphToJson($content)
{
if ($content instanceof JsonableInterface) return $content->toJson();
return json_encode($content);
}
/**
* Determine if the given content should be turned into JSON.
508 => 'Loop Detected', // RFC5842
510 => 'Not Extended', // RFC2774
511 => 'Network Authentication Required', // RFC6585
);
/**
* Constructor.
*
* @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
*
* @api
*/
public function __construct($content = '', $status = 200, $headers = array())
{
$this->headers = new ResponseHeaderBag($headers);
$this->setContent($content);
$this->setStatusCode($status);
$this->setProtocolVersion('1.0');
if (!$this->headers->has('Date')) {
$this->setDate(new \DateTime(null, new \DateTimeZone('UTC')));
}
}
/**
* Factory method for chainability.
*
* Example:
*
* return Response::create($body, 200)
* ->setSharedMaxAge(300);
*
* @param mixed $content The response content, see setContent()
* @param int $status The response status code
* @param array $headers An array of response headers
*
* @return Response
protected function cleanFilterParameters(array $parameters)
{
return array_filter($parameters, function($p)
{
return ! is_null($p) && $p !== '';
});
}
/**
* Create a response instance from the given value.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param mixed $response
* @return \Illuminate\Http\Response
*/
protected function prepareResponse($request, $response)
{
if ( ! $response instanceof SymfonyResponse)
{
$response = new Response($response);
}
return $response->prepare($request);
}
/**
* Run a callback with filters disable on the router.
*
* @param callable $callback
* @return void
*/
public function withoutFilters(callable $callback)
{
$this->disableFilters();
call_user_func($callback);
$this->enableFilters();
}
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function dispatchToRoute(Request $request)
{
$route = $this->findRoute($request);
$this->events->fire('router.matched', array($route, $request));
// Once we have successfully matched the incoming request to a given route we
// can call the before filters on that route. This works similar to global
// filters in that if a response is returned we will not call the route.
$response = $this->callRouteBefore($route, $request);
if (is_null($response))
{
$response = $route->run($request);
}
$response = $this->prepareResponse($request, $response);
// After we have a prepared response from the route or filter we will call to
// the "after" filters to do any last minute processing on this request or
// response object before the response is returned back to the consumer.
$this->callRouteAfter($route, $request, $response);
return $response;
}
/**
* Find the route matching a given request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Routing\Route
*/
protected function findRoute($request)
{
$this->current = $route = $this->routes->match($request);
return $this->substituteBindings($route);
}
/**
* Dispatch the request to the application.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function dispatch(Request $request)
{
$this->currentRequest = $request;
// If no response was returned from the before filter, we will call the proper
// route instance to get the response. If no route is found a response will
// still get returned based on why no routes were found for this request.
$response = $this->callFilter('before', $request);
if (is_null($response))
{
$response = $this->dispatchToRoute($request);
}
$response = $this->prepareResponse($request, $response);
// Once this route has run and the response has been prepared, we will run the
// after filter to do any last work on the response or for this application
// before we will return the response back to the consuming code for use.
$this->callFilter('after', $request, $response);
return $response;
}
/**
* Dispatch the request to a route and return the response.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public function dispatchToRoute(Request $request)
{
* Handle the given request and get the response.
*
* @param \Illuminate\Http\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function dispatch(Request $request)
{
if ($this->isDownForMaintenance())
{
$response = $this['events']->until('illuminate.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)
{
$this->callFinishCallbacks($request, $response);
$this->shutdown();
}
/**
* Refresh the bound request instance in the container.
*
* @param \Illuminate\Http\Request $request
* Provides compatibility with BrowserKit functional testing.
*
* @implements HttpKernelInterface::handle
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @param int $type
* @param bool $catch
* @return \Symfony\Component\HttpFoundation\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.
*
* @param \Illuminate\Http\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function dispatch(Request $request)
{
if ($this->isDownForMaintenance())
{
$response = $this['events']->until('illuminate.app.down');
* @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)
{
$this->checkRequestForArraySessions($request);
// 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);
}
return $response;
}
/**
* Check the request and reject callback for array sessions.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return void
*/
*/
public function __construct(HttpKernelInterface $app, CookieJar $cookies)
{
$this->app = $app;
$this->cookies = $cookies;
}
/**
* 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(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;
}
}
*/
public function __construct(HttpKernelInterface $app, Encrypter $encrypter)
{
$this->app = $app;
$this->encrypter = $encrypter;
}
/**
* 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(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
return $this->encrypt($this->app->handle($this->decrypt($request), $type, $catch));
}
/**
* Decrypt the cookies on the request.
*
* @param \Symfony\Component\HttpFoundation\Request $request
* @return \Symfony\Component\HttpFoundation\Request
*/
protected function decrypt(Request $request)
{
foreach ($request->cookies as $key => $c)
{
try
{
$request->cookies->set($key, $this->decryptCookie($c));
}
catch (DecryptException $e)
{
$request->cookies->set($key, null);
}
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class StackedHttpKernel implements HttpKernelInterface, TerminableInterface
{
private $app;
private $middlewares = array();
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);
}
$prevKernel = $kernel;
}
}
}
* @return void
*/
public function booted($callback)
{
$this->bootedCallbacks[] = $callback;
if ($this->isBooted()) $this->fireAppCallbacks(array($callback));
}
/**
* 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
*/
protected function getStackedClient()
{
$sessionReject = $this->bound('session.reject') ? $this['session.reject'] : null;
$client = (new Builder)
->push('Illuminate\Cookie\Guard', $this['encrypter'])
->push('Illuminate\Cookie\Queue', $this['cookie'])
->push('Illuminate\Session\Middleware', $this['session'], $sessionReject);
| will load up this application so that we can run it and send
| the responses back to the browser and delight these users.
|
*/
$app = require_once __DIR__.'/../bootstrap/start.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can simply call the run method,
| which will execute the request and send the response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have whipped up for them.
|
*/
$app->run();