PHP Class Pop\Image\Captcha

Author: Nick Sagona, III ([email protected])
Afficher le fichier Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Свойство Type Description
$border mixed CAPTCHA border width
$colors integer CAPTCHA colors
$expire integer CAPTCHA token expiration in seconds
$font string CAPTCHA font
$grid integer CAPTCHA grid spacing
$image mixed CAPTCHA image resource
$length integer CAPTCHA string length
$rotate integer CAPTCHA rotate
$size integer CAPTCHA font size (if using system fonts, it will be capped at 5)
$swirl integer CAPTCHA swirl
$token array CAPTCHA token object
$x integer CAPTCHA x
$y integer CAPTCHA y

Méthodes publiques

Méthode Description
__construct ( array $options, boolean $forceGd = false ) : Captcha Constructor
factory ( array $options, boolean $forceGd = false ) : Captcha Static method to instantiate the CAPTCHA image object and return itself to facilitate chaining methods together.
generateToken ( ) : void Method to generate the token object
getBackgroundColor ( ) : array Method to get the background color
getBorderColor ( ) : array Method to get the border color
getBorderWidth ( ) : mixed Method to get the border width
getExpire ( ) : integer Method to get the expiration length in seconds
getFont ( ) : string Method to get the font
getGridColor ( ) : array Method to get the grid color
getGridWidth ( ) : integer Method to get the grid spacing
getLength ( ) : integer Method to get the string length
getRotate ( ) : integer Method to get the rotation
getSize ( ) : integer Method to get the font size
getSwirl ( ) : integer Method to get the swirl
getTextColor ( ) : array Method to get the text color
getToken ( ) : array Method to get the token object, generating a new one if necessary
getX ( ) : integer Method to get the X position
getY ( ) : integer Method to get the Y position
image ( ) : mixed Method to get the image object
output ( ) : void Method to output the image object
setBackgroundColor ( integer $r, integer $g, integer $b ) : Captcha Method to set the background color
setBorderColor ( integer $r = null, integer $g = null, integer $b = null ) : Captcha Method to set the border color
setBorderWidth ( mixed $border = 0.55 ) : Captcha Method to set the border width
setExpire ( integer $expire = 300 ) : Captcha Method to set the expiration length in seconds
setFont ( string $font = null ) : Captcha Method to set the font
setGridColor ( integer $r = null, integer $g = null, integer $b = null ) : Captcha Method to set the grid color
setGridWidth ( integer $grid = 5 ) : Captcha Method to set the grid spacing
setLength ( integer $length = 4 ) : Captcha Method to set the string length
setRotate ( integer $rotate = null ) : Captcha Method to set the rotation
setSize ( integer $size = 20 ) : Captcha Method to set the font size
setSwirl ( integer $swirl = null ) : Captcha Method to set the swirl
setTextColor ( integer $r, integer $g, integer $b ) : Captcha Method to set the text color
setX ( integer $x = null ) : Captcha Method to set the X position
setXY ( integer $x = null, integer $y = null ) : Captcha Method to set the X, Y position
setY ( integer $y = null ) : Captcha Method to set the Y position

Method Details

__construct() public méthode

Instantiate a CAPTCHA image object. Valid options are: $options = array( 'width' => 75, 'height' => 25, 'background' => array(200, 200, 200) // R, G, B values for the background color ); $options = array( 'image' => 'some-image-background,gif' ); This $forceGd flag forces the object to use the Gd extension. If both are installed, it will default to Imagick unless this flag is set to true.
public __construct ( array $options, boolean $forceGd = false ) : Captcha
$options array
$forceGd boolean
Résultat Captcha

factory() public static méthode

Static method to instantiate the CAPTCHA image object and return itself to facilitate chaining methods together.
public static factory ( array $options, boolean $forceGd = false ) : Captcha
$options array
$forceGd boolean
Résultat Captcha

generateToken() public méthode

Method to generate the token object
public generateToken ( ) : void
Résultat void

getBackgroundColor() public méthode

Method to get the background color
public getBackgroundColor ( ) : array
Résultat array

getBorderColor() public méthode

Method to get the border color
public getBorderColor ( ) : array
Résultat array

getBorderWidth() public méthode

Method to get the border width
public getBorderWidth ( ) : mixed
Résultat mixed

getExpire() public méthode

Method to get the expiration length in seconds
public getExpire ( ) : integer
Résultat integer

getFont() public méthode

Method to get the font
public getFont ( ) : string
Résultat string

getGridColor() public méthode

Method to get the grid color
public getGridColor ( ) : array
Résultat array

getGridWidth() public méthode

Method to get the grid spacing
public getGridWidth ( ) : integer
Résultat integer

getLength() public méthode

Method to get the string length
public getLength ( ) : integer
Résultat integer

getRotate() public méthode

Method to get the rotation
public getRotate ( ) : integer
Résultat integer

getSize() public méthode

Method to get the font size
public getSize ( ) : integer
Résultat integer

getSwirl() public méthode

Method to get the swirl
public getSwirl ( ) : integer
Résultat integer

getTextColor() public méthode

Method to get the text color
public getTextColor ( ) : array
Résultat array

getToken() public méthode

Method to get the token object, generating a new one if necessary
public getToken ( ) : array
Résultat array

getX() public méthode

Method to get the X position
public getX ( ) : integer
Résultat integer

getY() public méthode

Method to get the Y position
public getY ( ) : integer
Résultat integer

image() public méthode

Method to get the image object
public image ( ) : mixed
Résultat mixed

output() public méthode

Method to output the image object
public output ( ) : void
Résultat void

setBackgroundColor() public méthode

Method to set the background color
public setBackgroundColor ( integer $r, integer $g, integer $b ) : Captcha
$r integer
$g integer
$b integer
Résultat Captcha

setBorderColor() public méthode

Method to set the border color
public setBorderColor ( integer $r = null, integer $g = null, integer $b = null ) : Captcha
$r integer
$g integer
$b integer
Résultat Captcha

setBorderWidth() public méthode

Method to set the border width
public setBorderWidth ( mixed $border = 0.55 ) : Captcha
$border mixed
Résultat Captcha

setExpire() public méthode

Method to set the expiration length in seconds
public setExpire ( integer $expire = 300 ) : Captcha
$expire integer
Résultat Captcha

setFont() public méthode

Method to set the font
public setFont ( string $font = null ) : Captcha
$font string
Résultat Captcha

setGridColor() public méthode

Method to set the grid color
public setGridColor ( integer $r = null, integer $g = null, integer $b = null ) : Captcha
$r integer
$g integer
$b integer
Résultat Captcha

setGridWidth() public méthode

Method to set the grid spacing
public setGridWidth ( integer $grid = 5 ) : Captcha
$grid integer
Résultat Captcha

setLength() public méthode

Method to set the string length
public setLength ( integer $length = 4 ) : Captcha
$length integer
Résultat Captcha

setRotate() public méthode

Method to set the rotation
public setRotate ( integer $rotate = null ) : Captcha
$rotate integer
Résultat Captcha

setSize() public méthode

Method to set the font size
public setSize ( integer $size = 20 ) : Captcha
$size integer
Résultat Captcha

setSwirl() public méthode

Method to set the swirl
public setSwirl ( integer $swirl = null ) : Captcha
$swirl integer
Résultat Captcha

setTextColor() public méthode

Method to set the text color
public setTextColor ( integer $r, integer $g, integer $b ) : Captcha
$r integer
$g integer
$b integer
Résultat Captcha

setX() public méthode

Method to set the X position
public setX ( integer $x = null ) : Captcha
$x integer
Résultat Captcha

setXY() public méthode

Method to set the X, Y position
public setXY ( integer $x = null, integer $y = null ) : Captcha
$x integer
$y integer
Résultat Captcha

setY() public méthode

Method to set the Y position
public setY ( integer $y = null ) : Captcha
$y integer
Résultat Captcha

Property Details

$border protected_oe property

CAPTCHA border width
protected mixed $border
Résultat mixed

$colors protected_oe property

CAPTCHA colors
protected int $colors
Résultat integer

$expire protected_oe property

CAPTCHA token expiration in seconds
protected int $expire
Résultat integer

$font protected_oe property

CAPTCHA font
protected string $font
Résultat string

$grid protected_oe property

CAPTCHA grid spacing
protected int $grid
Résultat integer

$image protected_oe property

CAPTCHA image resource
protected mixed $image
Résultat mixed

$length protected_oe property

CAPTCHA string length
protected int $length
Résultat integer

$rotate protected_oe property

CAPTCHA rotate
protected int $rotate
Résultat integer

$size protected_oe property

CAPTCHA font size (if using system fonts, it will be capped at 5)
protected int $size
Résultat integer

$swirl protected_oe property

CAPTCHA swirl
protected int $swirl
Résultat integer

$token protected_oe property

CAPTCHA token object
protected array $token
Résultat array

$x protected_oe property

CAPTCHA x
protected int $x
Résultat integer

$y protected_oe property

CAPTCHA y
protected int $y
Résultat integer