r13166 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r13165‎ | r13166 | r13167 >
Date:23:29, 4 March 2006
Author:robchurch
Status:old
Tags:
Comment:
(bug 5167) Add {{SUBPAGENAME}} variable
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/MagicWord.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -2022,6 +2022,8 @@
20232023 return $this->mTitle->getPrefixedText();
20242024 case MAG_FULLPAGENAMEE:
20252025 return $this->mTitle->getPrefixedURL();
 2026+ case MAG_SUBPAGENAME:
 2027+ return $this->mTitle->getSubpageText();
20262028 case MAG_REVISIONID:
20272029 return $this->mRevisionId;
20282030 case MAG_NAMESPACE:
Index: trunk/phase3/includes/MagicWord.php
@@ -70,6 +70,7 @@
7171 'MAG_FULLPAGENAME',
7272 'MAG_FULLPAGENAMEE',
7373 'MAG_RAW',
 74+ 'MAG_SUBPAGENAME',
7475 );
7576 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
7677 wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) );
@@ -102,6 +103,7 @@
103104 MAG_CURRENTWEEK,
104105 MAG_CURRENTDOW,
105106 MAG_REVISIONID,
 107+ MAG_SUBPAGENAME
106108 );
107109 if ( ! defined( 'MEDIAWIKI_INSTALL' ) )
108110 wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) );
Index: trunk/phase3/includes/Title.php
@@ -677,6 +677,20 @@
678678 }
679679
680680 /**
 681+ * Get the lowest-level subpage name, i.e. the rightmost part after /
 682+ * @return string Subpage name
 683+ */
 684+ function getSubpageText() {
 685+ global $wgNamespacesWithSubpages;
 686+ if( $wgNamespacesWithSubpages[ $this->mNamespace ] ) {
 687+ $parts = explode( '/', $this->mTextform );
 688+ return( $parts[ count( $parts ) - 1 ] );
 689+ } else {
 690+ return( $this->mTextform );
 691+ }
 692+ }
 693+
 694+ /**
681695 * Get a URL-encoded title (not an actual URL) including interwiki
682696 * @return string the URL-encoded form
683697 * @access public
Index: trunk/phase3/RELEASE-NOTES
@@ -277,6 +277,7 @@
278278 * (bug 4783) : Fix for "{{ns:0}} does not render"
279279 * Improved support for interwiki transclusion
280280 * (bug 1850) Image link to nonexistent file fixed.
 281+* (bug 5167) Add {{SUBPAGENAME}} variable
281282
282283 Upload:
283284 * (bug 2527) Always set destination filename when new file is selected
Index: trunk/phase3/languages/Language.php
@@ -226,6 +226,7 @@
227227 MAG_NAMESPACEE => array( 1, 'NAMESPACEE' ),
228228 MAG_FULLPAGENAME => array( 1, 'FULLPAGENAME' ),
229229 MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ),
 230+ MAG_SUBPAGENAME => array( 0, 'SUBPAGENAME' ),
230231 MAG_MSG => array( 0, 'MSG:' ),
231232 MAG_SUBST => array( 0, 'SUBST:' ),
232233 MAG_MSGNW => array( 0, 'MSGNW:' ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r13433(bug 5167) Add SUBPAGENAMEErobchurch16:19, 2 April 2006

Status & tagging log