Dodany przez: mrmarkos, 22:24 29-06-2012

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

Źródło:

Ostatnie wpisy

Linki

Funkcje