本文整理汇总了PHP中TYPO3\Flow\Mvc\ActionRequest::getArguments方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionRequest::getArguments方法的具体用法?PHP ActionRequest::getArguments怎么用?PHP ActionRequest::getArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Mvc\ActionRequest
的用法示例。
在下文中一共展示了ActionRequest::getArguments方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createActionRequest
/**
* @param Request $httpRequest
* @param array $matchResults
* @return ActionRequest
*/
protected function createActionRequest(Request $httpRequest, array $matchResults = NULL)
{
$actionRequest = new ActionRequest($httpRequest);
if ($matchResults !== NULL) {
$requestArguments = $actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$actionRequest->setArguments($mergedArguments);
}
return $actionRequest;
}
示例2: route
/**
* Routes the specified web request by setting the controller name, action and possible
* parameters. If the request could not be routed, it will be left untouched.
*
* @param \TYPO3\Flow\Http\Request $httpRequest The web request to be analyzed. Will be modified by the router.
* @return \TYPO3\Flow\Mvc\ActionRequest
*/
public function route(Request $httpRequest)
{
$this->actionRequest = $httpRequest->createActionRequest();
$matchResults = $this->findMatchResults($httpRequest);
if ($matchResults !== NULL) {
$requestArguments = $this->actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$this->actionRequest->setArguments($mergedArguments);
}
$this->setDefaultControllerAndActionNameIfNoneSpecified();
return $this->actionRequest;
}
示例3: updateCredentials
/**
* Updates the username and password credentials from the POST vars, if the POST parameters
* are available. Sets the authentication status to REAUTHENTICATION_NEEDED, if credentials have been sent.
*
* @param \TYPO3\Flow\Mvc\ActionRequest $actionRequest The current action request instance
* @return void
*/
public function updateCredentials(\TYPO3\Flow\Mvc\ActionRequest $actionRequest)
{
$getArguments = $actionRequest->getArguments();
if (!empty($getArguments['user']) && !empty($getArguments['signature']) && !empty($getArguments['expires']) && !empty($getArguments['version']) && !empty($getArguments['tpa_id']) && !empty($getArguments['action']) && !empty($getArguments['flags']) && !empty($getArguments['userdata'])) {
$this->credentials['username'] = $getArguments['user'];
$this->credentials['signature'] = \TYPO3\Flow\Utility\TypeHandling::hex2bin($getArguments['signature']);
$this->credentials['expires'] = $getArguments['expires'];
$this->credentials['version'] = $getArguments['version'];
$this->credentials['tpaId'] = $getArguments['tpa_id'];
$this->credentials['action'] = $getArguments['action'];
$this->credentials['flags'] = $getArguments['flags'];
$this->credentials['userdata'] = $getArguments['userdata'];
$this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
}
}
示例4: mapAndValidatePage
/**
* @param \TYPO3\Form\Core\Model\Page $page
* @return \TYPO3\Flow\Error\Result
* @internal
*/
protected function mapAndValidatePage(\TYPO3\Form\Core\Model\Page $page)
{
$result = new \TYPO3\Flow\Error\Result();
$requestArguments = $this->request->getArguments();
$propertyPathsForWhichPropertyMappingShouldHappen = array();
$registerPropertyPaths = function ($propertyPath) use(&$propertyPathsForWhichPropertyMappingShouldHappen) {
$propertyPathParts = explode('.', $propertyPath);
$accumulatedPropertyPathParts = array();
foreach ($propertyPathParts as $propertyPathPart) {
$accumulatedPropertyPathParts[] = $propertyPathPart;
$temporaryPropertyPath = implode('.', $accumulatedPropertyPathParts);
$propertyPathsForWhichPropertyMappingShouldHappen[$temporaryPropertyPath] = $temporaryPropertyPath;
}
};
foreach ($page->getElementsRecursively() as $element) {
$value = \TYPO3\Flow\Utility\Arrays::getValueByPath($requestArguments, $element->getIdentifier());
$element->onSubmit($this, $value);
$this->formState->setFormValue($element->getIdentifier(), $value);
$registerPropertyPaths($element->getIdentifier());
}
// The more parts the path has, the more early it is processed
usort($propertyPathsForWhichPropertyMappingShouldHappen, function ($a, $b) {
return substr_count($b, '.') - substr_count($a, '.');
});
$processingRules = $this->formDefinition->getProcessingRules();
foreach ($propertyPathsForWhichPropertyMappingShouldHappen as $propertyPath) {
if (isset($processingRules[$propertyPath])) {
$processingRule = $processingRules[$propertyPath];
$value = $this->formState->getFormValue($propertyPath);
try {
$value = $processingRule->process($value);
} catch (\TYPO3\Flow\Property\Exception $exception) {
throw new \TYPO3\Form\Exception\PropertyMappingException('Failed to process FormValue at "' . $propertyPath . '" from "' . gettype($value) . '" to "' . $processingRule->getDataType() . '"', 1355218921, $exception);
}
$result->forProperty($propertyPath)->merge($processingRule->getProcessingMessages());
$this->formState->setFormValue($propertyPath, $value);
}
}
return $result;
}
示例5: updateCredentials
/**
* @param ActionRequest $actionRequest The current action request
* @return void
*/
public function updateCredentials(ActionRequest $actionRequest)
{
if ($actionRequest->getHttpRequest()->getMethod() === 'OPTIONS') {
return;
}
$authorizationHeader = $actionRequest->getHttpRequest()->getHeaders()->get('Authorization');
$authorizationArguments = $actionRequest->getArguments();
if (isset($authorizationArguments['username']) && isset($authorizationArguments['password'])) {
$this->credentials['username'] = $authorizationArguments['username'];
$this->credentials['password'] = $authorizationArguments['password'];
$this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
return;
} elseif (substr($authorizationHeader, 0, 6) === 'Bearer') {
$this->credentials['token'] = substr($authorizationHeader, 7);
$this->credentials['user_agent'] = $actionRequest->getHttpRequest()->getHeader('User-Agent');
$this->credentials['ip_address'] = $actionRequest->getHttpRequest()->getClientIpAddress();
$this->setAuthenticationStatus(self::AUTHENTICATION_NEEDED);
return;
} else {
$this->credentials = array('token' => NULL);
$this->authenticationStatus = self::NO_CREDENTIALS_GIVEN;
return;
}
}
示例6: mergeArgumentsWithRequestArguments
/**
* Merges specified arguments with arguments from request.
*
* If $this->request is no sub request, request arguments will only be merged if $this->addQueryString is set.
* Otherwise all request arguments except for the ones prefixed with the current request argument namespace will
* be merged. Additionally special arguments (PackageKey, SubpackageKey, ControllerName & Action) are merged.
*
* The argument provided through the $arguments parameter always overrule the request
* arguments.
*
* The request hierarchy is structured as follows:
* root (HTTP) > main (Action) > sub (Action) > sub sub (Action)
*
* @param array $arguments
* @return array
*/
protected function mergeArgumentsWithRequestArguments(array $arguments)
{
if ($this->request !== $this->request->getMainRequest()) {
$subRequest = $this->request;
while ($subRequest instanceof \TYPO3\Flow\Mvc\ActionRequest) {
$requestArguments = (array) $subRequest->getArguments();
// Reset arguments for the request that is bound to this UriBuilder instance
if ($subRequest === $this->request) {
if ($this->addQueryString === false) {
$requestArguments = array();
} else {
foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
unset($requestArguments[$argumentToBeExcluded]);
}
}
} else {
// Remove all arguments of the current sub request if it's namespaced
if ($this->request->getArgumentNamespace() !== '') {
$requestNamespace = $this->getRequestNamespacePath($this->request);
if ($this->addQueryString === false) {
$requestArguments = Arrays::unsetValueByPath($requestArguments, $requestNamespace);
} else {
foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
$requestArguments = Arrays::unsetValueByPath($requestArguments, $requestNamespace . '.' . $argumentToBeExcluded);
}
}
}
}
// Merge special arguments (package, subpackage, controller & action) from main request
$requestPackageKey = $subRequest->getControllerPackageKey();
if (!empty($requestPackageKey)) {
$requestArguments['@package'] = $requestPackageKey;
}
$requestSubpackageKey = $subRequest->getControllerSubpackageKey();
if (!empty($requestSubpackageKey)) {
$requestArguments['@subpackage'] = $requestSubpackageKey;
}
$requestControllerName = $subRequest->getControllerName();
if (!empty($requestControllerName)) {
$requestArguments['@controller'] = $requestControllerName;
}
$requestActionName = $subRequest->getControllerActionName();
if (!empty($requestActionName)) {
$requestArguments['@action'] = $requestActionName;
}
if (count($requestArguments) > 0) {
$requestArguments = $this->addNamespaceToArguments($requestArguments, $subRequest);
$arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments);
}
$subRequest = $subRequest->getParentRequest();
}
} elseif ($this->addQueryString === true) {
$requestArguments = $this->request->getArguments();
foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
unset($requestArguments[$argumentToBeExcluded]);
}
if ($requestArguments !== array()) {
$arguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $arguments);
}
}
return $arguments;
}
示例7: allArgumentsCanBeSetOrRetrievedAtOnce
/**
* @test
*/
public function allArgumentsCanBeSetOrRetrievedAtOnce()
{
$arguments = array('foo' => 'fooValue', 'bar' => 'barValue');
$this->actionRequest->setArguments($arguments);
$this->assertEquals($arguments, $this->actionRequest->getArguments());
}
示例8: route
/**
* @param Request $httpRequest
* @return ActionRequest
*/
protected function route(Request $httpRequest)
{
$actionRequest = new ActionRequest($httpRequest);
$matchResults = $this->router->route($httpRequest);
if ($matchResults !== null) {
$requestArguments = $actionRequest->getArguments();
$mergedArguments = Arrays::arrayMergeRecursiveOverrule($requestArguments, $matchResults);
$actionRequest->setArguments($mergedArguments);
}
return $actionRequest;
}
示例9: redirectToRequest
/**
* Redirects the request to another action and / or controller.
*
* Redirect will be sent to the client which then performs another request to the new URI.
*
* NOTE: This method only supports web requests and will throw an exception
* if used with other request types.
*
* @param ActionRequest $request The request to redirect to
* @param integer $delay (optional) The delay in seconds. Default is no delay.
* @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
* @return void
* @throws \TYPO3\Flow\Mvc\Exception\StopActionException
* @see forwardToRequest()
* @api
*/
protected function redirectToRequest(ActionRequest $request, $delay = 0, $statusCode = 303)
{
$packageKey = $request->getControllerPackageKey();
$subpackageKey = $request->getControllerSubpackageKey();
if ($subpackageKey !== null) {
$packageKey .= '\\' . $subpackageKey;
}
$this->redirect($request->getControllerActionName(), $request->getControllerName(), $packageKey, $request->getArguments(), $delay, $statusCode, $request->getFormat());
}
示例10: onAuthenticationSuccess
/**
* Is called if authentication was successful.
*
* @param \TYPO3\Flow\Mvc\ActionRequest $originalRequest The request that was intercepted by the security framework, NULL if there was none
* @return string
*/
public function onAuthenticationSuccess(\TYPO3\Flow\Mvc\ActionRequest $originalRequest = NULL)
{
$uriBuilder = $this->controllerContext->getUriBuilder();
if ($originalRequest !== NULL) {
$uri = $uriBuilder->uriFor($originalRequest->getControllerActionName(), $originalRequest->getArguments(), $originalRequest->getControllerName(), $originalRequest->getControllerPackageKey());
} else {
if (isset($this->settings['Redirect']['signedIn'])) {
$packageKey = $this->settings['Redirect']['signedIn']['packageKey'];
$controllerName = $this->settings['Redirect']['signedIn']['controllerName'];
$actionName = $this->settings['Redirect']['signedIn']['actionName'];
$uri = $uriBuilder->uriFor($actionName, NULL, $controllerName, $packageKey);
} else {
$uri = $uriBuilder->uriFor('signIn', NULL, 'Login', 'Flow.Login');
}
}
$response = array();
$response['status'] = 'OK';
$response['redirect'] = $uri;
$this->view->assign('value', $response);
}
示例11: allArgumentsCanBeSetOrRetrievedAtOnce
/**
* @test
*/
public function allArgumentsCanBeSetOrRetrievedAtOnce()
{
$httpRequest = HttpRequest::create(new Uri('http://robertlemke.com/blog'));
$arguments = array('foo' => 'fooValue', 'bar' => 'barValue');
$actionRequest = new ActionRequest($httpRequest);
$actionRequest->setArguments($arguments);
$this->assertEquals($arguments, $actionRequest->getArguments());
}