PHP Class Sonata\Exporter\Writer\SitemapWriter

Inheritance: implements Sonata\Exporter\Writer\WriterInterface
Mostra file Open project: sonata-project/exporter Class Usage Examples

Protected Properties

Property Type Description
$autoIndex boolean
$buffer resource
$bufferPart integer
$bufferSize integer
$bufferUrlCount integer
$folder string
$groupName string
$headers array
$pattern string

Public Methods

Method Description
__construct ( string $folder, mixed $groupName = false, array $headers = [], boolean $autoIndex = true ) Constructor.
close ( )
generateSitemapIndex ( string $folder, string $baseUrl, string $pattern = 'sitemap*.xml', string $filename = 'sitemap.xml' ) Generates the sitemap index from the sitemap part avaible in the folder.
getFolder ( ) : string Returns folder to store the sitemap.xml file.
isAutoIndex ( ) : boolean Returns the status of auto generation of index site map.
open ( )
write ( array $data )

Protected Methods

Method Description
addSitemapLine ( string $line ) Add a new line into the sitemap part.
buildData ( array $data ) : array Build data with default parameters.
closeSitemap ( ) Close the sitemap part.
fixDataType ( array &$data ) Fix type of data, if data type is specific, he must to be defined in data and he must to be a array.
generateDefaultLine ( array $data ) : string Generate standard line of sitemap.
generateImageLine ( array $data ) : string Generate image line of sitemap.
generateNewPart ( ) Generate a new sitemap part.
generateVideoLine ( array $data ) : string Generate video line of sitemap.
getHeaderByFlag ( ) : string Generate additional header with namespace adapted to the content.

Method Details

__construct() public method

Constructor.
public __construct ( string $folder, mixed $groupName = false, array $headers = [], boolean $autoIndex = true )
$folder string The folder to store the sitemap.xml file
$groupName mixed Name of sub-sitemap (optional)
$headers array Indicate the need for namespace in the header sitemap
$autoIndex boolean If you want to generate index of sitemap (optional)

addSitemapLine() protected method

Add a new line into the sitemap part.
protected addSitemapLine ( string $line )
$line string

buildData() protected method

Build data with default parameters.
protected buildData ( array $data ) : array
$data array List of parameters
return array

close() public method

public close ( )

closeSitemap() protected method

Close the sitemap part.
protected closeSitemap ( )

fixDataType() protected method

Fix type of data, if data type is specific, he must to be defined in data and he must to be a array.
protected fixDataType ( array &$data )
$data array

generateDefaultLine() protected method

Generate standard line of sitemap.
protected generateDefaultLine ( array $data ) : string
$data array List of parameters
return string

generateImageLine() protected method

Generate image line of sitemap.
protected generateImageLine ( array $data ) : string
$data array List of parameters
return string

generateNewPart() protected method

Generate a new sitemap part.
protected generateNewPart ( )

generateSitemapIndex() public static method

Generates the sitemap index from the sitemap part avaible in the folder.
public static generateSitemapIndex ( string $folder, string $baseUrl, string $pattern = 'sitemap*.xml', string $filename = 'sitemap.xml' )
$folder string A folder to write sitemap index
$baseUrl string A base URL
$pattern string A sitemap pattern, optional
$filename string A sitemap file name, optional

generateVideoLine() protected method

Generate video line of sitemap.
protected generateVideoLine ( array $data ) : string
$data array List of parameters
return string

getFolder() public method

Returns folder to store the sitemap.xml file.
public getFolder ( ) : string
return string

getHeaderByFlag() protected method

Generate additional header with namespace adapted to the content.
protected getHeaderByFlag ( ) : string
return string

isAutoIndex() public method

Returns the status of auto generation of index site map.
public isAutoIndex ( ) : boolean
return boolean

open() public method

public open ( )

write() public method

public write ( array $data )
$data array

Property Details

$autoIndex protected_oe property

protected bool $autoIndex
return boolean

$buffer protected_oe property

protected resource $buffer
return resource

$bufferPart protected_oe property

protected int $bufferPart
return integer

$bufferSize protected_oe property

protected int $bufferSize
return integer

$bufferUrlCount protected_oe property

protected int $bufferUrlCount
return integer

$folder protected_oe property

protected string $folder
return string

$groupName protected_oe property

protected string $groupName
return string

$headers protected_oe property

protected array $headers
return array

$pattern protected_oe property

protected string $pattern
return string