CWIS Developer Documentation
|
Implements an RSS client for fetching, parsing, and caching RSS feeds. More...
Public Member Functions | |
RSSClient ($ServerUrl, $CacheDB=NULL, $RefreshTime=600, $Encoding="UTF-8", $DebugLevel=0) | |
Object constructor. More... | |
ServerUrl ($NewValue=NULL) | |
Get or set the RSS feed URL. More... | |
Encoding ($NewValue=NULL) | |
Get or set the character encoding of the RSS feed. More... | |
AutodetectEncoding () | |
Try to automatically detect and set the encoding of the RSS feed. More... | |
GetItems ($NumberOfItems=NULL, $ChannelName=NULL) | |
Retrieve the RSS items from the RSS feed. More... | |
GetChannelTitle () | |
Retrieve the channel title as given in the RSS feed. More... | |
GetChannelLink () | |
Retrive the URL to the site of the channel in the RSS feed. More... | |
GetChannelDescription () | |
Get the description of the channel as given in the RSS feed. More... | |
UsedCachedData () | |
Determine whether the RSS client is using cached data. More... | |
SetDebugLevel ($NewLevel) | |
Set the current level of verbosity for debug output. More... | |
GetXmlInfo ($Url) | |
Get the XML text at the given URL, along with the type and character encoding of the text. More... | |
QueryServerWithCaching ($ServerUrl, $CacheDB, $RefreshTime) | |
Load the XML of an RSS feed from the cache, if available, or from the server. More... | |
LoadChannelInfo () | |
Load information from the current RSS channel. More... | |
Public Attributes | |
$CacheDB | |
$RefreshTime | |
$ServerUrl | |
$MetadataPrefix | |
$SetSpec | |
$DebugLevel | |
$Encoding | |
$XmlText | |
$Parser | |
$ChannelTitle | |
$ChannelLink | |
$ChannelDescription | |
$CachedDataWasUsed | |
Implements an RSS client for fetching, parsing, and caching RSS feeds.
Definition at line 13 of file RSSClient.php.
RSSClient::AutodetectEncoding | ( | ) |
Try to automatically detect and set the encoding of the RSS feed.
The precedence is as follows: encoding declared in the XML file, charset parameter in the Content-Type HTTP response header, then ISO-8859-1.
Definition at line 117 of file RSSClient.php.
References $CacheDB, $Encoding, $ServerUrl, Encoding(), and ServerUrl().
RSSClient::Encoding | ( | $NewValue = NULL | ) |
Get or set the character encoding of the RSS feed.
string | $NewValue | New character encoding of the RSS feed. This parameter is optional. |
Definition at line 88 of file RSSClient.php.
References $Encoding, $Parser, QueryServerWithCaching(), and ServerUrl().
Referenced by AutodetectEncoding(), and RSSClient().
RSSClient::GetChannelDescription | ( | ) |
Get the description of the channel as given in the RSS feed.
Definition at line 244 of file RSSClient.php.
References $ChannelDescription, and LoadChannelInfo().
RSSClient::GetChannelLink | ( | ) |
Retrive the URL to the site of the channel in the RSS feed.
Definition at line 234 of file RSSClient.php.
References $ChannelLink, and LoadChannelInfo().
RSSClient::GetChannelTitle | ( | ) |
Retrieve the channel title as given in the RSS feed.
Definition at line 224 of file RSSClient.php.
References $ChannelTitle, and LoadChannelInfo().
RSSClient::GetItems | ( | $NumberOfItems = NULL , |
|
$ChannelName = NULL |
|||
) |
Retrieve the RSS items from the RSS feed.
The first channel of the feed will be used if not specified.
int | $NumberOfItems | Number of items to return from the field. All of the items are returned by default. |
string | $ChannelName | Channel to retrieve if not the first one. |
Definition at line 179 of file RSSClient.php.
RSSClient::GetXmlInfo | ( | $Url | ) |
Get the XML text at the given URL, along with the type and character encoding of the text.
$Url | URL to the XML text. |
Definition at line 294 of file RSSClient.php.
Referenced by QueryServerWithCaching().
RSSClient::LoadChannelInfo | ( | ) |
Load information from the current RSS channel.
The information includes the channel title, site URL, and channel description.
Definition at line 424 of file RSSClient.php.
References $Parser.
Referenced by GetChannelDescription(), GetChannelLink(), and GetChannelTitle().
RSSClient::QueryServerWithCaching | ( | $ServerUrl, | |
$CacheDB, | |||
$RefreshTime | |||
) |
Load the XML of an RSS feed from the cache, if available, or from the server.
string | $ServerUrl | URL to the RSS feed. |
Database | $CacheDB | Database object to use for storage and retrieval of cached RSS feeds. The default value is NULL. |
int | $RefreshTime | Time in seconds for how long the cache of an RSS should remain valid. The default value is 600. |
Definition at line 354 of file RSSClient.php.
References $CacheDB, $ServerUrl, GetXmlInfo(), and ServerUrl().
Referenced by Encoding(), RSSClient(), and ServerUrl().
RSSClient::RSSClient | ( | $ServerUrl, | |
$CacheDB = NULL , |
|||
$RefreshTime = 600 , |
|||
$Encoding = "UTF-8" , |
|||
$DebugLevel = 0 |
|||
) |
Object constructor.
string | $ServerUrl | URL to the RSS feed. |
Database | $CacheDB | Database object to use for storage and retrieval of cached RSS feeds. The default value is NULL. |
int | $RefreshTime | Time in seconds for how long the cache of an RSS should remain valid. The default value is 600. |
string | $Encoding | The character encoding of the RSS feed. The default value is UTF-8. |
int | $DebugLevel | The level of verbosity of debug messages. The default value is 0. |
Definition at line 29 of file RSSClient.php.
References $CacheDB, $DebugLevel, $Encoding, $Parser, $RefreshTime, $ServerUrl, Encoding(), and QueryServerWithCaching().
RSSClient::ServerUrl | ( | $NewValue = NULL | ) |
Get or set the RSS feed URL.
string | $NewValue | New RSS feed URL. This parameter is optional. |
Definition at line 58 of file RSSClient.php.
References $Parser, $ServerUrl, and QueryServerWithCaching().
Referenced by AutodetectEncoding(), Encoding(), and QueryServerWithCaching().
RSSClient::SetDebugLevel | ( | $NewLevel | ) |
Set the current level of verbosity for debug output.
The valid levels are between 0-9 inclusive.
int | $NewLevel | New level of verbosity for debug output. |
Definition at line 280 of file RSSClient.php.
RSSClient::UsedCachedData | ( | ) |
Determine whether the RSS client is using cached data.
Definition at line 254 of file RSSClient.php.
References $CachedDataWasUsed.
RSSClient::$CacheDB |
Definition at line 261 of file RSSClient.php.
Referenced by AutodetectEncoding(), QueryServerWithCaching(), and RSSClient().
RSSClient::$CachedDataWasUsed |
Definition at line 273 of file RSSClient.php.
Referenced by UsedCachedData().
RSSClient::$ChannelDescription |
Definition at line 272 of file RSSClient.php.
Referenced by GetChannelDescription().
RSSClient::$ChannelLink |
Definition at line 271 of file RSSClient.php.
Referenced by GetChannelLink().
RSSClient::$ChannelTitle |
Definition at line 270 of file RSSClient.php.
Referenced by GetChannelTitle().
RSSClient::$DebugLevel |
Definition at line 266 of file RSSClient.php.
Referenced by RSSClient().
RSSClient::$Encoding |
Definition at line 267 of file RSSClient.php.
Referenced by AutodetectEncoding(), Encoding(), and RSSClient().
RSSClient::$MetadataPrefix |
Definition at line 264 of file RSSClient.php.
RSSClient::$Parser |
Definition at line 269 of file RSSClient.php.
Referenced by Encoding(), GetItems(), LoadChannelInfo(), RSSClient(), and ServerUrl().
RSSClient::$RefreshTime |
Definition at line 262 of file RSSClient.php.
Referenced by RSSClient().
RSSClient::$ServerUrl |
Definition at line 263 of file RSSClient.php.
Referenced by AutodetectEncoding(), QueryServerWithCaching(), RSSClient(), and ServerUrl().
RSSClient::$SetSpec |
Definition at line 265 of file RSSClient.php.
RSSClient::$XmlText |
Definition at line 268 of file RSSClient.php.