* @return Title the new object, or NULL on an error
*/
public static function newFromURL( $url ) {
- global $wgLegalTitleChars;
$t = new Title();
# For compatibility with old buggy URLs. "+" is usually not valid in titles,
# but some URLs used it as a space replacement and they still come
# from some external search tools.
- if ( strpos( $wgLegalTitleChars, '+' ) === false ) {
+ if ( strpos( self::legalChars(), '+' ) === false ) {
$url = str_replace( '+', ' ', $url );
}
) );
# Context links: [[|name]] and [[name (context)|]]
- global $wgLegalTitleChars;
- $tc = "[$wgLegalTitleChars]";
+ $tc = '[' . Title::legalChars() . ']';
$nc = '[ _0-9A-Za-z\x80-\xff-]'; # Namespaces can use non-ascii!
$p1 = "/\[\[(:?$nc+:|:|)($tc+?)( ?\\($tc+\\))\\|]]/"; # [[ns:page (context)|]]
}
private function buildSafeTitle( $name ) {
- global $wgLegalTitleChars;
$x = preg_replace_callback(
- "/([^$wgLegalTitleChars]|~)/",
+ '/([^' . Title::legalChars() . ']|~)/',
array( $this, 'hexChar' ),
$name );