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


PHP RequestInterface::getQuery方法代码示例

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


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

示例1: getCurrentApp

 /**
  * Get Backend app based on its name
  *
  * @return BackendApp|null
  */
 public function getCurrentApp()
 {
     $appName = $this->request->getQuery('app');
     if ($appName && isset($this->backendApps[$appName])) {
         return $this->backendApps[$appName];
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:BackendAppList.php

示例2: getSid

 /**
  * @param SessionManagerInterface $session
  * @return string
  */
 public function getSid(SessionManagerInterface $session)
 {
     $sidKey = null;
     $useSidOnFrontend = $this->scopeConfig->getValue(self::XML_PATH_USE_FRONTEND_SID, $this->_scopeType);
     if ($useSidOnFrontend && $this->request->getQuery($this->getSessionIdQueryParam($session), false) && $this->urlBuilder->isOwnOriginUrl()) {
         $sidKey = $this->request->getQuery($this->getSessionIdQueryParam($session));
     }
     return $sidKey;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:SidResolver.php

示例3: testGetSid

 /**
  * @param mixed $sid
  * @param bool $useFrontedSid
  * @param bool $isOwnOriginUrl
  * @param mixed $testSid
  * @dataProvider dataProviderTestGetSid
  */
 public function testGetSid($sid, $useFrontedSid, $isOwnOriginUrl, $testSid)
 {
     $this->scopeConfig->expects($this->any())->method('getValue')->with(\Magento\Framework\Session\SidResolver::XML_PATH_USE_FRONTEND_SID, \Magento\Store\Model\ScopeInterface::SCOPE_STORE)->will($this->returnValue($useFrontedSid));
     $this->urlBuilder->expects($this->any())->method('isOwnOriginUrl')->will($this->returnValue($isOwnOriginUrl));
     if ($testSid) {
         $this->request->getQuery()->set($this->model->getSessionIdQueryParam($this->session), $testSid);
     }
     $this->assertEquals($sid, $this->model->getSid($this->session));
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:SidResolverTest.php

示例4: setRouteParams

 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function setRouteParams(array $data, $unsetOldParams = true)
 {
     if (isset($data['_type'])) {
         $this->setType($data['_type']);
         unset($data['_type']);
     }
     if (isset($data['_forced_secure'])) {
         $this->setSecure((bool) $data['_forced_secure']);
         $this->setSecureIsForced(true);
         unset($data['_forced_secure']);
     } elseif (isset($data['_secure'])) {
         $this->setSecure((bool) $data['_secure']);
         unset($data['_secure']);
     }
     if (isset($data['_absolute'])) {
         unset($data['_absolute']);
     }
     if ($unsetOldParams) {
         $this->unsetData('route_params');
     }
     if (isset($data['_current'])) {
         if (is_array($data['_current'])) {
             foreach ($data['_current'] as $key) {
                 if (array_key_exists($key, $data) || !$this->request->getUserParam($key)) {
                     continue;
                 }
                 $data[$key] = $this->request->getUserParam($key);
             }
         } elseif ($data['_current']) {
             foreach ($this->request->getUserParams() as $key => $value) {
                 if (array_key_exists($key, $data) || $this->getRouteParam($key)) {
                     continue;
                 }
                 $data[$key] = $value;
             }
             foreach ($this->request->getQuery() as $key => $value) {
                 $this->queryParamsResolver->setQueryParam($key, $value);
             }
         }
         unset($data['_current']);
     }
     if (isset($data['_use_rewrite'])) {
         unset($data['_use_rewrite']);
     }
     foreach ($data as $key => $value) {
         $this->setRouteParam($key, $value);
     }
     return $this;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:54,代码来源:RouteParamsResolver.php

示例5: setRouteParams

 /**
  * {@inheritdoc}
  */
 public function setRouteParams(array $data, $unsetOldParams = true)
 {
     if (isset($data['_type'])) {
         $this->setType($data['_type']);
         unset($data['_type']);
     }
     if (isset($data['_scope'])) {
         $this->setScope($data['_scope']);
         unset($data['_scope']);
     }
     if (isset($data['_forced_secure'])) {
         $this->setSecure((bool) $data['_forced_secure']);
         $this->setSecureIsForced(true);
         unset($data['_forced_secure']);
     } elseif (isset($data['_secure'])) {
         $this->setSecure((bool) $data['_secure']);
         unset($data['_secure']);
     }
     if (isset($data['_absolute'])) {
         unset($data['_absolute']);
     }
     if ($unsetOldParams) {
         $this->unsetData('route_params');
     }
     if (isset($data['_current'])) {
         if (is_array($data['_current'])) {
             foreach ($data['_current'] as $key) {
                 if (array_key_exists($key, $data) || !$this->_request->getUserParam($key)) {
                     continue;
                 }
                 $data[$key] = $this->_request->getUserParam($key);
             }
         } elseif ($data['_current']) {
             foreach ($this->_request->getUserParams() as $key => $value) {
                 if (array_key_exists($key, $data) || $this->getRouteParam($key)) {
                     continue;
                 }
                 $data[$key] = $value;
             }
             foreach ($this->_request->getQuery() as $key => $value) {
                 $this->_queryParamsResolver->setQueryParam($key, $value);
             }
         }
         unset($data['_current']);
     }
     if (isset($data['_use_rewrite'])) {
         unset($data['_use_rewrite']);
     }
     if (isset($data['_scope_to_url']) && (bool) $data['_scope_to_url'] === true) {
         $store = $this->getScope() ?: $this->_storeManager->getStore();
         if (!$this->_scopeConfig->getValue(\Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getScope()) && !$this->_storeManager->hasSingleStore()) {
             $this->_queryParamsResolver->setQueryParam('___store', $store->getCode());
         }
     }
     unset($data['_scope_to_url']);
     foreach ($data as $key => $value) {
         $this->setRouteParam($key, $value);
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:63,代码来源:RouteParamsResolver.php

示例6: getCurrentUrl

 /**
  * Retrieve current url for store
  *
  * @param bool|string $fromStore
  * @return string
  */
 public function getCurrentUrl($fromStore = true)
 {
     $sidQueryParam = $this->_sidResolver->getSessionIdQueryParam($this->_getSession());
     $requestString = $this->_url->escape(ltrim($this->_request->getRequestString(), '/'));
     $storeUrl = $this->_storeManager->getStore()->isCurrentlySecure() ? $this->getUrl('', array('_secure' => true)) : $this->getUrl('');
     if (!filter_var($storeUrl, FILTER_VALIDATE_URL)) {
         return $storeUrl;
     }
     $storeParsedUrl = parse_url($storeUrl);
     $storeParsedQuery = array();
     if (isset($storeParsedUrl['query'])) {
         parse_str($storeParsedUrl['query'], $storeParsedQuery);
     }
     $currQuery = $this->_request->getQuery();
     if (isset($currQuery[$sidQueryParam]) && !empty($currQuery[$sidQueryParam]) && $this->_getSession()->getSessionIdForHost($storeUrl) != $currQuery[$sidQueryParam]) {
         unset($currQuery[$sidQueryParam]);
     }
     foreach ($currQuery as $key => $value) {
         $storeParsedQuery[$key] = $value;
     }
     if (!$this->isUseStoreInUrl()) {
         $storeParsedQuery['___store'] = $this->getCode();
     }
     if ($fromStore !== false) {
         $storeParsedQuery['___from_store'] = $fromStore === true ? $this->_storeManager->getStore()->getCode() : $fromStore;
     }
     return $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host'] . (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '') . $storeParsedUrl['path'] . $requestString . ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:34,代码来源:Store.php

示例7: testGetScriptOptions

 public function testGetScriptOptions()
 {
     $this->request->getQuery()->set('getparameter', 1);
     $this->assertContains('?getparameter=1', $this->javascript->getScriptOptions());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:5,代码来源:JavascriptTest.php


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