r66788 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66787‎ | r66788 | r66789 >
Date:11:34, 23 May 2010
Author:ialex
Status:deferred
Tags:
Comment:
* Use $wgExtensionAssetsPath
* Put javascript variables in the same <script> tag as other ones
Modified paths:
  • /trunk/extensions/CleanChanges/CleanChanges.php (modified) (history)
  • /trunk/extensions/CleanChanges/CleanChanges_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CleanChanges/CleanChanges.php
@@ -19,6 +19,7 @@
2020
2121 /* Hook into code */
2222 $wgHooks['FetchChangesList'][] = 'NCL::hook';
 23+$wgHooks['MakeGlobalVariablesScript'][] = 'NCL::addScriptVariables';
2324
2425 /* Extension information */
2526 $wgExtensionCredits['other'][] = array(
Index: trunk/extensions/CleanChanges/CleanChanges_body.php
@@ -28,8 +28,8 @@
2929 }
3030
3131 if ( $list instanceof NCL ) {
32 - global $wgOut, $wgScriptPath;
33 - $wgOut->addScriptFile( "$wgScriptPath/extensions/CleanChanges/cleanchanges.js" );
 32+ global $wgOut, $wgExtensionAssetsPath;
 33+ $wgOut->addScriptFile( "$wgExtensionAssetsPath/CleanChanges/cleanchanges.js" );
3434 }
3535
3636 /* If some list was specified, stop processing */
@@ -37,13 +37,18 @@
3838
3939 }
4040
 41+ protected static $userinfo = array();
4142
 43+ public static function addScriptVariables( &$vars ) {
 44+ $vars += self::$userinfo;
 45+ return true;
 46+ }
 47+
4248 /**
4349 * String that comes between page details and the user details. By default
4450 * only larger space.
4551 */
4652 protected $userSeparator = "\xc2\xa0 \xc2\xa0";
47 - protected $userinfo = array();
4853
4954 /**
5055 * Text direction, true for ltr and false for rtl
@@ -69,11 +74,6 @@
7075 }
7176
7277 function endRecentChangesList() {
73 - /*
74 - * Have to output the accumulated javascript stuff before any output is send.
75 - */
76 - global $wgOut;
77 - $wgOut->addScript( Skin::makeVariablesScript( $this->userinfo ) );
7878 return parent::endRecentChangesList() . '</div>';
7979 }
8080
@@ -176,7 +176,7 @@
177177
178178 $stuff = $this->userToolLinks( $rc->getAttribute( 'rc_user' ),
179179 $rc->getAttribute( 'rc_user_text' ) );
180 - $this->userinfo += $stuff[1];
 180+ self::$userinfo += $stuff[1];
181181
182182 $rc->_user = $this->skin->userLink( $rc->getAttribute( 'rc_user' ),
183183 $rc->getAttribute( 'rc_user_text' ) );

Status & tagging log