aboutsummaryrefslogtreecommitdiffstats
path: root/view/theme/redbasic/php/style.php
blob: 6ea6faadcd7ff25e361dee92c64d02dd537aaa54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
// Get the UID of the channel owner
	$uid = get_theme_uid();

	if($uid)
	    load_pconfig($uid,'redbasic');

// Nav colours are mess.  Set $nav_colour as a single word for the sake of letting folk pick one
// but it actually consists of at least two colours to form a gradient - $nav_bg_1 and $nav_bg_2
// A further two - $nav_bg_3 and $nav_bg_4 are used to create the hover, if any particular scheme
// wants to implement that
	    $nav_colour = get_pconfig($uid, "redbasic", "nav_colour");	

// Load the owners pconfig
		$banner_colour = get_pconfig($uid,'redbasic','banner_colour');
		$schema = get_pconfig($uid,'redbasic','schema');
	    $bgcolour = get_pconfig($uid, "redbasic", "background_colour");	
	    $background_image = get_pconfig($uid, "redbasic", "background_image");	
	    $item_colour = get_pconfig($uid, "redbasic", "item_colour");	
	    $item_opacity = get_pconfig($uid, "redbasic", "item_opacity");	
	    $font_size = get_pconfig($uid, "redbasic", "font_size");	
	    $font_colour = get_pconfig($uid, "redbasic", "font_colour");	
	    $radius = get_pconfig($uid, "redbasic", "radius");	
	    $shadow = get_pconfig($uid,"redbasic","photo_shadow");
	    $section_width=get_pconfig($uid,"redbasic","section_width");
		$nav_min_opacity=get_pconfig($uid,'redbasic','nav_min_opacity');
		$sloppy_photos=get_pconfig($uid,'redbasic','sloppy_photos');

// Now load the scheme.  If a value is changed above, we'll keep the settings
// If not, we'll keep those defined by the schema
// Setting $scheme to '' wasn't working for some reason, so we'll check it's
// not --- like the mobile theme does instead.

		if (($schema) && ($schema != '---')) {
			$schemefile = 'view/theme/redbasic/schema/' . $schema . '.php';
			require_once ($schemefile);
		}
		// If we haven't got a schema, load the default.  We shouldn't touch this - we
		// should leave it for admins to define for themselves.
			if (! $schema) {
			      if(file_exists('view/theme/redbasic/schema/default.php')) {
				    $schemefile = 'view/theme/redbasic/schema/' . 'default.php';
				    require_once ($schemefile);
				    }
			}
		
		
//Set some defaults - we have to do this after pulling owner settings, and we have to check for each setting
//individually.  If we don't, we'll have problems if a user has set one, but not all options.

	if (! $nav_colour) {
		$nav_colour = "red";
			$nav_bg_1 = "#f88";
			$nav_bg_2 = "#b00";
			$nav_bg_3 = "#f00";
			$nav_bg_4 = "#b00";
		}
	if (! $banner_colour)
		$banner_colour = "fff";
	if (! $bgcolour)
		$bgcolour = "fff";
	if (! $background_image)
		$background_image ='';
	if (! $item_colour)
		$item_colour = "fff";
	if (! $item_opacity)
		$item_opacity = "1";
	if (! $font_size)
		$font_size = "12";
	if (! $font_colour)
		$font_colour = "000";
	if (! $radius)
		$radius = "5";
	if (! $shadow)
		$shadow = "0";
	if(! $active_colour)
		$active_colour = '#FFFFFF';
    if (! $section_width)
    	$section_width="72%";
	if($nav_min_opacity === false || $nav_min_opacity === '') {
		$nav_float_min_opacity = 1.0;
		$nav_percent_min_opacity = 100;
	}
	else {
		$nav_float_min_opacity = (float) $nav_min_opacity;
		$nav_percent_min_opacity = (int) 100 * $nav_min_opacity;
	}
			

// Nav colours have nested values, so we have to define the actual variables
// used in the CSS from the higher level "red", "black", etc here
		if ($nav_colour == "red") {
					$nav_bg_1 = "#f88";
					$nav_bg_2 = "#b00";
					$nav_bg_3 = "#f00";
					$nav_bg_4 = "#b00";
					$search_background = '#FFDDDD';
					$active_colour = '#444444';
		}

		if ($nav_colour == "black") {
				    $nav_bg_1 = $nav_bg_3 = "#000";
		      		    $nav_bg_2 = $nav_bg_4 = "#222";
					$search_background = '#EEEEEE';
					$active_colour = '#AAAAAA';
		}
		if ($nav_colour == "silver") {
				    $nav_bg_1 = $nav_bg_2 = $nav_bg_3 = $nav_bg_4 = "silver";
					$search_background = '#EEEEEE';
		}

		
// Apply the settings
	if(file_exists('view/theme/redbasic/css/style.css')) {
		$x = file_get_contents('view/theme/redbasic/css/style.css');

$options = array (
'$nav_bg_1' => $nav_bg_1,
'$nav_bg_2' => $nav_bg_2,
'$nav_bg_3' => $nav_bg_3,
'$nav_bg_4' => $nav_bg_4,
'$banner_colour' => $banner_colour,
'$search_background' => $search_background,
'$bgcolour' => $bgcolour,
'$background_image' => $background_image,
'$item_colour' => $item_colour,
'$item_opacity' => $item_opacity,
'$font_size' => $font_size,
'$font_colour' => $font_colour,
'$radius' => $radius,
'$shadow' => $shadow,
'$active_colour' => $active_colour,
'$section_width' => $section_width,
'$nav_float_min_opacity' => $nav_float_min_opacity,
'$nav_percent_min_opacity' => $nav_percent_min_opacity
);

echo str_replace(array_keys($options), array_values($options), $x);    

}

if($sloppy_photos && file_exists('view/theme/redbasic/css/sloppy_photos.css')) {
	echo file_get_contents('view/theme/redbasic/css/sloppy_photos.css');
}