r45738 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45737‎ | r45738 | r45739 >
Date:18:19, 14 January 2009
Author:mkroetzsch
Status:deferred
Tags:
Comment:
Use nofollow in navigational links, smarter adjustment of results per page if overall max limit is low
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -255,14 +255,14 @@
256256 $i++;
257257 }
258258 $result .= '<input type="hidden" name="sc" value="' . $i . '"/>';
259 - $result .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail . '&eq=yes&sc=1')) . '">' . wfMsg('smw_add_sortcondition') . '</a>'; // note that $urltail uses a , separated list for sorting, so setting sc to 1 always adds one new condition
 259+ $result .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail . '&eq=yes&sc=1')) . '" rel="nofollow">' . wfMsg('smw_add_sortcondition') . '</a>'; // note that $urltail uses a , separated list for sorting, so setting sc to 1 always adds one new condition
260260 }
261261 $result .= '<br /><input type="submit" value="' . wfMsg('smw_ask_submit') . '"/>' .
262262 '<input type="hidden" name="eq" value="yes"/>' .
263 - ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail)) . '">' . wfMsg('smw_ask_hidequery') . '</a> | <a href="' . htmlspecialchars(wfMsg('smw_ask_doculink')) . '">' . wfMsg('smw_ask_help') . '</a>' .
 263+ ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail)) . '" rel="nofollow">' . wfMsg('smw_ask_hidequery') . '</a> | <a href="' . htmlspecialchars(wfMsg('smw_ask_doculink')) . '">' . wfMsg('smw_ask_help') . '</a>' .
264264 "\n</form><br />";
265265 } else {
266 - $result .= '<p><a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail . '&eq=yes')) . '">' . wfMsg('smw_ask_editquery') . '</a></p>';
 266+ $result .= '<p><a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask',$urltail . '&eq=yes')) . '" rel="nofollow">' . wfMsg('smw_ask_editquery') . '</a></p>';
267267 }
268268 return $result;
269269 }
@@ -277,7 +277,7 @@
278278 $limit = $this->m_params['limit'];
279279 // prepare navigation bar
280280 if ($offset > 0) {
281 - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . $urltail)) . '">' . wfMsg('smw_result_prev') . '</a>';
 281+ $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . $urltail)) . '" rel="nofollow">' . wfMsg('smw_result_prev') . '</a>';
282282 } else {
283283 $navigation = wfMsg('smw_result_prev');
284284 }
@@ -285,22 +285,18 @@
286286 $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + $res->getCount()) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
287287
288288 if ($res->hasFurtherResults())
289 - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . ($offset+$limit) . '&limit=' . $limit . $urltail)) . '">' . wfMsg('smw_result_next') . '</a>';
 289+ $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . ($offset+$limit) . '&limit=' . $limit . $urltail)) . '" rel="nofollow">' . wfMsg('smw_result_next') . '</a>';
290290 else $navigation .= wfMsg('smw_result_next');
291291
292 - $max = false; $first=true;
 292+ $first=true;
293293 foreach (array(20,50,100,250,500) as $l) {
294 - if ($max) continue;
 294+ if ($l > $smwgQMaxLimit) break;
295295 if ($first) {
296296 $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(';
297297 $first = false;
298298 } else $navigation .= ' | ';
299 - if ($l > $smwgQMaxLimit) {
300 - $l = $smwgQMaxLimit;
301 - $max = true;
302 - }
303299 if ( $limit != $l ) {
304 - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . $offset . '&limit=' . $l . $urltail)) . '">' . $l . '</a>';
 300+ $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . $offset . '&limit=' . $l . $urltail)) . '" rel="nofollow">' . $l . '</a>';
305301 } else {
306302 $navigation .= '<b>' . $l . '</b>';
307303 }
@@ -353,13 +349,13 @@
354350
355351 // prepare navigation bar
356352 if ($offset > 0)
357 - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '">' . wfMsg('smw_result_prev') . '</a>';
 353+ $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '" rel="nofollow">' . wfMsg('smw_result_prev') . '</a>';
358354 else $navigation = wfMsg('smw_result_prev');
359355
360356 $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + $res->getCount()) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
361357
362358 if ($res->hasFurtherResults())
363 - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . ($offset+$limit) . '&limit=' . $limit . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '">' . wfMsg('smw_result_next') . '</a>';
 359+ $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . ($offset+$limit) . '&limit=' . $limit . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '" rel="nofollow">' . wfMsg('smw_result_next') . '</a>';
364360 else $navigation .= wfMsg('smw_result_next');
365361
366362 $max = false; $first=true;
@@ -374,7 +370,7 @@
375371 $max = true;
376372 }
377373 if ( $limit != $l ) {
378 - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . $offset . '&limit=' . $l . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '">' . $l . '</a>';
 374+ $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . $offset . '&limit=' . $l . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '" rel="nofollow">' . $l . '</a>';
379375 } else {
380376 $navigation .= '<b>' . $l . '</b>';
381377 }

Status & tagging log