This is an old revision of the document!
Table of Contents
Sitemap
Layer: Core · Source: lib/core/Sitemap.php:20 (lines 20–278)
class Sitemap
Sitemap
This class used for generating Google Sitemap files
Docblock Metadata
^ Tag ^ Value ^ | ''@author'' | Osman Üngür <[email protected]> | | ''@license'' | http://opensource.org/licenses/MIT MIT License |
Inheritance
No parent, interface or trait. This is a root type.
Constants (6)
^ Visibility ^ Name ^ Value ^ Line ^ | ''-'' | ''EXT'' | '''.xml';'' | 33 | | ''-'' | ''SCHEMA'' | '''http://www.sitemaps.org/schemas/sitemap/0.9';'' | 34 | | ''-'' | ''DEFAULT_PRIORITY'' | ''0.5;'' | 35 | | ''-'' | ''ITEM_PER_SITEMAP'' | ''50000;'' | 36 | | ''-'' | ''SEPERATOR'' | '''-';'' | 37 | | ''-'' | ''INDEX_SUFFIX'' | '''index';'' | 38 |
Properties (3)
^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ''private'' | ''(untyped)'' | ''$filename'' | '''sitemap';'' | 29 | | ''private'' | ''(untyped)'' | ''$current_item'' | ''0;'' | 30 | | ''private'' | ''(untyped)'' | ''$current_sitemap'' | ''0;'' | 31 |
Methods (18)
^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''__construct()'' | | 44 | | public | ''setDomain()'' | Sets root path of the website, starting with http:// or https:// | 54 | | private | ''getDomain()'' | Returns root path of the website | 65 | | private | ''getWriter()'' | Returns XMLWriter object instance | 75 | | private | ''setWriter()'' | Assigns XMLWriter object instance | 85 | | private | ''getPath()'' | Returns path of sitemaps | 95 | | public | ''setPath()'' | Sets paths of sitemaps | 106 | | private | ''getFilename()'' | Returns filename of sitemap file | 117 | | public | ''setFilename()'' | Sets filename of sitemap file | 128 | | private | ''getCurrentItem()'' | Returns current item count | 139 | | private | ''incCurrentItem()'' | Increases item counter | 148 | | private | ''getCurrentSitemap()'' | Returns current sitemap file count | 158 | | private | ''incCurrentSitemap()'' | Increases sitemap file count | 167 | | private | ''startSitemap()'' | Prepares sitemap XML document | 176 | | public | ''addItem()'' | Adds an item to sitemap | 200 | | private | ''getLastModifiedDate()'' | Prepares given date for sitemap | 231 | | private | ''endSitemap()'' | Finalizes tags of sitemap XML document. | 245 | | public | ''createSitemapIndex()'' | Writes Google sitemap index for generated sitemap files | 260 |
__construct()
public function __construct($domain)
lines 44–47 (4)
^ Parameter ^ Type ^ Default ^ Description ^ | ''$domain'' | ''(untyped)'' | //required// | //none// |
setDomain()
public function setDomain($domain)
lines 54–58 (5)
Sets root path of the website, starting with http:// or https://
^ Parameter ^ Type ^ Default ^ Description ^ | ''$domain'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared)
getDomain()
private function getDomain()
lines 65–68 (4)
Returns root path of the website
Takes no parameters.
Returns: (none declared) — string
getWriter()
private function getWriter()
lines 75–78 (4)
Returns XMLWriter object instance
Takes no parameters.
Returns: (none declared) — \XMLWriter
setWriter()
private function setWriter(\XMLWriter $writer)
lines 85–88 (4)
Assigns XMLWriter object instance
^ Parameter ^ Type ^ Default ^ Description ^ | ''$writer'' | ''\XMLWriter'' | //required// | //none// |
Returns: (none declared)
getPath()
private function getPath()
lines 95–98 (4)
Returns path of sitemaps
Takes no parameters.
Returns: (none declared) — string
setPath()
public function setPath($path)
lines 106–110 (5)
Sets paths of sitemaps
^ Parameter ^ Type ^ Default ^ Description ^ | ''$path'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — Sitemap
getFilename()
private function getFilename()
lines 117–120 (4)
Returns filename of sitemap file
Takes no parameters.
Returns: (none declared) — string
setFilename()
public function setFilename($filename)
lines 128–132 (5)
Sets filename of sitemap file
^ Parameter ^ Type ^ Default ^ Description ^ | ''$filename'' | ''(untyped)'' | //required// | //none// |
Returns: (none declared) — Sitemap
getCurrentItem()
private function getCurrentItem()
lines 139–142 (4)
Returns current item count
Takes no parameters.
Returns: (none declared) — int
incCurrentItem()
private function incCurrentItem()
lines 148–151 (4)
Increases item counter
Takes no parameters.
Returns: (none declared)
getCurrentSitemap()
private function getCurrentSitemap()
lines 158–161 (4)
Returns current sitemap file count
Takes no parameters.
Returns: (none declared) — int
incCurrentSitemap()
private function incCurrentSitemap()
lines 167–170 (4)
Increases sitemap file count
Takes no parameters.
Returns: (none declared)
startSitemap()
private function startSitemap()
lines 176–189 (14)
Prepares sitemap XML document
Takes no parameters.
Returns: (none declared)
addItem()
public function addItem($loc, $priority = self::DEFAULT_PRIORITY, $changefreq = null, $lastmod = null)
lines 200–223 (24)
Adds an item to sitemap
^ Parameter ^ Type ^ Default ^ Description ^ | ''$loc'' | ''(untyped)'' | //required// | URL of the page. This value must be less than 2,048 characters. | | ''$priority'' | ''(untyped)'' | ''self::DEFAULT_PRIORITY'' | The priority of this URL relative to other URLs on your site. Valid values range from 0.0 to 1.0. | | ''$changefreq'' | ''(untyped)'' | ''null'' | How frequently the page is likely to change. Valid values are always, hourly, daily, weekly, monthly, yearly and never. | | ''$lastmod'' | ''(untyped)'' | ''null'' | The date of last modification of url. Unix timestamp or any English textual datetime description. |
Returns: (none declared) — Sitemap
getLastModifiedDate()
private function getLastModifiedDate($date)
lines 231–239 (9)
Prepares given date for sitemap
^ Parameter ^ Type ^ Default ^ Description ^ | ''$date'' | ''(untyped)'' | //required// | Unix timestamp or any English textual datetime description |
Returns: (none declared) — string Year-Month-Day formatted date.
endSitemap()
private function endSitemap()
lines 245–252 (8)
Finalizes tags of sitemap XML document.
Takes no parameters.
Returns: (none declared)
createSitemapIndex()
public function createSitemapIndex($loc, $lastmod = 'Today')
lines 260–277 (18)
Writes Google sitemap index for generated sitemap files
^ Parameter ^ Type ^ Default ^ Description ^ | ''$loc'' | ''(untyped)'' | //required// | Accessible URL path of sitemaps | | ''$lastmod'' | ''(untyped)'' | '''Today''' | The date of last modification of sitemap. Unix timestamp or any English textual datetime description. |
Returns: (none declared)
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
