API Documentation

Form/Element/Hash.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Form
subpackage
Element
Classes
Zend_Form_Element_Hash

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Form_Element_Hash

Extends from
Zend_Form_Element_Xhtml
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Form
subpackage
Element
version
$Id: Hash.php 20096 2010-01-06 02:05:09Z bkarwin $
Properties
$helper
$_hash
$_salt
$_session
$_timeout
Methods
__construct
setSession
getSession
initCsrfValidator
setSalt
getSalt
getHash
getSessionName
setTimeout
getTimeout
getLabel
initCsrfToken
render
_generateHash

Description

CSRF form protection

Properties

$_hash

mixed $_hash = ''

Actual hash used.

Details

$_hash
mixed
visibility
protected
default
final
false
static
false

$_salt

string $_salt = 'salt'

Salt for CSRF token

Details

$_salt
string
visibility
protected
default
salt
final
false
static
false

$_session

Zend_Session_Namespace $_session = ''

Details

$_session
Zend_Session_Namespace
visibility
protected
default
final
false
static
false

$_timeout

int $_timeout = '300'

TTL for CSRF token

Details

$_timeout
int
visibility
protected
default
300
final
false
static
false

$helper

string $helper = 'formHidden'

Use formHidden view helper by default

Details

$helper
string
visibility
public
default
formHidden
final
false
static
false

Methods

__construct

__construct( string|array|Zend_Config $spec, array|Zend_Config $options = null ) : void

Constructor

Creates session namespace for CSRF token, and adds validator for CSRF token.

Arguments
$spec
stringarrayZend_Config
$options
arrayZend_Config
Details
visibility
public
final
false
static
false

_generateHash

_generateHash( ) : void

Generate CSRF token

Generates CSRF token and stores both in {@link $_hash} and element value.

Details
visibility
protected
final
false
static
false

getHash

getHash( ) : string

Retrieve CSRF token

If no CSRF token currently exists, generates one.

Output
string
Details
visibility
public
final
false
static
false

getLabel

getLabel( ) : null

Override getLabel() to always be empty

Output
null
Details
visibility
public
final
false
static
false

getSalt

getSalt( ) : string

Retrieve salt for CSRF token

Output
string
Details
visibility
public
final
false
static
false

getSession

getSession( ) : Zend_Session_Namespace

Get session object

Instantiate session object if none currently exists

Details
visibility
public
final
false
static
false

getSessionName

getSessionName( ) : string

Get session namespace for CSRF token

Generates a session namespace based on salt, element name, and class.

Output
string
Details
visibility
public
final
false
static
false

getTimeout

getTimeout( ) : int

Get CSRF session token timeout

Output
int
Details
visibility
public
final
false
static
false

initCsrfToken

initCsrfToken( ) : void

Initialize CSRF token in session

Details
visibility
public
final
false
static
false

initCsrfValidator

initCsrfValidator( ) : Zend_Form_Element_Hash

Initialize CSRF validator

Creates Session namespace, and initializes CSRF token in session. Additionally, adds validator for validating CSRF token.

Details
visibility
public
final
false
static
false

render

render( Zend_View_Interface $view = null ) : string

Render CSRF token in form

Arguments
$view
Zend_View_Interface
Output
string
Details
visibility
public
final
false
static
false

setSalt

setSalt( string $salt ) : Zend_Form_Element_Hash

Salt for CSRF token

Arguments
$salt
string
Details
visibility
public
final
false
static
false

setSession

setSession( Zend_Session_Namespace $session ) : Zend_Form_Element_Hash

Set session object

Arguments
$session
Zend_Session_Namespace
Details
visibility
public
final
false
static
false

setTimeout

setTimeout( int $ttl ) : Zend_Form_Element_Hash

Set timeout for CSRF session token

Arguments
$ttl
int
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.