From dd06fb5a8a06f39e6cd611de48fbd5288caab043 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Sun, 6 Aug 2017 00:52:00 +0200 Subject: [PATCH] Tinymce n --- bl-plugins/simplemde/plugin.php | 39 +++++++------------ bl-plugins/tinymce/plugin.php | 66 ++++++++++++++++----------------- 2 files changed, 45 insertions(+), 60 deletions(-) diff --git a/bl-plugins/simplemde/plugin.php b/bl-plugins/simplemde/plugin.php index 9c51522f..6bcea7f6 100644 --- a/bl-plugins/simplemde/plugin.php +++ b/bl-plugins/simplemde/plugin.php @@ -2,10 +2,8 @@ class pluginsimpleMDE extends Plugin { - private $loadWhenController = array( - 'new-post', + private $loadOnController = array( 'new-page', - 'edit-post', 'edit-page' ); @@ -54,13 +52,9 @@ class pluginsimpleMDE extends Plugin { public function adminHead() { - global $layout; + if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) { + $html = ''; - $html = ''; - - // Load CSS and JS only on Controllers in array. - if(in_array($layout['controller'], $this->loadWhenController)) - { // Path plugin. $pluginPath = $this->htmlPath(); @@ -81,30 +75,22 @@ class pluginsimpleMDE extends Plugin { .CodeMirror, .CodeMirror-scroll { min-height: 400px !important; border-radius: 0 !important; } '; + return $html; } - return $html; + return false; } public function adminBodyEnd() { - global $layout; - global $Language; - - $html = ''; - - // Load CSS and JS only on Controllers in array. - if(in_array($layout['controller'], $this->loadWhenController)) - { + if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) { // Autosave - global $_Page, $_Post; - $autosaveID = $layout['controller']; + global $Page; + global $Language; + $autosaveID = $GLOBALS['ADMIN_CONTROLLER']; $autosaveEnable = $this->getDbField('autosave')?'true':'false'; - if(isset($_Page)) { - $autosaveID = $_Page->key(); - } - if(isset($_Post)) { - $autosaveID = $_Post->key(); + if (!empty($Page)) { + $autosaveID = $Page->key(); } // Spell Checker @@ -148,8 +134,9 @@ class pluginsimpleMDE extends Plugin { });'; $html .= '}); '; + return $html; } - return $html; + return false; } } \ No newline at end of file diff --git a/bl-plugins/tinymce/plugin.php b/bl-plugins/tinymce/plugin.php index 388d1745..2d3281e5 100644 --- a/bl-plugins/tinymce/plugin.php +++ b/bl-plugins/tinymce/plugin.php @@ -2,43 +2,14 @@ class pluginTinymce extends Plugin { - private $loadWhenController = array( - 'new-post', + private $loadOnController = array( 'new-page', - 'edit-post', 'edit-page' ); - public function init() - { - $this->dbFields = array( - 'plugins'=>'autoresize, fullscreen, pagebreak, link, textcolor, code, image, paste', - 'toolbar'=>'bold italic underline strikethrough | alignleft aligncenter alignright | bullist numlist | styleselect | link forecolor backcolor removeformat image | pagebreak code fullscreen' - ); - } - - public function form() - { - global $Language; - - $html = '
'; - $html .= ''; - $html .= ''; - $html .= '
'; - - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= '
'; - - return $html; - } - public function adminHead() { - global $layout; - - if (in_array($layout['controller'], $this->loadWhenController)) { + if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) { return ''; } return false; @@ -46,10 +17,37 @@ class pluginTinymce extends Plugin { public function adminBodyEnd() { - global $layout; + global $Language; - if (in_array($layout['controller'], $this->loadWhenController)) { - return ''; + if (in_array($GLOBALS['ADMIN_CONTROLLER'], $this->loadOnController)) { + return ''; } return false; }