Permalink
Browse files

MDL-39629 theme_formal_white: added support for new admin_setting_con…

…figstoredfile setting element
  • Loading branch information...
1 parent 95190fd commit 8fbe204b86ca9d7d21229335c59adc5d243b4d73 @kordan kordan committed May 13, 2013
@@ -30,15 +30,12 @@
/************************************************************************************************/
if (!empty($PAGE->theme->settings->frontpagelogourl)) {
- $logourl = $PAGE->theme->settings->frontpagelogourl;
+ $logourl = $PAGE->theme->setting_file_url('frontpagelogourl', 'frontpagelogourl');
} else if (!empty($PAGE->theme->settings->customlogourl)) {
- $logourl = $PAGE->theme->settings->customlogourl;
+ $logourl = $PAGE->theme->setting_file_url('customlogourl', 'customlogourl');
} else {
$logourl = $OUTPUT->pix_url('logo', 'theme');
}
-if (strtolower(substr($logourl, 0, 4)) != 'http') {
- $logourl = $CFG->wwwroot.'/'.$logourl;
-}
$hasframe = !isset($PAGE->theme->settings->noframe) || !$PAGE->theme->settings->noframe;
@@ -40,10 +40,7 @@
/************************************************************************************************/
if (!empty($PAGE->theme->settings->customlogourl)) {
- $logourl = $PAGE->theme->settings->customlogourl;
- if (strtolower(substr($logourl, 0, 4)) != 'http') {
- $logourl = $CFG->wwwroot.'/'.$logourl;
- }
+ $logourl = $PAGE->theme->setting_file_url('customlogourl', 'customlogourl');
} else {
$logourl = $OUTPUT->pix_url('logo_small', 'theme');
}
@@ -35,10 +35,7 @@
/************************************************************************************************/
if (!empty($PAGE->theme->settings->customlogourl)) {
- $logourl = $PAGE->theme->settings->customlogourl;
- if (strtolower(substr($logourl, 0, 4)) != 'http') {
- $logourl = $CFG->wwwroot.'/'.$logourl;
- }
+ $logourl = $PAGE->theme->setting_file_url('customlogourl', 'customlogourl');
} else {
$logourl = $OUTPUT->pix_url('logo_small', 'theme');
}
@@ -50,17 +50,15 @@
$name = 'theme_formal_white/customlogourl';
$title = get_string('customlogourl','theme_formal_white');
$description = get_string('customlogourldesc', 'theme_formal_white');
- $default = '';
- $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_RAW); // we want it accepting ../ at the beginning. Security is not at its top but Moodle trusts admins.
+ $setting = new admin_setting_configstoredfile($name, $title, $description, 'customlogourl');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);
// Custom front page site logo setting
$name = 'theme_formal_white/frontpagelogourl';
$title = get_string('frontpagelogourl','theme_formal_white');
$description = get_string('frontpagelogourldesc', 'theme_formal_white');
- $default = '';
- $setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_RAW); // we want it accepting ../ at the beginning. Security is not at its top but Moodle trusts admins.
+ $setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpagelogourl');
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->add($setting);

0 comments on commit 8fbe204

Please sign in to comment.