1
0
mirror of https://github.com/php/web-php.git synced 2026-03-24 23:32:16 +01:00

Allow namespace\classname searches

This commit is contained in:
Hannes Magnusson
2015-04-20 15:56:24 -07:00
parent 5739e82155
commit a3dcbf63da

View File

@@ -39,6 +39,13 @@ function tryprefix($lang, $keyword, $prefix)
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . $try)) { return $try; }
}
// Replace namespace sperators, and try that (if different)
$noul = str_replace("\\", "-", $keyword);
if ($noul != $keyword) {
$try = "/manual/${lang}/${prefix}${noul}.php";
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . $try)) { return $try; }
}
// Nothing found
return "";
}
@@ -169,7 +176,7 @@ function find_manual_page($lang, $keyword)
$stm = $dbh->prepare($SQL);
if ($stm) {
$stm->execute(array($lang, $keyword, str_replace(' ', '', $keyword), str_replace(' ', '-', $keyword), str_replace('-', '', $keyword), $keyword));
$stm->execute(array($lang, $keyword, str_replace('\\', '-', $keyword), str_replace(' ', '', $keyword), str_replace(' ', '-', $keyword), str_replace('-', '', $keyword), $keyword));
}
}