dolibarr  18.0.6
Public Member Functions | Private Member Functions | List of all members
RssParser Class Reference

Class to parse RSS files. More...

Public Member Functions

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

Private Member Functions

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

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.

◆ append_content()

RssParser::append_content (   $text)

Enter description here ...

Parameters
string$textText
Returns
void

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

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

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

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

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

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

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

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


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