aboutsummaryrefslogtreecommitdiff
path: root/mod/tinymce/start.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/tinymce/start.php')
-rw-r--r--mod/tinymce/start.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/mod/tinymce/start.php b/mod/tinymce/start.php
new file mode 100644
index 000000000..6aba837e0
--- /dev/null
+++ b/mod/tinymce/start.php
@@ -0,0 +1,47 @@
+<?php
+/**
+ * TinyMCE wysiwyg editor
+ *
+ * @package ElggTinyMCE
+ */
+
+elgg_register_event_handler('init', 'system', 'tinymce_init');
+
+function tinymce_init() {
+ elgg_extend_view('css/elgg', 'tinymce/css');
+ elgg_extend_view('css/admin', 'tinymce/css');
+
+ elgg_register_js('tinymce', 'mod/tinymce/vendor/tinymce/jscripts/tiny_mce/tiny_mce.js');
+ elgg_register_js('elgg.tinymce', elgg_get_simplecache_url('js', 'tinymce'));
+ elgg_register_simplecache_view('js/tinymce');
+
+ elgg_extend_view('input/longtext', 'tinymce/init');
+
+ elgg_extend_view('embed/custom_insert_js', 'tinymce/embed_custom_insert_js');
+
+ elgg_register_plugin_hook_handler('register', 'menu:longtext', 'tinymce_longtext_menu');
+}
+
+function tinymce_longtext_menu($hook, $type, $items, $vars) {
+
+ $items[] = ElggMenuItem::factory(array(
+ 'name' => 'tinymce_toggler',
+ 'link_class' => 'tinymce-toggle-editor elgg-longtext-control',
+ 'href' => "#{$vars['id']}",
+ 'text' => elgg_echo('tinymce:remove'),
+ ));
+
+ return $items;
+}
+
+function tinymce_get_site_language() {
+
+ if ($site_language = elgg_get_config('language')) {
+ $path = elgg_get_plugins_path() . "tinymce/vendor/tinymce/jscripts/tiny_mce/langs";
+ if (file_exists("$path/$site_language.js")) {
+ return $site_language;
+ }
+ }
+
+ return 'en';
+}