示例#1
0
 function adinj_config_blocked_referrers_list()
 {
     $list = adinj_quote_list('blocked_keywords');
     return preg_split("/[,'\\s]+/", $list, -1, PREG_SPLIT_NO_EMPTY);
 }
function adinj_write_config_file()
{
    if (!adinj_mfunc_mode()) {
        return;
    }
    $ops = adinj_options();
    $allow_referrers = adinj_ticked('sevisitors_only') ? 'true' : 'false';
    $allowed_referrers_list = adinj_quote_list('ad_referrers');
    $block_ips = adinj_ticked('block_ips') ? 'true' : 'false';
    $blocked_ip_list = adinj_quote_list('blocked_ips');
    $block_referrers = adinj_ticked('block_keywords') ? 'true' : 'false';
    $blocked_referrers_list = adinj_quote_list('blocked_keywords');
    $block_hours = $ops['block_ads_for_hours'];
    $debug_mode = adinj_ticked('debug_mode') ? 'true' : 'false';
    $version = adinj_db_version($ops);
    $config = <<<CONFIG
<?php
/*
Ad Injection config file dbversion={$version}
DO NOT EDIT MANUALLY
This file is generated by Ad Injection
*/

function adinj_config_allow_referrers() { return {$allow_referrers}; }
function adinj_config_allowed_referrers_list() { return array({$allowed_referrers_list}); }

function adinj_config_block_ips() { return {$block_ips}; }
function adinj_config_blocked_ips_list() { return array({$blocked_ip_list}); }

function adinj_config_block_referrers() { return {$block_referrers}; }
function adinj_config_blocked_referrers_list() { return array({$blocked_referrers_list}); }
function adinj_config_block_hours() { return {$block_hours}; }

function adinj_config_block_after_ad_click() { return false; }

function adinj_config_debug_mode() { return {$debug_mode}; }

?>
CONFIG;
    adinj_write_file(ADINJ_CONFIG_FILE, $config, 0640);
}
function adinj_print_referrers_hook()
{
    // TODO can re-enable this check once the widget ads are factored in.
    //if (adinj_ads_completely_disabled_from_page()) return;
    $sevisitors = adinj_ticked('sevisitors_only');
    $block = adinj_ticked('block_keywords');
    if (!$sevisitors && !$block) {
        return;
    }
    echo <<<SCRIPT

<script type="text/javascript">
// Ad Injection plugin

SCRIPT;
    $ops = adinj_options();
    $referrer_list = adinj_quote_list('ad_referrers');
    $blocked_list = adinj_quote_list('blocked_keywords');
    $blocked_hours = $ops['block_ads_for_hours'];
    if ($sevisitors) {
        echo "var adinj_referrers = new Array({$referrer_list});\n";
    }
    if ($block) {
        echo "var adinj_blocked_referrers = new Array({$blocked_list});\n";
    }
    if ($block) {
        echo "var adinj_blocked_hours = {$blocked_hours};\n";
    }
    echo "adinj_dynamic_checks();\n";
    echo "</script>\n";
}
示例#4
0
function adinj_blocked_ips()
{
    $list = adinj_quote_list('blocked_ips');
    return preg_split("/[,'\\s]+/", $list, -1, PREG_SPLIT_NO_EMPTY);
}
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);
}