From 717b196594c725f260890725f29e0028c25850ab Mon Sep 17 00:00:00 2001 From: MrReSc Date: Sun, 20 Dec 2020 07:14:38 +0100 Subject: [PATCH] codesample languges added --- .htaccess | 2 +- bl-plugins/tinymce/plugin.php | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.htaccess b/.htaccess index 35995c8a..687ddee1 100644 --- a/.htaccess +++ b/.htaccess @@ -6,7 +6,7 @@ AddDefaultCharset UTF-8 RewriteEngine on # Base directory -#RewriteBase / +RewriteBase /bludit/ # Deny direct access to the next directories RewriteRule ^bl-content/(databases|workspaces|pages|tmp)/.*$ - [R=404,L] diff --git a/bl-plugins/tinymce/plugin.php b/bl-plugins/tinymce/plugin.php index 45e7314a..6fb174c1 100644 --- a/bl-plugins/tinymce/plugin.php +++ b/bl-plugins/tinymce/plugin.php @@ -12,7 +12,8 @@ class pluginTinymce extends Plugin { $this->dbFields = array( 'toolbar1'=>'formatselect bold italic forecolor backcolor removeformat | bullist numlist table | blockquote alignleft aligncenter alignright | link unlink pagebreak image code', 'toolbar2'=>'', - 'plugins'=>'code autolink image link pagebreak advlist lists textpattern table' + 'plugins'=>'code autolink image link pagebreak advlist lists textpattern table', + 'codesampleLanguages'=>'HTML/XML markup|JavaScript javascript|CSS css|PHP php|Ruby ruby|Python python|Java java|C c|C# sharp|C++ cpp' ); } @@ -35,6 +36,13 @@ class pluginTinymce extends Plugin { $html .= ''; $html .= ''; + if (strpos($this->getValue('plugins'), 'codesample') !== false) { + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; + } + return $html; } @@ -64,6 +72,14 @@ class pluginTinymce extends Plugin { $plugins = $this->getValue('plugins'); $version = $this->version(); + if (strpos($this->getValue('plugins'), 'codesample') !== false) { + $codesampleLanguages = explode("|", $this->getValue('codesampleLanguages')); + foreach($codesampleLanguages AS $codesampleLang) { + $values = explode(" ", $codesampleLang); + $codesampleConfig .= "{ text: '" . $values[0] . "', value: '" . $values[1] . "' },"; + } + } + $lang = 'en'; if (file_exists($this->phpPath().'tinymce'.DS.'langs'.DS.$L->currentLanguage().'.js')) { $lang = $L->currentLanguage(); @@ -121,7 +137,8 @@ $html = <<