r52415 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52414‎ | r52415 | r52416 >
Date:21:19, 25 June 2009
Author:yaron
Status:deferred
Tags:
Comment:
'autocomplete on category' prevents repeated values
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.inc
@@ -266,10 +266,12 @@
267267 }
268268 } else {
269269 $cur_value = str_replace("_", " ", $row['page_title']);
270 - if ($substring == null)
271 - $pages[] = $cur_value;
272 - else
273 - $pages[] = array('title' => $cur_value);
 270+ if (! in_array($cur_value, $pages)) {
 271+ if ($substring == null)
 272+ $pages[] = $cur_value;
 273+ else
 274+ $pages[] = array('title' => $cur_value);
 275+ }
274276 // return if we've reached the maximum number of allowed values
275277 if (count($pages) > $sfgMaxAutocompleteValues)
276278 return $pages;

Status & tagging log