/** * Render disqus thread * * @param Tx_MooxNews_Domain_Model_News $newsItem news item * @param string $shortName shortname * @param string $link link * @return string */ public function render(Tx_MooxNews_Domain_Model_News $newsItem, $shortName, $link) { $tsSettings = $this->pluginSettingsService->getSettings(); $code = '<script type="text/javascript"> var disqus_shortname = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($shortName, TRUE) . '; var disqus_identifier = \'news_' . $newsItem->getUid() . '\'; var disqus_url = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($link, TRUE) . '; var disqus_title = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($newsItem->getTitle(), TRUE) . '; var disqus_config = function () { this.language = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($tsSettings['disqusLocale']) . '; }; (function() { var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true; dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js"; (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq); })(); </script>'; return $code; }
/** * Test if title can be set * * @test * @return void */ public function titleCanBeSet() { $title = 'News title'; $this->newsDomainModelInstance->setTitle($title); $this->assertEquals($title, $this->newsDomainModelInstance->getTitle()); }