/** * Render the document. * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * @return The rendered data */ public function render($cache = false, $params = array()) { $this->setMimeEncoding($this->_mime); parent::render(); \App::get('response')->headers->set('Content-disposition', 'inline; filename="' . $this->getName() . '.xml"', true); return $this->getBuffer(); }
/** * Render the document. * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * @return object The rendered data */ public function render($cache = false, $params = array()) { \App::get('response')->headers->set('Cache-Control', 'no-cache', false); \App::get('response')->headers->set('Pragma', 'no-cache'); \App::get('response')->headers->set('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 The rendered data */ public function render($cache = false, $params = array()) { $xml = new \DOMDocument('1.0', 'utf-8'); $xml->formatOutput = true; // The OpenSearch Namespace $osns = 'http://a9.com/-/spec/opensearch/1.1/'; // Create the root element $elOs = $xml->createElementNS($osns, 'OpenSearchDescription'); $elShortName = $xml->createElementNS($osns, 'ShortName'); $elShortName->appendChild($xml->createTextNode(htmlspecialchars($this->shortName))); $elOs->appendChild($elShortName); $elDescription = $xml->createElementNS($osns, 'Description'); $elDescription->appendChild($xml->createTextNode(htmlspecialchars($this->description))); $elOs->appendChild($elDescription); // Always set the accepted input encoding to UTF-8 $elInputEncoding = $xml->createElementNS($osns, 'InputEncoding'); $elInputEncoding->appendChild($xml->createTextNode('UTF-8')); $elOs->appendChild($elInputEncoding); foreach ($this->images as $image) { $elImage = $xml->createElementNS($osns, 'Image'); $elImage->setAttribute('type', $image->type); $elImage->setAttribute('width', $image->width); $elImage->setAttribute('height', $image->height); $elImage->appendChild($xml->createTextNode(htmlspecialchars($image->data))); $elOs->appendChild($elImage); } foreach ($this->urls as $url) { $elUrl = $xml->createElementNS($osns, 'Url'); $elUrl->setAttribute('type', $url->type); // Results is the defualt value so we don't need to add it if ($url->rel != 'results') { $elUrl->setAttribute('rel', $url->rel); } $elUrl->setAttribute('template', $url->template); $elOs->appendChild($elUrl); } $xml->appendChild($elOs); parent::render(); return $xml->saveXML(); }
/** * Render the document * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * @return string The rendered data */ public function render($cache = false, $params = array()) { // If no error object is set return null if (!isset($this->error)) { return; } // Set the status header //\App::get('response')->headers->set('status', $this->error->getCode() . ' ' . str_replace("\n", ' ', $this->error->getMessage())); $file = 'error.php'; // Check template $directory = isset($params['directory']) ? $params['directory'] : PATH_CORE . '/templates'; $template = isset($params['template']) ? ltrim(preg_replace('/[^A-Z0-9_\\.-]/i', '', (string) $params['template']), '.') : 'system'; if (!file_exists($directory . DS . $template . DS . $file)) { $directory = PATH_CORE . '/templates'; $template = 'system'; } // Set variables $this->baseurl = isset($params['baseurl']) ? $params['baseurl'] : rtrim(\Request::root(true), '/') . rtrim(substr(dirname($directory), strlen(PATH_ROOT)), '/'); $this->template = $template; $this->debug = isset($params['debug']) ? $params['debug'] : false; // Load $data = $this->loadTemplate($directory . DS . $template, $file); parent::render(); return $data; }
/** * Outputs the template to the browser. * * @param boolean $caching If true, cache the output * @param array $params Associative array of attributes * @return object The rendered data */ public function render($caching = false, $params = array()) { $this->_caching = $caching; if (!empty($this->_template)) { $data = $this->_renderTemplate(); } else { $this->parse($params); $data = $this->_renderTemplate(); } parent::render(); return $data; }
/** * Render the document * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * @return The rendered data */ public function render($cache = false, $params = array()) { // Get the feed type $type = \Request::getCmd('type', 'Rss'); // Instantiate feed renderer and set the mime encoding $renderer = $this->loadRenderer($type ? $type : 'rss'); if (!$renderer instanceof Renderer) { \App::abort(404, \Lang::txt('Resource Not Found')); } $this->setMimeEncoding($renderer->getContentType()); // output // Generate prolog $data = '<?xml version="1.0" encoding="' . $this->_charset . '"?>' . "\n"; $data .= '<!-- generator="' . $this->getGenerator() . '" -->' . "\n"; // Generate stylesheet links foreach ($this->_styleSheets as $src => $attr) { $data .= '<?xml-stylesheet href="' . $src . '" type="' . $attr['mime'] . '"?>' . "\n"; } // Render the feed $data .= $renderer->render(); parent::render(); return $data; }
/** * Render the document. * * @param boolean $cache If true, cache the output * @param array $params Associative array of attributes * @return string The rendered data */ public function render($cache = false, $params = array()) { parent::render(); return $this->getBuffer(); }