protected function get_init_params($elementid, array $options = null) { global $CFG, $PAGE, $OUTPUT; require_once $CFG->dirroot . '/lib/editor/tinymce/classes/plugin.php'; //TODO: we need to implement user preferences that affect the editor setup too $directionality = get_string('thisdirection', 'langconfig'); $strtime = get_string('strftimetime'); $strdate = get_string('strftimedaydate'); $lang = current_language(); $contentcss = $PAGE->theme->editor_css_url()->out(false); $context = empty($options['context']) ? context_system::instance() : $options['context']; $config = get_config('editor_tinymce'); if (!isset($config->disabledsubplugins)) { $config->disabledsubplugins = ''; } $fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist; $langrev = -1; if (!empty($CFG->cachejs)) { $langrev = get_string_manager()->get_revision(); } $params = array('moodle_config' => $config, 'mode' => "exact", 'elements' => $elementid, 'relative_urls' => false, 'document_base_url' => $CFG->httpswwwroot, 'moodle_plugin_base' => "{$CFG->httpswwwroot}/lib/editor/tinymce/plugins/", 'content_css' => $contentcss, 'language' => $lang, 'directionality' => $directionality, 'plugin_insertdate_dateFormat ' => $strdate, 'plugin_insertdate_timeFormat ' => $strtime, 'theme' => "advanced", 'skin' => "o2k7", 'skin_variant' => "silver", 'apply_source_formatting' => true, 'remove_script_host' => false, 'entity_encoding' => "raw", 'plugins' => 'safari,table,style,layer,advhr,advlink,emotions,inlinepopups,' . 'searchreplace,paste,directionality,fullscreen,nonbreaking,contextmenu,' . 'insertdatetime,save,iespell,preview,print,noneditable,visualchars,' . 'xhtmlxtras,template,pagebreak', 'gecko_spellcheck' => true, 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_toolbar_align' => "left", 'theme_advanced_fonts' => $fontselectlist, 'theme_advanced_resize_horizontal' => true, 'theme_advanced_resizing' => true, 'theme_advanced_resizing_min_height' => 30, 'min_height' => 30, 'theme_advanced_toolbar_location' => "top", 'theme_advanced_statusbar_location' => "bottom", 'language_load' => false, 'langrev' => $langrev); // Should we override the default toolbar layout unconditionally? $customtoolbar = self::parse_toolbar_setting($config->customtoolbar); if ($customtoolbar) { $i = 1; foreach ($customtoolbar as $line) { $params['theme_advanced_buttons' . $i] = $line; $i++; } } else { // At least one line is required. $params['theme_advanced_buttons1'] = ''; } if (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted'])) { // now deal somehow with non-standard tags, people scream when we do not make moodle code xtml strict, // but they scream even more when we strip all tags that are not strict :-( $params['valid_elements'] = 'script[src|type],*[*]'; // for some reason the *[*] does not inlcude javascript src attribute MDL-25836 $params['invalid_elements'] = ''; } // Add unique moodle elements - unfortunately we have to decide if these are SPANs or DIVs. $params['extended_valid_elements'] = 'nolink,tex,algebra,lang[lang]'; $params['custom_elements'] = 'nolink,~tex,~algebra,lang'; //Add onblur event for client side text validation if (!empty($options['required'])) { $params['init_instance_callback'] = 'M.editor_tinymce.onblur_event'; } // Allow plugins to adjust parameters. editor_tinymce_plugin::all_update_init_params($params, $context, $options); // Remove temporary parameters. unset($params['moodle_config']); return $params; }
protected function get_init_params($elementid, array $options = null) { global $CFG, $PAGE, $OUTPUT; require_once $CFG->dirroot . '/lib/editor/tinymce/classes/plugin.php'; //TODO: we need to implement user preferences that affect the editor setup too $directionality = get_string('thisdirection', 'langconfig'); $strtime = get_string('strftimetime'); $strdate = get_string('strftimedaydate'); $lang = current_language(); $contentcss = $PAGE->theme->editor_css_url()->out(false); $context = empty($options['context']) ? context_system::instance() : $options['context']; $config = get_config('editor_tinymce'); $fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist; $fontbutton = $fontselectlist === '' ? '' : 'fontselect,'; $params = array('moodle_config' => $config, 'mode' => "exact", 'elements' => $elementid, 'relative_urls' => false, 'document_base_url' => $CFG->httpswwwroot, 'moodle_plugin_base' => "{$CFG->httpswwwroot}/lib/editor/tinymce/plugins/", 'content_css' => $contentcss, 'language' => $lang, 'directionality' => $directionality, 'plugin_insertdate_dateFormat ' => $strdate, 'plugin_insertdate_timeFormat ' => $strtime, 'theme' => "advanced", 'skin' => "o2k7", 'skin_variant' => "silver", 'apply_source_formatting' => true, 'remove_script_host' => false, 'entity_encoding' => "raw", 'plugins' => 'safari,table,style,layer,advhr,advlink,emotions,inlinepopups,' . 'searchreplace,paste,directionality,fullscreen,nonbreaking,contextmenu,' . 'insertdatetime,save,iespell,preview,print,noneditable,visualchars,' . 'xhtmlxtras,template,pagebreak', 'theme_advanced_font_sizes' => "1,2,3,4,5,6,7", 'theme_advanced_layout_manager' => "SimpleLayout", 'theme_advanced_toolbar_align' => "left", 'theme_advanced_buttons1' => $fontbutton . 'fontsizeselect,formatselect,|,' . 'undo,redo,|,search,replace,|,fullscreen', 'theme_advanced_buttons2' => 'bold,italic,underline,strikethrough,sub,sup,|,' . 'justifyleft,justifycenter,justifyright,|,' . 'cleanup,removeformat,pastetext,pasteword,|,forecolor,backcolor,|,ltr,rtl', 'theme_advanced_buttons3' => 'bullist,numlist,outdent,indent,|,' . 'link,unlink,|,image,nonbreaking,charmap,table,|,code', 'theme_advanced_fonts' => $fontselectlist, 'theme_advanced_resize_horizontal' => true, 'theme_advanced_resizing' => true, 'theme_advanced_resizing_min_height' => 30, 'min_height' => 30, 'theme_advanced_toolbar_location' => "top", 'theme_advanced_statusbar_location' => "bottom"); if (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted'])) { // now deal somehow with non-standard tags, people scream when we do not make moodle code xtml strict, // but they scream even more when we strip all tags that are not strict :-( $params['valid_elements'] = 'script[src|type],*[*]'; // for some reason the *[*] does not inlcude javascript src attribute MDL-25836 $params['invalid_elements'] = ''; } // Add unique moodle elements - unfortunately we have to decide if these are SPANs or DIVs. $params['extended_valid_elements'] = 'nolink,tex,algebra,lang[lang]'; $params['custom_elements'] = 'nolink,~tex,~algebra,lang'; if (empty($options['legacy'])) { if (isset($options['maxfiles']) and $options['maxfiles'] != 0) { $params['file_browser_callback'] = "M.editor_tinymce.filepicker"; } } //Add onblur event for client side text validation if (!empty($options['required'])) { $params['init_instance_callback'] = 'M.editor_tinymce.onblur_event'; } // Allow plugins to adjust parameters. editor_tinymce_plugin::all_update_init_params($params, $context, $options); // Remove temporary parameters. unset($params['moodle_config']); return $params; }