public function getURL()
{
$url = Config::PATH;
foreach ($this->path as $part) {
$url .= '/' . strtr(str_replace('_', '%5F', urlencode($part)), '+', '_');
}
if ($this->object instanceof GitTree) {
$url .= '/';
}
return $url;
}
public static function parseLinkTarget($ref) { $ref = strtr($ref, "\n", ' '); $parts = explode(':', $ref, 2); $valid = -1; if (count($parts) == 1) { $page = new WikiPage(explode('/', $ref)); $valid = $page->isValid(); $url = $page->getURL(); } else { if ($parts[0] == 'wp') { $url = 'http://en.wikipedia.org/wiki/' . strtr(implode('/', array_map('urlencode', explode('/', $parts[1]))), '+', '_'); $ref = $parts[1] . ' (Wikipedia)'; } else { $url = $ref; } } return array($url, $ref, $valid); }