mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-25619 portfolio: exported HTML output can not be cleaned
This commit is contained in:
parent
f085c3eccb
commit
7e514cd768
@ -1171,6 +1171,24 @@ function portfolio_existing_exports_by_plugin($userid) {
|
||||
return $DB->get_records_sql_menu($sql, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return default common options for {@link format_text()} when preparing a content to be exported
|
||||
*
|
||||
* It is important not to apply filters and not to clean the HTML in format_text()
|
||||
*
|
||||
* @return stdClass
|
||||
*/
|
||||
function portfolio_format_text_options() {
|
||||
|
||||
$options = new stdClass();
|
||||
$options->para = false;
|
||||
$options->newlines = true;
|
||||
$options->filter = false;
|
||||
$options->noclean = true;
|
||||
$options->overflowdiv = false;
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* callback function from {@link portfolio_rewrite_pluginfile_urls}
|
||||
|
@ -295,9 +295,7 @@ class assignment_online extends assignment_base {
|
||||
|
||||
function portfolio_prepare_package($exporter, $user) {
|
||||
$submission = $this->get_submission($user->id);
|
||||
$options = new stdClass();
|
||||
$options->para = false;
|
||||
$options->filter = false;
|
||||
$options = portfolio_format_text_options();
|
||||
$html = format_text($submission->data1, $submission->data2, $options);
|
||||
$html = portfolio_rewrite_pluginfile_urls($html, $this->context->id, 'mod_assignment', $this->filearea, $submission->id, $exporter->get('format'));
|
||||
if (in_array($exporter->get('formatclass'), array(PORTFOLIO_FORMAT_PLAINHTML, PORTFOLIO_FORMAT_RICHHTML))) {
|
||||
|
@ -293,9 +293,7 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
|
||||
$post->author = $users[$post->userid];
|
||||
$viewfullnames = true;
|
||||
// format the post body
|
||||
$options = new stdClass();
|
||||
$options->para = false;
|
||||
$options->filter = false;
|
||||
$options = portfolio_format_text_options();
|
||||
$format = $this->get('exporter')->get('format');
|
||||
$formattedtext = format_text($post->message, $post->messageformat, $options, $this->get('course')->id);
|
||||
$formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->modcontext->id, 'mod_forum', 'post', $post->id, $format);
|
||||
|
@ -375,10 +375,8 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
|
||||
global $OUTPUT, $DB;
|
||||
$entry = clone $entry;
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$options = new stdClass();
|
||||
$options->para = false;
|
||||
$options = portfolio_format_text_options();
|
||||
$options->trusted = $entry->definitiontrust;
|
||||
$options->filter = false;
|
||||
$options->context = $context;
|
||||
|
||||
$output = '<table class="glossarypost dictionary" cellspacing="0">' . "\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user