[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_newsfeeds/tmpl/newsfeed/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_newsfeeds
   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\Factory;
  14  use Joomla\CMS\Filter\OutputFilter;
  15  use Joomla\CMS\HTML\HTMLHelper;
  16  use Joomla\CMS\Language\Text;
  17  use Joomla\CMS\Layout\FileLayout;
  18  use Joomla\CMS\Layout\LayoutHelper;
  19  
  20  ?>
  21  
  22  <?php if (!empty($this->msg)) : ?>
  23      <?php echo $this->msg; ?>
  24  <?php else : ?>
  25      <?php $lang      = Factory::getLanguage(); ?>
  26      <?php $myrtl     = $this->item->rtl; ?>
  27      <?php $direction = ' '; ?>
  28      <?php $isRtl     = $lang->isRtl(); ?>
  29      <?php if ($isRtl && $myrtl == 0) : ?>
  30          <?php $direction = ' redirect-rtl'; ?>
  31      <?php elseif ($isRtl && $myrtl == 1) : ?>
  32          <?php $direction = ' redirect-ltr'; ?>
  33      <?php elseif ($isRtl && $myrtl == 2) : ?>
  34          <?php $direction = ' redirect-rtl'; ?>
  35      <?php elseif ($myrtl == 0) : ?>
  36          <?php $direction = ' redirect-ltr'; ?>
  37      <?php elseif ($myrtl == 1) : ?>
  38          <?php $direction = ' redirect-ltr'; ?>
  39      <?php elseif ($myrtl == 2) : ?>
  40          <?php $direction = ' redirect-rtl'; ?>
  41      <?php endif; ?>
  42      <?php $images = json_decode($this->item->images); ?>
  43      <div class="com-newsfeeds-newsfeed newsfeed<?php echo $direction; ?>">
  44          <?php if ($this->params->get('display_num')) : ?>
  45          <h1 class="<?php echo $direction; ?>">
  46              <?php echo $this->escape($this->params->get('page_heading')); ?>
  47          </h1>
  48          <?php endif; ?>
  49          <h2 class="<?php echo $direction; ?>">
  50              <?php if ($this->item->published == 0) : ?>
  51                  <span class="badge bg-warning text-light"><?php echo Text::_('JUNPUBLISHED'); ?></span>
  52              <?php endif; ?>
  53              <a href="<?php echo $this->item->link; ?>" target="_blank" rel="noopener">
  54                  <?php echo str_replace('&apos;', "'", $this->item->name); ?>
  55              </a>
  56          </h2>
  57  
  58          <?php if ($this->params->get('show_tags', 1)) : ?>
  59              <?php $this->item->tagLayout = new FileLayout('joomla.content.tags'); ?>
  60              <?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
  61          <?php endif; ?>
  62  
  63          <!-- Show Images from Component -->
  64          <?php if (isset($images->image_first) && !empty($images->image_first)) : ?>
  65              <?php $imgfloat = empty($images->float_first) ? $this->params->get('float_first') : $images->float_first; ?>
  66              <div class="com-newsfeeds-newsfeed__first-image img-intro-<?php echo $this->escape($imgfloat); ?>">
  67                  <figure>
  68                      <?php echo LayoutHelper::render(
  69                          'joomla.html.image',
  70                          [
  71                              'src' => $images->image_first,
  72                              'alt' => empty($images->image_first_alt) && empty($images->image_first_alt_empty) ? false : $images->image_first_alt,
  73                          ]
  74                      ); ?>
  75                      <?php if ($images->image_first_caption) : ?>
  76                          <figcaption class="caption"><?php echo $this->escape($images->image_first_caption); ?></figcaption>
  77                      <?php endif; ?>
  78                  </figure>
  79              </div>
  80          <?php endif; ?>
  81  
  82          <?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
  83              <?php $imgfloat = empty($images->float_second) ? $this->params->get('float_second') : $images->float_second; ?>
  84              <div class="com-newsfeeds-newsfeed__second-image float-<?php echo $this->escape($imgfloat); ?> item-image">
  85                  <figure>
  86                      <?php echo LayoutHelper::render(
  87                          'joomla.html.image',
  88                          [
  89                              'src' => $images->image_second,
  90                              'alt' => empty($images->image_second_alt) && empty($images->image_second_alt_empty) ? false : $images->image_second_alt,
  91                          ]
  92                      ); ?>
  93                      <?php if ($images->image_second_caption) : ?>
  94                          <figcaption class="caption"><?php echo $this->escape($images->image_second_caption); ?></figcaption>
  95                      <?php endif; ?>
  96                  </figure>
  97              </div>
  98          <?php endif; ?>
  99          <!-- Show Description from Component -->
 100          <?php echo $this->item->description; ?>
 101          <!-- Show Feed's Description -->
 102  
 103          <?php if ($this->params->get('show_feed_description')) : ?>
 104              <div class="com-newsfeeds-newsfeed__description feed-description">
 105                  <?php echo str_replace('&apos;', "'", $this->rssDoc->description); ?>
 106              </div>
 107          <?php endif; ?>
 108  
 109          <!-- Show Image -->
 110          <?php if ($this->rssDoc->image && $this->params->get('show_feed_image')) : ?>
 111              <div class="com-newsfeeds-newsfeed__feed-image">
 112                  <?php echo LayoutHelper::render(
 113                      'joomla.html.image',
 114                      [
 115                          'src' => $this->rssDoc->image->uri,
 116                          'alt' => $this->rssDoc->image->title,
 117                      ]
 118                  ); ?>
 119              </div>
 120          <?php endif; ?>
 121  
 122          <!-- Show items -->
 123          <?php if (!empty($this->rssDoc[0])) : ?>
 124              <ol class="com-newsfeeds-newsfeed__items">
 125                  <?php for ($i = 0; $i < $this->item->numarticles; $i++) : ?>
 126                      <?php if (empty($this->rssDoc[$i])) : ?>
 127                          <?php break; ?>
 128                      <?php endif; ?>
 129                      <?php $uri  = $this->rssDoc[$i]->uri || !$this->rssDoc[$i]->isPermaLink ? trim($this->rssDoc[$i]->uri) : trim($this->rssDoc[$i]->guid); ?>
 130                      <?php $uri  = !$uri || stripos($uri, 'http') !== 0 ? $this->item->link : $uri; ?>
 131                      <?php $text = $this->rssDoc[$i]->content !== '' ? trim($this->rssDoc[$i]->content) : ''; ?>
 132                      <li>
 133                          <?php if (!empty($uri)) : ?>
 134                              <h3 class="feed-link">
 135                                  <a href="<?php echo htmlspecialchars($uri); ?>" target="_blank" rel="noopener">
 136                                      <?php echo trim($this->rssDoc[$i]->title); ?>
 137                                  </a>
 138                              </h3>
 139                          <?php else : ?>
 140                              <h3 class="feed-link"><?php echo trim($this->rssDoc[$i]->title); ?></h3>
 141                          <?php endif; ?>
 142  
 143                          <?php if ($this->params->get('show_item_description') && $text !== '') : ?>
 144                              <div class="feed-item-description">
 145                                  <?php if ($this->params->get('show_feed_image', 0) == 0) : ?>
 146                                      <?php $text = OutputFilter::stripImages($text); ?>
 147                                  <?php endif; ?>
 148                                  <?php $text = HTMLHelper::_('string.truncate', $text, $this->params->get('feed_character_count')); ?>
 149                                  <?php echo str_replace('&apos;', "'", $text); ?>
 150                              </div>
 151                          <?php endif; ?>
 152                      </li>
 153                  <?php endfor; ?>
 154              </ol>
 155          <?php endif; ?>
 156      </div>
 157  <?php endif; ?>


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