misc.func.php
1.02 KB
<?php
// PHP xml sitemap generator
// this function generates and returns the xml sitemap at the end of the spidering process
function genXmlSitemap() {
        global $SPIDER, $CONFIG;
        $data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
        <urlset
          xmlns=\"http://www.google.com/schemas/sitemap/0.84\"
          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
          xsi:schemaLocation=\http://www.google.com/schemas/sitemap/0.84
                      http://www.google.com/schemas/sitemap/0.84/sitemap.xsd\">";
        for($i = 0; $i < sizeof($SPIDER["spider"]); $i++) {
                $data .= "<url>\n\t<loc>".$SPIDER["spider"][$i]."</loc>\n\t<priority>".$CONFIG["priority"]."</priority>\n</url>\n";
        }
        $data .= "</urlset>";
        return $data;
}
// case insensitive version of strpos ( used for compatibility with php4 )
function strposi($string, $needle) {
        $istr = strtolower($string);
        $ineedle = strtolower($needle);
        return strpos($istr, $ineedle);
}
?>