From 4a9b28a58c43273b0910748c5419198995e1c00b Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 18 Mar 2019 16:08:30 +0100 Subject: [PATCH] Add ad support for articles Close #2707 --- com.woltlab.wcf/objectType.xml | 36 +++++++++++++++ com.woltlab.wcf/templates/article.tpl | 6 ++- .../templates/articleListItems.tpl | 46 ++++++++++++++++++- com.woltlab.wcf/templates/boxArticleList.tpl | 2 +- wcfsetup/install/lang/de.xml | 7 +++ wcfsetup/install/lang/en.xml | 7 +++ 6 files changed, 101 insertions(+), 3 deletions(-) diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 5c2d5844c2..8da42098fb 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -1018,6 +1018,42 @@ com.woltlab.wcf.global wcfAdLocationFooterBottom + + com.woltlab.wcf.article.inArticle + com.woltlab.wcf.adLocation + com.woltlab.wcf.article + wcfAdLocationInArticle + + + com.woltlab.wcf.article.after1stArticle + com.woltlab.wcf.adLocation + com.woltlab.wcf.article + wcfAdLocationArticleList wcfAdLocationAfter1stArticle + + + com.woltlab.wcf.article.afterEvery2ndArticle + com.woltlab.wcf.adLocation + com.woltlab.wcf.article + wcfAdLocationArticleList wcfAdLocationAfterEvery2ndArticle + + + com.woltlab.wcf.article.afterEvery3rdArticle + com.woltlab.wcf.adLocation + com.woltlab.wcf.article + wcfAdLocationArticleList wcfAdLocationAfterEvery3rdArticle + + + com.woltlab.wcf.article.afterEvery5thArticle + com.woltlab.wcf.adLocation + com.woltlab.wcf.article + wcfAdLocationArticleList wcfAdLocationAfterEvery5thArticle + + + com.woltlab.wcf.article.afterEvery10thArticle + com.woltlab.wcf.adLocation + com.woltlab.wcf.article + wcfAdLocationArticleList wcfAdLocationAfterEvery10thArticle + diff --git a/com.woltlab.wcf/templates/article.tpl b/com.woltlab.wcf/templates/article.tpl index e0ad68e213..824aec8d0b 100644 --- a/com.woltlab.wcf/templates/article.tpl +++ b/com.woltlab.wcf/templates/article.tpl @@ -132,10 +132,14 @@
getReactionHandler()->getDataAttributes('com.woltlab.wcf.likeableArticle', $article->articleID)}>
+ {if MODULE_WCF_AD} + {@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.inArticle')} + {/if} + {if $articleContent->teaser} {/if} - + {@$articleContent->getFormattedContent()} {event name='htmlArticleContent'} diff --git a/com.woltlab.wcf/templates/articleListItems.tpl b/com.woltlab.wcf/templates/articleListItems.tpl index 5067b8e89d..22cfaf345a 100644 --- a/com.woltlab.wcf/templates/articleListItems.tpl +++ b/com.woltlab.wcf/templates/articleListItems.tpl @@ -1,5 +1,7 @@ +{if !$disableAds|isset}{assign var='disableAds' value=false}{/if} +
    - {foreach from=$objects item='article'} + {foreach from=$objects item='article' name=articles}
  • {if $article->getTeaserImage() && $article->getTeaserImage()->hasThumbnail('tiny')} @@ -60,5 +62,47 @@ {event name='articleListEntry'}
  • + + {if MODULE_WCF_AD && !$disableAds} + {if $tpl[foreach][articles][iteration] === 1} + {hascontent} +
  • + {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.after1stArticle')}{/content} +
  • + {/hascontent} + {else} + {if $tpl[foreach][articles][iteration] % 2 === 0} + {hascontent} +
  • + {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery2ndArticle')}{/content} +
  • + {/hascontent} + {/if} + + {if $tpl[foreach][articles][iteration] % 3 === 0} + {hascontent} +
  • + {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery3rdArticle')}{/content} +
  • + {/hascontent} + {/if} + + {if $tpl[foreach][articles][iteration] % 5 === 0} + {hascontent} +
  • + {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery5thArticle')}{/content} +
  • + {/hascontent} + {/if} + + {if $tpl[foreach][articles][iteration] % 10 === 0} + {hascontent} +
  • + {content}{@$__wcf->getAdHandler()->getAds('com.woltlab.wcf.article.afterEvery10thArticle')}{/content} +
  • + {/hascontent} + {/if} + {/if} + {/if} {/foreach}
diff --git a/com.woltlab.wcf/templates/boxArticleList.tpl b/com.woltlab.wcf/templates/boxArticleList.tpl index ac166e7b6d..c639d38c59 100644 --- a/com.woltlab.wcf/templates/boxArticleList.tpl +++ b/com.woltlab.wcf/templates/boxArticleList.tpl @@ -51,5 +51,5 @@ {/foreach} {else} - {include file='articleListItems' objects=$boxArticleList} + {include file='articleListItems' objects=$boxArticleList disableAds=true} {/if} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index ed1ca12705..54e2ed0c23 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -46,6 +46,13 @@ + + + + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 0d47ec7b0b..3c317844aa 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -46,6 +46,13 @@ + + + + + + + -- 2.20.1