From e16e1e898c8656d74046623f4b3b62b304c60b6f Mon Sep 17 00:00:00 2001 From: Leon Weber Date: Tue, 12 Dec 2006 19:14:29 +0000 Subject: [PATCH] Added Title::isSubpage() --- RELEASE-NOTES | 2 +- includes/Title.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e187f42daa..72ffd6296b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 == diff --git a/includes/Title.php b/includes/Title.php index c52ea244c2..dce53d1e73 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -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 -- 2.20.1