From: Alexander Ebert Date: Thu, 28 Jul 2016 10:40:22 +0000 (+0200) Subject: Use proper html output for AMP pages X-Git-Tag: 3.0.0_Beta_1~943^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa644e2defdf80f01a5882cb2e83b99dc2518fbd;p=GitHub%2FWoltLab%2FWCF.git Use proper html output for AMP pages --- diff --git a/com.woltlab.wcf/templates/ampArticle.tpl b/com.woltlab.wcf/templates/ampArticle.tpl index 9ce2344d8e..f4bcbdc8b8 100644 --- a/com.woltlab.wcf/templates/ampArticle.tpl +++ b/com.woltlab.wcf/templates/ampArticle.tpl @@ -61,7 +61,7 @@ {/if}
- {@$articleContent->getFormattedContent()} + {@$articleContent->getAmpFormattedContent()}
diff --git a/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php b/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php index 05dfd77627..042e3d671a 100644 --- a/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php +++ b/wcfsetup/install/files/lib/data/article/content/ArticleContent.class.php @@ -4,6 +4,7 @@ use wcf\data\article\Article; use wcf\data\language\Language; use wcf\data\DatabaseObject; use wcf\data\ILinkableObject; +use wcf\system\html\output\AmpHtmlOutputProcessor; use wcf\system\html\output\HtmlOutputProcessor; use wcf\system\language\LanguageFactory; use wcf\system\request\IRouteController; @@ -98,6 +99,18 @@ class ArticleContent extends DatabaseObject implements ILinkableObject, IRouteCo return $processor->getHtml(); } + /** + * Returns the article's formatted content ready for use with Google AMP pages. + * + * @return string + */ + public function getAmpFormattedContent() { + $processor = new AmpHtmlOutputProcessor(); + $processor->process($this->content, 'com.woltlab.wcf.article.content', $this->articleContentID); + + return $processor->getHtml(); + } + /** * Returns article object. *