default.php
4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* @package Joomla.Site
* @subpackage mod_banners
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('BannerHelper', JPATH_ROOT . '/components/com_banners/helpers/banner.php');
?>
<div class="bannergroup<?php echo $moduleclass_sfx; ?>">
<?php if ($headerText) : ?>
<?php echo $headerText; ?>
<?php endif; ?>
<?php foreach ($list as $item) : ?>
<div class="banneritem">
<?php $link = JRoute::_('index.php?option=com_banners&task=click&id=' . $item->id); ?>
<?php if ($item->type == 1) : ?>
<?php // Text based banners ?>
<?php echo str_replace(array('{CLICKURL}', '{NAME}'), array($link, $item->name), $item->custombannercode); ?>
<?php else : ?>
<?php $imageurl = $item->params->get('imageurl'); ?>
<?php $width = $item->params->get('width'); ?>
<?php $height = $item->params->get('height'); ?>
<?php if (BannerHelper::isImage($imageurl)) : ?>
<?php // Image based banner ?>
<?php $baseurl = strpos($imageurl, 'http') === 0 ? '' : JUri::base(); ?>
<?php $alt = $item->params->get('alt'); ?>
<?php $alt = $alt ?: $item->name; ?>
<?php $alt = $alt ?: JText::_('MOD_BANNERS_BANNER'); ?>
<?php if ($item->clickurl) : ?>
<?php // Wrap the banner in a link ?>
<?php $target = $params->get('target', 1); ?>
<?php if ($target == 1) : ?>
<?php // Open in a new window ?>
<a
href="<?php echo $link; ?>" target="_blank" rel="noopener noreferrer"
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) echo ' width="' . $width . '"';?>
<?php if (!empty($height)) echo ' height="' . $height . '"';?>
/>
</a>
<?php elseif ($target == 2) : ?>
<?php // Open in a popup window ?>
<a
href="<?php echo $link; ?>" onclick="window.open(this.href, '',
'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550');
return false"
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) echo ' width="' . $width . '"';?>
<?php if (!empty($height)) echo ' height="' . $height . '"';?>
/>
</a>
<?php else : ?>
<?php // Open in parent window ?>
<a
href="<?php echo $link; ?>"
title="<?php echo htmlspecialchars($item->name, ENT_QUOTES, 'UTF-8'); ?>">
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) echo ' width="' . $width . '"';?>
<?php if (!empty($height)) echo ' height="' . $height . '"';?>
/>
</a>
<?php endif; ?>
<?php else : ?>
<?php // Just display the image if no link specified ?>
<img
src="<?php echo $baseurl . $imageurl; ?>"
alt="<?php echo htmlspecialchars($alt, ENT_QUOTES, 'UTF-8'); ?>"
<?php if (!empty($width)) echo ' width="' . $width . '"';?>
<?php if (!empty($height)) echo ' height="' . $height . '"';?>
/>
<?php endif; ?>
<?php elseif (BannerHelper::isFlash($imageurl)) : ?>
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
<?php if (!empty($width)) echo ' width="' . $width . '"';?>
<?php if (!empty($height)) echo ' height="' . $height . '"';?>
>
<param name="movie" value="<?php echo $imageurl; ?>" />
<embed
src="<?php echo $imageurl; ?>"
loop="false"
pluginspage="http://www.macromedia.com/go/get/flashplayer"
type="application/x-shockwave-flash"
<?php if (!empty($width)) echo ' width="' . $width . '"';?>
<?php if (!empty($height)) echo ' height="' . $height . '"';?>
/>
</object>
<?php endif; ?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endforeach; ?>
<?php if ($footerText) : ?>
<div class="bannerfooter">
<?php echo $footerText; ?>
</div>
<?php endif; ?>
</div>