as_plugin_enabled($slug)判断插件是否已启用。用于插件内部函数的降级处理。
function adslot($code) {
if (!as_plugin_enabled('adslot')) {
return ''; // 插件停用时返回空字符串
}
$items = DB::rows(
'SELECT * FROM `' . DB_PREFIX . 'adslot_items` WHERE code = ? AND status = 1 ORDER BY sort DESC',
[$code]
);
return adslot_render($items);
}