Actions

API15

JSession/clear

From Joomla! Documentation

< API15:JSession
Revision as of 16:17, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Unset data from the session store

[Edit Descripton]

Description:JSession/clear

Syntax

clear($name, $namespace= 'default')
Parameter Name Default Value Description
$name $name Name of variable
$namespace 'default' $namespace Namespace to use, default to 'default'

Returns

mixed $value the value from session or NULL if not set

Defined in

libraries/joomla/session/session.php

Importing

jimport( 'joomla.session.session' );

Source Body

function clear( $name, $namespace = 'default' )
{
        $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions
 
        if( $this->_state !== 'active' ) {
                // @TODO :: generated error here
                return null;
        }
 
        $value  =       null;
        if( isset( $_SESSION[$namespace][$name] ) ) {
                $value  =       $_SESSION[$namespace][$name];
                unset( $_SESSION[$namespace][$name] );
        }
 
        return $value;
}

[Edit See Also] SeeAlso:JSession/clear

Examples

<CodeExamplesForm />