From 59fa45d0f138945b9a6a81736990b354199867d3 Mon Sep 17 00:00:00 2001 From: scyrma Date: Wed, 7 May 2008 07:40:50 +0000 Subject: [PATCH] MDL-11113: simplify the code - use only one function to check for html editor availability --- calendar/event.php | 2 +- lang/en_utf8/help/richtext.html | 2 +- lang/en_utf8/help/richtext2.html | 2 +- lib/moodlelib.php | 10 ---------- lib/questionlib.php | 2 +- mod/data/field/textarea/field.class.php | 4 ++-- mod/quiz/report/grading/report.php | 2 +- user/messageselect.php | 2 +- 8 files changed, 8 insertions(+), 18 deletions(-) diff --git a/calendar/event.php b/calendar/event.php index 457493cb55..8ca1eb0b88 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -80,7 +80,7 @@ $mon = intval($now['mon']); $yr = intval($now['year']); - if ($usehtmleditor = can_use_richtext_editor()) { + if ($usehtmleditor = can_use_html_editor()) { $defaultformat = FORMAT_HTML; } else { $defaultformat = FORMAT_MOODLE; diff --git a/lang/en_utf8/help/richtext.html b/lang/en_utf8/help/richtext.html index c7ef61ed98..7ac3c64382 100644 --- a/lang/en_utf8/help/richtext.html +++ b/lang/en_utf8/help/richtext.html @@ -5,7 +5,7 @@ print_string("htmleditordisabledadmin"); } else if (!$USER->htmleditor) { print_string("htmleditordisabled"); - } else if (!can_use_richtext_editor()) { + } else if (!can_use_html_editor()) { print_string("htmleditordisabledbrowser"); } else { print_string("htmleditoravailable"); diff --git a/lang/en_utf8/help/richtext2.html b/lang/en_utf8/help/richtext2.html index dc240a64a9..3711183d6f 100644 --- a/lang/en_utf8/help/richtext2.html +++ b/lang/en_utf8/help/richtext2.html @@ -5,7 +5,7 @@ print_string("htmleditordisabledadmin"); } else if (!$USER->htmleditor) { print_string("htmleditordisabled"); - } else if (!can_use_richtext_editor()) { + } else if (!can_use_html_editor()) { print_string("htmleditordisabledbrowser"); } else { print_string("htmleditoravailable"); diff --git a/lib/moodlelib.php b/lib/moodlelib.php index c48ccb0e4a..c40e4d2397 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6144,16 +6144,6 @@ function ini_get_bool($ini_get_arg) { return false; } -/** - * Compatibility stub to provide backward compatibility - * - * Determines if the HTML editor is enabled. - * @deprecated Use {@link can_use_html_editor()} instead. - */ -function can_use_richtext_editor() { - return can_use_html_editor(); -} - /** * Determines if the HTML editor is enabled. * diff --git a/lib/questionlib.php b/lib/questionlib.php index 64da4dac8d..94259e5b97 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1373,7 +1373,7 @@ function question_print_comment_box($question, $state, $attempt, $url) { global $CFG; $prefix = 'response'; - $usehtmleditor = can_use_richtext_editor(); + $usehtmleditor = can_use_html_editor(); $grade = round($state->last_graded->grade, 3); echo '
'; include($CFG->dirroot.'/question/comment.html'); diff --git a/mod/data/field/textarea/field.class.php b/mod/data/field/textarea/field.class.php index ebf6360f6f..10032ea19a 100755 --- a/mod/data/field/textarea/field.class.php +++ b/mod/data/field/textarea/field.class.php @@ -46,7 +46,7 @@ class data_field_textarea extends data_field_base { $str = '
'; - if (can_use_richtext_editor()) { + if (can_use_html_editor()) { // Show a rich text html editor. $str .= $this->gen_textarea(true, $text); $str .= helpbutton("richtext2", get_string("helprichtext"), 'moodle', true, true, '', true); @@ -89,7 +89,7 @@ class data_field_textarea extends data_field_base { function print_after_form() { - if (can_use_richtext_editor()) { + if (can_use_html_editor()) { use_html_editor('field_' . $this->field->id, '', 'field_' . $this->field->id); } } diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index af40baf85e..93f58faaeb 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -335,7 +335,7 @@ class quiz_report extends quiz_default_report { $context = NULL; $questions[$question->id] = &$question; - $usehtmleditor = can_use_richtext_editor(); + $usehtmleditor = can_use_html_editor(); $users = get_course_students($quiz->course); $userids = implode(',', array_keys($users)); diff --git a/user/messageselect.php b/user/messageselect.php index 3ab50d83fb..e023a4304e 100644 --- a/user/messageselect.php +++ b/user/messageselect.php @@ -130,7 +130,7 @@ } if (count($SESSION->emailto[$id])) { - $usehtmleditor = can_use_richtext_editor(); + $usehtmleditor = can_use_html_editor(); require("message.html"); if ($usehtmleditor) { use_html_editor("messagebody"); -- 2.39.5