/** * @test * @dataProvider emptyTagsDataProvider * @param bool $stripOn TRUE if stripping should be activated. * @param string $tagList Comma seperated list of tags that should be stripped. * @param bool $treatNonBreakingSpaceAsEmpty If TRUE will be considered empty. * @param string $content The HTML code that should be modified. * @param string $expectedResult The expected HTML code result. */ public function stripEmptyTags($stripOn, $tagList, $treatNonBreakingSpaceAsEmpty, $content, $expectedResult) { $tsConfig = array('keepNonMatchedTags' => 1, 'stripEmptyTags' => $stripOn, 'stripEmptyTags.' => array('tags' => $tagList, 'treatNonBreakingSpaceAsEmpty' => $treatNonBreakingSpaceAsEmpty)); $config = $this->subject->HTMLparserConfig($tsConfig); $result = $this->subject->HTMLcleaner($content, $config[0], $config[1], $config[2], $config[3]); $this->assertEquals($expectedResult, $result); }
/** * Main function * The main function of this class. Loads language variables and * calls subsidiary functions. * * @author Martin Helmich <*****@*****.**> * @version 2008-01-08 * @return string The output of this script. */ function main() { $this->debug('Starting message notification'); $user_res = $this->databaseHandle->exec_SELECTquery('*', 'fe_users', 'tx_mmforum_pmnotifymode = 1 AND deleted=0 AND disable=0 AND starttime < ' . $GLOBALS['EXEC_TIME'] . ' AND (endtime = 0 OR endtime <= ' . $GLOBALS['EXEC_TIME'] . ')'); $template = $this->loadTemplateFile('notifyPM'); if ($this->conf['cron_htmlemail']) { $template = HtmlParser::getSubpart($template, '###NOTIFY_HTML###'); } else { $template = HtmlParser::getSubpart($template, '###NOTIFY_PLAINTEXT###'); } $itemTemplate = HtmlParser::getSubpart($template, '###NOTIFY_LISTITEM###'); $content = ''; while ($user_arr = $this->databaseHandle->sql_fetch_assoc($user_res)) { $pm_res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_pminbox', 'to_uid=' . $user_arr['uid'] . ' AND notified=0 AND mess_type=0'); $pm_content = ''; if ($this->databaseHandle->sql_num_rows($pm_res) == 0) { $this->debug('No new messages for user ' . $user_arr['username'] . '. Continue with next user.'); continue; } else { $this->debug($this->databaseHandle->sql_num_rows($pm_res) . ' new messages for user ' . $user_arr['username'] . '. Creating email.'); } while ($pm_arr = $this->databaseHandle->sql_fetch_assoc($pm_res)) { $link = sprintf($this->conf['cron_pm_readlink'], $pm_arr['uid']); $cache_link = $this->getCacheValue_remove('pm.urlCache.' . $pm_arr['uid']); if ($cache_link !== false) { $link = $cache_link; } $pm_marker = array('###NOTIFY_SUBJECT###' => $pm_arr['subject'], '###NOTIFY_DATE###' => $this->formatDate($pm_arr['sendtime']), '###NOTIFY_SENDER###' => $this->getUsername($pm_arr['from_uid']), '###NOTIFY_LINK###' => $link, '###LLL_BY###' => $this->getLL('by'), '###LLL_ON###' => $this->getLL('on')); $pm_content .= HtmlParser::substituteMarkerArray($itemTemplate, $pm_marker); } $user_content = HtmlParser::substituteSubpart($template, '###NOTIFY_LISTITEM###', $pm_content); $user_marker = array('###NOTIFY_SUBJECT###' => sprintf($this->getLL('subject'), $this->databaseHandle->sql_num_rows($pm_res)), '###NOTIFY_TEXT###' => sprintf($this->getLL('text'), $this->conf['cron_sitetitle'], $this->databaseHandle->sql_num_rows($pm_res)), '###NOTIFY_ADDRESS###' => sprintf($this->getLL('address'), $user_arr[$this->conf['userNameField'] ? $this->conf['userNameField'] : 'username']), '###NOTIFY_LINK###' => $this->conf['cron_pm_link'], '###LABEL_NOTIFY_SUBJECT###' => $this->getLL('subject'), '###LABEL_NOTIFY_SENDER###' => $this->getLL('sender'), '###LABEL_NOTIFY_DATE###' => $this->getLL('date')); $user_content = HtmlParser::substituteMarkerArray($user_content, $user_marker); $subject = sprintf($this->getLL('mailSubject'), $this->conf['cron_sitetitle'], $this->databaseHandle->sql_num_rows($pm_res)); $username = $user_arr['name'] ? $user_arr['name'] : $user_arr['username']; $recipient = '"' . $username . '" <' . $user_arr['email'] . '>'; $contenttype = $this->conf['cron_htmlemail'] ? 'text/html' : 'text/plain'; $header = "Content-Type: {$contenttype}; charset=utf-8\n"; $header .= "From: " . $this->conf['cron_notifyPublishSender'] . "\n"; $content .= "Try to send mail({$recipient}, {$subject}, ...)\n"; if (!@mail($recipient, $subject, $user_content, $header)) { $this->debug('Could not send email to ' . $recipient, $this->DEBUG_ERROR); } else { $this->debug('Email to user ' . $user_arr['username'] . ' was successfully sent.'); } } $updateArray = array('notified' => 1, 'tstamp' => $GLOBALS['EXEC_TIME']); $this->databaseHandle->exec_UPDATEquery('tx_mmforum_pminbox', 'notified=0', $updateArray); $this->content = $content; }
/** * * Gets a subpart from a template. This is just a wrapper around the getSubpart * method of the \TYPO3\CMS\Core\Html\HtmlParser class. * * @param String $template The template * @param String $subpart The subpart name * @return String The subpart * */ static function getSubpart($template, $subpart) { return HtmlParser::getSubpart($template, $subpart); }
/** * Calls HTMLparserConfig() and passes the generated config to the HTMLcleaner() method on the current subject. * * @param array $tsConfig The TypoScript that should be used to generate the HTML parser config. * @param string $content The content that should be parsed by the HTMLcleaner. * @return string The parsed content. */ protected function parseConfigAndCleanHtml(array $tsConfig, $content) { $config = $this->fixture->HTMLparserConfig($tsConfig); return $this->fixture->HTMLcleaner($content, $config[0], $config[1], $config[2], $config[3]); }
/** * Compiles the extra form headers if the tceforms * * @return string The HTML */ public function extraFormHeaders() { $extraTemplate = ''; if (is_array($this->tceforms->extraFormHeaders)) { $extraTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###DOCHEADER_EXTRAHEADER###'); $extraTemplate = HtmlParser::substituteMarker($extraTemplate, '###EXTRAHEADER###', implode(LF, $this->tceforms->extraFormHeaders)); } return $extraTemplate; }
/** * Generates the notification email content. * This function generates the content of the notification email that is to * be sent. The result of this function is stored into the attribute $this->postalertMail. * * @author Martin Helmich <*****@*****.**> * @version 2008-06-22 * @return void */ function generateOutput() { $template = $this->loadTemplateFile('notifyReported'); if ($this->conf['cron_htmlemail']) { $template = HtmlParser::getSubpart($template, '###PNOTIFY_HTML###'); } else { $template = HtmlParser::getSubpart($template, '###PNOTIFY_PLAINTEXT###'); } $itemTemplate = HtmlParser::getSubpart($template, '###PNOTIFY_LISTITEM###'); $marker = array('###PNOTIFY_SUBJECT###' => sprintf($this->getLL('subject'), count($this->postalertItems)), '###PNOTIFY_TEXT###' => sprintf($this->getLL('text'), $this->conf['cron_sitetitle'], count($this->postalertItems)), '###PNOTIFY_LINK###' => $this->conf['cron_alertqueue_link'], '###LABEL_PNOTIFY_TOPICTITLE###' => $this->getLL('topictitle'), '###LABEL_PNOTIFY_REPORTDATE###' => $this->getLL('reportdate'), '###LABEL_PNOTIFY_TOPICAUTHOR###' => $this->getLL('topicauthor'), '###LABEL_PNOTIFY_TOPICFORUM###' => $this->getLL('topicforum'), '###LABEL_PNOTIFY_TOPICREPORTER###' => $this->getLL('postreporter'), '###LABEL_PNOTIFY_ALERTTEXT###' => $this->getLL('alerttext'), '###LABEL_PNOTIFY_POSTCONTENT###' => $this->getLL('reportedcontent')); $template = HtmlParser::substituteMarkerArray($template, $marker); $itemContent = ''; foreach ($this->postalertItems as $postalertItem) { $itemMarker = array('###PNOTIFY_TOPICTITLE###' => $this->getTopicTitle($postalertItem['topic_id']), '###PNOTIFY_TOPICAUTHOR###' => $this->getPostAuthor($postalertItem['post_id']), '###PNOTIFY_TOPICREPORTER###' => $this->getUsername($postalertItem['cruser_id']), '###PNOTIFY_REPORTDATE###' => date('d. m. Y, H:i', $postalertItem['crdate']), '###PNOTIFY_TOPICFORUM###' => $this->getTopicForum($postalertItem['topic_id']), '###PNOTIFY_POSTCONTENT###' => $this->getPostContent($postalertItem['post_id']), '###PNOTIFY_ALERTTEXT###' => stripslashes($postalertItem['alert_text']), '###LABEL_PNOTIFY_ALERTTEXT###' => $this->getLL('alerttext'), '###LABEL_PNOTIFY_POSTCONTENT###' => $this->getLL('reportedcontent')); $itemContent .= HtmlParser::substituteMarkerArray($itemTemplate, $itemMarker); } $template = HtmlParser::substituteSubpart($template, '###PNOTIFY_LISTITEM###', $itemContent); $this->postalertMail = $template; }
/** * Builds the checkboxes out of the hooks array * * @param array $brokenLinkOverView Array of broken links information * @param string $prefix * @return string code content */ protected function getCheckOptions(array $brokenLinkOverView, $prefix = '') { $markerArray = array(); if (!empty($prefix)) { $additionalAttr = ' class="' . $prefix . '"'; } else { $additionalAttr = ' class="refresh"'; } $checkOptionsTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###'); $hookSectionTemplate = HtmlParser::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###'); $markerArray['statistics_header'] = $this->doc->sectionHeader($this->getLanguageService()->getLL('report.statistics.header')); $markerArray['total_count_label'] = BackendUtility::wrapInHelp('linkvalidator', 'checkboxes', $this->getLanguageService()->getLL('overviews.nbtotal')); $markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'] ?: '0'; $linktypes = GeneralUtility::trimExplode(',', $this->modTS['linktypes'], TRUE); $hookSectionContent = ''; if (is_array($linktypes)) { if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) { if (in_array($type, $linktypes)) { $hookSectionMarker = array('count' => $brokenLinkOverView[$type] ?: '0'); $translation = $this->getLanguageService()->getLL('hooks.' . $type) ?: $type; $hookSectionMarker['option'] = '<input type="checkbox"' . $additionalAttr . ' id="' . $prefix . 'SET_' . $type . '" name="' . $prefix . 'SET[' . $type . ']" value="1"' . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '') . '/>' . '<label for="' . $prefix . 'SET_' . $type . '">' . htmlspecialchars($translation) . '</label>'; $hookSectionContent .= HtmlParser::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE); } } } } $checkOptionsTemplate = HtmlParser::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent); return HtmlParser::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE); }
/** * Find all supported broken links for a specific typoLink * * @param array $resultArray findRef parsed records * @param array $results Array of broken links * @param HtmlParser $htmlParser Instance of html parser * @param array $record The current record * @param string $field The current field * @param string $table The current table * @return void */ protected function analyseTypoLinks(array $resultArray, array &$results, $htmlParser, array $record, $field, $table) { $currentR = array(); $linkTags = $htmlParser->splitIntoBlock('link', $resultArray['content']); $idRecord = $record['uid']; $type = ''; $title = ''; $countLinkTags = count($linkTags); for ($i = 1; $i < $countLinkTags; $i += 2) { $referencedRecordType = ''; foreach ($resultArray['elements'] as $element) { $type = ''; $r = $element['subst']; if (!empty($r['tokenID'])) { if (substr_count($linkTags[$i], $r['tokenID'])) { // Type of referenced record if (strpos($r['recordRef'], 'pages') !== FALSE) { $currentR = $r; // Contains number of the page $referencedRecordType = $r['tokenValue']; $wasPage = TRUE; } elseif (strpos($r['recordRef'], 'tt_content') !== FALSE && (isset($wasPage) && $wasPage === TRUE)) { $referencedRecordType = $referencedRecordType . '#c' . $r['tokenValue']; $wasPage = FALSE; } else { $currentR = $r; } $title = strip_tags($linkTags[$i]); } } } /** @var $hookObj \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype */ foreach ($this->hookObjectsArr as $keyArr => $hookObj) { $type = $hookObj->fetchType($currentR, $type, $keyArr); // Store the type that was found // This prevents overriding by internal validator if (!empty($type)) { $currentR['type'] = $type; } } $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['substr'] = $currentR; $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['row'] = $record; $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['table'] = $table; $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['field'] = $field; $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['uid'] = $idRecord; $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['link_title'] = $title; $results[$type][$table . ':' . $field . ':' . $idRecord . ':' . $currentR['tokenID']]['pageAndAnchor'] = $referencedRecordType; } }
/** * Replaces all markers and subparts in a template with the content provided in the structured array. * * @param string $content * @param array $markersAndSubparts * @param string $wrap * @param bool $uppercase * @param bool $deleteUnused * @return string */ public function substituteMarkerAndSubpartArrayRecursive($content, array $markersAndSubparts, $wrap = '', $uppercase = FALSE, $deleteUnused = FALSE) { return HtmlParser::substituteMarkerAndSubpartArrayRecursive($content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused); }
/** * Constructor function, setting internal variables, loading the styles used. * */ public function __construct() { $this->inlineStackProcessor = GeneralUtility::makeInstance(InlineStackProcessor::class); $this->initializeAdditionalPreviewLanguages(); // Prepare user defined objects (if any) for hooks which extend this function: $this->hookObjectsMainFields = array(); if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getMainFieldsClass'] as $classRef) { $this->hookObjectsMainFields[] = GeneralUtility::getUserObj($classRef); } } $this->templateFile = 'sysext/backend/Resources/Private/Templates/FormEngine.html'; $template = GeneralUtility::getUrl(PATH_typo3 . $this->templateFile); // Wrapping all table rows for a particular record being edited: $this->totalWrap = HtmlParser::getSubpart($template, '###TOTALWRAP###'); $this->nodeFactory = GeneralUtility::makeInstance(NodeFactory::class); }
/** * @test * @param string $source * @param string $expected * @dataProvider cDataWillRemainUnmodifiedDataProvider */ public function xHtmlCleaningDoesNotModifyCDATA($source, $expected) { $result = $this->fixture->XHTML_clean($source); $this->assertSame($expected, $result); }
/** * @test * @dataProvider substituteMarkerAndSubpartArrayRecursiveResolvesMarkersAndSubpartsArrayDataProvider */ public function substituteMarkerAndSubpartArrayRecursiveResolvesMarkersAndSubpartsArray($template, $markersAndSubparts, $wrap, $uppercase, $deleteUnused, $expected) { $this->assertSame($expected, $this->fixture->substituteMarkerAndSubpartArrayRecursive($template, $markersAndSubparts, $wrap, $uppercase, $deleteUnused)); }
/** * Make login news - renders the HTML content for a list of news shown under * the login form. News data is added through sys_news records * * @return string HTML content * @credits Idea by Jan-Hendrik Heuing * @todo Define visibility */ public function makeLoginNews() { $newsContent = ''; $systemNews = $this->getSystemNews(); // Traverse news array IF there are records in it: if (is_array($systemNews) && count($systemNews) && !GeneralUtility::_GP('loginRefresh')) { /** @var $htmlParser \TYPO3\CMS\Core\Html\RteHtmlParser */ $htmlParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser'); $htmlParser->procOptions['dontHSC_rte'] = TRUE; // Get the main news template, and replace the subpart after looped through $newsContent = HtmlParser::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_NEWS###'); $newsItemTemplate = HtmlParser::getSubpart($newsContent, '###NEWS_ITEM###'); $newsItem = ''; $count = 1; foreach ($systemNews as $newsItemData) { $additionalClass = ''; if ($count == 1) { $additionalClass = ' first-item'; } elseif ($count == count($systemNews)) { $additionalClass = ' last-item'; } $newsItemContent = $htmlParser->TS_transform_rte($htmlParser->TS_links_rte($newsItemData['content'])); $newsItemMarker = array('###HEADER###' => htmlspecialchars($newsItemData['header']), '###DATE###' => htmlspecialchars($newsItemData['date']), '###CONTENT###' => $newsItemContent, '###CLASS###' => $additionalClass); $count++; $newsItem .= HtmlParser::substituteMarkerArray($newsItemTemplate, $newsItemMarker); } $title = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] : $GLOBALS['LANG']->getLL('newsheadline'); $newsContent = HtmlParser::substituteMarker($newsContent, '###NEWS_HEADLINE###', htmlspecialchars($title)); $newsContent = HtmlParser::substituteSubpart($newsContent, '###NEWS_ITEM###', $newsItem); } return $newsContent; }
/** * Renders the message. * * @return string The message as HTML. */ public function render() { $markers = array_merge($this->getDefaultMarkers(), $this->markers); $content = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($this->htmlTemplate); $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markers, '', FALSE, TRUE); return $content; }
/** * Build the mail content * * @param integer $curPage Id of the current page * @param string $pageList List of pages id * @param array $markerArray Array of markers * @param array $oldBrokenLink Marker array with the number of link found * @return string Content of the mail */ protected function buildMail($curPage, $pageList, array $markerArray, array $oldBrokenLink) { $pageSectionHtml = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->templateMail, '###PAGE_SECTION###'); // Hook if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['buildMailMarkers'] as $userFunc) { $params = array('curPage' => $curPage, 'pageList' => $pageList, 'markerArray' => $markerArray, 'oldBrokenLink' => $oldBrokenLink, 'pObj' => &$this); $newMarkers = GeneralUtility::callUserFunction($userFunc, $params, $this); if (is_array($newMarkers)) { $markerArray = GeneralUtility::array_merge($markerArray, $newMarkers); } unset($params); } } if (is_array($markerArray)) { foreach ($markerArray as $markerKey => $markerValue) { if (empty($oldBrokenLink[$markerKey])) { $oldBrokenLink[$markerKey] = 0; } if ($markerValue != $oldBrokenLink[$markerKey]) { $this->isDifferentToLastRun = TRUE; } $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey]; } } $markerArray['title'] = BackendUtility::getRecordTitle('pages', BackendUtility::getRecord('pages', $curPage)); $content = ''; if ($markerArray['brokenlinkCount'] > 0) { $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($pageSectionHtml, $markerArray, '###|###', TRUE, TRUE); } return $content; }
/** * Processes helpers LINK : finds and evaluates them in HTML code. * Example : ###LINK:Pid|AdditionalParameters|useCache### * Example : ###LINK:3|param1=val1¶m12=val2|1### * If Pid is empty = current page * * @param array $templateMarkers * @param string $content * @param array $viewHelperArgumentLists * @return string */ protected function processHelpersLink($templateMarkers, $content, $viewHelperArgumentLists) { foreach ($viewHelperArgumentLists as $viewHelperArgument) { $explodeViewHelperArguments = explode('|', $viewHelperArgument); $pid = $explodeViewHelperArguments[0] ? $explodeViewHelperArguments[0] : $GLOBALS['TSFE']->id; $additionalParameters = $explodeViewHelperArguments[1] ? \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($explodeViewHelperArguments[1]) : array(); $useCache = $explodeViewHelperArguments[2] ? true : false; $value = $this->misc->getURL($additionalParameters, $useCache, $pid); $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarker($content, '###LINK:' . $viewHelperArgument . '###', $value); } return $content; }
/** * Gets a subpart from a template. This is just a wrapper around the getSubpart * method of the \TYPO3\CMS\Core\Html\HtmlParser class. * * @param string $template The template * @param string $subpart The subpart name * @return string The subpart */ protected function getSubpart($template, $subpart) { return \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, $subpart); }
/** * Retrieves a subpart from the given html template. * * @param string $subpartName subpart marker name, can be lowercase, doesn't need the ### delimiters * @param string $alternativeTemplate * @return string the html subpart */ public function getSubpart($subpartName, $alternativeTemplate = '') { $template = $this->workOnSubpart; // set alternative template to work on if (!empty($alternativeTemplate)) { $template = $alternativeTemplate; } $subpart = HtmlParser::getSubpart($template, '###' . strtoupper($subpartName) . '###'); return $subpart; }
/** * Creates HTML output for a palette * * @param array $palArr The palette array to print * @return string HTML output * @todo Define visibility */ public function printPalette($palArr) { $fieldAttributes = $labelAttributes = ''; // Init color/class attributes: if ($this->colorScheme[2]) { $labelAttributes .= ' bgcolor="' . $this->colorScheme[2] . '"'; } if ($this->classScheme[2]) { $labelAttributes .= ' class="t3-form-palette-field-label ' . $this->classScheme[2] . '"'; } else { $labelAttributes .= ' class="t3-form-palette-field-label"'; } if ($this->colorScheme[4]) { $fieldAttributes .= ' style="color: ' . $this->colorScheme[4] . '"'; } if ($this->classScheme[4]) { $fieldAttributes .= ' class="t3-form-palette-field ' . $this->classScheme[4] . '"'; } $row = 0; $iRow = array(); $lastLineWasLinebreak = FALSE; // Traverse palette fields and render them into containers: foreach ($palArr as $content) { if ($content['NAME'] === '--linebreak--') { if (!$lastLineWasLinebreak) { $row++; $lastLineWasLinebreak = TRUE; } } else { $lastLineWasLinebreak = FALSE; $paletteMarkers = array('###CONTENT_TABLE###' => $content['TABLE'], '###CONTENT_ID###' => $content['ID'], '###CONTENT_FIELD###' => $content['FIELD'], '###CONTENT_NAME###' => $content['NAME'], '###CONTENT_ITEM###' => $content['ITEM'], '###CONTENT_ITEM_NULLVALUE###' => $content['ITEM_NULLVALUE'], '###CONTENT_ITEM_DISABLED###' => $content['ITEM_DISABLED'], '###ATTRIBUTES_LABEL###' => $labelAttributes, '###ATTRIBUTES_FIELD###' => $fieldAttributes); $iRow[$row][] = HtmlParser::substituteMarkerArray($this->paletteFieldTemplate, $paletteMarkers, FALSE, TRUE); } } // Final wrapping into the fieldset: $out = '<fieldset class="t3-form-palette-fieldset">'; for ($i = 0; $i <= $row; $i++) { if (isset($iRow[$i])) { $out .= implode('', $iRow[$i]); $out .= $i < $row ? '<br />' : ''; } } $out .= '</fieldset>'; return $out; }
/** * Returns HTML-code, which is a visual representation of a multidimensional array * Returns FALSE if $array_in is not an array * * @param mixed $incomingValue Array to view * @return string HTML output * @todo Define visibility */ public function viewArray($incomingValue) { // Get the template file $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'ViewArray.html'); if (is_array($incomingValue) && !empty($incomingValue)) { // Get the template part from the file $content = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###TEMPLATE###'); // Get the subpart for a single item $itemSubpart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($content, '###ITEM###'); foreach ($incomingValue as $key => $value) { if (is_array($value)) { $description = $this->viewArray($value); } elseif (is_object($value)) { $description = get_class($value); if (method_exists($value, '__toString')) { $description .= ': ' . (string) $value; } } else { if (gettype($value) == 'object') { $description = 'Unknown object'; } else { $description = htmlspecialchars((string) $value); } } // Define the markers content $itemMarkers = array('key' => htmlspecialchars((string) $key), 'description' => !empty($description) ? $description : ' '); // Fill the markers in the subpart $items[] = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($itemSubpart, $itemMarkers, '###|###', TRUE, FALSE); } // Substitute the subpart for single item $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($content, '###ITEM###', implode(LF, $items)); } return $content; }
/** * Fill the button lists with the defined HTML * * @param array $buttons HTML for all buttons * @return array Containing HTML for both buttonlists */ protected function getDocHeaderButtons($buttons) { $markers = array(); // Fill buttons for left and right float $floats = array('left', 'right'); foreach ($floats as $key) { // Get the template for each float $buttonTemplate = HtmlParser::getSubpart($this->moduleTemplate, '###BUTTON_GROUPS_' . strtoupper($key) . '###'); // Fill the button markers in this float $buttonTemplate = HtmlParser::substituteMarkerArray($buttonTemplate, $buttons, '###|###', TRUE); // getting the wrap for each group $buttonWrap = HtmlParser::getSubpart($this->moduleTemplate, '###BUTTON_GROUP_WRAP###'); // looping through the groups (max 6) and remove the empty groups for ($groupNumber = 1; $groupNumber < 6; $groupNumber++) { $buttonMarker = '###BUTTON_GROUP' . $groupNumber . '###'; $buttonGroup = HtmlParser::getSubpart($buttonTemplate, $buttonMarker); if (trim($buttonGroup)) { if ($buttonWrap) { $buttonGroup = HtmlParser::substituteMarker($buttonWrap, '###BUTTONS###', $buttonGroup); } $buttonTemplate = HtmlParser::substituteSubpart($buttonTemplate, $buttonMarker, trim($buttonGroup)); } } // Replace the marker with the template and remove all line breaks (for IE compat) $markers['BUTTONLIST_' . strtoupper($key)] = str_replace(LF, '', $buttonTemplate); } // Hook for manipulating docHeaderButtons if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'])) { $params = array('buttons' => $buttons, 'markers' => &$markers, 'pObj' => &$this); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'] as $funcRef) { GeneralUtility::callUserFunction($funcRef, $params, $this); } } return $markers; }
/** * Render the page but not the JavaScript and CSS Files * * @param string $substituteHash The hash that is used for the placehoder markers * @access private * @return string Content of rendered section */ public function renderPageWithUncachedObjects($substituteHash) { $this->prepareRendering(); $markerArray = $this->getPreparedMarkerArrayForPageWithUncachedObjects($substituteHash); $template = $this->getTemplateForPart(self::PART_COMPLETE); return trim(\TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markerArray, '###|###')); }
/** * Strips empty tags from HTML. * * @test * @dataProvider stripEmptyTagsDataProvider * @param string $content The content to be stripped of empty tags * @param string $tagList The comma separated list of tags to be stripped. * If empty, all empty tags will be stripped * @param bool $treatNonBreakingSpaceAsEmpty If TRUE tags containing only entities will be treated as empty. * @param string $expectedResult */ public function rawStripEmptyTagsTest($content, $tagList, $treatNonBreakingSpaceAsEmpty, $expectedResult) { $this->assertEquals($expectedResult, $this->subject->stripEmptyTags($content, $tagList, $treatNonBreakingSpaceAsEmpty)); }
/** * Exit the script with a message that the install tool is locked. * * @return void */ protected static function dieWithLockedInstallToolMessage() { require_once PATH_site . 't3lib/class.t3lib_parsehtml.php'; // Define the stylesheet $stylesheet = '<link rel="stylesheet" type="text/css" href="' . '../stylesheets/install/install.css" />'; $javascript = '<script type="text/javascript" src="' . '../contrib/prototype/prototype.js"></script>'; $javascript .= '<script type="text/javascript" src="' . '../sysext/install/Resources/Public/Javascript/install.js"></script>'; // Get the template file $template = @file_get_contents(PATH_site . 'typo3/templates/install.html'); // Define the markers content $markers = array('styleSheet' => $stylesheet, 'javascript' => $javascript, 'title' => 'The Install Tool is locked', 'content' => ' <p> To enable the Install Tool, the file ENABLE_INSTALL_TOOL must be created. </p> <ul> <li> In the typo3conf/ folder, create a file named ENABLE_INSTALL_TOOL. The file name is case sensitive, but the file itself can simply be an empty file. </li> <li class="t3-install-locked-user-settings"> Alternatively, in the Backend, go to <a href="javascript:top.goToModule(\'tools_install\',1);">Admin tools > Install</a> and let TYPO3 create this file for you.<br /> You are recommended to log out from the Install Tool after finishing your work. The file will then automatically be deleted. </li> </ul> <p> For security reasons, it is highly recommended that you either rename or delete the file after the operation is finished. </p> <p> As an additional security measure, if the file is older than one hour, TYPO3 will automatically delete it. The file must be writable by the web server user. </p> '); // Fill the markers $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markers, '###|###', 1, 1); // Output the warning message and exit header('Content-Type: text/html; charset=utf-8'); header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); echo $content; die; }
/** * Generates the css files * * @return void */ protected function generateCSS() { $cssData = ''; if ($this->includeTimestampInCSS) { $timestamp = '?' . time(); } else { $timestamp = ''; } $spritePathForCSS = $this->resolveSpritePath(); $markerArray = array('###NAMESPACE###' => $this->nameSpace, '###DEFAULTWIDTH###' => $this->defaultWidth, '###DEFAULTHEIGHT###' => $this->defaultHeight, '###SPRITENAME###' => '', '###SPRITEURL###' => $spritePathForCSS ? $spritePathForCSS . '/' : ''); $markerArray['###SPRITEURL###'] .= $this->spriteName . '.png' . $timestamp; foreach ($this->spriteBases as $base) { $markerArray['###SPRITENAME###'] = $base; $cssData .= \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($this->templateSprite, $markerArray); } foreach ($this->iconsData as $key => $data) { $temp = $data['iconNameParts']; array_shift($temp); $cssName = implode('-', $temp); $markerArrayIcons = array('###NAMESPACE###' => $this->nameSpace, '###ICONNAME###' => $cssName, '###LEFT###' => $data['left'], '###TOP###' => $data['top'], '###SIZE_INFO###' => ''); if ($data['height'] != $this->defaultHeight) { $markerArrayIcons['###SIZE_INFO###'] .= TAB . 'height: ' . $data['height'] . 'px;' . LF; } if ($data['width'] != $this->defaultWidth) { $markerArrayIcons['###SIZE_INFO###'] .= TAB . 'width: ' . $data['width'] . 'px;' . LF; } $cssData .= \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($this->templateIcon, $markerArrayIcons); } \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . $this->cssFolder . $this->spriteName . '.css', $cssData); }
/** * Generates the notification email content. * This function generates the content of the notification email that is to * be sent. The result of this function is stored into the attribute $this->postqueueMail. * * @author Martin Helmich <*****@*****.**> * @version 2008-06-22 * @return void */ function generateOutput() { $template = $this->loadTemplateFile('notifyPublish'); if ($this->conf['cron_htmlemail']) { $template = HtmlParser::getSubpart($template, '###PNOTIFY_HTML###'); } else { $template = HtmlParser::getSubpart($template, '###PNOTIFY_PLAINTEXT###'); } $itemTemplate = HtmlParser::getSubpart($template, '###PNOTIFY_LISTITEM###'); $marker = array('###PNOTIFY_SUBJECT###' => sprintf($this->getLL('subject'), count($this->postqueueItems)), '###PNOTIFY_TEXT###' => sprintf($this->getLL('text'), $this->conf['cron_sitetitle'], count($this->postqueueItems)), '###PNOTIFY_LINK###' => $this->conf['cron_postqueue_link'], '###LABEL_PNOTIFY_TOPICTITLE###' => $this->getLL('topictitle'), '###LABEL_PNOTIFY_TOPICDATE###' => $this->getLL('topicdate'), '###LABEL_PNOTIFY_TOPICAUTHOR###' => $this->getLL('topicauthor'), '###LABEL_PNOTIFY_TOPICFORUM###' => $this->getLL('topicforum')); $template = HtmlParser::substituteMarkerArray($template, $marker); $itemContent = ''; foreach ($this->postqueueItems as $postqueueItem) { $itemMarker = array('###PNOTIFY_TOPICTITLE###' => $this->getTopicTitle($postqueueItem), '###PNOTIFY_TOPICAUTHOR###' => $this->getTopicAuthor($postqueueItem['post_user']), '###PNOTIFY_TOPICDATE###' => date('d. m. Y, H:i', $postqueueItem['post_time']), '###PNOTIFY_TOPICFORUM###' => $this->getTopicForum($postqueueItem)); $itemContent .= HtmlParser::substituteMarkerArray($itemTemplate, $itemMarker); } $template = HtmlParser::substituteSubpart($template, '###PNOTIFY_LISTITEM###', $itemContent); $this->postqueueMail = $template; }
/** * Marks up the search words from $this->sWarr in the $str with a color. * * @param string Text in which to find and mark up search words. This text is assumed to be UTF-8 like the search words internally is. * @return string Processed content. * @todo Define visibility */ public function markupSWpartsOfString($str) { // Init: $str = str_replace(' ', ' ', \TYPO3\CMS\Core\Html\HtmlParser::bidir_htmlspecialchars($str, -1)); $str = preg_replace('/\\s\\s+/', ' ', $str); $swForReg = array(); // Prepare search words for regex: foreach ($this->sWArr as $d) { $swForReg[] = preg_quote($d['sword'], '/'); } $regExString = '(' . implode('|', $swForReg) . ')'; // Split and combine: $parts = preg_split('/' . $regExString . '/i', ' ' . $str . ' ', 20000, PREG_SPLIT_DELIM_CAPTURE); // Constants: $summaryMax = 300; $postPreLgd = 60; $postPreLgd_offset = 5; $divider = ' ... '; $occurencies = (count($parts) - 1) / 2; if ($occurencies) { $postPreLgd = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($summaryMax / $occurencies, $postPreLgd, $summaryMax / 2); } // Variable: $summaryLgd = 0; $output = array(); // Shorten in-between strings: foreach ($parts as $k => $strP) { if ($k % 2 == 0) { // Find length of the summary part: $strLen = $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $parts[$k]); $output[$k] = $parts[$k]; // Possibly shorten string: if (!$k) { // First entry at all (only cropped on the frontside) if ($strLen > $postPreLgd) { $output[$k] = $divider . preg_replace('/^[^[:space:]]+[[:space:]]/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset))); } } elseif ($summaryLgd > $summaryMax || !isset($parts[$k + 1])) { // In case summary length is exceed OR if there are no more entries at all: if ($strLen > $postPreLgd) { $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], $postPreLgd - $postPreLgd_offset)) . $divider; } } else { // In-between search words: if ($strLen > $postPreLgd * 2) { $output[$k] = preg_replace('/[[:space:]][^[:space:]]+$/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], $postPreLgd - $postPreLgd_offset)) . $divider . preg_replace('/^[^[:space:]]+[[:space:]]/', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset))); } } $summaryLgd += $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $output[$k]); // Protect output: $output[$k] = htmlspecialchars($output[$k]); // If summary lgd is exceed, break the process: if ($summaryLgd > $summaryMax) { break; } } else { $summaryLgd += $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $strP); $output[$k] = '<strong class="tx-indexedsearch-redMarkup">' . htmlspecialchars($parts[$k]) . '</strong>'; } } // Return result: return implode('', $output); }
/** * Removes the first and last tag in the string * Anything before the first and after the last tags respectively is also removed * * @test * @dataProvider removeFirstAndLastTagDataProvider * @param string $str String to process * @param string $expectedResult */ public function removeFirstAndLastTag($str, $expectedResult) { $this->assertEquals($expectedResult, $this->subject->removeFirstAndLastTag($str)); }
/** * Send an email notification to users in workspace * * @param array $stat Workspace access array from \TYPO3\CMS\Core\Authentication\BackendUserAuthentication::checkWorkspace() * @param int $stageId New Stage number: 0 = editing, 1= just ready for review, 10 = ready for publication, -1 = rejected! * @param string $table Table name of element (or list of element names if $id is zero) * @param int $id Record uid of element (if zero, then $table is used as reference to element(s) alone) * @param string $comment User comment sent along with action * @param DataHandler $tcemainObj TCEmain object * @param array $notificationAlternativeRecipients List of recipients to notify instead of be_users selected by sys_workspace, list is generated by workspace extension module * @return void */ protected function notifyStageChange(array $stat, $stageId, $table, $id, $comment, DataHandler $tcemainObj, array $notificationAlternativeRecipients = array()) { $workspaceRec = BackendUtility::getRecord('sys_workspace', $stat['uid']); // So, if $id is not set, then $table is taken to be the complete element name! $elementName = $id ? $table . ':' . $id : $table; if (!is_array($workspaceRec)) { return; } // Get the new stage title from workspaces library, if workspaces extension is installed if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) { $stageService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\StagesService::class); $newStage = $stageService->getStageTitle((int) $stageId); } else { // @todo CONSTANTS SHOULD BE USED - tx_service_workspace_workspaces // @todo use localized labels // Compile label: switch ((int) $stageId) { case 1: $newStage = 'Ready for review'; break; case 10: $newStage = 'Ready for publishing'; break; case -1: $newStage = 'Element was rejected!'; break; case 0: $newStage = 'Rejected element was noticed and edited'; break; default: $newStage = 'Unknown state change!?'; } } if (count($notificationAlternativeRecipients) == 0) { // Compile list of recipients: $emails = array(); switch ((int) $stat['stagechg_notification']) { case 1: switch ((int) $stageId) { case 1: $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']); break; case 10: $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE); break; case -1: // List of elements to reject: $allElements = explode(',', $elementName); // Traverse them, and find the history of each foreach ($allElements as $elRef) { list($eTable, $eUid) = explode(':', $elRef); $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('log_data,tstamp,userid', 'sys_log', 'action=6 and details_nr=30 AND tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($eTable, 'sys_log') . ' AND recuid=' . (int) $eUid, '', 'uid DESC'); // Find all implicated since the last stage-raise from editing to review: foreach ($rows as $dat) { $data = unserialize($dat['log_data']); $emails = $this->getEmailsForStageChangeNotification($dat['userid'], TRUE) + $emails; if ($data['stage'] == 1) { break; } } } break; case 0: $emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']); break; default: $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE); } break; case 10: $emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE); $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']) + $emails; $emails = $this->getEmailsForStageChangeNotification($workspaceRec['members']) + $emails; break; default: // Do nothing } } else { $emails = $notificationAlternativeRecipients; } // prepare and then send the emails if (count($emails)) { // Path to record is found: list($elementTable, $elementUid) = explode(':', $elementName); $elementUid = (int) $elementUid; $elementRecord = BackendUtility::getRecord($elementTable, $elementUid); $recordTitle = BackendUtility::getRecordTitle($elementTable, $elementRecord); if ($elementTable == 'pages') { $pageUid = $elementUid; } else { BackendUtility::fixVersioningPid($elementTable, $elementRecord); $pageUid = $elementUid = $elementRecord['pid']; } // fetch the TSconfig settings for the email // old way, options are TCEMAIN.notificationEmail_body/subject $TCEmainTSConfig = $tcemainObj->getTCEMAIN_TSconfig($pageUid); // new way, options are // pageTSconfig: tx_version.workspaces.stageNotificationEmail.subject // userTSconfig: page.tx_version.workspaces.stageNotificationEmail.subject $pageTsConfig = BackendUtility::getPagesTSconfig($pageUid); $emailConfig = $pageTsConfig['tx_version.']['workspaces.']['stageNotificationEmail.']; $markers = array('###RECORD_TITLE###' => $recordTitle, '###RECORD_PATH###' => BackendUtility::getRecordPath($elementUid, '', 20), '###SITE_NAME###' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], '###SITE_URL###' => GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir, '###WORKSPACE_TITLE###' => $workspaceRec['title'], '###WORKSPACE_UID###' => $workspaceRec['uid'], '###ELEMENT_NAME###' => $elementName, '###NEXT_STAGE###' => $newStage, '###COMMENT###' => $comment, '###USER_REALNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_FULLNAME###' => $tcemainObj->BE_USER->user['realName'], '###USER_USERNAME###' => $tcemainObj->BE_USER->user['username']); // add marker for preview links if workspace extension is loaded if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('workspaces')) { $this->workspaceService = GeneralUtility::makeInstance(\TYPO3\CMS\Workspaces\Service\WorkspaceService::class); // only generate the link if the marker is in the template - prevents database from getting to much entries if (GeneralUtility::isFirstPartOfStr($emailConfig['message'], 'LLL:')) { $tempEmailMessage = $GLOBALS['LANG']->sL($emailConfig['message']); } else { $tempEmailMessage = $emailConfig['message']; } if (strpos($tempEmailMessage, '###PREVIEW_LINK###') !== FALSE) { $markers['###PREVIEW_LINK###'] = $this->workspaceService->generateWorkspacePreviewLink($elementUid); } unset($tempEmailMessage); $markers['###SPLITTED_PREVIEW_LINK###'] = $this->workspaceService->generateWorkspaceSplittedPreviewLink($elementUid, TRUE); } // Hook for preprocessing of the content for formmails: if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/version/class.tx_version_tcemain.php']['notifyStageChange-postModifyMarkers'] as $_classRef) { $_procObj =& GeneralUtility::getUserObj($_classRef); $markers = $_procObj->postModifyMarkers($markers, $this); } } // send an email to each individual user, to ensure the // multilanguage version of the email $emailRecipients = array(); // an array of language objects that are needed // for emails with different languages $languageObjects = array($GLOBALS['LANG']->lang => $GLOBALS['LANG']); // loop through each recipient and send the email foreach ($emails as $recipientData) { // don't send an email twice if (isset($emailRecipients[$recipientData['email']])) { continue; } $emailSubject = $emailConfig['subject']; $emailMessage = $emailConfig['message']; $emailRecipients[$recipientData['email']] = $recipientData['email']; // check if the email needs to be localized // in the users' language if (GeneralUtility::isFirstPartOfStr($emailSubject, 'LLL:') || GeneralUtility::isFirstPartOfStr($emailMessage, 'LLL:')) { $recipientLanguage = $recipientData['lang'] ? $recipientData['lang'] : 'default'; if (!isset($languageObjects[$recipientLanguage])) { // a LANG object in this language hasn't been // instantiated yet, so this is done here /** @var $languageObject \TYPO3\CMS\Lang\LanguageService */ $languageObject = GeneralUtility::makeInstance(\TYPO3\CMS\Lang\LanguageService::class); $languageObject->init($recipientLanguage); $languageObjects[$recipientLanguage] = $languageObject; } else { $languageObject = $languageObjects[$recipientLanguage]; } if (GeneralUtility::isFirstPartOfStr($emailSubject, 'LLL:')) { $emailSubject = $languageObject->sL($emailSubject); } if (GeneralUtility::isFirstPartOfStr($emailMessage, 'LLL:')) { $emailMessage = $languageObject->sL($emailMessage); } } $emailSubject = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($emailSubject, $markers, '', TRUE, TRUE); $emailMessage = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($emailMessage, $markers, '', TRUE, TRUE); // Send an email to the recipient /** @var $mail \TYPO3\CMS\Core\Mail\MailMessage */ $mail = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class); if (!empty($recipientData['realName'])) { $recipient = array($recipientData['email'] => $recipientData['realName']); } else { $recipient = $recipientData['email']; } $mail->setTo($recipient)->setSubject($emailSubject)->setFrom(\TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom())->setBody($emailMessage); $mail->send(); } $emailRecipients = implode(',', $emailRecipients); $tcemainObj->newlog2('Notification email for stage change was sent to "' . $emailRecipients . '"', $table, $id); } }
/** * Sets the design to the backend design. * Backend * * @return void * @todo Define visibility */ public function setNewBEDesign() { $template = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(PATH_typo3 . $this->templateFile); // Wrapping all table rows for a particular record being edited: $this->totalWrap = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###TOTALWRAP###'); // Wrapping a single field: $this->fieldTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###FIELDTEMPLATE###'); $this->palFieldTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###PALETTE_FIELDTEMPLATE###'); $this->palFieldTemplateHeader = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###PALETTE_FIELDTEMPLATE_HEADER###'); $this->sectionWrap = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###SECTION_WRAP###'); }