Zend Framework  1.12
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Captcha_Word Class Reference

Public Member Functions

 getSessionClass ()
 Retrieve session class to utilize.
 
 setSessionClass ($_sessionClass)
 Set session class for persistence.
 
 getWordlen ()
 Retrieve word length to use when genrating captcha.
 
 setWordlen ($wordlen)
 Set word length of captcha.
 
 getId ()
 Retrieve captcha ID.
 
 setTimeout ($ttl)
 Set timeout for session token.
 
 getTimeout ()
 Get session token timeout.
 
 setKeepSession ($keepSession)
 Sets if session should be preserved on generate()
 
 getUseNumbers ()
 Numbers should be included in the pattern?
 
 setUseNumbers ($_useNumbers)
 Set if numbers should be included in the pattern.
 
 getSession ()
 Get session object.
 
 setSession (Zend_Session_Namespace $session)
 Set session namespace object.
 
 getWord ()
 Get captcha word.
 
 generate ()
 Generate new session ID and new word.
 
 isValid ($value, $context=null)
 Validate the word.
 
 getDecorator ()
 Get captcha decorator.
 
- Public Member Functions inherited from Zend_Captcha_Base
 getName ()
 Get name.
 
 setName ($name)
 Set name.
 
 __construct ($options=null)
 Constructor.
 
 setOption ($key, $value)
 Set single option for the object.
 
 setOptions ($options=null)
 Set object state from options array.
 
 getOptions ()
 Retrieve options representing object state.
 
 setConfig (Zend_Config $config)
 Set object state from config object.
 
 getDecorator ()
 Get optional decorator.
 
- Public Member Functions inherited from Zend_Validate_Abstract
 getMessages ()
 Returns array of validation failure messages.
 
 getMessageVariables ()
 Returns an array of the names of variables that are used in constructing validation failure messages.
 
 getMessageTemplates ()
 Returns the message templates from the validator.
 
 setMessage ($messageString, $messageKey=null)
 Sets the validation failure message template for a particular key.
 
 setMessages (array $messages)
 Sets validation failure message templates given as an array, where the array keys are the message keys, and the array values are the message template strings.
 
 __get ($property)
 Magic function returns the value of the requested property, if and only if it is the value or a message variable.
 
 getErrors ()
 Returns array of validation failure message codes.
 
 setObscureValue ($flag)
 Set flag indicating whether or not value should be obfuscated in messages.
 
 getObscureValue ()
 Retrieve flag indicating whether or not value should be obfuscated in messages.
 
 setTranslator ($translator=null)
 Set translation object.
 
 getTranslator ()
 Return translation object.
 
 hasTranslator ()
 Does this validator have its own specific translator?
 
 setDisableTranslator ($flag)
 Indicate whether or not translation should be disabled.
 
 translatorIsDisabled ()
 Is translation disabled?
 
- Public Member Functions inherited from Zend_Validate_Interface
 isValid ($value)
 Returns true if and only if $value meets the validation requirements.
 
- Public Member Functions inherited from Zend_Captcha_Adapter
 render (Zend_View_Interface $view=null, $element=null)
 Display the captcha.
 

Public Attributes

const MISSING_VALUE = 'missingValue'
 #@+ Error codes
 
const MISSING_ID = 'missingID'
 
const BAD_CAPTCHA = 'badCaptcha'
 

Static Public Attributes

static $V = array("a", "e", "i", "o", "u", "y")
 
static $VN = array("a", "e", "i", "o", "u", "y","2","3","4","5","6","7","8","9")
 
static $C = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z")
 
static $CN = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z","2","3","4","5","6","7","8","9")
 

Protected Member Functions

 _setId ($id)
 Set captcha identifier.
 
 _setWord ($word)
 Set captcha word.
 
 _generateWord ()
 Generate new random word.
 
 _generateRandomId ()
 

Protected Attributes

 $_id
 
 $_word
 
 $_session
 
 $_sessionClass = 'Zend_Session_Namespace'
 
 $_useNumbers = true
 
 $_timeout = 300
 
 $_keepSession = false
 
 $_messageTemplates
 
 $_wordlen = 8
 
- Protected Attributes inherited from Zend_Captcha_Base
 $_name
 
 $_options = array()
 
 $_skipOptions
 
- Protected Attributes inherited from Zend_Validate_Abstract
 $_value
 
 $_messageVariables = array()
 
 $_messageTemplates = array()
 
 $_messages = array()
 
 $_obscureValue = false
 
 $_errors = array()
 
 $_translator
 
 $_translatorDisabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Validate_Abstract
static setDefaultTranslator ($translator=null)
 Set default translation object for all validate objects.
 
static getDefaultTranslator ()
 Get default translation object for all validate objects.
 
static hasDefaultTranslator ()
 Is there a default translation object set?
 
static getMessageLength ()
 Returns the maximum allowed message length.
 
static setMessageLength ($length=-1)
 Sets the maximum allowed message length.
 
- Static Protected Attributes inherited from Zend_Validate_Abstract
static $_defaultTranslator
 
static $_messageLength = -1
 

Member Function Documentation

_generateRandomId ( )
protected
_generateWord ( )
protected

Generate new random word.

Returns
string
_setId (   $id)
protected

Set captcha identifier.

Parameters
string$idreturn Zend_Captcha_Word
_setWord (   $word)
protected

Set captcha word.

Parameters
string$word
Returns
Zend_Captcha_Word
generate ( )

Generate new session ID and new word.

Returns
string session ID

Implements Zend_Captcha_Adapter.

getDecorator ( )

Get captcha decorator.

Returns
string

Implements Zend_Captcha_Adapter.

getId ( )

Retrieve captcha ID.

Returns
string
getSession ( )

Get session object.

Returns
Zend_Session_Namespace
getSessionClass ( )

Retrieve session class to utilize.

Returns
string
getTimeout ( )

Get session token timeout.

Returns
int
getUseNumbers ( )

Numbers should be included in the pattern?

Returns
bool
getWord ( )

Get captcha word.

Returns
string
getWordlen ( )

Retrieve word length to use when genrating captcha.

Returns
integer
isValid (   $value,
  $context = null 
)

Validate the word.

See Also
Zend_Validate_Interface::isValid()
Parameters
mixed$value
Returns
boolean
setKeepSession (   $keepSession)

Sets if session should be preserved on generate()

Parameters
bool$keepSessionShould session be kept on generate()?
Returns
Zend_Captcha_Word
setSession ( Zend_Session_Namespace  $session)

Set session namespace object.

Parameters
Zend_Session_Namespace$session
Returns
Zend_Captcha_Word
setSessionClass (   $_sessionClass)

Set session class for persistence.

Parameters
string$_sessionClass
Returns
Zend_Captcha_Word
setTimeout (   $ttl)

Set timeout for session token.

Parameters
int$ttl
Returns
Zend_Captcha_Word
setUseNumbers (   $_useNumbers)

Set if numbers should be included in the pattern.

Parameters
bool$_useNumbersnumbers should be included in the pattern?
Returns
Zend_Captcha_Word
setWordlen (   $wordlen)

Set word length of captcha.

Parameters
integer$wordlen
Returns
Zend_Captcha_Word

Member Data Documentation

$_id
protected
$_keepSession = false
protected
$_messageTemplates
protected
Initial value:
= array(
self::MISSING_VALUE => 'Empty captcha value',
self::MISSING_ID => 'Captcha ID field is missing',
self::BAD_CAPTCHA => 'Captcha value is wrong',
)
$_session
protected
$_sessionClass = 'Zend_Session_Namespace'
protected
$_timeout = 300
protected
$_useNumbers = true
protected
$_word
protected
$_wordlen = 8
protected
$C = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z")
static
$CN = array("b","c","d","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","z","2","3","4","5","6","7","8","9")
static
$V = array("a", "e", "i", "o", "u", "y")
static
$VN = array("a", "e", "i", "o", "u", "y","2","3","4","5","6","7","8","9")
static
const BAD_CAPTCHA = 'badCaptcha'
const MISSING_ID = 'missingID'
const MISSING_VALUE = 'missingValue'

#@+ Error codes