示例#1
0
 /**
  * Execute the controller method and return the response
  * @return string
  */
 protected function handleRequest()
 {
     $response = false;
     //see if we can grab it from the cache
     if (Registry::get("CACHE_ENABLED") && $this->resource->getCacheLength() > 0) {
         $response = $this->getResponseFromCache();
     }
     //if it wasn't in the cache or the cache is not on...
     if ($response === false) {
         //preform the init
         $this->init();
         //add any existing exceptions
         $this->addPersistedExceptions();
         //get the controller method
         $method = $this->resource->getMethod();
         //execute controller method
         $this->{$method}();
         //use the view to generate the response
         $response = $this->view->execute();
     }
     return $response;
 }
示例#2
0
<?php

/*------------------------------------------------------------------------------
	Execute
------------------------------------------------------------------------------*/
include_once 'libs/autoindex.php';
include_once 'libs/markdown.php';
$view = new View();
$view->load('standard');
/*----------------------------------------------------------------------------*/
// Allow anything:
$view->allow('%.%');
// Ignore OSX meta data:
$view->deny('%/\\.(Apple|DS_)%');
$view->deny('%/(Network Trash Folder|Temporary Items)$%');
// Ignore hidden files:
$view->deny('%/\\.%');
// Allow itself:
$view->allow('%/\\.?autoindex(/|$)%');
// Add readme files:
$view->readme('%/readme(\\.txt)?$%i');
$view->readme('%/readme\\.md$%i', function ($text) {
    return Markdown($text);
});
$view->readme('%/readme\\.html?$%i', function ($text) {
    return $text;
});
$view->execute()->display();
/*----------------------------------------------------------------------------*/
示例#3
0
文件: Request.php 项目: peternerd/YOi
 public function executeResponse($response)
 {
     if ($response instanceof Response) {
         $response->execute();
     } elseif (is_string($response)) {
         echo $response;
     } elseif (is_array($response)) {
         echo json_encode($response);
     } else {
         $error = new View("error404", ["title" => "Error 404 | Pagina no encontrada"]);
         return $error->execute();
     }
 }