/** * Parses variables again * * @param \In2code\Powermail\Domain\Model\Mail $mail Variables and Labels array * @param string $type "web" or "mail" * @param string $function "createAction", "senderMail", "receiverMail" * @return string Changed string */ public function render(Mail $mail, $type = 'web', $function = 'createAction') { /** @var \TYPO3\CMS\Fluid\View\StandaloneView $parseObject */ $parseObject = $this->objectManager->get('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $parseObject->setTemplateSource($this->removePowermailAllParagraphTagWrap($this->renderChildren())); $parseObject->assignMultiple(ArrayUtility::htmlspecialcharsOnArray($this->mailRepository->getVariablesWithMarkersFromMail($mail))); $parseObject->assignMultiple(ArrayUtility::htmlspecialcharsOnArray($this->mailRepository->getLabelsWithMarkersFromMail($mail))); $parseObject->assign('powermail_all', TemplateUtility::powermailAll($mail, $type, $this->settings, $function)); return html_entity_decode($parseObject->render(), ENT_QUOTES, 'UTF-8'); }
/** * Create FlexForm * * @param array $form * @param int $formUid Form that was created before * @return string */ protected function createFlexForm($form, $formUid) { $form['tx_powermail_thanks'] = $this->rewriteVariables($form['tx_powermail_thanks'], $form, true); $form['tx_powermail_mailsender'] = $this->rewriteVariables($form['tx_powermail_mailsender'], $form, true); $form['tx_powermail_mailreceiver'] = $this->rewriteVariables($form['tx_powermail_mailreceiver'], $form, true); $form['tx_powermail_recipient'] = $this->rewriteVariables($form['tx_powermail_recipient'], $form); $form['tx_powermail_subject_r'] = $this->rewriteVariables($form['tx_powermail_subject_r'], $form); $form['tx_powermail_subject_s'] = $this->rewriteVariables($form['tx_powermail_subject_s'], $form); if ($form['sys_language_uid'] > 0) { $formUid = (int) $this->localizationRelations['form'][$form['l18n_parent']]; } $standaloneView = TemplateUtility::getDefaultStandAloneView(); $standaloneView->getRequest()->setControllerName('Module'); $standaloneView->setTemplatePathAndFilename(TemplateUtility::getTemplatePath('Module/ConverterFlexForm.xml')); $standaloneView->assignMultiple(['formUid' => $formUid, 'form' => $form, 'configuration' => $this->configuration]); return $standaloneView->render(); }
/** * Parsing variables with fluid engine to allow viewhelpers in flexform * * @param array $email * @param Mail $mail * @return void */ protected function parseVariables(array &$email, Mail &$mail) { $parse = array('receiverName', 'receiverEmail', 'senderName', 'senderEmail', 'subject'); foreach ($parse as $value) { $email[$value] = TemplateUtility::fluidParseString($email[$value], $this->mailRepository->getVariablesWithMarkersFromMail($mail)); } }
/** * Prepare output * * @param Mail $mail * @return void */ protected function prepareOutput(Mail $mail) { $this->view->assignMultiple(['variablesWithMarkers' => $this->mailRepository->getVariablesWithMarkersFromMail($mail, true), 'mail' => $mail, 'marketingInfos' => SessionUtility::getMarketingInfos(), 'messageClass' => $this->messageClass, 'ttContentData' => $this->contentObject->data, 'powermail_rte' => $this->settings['thx']['body'], 'powermail_all' => TemplateUtility::powermailAll($mail, 'web', $this->settings, $this->actionMethodName)]); $this->view->assignMultiple($this->mailRepository->getVariablesWithMarkersFromMail($mail, true)); $this->view->assignMultiple($this->mailRepository->getLabelsWithMarkersFromMail($mail)); }
/** * Create export file content * * @return string * @throws InvalidActionNameException * @throws InvalidControllerNameException */ protected function getFileContent() { $standaloneView = TemplateUtility::getDefaultStandAloneView(); $standaloneView->setTemplatePathAndFilename(TemplateUtility::getTemplatePath($this->getRelativeTemplatePathAndFileName())); $standaloneView->setLayoutRootPaths(TemplateUtility::getTemplateFolders('layout')); $standaloneView->setPartialRootPaths(TemplateUtility::getTemplateFolders('partial')); $standaloneView->assignMultiple(array('mails' => $this->getMails(), 'fieldUids' => $this->getFieldList())); return $standaloneView->render(); }
/** * @param string $string Options from the Textarea * @param $parse * @return array */ protected function buildOptions($string, $parse) { $options = []; $string = str_replace('[\\n]', PHP_EOL, $string); $settingsField = GeneralUtility::trimExplode(PHP_EOL, $string, true); foreach ($settingsField as $line) { $settings = GeneralUtility::trimExplode('|', $line, false); $value = isset($settings[1]) ? $settings[1] : $settings[0]; $label = $parse ? TemplateUtility::fluidParseString($settings[0]) : $settings[0]; $options[] = ['label' => $label, 'value' => $value, 'selected' => isset($settings[2]) ? 1 : 0]; } return $options; }
/** * Get emails from FlexForm and parse with fluid * * @return array */ protected function getEmailsFromFlexForm() { $emailString = TemplateUtility::fluidParseString($this->settings['receiver']['email'], $this->mailRepository->getVariablesWithMarkersFromMail($this->mail)); return $this->parseEmailsFromString($emailString); }
/** * Create an options array (Needed for fieldsettings: select, radio, check) * option1 => * label => Red Shoes * value => red * selected => 1 * * @param string $string Options from the Textarea * @param string $typoScriptObjectPath Path to TypoScript like lib.blabla * @param bool $parse * @return array Options Array */ protected function optionArray($string, $typoScriptObjectPath, $parse = true) { if (empty($string)) { $string = TypoScriptUtility::parseTypoScriptFromTypoScriptPath($typoScriptObjectPath); } if (empty($string)) { $string = 'Error, no options to show'; } $options = array(); $string = str_replace('[\\n]', PHP_EOL, $string); $settingsField = GeneralUtility::trimExplode(PHP_EOL, $string, true); foreach ($settingsField as $line) { $settings = GeneralUtility::trimExplode('|', $line, false); $value = isset($settings[1]) ? $settings[1] : $settings[0]; $label = $parse ? TemplateUtility::fluidParseString($settings[0]) : $settings[0]; $options[] = array('label' => $label, 'value' => $value, 'selected' => isset($settings[2]) ? 1 : 0); } return $options; }
/** * Create message for spam logging * - bodytext for spamnotification mail OR * - log entry * * @param string $path relative path to mail * @param array $multipleAssign * @return string */ protected function createSpamNotificationMessage($path, $multipleAssign = array()) { $standaloneView = TemplateUtility::getDefaultStandAloneView(); $standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($path)); $standaloneView->setLayoutRootPaths(TemplateUtility::getTemplateFolders('layout')); $standaloneView->setPartialRootPaths(TemplateUtility::getTemplateFolders('partial')); $standaloneView->assignMultiple($multipleAssign); return $standaloneView->render(); }
/** * Create export file content * * @return string * @throws InvalidActionNameException * @throws InvalidControllerNameException */ protected function getFileContent() { $standaloneView = TemplateUtility::getDefaultStandAloneView(); $standaloneView->setTemplatePathAndFilename(TemplateUtility::getTemplatePath($this->getRelativeTemplatePathAndFileName())); $standaloneView->assignMultiple(['mails' => $this->getMails(), 'fieldUids' => $this->getFieldList()]); return $standaloneView->render(); }
/** * Create message for spam logging * - bodytext for spamnotification mail OR * - log entry * * @param string $path relative path to mail * @param array $multipleAssign * @return string */ protected function createSpamNotificationMessage($path, $multipleAssign = []) { $standaloneView = TemplateUtility::getDefaultStandAloneView(); $standaloneView->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName($path)); $standaloneView->assignMultiple($multipleAssign); return $standaloneView->render(); }