Thread: [Openfirst-cvscommit] news/rss class.RSSBuilder.inc.php,NONE,1.1 rss.php,NONE,1.1
Brought to you by:
xtimg
From: <dav...@us...> - 2003-09-28 15:34:06
|
Update of /cvsroot/openfirst/news/rss In directory sc8-pr-cvs1:/tmp/cvs-serv30680 Added Files: class.RSSBuilder.inc.php rss.php Log Message: RSS Class and the RSS viewer. --- NEW FILE: class.RSSBuilder.inc.php --- <?php /* vim: set expandtab tabstop=4 shiftwidth=4: */ //+----------------------------------------------------------------------+ //| WAMP (XP-SP1/1.3.27/4.0.12/4.3.2) | //+----------------------------------------------------------------------+ //| Copyright (c) 1992-2003 Michael Wimmer | //+----------------------------------------------------------------------+ //| I don't have the time to read through all the licences to find out | //| what the exactly say. But it's simple. It's free for non commercial | //| projects, but as soon as you make money with it, i want my share :-) | //| (License : Free for non-commercial use) | //+----------------------------------------------------------------------+ //| Authors: Michael Wimmer <fl...@gm...> | //+----------------------------------------------------------------------+ // // $Id: class.RSSBuilder.inc.php,v 1.1 2003/09/28 15:33:53 daviddibiase Exp $ /** * @package RSSBuilder [...1700 lines suppressed...] * @since 1.001 - 2003-05-30 */ function getComments() { return (string) $this->comments; } // end function /** * Returns $image variable * * @desc Returns $image variable * @return string $image * @see $image * @since 1.002 - 2003-06-26 */ function getImage() { return (string) $this->image; } // end function /**#@-*/ } // end class RSSItem ?> --- NEW FILE: rss.php --- <?php /* * openFIRST.news - rss/rss.php * * Copyright (C) 2003, * openFIRST Project * Original Author: David Di Biase <dav...@ea...> * * 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. * 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 USA * */ include("../../config/globals.php"); ob_start(); session_start(); // Include system RSSBuilder Class include("class.RSSBuilder.inc.php"); // Create the object - remember, not all attibutes are supported // by every rss version. just hand over an empty string if you // don't need a specific attribute $encoding =(string) 'ISO-8859-1'; $about = (string) $home; $title = (string) $title." News"; $description = (string) 'This is the '.$title.' News RSS Feed'; $image_link = (string) ''; $category = (string) ''; // (only rss 2.0) $cache = (string) 60; // in minutes (only rss 2.0) $rssfile = new RSSBuilder($encoding, $about, $title, $description, $image_link, $category, $cache); // If you want you can add additional Public Core data to the basic rss file // (if rss version supports it) $publisher = (string) $title; // person, an organization, or a service $creator = (string) ''; // person, an organization, or a service $date = (string) date('Y-m-d\TH:i:sO'); $language = (string) 'en'; $rights = (string) 'Copyright © 2003 '.$title.' ('.$home.')'; $coverage = (string) ''; // spatial location , temporal period or jurisdiction $contributor = (string) ''; // person, an organization, or a service $rssfile->addDCdata($publisher, $creator, $date, $language, $rights, $coverage, $contributor); // If you want you can add additional Syndication data to the basic // rss file (if rss version supports it) $period = (string) 'daily'; // hourly / daily / weekly / ... $frequency = (int) 5; // every X hours/days/... $base = (string) date('Y-m-d\TH:i:sO'); $rssfile->addSYdata($period, $frequency, $base); // Data for a single RSS item $query = ofirst_dbquery("SELECT * FROM ofirst_news LIMIT 0,5"); while($news = ofirst_dbfetch_object($query)){ $about = $link = $home.$base.'/news/readnews.php?ID='.$news->ID; $title = (string) $news->title; $description = (string) $news->news; $subject = (string) ''; // optional DC value $date = (string) date('Y-m-d\TH:i:sO'); // optional DC value $author = (string) $news->poster; // author of item $comments = (string) ''; // url to comment page rss 2.0 value $image = (string) $home.$base.'/news/images/'.$news->image; // optional mod_im value for dispaying a different pic for every item $rssfile->addItem($about, $title, $link, $description, $subject, $date, $author, $comments, $image); } // If you don't want to directly output the content, but instead work with the string (for example write it to a cache file) use // $rssfile->getRSSOutput($version); $version = $_GET['rss']; $rssfile->outputRSS($version); ob_end_flush(); ?> |