r6792 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r6791‎ | r6792 | r6793 >
Date:10:09, 23 December 2004
Author:kateturner
Status:old
Tags:
Comment:
generate slightly more valid xhtml
Modified paths:
  • /trunk/extensions/LuceneSearch.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LuceneSearch.php
@@ -61,7 +61,7 @@
6262 $limit = $wgRequest->getInt("limit");
6363 if ($limit < 1 || $limit > 50)
6464 $limit = 20;
65 - header("Content-Type: text/plain; charset=ISO_8859-1");
 65+ header("Content-Type: text/plain; charset=UTF-8");
6666 if (strlen($q) < 1)
6767 wfAbruptExit();
6868
@@ -121,16 +121,16 @@
122122 $titles = $this->doTitleMatches($q);
123123 if (count($titles) > 0) {
124124 $sk =& $wgUser->getSkin();
125 - $nmtext = "<p>".wfMsg('searchnearmatches');
 125+ $nmtext = "<p>".wfMsg('searchnearmatches')."</p>";
126126 $i = 0;
127 - $wgOut->addHTML("<ul>");
 127+ $nmtext .= "<ul>";
128128 foreach ($titles as $title) {
129129 if (++$i > 5) break;
130130 $nmtext .= wfMsg('searchnearmatch',
131131 $sk->makeKnownLinkObj($title, ''));
132132 }
133133 $nmtext .= "</ul>";
134 - $nmtext .= "<hr/></p>";
 134+ $nmtext .= "<hr/>";
135135 }
136136 }
137137
@@ -151,7 +151,7 @@
152152
153153 $top = wfMsg("searchnumber", $offset + 1,
154154 min($numresults, $offset+$limit), $numresults);
155 - $out = "<ul start=".($offset + 1).">";
 155+ $out = "<ul>";
156156 $chunks = array_chunk($results, $limit);
157157 $numchunks = ceil($numresults / $limit);
158158 $whichchunk = $offset / $limit;
@@ -182,7 +182,7 @@
183183 foreach ($chunks[$whichchunk] as $result) {
184184 $out .= $this->showHit($result[0], $result[1], $contextWords);
185185 }
186 - $out .= "</ol>";
 186+ $out .= "</ul>";
187187 }
188188 $wgOut->addHTML("<hr/>" . $top . $out);
189189 $wgOut->addHTML("<hr/>" . $prevnext);
@@ -389,7 +389,7 @@
390390 function makeSuggestJS() {
391391 global $wgScript;
392392 return <<<___EOF___
393 -<script language="javascript">
 393+<script type="text/javascript"><!--
394394
395395 var xmlHttp = (window.XMLHttpRequest) ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
396396 var searchCache = {};
@@ -398,14 +398,12 @@
399399
400400 function getResults()
401401 {
402 -// alert(searchStr)
403 - //xmlHttp.open("GET", "$wgScript?title=Special:Search?gen=titlematch&ns0=0&limit=10&search=" + escape(searchStr), true);
404402 var encStr = escape(searchStr.replace(/ /g, '_'));
405 - xmlHttp.open("GET", "/w/Special:Search?gen=titlematch&ns0=0&limit=10&search=" + encStr, true);
 403+ xmlHttp.open("GET", "$wgScript?title=Special:Search&gen=titlematch&ns0=0&limit=10&search="
 404+ + encStr, true);
406405
407406 xmlHttp.onreadystatechange = parseResults;
408407 xmlHttp.send(null);
409 - //document.getElementById("results").innerHTML = "Loading...";
410408 }
411409
412410 function parseResults()
@@ -460,7 +458,7 @@
461459 document.getElementById("results").style.display = "none";
462460 }
463461 }
464 -</script>
 462+//--></script>
465463 ___EOF___;
466464 }
467465 }

Status & tagging log