TYPO3  7.6
Static Public Member Functions | Static Protected Member Functions | Static Protected Attributes | Private Member Functions | List of all members
FormProtectionFactory Class Reference

Static Public Member Functions

static get ($className= 'default')
 
static set ($className, AbstractFormProtection $instance)
 
static purgeInstances ()
 

Static Protected Member Functions

static getClassNameAndConstructorArgumentsByState ()
 
static isInstallToolSession ()
 
static isBackendSession ()
 
static isFrontendSession ()
 
static createInstance (array $classNameAndConstructorArguments)
 

Static Protected Attributes

static $instances = array()
 

Private Member Functions

 __construct ()
 

Detailed Description

This class creates and manages instances of the various form protection classes.

This class provides only static methods. It can not be instantiated.

Usage for the back-end form protection:

$formProtection = ::get();

Usage for the install tool form protection:

$formProtection = ::get();

Definition at line 41 of file FormProtectionFactory.php.

Constructor & Destructor Documentation

__construct ( )
private

Private constructor to prevent instantiation.

Definition at line 53 of file FormProtectionFactory.php.

Member Function Documentation

static createInstance ( array  $classNameAndConstructorArguments)
staticprotected

Creates an instance for the requested class $className and stores it internally.

Parameters
array$classNameAndConstructorArguments
Exceptions
\InvalidArgumentException
Returns
AbstractFormProtection

Definition at line 181 of file FormProtectionFactory.php.

static get (   $className = 'default')
static

Gets a form protection instance for the requested class $className.

If there already is an existing instance of the requested $className, the existing instance will be returned. If no $className is provided, the factory detects the scope and returns the appropriate form protection object.

Parameters
string$className
Returns
the requested instance

Definition at line 67 of file FormProtectionFactory.php.

Referenced by SetupModuleController\__construct(), UriBuilder\buildUriFromAjaxId(), UriBuilder\buildUriFromModule(), UriBuilder\buildUriFromRoute(), LoginController\checkRedirect(), RouteDispatcher\getFormProtection(), AjaxRequestHandler\getFormProtection(), and BackendModuleRequestHandler\getFormProtection().

static getClassNameAndConstructorArgumentsByState ( )
staticprotected

Returns the class name depending on TYPO3_MODE and active backend session.

Returns
array

Definition at line 87 of file FormProtectionFactory.php.

References $GLOBALS, and GeneralUtility\makeInstance().

static isBackendSession ( )
staticprotected

Checks if a user is logged in and the session is active.

Returns
bool

Definition at line 136 of file FormProtectionFactory.php.

References $GLOBALS.

static isFrontendSession ( )
staticprotected

Checks if a frontend user is logged in and the session is active.

Returns
bool

Definition at line 146 of file FormProtectionFactory.php.

References $GLOBALS.

static isInstallToolSession ( )
staticprotected

Check if we are in the install tool

Returns
bool

Definition at line 126 of file FormProtectionFactory.php.

static purgeInstances ( )
static

Purges all existing instances.

This function is particularly useful when cleaning up in unit testing.

Returns
void

Definition at line 217 of file FormProtectionFactory.php.

static set (   $className,
AbstractFormProtection  $instance 
)
static

Sets the instance that will be returned by get() for a specific class name.

Note: This function is intended for testing purposes only.

private

Parameters
string$className
AbstractFormProtection$instance
Returns
void

Definition at line 205 of file FormProtectionFactory.php.

Member Data Documentation

$instances = array()
staticprotected

Definition at line 48 of file FormProtectionFactory.php.