Text_CAPTCHA
[ class tree: Text_CAPTCHA ] [ index: Text_CAPTCHA ] [ all elements ]

Class: Text_CAPTCHA_Driver_Equation

Source Location: /Text_CAPTCHA-0.3.1/CAPTCHA/Driver/Equation.php

Class Overview

Text_CAPTCHA
   |
   --Text_CAPTCHA_Driver_Equation

Text_CAPTCHA - creates a CAPTCHA for Turing tests


Variables

Methods


Inherited Variables

Inherited Methods

Class: Text_CAPTCHA

Text_CAPTCHA::factory()
Create a new Text_CAPTCHA object
Text_CAPTCHA::getPhrase()
Return secret CAPTCHA phrase
Text_CAPTCHA::setPhrase()
Sets secret CAPTCHA phrase

Class Details

[line 11]
Text_CAPTCHA - creates a CAPTCHA for Turing tests

Class to create a Turing test for websites by creating an image, ASCII art or something else with some (obfuscated) characters



[ Top ]


Class Variables

$_equation =  null

[line 36]

The equation to solve.
  • Access: protected

Type:   string


[ Top ]

$_error =  null

[line 78]

Last error
  • Access: protected

Type:   PEAR_Error


[ Top ]

$_max =  10

[line 52]

Maximum number to use in an equation.
  • Access: protected

Type:   int


[ Top ]

$_min =  1

[line 44]

Minimal number to use in an equation.
  • Access: protected

Type:   int


[ Top ]

$_numbersToText =  false

[line 60]

Whether numbers shall be converted to text
  • Access: protected

Type:   bool


[ Top ]

$_operators = array(
        '%s * %s',
        '%s + %s',
        '%s - %s',
        'min(%s, %s)',
        'max(%s, %s)'
    )

[line 22]

Operators that may be used in the equation.

Two numbers have to be filled in, and %s is needed since number2text conversion may be applied and strings filled in.

  • Access: protected

Type:   array


[ Top ]

$_severity =  1

[line 70]

Complexity of the generated equations.

  1. - simple ones such as "1 + 10"
  2. - harder ones such as "(3-2)*(min(5,6))"

  • Access: protected

Type:   int


[ Top ]



Method Detail

getCAPTCHA   [line 219]

string getCAPTCHA( )

Returns the CAPTCHA (as a string)
  • Access: public

[ Top ]

getPhrase   [line 197]

string getPhrase( )

Return the solution to the equation.

This method returns the CAPTCHA phrase, which is the solution to the equation.

  • Return: secret phrase
  • Access: public

Overrides Text_CAPTCHA::getPhrase() (Return secret CAPTCHA phrase)
[ Top ]

init   [line 87]

true init( [ $options = array()])

Initialize the driver.
  • Return: on success, PEAR_Error on error.
  • Access: public

Parameters:

   $options   — 

[ Top ]

_createCAPTCHA   [line 209]

PEAR_Error _createCAPTCHA( )

Creates the captcha. This method is a placeholder, since the equation is created in _createPhrase()
  • Access: protected

[ Top ]

_createPhrase   [line 129]

mixed _createPhrase( )

Create random CAPTCHA equation.

This method creates a random equation. The equation is stored in $this->_equation, the solution in $this->_phrase.

  • Return: true on success, PEAR_Error on error
  • Access: protected

[ Top ]

_createSimpleEquation   [line 157]

array _createSimpleEquation( )

Creates a simple equation of type (number operator number)
  • Return: Array with equation and solution
  • Access: protected

[ Top ]

_solveSimpleEquation   [line 175]

array _solveSimpleEquation( $one, $two, $operator)

Solves a simple equation with two given numbers and one operator as defined in $this->_operators.

Also converts the numbers to words if required.

  • Return: Array with equation and solution
  • Access: protected

Parameters:

   $one   — 
   $two   — 
   $operator   — 

[ Top ]


Documentation generated on Thu, 10 Dec 2015 05:46:55 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.