Hugo 'Emacs' HAMON - webmaster@apprendre-php.com - http://www.apprendre-php.com
The RSSFeed was built to power valid and complete RSS 2.0 feeds for your website. Generated feeds can be as minimal as possible or very complete. Indeed, every RSS 2.0 tag is supported in this classes package.
The biggest pros of this package is to create RSS 2.0 feeds very easily without to write one XML code line. The programm does it for you !
The RSSFeed library needs to run on a PHP5 web server because it uses the PHP5 Object Model.
The RSSFeed package source is completely open. You can edit, improve or sell it with your web applications.
Unzip the RSSFeed package on your web server.
Include the RSSFeed.class.php file in your script like this :
Generate your RSS 2.0 feed like example scripts.
Let's see more in details the five classes, which compose this package.
This class provides RSS Feed Exceptions (errors). It herits the native PHP Exception class properties.
The abstract RSSFeedTools class contains a serie of static methods which allow to validate some information for the feed.
The RSSFeedBase script is an abstract class which contains properties and methods that are shared by the two RSSFeed and RSSFeedItem classes. Indeed, both of the feed or item can have a title, description, link, pubDate element and one or more category elements. That's why theses properties are placed in this superclass.
The RSSFeed file is the main class of the package. It's a concrete class which allows to instanciate a new RSSFeed object. It herits the properties and methods of the RSSFeedBase abstract superclass. Below are listed the public methods that you can apply on the RSSFeed object.
See a method documentation :
This is the constructor of the class. It allows to create the new RSSFeed object.
(string) $encoding : the feed encoding.
This method allows to set the protect string policy. If the $protectString parameter is set to true, all feed information will be protected. Special characters will be transformed into their html entity equivalent.
(boolean) $protectString : false by default, true to enable the string protection.
Set the feed title.
(string) $title : the feed title.
Set the feed description.
(string) $description : the feed description.
Set the feed link.
(string) $link : the feed URI link.
Set a new feed category. Note that a feed can have 0 or more categories elements.
(string) $domain : the category URI.
(string) $content : the category content.
Set the feed image.
(string) $url : the image URI.
(string) $title : the image caption.
(string) $link : the image link. Note that it's recommanded to provide the same string that the feed link.
(string) $description : the image description.
(int) $width : the image width : 0px < $width < 144px
(int) $height : the image height : 0px < $height < 400px
Set the feed last build date.
(string) $lastBuildDate : the last build date. Attempt formats : AAAA-MM-DD or AAAA-MM-DD HH:II:SS.
Set the feed publication date.
(string) $setPubDate : the feed publication date. Attempt formats : AAAA-MM-DD or AAAA-MM-DD HH:II:SS.
Set the feed time to live. This is the time (in seconds) during the feed is stored in client cache.
(int) $ttl : the feed time to live.
Set the managing editor of the feed.
(string) $email : the manager email.
(string) $name : the manager name.
Set the website webmaster.
(string) $email : the webmaster email.
(string) $name : the webmaster name.
Set the feed copyright.
(string) $copyright : the feed copyright.
Set the feed rating.
(string) $rating : the feed rating.
Set the feed generator.
(string) $generator : the feed generator.
Set the feed language.
(string) $language : the feed language with 2 characters.
Set the feed documentation.
(string) $docs : the feed documentation.
Set a new skip day. A skip day indicates a day when the feed hasn't to be refreshed. A feed can have more than one skip day. Note that if you provide the seven week days, your RSS 2.0 feed won't be refreshed anymore.
(string) $day : the skip day. Attempt values : Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
Set a new skip hour. A skip hour indicates a time when the feed hasn't to be refreshed in a day. A feed can have more than one skip hour.
(int) $hour : the skip hour. Attempt values : from 0 to 23.
Set the feed cloud.
(string) $domain : the host domain name of the server to register.
(int) $port : port tu use.
(string) $path : path of the script on the web server.
(string) $registerProcedure : name of the register procedure.
(string) $protocol : the protocol : xml-rpc or soap.
Add a new RSSFeedItem object to the feed.
(RSSFeedItem) $item : the item object.
Display the generated feed.
No parameter for this method.
Regenerate the feed.
No parameter for this method.
Save the feed in a XML file on the web server.
(string) $xmlFileName : the xml file name.
The RSSFeedItem file is the second important class of the package. It's a concrete class which allows to instanciate a new RSSFeedItem object. It herits the properties and methods of the RSSFeedBase abstract superclass. Below are listed the public methods that you can apply on the RSSFeedItem object.
See a method documentation :
This is the constructor of the class. It allows to create the new RSSFeedItem object.
No parameter for this method.
Set the item title.
(string) $title : the item title.
Set the item description.
(string) $description : the item description.
Set the item link.
(string) $link : the item URI link.
Set a new item category. Note that an item can have 0 or more categories elements.
(string) $domain : the category URI.
(string) $content : the category content.
Set the item publication date.
(string) $setPubDate : the item publication date. Attempt formats : AAAA-MM-DD or AAAA-MM-DD HH:II:SS.
Set the item author.
(string) $email : the author email.
(string) $name : the author name.
Set the item comments URI of a post.
(string) $comments : the comments URI.
Set the item enclosure element.
(string) $url : the media URI.
(int) $length : the length in bytes of the media.
(string) $mimeType : the media mimeType.
Set the unique item guid element.
(string) $url : the guid link.
(boolean) $isPermaLink : specify if the link is permanent or not
Set the item source element.
(string) $url : the source link.
(string) $content : ths source name link
See the scripts in the RSSFeed/examples/ directory.