コード例 #1
0
 /**
  * Send header and the generated feed on the standard output.
  *
  * @param string $title
  *        	the feed title
  * @param string $description
  *        	optional, a feed description
  * @param string $url
  *        	the url where the feed is published
  */
 public function outputFeed($title, $description, $url)
 {
     $parser = $this->parserFactory->createFromWebPage();
     $feed = new RSSFeedGenerator($title, $description, $this->parserFactory->getAlboPretorioLandingPage(), $url);
     foreach ($parser as $e) {
         $item = $this->converter->getRSSItem($e);
         if (strlen($item->errors)) {
             $feed->addComment($item->errors);
         } else {
             $feed->addItemObject($item);
         }
     }
     // output
     header('Content-type: application/rss+xml; charset=UTF-8');
     /*
      * Impostazioni locali in italiano, utilizzato per la stampa di data e ora
      * (il server deve avere il locale italiano installato
      */
     setlocale(LC_TIME, 'it_IT');
     AccessLogUtils::logAccess();
     echo $feed->getFeed();
 }
コード例 #2
0
ファイル: sharer.php プロジェクト: aborruso/albo-pop
 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require "AlboUnictParserFactory.php";
require "../phpalbogenerator/AccessLogUtils.php";
define("RSSPATH", "http://dev.opendatasicilia.it/albopop/catania/");
AccessLogUtils::logAccess("accessNotices.log");
$number = $_GET['number'];
if (!isset($number)) {
    die("E' necessario specificare un numero di avviso.");
}
$entry = (new AlboUnictParserFactory())->createFromWebPage()->getByNumber($number);
if ($entry == null) {
    die("Nessun elemento con numero {$number}");
}
$css = "../RSS/sharer.css";
$ente = "Universit&agrave; di Catania";
$title = "Albo POP Universit&agrave; di Catania - Avviso {$number}";
$logo = "logo.png";
$description = $entry->richiedente . ": " . $entry->description;
$link = $entry->link;
$news = null;
コード例 #3
0
 * (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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require "AlboComuneCTParser.php";
require "../RSS/RSSFeedGenerator.php";
require "../RSS/RSSFeedItem.php";
require "../phpalbogenerator/AccessLogUtils.php";
define("RSSPATH", "http://dev.opendatasicilia.it/albopop/catania/");
AccessLogUtils::logAccess();
$parser = AlboComuneCTParser::createByYear();
$feed = new RSSFeedGenerator("Albo del Comune di Catania", "Versione POP e social dell'Albo Pretorio del Comune di Catania", "http://www.comune.catania.gov.it/EtnaInWeb/AlboPretorio.nsf/HomePage?Open&buffer=A20110301121017437GH", RSSPATH . "alboct2RSS-social.php");
foreach ($parser as $r) {
    //remove the sender if it is internal to the municipality of Catania
    $title = preg_replace('%^.*- COMUNE DI CATANIA *%', '', $r->mittente_descrizione, 1);
    if (empty($title)) {
        $feed->addItem('ERROR', null, null, $r->link, $r->link);
    } else {
        $description = $r->repertorio . " - " . $r->tipo . ": " . $r->mittente_descrizione;
        $newpagelink = RSSPATH . 'sharer.php?anno=' . urlencode($r->anno) . "&numero=" . urlencode($r->numero);
        $feed->addItem($title, $description, null, $newpagelink, $newpagelink);
    }
}
//output
header('Content-type: application/rss+xml; charset=UTF-8');