瀏覽代碼

1,插件化富文本编辑器功能,方便第三方整合。
2,修复url推送默认显示配置项问题。
3,其他细节。

magicblack 5 年之前
父節點
當前提交
14b895c7ec

+ 1 - 0
application/admin/controller/Base.php

@@ -37,6 +37,7 @@ class Base extends All
                 return $this->error('您没有权限访问此页面');
             }
         }
+        $this->assign('cl',$this->_cl);
     }
 
     public function check_auth($c,$a)

+ 11 - 72
application/admin/controller/System.php

@@ -128,6 +128,9 @@ class System extends Base
         $usergroup = Db::name('group')->select();
         $this->assign('usergroup', $usergroup);
 
+        $editors = mac_extends_list('editor');
+        $this->assign('editors',$editors);
+
         $config = config('maccms');
         $this->assign('config', $config);
         $this->assign('title', '网站参数配置');
@@ -255,25 +258,8 @@ class System extends Base
 
         $this->assign('config', config('maccms'));
 
-        $path = './application/common/extend/upload';
-        $file_list = glob($path . '/*.php',GLOB_NOSORT );
-        $ext_list = [];
-        $ext_html = '';
-        foreach($file_list as $k=>$v) {
-            $cl = str_replace([$path . '/', '.php'], '', $v);
-            $cp = 'app\\common\\extend\\upload\\' . $cl;
-
-            if (class_exists($cp)) {
-                $c = new $cp;
-                $ext_list[$cl] = $c->name;
-
-                if(file_exists( './application/admin/view/extend/upload/'.strtolower($cl) .'.html')) {
-                    $ext_html .= $this->fetch('admin@extend/upload/' . strtolower($cl));
-                }
-            }
-        }
-        $this->assign('ext_list',$ext_list);
-        $this->assign('ext_html',$ext_html);
+        $extends = mac_extends_list('upload');
+        $this->assign('extends',$extends);
 
         $this->assign('title', '附件参数配置');
         return $this->fetch('admin@system/configupload');
@@ -343,26 +329,8 @@ class System extends Base
         $this->assign('http_type',$GLOBALS['http_type']);
         $this->assign('config', config('maccms'));
 
-        $path = './application/common/extend/pay';
-        $file_list = glob($path . '/*.php',GLOB_NOSORT );
-        $ext_list = [];
-        $ext_html = '';
-        foreach($file_list as $k=>$v) {
-            $cl = str_replace([$path . '/', '.php'], '', $v);
-            $cp = 'app\\common\\extend\\pay\\' . $cl;
-
-            if (class_exists($cp)) {
-                $c = new $cp;
-                $ext_list[$cl] = $c->name;
-
-                if(file_exists( './application/admin/view/extend/pay/'.strtolower($cl) .'.html')) {
-                    $ext_html .= $this->fetch('admin@extend/pay/' . strtolower($cl));
-                }
-            }
-        }
-        $this->assign('ext_list',$ext_list);
-        $this->assign('ext_html',$ext_html);
-
+        $extends = mac_extends_list('pay');
+        $this->assign('extends',$extends);
 
         $this->assign('title', '在线支付配置');
         return $this->fetch('admin@system/configpay');
@@ -406,26 +374,8 @@ class System extends Base
         }
         $this->assign('config', config('maccms'));
 
-        $path = './application/common/extend/email';
-        $file_list = glob($path . '/*.php',GLOB_NOSORT );
-        $ext_list = [];
-        $ext_html = '';
-        foreach($file_list as $k=>$v) {
-            $cl = str_replace([$path . '/', '.php'], '', $v);
-            $cp = 'app\\common\\extend\\email\\' . $cl;
-
-            if (class_exists($cp)) {
-                $c = new $cp;
-                $ext_list[$cl] = $c->name;
-
-                if(file_exists( './application/admin/view/extend/email/'.strtolower($cl) .'.html')) {
-                    $ext_html .= $this->fetch('admin@extend/email/' . strtolower($cl));
-                }
-            }
-        }
-        $this->assign('ext_list',$ext_list);
-        $this->assign('ext_html',$ext_html);
-
+        $extends = mac_extends_list('email');
+        $this->assign('extends',$extends);
 
         $this->assign('title', '邮件发送配置');
         return $this->fetch('admin@system/configemail');
@@ -447,19 +397,8 @@ class System extends Base
             return $this->success('保存成功!');
         }
 
-        $path = './application/common/extend/sms';
-        $file_list = glob($path . '/*.php',GLOB_NOSORT );
-        $ext_list = [];
-        foreach($file_list as $k=>$v) {
-            $cl = str_replace([$path . '/', '.php'], '', $v);
-            $cp = 'app\\common\\extend\\sms\\' . $cl;
-
-            if (class_exists($cp)) {
-                $c = new $cp;
-                $ext_list[$cl] = $c->name;
-            }
-        }
-        $this->assign('ext_list',$ext_list);
+        $extends = mac_extends_list('sms');
+        $this->assign('extends',$extends);
 
         $this->assign('config', config('maccms'));
         $this->assign('title', '短信发送配置');

+ 25 - 65
application/admin/controller/Upload.php

@@ -46,27 +46,18 @@ class Upload extends Base
         $config = config('maccms.site');
         $pre= $config['install_dir'];
 
-        switch ($param['from']) {
-            case 'kindeditor':
-                $param['input'] = 'imgFile';
-                break;
-            case 'umeditor':
-                $param['input'] = 'upfile';
-                break;
-            case 'ckeditor':
-                $param['input'] = 'upload';
-                break;
-            case 'ueditor':
-                $param['input'] = 'upfile';
-                if (isset($_GET['action']) && $_GET['action'] == 'config') {
-                    $UE_CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents('./static/ueditor/config.json')), true);
-                    echo json_encode($UE_CONFIG);
-                    exit;
-                }
-                break;
-            default:// 默认使用layui.upload上传控件
-                $pre='';
-                break;
+        if(!empty($param['from'])){
+            $cp = 'app\\common\\extend\\editor\\' . ucfirst($param['from']);
+            if (class_exists($cp)) {
+                $c = new $cp;
+                $c->front($param);
+            }
+            else{
+                return self::upload_return('未找到第三方扩展上传类库!', '');
+            }
+        }
+        else{
+            $pre='';
         }
 
         // 获取表单上传文件 例如上传了001.jpg
@@ -240,8 +231,7 @@ class Upload extends Base
                 $data['thumb'][0]['file'] = model('Upload')->api($data['thumb'][0]['file'],$config);
             }
         }
-
-        if ( in_array($param['from'],['ueditor','umeditor','kindeditor','ckeditor'])){
+        if(!empty($param['from'])){
             if(substr($data['file'],0,4)!='http' && substr($data['file'],0,4)!='mac:'){
                 $data['file']  =  $pre. $data['file'];
             }
@@ -253,51 +243,21 @@ class Upload extends Base
     }
 
 
-    private function upload_return($info = '', $from = 'input', $status = 0, $data = [])
+    private function upload_return($info='',$from='',$status=0,$data=[])
     {
         $arr = [];
-        switch ($from) {
-            case 'kindeditor':
-                if ($status == 0) {
-                    $arr['error'] = 1;
-                    $arr['message'] = $info;
-                } else {
-                    $arr['error'] = 0;
-                    $arr['url'] = $data['file'];
-                }
-                echo json_encode($arr, 1);exit;
-                break;
-            case 'ckeditor':
-                if ($status == 1) {
-                    $arr['uploaded'] = 1;
-                    $arr['fileName'] = '';
-                    $arr['url'] = $data['file'];
-                    //echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(1, "'.$data['file'].'", "");</script>';
-                } else {
-                    $arr['uploaded'] = 0;
-                    $arr['error']['msg'] = $info;
-                    //echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(1, "", "'.$info.'");</script>';
-                }
-                echo json_encode($arr, 1);exit;
-                break;
-            case 'umeditor':
-            case 'ueditor':
-                if ($status == 0) {
-                    $arr['message'] = $info;
-                    $arr['state'] = 'ERROR';
-                } else {
-                    $arr['message'] = $info;
-                    $arr['url'] = $data['file'];
-                    $arr['state'] = 'SUCCESS';
-                }
-                echo json_encode($arr, 1);exit;
-                break;
 
-            default:
-                $arr['msg'] = $info;
-                $arr['code'] = $status;
-                $arr['data'] = $data;
-                break;
+        if(!empty($from)){
+            $cp = 'app\\common\\extend\\editor\\' . ucfirst($from);
+            if (class_exists($cp)) {
+                $c = new $cp;
+                $arr = $c->back($info,$status,$data);
+            }
+        }
+        else{
+            $arr['msg'] = $info;
+            $arr['code'] = $status;
+            $arr['data'] = $data;
         }
         return $arr;
     }

+ 2 - 18
application/admin/controller/Urlsend.php

@@ -30,25 +30,9 @@ class Urlsend extends Base
         $urlsend_config = $GLOBALS['config']['urlsend'];
         $this->assign('config',$urlsend_config);
 
-        $path = './application/common/extend/urlsend';
-        $file_list = glob($path . '/*.php',GLOB_NOSORT );
-        $ext_list = [];
-        $ext_html = '';
-        foreach($file_list as $k=>$v) {
-            $cl = str_replace([$path . '/', '.php'], '', $v);
-            $cp = 'app\\common\\extend\\urlsend\\' . $cl;
+        $extends = mac_extends_list('urlsend');
+        $this->assign('extends',$extends);
 
-            if (class_exists($cp)) {
-                $c = new $cp;
-                $ext_list[$cl] = $c->name;
-
-                if(file_exists( './application/admin/view/extend/urlsend/'.strtolower($cl) .'.html')) {
-                    $ext_html .= $this->fetch('admin@extend/urlsend/' . strtolower($cl));
-                }
-            }
-        }
-        $this->assign('ext_list',$ext_list);
-        $this->assign('ext_html',$ext_html);
 
         $this->assign('title','URL推送管理');
         return $this->fetch('admin@urlsend/index');

+ 19 - 0
application/admin/view/extend/editor/ckeditor.html

@@ -0,0 +1,19 @@
+<script type="text/javascript" src="__STATIC__/editor/ckeditor/ckeditor.js"></script>
+<script type="text/javascript">
+    var EDITOR = CKEDITOR;
+</script>
+<script>
+    var editor = "{$editor}";
+    function editor_getEditor(obj)
+    {
+        return CKEDITOR.replace(obj,{filebrowserImageUploadUrl:"{:url('upload/upload')}?from=ckeditor&flag={$cl|strtolower}_editor&input=upload"});
+    }
+    function editor_setContent(obj,html)
+    {
+        return obj.setData(html);
+    }
+    function editor_getContent(obj)
+    {
+        return obj.getData();
+    }
+</script>

+ 19 - 0
application/admin/view/extend/editor/kindeditor.html

@@ -0,0 +1,19 @@
+<script type="text/javascript" src="__STATIC__/editor/kindeditor/kindeditor-all-min.js"></script>
+<script type="text/javascript">
+    var EDITOR = KindEditor;
+</script>
+<script>
+    var editor = "{$editor}";
+    function editor_getEditor(obj)
+    {
+        return KindEditor.create('#'+obj, { uploadJson:"{:url('upload/upload')}?from=kindeditor&flag={$cl|strtolower}_editor&input=imgFile" , allowFileManager : false });
+    }
+    function editor_setContent(obj,html)
+    {
+        return obj.html(html);
+    }
+    function editor_getContent(obj)
+    {
+        return obj.html();
+    }
+</script>

+ 31 - 0
application/admin/view/extend/editor/tinymce.html

@@ -0,0 +1,31 @@
+<script type="text/javascript" src="__STATIC__/editor/tinymce/tinymce.min.js"></script>
+<script type="text/javascript">
+    var EDITOR = tinymce;
+</script>
+<script>
+    var editor = "{$editor}";
+    function editor_getEditor(obj)
+    {
+        tinyMCE.init({
+            language: 'zh_CN',
+            plugins: 'print preview paste importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern noneditable help charmap quickbars emoticons',
+            menubar: 'file edit view insert format tools table help',
+            toolbar: 'undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent |  numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen  preview save print | insertfile image media template link anchor codesample | ltr rtl',
+            toolbar_sticky: true,
+            images_upload_url: "{:url('upload/upload')}?from=tinymce&flag={$cl|strtolower}_editor&input=file",
+            selector: '#'+obj,
+            init_instance_callback : function(editor) {
+                res = editor;
+            }
+        });
+        return tinyMCE.activeEditor;
+    }
+    function editor_setContent(obj,html)
+    {
+        return obj.setContent(html);
+    }
+    function editor_getContent(obj)
+    {
+        return obj.getContent();
+    }
+</script>

+ 21 - 0
application/admin/view/extend/editor/ueditor.html

@@ -0,0 +1,21 @@
+<script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
+<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.min.js"></script>
+<script type="text/javascript">
+    window.UEDITOR_CONFIG.serverUrl = "{:url('upload/upload')}?from=ueditor&flag={$cl|strtolower}_editor&input=upfile";
+    var EDITOR = UE;
+</script>
+<script>
+    var editor = "{$editor}";
+    function editor_getEditor(obj)
+    {
+        return EDITOR.getEditor(obj);
+    }
+    function editor_setContent(obj,html)
+    {
+        return obj.setContent(html);
+    }
+    function editor_getContent(obj)
+    {
+        return obj.getContent();
+    }
+</script>

+ 22 - 0
application/admin/view/extend/editor/umeditor.html

@@ -0,0 +1,22 @@
+<link rel="stylesheet" href="__STATIC__/editor/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
+<script type="text/javascript" src="__STATIC__/editor/umeditor/umeditor.config.js"></script>
+<script type="text/javascript" src="__STATIC__/editor/umeditor/umeditor.min.js"></script>
+<script type="text/javascript">
+    window.UMEDITOR_CONFIG.imageUrl = "{:url('upload/upload')}?from=umeditor&flag={$cl|strtolower}_editor&input=upfile";
+    var EDITOR = UM;
+</script>
+<script>
+    var editor = "{$editor}";
+    function editor_getEditor(obj)
+    {
+        return EDITOR.getEditor(obj);
+    }
+    function editor_setContent(obj,html)
+    {
+        return obj.setContent(html);
+    }
+    function editor_getContent(obj)
+    {
+        return obj.getContent();
+    }
+</script>

+ 6 - 77
application/admin/view/public/editor.html

@@ -1,83 +1,12 @@
 {php}
-$editor=$GLOBALS['config']['app']['editor'];
+use think\View;
+
+$editor= strtolower($GLOBALS['config']['app']['editor']);
 $ue_old= ROOT_PATH . 'static/ueditor/' ;
 $ue_new= ROOT_PATH . 'static/editor/'. $editor ;
 if( (!file_exists($ue_new) && file_exists($ue_old)) || $editor=='' ){
     $editor = 'ueditor';
 }
-{/php}
-{if condition="$editor eq 'ueditor'"}
-<script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
-<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.min.js"></script>
-<script type="text/javascript">
-    window.UEDITOR_CONFIG.serverUrl = "{:url('upload/upload')}?from=ueditor&flag=[flag]&input=upfile";
-    var EDITOR = UE;
-</script>
-{elseif condition="$editor eq 'umeditor'"}
-<link rel="stylesheet" href="__STATIC__/editor/umeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
-<script type="text/javascript" src="__STATIC__/editor/umeditor/umeditor.config.js"></script>
-<script type="text/javascript" src="__STATIC__/editor/umeditor/umeditor.min.js"></script>
-<script type="text/javascript">
-    window.UMEDITOR_CONFIG.imageUrl = "{:url('upload/upload')}?from=umeditor&flag=[flag]&input=upfile";
-    var EDITOR = UM;
-</script>
-{elseif condition="$editor eq 'kindeditor'"}
-<script type="text/javascript" src="__STATIC__/editor/kindeditor/kindeditor-all-min.js"></script>
-<script type="text/javascript">
-    var EDITOR = KindEditor;
-</script>
-{elseif condition="$editor eq 'ckeditor'"}
-<script type="text/javascript" src="__STATIC__/editor/ckeditor/ckeditor.js"></script>
-<script type="text/javascript">
-    var EDITOR = CKEDITOR;
-</script>
-{/if}
-<script>
-    var editor = "{$editor}";
-    function editor_getEditor(obj)
-    {
-        var res;
-        switch(editor){
-            case "kindeditor":
-                res = KindEditor.create('#'+obj, { uploadJson:"{:url('upload/upload')}?from=kindeditor&flag=[flag]&input=imgFile" , allowFileManager : false });
-                break;
-            case "ckeditor":
-                res = CKEDITOR.replace(obj,{filebrowserImageUploadUrl:"{:url('upload/upload')}?from=ckeditor&flag=[flag]&input=upload"});
-                break;
-            default:
-                res = EDITOR.getEditor(obj);
-                break;
-        }
-        return res;
-    }
-    function editor_setContent(obj,html) {
-        var res;
-        switch(editor){
-            case "kindeditor":
-                res = obj.html(html);
-                break;
-            case "ckeditor":
-                res = obj.setData(html);
-                break;
-            default:
-                res = obj.setContent(html);
-                break;
-        }
-        return res;
-    }
-    function editor_getContent(obj) {
-        var res;
-        switch(editor){
-            case "kindeditor":
-                res = obj.html();
-                break;
-            case "ckeditor":
-                res = obj.getData();
-                break;
-            default:
-                res = obj.getContent();
-                break;
-        }
-        return res;
-    }
-</script>
+
+echo  View::instance()->fetch('admin@extend/editor/'.$editor.'');
+{/php}

+ 5 - 4
application/admin/view/system/config.html

@@ -358,10 +358,11 @@
                     <label class="layui-form-label">富文本编辑器:</label>
                     <div class="layui-input-inline">
                         <select style="width:150px;" name="app[editor]">
-                            <option value="ueditor" {if condition="$config['app']['editor'] eq 'ueditor' || $config['app']['editor'] eq '' "}selected {/if}>ueditor</option>
-                            <option value="umeditor" {if condition="$config['app']['editor'] eq 'umeditor'"}selected {/if}>umeditor</option>
-                            <option value="kindeditor" {if condition="$config['app']['editor'] eq 'kindeditor'"}selected {/if}>kindeditor</option>
-                            <option value="ckeditor" {if condition="$config['app']['editor'] eq 'ckeditor'"}selected {/if}>ckeditor</option>
+                            {volist name="$editors['ext_list']" id="vo"}
+                            <option value="{$key}" {if condition="$config['app']['editor'] eq $key"}selected {/if}>{$vo}</option>
+                            {/volist}
+
+
                         </select>
                     </div>
                     <div class="layui-form-mid layui-word-aux">系统默认带ueditor,使用其他请先到官网下载扩展包</div>

+ 3 - 3
application/admin/view/system/configemail.html

@@ -5,7 +5,7 @@
         <div class="layui-tab">
             <ul class="layui-tab-title">
                 <li class="layui-this">邮件模板配置</li>
-                {volist name="ext_list" id="vo"}
+                {volist name="$extends['ext_list']" id="vo"}
                 <li data-key="{$key}" lay-id="configpay_{$i+2}">{$vo}</li>
                 {/volist}
             </ul>
@@ -22,7 +22,7 @@
                         <div class="layui-input-inline">
                             <select class="w150" id="ac" name="email[type]" lay-filter="ac">
                                 <option value="" >请选择...</option>
-                                {volist name="ext_list" id="vo"}
+                                {volist name="$extends['ext_list']" id="vo"}
                                 <option value="{$key}" {if condition="$config['email']['type'] eq $key"}selected {/if}>{$vo}</option>
                                 {/volist}
                             </select>
@@ -103,7 +103,7 @@
                         </div>
                     </div>
                 </div>
-                {$ext_html}
+                {$extends['ext_html']}
             </div>
 
         </div>

+ 2 - 2
application/admin/view/system/configpay.html

@@ -6,7 +6,7 @@
             <ul class="layui-tab-title">
                 <li class="layui-this" lay-id="configpay_1">在线支付设置</li>
                 <li lay-id="configpay_2">卡密</li>
-                {volist name="ext_list" id="vo"}
+                {volist name="$extends['ext_list']" id="vo"}
                 <li data-key="{$key}" lay-id="configpay_{$i+2}">{$vo}</li>
                 {/volist}
                 
@@ -57,7 +57,7 @@
                     </div>
                 </div>
 
-                {$ext_html}
+                {$extends['ext_html']}
 
             </div>
         </div>

+ 1 - 1
application/admin/view/system/configsms.html

@@ -30,7 +30,7 @@
                         <div class="layui-input-inline">
                             <select  name="sms[type]">
                                 <option value="" >请选择...</option>
-                                {volist name="ext_list" id="vo"}
+                                {volist name="$extends['ext_list']" id="vo"}
                                 <option value="{$key}" {if condition="$config['sms']['type'] eq $key"}selected {/if}>{$vo}</option>
                                 {/volist}
                             </select>

+ 2 - 2
application/admin/view/system/configupload.html

@@ -118,7 +118,7 @@
                         <select class="w150" name="upload[mode]" lay-filter="upload[mode]">
                             <option value="local" {if condition="$config['upload']['mode'] eq 'local'"}selected {/if}>本地保存</option>
                             <option value="remote" {if condition="$config['upload']['mode'] eq 'remote'"}selected {/if}>远程访问</option>
-                            {volist name="ext_list" id="vo"}
+                            {volist name="$extends['ext_list']" id="vo"}
                             <option value="{$key}" {if condition="$config['upload']['mode'] eq $key"}selected {/if}>{$vo}</option>
                             {/volist}
                         </select>
@@ -132,7 +132,7 @@
                     </div>
                 </div>
 
-                {$ext_html}
+                {$extends['ext_html']}
 
                 </div>
 

+ 11 - 3
application/admin/view/urlsend/index.html

@@ -5,14 +5,14 @@
     <form class="layui-form layui-form-pane" action="">
         <div class="layui-tab" lay-filter="tb1">
             <ul class="layui-tab-title">
-                {volist name="ext_list" id="vo"}
+                {volist name="$extends['ext_list']" id="vo"}
                 <li data-key="{$key}" lay-id="configpay_{$i+2}">{$vo}配置</li>
                 {/volist}
 
             </ul>
             <div class="layui-tab-content">
 
-                {$ext_html}
+                {$extends['ext_html']}
 
             </div>
         </div>
@@ -36,7 +36,7 @@
             <label class="layui-form-label">推送类型:</label>
             <div class="layui-input-inline">
                 <select class="w150" id="ac" name="ac" lay-filter="ac">
-                    {volist name="ext_list" id="vo"}
+                    {volist name="$extends['ext_list']" id="vo"}
                     <option value="{$key}">{$vo}</option>
                     {/volist}
                 </select>
@@ -103,6 +103,8 @@
             element.tabChange('tb1', $.cookie('urlsend_tab'));
         }
 
+
+
     });
     function post(p)
     {
@@ -114,6 +116,12 @@
         $("#form_post").submit();
     }
 
+    $(function () {
+        if( $.cookie('urlsend_tab') == undefined) {
+            $('.layui-tab-title').find('li').first().addClass('layui-this');
+            $('.layui-tab-item').first().addClass('layui-show');
+        }
+    });
 
 </script>
 </body>

+ 21 - 0
application/common.php

@@ -321,6 +321,27 @@ function mac_get_refer()
     return trim(urldecode($_SERVER["HTTP_REFERER"]));
 }
 
+function mac_extends_list($flag)
+{
+    $path = './application/common/extend/'.$flag;
+    $file_list = glob($path . '/*.php',GLOB_NOSORT );
+    $res=[];
+    $res['ext_list'] = [];
+    $res['ext_html'] = '';
+    foreach($file_list as $k=>$v) {
+        $cl = str_replace([$path . '/', '.php'], '', $v);
+        $cp = 'app\\common\\extend\\'.$flag.'\\' . $cl;
+        if (class_exists($cp)) {
+            $c = new $cp;
+            $res['ext_list'][$cl] = $c->name;
+            if(file_exists( './application/admin/view/extend/'.$flag.'/'.strtolower($cl) .'.html')) {
+                $res['ext_html'] .= View::instance()->fetch('admin@extend/'.$flag.'/' . strtolower($cl));
+            }
+        }
+    }
+    return $res;
+}
+
 function mac_send_sms($to,$code,$type_flag,$type_des,$msg)
 {
     if(empty($GLOBALS['config']['sms']['type'])){

+ 30 - 0
application/common/extend/editor/Ckeditor.php

@@ -0,0 +1,30 @@
+<?php
+namespace app\common\extend\editor;
+
+class Ckeditor {
+
+    public $name = 'Ckeditor';
+    public $ver = '1.0';
+
+    public function front($param)
+    {
+
+    }
+
+    public function back($info='',$status=0,$data=[])
+    {
+        $arr=[];
+        if ($status == 1) {
+            $arr['uploaded'] = 1;
+            $arr['fileName'] = '';
+            $arr['url'] = $data['file'];
+            //echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(1, "'.$data['file'].'", "");</script>';
+        } else {
+            $arr['uploaded'] = 0;
+            $arr['error']['msg'] = $info;
+            //echo '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(1, "", "'.$info.'");</script>';
+        }
+        echo json_encode($arr, 1);
+        exit;
+    }
+}

+ 27 - 0
application/common/extend/editor/Kindeditor.php

@@ -0,0 +1,27 @@
+<?php
+namespace app\common\extend\editor;
+
+class Kindeditor {
+
+    public $name = 'Kindeditor';
+    public $ver = '1.0';
+
+    public function front($param)
+    {
+
+    }
+
+    public function back($info='',$status=0,$data=[])
+    {
+        $arr=[];
+        if ($status == 0) {
+            $arr['error'] = 1;
+            $arr['message'] = $info;
+        } else {
+            $arr['error'] = 0;
+            $arr['url'] = $data['file'];
+        }
+        echo json_encode($arr, 1);
+        exit;
+    }
+}

+ 21 - 0
application/common/extend/editor/Tinymce.php

@@ -0,0 +1,21 @@
+<?php
+namespace app\common\extend\editor;
+
+class Tinymce {
+
+    public $name = 'Tinymce';
+    public $ver = '1.0';
+
+    public function front($param)
+    {
+
+    }
+
+    public function back($info='',$status=0,$data=[])
+    {
+        $arr=[];
+        $arr['location'] = $data['file'];
+        echo json_encode($arr, 1);
+        exit;
+    }
+}

+ 32 - 0
application/common/extend/editor/Ueditor.php

@@ -0,0 +1,32 @@
+<?php
+namespace app\common\extend\editor;
+
+class Ueditor {
+
+    public $name = 'Ueditor';
+    public $ver = '1.0';
+
+    public function front($param)
+    {
+        if (isset($param['action']) && $param['action'] == 'config') {
+            $UE_CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents('./static/ueditor/config.json')), true);
+            echo json_encode($UE_CONFIG);
+            exit;
+        }
+    }
+
+    public function back($info='',$status=0,$data=[])
+    {
+        $arr=[];
+        if ($status == 0) {
+            $arr['message'] = $info;
+            $arr['state'] = 'ERROR';
+        } else {
+            $arr['message'] = $info;
+            $arr['url'] = $data['file'];
+            $arr['state'] = 'SUCCESS';
+        }
+        echo json_encode($arr, 1);
+        exit;
+    }
+}

+ 32 - 0
application/common/extend/editor/Umeditor.php

@@ -0,0 +1,32 @@
+<?php
+namespace app\common\extend\editor;
+
+class Umeditor {
+
+    public $name = 'Umeditor';
+    public $ver = '1.0';
+
+    public function front($param)
+    {
+        if (isset($param['action']) && $param['action'] == 'config') {
+            $UE_CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents('./static/ueditor/config.json')), true);
+            echo json_encode($UE_CONFIG);
+            exit;
+        }
+    }
+
+    public function back($info='',$status=0,$data=[])
+    {
+        $arr=[];
+        if ($status == 0) {
+            $arr['message'] = $info;
+            $arr['state'] = 'ERROR';
+        } else {
+            $arr['message'] = $info;
+            $arr['url'] = $data['file'];
+            $arr['state'] = 'SUCCESS';
+        }
+        echo json_encode($arr, 1);
+        exit;
+    }
+}

+ 1 - 1
application/extra/version.php

@@ -3,7 +3,7 @@ return array (
     'name' => '苹果CMS',
     'copyright' => 'MacCMS.LA',
     'url' => '//www.maccms.la/',
-    'code' => '2020.1000.1031',
+    'code' => '2020.1000.1032',
     'license' => '免费版',
 );
 ?>

+ 3 - 14
application/index/controller/User.php

@@ -532,20 +532,9 @@ class User extends Base
         $this->assign('config', $GLOBALS['config']['pay']);
         $this->assign('info', $res['info']);
 
-        $ext_list=[];
-
-        foreach($GLOBALS['config']['pay'] as $k=>$v){
-            if(!in_array($k,['min','scale','card'])){
-                if(!empty(current($v))){
-                    $cp = 'app\\common\\extend\\pay\\' . ucfirst($k);
-                    if (class_exists($cp)) {
-                        $c = new $cp;
-                        $ext_list[$k] = $c->name;
-                    }
-                }
-            }
-        }
-        $this->assign('ext_list',$ext_list);
+        $extends = mac_extends_list('pay');
+        $this->assign('extends',$extends);
+        $this->assign('ext_list',$extends['ext_list']);
 
         return $this->fetch('user/pay');
     }