/** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return string The content that is displayed on the website */ function main($content, $conf) { $this->ms = GeneralUtility::milliseconds(); $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); // Configuring so caching is not expected. This value means that no cHash params are ever set. // We do this, because it's a USER_INT object! $this->pi_USER_INT_obj = 1; // initializes plugin configuration $this->init(); // init template for pi1 $this->initFluidTemplate(); // hook for initials if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['initials'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $_procObj->addInitials($this); } } // get content for searchbox $this->getSearchboxContent(); // assign variables and do the rendering $this->searchFormView->assignMultiple($this->fluidTemplateVariables); $htmlOutput = $this->searchFormView->render(); return $htmlOutput; }
/** * Constructor * * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference * @throws \UnexpectedValueException */ public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) { $this->backendReference = $backendReference; $this->cacheActions = array(); $this->optionValues = array(); $backendUser = $this->getBackendUser(); // Clear all page-related caches if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) { $this->cacheActions[] = array('id' => 'pages', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=pages&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low')); $this->optionValues[] = 'pages'; } // Clear cache for ALL tables! if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { $this->cacheActions[] = array('id' => 'all', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=all&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium')); $this->optionValues[] = 'all'; } // Clearing of system cache (core cache, class cache etc) // is only shown explicitly if activated for a BE-user (not activated for admins by default) // or if the system runs in development mode // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins) if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === TRUE && $backendUser->isAdmin()) { $this->cacheActions[] = array('id' => 'system', 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE), 'description' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE), 'href' => $this->backPath . 'tce_db.php?vC=' . $backendUser->veriCode() . '&cacheCmd=system&ajaxCall=1' . BackendUtility::getUrlToken('tceAction'), 'icon' => IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); $this->optionValues[] = 'system'; } // Hook for manipulating cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Obtains a storage. This function will return a non-abstract class, which * is derieved from the tx_rsaauth_abstract_storage. Applications should * not use anoy methods that are not declared in the tx_rsaauth_abstract_storage. * * @return \TYPO3\CMS\Rsaauth\Storage\AbstractStorage A storage */ public static function getStorage() { if (is_null(self::$storageInstance)) { self::$storageInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj(self::$preferredStorage); } return self::$storageInstance; }
/** * Main function, rendering the element browser in RTE mode. * * @return void * @todo Define visibility */ public function main() { // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only") $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints')); if ($altMountPoints) { $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints); foreach ($altMountPoints as $filePathRelativeToFileadmindir) { $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly'); } $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts(); } // Rendering type by user function $browserRendered = FALSE; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/TYPO3\\CMS\\Recordlist\\Browser\\ElementBrowser.php']['browserRendering'] as $classRef) { $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) { if ($browserRenderObj->isValid($this->mode, $this)) { $this->content .= $browserRenderObj->render($this->mode, $this); $browserRendered = TRUE; break; } } } } // If type was not rendered, use default rendering functions if (!$browserRendered) { $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Rtehtmlarea\\SelectImage'); $GLOBALS['SOBE']->browser->init(); $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php', 'ses'); list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData); $GLOBALS['BE_USER']->pushModuleData('select_image.php', $modData); $this->content = $GLOBALS['SOBE']->browser->main_rte(); } }
/** * Constructor * * @throws \UnexpectedValueException */ public function __construct() { $backendUser = $this->getBackendUser(); $languageService = $this->getLanguageService(); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Toolbar/ClearCacheMenu'); // Clear all page-related caches if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.pages')) { $this->cacheActions[] = array('id' => 'pages', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'pages', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-low', Icon::SIZE_SMALL)->render()); $this->optionValues[] = 'pages'; } // Clear cache for ALL tables! if ($backendUser->isAdmin() || $backendUser->getTSConfigVal('options.clearCache.all')) { $this->cacheActions[] = array('id' => 'all', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'all', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-medium', Icon::SIZE_SMALL)->render()); $this->optionValues[] = 'all'; } // Clearing of system cache (core cache, class cache etc) // is only shown explicitly if activated for a BE-user (not activated for admins by default) // or if the system runs in development mode // or if $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] is set (only for admins) if ($backendUser->getTSConfigVal('options.clearCache.system') || GeneralUtility::getApplicationContext()->isDevelopment() || (bool) $GLOBALS['TYPO3_CONF_VARS']['SYS']['clearCacheSystem'] === true && $backendUser->isAdmin()) { $this->cacheActions[] = array('id' => 'system', 'title' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', true), 'description' => $languageService->sL('LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', true), 'href' => BackendUtility::getModuleUrl('tce_db', ['vC' => $backendUser->veriCode(), 'cacheCmd' => 'system', 'ajaxCall' => 1]), 'icon' => $this->iconFactory->getIcon('actions-system-cache-clear-impact-high', Icon::SIZE_SMALL)->render()); $this->optionValues[] = 'system'; } // Hook for manipulating cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface ' . ClearCacheActionsHookInterface::class, 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Constructor * * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference TYPO3 backend object reference */ public function __construct(\TYPO3\CMS\Backend\Controller\BackendController &$backendReference = NULL) { $this->backendReference = $backendReference; $this->cacheActions = array(); $this->optionValues = array('all', 'pages'); // Clear cache for ALL tables! if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_all', TRUE); $this->cacheActions[] = array('id' => 'all', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=all&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-high')); } // Clear cache for either ALL pages if ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_pages', TRUE); $this->cacheActions[] = array('id' => 'pages', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=pages&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-medium')); } // Clearing of cache-files in typo3conf/ + menu if ($GLOBALS['BE_USER']->isAdmin()) { $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf', TRUE); $this->cacheActions[] = array('id' => 'temp_CACHED', 'title' => $title, 'href' => $this->backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() . '&cacheCmd=temp_CACHED&ajaxCall=1' . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction'), 'icon' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-cache-clear-impact-low')); } // Hook for manipulate cacheActions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions'] as $cacheAction) { $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($cacheAction); if (!$hookObject instanceof \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000); } $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues); } } }
/** * Show general information and the installed modules * * @return void */ public function indexAction() { $warnings = array(); $contentWarnings = ''; // Hook for additional warnings if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $classRef) { $hookObj = GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'displayWarningMessages_postProcess')) { $hookObj->displayWarningMessages_postProcess($warnings); } } } if (!empty($warnings)) { if (count($warnings) > 1) { $securityWarnings = '<ul><li>' . implode('</li><li>', $warnings) . '</li></ul>'; } else { $securityWarnings = '<p>' . implode('', $warnings) . '</p>'; } $securityMessage = GeneralUtility::makeInstance(FlashMessage::class, $securityWarnings, $this->languageService->sL('LLL:EXT:lang/locallang_core.xlf:warning.header'), FlashMessage::ERROR); $contentWarnings = '<div style="margin: 20px 0;">' . $securityMessage->render() . '</div>'; unset($warnings); } $this->view->assignMultiple(array('TYPO3Version' => TYPO3_version, 'copyRightNotice' => BackendUtility::TYPO3_copyRightNotice(), 'warningMessages' => $contentWarnings, 'modules' => $this->getModulesData())); }
/** * Load extra predefined media params if they exist * * @param array $params Existing types by reference * @param array $conf Config array * @return void */ public function customMediaParams(&$params, $conf) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaParams'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/hooks/class.tx_cms_mediaitems.php']['customMediaParams'] as $classRef) { $hookObj = GeneralUtility::getUserObj($classRef); $hookObj->customMediaParams($params, $conf); } } }
/** * Constructor */ public function __construct(\TYPO3\CMS\Taskcenter\Controller\TaskModuleController $taskObject) { $this->moduleUrl = BackendUtility::getModuleUrl('user_task'); $this->taskObject = $taskObject; $this->getLanguageService()->includeLLFile('EXT:sys_action/locallang.xlf'); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sys_action']['tx_sysaction_task'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sys_action']['tx_sysaction_task'] as $classRef) { $this->hookObjects[] = GeneralUtility::getUserObj($classRef); } } }
/** * Constructor */ public function __construct(\TYPO3\CMS\Taskcenter\Controller\TaskModuleController $taskObject) { $this->taskObject = $taskObject; $GLOBALS['LANG']->includeLLFile('EXT:sys_action/locallang.xml'); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sys_action']['tx_sysaction_task'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['sys_action']['tx_sysaction_task'] as $classRef) { $this->hookObjects[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); } } }
/** * Assure the translation for the given key. * If not exists create the label in the xml/xlf file. * Returns the localization. * * Use the Slot to handle the label * * @see LocalizationUtility::translate * * @param string $key key in the localization file * @param string $extensionName * @param string $default default value of the label * @param array $arguments arguments are being passed over to vsprintf * * @return string */ public static function assureLabel($key, $extensionName, $default = null, $arguments = null) { if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['autoloader']['assureLabel'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['autoloader']['assureLabel'] as $classConfig) { $className = GeneralUtility::getUserObj($classConfig); if (is_object($className) && method_exists($className, 'assureLabel')) { $className->assureLabel($key, $extensionName, $default, $arguments); } } } return (string) $default; }
/** * The __constructor is private because the dispatcher is a singleton * * @param void * @return void */ protected function __construct() { $this->observers = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['crawler/domain/events/class.tx_crawler_domain_events_dispatcher.php']['registerObservers'] as $classRef) { $hookObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'registerObservers')) { $hookObj->registerObservers($this); } } } }
/** * Main function, rendering the element browser in RTE mode. * * @return void */ public function main() { // Setting alternative web browsing mounts (ONLY local to browse_links.php this script so they stay "read-only") $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints')); $appendAltMountPoints = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.altElementBrowserMountPoints.append'); // Clear temporary DB mounts $tmpMount = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('setTempDBmount'); if (isset($tmpMount)) { $GLOBALS['BE_USER']->setAndSaveSessionData('pageTree_temporaryMountPoint', (int) $tmpMount); } // Set temporary DB mounts $tempDBmount = (int) $GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'); if ($tempDBmount) { $altMountPoints = $tempDBmount; $appendAltMountPoints = FALSE; } if ($altMountPoints) { $alternativeMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $altMountPoints); $GLOBALS['BE_USER']->setWebmounts($alternativeMountPoints, $appendAltMountPoints); } // Setting alternative file browsing mounts (ONLY local to browse_links.php this script so they stay "read-only") $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints')); if ($altMountPoints) { $altMountPoints = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $altMountPoints); foreach ($altMountPoints as $filePathRelativeToFileadmindir) { // @todo: add this feature for FAL and TYPO3 6.2 } } // Render type by user function $browserRendered = FALSE; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) { $browserRenderObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) { if ($browserRenderObj->isValid($this->mode, $this)) { $this->content .= $browserRenderObj->render($this->mode, $this); $browserRendered = TRUE; break; } } } } // If type was not rendered, use default rendering functions if (!$browserRendered) { $GLOBALS['SOBE']->browser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\BrowseLinks::class); $GLOBALS['SOBE']->browser->init(); $modData = $GLOBALS['BE_USER']->getModuleData('browse_links.php', 'ses'); list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData); $GLOBALS['BE_USER']->pushModuleData('browse_links.php', $modData); $this->content = $GLOBALS['SOBE']->browser->main_rte(); } }
function init($conf) { $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); $this->pi_initPIflexForm(); // Init FlexForm configuration for plugin $this->pi_USER_INT_obj = 1; // Make the plugin not cachable $this->hooks = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey][$this->scriptRelPath])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey][$this->scriptRelPath] as $classRef) { $this->hooks[] =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); } } /* -------------------------------------------------- Configuration (order of priority) - FlexForm - TypoScript -------------------------------------------------- */ $conf['use_mailer'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('direct_mail') ? 'direct_mail' : ''; $flex = array(); $options = array('default_group' => 'sDEF', 'default_type' => 'sDEF', 'mail_from' => 'sDEF', 'mail_from_name' => 'sDEF', 'mail_notify' => 'sDEF', 'mail_reply' => 'sDEF', 'mail_reply_name' => 'sDEF', 'mail_return' => 'sDEF', 'page_edit' => 'sDEF', 'page_redirect_unsubscribe' => 'sDEF', 'show_default' => 'sDEF', 'template' => 'sDEF'); foreach ($options as $option => $sheet) { $value = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], $option, $sheet); if ($value) { switch ($option) { case 'template': $flex[$option] = 'uploads/tx_odsajaxmailsubscription/' . $value; break; default: $flex[$option] = $value; break; } } } $this->config = array_merge($conf, $flex); if ($this->cObj->data['pages']) { $this->config['page_records'] = $this->cObj->data['pages']; } if ($this->cObj->data['recursive']) { $this->config['page_records_recursive'] = $this->cObj->data['recursive']; } $this->config['mail_from'] = strtr($this->config['mail_from'], array('###DOMAIN###' => $_SERVER['HTTP_HOST'])); if (empty($this->config['page_edit'])) { $this->config['page_edit'] = $GLOBALS['TSFE']->id; } // Backward compatibility to 0.2.x if (is_numeric($this->config['default_group'])) { $this->config['default_group'] = 'sys_dmail_group_' . $this->config['default_group']; } }
/** * Create a configured mailer from a newsletter page record. * This mailer will have both plain and html content applied as well as files attached. * * @param \Ecodev\Newsletter\Domain\Model\Newsletter The newsletter * @param int $language * @return \Ecodev\Newsletter\Mailer preconfigured mailer for sending */ public static function getConfiguredMailer(Newsletter $newsletter, $language = null) { // Configure the mailer $mailer = new Mailer(); $mailer->setNewsletter($newsletter, $language); // hook for modifying the mailer before finish preconfiguring if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newsletter']['getConfiguredMailerHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newsletter']['getConfiguredMailerHook'] as $_classRef) { $_procObj = GeneralUtility::getUserObj($_classRef); $mailer = $_procObj->getConfiguredMailerHook($mailer, $newsletter); } } return $mailer; }
/** * Get hook objects. * * @param string $className Class name * @param string $hookName Hook name * * @return array */ public static function getHooks($className, $hookName) { $className = 'commerce/' . $className; $result = array(); static::mapClassName($className); static::mapHookName($className, $hookName); $extConf =& $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']; if (is_array($extConf[$className][$hookName])) { foreach ($extConf[$className][$hookName] as $classRef) { $result[] = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); } } return $result; }
/** * Get defined views for dropdown (from hook) * @return array */ public function getViews($config, $item) { $optionList = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jfmulticontent']['getViews'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jfmulticontent']['getViews'] as $_classRef) { $_procObj =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); if (!method_exists($_procObj, 'isActive') || method_exists($_procObj, 'isActive') && $_procObj->isActive()) { $optionList[] = array(trim($_procObj->getname()), trim($_procObj->getIdentifier())); } } } $config['items'] = array_merge($config['items'], $optionList); return $config; }
/** * Main method of your PlugIn * * @param string $content: The content of the PlugIn * @param array $conf: The PlugIn Configuration * @return The content that should be displayed on the website */ function main($content, $conf) { $this->db = $GLOBALS['TYPO3_DB']; $this->tsfe = $GLOBALS['TSFE']; $this->pi_setPiVarDefaults(); $this->pi_initPIflexForm(); $this->conf = $conf; $content = ""; $this->hookObjects = array(); // initialise hooks for any additional content manipulation // TODO: make use of hook objects if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['gorillary']['contentManipulation'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['gorillary']['contentManipulation'] as $_classRef) { $this->hookObjects[] =& GeneralUtility::getUserObj($_classRef); } } // we have to retrieve the original uid, in case this is a localized tt_content record if (isset($this->cObj->data['_LOCALIZED_UID'])) { $contentId = $this->cObj->data['_LOCALIZED_UID']; } else { $contentId = $this->cObj->data['uid']; } // check whether the default typoscript template was included if (!$this->conf['singleView.']) { return $this->pi_wrapInBaseClass("please include the template \"Gorillary gallery default configuration\" in your typoscript root template!"); } // include the additional files into the header (e.g. some js files) $this->tsfe->additionalHeaderData[$this->prefixId] = ''; foreach ($this->conf['additionalHeaderData.'] as $value) { $this->tsfe->additionalHeaderData[$this->prefixId] .= $value . "\n"; } // check whether we have GET params here $imageId = intval($this->piVars['image']); $collectionId = intval($this->piVars['collection']); if ($imageId) { // load image single view $content = $this->getSingleView($imageId); } else { if ($collectionId) { // load collection single view $content = $this->getCollectionView($collectionId); } else { // load collection overview $content = $this->getGalleryView($contentId); } } return $this->pi_wrapInBaseClass($content); }
/** * Hook to add custom content * * @return array with additional content sections * @deprecated Since 4.7; will be removed together with the call in indexAction and the fluid partial in 6.1 */ protected function getCustomContent() { $sections = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['about/index.php']['addSection'])) { \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('Hook about/index.php addSection is deprecated and will be removed in TYPO3 6.1, use fluid overrides instead.'); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['about/index.php']['addSection'] as $classRef) { /** @var $hookObject \TYPO3\CMS\About\CustomSectionsInterface */ $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if (!$hookObject instanceof \TYPO3\CMS\About\CustomSectionsInterface) { throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\About\\CustomSectionsInterface', 1298121573); } $hookObject->addSection($sections); } } return $sections; }
/** * Main method to dump a file * * @param ServerRequestInterface $request * @param ResponseInterface $response * @return NULL|ResponseInterface * * @throws \InvalidArgumentException * @throws \RuntimeException * @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException * @throws \UnexpectedValueException */ public function dumpAction(ServerRequestInterface $request, ResponseInterface $response) { $parameters = array('eID' => 'dumpFile'); $t = $this->getGetOrPost($request, 't'); if ($t) { $parameters['t'] = $t; } $f = $this->getGetOrPost($request, 'f'); if ($f) { $parameters['f'] = $f; } $p = $this->getGetOrPost($request, 'p'); if ($p) { $parameters['p'] = $p; } if (GeneralUtility::hmac(implode('|', $parameters), 'resourceStorageDumpFile') === $this->getGetOrPost($request, 'token')) { if (isset($parameters['f'])) { $file = ResourceFactory::getInstance()->getFileObject($parameters['f']); if ($file->isDeleted() || $file->isMissing()) { $file = null; } } else { $file = GeneralUtility::makeInstance(ProcessedFileRepository::class)->findByUid($parameters['p']); if ($file->isDeleted()) { $file = null; } } if ($file === null) { HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_404); } // Hook: allow some other process to do some security/access checks. Hook should issue 403 if access is rejected if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'] as $classRef) { $hookObject = GeneralUtility::getUserObj($classRef); if (!$hookObject instanceof FileDumpEIDHookInterface) { throw new \UnexpectedValueException('FileDump hook object must implement interface ' . FileDumpEIDHookInterface::class, 1394442417); } $hookObject->checkFileAccess($file); } } $file->getStorage()->dumpFileContents($file); // @todo Refactor FAL to not echo directly, but to implement a stream for output here and use response return null; } else { return $response->withStatus(403); } }
/** * Constructor * * @param integer $nodeLimit (optional) */ public function __construct($nodeLimit = NULL) { if ($nodeLimit === NULL) { $nodeLimit = $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit']; } $this->nodeLimit = abs(intval($nodeLimit)); $this->hiddenRecords = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')); $hookElements = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections']; if (is_array($hookElements)) { foreach ($hookElements as $classRef) { /** @var $hookObject t3lib_tree_pagetree_interfaces_collectionprocessor */ $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if ($hookObject instanceof \t3lib_tree_pagetree_interfaces_collectionprocessor) { $this->processCollectionHookObjects[] = $hookObject; } } } }
/** * Tracks down index documents belonging to a particular record or page and * removes them from the index and the Index Queue. * * @param string $table The record's table name. * @param integer $uid The record's uid. * @throws \UnexpectedValueException if a hook object does not implement interface \ApacheSolrForTypo3\Solr\GarbageCollectorPostProcessor */ public function collectGarbage($table, $uid) { if ($table == 'tt_content' || $table == 'pages' || $table == 'pages_language_overlay') { $this->collectPageGarbage($table, $uid); } else { $this->collectRecordGarbage($table, $uid); } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessGarbageCollector'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessGarbageCollector'] as $classReference) { $garbageCollectorPostProcessor = GeneralUtility::getUserObj($classReference); if ($garbageCollectorPostProcessor instanceof GarbageCollectorPostProcessor) { $garbageCollectorPostProcessor->postProcessGarbageCollector($table, $uid); } else { throw new \UnexpectedValueException(get_class($garbageCollectorPostProcessor) . ' must implement interface ApacheSolrForTypo3\\Solr\\GarbageCollectorPostProcessor', 1345807460); } } } }
public function loadWidget($key) { if (!isset($this->widgetsKeys[$key])) { return false; } if (isset($this->baseWidgets[$key])) { return $this->baseWidgets[$key]; } $this->baseWidgets[$key] =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($this->widgetsKeys[$key]); if (is_object($this->baseWidgets[$key]) && !in_array('tx_mydashboard_widgetinterface', class_implements($this->baseWidgets[$key]))) { echo 'Error: The Widget "<b>' . $key . '</b>" have to implement the interface "tx_mydashboard_widgetinterface"!<br />'; unset($this->baseWidgets[$key]); return false; } # if $this->baseWidgets[$key]->setWidgetKey($key); return $this->baseWidgets[$key]; }
/** * Constructor * * @param int $nodeLimit (optional) */ public function __construct($nodeLimit = null) { if ($nodeLimit === null) { $nodeLimit = $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit']; } $this->nodeLimit = abs((int) $nodeLimit); $this->showRootlineAboveMounts = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPathAboveMounts'); $this->hiddenRecords = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')); $hookElements = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections']; if (is_array($hookElements)) { foreach ($hookElements as $classRef) { /** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */ $hookObject = GeneralUtility::getUserObj($classRef); if ($hookObject instanceof \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface) { $this->processCollectionHookObjects[] = $hookObject; } } } }
public function __construct() { $this->preProcessHookObjects = array(); $this->postProcessHookObjects = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_db.php']['queryProcessors'] as $classRef) { $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classRef); if (!($hookObject instanceof \TYPO3\CMS\Core\Database\PreProcessQueryHookInterface || $hookObject instanceof \TYPO3\CMS\Core\Database\PostProcessQueryHookInterface)) { throw new UnexpectedValueException('$hookObject must either implement interface t3lib_DB_preProcessQueryHook or interface t3lib_DB_postProcessQueryHook', 1299158548); } if ($hookObject instanceof \TYPO3\CMS\Core\Database\PreProcessQueryHookInterface) { $this->preProcessHookObjects[] = $hookObject; } if ($hookObject instanceof \TYPO3\CMS\Core\Database\PostProcessQueryHookInterface) { $this->postProcessHookObjects[] = $hookObject; } } } }
/** * Provides the values for the markers in the simple form template * * @return array An array containing values for markers in the simple form template * @throws InvalidArgumentException if an registered form modifier fails to implement the required interface Tx_Solr_FormModifier */ public function execute() { $url = $this->cObj->getTypoLink_URL($this->parentPlugin->conf['search.']['targetPage']); $marker = array('action' => htmlspecialchars($url), 'action_id' => intval($this->parentPlugin->conf['search.']['targetPage']), 'action_language' => intval($GLOBALS['TSFE']->sys_page->sys_language_uid), 'action_language_parameter' => 'L', 'accept-charset' => $GLOBALS['TSFE']->metaCharset, 'q' => $this->parentPlugin->getCleanUserQuery()); // hook to modify the search form if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchForm'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['modifySearchForm'] as $classReference) { $formModifier = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classReference); if ($formModifier instanceof Tx_Solr_FormModifier) { if ($formModifier instanceof Tx_Solr_CommandPluginAware) { $formModifier->setParentPlugin($this->parentPlugin); } $marker = $formModifier->modifyForm($marker, $this->parentPlugin->getTemplate()); } else { throw new InvalidArgumentException('Form modifier "' . $classReference . '" must implement the Tx_Solr_FormModifier interface.', 1262864703); } } } return $marker; }
/** * Obtains a backend. This function will return a non-abstract class, which * is derived from the AbstractBackend. Applications should * not use any methods that are not declared in the AbstractBackend. * * @return AbstractBackend A backend */ public static function getBackend() { if (!self::$initialized) { // Backend does not exist yet. Create it. foreach (self::$availableBackends as $backend) { $backendObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($backend); // Check that it is derived from the proper base class if ($backendObject instanceof AbstractBackend) { /** @var $backendObject AbstractBackend */ if ($backendObject->isAvailable()) { // The backend is available, save it and stop the loop self::$selectedBackend = $backendObject; self::$initialized = TRUE; break; } // Attempt to force destruction of the object unset($backendObject); } } } return self::$selectedBackend; }
/** * Show general information and the installed modules * * @return void */ public function indexAction() { $warnings = []; $securityWarnings = ''; // Hook for additional warnings if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['displayWarningMessages'] as $classRef) { $hookObj = GeneralUtility::getUserObj($classRef); if (method_exists($hookObj, 'displayWarningMessages_postProcess')) { $hookObj->displayWarningMessages_postProcess($warnings); } } } if (!empty($warnings)) { if (count($warnings) > 1) { $securityWarnings = '<ul><li>' . implode('</li><li>', $warnings) . '</li></ul>'; } else { $securityWarnings = '<p>' . implode('', $warnings) . '</p>'; } unset($warnings); } $this->view->assignMultiple(['TYPO3Version' => TYPO3_version, 'copyRightNotice' => BackendUtility::TYPO3_copyRightNotice(), 'warningMessages' => $securityWarnings, 'warningTitle' => $this->languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:warning.header'), 'modules' => $this->getModulesData()]); }
/** * Apply multiple markers to mail contents * @param string $src * @param Email $email * @param string $name optionnal name to be forwarded to hook * @return string url with marker replaced */ public function substituteMarkers($src, Email $email, $name = '') { $markers = $this->getMarkers($email); $result = $src; if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newsletter']['substituteMarkersHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['newsletter']['substituteMarkersHook'] as $_classRef) { $_procObj = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($_classRef); $result = $_procObj->substituteMarkersHook($result, $name, $markers); } } // For each marker, only substitute if the field is registered as a marker. // This approach has shown to speed up things quite a bit. $this->findExistingMarkers($src); foreach ($markers as $name => $value) { if (in_array($name, $this->advancedMarkersFound)) { $result = $this->substituteAdvancedMarker($result, $name, $value); } if (in_array($name, $this->simpleMarkersFound)) { $result = $this->substituteSimpleMarker($result, $name, $value); } } return $result; }
/** * init static info tables to use with this view helper * * @return null */ protected static function init() { // check if class was already initialized if (!is_null(self::$staticInfoObject)) { return; } // check if static_info_tables is installed if (!t3lib_extMgm::isLoaded('static_info_tables')) { self::$staticInfoObject = false; \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('static_info_tables needs to be installed to use ' . get_class(self), get_class(self), 1); return; } require_once t3lib_extMgm::extPath('static_info_tables') . 'pi1/class.tx_staticinfotables_pi1.php'; // init class // code taken from the documentation self::$staticInfoObject =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('&tx_staticinfotables_pi1'); if (!self::$staticInfoObject) { self::$staticInfoObject = false; return null; } if (self::$staticInfoObject->needsInit()) { self::$staticInfoObject->init(); } }