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


PHP Varien_Simplexml_Element::attributes方法代码示例

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


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

示例1: _getHelperValue

 protected function _getHelperValue(Varien_Simplexml_Element $child)
 {
     $helperName = 'adminhtml';
     $titleNodeName = 'title';
     $childAttributes = $child->attributes();
     if (isset($childAttributes['module'])) {
         $helperName = (string) $childAttributes['module'];
     }
     //        if (isset($childAttributes['translate'])) {
     //            $titleNodeName  = (string)$childAttributes['translate'];
     //        }
     return Mage::helper($helperName)->__((string) $child->{$titleNodeName});
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:13,代码来源:Menu.php

示例2: getAttributes

 /**
  * Return attributes of all namespaces
  *
  * array(
  *   namespace => array(
  *     attribute_key => attribute_value,
  *     ...
  *   )
  * )
  *
  * @param Varien_Simplexml_Element $source
  * @return array
  */
 public function getAttributes($source, $namespace = null)
 {
     $attributes = array();
     if (!is_null($namespace)) {
         $attributes[$namespace] = $source->attributes($namespace);
         return $attributes;
     }
     $namespaces = $source->getNamespaces(true);
     $attributes[''] = $source->attributes('');
     foreach ($namespaces as $key => $value) {
         if ($key == '' || $key == 'soap') {
             continue;
         }
         $attributes[$value] = $source->attributes($value);
     }
     return $attributes;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:30,代码来源:Element.php

示例3: importXml

 public function importXml(Varien_Simplexml_Element $actionNode)
 {
     foreach ($actionNode->attributes() as $key => $value) {
         $this->setParam($key, (string) $value);
     }
     if ($actionNode['use']) {
         $container = $this->getProfile()->getContainer((string) $actionNode['use']);
     } else {
         $this->setParam('class', $this->getClassNameByType((string) $actionNode['type']));
         $container = $action->getContainer();
     }
     $this->setContainer($container);
     if ($this->getParam('name')) {
         $this->getProfile()->addContainer($this->getParam('name'), $container);
     }
     foreach ($actionNode->var as $varNode) {
         $container->setVar((string) $varNode['name'], (string) $varNode);
     }
     foreach ($actionNode->action as $actionSubnode) {
         $action = $this->addAction();
         $action->importXml($actionSubnode);
     }
     return $this;
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:24,代码来源:Abstract.php

示例4: extendChild

 /**
  * Extends one node
  *
  * @param Varien_Simplexml_Element $source
  * @param boolean $overwrite
  * @return Varien_Simplexml_Element
  */
 public function extendChild($source, $overwrite = false)
 {
     // this will be our new target node
     $targetChild = null;
     // name of the source node
     $sourceName = $source->getName();
     // here we have children of our source node
     $sourceChildren = $source->children();
     if (!$source->hasChildren()) {
         // handle string node
         if (isset($this->{$sourceName})) {
             // if target already has children return without regard
             if ($this->{$sourceName}->hasChildren()) {
                 return $this;
             }
             if ($overwrite) {
                 unset($this->{$sourceName});
             } else {
                 return $this;
             }
         }
         $targetChild = $this->addChild($sourceName, $source->xmlentities());
         $targetChild->setParent($this);
         foreach ($source->attributes() as $key => $value) {
             $targetChild->addAttribute($key, $this->xmlentities($value));
         }
         return $this;
     }
     if (isset($this->{$sourceName})) {
         $targetChild = $this->{$sourceName};
     }
     if (is_null($targetChild)) {
         // if child target is not found create new and descend
         $targetChild = $this->addChild($sourceName);
         $targetChild->setParent($this);
         foreach ($source->attributes() as $key => $value) {
             $targetChild->addAttribute($key, $this->xmlentities($value));
         }
     }
     // finally add our source node children to resulting new target node
     foreach ($sourceChildren as $childKey => $childNode) {
         $targetChild->extendChild($childNode, $overwrite);
     }
     return $this;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:52,代码来源:Element.php

示例5: _isEnabledModuleOutput

 /**
  * Check is module output enabled
  *
  * @param Varien_Simplexml_Element $child
  * @return bool
  */
 protected function _isEnabledModuleOutput(Varien_Simplexml_Element $child)
 {
     $helperName = 'adminhtml';
     $childAttributes = $child->attributes();
     if (isset($childAttributes['module'])) {
         $helperName = (string) $childAttributes['module'];
     }
     return Mage::helper($helperName)->isModuleOutputEnabled();
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:15,代码来源:Menu.php

示例6: _getHelperValue

 protected function _getHelperValue(Varien_Simplexml_Element $child)
 {
     $helperName = 'Mage_Adminhtml_Helper_Data';
     $titleNodeName = 'title';
     $childAttributes = $child->attributes();
     if (isset($childAttributes['module'])) {
         $helperName = (string) $childAttributes['module'];
     }
     $titleNodeName = 'title';
     return Mage::helper($helperName)->__((string) $child->{$titleNodeName});
 }
开发者ID:natxetee,项目名称:magento2,代码行数:11,代码来源:Page.php

示例7: _sanitizeReference

 /**
  * Cleanup reference node according to the block it refers to
  *
  * Look for the block by reference name and if the block is "unsafe", cleanup the reference node from actions
  *
  * @param Varien_Simplexml_Element $node
  */
 protected static function _sanitizeReference(Varien_Simplexml_Element $node)
 {
     $attributes = $node->attributes();
     $name = $attributes['name'];
     $result = $node->xpath("//block[@name='{$name}']") ?: array();
     foreach ($result as $block) {
         $isTypeSafe = self::_isTypeSafe($block->getAttribute('type'));
         if (!$isTypeSafe || !self::_isParentSafe($block)) {
             self::_deleteNodes($node, 'action');
         }
         break;
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:20,代码来源:Layout.php


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