|
ColdBox Platform Version 2.6.3 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.frameworkSupertype
coldbox.system.plugin
coldbox.system.plugins.feedReader
public class feedReader
A rss reader plugin. We recommend that when you call the readFeed method, that you use url's as settings. ex: readFeed(getSetting('myFeedURL')). The settings this plugin uses are the following: feedReader_useCache:boolean [default=true], feedReader_cacheLocation:string, feedReader_cacheTimeout:numeric [default=30 min], feedReader_httpTimeout:numeric [default=30 sec]. If the cacheLocation directory does not exits, the plugin will throw an error. So please remember to create the directory.
Constructor Summary | |
---|---|
init(any controller)
Plugin Constructor. |
Method Summary | |
---|---|
private string |
URLToCacheKey(string feedURL)
Convert a url to a cache key representation |
void |
expireCachedFeed(string feedURL)
If the feed exists and it has expired, it removes it, else nothing. |
private string |
findCreatedDate(xml xmlRoot)
Parse the doc and find a created date |
private string |
findUpdatedDate(xml xmlRoot)
Parse the doc and find a updated date |
void |
flushCache()
Flushes the entire file cache. Removes all entries |
numeric |
getCacheSize()
Returns the number of elements in the cache directory. Only used for file caching. |
any |
getCachedFeed(string feedURL)
Get the contents of a feed from the cache, if not found, it returns a blank structure. (This method does NOT timeout or expire the feeds, that is done by the readFeed method ONLY) |
string |
getcacheLocation()
The cache location (absolute path) |
string |
getcachePrefix()
|
numeric |
getcacheTimeout()
The cache timeout in minutes |
string |
getcacheType()
|
numeric |
gethttpTimeout()
The http timeout in seconds |
private string |
getlockName()
|
boolean |
getuseCache()
Whether using file cache or not. |
boolean |
isDateISO8601(string datetime)
Checks if a date is in ISO8601 Format |
boolean |
isFeedCached(string feedURL)
Checks if a feed is cached or not |
boolean |
isFeedExpired(string feedURL)
Checks if a feed has expired or not. If the feed does not exist, it will throw an error. |
private string |
normalizeAtomTextConstruct(any entity)
Send an element and it will return the appropriate text construct. |
private any |
parseAtomItems(any items, [string itemsType='query'], [numeric maxItems='0'])
Parse the items an return an array of structures |
struct |
parseFeed(xml xmlDoc, [string itemsType='query'], [numeric maxItems='0'])
This parses a feed as an xml doc and returns it as a structure of elements. |
private any |
parseRSSItems(any items, [string itemsType='query'], [numeric maxItems='0'])
Parse the items an return an array of structures |
private query |
readCacheDir([string filter='*'])
Read the cahe directory using a filter. |
struct |
readFeed(string feedURL, [string itemsType='query'], [numeric maxItems='0'])
Read a feed from http if new or from local cache. Return a universal structure representation of the feed. |
boolean |
removeCachedFeed(string feedURL)
Purges/removes a feed from the cache, returns false if not in the cache. |
struct |
retrieveFeed(string feedURL, [string itemsType='query'], [numeric maxItems='0'])
This method does a cfhttp call on the feed url and returns a universal parsed feed structure. You can use this if you don't even want to use the caching facilities. |
void |
setCachedFeed(string feedURL, any feedStruct)
Set a new feed contents into the feed cache. |
void |
setcacheLocation(string cacheLocation)
The cache location (absolute path) |
void |
setcachePrefix(string cachePrefix)
|
void |
setcacheTimeout(numeric cacheTimeout)
Set the cache timeout in minutes |
void |
setcacheType(string cacheType)
|
void |
sethttpTimeout(numeric httpTimeout)
Set the http timeout in seconds |
private void |
setlockName(string lockName)
|
void |
setuseCache(boolean useCache)
Set whether to use file caching or not |
Methods inherited from class coldbox.system.plugin |
---|
getPluginDescription, getPluginName, getPluginVersion, getpluginPath, setPluginDescription, setPluginName, setPluginVersion
|
Methods inherited from class WEB-INF.cftags.component |
---|
|
Constructor Detail |
---|
public init(any controller)
Method Detail |
---|
private string URLToCacheKey(string feedURL)
feedURL
- The feed url to parse or retrieve from cache.public void expireCachedFeed(string feedURL)
feedURL
- The url to check if its in the cache.private string findCreatedDate(xml xmlRoot)
xmlRoot
- The xml root to look inprivate string findUpdatedDate(xml xmlRoot)
xmlRoot
- The xml root to look inpublic void flushCache()
public numeric getCacheSize()
public any getCachedFeed(string feedURL)
feedURL
- The url to check if its in the cache.public string getcacheLocation()
public string getcachePrefix()
public numeric getcacheTimeout()
public string getcacheType()
public numeric gethttpTimeout()
private string getlockName()
public boolean getuseCache()
public boolean isDateISO8601(string datetime)
datetime
- The datetime string to checkpublic boolean isFeedCached(string feedURL)
feedURL
- The url to check if its in the cache.public boolean isFeedExpired(string feedURL)
feedURL
- The url to check if its in the cache.private string normalizeAtomTextConstruct(any entity)
entity
- The xml constructprivate any parseAtomItems(any items, [string itemsType='query'], [numeric maxItems='0'])
items
- The xml of itemsitemsType
- The type of the items either query or Array. Query is by default.maxItems
- The max number of entries to retrieve, default is allpublic struct parseFeed(xml xmlDoc, [string itemsType='query'], [numeric maxItems='0'])
xmlDoc
- The xmldoc to parse and normalize. Must be a coldfusion xml doc object not a string.itemsType
- The type of the items either query or Array. Query is by default.maxItems
- The max number of entries to retrieve, default is allprivate any parseRSSItems(any items, [string itemsType='query'], [numeric maxItems='0'])
items
- The xml of itemsitemsType
- The type of the items either query or Array. Query is by default.maxItems
- The max number of entries to retrieve, default is allprivate query readCacheDir([string filter='*'])
filter
- The file filter to use if sent, else * is defaultpublic struct readFeed(string feedURL, [string itemsType='query'], [numeric maxItems='0'])
feedURL
- The feed url to parse or retrieve from cache.itemsType
- The type of the items either query or Array. Query is by default.maxItems
- The max number of entries to retrieve, default is allpublic boolean removeCachedFeed(string feedURL)
feedURL
- The url to purge from the cache.public struct retrieveFeed(string feedURL, [string itemsType='query'], [numeric maxItems='0'])
feedURL
- The url to retrieve the feed from.itemsType
- The type of the items either query or Array. Query is by default.maxItems
- The max number of entries to retrieve, default is allpublic void setCachedFeed(string feedURL, any feedStruct)
feedURL
- The feed url to store in the cache.feedStruct
- The contents of the feed to cachepublic void setcacheLocation(string cacheLocation)
cacheLocation
public void setcachePrefix(string cachePrefix)
cachePrefix
public void setcacheTimeout(numeric cacheTimeout)
cacheTimeout
public void setcacheType(string cacheType)
cacheType
public void sethttpTimeout(numeric httpTimeout)
httpTimeout
private void setlockName(string lockName)
lockName
public void setuseCache(boolean useCache)
useCache
|
ColdBox Platform Version 2.6.3 | ||||
FRAMES |