function read($pref, $force_create = false, $create_path = null) { if (!isset($this->{$pref}) && count($this->__pref_paths) > 0) { $valid_path = false; for ($i = 0; $i < count($this->__pref_paths); $i++) { if (is_file($this->__pref_paths[$i] . '/' . $pref . '.prefs.php')) { $valid_path = $this->__pref_paths[$i]; break; } } if ($valid_path !== false) { include_once $valid_path . '/' . $pref . '.prefs.php'; $class = $pref . '_preferences'; if (class_exists($class)) { self::$__current_pref_file = $valid_path . '/' . $pref . '.prefs.php'; $this->{$pref} = new $class(); self::$__current_pref_file = null; if (is_object($this->{$pref})) { return true; } } } elseif ($force_create) { $object = new PreferenceContainer(); if ($create_path == null) { $create_path = $this->__pref_paths[0]; } if ($object->save($pref, $create_path)) { $this->read($pref); return true; } else { return false; } } } return false; }