mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-8597 - Fixed: weblib.php::print_speller_code was adding CDATA and <script> tags around the code, when this was already done by weblib.php::use_html_editor().
Check lib/editor/htmlarea/htmlarea.class.php for a seemingly duplicated print_speller_code method.
This commit is contained in:
parent
759b77631c
commit
345ea0f7d4
@ -337,9 +337,10 @@ class htmlarea extends editorObject {
|
||||
/**
|
||||
* Prints out needed code for spellchecking.
|
||||
* @param bool $usehtmleditor
|
||||
* @todo Deprecated? see lib/weblib.php::print_speller_code()
|
||||
* @see lib/weblib.php::print_speller_code()
|
||||
*/
|
||||
function print_speller_code ($usehtmleditor=false) {
|
||||
|
||||
echo "\n".'<script type="text/javascript">'."\n";
|
||||
echo '//<![CDATA['."\n";
|
||||
if (!$usehtmleditor) {
|
||||
@ -362,6 +363,7 @@ class htmlarea extends editorObject {
|
||||
}
|
||||
echo '//]]>'."\n";
|
||||
echo '</script>'."\n";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3864,7 +3864,7 @@ function print_editor_config($editorhidebuttons='', $return=false) {
|
||||
}
|
||||
|
||||
if (!empty($CFG->editorspelling) && !empty($CFG->aspellpath)) {
|
||||
$str .= print_speller_code($usehtmleditor=true, true);
|
||||
$str .= print_speller_code($CFG->htmleditor, true);
|
||||
}
|
||||
|
||||
if ($return) {
|
||||
@ -5378,17 +5378,17 @@ function print_side_block_end($attributes = array()) {
|
||||
/**
|
||||
* Prints out code needed for spellchecking.
|
||||
* Original idea by Ludo (Marc Alier).
|
||||
*
|
||||
*
|
||||
* Opening CDATA and <script> are output by weblib::use_html_editor()
|
||||
* @uses $CFG
|
||||
* @param boolean $usehtmleditor ?
|
||||
* @todo Finish documenting this function
|
||||
* @param boolean $usehtmleditor Normally set by $CFG->htmleditor, can be overriden here
|
||||
* @param boolean $return If false, echos the code instead of returning it
|
||||
* @todo Find out if lib/editor/htmlarea/htmlarea.class.php::print_speller_code() is still used, and delete if not
|
||||
*/
|
||||
function print_speller_code ($usehtmleditor=false, $return=false) {
|
||||
global $CFG;
|
||||
$str = '';
|
||||
|
||||
$str .= "\n".'<script type="text/javascript">'."\n";
|
||||
$str .= '//<![CDATA['."\n";
|
||||
if(!$usehtmleditor) {
|
||||
$str .= 'function openSpellChecker() {'."\n";
|
||||
$str .= "\tvar speller = new spellChecker();\n";
|
||||
@ -5407,8 +5407,7 @@ function print_speller_code ($usehtmleditor=false, $return=false) {
|
||||
$str .= "\tspeller.openChecker();\n";
|
||||
$str .= '}'."\n";
|
||||
}
|
||||
$str .= '//]]>'."\n";
|
||||
$str .= '</script>'."\n";
|
||||
|
||||
if ($return) {
|
||||
return $str;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user