Skip to content

Commit

Permalink
Allow namespace\classname searches
Browse files Browse the repository at this point in the history
  • Loading branch information
bjori committed Apr 20, 2015
1 parent 5739e82 commit a3dcbf6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/manual-lookup.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
}
Expand Down Expand Up @@ -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));
}
}

Expand Down

0 comments on commit a3dcbf6

Please sign in to comment.