<?php
/**
 * Created by PhpStorm.
 * User: zw
 * Date: 17-12-3
 * Time: 下午21:05
 */


if(!function_exists('create_editor')){
    function create_editor($id,$value='',$config=array()){
        // Include the CKEditor class.
        include_once "../public/resource/lib/Ckeditor/ckeditor.php";
        // Create a class instance.
        $CKEditor = new CKEditor( 'http://' . $_SERVER['HTTP_HOST'] . '/resource/lib/Ckeditor/');
        // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
        //   $CKEditor->basePath = '/ckeditor/'
        // If not set, CKEditor will try to detect the correct path.

        // Replace a textarea element with an id (or name) of "editor1".

        $_config['filebrowserBrowseUrl'] = '/resource/lib/Ckfinder/ckfinder.html';

        $_config['filebrowserImageBrowseUrl'] = '/resource/lib/Ckfinder/ckfinder.html?Type=Images';
        //$_config['filebrowserUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files';
        //$_config['filebrowserImageUploadUrl'] = '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images';
        if(!empty($config)){
            $_config = array_merge($_config,$config);
        }
        $CKEditor->editor("describe",$value,$_config);
        //$CKEditor->replace("describe");
    }
}