Merge branch 'MDL-54629-master' of git://github.com/jleyva/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2016-07-12 21:01:02 +02:00
commit af8b948e2b
3 changed files with 8 additions and 3 deletions

View File

@ -2722,7 +2722,7 @@ class calendar_event {
if ($this->properties->eventtype != 'user' && $this->properties->eventtype != 'course'
&& $this->properties->eventtype != 'site' && $this->properties->eventtype != 'group') {
// We don't have a context here, do a normal format_text.
return array(format_text($this->properties->description, $this->properties->format), $this->properties->format);
return external_format_text($this->properties->description, $this->properties->format, $this->editorcontext->id);
}
}

View File

@ -916,14 +916,16 @@ function external_format_string($str, $contextid, $striplinks = true, $options =
* @param object/array $options text formatting options
* @return array text + textformat
* @since Moodle 2.3
* @since Moodle 3.2 component, filearea and itemid are optional parameters
*/
function external_format_text($text, $textformat, $contextid, $component, $filearea, $itemid, $options = null) {
function external_format_text($text, $textformat, $contextid, $component = null, $filearea = null, $itemid = null,
$options = null) {
global $CFG;
// Get settings (singleton).
$settings = external_settings::get_instance();
if ($settings->get_fileurl()) {
if ($component and $filearea and $settings->get_fileurl()) {
require_once($CFG->libdir . "/filelib.php");
$text = file_rewrite_pluginfile_urls($text, $settings->get_file(), $contextid, $component, $filearea, $itemid);
}

View File

@ -8,6 +8,9 @@ This information is intended for authors of webservices, not people writing webs
* webservice->get_external_functions now returns the external function list ordered by name ASC.
* The filearea optional parameter has been removed from webservice/upload.php.
Since Moodle 3.1 all the uploads go to the draft area.
* external_format_text() function: component, filearea and itemid are now optional parameters.
In some contexts those parameteres are not necessary because is not required to do a file rewrite via
file_rewrite_pluginfile_urls.
=== 3.1 ===