/** * Load widget XML config and merge with theme widget config * * @return Varien_Simplexml_Element|null */ public function getWidgetConfig() { if ($this->_widgetConfigXml === null) { $this->_widgetConfigXml = Mage::getSingleton('widget/widget')->getXmlElementByType($this->getType()); if ($this->_widgetConfigXml) { $configFile = Mage::getSingleton('core/design_package')->getBaseDir(array('_area' => $this->getArea(), '_package' => $this->getPackage(), '_theme' => $this->getTheme(), '_type' => 'etc')) . DS . 'widget.xml'; if (is_readable($configFile)) { $themeWidgetsConfig = new Varien_Simplexml_Config(); $themeWidgetsConfig->loadFile($configFile); if ($themeWidgetTypeConfig = $themeWidgetsConfig->getNode($this->_widgetConfigXml->getName())) { $this->_widgetConfigXml->extend($themeWidgetTypeConfig); } } } } return $this->_widgetConfigXml; }
/** * Load widget XML config and merge with theme widget config * * @return Varien_Simplexml_Element|null */ public function getWidgetConfig() { if ($this->_widgetConfigXml === null) { $this->_widgetConfigXml = Mage::getSingleton('Mage_Widget_Model_Widget')->getXmlElementByType($this->getType()); if ($this->_widgetConfigXml) { $configFile = Mage::getDesign()->getFilename('widget.xml', array('_area' => $this->getArea(), '_package' => $this->getPackage(), '_theme' => $this->getTheme(), '_module' => Mage::getConfig()->determineOmittedNamespace(preg_replace('/^(.+?)\\/.+$/', '\\1', $this->getType()), true))); if (is_readable($configFile)) { $themeWidgetsConfig = new Varien_Simplexml_Config(); $themeWidgetsConfig->loadFile($configFile); if ($themeWidgetTypeConfig = $themeWidgetsConfig->getNode($this->_widgetConfigXml->getName())) { $this->_widgetConfigXml->extend($themeWidgetTypeConfig); } } } } return $this->_widgetConfigXml; }
/** * Load application local.xml file, determine database vendor name * * @throws Magento_Exception */ protected function _readLocalXml() { if (!is_file($this->_localXmlFile)) { throw new Magento_Exception("Local XML configuration file '{$this->_localXmlFile}' does not exist."); } // Read local.xml and merge customization file into it $this->_localXml = simplexml_load_string(file_get_contents($this->_localXmlFile), 'Varien_Simplexml_Element'); if ($this->_customXmlFile) { $additionalOptions = simplexml_load_string(file_get_contents($this->_customXmlFile), 'Varien_Simplexml_Element'); $this->_localXml->extend($additionalOptions); } // Extract db vendor $dbVendorId = (string) $this->_localXml->global->resources->default_setup->connection->model; $dbVendorMap = array('mysql4' => 'mysql', 'mssql' => 'mssql', 'oracle' => 'oracle'); if (!array_key_exists($dbVendorId, $dbVendorMap)) { throw new Magento_Exception("Database vendor '{$dbVendorId}' is not supported."); } $this->_dbVendorName = $dbVendorMap[$dbVendorId]; }