本文整理汇总了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;
}
示例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';
}
示例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';
}
示例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);
}
示例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');
}