Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1015,7 +1015,7 @@ |
1016 | 1016 | 'email', |
1017 | 1017 | 'prefs-help-realname', |
1018 | 1018 | |
1019 | | - # 3 messages depending upon wgEmailConfirmToEdit and $wgEnableUserEmail |
| 1019 | + # 3 messages depending upon $wgEmailConfirmToEdit and $wgEnableUserEmail |
1020 | 1020 | 'prefs-help-email', |
1021 | 1021 | 'prefs-help-email-others', |
1022 | 1022 | 'prefs-help-email-required', |
Index: trunk/phase3/skins/common/protect.js |
— | — | @@ -77,16 +77,20 @@ |
78 | 78 | }, |
79 | 79 | |
80 | 80 | /** |
81 | | - * Is this protection level cascadeable? |
82 | | - * @param level String |
83 | | - * |
84 | | - * @return boolean |
85 | | - * |
| 81 | + * Checks if a cerain protection level is cascadeable. |
| 82 | + * @param level {String} |
| 83 | + * @return {Boolean} |
86 | 84 | */ |
87 | 85 | 'isCascadeableLevel': function( level ) { |
88 | | - for (var k = 0; k < wgCascadeableLevels.length; k++) { |
89 | | - if ( wgCascadeableLevels[k] == level ) { |
90 | | - return true; |
| 86 | + var cascadeLevels, len, i; |
| 87 | + |
| 88 | + cascadeLevels = mw.config.get( 'wgCascadeableLevels' ); |
| 89 | + // cascadeLevels isn't defined on all pages |
| 90 | + if ( cascadeLevels ) { |
| 91 | + for ( i = 0, len = cascadeLevels.length; i < len; i += 1 ) { |
| 92 | + if ( cascadeLevels[i] === level ) { |
| 93 | + return true; |
| 94 | + } |
91 | 95 | } |
92 | 96 | } |
93 | 97 | return false; |
Index: trunk/phase3/skins/common/ajax.js |
— | — | @@ -84,9 +84,7 @@ |
85 | 85 | var i, x, n; |
86 | 86 | var uri; |
87 | 87 | var post_data; |
88 | | - uri = wgServer + |
89 | | - ( ( wgScript == null ) ? ( wgScriptPath + '/index.php' ) : wgScript ) + |
90 | | - '?action=ajax'; |
| 88 | + uri = mw.util.wikiScript() + '?action=ajax'; |
91 | 89 | if ( sajax_request_type == 'GET' ) { |
92 | 90 | if ( uri.indexOf( '?' ) == -1 ) { |
93 | 91 | uri = uri + '?rs=' + encodeURIComponent( func_name ); |
Index: trunk/phase3/skins/common/upload.js |
— | — | @@ -1,3 +1,7 @@ |
| 2 | +( function () { |
| 3 | +var ajaxUploadDestCheck = mw.config.get( 'wgAjaxUploadDestCheck' ), |
| 4 | + fileExtensions = mw.config.get( 'wgFileExtensions' ); |
| 5 | + |
2 | 6 | window.licenseSelectorCheck = function() { |
3 | 7 | var selector = document.getElementById( "wpLicense" ); |
4 | 8 | var selection = selector.options[selector.selectedIndex].value; |
— | — | @@ -11,7 +15,7 @@ |
12 | 16 | wgUploadLicenseObj.fetchPreview( selection ); |
13 | 17 | }; |
14 | 18 | |
15 | | -window.wgUploadSetup = function() { |
| 19 | +function uploadSetup() { |
16 | 20 | // Disable URL box if the URL copy upload source type is not selected |
17 | 21 | var e = document.getElementById( 'wpSourceTypeurl' ); |
18 | 22 | if( e ) { |
— | — | @@ -36,7 +40,7 @@ |
37 | 41 | } |
38 | 42 | |
39 | 43 | // AJAX wpDestFile warnings |
40 | | - if ( wgAjaxUploadDestCheck ) { |
| 44 | + if ( ajaxUploadDestCheck ) { |
41 | 45 | // Insert an event handler that fetches upload warnings when wpDestFile |
42 | 46 | // has been changed |
43 | 47 | document.getElementById( 'wpDestFile' ).onchange = function ( e ) { |
— | — | @@ -54,7 +58,7 @@ |
55 | 59 | } |
56 | 60 | |
57 | 61 | var wpLicense = document.getElementById( 'wpLicense' ); |
58 | | - if ( wgAjaxLicensePreview && wpLicense ) { |
| 62 | + if ( mw.config.get( 'wgAjaxLicensePreview' ) && wpLicense ) { |
59 | 63 | // License selector check |
60 | 64 | wpLicense.onchange = licenseSelectorCheck; |
61 | 65 | |
— | — | @@ -74,8 +78,11 @@ |
75 | 79 | |
76 | 80 | |
77 | 81 | // fillDestFile setup |
78 | | - for ( var i = 0; i < wgUploadSourceIds.length; i++ ) |
79 | | - document.getElementById( wgUploadSourceIds[i] ).onchange = function (e) { |
| 82 | + var i, |
| 83 | + uploadSourceIds = mw.config.get( 'wgUploadSourceIds' ), |
| 84 | + len = uploadSourceIds.length; |
| 85 | + for ( i = 0; i < len; i += 1 ) |
| 86 | + document.getElementById( uploadSourceIds[i] ).onchange = function (e) { |
80 | 87 | fillDestFilename( this.id ); |
81 | 88 | }; |
82 | 89 | }; |
— | — | @@ -89,7 +96,7 @@ |
90 | 97 | 'timeoutID': false, |
91 | 98 | |
92 | 99 | 'keypress': function () { |
93 | | - if ( !wgAjaxUploadDestCheck || !sajax_init_object() ) return; |
| 100 | + if ( !ajaxUploadDestCheck || !sajax_init_object() ) return; |
94 | 101 | |
95 | 102 | // Find file to upload |
96 | 103 | var destFile = document.getElementById('wpDestFile'); |
— | — | @@ -114,7 +121,7 @@ |
115 | 122 | }, |
116 | 123 | |
117 | 124 | 'checkNow': function (fname) { |
118 | | - if ( !wgAjaxUploadDestCheck || !sajax_init_object() ) return; |
| 125 | + if ( !ajaxUploadDestCheck || !sajax_init_object() ) return; |
119 | 126 | if ( this.timeoutID ) { |
120 | 127 | window.clearTimeout( this.timeoutID ); |
121 | 128 | } |
— | — | @@ -123,7 +130,7 @@ |
124 | 131 | }, |
125 | 132 | |
126 | 133 | 'timeout' : function() { |
127 | | - if ( !wgAjaxUploadDestCheck || !sajax_init_object() ) return; |
| 134 | + if ( !ajaxUploadDestCheck || !sajax_init_object() ) return; |
128 | 135 | injectSpinner( document.getElementById( 'wpDestFile' ), 'destcheck' ); |
129 | 136 | |
130 | 137 | // Get variables into local scope so that they will be preserved for the |
— | — | @@ -168,7 +175,7 @@ |
169 | 176 | }; |
170 | 177 | |
171 | 178 | window.fillDestFilename = function(id) { |
172 | | - if (!wgUploadAutoFill) { |
| 179 | + if ( !mw.config.get( 'wgUploadAutoFill' ) ) { |
173 | 180 | return; |
174 | 181 | } |
175 | 182 | if (!document.getElementById) { |
— | — | @@ -197,12 +204,12 @@ |
198 | 205 | // Clear the filename if it does not have a valid extension. |
199 | 206 | // URLs are less likely to have a useful extension, so don't include them in the |
200 | 207 | // extension check. |
201 | | - if( wgStrictFileExtensions && wgFileExtensions && id != 'wpUploadFileURL' ) { |
| 208 | + if ( mw.config.get( 'wgStrictFileExtensions' ) && fileExtensions && id !== 'wpUploadFileURL' ) { |
202 | 209 | var found = false; |
203 | | - if( fname.lastIndexOf( '.' ) != -1 ) { |
| 210 | + if ( fname.lastIndexOf( '.' ) !== -1 ) { |
204 | 211 | var ext = fname.substr( fname.lastIndexOf( '.' ) + 1 ); |
205 | | - for( var i = 0; i < wgFileExtensions.length; i++ ) { |
206 | | - if( wgFileExtensions[i].toLowerCase() == ext.toLowerCase() ) { |
| 212 | + for ( var i = 0; i < fileExtensions.length; i += 1 ) { |
| 213 | + if ( fileExtensions[i].toLowerCase() === ext.toLowerCase() ) { |
207 | 214 | found = true; |
208 | 215 | break; |
209 | 216 | } |
— | — | @@ -229,7 +236,7 @@ |
230 | 237 | // Replace spaces by underscores |
231 | 238 | fname = fname.replace( / /g, '_' ); |
232 | 239 | // Capitalise first letter if needed |
233 | | - if ( wgCapitalizeUploads ) { |
| 240 | + if ( mw.config.get( 'wgCapitalizeUploads' ) ) { |
234 | 241 | fname = fname.charAt( 0 ).toUpperCase().concat( fname.substring( 1, 10000 ) ); |
235 | 242 | } |
236 | 243 | |
— | — | @@ -253,7 +260,7 @@ |
254 | 261 | 'responseCache' : { '' : '' }, |
255 | 262 | |
256 | 263 | 'fetchPreview': function( license ) { |
257 | | - if( !wgAjaxLicensePreview ) return; |
| 264 | + if ( !mw.config.get( 'wgAjaxLicensePreview' ) ) return; |
258 | 265 | for (cached in this.responseCache) { |
259 | 266 | if (cached == license) { |
260 | 267 | this.showPreview( this.responseCache[license] ); |
— | — | @@ -265,7 +272,7 @@ |
266 | 273 | var title = document.getElementById('wpDestFile').value; |
267 | 274 | if ( !title ) title = 'File:Sample.jpg'; |
268 | 275 | |
269 | | - var url = wgScriptPath + '/api' + wgScriptExtension |
| 276 | + var url = mw.util.wikiScript( 'api' ) |
270 | 277 | + '?action=parse&text={{' + encodeURIComponent( license ) + '}}' |
271 | 278 | + '&title=' + encodeURIComponent( title ) |
272 | 279 | + '&prop=text&pst&format=json'; |
— | — | @@ -293,4 +300,6 @@ |
294 | 301 | |
295 | 302 | }; |
296 | 303 | |
297 | | -addOnloadHook( wgUploadSetup ); |
| 304 | +$( document ).ready( uploadSetup ); |
| 305 | + |
| 306 | +}() ); |
Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -69,9 +69,8 @@ |
70 | 70 | }; |
71 | 71 | |
72 | 72 | window.importScript = function( page ) { |
73 | | - // TODO: might want to introduce a utility function to match wfUrlencode() in PHP |
74 | | - var uri = wgScript + '?title=' + |
75 | | - encodeURIComponent(page.replace(/ /g,'_')).replace(/%2F/ig,'/').replace(/%3A/ig,':') + |
| 73 | + var uri = mw.config.get( 'wgScript' ) + '?title=' + |
| 74 | + mw.util.wikiUrlencode( page ) + |
76 | 75 | '&action=raw&ctype=text/javascript'; |
77 | 76 | return importScriptURI( uri ); |
78 | 77 | }; |
— | — | @@ -90,7 +89,7 @@ |
91 | 90 | }; |
92 | 91 | |
93 | 92 | window.importStylesheet = function( page ) { |
94 | | - return importStylesheetURI( wgScript + '?action=raw&ctype=text/css&title=' + encodeURIComponent( page.replace(/ /g,'_') ) ); |
| 93 | + return importStylesheetURI( mw.config.get( 'wgScript' ) + '?action=raw&ctype=text/css&title=' + mw.util.wikiUrlencode( page ) ); |
95 | 94 | }; |
96 | 95 | |
97 | 96 | window.importStylesheetURI = function( url, media ) { |
Index: trunk/phase3/skins/common/mwsuggest.js |
— | — | @@ -478,7 +478,7 @@ |
479 | 479 | var query = os_timer.query; |
480 | 480 | os_timer = null; |
481 | 481 | var path = mw.config.get( 'wgMWSuggestTemplate' ).replace( "{namespaces}", os_getNamespaces( r ) ) |
482 | | - .replace( "{dbname}", wgDBname ) |
| 482 | + .replace( "{dbname}", mw.config.get( 'wgDBname' ) ) |
483 | 483 | .replace( "{searchTerms}", os_encodeQuery( query ) ); |
484 | 484 | |
485 | 485 | // try to get from cache, if not fetch using ajax |
Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -1221,7 +1221,7 @@ |
1222 | 1222 | - lim Integer Limit of items to show, default is 50 |
1223 | 1223 | - conds Array Extra conditions for the query (e.g. "log_action != 'revision'") |
1224 | 1224 | - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty if set to true (default), "No matching items in log" is displayed if loglist is empty |
1225 | | - - msgKey Array If you want a nice box with a message, set this to the key of the message. First element is the message key, additional optional elements are parameters for the key that are processed with wgMsgExt and option 'parse' |
| 1225 | + - msgKey Array If you want a nice box with a message, set this to the key of the message. First element is the message key, additional optional elements are parameters for the key that are processed with wfMsgExt and option 'parse' |
1226 | 1226 | - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset |
1227 | 1227 | - wrap String Wrap the message in html (usually something like "<div ...>$1</div>"). |
1228 | 1228 | - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS) |
Index: trunk/phase3/tests/phpunit/skins/SideBarTest.php |
— | — | @@ -136,7 +136,7 @@ |
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
140 | | - * Test wgNoFollowLinks in sidebar |
| 140 | + * Test $wgNoFollowLinks in sidebar |
141 | 141 | */ |
142 | 142 | function testRespectWgnofollowlinks() { |
143 | 143 | global $wgNoFollowLinks; |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | |
147 | 147 | $attribs = $this->getAttribs(); |
148 | 148 | $this->assertArrayNotHasKey( 'rel', $attribs, |
149 | | - 'External URL in sidebar do not have rel=nofollow when wgNoFollowLinks = false' |
| 149 | + 'External URL in sidebar do not have rel=nofollow when $wgNoFollowLinks = false' |
150 | 150 | ); |
151 | 151 | |
152 | 152 | // Restore global |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | | - * Test wgExternaLinkTarget in sidebar |
| 157 | + * Test $wgExternaLinkTarget in sidebar |
158 | 158 | */ |
159 | 159 | function testRespectExternallinktarget() { |
160 | 160 | global $wgExternalLinkTarget; |
Index: trunk/phase3/tests/phpunit/includes/upload/UploadTest.php |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | | - * test uploading a 100 bytes file with wgMaxUploadSize = 100 |
| 104 | + * test uploading a 100 bytes file with $wgMaxUploadSize = 100 |
105 | 105 | * |
106 | 106 | * This method should be abstracted so we can test different settings. |
107 | 107 | */ |
Index: trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php |
— | — | @@ -422,7 +422,7 @@ |
423 | 423 | $this->assertEquals( |
424 | 424 | array( NS_MAIN, NS_USER, NS_CATEGORY ), |
425 | 425 | MWNamespace::getcontentNamespaces(), |
426 | | - 'NS_MAIN is forced in wgContentNamespaces even if unwanted' |
| 426 | + 'NS_MAIN is forced in $wgContentNamespaces even if unwanted' |
427 | 427 | ); |
428 | 428 | |
429 | 429 | # test other cases, return $wgcontentNamespaces as is |
Index: trunk/phase3/includes/HTMLForm.php |
— | — | @@ -423,7 +423,7 @@ |
424 | 424 | } |
425 | 425 | |
426 | 426 | /** |
427 | | - * Display the form (sending to wgOut), with an appropriate error |
| 427 | + * Display the form (sending to $wgOut), with an appropriate error |
428 | 428 | * message or stack of messages, and any validation errors, etc. |
429 | 429 | * @param $submitResult Mixed output from HTMLForm::trySubmit() |
430 | 430 | */ |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2750,9 +2750,9 @@ |
2751 | 2751 | * Add one or more variables to be set in mw.config in JavaScript. |
2752 | 2752 | * |
2753 | 2753 | * @param $key {String|Array} Key or array of key/value pars. |
2754 | | - * @param $value {Mixed} Value of the configuration variable. |
| 2754 | + * @param $value {Mixed} [optional] Value of the configuration variable. |
2755 | 2755 | */ |
2756 | | - public function addJsConfigVars( $keys, $value ) { |
| 2756 | + public function addJsConfigVars( $keys, $value = null ) { |
2757 | 2757 | if ( is_array( $keys ) ) { |
2758 | 2758 | foreach ( $keys as $key => $value ) { |
2759 | 2759 | $this->mJsConfigVars[$key] = $value; |
Index: trunk/phase3/includes/logging/LogEventsList.php |
— | — | @@ -614,7 +614,7 @@ |
615 | 615 | * if set to true (default), "No matching items in log" is displayed if loglist is empty |
616 | 616 | * - msgKey Array If you want a nice box with a message, set this to the key of the message. |
617 | 617 | * First element is the message key, additional optional elements are parameters for the key |
618 | | - * that are processed with wgMsgExt and option 'parse' |
| 618 | + * that are processed with wfMsgExt and option 'parse' |
619 | 619 | * - offset Set to overwrite offset parameter in $wgRequest |
620 | 620 | * set to '' to unset offset |
621 | 621 | * - wrap String Wrap the message in html (usually something like "<div ...>$1</div>"). |
Index: trunk/phase3/includes/specials/SpecialUpload.php |
— | — | @@ -1084,7 +1084,7 @@ |
1085 | 1085 | ); |
1086 | 1086 | |
1087 | 1087 | $out = $this->getOutput(); |
1088 | | - $out->addScript( Skin::makeVariablesScript( $scriptVars ) ); |
| 1088 | + $out->addJsConfigVars( $scriptVars ); |
1089 | 1089 | |
1090 | 1090 | |
1091 | 1091 | $out->addModules( array( |
Index: trunk/phase3/resources/Resources.php |
— | — | @@ -765,7 +765,7 @@ |
766 | 766 | 'size-gigabytes', |
767 | 767 | 'largefileserver', |
768 | 768 | ), |
769 | | - 'dependencies' => array( 'mediawiki.libs.jpegmeta' ), |
| 769 | + 'dependencies' => array( 'mediawiki.libs.jpegmeta', 'mediawiki.util' ), |
770 | 770 | ), |
771 | 771 | |
772 | 772 | /* MediaWiki Legacy */ |
— | — | @@ -774,7 +774,7 @@ |
775 | 775 | 'scripts' => 'common/ajax.js', |
776 | 776 | 'remoteBasePath' => $GLOBALS['wgStylePath'], |
777 | 777 | 'localBasePath' => $GLOBALS['wgStyleDirectory'], |
778 | | - 'dependencies' => 'mediawiki.legacy.wikibits', |
| 778 | + 'dependencies' => array( 'mediawiki.util', 'mediawiki.legacy.wikibits' ), |
779 | 779 | ), |
780 | 780 | 'mediawiki.legacy.commonPrint' => array( |
781 | 781 | 'styles' => array( 'common/commonPrint.css' => array( 'media' => 'print' ) ), |