/** * 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'); }
/** * Preperation function for every table * * @return void */ public function savePreflightFinisher() { if ($this->isSaveToAnyTableActivated()) { $this->addArrayToDataArray($this->mailRepository->getVariablesWithMarkersFromMail($this->mail)); foreach ((array) array_keys($this->configuration) as $tableKey) { $table = StringUtility::removeLastDot($tableKey); $this->contentObject->start($this->getDataArray()); $tableConfiguration = $this->configuration[$tableKey]; if ($this->isSaveToAnyTableActivatedForSpecifiedTable($tableConfiguration)) { $this->saveSpecifiedTablePreflight($table, $tableConfiguration); } } } }
/** * 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)); } }
/** * Initialize * * @return void */ public function initializeFinisher() { $this->contentObject = $this->configurationManager->getContentObject(); $this->contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($this->mail)); $typoScript = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $this->configuration = $typoScript['plugin.']['tx_powermail.']['settings.']['setup.']['marketing.']['sendPost.']; }
/** * Initialize */ public function initializeFinisher() { $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($this->settings); if (!empty($configuration['dbEntry.'])) { $this->configuration = $configuration['dbEntry.']; } if ($this->isConfigurationAvailable()) { $this->addArrayToDataArray(['uid' => $this->mail->getUid()]); $this->addArrayToDataArray($this->mailRepository->getVariablesWithMarkersFromMail($this->mail)); } }
/** * Powermail SendPost - Send values via curl to a third party software * * @param Mail $mail * @param array $configuration TypoScript Configuration * @return void */ public function sendFromConfiguration(Mail $mail, $configuration) { $contentObject = $this->configurationManager->getContentObject(); $spConfiguration = $configuration['marketing.']['sendPost.']; // switch of if disabled $enable = $contentObject->cObjGetSingle($spConfiguration['_enable'], $spConfiguration['_enable.']); if (!$enable) { return; } $contentObject->start($this->mailRepository->getVariablesWithMarkersFromMail($mail)); $parameters = $contentObject->cObjGetSingle($spConfiguration['values'], $spConfiguration['values.']); $curlSettings = ['url' => $spConfiguration['targetUrl'], 'params' => $parameters]; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $curlSettings['url']); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $curlSettings['params']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_exec($curl); curl_close($curl); if ($spConfiguration['debug']) { GeneralUtility::devLog('SendPost Values', 'powermail', 0, $curlSettings); } }
/** * 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); }