本文整理汇总了PHP中Varien_Simplexml_Element::getBlockName方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Element::getBlockName方法的具体用法?PHP Varien_Simplexml_Element::getBlockName怎么用?PHP Varien_Simplexml_Element::getBlockName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Simplexml_Element
的用法示例。
在下文中一共展示了Varien_Simplexml_Element::getBlockName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _runAction
/**
* If all ifconfig conditions are ok then action runs
*
* @param Varien_Simplexml_Element $node
* @param Varien_Simplexml_Element $parent
* @return Codnitive_Extifcon_Model_Core_Layout
*/
private function _runAction($node, $parent)
{
$method = (string) $node['method'];
if (!empty($node['block'])) {
$parentName = (string) $node['block'];
} else {
$parentName = $parent->getBlockName();
}
$_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
Varien_Profiler::start($_profilerKey);
if (!empty($parentName)) {
$block = $this->getBlock($parentName);
}
if (!empty($block)) {
$args = (array) $node->children();
unset($args['@attributes']);
foreach ($args as $key => $arg) {
if ($arg instanceof Mage_Core_Model_Layout_Element) {
if (isset($arg['helper'])) {
$helperName = explode('/', (string) $arg['helper']);
$helperMethod = array_pop($helperName);
$helperName = implode('/', $helperName);
$arg = $arg->asArray();
unset($arg['@']);
$args[$key] = call_user_func_array(array(Mage::helper($helperName), $helperMethod), $arg);
} else {
/**
* if there is no helper we hope that this is assoc array
*/
$arr = array();
foreach ($arg as $subkey => $value) {
$arr[(string) $subkey] = $value->asArray();
}
if (!empty($arr)) {
$args[$key] = $arr;
}
}
}
}
if (isset($node['json'])) {
$json = explode(' ', (string) $node['json']);
foreach ($json as $arg) {
$args[$arg] = Mage::helper('core')->jsonDecode($args[$arg]);
}
}
$this->_translateLayoutNode($node, $args);
call_user_func_array(array($block, $method), $args);
}
Varien_Profiler::stop($_profilerKey);
return $this;
}
示例2: _generateAction
/**
* Convert an action node into a method call on the parent block
*
* @param Varien_Simplexml_Element $node
* @param Varien_Simplexml_Element $parent
*
* @return Aoe_Layout_Model_Layout
*/
protected function _generateAction($node, $parent)
{
if ($node instanceof Mage_Core_Model_Layout_Element) {
if (!$this->checkConditionals($node)) {
return $this;
}
}
$method = (string) $node['method'];
if (!empty($node['block'])) {
$parentName = (string) $node['block'];
} else {
$parentName = $parent->getBlockName();
}
$_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
Varien_Profiler::start($_profilerKey);
if (!empty($parentName)) {
$block = $this->getBlock($parentName);
}
if (!empty($block)) {
$args = (array) $node->children();
$jsonArgs = isset($node['json']) ? explode(' ', (string) $node['json']) : [];
$jsonHelper = Mage::helper('core');
$translateArgs = isset($node['translate']) ? explode(' ', (string) $node['translate']) : [];
$translateHelper = Mage::helper(isset($node['module']) ? (string) $node['module'] : 'core');
$args = $this->processActionArgs($args, $jsonArgs, $jsonHelper, $translateArgs, $translateHelper);
call_user_func_array([$block, $method], $args);
}
Varien_Profiler::stop($_profilerKey);
return $this;
}
示例3: _generateAction
/**
* Checks ifconfig and conditions to run action or not
*
* @param Varien_Simplexml_Element $node
* @param Varien_Simplexml_Element $parent
* @return Codnitive_Extifcon_Model_Core_Layout
*/
protected function _generateAction($node, $parent)
{
$compiler = Mage::getModel('dgttheme/system_layout_compiler');
if (isset($node['ifconfig']) && ($configPath = (string) $node['ifconfig'])) {
$condition = true;
if (isset($node['condition'])) {
$condition = $compiler->getXmlCondition($compiler->spaceRemover($node['condition']));
}
$config = $compiler->getAdminConfig($compiler->spaceRemover($configPath));
if ($config !== $condition) {
return $this;
}
}
$method = (string) $node['method'];
if (!empty($node['block'])) {
$parentName = (string) $node['block'];
} else {
$parentName = $parent->getBlockName();
}
$_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
Varien_Profiler::start($_profilerKey);
if (!empty($parentName)) {
$block = $this->getBlock($parentName);
}
if (!empty($block)) {
$args = (array) $node->children();
unset($args['@attributes']);
foreach ($args as $key => $arg) {
if ($arg instanceof Mage_Core_Model_Layout_Element) {
if (isset($arg['helper'])) {
$helperName = explode('/', (string) $arg['helper']);
$helperMethod = array_pop($helperName);
$helperName = implode('/', $helperName);
$arg = $arg->asArray();
unset($arg['@']);
$args[$key] = call_user_func_array(array(Mage::helper($helperName), $helperMethod), $arg);
} else {
/**
* if there is no helper we hope that this is assoc array
*/
$arr = array();
foreach ($arg as $subkey => $value) {
$arr[(string) $subkey] = $value->asArray();
}
if (!empty($arr)) {
$args[$key] = $arr;
}
}
}
}
if (isset($node['json'])) {
$json = explode(' ', (string) $node['json']);
foreach ($json as $arg) {
$args[$arg] = Mage::helper('core')->jsonDecode($args[$arg]);
}
}
$this->_translateLayoutNode($node, $args);
call_user_func_array(array($block, $method), $args);
}
Varien_Profiler::stop($_profilerKey);
return $this;
}
示例4: _generateAction
/**
* Enter description here...
*
* @param Varien_Simplexml_Element $node
* @param Varien_Simplexml_Element $parent
* @return Mage_Core_Model_Layout
*/
protected function _generateAction($node, $parent)
{
if (isset($node['ifconfig']) && ($configPath = (string) $node['ifconfig'])) {
if (!Mage::getStoreConfigFlag($configPath)) {
return $this;
}
}
$method = (string) $node['method'];
if (!empty($node['block'])) {
$parentName = (string) $node['block'];
} else {
$parentName = $parent->getBlockName();
}
$_profilerKey = 'BLOCK_ACTION:' . $parentName . '>' . $method;
Magento_Profiler::start($_profilerKey);
if (!empty($parentName)) {
$block = $this->getBlock($parentName);
}
if (!empty($block)) {
$args = (array) $node->children();
unset($args['@attributes']);
foreach ($args as $key => $arg) {
if ($arg instanceof Mage_Core_Model_Layout_Element) {
if (isset($arg['helper'])) {
$helper = (string) $arg['helper'];
if (strpos($helper, '::') === false) {
$helperName = explode('/', $helper);
$helperMethod = array_pop($helperName);
$helperName = implode('/', $helperName);
} else {
list($helperName, $helperMethod) = explode('::', $helper);
}
$arg = $arg->asArray();
unset($arg['@']);
$args[$key] = call_user_func_array(array(Mage::helper($helperName), $helperMethod), $arg);
} else {
/**
* if there is no helper we hope that this is assoc array
*/
$arr = array();
foreach ($arg as $subkey => $value) {
$arr[(string) $subkey] = $value->asArray();
}
if (!empty($arr)) {
$args[$key] = $arr;
}
}
}
}
if (isset($node['json'])) {
$json = explode(' ', (string) $node['json']);
foreach ($json as $arg) {
$args[$arg] = Mage::helper('Mage_Core_Helper_Data')->jsonDecode($args[$arg]);
}
}
$this->_translateLayoutNode($node, $args);
call_user_func_array(array($block, $method), $args);
}
Magento_Profiler::stop($_profilerKey);
return $this;
}
示例5: _generateAction
/**
* Modified core generate action method
*
* @param Varien_Simplexml_Element $node
* @param Varien_Simplexml_Element $parent
* @return Mage_Core_Model_Layout
*/
protected function _generateAction($node, $parent)
{
if (isset($node['ifconfig']) && ($configPath = (string) $node['ifconfig'])) {
$ifConfig = Mage::getStoreConfigFlag($configPath);
$nodeArray = (array) $node;
$advIfconfig = null;
$dependsCheck = false;
$requiredDepends = false;
if (isset($nodeArray['adv_ifconfig'])) {
$advIfconfig = (array) $nodeArray['adv_ifconfig'];
if (isset($advIfconfig['depends_check'])) {
$dependsCheck = $advIfconfig['depends_check'];
}
if (isset($advIfconfig['required_depends'])) {
$requiredDepends = $advIfconfig['required_depends'];
}
}
if ($ifConfig && $dependsCheck) {
if ($dependsCheck == 1 || $dependsCheck == 'tree') {
$configPath = explode('/', $configPath);
$ifConfig = $ifConfig && Mage::helper('advifconfig')->checkSystemConfigNodeDepends($configPath[0], $configPath[1], $configPath[2], $ifConfig);
}
if (($dependsCheck == 1 || $dependsCheck == 'required') && $requiredDepends) {
$additionalDepends = array_map('trim', explode(',', $requiredDepends));
foreach ($additionalDepends as $depend) {
$ifConfig = $ifConfig && Mage::getStoreConfigFlag($depend);
}
}
}
if (!$ifConfig) {
return $this;
}
if (isset($advIfconfig['custom_rules'])) {
$data = array_merge(array('ifconfig' => false), (array) $advIfconfig['custom_rules']);
$data = new Varien_Object($data);
Mage::dispatchEvent('adv_ifconfig_custom_rules', $data);
if (!$data->getIfconfig()) {
return $this;
}
}
}
$method = (string) $node['method'];
if (!empty($node['block'])) {
$parentName = (string) $node['block'];
} else {
$parentName = $parent->getBlockName();
}
$_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
Varien_Profiler::start($_profilerKey);
if (!empty($parentName)) {
$block = $this->getBlock($parentName);
}
if (!empty($block)) {
$args = (array) $node->children();
unset($args['@attributes']);
if (isset($args['adv_ifconfig'])) {
unset($args['adv_ifconfig']);
}
foreach ($args as $key => $arg) {
if ($arg instanceof Mage_Core_Model_Layout_Element) {
if (isset($arg['helper'])) {
$helperName = explode('/', (string) $arg['helper']);
$helperMethod = array_pop($helperName);
$helperName = implode('/', $helperName);
$arg = $arg->asArray();
unset($arg['@']);
$args[$key] = call_user_func_array(array(Mage::helper($helperName), $helperMethod), $arg);
} else {
/**
* if there is no helper we hope that this is assoc array
*/
$arr = array();
foreach ($arg as $subkey => $value) {
$arr[(string) $subkey] = $value->asArray();
}
if (!empty($arr)) {
$args[$key] = $arr;
}
}
}
}
if (isset($node['json'])) {
$json = explode(' ', (string) $node['json']);
foreach ($json as $arg) {
$args[$arg] = Mage::helper('core')->jsonDecode($args[$arg]);
}
}
$this->_translateLayoutNode($node, $args);
call_user_func_array(array($block, $method), $args);
}
Varien_Profiler::stop($_profilerKey);
return $this;
}
示例6: _generateAction
/**
* Enter description here...
*
* @param Varien_Simplexml_Element $node
* @param Varien_Simplexml_Element $parent
* @return Mage_Core_Model_Layout
*/
protected function _generateAction($node, $parent)
{
if (isset($node['ifconfig']) && ($configPath = (string) $node['ifconfig'])) {
if (!Mage::getStoreConfigFlag($configPath)) {
return $this;
}
}
$method = (string) $node['method'];
if (!empty($node['block'])) {
$parentName = (string) $node['block'];
} else {
$parentName = $parent->getBlockName();
}
$_profilerKey = 'BLOCK ACTION: ' . $parentName . ' -> ' . $method;
Varien_Profiler::start($_profilerKey);
if (!empty($parentName)) {
$block = $this->getBlock($parentName);
}
if (!empty($block)) {
$args = (array) $node->children();
unset($args['@attributes']);
foreach ($args as $key => $arg) {
if ($arg instanceof Mage_Core_Model_Layout_Element) {
if (isset($arg['helper'])) {
$helperName = explode('/', (string) $arg['helper']);
$helperMethod = array_pop($helperName);
$helperName = implode('/', $helperName);
$arg = $arg->asArray();
unset($arg['@']);
$args[$key] = call_user_func_array(array(Mage::helper($helperName), $helperMethod), $arg);
}
}
}
if (isset($node['json'])) {
$json = explode(' ', (string) $node['json']);
foreach ($json as $arg) {
$args[$arg] = Zend_Json::decode($args[$arg]);
}
}
$this->_translateLayoutNode($node, $args);
call_user_func_array(array($block, $method), $args);
}
Varien_Profiler::stop($_profilerKey);
return $this;
}