/** * * * @return string */ public function indexAction() { \Admin\Core\API::addTitleSegment("Admin"); \Admin\Core\API::addTitleSegment("Login"); $users = $this->userRepository->findAll(); if ($users->count() < 1 || $this->helper->getSettings("Admin.DemoMode")) { $user = $this->objectManager->get("Admin\\Security\\User"); $username = "******"; if ($users->count() > 0) { $username .= $users->count() + 1; } $user->setAccountIdentifier($username); $user->setCredentialsSource("password"); $user->setAdmin(true); $this->userRepository->add($user); $message = new \TYPO3\FLOW3\Error\Message('A User has been Created: ' . $username . '/password'); $this->flashMessageContainer->addMessage($message); $message = new \TYPO3\FLOW3\Error\Warning('Please Change the Passwort after Login!'); $this->flashMessageContainer->addMessage($message); $this->view->assign("username", $username); $this->view->assign("password", "password"); } else { $this->view->assign("username", ""); $this->view->assign("password", ""); } }
/** * Lifecycle method, called after all dependencies have been injected. * Here, the typeConverter array gets initialized. * * @return void * @throws \TYPO3\FLOW3\Property\Exception\DuplicateTypeConverterException */ public function initializeObject() { foreach ($this->reflectionService->getAllImplementationClassNamesForInterface('TYPO3\\FLOW3\\Property\\TypeConverterInterface') as $typeConverterClassName) { $typeConverter = $this->objectManager->get($typeConverterClassName); foreach ($typeConverter->getSupportedSourceTypes() as $supportedSourceType) { if (isset($this->typeConverters[$supportedSourceType][$typeConverter->getSupportedTargetType()][$typeConverter->getPriority()])) { throw new \TYPO3\FLOW3\Property\Exception\DuplicateTypeConverterException('There exist at least two converters which handle the conversion from "' . $supportedSourceType . '" to "' . $typeConverter->getSupportedTargetType() . '" with priority "' . $typeConverter->getPriority() . '": ' . get_class($this->typeConverters[$supportedSourceType][$typeConverter->getSupportedTargetType()][$typeConverter->getPriority()]) . ' and ' . get_class($typeConverter), 1297951378); } $this->typeConverters[$supportedSourceType][$typeConverter->getSupportedTargetType()][$typeConverter->getPriority()] = $typeConverter; } } }
/** * * @param object $value * @param string $partial * @param string $fallbacks * @param array $vars * @return string Rendered string * @author Marc Neuhaus <*****@*****.**> * @api */ public function render($as = "widget") { $this->reflectionService = $this->objectManager->get("TYPO3\\FLOW3\\Reflection\\ReflectionService"); $output = ""; foreach ($this->reflectionService->getAllImplementationClassNamesForInterface('\\Admin\\Core\\DashboardWidgets\\DashboardWidgetInterface') as $className) { $widget = new $className($this->viewHelperVariableContainer->getView()); $this->templateVariableContainer->add($as, $widget); $output .= $this->renderChildren(); $this->templateVariableContainer->remove($as, $widget); } return $output; }
/** * Returns the static value of the given operand, this might be also a global object * * @param mixed $expression The expression string representing the operand * @return mixed The calculated value */ protected function getValueForOperand($expression) { if (is_array($expression)) { $result = array(); foreach ($expression as $expressionEntry) { $result[] = $this->getValueForOperand($expressionEntry); } return $result; } else { if (is_numeric($expression)) { return $expression; } else { if ($expression === 'TRUE') { return TRUE; } else { if ($expression === 'FALSE') { return FALSE; } else { if ($expression === 'NULL') { return NULL; } else { if (strpos($expression, 'current.') === 0) { $objectAccess = explode('.', $expression, 3); $globalObjectsRegisteredClassName = $this->globalObjects[$objectAccess[1]]; $globalObject = $this->objectManager->get($globalObjectsRegisteredClassName); return $this->getObjectValueByPath($globalObject, $objectAccess[2]); } else { return trim($expression, '"\''); } } } } } } }
/** * Emits a signal when an Advice is invoked * * The advice is not proxyable, so the signal is dispatched manually here. * * @param object $aspectObject * @param string $methodName * @param \TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint * @return void * @FLOW3\Signal */ protected function emitAdviceInvoked($aspectObject, $methodName, $joinPoint) { if ($this->dispatcher === NULL) { $this->dispatcher = $this->objectManager->get('TYPO3\\FLOW3\\SignalSlot\\Dispatcher'); } $this->dispatcher->dispatch('TYPO3\\FLOW3\\Aop\\Advice\\AbstractAdvice', 'adviceInvoked', array($aspectObject, $methodName, $joinPoint)); }
/** * Factory method which creates an EntityManager. * * @return \Doctrine\ORM\EntityManager */ public function create() { $config = new \Doctrine\ORM\Configuration(); $config->setClassMetadataFactoryName('TYPO3\\FLOW3\\Persistence\\Doctrine\\Mapping\\ClassMetadataFactory'); if (class_exists($this->settings['doctrine']['cacheImplementation'])) { // safeguard against apc being disabled in CLI... if ($this->settings['doctrine']['cacheImplementation'] !== 'Doctrine\\Common\\Cache\\ApcCache' || function_exists('apc_fetch')) { $cache = new $this->settings['doctrine']['cacheImplementation'](); $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); } } if (class_exists($this->settings['doctrine']['sqlLogger'])) { $config->setSQLLogger(new $this->settings['doctrine']['sqlLogger']()); } // must use ObjectManager in compile phase... $flow3AnnotationDriver = $this->objectManager->get('TYPO3\\FLOW3\\Persistence\\Doctrine\\Mapping\\Driver\\Flow3AnnotationDriver'); $config->setMetadataDriverImpl($flow3AnnotationDriver); $proxyDirectory = \TYPO3\FLOW3\Utility\Files::concatenatePaths(array($this->environment->getPathToTemporaryDirectory(), 'Doctrine/Proxies')); \TYPO3\FLOW3\Utility\Files::createDirectoryRecursively($proxyDirectory); $config->setProxyDir($proxyDirectory); $config->setProxyNamespace('TYPO3\\FLOW3\\Persistence\\Doctrine\\Proxies'); $config->setAutoGenerateProxyClasses(FALSE); $entityManager = \Doctrine\ORM\EntityManager::create($this->settings['backendOptions'], $config); $flow3AnnotationDriver->setEntityManager($entityManager); return $entityManager; }
/** * Starts the shutdown sequence * * @param string $runlevel Either "Compiletime" or "Runtime" * @return void */ protected function shutdown($runlevel) { $this->bootstrap->shutdown($runlevel); if ($runlevel === 'Compiletime') { $this->objectManager->get('TYPO3\\FLOW3\\Core\\LockManager')->unlockSite(); } exit($this->response->getExitCode()); }
/** * Emits a signal when a Request has been dispatched * * The action request is not proxyable, so the signal is dispatched manually here. * The safeguard allows unit tests without the dispatcher dependency. * * @param \TYPO3\FLOW3\Configuration\ConfigurationManager $configurationManager * @return void * @FLOW3\Signal */ protected function emitRequestDispatched($request) { if ($this->objectManager !== NULL) { $dispatcher = $this->objectManager->get('TYPO3\\FLOW3\\SignalSlot\\Dispatcher'); if ($dispatcher !== NULL) { $dispatcher->dispatch('TYPO3\\FLOW3\\Mvc\\ActionRequest', 'requestDispatched', array($request)); } } }
/** * Sets the internal filters based on the given configuration. * * @param array $filterSettings The filter settings * @return void */ protected function buildFiltersFromSettings(array $filterSettings) { foreach ($filterSettings as $singleFilterSettings) { $requestPattern = $this->objectManager->get($this->requestPatternResolver->resolveRequestPatternClass($singleFilterSettings['patternType'])); $requestPattern->setPattern($singleFilterSettings['patternValue']); $interceptor = $this->objectManager->get($this->interceptorResolver->resolveInterceptorClass($singleFilterSettings['interceptor'])); $this->filters[] = $this->objectManager->get('TYPO3\\FLOW3\\Security\\Authorization\\RequestFilter', $requestPattern, $interceptor); } }
public function __toString() { if (is_object($this->objectManager)) { $reflectionService = $this->objectManager->get("TYPO3\\FLOW3\\Reflection\\ReflectionService"); $class = get_class($this); if ($this instanceof \Doctrine\ORM\Proxy\Proxy) { $class = get_parent_class($this); } $properties = $reflectionService->getClassPropertyNames($class); $identity = array(); $title = array(); $goodGuess = null; $usualSuspects = array("title", "name"); foreach ($properties as $property) { $tags = $reflectionService->getPropertyTagsValues($class, $property); if (in_array("title", array_keys($tags))) { $title[] = \TYPO3\FLOW3\Reflection\ObjectAccess::getProperty($this, $property); } if (in_array("identity", array_keys($tags))) { $value = \TYPO3\FLOW3\Reflection\ObjectAccess::getProperty($this, $property); if (!is_object($value)) { $identity[] = $value; } } if (in_array($property, $usualSuspects) && $goodGuess === null) { $value = \TYPO3\FLOW3\Reflection\ObjectAccess::getProperty($this, $property); if (!is_object($value)) { $goodGuess[] = $value; } } } if (count($title) > 0) { $string = implode(", ", $title); } if (count($identity) > 0 && empty($string)) { $string = implode(", ", $identity); } if ($goodGuess !== null && empty($string)) { $string = implode(",", $goodGuess); } } else { $myProperties = get_object_vars($this); $strings = array(); foreach ($myProperties as $key => $value) { if (is_string($value) && $key !== "FLOW3_Persistence_Identifier") { $strings[] = $value; } } $string = implode(", ", $strings); } if (empty($string)) { return sprintf("Object (%s)", \Admin\Core\Helper::getShortName(get_class($this))); } else { return $string; } }
/** * Creates and sets the configured access decision voters * * @param array $voterClassNames Array of access decision voter class names * @return void * @throws \TYPO3\FLOW3\Security\Exception\VoterNotFoundException */ protected function createAccessDecisionVoters(array $voterClassNames) { foreach ($voterClassNames as $voterClassName) { if (!$this->objectManager->isRegistered($voterClassName)) { throw new \TYPO3\FLOW3\Security\Exception\VoterNotFoundException('No voter of type ' . $voterClassName . ' found!', 1222267934); } $voter = $this->objectManager->get($voterClassName); if (!$voter instanceof \TYPO3\FLOW3\Security\Authorization\AccessDecisionVoterInterface) { throw new \TYPO3\FLOW3\Security\Exception\VoterNotFoundException('The found voter class did not implement \\TYPO3\\FLOW3\\Security\\Authorization\\AccessDecisionVoterInterface', 1222268008); } $this->accessDecisionVoters[] = $voter; } }
/** * Returns instance of concrete formatter. * * The name provided has to be a name of existing class placed in * \TYPO3\FLOW3\I18n\Formatter package and implementing FormatterInterface * (also in this package). For example, when $formatterName is 'number', * the \TYPO3\FLOW3\I18n\Formatter\NumberFormatter class has to exist. * * Throws exception if there is no formatter for name given. * * @param string $formatterName Name of the formatter class (without Formatter suffix) * @return \TYPO3\FLOW3\I18n\Formatter\FormatterInterface The concrete formatter class * @throws \TYPO3\FLOW3\I18n\Exception\UnknownFormatterException When formatter for a name given does not exist */ protected function getFormatter($formatterName) { $formatterName = ucfirst($formatterName); if (isset($this->formatters[$formatterName])) { return $this->formatters[$formatterName]; } try { $formatter = $this->objectManager->get('TYPO3\\FLOW3\\I18n\\Formatter\\' . $formatterName . 'Formatter'); } catch (\TYPO3\FLOW3\Object\Exception\UnknownObjectException $exception) { throw new \TYPO3\FLOW3\I18n\Exception\UnknownFormatterException('Could not find formatter for "' . $formatterName . '".', 1278057791); } return $this->formatters[$formatterName] = $formatter; }
/** * Sets up security test requirements * * @return void */ protected function setupSecurity() { $this->accessDecisionManager = $this->objectManager->get('TYPO3\\FLOW3\\Security\\Authorization\\AccessDecisionManagerInterface'); $this->accessDecisionManager->setOverrideDecision(NULL); $this->authenticationManager = $this->objectManager->get('TYPO3\\FLOW3\\Security\\Authentication\\AuthenticationProviderManager'); $this->testingProvider = $this->objectManager->get('TYPO3\\FLOW3\\Security\\Authentication\\Provider\\TestingProvider'); $this->testingProvider->setName('TestingProvider'); $this->securityContext = $this->objectManager->get('TYPO3\\FLOW3\\Security\\Context'); $this->securityContext->clearContext(); $this->securityContext->refreshTokens(); $requestHandler = self::$bootstrap->getActiveRequestHandler(); $actionRequest = $requestHandler->getHttpRequest()->createActionRequest(); $this->securityContext->injectRequest($actionRequest); }
/** * Around advice, wrapping every method of a scope session object. It redirects * all method calls to the session object once there is one. * * @param \TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint The current join point * @return mixed * @FLOW3\Around("filter(TYPO3\FLOW3\Session\Aspect\SessionObjectMethodsPointcutFilter)") */ public function callMethodOnOriginalSessionObject(\TYPO3\FLOW3\Aop\JoinPointInterface $joinPoint) { $objectName = $this->objectManager->getObjectNameByClassName(get_class($joinPoint->getProxy())); $methodName = $joinPoint->getMethodName(); $proxy = $joinPoint->getProxy(); if (!isset($this->sessionOriginalInstances[$objectName])) { $this->sessionOriginalInstances[$objectName] = $this->objectManager->get($objectName); } if ($this->sessionOriginalInstances[$objectName] === $proxy) { return $joinPoint->getAdviceChain()->proceed($joinPoint); } else { return call_user_func_array(array($this->sessionOriginalInstances[$objectName], $methodName), $joinPoint->getMethodArguments()); } }
private function getAdapter() { if (isset($this->adapter)) { $adapter = $this->objectManager->get($this->adapter); if (!empty($this->being) && class_exists($this->being, false)) { $tags = $this->reflectionService->getClassTagsValues($this->being); if (array_key_exists("adapter", $tags) && class_exists("\\" . $tags["adapter"][0], false)) { $adapter = $this->objectManager->get($tags["adapter"][0]); } } $adapter->init(); return $adapter; } else { return null; } }
public function getClassConfiguration($class) { $implementations = class_implements("\\" . ltrim($class, "\\")); if (in_array("Doctrine\\ORM\\Proxy\\Proxy", $implementations)) { $class = get_parent_class("\\" . ltrim($class, "\\")); } $this->class = $class; if (isset($this->settings["ConfigurationProvider"]) && !isset($this->runtimeCache[$class])) { $configuration = array(); $configurationProviders = $this->settings["ConfigurationProvider"]; foreach ($configurationProviders as $configurationProviderClass) { $configurationProvider = $this->objectManager->get($configurationProviderClass); $configurationProvider->setSettings($this->settings); $configuration = $this->merge($configuration, $configurationProvider->get($class)); } $this->runtimeCache[$class] = $configuration; } return $this->runtimeCache[$class]; }
/** * Finds and instantiates a controller that matches the current request. * If no controller can be found, an instance of NotFoundControllerInterface is returned. * * @param \TYPO3\FLOW3\Mvc\RequestInterface $request The request to dispatch * @return \TYPO3\FLOW3\Mvc\Controller\ControllerInterface * @throws \TYPO3\FLOW3\Mvc\Controller\Exception\InvalidControllerException */ protected function resolveController(\TYPO3\FLOW3\Mvc\RequestInterface $request) { $exception = NULL; $controllerObjectName = $request->getControllerObjectName(); if ($controllerObjectName === '') { $exception = new \TYPO3\FLOW3\Mvc\Controller\Exception\InvalidControllerException('No controller could be resolved which would match your request', 1303209195, NULL, $request); } if ($exception !== NULL) { $controller = $this->objectManager->get($this->settings['mvc']['notFoundController']); if (!$controller instanceof \TYPO3\FLOW3\Mvc\Controller\NotFoundControllerInterface) { throw new \TYPO3\FLOW3\Mvc\Controller\Exception\InvalidControllerException('The NotFoundController must implement "\\TYPO3\\FLOW3\\Mvc\\Controller\\NotFoundControllerInterface", ' . (is_object($controller) ? get_class($controller) : gettype($controller)) . ' given.', 1246714416, NULL, $request); } $controller->setException($exception); } else { $controller = $this->objectManager->get($controllerObjectName); if (!$controller instanceof \TYPO3\FLOW3\Mvc\Controller\ControllerInterface) { throw new \TYPO3\FLOW3\Mvc\Controller\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must be a valid request handling controller, ' . (is_object($controller) ? get_class($controller) : gettype($controller)) . ' given.', 1202921619, NULL, $request); } } return $controller; }
/** * Get a validator for a given data type. Returns a validator implementing * the TYPO3\FLOW3\Validation\Validator\ValidatorInterface or NULL if no validator * could be resolved. * * @param string $validatorType Either one of the built-in data types or fully qualified validator class name * @param array $validatorOptions Options to be passed to the validator * @return \TYPO3\FLOW3\Validation\Validator\ValidatorInterface * @throws \TYPO3\FLOW3\Validation\Exception\NoSuchValidatorException * @api */ public function createValidator($validatorType, array $validatorOptions = array()) { $validatorObjectName = $this->resolveValidatorObjectName($validatorType); if ($validatorObjectName === FALSE) { return NULL; } switch ($this->objectManager->getScope($validatorObjectName)) { case Configuration::SCOPE_PROTOTYPE: $validator = new $validatorObjectName($validatorOptions); break; case Configuration::SCOPE_SINGLETON: $validator = $this->objectManager->get($validatorObjectName); break; default: throw new \TYPO3\FLOW3\Validation\Exception\NoSuchValidatorException('The validator "' . $validatorObjectName . '" is not of scope singleton or prototype!', 1300694835); } if (!$validator instanceof ValidatorInterface) { throw new \TYPO3\FLOW3\Validation\Exception\NoSuchValidatorException('The validator "' . $validatorObjectName . '" does not implement TYPO3\\FLOW3\\Validation\\Validator\\ValidatorInterface!', 1300694875); } return $validator; }
/** * Get a password hashing strategy * * @param string $strategyIdentifier * @param boolean $validating TRUE if the password is validated, FALSE if the password is hashed * @return array Array of \TYPO3\FLOW3\Security\Cryptography\PasswordHashingStrategyInterface and string * @throws \TYPO3\FLOW3\Security\Exception\MissingConfigurationException */ protected function getPasswordHashingStrategyAndIdentifier($strategyIdentifier = 'default', $validating) { if (isset($this->passwordHashingStrategies[$strategyIdentifier])) { return array($this->passwordHashingStrategies[$strategyIdentifier], $strategyIdentifier); } if ($strategyIdentifier === 'default') { if ($validating && isset($this->strategySettings['fallback'])) { $strategyIdentifier = $this->strategySettings['fallback']; } else { if (!isset($this->strategySettings['default'])) { throw new \TYPO3\FLOW3\Security\Exception\MissingConfigurationException('No default hashing strategy configured', 1320758427); } $strategyIdentifier = $this->strategySettings['default']; } } if (!isset($this->strategySettings[$strategyIdentifier])) { throw new \TYPO3\FLOW3\Security\Exception\MissingConfigurationException('No hashing strategy with identifier "' . $strategyIdentifier . '" configured', 1320758776); } $strategyObjectName = $this->strategySettings[$strategyIdentifier]; $this->passwordHashingStrategies[$strategyIdentifier] = $this->objectManager->get($strategyObjectName); return array($this->passwordHashingStrategies[$strategyIdentifier], $strategyIdentifier); }
/** * Prepares a view for the current action and stores it in $this->view. * By default, this method tries to locate a view with a name matching * the current action. * * @return \TYPO3\FLOW3\Mvc\View\ViewInterface the resolved view * @api */ protected function resolveView() { $viewObjectName = $this->resolveViewObjectName(); if ($viewObjectName !== FALSE) { $view = $this->objectManager->get($viewObjectName); if ($view->canRender($this->controllerContext) === FALSE) { unset($view); } } if (!isset($view) && $this->defaultViewObjectName != '') { $view = $this->objectManager->get($this->defaultViewObjectName); if ($view->canRender($this->controllerContext) === FALSE) { unset($view); } } if (!isset($view)) { $view = $this->objectManager->get('TYPO3\\FLOW3\\Mvc\\View\\NotFoundView'); $view->assign('errorMessage', 'No template was found. View could not be resolved for action "' . $this->request->getControllerActionName() . '"'); } $view->setControllerContext($this->controllerContext); return $view; }
/** * Dispatches a signal by calling the registered Slot methods * * @param string $signalClassName Name of the class containing the signal * @param string $signalName Name of the signal * @param array $signalArguments arguments passed to the signal method * @return void * @throws \TYPO3\FLOW3\SignalSlot\Exception\InvalidSlotException if the slot is not valid * @api */ public function dispatch($signalClassName, $signalName, array $signalArguments = array()) { if (!isset($this->slots[$signalClassName][$signalName])) { return; } foreach ($this->slots[$signalClassName][$signalName] as $slotInformation) { if (isset($slotInformation['object'])) { $object = $slotInformation['object']; } elseif (substr($slotInformation['method'], 0, 2) === '::') { if (!isset($this->objectManager)) { if (is_callable($slotInformation['class'] . $slotInformation['method'])) { $object = $slotInformation['class']; } else { throw new \TYPO3\FLOW3\SignalSlot\Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624); } } else { $object = $this->objectManager->getClassNameByObjectName($slotInformation['class']); } $slotInformation['method'] = substr($slotInformation['method'], 2); } else { if (!isset($this->objectManager)) { throw new \TYPO3\FLOW3\SignalSlot\Exception\InvalidSlotException(sprintf('Cannot dispatch %s::%s to class %s. The object manager is not yet available in the Signal Slot Dispatcher and therefore it cannot dispatch classes.', $signalClassName, $signalName, $slotInformation['class']), 1298113624); } if (!$this->objectManager->isRegistered($slotInformation['class'])) { throw new \TYPO3\FLOW3\SignalSlot\Exception\InvalidSlotException('The given class "' . $slotInformation['class'] . '" is not a registered object.', 1245673367); } $object = $this->objectManager->get($slotInformation['class']); } if ($slotInformation['passSignalInformation'] === TRUE) { $signalArguments[] = $signalClassName . '::' . $signalName; } if (!method_exists($object, $slotInformation['method'])) { throw new \TYPO3\FLOW3\SignalSlot\Exception\InvalidSlotException('The slot method ' . get_class($object) . '->' . $slotInformation['method'] . '() does not exist.', 1245673368); } call_user_func_array(array($object, $slotInformation['method']), $signalArguments); } }
/** * returns all active groups * * @return $groups Array * @author Marc Neuhaus */ public function getGroups() { $this->adapters = $this->getAdapters(); $cache = $this->cacheManager->getCache('Admin_Cache'); $identifier = "Groups-" . sha1(implode("-", $this->adapters)); if (!$cache->has($identifier)) { $groups = array(); $adapters = array(); foreach ($this->adapters as $adapter) { $adapters[$adapter] = $this->objectManager->get($adapter); foreach ($adapters[$adapter]->getGroups() as $group => $beings) { foreach ($beings as $conf) { $being = $conf["being"]; $conf["adapter"] = $adapter; $groups[$group]["beings"][$being] = $conf; } } } $cache->set($identifier, $groups); } else { $groups = $cache->get($identifier); } return $groups; }
/** * Iterates through all segments in $this->uriPattern and creates * appropriate RoutePart instances. * * @return void * @throws \TYPO3\FLOW3\Mvc\Exception\InvalidRoutePartHandlerException * @throws \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException */ public function parse() { if ($this->isParsed || $this->uriPattern === NULL || $this->uriPattern === '') { return; } $this->routeParts = array(); $currentRoutePartIsOptional = FALSE; if (substr($this->uriPattern, -1) === '/') { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" ends with a slash, which is not allowed. You can put the trailing slash in brackets to make it optional.', 1234782997); } if ($this->uriPattern[0] === '/') { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" starts with a slash, which is not allowed.', 1234782983); } $matches = array(); preg_match_all(self::PATTERN_EXTRACTROUTEPARTS, $this->uriPattern, $matches, PREG_SET_ORDER); $lastRoutePart = NULL; foreach ($matches as $match) { $routePartType = empty($match['dynamic']) ? self::ROUTEPART_TYPE_STATIC : self::ROUTEPART_TYPE_DYNAMIC; $routePartName = $match['content']; if (!empty($match['optionalStart'])) { if ($lastRoutePart !== NULL && $lastRoutePart->isOptional()) { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive optional Route sections, which is not allowed.', 1234562050); } $currentRoutePartIsOptional = TRUE; } $routePart = NULL; switch ($routePartType) { case self::ROUTEPART_TYPE_DYNAMIC: if ($lastRoutePart instanceof \TYPO3\FLOW3\Mvc\Routing\DynamicRoutePartInterface) { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive Dynamic Route Parts, which is not allowed.', 1218446975); } if (isset($this->routePartsConfiguration[$routePartName]['handler'])) { $routePart = $this->objectManager->get($this->routePartsConfiguration[$routePartName]['handler']); if (!$routePart instanceof \TYPO3\FLOW3\Mvc\Routing\DynamicRoutePartInterface) { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidRoutePartHandlerException('routePart handlers must implement "\\TYPO3\\FLOW3\\Mvc\\Routing\\DynamicRoutePartInterface" in route "' . $this->getName() . '"', 1218480972); } } elseif (isset($this->routePartsConfiguration[$routePartName]['objectType'])) { $routePart = new \TYPO3\FLOW3\Mvc\Routing\IdentityRoutePart(); $routePart->setObjectType($this->routePartsConfiguration[$routePartName]['objectType']); if (isset($this->routePartsConfiguration[$routePartName]['uriPattern'])) { $routePart->setUriPattern($this->routePartsConfiguration[$routePartName]['uriPattern']); } } else { $routePart = new \TYPO3\FLOW3\Mvc\Routing\DynamicRoutePart(); } $routePartDefaultValue = \TYPO3\FLOW3\Reflection\ObjectAccess::getPropertyPath($this->defaults, $routePartName); if ($routePartDefaultValue !== NULL) { $routePart->setDefaultValue($routePartDefaultValue); } break; case self::ROUTEPART_TYPE_STATIC: $routePart = new \TYPO3\FLOW3\Mvc\Routing\StaticRoutePart(); if ($lastRoutePart !== NULL && $lastRoutePart instanceof \TYPO3\FLOW3\Mvc\Routing\DynamicRoutePartInterface) { $lastRoutePart->setSplitString($routePartName); } } $routePart->setName($routePartName); $routePart->setOptional($currentRoutePartIsOptional); $routePart->setLowerCase($this->lowerCase); if (isset($this->routePartsConfiguration[$routePartName]['options'])) { $routePart->setOptions($this->routePartsConfiguration[$routePartName]['options']); } if (isset($this->routePartsConfiguration[$routePartName]['toLowerCase'])) { $routePart->setLowerCase($this->routePartsConfiguration[$routePartName]['toLowerCase']); } $this->routeParts[] = $routePart; if (!empty($match['optionalEnd'])) { if (!$currentRoutePartIsOptional) { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unopened optional section.', 1234564495); } $currentRoutePartIsOptional = FALSE; } $lastRoutePart = $routePart; } if ($currentRoutePartIsOptional) { throw new \TYPO3\FLOW3\Mvc\Exception\InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unterminated optional section.', 1234563922); } $this->isParsed = TRUE; }
/** * Adds a setting filter to the pointcut filter composite * * @param string $operator The operator * @param string $configurationPath The path to the settings option, that should be used * @param PointcutFilterComposite $pointcutFilterComposite An instance of the pointcut filter composite. The result (ie. the custom filter) will be added to this composite object. * @return void */ protected function parseDesignatorSetting($operator, $configurationPath, PointcutFilterComposite $pointcutFilterComposite) { $filter = new PointcutSettingFilter($configurationPath); $filter->injectConfigurationManager($this->objectManager->get('TYPO3\\FLOW3\\Configuration\\ConfigurationManager')); $pointcutFilterComposite->addFilter($operator, $filter); }