'."\n";
echo '
'."\n"; // hard code the index.php page to top of menu
while (false !== ($file = readdir($dh)) ) {
if (strpos($file, '.php', 1)) { // only include files with .php extension
$name = substr($file,0,strrpos($file,'.')); // strip the .php extension
$menu_status_file = $menu_status.$name.'.txt';
$visibility = @file_get_contents($menu_status_file);
if ( $visibility == 'hidden' ) {
$hidefile = $file;
} else {
$hidefile = '';
}
if ( $file!='.' && $file!='..' && $file!='index.php' && $file!='page_preview.php' && $file!=$hidefile && $file!='_site_admin.php') {
if (!in_array($file, $page_exclude)) {
$file_array[] = $file;
}
}
}
}
// Sort files by modified time, earliest to latest
array_multisort(
array_map( 'filemtime', $file_array ),
SORT_NUMERIC,
SORT_ASC, // Use SORT_ASC in place of SORT_DESC for earliest to latest
$file_array
);
if ( $menu_sort == '1' ) {
sort ($file_array); // sort pages a-z
}
foreach ($file_array as $value) { // dynamic auto title script
$title = substr($value,0,strrpos($value,'.')); // strip the .php extension
$title1 = str_replace(array('-and-','_and_'), ' & ', $title); // convert 'and' to '&'
$title2 = str_replace(array('-','_'), ' ', strtolower($title1)); // convert name to lowercase and replace hyphens/underscores...
$page_title = ucwords($title2); // capitalize first letter
$alias = @file_get_contents($menu_alias.$title.'.txt');
if ( $alias != '' ) {
$page_title = $alias;
} else {
$page_title = $page_title;
}
$button_link_check = strpos(file_get_contents($value), ''.$page_title.''."\n";
}
echo '';
closedir($dh);
?>