Location: PHPKode > projects > SkullPuppy > Project/library/SP/Registry.php
<?php

class SP_Registry {
	static private $_registry = array();

	static public function setKey($key, $value) {
		self::$_registry[$key] = $value;
		return true;
	}

	static public function getKey($key = null) {
		if(!$key) return self::$_registry;
		if(!array_key_exists($key, self::$_registry)) return false;
		return @self::$_registry[$key];
	}

	static public function yesno($val) {
		if(is_int($val)) {
			return($val ? 'yes' : 'no');
		}
		return $val;
	}

	static public function yesnoToBool($val) {
		if(!$val) $val = 'no';
		if(is_string($val)) {
			if(preg_match("/^[0-9]+[.]?[0-9]*$/", $val, $p)) $val = (int) $val;

			switch(strtolower($val)){
				case 'yes': return true; break;
				case 'y': return true; break;
				case 'no': return false; break;
				case 'n': return false; break;
			}
		}
		return $val;
	}
}

?>
Return current item: SkullPuppy