public function addSitemap($location, $lastModified = null)
    {
        if (false === filter_var($location, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException(
                "The location must be a valid URL. You have specified: {$location}."
            );
        }

        if ($this->writer === null) {
            $this->createNewFile();
        }

        $this->writer->startElement('sitemap');
        $this->writer->writeElement('loc', $location);

        if ($lastModified !== null) {
            $this->writer->writeElement('lastmod', date('c', $lastModified));
        }
        $this->writer->endElement();
    }
public function addSitemap($location, $lastModified = null)
    {
        if (false === filter_var($location, FILTER_VALIDATE_URL)) {
            throw new \InvalidArgumentException(
                "The location must be a valid URL. You have specified: {$location}."
            );
        }

        if ($this->writer === null) {
            $this->createNewFile();
        }

        $this->writer->startElement('sitemap');
        $this->writer->writeElement('loc', $location);

        if ($lastModified !== null) {
            $this->writer->writeElement('lastmod', date('c', $lastModified));
        }
        $this->writer->endElement();
    }
public function addSitemap ( $ location , $ lastModified = null ) { if ( false === filter_var ( $ location , FILTER_VALIDATE_URL ) ) { throw new \ InvalidArgumentException ( "The location must be a valid URL. You have specified: {$location}." ) ; } if ( $ this -> writer === null ) { $ this -> createNewFile ( ) ; } $ this -> writer -> startElement ( 'sitemap' ) ; $ this -> writer -> writeElement ( 'loc' , $ location ) ; if ( $ lastModified !== null ) { $ this -> writer -> writeElement ( 'lastmod' , date ( 'c' , $ lastModified ) ) ; } $ this -> writer -> endElement ( ) ; }
Adds sitemap link to the index file

@param string $location URL of the sitemap
@param integer $lastModified unix timestamp of sitemap modification time
@throws \InvalidArgumentException
Adds sitemap link to the index file