Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -67,7 +67,7 @@ |
68 | 68 | * Contains the page subtitle. Special pages usually have some links here. |
69 | 69 | * Don't confuse with site subtitle added by skins. |
70 | 70 | */ |
71 | | - var $mSubtitle = ''; |
| 71 | + private $mSubtitle = array(); |
72 | 72 | |
73 | 73 | var $mRedirect = ''; |
74 | 74 | var $mStatusCode; |
— | — | @@ -820,28 +820,63 @@ |
821 | 821 | /** |
822 | 822 | * Replace the subtile with $str |
823 | 823 | * |
824 | | - * @param $str String: new value of the subtitle |
| 824 | + * @param $str String|Message: new value of the subtitle |
825 | 825 | */ |
826 | 826 | public function setSubtitle( $str ) { |
827 | | - $this->mSubtitle = /*$this->parse(*/ $str /*)*/; // @bug 2514 |
| 827 | + $this->clearSubtitle(); |
| 828 | + $this->addSubtitle( $str ); |
828 | 829 | } |
829 | 830 | |
830 | 831 | /** |
831 | 832 | * Add $str to the subtitle |
832 | 833 | * |
833 | | - * @param $str String to add to the subtitle |
| 834 | + * @deprecated in 1.19; use addSubtitle() instead |
| 835 | + * @param $str String|Message to add to the subtitle |
834 | 836 | */ |
835 | 837 | public function appendSubtitle( $str ) { |
836 | | - $this->mSubtitle .= /*$this->parse(*/ $str /*)*/; // @bug 2514 |
| 838 | + $this->addSubtitle( $str ); |
837 | 839 | } |
838 | 840 | |
839 | 841 | /** |
| 842 | + * Add $str to the subtitle |
| 843 | + * |
| 844 | + * @param $str String|Message to add to the subtitle |
| 845 | + */ |
| 846 | + public function addSubtitle( $str ) { |
| 847 | + if ( $str instanceof Message ) { |
| 848 | + $this->mSubtitle[] = $str->setContext( $this->getContext() )->parse(); |
| 849 | + } else { |
| 850 | + $this->mSubtitle[] = $str; |
| 851 | + } |
| 852 | + } |
| 853 | + |
| 854 | + /** |
| 855 | + * Add a subtitle containing a backlink to a page |
| 856 | + * |
| 857 | + * @param $title Title to link to |
| 858 | + */ |
| 859 | + public function addBacklinkSubtitle( Title $title ) { |
| 860 | + $query = array(); |
| 861 | + if ( $title->isRedirect() ) { |
| 862 | + $query['redirect'] = 'no'; |
| 863 | + } |
| 864 | + $this->addSubtitle( $this->msg( 'backlinksubtitle' )->rawParams( Linker::link( $title, null, array(), $query ) ) ); |
| 865 | + } |
| 866 | + |
| 867 | + /** |
| 868 | + * Clear the subtitles |
| 869 | + */ |
| 870 | + public function clearSubtitle() { |
| 871 | + $this->mSubtitle = array(); |
| 872 | + } |
| 873 | + |
| 874 | + /** |
840 | 875 | * Get the subtitle |
841 | 876 | * |
842 | 877 | * @return String |
843 | 878 | */ |
844 | 879 | public function getSubtitle() { |
845 | | - return $this->mSubtitle; |
| 880 | + return implode( "<br />\n\t\t\t\t", $this->mSubtitle ); |
846 | 881 | } |
847 | 882 | |
848 | 883 | /** |
— | — | @@ -1947,6 +1982,7 @@ |
1948 | 1983 | $this->setArticleRelated( false ); |
1949 | 1984 | $this->enableClientCache( false ); |
1950 | 1985 | $this->mRedirect = ''; |
| 1986 | + $this->clearSubtitle(); |
1951 | 1987 | $this->clearHTML(); |
1952 | 1988 | } |
1953 | 1989 | |
— | — | @@ -2140,10 +2176,8 @@ |
2141 | 2177 | if ( !empty( $reasons ) ) { |
2142 | 2178 | // Permissions error |
2143 | 2179 | if( $source ) { |
2144 | | - $this->setPageTitle( $this->msg( 'viewsource' ) ); |
2145 | | - $this->setSubtitle( |
2146 | | - $this->msg( 'viewsourcefor', Linker::linkKnown( $this->getTitle() ) )->text() |
2147 | | - ); |
| 2180 | + $this->setPageTitle( $this->msg( 'viewsource-title', $this->getTitle()->getPrefixedText() ) ); |
| 2181 | + $this->addBacklinkSubtitle( $this->getTitle() ); |
2148 | 2182 | } else { |
2149 | 2183 | $this->setPageTitle( $this->msg( 'badaccess' ) ); |
2150 | 2184 | } |