[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/modules/mod_feed/tmpl/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_feed
   6   *
   7   * @copyright   (C) 2006 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\Filter\OutputFilter;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Text;
  16  
  17  // Check if feed URL has been set
  18  if (empty($rssurl)) {
  19      echo '<div>' . Text::_('MOD_FEED_ERR_NO_URL') . '</div>';
  20  
  21      return;
  22  }
  23  
  24  if (!empty($feed) && is_string($feed)) {
  25      echo $feed;
  26  } else {
  27      $lang      = $app->getLanguage();
  28      $myrtl     = $params->get('rssrtl', 0);
  29      $direction = ' ';
  30  
  31      $isRtl = $lang->isRtl();
  32  
  33      if ($isRtl && $myrtl == 0) {
  34          $direction = ' redirect-rtl';
  35      } elseif ($isRtl && $myrtl == 1) {
  36          // Feed description
  37          $direction = ' redirect-ltr';
  38      } elseif ($isRtl && $myrtl == 2) {
  39          $direction = ' redirect-rtl';
  40      } elseif ($myrtl == 0) {
  41          $direction = ' redirect-ltr';
  42      } elseif ($myrtl == 1) {
  43          $direction = ' redirect-ltr';
  44      } elseif ($myrtl == 2) {
  45          $direction = ' redirect-rtl';
  46      }
  47  
  48      if ($feed !== false) {
  49          ?>
  50          <div style="direction: <?php echo $rssrtl ? 'rtl' : 'ltr'; ?>;" class="text-<?php echo $rssrtl ? 'right' : 'left'; ?> feed">
  51          <?php
  52          // Feed title
  53          if ($feed->title !== null && $params->get('rsstitle', 1)) {
  54              ?>
  55                  <h2 class="<?php echo $direction; ?>">
  56                      <a href="<?php echo htmlspecialchars($rssurl, ENT_COMPAT, 'UTF-8'); ?>" target="_blank" rel="noopener">
  57                      <?php echo $feed->title; ?></a>
  58                  </h2>
  59              <?php
  60          }
  61          // Feed date
  62          if ($params->get('rssdate', 1)) : ?>
  63              <h3>
  64              <?php echo HTMLHelper::_('date', $feed->publishedDate, Text::_('DATE_FORMAT_LC3')); ?>
  65              </h3>
  66          <?php endif;
  67          // Feed description
  68          if ($params->get('rssdesc', 1)) {
  69              ?>
  70              <?php echo $feed->description; ?>
  71              <?php
  72          }
  73          // Feed image
  74          if ($feed->image && $params->get('rssimage', 1)) :
  75              ?>
  76              <?php echo HTMLHelper::_('image', $feed->image->uri, $feed->image->title); ?>
  77          <?php endif; ?>
  78  
  79  
  80      <!-- Show items -->
  81          <?php if (!empty($feed)) { ?>
  82          <ul class="newsfeed">
  83              <?php for ($i = 0, $max = min(count($feed), $params->get('rssitems', 3)); $i < $max; $i++) { ?>
  84                  <?php
  85                  $uri  = $feed[$i]->uri || !$feed[$i]->isPermaLink ? trim($feed[$i]->uri) : trim($feed[$i]->guid);
  86                  $uri  = !$uri || stripos($uri, 'http') !== 0 ? $rssurl : $uri;
  87                  $text = $feed[$i]->content !== '' ? trim($feed[$i]->content) : '';
  88                  ?>
  89                  <li>
  90                      <?php if (!empty($uri)) : ?>
  91                          <span class="feed-link">
  92                          <a href="<?php echo htmlspecialchars($uri, ENT_COMPAT, 'UTF-8'); ?>" target="_blank" rel="noopener">
  93                          <?php echo trim($feed[$i]->title); ?></a></span>
  94                      <?php else : ?>
  95                          <span class="feed-link"><?php echo trim($feed[$i]->title); ?></span>
  96                      <?php endif; ?>
  97  
  98                      <?php if ($params->get('rssitemdate', 0)) : ?>
  99                          <div class="feed-item-date">
 100                              <?php echo HTMLHelper::_('date', $feed[$i]->publishedDate, Text::_('DATE_FORMAT_LC3')); ?>
 101                          </div>
 102                      <?php endif; ?>
 103  
 104                      <?php if ($params->get('rssitemdesc', 1) && $text !== '') : ?>
 105                          <div class="feed-item-description">
 106                          <?php
 107                              // Strip the images.
 108                              $text = OutputFilter::stripImages($text);
 109                              $text = HTMLHelper::_('string.truncate', $text, $params->get('word_count', 0));
 110                              echo str_replace('&apos;', "'", $text);
 111                          ?>
 112                          </div>
 113                      <?php endif; ?>
 114                  </li>
 115              <?php } ?>
 116          </ul>
 117          <?php } ?>
 118      </div>
 119      <?php }
 120  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer