<?php
-/*
- * mvwScriptLoader.php
-* Script Loading Library for MediaWiki
-*
-* @author Michael Dale mdale@wikimedia.org
-* @date feb, 2009
-*
-* This program is free software; you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License along
-* with this program; if not, write to the Free Software Foundation, Inc.,
-* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-* http://www.gnu.org/copyleft/gpl.html
-*/
-
-/*
- * mvwScriptLoader:
+/**
+ * mwScriptLoader.php
+ * Script Loading Library for MediaWiki
+ *
+ * @file
+ * @author Michael Dale mdale@wikimedia.org
+ * @date feb, 2009
+ * @link http://www.mediawiki.org/wiki/ScriptLoader Documentation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * some documentation about script-loader:
- * http://www.mediawiki.org/wiki/ScriptLoader
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * http://www.gnu.org/copyleft/gpl.html
*/
-//include WebStart.php
-require_once('includes/WebStart.php');
+//first do a quick static check for the cached file
+define('MW_CACHE_SCRIPT_CHECK', true);
+require_once( dirname(__FILE__) . '/js2/mwEmbed/jsScriptLoader.php');
+$myScriptLoader = new jsScriptLoader();
+if( $myScriptLoader->outputFromCache() ){
+ exit();
+}
-wfProfileIn('mvwScriptLoader.php');
+//Else load up mediaWiki stuff and continue scriptloader processing:
-if( isset( $_SERVER['SCRIPT_URL'] ) ) {
- $url = $_SERVER['SCRIPT_URL'];
-} else {
- $url = $_SERVER['PHP_SELF'];
-}
+// include WebStart.php
+ob_start();
+require_once('includes/WebStart.php');
+$webstartwhitespace = ob_end_clean();
+
+wfProfileIn( 'mwScriptLoader.php' );
-if( strpos($url, "mwScriptLoader$wgScriptExtension") === false){
+if( $wgRequest->isPathInfoBad() ){
wfHttpError( 403, 'Forbidden',
- 'mvwScriptLoader must be accessed through the primary script entry point.' );
- return ;
+ 'Invalid file extension found in PATH_INFO. ' .
+ 'mwScriptLoader must be accessed through the primary script entry point.' );
+ return;
}
-//Verify the script loader is on:
-if (!$wgEnableScriptLoader) {
+// Verify the script loader is on:
+if ( !$wgEnableScriptLoader ) {
echo '/*ScriptLoader is not enabled for this site. To enable add the following line to your LocalSettings.php';
echo '<pre><b>$wgEnableScriptLoader=true;</b></pre>*/';
echo 'alert(\'Script loader is disabled\');';
- die(1);
+ die( 1 );
}
-//load the mwEmbed language file:
-$wgExtensionMessagesFiles['mwEmbed'] = "{$IP}/js2/mwEmbed/php/languages/mwEmbed.i18n.php";
-//enable the msgs before we go on:
-wfLoadExtensionMessages( 'mwEmbed' );
-
-//run jsScriptLoader action:
-$myScriptLoader = new jsScriptLoader();
+//load the language file and
+// Run jsScriptLoader action:
$myScriptLoader->doScriptLoader();
-wfProfileOut();
-?>
\ No newline at end of file
+
+wfProfileOut( 'mwScriptLoader.php' );