|
/**
* 获取广告
*/
function adshow($parameter) {
global $_G;
if($_G['inajax'] || $_G['group']['closead']) {
return;
}
if(isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] == 2) {
return '<hook>[ad '.$parameter.']</hook>';
}
$params = explode('/', $parameter);
$customid = 0;
$customc = explode('_', $params[0]);
if($customc[0] == 'custom') {
$params[0] = $customc[0];
$customid = $customc[1];
}
$adcontent = null;
if(empty($_G['setting']['advtype']) || !in_array($params[0], $_G['setting']['advtype'])) {
$adcontent = '';
}
if($adcontent === null) {
loadcache('advs');
$adids = array();
$evalcode = &$_G['cache']['advs']['evalcode'][$params[0]];
$parameters = &$_G['cache']['advs']['parameters'][$params[0]];
$codes = &$_G['cache']['advs']['code'][$_G['basescript']][$params[0]];
if(!empty($codes)) {
foreach($codes as $adid => $code) {
$parameter = &$parameters[$adid];
$checked = true;
@eval($evalcode['check']);
if($checked) {
$adids[] = $adid;
}
}
if(!empty($adids)) {
$adcode = $extra = '';
@eval($evalcode['create']);
if(empty($notag)) {
$adcontent = '<div'.($params[1] != '' ? ' class="'.$params[1].'"' : '').$extra.'>'.$adcode.'</div>';
} else {
$adcontent = $adcode;
}
}
}
}
$adfunc = 'ad_'.$params[0];
$_G['setting']['pluginhooks'][$adfunc] = null;
hookscript('ad', 'global', 'funcs', array('params' => $params, 'content' => $adcontent), $adfunc);
if(!$_G['setting']['hookscript']['global']['ad']['funcs'][$adfunc]) {
hookscript('ad', $_G['basescript'], 'funcs', array('params' => $params, 'content' => $adcontent), $adfunc);
}
return $_G['setting']['pluginhooks'][$adfunc] === null ? $adcontent : $_G['setting']['pluginhooks'][$adfunc];
} |
|