_hasAutomation = false; $this->_automation = array(); $filenames = array('abiautomation.ini', 'kickstart.ini', 'jpi4automation.ini'); foreach($filenames as $fn_base) { // Try to load the abiautomation.ini file $fn_rel = '..'.DS.$fn_base; $fn_abs = JPATH_SITE.DS.$fn_base; // Can I access the relative path? if(@file_exists($fn_rel)) { $filename = $fn_rel; // Yes, use relative path } else { $filename = $fn_abs; // No, use absolute path } if(@file_exists($filename)) { $this->_automation = _parse_ini_file($filename, true); if(!isset($this->_automation['abi'])) { $this->_automation = array(); } else { $this->_hasAutomation = true; break; } } } } /** * Do we have automation? * @return bool True if abiautomation.ini exists and has a abi section */ function hasAutomation() { return $this->_hasAutomation; } /** * Returns an automation section. If the section doesn't exist, it returns an empty array. * @param string $section [optional] The name of the section to load, defaults to 'abi' * @return array */ function getSection($section = 'abi') { if(!$this->_hasAutomation) { return array(); } else { if(isset($this->_automation[$section])) { return $this->_automation[$section]; } else { return array(); } } } }