ppypp伦理天堂,91手机在线视频,免费在线观看黄色毛片,夜夜穞天天穞狠狠穞AV美女按摩

聯系官方銷售客服

1835022288

028-61286886

投訴 已解決 怎么使用自定義字段類型怎么使用自定義字段類型想要修改的百度編 8 0
sw586(前端和PHP) VIP會員 OEM版權 2020-07-11 14:51:58 私信
迅睿CMS版本:4.3.8 #字段 #編輯器

怎么使用:自定義字段類型,想要修改官方的百度編輯器,但是不想動官方原來的ueditor,想復制官方的ueditor字段類型增加一個比如:gitueditor字段類型,

按照官方教程http://www.zbshanke.com/doc/940.html操作;

1、在www/api目錄復制ueditor文件夾,重命名為gitueditor

2、在\dayrui\My\Field下新建\dayrui\My\Field\Field.php文件,內容:

<?php

/**
 * 自定義系統字段
 * id 文件名稱
 * name 顯示名稱
 * used 留空
 * namespace 是哪個app專屬的
 */

return [
    [
        'id' => 'Gitueditor',
        'name' => 'Github-百度編輯器',
        'used' => '',
        'namespace' => '',
    ],
];

新建文件:\dayrui\My\Field\Gitueditor.php 內容:

<?php namespace My\Field;

/**
 * http://www.zbshanke.com
 * 本文件是框架系統文件,二次開發時不可以修改本文件,可以通過繼承類方法來重寫此文件
 **/

class Gitueditor extends \Phpcmf\Library\A_Field {

    /**
     * 構造函數
     */
    public function __construct(...$params) {
        parent::__construct(...$params);
        $this->close_xss = 1; // 關閉xss驗證
        $this->fieldtype = ['MEDIUMTEXT' => ''];
        $this->defaulttype = 'MEDIUMTEXT';
    }

    /**
     * 字段相關屬性參數
     *
     * @param   array   $value  值
     * @return  string
     */
    public function option($option) {

        $option['mode'] = isset($option['mode']) ? $option['mode'] : 1;
        $option['page'] = isset($option['page']) ? $option['page'] : 0;
        $option['tool'] = isset($option['tool']) ? $option['tool'] : '\'bold\', \'italic\', \'underline\'';
        $option['mode2'] = isset($option['mode2']) ? $option['mode2'] : $option['mode'];
        $option['tool2'] = isset($option['tool2']) ? $option['tool2'] : $option['tool'];
        $option['mode3'] = isset($option['mode3']) ? $option['mode3'] : $option['mode'];
        $option['tool3'] = isset($option['tool3']) ? $option['tool3'] : $option['tool'];
        $option['value'] = isset($option['value']) ? $option['value'] : '';
        $option['width'] = isset($option['width']) ? $option['width'] : '100%';
        $option['height'] = isset($option['height']) ? $option['height'] : 300;
        $option['fieldtype'] = isset($option['fieldtype']) ? $option['fieldtype'] : '';
        $option['autofloat'] = isset($option['autofloat']) ? $option['autofloat'] : 0;
        $option['autoheight'] = isset($option['autoheight']) ? $option['autoheight'] : 0;
        $option['fieldlength'] = isset($option['fieldlength']) ? $option['fieldlength'] : '';
        $option['watermark'] = isset($option['watermark']) ? $option['watermark'] : '';
        $option['show_bottom_boot'] = isset($option['show_bottom_boot']) ? $option['show_bottom_boot'] : '';

        $wm = \Phpcmf\Service::C()->get_cache('site', SITE_ID, 'watermark', 'gitueditor') ? '<div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('圖片水印').'</label>
                    <div class="col-md-9">
                        <div class="form-control-static">
                            '.dr_lang('系統強制開啟水印').'
                        </div>
                    </div>
                </div>' : '<div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('圖片水印').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][watermark]" '.($option['watermark'] == 1 ? 'checked' : '').' > '.dr_lang('開啟').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][watermark]" '.($option['watermark'] == 0 ? 'checked' : '').' > '.dr_lang('關閉').'</label>
                        </div>
                  <span class="help-block">上傳的圖片會加上水印圖</span>
                    </div>
                </div>';

        return ['<div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('下載遠程圖片').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][down_img]" '.($option['down_img'] == 1 ? 'checked' : '').' > '.dr_lang('自動').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][down_img]" '.($option['down_img'] == 0 ? 'checked' : '').' > '.dr_lang('手動').'</label>
                        </div>
                  <span class="help-block">自動模式下每一次編輯內容時都會下載圖片;手動模式可以在編輯器下放工具欄中控制“是否下載”</span>
                    </div>
                </div>
            <div class="form-group hide">
                    <label class="col-md-2 control-label">'.dr_lang('下載圖片模式').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][down_img_type]" '.($option['down_img_type'] == 1 ? 'checked' : '').' > '.dr_lang('異步').'(Beta)</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][down_img_type]" '.($option['down_img_type'] == 0 ? 'checked' : '').' > '.dr_lang('同步').'</label>
                        </div>
                  <span class="help-block">同步模式是在編輯內容時一次性下載完圖片,圖片多的時候容易卡死;<br>異步模式是在編輯內容時不會馬上下載圖片,他會進入任務隊列中進行延遲下載</span>
                    </div>
                </div>'.$wm.
            '
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('底部工具欄').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][show_bottom_boot]" '.($option['show_bottom_boot'] == 1 ? 'checked' : '').' > '.dr_lang('開啟').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][show_bottom_boot]" '.($option['show_bottom_boot'] == 0 ? 'checked' : '').' > '.dr_lang('關閉').'</label>
                        </div>
                  <span class="help-block">編輯器底部工具欄,有截取字符選擇、提取縮略圖、下載遠程圖等控制按鈕</span>
                    </div>
                </div>
                <div class="form-group hidden">
                    <label class="col-md-2 control-label">'.dr_lang('編輯器類型').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][mini]" '.($option['mini'] == 1 ? 'checked' : '').' > '.dr_lang('Umeditor').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][mini]" '.($option['mini'] == 0 ? 'checked' : '').' > '.dr_lang('Ueditor').'</label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('固定工具欄').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][autofloat]" '.($option['autofloat'] == 1 ? 'checked' : '').' > '.dr_lang('開啟').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][autofloat]" '.($option['autofloat'] == 0 ? 'checked' : '').' > '.dr_lang('關閉').'</label>
                        </div>
                  <span class="help-block">編輯器圖標欄會固定在頁面,不會隨瀏覽器滾動</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('自動伸長高度').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][autoheight]" '.($option['autoheight'] == 1 ? 'checked' : '').' > '.dr_lang('開啟').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][autoheight]" '.($option['autoheight'] == 0 ? 'checked' : '').' > '.dr_lang('關閉').'</label>
                        </div>
                  
                  <span class="help-block">編輯器會自動增加高度</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('分頁標簽').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][page]" '.($option['page'] ? 'checked' : '').' > '.dr_lang('開啟').'</label>
                            <label class="radio-inline"><input type="radio" value="0" name="data[setting][option][page]" '.(!$option['page'] ? 'checked' : '').' > '.dr_lang('關閉').'</label>
                        </div>
                  <span class="help-block">文章內容的分頁功能</span>
                    </div>
                </div>
                
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('后臺編輯器模式').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][mode]" '.($option['mode'] == 1 ? 'checked' : '').' onclick="$(\'#bjqms1\').hide()"> '.dr_lang('完整').'</label>
                            <label class="radio-inline"><input type="radio" value="2" name="data[setting][option][mode]" '.($option['mode'] == 2 ? 'checked' : '').' onclick="$(\'#bjqms1\').hide()"> '.dr_lang('精簡').'</label>
                            <label class="radio-inline"><input type="radio" value="3" name="data[setting][option][mode]" '.($option['mode'] == 3 ? 'checked' : '').' onclick="$(\'#bjqms1\').show()"> '.dr_lang('自定義').'</label>
                        </div>
                    </div>
                </div>
                <div class="form-group" id="bjqms1" '.($option['mode'] < 3 ? 'style="display:none"' : '').'>
                    <label class="col-md-2 control-label">'.dr_lang('工具欄').'</label>
                    <div class="col-md-9">
                    <textarea name="data[setting][option][tool]" style="height:90px;" class="form-control">'.$option['tool'].'</textarea>
                    <span class="help-block">'.dr_lang('必須嚴格按照Ueditor工具欄格式\'fullscreen\', \'source\', \'|\', \'undo\', \'redo\'').'</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('前臺編輯器模式').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][mode2]" '.($option['mode2'] == 1 ? 'checked' : '').' onclick="$(\'#bjqms2\').hide()"> '.dr_lang('完整').'</label>
                            <label class="radio-inline"><input type="radio" value="2" name="data[setting][option][mode2]" '.($option['mode2'] == 2 ? 'checked' : '').' onclick="$(\'#bjqms2\').hide()"> '.dr_lang('精簡').'</label>
                            <label class="radio-inline"><input type="radio" value="3" name="data[setting][option][mode2]" '.($option['mode2'] == 3 ? 'checked' : '').' onclick="$(\'#bjqms2\').show()"> '.dr_lang('自定義').'</label>
                        </div>
                    </div>
                </div>
                <div class="form-group" id="bjqms2" '.($option['mode2'] < 3 ? 'style="display:none"' : '').'>
                    <label class="col-md-2 control-label">'.dr_lang('工具欄').'</label>
                    <div class="col-md-9">
                    <textarea name="data[setting][option][tool2]" style="height:90px;" class="form-control">'.$option['tool2'].'</textarea>
                    <span class="help-block">'.dr_lang('必須嚴格按照Ueditor工具欄格式\'fullscreen\', \'source\', \'|\', \'undo\', \'redo\'').'</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('移動端編輯器模式').'</label>
                    <div class="col-md-9" style="padding-left: 35px;">
                        <div class="radio-list">
                            <label class="radio-inline"><input type="radio" value="1" name="data[setting][option][mode3]" '.($option['mode3'] == 1 ? 'checked' : '').' onclick="$(\'#bjqms3\').hide()"> '.dr_lang('完整').'</label>
                            <label class="radio-inline"><input type="radio" value="2" name="data[setting][option][mode3]" '.($option['mode3'] == 2 ? 'checked' : '').' onclick="$(\'#bjqms3\').hide()"> '.dr_lang('精簡').'</label>
                            <label class="radio-inline"><input type="radio" value="3" name="data[setting][option][mode3]" '.($option['mode3'] == 3 ? 'checked' : '').' onclick="$(\'#bjqms3\').show()"> '.dr_lang('自定義').'</label>
                        </div>
                    </div>
                </div>
                <div class="form-group" id="bjqms3" '.($option['mode3'] < 3 ? 'style="display:none"' : '').'>
                    <label class="col-md-2 control-label">'.dr_lang('工具欄').'</label>
                    <div class="col-md-9">
                    <textarea name="data[setting][option][tool3]" style="height:90px;" class="form-control">'.$option['tool3'].'</textarea>
                    <span class="help-block">'.dr_lang('必須嚴格按照Ueditor工具欄格式\'fullscreen\', \'source\', \'|\', \'undo\', \'redo\'').'</span>
                    </div>
                </div>'.$this->attachment($option).'
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('默認存儲值').'</label>
                    <div class="col-md-9">
                        <label><input id="field_default_value" type="text" class="form-control" size="20" value="'.$option['value'].'" name="data[setting][option][value]"></label>
                        <label>'.$this->member_field_select().'</label>
                        <span class="help-block">'.dr_lang('也可以設置會員表字段,表示用當前登錄會員信息來填充這個值').'</span>
                    </div>
                </div>
                '.$this->field_type($option['fieldtype'], $option['fieldlength']),

            '<div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('控件寬度').'</label>
                    <div class="col-md-9">
                        <label><input type="text" class="form-control" name="data[setting][option][width]" value="'.$option['width'].'"></label>
                        <span class="help-block">'.dr_lang('[整數]表示固定寬度;[整數%]表示百分比').'</span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label">'.dr_lang('控件高度').'</label>
                    <div class="col-md-9">
                        <label><input type="text" class="form-control" name="data[setting][option][height]" value="'.$option['height'].'"></label>
                        <label>px</label>
                    </div>
                </div>'
        ];
    }

    /**
     * 字段入庫值
     */
    public function insert_value($field) {

        //$table = [];
        $value = \Phpcmf\Service::L('Field')->post[$field['fieldname']];

        // 第一張作為縮略圖
        $slt = isset($_POST['data']['thumb']) && isset($_POST['is_auto_thumb'])  && !$_POST['data']['thumb'] && $_POST['is_auto_thumb'];
        // 是否下載圖片
        $yct = $field['setting']['option']['down_img'] || (isset($_POST['is_auto_down_img']) && $_POST['is_auto_down_img']);

        // 下載遠程圖片
        if (($yct || $slt) && preg_match_all("/(src)=([\"|']?)([^ \"'>]+\.(gif|jpg|jpeg|png|webp))\\2/i", $value, $imgs)) {
            foreach ($imgs[3] as $img) {
                if (strpos($img, '/api/gitueditor/') !== false
                    || strpos($img, '/api/umeditor/') !== false) {
                    continue;
                }
                // 下載圖片
                if ($yct && strpos($img, 'http') === 0) {
                    if (dr_is_app('mfile') && \Phpcmf\Service::M('mfile', 'mfile')->check_upload(\Phpcmf\Service::C()->uid)) {
                        //用戶存儲空間已滿
                    } else {
                        // 正常下載
                        // 判斷域名白名單
                        $arr = parse_url($img);
                        $domain = $arr['host'];
                        if ($domain) {
                            $sites = WRITEPATH.'config/domain_site.php';
                            if (isset($sites[$domain])) {
                                // 過濾站點域名
                            } elseif (strpos(SYS_UPLOAD_URL, $domain) !== false) {
                                // 過濾附件白名單
                            } else {
                                $zj = 0;
                                $remote = \Phpcmf\Service::C()->get_cache('attachment');
                                if ($remote) {
                                    foreach ($remote as $t) {
                                        if (strpos($t['url'], $domain) !== false) {
                                            $zj = 1;
                                            break;
                                        }
                                    }
                                }
                                if ($zj == 0) {
                                    // 可以下載文件
                                    /*
                           if ($field['setting']['option']['down_img_type']) {
                              // 異步模式
                               if (!$table) {
                                 $table = \Phpcmf\Service::M('field')->get_table_name(SITE_ID, $field);
                              }
                              $rt = \Phpcmf\Service::M('cron')->add_cron(SITE_ID, 'ueditor_down_img', [
                                 'url' => $img,
                                 'table' => $table,
                                 'field' => $field['fieldname'],
                                 'siteid' => SITE_ID,
                                 'member' => \Phpcmf\Service::C()->member,
                                 'attachment' => \Phpcmf\Service::M('Attachment')->get_attach_info(intval($field['setting']['option']['attachment'])),
                                 'image_reduce' => $field['setting']['option']['image_reduce'],
                              ]);
                              if (!$rt['code']) {
                                 log_message('error', '遠程圖片下載-任務注冊失敗:'.$rt['msg']);
                              }
                              $value = str_replace($img, ROOT_THEME_PATH.'assets/images/down_img.jpg?id='.$rt['code'], $value);
                              $img = '';
                           } else {
                                    */
                                    // 同步模式
                                    // 下載遠程文件
                                    $rt = \Phpcmf\Service::L('upload')->down_file([
                                        'url' => $img,
                                        'timeout' => 5,
                                        'watermark' => \Phpcmf\Service::C()->get_cache('site', SITE_ID, 'watermark', 'gitueditor') || $field['setting']['option']['watermark'] ? 1 : 0,
                                        'attachment' => \Phpcmf\Service::M('Attachment')->get_attach_info(intval($field['setting']['option']['attachment'])),
                                    ]);
                                    if ($rt['code']) {
                                        $att = \Phpcmf\Service::M('Attachment')->save_data($rt['data'], 'ueditor_down_img');
                                        if ($att['code']) {
                                            // 歸檔成功
                                            $value = str_replace($img, $rt['data']['url'], $value);
                                            $img = $att['code'];
                                        }
                                    }
                                    //}
                                }
                            }

                        }

                    }
                }
                // 縮略圖
                if ($img && $slt && !\Phpcmf\Service::L('Field')->data[1]['thumb']) {
                    \Phpcmf\Service::L('Field')->data[1]['thumb'] = $img;
                }
            }
        }

        // 提取描述信息
        if (isset($_POST['data']['description']) && isset($_POST['is_auto_description']) && !$_POST['data']['description']) {
            \Phpcmf\Service::L('Field')->data[1]['description'] = trim(dr_strcut(dr_clearhtml($value), 200));
        }

        // 替換分頁
        $value = str_replace('[object Object]', '<hr class="pagebreak">', $value);

        // 入庫操作
        if (isset($_GET['is_verify_iframe']) && $_GET['is_verify_iframe']) {
            // 來自批量審核內容
            \Phpcmf\Service::L('Field')->data[$field['ismain']][$field['fieldname']] = ($value);
        } else {
            \Phpcmf\Service::L('Field')->data[$field['ismain']][$field['fieldname']] = htmlspecialchars($value);
        }
    }

    /**
     * 字段輸出
     *
     * @param   array   $value  數據庫值
     * @return  string
     */
    public function output($value) {
        return htmlspecialchars_decode($value);
    }

    /**
     * 字段顯示
     *
     * @return  string
     */
    public function show($field, $value = null) {
        $html = '
        <div class="portlet  bordered light">
        <div class="portlet-body">
        <div class="scroller" style="width:'.(\Phpcmf\Service::_is_mobile() ? '100%' : ($field['setting']['option']['width'] ? $field['setting']['option']['width'].(is_numeric($field['setting']['option']['width']) ? 'px' : '') : '100%')).';height:'.($field['setting']['option']['height'] ? $field['setting']['option']['height'] : '300').'px" data-always-visible="1" data-rail-visible="1">
        '.htmlspecialchars_decode($value).'                
        </div>
        </div>
        </div>';
        return $this->input_format($field['fieldname'], $field['name'], $html);
    }

    /**
     * 字段表單輸入
     *
     */
    public function input($field, $value = '') {

        // 字段禁止修改時就返回顯示字符串
        if ($this->_not_edit($field, $value)) {
            return $this->show($field, $value);
        }

        // 字段存儲名稱
        $name = $field['fieldname'];

        // 字段顯示名稱
        $text = ($field['setting']['validate']['required'] ? '<span class="required" aria-required="true"> * </span>' : '').$field['name'];

        if (isset($_GET['is_verify_iframe']) && $_GET['is_verify_iframe']) {
            // 來自批量審核內容
            $str = '<textarea class="form-control"  name="data['.$name.']" id="dr_'.$name.'">'.htmlspecialchars($value).'</textarea>';
            return $this->input_format($field['fieldname'], $text, $str);
        }

        // 表單寬度設置
        $is_mobile = \Phpcmf\Service::C()->_is_mobile();
        $width = $is_mobile ? '100%' : ($field['setting']['option']['width'] ? $field['setting']['option']['width'] : '100%');

        // 表單高度設置
        $height = $field['setting']['option']['height'] ? $field['setting']['option']['height'] : '300';

        // 字段提示信息
        $tips = $field['setting']['validate']['tips'] ? '<span class="help-block" id="dr_'.$name.'_tips">'.$field['setting']['validate']['tips'].'</span>' : '';

        // 字段默認值
        $value = htmlspecialchars_decode(strlen($value) ? $value : $this->get_default_value($field['setting']['option']['value']));

        $uri = \Phpcmf\Service::L('router')->uri();
        APP_DIR != 'member' && $uri = str_replace('member/', '', $uri);

        // 輸出
        $str = '';

        // 防止重復加載JS
        if (!defined('PHPCMF_FIELD_UEDITOR')) {
            $str.= '
            <script type="text/javascript" src="/api/gitueditor/ueditor.config.js?v='.CMF_UPDATE_TIME.'"></script>
            <script type="text/javascript" src="/api/gitueditor/ueditor.'.(IS_DEV ? 'all' : 'all.min').'.js?v='.CMF_UPDATE_TIME.'"></script>
            ';
            define('PHPCMF_FIELD_UEDITOR', 1);
        }

        $tool = IS_ADMIN ? "'fullscreen', 'source', '|', " : ''; // 后臺引用時顯示html工具欄

        // 編輯器模式
        if ($is_mobile) {
            $mode = $field['setting']['option']['mode3'] ? $field['setting']['option']['mode3'] : $field['setting']['option']['mode'];
            $field['setting']['option']['tool'] = $field['setting']['option']['tool3'] ? $field['setting']['option']['tool3'] : $field['setting']['option']['tool'];
        } elseif (IS_ADMIN) {
            $mode = $field['setting']['option']['mode'];
        } else {
            $mode = $field['setting']['option']['mode2'] ? $field['setting']['option']['mode2'] : $field['setting']['option']['mode'];
            $field['setting']['option']['tool'] = $field['setting']['option']['tool2'] ? $field['setting']['option']['tool2'] : $field['setting']['option']['tool'];
        }

        // 編輯器工具
        $pagebreak = (int)$field['setting']['option']['page'] ? ', \'pagebreak\'' : '';
        switch ($mode) {
            case 3: // 自定義
                $tool.= trim($field['setting']['option']['tool'], ',').$pagebreak;
                break;
            case 2: // 精簡
                $tool.= "'undo', 'redo', '|',
                        'bold', 'italic', 'underline', 'strikethrough','|', 'pasteplain', 'forecolor', 'fontfamily', 'fontsize','|', 'link', 'simpleupload'$pagebreak";
                break;
            case 1: // 默認
                $tool.= "'undo', 'redo', '|',
            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
            'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
            'directionalityltr', 'directionalityrtl', 'indent', '|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
            'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
            'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'attachment', 'map', 'insertframe', 'insertcode', 'template', 'background', '|',
            'horizontal', 'date', 'time', 'spechars', '|',
            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
            'print', 'preview', 'searchreplace', 'drafts'$pagebreak";
                break;
        }

        $str.= "<script class=\"dr_ueditor\" name=\"data[$name]\" type=\"text/plain\" id=\"dr_$name\">$value</script>";
        $js = \Phpcmf\Service::L('js_packer');
        $str.= $js->pack("
        <script type=\"text/javascript\">
            var editorOption = {
                UEDITOR_HOME_URL: \"/api/gitueditor/\",
                serverUrl:\"/index.php?s=api&c=file&token=".dr_get_csrf_token()."&m=gitueditor&image_reduce=".intval($field['setting']['option']['image_reduce'])."&attachment=".intval($field['setting']['option']['attachment'])."&is_wm=".$field['setting']['option']['watermark']."&rid=".($uri.'/id:'.(int)$_GET['id'])."&\",
                lang: \"".SITE_LANGUAGE."\",
                langPath: \"".ROOT_URL."api/language/\",
                toolbars: [
                    [ $tool ]
                ],
                initialContent:\"\",
                initialFrameWidth: \"".$width."\",
                initialFrameHeight: \"{$height}\",
                initialStyle:\"body{font-size:14px}\",
                wordCount:false,
                maximumWords:99999999999,
                elementPathEnabled:false,
                autoFloatEnabled:".($field['setting']['option']['autofloat'] ? 'true' : 'false').",
                autoHeightEnabled:".($field['setting']['option']['autoheight'] ? 'true' : 'false').",
                charset:\"utf-8\",
            };
            var editor = new baidu.editor.ui.Editor(editorOption);
            editor.render(\"dr_$name\");
        </script>
        ", 0);


        if ($field['setting']['option']['show_bottom_boot']) {

            $str.= '<div class="mt-checkbox-inline" style="margin-top: 10px;">';
            $str.= '     <label style="margin-bottom: 0;" class="mt-checkbox mt-checkbox-outline">
                  <input name="is_auto_thumb" type="checkbox" checked value="1"> 提取第一個圖片為縮略圖 <span></span>
                 </label>';
            $str.= '
                 <label style="margin-bottom: 0;" class="mt-checkbox mt-checkbox-outline">
                  <input name="is_auto_description" type="checkbox" checked value="1"> 提取前200字為描述信息 <span></span>
                 </label>';
            if (!$field['setting']['option']['down_img']) {
                $str.= '
                 <label style="margin-bottom: 0;" class="mt-checkbox mt-checkbox-outline">
                  <input name="is_auto_down_img" type="checkbox" checked value="1"> 下載遠程圖片 <span></span>
                 </label>';
            }
            $str.= '</div>';
        }


        return $this->input_format($name, $text, $str.$tips);
    }
}

報錯:


image

請問流程對嗎?我就想復制一份ueditor然后自己自定義,是否還需要修改其他地方?請求指教下下

解決方案