/
SitemapElement.php
57 lines (49 loc) · 1.37 KB
/
SitemapElement.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Concrete\Core\Page\Sitemap\Element;
use SimpleXMLElement;
abstract class SitemapElement
{
/**
* The default sitemap namespace.
*
* @var string
*/
const DEFAULT_NAMESPACE = 'http://www.sitemaps.org/schemas/sitemap/0.9';
/**
* The namespace required for the multilingual alternatives.
*
* @var string
*/
const MULTILINGUAL_NAMESPACE = 'http://www.w3.org/1999/xhtml';
/**
* The alias of the namespace required for the multilingual alternatives.
*
* @var string
*/
const MULTILINGUAL_NAMESPACE_NAME = 'xhtml';
/**
* Returns the XML representation of this element.
*
* @param string $indenter The string used to indent the XML
*
* @return string[]|null Returns NULL in case no data should be generated, the XML lines otherwise
*/
abstract public function toXmlLines($indenter = ' ');
/**
* Returns a SimpleXMLElement instance representing this element.
*
* @param null|SimpleXMLElement $parentElement
*
* @return \SimpleXMLElement|null
*/
abstract public function toXmlElement(SimpleXMLElement $parentElement = null);
/**
* Get the XML meta-header.
*
* @return string
*/
protected function getXmlMetaHeader()
{
return '<?xml version="1.0" encoding="' . APP_CHARSET . '"?>';
}
}