[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/session/src/ -> Session.php (summary)

Part of the Joomla Framework Session Package

Copyright: Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
License: GNU General Public License version 2 or later; see LICENSE
File Size: 799 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Session:: (34 methods):
  __construct()
  addValidator()
  getExpire()
  getState()
  getToken()
  hasToken()
  getIterator()
  getName()
  setName()
  getId()
  setId()
  isActive()
  isNew()
  isStarted()
  get()
  set()
  has()
  remove()
  clear()
  all()
  start()
  destroy()
  restart()
  fork()
  close()
  gc()
  abort()
  createToken()
  setCounter()
  setExpire()
  setState()
  setTimers()
  setOptions()
  validate()


Class: Session  - X-Ref

Class for managing HTTP sessions

Provides access to session-state values as well as session-level settings and lifetime management methods.
Based on the standard PHP session handling mechanism it provides more advanced features such as expire timeouts.

__construct(StorageInterface $store = null, DispatcherInterface $dispatcher = null, array $options = [])   X-Ref
Constructor

param: StorageInterface     $store       A StorageInterface implementation.
param: DispatcherInterface  $dispatcher  DispatcherInterface for the session to use.
param: array                $options     Optional parameters. Supported keys include:

addValidator(ValidatorInterface $validator)   X-Ref
Adds a validator to the session

param: ValidatorInterface  $validator  The session validator
return: void

getExpire()   X-Ref
Get expiration time in seconds

return: integer  The session expiration time in seconds

getState()   X-Ref
Get current state of session

return: string  The session state

getToken($forceNew = false)   X-Ref
Get a session token.

Tokens are used to secure forms from spamming attacks. Once a token has been generated the system will check the request to see if
it is present, if not it will invalidate the session.

param: boolean  $forceNew  If true, forces a new token to be created
return: string

hasToken($token, $forceExpire = true)   X-Ref
Check if the session has the given token.

param: string   $token        Hashed token to be verified
param: boolean  $forceExpire  If true, expires the session
return: boolean

getIterator()   X-Ref
Retrieve an external iterator.

return: \ArrayIterator  Return an ArrayIterator of $_SESSION.

getName()   X-Ref
Get session name

return: string  The session name

setName(string $name)   X-Ref
Set the session name

param: string  $name  The session name
return: $this

getId()   X-Ref
Get session id

return: string  The session id

setId(string $id)   X-Ref
Set the session ID

param: string  $id  The session ID
return: $this

isActive()   X-Ref
Check if the session is active

return: boolean

isNew()   X-Ref
Check whether this session is currently created

return: boolean

isStarted()   X-Ref
Check if the session is started

return: boolean

get($name, $default = null)   X-Ref
Get data from the session store

param: string  $name     Name of a variable
param: mixed   $default  Default value of a variable if not set
return: mixed  Value of a variable

set($name, $value = null)   X-Ref
Set data into the session store.

param: string  $name   Name of a variable.
param: mixed   $value  Value of a variable.
return: mixed  Old value of a variable.

has($name)   X-Ref
Check whether data exists in the session store

param: string  $name  Name of variable
return: boolean  True if the variable exists

remove(string $name)   X-Ref
Unset a variable from the session store

param: string  $name  Name of variable
return: mixed   The value from session or NULL if not set

clear()   X-Ref
Clears all variables from the session store

return: void

all()   X-Ref
Retrieves all variables from the session store

return: array

start()   X-Ref
Start a session.

return: void

destroy()   X-Ref
Frees all session variables and destroys all data registered to a session

This method resets the $_SESSION variable and destroys all of the data associated
with the current session in its storage (file or DB). It forces new session to be
started after this method is called.

return: boolean

restart()   X-Ref
Restart an expired or locked session.

return: boolean  True on success

fork($destroy = false)   X-Ref
Create a new session and copy variables from the old one

param: boolean  $destroy  Whether to delete the old session or leave it to garbage collection.
return: boolean  True on success

close()   X-Ref
Writes session data and ends session

Session data is usually stored after your script terminated without the need
to call {@link Session::close()}, but as session data is locked to prevent concurrent
writes only one script may operate on a session at any time. When using
framesets together with sessions you will experience the frames loading one
by one due to this locking. You can reduce the time needed to load all the
frames by ending the session as soon as all changes to session variables are
done.

return: void

gc()   X-Ref
Perform session data garbage collection

return: integer|boolean  Number of deleted sessions on success or boolean false on failure or if the function is unsupported

abort()   X-Ref
Aborts the current session

return: boolean

createToken()   X-Ref
Create a token string

return: string

setCounter()   X-Ref
Set counter of session usage

return: boolean  True on success

setExpire($expire)   X-Ref
Set the session expiration

param: integer  $expire  Maximum age of unused session in seconds
return: $this

setState($state)   X-Ref
Set the session state

param: string  $state  Internal state
return: $this

setTimers()   X-Ref
Set the session timers

return: boolean  True on success

setOptions(array $options)   X-Ref
Set additional session options

param: array  $options  List of parameter
return: boolean  True on success

validate($restart = false)   X-Ref
Do some checks for security reasons

If one check fails, session data has to be cleaned.

param: boolean  $restart  Reactivate session
return: boolean  True on success



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer