'com_name', 'comcomname' => 'com_com_name', 'comscope' => 'comscope', 'comtype' => 'comtype', 'entryfile' => 'entryfile', 'version' => 'com_version', 'lang_admin' => 'dir_lang_admin', 'lang_site' => 'dir_lang_site', 'installxml'=>'installxml', 'description' => 'description', 'ebc_author' => 'author', 'authoremail' => 'authoremail', 'authorurl' => 'authorurl', 'license' => 'license', 'copyright' => 'copyright' , 'creationdate' => 'creationDate' ); private $_comTypes = array(); private $_substitutes = array(); private $project = null; /** * Constructor * * @access public * @return void */ public function __construct($name = '') { # $this->_config = $config; if( $name ) { if( ! $project = $this->getProject($name) ) { //--Something went wrong.. JError::raiseError(100, JText::sprintf('Unable to load the project %s', $name)); return false; } $this->project = $project; } $this->_comTypes = array( JText::_('Components') => 'component' , JText::_('Modules') => 'module' , JText::_('Plugins') => 'plugin' , JText::_('Templates') => 'template' ); }//function /** * files from build/scripts directory * * @return array filenames or empty array if none found */ public static function getExistingProjects() { jimport('joomla.filesystem.file'); $files = JFolder::files(JPATH_ADMINISTRATOR.DS.'components'.DS.com_EASY_APP_ELKUKU_1.DS.'builds'.DS.'scripts', 'ebc'); $projects = array(); if( ! $files || ! count($files) ) { return $projects; } foreach( $files as $fileName ) { if( JFile::getExt($fileName) == 'ebc') { $projects[] = JFile::stripExt($fileName); } }//foreach return $projects; }//function function getExistingProjectsOrdered() { jimport('joomla.filesystem.file'); $scripts = JFolder::files(JPATH_COMPONENT.DS.'builds'.DS.'scripts', $filter = '.ebc'); //--initialize the array foreach ($this->_comTypes as $display=>$type) { $projects[$type] = array(); }//foreach if( ! $scripts || ! count($scripts) ) { return $projects; } $i = 0; foreach( $scripts as $script ) { if( ! $p = $this->getProject(JFile::stripExt($script)) ) { JError::raiseWarning(100, JText::sprintf('Unable to load the project %s', JFile::stripExt($script))); ecrHTML::easyFormEnd(); //--something went very wrong.. return; } $projects[$p->comtype][$i]['name'] = $p->com_name; $projects[$p->comtype][$i]['com_name'] = $p->com_com_name; $i++; }//foreach return $projects; }//function function getDetails() { jimport('joomla.filesystem.file'); $scripts = JFolder::files(JPATH_COMPONENT.DS.'builds'.DS.'scripts', $filter = '.ebc'); //--initialize the array foreach ($this->_comTypes as $display=>$type) { $projects[$type] = array(); }//foreach if( ! $scripts || ! count($scripts) ) { return $projects; } foreach( $scripts as $script ) { if( ! $p = $this->getProject(JFile::stripExt($script)) ) { //--something went very wrong.. JError::raiseWarning(100, JText::sprintf('Unable to load the project %s', JFile::stripExt($script))); ecrHTML::easyFormEnd(); return; } $projects[$p->comtype][] = $p; }//foreach return $projects; }//function public function drawRegisteredProjectsTable() { $projects = $this->getExistingProjectsOrdered(); $projectCount = 0; ?> _comTypes as $titel=>$comType) { if( count($projects[$comType])) { ?>
'' , 'module' => 'admin,site' , 'plugin' => implode(',', JFolder::folders(JPATH_ROOT.DS.'plugins', '.', false, false, array('tmp', '.svn'))) , 'template' => 'admin,site' ); $task = JRequest::getVar('task', ''); $js = 'onchange="submitbutton(\''.$task.'\');"'; $showCore =( JRequest::getVar('show_core', '') == 'show_core' ) ? true : false ; $checked =( $showCore ) ? ' checked="checked"' : ''; ?> $projectScope) { $scopes = explode(',', $projectScope); ?>

/>
getUnregisteredProjects($projectType, $scope, $showCore); if( $projectType != 'component' ) { ?>
);">
getExistingProjects(); $allProjects = array(); $coreProjects = array(); switch ($type) { case 'component': //--get unregistered components $allProjects = JFolder::folders(JPATH_ROOT.DS.'administrator'.DS.'components'); //--List of core components $coreProjects = array( 'com_admin', 'com_banners', 'com_cache', 'com_categories', 'com_checkin', 'com_config' , 'com_contact', 'com_content', 'com_cpanel', 'com_frontpage', 'com_installer', 'com_languages', 'com_login' , 'com_massmail', 'com_media', 'com_menus', 'com_messages', 'com_modules', 'com_newsfeeds', 'com_plugins' , 'com_poll', 'com_search', 'com_sections', 'com_templates', 'com_trash', 'com_users', 'com_weblinks' ###comment out for testing... // , 'com_easycreator'); ); break; case 'module': switch ($scope) { case 'admin': //--Get unregistered admin modules $allProjects = JFolder::folders(JPATH_ROOT.DS.'administrator'.DS.'modules'); $coreProjects = array('mod_custom', 'mod_feed', 'mod_footer', 'mod_latest', 'mod_logged', 'mod_login' , 'mod_menu', 'mod_online', 'mod_popular', 'mod_quickicon', 'mod_stats', 'mod_status', 'mod_submenu' , 'mod_title', 'mod_toolbar', 'mod_unread'); break; case 'site': //--Get unregistered site modules $allProjects = JFolder::folders(JPATH_ROOT.DS.'modules'); $coreProjects = array('mod_archive', 'mod_banners', 'mod_breadcrumbs', 'mod_custom', 'mod_feed', 'mod_footer' , 'mod_latestnews', 'mod_login', 'mod_mainmenu', 'mod_mostread', 'mod_newsflash', 'mod_poll', 'mod_random_image' , 'mod_related_items', 'mod_search', 'mod_sections', 'mod_stats', 'mod_syndicate', 'mod_whosonline', 'mod_wrapper'); break; }//switch break; case 'plugin': //--Get unregistered plugins $plugins = JFolder::files(JPATH_ROOT.DS.'plugins'.DS.$scope, 'php'); foreach ($plugins as $plugin) { $allProjects[] = JFile::stripExt($plugin); }//foreach switch ($scope) { case 'authentication': $coreProjects = array('example', 'gmail', 'joomla', 'ldap', 'openid'); break; case 'content': $coreProjects = array('emailcloak', 'example', 'geshi', 'loadmodule', 'pagebreak', 'pagenavigation', 'vote'); break; case 'editors': $coreProjects = array('none', 'tinymce', 'xstandard'); break; case 'editors-xtd': $coreProjects = array('image', 'pagebreak', 'readmore'); break; case 'search': $coreProjects = array('categories', 'contacts', 'content', 'newsfeeds', 'sections', 'weblinks'); break; case 'system': $coreProjects = array('backlink', 'cache', 'debug', 'legacy', 'log', 'remember', 'sef'); break; case 'user': $coreProjects = array('example', 'joomla'); break; case 'xmlrpc': $coreProjects = array('blogger', 'joomla'); break; }//switch break; case 'template': switch ($scope) { case 'admin': //--Get unregistered admin templates $allProjects = JFolder::folders(JPATH_ROOT.DS.'administrator'.DS.'templates'); $coreProjects = array('khepri', 'system'); break; case 'site': //--Get unregistered site templates $allProjects = JFolder::folders(JPATH_ROOT.DS.'templates'); $coreProjects = array('beez', 'ja_purity', 'rhuk_milkyway', 'system'); break; }//switch break; default: echo 'UNKNOWN TYPE: '.$type.'
'; return array(); break; }//switch if( $showCore ) { $result = array_diff($allProjects, $registeredProjects); } else { $result = array_diff($allProjects, $registeredProjects, $coreProjects); } return $result; }//function /** * Get the std credits * * @return JObject credits */ public function getStdCredits() { $fFile = file(JPATH_COMPONENT.DS.'templates'.DS.'std'.DS.'credits.ini'); $credits = array(); $credits = new JObject(); foreach( $fFile as $line ) { $line = trim($line); if( $line && ! (strpos( $line, '#' ) === 0) ) { $key = trim(substr($line, 0, strpos($line, '='))); $value = substr($line, strpos($line, '=') + 1); $credits->$key = $value; } }//foreach return $credits; }//function /** * Get the credits from XML file * * @param string $xmlFileName full path * @return mixed JObject / false on error */ public function getXmlCredits($xmlFileName) { if( $data = JApplicationHelper::parseXMLInstallFile($xmlFileName) ) { return $data; $credits = new JObject(); foreach( $data as $key => $value ) { $credits->$key = $value; } return $credits; } return false; }//function> public function updateXML($projectName='') { if( $projectName ) { $project = $this->getProject($projectName); } else { if( ! $this->project ) { ecrHTML::displayMessage(array(JText::_('No project selected'), 'error')); } $project = $this->project; } $xmlBuildVars = array( 'name' => 'com_name' , 'version' => 'com_version' , 'description' => 'description' , 'license' => 'license' , 'author' => 'ebc_author' , 'authoremail' => 'authoremail' , 'authorurl' => 'authorurl' , 'copyright' => 'copyright' ); $xml = & JFactory::getXMLParser('Simple'); if( ! $xml->loadFile(JPATH_ROOT.DS.$project->installxml)) { unset($xml); return false; } //--Process credit vars foreach ($xmlBuildVars as $xmlName => $reqName) { $req =( isset($project->$reqName) ) ? $project->$reqName : false; if( ! $req ) { continue; } $element = & $xml->document->{$xmlName}[0]; if( $element ) { $element->setData($req); } }//foreach //--Process site language $element = & $xml->document->languages[0]; if( $element ) { $children = $element->children(); if( count($children) ) { $xmlLangs = array(); foreach ($children as $child) { $tag = $child->attributes('tag'); if( ! in_array($tag, $project->langs) ) { $element->removeChild($child); } else { $xmlLangs[] = $tag; } }//foreach } foreach ($project->langs as $lang) { if( ! in_array($lang, $xmlLangs) ) { $lng = $element->addChild('language', array('tag'=>$lang)); $lng->setData($lang.'/'.$lang.'.'.$project->com_com_name.'.ini'); } }//foreach } //--Process admin language $element =& $xml->document->administration[0]->languages[0]; if( $element ) { $children = $element->children(); if( count($children) ) { $xmlLangs = array(); $xmlMenuLangs = array(); foreach ($children as $child) { if( ! in_array($child->attributes('tag'), $project->langs) ) { $element->removeChild($child); } else { if( strpos($child->data(), 'menu.ini') ) { $xmlMenuLangs[] = $child->attributes('tag'); } else { $xmlLangs[] = $child->attributes('tag'); } } }//foreach } foreach ($project->langs as $lang) { if( ! in_array($lang, $xmlLangs) ) { $lng = $element->addChild('language', array('tag'=>$lang)); $lng->setData($lang.'/'.$lang.'.'.$project->com_com_name.'.ini'); } if( ! in_array($lang, $xmlMenuLangs) ) { if( JFile::exists(JPATH_ROOT.DS.'administrator'.DS.'language'.DS.$lang.DS.$lang.'.'.$project->com_com_name.'.menu.ini')) { $lng = $element->addChild('language', array('tag'=>$lang)); $lng->setData($lang.'/'.$lang.'.'.$project->com_com_name.'.menu.ini'); } } }//foreach } //--Write XML file to disc if( ! JFile::write(JPATH_ROOT.DS.$project->installxml, $xml->document->toString()) ) { JError::raiseWarning(100, JText::_('Unable to write file')); JError::raiseWarning(100, JPATH_ROOT.DS.$project->installxml); return false; } if( defined('ECR_DEBUG') ) { $screenOut = $xml->document->toString(true); $screenOut = str_replace('<', '<', $screenOut); $screenOut = str_replace('>', '>', $screenOut); echo '
'; echo '
'.$screenOut.'
'; echo '
'; } return true; }//function public function remove($complete=false) { jimport('joomla.filesystem.file'); $path_scripts = JPATH_COMPONENT.DS.'builds'.DS.'scripts'; $ebc_project = JRequest::getVar('ebc_project'); $project = $this->getProject($ebc_project); //--remove the config script if( ! JFile::exists($path_scripts.DS.$ebc_project.'.ebc')) { echo ecrHTML::displayMessage(JText::_('Config file not found'), 'error'); echo ecrHTML::displayMessage($path_scripts.DS.$ebc_project.'ebc', 'error'); return false; } else { if( ! JFile::delete($path_scripts.DS.$ebc_project.'.ebc')) { echo ecrHTML::displayMessage(JText::_('Unable to delete file'), 'error'); echo ecrHTML::displayMessage($path_scripts.DS.$ebc_project.'ebc', 'error'); return false; } } if( $complete ) { $id = $project->menu['dbid']; $clientId = 0; $type = $project->comtype; //--Get an installer object for the extension type jimport('joomla.installer.installer'); $installer = & JInstaller::getInstance(); //--Uninstall the chosen extensions $id = trim( $id ); if( ! $installer->uninstall($type, $id, $clientId )) { echo ecrHTML::displayMessage(JText::_('Unable to remove project'), 'error'); return false; } } return true; }// function /** * gets a project by name * * @param string $name * @return JObject Project */ public function getProject($projectName='') { if( ! $projectName ) { if( ! $this->project ) { //--Something went wrong.. JError::raiseError(100, JText::_('No project given')); return false; } return $this->project; } jimport('joomla.filesystem.file'); $basePath = JPATH_COMPONENT.DS.'builds'; $fileName = $basePath.DS.'scripts'.DS.$projectName.'.ebc'; $file = JFile::read($fileName); $file = explode("\n", $file); $project = $this->_parseConfig($file); $this->readMenu( $project ); return $project; }//function /** * Adds a submenu entry * * @param string $ebc_project project name * @param string $text * @param string $link * @param string $image * @return bool true on success */ public function addSubmenuEntry($ebc_project, $text, $link, $image='') { if( ! $project = $this->getProject($ebc_project)) { JError::raiseWarning(100, JText::sprintf('Unable to load the project %s', $this->ebc_project)); } $item = array(); $item['text'] = $text; $item['link'] = $link; $item['img'] = $image; $item['dbid'] = 0; $item['parent'] = $project->menu['dbid']; return $this->setDbMenuItem($item); }//function /** * Read the J! main menu entries for a component from the core components table * @param $project * @return void */ private function readMenu($project) { $db =& JFactory::getDBO(); //--Get menu entries $query = 'SELECT * FROM `#__components`' . ' WHERE `admin_menu_link` = \'option='.$project->com_com_name.'\''; $db->setQuery($query); $comp = $db->loadObject(); if($comp) { $project->menu['text'] = $comp->name; $project->menu['link'] = $comp->admin_menu_link; $project->menu['img'] = $comp->admin_menu_img; $project->menu['dbid'] = $comp->id; //--Get submenu entries $query = 'SELECT * FROM `#__components`' . ' WHERE parent = \''.$comp->id.'\'' . ' ORDER BY ordering'; $db->setQuery($query); $subs = $db->loadObjectList(); if($subs) { $i = 0; foreach( $subs as $sub ) { $project->submenu[$i]['text'] = $sub->name; $project->submenu[$i]['link'] = $sub->admin_menu_link; $project->submenu[$i]['img'] = $sub->admin_menu_img; $project->submenu[$i]['dbid'] = $sub->id; $i++; }//foreach } } }//function /** * Updates a menu entry in database / Insert new one if not exists * * @param $item array * @return bool true on success * @todo move */ private function setDbMenuItem($item) { $db = JFactory::getDBO(); //--Test if item exists $query = 'SELECT count(*) FROM `#__components`' . ' WHERE id = \''.$item['dbid'].'\''; $db->setQuery($query); $exists = $db->loadResult(); if( ! $exists ) { //--New item $query = 'INSERT INTO `#__components`' . ' SET' . ' `name` = \''.$item['text'].'\'' . ', `admin_menu_alt` = \''.$item['text'].'\'' . ', `admin_menu_link` = \''.$item['link'].'\'' . ', `admin_menu_img` = \''.$item['img'].'\'' . ', `parent` = \''.$item['parent'].'\';'; } else { //--Update existing item $query = 'UPDATE `#__components`' . ' SET ' . ' `name` = \''.$item['text'].'\'' . ', `admin_menu_alt` = \''.$item['text'].'\'' . ', `admin_menu_link` = \''.$item['link'].'\'' . ', `admin_menu_img` = \''.$item['img'].'\'' . ' WHERE `id` = '.$item['dbid'].';'; } $db->setQuery($query); if( ! $db->query() ) { ecrHTML::displayMessage($db->stderr(true)); return false; } return true; }//function public function getProjectParams($xmlfile) { JLoader::import('helpers.parameter', JPATH_COMPONENT); $params = new EasyParameter('', $xmlfile); return $params; }//function public function getTemplates() { $comTypes = array('com', 'mod', 'plg', 'tpl'); $path = JPATH_COMPONENT.DS.'templates'; $excludes = array('std', 'utl', '.svn'); foreach( $comTypes as $type ) { $ts = array(); $folders = JFolder::folders($path.DS.$type, '.', false, false, $excludes ); foreach ($folders as $folder) { $credits = EasyProject::getTemplateCredits($type, $folder); $t = new JObject(); $t->folder = $folder; $t->name = $credits->name; $t->info = $credits->name.'::'.$credits->description; $t->info .=( $credits->author ) ? '
Author: '.$credits->author : ''; $ts[] = $t; }//foreach $templates[$type] = $ts; }//foreach return $templates; }//function /** * Get groups of template parts * * @return array of folders */ public function getPartsGroups() { $path = JPATH_COMPONENT.DS.'templates'.DS.'parts'; $excludes = array('std', 'utl', '.svn'); $folders = JFolder::folders($path, '.', false, false, $excludes ); return $folders; } /** * get template parts * * @param string $group groups name * @return array of folders */ public function getParts($group) { $path = JPATH_COMPONENT.DS.'templates'.DS.'parts'.DS.$group; $excludes = array('.svn'); $folders = JFolder::folders($path, '.', false, false, $excludes ); return $folders; } /** * Get a template part * * @param string $group * @param string $name * @return class */ public function getPart($group, $part) { jimport('joomla.filesystem.file'); $path = JPATH_COMPONENT.DS.'templates'.DS.'parts'.DS.$group.DS.$part; $fileName = $path.DS.'part.php'; if( ! JFile::exists($fileName)) { ecrHTML::displayMessage(array(JText::_('File not found'), $fileName), 'error'); return; } require_once($fileName); $className = 'part'.ucfirst($group).ucfirst($part); if( ! class_exists($className)) { ecrHTML::displayMessage(array(JText::_('Class not found'), $className), 'error'); return; } $part = new $className(); return $part; }//function function insertPart($options, $logger, $overwrite=false) { $element_scope = JRequest::getVar('element_scope', ''); $element_name = JRequest::getVar('element_name', NULL); /* * Define substitutes */ $this->addSubstitute('_ECR_ELEMENT_NAME_', $element_name); /* * Process files */ $basePathDest = JPATH_ROOT; $basePathDest .=( $element_scope == 'admin' ) ? DS.'administrator' : ''; $basePathDest .= DS.'components'.DS.$options->ebc_project; $files = JFolder::files($options->pathSource, '.', true, true, array('options', '.svn')); foreach ($files as $file) { $fName = str_replace($options->pathSource.DS, '', $file); $fName = str_replace('ecr_element_name', strtolower($element_name), $fName); //--Check if file exists if( JFile::exists($basePathDest.DS.$fName) && ! $overwrite) { JError::raiseWarning(100, JText::sprintf('The file %s already exists', $fName)); return false; } $subPackage = explode(DS, str_replace($options->pathSource.DS, '', $file)); $subPackage = $subPackage[0]; $subPackage = str_replace(JFile::getName($file), '', $subPackage); $subPackage =( $subPackage ) ? $subPackage : 'Base'; $this->addSubstitute('_ECR_SUBPACKAGE_', ucfirst($subPackage)); $fileContents = JFile::read($file); $this->substitute($fileContents); if( ! JFile::write($basePathDest.DS.$fName, $fileContents)) { JError::raiseWarning(100, JText::_('Unable to write file')); return false; } $logger->logFileWrite($file, $basePathDest.DS.$fName, $fileContents); }//foreach return true; }//function /** * gets the credits for a template from description.ini * * @param string $com_type folder name * @param string $template folder name * @return object */ public function getTemplateCredits($com_type, $template) { jimport('joomla.filesystem.file'); $basePath = JPATH_COMPONENT.DS.'templates'; $fileName = $com_type.DS.$template.DS.'description.ini'; $credits = new JObject(); $credits->name = ''; $credits->description = ''; $credits->author = ''; $credits->description_link = ''; if( ! JFile::exists($basePath.DS.$fileName)) { //--File does not exists - look in 'parts' folder $fileName = $com_type.DS.$template.DS.'part.php'; if( JFile::exists($basePath.DS.$fileName)) { $group = str_replace('parts'.DS, '', $com_type); $part = $this->getPart($group, $template); if( method_exists($part, 'info')) { $info = $part->info(); $credits->name = $info->title; if( $info->description ) { $credits->description = $info->description; } } } //--File does not exists - return empty credits return $credits; } $file = JFile::read($basePath.DS.$fileName); if( ! $file ) { return $credits; } $lines = explode("\n", $file); foreach( $lines as $line ) { $line = trim($line); if( strpos($line, '#') === 0) { //--Comment line continue; } $eqpos = strpos($line, '='); if( ! $eqpos ) { continue; } //--Found a pair $key = substr($line, 0, $eqpos); $value = substr($line, $eqpos + 1); switch ($key) { case 'NAME': $credits->name = $value; break; case 'DESCRIPTION': $credits->description = $value; break; case 'AUTHOR': $credits->author = $value; break; case 'DESCRIPTIONLINK': $credits->description_link = $value; break; default: if(defined('ECR_DEBUG')) { echo 'UNDEFINED:
key:'.$key.'
Value:'.$value; } break; }//switch }//foreach return $credits; }//function /** * Parse the config file * always creating an object * * @param string $file * @param bool $ignoreComments * @return object Project */ function _parseConfig($file, $ignoreComments=true) { $project = new JObject(); //--init the object foreach ($this->_build_vars as $key=>$v) { $project->$key = ''; }//foreach $project->langs = array(); $project->copys = array(); $project->menu['img'] = ''; $project->menu['link'] = ''; $project->menu['text'] = ''; $project->submenu = array(); $project->dir_lang_admin = ''; $project->dir_lang_site = ''; $project->position = ''; $project->ordering = ''; $project->modules = array(); $project->plugins = array(); $project->isNew = false; $ignores =( $ignoreComments ) ? array('', '/**', '*', '*/') : array(); foreach( $file as $line ) { $args = $this->_separateCommands( $line ); if( ! count($args) ) continue; $command = strtolower( trim($args[0]) ); if( in_array( $command, $ignores ) ) continue; if( array_key_exists($command, $this->_build_vars) ) { $project->{$this->_build_vars[$command]} = trim( substr( $line, strlen( $command ))); continue; } switch( $command ) { case 'langs': $project->langs = explode(',', trim($args[1])); break; case 'ecopy': $i =( count($project->copys) ) ? count($project->copys) : 0; $project->copys[$i]['source'] = trim($args[1]); $project->copys[$i]['dest'] =( isset($args[2]) ) ? trim($args[2]) : ''; break; case 'module': $i =( count($project->modules) ) ? count($project->modules) : 0; $project->modules[$i]['client'] = trim($args[1]); $project->modules[$i]['name'] =( isset($args[2])) ? trim($args[2]) : ''; $project->modules[$i]['title'] =( isset($args[3])) ? trim($args[3]) : ''; $project->modules[$i]['position'] =( isset($args[4])) ? trim($args[4]) : ''; $project->modules[$i]['ordering'] =( isset($args[5])) ? trim($args[5]) : ''; break; case 'plugin': $i =( count($project->plugins) ) ? count($project->plugins) : 0; $project->plugins[$i]['client'] = trim($args[1]); $project->plugins[$i]['name'] = trim($args[2]); $project->plugins[$i]['title'] =( isset($args[3])) ? trim($args[3]) : ''; $project->plugins[$i]['order'] =( isset($args[4])) ? trim($args[4]) : ''; break; default: break; }//switch }//foreach return $project; }// function public function prepareAddPart($ebc_project, $substitutes=array()) { if( ! $project = $this->getProject($ebc_project) ) { JError::raiseWarning(100, JText::sprintf('Unable to load the project %s', $ebc_project)); return false; } $this->_addSubstitute('_EBC_COM_NAME_', $project->com_name); $this->_addSubstitute('EBC_AUTHOR', $project->author); $this->_addSubstitute('AUTHORURL', $project->authorurl); $this->_addSubstitute('_EBC_ACT_DATE_', date('d-M-y')); foreach ($substitutes as $key => $value) { $this->_addSubstitute($key, $value); } $this->_readHeader(); return true; }//function function drawAddElementTable( ) { $ebc_project = JRequest::getVar('ebc_project'); $link = 'index.php?option='.com_EASY_APP_ELKUKU_1.'&controller=ajax&task=show_part&tmpl=component'; $link .= '&ebc_project='.$ebc_project; ?>
getPartsGroups() as $group) { echo ''.ucfirst($group).'
'; foreach ($this->getParts($group) as $part) { if( $easyPart = self::getPart($group, $part) ) { $toolTip = $group.'::'.$part; $title = $part; if( method_exists($easyPart, 'info')) { $info = $easyPart->info(); $title = $info->title; $toolTip = $info->title; if( $info->description ) { $toolTip .= '::'.$info->description; } } echo '
'.$title.'
'; } }//foreach }//foreach ?>
_substitute($header); $this->_addSubstitute('##*HEADER*##', $header); }// function /** * Add a string to the substitution array * @param $key string * @param $value string * @return void */ private function _addSubstitute($key, $value) { $this->_substitutes[$key] = $value; }//function /** * Add a string to the substitution array * @param $key string * @param $value string * @return void */ public function addSubstitute($key, $value) { $this->_substitutes[$key] = $value; }//function public function getSubstitute($key) { if( array_key_exists($key, $this->_substitutes)) { return $this->_substitutes[$key]; } return ''; }//function /** * Replaces tags in a string with values from the substitution array * @param $string string * @return string string */ private function _substitute( & $string) { foreach ($this->_substitutes as $key=>$value) { $string = str_replace($key, $value, $string); }//foreach return $string; }//function /** * Replaces tags in a string with values from the substitution array * @param $string string * @return string string */ public function substitute( & $string) { foreach ($this->_substitutes as $key=>$value) { $string = str_replace($key, $value, $string); }//foreach return $string; }//function }//class