You are here

class XMLSitemapIndexWriter in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap.xmlsitemap.inc \XMLSitemapIndexWriter

Hierarchy

Expanded class hierarchy of XMLSitemapIndexWriter

File

./xmlsitemap.xmlsitemap.inc, line 195
XML sitemap integration functions for xmlsitemap.module.

View source
class XMLSitemapIndexWriter extends XMLSitemapWriter {
  protected $rootElement = 'sitemapindex';
  function __construct(stdClass &$sitemap, $page = 'index') {
    parent::__construct($sitemap, 'index');
  }
  public function getRootAttributes() {
    $attributes['xmlns'] = 'http://www.sitemaps.org/schemas/sitemap/0.9';
    if (variable_get('xmlsitemap_developer_mode', 0)) {
      $attributes['xmlns:xsi'] = 'http://www.w3.org/2001/XMLSchema-instance';
      $attributes['xsi:schemaLocation'] = 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd';
    }
    return $attributes;
  }
  public function generateXML() {
    $lastmod_format = variable_get('xmlsitemap_lastmod_format', XMLSITEMAP_LASTMOD_MEDIUM);
    for ($i = 1; $i <= $this->sitemap->chunks; $i++) {
      $element = array(
        'loc' => $this
          ->getSitemapUrl('sitemap.xml', array(
          'query' => array(
            'page' => $i,
          ),
        )),
        // @todo Use the actual lastmod value of the chunk file.
        'lastmod' => gmdate($lastmod_format, REQUEST_TIME),
      );
      $this
        ->writeSitemapElement('sitemap', $element);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
XMLSitemapIndexWriter::$rootElement protected property Overrides XMLSitemapWriter::$rootElement
XMLSitemapIndexWriter::generateXML public function Overrides XMLSitemapWriter::generateXML
XMLSitemapIndexWriter::getRootAttributes public function Return an array of attributes for the root element of the XML. Overrides XMLSitemapWriter::getRootAttributes
XMLSitemapIndexWriter::__construct function Constructor. Overrides XMLSitemapWriter::__construct
XMLSitemapWriter::$linkCountFlush protected property
XMLSitemapWriter::$sitemap protected property
XMLSitemapWriter::$sitemapElementCount protected property
XMLSitemapWriter::$sitemap_page protected property
XMLSitemapWriter::$uri protected property
XMLSitemapWriter::endDocument public function
XMLSitemapWriter::getSitemapElementCount public function
XMLSitemapWriter::getSitemapUrl public function
XMLSitemapWriter::getURI public function
XMLSitemapWriter::openUri public function
XMLSitemapWriter::startDocument public function
XMLSitemapWriter::startElement public function
XMLSitemapWriter::writeElement public function Write full element tag including support for nested elements.
XMLSitemapWriter::writeRaw public function Explicitly define the writeRaw() function since it is not available before PHP 5.2.
XMLSitemapWriter::writeSitemapElement public function Write an full XML sitemap element tag.
XMLSitemapWriter::writeXSL public function Add the XML stylesheet to the XML page.