From 9ab7bc6b169619ac82c8e93f111d8d8fa905a2b8 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 13 Sep 2009 03:48:22 -0400
Subject: [PATCH] - Added 'html_editor' hook (#1486068)

---
 CHANGELOG                |    1 +
 program/include/main.inc |   22 ++++++++++++++--------
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 45753a0..1b0317a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Added 'html_editor' hook (#1486068)
 - Fix DB constraint violation when populating messages cache (#1486052)
 - Password: added password strength options (#1486062)
 - Fix LDAP partial result warning (#1485536)
diff --git a/program/include/main.inc b/program/include/main.inc
index ce27b75..e79cc02 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1378,17 +1378,23 @@
  */
 function rcube_html_editor($mode='')
 {
-  global $OUTPUT, $CONFIG;
+  global $RCMAIL, $CONFIG;
 
-  $lang = $tinylang = strtolower(substr($_SESSION['language'], 0, 2));
-  if (!file_exists(INSTALL_PATH . 'program/js/tiny_mce/langs/'.$tinylang.'.js'))
-    $tinylang = 'en';
+  $lang = strtolower(substr($_SESSION['language'], 0, 2));
+  if (!file_exists(INSTALL_PATH . 'program/js/tiny_mce/langs/'.$lang.'.js'))
+    $lang = 'en';
 
-  $OUTPUT->include_script('tiny_mce/tiny_mce.js');
-  $OUTPUT->include_script('editor.js');
-  $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.JQ($tinylang).'", '.intval($CONFIG['enable_spellcheck']).', "'.$mode.'");');
+  $hook = $RCMAIL->plugins->exec_hook('hmtl_editor', array('abort' => false,
+    'mode' => $mode, 'lang' => $lang));
+
+  if ($hook['abort'])
+    return;  
+
+  $RCMAIL->output->include_script('tiny_mce/tiny_mce.js');
+  $RCMAIL->output->include_script('editor.js');
+  $RCMAIL->output->add_script('rcmail_editor_init("$__skin_path",
+    "'.JQ($hook['lang']).'", '.intval($CONFIG['enable_spellcheck']).', "'.$hook['mode'].'");');
 }
-
 
 
 /**

--
Gitblit v1.9.1