<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
</option>
+ <option name="enable_ad_rotation">
+ <categoryname>general.page</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>1</defaultvalue>
+ <options>module_wcf_ad</options>
+ </option>
<option name="head_code">
<categoryname>general.page</categoryname>
<optiontype>textarea</optiontype>
define('HEAD_CODE', '');
define('AVATAR_DEFAULT_TYPE', 'initials');
define('ARTICLE_ENABLE_VISIT_TRACKING', 1);
+define('ENABLE_AD_ROTATION', 1);
return '';
}
- $output = '';
+ /** @var Ad[] $ads */
+ $ads = [];
foreach ($this->ads[$this->objectTypes[$adLocation]->objectTypeID] as $ad) {
+ $ads[] = $ad;
+ }
+
+ if (ENABLE_AD_ROTATION && count($ads) > 1) {
+ $ads = [
+ $ads[mt_rand(0, count($ads) - 1)]
+ ];
+
+ $a = [0, 0];
+ for ($i = 0; $i < 10000; $i++) {
+ $a[mt_rand(0, 1)]++;
+ }
+ }
+
+ $output = '';
+ foreach ($ads as $ad) {
$conditions = $ad->getConditions();
foreach ($conditions as $condition) {
if (!$condition->getObjectType()->getProcessor()->showContent($condition)) {
<item name="wcf.acp.option.avatar_default_type.initials"><![CDATA[Initialen]]></item>
<item name="wcf.acp.option.avatar_default_type.silhouette"><![CDATA[Silhouette]]></item>
<item name="wcf.acp.option.article_enable_visit_tracking"><![CDATA[Gelesen-Markierung für Artikel aktivieren]]></item>
+ <item name="wcf.acp.option.enable_ad_rotation"><![CDATA[Werbung abwechselnd anzeigen]]></item>
+ <item name="wcf.acp.option.enable_ad_rotation.description"><![CDATA[Sobald einer Position mehr als eine Werbung zugewiesen sein, so wird bei jedem Aufruf eine zufällige Werbung angezeigt. Bei Deaktivierung dieser Option werden alle Werbungen parallel angezeigt.]]></item>
</category>
<category name="wcf.acp.package">
<item name="wcf.acp.option.avatar_default_type.initials"><![CDATA[Initials]]></item>
<item name="wcf.acp.option.avatar_default_type.silhouette"><![CDATA[Silhouette]]></item>
<item name="wcf.acp.option.article_enable_visit_tracking"><![CDATA[Enable “mark as read” for articles]]></item>
+ <item name="wcf.acp.option.enable_ad_rotation"><![CDATA[Enable ad rotation]]></item>
+ <item name="wcf.acp.option.enable_ad_rotation.description"><![CDATA[If there is more than one ad per placeholder, a random ad will be displayed every time. Disabling this option will display all ads simultaneously.]]></item>
</category>
<category name="wcf.acp.package">