dolibarr 18.0.6
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 72 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 709 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 692 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 676 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 615 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 634 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 527 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 774 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 744 of file rssparser.class.php.

Referenced by parser().

◆ getCopyright()

RssParser::getCopyright ( )

getCopyright

Returns
string

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

◆ getDescription()

RssParser::getDescription ( )

getDescription

Returns
string

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

◆ getFormat()

RssParser::getFormat ( )

getFormat

Returns
string

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

◆ getGenerator()

RssParser::getGenerator ( )

getGenerator

Returns
string

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

◆ getImageUrl()

RssParser::getImageUrl ( )

getImageUrl

Returns
string

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

◆ getItems()

RssParser::getItems ( )

getItems

Returns
array

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

◆ getLanguage()

RssParser::getLanguage ( )

getLanguage

Returns
string

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

◆ getLastBuildDate()

RssParser::getLastBuildDate ( )

getLastBuildDate

Returns
string

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

◆ getLastFetchDate()

RssParser::getLastFetchDate ( )

getLastFetchDate

Returns
string

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

◆ getLink()

RssParser::getLink ( )

getLink

Returns
string

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

◆ getTitle()

RssParser::getTitle ( )

getTitle

Returns
string

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

◆ getUrlRss()

RssParser::getUrlRss ( )

getUrlRss

Returns
string

Definition at line 92 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 <0 if KO, >0 if OK

Definition at line 197 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(), getURLContent(), sanitizeVal(), and xml2php().


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