themes lib MDL-24895 Multiple fixes to better handle overflow.
[moodle.git] / theme / sky_high / lib.php
CommitLineData
dc38e364
S
1<?php
2
3function sky_high_process_css($css, $theme) {
4
5 if (!empty($theme->settings->regionwidth)) {
6 $regionwidth = $theme->settings->regionwidth;
7 } else {
8 $regionwidth = null;
9 }
10 $css = sky_high_set_regionwidth($css, $regionwidth);
11
12 if (!empty($theme->settings->customcss)) {
13 $customcss = $theme->settings->customcss;
14 } else {
15 $customcss = null;
16 }
17 $css = sky_high_set_customcss($css, $customcss);
18
19 return $css;
20}
21
22/**
23 * Sets the region width variable in CSS
24 *
25 * @param string $css
26 * @param mixed $regionwidth
27 * @return string
28 */
29function 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;
37 }
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;
43}
44
45/**
46 * Sets the custom css variable in CSS
47 *
48 * @param string $css
49 * @param mixed $customcss
50 * @return string
51 */
52function sky_high_set_customcss($css, $customcss) {
53 $tag = '[[setting:customcss]]';
54 $replacement = $customcss;
55 if (is_null($replacement)) {
56 $replacement = '';
57 }
58 $css = str_replace($tag, $replacement, $css);
59 return $css;
60}
61
62?>