* @param string $text Text to evaluate
* @return string
* @throws ParsingException
*/
protected function parsePhp($text)
{
ob_start();
$result = eval('?>'.$text.'<?php ');
if ($result === false) {
* @param string $text Text to evaluate
* @return string
* @throws ParsingException
*/
protected function parsePhp($text)
{
ob_start();
$result = eval('?>'.$text.'<?php ');
if ($result === false) {
* @param string $text Text to evaluate
* @return string
* @throws ParsingException
*/
protected function parsePhp($text)
{
ob_start();
$result = eval('?>'.$text.'<?php ');
if ($result === false) {
$text = preg_replace('/'.preg_quote($match[0], '/').'/m', addcslashes($conditional, '\\$'), $text, 1);
}
$text = preg_replace($this->conditionalElseRegex, '<?php else: ?>', $text);
$text = preg_replace($this->conditionalEndRegex, '<?php endif; ?>', $text);
$text = $this->parsePhp($text);
$this->inCondition = false;
$text = $this->parseComments($text);
// </statamic>
$text = $this->extractLoopedTags($text, $data, $callback);
// Order is important here. We parse conditionals first as to avoid
// unnecessary code from being parsed and executed.
$text = $this->parseConditionals($text, $data, $callback);
$text = $this->injectExtractions($text, 'looped_tags');
$text = $this->parseVariables($text, $data, $callback);
if (!isset(self::$parsers['template_parser'])) {
$parser = new \Lex\Parser();
$parser->cumulativeNoparse(TRUE);
self::$parsers['template_parser'] = $parser;
}
$result = self::$parsers['template_parser']->parse($html, ($variables + $context), $callback, Config::get('_allow_php', false));
// end measuring
// Fetch template and parse any front matter
$template = Parse::frontMatter(File::get($template_path . '.html'));
self::$_extra_data = $template['data'] + self::$_extra_data;
$this->prependNewData(self::$_extra_data);
$html = Parse::template($template['content'], Statamic_View::$_dataStore, array($this, 'callback'));
break;
* This method returns the rendered template
*
* @param string $template Pathname of template file relative to templates directory
* @return string
*/
public function fetch($template)
{
return $this->render($template);
}
*
* This method echoes the rendered template to the current output buffer
*
* @param string $template Pathname of template file relative to templates directoy
*/
public function display($template)
{
echo $this->fetch($template);
}
public function render($template, $data = array(), $status = null)
{
if (!is_null($status)) {
$this->response->status($status);
}
$this->view->setTemplatesDirectory($this->config('templates.path'));
$this->view->appendData($data);
$this->view->display($template);
}
}
// append the response code
$data['_http_status'] = $response_code;
$data['_response'] = $response_code;
// and go!
$app->render(null, $data, $response_code);
// mark milestone for debug panel
//Invoke middleware
foreach ($route->getMiddleware() as $mw) {
call_user_func_array($mw, array($route));
}
//Invoke callable
call_user_func_array($route->getCallable(), array_values($route->getParams()));
return true;
ob_start();
$this->applyHook('slim.before.router');
$dispatched = false;
$matchedRoutes = $this->router->getMatchedRoutes($this->request->getMethod(), $this->request->getResourceUri());
foreach ($matchedRoutes as $route) {
try {
$this->applyHook('slim.before.dispatch');
$dispatched = $this->router->dispatch($route);
$this->applyHook('slim.after.dispatch');
if ($dispatched) {
{
//Read flash messaging from previous request if available
$this->loadMessages();
//Prepare flash messaging for current request
$env = $this->app->environment();
$env['slim.flash'] = $this;
$this->next->call();
$this->save();
}
$req = new \Slim\Http\Request($env);
$method = $req->post($this->settings['key']);
if ($method) {
$env['slim.method_override.original_method'] = $env['REQUEST_METHOD'];
$env['REQUEST_METHOD'] = strtoupper($method);
}
}
$this->next->call();
}
}
$app->config('whoops', new Run);
$app->config('whoops')->pushHandler($app->config('whoops.error_page_handler'));
$app->config('whoops')->pushHandler($app->config('whoops.error_json_handler'));
$app->config('whoops')->pushHandler($app->config('whoops.slim_info_handler'));
$app->error(array($app->config('whoops'), Run::EXCEPTION_HANDLER));
}
$this->next->call();
}
}
/**
* Call
*/
public function call()
{
try {
$this->next->call();
} catch (\Exception $e) {
$env = $this->app->environment();
{
set_error_handler(array('\Slim\Slim', 'handleErrors'));
//Apply final outer middleware layers
$this->add(new \Slim\Middleware\PrettyExceptions());
//Invoke middleware and application stack
$this->middleware[0]->call();
//Fetch status, header, and body
| All the heavy initialization and configuration happens right here.
| Let's get going!
|
*/
$app = require_once BASE_PATH . '/_app/start.php';
$app->run();