r97624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97623‎ | r97624 | r97625 >
Date:13:23, 20 September 2011
Author:reedy
Status:ok
Tags:
Comment:
MFT r93557, revert r97588 in 1.18wmf1 AND REL1_18
Modified paths:
  • /branches/REL1_18/phase3/includes/OutputPage.php (modified) (history)
  • /branches/wmf/1.18wmf1/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/includes/OutputPage.php
@@ -18,7 +18,7 @@
1919 *
2020 * @todo document
2121 */
22 -class OutputPage {
 22+class OutputPage extends ContextSource {
2323 /// Should be private. Used with addMeta() which adds <meta>
2424 var $mMetatags = array();
2525
@@ -196,8 +196,6 @@
197197
198198 var $mFileVersion = null;
199199
200 - private $mContext;
201 -
202200 /**
203201 * An array of stylesheet filenames (relative from skins path), with options
204202 * for CSS media, IE conditions, and RTL/LTR direction.
@@ -226,7 +224,7 @@
227225 * a OutputPage tied to that context.
228226 */
229227 function __construct( IContextSource $context = null ) {
230 - $this->mContext = $context;
 228+ $this->setContext( $context );
231229 }
232230
233231 /**
@@ -784,29 +782,6 @@
785783 }
786784
787785 /**
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 - /**
811786 * Set the Title object to use
812787 *
813788 * @param $t Title object
@@ -815,36 +790,8 @@
816791 $this->getContext()->setTitle( $t );
817792 }
818793
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 - }
827794
828795 /**
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 - /**
849796 * Replace the subtile with $str
850797 *
851798 * @param $str String: new value of the subtitle
@@ -2257,8 +2204,8 @@
22582205 * @return String: The doctype, opening <html>, and head element.
22592206 */
22602207 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();
22632210 $sitedir = $wgContLang->getDir();
22642211
22652212 if ( $sk->commonPrintStylesheet() ) {
@@ -2266,7 +2213,7 @@
22672214 }
22682215 $sk->setupUserCss( $this );
22692216
2270 - $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $userdir ) );
 2217+ $ret = Html::htmlHeader( array( 'lang' => $this->getLang()->getCode(), 'dir' => $userdir ) );
22712218
22722219 if ( $this->getHTMLTitle() == '' ) {
22732220 $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) );
@@ -2958,8 +2905,7 @@
29592906 * @param $flip Boolean: Whether to flip the CSS if needed
29602907 */
29612908 public function addInlineStyle( $style_css, $flip = false ) {
2962 - global $wgLang;
2963 - if( $flip && $wgLang->isRTL() ) {
 2909+ if( $flip && $this->getLang()->isRTL() ) {
29642910 # If wanted, and the interface is right-to-left, flip the CSS
29652911 $style_css = CSSJanus::transform( $style_css, true, false );
29662912 }
@@ -3029,8 +2975,7 @@
30302976 */
30312977 protected function styleLink( $style, $options ) {
30322978 if( isset( $options['dir'] ) ) {
3033 - global $wgLang;
3034 - if( $wgLang->getDir() != $options['dir'] ) {
 2979+ if( $this->getLang()->getDir() != $options['dir'] ) {
30352980 return '';
30362981 }
30372982 }
Property changes on: branches/wmf/1.18wmf1/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
30382983 Merged /trunk/phase3/includes/OutputPage.php:r93557
Index: branches/REL1_18/phase3/includes/OutputPage.php
@@ -18,7 +18,7 @@
1919 *
2020 * @todo document
2121 */
22 -class OutputPage {
 22+class OutputPage extends ContextSource {
2323 /// Should be private. Used with addMeta() which adds <meta>
2424 var $mMetatags = array();
2525
@@ -196,8 +196,6 @@
197197
198198 var $mFileVersion = null;
199199
200 - private $mContext;
201 -
202200 /**
203201 * An array of stylesheet filenames (relative from skins path), with options
204202 * for CSS media, IE conditions, and RTL/LTR direction.
@@ -226,7 +224,7 @@
227225 * a OutputPage tied to that context.
228226 */
229227 function __construct( IContextSource $context = null ) {
230 - $this->mContext = $context;
 228+ $this->setContext( $context );
231229 }
232230
233231 /**
@@ -784,29 +782,6 @@
785783 }
786784
787785 /**
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 - /**
811786 * Set the Title object to use
812787 *
813788 * @param $t Title object
@@ -815,36 +790,8 @@
816791 $this->getContext()->setTitle( $t );
817792 }
818793
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 - }
827794
828795 /**
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 - /**
849796 * Replace the subtile with $str
850797 *
851798 * @param $str String: new value of the subtitle
@@ -2257,8 +2204,8 @@
22582205 * @return String: The doctype, opening <html>, and head element.
22592206 */
22602207 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();
22632210 $sitedir = $wgContLang->getDir();
22642211
22652212 if ( $sk->commonPrintStylesheet() ) {
@@ -2266,7 +2213,7 @@
22672214 }
22682215 $sk->setupUserCss( $this );
22692216
2270 - $ret = Html::htmlHeader( array( 'lang' => $wgLang->getCode(), 'dir' => $userdir ) );
 2217+ $ret = Html::htmlHeader( array( 'lang' => $this->getLang()->getCode(), 'dir' => $userdir ) );
22712218
22722219 if ( $this->getHTMLTitle() == '' ) {
22732220 $this->setHTMLTitle( wfMsg( 'pagetitle', $this->getPageTitle() ) );
@@ -2958,8 +2905,7 @@
29592906 * @param $flip Boolean: Whether to flip the CSS if needed
29602907 */
29612908 public function addInlineStyle( $style_css, $flip = false ) {
2962 - global $wgLang;
2963 - if( $flip && $wgLang->isRTL() ) {
 2909+ if( $flip && $this->getLang()->isRTL() ) {
29642910 # If wanted, and the interface is right-to-left, flip the CSS
29652911 $style_css = CSSJanus::transform( $style_css, true, false );
29662912 }
@@ -3029,8 +2975,7 @@
30302976 */
30312977 protected function styleLink( $style, $options ) {
30322978 if( isset( $options['dir'] ) ) {
3033 - global $wgLang;
3034 - if( $wgLang->getDir() != $options['dir'] ) {
 2979+ if( $this->getLang()->getDir() != $options['dir'] ) {
30352980 return '';
30362981 }
30372982 }
Property changes on: branches/REL1_18/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
30382983 Merged /trunk/phase3/includes/OutputPage.php:r93557

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93557* Made OutputPage extend ContextSource instead of duplicating its code; this ...ialex19:37, 30 July 2011
r97588PHP fatal error in /usr/local/apache/common-local/php-1.18/includes/OutputPag...reedy00:30, 20 September 2011

Status & tagging log