<?php
/**
 * JYmusic音乐管理系统 
 *
 * @version     2.0
 * @author      战神~~巴蒂 <jyuucn@163.com>
 * @license     http://jyuu.cn/license
 * @copyright   2014 - 2017 JYmusic
 */

namespace addons\Editor;

use think\Url;
use app\services\Addons;

/**
 * 插件测试
 * @author by JYmusic <jyuucn@163.com>
 */
class Editor extends Addons
{
    public $info = [
        'name'          => 'Editor',
        'title'         => '网页在线编辑器',
        'description'   => 'JYmusic2.0 新增一款超简洁高效的编辑器',
        'status'        => 0,
        'author'        => 'JYmusic',
        'version'       => '0.1'
    ];

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $this->existHook('articleEdit', 'Editor');
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        return true;
    }

    /**
     * 实现的articleEdit钩子方法
     * @return \think\Response
     */
    public function articleEdit($param)
    {
        Url::root('/index.php');
        $param['uploadServer']  = Url::build('/apply/upload/local');
        $this->assign('addons_config', $this->getConfig());
        $this->assign('addons_param', $param);
        return $this->fetch('widget');
    }
}
