48 parent::__construct(
$type );
61 return str_replace(
' ',
'_',
$title );
92 public function normalizePageName( $pageName, $followRedirect = MediaWikiPageNameNormalizer::FOLLOW_REDIRECT ) {
93 if ( defined(
'MW_PHPUNIT_TEST' ) || defined(
'MW_DEV_ENV' ) ) {
99 $t = Title::newFromText( $pageName );
100 return $t->getPrefixedText();
102 static $mediaWikiPageNameNormalizer =
null;
104 if ( $mediaWikiPageNameNormalizer ===
null ) {
108 return $mediaWikiPageNameNormalizer->normalizePageName(
125 return self::PATH_PAGE;
136 return parse_url( $this->
getPath( self::PATH_PAGE ), PHP_URL_PATH );
147 return parse_url( $this->
getPath( self::PATH_FILE ), PHP_URL_PATH );
189 if ( $url ===
null ) {
193 if ( $pageName !==
false ) {
194 $pageName = $this->
toDBKey( trim( $pageName ) );
195 $url = str_replace(
'$1',
wfUrlencode( $pageName ), $url );
213 $filePath = $this->
getPath( self::PATH_FILE );
215 if ( $filePath !==
false ) {
216 $filePath = str_replace(
'$1',
$path, $filePath );
wfUrlencode( $s)
We want some things to be included as literal characters in our title URLs for prettiness,...
Service for normalizing a page name using a MediaWiki api.
setPath( $pathType, $fullUrl)
Sets the path used to construct links with.
getPath( $pathType)
Returns the path of the provided type or false if there is no such path.
getLinkPath()
Returns the path used to construct links with or false if there is no such path.