Example #1
0
function adinj_ad_code_bottom()
{
    $ops = adinj_options();
    $ad = $ops['ad_code_bottom_1'];
    if (empty($ad)) {
        return "<!--ADINJ DEBUG: no bottom ad defined. Either define it or turn the ad off-->";
    }
    if ($ops['ad_insertion_mode'] == 'mfunc') {
        $ad = adinj_get_mfunc_code(ADINJ_AD_BOTTOM_FILE);
    } else {
        $ad = adinj_add_tags($ad, 'bottom_');
    }
    global $adinj_total_all_ads_used;
    ++$adinj_total_all_ads_used;
    return adinj_ad_code_eval($ad);
}
function adinj_write_config_file()
{
    $ops = adinj_options();
    if ($ops['ad_insertion_mode'] != 'mfunc') {
        return;
    }
    $referrer_list = adinj_quote_list('ad_referrers');
    $ip_list = adinj_quote_list('blocked_ips');
    $sevisitors_only = adinj_ticked('sevisitors_only') ? 'true' : 'false';
    $debug_mode = adinj_ticked('debug_mode') ? 'true' : 'false';
    $rnd_func = adinj_add_tags(NULL, 'rnd_', 'adinj_config_add_tags_rnd');
    $top_func = adinj_add_tags(NULL, 'top_', 'adinj_config_add_tags_top');
    $bottom_func = adinj_add_tags(NULL, 'bottom_', 'adinj_config_add_tags_bottom');
    $config = <<<CONFIG
<?php
/*
Ad Injection config file
DO NOT EDIT MANUALLY
This file is generated by Ad Injection
*/

function adinj_config_sevisitors_only() { return {$sevisitors_only}; }
function adinj_config_search_engine_referrers() { return array({$referrer_list}); }
function adinj_config_blocked_ips() { return array({$ip_list}); }
function adinj_config_debug_mode() { return {$debug_mode}; }
{$rnd_func}
{$top_func}
{$bottom_func}

?>
CONFIG;
    adinj_write_file(ADINJ_CONFIG_FILE, $config, 0640);
}