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


PHP Mage_Core_Model_Config_Base::getNode方法代码示例

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


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

示例1: 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

示例2: 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

示例3: getNode

 /**
  * Returns node found by the $path and scope info
  *
  * @param   string $path
  * @param   string $scope
  * @param   string|int $scopeCode
  * @return Mage_Core_Model_Config_Element
  */
 public function getNode($path = null, $scope = '', $scopeCode = null)
 {
     if ($scope !== '') {
         if ('store' === $scope || 'website' === $scope) {
             $scope .= 's';
         }
         if ('default' !== $scope && is_int($scopeCode)) {
             if ('stores' == $scope) {
                 $scopeCode = Mage::app()->getStore($scopeCode)->getCode();
             } elseif ('websites' == $scope) {
                 $scopeCode = Mage::app()->getWebsite($scopeCode)->getCode();
             } else {
                 Mage::throwException(Mage::helper('Mage_Core_Helper_Data')->__('Unknown scope "%s".', $scope));
             }
         }
         $path = $scope . ($scopeCode ? '/' . $scopeCode : '') . (empty($path) ? '' : '/' . $path);
     }
     /**
      * Check path cache loading
      */
     if ($this->_useCache && $path !== null) {
         $path = explode('/', $path);
         $section = $path[0];
         if (isset($this->_cacheSections[$section])) {
             $res = $this->getSectionNode($path);
             if ($res !== false) {
                 return $res;
             }
         }
     }
     return parent::getNode($path);
 }
开发者ID:nemphys,项目名称:magento2,代码行数:40,代码来源:Config.php

示例4: _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

示例5: _getClassConfig

 /**
  * @param $type
  * @param Mage_Core_Model_Config_Base $moduleConfig
  * @return Mage_Core_Model_Config_Element
  */
 protected function _getClassConfig($type, Mage_Core_Model_Config_Base $moduleConfig)
 {
     $xpath = "global/{$type}s/*[class]";
     $classConfigs = $moduleConfig->getNode()->xpath($xpath);
     if ($classConfigs) {
         return $classConfigs[0];
     }
     return false;
 }
开发者ID:Wohlie,项目名称:phpstorm-magento-mapper,代码行数:14,代码来源:generate-phpstorm-map.php

示例6: isRedisEnabled

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

示例7: mergexmlAction

    public function mergexmlAction()
    {
        /*@davidselo: Action para entender como funciona el merge de los archivos XML*/
        /*$first = new Mage_Core_Model_Config_Base;
        		$first->loadString('<config>
        				<one></one>
        				<two></two>
        				<three></three>
        				</config>');
        		
        		$second = new Mage_Core_Model_Config_Base;
        		$second->loadString('<config>
        				<four></four>
        				<five></five>
        				</config>');
        		
        		$first->extend($second);
        	    echo  $first->getNode()->asNiceXml();*/
        /*SALIDA POR PANTALLA:
         * <config>
         * 		<one/>
         * 		<two/>
         * 		<three/>
         *  	<four/>
         *  	<five/>
         *  </config>
         * 
         * */
        /*
        		$first = new Mage_Core_Model_Config_Base;
        		$first->loadString('<config>
        				<one></one>
        				<two></two>
        				<three></three>
        				</config>');
        		
        		$second = new Mage_Core_Model_Config_Base;
        		$second->loadString('<config>
        				<one>Hello</one>
        				<two>Goodby</two>
        				</config>');
        		
        		$first->extend($second);
        		echo $first->getNode()->asNiceXml();*/
        /*SALIDA POR PANTALLA:
         * <config>
         *   <three/>
         *     <one>Hello</one>
         *     <two>Goodby</two>
         * </config>*/
        /*$first = new Mage_Core_Model_Config_Base;
        		$first->loadString('<config>
        				<one>
        				<two>
        				<three></three>
        				</two>
        				</one>
        				</config>');
        		
        		$second = new Mage_Core_Model_Config_Base;
        		$second->loadString('<config>
        				<one>
        				<two>
        				<four></four>
        				</two>
        				</one>
        				</config>');
        		
        		$first->extend($second);
        		echo $first->getNode()->asNiceXml();
        		*/
        $first = new Mage_Core_Model_Config_Base();
        $first->loadString('<config>
				<one>
				<two>
				<three>Original Value</three>
				</two>
				</one>
				</config>');
        $second = new Mage_Core_Model_Config_Base();
        $second->loadString('<config>
				<one>
				<two>
				<four></four>
				<three>New Value</three>
				</two>
				</one>
				</config>');
        $first->extend($second, false);
        echo $first->getNode()->asNiceXml();
    }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:91,代码来源:IndexController.php

示例8: _makeEventsLowerCase

 /**
  * Makes all events to lower-case
  *
  * @param string $area
  * @param Mage_Core_Model_Config_Base $mergeModel
  */
 protected function _makeEventsLowerCase($area, Mage_Core_Model_Config_Base $mergeModel)
 {
     $events = $mergeModel->getNode($area . "/" . Mage_Core_Model_App_Area::PART_EVENTS);
     if ($events !== false) {
         $children = clone $events->children();
         /** @var Mage_Core_Model_Config_Element $event */
         foreach ($children as $event) {
             if ($this->_isNodeNameHasUpperCase($event)) {
                 $oldName = $event->getName();
                 $newEventName = strtolower($oldName);
                 if (!isset($events->{$newEventName})) {
                     /** @var Mage_Core_Model_Config_Element $newNode */
                     $newNode = $events->addChild($newEventName, $event);
                     $newNode->extend($event);
                 }
                 unset($events->{$oldName});
             }
         }
     }
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:26,代码来源:Config.php

示例9: initFields

    /**
     * Init fieldset fields
     *
     * @param Varien_Data_Form_Element_Fieldset $fieldset
     * @param Varien_Simplexml_Element $group
     * @param Varien_Simplexml_Element $section
     * @param string $fieldPrefix
     * @param string $labelPrefix
     * @return Soon_StockReleaser_Block_Adminhtml_System_Config_Form
     */
    public function initFields($fieldset, $group, $section, $fieldPrefix = '', $labelPrefix = '')
    {
        if (!$group->is('use_custom_form', 1)) {
            return parent::initFields($fieldset, $group, $section, $fieldPrefix = '', $labelPrefix = '');
        }
        if (!$this->_configDataObject) {
            $this->_initObjects();
        }
        // Extends for config data
        $configDataAdditionalGroups = array();
        $paymentMethods = Mage::helper('payment')->getPaymentMethods();
        $xmlString = "<config><fields>";
        $sort_order = 0;
        foreach ($paymentMethods as $code => $paymentMethod) {
            if (!isset($paymentMethod['active']) || $paymentMethod['active'] == 0) {
                continue;
            }
            ++$sort_order;
            $xmlString .= '
        		<' . $code . ' translate="label">
                            <label>' . $paymentMethod['title'] . '</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>' . $sort_order . '</sort_order>
                            <validate>validate-number</validate>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
			</' . $code . '>';
            ++$sort_order;
            $xmlString .= '                    
        		<' . $code . '-unit translate="label">
                            <frontend_type>select</frontend_type>
                            <source_model>stockreleaser/system_config_source_unit</source_model>
                            <sort_order>' . $sort_order . '</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
			</' . $code . '-unit>';
        }
        $xmlString .= "</fields></config>";
        $element = new Mage_Core_Model_Config_Base();
        $element->loadString($xmlString);
        foreach ($element->getNode('fields') as $elements) {
            $elements = (array) $elements;
            // sort either by sort_order or by child node values bypassing the sort_order
            if ($group->sort_fields && $group->sort_fields->by) {
                $fieldset->setSortElementsByAttribute((string) $group->sort_fields->by, $group->sort_fields->direction_desc ? SORT_DESC : SORT_ASC);
            } else {
                usort($elements, array($this, '_sortForm'));
            }
            foreach ($elements as $e) {
                if (!$this->_canShowField($e)) {
                    continue;
                }
                /**
                 * Look for custom defined field path
                 */
                $path = (string) $e->config_path;
                if (empty($path)) {
                    $path = $section->getName() . '/' . $group->getName() . '/' . $fieldPrefix . $e->getName();
                } elseif (strrpos($path, '/') > 0) {
                    // Extend config data with new section group
                    $groupPath = substr($path, 0, strrpos($path, '/'));
                    if (!isset($configDataAdditionalGroups[$groupPath])) {
                        $this->_configData = $this->_configDataObject->extendConfig($groupPath, false, $this->_configData);
                        $configDataAdditionalGroups[$groupPath] = true;
                    }
                }
                $id = $section->getName() . '_' . $group->getName() . '_' . $fieldPrefix . $e->getName();
                if (isset($this->_configData[$path])) {
                    $data = $this->_configData[$path];
                    $inherit = false;
                } else {
                    $data = $this->_configRoot->descend($path);
                    $inherit = true;
                }
                if ($e->frontend_model) {
                    $fieldRenderer = Mage::getBlockSingleton((string) $e->frontend_model);
                } else {
                    $fieldRenderer = $this->_defaultFieldRenderer;
                }
                $fieldRenderer->setForm($this);
                $fieldRenderer->setConfigData($this->_configData);
                $helperName = $this->_configFields->getAttributeModule($section, $group, $e);
                $fieldType = (string) $e->frontend_type ? (string) $e->frontend_type : 'text';
                $name = 'groups[' . $group->getName() . '][fields][' . $fieldPrefix . $e->getName() . '][value]';
                $label = Mage::helper($helperName)->__($labelPrefix) . ' ' . Mage::helper($helperName)->__((string) $e->label);
                $hint = (string) $e->hint ? Mage::helper($helperName)->__((string) $e->hint) : '';
                if ($e->backend_model) {
                    $model = Mage::getModel((string) $e->backend_model);
//.........这里部分代码省略.........
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:101,代码来源:Form.php

示例10: _checkRewrites

 protected function _checkRewrites()
 {
     $this->section('Rewrites Information');
     $types = array('models' => 'Models', 'blocks' => 'Blocks', 'helpers' => 'Helpers');
     $this->output('/!\\ Only active modules are considered and core modules are ignored');
     $this->output('The script will also try to find possible conflicts between classes', 4);
     $this->br();
     $rewrites = array();
     $modules = $this->_config->getNode('modules')->children();
     foreach ($modules as $moduleName => $module) {
         if ($module->is('active') && $module->codePool != 'core') {
             $mergeModel = new Mage_Core_Model_Config_Base();
             $configFile = $this->_config->getModuleDir('etc', $moduleName) . DS . 'config.xml';
             if ($data = $mergeModel->loadFile($configFile)) {
                 foreach ($types as $type => $label) {
                     $list = $mergeModel->getNode()->global->{$type};
                     if ($list) {
                         foreach ($list->children() as $key => $data) {
                             if ($data->rewrite) {
                                 foreach ($data->rewrite->children() as $path => $value) {
                                     $rewrites[$type]["{$key}/{$path}"][$moduleName] = (string) $value;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (empty($rewrites)) {
         $this->output('No class rewrites found');
     } else {
         foreach ($rewrites as $type => $list) {
             $this->output(sprintf('%s (%s)', $this->bold($types[$type]), count($list)));
             foreach ($list as $key => $modules) {
                 if (count($modules) === 1) {
                     $this->output($this->bold($key), 2);
                 } else {
                     $this->error(sprintf('%s (possible classes conflicts)', $this->bold($key)), 2);
                 }
                 foreach ($modules as $module => $class) {
                     $this->start($this->pad($module, 40), 4);
                     $this->output($class);
                 }
             }
             $this->br();
         }
     }
     return $this;
 }
开发者ID:newedge-media,项目名称:iwantmymeds,代码行数:50,代码来源:review.php

示例11: _saveMigrationModuleConfig

 /**
  * Overwrite bootstrap file with new XML data.
  *
  * @param Mage_Core_Model_Config_Base $moduleConfig
  * @return bool
  */
 protected function _saveMigrationModuleConfig($moduleConfig)
 {
     /**
      * Overwrite the bootstrap file.
      */
     return (bool) file_put_contents($this->_getMigrationModuleBootstrapFile(), $moduleConfig->getNode()->asNiceXml('', 0));
 }
开发者ID:victso,项目名称:MigrationHelper,代码行数:13,代码来源:Observer.php

示例12: _getAssetData

 /**
  * Returns assets and handles
  *
  * @param Mage_Core_Model_Config_Base $xml
  * @param string $type
  * @param string $area
  * @param string $package
  * @param string $theme
  * @return array
  */
 protected function _getAssetData(Mage_Core_Model_Config_Base $xml, $type, $area, $package, $theme)
 {
     $assets = array();
     $handles = array();
     /** @var $node Mage_Core_Model_Config_Element */
     foreach ($xml->getNode($type)->children() as $node) {
         $assetName = $node->getName();
         $assetMethod = $node->method ? (string) $node->method : 'default';
         $assetType = $node->type ? (string) $node->type : 'skin';
         $assetArea = $node->area ? (string) $node->area : 'frontend';
         $assetPackage = $node->package ? (string) $node->package : 'base';
         $assetTheme = $node->theme ? (string) $node->theme : 'default';
         $assetIf = $node->if ? (string) $node->if : null;
         $assetParams = $node->params ? (string) $node->params : null;
         if ($type == self::TYPE_CSS) {
             $assetPath = $node->path ? rtrim((string) $node->path, '/') : 'css';
             $assetFile = sprintf('/%s.css', $node->filename);
             $assetFileMin = sprintf('/%s.min.css', $node->filename);
         } else {
             if ($type == self::TYPE_JS) {
                 $assetPath = $node->path ? rtrim((string) $node->path, '/') : 'css';
                 $assetFile = sprintf('/%s.js', $node->filename);
                 $assetFileMin = sprintf('/%s.min.js', $node->filename);
             } else {
                 continue;
             }
         }
         if ($assetType != 'skin') {
             continue;
         }
         if ($assetArea != $area || $assetPackage != $package || $assetTheme != $theme) {
             continue;
         }
         if (!$node->handles || !$node->files) {
             continue;
         }
         $removeList = array();
         /** @var $fileNode Mage_Core_Model_Config_Element */
         foreach ($node->files->children() as $fileNode) {
             if (!$fileNode->remove) {
                 continue;
             }
             $sourceName = $fileNode->getName();
             $attributes = $fileNode->remove->attributes();
             if (empty($attributes['type']) || empty($attributes['file'])) {
                 continue;
             }
             $removeList[$sourceName] = array((string) $attributes['type'], (string) $attributes['file']);
         }
         /** @var $handle Mage_Core_Model_Config_Element */
         foreach ($node->handles->children() as $handle) {
             $handles[$handle->getName()][] = $assetName;
         }
         $assets[$assetName] = array('file' => $assetPath . $assetFile, 'file_min' => $assetPath . $assetFileMin, 'if' => $assetIf, 'params' => $assetParams, 'remove' => $removeList, 'behavior' => $assetMethod);
     }
     return array($assets, $handles);
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:67,代码来源:Merge.php

示例13: _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

示例14: 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

示例15: 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


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