diff --git a/lib/form/htmleditor.php b/lib/form/htmleditor.php
index 20d1109a888..8eb68debdc0 100644
--- a/lib/form/htmleditor.php
+++ b/lib/form/htmleditor.php
@@ -61,9 +61,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
function toHtml(){
if ($this->_canUseHtmlEditor && !$this->_flagFrozen){
- ob_start();
- use_html_editor($this->getName(), '', $this->getAttribute('id'));
- $script=ob_get_clean();
+ global $htmlEditorObject;
+ $script = $htmlEditorObject->activateEditor($this->getName(), $this->getAttribute('id'));
} else {
$script='';
}
@@ -96,4 +95,4 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
return $html . $this->_getPersistantData();
} //end func getFrozenHtml
}
-?>
\ No newline at end of file
+?>
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 12f551258c4..6d0e8c9146c 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -6131,6 +6131,33 @@ function ini_get_bool($ini_get_arg) {
return false;
}
+ /**
+ * Get the list of available HTML editors
+ */
+function get_available_html_editors() {
+ global $CFG;
+ static $editors = null;
+
+ if ($editors != null) {
+ return $editors;
+ }
+
+ $editors = array();
+
+ $dir = opendir($CFG->libdir .'/editor');
+ while (($file = readdir($dir)) !== false) {
+ if ($file != '.' and $file != '..') {
+ $path_file = $CFG->libdir ."/editor/{$file}";
+ if (is_dir($path_file) and file_exists($path_file .'.js.php')) {
+ $editors[] = $file;
+ }
+ }
+ }
+ closedir($dir);
+
+ return $editors;
+}
+
/**
* Determines if the HTML editor is enabled.
*
diff --git a/lib/weblib.php b/lib/weblib.php
index af9fe888121..616878b3562 100644
--- a/lib/weblib.php
+++ b/lib/weblib.php
@@ -2557,11 +2557,18 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
$bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
+ require_once($CFG->libdir .'/editor/htmlEditor.class.php');
+ global $htmlEditorObject;
+ $htmlEditorObject = new htmlEditor();
+ $htmlEditor = $htmlEditorObject->configure();
+
ob_start();
include($CFG->header);
$output = ob_get_contents();
ob_end_clean();
+ $output = str_replace('', "\n\n$htmlEditor\n\n", $output);
+
// container debugging info
$THEME->open_header_containers = open_containers();