com web/php: Allow namespace\classname searches: include/manual-lookup.inc
| From: | Hannes Magnusson | Date: | Mon, 20 Apr 2015 22:56:55 +0000 |
| Subject: | com web/php: Allow namespace\classname searches: include/manual-lookup.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-21089@lists.php.net to get a copy of this message | ||
Commit: a3dcbf63dab8bb43efaa7e811ef0878dc8018408
Author: Hannes Magnusson <bjori@php.net> Mon, 20 Apr 2015 15:56:24 -0700
Parents: 5739e82155fdc760a5b6865ae4f4f22a33e7a06f
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=a3dcbf63dab8bb43efaa7e811ef0878dc8018408
Log:
Allow namespace\classname searches
Changed paths:
M include/manual-lookup.inc
Diff:
diff --git a/include/manual-lookup.inc b/include/manual-lookup.inc
index c6c612a...b2e6668 100644
--- a/include/manual-lookup.inc
+++ b/include/manual-lookup.inc
@@ -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));
}
}