當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。