예제 #1
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);
 }
 /**
  * @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;
     }
 }
예제 #3
0
 /**
  * Injects the Configuration Manager and is initializing the framework settings
  *
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager Instance of the Configuration Manager
  * @return void
  */
 public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $tsSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'news', 'news_pi1');
     $originalSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
     $propertiesNotAllowedViaFlexForms = ['orderByAllowed'];
     foreach ($propertiesNotAllowedViaFlexForms as $property) {
         $originalSettings[$property] = $tsSettings['settings'][$property];
     }
     // Use stdWrap for given defined settings
     if (isset($originalSettings['useStdWrap']) && !empty($originalSettings['useStdWrap'])) {
         /** @var  \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService */
         $typoScriptService = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
         $typoScriptArray = $typoScriptService->convertPlainArrayToTypoScriptArray($originalSettings);
         $stdWrapProperties = GeneralUtility::trimExplode(',', $originalSettings['useStdWrap'], true);
         foreach ($stdWrapProperties as $key) {
             if (is_array($typoScriptArray[$key . '.'])) {
                 $originalSettings[$key] = $this->configurationManager->getContentObject()->stdWrap($originalSettings[$key], $typoScriptArray[$key . '.']);
             }
         }
     }
     // start override
     if (isset($tsSettings['settings']['overrideFlexformSettingsIfEmpty'])) {
         /** @var \GeorgRinger\News\Utility\TypoScript $typoScriptUtility */
         $typoScriptUtility = GeneralUtility::makeInstance(\GeorgRinger\News\Utility\TypoScript::class);
         $originalSettings = $typoScriptUtility->override($originalSettings, $tsSettings);
     }
     $this->settings = $originalSettings;
 }
예제 #4
0
 /**
  * Inject Configuration Manager
  *
  * @param ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $this->cObj = $this->configurationManager->getContentObject();
     $typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $this->settings = $typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.'];
 }
 /**
  * Initialize
  *
  * @return void
  */
 public function initializeFinisher()
 {
     $this->contentObject = $this->configurationManager->getContentObject();
     $this->contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($this->mail));
     $typoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $this->configuration = $typoScript['plugin.']['tx_powermail.']['settings.']['setup.']['marketing.']['sendPost.'];
 }
예제 #6
0
 /**
  * @param ProviderInterface $provider
  * @param array $row
  * @param Form $form
  * @return string|NULL
  */
 protected function renderPreviewSection(ProviderInterface $provider, array $row, Form $form = NULL)
 {
     $templatePathAndFilename = $provider->getTemplatePathAndFilename($row);
     if (NULL === $templatePathAndFilename) {
         return NULL;
     }
     $extensionKey = $provider->getExtensionKey($row);
     $paths = $provider->getTemplatePaths($row);
     $flexformVariables = $provider->getFlexFormValues($row);
     $templateVariables = $provider->getTemplateVariables($row);
     $variables = RecursiveArrayUtility::merge($templateVariables, $flexformVariables);
     $variables['row'] = $row;
     $variables['record'] = $row;
     if (TRUE === is_object($form)) {
         $formLabel = $form->getLabel();
         $label = LocalizationUtility::translate($formLabel, $extensionKey);
         $variables['label'] = $label;
     }
     $templatePaths = new TemplatePaths($paths);
     $viewContext = new ViewContext($templatePathAndFilename, $extensionKey, self::CONTROLLER_NAME);
     $viewContext->setTemplatePaths($templatePaths);
     $viewContext->setVariables($variables);
     $view = $this->configurationService->getPreparedExposedTemplateView($viewContext);
     $existingContentObject = $this->configurationManager->getContentObject();
     $contentObject = new ContentObjectRenderer();
     $contentObject->start($row, $provider->getTableName($row));
     $this->configurationManager->setContentObject($contentObject);
     $previewContent = $view->renderStandaloneSection(self::PREVIEW_SECTION, $variables, TRUE);
     $this->configurationManager->setContentObject($existingContentObject);
     $previewContent = trim($previewContent);
     return $previewContent;
 }
예제 #7
0
 /**
  * Injects the Configuration Manager and is initializing the framework settings
  *
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager Instance of the Configuration Manager
  * @return void
  */
 public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $tsSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'news', 'news_pi1');
     $originalSettings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
     // Use stdWrap for given defined settings
     if (isset($originalSettings['useStdWrap']) && !empty($originalSettings['useStdWrap'])) {
         /** @var  \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService */
         $typoScriptService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
         $typoScriptArray = $typoScriptService->convertPlainArrayToTypoScriptArray($originalSettings);
         $stdWrapProperties = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $originalSettings['useStdWrap'], TRUE);
         foreach ($stdWrapProperties as $key) {
             if (is_array($typoScriptArray[$key . '.'])) {
                 $originalSettings[$key] = $this->configurationManager->getContentObject()->stdWrap($originalSettings[$key], $typoScriptArray[$key . '.']);
             }
         }
     }
     // start override
     if (isset($tsSettings['settings']['overrideFlexformSettingsIfEmpty'])) {
         /** @var Tx_MooxNews_Utility_TypoScript $typoScriptUtility */
         $typoScriptUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_MooxNews_Utility_TypoScript');
         $originalSettings = $typoScriptUtility->override($originalSettings, $tsSettings);
     }
     $this->settings = $originalSettings;
 }
예제 #8
0
 /**
  * This function renders an array of tt_content record into an array of rendered content
  * it returns a list of elements rendered by typoscript RECORDS function
  *
  * @param array $rows database rows of records (each item is a tt_content table record)
  * @return array
  */
 protected function getRenderedRecords($rows)
 {
     $elements = array();
     foreach ($rows as $row) {
         $conf = array('tables' => 'tt_content', 'source' => $row['uid'], 'dontCheckPid' => 1);
         array_push($elements, $this->configurationManager->getContentObject()->cObjGetSingle('RECORDS', $conf));
     }
     return $elements;
 }
예제 #9
0
 /**
  * Show selected person's entry for displaying it
  *
  */
 public function showSelectedAction()
 {
     /** @var int $position */
     $position = $this->configurationManager->getContentObject()->data['colPos'];
     $templateChosen = intval($this->settings['chooseTemplate']);
     $selectedPeople = GeneralUtility::intExplode(',', $this->settings['showPeople']);
     $persons = $this->personRepository->findPeopleInList($selectedPeople);
     $this->view->assign('persons', $persons)->assign('position', $position)->assign('showOrganizationalDetails', $this->settings['showOrganizationalDetails'])->assign('template', $templateChosen);
 }
 /**
  * @param string $action
  * @param array $arguments
  * @param string $controller
  * @param string $extensionName
  * @param string $pluginName
  * @param string $format
  * @param int $pageUid
  * @param boolean $cachedAjaxIfPossible TRUE if the URI should be cached (with respect to non-cacheable actions)
  * @param boolean $forceContext TRUE if the controller/action/... should be passed
  * @param boolean $noAjax
  *
  * @return string
  */
 public function render($action = NULL, array $arguments = array(), $controller = NULL, $extensionName = NULL, $pluginName = NULL, $format = '', $pageUid = NULL, $cachedAjaxIfPossible = TRUE, $forceContext = TRUE, $noAjax = FALSE)
 {
     $request = $this->mvcDispatcher->getCurrentRequest();
     if ($forceContext) {
         $requestArguments = $this->controllerContext->getRequest()->getArguments();
         $requestArguments = array_merge($requestArguments, $this->hijaxEventDispatcher->getContextArguments());
         $requestArguments = array_merge($requestArguments, $arguments);
         $arguments = $requestArguments;
     }
     if ($noAjax) {
         return parent::render($action, $arguments, $controller, $extensionName, $pluginName, $pageUid);
     } else {
         /* @var $listener \EssentialDots\ExtbaseHijax\Event\Listener */
         $listener = $this->mvcDispatcher->getCurrentListener();
         if ($request) {
             if ($action === NULL) {
                 $action = $request->getControllerActionName();
             }
             if ($controller === NULL) {
                 $controller = $request->getControllerName();
             }
             if ($extensionName === NULL) {
                 $extensionName = $request->getControllerExtensionName();
             }
             if ($pluginName === NULL && TYPO3_MODE === 'FE') {
                 $pluginName = $this->extensionService->getPluginNameByAction($extensionName, $controller, $action);
             }
             if ($pluginName === NULL) {
                 $pluginName = $request->getPluginName();
             }
             $cachedAjaxIfPossible = $cachedAjaxIfPossible ? $this->configurationManager->getContentObject()->getUserObjectType() != ContentObjectRenderer::OBJECTTYPE_USER_INT : false;
             if ($cachedAjaxIfPossible) {
                 /* @var $cacheHash \TYPO3\CMS\Frontend\Page\CacheHashCalculator */
                 $cacheHash = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator');
                 $chash = $cacheHash->calculateCacheHash(array('encryptionKey' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'], 'action' => $action, 'controller' => $controller, 'extension' => $extensionName, 'plugin' => $pluginName, 'arguments' => $this->array_map_recursive('strval', $arguments), 'settingsHash' => $listener->getId()));
             }
         }
         $additionalArguments = array();
         $this->hA('r[0][arguments]', $arguments, $additionalArguments);
         $language = intval($GLOBALS['TSFE'] ? $GLOBALS['TSFE']->sys_language_content : 0);
         $additionalParams = "&r[0][extension]={$extensionName}&r[0][plugin]={$pluginName}&r[0][controller]={$controller}&r[0][action]={$action}&r[0][format]={$format}&r[0][settingsHash]={$listener->getId()}&eID=extbase_hijax_dispatcher&L={$language}";
         if ($additionalArguments) {
             $additionalParams .= '&' . implode('&', $additionalArguments);
         }
         if ($chash) {
             $additionalParams .= '&r[0][chash]=' . $chash;
         }
         /* @var $cObj \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer */
         $cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
         $uri = $cObj->typoLink('', array('returnLast' => 'url', 'additionalParams' => $additionalParams, 'parameter' => $pageUid ? $pageUid : ($GLOBALS['TSFE'] ? $GLOBALS['TSFE']->id : 0)));
         $this->tag->addAttribute('href', $uri);
         $this->tag->setContent($this->renderChildren());
         $this->tag->forceClosingTag(TRUE);
         return $this->tag->render();
     }
 }
예제 #11
0
 /**
  * Handles the web request. The response will automatically be sent to the client.
  *
  * @return \TYPO3\CMS\Extbase\Mvc\ResponseInterface|NULL
  */
 public function handleRequest()
 {
     $request = $this->requestBuilder->build();
     if ($this->extensionService->isActionCacheable(NULL, NULL, $request->getControllerName(), $request->getControllerActionName())) {
         $request->setIsCached(TRUE);
     } else {
         $contentObject = $this->configurationManager->getContentObject();
         if ($contentObject->getUserObjectType() === \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
             $contentObject->convertToUserIntObject();
             // \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::convertToUserIntObject() will recreate the object, so we have to stop the request here
             return NULL;
         }
         $request->setIsCached(FALSE);
     }
     /** @var $response \TYPO3\CMS\Extbase\Mvc\ResponseInterface */
     $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
     $this->dispatcher->dispatch($request, $response);
     return $response;
 }
예제 #12
0
 /**
  * Override the title tag
  *
  * @param boolean $concat
  * @return void
  */
 public function render($concat = false)
 {
     $content = $this->renderChildren();
     $contentObjectData = $this->configurationManager->getContentObject()->getUserObjectType();
     if (!empty($content) && $this->configurationManager->getContentObject()->getUserObjectType() == \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
         if ($concat === true) {
             $GLOBALS['TSFE']->page['title'] .= $content;
             $GLOBALS['TSFE']->indexedDocTitle .= $content;
         } else {
             $GLOBALS['TSFE']->page['title'] = $content;
             $GLOBALS['TSFE']->indexedDocTitle = $content;
         }
     } else {
         if ($concat === true) {
             $GLOBALS['TSFE']->content = preg_replace('@<title>(.*?)</title>@i', '<title>' . $content . ' $1</title>', $GLOBALS['TSFE']->content);
         } else {
             $GLOBALS['TSFE']->content = preg_replace('@<title>(.*?)</title>@i', '<title>' . $content . '</title>', $GLOBALS['TSFE']->content);
         }
     }
 }
예제 #13
0
파일: Settings.php 프로젝트: BjoBre/t3chimp
 private function loadConfiguration()
 {
     if (!array_key_exists($this->extKey, self::$settingsCache)) {
         $this->mergeSettings(unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]));
         $this->mergeSettings($this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK));
         $this->mergeSettings($this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS));
         $flexformSettings = $this->flexFormService->convertFlexFormContentToArray($this->configurationManager->getContentObject()->data['pi_flexform']);
         $this->mergeSettings($flexformSettings['settings']);
         self::$settingsCache[$this->extKey] = $this->settings;
     }
     $this->settings = self::$settingsCache[$this->extKey];
 }
 /**
  * Init
  *
  * @return void
  */
 public function initialize()
 {
     $this->extensionName = $this->controllerContext->getRequest()->getControllerExtensionName();
     $this->contentObject = $this->configurationManager->getContentObject();
     if ($this->arguments['extensionName'] !== null) {
         $this->extensionName = $this->arguments['extensionName'];
     }
     $typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS);
     if (!empty($typoScriptSetup['setup'])) {
         $this->settings = $typoScriptSetup['setup'];
     }
 }
예제 #15
0
 /**
  * @return mixed
  */
 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 if no assign
     $as = $this->arguments['as'];
     if (TRUE === empty($as)) {
         return $content;
     }
     $variables = array($as => $content);
     $output = ViewHelperUtility::renderChildrenWithVariables($this, $this->templateVariableContainer, $variables);
     return $output;
 }
 /**
  * Powermail SendPost - Send values via curl to a third party software
  *
  * @param Mail $mail
  * @param array $configuration TypoScript Configuration
  * @return void
  */
 public function sendFromConfiguration(Mail $mail, $configuration)
 {
     $contentObject = $this->configurationManager->getContentObject();
     $spConfiguration = $configuration['marketing.']['sendPost.'];
     // switch of if disabled
     $enable = $contentObject->cObjGetSingle($spConfiguration['_enable'], $spConfiguration['_enable.']);
     if (!$enable) {
         return;
     }
     $contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($mail));
     $parameters = $contentObject->cObjGetSingle($spConfiguration['values'], $spConfiguration['values.']);
     $curlSettings = ['url' => $spConfiguration['targetUrl'], 'params' => $parameters];
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $curlSettings['url']);
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $curlSettings['params']);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_exec($curl);
     curl_close($curl);
     if ($spConfiguration['debug']) {
         GeneralUtility::devLog('SendPost Values', 'powermail', 0, $curlSettings);
     }
 }
예제 #17
0
 public function render()
 {
     $content = $this->renderChildren();
     if (empty($this->arguments['parameter'])) {
         $this->arguments['parameter'] = $content;
         $content = '';
     }
     $config = array('parameter' => $this->arguments['parameter'], 'useCacheHash' => $this->arguments['useCacheHash'], 'no_cache' => !$this->arguments['useCacheHash']);
     unset($this->arguments['parameter'], $this->arguments['useCacheHash']);
     foreach ($this->arguments as $name => $value) {
         if (is_array($value)) {
             if (substr($name, -5) === 'Array') {
                 $name = substr($name, 0, -5) . '.';
             } elseif (strtolower(substr($name, -7)) === 'stdwrap') {
                 $name = substr($name, 0, -7) . '.';
             } elseif (!empty($value)) {
                 $value = '&' . GeneralUtility::implodeArrayForUrl('', $value);
             }
         }
         $config[$name] = $value;
     }
     return $this->configurationManager->getContentObject()->TEXT(array('value' => $content, 'typolink.' => $config));
 }
예제 #18
0
 /**
  * Handles the web request. The response will automatically be sent to the client.
  *
  * @return \TYPO3\CMS\Extbase\Mvc\ResponseInterface|NULL
  */
 public function handleRequest()
 {
     $request = $this->requestBuilder->build();
     if ($this->extensionService->isActionCacheable(null, null, $request->getControllerName(), $request->getControllerActionName())) {
         $request->setIsCached(true);
     } else {
         $contentObject = $this->configurationManager->getContentObject();
         if ($contentObject->getUserObjectType() === \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
             $contentObject->convertToUserIntObject();
             // \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::convertToUserIntObject() will recreate the object, so we have to stop the request here
             return null;
         }
         $request->setIsCached(false);
     }
     if ($this->configurationManager->isFeatureEnabled('requireCHashArgumentForActionArguments')) {
         $pluginNamespace = $this->extensionService->getPluginNamespace($request->getControllerExtensionName(), $request->getPluginName());
         $this->cacheHashEnforcer->enforceForRequest($request, $pluginNamespace);
     }
     /** @var $response \TYPO3\CMS\Extbase\Mvc\ResponseInterface */
     $response = $this->objectManager->get(\TYPO3\CMS\Extbase\Mvc\Web\Response::class);
     $this->dispatcher->dispatch($request, $response);
     return $response;
 }
예제 #19
0
 /**
  * Constructs a new \EssentialDots\ExtbaseHijax\Event\Listener.
  *
  * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface		$request		The request
  * @param array 								$configuration 	Framework configuraiton
  * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer	 						$cObj	 	An array of parameters
  */
 public function __construct(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, $configuration = null, $cObj = null)
 {
     $this->injectObjectManager(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager'));
     $this->injectConfigurationManager($this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManagerInterface'));
     $this->injectAutoIDService($this->objectManager->get('EssentialDots\\ExtbaseHijax\\Service\\AutoIDService'));
     $this->request = $request;
     if (method_exists($this->request, 'setMethod')) {
         $this->request->setMethod('GET');
     }
     if ($configuration) {
         $this->configuration = $this->ksortRecursive($configuration);
     } else {
         $this->configuration = $this->ksortRecursive($this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK));
     }
     if ($cObj) {
         $this->cObj = $cObj;
     } else {
         $this->cObj = $this->configurationManager->getContentObject();
     }
     /* @var $listenerFactory \EssentialDots\ExtbaseHijax\Service\Serialization\ListenerFactory */
     $listenerFactory = $this->objectManager->get('EssentialDots\\ExtbaseHijax\\Service\\Serialization\\ListenerFactory');
     // old logic - using autoincrement
     //$this->id = $this->autoIDService->getAutoId(get_class($this));
     // new logic - determine the id based on md5 hash
     $this->id = '';
     // resetting the id so it doesn't affect the hash
     $serialized = $listenerFactory->serialize($this);
     list($table, $uid) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $this->cObj->currentRecord);
     if ($table == 'tt_content' && $uid) {
         $this->id = str_replace(':', '-', $this->cObj->currentRecord) . '-' . md5($serialized);
     } else {
         // test if this is ExtbaseHijax Pi1
         if (method_exists($this->request, 'getControllerExtensionName') && method_exists($this->request, 'getPluginName') && $this->request->getControllerExtensionName() == 'ExtbaseHijax' && $this->request->getPluginName() == 'Pi1') {
             $encodedSettings = str_replace('.', '---', $this->configuration['settings']['loadContentFromTypoScript']);
             $settingsHash = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($encodedSettings);
             if ($this->configuration['switchableControllerActions']['ContentElement'][0] == 'user') {
                 $this->id = 'h-' . $settingsHash . '-' . $encodedSettings;
             } else {
                 $this->id = 'hInt-' . $settingsHash . '-' . $encodedSettings;
             }
         } elseif ($this->configuration['settings']['fallbackTypoScriptConfiguration']) {
             $encodedSettings = str_replace('.', '---', $this->configuration['settings']['fallbackTypoScriptConfiguration']);
             $settingsHash = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($encodedSettings);
             $this->id = 'f-' . $settingsHash . '-' . $encodedSettings;
         } else {
             $this->id = md5($serialized);
         }
     }
 }
예제 #20
0
파일: Div.php 프로젝트: advOpk/pwm
 /**
  * Save values to any table in TYPO3 database
  *
  * @param \In2code\Powermail\Domain\Model\Mail $mail
  * @param \array $conf TypoScript Configuration
  * @return void
  */
 public function saveToAnyTable($mail, $conf)
 {
     if (empty($conf['dbEntry.'])) {
         return;
     }
     $contentObject = $this->configurationManager->getContentObject();
     $startArray = $this->getVariablesWithMarkers($mail);
     // one loop per table
     foreach ((array) $conf['dbEntry.'] as $table => $settings) {
         $settings = NULL;
         // remove ending .
         $table = substr($table, 0, -1);
         // skip this table if disabled
         $enable = $contentObject->cObjGetSingle($conf['dbEntry.'][$table . '.']['_enable'], $conf['dbEntry.'][$table . '.']['_enable.']);
         if (!$enable) {
             continue;
         }
         /* @var $storeObject \In2code\Powermail\Utility\SaveToAnyTable */
         $storeObject = $this->objectManager->get('In2code\\Powermail\\Utility\\SaveToAnyTable');
         $storeObject->setTable($table);
         $contentObject->start($startArray);
         // if unique was set
         if (!empty($conf['dbEntry.'][$table . '.']['_ifUnique.'])) {
             $uniqueFields = array_keys($conf['dbEntry.'][$table . '.']['_ifUnique.']);
             $storeObject->setMode($conf['dbEntry.'][$table . '.']['_ifUnique.'][$uniqueFields[0]]);
             $storeObject->setUniqueField($uniqueFields[0]);
         }
         // one loop per field
         foreach ((array) $conf['dbEntry.'][$table . '.'] as $field => $settingsInner) {
             $settingsInner = NULL;
             // skip if key. or if it starts with _
             if (stristr($field, '.') || $field[0] === '_') {
                 continue;
             }
             // read from TypoScript
             $value = $contentObject->cObjGetSingle($conf['dbEntry.'][$table . '.'][$field], $conf['dbEntry.'][$table . '.'][$field . '.']);
             $storeObject->addProperty($field, $value);
         }
         if (!empty($conf['debug.']['saveToTable'])) {
             $storeObject->setDevLog(TRUE);
         }
         $uid = $storeObject->execute();
         // add this uid to startArray for using in TypoScript
         $startArray = array_merge($startArray, array('uid_' . $table => $uid));
     }
 }
 /**
  * Convert old to new marker
  *        from: this is the ###uid123### value
  *        to: this is the {uid123} value
  *
  * @param string $string
  * @param array $form
  * @param bool $rte
  * @return string
  */
 protected function rewriteVariables($string, $form, $rte = false)
 {
     $string = str_replace('###POWERMAIL_ALL###', '{powermail_all}', $string);
     $string = preg_replace_callback('|###UID([^#]*)?###|i', function ($matches) use($form) {
         $uid = $matches[1];
         if ($form['sys_language_uid'] > 0) {
             $uid = FormConverterService::getDefaultUidFromOldLocalizedFieldUid($form, $uid);
         }
         return '{uid' . $uid . '}';
     }, $string);
     if ($rte && !empty($this->configuration['parseFunc'])) {
         $this->initialiazeTsfe();
         $typoScriptSetup = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         $parseFunc = $typoScriptSetup['lib.'][$this->configuration['parseFunc']];
         $contentObject = $this->configurationManager->getContentObject();
         $string = $contentObject->_parseFunc($string, $parseFunc);
     }
     return $string;
 }
예제 #22
0
 /**
  * This is the main-function for sending Mails
  *
  * @param array $email Array with all needed mail information
  *        $email['receiverName'] = 'Name';
  *        $email['receiverEmail'] = '*****@*****.**';
  *        $email['senderName'] = 'Name';
  *        $email['senderEmail'] = '*****@*****.**';
  *        $email['subject'] = 'Subject line';
  *        $email['template'] = 'PathToTemplate/';
  *        $email['rteBody'] = 'This is the <b>content</b> of the RTE';
  *        $email['format'] = 'both'; // or plain or html
  * @param Mail &$mail
  * @param array $settings TypoScript Settings
  * @param string $type Email to "sender" or "receiver"
  * @return bool Mail successfully sent
  */
 public function sendEmailPreflight(array $email, Mail &$mail, $settings, $type = 'receiver')
 {
     $this->mail =& $mail;
     $this->settings = $settings;
     $this->configuration = $this->getConfigurationFromSettings($settings);
     $this->overwriteConfiguration = $this->configuration[$type . '.']['overwrite.'];
     $this->contentObject = $this->configurationManager->getContentObject();
     $this->contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($mail));
     $this->type = $type;
     $this->parseVariables($email, $mail);
     if ($settings['debug']['mail']) {
         GeneralUtility::devLog('Mail properties', 'powermail', 0, $email);
     }
     if (!GeneralUtility::validEmail($email['receiverEmail']) || !GeneralUtility::validEmail($email['senderEmail'])) {
         return false;
     }
     if (empty($email['subject'])) {
         // don't want an error flashmessage
         return true;
     }
     return $this->sendTemplateEmail($email);
 }
 /**
  * Get TypoScript and FlexForm
  *
  * @param ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectTypoScript(ConfigurationManagerInterface $configurationManager)
 {
     $typoScriptSetup = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $this->settings = $typoScriptSetup['plugin.']['tx_powermail.']['settings.']['setup.'];
     $flexFormXml = $configurationManager->getContentObject()->data['pi_flexform'];
     $flexForm = GeneralUtility::xml2array($flexFormXml, 'data');
     $this->flexForm = $flexForm[0];
 }
예제 #24
0
 /**
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $this->contentObject = $this->configurationManager->getContentObject();
 }
예제 #25
0
 /**
  * Get preview chunks - header and content - as
  * array(string $headerContent, string $previewContent, boolean $continueRendering)
  *
  * Default implementation renders the Preview section from the template
  * file that the actual Provider returns for $row, using paths also
  * determined by $row. Example: fluidcontent's Provider returns files
  * and paths based on selected "Fluid Content type" and inherits and
  * uses this method to render a Preview from the template file in the
  * specific path. This default implementation expects the TYPO3 core
  * to render the default header, so it returns NULL as $headerContent.
  *
  * @param array $row The record data to be analysed for variables to use in a rendered preview
  * @return array
  */
 public function getPreview(array $row)
 {
     $templateSource = $this->getTemplateSource($row);
     if (TRUE === empty($templateSource)) {
         return array(NULL, NULL, TRUE);
     }
     $extensionKey = $this->getExtensionKey($row);
     $flexformVariables = $this->getFlexFormValues($row);
     $templateVariables = $this->getTemplateVariables($row);
     $variables = RecursiveArrayUtility::merge($templateVariables, $flexformVariables);
     $paths = $this->getTemplatePaths($row);
     $form = $this->getForm($row);
     $formLabel = $form->getLabel();
     $label = LocalizationUtility::translate($formLabel, $extensionKey);
     $variables['label'] = $label;
     $variables['row'] = $row;
     $variables['record'] = $row;
     $view = $this->configurationService->getPreparedExposedTemplateView($extensionKey, 'Content', $paths, $variables);
     $view->setTemplateSource($templateSource);
     $existingContentObject = $this->configurationManager->getContentObject();
     $contentObject = new ContentObjectRenderer();
     $contentObject->start($row, $this->getTableName($row));
     $this->configurationManager->setContentObject($contentObject);
     $previewContent = $view->renderStandaloneSection('Preview', $variables);
     $this->configurationManager->setContentObject($existingContentObject);
     $previewContent = trim($previewContent);
     $headerContent = NULL;
     return array($headerContent, $previewContent, empty($previewContent));
 }
예제 #26
0
 /**
  * Initialize this settings utility
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->contentObject = $this->configurationManager->getContentObject();
 }
예제 #27
0
 /**
  * Makes the data object in fluid accessible
  *
  * @param \TYPO3\CMS\Extbase\Mvc\ViewInterface $view
  * @return void
  */
 protected function initializeView($view)
 {
     parent::initializeView($view);
     $view->assign('data', $this->configurationManager->getContentObject()->data);
 }
 /**
  * Generates a public URL to the specified file
  * This is necessary because TYPO3 doesn't prepend the absRefPrefix in all cases.
  *
  * @param  \TYPO3\CMS\Core\Resource\FileReference $mediaFile  media file
  * @return string                                             URL to the file
  */
 protected function generatePublicUrl(\TYPO3\CMS\Core\Resource\FileReference $mediaFile)
 {
     return $this->configurationManager->getContentObject()->typolink_URL(array('parameter' => $mediaFile->getPublicUrl()));
 }
 /**
  * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
  * @return void
  */
 public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
 {
     $this->configurationManager = $configurationManager;
     $this->contentObject = $this->configurationManager->getContentObject();
 }
예제 #30
0
 /**
  * Constructor
  *
  * @param ConfigurationManagerInterface $configurationManager Application
  * ConfigurationManager
  */
 public function __construct(ConfigurationManagerInterface $configurationManager)
 {
     $this->contentObject = $configurationManager->getContentObject();
     $this->initialize();
 }