Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JDocumentRendererRSS
+ Graphe d'héritage de JDocumentRendererRSS:
+ Graphe de collaboration de JDocumentRendererRSS:

Liste de tous les membres

Fonctions membres publiques

 render ($name= '', $params=null, $content=null)
 _relToAbs ($text)
- Fonctions membres publiques inherited from JDocumentRenderer
 __construct (JDocument $doc)
 getContentType ()

Attributs protégés

 $_mime = "application/rss+xml"
- Attributs protégés inherited from JDocumentRenderer
 $_doc = null

Description détaillée

Définition à la ligne 20 du fichier rss.php.


Documentation des fonctions membres

JDocumentRendererRSS::_relToAbs (   $text)

Convert links in a text from relative to absolute

Paramètres:
string$textThe text processed
Renvoie:
string Text with converted links
Depuis:
11.1

Définition à la ligne 244 du fichier rss.php.

Références JUri\base().

{
$base = JUri::base();
$text = preg_replace("/(href|src)=\"(?!http|ftp|https|mailto|data)([^\"]*)\"/", "$1=\"$base\$2\"", $text);
return $text;
}

+ Voici le graphe d'appel pour cette fonction :

JDocumentRendererRSS::render (   $name = '',
  $params = null,
  $content = null 
)

Render the feed.

Paramètres:
string$nameThe name of the element to render
array$paramsArray of values
string$contentOverride the output of the renderer
Renvoie:
string The output of the script
Voir également:
JDocumentRenderer::render()
Depuis:
11.1

Réimplémentée à partir de JDocumentRenderer.

Définition à la ligne 42 du fichier rss.php.

Références JRoute\_(), JFactory\getApplication(), JFactory\getDate(), JUri\getInstance(), et JText\sprintf().

{
// Gets and sets timezone offset from site configuration
$tz = new DateTimeZone($app->getCfg('offset'));
$now->setTimeZone($tz);
$data = $this->_doc;
$url = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$syndicationURL = JRoute::_('&format=feed&type=rss');
if ($app->getCfg('sitename_pagetitles', 0) == 1)
{
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $data->title);
}
elseif ($app->getCfg('sitename_pagetitles', 0) == 2)
{
$title = JText::sprintf('JPAGETITLE', $data->title, $app->getCfg('sitename'));
}
else
{
$title = $data->title;
}
$feed_title = htmlspecialchars($title, ENT_COMPAT, 'UTF-8');
$feed = "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
$feed .= " <channel>\n";
$feed .= " <title>" . $feed_title . "</title>\n";
$feed .= " <description><![CDATA[" . $data->description . "]]></description>\n";
$feed .= " <link>" . str_replace(' ', '%20', $url . $data->link) . "</link>\n";
$feed .= " <lastBuildDate>" . htmlspecialchars($now->toRFC822(true), ENT_COMPAT, 'UTF-8') . "</lastBuildDate>\n";
$feed .= " <generator>" . $data->getGenerator() . "</generator>\n";
$feed .= ' <atom:link rel="self" type="application/rss+xml" href="' . str_replace(' ', '%20', $url . $syndicationURL) . "\"/>\n";
if ($data->image != null)
{
$feed .= " <image>\n";
$feed .= " <url>" . $data->image->url . "</url>\n";
$feed .= " <title>" . htmlspecialchars($data->image->title, ENT_COMPAT, 'UTF-8') . "</title>\n";
$feed .= " <link>" . str_replace(' ', '%20', $data->image->link) . "</link>\n";
if ($data->image->width != "")
{
$feed .= " <width>" . $data->image->width . "</width>\n";
}
if ($data->image->height != "")
{
$feed .= " <height>" . $data->image->height . "</height>\n";
}
if ($data->image->description != "")
{
$feed .= " <description><![CDATA[" . $data->image->description . "]]></description>\n";
}
$feed .= " </image>\n";
}
if ($data->language != "")
{
$feed .= " <language>" . $data->language . "</language>\n";
}
if ($data->copyright != "")
{
$feed .= " <copyright>" . htmlspecialchars($data->copyright, ENT_COMPAT, 'UTF-8') . "</copyright>\n";
}
if ($data->editorEmail != "")
{
$feed .= " <managingEditor>" . htmlspecialchars($data->editorEmail, ENT_COMPAT, 'UTF-8') . ' ('
. htmlspecialchars($data->editor, ENT_COMPAT, 'UTF-8') . ")</managingEditor>\n";
}
if ($data->webmaster != "")
{
$feed .= " <webMaster>" . htmlspecialchars($data->webmaster, ENT_COMPAT, 'UTF-8') . "</webMaster>\n";
}
if ($data->pubDate != "")
{
$pubDate = JFactory::getDate($data->pubDate);
$pubDate->setTimeZone($tz);
$feed .= " <pubDate>" . htmlspecialchars($pubDate->toRFC822(true), ENT_COMPAT, 'UTF-8') . "</pubDate>\n";
}
if (empty($data->category) === false)
{
if (is_array($data->category))
{
foreach ($data->category as $cat)
{
$feed .= " <category>" . htmlspecialchars($cat, ENT_COMPAT, 'UTF-8') . "</category>\n";
}
}
else
{
$feed .= " <category>" . htmlspecialchars($data->category, ENT_COMPAT, 'UTF-8') . "</category>\n";
}
}
if ($data->docs != "")
{
$feed .= " <docs>" . htmlspecialchars($data->docs, ENT_COMPAT, 'UTF-8') . "</docs>\n";
}
if ($data->ttl != "")
{
$feed .= " <ttl>" . htmlspecialchars($data->ttl, ENT_COMPAT, 'UTF-8') . "</ttl>\n";
}
if ($data->rating != "")
{
$feed .= " <rating>" . htmlspecialchars($data->rating, ENT_COMPAT, 'UTF-8') . "</rating>\n";
}
if ($data->skipHours != "")
{
$feed .= " <skipHours>" . htmlspecialchars($data->skipHours, ENT_COMPAT, 'UTF-8') . "</skipHours>\n";
}
if ($data->skipDays != "")
{
$feed .= " <skipDays>" . htmlspecialchars($data->skipDays, ENT_COMPAT, 'UTF-8') . "</skipDays>\n";
}
for ($i = 0, $count = count($data->items); $i < $count; $i++)
{
if ((strpos($data->items[$i]->link, 'http://') === false) && (strpos($data->items[$i]->link, 'https://') === false))
{
$data->items[$i]->link = str_replace(' ', '%20', $url . $data->items[$i]->link);
}
$feed .= " <item>\n";
$feed .= " <title>" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "</title>\n";
$feed .= " <link>" . str_replace(' ', '%20', $data->items[$i]->link) . "</link>\n";
if (empty($data->items[$i]->guid) === true)
{
$feed .= " <guid isPermaLink=\"true\">" . str_replace(' ', '%20', $data->items[$i]->link) . "</guid>\n";
}
else
{
$feed .= " <guid isPermaLink=\"false\">" . htmlspecialchars($data->items[$i]->guid, ENT_COMPAT, 'UTF-8') . "</guid>\n";
}
$feed .= " <description><![CDATA[" . $this->_relToAbs($data->items[$i]->description) . "]]></description>\n";
if ($data->items[$i]->authorEmail != "")
{
$feed .= " <author>"
. htmlspecialchars($data->items[$i]->authorEmail . ' (' . $data->items[$i]->author . ')', ENT_COMPAT, 'UTF-8') . "</author>\n";
}
/*
* @todo: On hold
* if ($data->items[$i]->source!="") {
* $data.= " <source>".htmlspecialchars($data->items[$i]->source, ENT_COMPAT, 'UTF-8')."</source>\n";
* }
*/
if (empty($data->items[$i]->category) === false)
{
if (is_array($data->items[$i]->category))
{
foreach ($data->items[$i]->category as $cat)
{
$feed .= " <category>" . htmlspecialchars($cat, ENT_COMPAT, 'UTF-8') . "</category>\n";
}
}
else
{
$feed .= " <category>" . htmlspecialchars($data->items[$i]->category, ENT_COMPAT, 'UTF-8') . "</category>\n";
}
}
if ($data->items[$i]->comments != "")
{
$feed .= " <comments>" . htmlspecialchars($data->items[$i]->comments, ENT_COMPAT, 'UTF-8') . "</comments>\n";
}
if ($data->items[$i]->date != "")
{
$itemDate = JFactory::getDate($data->items[$i]->date);
$itemDate->setTimeZone($tz);
$feed .= " <pubDate>" . htmlspecialchars($itemDate->toRFC822(true), ENT_COMPAT, 'UTF-8') . "</pubDate>\n";
}
if ($data->items[$i]->enclosure != null)
{
$feed .= " <enclosure url=\"";
$feed .= $data->items[$i]->enclosure->url;
$feed .= "\" length=\"";
$feed .= $data->items[$i]->enclosure->length;
$feed .= "\" type=\"";
$feed .= $data->items[$i]->enclosure->type;
$feed .= "\"/>\n";
}
$feed .= " </item>\n";
}
$feed .= " </channel>\n";
$feed .= "</rss>\n";
return $feed;
}

+ Voici le graphe d'appel pour cette fonction :


Documentation des données membres

JDocumentRendererRSS::$_mime = "application/rss+xml"
protected

Réimplémentée à partir de JDocumentRenderer.

Définition à la ligne 28 du fichier rss.php.


La documentation de cette classe a été générée à partir du fichier suivant :