| Current Path : /home/juvelize/martine/components/com_easybookreloaded/views/easybookreloaded/ |
| Current File : /home/juvelize/martine/components/com_easybookreloaded/views/easybookreloaded/view.feed.php |
<?php
/**
* @copyright
* @package Easybook Reloaded - EBR for Joomla! 3.x
* @author Viktor Vogel <admin@kubik-rubik.de>
* @version 3.4.1.1-FREE - 2021-08-29
* @link https://kubik-rubik.de/ebr-easybook-reloaded
*
* @license GNU/GPL
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
defined('_JEXEC') || die('Restricted access');
use EasybookReloaded\Route as EasybookReloadedRoute;
use Joomla\CMS\Document\Feed\FeedItem;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\{Factory, Router\Route, Language\Text};
/**
* Class EasybookReloadedViewEasybookReloaded
*
* @since 3.4.0-FREE
* @version 3.4.1.0-FREE
*/
class EasybookReloadedViewEasybookReloaded extends HtmlView
{
/**
* Executes and displays the feed output
*
* @param string|null $tpl
*
* @return mixed
* @throws Exception
* @since 3.4.0-FREE
* @version 3.4.1.0-FREE
*/
public function display($tpl = null)
{
$gbId = (int)$this->get('GbId');
if (!is_int($gbId)) {
return parent::display('error');
}
// Get the data from the model
$items = $this->get('Data');
$gbData = $this->get('GbData');
$app = Factory::getApplication();
$document = Factory::getDocument();
$document->link = Route::_('index.php?option=com_easybookreloaded&view=easybookreloaded&gbid=' . $gbId);
$document->setGenerator(Text::_('COM_EASYBOOKRELOADED_FEED_GENERATOR'));
Factory::getApplication()->input->set('limit', $app->get('feed_limit'));
// Get the Item ID of the menu entry
$itemId = EasybookReloadedRoute::getItemId($gbId);
foreach ($items as $item) {
if (!empty($item->gbtitle)) {
$title = html_entity_decode($this->escape($item->gbtitle . ' - ' . $item->gbname));
} else {
$title = html_entity_decode($this->escape($item->gbname));
}
// Create correct link to the entry
$limit = EasybookReloadedRoute::getLimitstart((int)$item->id, $gbId);
$linkRaw = 'index.php?option=com_easybookreloaded&view=easybookreloaded';
$linkRaw .= '&gbid=' . $gbId;
$linkRaw .= '&Itemid=' . $itemId;
if (!empty($limit)) {
$linkRaw .= '&limitstart=' . $limit;
}
$linkRaw .= '#gbentry_' . $item->id;
$link = Route::_($linkRaw);
$description = $item->gbtext;
$date = ($item->gbdate ? date('r', strtotime($item->gbdate)) : '');
// Add prepared entry to the feed
$feedItem = new FeedItem();
$feedItem->title = $title;
$feedItem->link = $link;
$feedItem->description = $description;
$feedItem->date = $date;
$feedItem->category = 'Guestbook';
// Add entry to RSS array
$document->addItem($feedItem);
}
}
}