Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -74,6 +74,22 @@ |
75 | 75 | */ |
76 | 76 | var $mAddedRedirectParams = array(); |
77 | 77 | /** |
| 78 | + * Current request |
| 79 | + * @var WebRequest |
| 80 | + */ |
| 81 | + protected $mRequest; |
| 82 | + /** |
| 83 | + * Current output page |
| 84 | + * @var OutputPage |
| 85 | + */ |
| 86 | + protected $mOutput; |
| 87 | + /** |
| 88 | + * Full title including $par |
| 89 | + * @var Title |
| 90 | + */ |
| 91 | + protected $mFullTitle; |
| 92 | + |
| 93 | + /** |
78 | 94 | * List of special pages, followed by parameters. |
79 | 95 | * If the only parameter is a string, that is the page name. |
80 | 96 | * Otherwise, it is an array. The format is one of: |
— | — | @@ -539,6 +555,9 @@ |
540 | 556 | wfProfileOut( __METHOD__ ); |
541 | 557 | return false; |
542 | 558 | } |
| 559 | + |
| 560 | + # Page exists, set the context |
| 561 | + $page->setContext( $wgRequest, $wgOut ); |
543 | 562 | |
544 | 563 | # Check for redirect |
545 | 564 | if ( !$including ) { |
— | — | @@ -951,6 +970,27 @@ |
952 | 971 | ? $params |
953 | 972 | : false; |
954 | 973 | } |
| 974 | + |
| 975 | + /** |
| 976 | + * Sets the context this SpecialPage is executed in |
| 977 | + * |
| 978 | + * @param $request WebRequest |
| 979 | + * @param $output OutputPage |
| 980 | + */ |
| 981 | + protected function setContext( $request, $output ) { |
| 982 | + $this->mRequest = $request; |
| 983 | + $this->mOutput = $output; |
| 984 | + $this->mFullTitle = $output->getTitle(); |
| 985 | + } |
| 986 | + /** |
| 987 | + * Wrapper around wfMessage that sets the current context. Currently this |
| 988 | + * is only the title. |
| 989 | + * |
| 990 | + * @see wfMessage |
| 991 | + */ |
| 992 | + public function msg( /* $args */ ) { |
| 993 | + return call_user_func_array( 'wfMessage', func_get_args() )->title( $this->mFullTitle ); |
| 994 | + } |
955 | 995 | } |
956 | 996 | |
957 | 997 | /** |