11) { $try = "/manual/${lang}/${first}.${prefix}${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } else { /* check for the same under other extensions */ foreach($ext as $first) { $try = "/manual/${lang}/${first}.${prefix}${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } } } } else { /* check for a gtk/gdk static function, full class or enum name */ $try = "/manual/${lang}/${prefix}${func}.php"; $constructor = "/manual/${lang}/${prefix}${func}.constructor.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$constructor")) { $try = "/manual/${lang}/${prefix}${realname}php"; $constructor = "/manual/${lang}/${prefix}${realname}constructor.php"; $full_match = $full_match + 2; $hit = array($try, $constructor); } else if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } else { $try = "/manual/${lang}/${prefix}enum.${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $try = "/manual/${lang}/${prefix}enum.${realname}php"; $full_match++; $hit[] = $try; } } } } if(!$hit) { /* go through the extension classes */ foreach($ext as $prefix) { $try = "/manual/${lang}/${prefix}.${func}.php"; $constructor = "/manual/${lang}/${prefix}.${func}.constructor.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$constructor")) { $try = "/manual/${lang}/${prefix}.${realname}php"; $constructor = "/manual/${lang}/${prefix}.${realname}constructor.php"; $full_match = $full_match + 2; $hit = array($try, $constructor); } else if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $full_match++; $hit[] = $try; } else { /* cover against futureshock - non-g*k enums */ $try = "/manual/${lang}/${prefix}.enum.${func}.php"; if (file_exists("$_SERVER[DOCUMENT_ROOT]$try")) { $try = "/manual/${lang}/${prefix}.enum.${realname}php"; $full_match++; $hit[] = $try; } } } } return $hit; } function wildcard($lang, $func, $hit) { global $classes, $full_match; $full_match = (int)0; $dir = opendir("$_SERVER[DOCUMENT_ROOT]/manual/$lang"); while(($item = readdir($dir))!== false) { $part = explode('.', $item); $gtk = $part[0]; $class = substr($part[1], 0, 3); $enum = substr($part[2], 0, 3); $method = substr($part[3], 0, 3); if($gtk == $class || $gtk == $enum || ($gtk !== "gtk" && $gtk !== "gdk")) { if(stristr($part[1], $func) || stristr($part[2], $func)) { if($part[2] !== "method" && $part[2] !== "property" && $part[2] !== "signal") { $try = "/manual/${lang}/$item"; if(file_exists("$_SERVER[DOCUMENT_ROOT]$try") && !in_array($try, $hit)) { if(stristr($part[1], $func)) $uc = $part[1]; else $uc = $part[2]; for($i = 0; $i < sizeof($classes); $i++) { if(stristr($classes[$i], "$uc.")) $pos = $i; } $realname = $classes[$pos]; if ($uc == $part[1]) { $try = "/manual/${lang}/$part[0].$realname$part[2]"; } else { $try = "/manual/${lang}/$part[0].$part[1].$realname$part[3]"; } similar_text(strtolower($func), strtolower($uc), $percent); if($percent == 100) $full_match++; if($percent > 50) $hit[] = $try; } } } } if($part[1] == "method") { if(strstr($part[2], $func)) { $try = "/manual/${lang}/$item"; if(file_exists("$_SERVER[DOCUMENT_ROOT]$try") && !in_array($try, $hit)) { similar_text(strtolower($func), strtolower($part[2]), $percent); if($percent == 100) $full_match++; if($percent > 50) $hit[] = $try; } } } if(($gtk == $class || ($gtk !== "gtk" && $gtk !== "gdk")) && strstr($part[3], $func)) { $try = "/manual/${lang}/$item"; if(file_exists("$_SERVER[DOCUMENT_ROOT]$try") && !in_array($try, $hit)) { for($i = 0; $i < sizeof($classes); $i++) { if(stristr($classes[$i], "$part[1].")) $pos = $i; } $realname = $classes[$pos]; $try = "/manual/${lang}/$part[0].$realname$part[2].$part[3].$part[4]"; similar_text(strtolower($func), strtolower($part[3]), $percent); if($percent == 100) $full_match++; if($percent > 50) $hit[] = $try; } } } closedir($dir); return $hit; } function find_manual_page($lang, $function) { $tried = 0; $hit = array(); /* fast track, single return :) */ if(strstr($function, "::")) { list($funcpre, $funcpost) = split("::", $function); $try = tryprefix($lang, $funcpost, "$funcpre.method."); if($try) return $try; } elseif(strtolower(substr($function, 0, 3)) == "gtk" || strtolower(substr($function, 0, 3 == "gdk"))) { $prefix = strtolower(substr($function, 0, 3)); $try = tryprefix($lang, $function, "$prefix."); if($try) return $try; } else { /* if there's no :: or gtk in there we could be looking for anything */ $try = wildcard($lang, $function, $hit); /* if($try) $result = array_merge($try, $result); */ if ($try) return $try; } /* if($result) { return $result; } */ return ""; } ?>