From fafd3e0b2667bbd65fa43d678b4924c3dfdb8e30 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 4 May 2012 21:47:00 +0200 Subject: [PATCH] Use Title::legalChars() Change-Id: I6b29f29875fa54196b5899042a8f576c82a8943f --- includes/Title.php | 3 +-- includes/parser/Parser.php | 3 +-- maintenance/cleanupImages.php | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/includes/Title.php b/includes/Title.php index b27ac7c94b..15945f8897 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -181,13 +181,12 @@ class Title { * @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 ); } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index d5868a71d0..018715e7a8 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4394,8 +4394,7 @@ class Parser { ) ); # 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)|]] diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php index 6a6a44610c..687a95ce56 100644 --- a/maintenance/cleanupImages.php +++ b/maintenance/cleanupImages.php @@ -192,9 +192,8 @@ class ImageCleanup extends TableCleanup { } private function buildSafeTitle( $name ) { - global $wgLegalTitleChars; $x = preg_replace_callback( - "/([^$wgLegalTitleChars]|~)/", + '/([^' . Title::legalChars() . ']|~)/', array( $this, 'hexChar' ), $name ); -- 2.20.1