Use Title::legalChars()
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 4 May 2012 19:47:00 +0000 (21:47 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 4 May 2012 19:47:00 +0000 (21:47 +0200)
Change-Id: I6b29f29875fa54196b5899042a8f576c82a8943f

includes/Title.php
includes/parser/Parser.php
maintenance/cleanupImages.php

index b27ac7c..15945f8 100644 (file)
@@ -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 );
                }
 
index d5868a7..018715e 100644 (file)
@@ -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)|]]
index 6a6a446..687a95c 100644 (file)
@@ -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 );