1<?php
2/**
3 * @package     Joomla.Site
4 * @subpackage  Templates.beez3
5 *
6 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
7 * @license     GNU General Public License version 2 or later; see LICENSE.txt
8 */
9
10defined('_JEXEC') or die;
11
12// Create shortcut
13$urls = json_decode($this->item->urls);
14
15// Create shortcuts to some parameters.
16$params = $this->item->params;
17if ($urls && (!empty($urls->urla) || !empty($urls->urlb) || !empty($urls->urlc))) :
18?>
19<div class="content-links">
20	<ul class="nav nav-tabs nav-stacked">
21		<?php
22			$urlarray = array(
23			array($urls->urla, $urls->urlatext, $urls->targeta, 'a'),
24			array($urls->urlb, $urls->urlbtext, $urls->targetb, 'b'),
25			array($urls->urlc, $urls->urlctext, $urls->targetc, 'c')
26			);
27			foreach ($urlarray as $url) :
28				$link = $url[0];
29				$label = $url[1];
30				$target = $url[2];
31				$id = $url[3];
32
33				if (!$link) :
34					continue;
35				endif;
36
37				// If no label is present, take the link
38				$label = $label ?: $link;
39
40				// If no target is present, use the default
41				$target = $target ?: $params->get('target'.$id);
42				?>
43			<li class="content-links-<?php echo $id; ?>">
44				<?php
45					// Compute the correct link
46
47					switch ($target)
48					{
49						case 1:
50							// open in a new window
51							echo '<a href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '" target="_blank"  rel="nofollow noopener noreferrer">' .
52								htmlspecialchars($label, ENT_COMPAT, 'UTF-8') .'</a>';
53							break;
54
55						case 2:
56							// open in a popup window
57							$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=600';
58							echo "<a href=\"" . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . "\" onclick=\"window.open(this.href, 'targetWindow', '".$attribs."'); return false;\" rel=\"noopener noreferrer\">".
59								htmlspecialchars($label, ENT_COMPAT, 'UTF-8').'</a>';
60							break;
61						case 3:
62							// open in a modal window
63							JHtml::_('behavior.modal', 'a.modal');
64							echo '<a class="modal" href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '"  rel="{handler: \'iframe\', size: {x:600, y:600}} noopener noreferrer">'.
65								htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . ' </a>';
66							break;
67
68						default:
69							// open in parent window
70							echo '<a href="' .  htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '" rel="nofollow">'.
71								htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . ' </a>';
72							break;
73					}
74				?>
75				</li>
76		<?php endforeach; ?>
77	</ul>
78</div>
79<?php endif; ?>
80