/** * * Builds the response-data. * * @return mixed|void * */ public function run() { $content = $this->content; $status = $this->options['status']; $options = $this->options; // Give response header for status code header('HTTP/1.1 ' . $status . ' ' . $this->codes[$status]); switch ($options['type']) { case 'json': $options['headers'] += array('Content-type' => 'application/json'); $this->headers($options['headers']); echo json_encode($content); break; case 'jsonEncoded': $options['headers'] += array('Content-type' => 'application/json'); $this->headers($options['headers']); return compact('content'); case 'tpl': /** Default pagelayout. */ $options += array('pagelayout' => 'pagelayout.tpl'); return $this->renderTpl($content, $options); case 'text': return array('pagelayout' => false, 'content' => $this->content); case 'xml': $options['headers'] += array('Content-type' => 'text/xml'); $this->headers($options['headers']); echo $content; break; } Router::handleEZXFormToken(true); return \eZExecution::cleanExit(); }