/** * Called by the Flow object framework after creating the object and resolving all dependencies. * * @param integer $cause Creation cause */ public function initializeObject($cause) { if ($cause === \TYPO3\Flow\Object\ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) { $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.TYPO3CR.Search'); $this->indexName = $settings['elasticSearch']['indexName']; } }
/** * This aspect will block loadNodeTypes from being called and will instead * call overrideNodeTypes with a modified configuration. * * @Flow\Around("method(TYPO3\TYPO3CR\Domain\Service\NodeTypeManager->loadNodeTypes())") * @param JoinPointInterface $joinPoint The current join point * @return void */ public function addDynamicNodeConfiguration(JoinPointInterface $joinPoint) { $completeNodeTypeConfiguration = $this->configurationManager->getConfiguration('NodeTypes'); $dynamicNodeTypes = $this->dynamicNodeTypeRepository->findAll(); /* @var $dynamicNodeType DynamicNodeType */ foreach ($dynamicNodeTypes as $dynamicNodeType) { $dynamicNodeName = $dynamicNodeType->getValidNodeTypeName($this->settings['nodeNamespace']); if (!array_key_exists($dynamicNodeName, $completeNodeTypeConfiguration)) { $dynamicProperties = array(); /* @var $dynamicProperty DynamicProperty */ foreach ($dynamicNodeType->getDynamicProperties() as $dynamicProperty) { $dynamicPropertyName = $dynamicProperty->getValidPropertyName($this->settings['propertyPrefix']); $dynamicProperties[$dynamicPropertyName] = array('type' => 'string', 'defaultValue' => $dynamicProperty->getDefaultValue(), 'ui' => array('label' => $dynamicProperty->getLabel(), 'reloadIfChanged' => TRUE, 'inlineEditable' => TRUE, 'aloha' => array('placeholder' => $dynamicProperty->getPlaceholder()), 'inspector' => array('group' => 'dynamicProperties', 'editorOptions' => array('placeholder' => $dynamicProperty->getPlaceholder())))); } $newNodeConfiguration = array('superTypes' => $this->settings['superTypes'], 'abstract' => FALSE, 'ui' => array('label' => $dynamicNodeType->getLabel())); // Only set properties if there are any. // If properties is set to an empty array a bug in Neos will break the node configuration. // This leads to an empty inspector and strange error messages. if (count($dynamicProperties)) { $newNodeConfiguration['properties'] = $dynamicProperties; } $completeNodeTypeConfiguration[$dynamicNodeName] = $newNodeConfiguration; } } /* @var $nodeTypeManager NodeTypeManager */ $nodeTypeManager = $joinPoint->getProxy(); $nodeTypeManager->overrideNodeTypes($completeNodeTypeConfiguration); }
/** * Gets the authentication provider configuration needed * * @return void */ public function initializeObject() { $settings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow'); if (isset($settings['security']['authentication']['providers']['Typo3SetupProvider']['providerOptions']['keyName'])) { $this->keyName = $settings['security']['authentication']['providers']['Typo3SetupProvider']['providerOptions']['keyName']; } }
/** * Called by the Flow object framework after creating the object and resolving all dependencies. * * @param integer $cause Creation cause */ public function initializeObject($cause) { if ($cause === \TYPO3\Flow\Object\ObjectManagerInterface::INITIALIZATIONCAUSE_CREATED) { $settings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.TYPO3CR.Search'); $this->defaultConfigurationPerType = $settings['defaultConfigurationPerType']; } }
/** * Get package settings */ public function getSettings() { if (!is_array($this->settings)) { $this->settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Ttree.JobButler'); } return $this->settings; }
/** * This method walks through the view configuration and applies * matching configurations in the order of their specifity score. * Possible options are currently the viewObjectName to specify * a different class that will be used to create the view and * an array of options that will be set on the view object. * * @param \TYPO3\Flow\Mvc\ActionRequest $request * @return array */ public function getViewConfiguration(ActionRequest $request) { $cacheIdentifier = $this->createCacheIdentifier($request); $viewConfiguration = $this->cache->get($cacheIdentifier); if ($viewConfiguration === false) { $configurations = $this->configurationManager->getConfiguration('Views'); $requestMatcher = new RequestMatcher($request); $context = new Context($requestMatcher); $matchingConfigurations = array(); foreach ($configurations as $order => $configuration) { $requestMatcher->resetWeight(); if (!isset($configuration['requestFilter'])) { $matchingConfigurations[$order]['configuration'] = $configuration; $matchingConfigurations[$order]['weight'] = $order; } else { $result = $this->eelEvaluator->evaluate($configuration['requestFilter'], $context); if ($result === false) { continue; } $matchingConfigurations[$order]['configuration'] = $configuration; $matchingConfigurations[$order]['weight'] = $requestMatcher->getWeight() + $order; } } usort($matchingConfigurations, function ($configuration1, $configuration2) { return $configuration1['weight'] > $configuration2['weight']; }); $viewConfiguration = array(); foreach ($matchingConfigurations as $key => $matchingConfiguration) { $viewConfiguration = Arrays::arrayMergeRecursiveOverrule($viewConfiguration, $matchingConfiguration['configuration']); } $this->cache->set($cacheIdentifier, $viewConfiguration); } return $viewConfiguration; }
/** * @param string $modelClassName * @param array $properties * @param string $applicationName * @param array $foundRelations * @return string */ public function getModelDeclaration($modelClassName, array $properties, $applicationName, array &$foundRelations) { $globalPropertyIgnoreConfiguration = $this->configurationManager->getConfiguration('Settings', 'Radmiraal.Emberjs.properties._exclude'); $modelGenerationPropertyIgnoreConfiguration = $this->configurationManager->getConfiguration('Settings', 'Radmiraal.Emberjs.applications.' . $applicationName . '.model.ignoredProperties'); $ignoredProperties = array_merge($globalPropertyIgnoreConfiguration ?: array(), $modelGenerationPropertyIgnoreConfiguration ?: array()); $typeMapping = $this->configurationManager->getConfiguration('Settings', 'Radmiraal.Emberjs.applications.' . $applicationName . '.model.typeMapping'); $propertyDefinition = array(); foreach ($properties as $property => $propertyConfiguration) { if ($property === 'id' || in_array($property, $ignoredProperties) || $this->reflectionService->isPropertyAnnotatedWith($modelClassName, $property, 'TYPO3\\Flow\\Annotations\\Transient')) { continue; } $type = $propertyConfiguration['type']; if (isset($typeMapping[$type])) { $type = $typeMapping[$type]; } if (strpos($propertyConfiguration['type'], '\\')) { if (!in_array($propertyConfiguration['type'], $foundRelations)) { $foundRelations[] = $propertyConfiguration['type']; } $type = 'App.' . EmberDataUtility::uncamelizeClassName($type); } $propertyDefinition[] = sprintf('%s%s: DS.attr("%s")', chr(10) . "\t", $property, !empty($type) ? $type : 'string'); } $modelName = EmberDataUtility::uncamelizeClassName($modelClassName); return sprintf('App.%s = DS.Model.extend(App.ModelMixin, {%s%s});', $modelName, implode(',', $propertyDefinition), chr(10)) . chr(10); }
/** * @param string $providerName The provider name as given in Settings.yaml * @throws \InvalidArgumentException * @return TokenEndpointInterface */ public function getTokenEndpointForProvider($providerName) { $tokenEndpointClassName = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions.tokenEndpointClassName', $providerName)); if ($tokenEndpointClassName === NULL) { throw new \InvalidArgumentException(sprintf('In Settings.yaml, there was no "tokenEndpointClassName" option given for the provider "%s".', $providerName), 1383743372); } return $this->objectManager->get($tokenEndpointClassName); }
/** * Injects the configuration manager * * @param \TYPO3\Flow\Configuration\ConfigurationManager $configurationManager * @return void */ public function injectConfigurationManager(\TYPO3\Flow\Configuration\ConfigurationManager $configurationManager) { $this->configurationManager = $configurationManager; $this->matches = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Debug.Profiling.Classes'); foreach ($this->matches as $key => $value) { $this->matches[$key] = '/^' . str_replace('\\', '\\\\', $value) . '$/'; } }
/** * Resolve a route for the request * * Stores the resolved route values in the ComponentContext to pass them * to other components. They can be accessed via ComponentContext::getParameter('TYPO3\Flow\Mvc\Routing\RoutingComponent', 'matchResults'); * * @param ComponentContext $componentContext * @return void */ public function handle(ComponentContext $componentContext) { if ($componentContext->getParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'skipRouterInitialization') !== TRUE) { $routesConfiguration = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_ROUTES); $this->router->setRoutesConfiguration($routesConfiguration); } $matchResults = $this->router->route($componentContext->getHttpRequest()); $componentContext->setParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults', $matchResults); }
/** * @return void */ public function initializeObject() { $this->settings = $this->configurationManager->getConfiguration('Settings', 'TYPO3.Media'); $domain = $this->domainRepository->findOneByActiveRequest(); // Set active asset collection to the current site's asset collection, if it has one, on the first view if a matching domain is found if ($domain !== null && !$this->browserState->get('activeAssetCollection') && $this->browserState->get('automaticAssetCollectionSelection') !== true && $domain->getSite()->getAssetCollection() !== null) { $this->browserState->set('activeAssetCollection', $domain->getSite()->getAssetCollection()); $this->browserState->set('automaticAssetCollectionSelection', true); } }
/** * @param \TYPO3\Flow\Core\Bootstrap $bootstrap */ public function prepareRealtimeIndexing(\TYPO3\Flow\Core\Bootstrap $bootstrap) { $this->configurationManager = $bootstrap->getObjectManager()->get('TYPO3\\Flow\\Configuration\\ConfigurationManager'); $settings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->getPackageKey()); if (isset($settings['realtimeIndexing']['enabled']) && $settings['realtimeIndexing']['enabled'] === TRUE) { $bootstrap->getSignalSlotDispatcher()->connect('Flowpack\\ElasticSearch\\Indexer\\Object\\Signal\\SignalEmitter', 'objectUpdated', 'Flowpack\\ElasticSearch\\Indexer\\Object\\ObjectIndexer', 'indexObject'); $bootstrap->getSignalSlotDispatcher()->connect('Flowpack\\ElasticSearch\\Indexer\\Object\\Signal\\SignalEmitter', 'objectPersisted', 'Flowpack\\ElasticSearch\\Indexer\\Object\\ObjectIndexer', 'indexObject'); $bootstrap->getSignalSlotDispatcher()->connect('Flowpack\\ElasticSearch\\Indexer\\Object\\Signal\\SignalEmitter', 'objectRemoved', 'Flowpack\\ElasticSearch\\Indexer\\Object\\ObjectIndexer', 'removeObject'); } }
/** * Renders an HTML tag from a given asset. * * @param string $layout * @param int $columnNo * @return string */ public function render($layout, $columnNo = 1) { $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'JohannesSteu.Bootstrap.GridSystem.Layouts'); if (array_key_exists($layout, $settings)) { if (array_key_exists("col-" . $columnNo, $settings[$layout])) { return $settings[$layout]["col-" . $columnNo]; } } return ""; }
/** * @return array */ protected function getGuides() { $out = []; $chartSettings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'WMDB.Forger.Charts'); foreach ($chartSettings['Phases'] as $version => $phases) { foreach ($phases as $phaseName => $dates) { $out[] = ['fillAlpha' => 0.5, 'date' => $dates['start'], 'toDate' => $dates['end'], 'label' => $phaseName, 'position' => 'top', 'inside' => TRUE, 'fillColor' => $chartSettings['Colors'][$phaseName]]; } } return $out; }
/** * @param string $providerName * @throws \InvalidArgumentException * @return array */ protected function getConfiguredOptionsByProviderName($providerName) { if (!array_key_exists($providerName, $this->providerOptionsByProviderName)) { $providerOptions = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions', $providerName)); if (!is_array($providerOptions)) { throw new \InvalidArgumentException(sprintf('The given provider name "%s" was not properly defined in the Settings (i.e. being defined and having a "providerOptions" key).', $providerName), 1383739910); } $this->providerOptionsByProviderName[$providerName] = $providerOptions; } return $this->providerOptionsByProviderName[$providerName]; }
/** * Initializes the controller */ protected function initializeAction() { date_default_timezone_set('UTC'); $context = $this->env->getContext(); if ($context == 'Development') { $this->context = 'DEV'; } else { $this->context = 'PRD'; } $this->connection = new Es\ElasticSearchConnection(); $this->connection->init(); $this->sprintConfig = $this->ConfigurationManager->getConfiguration('Sprints'); }
/** * Validate a single configuration type * * @param string $configurationType the configuration typr to validate * @param string $path configuration path to validate, or NULL. * @param array $loadedSchemaFiles will be filled with a list of loaded schema files * @return \TYPO3\Flow\Error\Result * @throws Exception\SchemaValidationException */ protected function validateSingleType($configurationType, $path, &$loadedSchemaFiles) { $availableConfigurationTypes = $this->configurationManager->getAvailableConfigurationTypes(); if (in_array($configurationType, $availableConfigurationTypes) === false) { throw new Exception\SchemaValidationException('The configuration type "' . $configurationType . '" was not found. Only the following configuration types are supported: "' . implode('", "', $availableConfigurationTypes) . '"', 1364984886); } $configuration = $this->configurationManager->getConfiguration($configurationType); // find schema files for the given type and path $schemaFileInfos = array(); $activePackages = $this->packageManager->getActivePackages(); foreach ($activePackages as $package) { $packageKey = $package->getPackageKey(); $packageSchemaPath = Files::concatenatePaths(array($package->getResourcesPath(), 'Private/Schema')); if (is_dir($packageSchemaPath)) { foreach (Files::getRecursiveDirectoryGenerator($packageSchemaPath, '.schema.yaml') as $schemaFile) { $schemaName = substr($schemaFile, strlen($packageSchemaPath) + 1, -strlen('.schema.yaml')); $schemaNameParts = explode('.', str_replace('/', '.', $schemaName), 2); $schemaType = $schemaNameParts[0]; $schemaPath = isset($schemaNameParts[1]) ? $schemaNameParts[1] : null; if ($schemaType === $configurationType && ($path === null || strpos($schemaPath, $path) === 0)) { $schemaFileInfos[] = array('file' => $schemaFile, 'name' => $schemaName, 'path' => $schemaPath, 'packageKey' => $packageKey); } } } } if (count($schemaFileInfos) === 0) { throw new Exception\SchemaValidationException('No schema files found for configuration type "' . $configurationType . '"' . ($path !== null ? ' and path "' . $path . '".' : '.'), 1364985056); } $result = new Result(); foreach ($schemaFileInfos as $schemaFileInfo) { $loadedSchemaFiles[] = $schemaFileInfo['file']; if ($schemaFileInfo['path'] !== null) { $data = \TYPO3\Flow\Utility\Arrays::getValueByPath($configuration, $schemaFileInfo['path']); } else { $data = $configuration; } if (empty($data)) { $result->addNotice(new Notice('No configuration found, skipping schema "%s".', 1364985445, array(substr($schemaFileInfo['file'], strlen(FLOW_PATH_ROOT))))); } else { $parsedSchema = \Symfony\Component\Yaml\Yaml::parse($schemaFileInfo['file']); $validationResultForSingleSchema = $this->schemaValidator->validate($data, $parsedSchema); if ($schemaFileInfo['path'] !== null) { $result->forProperty($schemaFileInfo['path'])->merge($validationResultForSingleSchema); } else { $result->merge($validationResultForSingleSchema); } } } return $result; }
public function init() { $conf = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'WMDB.Forger.Elasticsearch.Credentials'); if (is_array($conf) && count($conf) > 0 && isset($conf['host']) && isset($conf['port']) && isset($conf['path']) && isset($conf['transport'])) { $elasticClientConfiguration = array('host' => $conf['host'], 'port' => $conf['port'], 'path' => $conf['path'], 'transport' => $conf['transport']); if (isset($conf['username']) && isset($conf['password'])) { $elasticClientConfiguration['headers'] = array('Authorization' => 'Basic ' . base64_encode($conf['username'] . ':' . $conf['password']) . '=='); } $elasticaClient = new \Elastica\Client($elasticClientConfiguration); $this->index = $elasticaClient->getIndex($conf['index']); } else { throw new Exception('Could not load elastic-credentials! Please check your setting.yaml!'); } }
/** * Notify SSO servers about the logged out client * * All active authentication tokens of type SingleSignOnToken will be * used to get the registered global session id and send a request * to the session service on the SSO server. * * @return void */ public function logout() { $allConfiguration = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow'); $tokens = $this->securityContext->getAuthenticationTokensOfType('Flowpack\\SingleSignOn\\Client\\Security\\SingleSignOnToken'); foreach ($tokens as $token) { $providerName = $token->getAuthenticationProviderName(); $serverIdentifier = \TYPO3\Flow\Utility\Arrays::getValueByPath($allConfiguration, 'security.authentication.providers.' . $providerName . '.providerOptions.server'); if ($serverIdentifier !== NULL) { $ssoClient = $this->ssoClientFactory->create(); $ssoServer = $this->ssoServerFactory->create($serverIdentifier); $ssoServer->destroySession($ssoClient, $token->getGlobalSessionId()); } } }
/** * @param string $type * @return void */ public function indexAction($type = 'Settings') { $availableConfigurationTypes = $this->configurationManager->getAvailableConfigurationTypes(); $this->view->assignMultiple(array('type' => $type, 'availableConfigurationTypes' => $availableConfigurationTypes)); if (in_array($type, $availableConfigurationTypes)) { $this->view->assign('configuration', $this->configurationManager->getConfiguration($type)); try { $this->view->assign('validationResult', $this->configurationSchemaValidator->validate($type)); } catch (\TYPO3\Flow\Configuration\Exception\SchemaValidationException $exception) { $this->addFlashMessage($exception->getMessage(), 'An error occurred during validation of the configuration.', Message::SEVERITY_ERROR, array(), 1412373972); } } else { $this->addFlashMessage('Configuration type not found.', '', Message::SEVERITY_ERROR, array(), 1412373998); } }
/** * Parses the given configuration path expression and sets $this->actualSettingValue * and $this->condition accordingly * * @param string $settingComparisonExpression The configuration expression (path + optional condition) * @return void * @throws \TYPO3\Flow\Aop\Exception\InvalidPointcutExpressionException */ protected function parseConfigurationOptionPath($settingComparisonExpression) { $settingComparisonExpression = preg_split(self::PATTERN_SPLITBYEQUALSIGN, $settingComparisonExpression); if (isset($settingComparisonExpression[1])) { $matches = array(); preg_match(self::PATTERN_MATCHVALUEINQUOTES, $settingComparisonExpression[1], $matches); if (isset($matches['SingleQuotedString']) && $matches['SingleQuotedString'] !== '') { $this->condition = $matches['SingleQuotedString']; } elseif (isset($matches['DoubleQuotedString']) && $matches['DoubleQuotedString'] !== '') { $this->condition = $matches['DoubleQuotedString']; } else { throw new \TYPO3\Flow\Aop\Exception\InvalidPointcutExpressionException('The given condition has a syntax error (Make sure to set quotes correctly). Got: "' . $settingComparisonExpression[1] . '"', 1230047529); } } $configurationKeys = preg_split('/\\./', $settingComparisonExpression[0]); if (count($configurationKeys) > 0) { $settingPackageKey = array_shift($configurationKeys); $settingValue = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $settingPackageKey); foreach ($configurationKeys as $currentKey) { if (!isset($settingValue[$currentKey])) { throw new \TYPO3\Flow\Aop\Exception\InvalidPointcutExpressionException('The given configuration path in the pointcut designator "setting" did not exist. Got: "' . $settingComparisonExpression[0] . '"', 1230035614); } $settingValue = $settingValue[$currentKey]; } $this->actualSettingValue = $settingValue; } }
/** * Returns a fresh or existing instance of the object specified by $objectName. * * This specialized get() method is able to do setter injection for properties * defined in the object configuration of the specified object. * * @param string $objectName The name of the object to return an instance of * @return object The object instance * @throws \TYPO3\Flow\Object\Exception\CannotBuildObjectException * @throws \TYPO3\Flow\Object\Exception\UnresolvedDependenciesException * @throws \TYPO3\Flow\Object\Exception\UnknownObjectException */ public function get($objectName) { if (isset($this->objects[$objectName]['i'])) { return $this->objects[$objectName]['i']; } if (isset($this->objectConfigurations[$objectName]) && count($this->objectConfigurations[$objectName]->getArguments()) > 0) { throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because constructor injection is not available in the compile time Object Manager. Refactor your code to use setter injection instead. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '. Build stack: ' . implode(', ', $this->objectNameBuildStack), 1297090026); } if (!isset($this->objects[$objectName])) { throw new Exception\UnknownObjectException('Cannot build object "' . $objectName . '" because it is unknown to the compile time Object Manager.', 1301477694); } if ($this->objects[$objectName]['s'] !== Configuration::SCOPE_SINGLETON) { throw new Exception\CannotBuildObjectException('Cannot build object "' . $objectName . '" because the get() method in the compile time Object Manager only supports singletons.', 1297090027); } $this->objectNameBuildStack[] = $objectName; $object = parent::get($objectName); /** @var Configuration $objectConfiguration */ $objectConfiguration = $this->objectConfigurations[$objectName]; /** @var Property $property */ foreach ($objectConfiguration->getProperties() as $propertyName => $property) { if ($property->getAutowiring() !== Configuration::AUTOWIRING_MODE_ON) { continue; } switch ($property->getType()) { case Property::PROPERTY_TYPES_STRAIGHTVALUE: $value = $property->getValue(); break; case Property::PROPERTY_TYPES_CONFIGURATION: $propertyValue = $property->getValue(); $value = $this->configurationManager->getConfiguration($propertyValue['type'], $propertyValue['path']); break; case Property::PROPERTY_TYPES_OBJECT: $propertyObjectName = $property->getValue(); if (!is_string($propertyObjectName)) { throw new Exception\CannotBuildObjectException('The object definition of "' . $objectName . '::' . $propertyName . '" is too complex for the compile time Object Manager. You can only use plain object names, not factories and the like. Check configuration in ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . ' and objects which depend on ' . $objectName . '.', 1297099659); } $value = $this->get($propertyObjectName); break; default: throw new Exception\CannotBuildObjectException('Invalid property type.', 1297090029); } if (method_exists($object, $setterMethodName = 'inject' . ucfirst($propertyName))) { $object->{$setterMethodName}($value); } elseif (method_exists($object, $setterMethodName = 'set' . ucfirst($propertyName))) { $object->{$setterMethodName}($value); } else { throw new Exception\UnresolvedDependenciesException('Could not inject configured property "' . $propertyName . '" into "' . $objectName . '" because no injection method exists, but for compile time use this is required. Configuration source: ' . $this->objectConfigurations[$objectName]->getConfigurationSourceHint() . '.', 1297110953); } } $initializationLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleInitializationMethodName(); if (method_exists($object, $initializationLifecycleMethodName)) { $object->{$initializationLifecycleMethodName}(); } $shutdownLifecycleMethodName = $this->objectConfigurations[$objectName]->getLifecycleShutdownMethodName(); if (method_exists($object, $shutdownLifecycleMethodName)) { $this->shutdownObjects[$object] = $shutdownLifecycleMethodName; } array_pop($this->objectNameBuildStack); return $object; }
/** * Loads all node types into memory. * * @return void */ protected function loadNodeTypes() { $completeNodeTypeConfiguration = $this->configurationManager->getConfiguration('NodeTypes'); foreach (array_keys($completeNodeTypeConfiguration) as $nodeTypeName) { $this->loadNodeType($nodeTypeName, $completeNodeTypeConfiguration); } }
public function compileSchema() { $schema = (array) $this->configurationManager->getConfiguration('Expose', $this->className); SettingsValidator::validate($schema, $this->supportedClassSettings); if (isset($schema['properties'])) { foreach ($schema['properties'] as $propertyName => $propertySettings) { SettingsValidator::validate($propertySettings, $this->supportedPropertySettings); } } $arrayKeys = array('listProperties', 'searchProperties', 'filterProperties'); foreach ($arrayKeys as $key) { if (isset($schema[$key]) && is_string($schema[$key])) { $schema[$key] = Arrays::trimExplode(',', $schema[$key]); } } return $schema; }
/** * @param array $issue */ public function sendMessage(array $issue) { $slackConfig = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'WMDB.Forger.Slack'); if ($slackConfig['Url'] == 'void') { return true; } $browser = new \TYPO3\Flow\Http\Client\Browser(); $engine = new \TYPO3\Flow\Http\Client\CurlEngine(); $browser->setRequestEngine($engine); if ($issue['tracker']['name'] === 'Bug') { $color = 'danger'; } else { $color = 'good'; } $jsonString = json_encode(['channel' => '#typo3-cms-issues', 'username' => 'Forger found a new issue', 'icon_url' => 'https://typo3.slack.com/services/B02KBL9GG', 'attachments' => [['title' => $issue['subject'], 'title_link' => 'https://forge.typo3.org/issues/' . $issue['id'], 'text' => $issue['description'], 'fallback' => $issue['subject'], 'author_name' => $issue['author']['name'], 'color' => $color, 'fields' => [['title' => 'Status', 'value' => $issue['status']['name'], 'short' => TRUE], ['title' => 'Tracker', 'value' => $issue['tracker']['name'], 'short' => TRUE]]]]], JSON_PRETTY_PRINT); $browser->request($slackConfig['Url'], 'POST', [], [], [], $jsonString); }
/** * Sets the connection parameters from the TYPO3 Flow Database configuration */ protected function setConnectionParameters() { $flowSettings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow'); try { $this->server = $flowSettings['persistence']['backendOptions']['host']; } catch (\Exception $e) { $this->server = self::DEFAULT_SERVER; } try { $this->port = $flowSettings['persistence']['backendOptions']['port']; } catch (\Exception $e) { $this->port = self::DEFAULT_PORT; } $this->username = $flowSettings['persistence']['backendOptions']['user']; $this->password = $flowSettings['persistence']['backendOptions']['password']; $this->database = $flowSettings['persistence']['backendOptions']['dbname']; }
/** * Checks if default mapper is configured to map party for given provider. * * @param string $providerName * * @return bool */ private function shouldMapParty($providerName) { $casMappingSettings = $this->configurationManager->getConfiguration(\TYPO3\Flow\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication.providers.' . $providerName . '.providerOptions.Mapping'); if (isset($casMappingSettings['Party']) && (empty($casMappingSettings['Party']['doNotMapParties']) || $casMappingSettings['Party']['doNotMapParties'] !== true) && (empty($casMappingSettings['doNotMapParties']) || $casMappingSettings['doNotMapParties'] !== true)) { return true; } return false; }
/** * If Action for new users is defined and new user is detected, then makes this method redirect to defined Action and breaks authentication. * * You must persist new user self and afterwards authenticate this user by calling $this->casManager->authenticateNewUser($providerName). * * @param string $providerName * @param Account $account * * @throws StopActionException * * @return void */ private function mekeRedirectByNewUserIfNeeded($providerName, Account $account) { $redirectControllerAndAction = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Flow.security.authentication.providers.' . $providerName . '.providerOptions.Mapping.redirectByNewUser'); if (!empty($redirectControllerAndAction)) { $this->casManager->setMiscellaneousByPath($providerName . '.Account', $account); $this->fixWhiteScreenByAbortingAuthentication($providerName); throw new StopActionException('New user detectded.', 1375270925); } }
/** * Merges the TYPO3.Ice settings with the current settings before calling the render() method * * @return string */ public function initializeArgumentsAndRender() { $settings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'TYPO3.Ice'); if ($this->controllerContext->getRequest()->getControllerPackageKey() !== 'TYPO3.Ice') { $packageSettings = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->controllerContext->getRequest()->getControllerPackageKey()); if (!empty($packageSettings['extendIceSettings'])) { $settings = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $packageSettings); } else { $settings = $packageSettings; } } if (isset($settings['projectElementTypes'])) { $supertypeResolver = new \TYPO3\Ice\Utility\SupertypeResolver($settings['projectElementTypes']); $settings['projectElementTypes'] = $supertypeResolver->getCompleteMergedTypeDefinition(TRUE); } $this->settings = $settings; return parent::initializeArgumentsAndRender(); }
public function checkCity($city) { $backendOptions = $this->configurationManager->getConfiguration('Settings', 'TYPO3.Flow.persistence.backendOptions'); $config = new \Doctrine\DBAL\Configuration(); $this->connection = \Doctrine\DBAL\DriverManager::getConnection($backendOptions, $config); $statement = "SELECT count(*) as number FROM `city` " . "WHERE `city`.`name` like '" . $city . "'"; $result = $this->connection->query($statement)->fetchAll(); return $result[0]; }