浏览文章
文章信息
通用函数
12051
<?php /** * 文件信息 * 作者:邹万才 * 网名:秋风雁飞(可以百度看看) * 网站:www.aiweline.com/bbs.aiweline.com * 工具:PhpStorm * 日期:2019-8-11 * 时间:下午 07:27 * 描述: */ /** * 获取主域名 * @return string */ function aiweline_core_domain_get() { return $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . '/'; } /** * 插入核心块依赖 * @param $plugin * @param $plugin_setting [插件微蓝配置] * @param $plugin_conf [插件配置] */ function aiweline_core_insert_plugin($plugin, $plugin_setting, $plugin_conf) { $aiweline = aiweline_core_setting_get('Aiweline_Core'); $aiweline['plugins'][$plugin] = $plugin_setting;//插入插件 aiweline_core_setting_set('Aiweline_Core', $aiweline); aiweline_core_setting_set($plugin, $plugin_conf); } /** * 删除核心块依赖(卸载插件) * @param $plugin */ function aiweline_core_plugin_delete($plugin) { $aiweline = aiweline_core_setting_get('Aiweline_Core'); unset($aiweline['plugins'][$plugin]);//卸载插件 aiweline_core_setting_set('Aiweline_Core', $aiweline); setting_delete($plugin.'_conf'); } /** * 核心插件配置路由 * @param $plugin * @param string $area * @param string $action * @return string */ function aiweline_core_plugin_url($plugin, $area = 'frontend', $action = 'setting') { return url('Aiweline_Core_' . $area) . "&plugin={$plugin}&action={$action}"; } /** * 插件统一配置 * @param $plugin * @param $plugin_conf * @return mixed|string */ function aiweline_core_setting_get($plugin) { return setting_get($plugin . '_conf');//插件配置 } /** * 配置 * @param $plugin * @param $plugin_conf */ function aiweline_core_setting_set($plugin, $plugin_conf) { setting_set($plugin . '_conf', $plugin_conf);//插件配置 } /** * 获取安装插件的路径 * @return string */ function aiweline_core_get_plugin_path() { global $dir; return aiweline_core_domain_get() . "plugin/$dir/"; } function p($data) { echo '<pre>'; var_dump($data); die; }