30 private string $mCanonicalServer;
32 private string $mServer;
34 private string $mPath;
41 public function __construct(
string $canonicalServer,
string $path, ?
string $server =
null ) {
42 $this->mCanonicalServer = $canonicalServer;
44 $this->mServer = $server ?? $canonicalServer;
54 $host = parse_url( $this->mCanonicalServer, PHP_URL_HOST );
60 return $this->mCanonicalServer;
75 private function getLocalUrl( $page, $fragmentId =
null ) {
76 $page =
wfUrlencode( str_replace(
' ',
'_', $page ) );
78 if ( is_string( $fragmentId ) && $fragmentId !==
'' ) {
82 return str_replace(
'$1', $page, $this->mPath );
94 return $this->mCanonicalServer . $this->getLocalUrl( $page, $fragmentId );
102 return $this->mCanonicalServer;
112 public function getUrl( $page, $fragmentId =
null ) {
126 return $this->mServer . $this->getLocalUrl( $page, $fragmentId );
131class_alias( WikiReference::class,
'WikiReference' );
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...