/** * Render the document. * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * * @return The rendered data * * @since 11.1 */ public function render($cache = false, $params = array()) { Response::allowCache(false); Response::setHeader('Content-disposition', 'attachment; filename="' . $this->getName() . '.json"', true); parent::render(); return $this->getBuffer(); }
/** * Render the document * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * * @return string The rendered data * * @since 11.1 */ public function render($cache = false, $params = array()) { // If no error object is set return null if (!isset($this->_error)) { return; } // Set the status header Response::setHeader('status', $this->_error->getCode() . ' ' . str_replace("\n", ' ', $this->_error->getMessage())); $file = 'error.php'; // Check template $directory = isset($params['directory']) ? $params['directory'] : 'templates'; $template = isset($params['template']) ? FilterInput::getInstance()->clean($params['template'], 'cmd') : 'system'; if (!file_exists($directory . '/' . $template . '/' . $file)) { $template = 'system'; } // Set variables $this->baseurl = Uri::base(true); $this->template = $template; $this->debug = isset($params['debug']) ? $params['debug'] : false; $this->error = $this->_error; // Load $data = $this->_loadTemplate($directory . '/' . $template, $file); parent::render(); return $data; }
/** * Break us out of any containing iframes * * @return void * * @since 11.1 */ public static function noframes() { // Only load once if (isset(self::$loaded[__METHOD__])) { return; } // Include MooTools framework self::framework(); $js = "window.addEvent('domready', function () {if (top == self) {document.documentElement.style.display = 'block'; }" . " else {top.location = self.location; }});"; $document = Factory::getDocument(); $document->addStyleDeclaration('html { display:none }'); $document->addScriptDeclaration($js); Response::setHeader('X-Frames-Options', 'SAME-ORIGIN'); self::$loaded[__METHOD__] = true; }
/** * Render the document. * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * * @return The rendered data * * @since 11.1 */ public function render($cache = false, $params = array()) { parent::render(); Response::setHeader('Content-disposition', 'inline; filename="' . $this->getName() . '.xml"', true); return $this->getBuffer(); }
/** * Set the ETag header in the response * * @param string $etag The entity tag (etag) to set * * @return void * * @since 11.1 */ protected function _setEtag($etag) { Response::setHeader('ETag', $etag, true); }
/** * Outputs the document * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * * @return The rendered data * * @since 11.1 */ public function render($cache = false, $params = array()) { if ($mdate = $this->getModifiedDate()) { Response::setHeader('Last-Modified', $mdate); } Response::setHeader('Content-Type', $this->_mime . ($this->_charset ? '; charset=' . $this->_charset : '')); }