$temp = new admin_settingpage('htmleditorsettings', get_string('htmleditorsettings', 'admin'));
- $htmleditors = array();
- foreach (get_available_html_editors() as $editor) {
- //$htmleditors[$editor] = get_string($editor, 'admin');
- $htmleditors[$editor] = $editor;
- }
+ $htmleditors = get_available_html_editors();
+
$temp->add(new admin_setting_configselect('defaulthtmleditor', get_string('defaulthtmleditor', 'admin'), null, 'tinymce', $htmleditors));
$temp->add(new admin_setting_configcheckbox('htmleditor', get_string('usehtmleditor', 'admin'), get_string('confightmleditor','admin'), 1));
$temp->add(new admin_setting_emoticons());
* 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;
+ return array('tinymce'=>'TinyMCE');
}
/**