 |
On May 9, 2010 |
|
|
tag. The script will
// try to extract the from these files. Any file types indexed
// that are NOT in this array will simply use the file name and not
// attempt to get the title.
$htmltypes=array(
".php",
".html",
".htm",
".shtm",
".sthml",
);
// Files and/or directories to ignore. Anything in this array will not
// be included in the site map.
$ignore=array(
".htaccess",
"cgi-bin",
"error_log",
"images",
"index.htm",
"index.html",
"index.php",
"robots.txt",
"PHPWgetSitemap.php",
"IAM_BabelFish_Translate.class.php",
"header.php",
"notfound.php",
"left.php",
"center.php",
"right.php",
"header_tag.php",
"footer.php",
"captcha.php",
"captcha_image.php",
"hts-log.txt",
"host",
"hts-cache",
"cronlogs",
"_private",
"_vti_bin",
"_vti_cnf",
"_vti_log",
"_vti_pvt",
"_vti_txt",
"_vti_inf.html",
"postinfo.html",
//change below and add any files or folders you do not need in the sitemap
"insurancetop.com",
"img"
);
/*
==============================================
You should not need to make changes below here
==============================================
*/
?>
\n";
$id++;
$divs="";
if(substr($startin,strlen($startin)-1,1)=="/")
$startin=trim($startin,"/");
foreach($types as $type){
if (file_exists($_SERVER['DOCUMENT_ROOT']."$startin/index$type")){
$index=$_SERVER['DOCUMENT_ROOT']."$startin"."/index$type";
break;
}
}
$types=join($types,"|");
$types="($types)";
if(!is_array($htmltypes))
$htmltypes=array();
if(count($htmltypes)==0)
$htmltypes=$types;
if(!$imgpath)
$imgpath=".";
echo " ".getTitle($index)."\n";
showlist($_SERVER['DOCUMENT_ROOT']."$startin");
echo " \n";
if (is_array($divs)){
$divs="'".join($divs,"','")."'";
echo "\n";
}
?>
//Do not edit below
function showlist($path){
global $ignore, $id, $divs, $imgpath, $types, $startin;
$dirs=array();
$files=array();
if(is_dir($path)){
if ($dir = @opendir($path)) {
while (($file = readdir($dir)) !== false) {
if ($file!="." && $file!=".." && !in_array($file,$ignore)){
if (is_dir("$path/$file")){
if (file_exists("$path/$file/index.php"))
$dirs[$file]=getTitle("$path/$file/index.php");
elseif (file_exists("$path/$file/index.html"))
$dirs[$file]=getTitle("$path/$file/index.html");
elseif (file_exists("$path/$file/index.htm"))
$dirs[$file]=getTitle("$path/$file/index.htm");
else
$dirs[$file]=$file;
} else {
if (ereg("$types$", $file)){
$files[$file]=getTitle("$path/$file");
if (strlen($files[$file])==0)
$files[$file]=$file;
}
}
}
}
closedir($dir);
}
natcasesort($dirs);
$url=str_replace($_SERVER['DOCUMENT_ROOT'],"",$path);
$n=substr_count("$url/$","/");
$base=substr_count($startin,"/")+1;
$indent=str_pad("",$n-1,"\t");
echo "$indent\n";
if ($n>$base)
$divs[]="$id";
$imgsrc="minus";
foreach($dirs as $d=>$t){
$id++;
echo "$indent\t ";
echo " ";
echo " $t\n";
showlist("$path/$d");
echo "$indent\t \n";
}
natcasesort($files);
$id++;
foreach($files as $f=>$t){
echo "$indent\t $t \n";
}
echo "$indent \n";
}
}
function getTitle($file){
global $htmltypes;
$title="";
$p=pathinfo($file);
if(!in_array(strtolower($p['extension']),$htmltypes)){
$f=file_get_contents($file);
if(preg_match("'(.+)'i", $f, $matches)){
$title=$matches[1];
}
}
$title=$title?$title:basename($file);
return htmlentities(trim(strip_tags($title)));
}
?>
|


|
|
 |