Exemplo n.º 1
0
 /**
  * Sends all appropriate headers for this page
  * Can be configured with the headers config array,
  * which should contain all header definitions for each template
  */
 public function headers()
 {
     $template = $this->template();
     if (isset($this->kirby->options['headers'][$template])) {
         $headers = $this->kirby->options['headers'][$template];
         if (is_numeric($headers)) {
             header::status($headers);
         } else {
             if (is_callable($headers)) {
                 call($headers, $this);
             }
         }
     } else {
         if ($this->isErrorPage()) {
             header::notfound();
         }
     }
 }
Exemplo n.º 2
0
/* Custom Panel Stylesheet
---------------------------------------
Define a custom stylesheet to load in to the panel. See:
getkirby.com/docs/cheatsheet/options/panel.stylesheet
*/
c::set('panel.stylesheet', 'assets/css/panel.css');
/* Kirby Configuration
---------------------------------------
By default you don't have to configure anything to
make Kirby work. For more fine-grained configuration
please check out getkirby.com/docs/advanced/options
and getkirby.com/blog/multi-environment-setup
*/
// Routes
//
c::set('routes', array(array('pattern' => '(:any)', 'method' => 'ALL', 'action' => function ($path) {
    if (!r::ajax()) {
        header::notfound();
        return site()->visit($path);
    }
    $page = page($path);
    $has_api_method = method_exists($page, 'api');
    return response::json(array('has_api_method' => $has_api_method));
}), array('pattern' => 'get/users.json', 'method' => 'ALL', 'action' => function () {
    // if(!r::ajax()) {
    // 	return header::forbidden();
    // }
    // $users = site()->users()->toArray();
    // $r = array_combine($users,site()->users()->toArray()); // format for kirby select field
    return response::json(array("first" => 'Rafe', "middle" => 'Jackson', "last" => 'Goldberg'));
})));