Captcha/Figlet.php

Show: inherited
Table of Contents

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 [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Captcha  
Subpackage
Adapter  

\Zend_Captcha_Figlet

Package: Zend\Captcha\Adapter

Captcha based on figlet text rendering service

Note that this engine seems not to like numbers

Parent(s)
\Zend_Captcha_Word < \Zend_Captcha_Base < \Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Version
$Id: Figlet.php 24593 2012-01-05 20:35:02Z matthew $  

Constants

Constant  MISSING_VALUE = 'missingValue'
inheritedInherited from: \Zend_Captcha_Word::MISSING_VALUE
Constant  MISSING_ID = 'missingID'
inheritedInherited from: \Zend_Captcha_Word::MISSING_ID
Inherited_from
\Zend_Captcha_Word::MISSING_ID  
Constant  BAD_CAPTCHA = 'badCaptcha'
inheritedInherited from: \Zend_Captcha_Word::BAD_CAPTCHA

Properties

Propertypublic$C = array("b", "c", "d", "f", "g", "h", "j", "k", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "z")
staticinheritedInherited from: \Zend_Captcha_Word::$$C
Default valuearray("b", "c", "d", "f", "g", "h", "j", "k", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "z")Details
Type
n/a
Inherited_from
\Zend_Captcha_Word::$$C  
Propertypublic$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")
staticinheritedInherited from: \Zend_Captcha_Word::$$CN
Default valuearray("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")Details
Type
n/a
Inherited_from
\Zend_Captcha_Word::$$CN  
Propertypublic$V = array("a", "e", "i", "o", "u", "y")
staticinheritedInherited from: \Zend_Captcha_Word::$$V
Default valuearray("a", "e", "i", "o", "u", "y")Details
Type
n/a
Inherited_from
\Zend_Captcha_Word::$$V  
Propertypublic$VN = array("a", "e", "i", "o", "u", "y", "2", "3", "4", "5", "6", "7", "8", "9")
staticinheritedInherited from: \Zend_Captcha_Word::$$VN
Default valuearray("a", "e", "i", "o", "u", "y", "2", "3", "4", "5", "6", "7", "8", "9")Details
Type
n/a
Inherited_from
\Zend_Captcha_Word::$$VN  
Propertyprotected\Zend_Translate $_defaultTranslator =
staticinherited

Default translation object for all validate objects

Inherited from: \Zend_Validate_Abstract::$$_defaultTranslator\Zend_Captcha_Base::$$_defaultTranslator\Zend_Captcha_Word::$$_defaultTranslator
Propertyprotectedarray $_errors = array()
inherited

Array of validation failure message codes

Inherited from: \Zend_Validate_Abstract::$$_errors\Zend_Captcha_Base::$$_errors\Zend_Captcha_Word::$$_errors
Default valuearray()Details
Type
array
Inherited_from
\Zend_Validate_Abstract::$$_errors  
Inherited_from
\Zend_Captcha_Base::$$_errors  
Inherited_from
\Zend_Captcha_Word::$$_errors  
Propertyprotected\Zend_Text_Figlet $_figlet =

Figlet text renderer

Details
Type
\Zend_Text_Figlet
Propertyprotectedstring $_id =
inherited

Random session ID

Inherited from: \Zend_Captcha_Word::$$_id
Details
Type
string
Inherited_from
\Zend_Captcha_Word::$$_id  
Propertyprotectedboolean $_keepSession = false
inherited

Should generate() keep session or create a new one?

Inherited from: \Zend_Captcha_Word::$$_keepSession
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_Captcha_Word::$$_keepSession  
PropertyprotectedInteger $_messageLength = -1
staticinherited

Limits the maximum returned length of a error message

Inherited from: \Zend_Validate_Abstract::$$_messageLength\Zend_Captcha_Base::$$_messageLength\Zend_Captcha_Word::$$_messageLength
Default value-1Details
Type
Integer
Inherited_from
\Zend_Validate_Abstract::$$_messageLength  
Inherited_from
\Zend_Captcha_Base::$$_messageLength  
Inherited_from
\Zend_Captcha_Word::$$_messageLength  
Propertyprotectedarray $_messageTemplates = array(self::MISSING_VALUE => 'Empty captcha value', self::MISSING_ID => 'Captcha ID field is missing', self::BAD_CAPTCHA => 'Captcha value is wrong')
inherited

Error messages

Inherited from: \Zend_Captcha_Word::$$_messageTemplates
Default valuearray(self::MISSING_VALUE => 'Empty captcha value', self::MISSING_ID => 'Captcha ID field is missing', self::BAD_CAPTCHA => 'Captcha value is wrong')Details
Type
array
Inherited_from
\Zend_Captcha_Word::$$_messageTemplates  
Propertyprotectedarray $_messageVariables = array()
inherited

Additional variables available for validation failure messages

Inherited from: \Zend_Validate_Abstract::$$_messageVariables\Zend_Captcha_Base::$$_messageVariables\Zend_Captcha_Word::$$_messageVariables
Default valuearray()Details
Type
array
Inherited_from
\Zend_Validate_Abstract::$$_messageVariables  
Inherited_from
\Zend_Captcha_Base::$$_messageVariables  
Inherited_from
\Zend_Captcha_Word::$$_messageVariables  
Propertyprotectedarray $_messages = array()
Default valuearray()Details
Type
array
Inherited_from
\Zend_Validate_Abstract::$$_messages  
Inherited_from
\Zend_Captcha_Base::$$_messages  
Inherited_from
\Zend_Captcha_Word::$$_messages  
Propertyprotectedstring $_name =
inherited

Element name

Inherited from: \Zend_Captcha_Base::$$_name\Zend_Captcha_Word::$$_name

Useful to generate/check form fields

Details
Type
string
Inherited_from
\Zend_Captcha_Base::$$_name  
Inherited_from
\Zend_Captcha_Word::$$_name  
Propertyprotectedbool $_obscureValue = false
inherited

Flag indidcating whether or not value should be obfuscated in error messages

Inherited from: \Zend_Validate_Abstract::$$_obscureValue\Zend_Captcha_Base::$$_obscureValue\Zend_Captcha_Word::$$_obscureValue
Default valuefalseDetails
Type
bool
Inherited_from
\Zend_Validate_Abstract::$$_obscureValue  
Inherited_from
\Zend_Captcha_Base::$$_obscureValue  
Inherited_from
\Zend_Captcha_Word::$$_obscureValue  
Propertyprotectedarray $_options = array()
inherited

Captcha options

Inherited from: \Zend_Captcha_Base::$$_options\Zend_Captcha_Word::$$_options
Default valuearray()Details
Type
array
Inherited_from
\Zend_Captcha_Base::$$_options  
Inherited_from
\Zend_Captcha_Word::$$_options  
Propertyprotected\Zend_Session_Namespace $_session =
inherited

Session

Inherited from: \Zend_Captcha_Word::$$_session
Propertyprotectedstring $_sessionClass = 'Zend_Session_Namespace'
inherited

Class name for sessions

Inherited from: \Zend_Captcha_Word::$$_sessionClass
Default value'Zend_Session_Namespace'Details
Type
string
Inherited_from
\Zend_Captcha_Word::$$_sessionClass  
Propertyprotectedarray $_skipOptions = array('options', 'config')
inherited

Options to skip when processing options

Inherited from: \Zend_Captcha_Base::$$_skipOptions\Zend_Captcha_Word::$$_skipOptions
Default valuearray('options', 'config')Details
Type
array
Inherited_from
\Zend_Captcha_Base::$$_skipOptions  
Inherited_from
\Zend_Captcha_Word::$$_skipOptions  
Propertyprotectedinteger $_timeout = 300
inherited

Session lifetime for the captcha data

Inherited from: \Zend_Captcha_Word::$$_timeout
Default value300Details
Type
integer
Inherited_from
\Zend_Captcha_Word::$$_timeout  
PropertyprotectedBoolean $_translatorDisabled = false
Default valuefalseDetails
Type
Boolean
Inherited_from
\Zend_Validate_Abstract::$$_translatorDisabled  
Inherited_from
\Zend_Captcha_Base::$$_translatorDisabled  
Inherited_from
\Zend_Captcha_Word::$$_translatorDisabled  
Propertyprotectedboolean $_useNumbers = true
inherited

Should the numbers be used or only letters

Inherited from: \Zend_Captcha_Word::$$_useNumbers
Default valuetrueDetails
Type
boolean
Inherited_from
\Zend_Captcha_Word::$$_useNumbers  
Propertyprotectedmixed $_value =
Details
Type
mixed
Inherited_from
\Zend_Validate_Abstract::$$_value  
Inherited_from
\Zend_Captcha_Base::$$_value  
Inherited_from
\Zend_Captcha_Word::$$_value  
Propertyprotectedstring $_word =
inherited

Generated word

Inherited from: \Zend_Captcha_Word::$$_word
Details
Type
string
Inherited_from
\Zend_Captcha_Word::$$_word  
Propertyprotectedinteger $_wordlen = 8
inherited

Length of the word to generate

Inherited from: \Zend_Captcha_Word::$$_wordlen
Default value8Details
Type
integer
Inherited_from
\Zend_Captcha_Word::$$_wordlen  

Methods

methodpublic__construct(null | string | array | \Zend_Config $options = null) : void

Constructor

Parameters
Name Type Description
$options null | string | array | \Zend_Config
methodpublic__get(string $property) : mixed
inherited

Magic function returns the value of the requested property, if and only if it is the value or a message variable.

Inherited from: \Zend_Validate_Abstract::__get()\Zend_Captcha_Base::__get()\Zend_Captcha_Word::__get()
Parameters
Name Type Description
$property string
Returns
Type Description
mixed
Throws
Exception Description
\Zend_Validate_Exception
methodprotected_createMessage(string $messageKey, string $value) : string
inherited

Constructs and returns a validation failure message with the given message key and value.

Inherited from: \Zend_Validate_Abstract::_createMessage()\Zend_Captcha_Base::_createMessage()\Zend_Captcha_Word::_createMessage()

Returns null if and only if $messageKey does not correspond to an existing template.

If a translator is available and a translation exists for $messageKey, the translation will be used.

Parameters
Name Type Description
$messageKey string
$value string
Returns
Type Description
string
methodprotected_error(string $messageKey, string $value = null) : void
Parameters
Name Type Description
$messageKey string
$value string

OPTIONAL

methodprotected_generateRandomId() : void
inherited

Inherited from: \Zend_Captcha_Word::_generateRandomId()
methodprotected_generateWord() : string
inherited

Generate new random word

Inherited from: \Zend_Captcha_Word::_generateWord()
Returns
Type Description
string
methodprotected_setId(string $id) : void
inherited

Set captcha identifier

Inherited from: \Zend_Captcha_Word::_setId()
Parameters
Name Type Description
$id string

return Zend_Captcha_Word

methodprotected_setValue(mixed $value) : void
inherited

Sets the value to be validated and clears the messages and errors arrays

Inherited from: \Zend_Validate_Abstract::_setValue()\Zend_Captcha_Base::_setValue()\Zend_Captcha_Word::_setValue()
Parameters
Name Type Description
$value mixed
methodprotected_setWord(string $word) : \Zend_Captcha_Word
inherited

Set captcha word

Inherited from: \Zend_Captcha_Word::_setWord()
Parameters
Name Type Description
$word string
Returns
Type Description
\Zend_Captcha_Word
methodpublicgenerate() : string

Generate new captcha

Returns
Type Description
string
methodpublicgetDecorator() : string
inherited

Get captcha decorator

Inherited from: \Zend_Captcha_Word::getDecorator()

By default, return null, indicating no extra decorator needed.

Returns
Type Description
string
methodpublicgetDefaultTranslator() : \Zend_Translate_Adapter | null
staticinherited

Get default translation object for all validate objects

Inherited from: \Zend_Validate_Abstract::getDefaultTranslator()\Zend_Captcha_Base::getDefaultTranslator()\Zend_Captcha_Word::getDefaultTranslator()
Returns
Type Description
\Zend_Translate_Adapter | null
methodpublicgetErrors() : array
inherited

Returns array of validation failure message codes

Inherited from: \Zend_Validate_Abstract::getErrors()\Zend_Captcha_Base::getErrors()\Zend_Captcha_Word::getErrors()
Returns
Type Description
array
methodpublicgetId() : string
inherited

Retrieve captcha ID

Inherited from: \Zend_Captcha_Word::getId()
Returns
Type Description
string
methodpublicgetMessageLength() : integer
Returns
Type Description
integer
methodpublicgetMessageTemplates() : array
Returns
Type Description
array
methodpublicgetMessageVariables() : array
inherited

Returns an array of the names of variables that are used in constructing validation failure messages

Inherited from: \Zend_Validate_Abstract::getMessageVariables()\Zend_Captcha_Base::getMessageVariables()\Zend_Captcha_Word::getMessageVariables()
Returns
Type Description
array
methodpublicgetMessages() : array
inherited

Returns array of validation failure messages

Inherited from: \Zend_Validate_Abstract::getMessages()\Zend_Captcha_Base::getMessages()\Zend_Captcha_Word::getMessages()

The array keys are validation failure message identifiers, and the array values are the corresponding human-readable message strings.

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

Returns
Type Description
array
methodpublicgetName() : string
Returns
Type Description
string
methodpublicgetObscureValue() : bool
inherited

Retrieve flag indicating whether or not value should be obfuscated in messages

Inherited from: \Zend_Validate_Abstract::getObscureValue()\Zend_Captcha_Base::getObscureValue()\Zend_Captcha_Word::getObscureValue()
Returns
Type Description
bool
methodpublicgetOptions() : array
inherited

Retrieve options representing object state

Inherited from: \Zend_Captcha_Base::getOptions()\Zend_Captcha_Word::getOptions()
Returns
Type Description
array
methodpublicgetSession() : \Zend_Session_Namespace
inherited

Get session object

Inherited from: \Zend_Captcha_Word::getSession()
Returns
Type Description
\Zend_Session_Namespace
methodpublicgetSessionClass() : string
inherited

Retrieve session class to utilize

Inherited from: \Zend_Captcha_Word::getSessionClass()
Returns
Type Description
string
methodpublicgetTimeout() : int
inherited

Get session token timeout

Inherited from: \Zend_Captcha_Word::getTimeout()
Returns
Type Description
int
methodpublicgetTranslator() : \Zend_Translate_Adapter | null
Returns
Type Description
\Zend_Translate_Adapter | null
methodpublicgetUseNumbers() : bool
inherited

Numbers should be included in the pattern?

Inherited from: \Zend_Captcha_Word::getUseNumbers()
Returns
Type Description
bool
methodpublicgetWord() : string
inherited

Get captcha word

Inherited from: \Zend_Captcha_Word::getWord()
Returns
Type Description
string
methodpublicgetWordlen() : integer
inherited

Retrieve word length to use when genrating captcha

Inherited from: \Zend_Captcha_Word::getWordlen()
Returns
Type Description
integer
methodpublichasDefaultTranslator() : boolean
Returns
Type Description
boolean
methodpublichasTranslator() : bool
inherited

Does this validator have its own specific translator?

Inherited from: \Zend_Validate_Abstract::hasTranslator()\Zend_Captcha_Base::hasTranslator()\Zend_Captcha_Word::hasTranslator()
Returns
Type Description
bool
methodpublicisValid(mixed $value,  $context = null) : boolean
inherited

Validate the word

Inherited from: \Zend_Captcha_Word::isValid()

If $value fails validation, then this method returns false, and getMessages() will return an array of messages that explain why the validation failed.

Parameters
Name Type Description
$value mixed
$context
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Validate_Exception If validation of $value is impossible
Details
See
\global\Zend_Validate_Interface::isValid()  
methodpublicrender(\Zend_View_Interface $view = null, mixed $element = null) : string

Display the captcha

Parameters
Name Type Description
$view \Zend_View_Interface
$element mixed
Returns
Type Description
string
methodpublicsetConfig(\Zend_Config $config) : \Zend_Captcha_Base
inherited

Set object state from config object

Inherited from: \Zend_Captcha_Base::setConfig()\Zend_Captcha_Word::setConfig()
Parameters
Name Type Description
$config \Zend_Config
Returns
Type Description
\Zend_Captcha_Base
methodpublicsetDefaultTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : void
staticinherited

Set default translation object for all validate objects

Inherited from: \Zend_Validate_Abstract::setDefaultTranslator()\Zend_Captcha_Base::setDefaultTranslator()\Zend_Captcha_Word::setDefaultTranslator()
Parameters
Name Type Description
$translator \Zend_Translate | \Zend_Translate_Adapter | null
methodpublicsetDisableTranslator(bool $flag) : \Zend_Validate_Abstract
Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Validate_Abstract
methodpublicsetKeepSession(bool $keepSession) : \Zend_Captcha_Word
inherited

Sets if session should be preserved on generate()

Inherited from: \Zend_Captcha_Word::setKeepSession()
Parameters
Name Type Description
$keepSession bool

Should session be kept on generate()?

Returns
Type Description
\Zend_Captcha_Word
methodpublicsetMessage(string $messageString, string $messageKey = null) : \Zend_Validate_Abstract
inherited

Sets the validation failure message template for a particular key

Inherited from: \Zend_Validate_Abstract::setMessage()\Zend_Captcha_Base::setMessage()\Zend_Captcha_Word::setMessage()
Parameters
Name Type Description
$messageString string
$messageKey string

OPTIONAL

Returns
Type Description
\Zend_Validate_Abstract Provides a fluent interface
Throws
Exception Description
\Zend_Validate_Exception
methodpublicsetMessageLength(integer $length = -1) : void
Parameters
Name Type Description
$length integer
methodpublicsetMessages(array $messages) : \Zend_Validate_Abstract
inherited

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.

Inherited from: \Zend_Validate_Abstract::setMessages()\Zend_Captcha_Base::setMessages()\Zend_Captcha_Word::setMessages()
Parameters
Name Type Description
$messages array
Returns
Type Description
\Zend_Validate_Abstract
methodpublicsetName(string $name) : \Zend_Captcha_Adapter
Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Captcha_Adapter
methodpublicsetObscureValue(bool $flag) : \Zend_Validate_Abstract
inherited

Set flag indicating whether or not value should be obfuscated in messages

Inherited from: \Zend_Validate_Abstract::setObscureValue()\Zend_Captcha_Base::setObscureValue()\Zend_Captcha_Word::setObscureValue()
Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Validate_Abstract
methodpublicsetOption(string $key, string $value) : \Zend_Form_Element
inherited

Set single option for the object

Inherited from: \Zend_Captcha_Base::setOption()\Zend_Captcha_Word::setOption()
Parameters
Name Type Description
$key string
$value string
Returns
Type Description
\Zend_Form_Element
methodpublicsetOptions(array $options = null) : \Zend_Form_Element
inherited

Set object state from options array

Inherited from: \Zend_Captcha_Base::setOptions()\Zend_Captcha_Word::setOptions()
Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Form_Element
methodpublicsetSession(\Zend_Session_Namespace $session) : \Zend_Captcha_Word
inherited

Set session namespace object

Inherited from: \Zend_Captcha_Word::setSession()
Parameters
Name Type Description
$session \Zend_Session_Namespace
Returns
Type Description
\Zend_Captcha_Word
methodpublicsetSessionClass(string $_sessionClass) : \Zend_Captcha_Word
inherited

Set session class for persistence

Inherited from: \Zend_Captcha_Word::setSessionClass()
Parameters
Name Type Description
$_sessionClass string
Returns
Type Description
\Zend_Captcha_Word
methodpublicsetTimeout(int $ttl) : \Zend_Captcha_Word
inherited

Set timeout for session token

Inherited from: \Zend_Captcha_Word::setTimeout()
Parameters
Name Type Description
$ttl int
Returns
Type Description
\Zend_Captcha_Word
methodpublicsetTranslator(\Zend_Translate | \Zend_Translate_Adapter | null $translator = null) : \Zend_Validate_Abstract
Parameters
Name Type Description
$translator \Zend_Translate | \Zend_Translate_Adapter | null
Returns
Type Description
\Zend_Validate_Abstract
methodpublicsetUseNumbers(bool $_useNumbers) : \Zend_Captcha_Word
inherited

Set if numbers should be included in the pattern

Inherited from: \Zend_Captcha_Word::setUseNumbers()
Parameters
Name Type Description
$_useNumbers bool

numbers should be included in the pattern?

Returns
Type Description
\Zend_Captcha_Word
methodpublicsetWordlen(integer $wordlen) : \Zend_Captcha_Word
inherited

Set word length of captcha

Inherited from: \Zend_Captcha_Word::setWordlen()
Parameters
Name Type Description
$wordlen integer
Returns
Type Description
\Zend_Captcha_Word
methodpublictranslatorIsDisabled() : bool
Returns
Type Description
bool
Documentation was generated by phpDocumentor 2.0.0a8.