Skip to content

Commit 154d8d3

Browse files
committed
Improve generation of visual demo markup
1 parent 9dc292f commit 154d8d3

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

event/main_listener.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,15 @@ public function visual_demo()
189189
$all_locations = $this->location_manager->get_all_locations(false);
190190
foreach ($this->location_manager->get_all_location_ids() as $location_id)
191191
{
192+
$ad_var = 'AD_' . strtoupper($location_id);
193+
192194
$this->template->assign_vars(array(
193-
'AD_' . strtoupper($location_id) . '_ID' => $location_id,
194-
'AD_' . strtoupper($location_id) => '<div class="phpbb-ads-visual-demo" title="' . $all_locations[$location_id]['desc'] . '">' . $all_locations[$location_id]['name'] . '</div>',
195+
$ad_var . '_ID' => $location_id,
196+
$ad_var => array(
197+
'visual_demo' => true,
198+
'name' => $all_locations[$location_id]['name'],
199+
'desc' => $all_locations[$location_id]['desc'],
200+
),
195201
));
196202
}
197203

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{# begin ad location #}
2-
{{ AD_SCRIPTS }}
2+
{% if AD_SCRIPTS and AD_SCRIPTS is not iterable %}
3+
{{ AD_SCRIPTS }}
4+
{% endif %}
35
{# end ad location #}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{% macro renderAds(PHPBB_ADS_CODE, PHPBB_ADS_ID, S_PHPBB_ADS_CENTER = false, PHPBB_ADS_STYLE = '') %}
22
{% if PHPBB_ADS_CODE %}
33
<div class="phpbb-ads{% if S_PHPBB_ADS_CENTER %} phpbb-ads-center{% endif %}" style="{{ PHPBB_ADS_STYLE }}" data-phpbb-ads-id="{{ PHPBB_ADS_ID|e('html_attr') }}">
4-
{{ PHPBB_ADS_CODE }}
4+
{% if PHPBB_ADS_CODE is iterable and PHPBB_ADS_CODE.visual_demo %}
5+
<div class="phpbb-ads-visual-demo" title="{{ PHPBB_ADS_CODE.desc|e('html_attr') }}">{{ PHPBB_ADS_CODE.name|e }}</div>
6+
{% else %}
7+
{{ PHPBB_ADS_CODE }}
8+
{% endif %}
59
</div>
610
{% endif %}
711
{% endmacro %}

0 commit comments

Comments
 (0)