1 | <?php |
||
20 | class ReCaptchaWidget extends InputWidget |
||
21 | { |
||
22 | /** |
||
23 | * @var string the color theme of the widget. Values can be 'dark' or 'light'. Optional. |
||
24 | */ |
||
25 | public $theme; |
||
26 | /** |
||
27 | * @var string the type of captcha. Values can be 'audio' or 'image'. Optional. |
||
28 | */ |
||
29 | public $type; |
||
30 | /** |
||
31 | * @var string the size of the widget. Values can be 'compact' or 'normal'. Optional. |
||
32 | */ |
||
33 | public $size; |
||
34 | /** |
||
35 | * @var string the tabindex of the widget and challenge. Optional. |
||
36 | */ |
||
37 | public $tabIndex; |
||
38 | /** |
||
39 | * @var string the name of the callbaqck function to be executed when the user submits a |
||
40 | * successful CAPTCHA response. The user's response, *g-recaptcha-response*, will be the input |
||
41 | * for the callback function. Optional. |
||
42 | */ |
||
43 | public $callback; |
||
44 | /** |
||
45 | * @var string the name of the callback function to be executed when the recaptcha response |
||
46 | * expires and the user needs to solve a new CAPTCHA. |
||
47 | */ |
||
48 | public $expiredCallback; |
||
49 | |||
50 | /** |
||
51 | * @inheritdoc |
||
52 | * |
||
53 | * @throws InvalidConfigException |
||
54 | */ |
||
55 | public function init() |
||
65 | |||
66 | /** |
||
67 | * @inheritdoc |
||
68 | * |
||
69 | * @throws InvalidConfigException |
||
70 | */ |
||
71 | public function run() |
||
83 | |||
84 | /** |
||
85 | * @throws InvalidConfigException |
||
86 | * @return array the google recaptcha options. |
||
87 | */ |
||
88 | protected function getCaptchaOptions() |
||
107 | |||
108 | /** |
||
109 | * Registers the required libraries and scripts for the widget to work. |
||
110 | */ |
||
111 | protected function registerClientScript() |
||
141 | |||
142 | /** |
||
143 | * @return bool|string the language code config option for google recatpcha library url. |
||
144 | */ |
||
145 | protected function getLanguageCode() |
||
168 | } |
||
169 |