src/Rah/Sitemap.php
private function addUrl($url, $lastmod = null): self
    {
        if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
            $url = hu.ltrim($url, '/');
        }

        if (preg_match('/[\'"<>]/', $url)) {
            $url = htmlspecialchars($url, ENT_QUOTES);
        }

        if (isset($this->addUrlset[$url])) {
            return $this;
        }

        if ($lastmod !== null) {
            if (!is_int($lastmod)) {
                $lastmod = strtotime($lastmod);
            }

            if ($lastmod !== false) {
                $lastmod = safe_strftime('iso8601', $lastmod);
            }
        }

        $this->addUrlset[$url] =
            '<url>'.
                '<loc>'.$url.'</loc>'.
                ($lastmod ? '<lastmod>'.$lastmod.'</lastmod>' : '').
            '</url>';

        return $this;
    }
private function addUrl($url, $lastmod = null): self
    {
        if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
            $url = hu.ltrim($url, '/');
        }

        if (preg_match('/[\'"<>]/', $url)) {
            $url = htmlspecialchars($url, ENT_QUOTES);
        }

        if (isset($this->addUrlset[$url])) {
            return $this;
        }

        if ($lastmod !== null) {
            if (!is_int($lastmod)) {
                $lastmod = strtotime($lastmod);
            }

            if ($lastmod !== false) {
                $lastmod = safe_strftime('iso8601', $lastmod);
            }
        }

        $this->addUrlset[$url] =
            '<url>'.
                '<loc>'.$url.'</loc>'.
                ($lastmod ? '<lastmod>'.$lastmod.'</lastmod>' : '').
            '</url>';

        return $this;
    }
private function addUrl ( $ url , $ lastmod = null ) : self { if ( strpos ( $ url , 'http://' ) !== 0 && strpos ( $ url , 'https://' ) !== 0 ) { $ url = hu . ltrim ( $ url , '/' ) ; } if ( preg_match ( '/[\'"<>]/' , $ url ) ) { $ url = htmlspecialchars ( $ url , ENT_QUOTES ) ; } if ( isset ( $ this -> addUrlset [ $ url ] ) ) { return $ this ; } if ( $ lastmod !== null ) { if ( ! is_int ( $ lastmod ) ) { $ lastmod = strtotime ( $ lastmod ) ; } if ( $ lastmod !== false ) { $ lastmod = safe_strftime ( 'iso8601' , $ lastmod ) ; } } $ this -> addUrlset [ $ url ] = '<url>' . '<loc>' . $ url . '</loc>' . ( $ lastmod ? '<lastmod>' . $ lastmod . '</lastmod>' : '' ) . '</url>' ; return $ this ; }
Renders a &lt;url&gt; element to the XML document.

@param  string     $url     The URL
@param  int|string $lastmod The modification date
@return $this
Renders a &lt ; url&gt ; element to the XML document .