move script into OpenXPlugin::showAd() so it works
This commit is contained in:
parent
97a1ef14d2
commit
dd413ff4fa
@ -31,22 +31,6 @@ if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$_OpenXPlugin_Script = <<<ENDOFSCRIPT
|
||||
var m3_u = '%s';
|
||||
var m3_r = Math.floor(Math.random()*99999999999);
|
||||
if (!document.MAX_used) document.MAX_used = ',';
|
||||
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
|
||||
document.write ("?zoneid=%s");
|
||||
document.write ('&cb=' + m3_r);
|
||||
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
|
||||
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
|
||||
document.write ("&loc=" + escape(window.location));
|
||||
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
|
||||
if (document.context) document.write ("&context=" + escape(document.context));
|
||||
if (document.mmm_fo) document.write ("&mmm_fo=1");
|
||||
document.write ("'><\/scr"+"ipt>");
|
||||
ENDOFSCRIPT;
|
||||
|
||||
/**
|
||||
* Plugin for OpenX Ad Server
|
||||
*
|
||||
@ -159,9 +143,23 @@ class OpenXPlugin extends UAPPlugin
|
||||
|
||||
protected function showAd($action, $zone)
|
||||
{
|
||||
global $_OpenXPlugin_Script;
|
||||
$scr = <<<ENDOFSCRIPT
|
||||
var m3_u = '%s';
|
||||
var m3_r = Math.floor(Math.random()*99999999999);
|
||||
if (!document.MAX_used) document.MAX_used = ',';
|
||||
document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
|
||||
document.write ("?zoneid=%d");
|
||||
document.write ('&cb=' + m3_r);
|
||||
if (document.MAX_used != ',') document.write ("&exclude=" + document.MAX_used);
|
||||
document.write (document.charset ? '&charset='+document.charset : (document.characterSet ? '&charset='+document.characterSet : ''));
|
||||
document.write ("&loc=" + escape(window.location));
|
||||
if (document.referrer) document.write ("&referer=" + escape(document.referrer));
|
||||
if (document.context) document.write ("&context=" + escape(document.context));
|
||||
if (document.mmm_fo) document.write ("&mmm_fo=1");
|
||||
document.write ("'><\/scr"+"ipt>");
|
||||
ENDOFSCRIPT;
|
||||
|
||||
$action->inlineScript(sprintf($_OpenXPlugin_Script, $this->adScript, $zone));
|
||||
$action->inlineScript(sprintf($scr, $this->adScript, $zone));
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user