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


PHP Varien_Simplexml_Element::getAttribute方法代码示例

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


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

示例1: _translateNode

 /**
  * translate node
  *
  * @access protected
  * @param Varien_Simplexml_Element $node
  * @return Ultimate_ModuleCreator_Model_Config
  * @author Marius Strajeru <ultimate.module.creator@gmail.com>
  */
 protected function _translateNode(&$node)
 {
     if ($node->getAttribute('translate')) {
         $fields = explode(' ', $node->getAttribute('translate'));
         $module = $node->getAttribute('module') ? (string) $node->getAttribute('module') : $this->_getDefaultTranslateModule();
         foreach ($fields as $field) {
             if ($node->{$field}) {
                 $node->{$field} = Mage::helper($module)->__((string) $node->{$field});
             }
         }
     }
     if ($node->hasChildren()) {
         foreach ($node->children() as $child) {
             $this->_translateNode($child);
         }
     }
     return $this;
 }
开发者ID:cojaco,项目名称:UltimateModuleCreator,代码行数:26,代码来源:Config.php

示例2: findTranslationModuleName

 /**
  * Lookup module name for translation from current specified layout node
  *
  * Priorities:
  * 1) "module" attribute in the element
  * 2) "module" attribute in any ancestor element
  * 3) layout handle name - first 1 or 2 parts (namespace is determined automatically)
  *
  * @param Varien_Simplexml_Element $node
  * @return string
  */
 public static function findTranslationModuleName(Varien_Simplexml_Element $node)
 {
     $result = $node->getAttribute('module');
     if ($result) {
         return (string) $result;
     }
     foreach (array_reverse($node->xpath('ancestor::*[@module]')) as $element) {
         $result = $element->getAttribute('module');
         if ($result) {
             return (string) $result;
         }
     }
     foreach ($node->xpath('ancestor-or-self::*[last()-1]') as $handle) {
         $name = Mage::getConfig()->determineOmittedNamespace($handle->getName());
         if ($name) {
             return $name;
         }
     }
     return 'core';
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:31,代码来源:Layout.php

示例3: findTranslationModuleName

 /**
  * Lookup module name for translation from current specified layout node
  *
  * Priorities:
  * 1) "module" attribute in the element
  * 2) "module" attribute in any ancestor element
  * 3) layout handle name - first 1 or 2 parts (namespace is determined automatically)
  *
  * @param Varien_Simplexml_Element $node
  * @return string
  */
 public static function findTranslationModuleName(Varien_Simplexml_Element $node)
 {
     // Commented out code uses not yet implemented functionality.
     $result = (string) $node->getAttribute('module');
     if ($result) {
         //return Mage::getConfig()->getModuleConfig($result) ? $result : 'core';
         return $result;
     }
     foreach (array_reverse($node->xpath('ancestor::*[@module]')) as $element) {
         $result = (string) $element->getAttribute('module');
         if ($result) {
             //return Mage::getConfig()->getModuleConfig($result) ? $result : 'core';
             return $result;
         }
     }
     foreach ($node->xpath('ancestor-or-self::*[last()-1]') as $handle) {
         $name = Mage::getConfig()->determineOmittedNamespace($handle->getName(), true);
         if ($name) {
             //return Mage::getConfig()->getModuleConfig($name) ? $name : 'core';
             return $name;
         }
     }
     return 'Mage_Core';
 }
开发者ID:natxetee,项目名称:magento2,代码行数:35,代码来源:Layout.php

示例4: _parseGdataExceptionMessage

 /**
  * Parse Exception Response Body
  *
  * @param string $message Exception message to parse
  * @return string
  */
 protected function _parseGdataExceptionMessage($message)
 {
     $result = array();
     foreach (explode("\n", $message) as $row) {
         if (strip_tags($row) == $row) {
             $result[] = $row;
             continue;
         }
         try {
             $xml = new Varien_Simplexml_Element($row);
             $error = $xml->getAttribute('reason');
             $result[] = $error;
         } catch (Exception $e) {
             continue;
         }
     }
     return implode(" ", $result);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:24,代码来源:ItemsController.php

示例5: _sanitizeBlock

 /**
  * Replace "unsafe" types of blocks into Mage_Core_Block_Template and cut all their actions
  *
  * A "stub" template will be assigned for the blocks
  *
  * @param Varien_Simplexml_Element $node
  */
 protected static function _sanitizeBlock(Varien_Simplexml_Element $node)
 {
     $type = $node->getAttribute('type');
     if (!$type) {
         return;
         // we encountered a node with name "block", however it doesn't actually define any block...
     }
     if (self::_isParentSafe($node) || self::_isTypeSafe($type)) {
         return;
     }
     self::_overrideAttribute($node, 'template', 'Mage_DesignEditor::stub.phtml');
     self::_overrideAttribute($node, 'type', 'Mage_Core_Block_Template');
     self::_deleteNodes($node, 'action');
 }
开发者ID:nemphys,项目名称:magento2,代码行数:21,代码来源:Layout.php


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