dolibarr 20.0.0
RssParser Class Reference

Class to parse RSS files. More...

Public Member Functions

 __construct ($db)
 Constructor.
 
 getFormat ()
 getFormat
 
 getUrlRss ()
 getUrlRss
 
 getLanguage ()
 getLanguage
 
 getGenerator ()
 getGenerator
 
 getCopyright ()
 getCopyright
 
 getLastBuildDate ()
 getLastBuildDate
 
 getImageUrl ()
 getImageUrl
 
 getLink ()
 getLink
 
 getTitle ()
 getTitle
 
 getDescription ()
 getDescription
 
 getLastFetchDate ()
 getLastFetchDate
 
 getItems ()
 getItems
 
 parser ($urlRSS, $maxNb=0, $cachedelay=60, $cachedir='')
 Parse rss URL.
 
 feed_start_element ($p, $element, $attrs)
 Triggered when opened tag is found.
 
 feed_cdata ($p, $text)
 Triggered when CDATA is found.
 
 feed_end_element ($p, $el)
 Triggered when closed tag is found.
 
 concat (&$str1, $str2="")
 To concat 2 strings with no warning if an operand is not defined.
 
 append_content ($text)
 Enter description here ...
 
 append ($el, $text)
 smart append - field and namespace aware
 

Private Member Functions

 getAtomItemDescription (array $item, $maxlength=500)
 Return a description/summary for one item from a ATOM feed.
 
 getAtomImageUrl (array $feed)
 Return a URL to a image of the given ATOM feed.
 

Detailed Description

Class to parse RSS files.

Definition at line 30 of file rssparser.class.php.

Constructor & Destructor Documentation

◆ __construct()

RssParser::__construct ( $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 80 of file rssparser.class.php.

Member Function Documentation

◆ append()

RssParser::append ( $el,
$text )

smart append - field and namespace aware

Parameters
string$elEl
string$textText
Returns
void

Definition at line 721 of file rssparser.class.php.

References concat().

Referenced by feed_cdata(), and feed_start_element().

◆ append_content()

RssParser::append_content ( $text)

Enter description here ...

Parameters
string$textText
Returns
void

Definition at line 704 of file rssparser.class.php.

References concat().

Referenced by feed_cdata(), feed_end_element(), and feed_start_element().

◆ concat()

RssParser::concat ( & $str1,
$str2 = "" )

To concat 2 strings with no warning if an operand is not defined.

Parameters
string$str1Str1
string$str2Str2
Returns
string String cancatenated

Definition at line 688 of file rssparser.class.php.

Referenced by append(), and append_content().

◆ feed_cdata()

RssParser::feed_cdata ( $p,
$text )

Triggered when CDATA is found.

Parameters
string$pP
string$textTag
Returns
void

Definition at line 627 of file rssparser.class.php.

References append(), and append_content().

◆ feed_end_element()

RssParser::feed_end_element ( $p,
$el )

Triggered when closed tag is found.

Parameters
string$pP
string$elTag
Returns
void

Definition at line 646 of file rssparser.class.php.

References append_content().

◆ feed_start_element()

RssParser::feed_start_element ( $p,
$element,
$attrs )

Triggered when opened tag is found.

Parameters
string$pStart
string$elementTag
array$attrsAttributes of tags
Returns
void

Definition at line 539 of file rssparser.class.php.

References append(), and append_content().

◆ getAtomImageUrl()

RssParser::getAtomImageUrl ( array $feed)
private

Return a URL to a image of the given ATOM feed.

Parameters
array$feedThe ATOM feed that possible contain a link to a logo or icon
Returns
string A URL to a image from a ATOM feed when found, otherwise a empty string

Definition at line 786 of file rssparser.class.php.

Referenced by parser().

◆ getAtomItemDescription()

RssParser::getAtomItemDescription ( array $item,
$maxlength = 500 )
private

Return a description/summary for one item from a ATOM feed.

Parameters
array$itemA parsed item of a ATOM feed
int$maxlength(optional) The maximum length for the description
Returns
string A summary description

Definition at line 756 of file rssparser.class.php.

Referenced by parser().

◆ getCopyright()

RssParser::getCopyright ( )

getCopyright

Returns
string

Definition at line 127 of file rssparser.class.php.

◆ getDescription()

RssParser::getDescription ( )

getDescription

Returns
string

Definition at line 172 of file rssparser.class.php.

◆ getFormat()

RssParser::getFormat ( )

getFormat

Returns
string

Definition at line 90 of file rssparser.class.php.

◆ getGenerator()

RssParser::getGenerator ( )

getGenerator

Returns
string

Definition at line 118 of file rssparser.class.php.

◆ getImageUrl()

RssParser::getImageUrl ( )

getImageUrl

Returns
string

Definition at line 145 of file rssparser.class.php.

◆ getItems()

RssParser::getItems ( )

getItems

Returns
array

Definition at line 190 of file rssparser.class.php.

◆ getLanguage()

RssParser::getLanguage ( )

getLanguage

Returns
string

Definition at line 109 of file rssparser.class.php.

◆ getLastBuildDate()

RssParser::getLastBuildDate ( )

getLastBuildDate

Returns
string

Definition at line 136 of file rssparser.class.php.

◆ getLastFetchDate()

RssParser::getLastFetchDate ( )

getLastFetchDate

Returns
int

Definition at line 181 of file rssparser.class.php.

◆ getLink()

RssParser::getLink ( )

getLink

Returns
string

Definition at line 154 of file rssparser.class.php.

◆ getTitle()

RssParser::getTitle ( )

getTitle

Returns
string

Definition at line 163 of file rssparser.class.php.

◆ getUrlRss()

RssParser::getUrlRss ( )

getUrlRss

Returns
string

Definition at line 100 of file rssparser.class.php.

◆ parser()

RssParser::parser ( $urlRSS,
$maxNb = 0,
$cachedelay = 60,
$cachedir = '' )

Parse rss URL.

Parameters
string$urlRSSUrl to parse
int$maxNbMax nb of records to get (0 for no limit)
int$cachedelay0=No cache, nb of seconds we accept cache files (cachedir must also be defined)
string$cachedirDirectory where to save cache file (For example $conf->externalrss->dir_temp)
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 204 of file rssparser.class.php.

References dol_filemtime(), dol_hash(), dol_is_dir(), dol_is_url(), dol_mkdir(), dol_now(), dol_syslog(), dolChmod(), getAtomImageUrl(), getAtomItemDescription(), getDolGlobalString(), getURLContent(), sanitizeVal(), and xml2php().


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