>
<div class="htmlContent">
{if $articleContent->teaser}
- <p class="articleTeaser">{$articleContent->teaser}</p>
+ <p class="articleTeaser">{@$articleContent->getFormattedTeaser()}</p>
{/if}
{@$articleContent->getFormattedContent()}
</li>
{if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike')}
- <li>
+ <li class="wcfLikeCounter{if $relatedArticle->cumulativeLikes > 0} likeCounterLiked{elseif $relatedArticle->cumulativeLikes < 0}likeCounterDisliked{/if}">
{if $relatedArticle->likes || $relatedArticle->dislikes}
- <span class="icon icon16 fa-thumbs-o-{if $relatedArticle->cumulativeLikes < 0}down{else}up{/if} jsTooltip" title="{lang likes=$relatedArticle->likes dislikes=$relatedArticle->dislikes}wcf.like.tooltip{/lang}"></span>
- {if $relatedArticle->cumulativeLikes > 0}+{elseif $relatedArticle->cumulativeLikes == 0}±{/if}{#$relatedArticle->cumulativeLikes}
+ <span class="icon icon16 fa-thumbs-o-{if $relatedArticle->cumulativeLikes < 0}down{else}up{/if} jsTooltip" title="{lang likes=$relatedArticle->likes dislikes=$relatedArticle->dislikes}wcf.like.tooltip{/lang}"></span>{if $relatedArticle->cumulativeLikes > 0}+{elseif $relatedArticle->cumulativeLikes == 0}±{/if}{#$relatedArticle->cumulativeLikes}
{/if}
</li>
{/if}
</div>
<div class="containerContent articleListTeaser">
- {$relatedArticle->getTeaser()}
+ {@$relatedArticle->getFormattedTeaser()}
</div>
</div>
* article content grouped by language id
* @var ArticleContent[]
*/
- public $articleContent;
+ public $articleContents;
/**
* language links
* @inheritDoc
*/
public function getLink() {
- $this->getArticleContent();
- if ($this->isMultilingual) {
- if (isset($this->articleContent[WCF::getLanguage()->languageID])) {
- return $this->articleContent[WCF::getLanguage()->languageID]->getLink();
- }
- }
- else {
- if (isset($this->articleContent[0])) {
- return $this->articleContent[0]->getLink();
- }
+ if ($this->getArticleContent() !== null) {
+ return $this->getArticleContent()->getLink();
}
return '';
/**
* Returns the article's title.
*
- * @return string
+ * @return string
*/
public function getTitle() {
- $this->getArticleContent();
- if ($this->isMultilingual) {
- if (isset($this->articleContent[WCF::getLanguage()->languageID])) {
- return $this->articleContent[WCF::getLanguage()->languageID]->getTitle();
- }
- }
- else {
- if (isset($this->articleContent[0])) {
- return $this->articleContent[0]->getTitle();
- }
+ if ($this->getArticleContent() !== null) {
+ return $this->getArticleContent()->getTitle();
}
return '';
}
/**
- * Returns the article's teaser.
+ * Returns the article's unformatted teaser.
*
- * @return string
+ * @return string
*/
public function getTeaser() {
- $this->getArticleContent();
- if ($this->isMultilingual) {
- if (isset($this->articleContent[WCF::getLanguage()->languageID])) {
- return $this->articleContent[WCF::getLanguage()->languageID]->teaser;
- }
+ if ($this->getArticleContent() !== null) {
+ return $this->getArticleContent()->getTeaser();
}
- else {
- if (isset($this->articleContent[0])) {
- return $this->articleContent[0]->teaser;
- }
+
+ return '';
+ }
+
+ /**
+ * Returns the article's formatted teaser.
+ *
+ * @return string
+ */
+ public function getFormattedTeaser() {
+ if ($this->getArticleContent() !== null) {
+ return $this->getArticleContent()->getFormattedTeaser();
}
return '';
/**
* Returns the article's formatted content.
*
- * @return string
+ * @return string
*/
public function getFormattedContent() {
- $this->getArticleContent();
- if ($this->isMultilingual) {
- if (isset($this->articleContent[WCF::getLanguage()->languageID])) {
- return $this->articleContent[WCF::getLanguage()->languageID]->getFormattedContent();
- }
- }
- else {
- if (isset($this->articleContent[0])) {
- return $this->articleContent[0]->getFormattedContent();
- }
+ if ($this->getArticleContent() !== null) {
+ return $this->getArticleContent()->getFormattedContent();
}
return '';
}
/**
- * Returns the article's image.
+ * Returns the active content version.
*
- * @return ViewableMedia
+ * @return ArticleContent|null
*/
- public function getImage() {
- $this->getArticleContent();
+ public function getArticleContent() {
+ $this->getArticleContents();
+
if ($this->isMultilingual) {
- if (isset($this->articleContent[WCF::getLanguage()->languageID])) {
- return $this->articleContent[WCF::getLanguage()->languageID]->getImage();
+ if (isset($this->articleContents[WCF::getLanguage()->languageID])) {
+ return $this->articleContents[WCF::getLanguage()->languageID];
}
}
else {
- if (!empty($this->articleContent[0])) {
- return $this->articleContent[0]->getImage();
+ if (!empty($this->articleContents[0])) {
+ return $this->articleContents[0];
}
}
*
* @return ArticleContent[]
*/
- public function getArticleContent() {
- if ($this->articleContent === null) {
- $this->articleContent = [];
+ public function getArticleContents() {
+ if ($this->articleContents === null) {
+ $this->articleContents = [];
$sql = "SELECT *
FROM wcf" . WCF_N . "_article_content
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$this->articleID]);
while ($row = $statement->fetchArray()) {
- $this->articleContent[($row['languageID'] ?: 0)] = new ArticleContent(null, $row);
+ $this->articleContents[($row['languageID'] ?: 0)] = new ArticleContent(null, $row);
}
}
- return $this->articleContent;
+ return $this->articleContents;
}
/**