/** * Initializes and runs an extbase controller * * @param string $extensionName Name of extension, in UpperCamelCase * @param string $controller Name of controller, in UpperCamelCase * @param string $action Optional name of action, in lowerCamelCase * @param string $pluginName Optional name of plugin. Default is 'Pi1' * @param array $settings Optional array of settings to use in controller * @param int $pageUid Uid of current page * @param string $vendorName VendorName * @return string output of controller's action */ protected function runExtbaseController($extensionName, $controller, $action = 'index', $pluginName = 'Pi1', $settings = array(), $pageUid = 0, $vendorName = 'PwCommentsTeam') { $GLOBALS['TT'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker'); $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageUid, 0); $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository'); $GLOBALS['TSFE']->initTemplate(); $rootline = $GLOBALS['TSFE']->sys_page->getRootLine($pageUid); $GLOBALS['TSFE']->tmpl->start($rootline); $GLOBALS['TSFE']->getConfigArray(); $pluginSettings = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pwcomments.']; $pwCommentsTypoScript = $pluginSettings['settings.']; \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage('de'); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); \TYPO3\CMS\Frontend\Utility\EidUtility::initExtensionTCA('pw_comments'); if (unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pw_comments'])) { $settings = array_merge($settings, unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pw_comments'])); } $settings = array_merge($settings, $pwCommentsTypoScript); $bootstrap = new \TYPO3\CMS\Extbase\Core\Bootstrap(); $bootstrap->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $extensionTyposcriptSetup = $this->getExtensionTyposcriptSetup(); $localLangArray = array(); if (is_array($pluginSettings['_LOCAL_LANG.'])) { $typoScriptService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $localLangArray = $typoScriptService->convertTypoScriptArrayToPlainArray($pluginSettings['_LOCAL_LANG.']); } $configuration = array('pluginName' => $pluginName, 'extensionName' => $extensionName, 'controller' => $controller, 'vendorName' => $vendorName, 'controllerConfiguration' => array($controller), 'action' => $action, 'mvc' => array('requestHandlers' => array('TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler' => 'TYPO3\\CMS\\Extbase\\Mvc\\Web\\FrontendRequestHandler')), 'settings' => $settings, 'persistence' => $extensionTyposcriptSetup['plugin']['tx_pwcomments']['persistence'], '_LOCAL_LANG' => $localLangArray); return $bootstrap->run('', $configuration); }
/** * Routes the given eID action to the related ExtDirect method with the necessary * ajax object. * * @param string $ajaxID * @return void */ protected function routeAction($ajaxID) { EidUtility::initLanguage(); $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID]['callbackMethod']; $this->ajaxObject = GeneralUtility::makeInstance(AjaxRequestHandler::class, 'ExtDirect::' . $ajaxID); $parameters = array(); GeneralUtility::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, false, true); }
/** * Routes the given eID action to the related ExtDirect method with the necessary * ajax object. * * @return void */ public function routeAction() { \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $ajaxID = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('action'); $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID]['callbackMethod']; $this->ajaxObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler', 'ExtDirect::' . $ajaxID); $parameters = array(); \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, FALSE, TRUE); }
/** * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ protected function getConfiguredTSFE($TYPO3_CONF_VARS = array(), $id = 1, $type = 0) { /** @var $TSFE \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ $TSFE = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $id, $type); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $TSFE->initFEuser(); $TSFE->set_no_cache(); $TSFE->checkAlternativeIdMethods(); $TSFE->determineId(); $TSFE->initTemplate(); $TSFE->getConfigArray(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance(); $TSFE->settingLanguage(); $TSFE->settingLocale(); return $TSFE; }
/** * Initializes TSFE and sets $GLOBALS['TSFE']. * * @return void */ protected function initTSFE() { $pageId = GeneralUtility::_GP('id'); /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $tsfe */ $GLOBALS['TSFE'] = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], $pageId, ''); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $GLOBALS['TSFE']->initFEuser(); // We do not want (nor need) EXT:realurl to be invoked: //$GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); if ($pageId > 0) { $GLOBALS['TSFE']->settingLanguage(); } $GLOBALS['TSFE']->settingLocale(); }
/** * Build up the TSFE */ public function buildFrontend() { global $TSFE; EidUtility::initLanguage(); /** @var TypoScriptFrontendController $TSFE */ $TSFE = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0, 0); EidUtility::initLanguage(); // Get FE User Information $TSFE->initFEuser(); // Important: no Cache for Ajax stuff $TSFE->set_no_cache(); $TSFE->initTemplate(); // $TSFE->getConfigArray(); Bootstrap::getInstance()->loadCachedTca(); $TSFE->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $TSFE->settingLanguage(); $TSFE->settingLocale(); }
/** * Boostrap of Typo3 for eID environment */ public static function initEnvironment() { /* @var $GLOBALS['TSFE'] \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, $GLOBALS['TYPO3_CONF_VARS'], null, 0); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->initUserGroups(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); $GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->clear_preview(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $GLOBALS['TSFE']->settingLanguage(); $GLOBALS['TSFE']->settingLocale(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca(); }
/** * */ public function __construct() { \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); }
/** * Initializes the $GLOBALS['TSFE'] var, useful everywhere when in a * Frontend context. * * @param int $id The id of the rootPage from which you want the controller to be based on. */ private function initializeTSFE($id) { if (TYPO3_MODE == 'FE') { $frontendController = $this->getFrontendController($id); EidUtility::initLanguage(); EidUtility::initTCA(); // No Cache for Ajax stuff. $frontendController->set_no_cache(); $frontendController->initFEuser(); $frontendController->checkAlternativeIdMethods(); $frontendController->determineId(); $frontendController->initTemplate(); $frontendController->getPageAndRootline(); $frontendController->getConfigArray(); $frontendController->connectToDB(); $frontendController->settingLanguage(); } }
* ExtensionName in upperCamelCase */ $ajax['vendor'] = 'Bjr'; //'T3Developer'; $ajax['extensionName'] = 'BjrFreizeitFeadmin'; //'ProjectsAndTasks'; /** * @var $TSFE \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController */ $TSFE = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $TYPO3_CONF_VARS, $ajax['arguments']['pageId'], 0); if (isset($ajax['arguments']['languageId'])) { $languageId = $ajax['arguments']['languageId']; } else { $languageId = 'default;'; } \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage($languageId); // Get FE User Information $TSFE->initFEuser(); // Important: no Cache for Ajax stuff $TSFE->set_no_cache(); //$TSFE->checkAlternativCoreMethods(); $TSFE->checkAlternativeIdMethods(); //$_SERVER['QUERY_STRING'] = '42'; //$TSFE->determineId(); // echo 'after determineId TSFE->id : ' . $TSFE->id; list($theAlias) = explode('&', \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('QUERY_STRING')); $theAlias = trim($theAlias); //echo 'ALIAS : ' . $theAlias; //echo 'QueryString : ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('QUERY_STRING'); if ($TSFE->id == 1) { //$pageId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pageId');
/** * @param array $TYPO3_CONF_VARS * * @return \Ecom\EcomToolbox\Utility\AjaxDispatcher */ public function init($TYPO3_CONF_VARS) { //define('TYPO3_MODE','FE'); $this->initCallArguments(); /** @var \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController $GLOBALS ['TSFE'] */ $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::class, $TYPO3_CONF_VARS, null, 0, true); $GLOBALS['TSFE']->fe_user = \TYPO3\CMS\Frontend\Utility\EidUtility::initFeUser(); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->id = $this->pageUid; $GLOBALS['TSFE']->sys_language_content = $this->language; /** @var \TYPO3\CMS\Frontend\Page\PageRepository sys_page */ $GLOBALS['TSFE']->sys_page = CoreUtility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Page\PageRepository::class); $GLOBALS['TSFE']->sys_page->init($GLOBALS['TSFE']->showHiddenPage); ######################################################## $GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->clear_preview(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); $GLOBALS['TSFE']->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $GLOBALS['TSFE']->settingLanguage(); $GLOBALS['TSFE']->settingLocale(); return $this; }
/** * Init the TSFE array */ protected function initTSFE() { $GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', $GLOBALS['TYPO3_CONF_VARS'], 0, 0); \TYPO3\CMS\Frontend\Utility\EidUtility::initTCA(); \TYPO3\CMS\Frontend\Utility\EidUtility::initLanguage(); $GLOBALS['TSFE']->initFEuser(); $GLOBALS['TSFE']->set_no_cache(); $GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca(); $GLOBALS['TSFE']->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); $GLOBALS['TSFE']->settingLanguage(); $GLOBALS['TSFE']->settingLocale(); }