class RssParser (View source)

Class to parse RSS files

Properties

DoliDB $db
string $error
string $feed_version
$items
array<string, string>|array<string, array<string, string>> $current_item
SimpleXMLElement|array<string, mixed> $channel
array<string, array<string, string>> $textinput
array<string, array<string, string>> $image
string[] $stack

Methods

__construct($db)

Constructor

string
getFormat()

getFormat

string
getUrlRss()

getUrlRss

string
getLanguage()

getLanguage

string
getGenerator()

getGenerator

string
getCopyright()

getCopyright

string
getLastBuildDate()

getLastBuildDate

string
getImageUrl()

getImageUrl

string
getLink()

getLink

string
getTitle()

getTitle

string
getDescription()

getDescription

int
getLastFetchDate()

getLastFetchDate

array<array{link: string, title: string, description: string, pubDate: string, category: string, id: string, author: string}>
getItems()

getItems

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

Parse rss URL

feed_start_element($p, string $element, $attrs)

Triggered when opened tag is found

feed_cdata($p, string $text)

Triggered when CDATA is found

feed_end_element($p, string $el)

Triggered when closed tag is found

concat($str1, string $str2 = "")

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

void
append_content(string $text)

Enter description here .

append($el, string $text)

smart append - field and namespace aware

Details

__construct($db)

Constructor

@param DoliDB $db Database handler

Parameters

$db

string getFormat()

getFormat

Return Value

string

string getUrlRss()

getUrlRss

Return Value

string

string getLanguage()

getLanguage

Return Value

string

string getGenerator()

getGenerator

Return Value

string

string getCopyright()

getCopyright

Return Value

string

string getLastBuildDate()

getLastBuildDate

Return Value

string

string getImageUrl()

getImageUrl

Return Value

string

getLink

Return Value

string

string getTitle()

getTitle

Return Value

string

string getDescription()

getDescription

Return Value

string

int getLastFetchDate()

getLastFetchDate

Return Value

int

array<array{link: string, title: string, description: string, pubDate: string, category: string, id: string, author: string}> getItems()

getItems

Return Value

array<array{link: string, title: string, description: string, pubDate: string, category: string, id: string, author: string}>

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

Parse rss URL

@param  string  $urlRSS     Url to parse

Parameters

$urlRSS
int $maxNb

Max nb of records to get (0 for no limit) @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined) @param string $cachedir Directory where to save cache file (For example $conf->externalrss->dir_temp)

$cachedelay
$cachedir

Return Value

int

Return integer <0 if KO, >0 if OK

feed_start_element($p, string $element, $attrs)

Triggered when opened tag is found

@param  string      $p          Start

Parameters

$p
string $element

Tag @param array<string,mixed|mixed[]> $attrs Attributes of tags @return void

$attrs

feed_cdata($p, string $text)

Triggered when CDATA is found

@param  string  $p      P

Parameters

$p
string $text

Tag @return void

feed_end_element($p, string $el)

Triggered when closed tag is found

@param  string      $p      P

Parameters

$p
string $el

Tag @return void

concat($str1, string $str2 = "")

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

@param  string  $str1       Str1

Parameters

$str1
string $str2

Str2 @return string String cancatenated

void append_content(string $text)

Enter description here .

..

Parameters

string $text Text

Return Value

void

append($el, string $text)

smart append - field and namespace aware

@param  string  $el     El

Parameters

$el
string $text

Text @return void