Fix warnings and enforce conventions in ContentHandler tests.
[lhc/web/wiklou.git] / includes / Skin.php
index 00eb5e8..24d48bc 100644 (file)
@@ -290,8 +290,8 @@ abstract class Skin extends ContextSource {
                        return $this->mRelevantUser;
                }
                $title = $this->getRelevantTitle();
-               if( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) {
-                       $rootUser = strtok( $title->getText(), '/' );
+               if( $title->hasSubjectNamespace( NS_USER ) ) {
+                       $rootUser = $title->getRootText();
                        if ( User::isIP( $rootUser ) ) {
                                $this->mRelevantUser = User::newFromName( $rootUser, false );
                        } else {
@@ -1063,7 +1063,7 @@ abstract class Skin extends ContextSource {
         * @return String URL
         */
        static function makeInternalOrExternalUrl( $name ) {
-               if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $name ) ) {
+               if ( preg_match( '/^(?i:' . wfUrlProtocols() . ')/', $name ) ) {
                        return $name;
                } else {
                        return self::makeUrl( $name );
@@ -1227,7 +1227,7 @@ abstract class Skin extends ContextSource {
                                                $text = $line[1];
                                        }
 
-                                       if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) {
+                                       if ( preg_match( '/^(?i:' . wfUrlProtocols() . ')/', $link ) ) {
                                                $href = $link;
 
                                                // Parser::getExternalLinkAttribs won't work here because of the Namespace things
@@ -1536,6 +1536,7 @@ abstract class Skin extends ContextSource {
         *
         * @param $fname String Name of called method
         * @param $args Array Arguments to the method
+        * @throws MWException
         * @return mixed
         */
        function __call( $fname, $args ) {