function adshow_display_ad_file_v2($adfiles, $adfiles_frequency = array(), $options = array(), $altfiles = array(), $altfiles_frequency = array()) { if (!adshow_functions_exist()) { return false; } if (adinj_config_debug_mode()) { echo "<!--ADINJ DEBUG: adshow_display_ad_file() quantity=" . sizeof($adfiles) . "-->\n"; } if (empty($adfiles) && empty($altfiles)) { echo "<!--ADINJ DEBUG: Error: adfiles and altfiles are empty-->\n"; return false; } $adfile = ""; $showads = adshow_show_adverts(); if ($showads !== true) { if (adinj_config_debug_mode()) { echo "<!--ADINJ DEBUG: ad blocked at run time reason={$showads}-->\n"; } $alt_content_file = adshow_pick_value($altfiles, $altfiles_frequency); if (!empty($alt_content_file)) { if (adinj_config_debug_mode()) { echo "<!--ADINJ DEBUG: alt content file defined:{$alt_content_file}-->\n"; } $adfile = $alt_content_file; } else { if (adinj_config_debug_mode()) { echo "<!--ADINJ DEBUG: no alt content file defined-->\n"; } return false; } } if (empty($adfile)) { $adfile = adshow_pick_value($adfiles, $adfiles_frequency); } if (adinj_config_debug_mode()) { echo "<!--ADINJ DEBUG: adshow_display_ad_file({$adfile})-->\n"; } $plugin_dir = dirname(__FILE__); $ad_path = dirname($plugin_dir) . '/ad-injection-data/' . $adfile; if (file_exists($ad_path)) { adshow_display_ad_full_path_v2($ad_path, $options); return; } echo "\r\n<!--ADINJ DEBUG: could not read ad: {$ad_path}\r\nIf you have just upgraded you may need to re-save your ads to regenerate the ad files.\r\n-->"; }
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); }