From 76cbeff33c9659cacbb57943056aabcb1517ca5c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 17 Jun 2009 02:35:51 -0700 Subject: Update background image settings to use bitflags --- classes/Design.php | 33 ++++++++++++++++++++++++++++++--- classes/laconica.ini | 2 +- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'classes') diff --git a/classes/Design.php b/classes/Design.php index 4ea176677..5b28bf014 100644 --- a/classes/Design.php +++ b/classes/Design.php @@ -21,6 +21,10 @@ if (!defined('LACONICA')) { exit(1); } +define('BACKGROUND_ON', 1); +define('BACKGROUND_OFF', 2); +define('BACKGROUND_TILE', 4); + /** * Table Definition for design */ @@ -41,7 +45,7 @@ class Design extends Memcached_DataObject public $textcolor; // int(4) public $linkcolor; // int(4) public $backgroundimage; // varchar(255) - public $tile; // tinyint(1) + public $disposition; // tinyint(1) default_1 /* Static get */ function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Design',$k,$v); } @@ -72,9 +76,11 @@ class Design extends Memcached_DataObject $css .= 'html body { color: #'. $tcolor->hexValue() . '} '. "\n"; $css .= 'a { color: #' . $lcolor->hexValue() . '} ' . "\n"; - if (!empty($this->backgroundimage)) { + if (!empty($this->backgroundimage) && + $this->disposition & BACKGROUND_ON) { - $repeat = ($this->tile) ? 'background-repeat:repeat;' : + $repeat = ($this->disposition & BACKGROUND_TILE) ? + 'background-repeat:repeat;' : 'background-repeat:no-repeat;'; $css .= 'body { background-image:url(' . @@ -125,4 +131,25 @@ class Design extends Memcached_DataObject return 'http://'.$server.$path.$filename; } + function setDisposition($on, $off, $tile) + { + if ($on) { + $this->disposition |= BACKGROUND_ON; + } else { + $this->disposition &= ~BACKGROUND_ON; + } + + if ($off) { + $this->disposition |= BACKGROUND_OFF; + } else { + $this->disposition &= ~BACKGROUND_OFF; + } + + if ($tile) { + $this->disposition |= BACKGROUND_TILE; + } else { + $this->disposition &= ~BACKGROUND_TILE; + } + } + } diff --git a/classes/laconica.ini b/classes/laconica.ini index 569681984..1a650aba5 100755 --- a/classes/laconica.ini +++ b/classes/laconica.ini @@ -46,7 +46,7 @@ sidebarcolor = 1 textcolor = 1 linkcolor = 1 backgroundimage = 2 -tile = 17 +disposition = 17 [design__keys] id = N -- cgit v1.2.3-54-g00ecf