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


PHP Request::hasArgument方法代码示例

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


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

示例1: extractWidgetContext

 /**
  * Extracts the WidgetContext from the given $httpRequest.
  * If the request contains an argument "__widgetId" the context is fetched from the session (AjaxWidgetContextHolder).
  * Otherwise the argument "__widgetContext" is expected to contain the serialized WidgetContext (protected by a HMAC suffix)
  *
  * @param Request $httpRequest
  * @return WidgetContext
  */
 protected function extractWidgetContext(Request $httpRequest)
 {
     if ($httpRequest->hasArgument('__widgetId')) {
         return $this->ajaxWidgetContextHolder->get($httpRequest->getArgument('__widgetId'));
     } elseif ($httpRequest->hasArgument('__widgetContext')) {
         $serializedWidgetContextWithHmac = $httpRequest->getArgument('__widgetContext');
         $serializedWidgetContext = $this->hashService->validateAndStripHmac($serializedWidgetContextWithHmac);
         return unserialize(base64_decode($serializedWidgetContext));
     }
     return null;
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:19,代码来源:AjaxWidgetComponent.php

示例2: prepareNodeSelectionFromNode

 /**
  * Get array of node selection properties
  *
  *
  *
  * @param Node $node
  * @return array
  */
 public function prepareNodeSelectionFromNode(Node $node)
 {
     foreach ($this->contentContextFactory->getInstances() as $context) {
         $this->workspace = $context->getWorkspace();
         break;
     }
     $limit = false;
     $limit_param_name = false;
     $offset = false;
     $offset_param_name = false;
     $filter = array();
     $sort = array();
     $nodetype = false;
     $nodetypeisabstract = false;
     $entryNodes = array();
     $nodeParentPath = $node->getParentPath();
     if ($node->getNodeData()->getNodeType()->getConfiguration('indexedNodes')) {
         // calculate nodetype name
         if ($node->getNodeData()->getNodeType()->getConfiguration('indexedNodes') && array_key_exists('nodeType', $node->getNodeData()->getNodeType()->getConfiguration('indexedNodes'))) {
             foreach ($node->getNodeData()->getNodeType()->getConfiguration('indexedNodes')['nodeType'] as $key => $value) {
                 switch ($key) {
                     case 'property':
                         if ($node->getProperty($value)) {
                             $nodetype = $node->getProperty($value);
                         }
                         break;
                     case 'value':
                         $nodetype = $value;
                         break;
                     case 'param':
                         if ($this->httpRequest->hasArgument($value) || $nodetype == false) {
                             $nodetype = addslashes($this->httpRequest->getArgument($value));
                         }
                         break;
                     case 'abstract':
                         $nodetypeisabstract = TRUE;
                         break;
                     default:
                         break;
                 }
             }
         } else {
             throw new IndexedNodesException($node->getNodeData()->getNodeType()->getName() . ' has no nodeType definition.');
         }
         // calculate limit
         if ($node->getNodeData()->getNodeType()->getConfiguration('indexedNodes') && array_key_exists('limit', $node->getNodeData()->getNodeType()->getConfiguration('indexedNodes'))) {
             foreach ($node->getNodeData()->getNodeType()->getConfiguration('indexedNodes')['limit'] as $key => $value) {
                 switch ($key) {
                     case 'property':
                         if ($node->getProperty($value)) {
                             $limit = $node->getProperty($value);
                         }
                         break;
                     case 'value':
                         $limit = $value;
                         break;
                     case 'param':
                         if ($this->httpRequest->hasArgument($value) || $limit == false) {
                             $limit = addslashes($this->httpRequest->getArgument($value));
                         }
                         $limit_param_name = $value;
                         if (strlen($limit) == 0) {
                             $limit = false;
                         }
                         break;
                     default:
                         break;
                 }
             }
         }
         if (!$limit) {
             // fetch default limit from internal params
             $value = "_limit-" . $node->getIdentifier();
             if ($this->httpRequest->hasArgument($value)) {
                 $limit = addslashes($this->httpRequest->getArgument($value));
             }
             if (!$limit_param_name) {
                 $limit_param_name = $value;
             }
         }
         // calculate limit offset, if limit isset
         if ($limit && $node->getNodeData()->getNodeType()->getConfiguration('indexedNodes') && array_key_exists('offset', $node->getNodeData()->getNodeType()->getConfiguration('indexedNodes'))) {
             foreach ($node->getNodeData()->getNodeType()->getConfiguration('indexedNodes')['offset'] as $key => $value) {
                 switch ($key) {
                     case 'property':
                         if ($node->getProperty($value)) {
                             $offset = $node->getProperty($value);
                         }
                         break;
                     case 'value':
                         $offset = $value;
                         break;
//.........这里部分代码省略.........
开发者ID:miegli,项目名称:NEOSLIVE.IndexedNodes,代码行数:101,代码来源:IndexService.php


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