getApById($ap_id); if (!$ap_info) return; $list = $ap_info['adv_list'];unset($ap_info['adv_list']); extract($ap_info); if($is_use !== '1'){ return ; } $adv_list = array(); $adv_info = array();//异步调用的数组格式 foreach ((array)$list as $k=>$v){ if($v['adv_start_date'] < $time && $v['adv_end_date'] > $time && $v['is_allow'] == '1'){ $adv_list[] = $v; } } if(empty($adv_list)){ if($ap_class == '1'){//文字广告 $content .= ""; $content .= $default_content; $content .= ""; }else{ $width = $ap_width; $height = $ap_height; $content .= ""; $content .= ""; $content .= ""; $adv_info['adv_title'] = $ap_name; $adv_info['adv_img'] = UPLOAD_SITE_URL."/".ATTACH_ADV."/".$default_content; $adv_info['adv_url'] = ''; } }else { $select = 0; if($ap_display == '1'){//多广告展示 $select = array_rand($adv_list); } $adv_select = $adv_list[$select]; extract($adv_select); //图片广告 if($ap_class == '0'){ $width = $ap_width; $height = $ap_height; $pic_content = unserialize($adv_content); $pic = $pic_content['adv_pic']; $url = $pic_content['adv_pic_url']; $content .= ""; $content .= "".$adv_title.""; $content .= ""; $adv_info['adv_title'] = $adv_title; $adv_info['adv_img'] = UPLOAD_SITE_URL."/".ATTACH_ADV."/".$pic; $adv_info['adv_url'] = 'http://'.$pic_content['adv_pic_url']; } //文字广告 if($ap_class == '1'){ $word_content = unserialize($adv_content); $word = $word_content['adv_word']; $url = $word_content['adv_word_url']; $content .= ""; $content .= $word; $content .= ""; } //Flash广告 if($ap_class == '3'){ $width = $ap_width; $height = $ap_height; $flash_content = unserialize($adv_content); $flash = $flash_content['flash_swf']; $url = $flash_content['flash_url']; $content .= ""; } } if ($type == 'array' && $ap_class == '0'){ return $adv_info; } if ($type == 'js'){ $content = "document.write(\"".$content."\");"; } return $content; }