2 require_once('view/theme/frio/php/PHPColors/Color.php');
6 // Get the UID of the channel owner
7 $uid = get_theme_uid();
9 load_pconfig($uid,'frio');
11 // Load the owners pconfig
12 $schema = get_pconfig($uid, "frio", "schema");
13 $nav_bg = get_pconfig($uid, "frio", "nav_bg");
14 $nav_icon_color = get_pconfig($uid, "frio", "nav_icon_color");
15 $link_color = get_pconfig($uid, "frio", "link_color");
16 $bgcolor = get_pconfig($uid, "frio", "background_color");
17 $contentbg_transp = get_pconfig($uid, "frio", "contentbg_transp");
18 $background_image = get_pconfig($uid, "frio", "background_image");
19 $bg_image_option = get_pconfig($uid, "frio", "bg_image_option");
22 // Now load the scheme. If a value is changed above, we'll keep the settings
23 // If not, we'll keep those defined by the schema
24 // Setting $schema to '' wasn't working for some reason, so we'll check it's
25 // not --- like the mobile theme does instead.
26 // Allow layouts to over-ride the schema
27 if($_REQUEST['schema']) {
28 $schema = $_REQUEST['schema'];
30 if (($schema) && ($schema != '---')) {
31 // Check it exists, because this setting gets distributed to clones
32 if(file_exists('view/theme/frio/schema/' . $schema . '.php')) {
33 $schemefile = 'view/theme/frio/schema/' . $schema . '.php';
34 require_once ($schemefile);
36 if(file_exists('view/theme/frio/schema/' . $schema . '.css')) {
37 $schemecss = file_get_contents('view/theme/frio/schema/' . $schema . '.css');
41 // If we haven't got a schema, load the default. We shouldn't touch this - we
42 // should leave it for admins to define for themselves.
43 // default.php and default.css MUST be symlinks to existing schema files.
45 if(file_exists('view/theme/frio/schema/default.php')) {
46 $schemefile = 'view/theme/frio/schema/default.php';
47 require_once ($schemefile);
49 if(file_exists('view/theme/frio/schema/default.css')) {
50 $schemecss = file_get_contents('view/theme/frio/schema/default.css');
54 //Set some defaults - we have to do this after pulling owner settings, and we have to check for each setting
55 //individually. If we don't, we'll have problems if a user has set one, but not all options.
59 $nav_icon_color = "#fff";
61 $link_color = "#6fdbe8";
64 if(! $contentbg_transp)
65 $contentbg_transp = 100;
66 if(! $background_image)
67 $background_image ='';
69 // Calculate some colors in dependance of existing colors
70 // Some colors are calculated to don't have too many selection
71 // fields in the theme settings
72 if(! $menu_background_hover_color) {
73 $mbhc = new Color($nav_bg);
74 $mcolor = $mbhc->getHex();
76 if($mbhc->isLight($mcolor, 75)) {
78 $menu_background_hover_color = '#' . $mbhc->darken(5);
81 $menu_background_hover_color = '#' . $mbhc->lighten(5);
82 //$menu_background_hover_color = "#628394";
85 if(! $nav_icon_hover_color) {
86 $nihc = new Color($nav_bg);
89 $nav_icon_hover_color = '#' . $nihc->darken(10);
91 $nav_icon_hover_color = '#' . $nihc->lighten(10);
93 if(! $link_hover_color) {
94 $lhc = new Color($link_color);
95 $lcolor = $lhc->getHex();
97 if($lhc->isLight($lcolor, 75)) {
98 $link_hover_color = '#' . $lhc->darken(5);
100 $link_hover_color = '#' . $lhc->lighten(5);
105 // Convert $bg_image_options into css
106 switch ($bg_image_option) {
108 $background_size_img = "100%";
111 $background_size_img ="cover";
114 $background_size_img = "auto";
117 $background_size_img = "contain";
121 $background_size_img = "auto";
125 // Convert transparency level from percentage to opacity value
126 $contentbg_transp = $contentbg_transp / 100;
129 // Apply the settings
130 if(file_exists('view/theme/frio/css/style.css')) {
131 $x = file_get_contents('view/theme/frio/css/style.css');
134 '$nav_bg' => $nav_bg,
135 '$nav_icon_color' => $nav_icon_color,
136 '$nav_icon_hover_color' => $nav_icon_hover_color,
137 '$link_color' => $link_color,
138 '$link_hover_color' => $link_hover_color,
139 '$menu_background_hover_color' => $menu_background_hover_color,
140 '$btn_primary_color' => $nav_icon_color,
141 '$btn_primary_hover_color' => $menu_background_hover_color,
142 '$bgcolor' => $bgcolor,
143 '$contentbg_transp' => $contentbg_transp,
144 '$background_image' => $background_image,
145 '$background_size_img' => $background_size_img,
148 echo str_replace(array_keys($options), array_values($options), $x);