Example #1
0
 function adshow_display_ad_full_path_v2($ad_path, $ops = array())
 {
     if (!adshow_functions_exist()) {
         return false;
     }
     if (!file_exists($ad_path)) {
         echo "<!--ADINJ DEBUG: ad file does not exist: {$ad_path}.\nIf you have just upgraded you may need to re-save your ads to regenerate the ad files.\n-->\n";
         return false;
     }
     $ad = file_get_contents($ad_path);
     if ($ad === false) {
         echo "<!--ADINJ DEBUG: could not read ad from file: {$ad_path}-->\n";
     }
     $ad = adshow_eval_php($ad);
     echo adshow_add_formatting($ad, $ops);
 }
function adinj_get_ad_code($adtype, $ads_db)
{
    $ops = adinj_options();
    $ads_live = NULL;
    $ads_split = NULL;
    $alt_live = NULL;
    $alt_split = NULL;
    $formatting = NULL;
    if (adinj_mfunc_mode()) {
        adinj_live_ads_array($adtype, $ads_db, $ads_live, $ads_split, 'string');
        adinj_live_ads_array($adtype . '_alt', $ads_db, $alt_live, $alt_split, 'string');
        $formatting = adinj_formatting_options($adtype, $ads_db, 'string');
    } else {
        $ads_live = array();
        $ads_split = array();
        $alt_live = array();
        $alt_split = array();
        adinj_live_ads_array($adtype, $ads_db, $ads_live, $ads_split, 'array');
        adinj_live_ads_array($adtype . '_alt', $ads_db, $alt_live, $alt_split, 'array');
        $formatting = adinj_formatting_options($adtype, $ads_db, 'array');
    }
    if (empty($ads_live) && empty($alt_live)) {
        return "";
    }
    if (adinj_mfunc_mode()) {
        return adinj_ad_code_eval("\n\n<!--Ad Injection mfunc mode ad code--><!--mfunc adshow_display_ad_file_v2(array({$ads_live}), array({$ads_split}), array({$formatting}), array({$alt_live}), array({$alt_split})) -->\n<?php adshow_display_ad_file_v2(array({$ads_live}), array({$ads_split}), array({$formatting}), array({$alt_live}), array({$alt_split})); ?>\n<!--/mfunc-->\n");
    }
    // else dynamic ad
    if (adshow_show_adverts() !== true) {
        $adname = adshow_pick_value($alt_live, $alt_split);
    } else {
        $adname = adshow_pick_value($ads_live, $ads_split);
    }
    $ad = $ads_db[$adname];
    if (empty($ad)) {
        return "";
    }
    $ad = adshow_add_formatting($ad, $formatting);
    return "<!--Ad Injection:{$adtype}-->" . adinj_ad_code_eval($ad);
}