From 85c1dd007794fdc6b0a0212ac3a32274faaf17b5 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 6 Dec 2023 23:46:14 +0800 Subject: [PATCH] MDL-80072 core: Deprecate format_text smiley option This was actually deprecated in Moodle 2.0 but did not emit. --- admin/tool/dbtransfer/locallib.php | 1 - .../tool/messageinbound/classes/edit_handler_form.php | 1 - admin/tool/messageinbound/renderer.php | 1 - admin/user/user_bulk_message.php | 1 - grade/edit/tree/grade.php | 1 - lib/classes/output/chooser_item.php | 1 - lib/tablelib.php | 3 --- lib/upgrade.txt | 1 + lib/weblib.php | 11 +++++++++-- tag/edit.php | 1 - 10 files changed, 10 insertions(+), 12 deletions(-) diff --git a/admin/tool/dbtransfer/locallib.php b/admin/tool/dbtransfer/locallib.php index eb0eaba1264..d0ea4e74bec 100644 --- a/admin/tool/dbtransfer/locallib.php +++ b/admin/tool/dbtransfer/locallib.php @@ -170,7 +170,6 @@ function tool_dbtransfer_create_maintenance_file() { $options = new stdClass(); $options->trusted = false; $options->noclean = false; - $options->smiley = false; $options->filter = false; $options->para = true; $options->newlines = false; diff --git a/admin/tool/messageinbound/classes/edit_handler_form.php b/admin/tool/messageinbound/classes/edit_handler_form.php index 1e5503e3d8b..321e7873827 100644 --- a/admin/tool/messageinbound/classes/edit_handler_form.php +++ b/admin/tool/messageinbound/classes/edit_handler_form.php @@ -46,7 +46,6 @@ class tool_messageinbound_edit_handler_form extends moodleform { $formatoptions = new stdClass(); $formatoptions->trusted = false; $formatoptions->noclean = false; - $formatoptions->smiley = false; $formatoptions->filter = false; $formatoptions->para = true; $formatoptions->newlines = false; diff --git a/admin/tool/messageinbound/renderer.php b/admin/tool/messageinbound/renderer.php index d383d748b4c..892c4a9dfcc 100644 --- a/admin/tool/messageinbound/renderer.php +++ b/admin/tool/messageinbound/renderer.php @@ -67,7 +67,6 @@ class tool_messageinbound_renderer extends plugin_renderer_base { $descriptionoptions = new stdClass(); $descriptionoptions->trusted = false; $descriptionoptions->noclean = false; - $descriptionoptions->smiley = false; $descriptionoptions->filter = false; $descriptionoptions->para = true; $descriptionoptions->newlines = false; diff --git a/admin/user/user_bulk_message.php b/admin/user/user_bulk_message.php index c18c010088a..29159dbf001 100644 --- a/admin/user/user_bulk_message.php +++ b/admin/user/user_bulk_message.php @@ -47,7 +47,6 @@ if ($msgform->is_cancelled()) { $options = new stdClass(); $options->para = false; $options->newlines = true; - $options->smiley = false; $options->trusted = trusttext_trusted(\context_system::instance()); $msg = format_text($formdata->messagebody['text'], $formdata->messagebody['format'], $options); diff --git a/grade/edit/tree/grade.php b/grade/edit/tree/grade.php index a710b24cc55..2ccbc3b28c3 100644 --- a/grade/edit/tree/grade.php +++ b/grade/edit/tree/grade.php @@ -111,7 +111,6 @@ if ($grade = $DB->get_record('grade_grades', array('itemid' => $grade_item->id, $grade->feedback = ''; } else { $options = new stdClass(); - $options->smiley = false; $options->filter = false; $options->noclean = false; $options->para = false; diff --git a/lib/classes/output/chooser_item.php b/lib/classes/output/chooser_item.php index 8883b446949..d6392c52b96 100644 --- a/lib/classes/output/chooser_item.php +++ b/lib/classes/output/chooser_item.php @@ -86,7 +86,6 @@ class chooser_item implements renderable, templatable { $options = new stdClass(); $options->trusted = false; $options->noclean = false; - $options->smiley = false; $options->filter = false; $options->para = true; $options->newlines = false; diff --git a/lib/tablelib.php b/lib/tablelib.php index 06612d7991b..c3cbbac6279 100644 --- a/lib/tablelib.php +++ b/lib/tablelib.php @@ -933,9 +933,6 @@ class flexible_table { if (!isset($options->newlines)) { $options->newlines = false; } - if (!isset($options->smiley)) { - $options->smiley = false; - } if (!isset($options->filter)) { $options->filter = false; } diff --git a/lib/upgrade.txt b/lib/upgrade.txt index d840ae02f48..25a01961aef 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -46,6 +46,7 @@ information provided here is intended especially for developers. The old method will be maintained, but new code should use the new method with first-class parameters. * The fourth parameter to `format_text` now emits a deprecation notice. It was originally deprecated in Moodle 2.0. +* The smiley option for format_text has been removed. It was deprecated in Moodle 2.0. === 4.3 === diff --git a/lib/weblib.php b/lib/weblib.php index 1da3952c547..d3030c0d790 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1318,6 +1318,15 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd $params['text'] = $text; if ($options) { + // The smiley option was deprecated in Moodle 2.0. + if (array_key_exists('smiley', $options)) { + unset($options['smiley']); + debugging( + 'The smiley option is deprecated and no longer used.', + DEBUG_DEVELOPER, + ); + } + $validoptions = [ 'text', 'format', @@ -1332,7 +1341,6 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd 'allowid', 'noclean', 'nocache', - 'smiley', ]; $invalidoptions = array_diff(array_keys($options), $validoptions); @@ -3743,7 +3751,6 @@ function get_formatted_help_string($identifier, $component, $ajax = false, $a = $options = new stdClass(); $options->trusted = false; $options->noclean = false; - $options->smiley = false; $options->filter = false; $options->para = true; $options->newlines = false; diff --git a/tag/edit.php b/tag/edit.php index b360d3212d8..e159bed5d8f 100644 --- a/tag/edit.php +++ b/tag/edit.php @@ -78,7 +78,6 @@ $data = $tag->to_object(); $data->relatedtags = core_tag_tag::get_item_tags_array('core', 'tag', $tag->id); $options = new stdClass(); -$options->smiley = false; $options->filter = false; // convert and remove any XSS