/** * Load a template file -- This is a special implementation that tries to find the files within the distribution help * dir first. There localized versions of these files can be stored! * * @access public * @param string $tpl The name of the template source file ... * automatically searches the template paths and compiles as needed. * @return string The output of the the template script. */ public function loadTemplate($tpl = null) { global $mainframe, $option; // clear prior output $this->_output = null; $file = isset($tpl) ? $this->_layout . '_' . $tpl : $this->_layout; // Add specific prefix to the file for usage within the help directry $file = 'help.' . $file; // clean the file name $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file); // Get Help URL jimport('joomla.language.help'); $filetofind = JHelp::createURL($file, true); // TODO: reactivate - this construct can not deal with symbolic links! //$this->_template = JPath::find(JPATH_ADMINISTRATOR, $filetofind); $fullname = JPATH_ADMINISTRATOR . DS . $filetofind; $this->_template = JFile::exists($fullname) ? $fullname : false; if ($this->_template != false) { // unset so as not to introduce into template scope unset($tpl); unset($file); // never allow a 'this' property if (isset($this->this)) { unset($this->this); } // start capturing output into a buffer ob_start(); // include the requested template filename in the local scope // (this will execute the view logic). include $this->_template; // done with the requested template; get the buffer and // clear it. $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; } else { return parent::loadTemplate($tpl); } }
/** * Load a template file -- This is a special implementation that tries to find the files within the distribution help * dir first. There localized versions of these files can be stored! * * @access public * @param string $tpl The name of the template source file ... * automatically searches the template paths and compiles as needed. * @return string The output of the the template script. */ function loadTemplate($tpl = null) { global $mainframe, $option; // clear prior output $this->_output = null; $file = $this->_layout; // clean the file name $file = preg_replace('/[^A-Z0-9_\\.-]/i', '', $file); // Get Help URL jimport('joomla.language.help'); $filetofind = JHelp::createURL($file, true); $this->_template = JPath::find(JPATH_ADMINISTRATOR, $filetofind); if ($this->_template != false) { // unset so as not to introduce into template scope unset($tpl); unset($file); // never allow a 'this' property if (isset($this->this)) { unset($this->this); } // start capturing output into a buffer ob_start(); // include the requested template filename in the local scope // (this will execute the view logic). include $this->_template; // done with the requested template; get the buffer and // clear it. $this->_output = ob_get_contents(); ob_end_clean(); return $this->_output; } else { return parent::loadTemplate($tpl); } }