Skip to content

Commit

Permalink
MDL-80072 core: Deprecate format_text smiley option
Browse files Browse the repository at this point in the history
This was actually deprecated in Moodle 2.0 but did not emit.
  • Loading branch information
andrewnicols committed Feb 12, 2024
1 parent d56303a commit 85c1dd0
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 12 deletions.
1 change: 0 additions & 1 deletion admin/tool/dbtransfer/locallib.php
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion admin/tool/messageinbound/classes/edit_handler_form.php
Expand Up @@ -46,7 +46,6 @@ public function definition() {
$formatoptions = new stdClass();
$formatoptions->trusted = false;
$formatoptions->noclean = false;
$formatoptions->smiley = false;
$formatoptions->filter = false;
$formatoptions->para = true;
$formatoptions->newlines = false;
Expand Down
1 change: 0 additions & 1 deletion admin/tool/messageinbound/renderer.php
Expand Up @@ -67,7 +67,6 @@ public function messageinbound_handlers_table(array $handlers) {
$descriptionoptions = new stdClass();
$descriptionoptions->trusted = false;
$descriptionoptions->noclean = false;
$descriptionoptions->smiley = false;
$descriptionoptions->filter = false;
$descriptionoptions->para = true;
$descriptionoptions->newlines = false;
Expand Down
1 change: 0 additions & 1 deletion admin/user/user_bulk_message.php
Expand Up @@ -47,7 +47,6 @@
$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);
Expand Down
1 change: 0 additions & 1 deletion grade/edit/tree/grade.php
Expand Up @@ -111,7 +111,6 @@
$grade->feedback = '';
} else {
$options = new stdClass();
$options->smiley = false;
$options->filter = false;
$options->noclean = false;
$options->para = false;
Expand Down
1 change: 0 additions & 1 deletion lib/classes/output/chooser_item.php
Expand Up @@ -86,7 +86,6 @@ public function export_for_template(renderer_base $output) {
$options = new stdClass();
$options->trusted = false;
$options->noclean = false;
$options->smiley = false;
$options->filter = false;
$options->para = true;
$options->newlines = false;
Expand Down
3 changes: 0 additions & 3 deletions lib/tablelib.php
Expand Up @@ -933,9 +933,6 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL, $courseid=NULL
if (!isset($options->newlines)) {
$options->newlines = false;
}
if (!isset($options->smiley)) {
$options->smiley = false;
}
if (!isset($options->filter)) {
$options->filter = false;
}
Expand Down
1 change: 1 addition & 0 deletions lib/upgrade.txt
Expand Up @@ -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 ===

Expand Down
11 changes: 9 additions & 2 deletions lib/weblib.php
Expand Up @@ -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',
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion tag/edit.php
Expand Up @@ -78,7 +78,6 @@
$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
Expand Down

0 comments on commit 85c1dd0

Please sign in to comment.