* (bug 4783) : Fix for "{{ns:0}} does not render"
* Improved support for interwiki transclusion
* (bug 1850) Image link to nonexistent file fixed.
+* (bug 5167) Add {{SUBPAGENAME}} variable
Upload:
* (bug 2527) Always set destination filename when new file is selected
'MAG_FULLPAGENAME',
'MAG_FULLPAGENAMEE',
'MAG_RAW',
+ 'MAG_SUBPAGENAME',
);
if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) );
MAG_CURRENTWEEK,
MAG_CURRENTDOW,
MAG_REVISIONID,
+ MAG_SUBPAGENAME
);
if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) );
return $this->mTitle->getPrefixedText();
case MAG_FULLPAGENAMEE:
return $this->mTitle->getPrefixedURL();
+ case MAG_SUBPAGENAME:
+ return $this->mTitle->getSubpageText();
case MAG_REVISIONID:
return $this->mRevisionId;
case MAG_NAMESPACE:
return $text;
}
+ /**
+ * Get the lowest-level subpage name, i.e. the rightmost part after /
+ * @return string Subpage name
+ */
+ function getSubpageText() {
+ global $wgNamespacesWithSubpages;
+ if( $wgNamespacesWithSubpages[ $this->mNamespace ] ) {
+ $parts = explode( '/', $this->mTextform );
+ return( $parts[ count( $parts ) - 1 ] );
+ } else {
+ return( $this->mTextform );
+ }
+ }
+
/**
* Get a URL-encoded title (not an actual URL) including interwiki
* @return string the URL-encoded form
MAG_NAMESPACEE => array( 1, 'NAMESPACEE' ),
MAG_FULLPAGENAME => array( 1, 'FULLPAGENAME' ),
MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ),
+ MAG_SUBPAGENAME => array( 0, 'SUBPAGENAME' ),
MAG_MSG => array( 0, 'MSG:' ),
MAG_SUBST => array( 0, 'SUBST:' ),
MAG_MSGNW => array( 0, 'MSGNW:' ),