From 4d67fe61613d90287f4bd89f6efb3bcd786ddc63 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 24 Jul 2018 16:28:01 +0800 Subject: [PATCH] MDL-50225 core: replace usages of print_textarea() --- lib/form/htmleditor.php | 18 +++++++----------- mod/feedback/show_nonrespondents.php | 8 ++++++-- mod/wiki/editors/wiki_editor.php | 3 ++- mod/wiki/instancecomments.php | 6 +++++- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/form/htmleditor.php b/lib/form/htmleditor.php index 32353d67376..c3aeb405d4b 100644 --- a/lib/form/htmleditor.php +++ b/lib/form/htmleditor.php @@ -88,21 +88,17 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{ * * @return string */ - function toHtml(){ + public function toHtml() { + global $OUTPUT; + if ($this->_flagFrozen) { return $this->getFrozenHtml(); } else { + $value = preg_replace("/(\r\n|\n|\r)/", ' ', $this->getValue()); + return $this->_getTabs() . - print_textarea(true, - $this->_options['rows'], - $this->_options['cols'], - $this->_options['width'], - $this->_options['height'], - $this->getName(), - preg_replace("/(\r\n|\n|\r)/", ' ',$this->getValue()), - 0, // unused anymore - true, - $this->getAttribute('id')); + $OUTPUT->print_textarea($this->getName(), $this->getAttribute('id'), $value, $this->_options['rows'], + $this->_options['cols']); } } diff --git a/mod/feedback/show_nonrespondents.php b/mod/feedback/show_nonrespondents.php index d6297362dd3..8be8e65cc21 100644 --- a/mod/feedback/show_nonrespondents.php +++ b/mod/feedback/show_nonrespondents.php @@ -31,7 +31,7 @@ require_once($CFG->libdir.'/tablelib.php'); //////////////////////////////////////////////////////// $id = required_param('id', PARAM_INT); $subject = optional_param('subject', '', PARAM_CLEANHTML); -$message = optional_param('message', '', PARAM_CLEANHTML); +$message = optional_param_array('message', '', PARAM_CLEANHTML); $format = optional_param('format', FORMAT_MOODLE, PARAM_INT); $messageuser = optional_param_array('messageuser', false, PARAM_INT); $action = optional_param('action', '', PARAM_ALPHA); @@ -44,6 +44,10 @@ $current_tab = 'nonrespondents'; //get the objects //////////////////////////////////////////////////////// +if ($message) { + $message = $message['text']; +} + list ($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback'); if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { print_error('invalidcoursemodule'); @@ -275,7 +279,7 @@ if (empty($students)) { echo ''; echo ''; echo ''; - print_textarea(true, 15, 25, 30, 10, "message", $message); + echo $OUTPUT->print_textarea('message', 'edit-message', $message, 15, 25); print_string('formathtml'); echo ''; echo '
'; diff --git a/mod/wiki/editors/wiki_editor.php b/mod/wiki/editors/wiki_editor.php index 07166e4cf91..d68d9acc89f 100644 --- a/mod/wiki/editors/wiki_editor.php +++ b/mod/wiki/editors/wiki_editor.php @@ -75,7 +75,8 @@ function wiki_print_editor_wiki($pageid, $content, $editor, $version = -1, $sect echo $OUTPUT->container_start(); echo '
'; - echo $OUTPUT->container(print_textarea(false, 20, 60, 0, 0, "newcontent", $content, 0, true), false, 'wiki_editor'); + $textarea = $OUTPUT->print_textarea('newcontent', 'edit-newcontent', $content, 20, 60); + echo $OUTPUT->container($textarea, false, 'wiki_editor'); echo $OUTPUT->container_start(); wiki_print_edit_form_default_fields($editor, $pageid, $version, $upload, $deleteuploads); echo $OUTPUT->container_end(); diff --git a/mod/wiki/instancecomments.php b/mod/wiki/instancecomments.php index 85366c9691b..b2466b6b57a 100644 --- a/mod/wiki/instancecomments.php +++ b/mod/wiki/instancecomments.php @@ -41,9 +41,13 @@ $pageid = required_param('pageid', PARAM_TEXT); $action = optional_param('action', '', PARAM_ALPHANUMEXT); $id = optional_param('id', 0, PARAM_INT); $commentid = optional_param('commentid', 0, PARAM_INT); -$newcontent = optional_param('newcontent', '', PARAM_CLEANHTML); +$newcontent = optional_param_array('newcontent', '', PARAM_CLEANHTML); $confirm = optional_param('confirm', 0, PARAM_BOOL); +if ($newcontent) { + $newcontent = $newcontent['text']; +} + if (!$page = wiki_get_page($pageid)) { print_error('incorrectpageid', 'wiki'); }