当前位置: 首页>>代码示例>>PHP>>正文


PHP MAX_javascriptToHTML函数代码示例

本文整理汇总了PHP中MAX_javascriptToHTML函数的典型用法代码示例。如果您正苦于以下问题:PHP MAX_javascriptToHTML函数的具体用法?PHP MAX_javascriptToHTML怎么用?PHP MAX_javascriptToHTML使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了MAX_javascriptToHTML函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: OA_SPCGetJavaScript

function OA_SPCGetJavaScript($affiliateid)
{
    $aConf = $GLOBALS['_MAX']['CONF'];
    $varprefix = $aConf['var']['prefix'];
    $aZones = OA_cacheGetPublisherZones($affiliateid);
    foreach ($aZones as $zoneid => $aZone) {
        $zones[$aZone['type']][] = "            '" . addslashes($aZone['name']) . "' : {$zoneid}";
    }
    $additionalParams = '';
    $magic_quotes_gpc = ini_get('magic_quotes_gpc');
    foreach ($_GET as $key => $value) {
        if ($key == 'id') {
            continue;
        }
        if ($magic_quotes_gpc) {
            $value = stripslashes($value);
        }
        $additionalParams .= htmlspecialchars('&' . urlencode($key) . '=' . urlencode($value), ENT_QUOTES);
    }
    $script = "\n    if (typeof({$varprefix}zones) != 'undefined') {\n        var {$varprefix}zoneids = '';\n        for (var zonename in {$varprefix}zones) {$varprefix}zoneids += escape(zonename+'=' + {$varprefix}zones[zonename] + \"|\");\n        {$varprefix}zoneids += '&amp;nz=1';\n    } else {\n        var {$varprefix}zoneids = escape('" . implode('|', array_keys($aZones)) . "');\n    }\n\n    if (typeof({$varprefix}source) == 'undefined') { {$varprefix}source = ''; }\n    var {$varprefix}p=location.protocol=='https:'?'" . MAX_commonConstructSecureDeliveryUrl($aConf['file']['singlepagecall'], true) . "':'" . MAX_commonConstructDeliveryUrl($aConf['file']['singlepagecall']) . "';\n    var {$varprefix}r=Math.floor(Math.random()*99999999);\n    {$varprefix}output = new Array();\n\n    var {$varprefix}spc=\"<\"+\"script type='text/javascript' \";\n    {$varprefix}spc+=\"src='\"+{$varprefix}p+\"?zones=\"+{$varprefix}zoneids;\n    {$varprefix}spc+=\"&amp;source=\"+escape({$varprefix}source)+\"&amp;r=\"+{$varprefix}r;" . (!empty($additionalParams) ? "\n    {$varprefix}spc+=\"{$additionalParams}\";" : '') . "\n    ";
    if (empty($_GET['charset'])) {
        $script .= "{$varprefix}spc+=(document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));\n";
    }
    $script .= "\n    if (window.location) {$varprefix}spc+=\"&amp;loc=\"+escape(window.location);\n    if (document.referrer) {$varprefix}spc+=\"&amp;referer=\"+escape(document.referrer);\n    {$varprefix}spc+=\"'><\"+\"/script>\";\n    document.write({$varprefix}spc);\n\n    function {$varprefix}show(name) {\n        if (typeof({$varprefix}output[name]) == 'undefined') {\n            return;\n        } else {\n            document.write({$varprefix}output[name]);\n        }\n    }\n\n    function {$varprefix}showpop(name) {\n        zones = window.{$varprefix}zones ? window.{$varprefix}zones : false;\n        var zoneid = name;\n        if (typeof(window.{$varprefix}zones) != 'undefined') {\n            if (typeof(zones[name]) == 'undefined') {\n                return;\n            }\n            zoneid = zones[name];\n        }\n\n        {$varprefix}p=location.protocol=='https:'?'" . MAX_commonConstructSecureDeliveryUrl($aConf['file']['popup'], true) . "':'" . MAX_commonConstructDeliveryUrl($aConf['file']['popup']) . "';\n\n        var {$varprefix}pop=\"<\"+\"script type='text/javascript' \";\n        {$varprefix}pop+=\"src='\"+{$varprefix}p+\"?zoneid=\"+zoneid;\n        {$varprefix}pop+=\"&amp;source=\"+escape({$varprefix}source)+\"&amp;r=\"+{$varprefix}r;" . (!empty($additionalParams) ? "\n        {$varprefix}spc+=\"{$additionalParams}\";" : '') . "\n        if (window.location) {$varprefix}pop+=\"&amp;loc=\"+escape(window.location);\n        if (document.referrer) {$varprefix}pop+=\"&amp;referer=\"+escape(document.referrer);\n        {$varprefix}pop+=\"'><\"+\"/script>\";\n\n        document.write({$varprefix}pop);\n    }\n";
    // Add the FlashObject include to the SPC output
    $script .= MAX_javascriptToHTML(MAX_flashGetFlashObjectExternal(), $varprefix . 'fo');
    return $script;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:28,代码来源:spcjs.php

示例2: test_MAX_javascriptToHTML

    /**
     * This function takes some HTML, and generates JavaScript document.write() code
     * to output that HTML via JavaScript
     *
     * @param string  $string   The string to be converted
     * @param string  $varName  The JS variable name to store the output in
     * @param boolean $output   Should there be a document.write to output the code?
     *
     * @return string   The JS-ified string
     */
    function test_MAX_javascriptToHTML()
    {
        $string = '<div>write this to document/div>';
        $varName = 'myVar';
        $output = true;
        $return = MAX_javascriptToHTML($string, $varName, $output);
        $result = str_replace("\r", '', 'var myVar = \'\';
myVar += "<"+"div>write this to document/div>\\n";
document.write(myVar);
');
        $this->assertEqual($return, $result);
    }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:22,代码来源:javascript.del.test.php

示例3: MAX_trackerbuildJSVariablesScript

function MAX_trackerbuildJSVariablesScript($trackerid, $conversionInfo, $trackerJsCode = null)
{
    $conf = $GLOBALS['_MAX']['CONF'];
    $buffer = '';
    $url = MAX_commonGetDeliveryUrl($conf['file']['conversionvars']);
    $tracker = MAX_cacheGetTracker($trackerid);
    $variables = MAX_cacheGetTrackerVariables($trackerid);
    $variableQuerystring = '';
    if (empty($trackerJsCode)) {
        $trackerJsCode = md5(uniqid('', true));
    } else {
        $tracker['variablemethod'] = 'default';
    }
    if (!empty($variables)) {
        if ($tracker['variablemethod'] == 'dom') {
            $buffer .= "\n    function MAX_extractTextDom(o)\n    {\n        var txt = '';\n\n        if (o.nodeType == 3) {\n            txt = o.data;\n        } else {\n            for (var i = 0; i < o.childNodes.length; i++) {\n                txt += MAX_extractTextDom(o.childNodes[i]);\n            }\n        }\n\n        return txt;\n    }\n\n    function MAX_TrackVarDom(id, v)\n    {\n        if (max_trv[id][v]) { return; }\n        var o = document.getElementById(v);\n        if (o) {\n            max_trv[id][v] = escape(o.tagName == 'INPUT' ? o.value : MAX_extractTextDom(o));\n        }\n    }";
            $funcName = 'MAX_TrackVarDom';
        } elseif ($tracker['variablemethod'] == 'default') {
            $buffer .= "\n    function MAX_TrackVarDefault(id, v)\n    {\n        if (max_trv[id][v]) { return; }\n        if (typeof(window[v]) == undefined) { return; }\n        max_trv[id][v] = window[v];\n    }";
            $funcName = 'MAX_TrackVarDefault';
        } else {
            $buffer .= "\n    function MAX_TrackVarJs(id, v, c)\n    {\n        if (max_trv[id][v]) { return; }\n        if (typeof(window[v]) == undefined) { return; }\n        if (typeof(c) != 'undefined') {\n            eval(c);\n        }\n        max_trv[id][v] = window[v];\n    }";
            $funcName = 'MAX_TrackVarJs';
        }
        $buffer .= "\n    if (!max_trv) { var max_trv = new Array(); }\n    if (!max_trv['{$trackerJsCode}']) { max_trv['{$trackerJsCode}'] = new Array(); }";
        foreach ($variables as $key => $variable) {
            $variableQuerystring .= "&{$variable['name']}=\"+max_trv['{$trackerJsCode}']['{$variable['name']}']+\"";
            if ($tracker['variablemethod'] == 'custom') {
                $buffer .= "\n    {$funcName}('{$trackerJsCode}', '{$variable['name']}', '" . addcslashes($variable['variablecode'], "'") . "');";
            } else {
                $buffer .= "\n    {$funcName}('{$trackerJsCode}', '{$variable['name']}');";
            }
        }
        if (!empty($variableQuerystring)) {
            $conversionInfoParams = array();
            foreach ($conversionInfo as $plugin => $pluginData) {
                if (is_array($pluginData)) {
                    foreach ($pluginData as $key => $value) {
                        $conversionInfoParams[] = $key . '=' . urlencode($value);
                    }
                }
            }
            $conversionInfoParams = '&' . implode('&', $conversionInfoParams);
            $buffer .= "\n    document.write (\"<\" + \"script language='JavaScript' type='text/javascript' src='\");\n    document.write (\"{$url}?trackerid={$trackerid}{$conversionInfoParams}{$variableQuerystring}'\");";
            $buffer .= "\n\tdocument.write (\"><\\/scr\"+\"ipt>\");";
        }
    }
    if (!empty($tracker['appendcode'])) {
        $tracker['appendcode'] = preg_replace('/("\\?trackerid=\\d+&amp;inherit)=1/', '$1=' . $trackerJsCode, $tracker['appendcode']);
        $jscode = MAX_javascriptToHTML($tracker['appendcode'], "MAX_{$trackerid}_appendcode");
        $jscode = preg_replace("/\\{m3_trackervariable:(.+?)\\}/", "\"+max_trv['{$trackerJsCode}']['\$1']+\"", $jscode);
        $buffer .= "\n" . preg_replace('/^/m', "\t", $jscode) . "\n";
    }
    if (empty($buffer)) {
        $buffer = "document.write(\"\");";
    }
    return $buffer;
}
开发者ID:JackyKit,项目名称:revive-adserver,代码行数:58,代码来源:ti.php

示例4: unset

     $varname = $zonename;
 } else {
     $thisZoneid = $varname = $thisZone;
 }
 // Clear deiveryData between iterations
 unset($GLOBALS['_MAX']['deliveryData']);
 $what = 'zone:' . $thisZoneid;
 //OX_Delivery_logMessage('$what='.$what, 7);
 //OX_Delivery_logMessage('$context='.print_r($context,true), 7);
 // Get the banner
 $output = MAX_adSelect($what, $clientid, $target, $source, $withtext, $charset, $context, true, $ct0, $GLOBALS['loc'], $GLOBALS['referer']);
 //OX_Delivery_logMessage('$block='.@$block, 7);
 //OX_Delivery_logMessage(print_r($output, true), 7);
 //OX_Delivery_logMessage('output bannerid='.(empty($output['bannerid']) ? ' NO BANNERID' : $output['bannerid']), 7);
 // Store the html2js'd output for this ad
 $spc_output .= MAX_javascriptToHTML($output['html'], $conf['var']['prefix'] . "output['{$varname}']", false, false) . "\n";
 // Block this banner for next invocation
 if (!empty($block) && !empty($output['bannerid'])) {
     $output['context'][] = array('!=' => 'bannerid:' . $output['bannerid']);
 }
 // Block this campaign for next invocation
 if (!empty($blockcampaign) && !empty($output['campaignid'])) {
     $output['context'][] = array('!=' => 'campaignid:' . $output['campaignid']);
 }
 // Pass the context array back to the next call, have to iterate over elements to prevent duplication
 if (!empty($output['context'])) {
     foreach ($output['context'] as $id => $contextArray) {
         if (!in_array($contextArray, $context)) {
             $context[] = $contextArray;
         }
     }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:spc.php

示例5: substr

    $uniqid = substr(md5(uniqid('', 1)), 0, 8);
    // Block this banner for next invocation
    if (!empty($block) && !empty($output['bannerid'])) {
        $output['context'][] = array('!=' => 'bannerid:' . $output['bannerid']);
    }
    // Block this campaign for next invocation
    if (!empty($blockcampaign) && !empty($output['campaignid'])) {
        $output['context'][] = array('!=' => 'campaignid:' . $output['campaignid']);
    }
    // Block this campaign for next invocation
    if (!empty($blockcampaign) && !empty($output['campaignid'])) {
        $output['context'][] = array('!=' => 'campaignid:' . $output['campaignid']);
    }
    // Append any data to the context array
    if (!empty($output['context'])) {
        foreach ($output['context'] as $id => $contextArray) {
            if (!in_array($contextArray, $context)) {
                $context[] = $contextArray;
            }
        }
    }
    // Include the FlashObject script if required
    if ($output['contenttype'] == 'swf') {
        echo MAX_flashGetFlashObjectInline();
    }
    // Set document.context, if required
    $output['html'] .= !empty($context) ? "<script type='text/javascript'>document.context='" . MAX_commonPackContext($context) . "'; </script>" : '';
    echo MAX_javascriptToHTML(MAX_layerGetHtml($output, $uniqid), "MAX_{$uniqid}");
    MAX_layerPutJs($output, $uniqid);
    ob_flush();
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:31,代码来源:al.php

示例6: foreach

if (!empty($output['context'])) {
    foreach ($output['context'] as $id => $contextArray) {
        if (!in_array($contextArray, $context)) {
            $context[] = $contextArray;
        }
    }
}
// Append context, if any
$output['html'] .= !empty($context) ? "<script type='text/javascript'>document.context='" . MAX_commonPackContext($context) . "'; </script>" : '';
MAX_cookieFlush();
// Show the banner
MAX_commonSendContentTypeHeader("text/javascript", $charset);
if (isset($output['contenttype']) && $output['contenttype'] == 'swf' && !isset($mmm_fo)) {
    echo MAX_flashGetFlashObjectInline();
}
echo MAX_javascriptToHTML($output['html'], 'OX_' . substr(md5(uniqid('', 1)), 0, 8));
// Backwards compatible block-banner JS variable (>2.4 tags do all this via document.context)
if (!empty($block) && !empty($output['bannerid'])) {
    $varprefix = $GLOBALS['_MAX']['CONF']['var']['prefix'];
    echo "\nif (document.{$varprefix}used) document.{$varprefix}_used += 'bannerid:" . $output['bannerid'] . ",';\n";
    // Provide backwards compatibility for the time-being
    echo "\nif (document.MAX_used) document.MAX_used += 'bannerid:" . $output['bannerid'] . ",';\n";
    echo "\nif (document.phpAds_used) document.phpAds_used += 'bannerid:" . $output['bannerid'] . ",';\n";
}
// Backwards compatible block-campaign JS variable (>2.4 tags do all this via document.context)
if (!empty($blockcampaign) && !empty($output['campaignid'])) {
    $varprefix = $GLOBALS['_MAX']['CONF']['var']['prefix'];
    echo "\nif (document.{$varprefix}used) document.{$varprefix}used += 'campaignid:" . $output['campaignid'] . ",';\n";
    // Provide backwards compatibility for the time-being
    echo "\nif (document.MAX_used) document.MAX_used += 'campaignid:" . $output['campaignid'] . ",';\n";
    echo "\nif (document.phpAds_used) document.phpAds_used += 'campaignid:" . $output['campaignid'] . ",';\n";
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:ajs.php

示例7: MAX_cookieFlush

        }
        $logVars = true;
    }
}
MAX_cookieFlush();
// Write the code for tracking the variable values, and any
// additional appended tracker code
if ($logVars) {
    // The $logVars variable contains the code for tracking
    // the variable values (if required by the tracker), and
    // also the code for appending any additional tracker code
    // IF there was a conversion
    echo "{$variablesScript}";
} else {
    if ($append == true) {
        // As $logVars was empty, this could mean that there are
        // no variable values to track and there is no additional
        // appended code required; but it could also mean that
        // although there is additional appended code required, there
        // was no conversion recorded. As the $append variable
        // is true, double check to see if there is any additional
        // appended tracker code, and if so, send it
        $aTracker = MAX_cacheGetTracker($trackerid);
        if (!empty($aTracker['appendcode'])) {
            $appendScript = MAX_javascriptToHTML($aTracker['appendcode'], "MAX_{$trackerid}_appendcode", true);
            echo $appendScript;
        }
    }
}
// Post tracker render hook
OX_Delivery_Common_hook('postTrackerRender', array(&$aConversion, &$aConversionInfo, &$trackerid, &$inherit));
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:tjs.php


注:本文中的MAX_javascriptToHTML函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。