/** * Returns a frontend locallang value with all HTML entities replaced for display in browser * * @param tslib_pibase object of type tslib_pibase: TYPO3 frontend plugin derived from tslib_pibase * @param string locallang array key (of the plugins locallang.php file) * @return string value of the passed locallang array key with all HTML entities replaced for display in browser * @author Rainer Kuhn */ public static function displayLL(\TYPO3\CMS\Frontend\Plugin\AbstractPlugin $callerObj, $LLkey) { return htmlentities($callerObj->pi_getLL($LLkey), ENT_QUOTES); }
/** * Wrapper function for retrieval of language dependent strings. * This function overrides the parent pi_getLL function. This was introduced * in order to allow language variables using TypoScript (which was until now * not possible due to the dots used in the language indices) by accessing * the same language label with dashes indead of dots. This function allows this * without changing all pi_getLL calls in this class. * * Furthermore, as of version 0.1.4, the function controls the use of * formal or informal language (which is mainly characterized by the use of the * german "Sie" or "Du"). * * @param string $key The language key * @return string The language dependent label * @author Martin Helmich <*****@*****.**> * @version 2007-10-05 */ function pi_getLL($key) { $altKey = str_replace('.', '-', $key); // first check the alternative syntax with the "-" $llKey = parent::pi_getLL($altKey); if ($llKey) { // additionally check for the informal option (once we know there is a if ($this->conf['informal'] && parent::pi_getLL($altKey . '-inf')) { $llKey = parent::pi_getLL($altKey . '-inf'); } } else { $llKey = parent::pi_getLL($key); if ($this->conf['informal'] && parent::pi_getLL($key . '-inf')) { $llKey = parent::pi_getLL($key . '-inf'); } } return $llKey; }
/** * Main function, called from TypoScript * A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it. * This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered. * * @param \TYPO3\CMS\Frontend\Plugin\AbstractPlugin $invokingObj the tt_news object * @return string Plain text content */ public function extraCodesProcessor(&$invokingObj) { $content = ''; $this->conf = $invokingObj->conf; if ($this->conf['code'] == 'PLAINTEXT') { $this->cObj = $invokingObj->cObj; $this->config = $invokingObj->config; $this->tt_news_uid = $invokingObj->tt_news_uid; $this->enableFields = $invokingObj->enableFields; $this->sys_language_mode = $invokingObj->sys_language_mode; $this->templateCode = $invokingObj->templateCode; $this->renderPlainText = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_directmail_pi1'); $this->renderPlainText->init($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_directmail_pi1.']); $this->renderPlainText->cObj = $this->cObj; $this->renderPlainText->labelsList = 'tt_news_author_prefix,tt_news_author_date_prefix,tt_news_author_email_prefix,tt_news_short_header,tt_news_bodytext_header'; $lines = array(); $singleWhere = 'tt_news.uid=' . intval($this->tt_news_uid); $singleWhere .= ' AND type=0' . $this->enableFields; // type=0->only real news. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_news', $singleWhere); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); $GLOBALS['TYPO3_DB']->sql_free_result($res); // get the translated record if the content language is not the default language if ($GLOBALS['TSFE']->sys_language_content) { $OLmode = $this->sys_language_mode == 'strict' ? 'hideNonTranslated' : ''; $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_news', $row, $GLOBALS['TSFE']->sys_language_content, $OLmode); } if (is_array($row)) { // Render the title $lines[] = $this->renderPlainText->renderHeader($row['title']); // Render author of the tt_news record $lines[] = $this->renderAuthor($row); // Render the short version of the tt_news record $lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['short'], 'tt_news_short'))); // Render the main text of the tt_news record $lines[] = $this->renderPlainText->breakContent(strip_tags($this->renderPlainText->parseBody($row['bodytext'], 'tt_news_bodytext'))); // Render the images of the tt_news record. $lines[] = $this->getImages($row); // Render the downloads of the tt_news record. $lines[] = $this->renderPlainText->renderUploads($row['news_files']); } elseif ($this->sys_language_mode == 'strict' && $this->tt_news_uid) { $noTranslMsg = $this->cObj->stdWrap($invokingObj->pi_getLL('noTranslMsg', 'Sorry, there is no translation for this news-article'), $this->conf['noNewsIdMsg_stdWrap.']); $content .= $noTranslMsg; } if (!empty($lines)) { $content = implode(LF, $lines) . $content; } // Substitute labels if (!empty($content)) { $markerArray = array(); $markerArray = $this->renderPlainText->addLabelsMarkers($markerArray); $content = $this->cObj->substituteMarkerArray($content, $markerArray); } } return $content; }