| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @brief dcLegacyEditor, a plugin for Dotclear 2 |
|---|
| 4 | * |
|---|
| 5 | * @package Dotclear |
|---|
| 6 | * @subpackage Plugins |
|---|
| 7 | * |
|---|
| 8 | * @copyright Olivier Meunier & Association Dotclear |
|---|
| 9 | * @copyright GPL-2.0-only |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | if (!defined('DC_CONTEXT_ADMIN')) {return;} |
|---|
| 13 | |
|---|
| 14 | $_menu['Plugins']->addItem('dcLegacyEditor', |
|---|
| 15 | $core->adminurl->get('admin.plugin.dcLegacyEditor'), |
|---|
| 16 | dcPage::getPF('dcLegacyEditor/icon.png'), |
|---|
| 17 | preg_match('/' . preg_quote($core->adminurl->get('admin.plugin.dcLegacyEditor')) . '/', $_SERVER['REQUEST_URI']), |
|---|
| 18 | $core->auth->check('admin,contentadmin', $core->blog->id) |
|---|
| 19 | ); |
|---|
| 20 | |
|---|
| 21 | $self_ns = $core->blog->settings->addNamespace('dclegacyeditor'); |
|---|
| 22 | |
|---|
| 23 | if ($self_ns->active) { |
|---|
| 24 | if (!($core->wiki2xhtml instanceof wiki2xhtml)) { |
|---|
| 25 | $core->initWikiPost(); |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | $core->addEditorFormater('dcLegacyEditor', 'xhtml', function ($s) {return $s;}); |
|---|
| 29 | $core->addEditorFormater('dcLegacyEditor', 'wiki', [$core->wiki2xhtml, 'transform']); |
|---|
| 30 | |
|---|
| 31 | $core->addBehavior('adminPostEditor', ['dcLegacyEditorBehaviors', 'adminPostEditor']); |
|---|
| 32 | $core->addBehavior('adminPopupMedia', ['dcLegacyEditorBehaviors', 'adminPopupMedia']); |
|---|
| 33 | $core->addBehavior('adminPopupLink', ['dcLegacyEditorBehaviors', 'adminPopupLink']); |
|---|
| 34 | $core->addBehavior('adminPopupPosts', ['dcLegacyEditorBehaviors', 'adminPopupPosts']); |
|---|
| 35 | } |
|---|