Index: trunk/phase3/includes/Title.php |
— | — | @@ -2206,21 +2206,11 @@ |
2207 | 2207 | } |
2208 | 2208 | return $p . $name; |
2209 | 2209 | } |
2210 | | - |
2211 | | - /** |
2212 | | - * Secure and split - main initialisation function for this object |
2213 | | - * |
2214 | | - * Assumes that mDbkeyform has been set, and is urldecoded |
2215 | | - * and uses underscores, but not otherwise munged. This function |
2216 | | - * removes illegal characters, splits off the interwiki and |
2217 | | - * namespace prefixes, sets the other forms, and canonicalizes |
2218 | | - * everything. |
2219 | | - * @return \type{\bool} true on success |
2220 | | - */ |
2221 | | - private function secureAndSplit() { |
2222 | | - global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks; |
2223 | | - |
2224 | | - # Initialisation |
| 2210 | + |
| 2211 | + // Returns a simple regex that will match on characters and sequences invalid in titles. |
| 2212 | + // Note that this doesn't pick up many things that could be wrong with titles, but that |
| 2213 | + // replacing this regex with something valid will make many titles valid. |
| 2214 | + static function getTitleInvalidRegex() { |
2225 | 2215 | static $rxTc = false; |
2226 | 2216 | if( !$rxTc ) { |
2227 | 2217 | # Matching titles will be held as illegal. |
— | — | @@ -2236,7 +2226,26 @@ |
2237 | 2227 | '|&#x[0-9A-Fa-f]+;' . |
2238 | 2228 | '/S'; |
2239 | 2229 | } |
| 2230 | + |
| 2231 | + return $rxTc; |
| 2232 | + } |
2240 | 2233 | |
| 2234 | + /** |
| 2235 | + * Secure and split - main initialisation function for this object |
| 2236 | + * |
| 2237 | + * Assumes that mDbkeyform has been set, and is urldecoded |
| 2238 | + * and uses underscores, but not otherwise munged. This function |
| 2239 | + * removes illegal characters, splits off the interwiki and |
| 2240 | + * namespace prefixes, sets the other forms, and canonicalizes |
| 2241 | + * everything. |
| 2242 | + * @return \type{\bool} true on success |
| 2243 | + */ |
| 2244 | + private function secureAndSplit() { |
| 2245 | + global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks; |
| 2246 | + |
| 2247 | + # Initialisation |
| 2248 | + $rxTc = self::getTitleInvalidRegex(); |
| 2249 | + |
2241 | 2250 | $this->mInterwiki = $this->mFragment = ''; |
2242 | 2251 | $this->mNamespace = $this->mDefaultNamespace; # Usually NS_MAIN |
2243 | 2252 | |