/** * 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 The rendered data * * @since 12.1 */ public function render($cache = false, $params = array()) { // Get the image type $type = Factory::getApplication()->input->get('type', 'png'); switch ($type) { case 'jpg': case 'jpeg': $this->_mime = 'image/jpeg'; break; case 'gif': $this->_mime = 'image/gif'; break; case 'png': default: $this->_mime = 'image/png'; break; } $this->_charset = null; 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 * * @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(); }
/** * 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; }
/** * Outputs the template to the browser. * * @param boolean $caching If true, cache the output * @param array $params Associative array of attributes * * @return The rendered data * * @since 11.1 */ 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 * * @since 11.1 * @throws Exception * @todo Make this cacheable */ public function render($cache = false, $params = array()) { // Get the feed type $type = Factory::getApplication()->input->get('type', 'rss'); // Instantiate feed renderer and set the mime encoding $renderer = $this->loadRenderer($type ? $type : 'rss'); if (!is_a($renderer, '\\Joomla\\Document\\Renderer')) { throw new Exception(Text::_('JGLOBAL_RESOURCE_NOT_FOUND'), 404); } $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 The rendered data * * @since 11.1 */ public function render($cache = false, $params = array()) { $xml = new DOMDocument('1.0', 'utf-8'); if (defined('JDEBUG') && JDEBUG) { $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 default 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(); }