Index: branches/wmf/1.18wmf1/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,7 +224,7 @@ |
227 | 225 | * a OutputPage tied to that context. |
228 | 226 | */ |
229 | 227 | function __construct( IContextSource $context = null ) { |
230 | | - $this->mContext = $context; |
| 228 | + $this->setContext( $context ); |
231 | 229 | } |
232 | 230 | |
233 | 231 | /** |
— | — | @@ -784,29 +782,6 @@ |
785 | 783 | } |
786 | 784 | |
787 | 785 | /** |
788 | | - * Get the RequestContext used in this instance |
789 | | - * |
790 | | - * @return RequestContext |
791 | | - */ |
792 | | - private function getContext() { |
793 | | - if ( !isset($this->mContext) ) { |
794 | | - wfDebug( __METHOD__ . " called and \$mContext is null. Using RequestContext::getMain(); for sanity\n" ); |
795 | | - $this->mContext = RequestContext::getMain(); |
796 | | - } |
797 | | - return $this->mContext; |
798 | | - } |
799 | | - |
800 | | - /** |
801 | | - * Get the WebRequest being used for this instance |
802 | | - * |
803 | | - * @return WebRequest |
804 | | - * @since 1.18 |
805 | | - */ |
806 | | - public function getRequest() { |
807 | | - return $this->getContext()->getRequest(); |
808 | | - } |
809 | | - |
810 | | - /** |
811 | 786 | * Set the Title object to use |
812 | 787 | * |
813 | 788 | * @param $t Title object |
— | — | @@ -815,36 +790,8 @@ |
816 | 791 | $this->getContext()->setTitle( $t ); |
817 | 792 | } |
818 | 793 | |
819 | | - /** |
820 | | - * Get the Title object used in this instance |
821 | | - * |
822 | | - * @return Title |
823 | | - */ |
824 | | - public function getTitle() { |
825 | | - return $this->getContext()->getTitle(); |
826 | | - } |
827 | 794 | |
828 | 795 | /** |
829 | | - * Get the User object used in this instance |
830 | | - * |
831 | | - * @return User |
832 | | - * @since 1.18 |
833 | | - */ |
834 | | - public function getUser() { |
835 | | - return $this->getContext()->getUser(); |
836 | | - } |
837 | | - |
838 | | - /** |
839 | | - * Get the Skin object used to render this instance |
840 | | - * |
841 | | - * @return Skin |
842 | | - * @since 1.18 |
843 | | - */ |
844 | | - public function getSkin() { |
845 | | - return $this->getContext()->getSkin(); |
846 | | - } |
847 | | - |
848 | | - /** |
849 | 796 | * Replace the subtile with $str |
850 | 797 | * |
851 | 798 | * @param $str String: new value of the subtitle |
— | — | @@ -2257,8 +2204,8 @@ |
2258 | 2205 | * @return String: The doctype, opening <html>, and head element. |
2259 | 2206 | */ |
2260 | 2207 | public function headElement( Skin $sk, $includeStyle = true ) { |
2261 | | - global $wgLang, $wgContLang, $wgUseTrackbacks; |
2262 | | - $userdir = $wgLang->getDir(); |
| 2208 | + global $wgContLang, $wgUseTrackbacks; |
| 2209 | + $userdir = $this->getLang()->getDir(); |
2263 | 2210 | $sitedir = $wgContLang->getDir(); |
2264 | 2211 | |
2265 | 2212 | if ( $sk->commonPrintStylesheet() ) { |
— | — | @@ -2266,7 +2213,7 @@ |
2267 | 2214 | } |
2268 | 2215 | $sk->setupUserCss( $this ); |
2269 | 2216 | |
2270 | | - $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $userdir ) ); |
| 2217 | + $ret = Html::htmlHeader( array( 'lang' => $this->getLang()->getCode(), 'dir' => $userdir ) ); |
2271 | 2218 | |
2272 | 2219 | if ( $this->getHTMLTitle() == '' ) { |
2273 | 2220 | $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) ); |
— | — | @@ -2958,8 +2905,7 @@ |
2959 | 2906 | * @param $flip Boolean: Whether to flip the CSS if needed |
2960 | 2907 | */ |
2961 | 2908 | public function addInlineStyle( $style_css, $flip = false ) { |
2962 | | - global $wgLang; |
2963 | | - if( $flip && $wgLang->isRTL() ) { |
| 2909 | + if( $flip && $this->getLang()->isRTL() ) { |
2964 | 2910 | # If wanted, and the interface is right-to-left, flip the CSS |
2965 | 2911 | $style_css = CSSJanus::transform( $style_css, true, false ); |
2966 | 2912 | } |
— | — | @@ -3029,8 +2975,7 @@ |
3030 | 2976 | */ |
3031 | 2977 | protected function styleLink( $style, $options ) { |
3032 | 2978 | if( isset( $options['dir'] ) ) { |
3033 | | - global $wgLang; |
3034 | | - if( $wgLang->getDir() != $options['dir'] ) { |
| 2979 | + if( $this->getLang()->getDir() != $options['dir'] ) { |
3035 | 2980 | return ''; |
3036 | 2981 | } |
3037 | 2982 | } |
Property changes on: branches/wmf/1.18wmf1/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3038 | 2983 | Merged /trunk/phase3/includes/OutputPage.php:r93557 |
Index: branches/REL1_18/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,7 +224,7 @@ |
227 | 225 | * a OutputPage tied to that context. |
228 | 226 | */ |
229 | 227 | function __construct( IContextSource $context = null ) { |
230 | | - $this->mContext = $context; |
| 228 | + $this->setContext( $context ); |
231 | 229 | } |
232 | 230 | |
233 | 231 | /** |
— | — | @@ -784,29 +782,6 @@ |
785 | 783 | } |
786 | 784 | |
787 | 785 | /** |
788 | | - * Get the RequestContext used in this instance |
789 | | - * |
790 | | - * @return RequestContext |
791 | | - */ |
792 | | - private function getContext() { |
793 | | - if ( !isset($this->mContext) ) { |
794 | | - wfDebug( __METHOD__ . " called and \$mContext is null. Using RequestContext::getMain(); for sanity\n" ); |
795 | | - $this->mContext = RequestContext::getMain(); |
796 | | - } |
797 | | - return $this->mContext; |
798 | | - } |
799 | | - |
800 | | - /** |
801 | | - * Get the WebRequest being used for this instance |
802 | | - * |
803 | | - * @return WebRequest |
804 | | - * @since 1.18 |
805 | | - */ |
806 | | - public function getRequest() { |
807 | | - return $this->getContext()->getRequest(); |
808 | | - } |
809 | | - |
810 | | - /** |
811 | 786 | * Set the Title object to use |
812 | 787 | * |
813 | 788 | * @param $t Title object |
— | — | @@ -815,36 +790,8 @@ |
816 | 791 | $this->getContext()->setTitle( $t ); |
817 | 792 | } |
818 | 793 | |
819 | | - /** |
820 | | - * Get the Title object used in this instance |
821 | | - * |
822 | | - * @return Title |
823 | | - */ |
824 | | - public function getTitle() { |
825 | | - return $this->getContext()->getTitle(); |
826 | | - } |
827 | 794 | |
828 | 795 | /** |
829 | | - * Get the User object used in this instance |
830 | | - * |
831 | | - * @return User |
832 | | - * @since 1.18 |
833 | | - */ |
834 | | - public function getUser() { |
835 | | - return $this->getContext()->getUser(); |
836 | | - } |
837 | | - |
838 | | - /** |
839 | | - * Get the Skin object used to render this instance |
840 | | - * |
841 | | - * @return Skin |
842 | | - * @since 1.18 |
843 | | - */ |
844 | | - public function getSkin() { |
845 | | - return $this->getContext()->getSkin(); |
846 | | - } |
847 | | - |
848 | | - /** |
849 | 796 | * Replace the subtile with $str |
850 | 797 | * |
851 | 798 | * @param $str String: new value of the subtitle |
— | — | @@ -2257,8 +2204,8 @@ |
2258 | 2205 | * @return String: The doctype, opening <html>, and head element. |
2259 | 2206 | */ |
2260 | 2207 | public function headElement( Skin $sk, $includeStyle = true ) { |
2261 | | - global $wgLang, $wgContLang, $wgUseTrackbacks; |
2262 | | - $userdir = $wgLang->getDir(); |
| 2208 | + global $wgContLang, $wgUseTrackbacks; |
| 2209 | + $userdir = $this->getLang()->getDir(); |
2263 | 2210 | $sitedir = $wgContLang->getDir(); |
2264 | 2211 | |
2265 | 2212 | if ( $sk->commonPrintStylesheet() ) { |
— | — | @@ -2266,7 +2213,7 @@ |
2267 | 2214 | } |
2268 | 2215 | $sk->setupUserCss( $this ); |
2269 | 2216 | |
2270 | | - $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $userdir ) ); |
| 2217 | + $ret = Html::htmlHeader( array( 'lang' => $this->getLang()->getCode(), 'dir' => $userdir ) ); |
2271 | 2218 | |
2272 | 2219 | if ( $this->getHTMLTitle() == '' ) { |
2273 | 2220 | $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) ); |
— | — | @@ -2958,8 +2905,7 @@ |
2959 | 2906 | * @param $flip Boolean: Whether to flip the CSS if needed |
2960 | 2907 | */ |
2961 | 2908 | public function addInlineStyle( $style_css, $flip = false ) { |
2962 | | - global $wgLang; |
2963 | | - if( $flip && $wgLang->isRTL() ) { |
| 2909 | + if( $flip && $this->getLang()->isRTL() ) { |
2964 | 2910 | # If wanted, and the interface is right-to-left, flip the CSS |
2965 | 2911 | $style_css = CSSJanus::transform( $style_css, true, false ); |
2966 | 2912 | } |
— | — | @@ -3029,8 +2975,7 @@ |
3030 | 2976 | */ |
3031 | 2977 | protected function styleLink( $style, $options ) { |
3032 | 2978 | if( isset( $options['dir'] ) ) { |
3033 | | - global $wgLang; |
3034 | | - if( $wgLang->getDir() != $options['dir'] ) { |
| 2979 | + if( $this->getLang()->getDir() != $options['dir'] ) { |
3035 | 2980 | return ''; |
3036 | 2981 | } |
3037 | 2982 | } |
Property changes on: branches/REL1_18/phase3/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3038 | 2983 | Merged /trunk/phase3/includes/OutputPage.php:r93557 |