Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Static Public Member Functions | Public Attributes | List of all members
eZPreferences Class Reference

Handles user/session preferences. More...

## Static Public Member Functions
static | setValue ( $name, $value, $storeUserID=false)
static | value ( $name, $user=false)
static | values ( $user=false)
static | sessionCleanup ()
static | storeInSession ( $name, $value)
static | isStoredInSession ( $name)
static | storedSessionValue ( $name)
static | cleanup ()

## Public Attributes
const | SESSION_NAME = "eZPreferences"

## Detailed Description

Handles user/session preferences.

Preferences can be either pr user or pr session. eZPreferences will automatically set a session preference if the user is not logged in, if not a user preference will be set.

Definition at line 21 of file ezpreferences.php.

## Member Function Documentation

## ◆ cleanup()

static eZPreferences::cleanup | ( |  | ) |
| static

Removes all preferences for all users.

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 236 of file ezpreferences.php.

References eZDB\instance().

## ◆ isStoredInSession()

static eZPreferences::isStoredInSession | ( |  | $name | ) |
| static

Returns
  `true` if the preference named $name is stored in session.

Definition at line 206 of file ezpreferences.php.

References eZHTTPTool\instance(), and SESSION_NAME.

Referenced by value().

## ◆ sessionCleanup()

static eZPreferences::sessionCleanup | ( |  | ) |
| static

Makes sure the stored session values are cleaned up.

Definition at line 182 of file ezpreferences.php.

References eZHTTPTool\instance(), and SESSION_NAME.

Referenced by eZUser\cleanup().

## ◆ setValue()

static eZPreferences::setValue | ( |  | $name,
|  |  | $value,
|  |  | $storeUserID = `false`
| ) |  |
| static

Sets a preference value for a given user. If the user is anonymous the value is only stored in session.

Parameters

  $name | The name of the preference to store
  $value | The value of the preference to store
  $storeUserID | The user which should get the preference, if `false` it will use the current user

Returns
  `true` if the preference was stored correctly or `false` if something went wrong

Note
  Transaction unsafe. If you call several transaction unsafe methods you must enclose the calls within a db transaction; thus within db->begin and db->commit.

Definition at line 38 of file ezpreferences.php.

References eZUser\currentUser(), eZUser\currentUserID(), eZUser\fetch(), eZDB\instance(), storeInSession(), and eZDebug\writeError().

Referenced by eZContentClass\instantiate(), and eZSiteInstaller\updatePreferences().

## ◆ storedSessionValue()

static eZPreferences::storedSessionValue | ( |  | $name | ) |
| static

Returns
  the stored preferenced value found in the session or `null` if none were found.

Definition at line 219 of file ezpreferences.php.

References eZHTTPTool\instance(), and SESSION_NAME.

Referenced by value().

## ◆ storeInSession()

static eZPreferences::storeInSession | ( |  | $name,
|  |  | $value
| ) |  |
| static

Makes sure the preferences named $name is stored in the session with the value $value.

Definition at line 192 of file ezpreferences.php.

References eZHTTPTool\instance(), and SESSION_NAME.

Referenced by setValue(), value(), and values().

## ◆ value()

static eZPreferences::value | ( |  | $name,
|  |  | $user = `false`
| ) |  |
| static

Parameters

  $user | The user object to read preferences for, if `false` it will read using the current user.

Returns
  The preference value for the specified user. If no variable is found `false` is returned.

Note
  The preferences variable will be stored in session after fetching if the specified user is the current user.

Definition at line 106 of file ezpreferences.php.

References eZUser\currentUser(), eZDB\instance(), eZHTTPTool\instance(), isStoredInSession(), storedSessionValue(), and storeInSession().

Referenced by eZContentObject\checkAccess(), eZContentObjectTreeNode\checkAccess(), eZContentObject\classListFromPolicy(), eZContentObjectTreeNode\classListFromPolicy(), eZContentClass\instantiate(), and eZKernelOperator\modify().

## ◆ values()

static eZPreferences::values | ( |  | $user = `false` | ) |
| static

Parameters

  $user | The user object to read preferences for, if `false` it will read using the current user.

Returns
  An array with all the preferences for the specified user. If the user is not logged in the empty array will be returned.

Definition at line 147 of file ezpreferences.php.

References eZUser\currentUser(), eZDB\instance(), eZHTTPTool\instance(), SESSION_NAME, and storeInSession().

Referenced by eZNodeviewfunctions\generateViewCacheFile().

## Member Data Documentation

## ◆ SESSION_NAME

const eZPreferences::SESSION_NAME = "eZPreferences"

Definition at line 23 of file ezpreferences.php.

Referenced by isStoredInSession(), sessionCleanup(), storedSessionValue(), storeInSession(), and values().

The documentation for this class was generated from the following file:

- ezpreferences.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.