[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage com_content 6 * 7 * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 defined('_JEXEC') or die; 12 13 use Joomla\CMS\HTML\HTMLHelper; 14 15 // Create shortcut 16 $urls = json_decode($this->item->urls); 17 18 // Create shortcuts to some parameters. 19 $params = $this->item->params; 20 if ($urls && (!empty($urls->urla) || !empty($urls->urlb) || !empty($urls->urlc))) : 21 ?> 22 <div class="com-content-article__links content-links"> 23 <ul class="com-content-article__links content-list"> 24 <?php 25 $urlarray = array( 26 array($urls->urla, $urls->urlatext, $urls->targeta, 'a'), 27 array($urls->urlb, $urls->urlbtext, $urls->targetb, 'b'), 28 array($urls->urlc, $urls->urlctext, $urls->targetc, 'c') 29 ); 30 foreach ($urlarray as $url) : 31 $link = $url[0]; 32 $label = $url[1]; 33 $target = $url[2]; 34 $id = $url[3]; 35 36 if (! $link) : 37 continue; 38 endif; 39 40 // If no label is present, take the link 41 $label = $label ?: $link; 42 43 // If no target is present, use the default 44 $target = $target ?: $params->get('target' . $id); 45 ?> 46 <li class="com-content-article__link content-links-<?php echo $id; ?>"> 47 <?php 48 // Compute the correct link 49 50 switch ($target) { 51 case 1: 52 // Open in a new window 53 echo '<a href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '" target="_blank" rel="nofollow noopener noreferrer">' . 54 htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . '</a>'; 55 break; 56 57 case 2: 58 // Open in a popup window 59 $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=600'; 60 echo "<a href=\"" . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . "\" onclick=\"window.open(this.href, 'targetWindow', '" . $attribs . "'); return false;\" rel=\"noopener noreferrer\">" . 61 htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . '</a>'; 62 break; 63 case 3: 64 echo '<a href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '" rel="noopener noreferrer" data-bs-toggle="modal" data-bs-target="#linkModal">' . 65 htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . ' </a>'; 66 echo HTMLHelper::_( 67 'bootstrap.renderModal', 68 'linkModal', 69 array( 70 'url' => $link, 71 'title' => $label, 72 'height' => '100%', 73 'width' => '100%', 74 'modalWidth' => '500', 75 'bodyHeight' => '500', 76 'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-hidden="true">' 77 . \Joomla\CMS\Language\Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>' 78 ) 79 ); 80 break; 81 82 default: 83 // Open in parent window 84 echo '<a href="' . htmlspecialchars($link, ENT_COMPAT, 'UTF-8') . '" rel="nofollow">' . 85 htmlspecialchars($label, ENT_COMPAT, 'UTF-8') . ' </a>'; 86 break; 87 } 88 ?> 89 </li> 90 <?php endforeach; ?> 91 </ul> 92 </div> 93 <?php endif; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |