mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
92 lines
2.1 KiB
PHP
92 lines
2.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Makes our changes to the CSS
|
|
*
|
|
* @param string $css
|
|
* @param theme_config $theme
|
|
* @return string
|
|
*/
|
|
function arialist_process_css($css, $theme) {
|
|
|
|
// Set the link color
|
|
if (!empty($theme->settings->linkcolor)) {
|
|
$linkcolor = $theme->settings->linkcolor;
|
|
} else {
|
|
$linkcolor = null;
|
|
}
|
|
$css = arialist_set_linkcolor($css, $linkcolor);
|
|
|
|
// Set the region width
|
|
if (!empty($theme->settings->regionwidth)) {
|
|
$regionwidth = $theme->settings->regionwidth;
|
|
} else {
|
|
$regionwidth = null;
|
|
}
|
|
$css = arialist_set_regionwidth($css, $regionwidth);
|
|
|
|
// Set the custom CSS
|
|
if (!empty($theme->settings->customcss)) {
|
|
$customcss = $theme->settings->customcss;
|
|
} else {
|
|
$customcss = null;
|
|
}
|
|
$css = arialist_set_customcss($css, $customcss);
|
|
|
|
// Return the CSS
|
|
return $css;
|
|
}
|
|
|
|
/**
|
|
* Sets the background colour variable in CSS
|
|
*
|
|
* @param string $css
|
|
* @param mixed $backgroundcolor
|
|
* @return string
|
|
*/
|
|
function arialist_set_linkcolor($css, $linkcolor) {
|
|
$tag = '[[setting:linkcolor]]';
|
|
$replacement = $linkcolor;
|
|
if (is_null($replacement)) {
|
|
$replacement = '#f25f0f';
|
|
}
|
|
$css = str_replace($tag, $replacement, $css);
|
|
return $css;
|
|
}
|
|
|
|
/**
|
|
* Sets the region width variable in CSS
|
|
*
|
|
* @param string $css
|
|
* @param mixed $regionwidth
|
|
* @return string
|
|
*/
|
|
|
|
function arialist_set_regionwidth($css, $regionwidth) {
|
|
$tag = '[[setting:regionwidth]]';
|
|
$doubletag = '[[setting:regionwidthdouble]]';
|
|
$replacement = $regionwidth;
|
|
if (is_null($replacement)) {
|
|
$replacement = 250;
|
|
}
|
|
$css = str_replace($tag, $replacement.'px', $css);
|
|
$css = str_replace($doubletag, ($replacement*2).'px', $css);
|
|
return $css;
|
|
}
|
|
|
|
/**
|
|
* Sets the custom css variable in CSS
|
|
*
|
|
* @param string $css
|
|
* @param mixed $customcss
|
|
* @return string
|
|
*/
|
|
function arialist_set_customcss($css, $customcss) {
|
|
$tag = '[[setting:customcss]]';
|
|
$replacement = $customcss;
|
|
if (is_null($replacement)) {
|
|
$replacement = '';
|
|
}
|
|
$css = str_replace($tag, $replacement, $css);
|
|
return $css;
|
|
} |