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


PHP Mage_Core_Controller_Request_Http::getRequestString方法代码示例

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


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

示例1: testGetRequestString

 public function testGetRequestString()
 {
     $this->assertEmpty($this->_model->getRequestString());
     $this->_model->setRequestUri('test');
     $this->_model->setPathInfo();
     $this->assertEquals('test', $this->_model->getRequestString());
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:7,代码来源:RequestHttp.php

示例2: getSearchQuery

 /**
  * @param Mage_Core_Controller_Request_Http $request
  *
  * @return string $query
  */
 private function getSearchQuery(Mage_Core_Controller_Request_Http $request)
 {
     $maxQueryLength = (int) Mage::getStoreConfig('catalog/search/max_query_length') > 0 ? (int) Mage::getStoreConfig('catalog/search/max_query_length') : 128;
     $query = preg_replace('/(\\W|html|php)+/', ' ', $request->getRequestString());
     if (count($request->getQuery()) > 0) {
         $query .= implode(' ', $request->getQuery());
     }
     return substr($query, 0, $maxQueryLength);
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:14,代码来源:Route.php

示例3: isAllowed

 /**
  * Checks whether route/controller action is allowed to be reached depending on initializer state
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @return bool
  */
 public function isAllowed(Mage_Core_Controller_Request_Http $request)
 {
     if ($this->isDataCollected()) {
         return true;
     }
     if (count($this->_restrictions) == 1) {
         $initializerAclNode = Mage::getConfig()->getNode('default/xcom/initializer_acl');
         if ($initializerAclNode) {
             $this->_restrictions += $initializerAclNode->asArray();
         }
     }
     $parts = array('module' => str_replace('_adminhtml', '', strtolower($request->getControllerModule())), 'controller' => strtolower($request->getControllerName()), 'action' => strtolower($request->getActionName()), 'urn' => trim(strtolower($request->getRequestString()), '/'));
     $moduleParts = explode('_', $parts['module']);
     $parts['namespace'] = $moduleParts[0];
     $this->_currentMatch = array('scopeWeight' => 0, 'directionWeight' => 2, 'urn' => '');
     foreach ($this->_restrictions as $issuer => $rules) {
         if ($issuer != '*') {
             if (!Mage::getResourceModel('xcom_initializer/job')->hasJobsLeft($issuer)) {
                 continue;
             }
         }
         foreach (array('allowed', 'denied') as $direction) {
             if (empty($rules[$direction])) {
                 continue;
             }
             foreach ($rules[$direction] as $scope => $values) {
                 if (!is_array($values)) {
                     Mage::log(printf('Invalid configuration for scope node %s', $scope));
                     continue;
                 }
                 foreach ($values as $value) {
                     $value = strtolower(is_array($value) ? current($value) : $value);
                     $hasMatched = false;
                     if (empty($value)) {
                         Mage::log(printf('Empty node inside scope %s', $scope));
                         continue;
                     }
                     switch (strtolower($scope)) {
                         case 'namespace':
                             if ('denied' == $direction) {
                                 $hasMatched = $value == $parts['namespace'];
                             } else {
                                 Mage::log('<namespace> node allowed in <denied> section only');
                             }
                             break;
                         case 'action':
                         case 'controller':
                             $pattern = '(?P<module>.+)/(?P<controller>.+)';
                             $scopes = array('module', 'controller');
                             if ('action' == $scope) {
                                 $pattern .= '::(?P<action>.+)';
                                 $scopes[] = 'action';
                             }
                             if (preg_match('#' . $pattern . '#', $value, $matches)) {
                                 // Split value into module and controller (and action, if it's 'action' rule)
                                 $hasMatched = true;
                                 foreach ($scopes as $_scope) {
                                     if (!in_array($matches[$_scope], array('*', $parts[$_scope]))) {
                                         // Value part doesn't match corresponding part of current request or '*'
                                         $hasMatched = false;
                                         break;
                                     }
                                 }
                             } else {
                                 Mage::log(printf('Invalid action/controller definition: %s. Allowed pattern: namespace_module/controller::action', $value));
                             }
                             break;
                         case 'module':
                             $hasMatched = $value == $parts['module'];
                             break;
                         case 'urn':
                             $value = trim($value, '/');
                             $hasMatched = 0 === strpos($parts['urn'], $value);
                             break;
                         default:
                             Mage::log(printf('Unknown rule scope: %s', $scope));
                     }
                     if ($hasMatched) {
                         $this->_matched($scope, $direction, 'urn' == $scope ? $value : '');
                     }
                 }
             }
         }
     }
     return $this->_isAllowed();
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:92,代码来源:Initializer.php

示例4: _applyCustomMaxAgeFromDb

 /**
  * Apply custom Cache-Control: max-age from db
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @param Mage_Core_Controller_Response_Http $response
  */
 protected function _applyCustomMaxAgeFromDb(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response)
 {
     if (!$this->messagesToShow) {
         // apply custom max-age from db
         $urls = array($request->getRequestString());
         $alias = $request->getAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS);
         if ($alias) {
             $urls[] = $alias;
         }
         /** @var $customUrlModel Aoe_Static_Model_CustomUrl */
         $customUrlModel = Mage::getModel('aoestatic/customUrl');
         $customUrlModel->setStoreId(Mage::app()->getStore()->getId());
         $customUrlModel->loadByRequestPath($urls);
         if ($customUrlModel->getId() && $customUrlModel->getMaxAge()) {
             $response->setHeader('Cache-Control', 'max-age=' . (int) $customUrlModel->getMaxAge(), true);
             $response->setHeader('X-Magento-Lifetime', (int) $customUrlModel->getMaxAge(), true);
             $response->setHeader('aoestatic', 'cache', true);
         }
     }
 }
开发者ID:kubaceg,项目名称:Aoe_Static,代码行数:26,代码来源:Observer.php


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