MDL-27588 Fixed up several bugs with the formal_white theme
[moodle.git] / theme / arialist / lib.php
blob9ed5f6e6c000581e336a2fdbfdc69d5759f3bba3
1 <?php
3 /**
4 * Makes our changes to the CSS
6 * @param string $css
7 * @param theme_config $theme
8 * @return string
9 */
10 function arialist_process_css($css, $theme) {
12 // Set the link color
13 if (!empty($theme->settings->linkcolor)) {
14 $linkcolor = $theme->settings->linkcolor;
15 } else {
16 $linkcolor = null;
18 $css = arialist_set_linkcolor($css, $linkcolor);
20 // Set the region width
21 if (!empty($theme->settings->regionwidth)) {
22 $regionwidth = $theme->settings->regionwidth;
23 } else {
24 $regionwidth = null;
26 $css = arialist_set_regionwidth($css, $regionwidth);
28 // Set the custom CSS
29 if (!empty($theme->settings->customcss)) {
30 $customcss = $theme->settings->customcss;
31 } else {
32 $customcss = null;
34 $css = arialist_set_customcss($css, $customcss);
36 // Return the CSS
37 return $css;
40 /**
41 * Sets the background colour variable in CSS
43 * @param string $css
44 * @param mixed $backgroundcolor
45 * @return string
47 function arialist_set_linkcolor($css, $linkcolor) {
48 $tag = '[[setting:linkcolor]]';
49 $replacement = $linkcolor;
50 if (is_null($replacement)) {
51 $replacement = '#f25f0f';
53 $css = str_replace($tag, $replacement, $css);
54 return $css;
57 /**
58 * Sets the region width variable in CSS
60 * @param string $css
61 * @param mixed $regionwidth
62 * @return string
65 function arialist_set_regionwidth($css, $regionwidth) {
66 $tag = '[[setting:regionwidth]]';
67 $doubletag = '[[setting:regionwidthdouble]]';
68 $replacement = $regionwidth;
69 if (is_null($replacement)) {
70 $replacement = 250;
72 $css = str_replace($tag, $replacement.'px', $css);
73 $css = str_replace($doubletag, ($replacement*2).'px', $css);
74 return $css;
77 /**
78 * Sets the custom css variable in CSS
80 * @param string $css
81 * @param mixed $customcss
82 * @return string
84 function arialist_set_customcss($css, $customcss) {
85 $tag = '[[setting:customcss]]';
86 $replacement = $customcss;
87 if (is_null($replacement)) {
88 $replacement = '';
90 $css = str_replace($tag, $replacement, $css);
91 return $css;