Moodle release 2.2.7
[moodle.git] / theme / overlay / lib.php
blobdccb3795b82a760e16c2c9a2ca0f46c4711c1670
1 <?php
2 function overlay_set_linkcolor($css, $linkcolor) {
3 $tag = '[[setting:linkcolor]]';
4 $replacement = $linkcolor;
5 if (is_null($replacement)) {
6 $replacement = '#428ab5';
8 $css = str_replace($tag, $replacement, $css);
11 return $css;
14 function overlay_set_headercolor($css, $headercolor) {
15 $tag = '[[setting:headercolor]]';
16 $replacement = $headercolor;
17 if (is_null($replacement)) {
18 $replacement = '#2a4c7b';
20 $css = str_replace($tag, $replacement, $css);
23 return $css;
27 function overlay_set_customcss($css, $customcss) {
28 $tag = '[[setting:customcss]]';
29 $replacement = $customcss;
30 if (is_null($replacement)) {
31 $replacement = '';
33 $css = str_replace($tag, $replacement, $css);
34 return $css;
41 function overlay_process_css($css, $theme) {
43 if (!empty($theme->settings->linkcolor)) {
44 $linkcolor = $theme->settings->linkcolor;
45 } else {
46 $linkcolor = null;
48 $css = overlay_set_linkcolor($css, $linkcolor);
50 if (!empty($theme->settings->headercolor)) {
51 $headercolor = $theme->settings->headercolor;
52 } else {
53 $headercolor = null;
55 $css = overlay_set_headercolor($css, $headercolor);
57 if (!empty($theme->settings->customcss)) {
58 $customcss = $theme->settings->customcss;
59 } else {
60 $customcss = null;
62 $css = overlay_set_customcss($css, $customcss);
64 return $css;