Esempio n. 1
0
 /**
  * Open, parse, and return the template file.
  *
  * @param $file string the template file name
  */
 public function fetch($file = null)
 {
     $tmpFile = $file;
     if (empty($file)) {
         $file = $this->file;
     }
     $file = JPATH_ROOT . DS . 'components' . DS . 'com_stream' . DS . 'templates' . DS . 'default' . DS . $file . '.php';
     // Template variable: $my;
     $my = JXFactory::getUser();
     $this->setRef('my', $my);
     // Template variable: the rest.
     if ($this->vars) {
         extract($this->vars, EXTR_REFS);
     }
     if (!JFile::exists($file)) {
         $app = JFactory::getApplication();
         $app->enqueueMessage(JText::sprintf('COM_STREAM_TEMPLATE_FILE_NOT_FOUND', $tmpFile . '.php'), 'error');
         return;
     }
     ob_start();
     // Start output buffering
     require $file;
     // Include the file
     $contents = ob_get_contents();
     // Get the contents of the buffer
     ob_end_clean();
     // End buffering and discard
     // Replace all _QQQ_ to "
     // Language file now uses new _QQQ_ to maintain Joomla 1.6 compatibility
     $contents = StreamTemplate::quote($contents);
     return $contents;
     // Return the contents
 }