Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2098,6 +2098,10 @@ |
2099 | 2099 | return $this->mTitle->getSubpageText(); |
2100 | 2100 | case MAG_SUBPAGENAMEE: |
2101 | 2101 | return $this->mTitle->getSubpageUrlForm(); |
| 2102 | + case MAG_BASEPAGENAME: |
| 2103 | + return $this->mTitle->getBaseText(); |
| 2104 | + case MAG_BASEPAGENAMEE: |
| 2105 | + return wfUrlEncode( str_replace( ' ', '_', $this->mTitle->getBaseText() ) ); |
2102 | 2106 | case MAG_TALKPAGENAME: |
2103 | 2107 | if( $this->mTitle->canTalk() ) { |
2104 | 2108 | $talkPage = $this->mTitle->getTalkPage(); |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -86,6 +86,8 @@ |
87 | 87 | 'MAG_NEWSECTIONLINK', |
88 | 88 | 'MAG_NUMBEROFPAGES', |
89 | 89 | 'MAG_CURRENTVERSION', |
| 90 | + 'MAG_BASEPAGENAME', |
| 91 | + 'MAG_BASEPAGENAMEE', |
90 | 92 | ); |
91 | 93 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
92 | 94 | wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); |
— | — | @@ -134,6 +136,8 @@ |
135 | 137 | MAG_NEWSECTIONLINK, |
136 | 138 | MAG_NUMBEROFPAGES, |
137 | 139 | MAG_CURRENTVERSION, |
| 140 | + MAG_BASEPAGENAME, |
| 141 | + MAG_BASEPAGENAMEE, |
138 | 142 | ); |
139 | 143 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
140 | 144 | wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -692,6 +692,21 @@ |
693 | 693 | } |
694 | 694 | |
695 | 695 | /** |
| 696 | + * Get the base name, i.e. the leftmost parts before the / |
| 697 | + * @return string Base name |
| 698 | + */ |
| 699 | + function getBaseText() { |
| 700 | + global $wgNamespacesWithSubpages; |
| 701 | + if( isset( $wgNamespacesWithSubpages[ $this->mNamespace] ) && $wgNamespacesWithSubpages[ $this->mNamespace ] ) { |
| 702 | + $parts = explode( '/', $this->getText() ); |
| 703 | + unset( $parts[ count( $parts ) - 1 ] ); |
| 704 | + return implode( '/', $parts ); |
| 705 | + } else { |
| 706 | + return $this->getText(); |
| 707 | + } |
| 708 | + } |
| 709 | + |
| 710 | + /** |
696 | 711 | * Get the lowest-level subpage name, i.e. the rightmost part after / |
697 | 712 | * @return string Subpage name |
698 | 713 | */ |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -261,6 +261,7 @@ |
262 | 262 | * (bug 5935) Improvement to German localisation (de) |
263 | 263 | * (bug 5937) Register links from gallery captions with the parent parser output |
264 | 264 | object so that link tables receive those updates too |
| 265 | +* (bug 5845) Introduce BASEPAGENAME and BASEPAGENAMEE magic words |
265 | 266 | |
266 | 267 | == Compatibility == |
267 | 268 | |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -242,6 +242,8 @@ |
243 | 243 | MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ), |
244 | 244 | MAG_SUBPAGENAME => array( 1, 'SUBPAGENAME' ), |
245 | 245 | MAG_SUBPAGENAMEE => array( 1, 'SUBPAGENAMEE' ), |
| 246 | + MAG_BASEPAGENAME => array( 1, 'BASEPAGENAME' ), |
| 247 | + MAG_BASEPAGENAMEE => array( 1, 'BASEPAGENAMEE' ), |
246 | 248 | MAG_TALKPAGENAME => array( 1, 'TALKPAGENAME' ), |
247 | 249 | MAG_TALKPAGENAMEE => array( 1, 'TALKPAGENAMEE' ), |
248 | 250 | MAG_SUBJECTPAGENAME => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ), |