Source for file rss.php
Documentation is available at rss.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | MCMS: a PHP Content Management System for creating accessible sites. |
// | Copyright (C) 2005 Silvio Moioli |
// | 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 2 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, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
// +----------------------------------------------------------------------+
// | Authors: Silvio Moioli <silvio at moioli dot net> www.moioli.net |
// +----------------------------------------------------------------------+
* Classe per l'aggiunta di un feed RSS 2 al sito.
* @author Silvio Moioli <silvio at moioli dot net>
/** Carica la classe base di MCMS per l'interfacciamento al Database */
require_once $_SERVER["DOCUMENT_ROOT"]. "/admin/lib/model/Engine.php";
* Classe per l'aggiunta di un feed RSS 2 al sito.
* @author Silvio Moioli <silvio at moioli dot net>
* Scritto solo per la concatenazione dei costruttori.
* Ritorna il nome di questo componente.
* @return string il nome del componente
* Questo componente non ha bisogno di inizializzazione,
* perciņ questo metodo č vuoto.
* @param Engine $engine il motore di MCMS
* Aggiunge la voce di menu per la mappa del sito (a tutte le
* @param string $contents i contenuti della pagina da modificare
* @param array $menuEntries il menu della pagina
* @param string $title il titolo della pagina da modificare
* @param Site $site il sito corrente
$siteID = $site->getID();
$menuEntries [] = "<p><a type=\"application/rss+xml\"".
" href=\"/feed.rss\">Feed RSS</a> per restare sempre aggiornato!</p>";
* Salva il feed RSS 2.0 del sito
* @param Site $site il sito corrente
* @param Compiler $compiler l'oggetto per il salvataggio dei file
$siteName = $site->getURL();
$result = "<?xml version=\"1.0\" encoding='ISO-8859-1'?>
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
xmlns=\"http://purl.org/rss/1.0/\"
xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
<channel rdf:about=\"http://www.moioli.net/feed.rss\">
<title>moioli.net</title>
<description>Sito di Silvio Moioli</description>
<rdf:li resource=\"$siteName/?1#notizia1\"/>
<rdf:li resource=\"$siteName/?2#notizia2\"/>
<rdf:li resource=\"$siteName/?3#notizia3\"/>
<rdf:li resource=\"$siteName/?4#notizia4\"/>
<rdf:li resource=\"$siteName/?5#notizia5\"/>
$news = $site->getNews();
//Massimo 5 notizie sul feed
$result .= "<item rdf:about=\"$siteName/?$newscount#$newscount\">
<title>$newsTitle</title>
<link>$siteName/?$newscount#$newscount</link>
<description>$content</description>
$compiler->fileSave("feed.rss", $result, false);
|