wfMsgForContentNoTrans() was removed
[mediawiki.git] / includes / resourceloader / ResourceLoaderRawFileModule.php
blobd9005fa5e22963ff2cbdd1f6712ba8ad71f4d8d6
1 <?php
2 /**
3 * Module containing files that are loaded without ResourceLoader.
5 * Primary usecase being "base" modules loaded by the startup module,
6 * such as jquery and the mw.loader client itself. These make use of
7 * ResourceLoaderModule and load.php for convenience but aren't actually
8 * registered in the startup module (as it would have to load itself).
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 * http://www.gnu.org/copyleft/gpl.html
25 * @file
26 * @author Timo Tijhof
29 class ResourceLoaderRawFileModule extends ResourceLoaderFileModule {
31 /**
32 * Enable raw mode to omit mw.loader.state() call as mw.loader
33 * does not yet exist when these modules execute.
34 * @var boolean
36 protected $raw = true;
38 /**
39 * Get all JavaScript code.
41 * @param ResourceLoaderContext $context
42 * @return string JavaScript code
44 public function getScript( ResourceLoaderContext $context ) {
45 $script = parent::getScript( $context );
46 // Add closure explicitly because raw modules can't be wrapped mw.loader.implement.
47 // Unlike with mw.loader.implement, this closure is immediately invoked.
48 // @see ResourceLoader::makeModuleResponse
49 // @see ResourceLoader::makeLoaderImplementScript
50 return "(function () {\n{$script}\n}());";