mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
|
|
|
function splash_process_css($css, $theme) {
|
|
|
|
if (!empty($theme->settings->regionwidth)) {
|
|
$regionwidth = $theme->settings->regionwidth;
|
|
} else {
|
|
$regionwidth = null;
|
|
}
|
|
$css = splash_set_regionwidth($css, $regionwidth);
|
|
|
|
if (!empty($theme->settings->customcss)) {
|
|
$customcss = $theme->settings->customcss;
|
|
} else {
|
|
$customcss = null;
|
|
}
|
|
$css = splash_set_customcss($css, $customcss);
|
|
|
|
return $css;
|
|
}
|
|
|
|
/**
|
|
* Sets the region width variable in CSS
|
|
*
|
|
* @param string $css
|
|
* @param mixed $regionwidth
|
|
* @return string
|
|
*/
|
|
function splash_set_regionwidth($css, $regionwidth) {
|
|
$tag = '[[setting:regionwidth]]';
|
|
$doubletag = '[[setting:regionwidthdouble]]';
|
|
$leftmargintag = '[[setting:leftregionwidthmargin]]';
|
|
$rightmargintag = '[[setting:rightregionwidthmargin]]';
|
|
$replacement = $regionwidth;
|
|
if (is_null($replacement)) {
|
|
$replacement = 240;
|
|
}
|
|
$css = str_replace($tag, $replacement.'px', $css);
|
|
$css = str_replace($doubletag, ($replacement*2).'px', $css);
|
|
$css = str_replace($rightmargintag, ($replacement*3-5).'px', $css);
|
|
$css = str_replace($leftmargintag, ($replacement+5).'px', $css);
|
|
return $css;
|
|
}
|
|
|
|
/**
|
|
* Sets the custom css variable in CSS
|
|
*
|
|
* @param string $css
|
|
* @param mixed $customcss
|
|
* @return string
|
|
*/
|
|
function splash_set_customcss($css, $customcss) {
|
|
$tag = '[[setting:customcss]]';
|
|
$replacement = $customcss;
|
|
if (is_null($replacement)) {
|
|
$replacement = '';
|
|
}
|
|
$css = str_replace($tag, $replacement, $css);
|
|
return $css;
|
|
}
|
|
|
|
?>
|