weekly release 2.6.2+
[moodle.git] / theme / sky_high / lib.php
blob2685878b966c79e2262bbb54f6b7b2064097e396
1 <?php
3 function sky_high_process_css($css, $theme) {
5 if (!empty($theme->settings->regionwidth)) {
6 $regionwidth = $theme->settings->regionwidth;
7 } else {
8 $regionwidth = null;
10 $css = sky_high_set_regionwidth($css, $regionwidth);
12 if (!empty($theme->settings->customcss)) {
13 $customcss = $theme->settings->customcss;
14 } else {
15 $customcss = null;
17 $css = sky_high_set_customcss($css, $customcss);
19 return $css;
22 /**
23 * Sets the region width variable in CSS
25 * @param string $css
26 * @param mixed $regionwidth
27 * @return string
29 function sky_high_set_regionwidth($css, $regionwidth) {
30 $tag = '[[setting:regionwidth]]';
31 $doubletag = '[[setting:regionwidthdouble]]';
32 $leftmargintag = '[[setting:leftregionwidthmargin]]';
33 $rightmargintag = '[[setting:rightregionwidthmargin]]';
34 $replacement = $regionwidth;
35 if (is_null($replacement)) {
36 $replacement = 240;
38 $css = str_replace($tag, $replacement.'px', $css);
39 $css = str_replace($doubletag, ($replacement*2).'px', $css);
40 $css = str_replace($rightmargintag, ($replacement*3-5).'px', $css);
41 $css = str_replace($leftmargintag, ($replacement+5).'px', $css);
42 return $css;
45 /**
46 * Sets the custom css variable in CSS
48 * @param string $css
49 * @param mixed $customcss
50 * @return string
52 function sky_high_set_customcss($css, $customcss) {
53 $tag = '[[setting:customcss]]';
54 $replacement = $customcss;
55 if (is_null($replacement)) {
56 $replacement = '';
58 $css = str_replace($tag, $replacement, $css);
59 return $css;