/** * Initializes the view helper before invoking the render method. * * Override this method to solve tasks before the view helper content is rendered. * * @return void * @api */ public function initialize() { $this->_extendedSettings = \Tollwerk\TwAntibot\Utility\Utility::settings(); $templateVariableContainer = $this->renderingContext->getTemplateVariableContainer(); $settings = $templateVariableContainer->get('settings'); if (is_array($settings) && !empty($settings['antibot']) && is_array($settings['antibot'])) { \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($this->_extendedSettings, $settings['antibot']); } }
/** * Create and return the antibot armor HTML * * @param \string $content Content * @param \array $config Configuration * @return \string Armor fields */ public function armor($content, array $config) { try { $settings = \Tollwerk\TwAntibot\Utility\Utility::settings(); if (array_key_exists('antibot.', $config) && is_array($config['antibot.'])) { $typoscriptService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Service\\TypoScriptService'); $antibotSettings = $typoscriptService->convertTypoScriptArrayToPlainArray($config['antibot.']); \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($settings, $antibotSettings); } return \Tollwerk\TwAntibot\Validation\Validator::armor($settings); } catch (\Exception $e) { die(get_class($e)); } }