From: skodak Date: Mon, 18 May 2009 19:04:07 +0000 (+0000) Subject: MDL-14589 file api improvements - converting more params to general $options array X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1b7f3041f0a095704defe849424a079fa0b48640;p=moodle.git MDL-14589 file api improvements - converting more params to general $options array --- diff --git a/lib/filelib.php b/lib/filelib.php index 454932d842..c8c8700417 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -320,8 +320,9 @@ function file_get_unused_draft_itemid() { * @param integer $contextid This parameter and the next two identify the file area to copy files from. * @param string $filearea helps indentify the file area. * @param integer $itemid helps identify the file area. Can be null if there are no files yet. - * @param array $options text and file options ('subdirs'=>false, 'forcehttps'=>false) + * @param boolean $subdirs allow directory structure within the file area. * @param string $text some html content that needs to have embedded links rewritten to point to the draft area. + * @param boolean $forcehttps force https urls. * @return string if $text was passed in, the rewritten $text is returned. Otherwise NULL. */ function file_prepare_draft_area(&$draftitemid, $contextid, $filearea, $itemid, array $options=null, $text=null) { @@ -331,7 +332,7 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $filearea, $itemid, if (!isset($options['subdirs'])) { $options['subdirs'] = false; } - if (!isset($options['forcehttps'])) { + if (!isset($options['maxfiles'])) { $options['forcehttps'] = false; } @@ -369,17 +370,12 @@ function file_prepare_draft_area(&$draftitemid, $contextid, $filearea, $itemid, * @param integer $contextid This parameter and the next two identify the file area to use. * @param string $filearea helps indentify the file area. * @param integer $itemid helps identify the file area. - * @param array $options text and file options ('forcehttps'=>false) + * @param boot $forcehttps if we should output a https URL. * @return string the processed text. */ -function file_rewrite_pluginfile_urls($text, $file, $contextid, $filearea, $itemid, array $options=null) { +function file_rewrite_pluginfile_urls($text, $file, $contextid, $filearea, $itemid, $forcehttps=false) { global $CFG; - $options = (array)$options; - if (!isset($options['forcehttps'])) { - $options['forcehttps'] = false; - } - if (!$CFG->slasharguments) { $file = $file . '?file='; } @@ -390,7 +386,7 @@ function file_rewrite_pluginfile_urls($text, $file, $contextid, $filearea, $item $baseurl .= "$itemid/"; } - if ($options['forcehttps']) { + if ($forcehttps) { $baseurl = str_replace('http://', 'https://', $baseurl); }