PHP Класс Contao\Feed

The class provides an interface to create RSS or Atom feeds. You can add the feed item objects and the class will generate the XML markup. Usage: $feed = new Feed('news'); $feed->title = 'News feed'; $item = new FeedItem(); $item->title = 'Latest news'; $item->author = 'Leo Feyer'; $feed->addItem($item); echo $feed->generateRss();
Наследование: extends System
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$arrData array Data
$arrItems array Items
$strName string Feed name

Открытые методы

Метод Описание
__construct ( string $strName ) Store the feed name (without file extension)
__get ( string $strKey ) : mixed | null Return an object property
__isset ( string $strKey ) : boolean Check whether a property is set
__set ( string $strKey, mixed $varValue ) Set an object property
addItem ( FeedItem $objItem ) Add an item
generateAtom ( ) : string Generate an Atom feed and return it as XML string
generateRss ( ) : string Generate an RSS 2.0 feed and return it as XML string

Защищенные методы

Метод Описание
adjustPublicationDate ( ) Adjust the publication date

Описание методов

__construct() публичный Метод

Store the feed name (without file extension)
public __construct ( string $strName )
$strName string The feed name

__get() публичный Метод

Return an object property
public __get ( string $strKey ) : mixed | null
$strKey string The property name
Результат mixed | null The property value

__isset() публичный Метод

Check whether a property is set
public __isset ( string $strKey ) : boolean
$strKey string The property name
Результат boolean True if the property is set

__set() публичный Метод

Set an object property
public __set ( string $strKey, mixed $varValue )
$strKey string The property name
$varValue mixed The property value

addItem() публичный Метод

Add an item
public addItem ( FeedItem $objItem )
$objItem FeedItem The feed item object

adjustPublicationDate() защищенный Метод

Adjust the publication date
protected adjustPublicationDate ( )

generateAtom() публичный Метод

Generate an Atom feed and return it as XML string
public generateAtom ( ) : string
Результат string The Atom feed markup

generateRss() публичный Метод

Generate an RSS 2.0 feed and return it as XML string
public generateRss ( ) : string
Результат string The RSS feed markup

Описание свойств

$arrData защищенное свойство

Data
protected array $arrData
Результат array

$arrItems защищенное свойство

Items
protected array $arrItems
Результат array

$strName защищенное свойство

Feed name
protected string $strName
Результат string