芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/dzilamdebravo1821.gob.mx/libraries/src/Document/Renderer/Feed/AtomRenderer.php
* @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Document\Renderer\Feed; \defined('JPATH_PLATFORM') or die; use Joomla\CMS\Document\DocumentRenderer; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Router\Route; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Version; /** * AtomRenderer is a feed that implements the atom specification * * Please note that just by using this class you won't automatically * produce valid atom files. For example, you have to specify either an editor * for the feed or an author for every single feed item. * * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php * @since 3.5 * * @property-read \Joomla\CMS\Document\FeedDocument $_doc Reference to the Document object that instantiated the renderer */ class AtomRenderer extends DocumentRenderer { /** * Document mime type * * @var string * @since 3.5 */ protected $_mime = 'application/atom+xml'; /** * Render the feed. * * @param string $name The name of the element to render * @param array $params Array of values * @param string $content Override the output of the renderer * * @return string The output of the script * * @see DocumentRenderer::render() * @since 3.5 */ public function render($name = '', $params = null, $content = null) { $app = Factory::getApplication(); // Gets and sets timezone offset from site configuration $tz = new \DateTimeZone($app->get('offset')); $now = Factory::getDate(); $now->setTimezone($tz); $data = $this->_doc; $url = Uri::getInstance()->toString(array('scheme', 'user', 'pass', 'host', 'port')); $syndicationURL = Route::_('&format=feed&type=atom'); $title = $data->getTitle(); if ($app->get('sitename_pagetitles', 0) == 1) { $title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $data->getTitle()); } elseif ($app->get('sitename_pagetitles', 0) == 2) { $title = Text::sprintf('JPAGETITLE', $data->getTitle(), $app->get('sitename')); } $feed_title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8'); $feed = "
getLanguage() != '') { $feed .= " xml:lang=\"" . $data->getLanguage() . "\""; } $feed .= ">\n"; $feed .= "
" . $feed_title . "
\n"; $feed .= "
" . htmlspecialchars($data->getDescription(), ENT_COMPAT, 'UTF-8') . "
\n"; if (!empty($data->category)) { if (\is_array($data->category)) { foreach ($data->category as $cat) { $feed .= "
\n"; } } else { $feed .= "
category, ENT_COMPAT, 'UTF-8') . "\" />\n"; } } $feed .= "
\n"; $feed .= "
" . str_replace(' ', '%20', $data->getBase()) . "
\n"; $feed .= "
" . htmlspecialchars($now->toISO8601(true), ENT_COMPAT, 'UTF-8') . "
\n"; if ($data->editor != '') { $feed .= "
\n"; $feed .= "
" . $data->editor . "
\n"; if ($data->editorEmail != '') { $feed .= "
" . htmlspecialchars($data->editorEmail, ENT_COMPAT, 'UTF-8') . "
\n"; } $feed .= "
\n"; } $versionHtmlEscaped = ''; if ($app->get('MetaVersion', 0)) { $minorVersion = Version::MAJOR_VERSION . '.' . Version::MINOR_VERSION; $versionHtmlEscaped = ' version="' . htmlspecialchars($minorVersion, ENT_COMPAT, 'UTF-8') . '"'; } $feed .= "
" . $data->getGenerator() . "
\n"; $feed .= "
\n"; for ($i = 0, $count = \count($data->items); $i < $count; $i++) { $itemlink = $data->items[$i]->link; if (preg_match('/[\x80-\xFF]/', $itemlink)) { $itemlink = implode('/', array_map('rawurlencode', explode('/', $itemlink))); } $feed .= "
\n"; $feed .= "
" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "
\n"; $feed .= "
\n"; if ($data->items[$i]->date == '') { $data->items[$i]->date = $now->toUnix(); } $itemDate = Factory::getDate($data->items[$i]->date); $itemDate->setTimezone($tz); $feed .= "
" . htmlspecialchars($itemDate->toISO8601(true), ENT_COMPAT, 'UTF-8') . "
\n"; $feed .= "
" . htmlspecialchars($itemDate->toISO8601(true), ENT_COMPAT, 'UTF-8') . "
\n"; if (empty($data->items[$i]->guid)) { $itemGuid = str_replace(' ', '%20', $url . $itemlink); } else { $itemGuid = htmlspecialchars($data->items[$i]->guid, ENT_COMPAT, 'UTF-8'); } $feed .= "
" . $itemGuid . "
\n"; if ($data->items[$i]->author != '') { $feed .= "
\n"; $feed .= "
" . htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8') . "
\n"; if (!empty($data->items[$i]->authorEmail)) { $feed .= "
" . htmlspecialchars($data->items[$i]->authorEmail, ENT_COMPAT, 'UTF-8') . "
\n"; } $feed .= "
\n"; } if (!empty($data->items[$i]->description)) { $feed .= "
" . htmlspecialchars($this->_relToAbs($data->items[$i]->description), ENT_COMPAT, 'UTF-8') . "
\n"; $feed .= "
" . htmlspecialchars($this->_relToAbs($data->items[$i]->description), ENT_COMPAT, 'UTF-8') . "
\n"; } if (!empty($data->items[$i]->category)) { if (\is_array($data->items[$i]->category)) { foreach ($data->items[$i]->category as $cat) { $feed .= "
\n"; } } else { $feed .= "
items[$i]->category, ENT_COMPAT, 'UTF-8') . "\" />\n"; } } if ($data->items[$i]->enclosure != null) { $feed .= "
items[$i]->enclosure->url . "\" type=\"" . $data->items[$i]->enclosure->type . "\" length=\"" . $data->items[$i]->enclosure->length . "\">\n"; } $feed .= "
\n"; } $feed .= "
\n"; return $feed; } }