function widget($args, $instance)
 {
     if (adinj_ads_completely_disabled_from_page()) {
         return;
     }
     $options = adinj_options();
     if (is_home() && adinj_ticked('widget_exclude_home') || is_page() && adinj_ticked('widget_exclude_page') || is_single() && adinj_ticked('widget_exclude_single') || is_archive() && adinj_ticked('widget_exclude_archive')) {
         return;
     }
     if ($options['ad_insertion_mode'] == 'direct_dynamic') {
         if (adinj_show_adverts() !== true) {
             return;
         }
     }
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     $advert = $instance['advert'];
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     $adcode = "";
     $include = "";
     if ($options['ad_insertion_mode'] == 'mfunc') {
         $include = adinj_ad_code_include();
         $adcode = adinj_get_mfunc_code($this->get_ad_file_name());
     } else {
         $adcode = $advert;
     }
     $adcode = adinj_ad_code_eval($adcode);
     if ($advert) {
         echo $include;
         echo $adcode;
     }
     echo $after_widget;
 }
示例#2
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);
}