$input = ereg_replace("\[\[wiki\]([[:alpha:]]+)\]", "<a href=\"http://www.wikipedia.org/wiki/\\1\">\\1</a>", $input);
That's your first question. With languages it is:
$input = ereg_replace("\[\[wiki:([[:alpha:]]+)\]([[:alpha:]]+)\]", "<a href=\"http://\\1.wikipedia.org/wiki/\\2\">\\2</a>", $input);