/** * Returns the (partial) URL for the given page (including any section identifier). * * @param TitleValue $page The link's target * @param array $params any additional URL parameters. * * @return string */ public function getPageUrl(TitleValue $page, $params = array()) { //TODO: move the code from Linker::linkUrl here! //The below is just a rough estimation! $name = $this->formatter->getPrefixedText($page); $name = str_replace(' ', '_', $name); $name = wfUrlencode($name); $url = $this->baseUrl . $name; if ($params) { $separator = strpos($url, '?') ? '&' : '?'; $url .= $separator . wfArrayToCgi($params); } $fragment = $page->getFragment(); if ($fragment !== '') { $url = $url . '#' . wfUrlencode($fragment); } return $url; }