Jelix 1.6.40

jResponseSitemap extends jResponse
in package

Sitemap 0.9 response

Tags
subpackage

core_response

link
http://www.sitemaps.org/
since
1.2

Table of Contents

$content  : jTpl
The template container
$contentTpl  : string
Selector of the template file
$forcedHttpVersion  : mixed
$httpVersion  : mixed
$_httpHeaders  : array<string|int, mixed>
$_httpHeadersSent  : bool
$_httpStatusCode  : string
$_httpStatusMsg  : string
$_outputOnlyHeaders  : bool
$_type  : string
Ident of the response type
$allowedChangefreq  : array<string|int, mixed>
Frequency change url
$maxSitemap  : int
Maximum number of URLs for a sitemap index file
$maxUrl  : int
Maximum number of URLs for a sitemap file
$sitemapCacheId  : string
$sitemapCacheTtl  : null|int
$sitemapXmlContent  : string|false
$urlList  : array<string|int, jSitemapUrl>
List of URLs for a sitemap file
$urlSitemap  : array<string|int, jSitemapIndex>
List of URLs for a sitemap index file
__construct()  : void
Class constructor
addHttpHeader()  : mixed
add an http header to the response.
addSitemap()  : bool
add a URL in a sitemap file
addUrl()  : bool
add a URL in a sitemap file
cleanCacheHeaders()  : mixed
Clean the differents caches headers
clearHttpHeaders()  : mixed
delete all http headers
getFormatType()  : string
return the format type name (eg the family type name)
getType()  : string
return the response type name
getUrlsFromUrlsXml()  : array<string|int, mixed>
Return pathinfo URLs automatically from urls.xml
hasUrlInCache()  : mixed
Activate the cache system of url and indicate if the cache is still valid
importFromUrlsXml()  : void
Add URLs automatically from urls.xml
isValidCache()  : bool
Use the HTPP headers Last-Modified to see if the ressource in client cache is fresh
output()  : bool
Generate the content and send it Errors are managed
outputErrors()  : mixed
Send a response with a generic error message.
ping()  : bool
Submitting a sitemap by sending an HTTP request
setExpires()  : mixed
Set an expires header to the page/ressource.
setHttpStatus()  : mixed
set the http status code for the http header
setLifetime()  : mixed
Set a life time for the page/ressource.
_checkRequestType()  : mixed
check if the request is of type GET or HEAD
_normalizeDate()  : string
Normalize a date into GMT format
_parseUrlsXml()  : array<string|int, mixed>
Parse urls.xml and return pathinfo URLs
sendHttpHeaders()  : mixed
send http headers

Properties

$_httpHeaders

protected array<string|int, mixed> $_httpHeaders = array()

list of http headers that will be send to the client

$_httpHeadersSent

protected bool $_httpHeadersSent = alse

indicates if http headers have already been sent to the client

$_httpStatusCode

protected string $_httpStatusCode = '200'

the http status code to send

$_httpStatusMsg

protected string $_httpStatusMsg = 'OK'

the http status message to send

$_outputOnlyHeaders

protected bool $_outputOnlyHeaders = alse

Should we output only the headers or the entire response

$allowedChangefreq

Frequency change url

protected array<string|int, mixed> $allowedChangefreq = array('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never')

Methods

addHttpHeader()

add an http header to the response.

public addHttpHeader(string $htype, string $hcontent[, int $overwrite = true ]) : mixed

will be send during the output of the response

Parameters
$htype : string

the header type ("Content-Type", "Date-modified"...)

$hcontent : string

value of the header type

$overwrite : int = true

false or 0 if the value should be set only if it doesn't still exist -1 to add the header with the existing values true or 1 to replace the existing header

Return values
mixed

addSitemap()

add a URL in a sitemap file

public addSitemap(string $loc[, string $lastmod = null ]) : bool
Parameters
$loc : string

URL of sitemap file

$lastmod : string = null

The date of last modification of the sitemap file

Return values
bool

true if addition is ok, else false

addUrl()

add a URL in a sitemap file

public addUrl(string $loc[, string $lastmod = null ][, string $changefreq = null ][, string $priority = null ]) : bool
Parameters
$loc : string

URL of the page

$lastmod : string = null

The date of last modification of the file

$changefreq : string = null

How frequently the page is likely to change

$priority : string = null

The priority of this URL relative to other URLs

Return values
bool

true if addition is ok, else false

cleanCacheHeaders()

Clean the differents caches headers

public cleanCacheHeaders() : mixed
Return values
mixed

clearHttpHeaders()

delete all http headers

public clearHttpHeaders() : mixed
Return values
mixed

getFormatType()

return the format type name (eg the family type name)

public getFormatType() : string
Return values
string

the name

getType()

return the response type name

public final getType() : string
Return values
string

the name

getUrlsFromUrlsXml()

Return pathinfo URLs automatically from urls.xml

public getUrlsFromUrlsXml() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasUrlInCache()

Activate the cache system of url and indicate if the cache is still valid

public hasUrlInCache([string $cacheName = "sitemap.xml" ][, int|null $ttl = null ]) : mixed

It the cache is still valid, you can return directly the response object.

Parameters
$cacheName : string = "sitemap.xml"

the cache name. customize it if you have several sitemap

$ttl : int|null = null

ttl of the cache in seconds. null = use default ttl

Tags
throws
jException
Return values
mixed

importFromUrlsXml()

Add URLs automatically from urls.xml

public importFromUrlsXml() : void
Return values
void

isValidCache()

Use the HTPP headers Last-Modified to see if the ressource in client cache is fresh

public isValidCache([mixed $dateLastModified = null ][, mixed $etag = null ][, bool $cleanCacheHeader = true ]) : bool
Parameters
$dateLastModified : mixed = null

Can be a jDateTime object, a DateTime object or a string understandable by strtotime

$etag : mixed = null
$cleanCacheHeader : bool = true

True for clean/delete other cache headers. Default : true.

Return values
bool

True if the client ressource version is fresh, false otherwise

output()

Generate the content and send it Errors are managed

public final output() : bool
Return values
bool

true if generation is ok, else false

outputErrors()

Send a response with a generic error message.

public outputErrors() : mixed
Return values
mixed

ping()

Submitting a sitemap by sending an HTTP request

public ping(mixed $uri) : bool
Parameters
$uri : mixed
Return values
bool

setExpires()

Set an expires header to the page/ressource.

public setExpires(mixed $date[, mixed $cleanCacheHeader = true ]) : mixed
Parameters
$date : mixed
$cleanCacheHeader : mixed = true
Tags
see
jResponse::_normalizeDate()
Return values
mixed

setHttpStatus()

set the http status code for the http header

public setHttpStatus(string $code, string $msg) : mixed
Parameters
$code : string

the status code (200, 404...)

$msg : string

the message following the status code ("OK", "Not Found"..)

Return values
mixed

setLifetime()

Set a life time for the page/ressource.

public setLifetime(int $time[, bool $sharedCache = false ][, mixed $cleanCacheHeader = true ]) : mixed
Parameters
$time : int

Time during which the page will be cached. Express in seconds.

$sharedCache : bool = false

True if the lifetime concern a public/shared cache. Default : false.

$cleanCacheHeader : mixed = true
Return values
mixed

_checkRequestType()

check if the request is of type GET or HEAD

protected _checkRequestType() : mixed
Return values
mixed

_normalizeDate()

Normalize a date into GMT format

protected _normalizeDate(mixed $date) : string
Parameters
$date : mixed

Can be a jDateTime object, a DateTime object or a string understandable by strtotime

Return values
string

a date in GMT format

_parseUrlsXml()

Parse urls.xml and return pathinfo URLs

protected _parseUrlsXml() : array<string|int, mixed>
Return values
array<string|int, mixed>

sendHttpHeaders()

send http headers

protected sendHttpHeaders() : mixed
Return values
mixed

Search results