function auto_complete_person($val, $result_limit = '5', $format = 'ac_line', &$match_count = '', &$person_ary = array()) { $dbr =& wfGetDB(DB_SLAVE); //first check the nick names: $nick_rows = MV_SpecialMediaSearch::getViaNickname($val, $result_limit); foreach ($nick_rows as $person) { $person_ary[$person] = true; } $result = $dbr->select('categorylinks', 'cl_sortkey', array('cl_to' => 'Person', '`cl_sortkey` LIKE \'%' . mysql_escape_string($val) . '%\' COLLATE latin1_swedish_ci'), __METHOD__, array('LIMIT' => $result_limit)); $out = ''; while ($row = $dbr->fetchObject($result)) { $person_name = $row->cl_sortkey; $person_ary[$person_name] = true; } if (count($person_ary) == 0) { return ''; } foreach ($person_ary as $person_name => $na) { // make sure the person page exists: $personTitle = Title::makeTitle(NS_MAIN, $person_name); if ($personTitle->exists()) { // dont try and get person full name from semantic table if available $person_full_name = $person_name; // format and output the line: $out .= MV_SpecialMediaSearch::format_ac_line($person_full_name, $val, '', MV_SpecialMediaSearch::getPersonImageURL($person_name), $format); } } // $out.='</ul>'; // return people people in the Person Category return $out; }