Added Title::isSubpage()
authorLeon Weber <leon@users.mediawiki.org>
Tue, 12 Dec 2006 19:14:29 +0000 (19:14 +0000)
committerLeon Weber <leon@users.mediawiki.org>
Tue, 12 Dec 2006 19:14:29 +0000 (19:14 +0000)
RELEASE-NOTES
includes/Title.php

index e187f42..72ffd62 100644 (file)
@@ -292,7 +292,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * User::setPassword() now throws PasswordError exceptions if the password
   is illegal or cannot be set via $wgAuth. These can be caught and a human-
   readable error message displayed by UI code.
-
+* Added Title::isSubpage()
 
 == Languages updated ==
 
index c52ea24..dce53d1 100644 (file)
@@ -1217,6 +1217,16 @@ class Title {
                return Namespace::isTalk( $this->getNamespace() );
        }
 
+       /**
+        * Is this a subpage?
+        * @return bool
+        * @access public
+        */
+       function isSubpage() {
+               global $wgNamespacesWithSubpages;
+               return ( strpos( $this->getText(), '/' ) !== false && $wgNamespacesWithSubpages[ $this->mNamespace ] == true );
+       }
+
        /**
         * Is this a .css or .js subpage of a user page?
         * @return bool