Exemple #1
0
 /**
  * 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, array $params = array())
 {
     $data = 'BEGIN:VCARD';
     $data .= "\r\n";
     $data .= 'VERSION:2.1';
     $data .= "\r\n";
     foreach ($this->_properties as $key => $value) {
         $data .= "{$key}:{$value}";
         $data .= "\r\n";
     }
     $data .= 'REV:' . date('Y-m-d') . 'T' . date('H:i:s') . 'Z';
     $data .= "\r\n";
     $data .= 'MAILER: Joomla! vCard for ' . $this->getBase();
     $data .= "\r\n";
     $data .= 'END:VCARD';
     $data .= "\r\n";
     // Set document type headers
     parent::render();
     //JResponse::setHeader('Content-Length', strlen($data), true);
     JResponse::setHeader('Content-disposition: attachment; filename="' . $this->_filename . '"', true);
     return $data;
 }
Exemple #2
0
 /**
  * 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, array $params = array())
 {
     $pdf = $this->_engine;
     // Set PDF Metadata
     $pdf->SetCreator($this->getGenerator());
     $pdf->SetTitle($this->getTitle());
     $pdf->SetSubject($this->getDescription());
     $pdf->SetKeywords($this->getMetaData('keywords'));
     // Set PDF Header data
     $pdf->setHeaderData('', 0, $this->getTitle(), $this->getHeader());
     // Set PDF Header and Footer fonts
     $lang = KFactory::get('lib.joomla.language');
     $font = $lang->getPdfFontName();
     $font = $font ? $font : 'freesans';
     $pdf->setRTL($lang->isRTL());
     $pdf->setHeaderFont(array($font, '', 10));
     $pdf->setFooterFont(array($font, '', 8));
     // Initialize PDF Document
     $pdf->AliasNbPages();
     $pdf->AddPage();
     // Build the PDF Document string from the document buffer
     $this->fixLinks();
     $pdf->WriteHTML($this->getBuffer(), true);
     $data = $pdf->Output('', 'S');
     // Set document type headers
     parent::render();
     //JResponse::setHeader('Content-Length', strlen($data), true);
     JResponse::setHeader('Content-disposition', 'inline; filename="' . $this->getName() . '.pdf"', true);
     //Close and output PDF document
     return $data;
 }
 /**
  * Outputs the template to the browser.
  *
  * @param boolean 	$cache		If true, cache the output
  * @param array		$params		Associative array of attributes
  * @return 	The rendered data
  */
 public function render($caching = false, array $params = array())
 {
     // check
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = JFilterInput::clean($params['template'], 'cmd');
     $file = JFilterInput::clean($params['file'], 'cmd');
     if (!file_exists($directory . DS . $template . DS . $file)) {
         $template = 'system';
     }
     // Parse the template INI file if it exists for parameters and insert
     // them into the template.
     if (is_readable($directory . DS . $template . DS . 'params.ini')) {
         $content = file_get_contents($directory . DS . $template . DS . 'params.ini');
         $params = new JParameter($content);
     }
     // Load the language file for the template
     $lang = KFactory::get('lib.joomla.language');
     $lang->load('tpl_' . $template);
     // Assign the variables
     $this->template = $template;
     $this->baseurl = JURI::base(true);
     $this->params = $params;
     // load
     $data = $this->_loadTemplate($directory . DS . $template, $file);
     // parse
     $data = $this->_parseTemplate($data);
     //output
     parent::render();
     return $data;
 }
Exemple #4
0
 /**
  * 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, array $params = array())
 {
     global $option;
     // Get the feed type
     $type = KInput::get('type', 'GET', 'cmd', 'cmd', 'rss');
     // Set the mime encoding
     $this->setMimeEncoding('application/' . $type . '+xml');
     /*
      * Cache TODO In later release
      */
     $cache = 0;
     $cache_time = 3600;
     $cache_path = JPATH_BASE . DS . 'cache';
     // set filename for rss feeds
     $file = strtolower(str_replace('.', '', $type));
     $file = $cache_path . DS . $file . '_' . $option . '.xml';
     // Instantiate feed renderer and set the mime encoding
     $renderer = $this->loadRenderer($type);
     //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(null);
     parent::render();
     return $data;
 }
 /**
  * Render the document
  *
  * @param boolean 	$cache		If true, cache the output
  * @param array		$params		Associative array of attributes
  */
 public function render($cache = false, $params = array())
 {
     // If no error object is set return null
     if (!isset($this->_error)) {
         return;
     }
     //Set the status header
     JResponse::setHeader('status', $this->_error->code . ' ' . str_replace("\n", ' ', $this->_error->message));
     $file = 'error.php';
     // check template
     $directory = isset($params['directory']) ? $params['directory'] : 'templates';
     $template = isset($params['template']) ? JFilterInput::clean($params['template'], 'cmd') : 'system';
     if (!file_exists($directory . DS . $template . DS . $file)) {
         $template = 'system';
     }
     //set variables
     $this->baseurl = JURI::base(true);
     $this->template = $template;
     $this->debug = isset($params['debug']) ? $params['debug'] : false;
     $this->error = $this->_error;
     // load
     $data = $this->_loadTemplate($directory . DS . $template, $file);
     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, array $params = array())
 {
     parent::render();
     return $this->getBuffer();
 }