summaryrefslogtreecommitdiff
path: root/classes/Design.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Design.php')
-rw-r--r--classes/Design.php63
1 files changed, 56 insertions, 7 deletions
diff --git a/classes/Design.php b/classes/Design.php
index 8bb527761..f5c87b489 100644
--- a/classes/Design.php
+++ b/classes/Design.php
@@ -64,12 +64,61 @@ class Design extends Memcached_DataObject
__FILE__);
}
- $out->element('style', array('type' => 'text/css'),
- 'html, body { background-color: #' . $bgcolor->hexValue() . '} '."\n".
- '#content, #site_nav_local_views .current a { background-color: #' .
- $ccolor->hexValue() . '} '."\n".
- '#aside_primary { background-color: #'. $sbcolor->hexValue() .'} '."\n".
- 'html body { color: #'. $tcolor->hexValue() .'} '."\n".
- 'a { color: #' . $lcolor->hexValue() . '} '."\n");
+ $css = 'html, body { background-color: #' . $bgcolor->hexValue() . '} ' . "\n";
+ $css .= '#content, #site_nav_local_views .current a { background-color: #';
+ $css .= $ccolor->hexValue() . '} '."\n";
+ $css .= '#aside_primary { background-color: #'. $sbcolor->hexValue() . '} ' . "\n";
+ $css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n";
+ $css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n";
+
+ if (!empty($this->backgroundimage)) {
+
+ $css .= 'body { background-image:url(' .
+ Design::url($this->backgroundimage) .
+ '); background-repeat:no-repeat; }' . "\n";
+ }
+
+ $out->element('style', array('type' => 'text/css'), $css);
+
+ }
+
+ static function filename($id, $extension, $extra=null)
+ {
+ return $id . (($extra) ? ('-' . $extra) : '') . $extension;
+ }
+
+ static function path($filename)
+ {
+ $dir = common_config('background', 'dir');
+
+ if ($dir[strlen($dir)-1] != '/') {
+ $dir .= '/';
+ }
+
+ return $dir . $filename;
}
+
+ static function url($filename)
+ {
+ $path = common_config('background', 'path');
+
+ if ($path[strlen($path)-1] != '/') {
+ $path .= '/';
+ }
+
+ if ($path[0] != '/') {
+ $path = '/'.$path;
+ }
+
+ $server = common_config('background', 'server');
+
+ if (empty($server)) {
+ $server = common_config('site', 'server');
+ }
+
+ // XXX: protocol
+
+ return 'http://'.$server.$path.$filename;
+ }
+
}