diff --git a/lib/editor/tinymce/plugins/moodleemoticon/dialog.php b/lib/editor/tinymce/plugins/moodleemoticon/dialog.php
index fc373fbbd2f..39bf1ac9149 100644
--- a/lib/editor/tinymce/plugins/moodleemoticon/dialog.php
+++ b/lib/editor/tinymce/plugins/moodleemoticon/dialog.php
@@ -1,5 +1,4 @@
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-define('NO_MOODLE_COOKIES', true); // Session not used here
-define('NO_UPGRADE_CHECK', true); // Ignore upgrade check
+define('NO_MOODLE_COOKIES', true); // Session not used here.
-require_once(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php');
+require(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/config.php');
-$PAGE->set_context(get_system_context());
+$PAGE->set_context(context_system::instance());
+$PAGE->set_url('/lib/editor/tinymce/plugins/moodleemoticon/dialog.php');
$emoticonmanager = get_emoticon_manager();
$stringmanager = get_string_manager();
@@ -36,12 +35,14 @@ $stringmanager = get_string_manager();
$editor = get_texteditor('tinymce');
$plugin = $editor->get_plugin('moodleemoticon');
+$htmllang = get_html_lang();
+header('Content-Type: text/html; charset=utf-8');
?>
-
-
+
+
-
-
+
+
@@ -50,7 +51,7 @@ $plugin = $editor->get_plugin('moodleemoticon');
get_emoticons();
-// this is tricky - we must somehow include the information about the original
+// This is tricky - we must somehow include the information about the original
// emoticon text so that we can replace the image back with it on editor save.
// so we are going to encode the index of the emoticon. this will break when the
// admin changes the mapping table while the user has the editor opened
diff --git a/lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php b/lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php
index e3b223d2439..55100cf233e 100644
--- a/lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php
+++ b/lib/editor/tinymce/plugins/moodleemoticon/lang/en/tinymce_moodleemoticon.php
@@ -17,11 +17,12 @@
/**
* Strings for Moodle emoticon plugin.
*
- * @package tinymce_moodleemoticon
+ * @package tinymce_moodleemoticon
* @copyright 2012 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Insert emoticon';
-$string['desc'] = 'Insert emoticon';
+/* All lang strings used from TinyMCE JavaScript code must be named 'pluginname:stringname', no need to create langs/en_dlg.js */
+$string['moodleemoticon:desc'] = 'Insert emoticon';
diff --git a/lib/editor/tinymce/plugins/moodleemoticon/lib.php b/lib/editor/tinymce/plugins/moodleemoticon/lib.php
index 1fb2c7204cd..09f23c5d503 100644
--- a/lib/editor/tinymce/plugins/moodleemoticon/lib.php
+++ b/lib/editor/tinymce/plugins/moodleemoticon/lib.php
@@ -19,9 +19,9 @@ defined('MOODLE_INTERNAL') || die();
/**
* Plugin for Moodle emoticons.
*
- * @package tinymce_moodleemoticon
+ * @package tinymce_moodleemoticon
* @copyright 2012 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tinymce_moodleemoticon extends editor_tinymce_plugin {
protected function update_init_params(array &$params, context $context,
diff --git a/lib/editor/tinymce/plugins/moodleemoticon/tinymce/editor_plugin.js b/lib/editor/tinymce/plugins/moodleemoticon/tinymce/editor_plugin.js
index c3a3bc0f028..389250bf30f 100644
--- a/lib/editor/tinymce/plugins/moodleemoticon/tinymce/editor_plugin.js
+++ b/lib/editor/tinymce/plugins/moodleemoticon/tinymce/editor_plugin.js
@@ -1,7 +1,7 @@
/**
- * TinyMCE plugin MoodleEmoticon - provides GUI to insert emoticon images
+ * TinyMCE plugin MoodleEmoticon - provides GUI to insert emoticon images.
*
- * Based on the example plugin (c) 2009 Moxiecode Systems AB
+ * Based on the example plugin (c) 2009 Moxiecode Systems AB.
*
* @author David Mudrak
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -11,7 +11,7 @@
tinymce.create('tinymce.plugins.MoodleEmoticon', {
/**
- * Holds the list of emoticons provided by emoticon_manager
+ * Holds the list of emoticons provided by emoticon_manager.
*
* @private
*/
@@ -30,7 +30,7 @@
ed.addCommand('mceMoodleEmoticon', function() {
lang = ed.getParam('language');
ed.windowManager.open({
- file : url + '/../../../moodleemoticon/dialog.php?lang=' + lang ,
+ file : ed.getParam("moodle_plugin_base") + 'moodleemoticon/dialog.php?lang=' + lang ,
width : 250 + parseInt(ed.getLang('moodleemoticon.delta_width', 0)),
height : 400 + parseInt(ed.getLang('moodleemoticon.delta_height', 0)),
inline : 1
@@ -39,7 +39,7 @@
});
});
- // Add an observer to the onInit event to convert emoticon texts to images
+ // Add an observer to the onInit event to convert emoticon texts to images.
ed.onInit.add(function(ed) {
var data = ed.getContent();
this._emoticons = tinymce.util.JSON.parse(ed.getParam('moodleemoticon_emoticons'));
@@ -54,7 +54,7 @@
ed.setContent(data);
});
- // Add an observer to the onPreProcess event to convert emoticon images to texts
+ // Add an observer to the onPreProcess event to convert emoticon images to texts.
ed.onPreProcess.add(function(ed, o) {
if (o.save) {
tinymce.each(ed.dom.select('img.emoticon', o.node), function(image) {
@@ -80,7 +80,7 @@
}
});
- // Register moodleemoticon button
+ // Register moodleemoticon button.
ed.addButton('moodleemoticon', {
title : 'moodleemoticon.desc',
cmd : 'mceMoodleEmoticon',
@@ -119,6 +119,6 @@
}
});
- // Register plugin
+ // Register plugin.
tinymce.PluginManager.add('moodleemoticon', tinymce.plugins.MoodleEmoticon);
})();
diff --git a/lib/editor/tinymce/plugins/moodleemoticon/tinymce/js/dialog.js b/lib/editor/tinymce/plugins/moodleemoticon/tinymce/js/dialog.js
index 49a3672c2cb..fc01f31c66b 100644
--- a/lib/editor/tinymce/plugins/moodleemoticon/tinymce/js/dialog.js
+++ b/lib/editor/tinymce/plugins/moodleemoticon/tinymce/js/dialog.js
@@ -1,7 +1,7 @@
var MoodleEmoticonDialog = {
init : function() {
- // register event handlers for the table rows
+ // Register event handlers for the table rows.
tinymce.each(tinymce.DOM.select('tr.emoticoninfo', document), function(row) {
tinymce.dom.Event.add(row, 'mouseover', function(e) {
diff --git a/lib/editor/tinymce/plugins/moodleemoticon/version.php b/lib/editor/tinymce/plugins/moodleemoticon/version.php
index 002f327919a..7252acbe9e8 100644
--- a/lib/editor/tinymce/plugins/moodleemoticon/version.php
+++ b/lib/editor/tinymce/plugins/moodleemoticon/version.php
@@ -17,9 +17,9 @@
/**
* TinyMCE emoticon plugin version details.
*
- * @package tinymce_moodleemoticon
+ * @package tinymce_moodleemoticon
* @copyright 2012 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();