/** * The constructor */ public function __construct($config = array()) { parent::__construct(); $app = JFactory::getApplication(); if (!isset($config['item_id']) || empty($config['item_id'])) { throw new Exception($this->_name . ": No template id given"); } // Get template data $this->item = $this->getModel('template')->getItem($config['item_id']); // Create template directory $this->createDir = $this->item->createDir; // Set template base dirs $this->templateDirs[0] = JDeveloperXTD . "/templates/template"; $this->templateDirs[1] = JDeveloperTEMPLATES . "/template"; $this->template = $this->getTemplate(); if ($this->template === false) { throw new JDeveloperException($this->getErrors()); } // Get the template header $params = JComponentHelper::getParams('com_jdeveloper'); $header = new JDeveloperTemplate(JDeveloperTEMPLATES . '/fileheader.txt'); $header->addPlaceholders(array('Author' => $params->get('author'), 'Copyright' => $params->get('copyright'), 'Extension' => ucfirst($this->item->name), 'License' => $params->get('license'), 'Version' => $this->item->version)); self::$templateHeader = $header->getBuffer(); }