public function render(array $params) { $this->_dump_buffers(); header('Content-type: text/calendar; charset=utf-8'); echo $params['data']; return Ai1ec_Http_Response_Helper::stop(0); }
/** * Renders the css for our frontend. * * Sets etags to avoid sending not needed data */ public function render_css() { header('HTTP/1.1 200 OK'); header('Content-Type: text/css', true, 200); // Aggressive caching to save future requests from the same client. $etag = '"' . md5(__FILE__ . $_GET[self::QUERY_STRING_PARAM]) . '"'; header('ETag: ' . $etag); $max_age = 31536000; $time_sys = $this->_registry->get('date.system'); header('Expires: ' . gmdate('D, d M Y H:i:s', $time_sys->current_time() + $max_age) . ' GMT'); header('Cache-Control: public, max-age=' . $max_age); if (empty($_SERVER['HTTP_IF_NONE_MATCH']) || $etag !== stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])) { // compress data if possible $compatibility_ob = $this->_registry->get('compatibility.ob'); if ($this->_registry->get('http.request')->client_use_gzip()) { $compatibility_ob->start('ob_gzhandler'); header('Content-Encoding: gzip'); } else { $compatibility_ob->start(); } $content = $this->get_compiled_css(); echo $content; $compatibility_ob->end_flush(); } else { // Not modified! status_header(304); } // We're done! Ai1ec_Http_Response_Helper::stop(0); }
public function render(array $params) { $this->_dump_buffers(); header('HTTP/1.1 200 OK'); header('Content-Type: text/xml; charset=UTF-8'); $data = Ai1ec_Http_Response_Helper::utf8($params['data']); $output = Ai1ec_XML_Builder::serialize_to_xml($data); echo $output; return Ai1ec_Http_Response_Helper::stop(0); }
public function render(array $params) { $this->_dump_buffers(); header('HTTP/1.1 200 OK'); header('Content-Type: application/json; charset=UTF-8'); $data = Ai1ec_Http_Response_Helper::utf8($params['data']); $output = json_encode($data); if (!empty($params['callback'])) { $output = $params['callback'] . '(' . $output . ')'; } echo $output; return Ai1ec_Http_Response_Helper::stop(0); }
public function render(array $params) { $this->_dump_buffers(); header('Content-Type: application/force-download; name="calendar.xml"'); header('Content-type: text/xml'); header('Content-Transfer-Encoding: binary'); header('Content-Disposition: attachment; filename="calendar.xml"'); header('Expires: 0'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); echo $params['data']; return Ai1ec_Http_Response_Helper::stop(0); }
public function render(array $params) { $this->_dump_buffers(); $now = gmdate('D, d M Y H:i:s'); $filename = $params['filename']; header('Expires: Tue, 03 Jul 2001 06:00:00 GMT'); header('Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate'); header('Last-Modified: ' . $now . ' GMT'); // force download header('Content-Type: application/force-download'); header('Content-Type: application/octet-stream'); header('Content-Type: application/download'); // disposition / encoding on response body header('Content-Disposition: attachment;filename="' . addcslashes($filename, '"') . '"'); header('Content-Transfer-Encoding: binary'); $columns = $params['columns']; for ($i = 0; $i < count($columns); $i++) { if ($i > 0) { echo ','; } echo $columns[$i]; } echo "\n"; $data = $params['data']; for ($i = 0; $i < count($data); $i++) { $row = $data[$i]; for ($j = 0; $j < count($row); $j++) { if ($j > 0) { echo ','; } echo $row[$j]; } echo "\n"; } return Ai1ec_Http_Response_Helper::stop(0); }
public function do_execute() { $this->_registry->get('theme.compiler')->generate(); return Ai1ec_Http_Response_Helper::stop(0); }
/** * Echoes the Javascript if not cached. * * Echoes the javascript with the correct content. * Since the content is dinamic, i use the hash function. * * @param string $javascript * * @return void */ private function _echo_javascript($javascript) { $conditional_get = new HTTP_ConditionalGet(array('contentHash' => md5($javascript))); $conditional_get->sendHeaders(); if (!$conditional_get->cacheIsValid) { $http_encoder = $this->_registry->get('http.encoder', array('content' => $javascript, 'type' => 'text/javascript')); $compression_level = null; if ($this->_registry->get('model.settings')->get('disable_gzip_compression')) { // set the compression level to 0 to disable it. $compression_level = 0; } $http_encoder->encode($compression_level); $http_encoder->sendAll(); } Ai1ec_Http_Response_Helper::stop(0); }
public function do_execute() { $message = $this->_process_files(); echo $message; return Ai1ec_Http_Response_Helper::stop(0); }