本文整理汇总了PHP中Varien_Simplexml_Element::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Simplexml_Element::getParent方法的具体用法?PHP Varien_Simplexml_Element::getParent怎么用?PHP Varien_Simplexml_Element::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Simplexml_Element
的用法示例。
在下文中一共展示了Varien_Simplexml_Element::getParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logAction
/**
* Postdispatch action handler
*
*/
public function logAction()
{
if (!$this->_initAction) {
return;
}
$username = null;
$userId = null;
if (Mage::getSingleton('admin/session')->isLoggedIn()) {
$userId = Mage::getSingleton('admin/session')->getUser()->getId();
$username = Mage::getSingleton('admin/session')->getUser()->getUsername();
}
$errors = Mage::getModel('adminhtml/session')->getMessages()->getErrors();
$loggingEvent = Mage::getModel('enterprise_logging/event')->setData(array('ip' => Mage::helper('core/http')->getRemoteAddr(), 'x_forwarded_ip' => Mage::app()->getRequest()->getServer('HTTP_X_FORWARDED_FOR'), 'user' => $username, 'user_id' => $userId, 'is_success' => empty($errors), 'fullaction' => $this->_initAction, 'error_message' => implode("\n", array_map(create_function('$a', 'return $a->toString();'), $errors))));
if ($this->_actionName == 'denied') {
$_conf = $this->_config->getNode($this->_initAction);
if (!$_conf || !$this->_config->isActive($this->_initAction)) {
return;
}
$loggingEvent->setAction($_conf->action);
$loggingEvent->setEventCode($_conf->getParent()->getParent()->getName());
$loggingEvent->setInfo(Mage::helper('enterprise_logging')->__('Access denied'));
$loggingEvent->setIsSuccess(0);
$loggingEvent->save();
return;
}
if ($this->_skipNextAction) {
return;
}
$loggingEvent->setAction($this->_eventConfig->action);
$loggingEvent->setEventCode($this->_eventConfig->getParent()->getParent()->getName());
try {
$callback = isset($this->_eventConfig->post_dispatch) ? (string) $this->_eventConfig->post_dispatch : false;
$defaulfCallback = 'postDispatchGeneric';
$classMap = $this->_getCallbackFunction($callback, $this->_controllerActionsHandler, $defaulfCallback);
$handler = $classMap['handler'];
$callback = $classMap['callback'];
if (!$handler) {
return;
}
if ($handler->{$callback}($this->_eventConfig, $loggingEvent, $this)) {
/**
* Prepare additional info
*/
if ($this->getCollectedAdditionalData()) {
$loggingEvent->setAdditionalInfo($this->getCollectedAdditionalData());
}
$loggingEvent->save();
if ($eventId = $loggingEvent->getId()) {
foreach ($this->_eventChanges as $changes) {
if ($changes && ($changes->getOriginalData() || $changes->getResultData())) {
$changes->setEventId($eventId);
$changes->save();
}
}
}
}
} catch (Exception $e) {
Mage::logException($e);
}
}
示例2: updateMenu
public function updateMenu(Varien_Simplexml_Element $node)
{
$entityTypesCollection = $this->_getEntityTypesCollection();
if ($entityTypesCollection->getSize()) {
$children = $node->addChild('children');
$index = 0;
foreach ($entityTypesCollection as $entityType) {
$index += 10;
$menuItem = $children->addChild(sprintf('goodahead_etm_entity_type_%d', $entityType->getId()));
$menuItem->addChild('title', strlen($entityType->getEntityTypeName()) ? $entityType->getEntityTypeName() : $entityType->getEntityTypeCode());
$menuItem->addChild('sort_order', $index);
$menuItem->addChild('action', sprintf((string) $node->base_link, $entityType->getId()));
}
} else {
$nodeName = $node->getName();
unset($node->getParent()->{$nodeName});
}
}
示例3: _translateConfigRecursively
/**
* Enter description here ...
* @param Varien_Simplexml_Element $config
* @param array | null $fields
* @param string | null $module
*/
protected function _translateConfigRecursively($config, $fields = null, $module = null)
{
if ($fields && in_array($config->getName(), $fields)) {
$name = $config->getName();
$parent = $config->getParent();
$value = (string) $config;
$moduleName = $module ? $module : $this->_getModuleName();
$parent->{$name} = Mage::app()->getTranslator()->translate(array(new Mage_Core_Model_Translate_Expr($value, $moduleName)));
}
$fields = isset($config['translate']) ? explode(',', (string) $config['translate']) : null;
$module = isset($config['module']) ? (string) $config['module'] : null;
foreach ($config->children() as $key => $value) {
$this->_translateConfigRecursively($value, $fields, $module);
}
}
示例4: _isParentSafe
/**
* Whether parent node of specified node can be considered a safe container
*
* @param Varien_Simplexml_Element $node
* @return bool
*/
protected static function _isParentSafe(Varien_Simplexml_Element $node)
{
$parentAttributes = $node->getParent()->attributes();
if (isset($parentAttributes['name'])) {
if (!in_array($parentAttributes['name'], self::$_containerWhiteList)) {
return false;
}
}
return true;
}