Esempio n. 1
0
 /**
  * Init the extbase Context and the configurationBuilder
  *
  * @throws Exception
  */
 protected function init()
 {
     // We do this so that we can check whether we are in "Flexform-Mode"
     self::$flexFormMode = true;
     $configuration['extensionName'] = self::EXTENSION_NAME;
     $configuration['pluginName'] = self::PLUGIN_NAME;
     $this->bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
     $this->bootstrap->initialize($configuration);
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     if (!$this->configurationBuilder) {
         try {
             // try to get the instance from factory cache
             $this->configurationBuilder = Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance('backend', 'backend');
         } catch (Exception $e) {
             if (!$this->currentPid) {
                 throw new Exception('Need PID for initialisation - No PID given!', 1298928835);
             }
             $settings = $this->getTyposcriptSettings($this->currentPid);
             Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::injectSettings($settings);
             $this->configurationBuilder = Tx_Yag_Domain_Configuration_ConfigurationBuilderFactory::getInstance('backend', 'backend');
             $this->initBackendRequirements();
         }
     }
     $yagPid = (int) GeneralUtility::_GP('yagPid');
     $this->pidDetector = $this->objectManager->get('Tx_Yag_Utility_PidDetector');
     $this->pidDetector->setPids(array($yagPid));
 }
Esempio n. 2
0
 public function initialize()
 {
     $feUserObj = EidUtility::initFeUser();
     $pageId = GeneralUtility::_GET('id') ?: 1;
     /** @var TypoScriptFrontendController $typoScriptFrontendController */
     $typoScriptFrontendController = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0, TRUE);
     $GLOBALS['TSFE'] = $typoScriptFrontendController;
     $typoScriptFrontendController->connectToDB();
     $typoScriptFrontendController->fe_user = $feUserObj;
     $typoScriptFrontendController->id = 2653;
     $typoScriptFrontendController->determineId();
     $typoScriptFrontendController->getCompressedTCarray();
     $typoScriptFrontendController->initTemplate();
     $typoScriptFrontendController->getConfigArray();
     $typoScriptFrontendController->includeTCA();
     /** @var TypoScriptService $typoScriptService */
     $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService');
     $pluginTyposcript = $typoScriptFrontendController->tmpl->setup['plugin.'][$this->extensionConfiguration['extensionKey'] . '.'];
     $this->pluginConfiguration = $typoScriptService->convertTypoScriptArrayToPlainArray($pluginTyposcript);
     // Set configuration to call the plugin
     $extensionConfiguration['settings'] = $this->pluginConfiguration['settings'];
     $extensionConfiguration['persistence'] = $this->pluginConfiguration['persistence'];
     $this->extensionConfiguration = array_merge($extensionConfiguration, $this->extensionConfiguration);
     $this->bootstrap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
     $this->bootstrap->initialize($this->extensionConfiguration);
 }
 /**
  * @param \TYPO3\CMS\Extbase\Core\Bootstrap $bootstrap
  * @param array $configuration
  * @param array $r
  * @param \TYPO3\CMS\Extbase\Mvc\Web\Request $request
  * @param \EssentialDots\ExtbaseHijax\Event\Listener $listener
  * @param bool $isCacheCallback
  * @return array
  * @throws \Tx_EdCache_Exception_PreventActionCaching
  */
 public function handleFrontendRequest($bootstrap, $configuration, $r, $request, $listener, $isCacheCallback = FALSE)
 {
     $this->initialize();
     $bootstrap->initialize($configuration);
     $this->setPreventMarkupUpdateOnAjaxLoad(false);
     /* @var $request \TYPO3\CMS\Extbase\Mvc\Web\Request */
     $request = $this->buildRequest($r, $request);
     $request->setDispatched(false);
     $namespace = $this->extensionService->getPluginNamespace($request->getControllerExtensionName(), $request->getPluginName());
     $_POST[$namespace] = $request->getArguments();
     /* @var $response \TYPO3\CMS\Extbase\Mvc\Web\Response */
     $response = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Response');
     /* @var $dispatcher \EssentialDots\ExtbaseHijax\MVC\Dispatcher */
     $dispatcher = $this->objectManager->get('EssentialDots\\ExtbaseHijax\\MVC\\Dispatcher');
     $dispatcher->dispatch($request, $response, $listener);
     $this->parseHeaders($response);
     $_POST[$namespace] = array();
     $content = $response->getContent();
     $this->serviceContent->processIntScripts($content);
     $this->serviceContent->processAbsRefPrefix($content, $configuration['settings']['absRefPrefix']);
     $response->setContent($content);
     // convert HTML to specified format
     $htmlConverter = $this->objectManager->get('EssentialDots\\ExtbaseHijax\\HTMLConverter\\ConverterFactory');
     /* @var $htmlConverter \EssentialDots\ExtbaseHijax\HTMLConverter\ConverterFactory */
     $converter = $htmlConverter->getConverter($request->getFormat());
     try {
         $response = $converter->convert($response);
     } catch (\EssentialDots\ExtbaseHijax\HTMLConverter\FailedConversionException $e) {
         $this->errorWhileConverting = TRUE;
     }
     $result = array('id' => $r['id'], 'format' => $request->getFormat(), 'response' => $response->getContent(), 'preventMarkupUpdate' => $this->getPreventMarkupUpdateOnAjaxLoad(), 'headers' => $response->getHeaders());
     if (!$this->errorWhileConverting && $isCacheCallback && !$request->isCached() && $this->cacheRepository) {
         error_log('Throwing Tx_EdCache_Exception_PreventActionCaching, did you missconfigure cacheable actions in Extbase?');
         /* @var $preventActionCaching \Tx_EdCache_Exception_PreventActionCaching */
         $preventActionCaching = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_EdCache_Exception_PreventActionCaching');
         $preventActionCaching->setResult($result);
         throw $preventActionCaching;
     }
     return $result;
 }
Esempio n. 4
0
 /**
  * Initializes the Extbase framework by instantiating the bootstrap
  * class and the extbase object manager.
  *
  * @return void
  */
 protected function initExtbase()
 {
     $this->extbaseBootstap = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Core\\Bootstrap');
     $this->extbaseBootstap->initialize(array('extensionName' => $this->extensionKey, 'pluginName' => 'ajax'));
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
 }