]>
src.bluestatic.org Git - isso.git/blob - functions.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Globalized Functions
30 * Globalized Functions
32 * This framework is a set of functions that are commonly used in most
36 * @copyright Copyright ©2002 - [#]year[#], Blue Static
44 * Framework registry object
47 private $registry = null;
50 * The path that is used to set cookies
53 private $cookiepath = '/';
56 * The domain used for cookie setting
59 private $cookiedom = '';
62 * The time it takes for a cookie to expire
65 private $cookieexp = 900;
68 * State of the current background colour during alternation
71 public $bgcolour = '';
74 * Fields array that is used in this module
77 private $fields = array(
78 'cookiepath' => array(REQ_YES
, null, true),
79 'cookiedom' => array(REQ_YES
, null, true),
80 'cookieexp' => array(REQ_YES
, null, true)
83 // ###################################################################
87 public function __construct(&$registry)
89 $this->registry
=& $registry;
92 // ###################################################################
96 * @param string Field name
97 * @param mixed Value of the field
99 public function set($name, $value)
101 $this->registry
->do_set($name, $value, 'functions');
104 // ###################################################################
108 * @param string Field name
110 * @return mixed Value of the field
112 public function get($fieldname)
114 return $this->registry
->do_get($fieldname, 'functions');
117 // ###################################################################
119 * Sets a cookie with a friendly interface
121 * @param string The name of the cookie
122 * @param string Value of the cookie
123 * @param bool Is the cookie permanent?
125 public function cookie($name, $value = '', $sticky = true)
127 $this->registry
->check_isso_fields(get_class($this));
132 setcookie($name, $value, time() - (2 * $this->cookieexp
), $this->cookiepath
, $this->cookiedom
);
139 $expire = time() +
60 * 60 * 24 * 365;
143 $expire = time() +
$this->cookieexp
;
146 setcookie($name, $value, $expire, $this->cookiepath
, $this->cookiedom
);
150 // ###################################################################
152 * Alternate between two background colours
154 * @param string First CSS class name
155 * @param string Second CSS class name
157 public function exec_swap_bg($class1 = 'alt1', $class2 = 'alt2')
161 $this->bgcolour
= ($count %
2) ? $class1 : $class2;
166 /*=====================================================================*\
167 || ###################################################################
170 || ###################################################################
171 \*=====================================================================*/