Example #1
1
 /**
  * Render the captcha image html
  *
  * @param string suffix to be appended to the extenstion key when forming css class names
  * @return string The html used to render the captcha image
  */
 public function render($suffix = '')
 {
     $value = '';
     // Include the required JavaScript
     $GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
     // Disable caching
     $GLOBALS['TSFE']->no_cache = 1;
     // Get the plugin configuration
     $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
     // Get the translation view helper
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
     $translator->injectConfigurationManager($this->configurationManager);
     // Generate the image url
     $fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
     $siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $L = GeneralUtility::_GP('L');
     $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
     if ($GLOBALS['TSFE']->MP) {
         $urlParams['MP'] = $GLOBALS['TSFE']->MP;
     }
     $urlParams['set'] = $fakeId;
     $imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
     // Generate the html text
     $value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
     return $value;
 }
Example #2
0
 /**
  * @return mixed
  * @throws \Exception
  */
 public function render()
 {
     $contentUid = intval($this->arguments['contentUid']);
     if (0 === $contentUid) {
         $cObj = $this->configurationManager->getContentObject();
         $record = $cObj->data;
     }
     $field = $this->arguments['field'];
     if (false === isset($record) && 0 !== $contentUid) {
         if (null !== $field && true === isset($GLOBALS['TCA']['tt_content']['columns'][$field])) {
             $selectFields = $field;
         } else {
             $selectFields = '*';
         }
         $record = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow($selectFields, 'tt_content', sprintf('uid=%d', $contentUid));
         // Add the page overlay
         $languageUid = intval($GLOBALS['TSFE']->sys_language_uid);
         if (0 !== $languageUid && $GLOBALS['TSFE']->sys_language_contentOL) {
             $record = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_content', $record, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL);
         }
     }
     if (false === $record && false === isset($record)) {
         throw new \Exception(sprintf('Either record with uid %d or field %s do not exist.', $contentUid, $selectFields), 1358679983);
     }
     // Check if single field or whole record should be returned
     $content = null;
     if (null === $field) {
         $content = $record;
     } elseif (true === isset($record[$field])) {
         $content = $record[$field];
     }
     return $this->renderChildrenWithVariableOrReturnInput($content);
 }
Example #3
0
 /**
  * Initializes configuration manager, object container and reflection service
  *
  * @param array $configuration
  * @return void
  */
 protected function initialize(array $configuration)
 {
     // initialize unconsumed Request and Response
     $this->request = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Request');
     $this->response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Cli\\Response');
     // initialize configuration
     $this->configurationManager->setContentObject(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'));
     $this->configurationManager->setConfiguration($configuration);
     // configure object container
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     if (isset($frameworkConfiguration['objects'])) {
         $objectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\Container\\Container');
         foreach ($frameworkConfiguration['objects'] as $classNameWithDot => $classConfiguration) {
             if (isset($classConfiguration['className'])) {
                 $originalClassName = rtrim($classNameWithDot, '.');
                 $objectContainer->registerImplementation($originalClassName, $classConfiguration['className']);
             }
         }
     }
     // initialize reflection
     $reflectionService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Reflection\\ReflectionService');
     $reflectionService->setDataCache(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('extbase_reflection'));
     if (!$reflectionService->isInitialized()) {
         $reflectionService->initialize();
     }
 }
 protected function initializeEnvironment()
 {
     /**
      * @var ConfigurationManager $configurationManager
      * @var ContentObjectRenderer $contentObjectRenderer
      */
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
     $this->configurationManager =& $configurationManager;
     $contentObjectRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
     $this->configurationManager->setContentObject($contentObjectRenderer);
     $this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     if (empty($GLOBALS['TSFE']->sys_page)) {
         $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
     }
     if (empty($GLOBALS['TSFE']->tmpl)) {
         $GLOBALS['TSFE']->initTemplate();
     }
     if (!isset($GLOBALS['TSFE']->config)) {
         $GLOBALS['TSFE']->config = array();
     }
     if (empty($GLOBALS['TSFE']->config['config'])) {
         $GLOBALS['TSFE']->config['config'] = array();
         $GLOBALS['TSFE']->config['config']['tx_realurl_enable'] = TRUE;
         $GLOBALS['TSFE']->config['mainScript'] = 'index.php';
     }
 }
 /**
  * Returns all settings.
  *
  * @return array
  */
 public function getSettings()
 {
     if ($this->settings === NULL) {
         $this->settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'News', 'Pi1');
     }
     return $this->settings;
 }
 /**
  * @return string
  */
 public function render()
 {
     $value = $this->configurationManager->getContentObject() ? $this->configurationManager->getContentObject()->data : array();
     if ($this->arguments['as']) {
         $variableNameArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('.', $this->arguments['as'], TRUE, 2);
         $variableName = $variableNameArr[0];
         $attributePath = $variableNameArr[1];
         if ($this->templateVariableContainer->exists($variableName)) {
             $oldValue = $this->templateVariableContainer->get($variableName);
             $this->templateVariableContainer->remove($variableName);
         }
         if ($attributePath) {
             if ($oldValue && is_array($oldValue)) {
                 $templateValue = $oldValue;
                 $templateValue[$attributePath] = $value;
             } else {
                 $templateValue = array($attributePath => $value);
             }
         } else {
             $templateValue = $value;
         }
         $this->templateVariableContainer->add($variableName, $templateValue);
         return '';
     } else {
         return $value;
     }
 }
Example #7
0
 /**
  * Builds a CLI request object from a command line.
  *
  * The given command line may be a string (e.g. "myextension:foo do-that-thing --force") or
  * an array consisting of the individual parts. The array must not include the script
  * name (like in $argv) but start with command right away.
  *
  * @param mixed $commandLine The command line, either as a string or as an array
  * @param string $callingScript The calling script (usually ./typo3/cli_dispatch.phpsh)
  * @return \TYPO3\CMS\Extbase\Mvc\Cli\Request The CLI request as an object
  */
 public function build($commandLine = '', $callingScript = './typo3/cli_dispatch.phpsh extbase')
 {
     $request = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Cli\Request::class);
     $request->setCallingScript($callingScript);
     $request->setControllerObjectName(\TYPO3\CMS\Extbase\Command\HelpCommandController::class);
     $rawCommandLineArguments = is_array($commandLine) ? $commandLine : explode(' ', $commandLine);
     if (empty($rawCommandLineArguments)) {
         $request->setControllerCommandName('helpStub');
         return $request;
     }
     $commandIdentifier = trim(array_shift($rawCommandLineArguments));
     try {
         $command = $this->commandManager->getCommandByIdentifier($commandIdentifier);
         $this->configurationManager->setConfiguration(array('extensionName' => $command->getExtensionName()));
     } catch (\TYPO3\CMS\Extbase\Mvc\Exception\CommandException $exception) {
         $request->setArgument('exception', $exception);
         $request->setControllerCommandName('error');
         return $request;
     }
     $controllerObjectName = $command->getControllerClassName();
     $controllerCommandName = $command->getControllerCommandName();
     $request->setControllerObjectName($controllerObjectName);
     $request->setControllerCommandName($controllerCommandName);
     list($commandLineArguments, $exceedingCommandLineArguments) = $this->parseRawCommandLineArguments($rawCommandLineArguments, $controllerObjectName, $controllerCommandName);
     $request->setArguments($commandLineArguments);
     $request->setExceedingArguments($exceedingCommandLineArguments);
     return $request;
 }
Example #8
0
 /**
  * Action initializer
  *
  * @return void
  */
 protected function initializeAction()
 {
     $pageId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $persistenceConfiguration = ['persistence' => ['storagePid' => $pageId]];
     $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $persistenceConfiguration));
 }
 /**
  * Returns the TS configuration
  *
  * @return array|mixed
  */
 public function getConfiguration()
 {
     if ($this->configuration === NULL) {
         $this->configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     }
     return $this->configuration;
 }
 /**
  * The cleanup command
  *
  * @return void
  */
 public function cleanupCommand()
 {
     $fullSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'SfEventMgt', 'Pievent');
     $settings = $fullSettings['plugin.']['tx_sfeventmgt.']['settings.'];
     $this->registrationService->handleExpiredRegistrations($settings['registration.']['deleteExpiredRegistrations']);
     // Clear cache for configured pages
     $this->utilityService->clearCacheForConfiguredUids($settings);
 }
Example #11
0
 /**
  * Initialize the object (called by objectManager)
  * 
  */
 public function initializeObject()
 {
     $frameWorkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $this->extensionName = $frameWorkConfiguration['extensionName'];
     $this->extensionNameSpace = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Extbase\\Service\\ExtensionService')->getPluginNamespace($frameWorkConfiguration['extensionName'], $frameWorkConfiguration['pluginName']);
     $this->inCachedMode = $frameWorkConfiguration['pluginName'] == 'Cached' ? true : false;
     unset($frameWorkConfiguration);
 }
Example #12
0
 /**
  * Injects the Configuration Manager
  *
  * @param ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $typoScriptSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     if (!empty($typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.'])) {
         $this->settings = \TYPO3\CMS\Core\Utility\GeneralUtility::removeDotsFromTS($typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.']);
     }
 }
 /**
  * The cleanup command
  *
  * @return void
  */
 public function cleanupCommand()
 {
     $fullSettings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT, 'SfEventMgt', 'Pievent');
     $settings = $fullSettings['plugin.']['tx_sfeventmgt.']['settings.'];
     $this->registrationService->handleExpiredRegistrations($settings['registration.']['deleteExpiredRegistrations']);
     $pidList = explode(',', $settings['clearCacheUids']);
     $this->cacheService->clearPageCache($pidList);
 }
Example #14
0
 /**
  * Initialize objects
  */
 public function initializeObject()
 {
     $configuration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $this->settings = $configuration['settings'];
     $this->features = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $this->priceInfluencer = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $this->information = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
 }
 /**
  * Initialize the object (called by objectManager)
  *
  */
 public function initializeObject()
 {
     $frameWorkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $this->extensionName = $frameWorkConfiguration['extensionName'];
     $this->setExtensionNamespace($frameWorkConfiguration['extensionName'], $frameWorkConfiguration['pluginName']);
     $this->isInCachedMode = $frameWorkConfiguration['pluginName'] == 'Cached' ? true : false;
     $this->currentListIdentifier = $frameWorkConfiguration['settings']['listIdentifier'];
     unset($frameWorkConfiguration);
 }
 /**
  * Action initializer
  *
  * @return void
  */
 protected function initializeAction()
 {
     # $this->pageId = (int)t3lib_div::_GP('id');
     $this->pageId = (int) $GLOBALS['TSFE']->id;
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $persistenceConfiguration = array('persistence' => array('storagePid' => $this->pageId));
     $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $persistenceConfiguration));
     #debug($this->request->getArguments());
 }
 /**
  * Check if this field is a required field
  *
  * @param \string $fieldName
  * @param \string $actionName
  * @return \bool
  */
 public function render($fieldName, $actionName = 'editAction')
 {
     $action = str_replace('Action', '', $actionName);
     $configuration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     if (isset($configuration['settings'][$action]['validation'][$fieldName]['required']) && $configuration['settings'][$action]['validation'][$fieldName]['required'] === '1') {
         return TRUE;
     }
     return FALSE;
 }
Example #18
0
 /**
  * @return \Tx_Yag_Domain_Configuration_Image_ResolutionConfigCollection
  */
 protected function getSelectedResolutionConfigs()
 {
     $settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'Yag', 'pi1');
     \Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::injectSettings($settings);
     $configurationBuilder = \Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance('default', 'backend');
     $resolutionConfigCollection = \Tx_Yag_Domain_Configuration_Image_ResolutionConfigCollectionFactory::getInstanceOfAllThemes($configurationBuilder);
     $selectedResolutionConfigCollection = $resolutionConfigCollection->extractCollectionByThemeList($this->selectedThemes);
     return $selectedResolutionConfigCollection;
 }
Example #19
0
 /**
  * {@inheritdoc}
  */
 public function initializeObject()
 {
     $this->defaultOrderings = ['name' => QueryInterface::ORDER_ASCENDING];
     // Ensure correct storage PID is used, regardless of what plugin the
     // repository is injected into
     $config = $this->cm->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'tevmailchimp');
     $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
     $querySettings->setStoragePageIds([$config['persistence']['storagePid']]);
     $this->setDefaultQuerySettings($querySettings);
 }
 public function setUp()
 {
     parent::setUp();
     $this->mockContentObject = $this->getMock('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(), array(), '', FALSE);
     $this->mockConfigurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $this->mockConfigurationManager->expects($this->any())->method('getContentObject')->will($this->returnValue($this->mockContentObject));
     $this->viewHelper = $this->getMock('TYPO3\\CMS\\Fluid\\ViewHelpers\\Format\\CropViewHelper', array('renderChildren'));
     $this->viewHelper->injectConfigurationManager($this->mockConfigurationManager);
     $this->viewHelper->expects($this->once())->method('renderChildren')->will($this->returnValue('Some Content'));
 }
 /**
  * Call command
  */
 protected function callCommandMethod()
 {
     $this->settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'newsImporter');
     /** @var StorageRepository $storageRepository */
     $storageRepository = $this->objectManager->get(StorageRepository::class);
     foreach ($storageRepository->findAll() as $storage) {
         $storage->setEvaluatePermissions(FALSE);
     }
     parent::callCommandMethod();
 }
 /**
  * returns a standalone template
  *
  * @param  \string                              $templatePath the template path relative to templateRootPath (UpperCamelCase)
  * @return \TYPO3\CMS\Fluid\View\StandaloneView
  */
 public function buildTemplate($templatePath)
 {
     /** @var \TYPO3\CMS\Fluid\View\StandaloneView $view */
     $view = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $extbaseFrameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $templateRootPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($extbaseFrameworkConfiguration['view']['templateRootPath']);
     $templatePathAndFilename = $templateRootPath . $templatePath;
     $view->setTemplatePathAndFilename($templatePathAndFilename);
     return $view;
 }
Example #23
0
 /**
  * Inject all dependencies, DI is not available here
  */
 public function __construct()
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->securityService = $this->objectManager->get('Aijko\\Paypal\\Service\\Security');
     $this->configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface');
     $pluginConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'paypal');
     $this->settings = $pluginConfiguration['settings'];
     $this->securityService->injectSettings($this->settings);
     $this->viewUtility = $this->objectManager->get('Aijko\\SharepointConnector\\Utility\\View');
     $this->viewUtility->setTemplateRootPath($pluginConfiguration['view']['templateRootPath']);
 }
Example #24
0
 protected function initializeAction()
 {
     if ($GLOBALS['TSFE'] === NULL) {
         $this->pageId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     } else {
         $this->pageId = $GLOBALS['TSFE']->id;
     }
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $persistenceConfiguration = array('persistence' => array('storagePid' => $this->pageId));
     $this->configurationManager->setConfiguration(array_merge($frameworkConfiguration, $persistenceConfiguration));
     $this->piVars = $this->request->getArguments();
 }
 /**
  * gets a TS Array by path
  *
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
  * @param $typoscriptObjectPath
  * @return array
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
  */
 public static function getTsArrayByPath($configurationManager, $typoscriptObjectPath)
 {
     $setup = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $pathSegments = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('.', $typoscriptObjectPath);
     foreach ($pathSegments as $segment) {
         if (!array_key_exists($segment . '.', $setup)) {
             throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) . '" does not exist', 1253191023);
         }
         $setup = $setup[$segment . '.'];
     }
     return $setup;
 }
Example #26
0
 /**
  * Loads the typoscript configuration from a certain setup path.
  *
  * @param string $configurationPath The typoscript path
  * @return array The typoscript configuration for the specified path.
  * @throws Exception
  */
 public function loadTyposcriptFromPath($configurationPath)
 {
     $setup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $pathSegments = GeneralUtility::trimExplode('.', $configurationPath);
     $lastSegment = array_pop($pathSegments);
     foreach ($pathSegments as $segment) {
         if (!array_key_exists($segment . '.', $setup)) {
             throw new Exception('TypoScript object path "' . htmlspecialchars($configurationPath) . '" does not exist', 1253191023);
         }
         $setup = $setup[$segment . '.'];
     }
     return $setup[$lastSegment . '.'];
 }
 /**
  * @return string
  */
 public function render()
 {
     $fullTs = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $reCaptchaSettings = $fullTs['plugin.']['tx_powermail.']['settings.']['setup.']['reCAPTCHA.'];
     if (isset($reCaptchaSettings) && is_array($reCaptchaSettings) && isset($reCaptchaSettings['siteKey']) && $reCaptchaSettings['siteKey']) {
         $this->templateVariableContainer->add('siteKey', $reCaptchaSettings['siteKey']);
         $content = $this->renderChildren();
         $this->templateVariableContainer->remove('siteKey');
     } else {
         throw new InvalidVariableException('No siteKey provided in TypoScript constants', 1358349150);
     }
     return $content;
 }
Example #28
0
 /**
  * A function for injecting dependencies. Should be called first
  * thing within the overridden 'execute' method.
  *
  * @param $extensionName
  * @param $pluginName
  */
 protected function initialize($extensionName, $pluginName)
 {
     $injectionService = GeneralUtility::makeInstance('CIC\\Cicbase\\Service\\InjectionService');
     $injectionService->doInjection($this);
     // Grab the settings array
     $this->configurationManager->setConfiguration(array('extensionName' => $extensionName, 'pluginName' => $pluginName));
     $this->settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
     if (!$this->settings) {
         $configuration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         $settings = $configuration['plugin.']['tx_' . strtolower($extensionName) . '.']['settings.'];
         $this->settings = $this->typoscriptService->convertTypoScriptArrayToPlainArray($settings);
     }
 }
Example #29
0
 /**
  * Creates a query object working on the given class name
  *
  * @param string $className The class name
  * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
  * @throws \TYPO3\CMS\Extbase\Persistence\Generic\Exception
  */
 public function create($className)
 {
     $query = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\QueryInterface::class, $className);
     $querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface::class);
     $dataMap = $this->dataMapper->getDataMap($className);
     if ($dataMap->getIsStatic() || $dataMap->getRootLevel()) {
         $querySettings->setRespectStoragePage(false);
     }
     $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $querySettings->setStoragePageIds(\TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']));
     $query->setQuerySettings($querySettings);
     return $query;
 }
Example #30
0
 /**
  * Configures the object manager object configuration from
  * config.tx_extbase.objects
  *
  * @return void
  * @see initialize()
  * @todo this is duplicated code (see \TYPO3\CMS\Extbase\Core\Bootstrap::configureObjectManager())
  */
 public function configureObjectManager()
 {
     $typoScriptSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     if (!is_array($typoScriptSetup['config.']['tx_extbase.']['objects.'])) {
         return;
     }
     $objectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class);
     foreach ($typoScriptSetup['config.']['tx_extbase.']['objects.'] as $classNameWithDot => $classConfiguration) {
         if (isset($classConfiguration['className'])) {
             $originalClassName = rtrim($classNameWithDot, '.');
             $objectContainer->registerImplementation($originalClassName, $classConfiguration['className']);
         }
     }
 }