SitemapIndex
extends AbstractFile
in package
Class for representing sitemap index files
Tags
Table of Contents
- $lastmod : string
- Last modification date of sitemaps.
- $topTag : string
- Top-level tag.
- $urls : array<string|int, mixed>
- URLs in map.
- __construct() : mixed
- Constructor
- addUrl() : void
- Add a URL to the map.
- clear() : void
- Remove all entries
- getCount() : int
- Get the count of items
- isEmpty() : bool
- Check if the sitemap is empty
- toString() : string
- Get the map as a string.
- write() : bool
- Write the map to a file on disk.
- getEntry() : string
- Translate a URL into an appropriate entry for this sitemap file.
- getExtraNamespaces() : array<string|int, mixed>
- Get any extra namespace declarations needed for the sitemap
Properties
$lastmod
Last modification date of sitemaps.
protected
string
$lastmod
$topTag
Top-level tag.
protected
string
$topTag
$urls
URLs in map.
protected
array<string|int, mixed>
$urls
= []
Methods
__construct()
Constructor
public
__construct([string $lastmod = null ]) : mixed
Parameters
- $lastmod : string = null
-
Last modification date of sitemaps.
Return values
mixed —addUrl()
Add a URL to the map.
public
addUrl(string|array<string|int, mixed> $url) : void
Parameters
- $url : string|array<string|int, mixed>
-
URL as a string or as an associative array
Return values
void —clear()
Remove all entries
public
clear() : void
Return values
void —getCount()
Get the count of items
public
getCount() : int
Return values
int —isEmpty()
Check if the sitemap is empty
public
isEmpty() : bool
Return values
bool —toString()
Get the map as a string.
public
toString() : string
Return values
string —write()
Write the map to a file on disk.
public
write(string $file) : bool
Parameters
- $file : string
-
Target filename
Return values
bool —getEntry()
Translate a URL into an appropriate entry for this sitemap file.
protected
getEntry(string $url) : string
Parameters
- $url : string
-
URL
Return values
string —XML fragment
getExtraNamespaces()
Get any extra namespace declarations needed for the sitemap
protected
getExtraNamespaces() : array<string|int, mixed>