function go($searchText) { global $wgOut; $expressionMeaningIds = getExpressionMeaningIds($searchText); if (count($expressionMeaningIds) > 0) { if (count($expressionMeaningIds) == 1) { $wgOut->redirect(definedMeaningIdAsURL($expressionMeaningIds[0])); } else { $wgOut->redirect(spellingAsURL($searchText)); } } else { $collectionMemberId = getAnyDefinedMeaningWithSourceIdentifier($searchText); if ($collectionMemberId != 0) { $wgOut->redirect(definedMeaningIdAsURL($collectionMemberId)); } else { $wgOut->redirect(spellingAsURL($searchText)); } } }
function spellingAsLink( $spelling, $lang = 0 ) { return createLink( spellingAsURL( $spelling, $lang ), $spelling ); }