|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace jumper423\decaptcha\services; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class RuCaptchaGrid. |
|
7
|
|
|
*/ |
|
8
|
|
|
class RuCaptchaClick extends RuCaptchaGrid |
|
9
|
|
|
{ |
|
10
|
|
|
public function init() |
|
11
|
|
|
{ |
|
12
|
|
|
parent::init(); |
|
13
|
|
|
|
|
14
|
|
|
unset( |
|
15
|
|
|
$this->paramsNames[static::ACTION_FIELD_RECAPTCHA], |
|
16
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_RECAPTCHA] |
|
17
|
|
|
); |
|
18
|
|
|
|
|
19
|
|
|
$this->paramsNames[static::ACTION_FIELD_COORDINATE] = 'coordinatescaptcha'; |
|
20
|
|
|
|
|
21
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INSTRUCTIONS][static::PARAM_SLUG_REQUIRE] = false; |
|
22
|
|
|
$this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_COORDINATE] = [ |
|
23
|
|
|
static::PARAM_SLUG_DEFAULT => 1, |
|
24
|
|
|
static::PARAM_SLUG_TYPE => static::PARAM_FIELD_TYPE_INTEGER, |
|
25
|
|
|
static::PARAM_SLUG_NOTWIKI => true, |
|
26
|
|
|
]; |
|
27
|
|
|
|
|
28
|
|
|
$this->wiki->setText(['service', 'name'], 'RuCaptcha ClickCaptcha'); |
|
29
|
|
|
$this->wiki->setText(['recognize', 'price'], [ |
|
30
|
|
|
'ru' => 'Стоимость 1000 распознаний данной капчи - 70 рублей.', |
|
31
|
|
|
'en' => 'It costs $1,2 to recognize 1000 CAPTCHAs this way.', |
|
32
|
|
|
]); |
|
33
|
|
|
$this->wiki->setText(['recognize', 'desc'], [ |
|
34
|
|
|
'ru' => 'Распознание любой ClickCaptcha (в том числе и ReCaptcha 2.0). В ответ приходит массив координат, от верхнего левого угла.', |
|
35
|
|
|
'en' => 'Recognizing any ClickCaptcha (including ReCaptcha 2.0). In response comes an array of coordinates from the top left corner.', |
|
36
|
|
|
]); |
|
37
|
|
|
$this->wiki->setText(['recognize', 'data'], [ |
|
38
|
|
|
static::ACTION_FIELD_INSTRUCTIONS => 'Where\'s the cat?', |
|
39
|
|
|
]); |
|
40
|
|
|
$this->wiki->setText(['menu', 'from_service'], [ |
|
41
|
|
|
RuCaptcha::class, |
|
42
|
|
|
RuCaptchaInstruction::class, |
|
43
|
|
|
RuCaptchaGrid::class, |
|
44
|
|
|
RuCaptchaReCaptcha::class, |
|
45
|
|
|
RuCaptchaKeyCaptcha::class, |
|
46
|
|
|
RuCaptchaFunCaptcha::class, |
|
47
|
|
|
RuCaptchaReCaptchaV3::class, |
|
48
|
|
|
RuCaptchaGeeTest::class, |
|
49
|
|
|
]); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @return array |
|
54
|
|
|
*/ |
|
55
|
|
|
public function getCode() |
|
56
|
|
|
{ |
|
57
|
|
|
$code = parent::getCode(); |
|
58
|
|
|
$code = explode(':', $code)[1]; |
|
59
|
|
|
$code = explode(';', $code); |
|
60
|
|
|
$result = []; |
|
61
|
|
|
foreach ($code as $row) { |
|
62
|
|
|
$rowCoord = explode(',', $row); |
|
63
|
|
|
foreach ($rowCoord as &$rowCoordOne) { |
|
64
|
|
|
$rowCoordOne = substr($rowCoordOne, 2); |
|
65
|
|
|
} |
|
66
|
|
|
$result[] = $rowCoord; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
return $result; |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|