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


PHP Zend_Controller_Request_Http::getStoreCodeFromPath方法代码示例

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


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

示例1: match

 public function match(Zend_Controller_Request_Http $request)
 {
     $active = Mage::getStoreConfig("dev/offline/mwdevtoolbar");
     if ($active == 1) {
         $storeenabled = Mage::getStoreConfig('dev/offline/enable', $request->getStoreCodeFromPath());
         if ($storeenabled) {
             Mage::getSingleton('core/session', array('name' => 'adminhtml'));
             $helper = Mage::helper('developertoolbar/data');
             if ($helper->checkAllowsIps() == 0) {
                 Mage::getSingleton('core/session', array('name' => 'front'));
                 $front = $this->getFront();
                 $response = $front->getResponse();
                 $response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
                 $response->setHeader('Status', '503 Service Temporarily Unavailable');
                 $response->setHeader('Retry-After', '5000');
                 $response->setBody(html_entity_decode(Mage::getStoreConfig('dev/offline/message', $request->getStoreCodeFromPath()), ENT_QUOTES, "utf-8"));
                 $response->sendHeaders();
                 $response->outputBody();
                 exit;
             } else {
                 $showreminder = Mage::getStoreConfig('dev/offline/reminder', $request->getStoreCodeFromPath());
                 if ($showreminder) {
                     $front = $this->getFront();
                     $response = $front->getResponse()->clearBody();
                     $response = $front->getResponse()->appendBody('<div style="height:12px; background:red; color: white; position:relative; width:100%;padding:3px; z-index:100000;text-trasform:capitalize;">Offline</div>');
                 }
             }
         }
     }
     return parent::match($request);
 }
开发者ID:ujwalasawant,项目名称:magento,代码行数:31,代码来源:Standard.php

示例2: match

 public function match(Zend_Controller_Request_Http $request)
 {
     $helper = Mage::helper('BalkeTechnologies_StoreMaintenance');
     $storeCode = $request->getStoreCodeFromPath();
     $enabled = $helper->getConfig('enabled', $storeCode);
     // module enabled?
     if (1 == $enabled) {
         $allowedIPsString = $helper->getConfig('allowedIPs', $storeCode);
         // remove spaces from string
         $allowedIPsString = preg_replace('/ /', '', $allowedIPsString);
         $allowedIPs = array();
         if ('' !== trim($allowedIPsString)) {
             $allowedIPs = explode(',', $allowedIPsString);
         }
         $currentIP = $_SERVER['REMOTE_ADDR'];
         $allowFrontendForAdmins = $helper->getConfig('allowFrontendForAdmins', $storeCode);
         $adminIp = null;
         if (1 == $allowFrontendForAdmins) {
             //get the admin session
             Mage::getSingleton('core/session', array('name' => 'adminhtml'));
             //verify if the user is logged in to the backend
             $adminSession = Mage::getSingleton('admin/session');
             if ($adminSession->isLoggedIn()) {
                 //do stuff
                 $adminIp = $adminSession['_session_validator_data']['remote_addr'];
             }
         }
         if ($currentIP === $adminIp) {
             // current user is logged in as admin
             $this->__log('Access granted for admin with IP: ' . $currentIP . ' and store ' . $storeCode, 2, $storeCode);
         } else {
             // current user allowed to access website?
             if (!in_array($currentIP, $allowedIPs)) {
                 $this->__log('Access denied  for IP: ' . $currentIP . ' and store ' . $storeCode, 1, $storeCode);
                 $maintenancePage = trim($helper->getConfig('maintenancePage', $storeCode));
                 // if custom maintenance page is defined in backend, display this one
                 if ('' !== $maintenancePage) {
                     Mage::getSingleton('core/session', array('name' => 'front'));
                     $response = $this->getFront()->getResponse();
                     $response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
                     $response->setHeader('Status', '503 Service Temporarily Unavailable');
                     $response->setHeader('Retry-After', '5000');
                     $response->setBody($maintenancePage);
                     $response->sendHeaders();
                     $response->outputBody();
                 }
                 exit;
             } else {
                 $this->__log('Access granted for IP: ' . $currentIP . ' and store ' . $storeCode, 2, $storeCode);
             }
         }
     }
     return parent::match($request);
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:54,代码来源:Standard.php

示例3: match

 public function match(Zend_Controller_Request_Http $request)
 {
     $helper = Mage::helper('Mdl_UnderConstruction');
     $storeCode = $request->getStoreCodeFromPath();
     $enabled = $helper->getConfig('enabled', $storeCode);
     if (1 == $enabled) {
         $allowedIPsString = $helper->getConfig('allowedIPs', $storeCode);
         $allowedIPsString = preg_replace('/ /', '', $allowedIPsString);
         $allowedIPs = array();
         if ('' !== trim($allowedIPsString)) {
             $allowedIPs = explode(',', $allowedIPsString);
         }
         $currentIP = $_SERVER['REMOTE_ADDR'];
         $allowFrontendForAdmins = $helper->getConfig('allowFrontendForAdmins', $storeCode);
         $adminIp = null;
         if (1 == $allowFrontendForAdmins) {
             Mage::getSingleton('core/session', array('name' => 'adminhtml'));
             $adminSession = Mage::getSingleton('admin/session');
             if ($adminSession->isLoggedIn()) {
                 $adminIp = $adminSession['_session_validator_data']['remote_addr'];
             }
         }
         if ($currentIP === $adminIp) {
             $this->__log('Access granted for admin with IP: ' . $currentIP . ' and store ' . $storeCode, 2, $storeCode);
         } else {
             if (!in_array($currentIP, $allowedIPs)) {
                 $this->__log('Access denied  for IP: ' . $currentIP . ' and store ' . $storeCode, 1, $storeCode);
                 Mage::getSingleton('core/session', array('name' => 'front'));
                 $response = $this->getFront()->getResponse();
                 $response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
                 $response->setHeader('Status', '503 Service Temporarily Unavailable');
                 $response->setHeader('Retry-After', '5000');
                 $response->setBody(Mage::app()->getLayout()->createBlock('core/template')->setTemplate('underconstruction/underconstruction.phtml')->toHtml());
                 $response->sendHeaders();
                 $response->outputBody();
                 //  }
                 exit;
             } else {
                 $this->__log('Access granted for IP: ' . $currentIP . ' and store ' . $storeCode, 2, $storeCode);
             }
         }
     }
     return parent::match($request);
 }
开发者ID:sshegde123,项目名称:wmp8,代码行数:44,代码来源:Standard.php

示例4: _sendCustomMessage

 /**
  * Send a custom message, configured in the admin panel.
  *
  * @param Zend_Controller_Request_Http $request
  */
 protected function _sendCustomMessage(Zend_Controller_Request_Http $request)
 {
     Mage::getSingleton('core/session', array('name' => 'front'));
     /** @var $front Mage_Core_Controller_Varien_Front */
     $front = $this->getFront();
     /** @var $response Mage_Core_Controller_Response_Http */
     $response = $front->getResponse();
     $response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
     $response->setHeader('Status', '503 Service Temporarily Unavailable');
     $response->setHeader('Retry-After', '5000');
     $response->setBody(html_entity_decode(Mage::getStoreConfig('dev/offlinemaintenance/message', $request->getStoreCodeFromPath()), ENT_QUOTES, "utf-8"));
     $response->sendHeaders();
     $response->outputBody();
     // We are done, we can exit now.
     exit;
 }
开发者ID:kirchbergerknorr,项目名称:Ho_OfflineMaintenance,代码行数:21,代码来源:Standard.php

示例5: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param Zend_Controller_Request_Http $request
  * @return bool
  */
 public function match(Zend_Controller_Request_Http $request)
 {
     if (Mage::helper('core')->isModuleEnabled('ArtsOnIT_OfflineMaintenance')) {
         $storeenabled = Mage::getStoreConfig('offlineMaintenance/settings/enabled', $request->getStoreCodeFromPath());
         if ($storeenabled) {
             Mage::getSingleton('core/session', array('name' => 'adminhtml'));
             if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
                 Mage::getSingleton('core/session', array('name' => 'front'));
                 $front = $this->getFront();
                 $response = $front->getResponse();
                 $response->setHeader('HTTP/1.1', '503 Service Temporarily Unavailable');
                 $response->setHeader('Status', '503 Service Temporarily Unavailable');
                 $response->setHeader('Retry-After', '5000');
                 $response->setBody(html_entity_decode(Mage::getStoreConfig('offlineMaintenance/settings/message', $request->getStoreCodeFromPath()), ENT_QUOTES, "utf-8"));
                 $response->sendHeaders();
                 $response->outputBody();
                 exit;
             } else {
                 $showreminder = Mage::getStoreConfig('offlineMaintenance/settings/showreminder', $request->getStoreCodeFromPath());
                 if ($showreminder) {
                     $front = $this->getFront();
                     $response = $front->getResponse()->appendBody('<div style="height:12px; background:red; color: white; position:relative; width:100%;padding:3px; z-index:100000;text-trasform:capitalize;">Offline</div>');
                 }
             }
         }
     }
     if (!Mage::helper('smvendors')->enableVendorSlug()) {
         return parent::match($request);
     }
     //checking before even try to find out that current module
     //should use this router
     if (!$this->_beforeModuleMatch()) {
         return false;
     }
     $this->fetchDefault();
     $front = $this->getFront();
     $path = trim($request->getPathInfo(), '/');
     if (!$path) {
         return parent::match($request);
     }
     $p = explode('/', $path);
     if (strpos($p[0], '.html') !== false) {
         return parent::match($request);
     }
     $vendorCollection = Mage::getResourceModel('smvendors/vendor_collection')->addFieldToFilter('vendor_slug', $p[0]);
     if ($vendorCollection->count() && ($vendor = $vendorCollection->getFirstItem()) && $vendor->getId()) {
         Mage::register('current_vendor', $vendor, true);
         Mage::register('in_vendor', true, true);
         /**
          * Searching router args by module name from route using it as key
          */
         $frontName = 'vendor';
         $modules = $this->getModuleByFrontName($frontName);
         if ($modules === false) {
             continue;
         }
         /**
          * Going through modules to find appropriate controller
          */
         $found = false;
         foreach ($modules as $realModule) {
             $request->setRouteName($this->getRouteByFrontName($frontName));
             // get controller name
             if (!empty($p[1])) {
                 $controller = $p[1];
             } else {
                 //                    $controller = $front->getDefault('controller');
                 $controller = 'products';
                 $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, ltrim($request->getOriginalPathInfo(), '/'));
             }
             // get action name
             if ($realModule == 'SM_Vendors') {
                 $action = !empty($p[2]) ? $p[2] : 'index';
             } else {
                 $action = !empty($p[2]) ? $p[2] : $front->getDefault('action');
             }
             //checking if this place should be secure
             $this->_checkShouldBeSecure($request, '/' . $frontName . '/' . $controller . '/' . $action);
             $controllerClassName = $this->_validateControllerClassName($realModule, $controller);
             if (!$controllerClassName) {
                 continue;
             }
             // instantiate controller class
             $controllerInstance = Mage::getControllerInstance($controllerClassName, $request, $front->getResponse());
             if (!$controllerInstance->hasAction($action)) {
                 continue;
             }
             $found = true;
             break;
         }
         // set values only after all the checks are done
         $request->setModuleName($frontName);
         $request->setControllerName($controller);
         $request->setActionName($action);
//.........这里部分代码省略.........
开发者ID:shashankkanungo,项目名称:magento,代码行数:101,代码来源:SM_Vendors_Controller_Router_Vendor.php


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