Index: trunk/phase3/includes/AjaxFunctions.php |
— | — | @@ -74,14 +74,14 @@ |
75 | 75 | } |
76 | 76 | |
77 | 77 | function wfSajaxSearch( $term ) { |
78 | | - global $wgContLang, $wgOut, $wgUser; |
| 78 | + global $wgContLang, $wgOut, $wgUser, $wgCapitalLinks; |
79 | 79 | $limit = 16; |
80 | 80 | $sk = $wgUser->getSkin(); |
81 | 81 | |
82 | 82 | $term = trim( $term ); |
83 | | - $term = str_replace( ' ', '_', $wgContLang->ucfirst( |
84 | | - $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ) |
85 | | - ) ); |
| 83 | + $term = $wgContLang->checkTitleEncoding( $wgContLang->recodeInput( js_unescape( $term ) ) ); |
| 84 | + if ( $wgCapitalLinks ) |
| 85 | + $term = $wgContLang->ucfirst( $term ); |
86 | 86 | $term_title = Title::newFromText( $term ); |
87 | 87 | |
88 | 88 | $r = $more = ''; |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | |
99 | 99 | $i = 0; |
100 | 100 | while ( ( $row = $db->fetchObject( $res ) ) && ( ++$i <= $limit ) ) { |
101 | | - $nt = Title::newFromText( $row->page_title, $row->page_namespace ); |
| 101 | + $nt = Title::makeTitle( $row->page_namespace, $row->page_title ); |
102 | 102 | $r .= '<li>' . $sk->makeKnownLinkObj( $nt ) . "</li>\n"; |
103 | 103 | } |
104 | 104 | if ( $i > $limit ) { |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | |
118 | 118 | foreach( $specialPages as $page ) { |
119 | 119 | if( $wgContLang->uc( $page ) != $page && strpos( $page, $term_title->getText() ) === 0 ) { |
120 | | - $r .= '<li>' . $sk->makeKnownLinkObj( Title::newFromText( $page, NS_SPECIAL ) ) . '</li>'; |
| 120 | + $r .= '<li>' . $sk->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, $page ) ) . '</li>'; |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | |
127 | 127 | $valid = (bool) $term_title; |
128 | 128 | $term_url = urlencode( $term ); |
129 | | - $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : str_replace( '_', ' ', $term ) ); |
| 129 | + $term_diplay = htmlspecialchars( $valid ? $term_title->getFullText() : $term ); |
130 | 130 | $subtitlemsg = ( $valid ? 'searchsubtitle' : 'searchsubtitleinvalid' ); |
131 | 131 | $subtitle = wfMsgWikiHtml( $subtitlemsg, $term_diplay ); |
132 | 132 | $html = '<div id="searchTargetHide"><a onclick="Searching_Hide_Results();">' |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | } |
176 | 176 | $watch = 'w' === $watch; |
177 | 177 | |
178 | | - $title = Title::newFromText($pagename); |
| 178 | + $title = Title::newFromDBkey($pagename); |
179 | 179 | if(!$title) { |
180 | 180 | // Invalid title |
181 | 181 | return '<err#>'; |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -273,6 +273,7 @@ |
274 | 274 | * (bug 3097) Inconsistently usable titles containing HTML character entities |
275 | 275 | are now forbidden. A run of cleanupTitles.php will fix up existing pages. |
276 | 276 | * (bug 12446) Permissions check fix for undelete link |
| 277 | +* (bug 12451) AJAX title normalization tweaks |
277 | 278 | |
278 | 279 | |
279 | 280 | == Parser changes in 1.12 == |