mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
Merge branch 'MDL-78432-401' of https://github.com/laurentdavid/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
d73c514909
@ -34,7 +34,9 @@ define("LABEL_MAX_NAME_LENGTH", 50);
|
||||
* @return string
|
||||
*/
|
||||
function get_label_name($label) {
|
||||
$name = html_to_text(format_string($label->intro, true));
|
||||
$context = context_module::instance($label->coursemodule);
|
||||
$intro = format_text($label->intro, $label->introformat, ['filter' => false, 'context' => $context]);
|
||||
$name = html_to_text(format_string($intro, true, ['context' => $context]));
|
||||
$name = preg_replace('/@@PLUGINFILE@@\/[[:^space:]]+/i', '', $name);
|
||||
// Remove double space and also nbsp; characters.
|
||||
$name = preg_replace('/\s+/u', ' ', $name);
|
||||
|
@ -289,7 +289,32 @@ class lib_test extends \advanced_testcase {
|
||||
'content' => '<audio controls="controls"><source src=""></audio>',
|
||||
'format' => FORMAT_HTML,
|
||||
'expected' => 'Text and media area'
|
||||
]
|
||||
],
|
||||
'markdown' => [
|
||||
'content' => "##Simple Title\n simple markdown format",
|
||||
'format' => FORMAT_MARKDOWN,
|
||||
'expected' => 'Simple Title simple markdown format'
|
||||
],
|
||||
'markdown with pluginfile' => [
|
||||
'content' => "##Simple Title\n simple markdown format @@PLUGINFILE@@/moodle-hit-song.mp3",
|
||||
'format' => FORMAT_MARKDOWN,
|
||||
'expected' => 'Simple Title simple markdown format'
|
||||
],
|
||||
'plain text' => [
|
||||
'content' => "Simple plain text @@PLUGINFILE@@/moodle-hit-song.mp3",
|
||||
'format' => FORMAT_PLAIN,
|
||||
'expected' => 'Simple plain text'
|
||||
],
|
||||
'moodle format text' => [
|
||||
'content' => "Simple plain text @@PLUGINFILE@@/moodle-hit-song.mp3",
|
||||
'format' => FORMAT_MOODLE,
|
||||
'expected' => 'Simple plain text'
|
||||
],
|
||||
'html format text' => [
|
||||
'content' => "<h1>Simple plain title</h1><p> with plain text</p> @@PLUGINFILE@@/moodle-hit-song.mp3",
|
||||
'format' => FORMAT_HTML,
|
||||
'expected' => 'Simple plain title with plain text'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user