*In SearchEngine's case, it gets caught every time further up the page (it never even reaches the upper/lower casing of only first character part)
*PrefixSearch eventually sends it through ApiQueryBase::titleToKey()
*AjaxFunctions immediately sends it to Title::newFromText()
define( 'AJAX_SEARCH_VERSION', 2 ); //AJAX search cache version
function wfSajaxSearch( $term ) {
- global $wgContLang, $wgUser, $wgCapitalLinks, $wgMemc;
+ global $wgContLang, $wgUser, $wgMemc;
$limit = 16;
$sk = $wgUser->getSkin();
$output = '';
$term = trim( $term );
$term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) );
- if ( $wgCapitalLinks )
- $term = $wgContLang->ucfirst( $term );
$term_title = Title::newFromText( $term );
$memckey = $term_title ? wfMemcKey( 'ajaxsearch', md5( $term_title->getFullText() ) ) : wfMemcKey( 'ajaxsearch', md5( $term ) );
/**
* Unless overridden by PrefixSearchBackend hook...
- * This is case-sensitive except the first letter (per $wgCapitalLinks)
+ * This is case-sensitive (First character may
+ * be automatically capitalized by Title::secureAndSpit()
+ * later on depending on $wgCapitalLinks)
*
* @param array $namespaces Namespaces to search in
* @param string $search term
* @return array of title strings
*/
protected static function defaultSearchBackend( $namespaces, $search, $limit ) {
- global $wgCapitalLinks, $wgContLang;
-
- if( $wgCapitalLinks ) {
- $search = $wgContLang->ucfirst( $search );
- }
-
$ns = array_shift($namespaces); // support only one namespace
if( in_array(NS_MAIN,$namespaces))
$ns = NS_MAIN; // if searching on many always default to main
return $title;
}
- global $wgCapitalLinks, $wgContLang;
- if( !$wgCapitalLinks ) {
- // Catch differs-by-first-letter-case-only
- $title = Title::newFromText( $wgContLang->ucfirst( $term ) );
- if ( $title && $title->exists() ) {
- return $title;
- }
- $title = Title::newFromText( $wgContLang->lcfirst( $term ) );
- if ( $title && $title->exists() ) {
- return $title;
- }
- }
-
// Give hooks a chance at better match variants
$title = null;
if( !wfRunHooks( 'SearchGetNearMatch', array( $term, &$title ) ) ) {