here it is ... the upload-api, script-server, js2 (javascript phase2) branch merge...
[lhc/web/wiklou.git] / mwScriptLoader.php
1 <?php
2 /*
3 * mvwScriptLoader.php
4 * Script Loading Library for MediaWiki
5 *
6 * @author Michael Dale mdale@wikimedia.org
7 * @date feb, 2009
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * http://www.gnu.org/copyleft/gpl.html
23 */
24
25 /*
26 * mvwScriptLoader:
27 *
28 * some documentation about script-loader:
29 * http://www.mediawiki.org/wiki/ScriptLoader
30 */
31
32 //include WebStart.php
33 require_once('includes/WebStart.php');
34
35 wfProfileIn('mvwScriptLoader.php');
36
37 if( isset( $_SERVER['SCRIPT_URL'] ) ) {
38 $url = $_SERVER['SCRIPT_URL'];
39 } else {
40 $url = $_SERVER['PHP_SELF'];
41 }
42
43 if( strpos($url, "mwScriptLoader$wgScriptExtension") === false){
44 wfHttpError( 403, 'Forbidden',
45 'mvwScriptLoader must be accessed through the primary script entry point.' );
46 return ;
47 }
48 //Verify the script loader is on:
49 if (!$wgEnableScriptLoader) {
50 echo '/*ScriptLoader is not enabled for this site. To enable add the following line to your LocalSettings.php';
51 echo '<pre><b>$wgEnableScriptLoader=true;</b></pre>*/';
52 echo 'alert(\'Script loader is disabled\');';
53 die(1);
54 }
55
56 //load the mwEmbed language file:
57 $wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php";
58 //enable the msgs before we go on:
59 wfLoadExtensionMessages( 'mwEmbed' );
60
61 //run jsScriptLoader action:
62 $myScriptLoader = new jsScriptLoader();
63 $myScriptLoader->doScriptLoader();
64
65 wfProfileOut();
66 ?>