+ }
+
+
+ /**
+ * Given a title, return the namespace name that would be given by the
+ * corresponding magic word
+ * Note: function name changed to "mwnamespace" rather than "namespace"
+ * to not break PHP 5.3
+ */
+ static function mwnamespace( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return str_replace( '_', ' ', $t->getNsText() );
+ }
+ static function namespacee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfUrlencode( $t->getNsText() );
+ }
+ static function talkspace( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) || !$t->canTalk() )
+ return '';
+ return str_replace( '_', ' ', $t->getTalkNsText() );
+ }
+ static function talkspacee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) || !$t->canTalk() )
+ return '';
+ return wfUrlencode( $t->getTalkNsText() );
+ }
+ static function subjectspace( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return str_replace( '_', ' ', $t->getSubjectNsText() );
+ }
+ static function subjectspacee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfUrlencode( $t->getSubjectNsText() );
+ }
+
+ /**
+ * Functions to get and normalize pagenames, corresponding to the magic words
+ * of the same names
+ */
+ static function pagename( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getText() );
+ }
+ static function pagenamee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getPartialURL() );
+ }
+ static function fullpagename( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) || !$t->canTalk() )
+ return '';
+ return wfEscapeWikiText( $t->getPrefixedText() );
+ }
+ static function fullpagenamee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) || !$t->canTalk() )
+ return '';
+ return wfEscapeWikiText( $t->getPrefixedURL() );
+ }
+ static function subpagename( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getSubpageText() );
+ }
+ static function subpagenamee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getSubpageUrlForm() );
+ }
+ static function basepagename( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getBaseText() );
+ }
+ static function basepagenamee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) );
+ }
+ static function talkpagename( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) || !$t->canTalk() )
+ return '';
+ return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
+ }
+ static function talkpagenamee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) || !$t->canTalk() )
+ return '';
+ return wfEscapeWikiText( $t->getTalkPage()->getPrefixedUrl() );
+ }
+ static function subjectpagename( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
+ }
+ static function subjectpagenamee( $parser, $title = null ) {
+ $t = Title::newFromText( $title );
+ if ( is_null( $t ) )
+ return '';
+ return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedUrl() );
+ }