• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_addon_class函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_addon_class函数的典型用法代码示例。如果您正苦于以下问题:PHP get_addon_class函数的具体用法?PHP get_addon_class怎么用?PHP get_addon_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_addon_class函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getAllAddon

 /**
  * 获取插件列表
  * @param string $addon_dir
  * @author jry <[email protected]>
  */
 public function getAllAddon($addon_dir = THINK_ADDON_PATH)
 {
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     if ($dirs === FALSE || !file_exists($addon_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return FALSE;
     }
     $addons = array();
     $map['name'] = array('in', $dirs);
     $list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
     foreach ($list as $addon) {
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['status'] = -1;
                 //未安装
             }
         }
     }
     foreach ($addons as &$val) {
         switch ($val['status']) {
             case '-1':
                 //未安装
                 $val['status'] = '<i class="glyphicon glyphicon-trash" style="color:red"></i>';
                 $val['right_button'] = '<a class="ajax-get" href="' . U('install?addon_name=' . $val['name']) . '">安装</a>';
                 break;
             case '0':
                 //禁用
                 $val['status'] = '<i class="glyphicon glyphicon-ban-circle" style="color:red"></i>';
                 $val['right_button'] = '<a href="' . U('config', array('id' => $val['id'])) . '">设置</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '">启用</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('uninstall?id=' . $val['id']) . '">卸载</a> ';
                 if ($val['adminlist']) {
                     $val['right_button'] .= '<a href="' . U('adminlist', array('name' => $val['name'])) . '">管理</a>';
                 }
                 break;
             case '1':
                 //正常
                 $val['status'] = '<i class="glyphicon glyphicon-ok" style="color:green"></i>';
                 $val['right_button'] = '<a href="' . U('config', array('id' => $val['id'])) . '">设置</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '">禁用</a> ';
                 $val['right_button'] .= '<a class="ajax-get" href="' . U('uninstall?id=' . $val['id']) . '">卸载</a> ';
                 if ($val['adminlist']) {
                     $val['right_button'] .= '<a href="' . U('adminlist', array('name' => $val['name'])) . '">管理</a>';
                 }
                 break;
         }
     }
     return $addons;
 }
开发者ID:sayi21cn,项目名称:corethink,代码行数:65,代码来源:AddonModel.class.php


示例2: getRank

 public function getRank()
 {
     $aType = I('post.type', 'today', 'op_t');
     $name = get_addon_class('CheckIn');
     $class = new $name();
     $html = $class->rank($aType);
     $this->ajaxReturn(array('status' => 1, 'html' => $html));
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:8,代码来源:CheckInController.class.php


示例3: _initialize

 public function _initialize()
 {
     $class = get_addon_class('BaiduRankTool');
     if (!class_exists($class)) {
         $this->error('插件不存在');
     }
     $this->addon = new $class();
     $this->_config = $this->addon->getConfig();
 }
开发者ID:slpi1,项目名称:onethinkTemplate,代码行数:9,代码来源:BaiduRankToolController.class.php


示例4: get_addon_config

/**
 * 获取插件类的配置文件数组
 * @param string $name 插件名
 */
function get_addon_config($name)
{
    $class = get_addon_class($name);
    if (class_exists($class)) {
        $addon = new $class();
        return $addon->getConfig();
    } else {
        return array();
    }
}
开发者ID:Willshon,项目名称:OLCS,代码行数:14,代码来源:addons.php


示例5: getList

 /**
  * 获取插件列表
  * @param string $addon_dir
  */
 public function getList($addon_dir = '')
 {
     if (!$addon_dir) {
         $addon_dir = ONETHINK_ADDON_PATH;
     }
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     //TODO 新增模块插件的支持
     /* $modules=D('Module')->getAll();
        foreach($modules as $m){
            if($m['is_setup']){
                $module_dir=APP_PATH.$m['name'].'/Addons/';
                if(!file_exists($module_dir)){
                    continue;
                }
                $tmp_dirs = array_map('basename',glob($module_dir.'*', GLOB_ONLYDIR));
                $dirs=array_merge($dirs,$tmp_dirs);
            }
        }*/
     if ($dirs === FALSE || !file_exists($addon_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return FALSE;
     }
     $addons = array();
     $where['name'] = array('in', $dirs);
     $list = $this->where($where)->field(true)->select();
     foreach ($list as $addon) {
         $addon['uninstall'] = 0;
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['uninstall'] = 1;
                 unset($addons[$value]['status']);
             }
         }
     }
     //dump($list);exit;
     int_to_string($addons, array('status' => array(-1 => '损坏', 0 => '禁用', 1 => '启用', null => '未安装')));
     $addons = list_sort_by($addons, 'uninstall', 'desc');
     return $addons;
 }
开发者ID:xiaolw,项目名称:wacms,代码行数:54,代码来源:AddonsModel.class.php


示例6: getList

 /**
  * 获取插件列表
  *
  * @param string $addon_dir        	
  */
 public function getList($addon_dir = '')
 {
     if (!$addon_dir) {
         $addon_dir = ONETHINK_ADDON_PATH;
     }
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     if ($dirs === FALSE || !file_exists($addon_dir) || count($dirs) == 0) {
         $this->error = '插件目录不可读或者不存在';
         return FALSE;
     }
     $addons = array();
     $where['name'] = array('in', $dirs);
     $list = $this->where($where)->field(true)->order('id desc')->select();
     foreach ($list as $addon) {
         $addon['is_weixin'] = file_exists($addon_dir . $addon['name'] . '/Model/WeixinAddonModel.class.php');
         $addon['uninstall'] = 0;
         $addon['is_show_text'] = $addon['is_show'] == 1 ? '是' : '否';
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['uninstall'] = 1;
                 unset($addons[$value]['status']);
             }
             $addons[$value]['is_weixin'] = file_exists($addon_dir . $value . '/Model/WeixinAddonModel.class.php');
         }
     }
     foreach ($addons as $key => $val) {
         if (!$val['is_weixin']) {
             unset($addons[$key]);
         }
     }
     int_to_string($addons, array('status' => array(-1 => '损坏', 0 => '禁用', 1 => '启用', null => '未安装')));
     $addons = list_sort_by($addons, 'uninstall', 'desc');
     return $addons;
 }
开发者ID:LukeChow1018,项目名称:weixin,代码行数:50,代码来源:AddonsModel.class.php


示例7: config

 public function config()
 {
     $this->getModel();
     if (IS_POST) {
         $flag = D('Common/AddonConfig')->set(_ADDONS, I('config'));
         if ($flag !== false) {
             $this->success('保存成功', Cookie('__forward__'));
         } else {
             $this->error('保存失败');
         }
     }
     $map['name'] = _ADDONS;
     $addon = M('addons')->where($map)->find();
     if (!$addon) {
         $this->error('插件未安装');
     }
     $addon_class = get_addon_class($addon['name']);
     if (!class_exists($addon_class)) {
         trace("插件{$addon['name']}无法实例化,", 'ADDONS', 'ERR');
     }
     $data = new $addon_class();
     $addon['addon_path'] = $data->addon_path;
     $addon['custom_config'] = $data->custom_config;
     $this->meta_title = '设置插件-' . $data->info['title'];
     $db_config = D('Common/AddonConfig')->get(_ADDONS);
     // dump ( $db_config );
     $addon['config'] = (include $data->config_file);
     if ($db_config) {
         foreach ($addon['config'] as $key => $value) {
             if ($value['type'] != 'group') {
                 !isset($db_config[$key]) || ($addon['config'][$key]['value'] = $db_config[$key]);
             } else {
                 foreach ($value['options'] as $gourp => $options) {
                     foreach ($options['options'] as $gkey => $value) {
                         !isset($db_config[$key]) || ($addon['config'][$key]['options'][$gourp]['options'][$gkey]['value'] = $db_config[$gkey]);
                     }
                 }
             }
         }
     }
     $this->assign('data', $addon);
     $this->display();
 }
开发者ID:yxz1025,项目名称:weiphp3.0,代码行数:43,代码来源:LeafletsController.class.php


示例8: removeHooks

 /**
  * 去除插件所有钩子里对应的插件数据
  */
 public function removeHooks($name)
 {
     $addons_class = get_addon_class($name);
     if (!class_exists($addons_class)) {
         return false;
     }
     $methods = get_class_methods($addons_class);
     $hooks = $this->getField('name', true);
     $common = array_intersect($hooks, $methods);
     if ($common) {
         foreach ($common as $hook) {
             $flag = $this->removeAddons($hook, array($name));
             if (false === $flag) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:easytp,项目名称:easytp,代码行数:22,代码来源:HooksModel.class.php


示例9: config

 function config()
 {
     $normal_tips = '配置完保存后,在微信里回复: 会员卡,即可看到效果。';
     $this->assign('normal_tips', $normal_tips);
     $this->getModel();
     if (IS_POST) {
         if ($_POST['config']['background'] == 11) {
             $_POST['config']['background_custom'] = get_cover_url($_POST['config']['bg']);
         }
         $flag = D('Common/AddonConfig')->set(_ADDONS, I('config'));
         if ($flag !== false) {
             $this->success('保存成功', Cookie('__forward__'));
         } else {
             $this->error('保存失败');
         }
     }
     $map['name'] = _ADDONS;
     $addon = M('Addons')->where($map)->find();
     if (!$addon) {
         $this->error('插件未安装');
     }
     $addon_class = get_addon_class($addon['name']);
     $data = new $addon_class();
     $addon['addon_path'] = $data->addon_path;
     $addon['custom_config'] = $data->custom_config;
     $db_config = D('Common/AddonConfig')->get(_ADDONS);
     $addon['config'] = (include $data->config_file);
     if ($db_config) {
         foreach ($addon['config'] as $key => $value) {
             if ($value['type'] != 'group') {
                 !isset($db_config[$key]) || ($addon['config'][$key]['value'] = $db_config[$key]);
             } else {
                 foreach ($value['options'] as $gourp => $options) {
                     foreach ($options['options'] as $gkey => $value) {
                         !isset($db_config[$key]) || ($addon['config'][$key]['options'][$gourp]['options'][$gkey]['value'] = $db_config[$gkey]);
                     }
                 }
             }
         }
     }
     $this->assign('data', $addon);
     $this->display();
 }
开发者ID:Backflag,项目名称:weiphp2.0.1202,代码行数:43,代码来源:CardController.class.php


示例10: getList

 /**
  * 获取插件列表
  * @param string $addon_dir
  */
 public function getList($addon_dir = '')
 {
     if (!$addon_dir) {
         $addon_dir = ZS_ADDON_PATH;
     }
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     if ($dirs === FALSE || !file_exists($addon_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return FALSE;
     }
     $addons = array();
     $where['name'] = array('in', $dirs);
     $list = $this->where($where)->field(true)->select();
     foreach ($list as $addon) {
         $addon['uninstall'] = 0;
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             $admin_list = $obj->admin_list;
             if ($addons[$value]) {
                 $addons[$value]['uninstall'] = 1;
                 unset($addons[$value]['status']);
             }
             if ($admin_list) {
                 $addons[$value]['has_adminlist'] = 1;
             } else {
                 $addons[$value]['has_adminlist'] = 0;
             }
         }
     }
     int_to_string($addons, array('status' => array(-1 => '损坏', 0 => '禁用', 1 => '启用', null => '未安装')));
     $addons = list_sort_by($addons, 'uninstall', 'desc');
     return $addons;
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:47,代码来源:AddonsModel.class.php


示例11: getList

 public function getList()
 {
     $dirs = array_map('basename', glob(ADDON_PATH . '*', GLOB_ONLYDIR));
     if ($dirs === false || !file_exists(ADDON_PATH)) {
         $this->error = '插件目录不可读或者不存在';
         return array();
     }
     $addons = array();
     $list = $this->select();
     foreach ($list as &$info) {
         $info['uninstall'] = 0;
         $addons[$info['name']] = $info;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['uninstall'] = 1;
                 $addons[$value]['status'] = null;
             }
         }
     }
     $result = array();
     $map = array('status' => array(-1 => '损坏', 0 => '禁用', 1 => '启用', null => '未安装'));
     foreach ($addons as $key => &$row) {
         if (!in_array($key, $dirs)) {
             $row['status'] = -1;
         }
         $row['status_text'] = $map['status'][$row['status']] ?: '-';
         array_push($result, $row);
     }
     return $result;
 }
开发者ID:easytp,项目名称:easytp,代码行数:40,代码来源:AddonsModel.class.php


示例12: getList

 /**
  * 获取插件列表
  * @param string $addon_dir
  * @param int $limit
  * @return array|bool
  */
 public function getList($addon_dir = '', $limit = 0)
 {
     if (!$addon_dir) {
         $addon_dir = Addon_PATH;
     }
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     if ($dirs === false || !File::file_exists($addon_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return false;
     }
     $addons = array();
     $where['name'] = array('in', $dirs);
     $list = $this->where($where)->field(true)->limit($limit)->select();
     foreach ($list as $addon) {
         $addon['uninstall'] = 0;
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['uninstall'] = 1;
                 $addons[$value]['status'] = 99;
             }
         } else {
             //todo 已安装的
         }
     }
     int_to_string($addons, array('status' => array(-1 => '损坏', 0 => '禁用', 1 => '启用', 99 => '未安装')));
     $addons = list_sort_by($addons, 'uninstall', 'desc');
     return $addons;
 }
开发者ID:jackycgq,项目名称:GreenCMS,代码行数:45,代码来源:AddonsModel.class.php


示例13: del

 public function del($id = '', $name)
 {
     $ids = array_unique((array) I('ids', 0));
     if (empty($ids)) {
         $this->error('请选择要操作的数据!');
     }
     $class = get_addon_class($name);
     if (!class_exists($class)) {
         $this->error('插件不存在');
     }
     $addon = new $class();
     $param = $addon->admin_list;
     if (!$param) {
         $this->error('插件列表信息不正确');
     }
     extract($param);
     if (isset($model)) {
         $addonModel = D("Addons://{$name}/{$model}");
         if (!$addonModel) {
             $this->error('模型无法实列化');
         }
     }
     $map = array('id' => array('in', $ids));
     if ($addonModel->where($map)->delete()) {
         $this->success('删除成功');
     } else {
         $this->error('删除失败!');
     }
 }
开发者ID:WineShop,项目名称:wine,代码行数:29,代码来源:AddonsController.class.php


示例14: ajax_apiparam

 /**
  * 根据Api获取参数
  */
 public function ajax_apiparam()
 {
     if (IS_AJAX) {
         $addonstype = I('cate', 0);
         $addonsid = I('cateid', 0);
         if (!in_array($addonstype, array('local', 'cloud'))) {
             $data['status'] = 0;
             $data['errmsg'] = '插件不存在';
             $this->ajaxReturn($data, 'JSON');
         } else {
             if ($addonstype == 'local') {
                 $addon_name = M('Addons')->where(array('id' => $addonsid))->getField('name');
                 $class = get_addon_class($addon_name);
                 if (!class_exists($class)) {
                     $data['status'] = 0;
                     $data['errmsg'] = '插件不存在';
                     $this->ajaxReturn($data, 'JSON');
                 }
                 $addons = new $class();
                 $paramlist = $addons->info['weixinkeyword']['option'];
                 $newlist = array();
                 foreach ($paramlist as $key => $value) {
                     $newlist[] = array('0' => $key, '2' => $key . '【' . $value . '】');
                 }
                 $data['status'] = 1;
                 $data['msg'] = $newlist;
                 $this->ajaxReturn($data, 'JSON');
             }
         }
     }
 }
开发者ID:Luckyseal,项目名称:amango,代码行数:34,代码来源:KeywordviewController.class.php


示例15: sendSMS

function sendSMS($mobile, $content)
{
    $sms_hook = modC('SMS_HOOK', 'none', 'USERCONFIG');
    $sms_hook = check_sms_hook_is_exist($sms_hook);
    if ($sms_hook == 'none') {
        return L('_THE_ADMINISTRATOR_HAS_NOT_CONFIGURED_THE_SMS_SERVICE_PROVIDER_INFORMATION_PLEASE_CONTACT_THE_ADMINISTRATOR_');
    }
    $name = get_addon_class($sms_hook);
    $class = new $name();
    return $class->sendSms($mobile, $content);
}
开发者ID:terrydeng,项目名称:beimeibang1205,代码行数:11,代码来源:vendors.php


示例16: getList

 /**
  * 获取插件列表
  * @param string $addon_dir
  */
 public function getList($addon_dir = '')
 {
     if (!$addon_dir) {
         $addon_dir = ONETHINK_ADDON_PATH;
     }
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     //TODO 新增模块插件的支持
     /* $modules=D('Module')->getAll();
        foreach($modules as $m){
            if($m['is_setup']){
                $module_dir=APP_PATH.$m['name'].'/Addons/';
                if(!file_exists($module_dir)){
                    continue;
                }
                $tmp_dirs = array_map('basename',glob($module_dir.'*', GLOB_ONLYDIR));
                $dirs=array_merge($dirs,$tmp_dirs);
            }
        }*/
     if ($dirs === FALSE || !file_exists($addon_dir)) {
         $this->error = L('_THE_PLUGIN_DIRECTORY_IS_NOT_READABLE_OR_NOT_');
         return FALSE;
     }
     $addons = array();
     $where['name'] = array('in', $dirs);
     $list = $this->where($where)->field(true)->select();
     foreach ($list as $addon) {
         $addon['uninstall'] = 0;
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record(L('_PLUGIN_') . $value . L('_THE_ENTRY_FILE_DOES_NOT_EXIST_WITH_EXCLAMATION_'));
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['uninstall'] = 1;
                 unset($addons[$value]['status']);
             }
         }
     }
     //dump($list);exit;
     int_to_string($addons, array('status' => array(-1 => L('_DAMAGE_'), 0 => L('_DISABLE_'), 1 => L('_ENABLE_'), null => L('_NOT_INSTALLED_'))));
     $addons = list_sort_by($addons, 'uninstall', 'desc');
     return $addons;
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:54,代码来源:AddonsModel.class.php


示例17: del

 public function del($id = '', $name)
 {
     $ids = array_unique((array) I('ids', 0));
     if (empty($ids)) {
         $this->error(L('_ERROR_DATA_SELECT_'));
     }
     $class = get_addon_class($name);
     if (!class_exists($class)) {
         $this->error(L('_PLUGIN_DOES_NOT_EXIST_'));
     }
     $addon = new $class();
     $param = $addon->admin_list;
     if (!$param) {
         $this->error(L('_THE_PLUGIN_LIST_INFORMATION_IS_NOT_CORRECT_'));
     }
     extract($param);
     if (isset($model)) {
         $addonModel = D("Addons://{$name}/{$model}");
         if (!$addonModel) {
             $this->error(L('_MODEL_CANNOT_BE_REAL_'));
         }
     }
     $map = array('id' => array('in', $ids));
     if ($addonModel->where($map)->delete()) {
         $this->success(L('_DELETE_SUCCESS_'));
     } else {
         $this->error(L('_DELETE_FAILED_'));
     }
 }
开发者ID:naliduo,项目名称:Lightweight-social-platform,代码行数:29,代码来源:AddonsController.class.php


示例18: getAllAddon

 /**
  * 获取插件列表
  * @param string $addon_dir
  * @author jry <[email protected]>
  */
 public function getAllAddon()
 {
     $addon_dir = C('ADDON_PATH');
     $dirs = array_map('basename', glob($addon_dir . '*', GLOB_ONLYDIR));
     if ($dirs == false || !file_exists($addon_dir)) {
         $this->error = '插件目录不可读或者不存在';
         return false;
     }
     $addons = array();
     $map['name'] = array('in', $dirs);
     $list = $this->where($map)->field(true)->order('sort asc,id desc')->select();
     foreach ($list as $addon) {
         $addons[$addon['name']] = $addon;
     }
     foreach ($dirs as $value) {
         if (!isset($addons[$value])) {
             $class = get_addon_class($value);
             if (!class_exists($class)) {
                 // 实例化插件失败忽略执行
                 \Think\Log::record('插件' . $value . '的入口文件不存在!');
                 continue;
             }
             $obj = new $class();
             $addons[$value] = $obj->info;
             if ($addons[$value]) {
                 $addons[$value]['status'] = -1;
                 // 未安装
             }
         }
     }
     foreach ($addons as &$val) {
         switch ($val['status']) {
             case '-1':
                 // 未安装
                 $val['status'] = '<i class="fa fa-trash" style="color:red"></i>';
                 $val['right_button']['install']['title'] = '安装';
                 $val['right_button']['install']['attribute'] = 'class="label label-success ajax-get" href="' . U('install', array('addon_name' => $val['name'])) . '"';
                 break;
             case '0':
                 // 禁用
                 $val['status'] = '<i class="fa fa-ban" style="color:red"></i>';
                 $val['right_button']['config']['title'] = '设置';
                 $val['right_button']['config']['attribute'] = 'class="label label-info" href="' . U('config', array('id' => $val['id'])) . '"';
                 $val['right_button']['forbid']['title'] = '启用';
                 $val['right_button']['forbid']['attribute'] = 'class="label label-success ajax-get" href="' . U('setStatus', array('status' => 'resume', 'ids' => $val['id'])) . '"';
                 $val['right_button']['uninstall']['title'] = '卸载';
                 $val['right_button']['uninstall']['attribute'] = 'class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '"';
                 if ($val['adminlist']) {
                     $val['right_button']['adminlist']['title'] = '数据管理';
                     $val['right_button']['adminlist']['attribute'] = 'class="label label-success" href="' . U('adminlist', array('name' => $val['name'])) . '"';
                 }
                 break;
             case '1':
                 // 正常
                 $val['status'] = '<i class="fa fa-check" style="color:green"></i>';
                 $val['right_button']['config']['title'] = '设置';
                 $val['right_button']['config']['attribute'] = 'class="label label-info" href="' . U('config', array('id' => $val['id'])) . '"';
                 $val['right_button']['forbid']['title'] = '禁用';
                 $val['right_button']['forbid']['attribute'] = 'class="label label-warning ajax-get" href="' . U('setStatus', array('status' => 'forbid', 'ids' => $val['id'])) . '"';
                 $val['right_button']['uninstall']['title'] = '卸载';
                 $val['right_button']['uninstall']['attribute'] = 'class="label label-danger ajax-get" href="' . U('uninstall', array('id' => $val['id'])) . '"';
                 if ($val['adminlist']) {
                     $val['right_button']['adminlist']['title'] = '数据管理';
                     $val['right_button']['adminlist']['attribute'] = 'class="label label-success" href="' . U('adminlist', array('name' => $val['name'])) . '"';
                 }
                 break;
         }
     }
     return $addons;
 }
开发者ID:applemin,项目名称:tangguo,代码行数:75,代码来源:AddonModel.class.php


示例19: uninstall

 /**
  * 卸载插件
  */
 public function uninstall()
 {
     $addonsModel = M('Addons');
     $id = $_REQUEST['id'];
     $db_addons = $addonsModel->find($id);
     $class = get_addon_class($db_addons['name']);
     $this->assign('jumpUrl', U('index'));
     if (!$db_addons || !class_exists($class)) {
         //$this->error('插件不存在');
         $this->mtReturn(300, '插件不存在');
     }
     session('addons_uninstall_error', null);
     $addons = new $class();
     $uninstall_flag = $addons->uninstall();
     if (!$uninstall_flag) {
         //$this->error('执行插件预卸载操作失败'.session('addons_uninstall_error'));
         $this->mtReturn(300, '执行插件预卸载操作失败' . session('addons_uninstall_error'));
     }
     $hooks_update = D('Hooks')->removeHooks($db_addons['name']);
     if ($hooks_update === false) {
         //$this->error('卸载插件所挂载的钩子数据失败');
         $this->mtReturn(300, '卸载插件所挂载的钩子数据失败');
     }
     S('hooks', null);
     $delete = $addonsModel->where("name='{$db_addons['name']}'")->delete();
     if ($delete === false) {
         // $this->error('卸载插件失败');
         $this->mtReturn(300, '卸载插件失败');
     } else {
         //$this->success('卸载成功');
         $this->mtReturn(200, '"' . $db_addons['title'] . '"插件卸载成功', '', 'forward', cookie('_currentUrl_'));
     }
 }
开发者ID:Willshon,项目名称:OLCS,代码行数:36,代码来源:AddonsController.class.php


示例20: sendSMS

function sendSMS($mobile, $content)
{
    $sms_hook = modC('SMS_HOOK', 'none', 'USERCONFIG');
    $sms_hook = check_sms_hook_is_exist($sms_hook);
    if ($sms_hook == 'none') {
        return "管理员还未配置短信服务商信息,请联系管理员";
    }
    $name = get_addon_class($sms_hook);
    $class = new $name();
    return $class->sendSms($mobile, $content);
}
开发者ID:ccccy,项目名称:wuanlife,代码行数:11,代码来源:vendors.php



注:本文中的get_addon_class函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_address函数代码示例发布时间:2022-05-15
下一篇:
PHP get_addition_all_info函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap