dolibarr 19.0.3
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 27 of file rssparser.class.php.

Constructor & Destructor Documentation

◆ __construct()

RssParser::__construct ( $db)

Constructor.

Parameters
DoliDB$dbDatabase handler

Definition at line 77 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 720 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 703 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 687 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 626 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 645 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 538 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 785 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 755 of file rssparser.class.php.

Referenced by parser().

◆ getCopyright()

RssParser::getCopyright ( )

getCopyright

Returns
string

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

◆ getDescription()

RssParser::getDescription ( )

getDescription

Returns
string

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

◆ getFormat()

RssParser::getFormat ( )

getFormat

Returns
string

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

◆ getGenerator()

RssParser::getGenerator ( )

getGenerator

Returns
string

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

◆ getImageUrl()

RssParser::getImageUrl ( )

getImageUrl

Returns
string

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

◆ getItems()

RssParser::getItems ( )

getItems

Returns
array

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

◆ getLanguage()

RssParser::getLanguage ( )

getLanguage

Returns
string

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

◆ getLastBuildDate()

RssParser::getLastBuildDate ( )

getLastBuildDate

Returns
string

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

◆ getLastFetchDate()

RssParser::getLastFetchDate ( )

getLastFetchDate

Returns
string

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

◆ getLink()

RssParser::getLink ( )

getLink

Returns
string

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

◆ getTitle()

RssParser::getTitle ( )

getTitle

Returns
string

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

◆ getUrlRss()

RssParser::getUrlRss ( )

getUrlRss

Returns
string

Definition at line 97 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 202 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: