RssHelper
extends Helper
in package
RSS Helper class for easy output RSS structures.
CakePHP4系で、RssHelper が削除されたため、CakePHP3系のものを利用 $this->Url->build() の第2引数について、CakePHP4系に合わせて調整済
Tags
Attributes
- #[AllowDynamicProperties]
Table of Contents
Properties
- $action : string
- Current action.
- $base : string
- Base URL
- $data : array<string|int, mixed>
- POSTed model data
- $field : string
- Name of the current field
- $helpers : array<string|int, mixed>
- Helpers used by RSS Helper
- $here : string
- URL to current action.
- $model : string
- Name of the current model
- $params : array<string|int, mixed>
- Parameter array.
- $Time : TimeHelper
- $Url : UrlHelper
- $version : string
- Default spec version of generated RSS
Methods
- channel() : string
- Returns an RSS `<channel />` element
- document() : string
- Returns an RSS document wrapped in `<rss />` tags
- elem() : string
- Generates an XML element
- implementedEvents() : array<string|int, mixed>
- Event listeners.
- item() : string
- Converts an array into an `<item />` element and its contents
- items() : string
- Transforms an array of data using an optional callback, and maps it to a set of `<item />` tags
- time() : string
- Converts a time in any format to an RSS time
Properties
$action
Current action.
public
string
$action
$base
Base URL
public
string
$base
$data
POSTed model data
public
array<string|int, mixed>
$data
$field
Name of the current field
public
string
$field
$helpers
Helpers used by RSS Helper
public
array<string|int, mixed>
$helpers
= ['Url', 'Time']
$here
URL to current action.
public
string
$here
$model
Name of the current model
public
string
$model
$params
Parameter array.
public
array<string|int, mixed>
$params
= []
$Time
public
TimeHelper
$Time
$Url
public
UrlHelper
$Url
$version
Default spec version of generated RSS
public
string
$version
= '2.0'
Methods
channel()
Returns an RSS `<channel />` element
public
channel([array<string|int, mixed> $attrib = [] ][, array<string|int, mixed> $elements = [] ][, string|null $content = null ]) : string
Parameters
- $attrib : array<string|int, mixed> = []
-
<channel />
tag attributes - $elements : array<string|int, mixed> = []
-
Named array elements which are converted to tags
- $content : string|null = null
-
Content (
<item />
's belonging to this channel
Tags
Return values
string —An RSS <channel />
document()
Returns an RSS document wrapped in `<rss />` tags
public
document([array<string|int, mixed> $attrib = [] ][, string|null $content = null ]) : string
Parameters
- $attrib : array<string|int, mixed> = []
-
<rss />
tag attributes - $content : string|null = null
-
Tag content.
Return values
string —An RSS document
elem()
Generates an XML element
public
elem(string $name[, array<string|int, mixed> $attrib = [] ][, string|array<string|int, mixed>|null $content = null ][, bool $endTag = true ]) : string
Parameters
- $name : string
-
The name of the XML element
- $attrib : array<string|int, mixed> = []
-
The attributes of the XML element
- $content : string|array<string|int, mixed>|null = null
-
XML element content
- $endTag : bool = true
-
Whether the end tag of the element should be printed
Tags
Return values
string —XML
implementedEvents()
Event listeners.
public
implementedEvents() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>item()
Converts an array into an `<item />` element and its contents
public
item([array<string|int, mixed> $att = [] ][, array<string|int, mixed> $elements = [] ]) : string
Parameters
- $att : array<string|int, mixed> = []
-
The attributes of the
<item />
element - $elements : array<string|int, mixed> = []
-
The list of elements contained in this
<item />
Tags
Return values
string —An RSS <item />
element
items()
Transforms an array of data using an optional callback, and maps it to a set of `<item />` tags
public
items(array<string|int, mixed> $items[, string|array<string|int, mixed>|null $callback = null ]) : string
Parameters
- $items : array<string|int, mixed>
-
The list of items to be mapped
- $callback : string|array<string|int, mixed>|null = null
-
A string function name, or array containing an object and a string method name
Tags
Return values
string —A set of RSS <item />
elements
time()
Converts a time in any format to an RSS time
public
time(int|string|DateTime $time) : string
Parameters
- $time : int|string|DateTime
-
UNIX timestamp or valid time string or DateTime object.
Tags
Return values
string —An RSS-formatted timestamp