/** * Load adapter for detect preview link * @return JSNPowerAdminBarPreviewAdapter */ private function loadAdapter() { $builtInFile = dirname(dirname(__FILE__)) . "/supports/{$this->option}.php"; $builtInXmlFile = dirname(dirname(__FILE__)) . "/supports/{$this->option}.xml"; $xmlFile = JPATH_ADMINISTRATOR . "/components/{$this->option}/preview.xml"; if (is_file($builtInFile)) { require_once $builtInFile; $className = sprintf('JSNPowerAdminBarSupport%s', ucfirst(substr($this->option, strpos($this->option, '_') + 1))); $this->adapter = class_exists($className) ? new $className($this->option, $this->params) : null; } else { require_once dirname(dirname(__FILE__)) . "/supports/base.php"; $this->adapter = new JSNPowerAdminBarSupportBase($this->option, $this->params); if (is_file($builtInXmlFile)) { $this->adapter->parseXml($builtInXmlFile); } elseif (is_file($xmlFile)) { $this->adapter->parseXml($xmlFile); } } }