/** * I/O is expensive. Therefore we make the whole class sessionwide singleton * to save some I/O. * * @return VisibilitySettings The sessionwide visibilitySettings */ public static function getInstance() { if (!$_SESSION['VisibilitySettings']) { self::$instance = new self(); $_SESSION['VisibilitySettings'] = serialize(new VisibilitySettings()); } else { /* * This part is really tricky. We serialize the class to be able to * save it in the session BUT it will definetly need all the * contained visibilitySetting. Maybe later we use runkit_method_add * but at the moment we will not use an experimental method */ $tmp = unserialize($_SESSION['VisibilitySettings']); foreach ($tmp->require_path as $path) { require_once $path; } } return unserialize($_SESSION['VisibilitySettings']); }
/** * Helpfunction to get all names for the settingstable * * @return array all visibility names */ public static function getVisibilities() { return VisibilitySettings::getInstance()->getAllNames(); }
/** * Returns all Arguments for the SettingsPage * @return array Arguments for the SettingsPage */ public function getHTMLArgs() { $privacy_states = VisibilitySettings::getInstance(); $result['header_colspan'] = $privacy_states->count() + 1; $result['row_colspan'] = $privacy_states->count(); $result['header_names'] = $privacy_states->getAllNames(); $result['states'] = $privacy_states->getAllKeys(); $result['entry'] = array(); foreach ($this->getProfileSettings() as $child) { $child->getHTMLArgs($result['entry']); } return $result; }