Jeff PHP framework  0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
captcha Class Reference

Class used to generate captcha images. More...

Public Member Functions

 __construct ($name, $opts=null)
 Constructs a captcha instance.
 check ()
 Cheks if the user inputs the right captcha code.
 render ($opts=null)
 Renders the captcha image and input.

Private Member Functions

 generateStrings ()
 Generates a random alphanumeric string.
 hex2RGB ($hexStr)
 Converts a hex color string in a rgb array.

Private Attributes

 $_allow_numbers
 whether to allow number in captcha or not
 $_font_file
 absolute path of the font ttf file
 $_height
 captcha image height
 $_letters
 letters allowed for the captcha
 $_name
 name of the captcha field
 $_numbers
 numbers allowed for the captcha
 $_width
 captcha image width

Detailed Description

Class used to generate captcha images.

Author:
abidibo abidi.nosp@m.bo@g.nosp@m.mail..nosp@m.com
Version:
0.99
Date:
2011-2012

Definition at line 21 of file captcha.class.php.


Constructor & Destructor Documentation

captcha::__construct ( name,
opts = null 
)

Constructs a captcha instance.

Parameters:
string$namethe name of the captcha field
array$optsAssociative array of options
  • allow_numbers: bool default false. Whether to allow number in captcha or not
Returns:
void

Definition at line 67 of file captcha.class.php.

+ Here is the call graph for this function:


Member Function Documentation

Cheks if the user inputs the right captcha code.

Returns:
bool, the check result

Definition at line 205 of file captcha.class.php.

captcha::generateStrings ( ) [private]

Generates a random alphanumeric string.

Returns:
void

Definition at line 147 of file captcha.class.php.

+ Here is the caller graph for this function:

captcha::hex2RGB ( hexStr) [private]

Converts a hex color string in a rgb array.

Parameters:
string$hexStrthe hex string
Returns:
the associative array containing the rgb values

Definition at line 176 of file captcha.class.php.

+ Here is the caller graph for this function:

captcha::render ( opts = null)

Renders the captcha image and input.

Parameters:
mixed$optsAssociative array of options
  • bkg_color: string default '#00ff00'. The hex code of the background color of the captcha
  • color: string default '#000000'. The hex code of the color of the letters in the captcha image
Returns:
the captcha image and input element

Definition at line 91 of file captcha.class.php.

+ Here is the call graph for this function:


Field Documentation

whether to allow number in captcha or not

Definition at line 56 of file captcha.class.php.

absolute path of the font ttf file

Definition at line 41 of file captcha.class.php.

captcha::$_height [private]

captcha image height

Definition at line 36 of file captcha.class.php.

captcha::$_letters [private]

letters allowed for the captcha

Definition at line 46 of file captcha.class.php.

captcha::$_name [private]

name of the captcha field

Definition at line 26 of file captcha.class.php.

captcha::$_numbers [private]

numbers allowed for the captcha

Definition at line 51 of file captcha.class.php.

captcha::$_width [private]

captcha image width

Definition at line 31 of file captcha.class.php.


The documentation for this class was generated from the following file: