当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Model_Config_Base类代码示例

本文整理汇总了PHP中Mage_Core_Model_Config_Base的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Config_Base类的具体用法?PHP Mage_Core_Model_Config_Base怎么用?PHP Mage_Core_Model_Config_Base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Core_Model_Config_Base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: loadPackageConfiguration

 /**
  * Iterate all active modules "etc" folders and combine data from
  * specidied xml file name to one object
  *
  * @param   string $fileName
  * @param   null|Mage_Core_Model_Config_Base $mergeToObject
  * @return  Mage_Core_Model_Config_Base
  */
 public function loadPackageConfiguration($mergeToObject = null, $mergeModel = null)
 {
     if ($mergeToObject === null) {
         $mergeToObject = new Mage_Core_Model_Config_Base();
         $mergeToObject->loadString('<config/>');
     }
     if ($mergeModel === null) {
         $mergeModel = new Mage_Core_Model_Config_Base();
     }
     $channels = Mage::getModel('channel/channel')->getCollection();
     foreach ($channels as $id => $channel) {
         // if the store is an activated channel
         if ($channel->load($id)->isChannel()) {
             if ($mergeModel->loadString($channel->getApiConfig())) {
                 $mergeToObject->extend($mergeModel, true);
             }
         }
     }
     /* $packages = Mage::getModel('catalog/product')
                 ->getCollection()
                 ->addFieldToFilter(
                 	'type_id',
                     Faett_Package_Model_Product_Type::TYPE_PACKAGE
                 );
     
             foreach ($packages as $id => $package) {
                 if ($mergeModel->loadString($package->load($id)->getApiConfig())) {
                     $mergeToObject->extend($mergeModel, true);
                 }
             } */
     return $mergeToObject;
 }
开发者ID:BGCX067,项目名称:faett-channel-svn-to-git,代码行数:40,代码来源:Config.php

示例2: loadPackageConfiguration

 /**
  * Iterate all active modules "etc" folders and combine data from
  * specidied xml file name to one object
  *
  * @param   string $fileName
  * @param   null|Mage_Core_Model_Config_Base $mergeToObject
  * @return  Mage_Core_Model_Config_Base
  */
 public function loadPackageConfiguration($mergeToObject = null, $mergeModel = null)
 {
     // initialize the configuration XML structure to append
     if ($mergeToObject === null) {
         $mergeToObject = new Mage_Core_Model_Config_Base();
         $mergeToObject->loadString('<config/>');
     }
     // initialize the configuration XML structure
     if ($mergeModel === null) {
         $mergeModel = new Mage_Core_Model_Config_Base();
     }
     // load the Collection with all channels
     $channels = Mage::getModel('channel/channel')->getCollection();
     // iterate over the channels
     foreach ($channels as $id => $channel) {
         // if the store is an activated channel
         if ($channel->load($id)->isChannel()) {
             // merge the channel to the ACL's
             if ($mergeModel->loadString($channel->getApiConfig())) {
                 $mergeToObject->extend($mergeModel, true);
             }
             // load the package Collection
             $packages = Mage::helper('channel')->getPackageCollection($channel);
             // merge the packages to the channel's ACL's
             foreach ($packages as $id => $package) {
                 if ($mergeModel->loadString($package->load($id)->getApiConfig($channel))) {
                     $mergeToObject->extend($mergeModel, true);
                 }
             }
         }
     }
     // return the configuration structure
     return $mergeToObject;
 }
开发者ID:BGCX067,项目名称:faett-channel-svn-to-git,代码行数:42,代码来源:Config.php

示例3: extendConfig

 /**
  * Extend extra configs from etc folder of module on system init configs
  *
  * @param Varien_Event_Observer $observer
  */
 public function extendConfig($observer)
 {
     $storeCode = Mage::helper("jmbasetheme")->getCurrentStoreCode("backend");
     $profiles = array_keys(Mage::helper("jmbasetheme")->getProfiles($storeCode));
     $mergeObject = new Mage_Core_Model_Config_Base();
     $profilePath = Mage::helper("jmbasetheme")->getProfilePath($storeCode);
     foreach ($profiles as $profile) {
         if (file_exists($profilePath . "core" . DS . $profile . ".xml")) {
             $mergeObject->loadFile($profilePath . "core" . DS . $profile . ".xml");
         } else {
             $mergeObject->loadFile($profilePath . "local" . DS . $profile . ".xml");
         }
         $observer->config->extend($mergeObject, false);
     }
     if (file_exists($profilePath . "core" . DS . "core.xml")) {
         $mergeObject->loadFile($profilePath . "core" . DS . "core.xml");
         $observer->config->extend($mergeObject, false);
     }
     //extend tablet settings
     $mergeObject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/device.xml");
     $observer->config->extend($mergeObject, false);
     //extend mobile settings
     $mergeObject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/mobile.xml");
     $observer->config->extend($mergeObject, false);
 }
开发者ID:kozinthetdbp,项目名称:megamall,代码行数:30,代码来源:Observer.php

示例4: testConstruct

    public function testConstruct()
    {
        $config = new Mage_Core_Model_Config_Base(<<<XML
<?xml version="1.0"?>
<root><key>value</key></root>
XML
);
        $this->assertInstanceOf('Mage_Core_Model_Config_Element', $config->getNode('key'));
    }
开发者ID:relue,项目名称:magento2,代码行数:9,代码来源:BaseTest.php

示例5: addMageOneFourConfig

 public function addMageOneFourConfig($observer)
 {
     if (version_compare(Mage::getVersion(), '1.5.0.0', '<')) {
         $file = Mage::getModuleDir('etc', 'MageBase_DpsPaymentExpress') . DS . 'config-1.4.xml';
         $config = Mage::getConfig();
         $prototype = new Mage_Core_Model_Config_Base();
         $prototype->loadFile($file);
         $config->extend($prototype);
         $config->saveCache();
     }
 }
开发者ID:mVentory,项目名称:magebase_paymentexpress,代码行数:11,代码来源:Observer.php

示例6: _initSectionsAndTabs

 protected function _initSectionsAndTabs()
 {
     if (Mage::helper('advanced')->isAnyStoreDisabled()) {
         $mergeConfig = Mage::getModel('core/config_base');
         $config = Mage::getConfig()->loadModulesConfiguration('system.xml');
         //these 4 lines are the only added content
         $configFile = Mage::helper('advanced')->getEtcPath() . DS . 'system-disabled.xml';
         $mergeModel = new Mage_Core_Model_Config_Base();
         $mergeModel->loadFile($configFile);
         $config = $config->extend($mergeModel, true);
         $this->_sections = $config->getNode('sections');
         $this->_tabs = $config->getNode('tabs');
     } else {
         return parent::_initSectionsAndTabs();
     }
     return parent::_initSectionsAndTabs();
 }
开发者ID:naz-ahmed,项目名称:ndap-magento-mirror,代码行数:17,代码来源:Config.php

示例7: Extendconfig

 public function Extendconfig($observer)
 {
     $profiles = array_keys(Mage::helper("jmbasetheme")->getProfiles());
     $mergeobject = new Mage_Core_Model_Config_Base();
     foreach ($profiles as $profile) {
         if (file_exists(Mage::helper("jmbasetheme")->getprofileFolder() . DS . "core" . DS . $profile . ".xml")) {
             $mergeobject->loadFile(Mage::helper("jmbasetheme")->getprofileFolder() . DS . "core" . DS . $profile . ".xml");
         } else {
             $mergeobject->loadFile(Mage::helper("jmbasetheme")->getprofileFolder() . DS . "local" . DS . $profile . ".xml");
         }
         $observer->config->extend($mergeobject, false);
     }
     if (file_exists(Mage::helper("jmbasetheme")->getprofileFolder() . DS . "core" . DS . "core.xml")) {
         $mergeobject->loadFile(Mage::helper("jmbasetheme")->getprofileFolder() . DS . "core" . DS . "core.xml");
         $observer->config->extend($mergeobject, false);
     }
     //extend tablet settings
     $mergeobject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/device.xml");
     $observer->config->extend($mergeobject, false);
     //extend mobile settings
     $mergeobject->loadFile(Mage::getModuleDir('etc', 'Wavethemes_Jmbasetheme') . "/mobile.xml");
     $observer->config->extend($mergeobject, false);
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:23,代码来源:Observer.php

示例8: _checkBaseUrl

 /**
  * Check base url settings, if not set it rises an exception
  *
  * @param Mage_Core_Model_Config_Base $original
  * @param Mage_Core_Model_Config_Base $test
  * @return EcomDev_PHPUnit_Model_Config
  * @throws RuntimeException
  */
 protected function _checkBaseUrl($original, $test)
 {
     $baseUrlSecure = (string) $test->getNode(self::XML_PATH_SECURE_BASE_URL);
     $baseUrlUnsecure = (string) $test->getNode(self::XML_PATH_UNSECURE_BASE_URL);
     if (empty($baseUrlSecure) || empty($baseUrlUnsecure) || $baseUrlSecure == self::CHANGE_ME || $baseUrlUnsecure == self::CHANGE_ME) {
         throw new RuntimeException('The base url is not set for proper controller tests. ' . 'Please run ecomdev-phpunit.php with magento-config action.');
     }
 }
开发者ID:cmuench,项目名称:EcomDev_PHPUnit,代码行数:16,代码来源:Config.php

示例9: mergeConfig

 public function mergeConfig($mergeToObject, $extensions)
 {
     foreach ($extensions as $extension) {
         if ($extension) {
             $mergeModel = new Mage_Core_Model_Config_Base();
             if ($mergeModel->loadString($extension)) {
                 $mergeToObject->extend($mergeModel->getNode(), true);
             }
         }
     }
     return $mergeToObject;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:12,代码来源:Data.php

示例10: _checkBaseUrl

 /**
  * Check base url settings, if not set it rises an exception
  *
  * @param Mage_Core_Model_Config_Base $original
  * @param Mage_Core_Model_Config_Base $test
  * @return Mage_Test_Model_Config
  * @throws RuntimeException
  */
 protected function _checkBaseUrl($original, $test)
 {
     $baseUrlSecure = (string) $test->getNode(self::XML_PATH_SECURE_BASE_URL);
     $baseUrlUnsecure = (string) $test->getNode(self::XML_PATH_UNSECURE_BASE_URL);
     if (empty($baseUrlSecure) || empty($baseUrlUnsecure) || $baseUrlSecure == self::CHANGE_ME || $baseUrlUnsecure == self::CHANGE_ME) {
         echo sprintf('Please change values in %s file for nodes %s and %s. ' . 'It will help in setting up proper controller test cases', 'app/etc/local.xml.phpunit', self::XML_PATH_SECURE_BASE_URL, self::XML_PATH_UNSECURE_BASE_URL);
         exit;
     }
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:17,代码来源:Config.php

示例11: isModuleEnabled

 public function isModuleEnabled($module)
 {
     $fileConfig = new Mage_Core_Model_Config_Base();
     $fileConfig->loadFile(Mage::getBaseDir('etc') . DS . 'modules' . DS . $module . '.xml');
     $isActive = $fileConfig->getNode('modules/' . $module . '/active');
     if (!$isActive || !in_array((string) $isActive, array('true', '1'))) {
         return false;
     }
     return true;
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:10,代码来源:Front.php

示例12: _loadDeclaredModules

 /**
  * Load declared modules configuration
  *
  * @return  Mage_Core_Model_Config
  */
 protected function _loadDeclaredModules()
 {
     Magento_Profiler::start('load_modules_files');
     $moduleFiles = $this->_getDeclaredModuleFiles();
     if (!$moduleFiles) {
         return $this;
     }
     Magento_Profiler::stop('load_modules_files');
     Magento_Profiler::start('load_modules_declaration');
     $unsortedConfig = new Mage_Core_Model_Config_Base('<config/>');
     $emptyConfig = new Mage_Core_Model_Config_Element('<config><modules/></config>');
     $declaredModules = array();
     foreach ($moduleFiles as $oneConfigFile) {
         $path = explode(DIRECTORY_SEPARATOR, $oneConfigFile);
         $moduleConfig = new Mage_Core_Model_Config_Base($oneConfigFile);
         $modules = $moduleConfig->getXpath('modules/*');
         if (!$modules) {
             continue;
         }
         $cPath = count($path);
         if ($cPath > 4) {
             $moduleName = $path[$cPath - 4] . '_' . $path[$cPath - 3];
             $this->_modulesCache[$moduleName] = $moduleConfig;
         }
         foreach ($modules as $module) {
             $moduleName = $module->getName();
             $isActive = (string) $module->active;
             if (isset($declaredModules[$moduleName])) {
                 $declaredModules[$moduleName]['active'] = $isActive;
                 continue;
             }
             $newModule = clone $emptyConfig;
             $newModule->modules->appendChild($module);
             $declaredModules[$moduleName] = array('active' => $isActive, 'module' => $newModule);
         }
     }
     foreach ($declaredModules as $moduleName => $module) {
         if ($module['active'] == 'true') {
             $module['module']->modules->{$moduleName}->active = 'true';
             $unsortedConfig->extend(new Mage_Core_Model_Config_Base($module['module']));
         }
     }
     $sortedConfig = new Mage_Core_Model_Config_Module($unsortedConfig, $this->_allowedModules);
     $this->extend($sortedConfig);
     Magento_Profiler::stop('load_modules_declaration');
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:52,代码来源:Config.php

示例13: __construct

 public function __construct($sourceData = null)
 {
     $this->setCacheId('config_urapidflow');
     $this->setCacheTags(array(self::CACHE_TAG));
     $this->setCacheChecksum(null);
     parent::__construct($sourceData);
     $this->_construct();
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:8,代码来源:Config.php

示例14: __construct

 public function __construct($arg)
 {
     list($sourceData, $moduleName) = $arg;
     parent::__construct($sourceData);
     $this->_config = Mage::getConfig();
     $this->_moduleName = $moduleName;
     $this->_moduleDir = realpath(Mage::getModuleDir('', $moduleName));
     $this->_etcModuleDir = realpath(Mage::getModuleDir('etc', $moduleName));
 }
开发者ID:ThomasNegeli,项目名称:Compatibility,代码行数:9,代码来源:Module.php

示例15: loadModules

 public function loadModules(array $files)
 {
     $this->loadString('<config/>');
     $loadedModules = array();
     foreach ($files as $file) {
         $this->_magento2config->loadFile($file);
         $moduleName = $this->_magento2config->getNode('module')->getAttribute('name');
         if ($this->isModuleLoaded($moduleName)) {
             $loadedModules[] = $moduleName;
             continue;
         }
         $loadedModules[] = $moduleName;
         $version = $this->_magento2config->getNode('module')->getAttribute('schema_version');
         $modules = Mage::getConfig()->getNode('modules');
         $child = $modules->addChild($moduleName);
         $child->addChild('active', 'true');
         $child->addChild('codePool', 'community');
         $child->addChild('version', $version);
         $this->loadString('<config/>');
     }
     return $loadedModules;
 }
开发者ID:ThomasNegeli,项目名称:Compatibility,代码行数:22,代码来源:Modules.php


注:本文中的Mage_Core_Model_Config_Base类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。