Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | * |
20 | 20 | * @todo document |
21 | 21 | */ |
22 | | -class OutputPage { |
| 22 | +class OutputPage extends ContextSource { |
23 | 23 | /// Should be private. Used with addMeta() which adds <meta> |
24 | 24 | var $mMetatags = array(); |
25 | 25 | |
— | — | @@ -196,8 +196,6 @@ |
197 | 197 | |
198 | 198 | var $mFileVersion = null; |
199 | 199 | |
200 | | - private $mContext; |
201 | | - |
202 | 200 | /** |
203 | 201 | * An array of stylesheet filenames (relative from skins path), with options |
204 | 202 | * for CSS media, IE conditions, and RTL/LTR direction. |
— | — | @@ -226,11 +224,12 @@ |
227 | 225 | * a OutputPage tied to that context. |
228 | 226 | */ |
229 | 227 | function __construct( RequestContext $context = null ) { |
230 | | - if ( !isset($context) ) { |
| 228 | + if ( $context === null ) { |
231 | 229 | # Extensions should use `new RequestContext` instead of `new OutputPage` now. |
232 | 230 | wfDeprecated( __METHOD__ ); |
| 231 | + } else { |
| 232 | + $this->setContext( $context ); |
233 | 233 | } |
234 | | - $this->mContext = $context; |
235 | 234 | } |
236 | 235 | |
237 | 236 | /** |
— | — | @@ -788,29 +787,6 @@ |
789 | 788 | } |
790 | 789 | |
791 | 790 | /** |
792 | | - * Get the RequestContext used in this instance |
793 | | - * |
794 | | - * @return RequestContext |
795 | | - */ |
796 | | - private function getContext() { |
797 | | - if ( !isset($this->mContext) ) { |
798 | | - wfDebug( __METHOD__ . " called and \$mContext is null. Using RequestContext::getMain(); for sanity\n" ); |
799 | | - $this->mContext = RequestContext::getMain(); |
800 | | - } |
801 | | - return $this->mContext; |
802 | | - } |
803 | | - |
804 | | - /** |
805 | | - * Get the WebRequest being used for this instance |
806 | | - * |
807 | | - * @return WebRequest |
808 | | - * @since 1.18 |
809 | | - */ |
810 | | - public function getRequest() { |
811 | | - return $this->getContext()->getRequest(); |
812 | | - } |
813 | | - |
814 | | - /** |
815 | 791 | * Set the Title object to use |
816 | 792 | * |
817 | 793 | * @param $t Title object |
— | — | @@ -819,36 +795,8 @@ |
820 | 796 | $this->getContext()->setTitle( $t ); |
821 | 797 | } |
822 | 798 | |
823 | | - /** |
824 | | - * Get the Title object used in this instance |
825 | | - * |
826 | | - * @return Title |
827 | | - */ |
828 | | - public function getTitle() { |
829 | | - return $this->getContext()->getTitle(); |
830 | | - } |
831 | 799 | |
832 | 800 | /** |
833 | | - * Get the User object used in this instance |
834 | | - * |
835 | | - * @return User |
836 | | - * @since 1.18 |
837 | | - */ |
838 | | - public function getUser() { |
839 | | - return $this->getContext()->getUser(); |
840 | | - } |
841 | | - |
842 | | - /** |
843 | | - * Get the Skin object used to render this instance |
844 | | - * |
845 | | - * @return Skin |
846 | | - * @since 1.18 |
847 | | - */ |
848 | | - public function getSkin() { |
849 | | - return $this->getContext()->getSkin(); |
850 | | - } |
851 | | - |
852 | | - /** |
853 | 801 | * Replace the subtile with $str |
854 | 802 | * |
855 | 803 | * @param $str String: new value of the subtitle |
— | — | @@ -2262,15 +2210,15 @@ |
2263 | 2211 | * @return String: The doctype, opening <html>, and head element. |
2264 | 2212 | */ |
2265 | 2213 | public function headElement( Skin $sk, $includeStyle = true ) { |
2266 | | - global $wgLang, $wgContLang, $wgUseTrackbacks; |
2267 | | - $userdir = $wgLang->getDir(); |
| 2214 | + global $wgContLang, $wgUseTrackbacks; |
| 2215 | + $userdir = $this->getLang()->getDir(); |
2268 | 2216 | $sitedir = $wgContLang->getDir(); |
2269 | 2217 | |
2270 | 2218 | if ( $sk->commonPrintStylesheet() ) { |
2271 | 2219 | $this->addModuleStyles( 'mediawiki.legacy.wikiprintable' ); |
2272 | 2220 | } |
2273 | 2221 | |
2274 | | - $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $userdir ) ); |
| 2222 | + $ret = Html::htmlHeader( array( 'lang' => $this->getLang()->getCode(), 'dir' => $userdir ) ); |
2275 | 2223 | |
2276 | 2224 | if ( $this->getHTMLTitle() == '' ) { |
2277 | 2225 | $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) ); |
— | — | @@ -3088,8 +3036,7 @@ |
3089 | 3037 | */ |
3090 | 3038 | protected function styleLink( $style, $options ) { |
3091 | 3039 | if( isset( $options['dir'] ) ) { |
3092 | | - global $wgLang; |
3093 | | - if( $wgLang->getDir() != $options['dir'] ) { |
| 3040 | + if( $this->getLang()->getDir() != $options['dir'] ) { |
3094 | 3041 | return ''; |
3095 | 3042 | } |
3096 | 3043 | } |