com web/php: Allow namespace\classname searches: include/manual-lookup.inc

[email protected] (Hannes Magnusson)
Newsgroups php.webmaster
Message-ID <[email protected]>
Commit:    a3dcbf63dab8bb43efaa7e811ef0878dc8018408
Author:    Hannes Magnusson <[email protected]>         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));
             }
         }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.