array(REQ_YES, null, true), 'cookiedom' => array(REQ_YES, null, true), 'cookieexp' => array(REQ_YES, null, true) ); // ################################################################### /** * Constructor */ public function __construct(&$registry) { $this->registry =& $registry; } // ################################################################### /** * Sets an ISSO field * * @param string Field name * @param mixed Value of the field */ public function set($name, $value) { $this->registry->do_set($name, $value, 'functions'); } // ################################################################### /** * Gets an ISSO field * * @param string Field name * * @return mixed Value of the field */ public function get($fieldname) { return $this->registry->do_get($fieldname, 'functions'); } // ################################################################### /** * Sets a cookie with a friendly interface * * @param string The name of the cookie * @param string Value of the cookie * @param bool Is the cookie permanent? */ public function cookie($name, $value = '', $sticky = true) { $this->registry->check_isso_fields(get_class($this)); // expire the cookie if (!$value) { setcookie($name, $value, time() - (2 * $this->cookieexp), $this->cookiepath, $this->cookiedom); } // set the cookie else { if ($sticky) { $expire = time() + 60 * 60 * 24 * 365; } else { $expire = time() + $this->cookieexp; } setcookie($name, $value, $expire, $this->cookiepath, $this->cookiedom); } } // ################################################################### /** * Alternate between two background colours * * @param string First CSS class name * @param string Second CSS class name */ public function exec_swap_bg($class1 = 'alt1', $class2 = 'alt2') { static $count; $this->bgcolour = ($count % 2) ? $class1 : $class2; $count++; } } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>