Beispiel #1
0
 function render($request, $response)
 {
     $config = $this->import("Config");
     $config = Util\array_delete_key("Pages", $config) ?: array();
     $renderTextile = isset($config["render_textile"]) ? $config["render_textile"] : true;
     $page = $request->meta("page");
     if (strpos($page, "_") === 0 or strpos($page, "/_") !== false) {
         throw new \Spark\Controller\Exception("Page is hidden", 404);
     }
     $page = Page::find($page);
     $page->setRenderTextile($renderTextile);
     $response->append($page->getContent());
 }
Beispiel #2
0
 function __invoke(HttpRequest $request)
 {
     $path = $request->getRequestUri();
     $path = trim($path, self::PARAM_DELIMITER);
     // Strip query params
     if (false !== ($pos = strpos($path, "?"))) {
         $path = substr($path, 0, $pos);
     }
     $request->meta("page", $path);
     if (false === Page::find($path)) {
         return false;
     }
     return $this->callback;
 }