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


PHP Mage_Core_Controller_Varien_Action::preDispatch方法代码示例

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


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

示例1: preDispatch

 /**
  * Controller pre-dispatch method
  *
  * @return Mage_XmlConnect_Controller_AdminAction
  */
 public function preDispatch()
 {
     Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         $value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
         if ($value) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     Mage_Core_Controller_Varien_Action::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
     if ($this->_isCheckCookieRequired()) {
         $this->_checkCookie();
     }
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:33,代码来源:AdminAction.php

示例2: preDispatch

 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea('frontend');
     parent::preDispatch();
     $this->getResponse()->setHeader('Cache-Control', 'no-cache, must-revalidate')->setHeader('Pragma', 'no-cache');
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:12,代码来源:Action.php

示例3: preDispatch

 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea($this->_currentArea);
     parent::preDispatch();
     // Layout functions
     if ($subD = Mage::registry('subdomain')) {
         Mage::getDesign()->setPackageName('default')->setTheme('shopper');
     }
     return $this;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:15,代码来源:Action.php

示例4: preDispatch

 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea($this->_currentArea);
     parent::preDispatch();
     // If IE6 redirect is enabled, send to ie6-rdirect cms page
     $configData = Mage::getStoreConfig('modal_header');
     $ie6support = $configData['settings']['ie6support'];
     if ($ie6support == 1) {
         if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.')) {
             Mage::getDesign()->setPackageName('base');
             Mage::getDesign()->setTheme('ie6');
             if (stripos($_SERVER['REQUEST_URI'], '/ie6-redirect/') == false) {
                 Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('ie6-redirect'))->sendResponse();
             }
         }
     }
     return $this;
 }
开发者ID:Rikisha,项目名称:proj,代码行数:23,代码来源:Action.php

示例5: preDispatch

 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea('frontend');
     parent::preDispatch();
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:11,代码来源:Action.php

示例6: preDispatch

 /**
  * Controller predispatch method
  *
  * @return Mage_Adminhtml_Controller_Action
  */
 public function preDispatch()
 {
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         if ($value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}")) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     $_isValidFormKey = true;
     $_isValidSecretKey = true;
     $_keyErrorMsg = '';
     if (Mage::getSingleton('admin/session')->isLoggedIn()) {
         if ($this->getRequest()->isPost()) {
             $_isValidFormKey = $this->_validateFormKey();
             $_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Form Key. Please refresh the page.');
         } elseif (Mage::getSingleton('adminhtml/url')->useSecretKey()) {
             $_isValidSecretKey = $this->_validateSecretKey();
             $_keyErrorMsg = Mage::helper('adminhtml')->__('Invalid Secret Key. Please refresh the page.');
         }
     }
     if (!$_isValidFormKey || !$_isValidSecretKey) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
             $this->getResponse()->setBody(Mage::helper('core')->jsonEncode(array('error' => true, 'message' => $_keyErrorMsg)));
         } else {
             $this->_redirect(Mage::getSingleton('admin/session')->getUser()->getStartupPageUrl());
         }
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) && !Mage::getConfig()->getNode('global/can_use_base_url')) {
         //$this->_checkUrlSettings();
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:53,代码来源:Action.php

示例7: preDispatch

 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     $this->getLayout()->setArea($this->_currentArea);
     parent::preDispatch();
     return $this;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:11,代码来源:Action.php

示例8: preDispatch

 /**
  * Controller predispatch method
  *
  * @return Mage_Adminhtml_Controller_Action
  */
 public function preDispatch()
 {
     Mage::getDesign()->setArea('adminhtml')->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     $this->getLayout()->setArea('adminhtml');
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     if ($this->getRequest()->isPost() && !$this->_validateFormKey() && Mage::getSingleton('admin/session')->isLoggedIn()) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
             $this->getResponse()->setBody(Zend_Json::encode(array('error' => true, 'error_msg' => Mage::helper('adminhtml')->__('Invalid Form Key'))));
         } else {
             $this->_redirectReferer();
         }
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) && !Mage::getConfig()->getNode('global/can_use_base_url')) {
         $this->_checkUrlSettings();
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:35,代码来源:Action.php

示例9: preDispatch

 /**
  * Controller predispatch method
  *
  * @return Mage_Backend_Controller_ActionAbstract
  */
 public function preDispatch()
 {
     Mage::app()->setCurrentStore('admin');
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     if (!$this->_processUrlKeys()) {
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if ($this->_isUrlChecked()) {
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('Mage_Backend_Model_Session')->getLocale())) {
         Mage::getSingleton('Mage_Backend_Model_Session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
开发者ID:,项目名称:,代码行数:26,代码来源:

示例10: preDispatch

 /**
  * Controller predispatch method
  *
  * @return Mage_Backend_Controller_ActionAbstract
  */
 public function preDispatch()
 {
     Mage::app()->setCurrentStore('admin');
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     parent::preDispatch();
     $_isValidFormKey = true;
     $_isValidSecretKey = true;
     $_keyErrorMsg = '';
     if (Mage::getSingleton('Mage_Backend_Model_Auth_Session')->isLoggedIn()) {
         if ($this->getRequest()->isPost()) {
             $_isValidFormKey = $this->_validateFormKey();
             $_keyErrorMsg = Mage::helper('Mage_Backend_Helper_Data')->__('Invalid Form Key. Please refresh the page.');
         } elseif (Mage::getSingleton('Mage_Backend_Model_Url')->useSecretKey()) {
             $_isValidSecretKey = $this->_validateSecretKey();
             $_keyErrorMsg = Mage::helper('Mage_Backend_Helper_Data')->__('Invalid Secret Key. Please refresh the page.');
         }
     }
     if (!$_isValidFormKey || !$_isValidSecretKey) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true);
         if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) {
             $this->getResponse()->setBody(Mage::helper('Mage_Core_Helper_Data')->jsonEncode(array('error' => true, 'message' => $_keyErrorMsg)));
         } else {
             $this->_redirect(Mage::getSingleton('Mage_Backend_Model_Url')->getStartupPageUrl());
         }
         return $this;
     }
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!$this->getFlag('', self::FLAG_IS_URLS_CHECKED) && !$this->getRequest()->getParam('forwarded') && !$this->_getSession()->getIsUrlNotice(true) && !Mage::getConfig()->getNode('global/can_use_base_url')) {
         $this->setFlag('', self::FLAG_IS_URLS_CHECKED, true);
     }
     if (is_null(Mage::getSingleton('Mage_Backend_Model_Session')->getLocale())) {
         Mage::getSingleton('Mage_Backend_Model_Session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:45,代码来源:ActionAbstract.php

示例11: preDispatch

 public function preDispatch()
 {
     Mage::getDesign()->setArea('adminhtml')->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default_clean'));
     $this->getLayout()->setArea('adminhtml');
     parent::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden');
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
     }
     return $this;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:12,代码来源:Action.php


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