CWIS Developer Documentation
Public Member Functions | Public Attributes | List of all members
RSSClient Class Reference

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
 

Detailed Description

Implements an RSS client for fetching, parsing, and caching RSS feeds.

Definition at line 13 of file RSSClient.php.

Member Function Documentation

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.

Parameters
string$NewValueNew character encoding of the RSS feed. This parameter is optional.
Returns
Returns the current character encoding of the RSS feed.

Definition at line 88 of file RSSClient.php.

References $Encoding, $Parser, QueryServerWithCaching(), and ServerUrl().

Referenced by AutodetectEncoding(), and RSSClient().

Here is the caller graph for this function:

RSSClient::GetChannelDescription ( )

Get the description of the channel as given in the RSS feed.

Returns
Returns 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.

Returns
Returns 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.

Returns
Returns the channel title.

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.

Parameters
int$NumberOfItemsNumber of items to return from the field. All of the items are returned by default.
string$ChannelNameChannel to retrieve if not the first one.
Returns
Returns the items from the RSS feed.

Definition at line 179 of file RSSClient.php.

References $Items, and $Parser.

RSSClient::GetXmlInfo (   $Url)

Get the XML text at the given URL, along with the type and character encoding of the text.

Parameters
$UrlURL to the XML text.
Returns
array( XML text or FALSE on failure, Type or NULL on failure or if not set, Charset or NULL on failure or if not set)

Definition at line 294 of file RSSClient.php.

Referenced by QueryServerWithCaching().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

RSSClient::QueryServerWithCaching (   $ServerUrl,
  $CacheDB,
  $RefreshTime 
)

Load the XML of an RSS feed from the cache, if available, or from the server.

Parameters
string$ServerUrlURL to the RSS feed.
Database$CacheDBDatabase object to use for storage and retrieval of cached RSS feeds. The default value is NULL.
int$RefreshTimeTime in seconds for how long the cache of an RSS should remain valid. The default value is 600.
Returns
Returns the XML of the RSS feed.

Definition at line 354 of file RSSClient.php.

References $CacheDB, $ServerUrl, GetXmlInfo(), and ServerUrl().

Referenced by Encoding(), RSSClient(), and ServerUrl().

Here is the caller graph for this function:

RSSClient::RSSClient (   $ServerUrl,
  $CacheDB = NULL,
  $RefreshTime = 600,
  $Encoding = "UTF-8",
  $DebugLevel = 0 
)

Object constructor.

Parameters
string$ServerUrlURL to the RSS feed.
Database$CacheDBDatabase object to use for storage and retrieval of cached RSS feeds. The default value is NULL.
int$RefreshTimeTime in seconds for how long the cache of an RSS should remain valid. The default value is 600.
string$EncodingThe character encoding of the RSS feed. The default value is UTF-8.
int$DebugLevelThe 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.

Parameters
string$NewValueNew RSS feed URL. This parameter is optional.
Returns
Returns the current RSS feed URL.

Definition at line 58 of file RSSClient.php.

References $Parser, $ServerUrl, and QueryServerWithCaching().

Referenced by AutodetectEncoding(), Encoding(), and QueryServerWithCaching().

Here is the caller graph for this function:

RSSClient::SetDebugLevel (   $NewLevel)

Set the current level of verbosity for debug output.

The valid levels are between 0-9 inclusive.

Parameters
int$NewLevelNew 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.

Returns
Returns TRUE if the RSS client is using cached data.

Definition at line 254 of file RSSClient.php.

References $CachedDataWasUsed.

Member Data Documentation

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.


The documentation for this class was generated from the following file: