function doScriptLoader() {
global $wgJSAutoloadClasses, $wgJSAutoloadLocalClasses, $IP,
- $wgEnableScriptMinify, $wgUseFileCache, $wgExtensionMessagesFiles;
+ $wgEnableScriptMinify, $wgUseFileCache, $wgExtensionMessagesFiles;
//load the ExtensionMessagesFiles
$wgExtensionMessagesFiles['mwEmbed'] = realpath( dirname( __FILE__ ) ) . '/php/languages/mwEmbed.i18n.php';
if ( $wgUseFileCache && !$this->debug ) {
$status = $this->sFileCache->saveToFileCache( $this->jsout );
if ( $status !== true )
- $this->error_msg .= $status;
+ $this->error_msg .= $status;
}
// Check for an error msg
if ( $this->error_msg != '' ) {
if ( in_array( strtolower( $skin ), $skinNames ) ) {
// If in debug mode, add a comment with wiki title and rev:
if ( $this->debug )
- $jsout .= "\n/**\n* GenerateUserJs: \n*/\n";
+ $jsout .= "\n/**\n* GenerateUserJs: \n*/\n";
return $jsout . $sk->generateUserJs( $skin ) . "\n";
}
} else {
if ( $a->getID() !== 0 ) {
// If in debug mode, add a comment with wiki title and rev:
if ( $this->debug )
- $jsout .= "\n/**\n* WikiJSPage: " . htmlspecialchars( $title_block ) . " rev: " . $a->getID() . " \n*/\n";
+ $jsout .= "\n/**\n* WikiJSPage: " . htmlspecialchars( $title_block ) . " rev: " . $a->getID() . " \n*/\n";
return $jsout . $a->getContent() . "\n";
}
if ( trim( $file_name ) != '' ) {
if ( $this->debug )
- $jsout .= "\n/**\n* File: " . htmlspecialchars( $file_name ) . "\n*/\n";
+ $jsout .= "\n/**\n* File: " . htmlspecialchars( $file_name ) . "\n*/\n";
$jsFileStr = $this->doGetJsFile( $file_name ) . "\n";
if( $jsFileStr ){
}
}
}
- //if we did not return some js
+ //if we did not return some js
$this->error_msg .= "\nUnknown error\n";
return false;
}
$m = array();
if( preg_match(
'/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
- $_SERVER['HTTP_ACCEPT_ENCODING'],
- $m ) ) {
+ $_SERVER['HTTP_ACCEPT_ENCODING'],
+ $m ) ) {
if( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) )
- return false;
+ return false;
//no gzip support found
return true;
}
//make sure its a valid wikipage before doing processing
$t = Title::newFromDBkey( substr( $reqClass, 3) );
if( $t->exists()
- && ( $t->getNamespace() == NS_MEDIAWIKI
- || $t->getNamespace() == NS_USER ) ){
- $doAddWT = true;
+ && ( $t->getNamespace() == NS_MEDIAWIKI
+ || $t->getNamespace() == NS_USER ) ){
+ $doAddWT = true;
}
}
}
function doProcessJs( $str ){
global $wgEnableScriptLocalization;
// Strip out js_log debug lines. Not much luck with this regExp yet:
- // if( !$this->debug )
- // $str = preg_replace('/\n\s*js_log\s*\([^\)]([^;]|\n])*;/', "\n", $str);
+ if( !$this->debug )
+ $str = preg_replace('/\n\s*js_log\(([^\)]*\))*\s*[\;\n]/U', "\n", $str);
// Do language swap by index:
if ( $wgEnableScriptLocalization ){
switch( $char ) {
case '"':
$inquote = !$inquote;
- break;
+ break;
case '}':
if( ! $inquote){
$returnIndex['e'] =$i;
return $returnIndex;
}
- break;
+ break;
case '\\':
if ( $inquote ) $ignorenext = true;
- break;
+ break;
}
}
}
$inx = self::getLoadGmIndex( $str );
if(!$inx)
- return '';
+ return '';
return FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true);
}
static public function getMsgKeys(& $jmsg, $langCode = false){
global $wgContLanguageCode;
if(!$langCode)
- $langCode = $wgContLanguageCode;
+ $langCode = $wgContLanguageCode;
//get the msg keys for the a json array
foreach ( $jmsg as $msgKey => $default_en_value ) {
$jmsg[$msgKey] = wfMsgGetKey( $msgKey, true, $langCode, false );
// Check for defined files::
if( is_file( $this->filename ) )
- return $this->filename;
+ return $this->filename;
if( is_file( $this->filename .'.gz') ){
$this->filename.='.gz';
}
//check the update the name based on the $wgUseGzip config var
if ( isset($wgUseGzip) && $wgUseGzip )
- $this->filename.='.gz';
+ $this->filename.='.gz';
}
public function isFileCached() {
$m = array();
if ( preg_match(
'/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
- $_SERVER['HTTP_ACCEPT_ENCODING'],
- $m ) ) {
+ $_SERVER['HTTP_ACCEPT_ENCODING'],
+ $m ) ) {
if ( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) )
- return false;
+ return false;
return true;
}
return 'Error: Called saveToFileCache with $wgUseFileCache off';
}
if ( strcmp( $text, '' ) == 0 )
- return 'saveToFileCache: empty output file';
+ return 'saveToFileCache: empty output file';
if ( $wgUseGzip ) {
$outputText = gzencode( trim( $text ) );
$status = $this->checkCacheDirs();
if ( $status !== true )
- return $status;
+ return $status;
$f = fopen( $this->filename, 'w' );
if ( $f ) {
fwrite( $f, $outputText );
//check for skin overrides for ctrlBuilder
if( _global[ embedObj.skin_name + 'Config'] ){
- //clone as to not overide prototype:
+ //clone as to not override prototype:
var _this = $j.extend(true, {}, this, _global[ embedObj.skin_name + 'Config']);
return _this;
}
$j('#dc_'+ embedObj.id).hover(
function(){
if($j('#gnp_' + embedObj.id).length==0){
+ var toppos = ( embedObj.instanceOf == 'mvPlayList')?25:10;
$j(this).append('<div id="gnp_' + embedObj.id + '" class="ui-state-highlight ui-corner-all" ' +
- 'style="position:absolute;display:none;background:#FFF;top:10px;left:10px;right:10px;">' +
+ 'style="position:absolute;display:none;background:#FFF;top:'+toppos+'px;left:10px;right:10px;">' +
gM('mwe-for_best_experience') +
'<br><input id="ffwarn_'+embedObj.id+'" type=\"checkbox\">' +
gM('mwe-do_not_warn_again') +
$j('#ffwarn_'+embedObj.id).click(function(){
if( $j(this).is(':checked') ){
//set up a cookie for 7 days:
- $j.cookie('dismissNativeWarn', true, { expires: 5 });
+ $j.cookie('dismissNativeWarn', true, { expires: 7 });
//set the current instance
_global['dismissNativeWarn'] = true;
$j('#gnp_' + embedObj.id).fadeOut('slow');
$j('#' +embedObj.id).get(0).fullscreen();
});
- js_log(" should add slider binding: " + $tp.find('.play_head').length) ;
+ js_log(" should add slider binding: " + $tp.find('.play_head').length);
$tp.find('.play_head').slider({
range: "min",
value: 0,