PHP Class RecaptchaComponent

Inheritance: extends Component
Mostra file Open project: cakedc/recaptcha

Public Properties

Property Type Description
$Controller string Name
$actions array Actions that should automatically checked for a recaptcha input
$apiUrl string Recaptcha API Url
$error string Error coming back from Recaptcha
$privateKey string Private API Key
$settings array Settings

Protected Properties

Property Type Description
$_defaults array Default Options

Public Methods

Method Description
__construct ( ComponentCollection $collection, array $settings = [] ) : RecaptchaComponent Constructor
initialize ( Controller $controller, array $settings = [] ) : void Callback
startup ( Controller $controller ) : void Callback
verify ( ) : boolean Verifies the recaptcha input

Protected Methods

Method Description
_getApiResponse ( ) : HttpSocketResponse Queries the Recaptcha API and and returns the raw response

Method Details

__construct() public method

Constructor
public __construct ( ComponentCollection $collection, array $settings = [] ) : RecaptchaComponent
$collection ComponentCollection A ComponentCollection this component can use to lazy load its components
$settings array Array of configuration settings
return RecaptchaComponent

_getApiResponse() protected method

Queries the Recaptcha API and and returns the raw response
protected _getApiResponse ( ) : HttpSocketResponse
return HttpSocketResponse

initialize() public method

Callback
public initialize ( Controller $controller, array $settings = [] ) : void
$controller Controller Controller with components to initialize
$settings array Array of configuration settings
return void

startup() public method

Callback
public startup ( Controller $controller ) : void
$controller Controller Controller with components to initialize
return void

verify() public method

Please note that you still have to pass the result to the model and do the validation there to make sure the data is not saved!
public verify ( ) : boolean
return boolean True if the response was correct

Property Details

$Controller public_oe property

Name
public string $Controller
return string

$_defaults protected_oe property

Default Options
protected array $_defaults
return array

$actions public_oe property

Actions that should automatically checked for a recaptcha input
public array $actions
return array

$apiUrl public_oe property

Recaptcha API Url
public string $apiUrl
return string

$error public_oe property

Error coming back from Recaptcha
public string $error
return string

$privateKey public_oe property

Private API Key
public string $privateKey
return string

$settings public_oe property

Settings
public array $settings
return array