以UEditor插件为例
[推荐] 方法一:判断插件是否安装 (无论是否启用):
//判断是否安装“UEditor”插件
$ueUrl = $zbp->host .'zb_users/plugin/AppCentre/main.php?id=228';
if($zbp->LoadApp('plugin', 'UEditor')->isloaded){
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/UEditor/ueditor.config.php"></script>';
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/UEditor/ueditor.all.min.js"></script>';
}else{
$zbp->ShowHint('bad', '请安装 (<a href="'. $ueUrl .'">UEditor编辑器</a>) 插件!');
}
方法二:判断插件是否安装并且启用:
//判断是否安装并且启用“UEditor”插件
$dependplugin = array('UEditor'=>'UEditor编辑器');
foreach ($dependplugin as $key=>$pluginname) {
if (!$zbp->CheckPlugin($key)) {
$zbp->ShowHint('bad', '请安装并启用 ' . $pluginname . ' (' . $key . ') 插件!');
}
}
方法三:通过判断文件是否存在 (无论是否启用):
//判断是否安装“UEditor”插件
$ueConfig = $zbp->path .'zb_users/plugin/UEditor/ueditor.config.php';
$ueAll = $zbp->path .'zb_users/plugin/UEditor/ueditor.all.min.js';
$ueUrl = $zbp->host .'zb_users/plugin/AppCentre/main.php?id=228';
if(file_exists($ueConfig) && file_exists($ueAll)){
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/UEditor/ueditor.config.php"></script>';
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/UEditor/ueditor.all.min.js"></script>';
}else{
$zbp->ShowHint('bad', '请安装 (<a href="'. $ueUrl .'">UEditor编辑器</a>) 插件!');
}
方法四:也是通过判断文件是否存在 (无论是否启用):
//判断是否安装“UEditor”插件
$path = realpath(dirname(__FILE__).'/../');
$ueConfig = $path .'zb_users/plugin/UEditor/ueditor.config.php';
$ueAll = $path .'zb_users/plugin/UEditor/ueditor.all.min.js';
$ueUrl = $zbp->host .'zb_users/plugin/AppCentre/main.php?id=228';
if(file_exists($ueConfig) && file_exists($ueAll)){
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/UEditor/ueditor.config.php"></script>';
echo '<script type="text/javascript" src="' . $zbp->host . 'zb_users/plugin/UEditor/ueditor.all.min.js"></script>';
}else{
$zbp->ShowHint('bad', '请安装 (<a href="'. $ueUrl .'">UEditor编辑器</a>) 插件!');
}
拓源主题 - 您身边的原创网站定制专家 丨 应用交流和开发工具可 点此加入ZBlog中国群