Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2097,12 +2097,40 @@ |
2098 | 2098 | return $this->mTitle->getSubpageText(); |
2099 | 2099 | case MAG_SUBPAGENAMEE: |
2100 | 2100 | return $this->mTitle->getSubpageUrlForm(); |
| 2101 | + case MAG_TALKPAGENAME: |
| 2102 | + if( $this->mTitle->canTalk() ) { |
| 2103 | + $talkPage = $this->mTitle->getTalkPage(); |
| 2104 | + return $talkPage->getPrefixedText(); |
| 2105 | + } else { |
| 2106 | + return ''; |
| 2107 | + } |
| 2108 | + case MAG_TALKPAGENAMEE: |
| 2109 | + if( $this->mTitle->canTalk() ) { |
| 2110 | + $talkPage = $this->mTitle->getTalkPage(); |
| 2111 | + return $talkPage->getPrefixedUrl(); |
| 2112 | + } else { |
| 2113 | + return ''; |
| 2114 | + } |
| 2115 | + case MAG_SUBJECTPAGENAME: |
| 2116 | + $subjPage = $this->mTitle->getSubjectPage(); |
| 2117 | + return $subjPage->getPrefixedText(); |
| 2118 | + case MAG_SUBJECTPAGENAMEE: |
| 2119 | + $subjPage = $this->mTitle->getSubjectPage(); |
| 2120 | + return $subjPage->getPrefixedUrl(); |
2101 | 2121 | case MAG_REVISIONID: |
2102 | 2122 | return $this->mRevisionId; |
2103 | 2123 | case MAG_NAMESPACE: |
2104 | 2124 | return $wgContLang->getNsText( $this->mTitle->getNamespace() ); |
2105 | 2125 | case MAG_NAMESPACEE: |
2106 | 2126 | return wfUrlencode( $wgContLang->getNsText( $this->mTitle->getNamespace() ) ); |
| 2127 | + case MAG_TALKSPACE: |
| 2128 | + return $this->mTitle->canTalk() ? $this->mTitle->getTalkNsText() : ''; |
| 2129 | + case MAG_TALKSPACEE: |
| 2130 | + return $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : ''; |
| 2131 | + case MAG_SUBJECTSPACE: |
| 2132 | + return $this->mTitle->getSubjectNsText(); |
| 2133 | + case MAG_SUBJECTSPACEE: |
| 2134 | + return( wfUrlencode( $this->mTitle->getSubjectNsText() ) ); |
2107 | 2135 | case MAG_CURRENTDAYNAME: |
2108 | 2136 | return $varCache[$index] = $wgContLang->getWeekdayName( date( 'w', $ts ) + 1 ); |
2109 | 2137 | case MAG_CURRENTYEAR: |
Index: trunk/phase3/includes/MagicWord.php |
— | — | @@ -73,6 +73,14 @@ |
74 | 74 | 'MAG_SUBPAGENAME', |
75 | 75 | 'MAG_SUBPAGENAMEE', |
76 | 76 | 'MAG_DISPLAYTITLE', |
| 77 | + 'MAG_TALKSPACE', |
| 78 | + 'MAG_TALKSPACEE', |
| 79 | + 'MAG_SUBJECTSPACE', |
| 80 | + 'MAG_SUBJECTSPACEE', |
| 81 | + 'MAG_TALKPAGENAME', |
| 82 | + 'MAG_TALKPAGENAMEE', |
| 83 | + 'MAG_SUBJECTPAGENAME', |
| 84 | + 'MAG_SUBJECTPAGENAMEE', |
77 | 85 | ); |
78 | 86 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
79 | 87 | wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); |
— | — | @@ -108,6 +116,14 @@ |
109 | 117 | MAG_SUBPAGENAME, |
110 | 118 | MAG_SUBPAGENAMEE, |
111 | 119 | MAG_DISPLAYTITLE, |
| 120 | + MAG_TALKSPACE, |
| 121 | + MAG_TALKSPACEE, |
| 122 | + MAG_SUBJECTSPACE, |
| 123 | + MAG_SUBJECTSPACEE, |
| 124 | + MAG_TALKPAGENAME, |
| 125 | + MAG_TALKPAGENAMEE, |
| 126 | + MAG_SUBJECTPAGENAME, |
| 127 | + MAG_SUBJECTPAGENAMEE, |
112 | 128 | ); |
113 | 129 | if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) |
114 | 130 | wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -605,6 +605,23 @@ |
606 | 606 | } |
607 | 607 | |
608 | 608 | /** |
| 609 | + * Get the namespace text of the talk page |
| 610 | + * @return string |
| 611 | + */ |
| 612 | + function getTalkNsText() { |
| 613 | + global $wgContLang; |
| 614 | + return( $wgContLang->getNsText( Namespace::getTalk( $this->mNamespace ) ) ); |
| 615 | + } |
| 616 | + |
| 617 | + /** |
| 618 | + * Could this title have a corresponding talk page? |
| 619 | + * @return bool |
| 620 | + */ |
| 621 | + function canTalk() { |
| 622 | + return( Namespace::canTalk( $this->mNamespace ) ); |
| 623 | + } |
| 624 | + |
| 625 | + /** |
609 | 626 | * Get the interwiki prefix (or null string) |
610 | 627 | * @return string |
611 | 628 | * @access public |
Index: trunk/phase3/includes/Namespace.php |
— | — | @@ -117,5 +117,13 @@ |
118 | 118 | return NULL; |
119 | 119 | } |
120 | 120 | } |
| 121 | + |
| 122 | + /** |
| 123 | + * Can this namespace ever have a talk namespace? |
| 124 | + * @param $index Namespace index |
| 125 | + */ |
| 126 | + function canTalk( $index ) { |
| 127 | + return( $index >= NS_MAIN ); |
| 128 | + } |
121 | 129 | } |
122 | 130 | ?> |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -57,6 +57,8 @@ |
58 | 58 | All extensions using it have been corrected. |
59 | 59 | * Propagate ISBN number for Booksources in LanguageNo.php |
60 | 60 | * (bug 5548) Improvements to Indonesian localisation [patch: Ivan Lanin] |
| 61 | +* Add TALKSPACE, SUBJECTSPACE, TALKPAGENAME, SUBJECTPAGENAME (and encoded forms for all) |
| 62 | + magic words |
61 | 63 | |
62 | 64 | == Compatibility == |
63 | 65 | |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -227,10 +227,18 @@ |
228 | 228 | MAG_PAGENAMEE => array( 1, 'PAGENAMEE' ), |
229 | 229 | MAG_NAMESPACE => array( 1, 'NAMESPACE' ), |
230 | 230 | MAG_NAMESPACEE => array( 1, 'NAMESPACEE' ), |
| 231 | + MAG_TALKSPACE => array( 1, 'TALKSPACE' ), |
| 232 | + MAG_TALKSPACEE => array( 1, 'TALKSPACEE' ), |
| 233 | + MAG_SUBJECTSPACE => array( 1, 'SUBJECTSPACE', 'ARTICLESPACE' ), |
| 234 | + MAG_SUBJECTSPACEE => array( 1, 'SUBJECTSPACEE', 'ARTICLESPACEE' ), |
231 | 235 | MAG_FULLPAGENAME => array( 1, 'FULLPAGENAME' ), |
232 | 236 | MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ), |
233 | | - MAG_SUBPAGENAME => array( 0, 'SUBPAGENAME' ), |
234 | | - MAG_SUBPAGENAMEE => array( 0, 'SUBPAGENAMEE' ), |
| 237 | + MAG_SUBPAGENAME => array( 1, 'SUBPAGENAME' ), |
| 238 | + MAG_SUBPAGENAMEE => array( 1, 'SUBPAGENAMEE' ), |
| 239 | + MAG_TALKPAGENAME => array( 1, 'TALKPAGENAME' ), |
| 240 | + MAG_TALKPAGENAMEE => array( 1, 'TALKPAGENAMEE' ), |
| 241 | + MAG_SUBJECTPAGENAME => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ), |
| 242 | + MAG_SUBJECTPAGENAMEE => array( 1, 'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ), |
235 | 243 | MAG_MSG => array( 0, 'MSG:' ), |
236 | 244 | MAG_SUBST => array( 0, 'SUBST:' ), |
237 | 245 | MAG_MSGNW => array( 0, 'MSGNW:' ), |