Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2022,6 +2022,8 @@ |
2023 | 2023 | return $this->mTitle->getPrefixedText(); |
2024 | 2024 | case MAG_FULLPAGENAMEE: |
2025 | 2025 | return $this->mTitle->getPrefixedURL(); |
| 2026 | + case MAG_SUBPAGENAME: |
| 2027 | + return $this->mTitle->getSubpageText(); |
2026 | 2028 | case MAG_REVISIONID: |
2027 | 2029 | return $this->mRevisionId; |
2028 | 2030 | case MAG_NAMESPACE: |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -70,6 +70,7 @@ |
71 | 71 | 'MAG_FULLPAGENAME', |
72 | 72 | 'MAG_FULLPAGENAMEE', |
73 | 73 | 'MAG_RAW', |
| 74 | + 'MAG_SUBPAGENAME', |
74 | 75 | ); |
75 | 76 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
76 | 77 | wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); |
— | — | @@ -102,6 +103,7 @@ |
103 | 104 | MAG_CURRENTWEEK, |
104 | 105 | MAG_CURRENTDOW, |
105 | 106 | MAG_REVISIONID, |
| 107 | + MAG_SUBPAGENAME |
106 | 108 | ); |
107 | 109 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
108 | 110 | wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -677,6 +677,20 @@ |
678 | 678 | } |
679 | 679 | |
680 | 680 | /** |
| 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 | + /** |
681 | 695 | * Get a URL-encoded title (not an actual URL) including interwiki |
682 | 696 | * @return string the URL-encoded form |
683 | 697 | * @access public |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -277,6 +277,7 @@ |
278 | 278 | * (bug 4783) : Fix for "{{ns:0}} does not render" |
279 | 279 | * Improved support for interwiki transclusion |
280 | 280 | * (bug 1850) Image link to nonexistent file fixed. |
| 281 | +* (bug 5167) Add {{SUBPAGENAME}} variable |
281 | 282 | |
282 | 283 | Upload: |
283 | 284 | * (bug 2527) Always set destination filename when new file is selected |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -226,6 +226,7 @@ |
227 | 227 | MAG_NAMESPACEE => array( 1, 'NAMESPACEE' ), |
228 | 228 | MAG_FULLPAGENAME => array( 1, 'FULLPAGENAME' ), |
229 | 229 | MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ), |
| 230 | + MAG_SUBPAGENAME => array( 0, 'SUBPAGENAME' ), |
230 | 231 | MAG_MSG => array( 0, 'MSG:' ), |
231 | 232 | MAG_SUBST => array( 0, 'SUBST:' ), |
232 | 233 | MAG_MSGNW => array( 0, 'MSGNW:' ), |