API16

JSession/getStores

From Joomla! Documentation

< API16:JSession

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Get the session handlers



Syntax[edit]

getStores()


Returns[edit]

array An array of available session handlers

Defined in[edit]

libraries/joomla/session/session.php

Importing[edit]

jimport( 'joomla.session.session' );

Source Body[edit]

public function getStores()
{
        jimport('joomla.filesystem.folder');
        $handlers = JFolder::files(dirname(__FILE__).DS.'storage', '.php$');

        $names = array();
        foreach($handlers as $handler) {
                $name = substr($handler, 0, strrpos($handler, '.'));
                $class = 'JSessionStorage'.ucfirst($name);

                //Load the class only if needed
                if (!class_exists($class)) {
                        require_once dirname(__FILE__).DS.'storage'.DS.$name.'.php';
                }

                if (call_user_func_array(array(trim($class), 'test'), array())) {
                        $names[] = $name;
                }
        }

        return $names;
}



Examples[edit]

Code Examples[edit]