@@ -14,6 +14,9 @@ discard block |
||
14 | 14 | protected $class; |
15 | 15 | protected $lang = 'en'; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $lang |
|
19 | + */ |
|
17 | 20 | public function setLang($lang) |
18 | 21 | { |
19 | 22 | $this->lang = $lang; |
@@ -312,10 +315,10 @@ discard block |
||
312 | 315 | } |
313 | 316 | |
314 | 317 | /** |
315 | - * @param string|array $name |
|
318 | + * @param string[] $name |
|
316 | 319 | * @param string $separator |
317 | 320 | * |
318 | - * @return string|array |
|
321 | + * @return string |
|
319 | 322 | */ |
320 | 323 | public function getText($name, $separator = '; ') |
321 | 324 | { |
@@ -541,6 +544,9 @@ discard block |
||
541 | 544 | return $str; |
542 | 545 | } |
543 | 546 | |
547 | + /** |
|
548 | + * @param string $keyMask |
|
549 | + */ |
|
544 | 550 | protected function getNameConst($keyMask, $value) |
545 | 551 | { |
546 | 552 | $class = $this->class; |
@@ -578,6 +584,9 @@ discard block |
||
578 | 584 | return $str; |
579 | 585 | } |
580 | 586 | |
587 | + /** |
|
588 | + * @param string $lang |
|
589 | + */ |
|
581 | 590 | public function getFileName($lang = null) |
582 | 591 | { |
583 | 592 | if (is_null($lang)) { |
@@ -596,14 +596,14 @@ |
||
596 | 596 | $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
597 | 597 | $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}".PHP_EOL; |
598 | 598 | foreach ([ |
599 | - ['slug', 'link'], |
|
600 | - ['slug', 'service', 'desc'], |
|
601 | - ['slug', 'price'], |
|
602 | - ['slug', 'recognize', 'desc'], |
|
603 | - ['install'], |
|
604 | - ['example'], |
|
605 | - ['slug', 'fields', 'desc'], |
|
606 | - ] as $anchor) { |
|
599 | + ['slug', 'link'], |
|
600 | + ['slug', 'service', 'desc'], |
|
601 | + ['slug', 'price'], |
|
602 | + ['slug', 'recognize', 'desc'], |
|
603 | + ['install'], |
|
604 | + ['example'], |
|
605 | + ['slug', 'fields', 'desc'], |
|
606 | + ] as $anchor) { |
|
607 | 607 | $str .= " + [{$this->getText($anchor)}](#".implode('-', explode(' ', ($this->lang === 'en' ? mb_strtolower($this->getText($anchor)) : $this->getText($anchor)))).')'.PHP_EOL; |
608 | 608 | } |
609 | 609 | if ($this->getText(['menu', 'from_service'])) { |
@@ -29,211 +29,211 @@ discard block |
||
29 | 29 | 'recognize_file' => true, |
30 | 30 | 'recognize_data_file' => 'http://site.com/captcha.jpg', |
31 | 31 | 'recognize_data' => [], |
32 | - 'field_main_name_'.$class::ACTION_FIELD_KEY => [ |
|
32 | + 'field_main_name_' . $class::ACTION_FIELD_KEY => [ |
|
33 | 33 | 'ru' => 'Ключ', |
34 | 34 | 'en' => 'Key', |
35 | 35 | ], |
36 | - 'field_main_desc_'.$class::ACTION_FIELD_KEY => [ |
|
36 | + 'field_main_desc_' . $class::ACTION_FIELD_KEY => [ |
|
37 | 37 | 'ru' => 'Ключ от учетной записи', |
38 | 38 | 'en' => 'Key account', |
39 | 39 | ], |
40 | - 'field_main_name_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
40 | + 'field_main_name_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
41 | 41 | 'ru' => 'Язык', |
42 | 42 | 'en' => 'Language', |
43 | 43 | ], |
44 | - 'field_main_desc_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
44 | + 'field_main_desc_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
45 | 45 | 'ru' => 'На каком языке текст на капче', |
46 | 46 | 'en' => 'What language the text on the captcha', |
47 | 47 | ], |
48 | - 'field_main_name_'.$class::ACTION_FIELD_FILE => [ |
|
48 | + 'field_main_name_' . $class::ACTION_FIELD_FILE => [ |
|
49 | 49 | 'ru' => 'Картинка', |
50 | 50 | 'en' => 'Picture', |
51 | 51 | ], |
52 | - 'field_main_desc_'.$class::ACTION_FIELD_FILE => [ |
|
52 | + 'field_main_desc_' . $class::ACTION_FIELD_FILE => [ |
|
53 | 53 | 'ru' => 'Путь на файл с картинкой или ссылка на него', |
54 | 54 | 'en' => 'The path to the picture file or link to it', |
55 | 55 | ], |
56 | - 'field_main_name_'.$class::ACTION_FIELD_PHRASE => [ |
|
56 | + 'field_main_name_' . $class::ACTION_FIELD_PHRASE => [ |
|
57 | 57 | 'ru' => 'Несколько слов', |
58 | 58 | 'en' => 'A few words', |
59 | 59 | ], |
60 | - 'field_main_desc_'.$class::ACTION_FIELD_PHRASE => [ |
|
60 | + 'field_main_desc_' . $class::ACTION_FIELD_PHRASE => [ |
|
61 | 61 | 'ru' => 'Работник должен ввести текст с одним или несколькими пробелами', |
62 | 62 | 'en' => 'The worker must enter text with one or more spaces', |
63 | 63 | ], |
64 | - 'field_main_name_'.$class::ACTION_FIELD_REGSENSE => [ |
|
64 | + 'field_main_name_' . $class::ACTION_FIELD_REGSENSE => [ |
|
65 | 65 | 'ru' => 'Регистр', |
66 | 66 | 'en' => 'Register', |
67 | 67 | ], |
68 | - 'field_main_desc_'.$class::ACTION_FIELD_REGSENSE => [ |
|
68 | + 'field_main_desc_' . $class::ACTION_FIELD_REGSENSE => [ |
|
69 | 69 | 'ru' => 'Работник должен ввести ответ с учетом регистра', |
70 | 70 | 'en' => 'The worker must enter the answer case sensitive', |
71 | 71 | ], |
72 | - 'field_main_name_'.$class::ACTION_FIELD_NUMERIC => [ |
|
72 | + 'field_main_name_' . $class::ACTION_FIELD_NUMERIC => [ |
|
73 | 73 | 'ru' => 'Символы', |
74 | 74 | 'en' => 'Characters', |
75 | 75 | ], |
76 | - 'field_main_desc_'.$class::ACTION_FIELD_NUMERIC => [ |
|
76 | + 'field_main_desc_' . $class::ACTION_FIELD_NUMERIC => [ |
|
77 | 77 | 'ru' => 'Какие символы используется в капче', |
78 | 78 | 'en' => 'What are the symbols used in captcha', |
79 | 79 | ], |
80 | - 'field_main_name_'.$class::ACTION_FIELD_CALC => [ |
|
80 | + 'field_main_name_' . $class::ACTION_FIELD_CALC => [ |
|
81 | 81 | 'ru' => 'Вычисление', |
82 | 82 | 'en' => 'Calculation', |
83 | 83 | ], |
84 | - 'field_main_desc_'.$class::ACTION_FIELD_CALC => [ |
|
84 | + 'field_main_desc_' . $class::ACTION_FIELD_CALC => [ |
|
85 | 85 | 'ru' => 'На капче изображенно математичекая выражение и её необходимо решить', |
86 | 86 | 'en' => 'The captcha shows matematicheskaya expression and must be addressed', |
87 | 87 | ], |
88 | - 'field_main_name_'.$class::ACTION_FIELD_MIN_LEN => [ |
|
88 | + 'field_main_name_' . $class::ACTION_FIELD_MIN_LEN => [ |
|
89 | 89 | 'ru' => 'Длина min', |
90 | 90 | 'en' => 'Length min', |
91 | 91 | ], |
92 | - 'field_main_desc_'.$class::ACTION_FIELD_MIN_LEN => [ |
|
92 | + 'field_main_desc_' . $class::ACTION_FIELD_MIN_LEN => [ |
|
93 | 93 | 'ru' => 'Минимальная длина капчи', |
94 | 94 | 'en' => 'The minimum length of captcha', |
95 | 95 | ], |
96 | - 'field_main_name_'.$class::ACTION_FIELD_MAX_LEN => [ |
|
96 | + 'field_main_name_' . $class::ACTION_FIELD_MAX_LEN => [ |
|
97 | 97 | 'ru' => 'Длина max', |
98 | 98 | 'en' => 'Length max', |
99 | 99 | ], |
100 | - 'field_main_desc_'.$class::ACTION_FIELD_MAX_LEN => [ |
|
100 | + 'field_main_desc_' . $class::ACTION_FIELD_MAX_LEN => [ |
|
101 | 101 | 'ru' => 'Максимальная длина капчи', |
102 | 102 | 'en' => 'The maximum length of the captcha', |
103 | 103 | ], |
104 | - 'field_main_name_'.$class::ACTION_FIELD_QUESTION => [ |
|
104 | + 'field_main_name_' . $class::ACTION_FIELD_QUESTION => [ |
|
105 | 105 | 'ru' => 'Вопрос', |
106 | 106 | 'en' => 'Question', |
107 | 107 | ], |
108 | - 'field_main_desc_'.$class::ACTION_FIELD_QUESTION => [ |
|
108 | + 'field_main_desc_' . $class::ACTION_FIELD_QUESTION => [ |
|
109 | 109 | 'ru' => 'На изображении задан вопрос, работник должен написать ответ', |
110 | 110 | 'en' => 'The image asked, the employee must write the answer', |
111 | 111 | ], |
112 | - 'field_main_name_'.$class::ACTION_FIELD_IS_RUSSIAN => [ |
|
112 | + 'field_main_name_' . $class::ACTION_FIELD_IS_RUSSIAN => [ |
|
113 | 113 | 'ru' => 'Кириллица', |
114 | 114 | 'en' => 'Cyrillic', |
115 | 115 | ], |
116 | - 'field_main_desc_'.$class::ACTION_FIELD_IS_RUSSIAN => [ |
|
116 | + 'field_main_desc_' . $class::ACTION_FIELD_IS_RUSSIAN => [ |
|
117 | 117 | 'ru' => 'На изображении присутствуют русские символы', |
118 | 118 | 'en' => 'In the image there are Russian characters', |
119 | 119 | ], |
120 | - 'field_main_name_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
120 | + 'field_main_name_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
121 | 121 | 'ru' => 'Язык', |
122 | 122 | 'en' => 'Language', |
123 | 123 | ], |
124 | - 'field_main_desc_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
124 | + 'field_main_desc_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
125 | 125 | 'ru' => 'Символы какого языка размещенны на капче', |
126 | 126 | 'en' => 'The symbols of the language posted on the captcha', |
127 | 127 | ], |
128 | - 'field_main_name_'.$class::ACTION_FIELD_HEADER_ACAO => [ |
|
128 | + 'field_main_name_' . $class::ACTION_FIELD_HEADER_ACAO => [ |
|
129 | 129 | 'ru' => 'Кросс-доменный', |
130 | 130 | 'en' => 'Cross-domain', |
131 | 131 | ], |
132 | - 'field_main_desc_'.$class::ACTION_FIELD_HEADER_ACAO => [ |
|
132 | + 'field_main_desc_' . $class::ACTION_FIELD_HEADER_ACAO => [ |
|
133 | 133 | 'ru' => 'Необходимо для кросс-доменных AJAX запросов в браузерных приложениях.', |
134 | 134 | 'en' => 'Need for cross-domain AJAX requests in browser-based applications.', |
135 | 135 | ], |
136 | - 'field_main_name_'.$class::ACTION_FIELD_INSTRUCTIONS => [ |
|
136 | + 'field_main_name_' . $class::ACTION_FIELD_INSTRUCTIONS => [ |
|
137 | 137 | 'ru' => 'Инструкция', |
138 | 138 | 'en' => 'Manual', |
139 | 139 | ], |
140 | - 'field_main_desc_'.$class::ACTION_FIELD_INSTRUCTIONS => [ |
|
140 | + 'field_main_desc_' . $class::ACTION_FIELD_INSTRUCTIONS => [ |
|
141 | 141 | 'ru' => 'Текстовая капча или инструкция для прохождения капчи.', |
142 | 142 | 'en' => 'Text captcha or manual to pass the captcha.', |
143 | 143 | ], |
144 | - 'field_main_name_'.$class::ACTION_FIELD_PINGBACK => [ |
|
144 | + 'field_main_name_' . $class::ACTION_FIELD_PINGBACK => [ |
|
145 | 145 | 'ru' => 'Ответ на', |
146 | 146 | 'en' => 'Response to', |
147 | 147 | ], |
148 | - 'field_main_desc_'.$class::ACTION_FIELD_PINGBACK => [ |
|
148 | + 'field_main_desc_' . $class::ACTION_FIELD_PINGBACK => [ |
|
149 | 149 | 'ru' => 'Указание для сервера, что после распознания изображения, нужно отправить ответ на указанный адрес.', |
150 | 150 | 'en' => 'Note to server, after recognizing the image, you need to send a reply to the specified address.', |
151 | 151 | ], |
152 | - 'field_main_name_'.$class::ACTION_FIELD_LABEL => [ |
|
152 | + 'field_main_name_' . $class::ACTION_FIELD_LABEL => [ |
|
153 | 153 | 'ru' => 'От куда', |
154 | 154 | 'en' => 'From where', |
155 | 155 | ], |
156 | - 'field_main_desc_'.$class::ACTION_FIELD_LABEL => [ |
|
156 | + 'field_main_desc_' . $class::ACTION_FIELD_LABEL => [ |
|
157 | 157 | 'ru' => 'Пояснение от куда пришла капча ("vk", "google", "recaptcha", "yandex", "mailru", "yahoo" и т.д.).', |
158 | 158 | 'en' => 'Clarification from where came the captcha ("vk", "google", "recaptcha", "yandex", "Google", "yahoo", etc.).', |
159 | 159 | ], |
160 | - 'field_main_name_'.$class::ACTION_FIELD_PAGEURL => [ |
|
160 | + 'field_main_name_' . $class::ACTION_FIELD_PAGEURL => [ |
|
161 | 161 | 'ru' => 'Адрес', |
162 | 162 | 'en' => 'Link', |
163 | 163 | ], |
164 | - 'field_main_desc_'.$class::ACTION_FIELD_PAGEURL => [ |
|
164 | + 'field_main_desc_' . $class::ACTION_FIELD_PAGEURL => [ |
|
165 | 165 | 'ru' => 'Адрес страницы на которой решается капча.', |
166 | 166 | 'en' => 'The address of the page where the captcha is solved.', |
167 | 167 | ], |
168 | - 'field_main_name_'.$class::ACTION_FIELD_GOOGLEKEY => [ |
|
168 | + 'field_main_name_' . $class::ACTION_FIELD_GOOGLEKEY => [ |
|
169 | 169 | 'ru' => 'Google key', |
170 | 170 | 'en' => 'Google key', |
171 | 171 | ], |
172 | - 'field_main_desc_'.$class::ACTION_FIELD_GOOGLEKEY => [ |
|
172 | + 'field_main_desc_' . $class::ACTION_FIELD_GOOGLEKEY => [ |
|
173 | 173 | 'ru' => 'Ключ-индентификатор рекапчи на целевой странице. <div class="g-recaptcha" data-sitekey="ВОТ_ЭТОТ"></div>', |
174 | 174 | 'en' => 'Key-the identifier of the recaptcha on the landing page. <div class="g-recaptcha" data-sitekey="THIS"></div>', |
175 | 175 | ], |
176 | - 'field_main_name_'.$class::ACTION_FIELD_GOOGLETOKEN => [ |
|
176 | + 'field_main_name_' . $class::ACTION_FIELD_GOOGLETOKEN => [ |
|
177 | 177 | 'ru' => 'Google token', |
178 | 178 | 'en' => 'Google token', |
179 | 179 | ], |
180 | - 'field_main_desc_'.$class::ACTION_FIELD_GOOGLETOKEN => [ |
|
180 | + 'field_main_desc_' . $class::ACTION_FIELD_GOOGLETOKEN => [ |
|
181 | 181 | 'ru' => 'Секретный токен для предыдущей версии рекапчи. В большинстве случаев сайты используют новую версию и этот токен не требуется. Секретный токен генерируется на сервере Google и вставляется на страницу в атрибуте data-stoken. Выглядит это примерно так: <script type="text/javascript" src="...." data-type="normal" data-ray="..." async data-sitekey="..." data-stoken="ВОТ_ЭТОТ"></script> Токен действует пару минут после генерации, затем нужно снова зайти на страницу и получить его.', |
182 | 182 | 'en' => 'The secret token for the previous version of recaptcha. In most cases, sites use the new version and this token is not required. The secret token is generated on a Google server and inserted into the page in the attribute data-stoken. It looks like this: <script type="text/javascript" src="...." data-type="normal" data-ray="..." async data-sitekey="..." data-stoken="THIS"></script> the Token is valid a few minutes after generation, then you need to go back to the page and get it.', |
183 | 183 | ], |
184 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYTYPE => [ |
|
184 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYTYPE => [ |
|
185 | 185 | 'ru' => 'Тип прокси', |
186 | 186 | 'en' => 'The proxy type', |
187 | 187 | ], |
188 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYTYPE => [ |
|
188 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYTYPE => [ |
|
189 | 189 | 'ru' => 'Тип прокси (http, socks4, ...)', |
190 | 190 | 'en' => 'The proxy type (http, socks4, ...)', |
191 | 191 | ], |
192 | - 'field_main_name_'.$class::ACTION_FIELD_PROXY => [ |
|
192 | + 'field_main_name_' . $class::ACTION_FIELD_PROXY => [ |
|
193 | 193 | 'ru' => 'Адрес прокси', |
194 | 194 | 'en' => 'The proxy address', |
195 | 195 | ], |
196 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXY => [ |
|
196 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXY => [ |
|
197 | 197 | 'ru' => 'IP адрес прокси ipv4/ipv6.', |
198 | 198 | 'en' => 'IP address of the proxy ipv4/ipv6.', |
199 | 199 | ], |
200 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYPORT => [ |
|
200 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYPORT => [ |
|
201 | 201 | 'ru' => 'Порт прокси', |
202 | 202 | 'en' => 'Proxy port', |
203 | 203 | ], |
204 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYPORT => [ |
|
204 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYPORT => [ |
|
205 | 205 | 'ru' => 'Порт прокси.', |
206 | 206 | 'en' => 'Proxy port.', |
207 | 207 | ], |
208 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYLOGIN => [ |
|
208 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYLOGIN => [ |
|
209 | 209 | 'ru' => 'Логин прокси', |
210 | 210 | 'en' => 'Login proxy', |
211 | 211 | ], |
212 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYLOGIN => [ |
|
212 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYLOGIN => [ |
|
213 | 213 | 'ru' => 'Логин от прокси-сервера.', |
214 | 214 | 'en' => 'Login from proxy server.', |
215 | 215 | ], |
216 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYPASS => [ |
|
216 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYPASS => [ |
|
217 | 217 | 'ru' => 'Пароль прокси', |
218 | 218 | 'en' => 'Password proxy', |
219 | 219 | ], |
220 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYPASS => [ |
|
220 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYPASS => [ |
|
221 | 221 | 'ru' => 'Пароль от прокси-сервера.', |
222 | 222 | 'en' => 'The password for the proxy server.', |
223 | 223 | ], |
224 | - 'field_main_name_'.$class::ACTION_FIELD_USERAGENT => [ |
|
224 | + 'field_main_name_' . $class::ACTION_FIELD_USERAGENT => [ |
|
225 | 225 | 'ru' => 'User-Agent браузера', |
226 | 226 | 'en' => 'User-Agent browser', |
227 | 227 | ], |
228 | - 'field_main_desc_'.$class::ACTION_FIELD_USERAGENT => [ |
|
228 | + 'field_main_desc_' . $class::ACTION_FIELD_USERAGENT => [ |
|
229 | 229 | 'ru' => 'User-Agent браузера, используемый в эмуляции. Необходимо использовать подпись современного браузера, иначе Google будет возвращать ошибку, требуя обновить браузер.', |
230 | 230 | 'en' => 'User-Agent browser used in emulation. You must use the signature modern browser, otherwise Google will return an error requiring you to upgrade your browser.', |
231 | 231 | ], |
232 | - 'field_main_name_'.$class::ACTION_FIELD_COOKIES => [ |
|
232 | + 'field_main_name_' . $class::ACTION_FIELD_COOKIES => [ |
|
233 | 233 | 'ru' => 'Куки', |
234 | 234 | 'en' => 'Cookies', |
235 | 235 | ], |
236 | - 'field_main_desc_'.$class::ACTION_FIELD_COOKIES => [ |
|
236 | + 'field_main_desc_' . $class::ACTION_FIELD_COOKIES => [ |
|
237 | 237 | 'ru' => 'Дополнительные cookies которые мы должны использовать во время взаимодействия с целевой страницей.', |
238 | 238 | 'en' => 'Additional cookies which we should use during the interaction with the target page.', |
239 | 239 | ], |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function getText($name, $separator = '; ') |
406 | 406 | { |
407 | - $getResult = function ($name, $texts) { |
|
407 | + $getResult = function($name, $texts) { |
|
408 | 408 | if (is_array($name)) { |
409 | 409 | $name = implode('_', $name); |
410 | 410 | } |
@@ -433,17 +433,17 @@ discard block |
||
433 | 433 | |
434 | 434 | protected function viewInstall() |
435 | 435 | { |
436 | - $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/).".PHP_EOL; |
|
436 | + $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/)." . PHP_EOL; |
|
437 | 437 | $str .= PHP_EOL; |
438 | - $str .= "{$this->getText(['install', 'start'])}".PHP_EOL; |
|
439 | - $str .= '```'.PHP_EOL; |
|
440 | - $str .= 'composer require --prefer-dist jumper423/decaptcha "*"'.PHP_EOL; |
|
441 | - $str .= '```'.PHP_EOL; |
|
442 | - $str .= "{$this->getText(['install', 'add'])}".PHP_EOL; |
|
443 | - $str .= '```'.PHP_EOL; |
|
444 | - $str .= '"jumper423/decaptcha": "*"'.PHP_EOL; |
|
445 | - $str .= '```'.PHP_EOL; |
|
446 | - $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`.".PHP_EOL; |
|
438 | + $str .= "{$this->getText(['install', 'start'])}" . PHP_EOL; |
|
439 | + $str .= '```' . PHP_EOL; |
|
440 | + $str .= 'composer require --prefer-dist jumper423/decaptcha "*"' . PHP_EOL; |
|
441 | + $str .= '```' . PHP_EOL; |
|
442 | + $str .= "{$this->getText(['install', 'add'])}" . PHP_EOL; |
|
443 | + $str .= '```' . PHP_EOL; |
|
444 | + $str .= '"jumper423/decaptcha": "*"' . PHP_EOL; |
|
445 | + $str .= '```' . PHP_EOL; |
|
446 | + $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`." . PHP_EOL; |
|
447 | 447 | |
448 | 448 | return $str; |
449 | 449 | } |
@@ -453,71 +453,71 @@ discard block |
||
453 | 453 | $class = $this->class; |
454 | 454 | $reflection = (new \ReflectionClass($class)); |
455 | 455 | |
456 | - $str = "__{$this->getText(['example', 'initialization'])}__".PHP_EOL; |
|
457 | - $str .= "{$this->getText(['example', 'initialization', 'desc'])}".PHP_EOL; |
|
458 | - $str .= '```'.PHP_EOL; |
|
459 | - $str .= "use {$reflection->getName()};".PHP_EOL; |
|
460 | - $str .= ''.PHP_EOL; |
|
461 | - $str .= '$captcha = new '.$reflection->getShortName().'(['.PHP_EOL; |
|
456 | + $str = "__{$this->getText(['example', 'initialization'])}__" . PHP_EOL; |
|
457 | + $str .= "{$this->getText(['example', 'initialization', 'desc'])}" . PHP_EOL; |
|
458 | + $str .= '```' . PHP_EOL; |
|
459 | + $str .= "use {$reflection->getName()};" . PHP_EOL; |
|
460 | + $str .= '' . PHP_EOL; |
|
461 | + $str .= '$captcha = new ' . $reflection->getShortName() . '([' . PHP_EOL; |
|
462 | 462 | foreach ($this->texts['constructor_data'] as $key => $val) { |
463 | 463 | $str .= " {$reflection->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
464 | 464 | $str .= is_string($val) ? "'{$val}'" : $val; |
465 | - $str .= ','.PHP_EOL; |
|
465 | + $str .= ',' . PHP_EOL; |
|
466 | 466 | } |
467 | - $str .= ']);'.PHP_EOL; |
|
468 | - $str .= '```'.PHP_EOL; |
|
467 | + $str .= ']);' . PHP_EOL; |
|
468 | + $str .= '```' . PHP_EOL; |
|
469 | 469 | |
470 | - $str .= "__{$this->getText(['example', 'recognize'])}__".PHP_EOL; |
|
471 | - $str .= "{$this->getText(['example', 'recognize', 'desc'])}".PHP_EOL; |
|
472 | - $str .= '```'.PHP_EOL; |
|
470 | + $str .= "__{$this->getText(['example', 'recognize'])}__" . PHP_EOL; |
|
471 | + $str .= "{$this->getText(['example', 'recognize', 'desc'])}" . PHP_EOL; |
|
472 | + $str .= '```' . PHP_EOL; |
|
473 | 473 | $str .= 'if ($captcha->recognize('; |
474 | 474 | $str .= $this->getRecognizeFile(); |
475 | 475 | $str .= $this->getRecognizeData(); |
476 | - $str .= ')) {'.PHP_EOL; |
|
477 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
478 | - $str .= '} else {'.PHP_EOL; |
|
479 | - $str .= ' $error = $captcha->getError();'.PHP_EOL; |
|
480 | - $str .= '}'.PHP_EOL; |
|
481 | - $str .= '```'.PHP_EOL; |
|
476 | + $str .= ')) {' . PHP_EOL; |
|
477 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
478 | + $str .= '} else {' . PHP_EOL; |
|
479 | + $str .= ' $error = $captcha->getError();' . PHP_EOL; |
|
480 | + $str .= '}' . PHP_EOL; |
|
481 | + $str .= '```' . PHP_EOL; |
|
482 | 482 | |
483 | 483 | if (in_array('notTrue', get_class_methods($class))) { |
484 | - $str .= "__{$this->getText(['example', 'nottrue'])}__".PHP_EOL; |
|
485 | - $str .= "{$this->getText(['example', 'nottrue', 'desc'])}".PHP_EOL; |
|
486 | - $str .= '```'.PHP_EOL; |
|
487 | - $str .= '$captcha->notTrue();'.PHP_EOL; |
|
488 | - $str .= '```'.PHP_EOL; |
|
484 | + $str .= "__{$this->getText(['example', 'nottrue'])}__" . PHP_EOL; |
|
485 | + $str .= "{$this->getText(['example', 'nottrue', 'desc'])}" . PHP_EOL; |
|
486 | + $str .= '```' . PHP_EOL; |
|
487 | + $str .= '$captcha->notTrue();' . PHP_EOL; |
|
488 | + $str .= '```' . PHP_EOL; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | if (in_array('getBalance', get_class_methods($class))) { |
492 | - $str .= "__{$this->getText(['example', 'balance'])}__".PHP_EOL; |
|
493 | - $str .= '```'.PHP_EOL; |
|
494 | - $str .= '$balance = $captcha->getBalance();'.PHP_EOL; |
|
495 | - $str .= '```'.PHP_EOL; |
|
492 | + $str .= "__{$this->getText(['example', 'balance'])}__" . PHP_EOL; |
|
493 | + $str .= '```' . PHP_EOL; |
|
494 | + $str .= '$balance = $captcha->getBalance();' . PHP_EOL; |
|
495 | + $str .= '```' . PHP_EOL; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | if ($this->getText(['example', 'error', 'lang', 'if'])) { |
499 | - $str .= "__{$this->getText(['example', 'error', 'lang'])}__".PHP_EOL; |
|
500 | - $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}".PHP_EOL; |
|
501 | - $str .= '```'.PHP_EOL; |
|
502 | - $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);'.PHP_EOL; |
|
503 | - $str .= '```'.PHP_EOL; |
|
499 | + $str .= "__{$this->getText(['example', 'error', 'lang'])}__" . PHP_EOL; |
|
500 | + $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}" . PHP_EOL; |
|
501 | + $str .= '```' . PHP_EOL; |
|
502 | + $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);' . PHP_EOL; |
|
503 | + $str .= '```' . PHP_EOL; |
|
504 | 504 | } |
505 | 505 | |
506 | - $str .= "__{$this->getText(['example', 'error', 'interception'])}__".PHP_EOL; |
|
507 | - $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}".PHP_EOL; |
|
508 | - $str .= '```'.PHP_EOL; |
|
509 | - $str .= '$captcha->setCauseAnError(true);'.PHP_EOL; |
|
506 | + $str .= "__{$this->getText(['example', 'error', 'interception'])}__" . PHP_EOL; |
|
507 | + $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}" . PHP_EOL; |
|
508 | + $str .= '```' . PHP_EOL; |
|
509 | + $str .= '$captcha->setCauseAnError(true);' . PHP_EOL; |
|
510 | 510 | $str .= PHP_EOL; |
511 | - $str .= 'try {'.PHP_EOL; |
|
511 | + $str .= 'try {' . PHP_EOL; |
|
512 | 512 | $str .= ' $captcha->recognize('; |
513 | 513 | $str .= $this->getRecognizeFile(); |
514 | 514 | $str .= $this->getRecognizeData(); |
515 | - $str .= ');'.PHP_EOL; |
|
516 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
517 | - $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {'.PHP_EOL; |
|
518 | - $str .= ' ...'.PHP_EOL; |
|
519 | - $str .= '}'.PHP_EOL; |
|
520 | - $str .= '```'.PHP_EOL; |
|
515 | + $str .= ');' . PHP_EOL; |
|
516 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
517 | + $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {' . PHP_EOL; |
|
518 | + $str .= ' ...' . PHP_EOL; |
|
519 | + $str .= '}' . PHP_EOL; |
|
520 | + $str .= '```' . PHP_EOL; |
|
521 | 521 | |
522 | 522 | return $str; |
523 | 523 | } |
@@ -531,11 +531,11 @@ discard block |
||
531 | 531 | if ($this->texts['recognize_file']) { |
532 | 532 | $str .= ', '; |
533 | 533 | } |
534 | - $str .= '['.PHP_EOL; |
|
534 | + $str .= '[' . PHP_EOL; |
|
535 | 535 | foreach ($this->texts['recognize_data'] as $key => $val) { |
536 | 536 | $str .= " {$reflection->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
537 | 537 | $str .= is_string($val) ? "'{$val}'" : $val; |
538 | - $str .= ','.PHP_EOL; |
|
538 | + $str .= ',' . PHP_EOL; |
|
539 | 539 | } |
540 | 540 | $str .= ' ]'; |
541 | 541 | } |
@@ -555,8 +555,8 @@ discard block |
||
555 | 555 | protected function viewFields() |
556 | 556 | { |
557 | 557 | $class = $this->class; |
558 | - $str = " {$this->getText(['table', 'th', 'name'])} | {$this->getText(['table', 'th', 'code'])} | {$this->getText(['table', 'th', 'type'])} | {$this->getText(['table', 'th', 'req'])} | {$this->getText(['table', 'th', 'def'])} | {$this->getText(['table', 'th', 'enum'])} | {$this->getText(['table', 'th', 'desc'])} ".PHP_EOL; |
|
559 | - $str .= ' --- | --- | --- | --- | --- | --- | --- '.PHP_EOL; |
|
558 | + $str = " {$this->getText(['table', 'th', 'name'])} | {$this->getText(['table', 'th', 'code'])} | {$this->getText(['table', 'th', 'type'])} | {$this->getText(['table', 'th', 'req'])} | {$this->getText(['table', 'th', 'def'])} | {$this->getText(['table', 'th', 'enum'])} | {$this->getText(['table', 'th', 'desc'])} " . PHP_EOL; |
|
559 | + $str .= ' --- | --- | --- | --- | --- | --- | --- ' . PHP_EOL; |
|
560 | 560 | foreach ($this->class->actions[$class::ACTION_RECOGNIZE][$class::ACTION_FIELDS] as $param => $setting) { |
561 | 561 | if (array_key_exists($class::ACTION_FIELDS, $setting) && is_array($setting[$class::ACTION_FIELDS])) { |
562 | 562 | foreach ($setting[$class::ACTION_FIELDS] as $param1 => $setting1) { |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | $class = $this->class; |
581 | 581 | $str = " {$this->getText(['field', 'main', 'name', $param])} |"; |
582 | 582 | $str .= " {$this->getNameConst('ACTION_FIELD_', $param)} |"; |
583 | - $str .= ' '.substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[$class::PARAM_SLUG_TYPE]), 17).' |'; |
|
584 | - $str .= ' '.(array_key_exists($class::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-').' |'; |
|
585 | - $str .= ' '.(array_key_exists($class::PARAM_SLUG_DEFAULT, $setting) ? $setting[$class::PARAM_SLUG_DEFAULT] : '').' |'; |
|
583 | + $str .= ' ' . substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[$class::PARAM_SLUG_TYPE]), 17) . ' |'; |
|
584 | + $str .= ' ' . (array_key_exists($class::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') . ' |'; |
|
585 | + $str .= ' ' . (array_key_exists($class::PARAM_SLUG_DEFAULT, $setting) ? $setting[$class::PARAM_SLUG_DEFAULT] : '') . ' |'; |
|
586 | 586 | $str .= " {$this->getText(['field', 'slug', $class::PARAM_SLUG_ENUM, $param])} |"; |
587 | 587 | $str .= " {$this->getText(['field', 'main', 'desc', $param])} |"; |
588 | 588 | $str .= PHP_EOL; |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | |
593 | 593 | protected function viewMenu() |
594 | 594 | { |
595 | - $str = "+ [{$this->getText(['slug', 'menu', 'main'])}](../docs/README-{$this->lang}.md)".PHP_EOL; |
|
596 | - $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
|
597 | - $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}".PHP_EOL; |
|
595 | + $str = "+ [{$this->getText(['slug', 'menu', 'main'])}](../docs/README-{$this->lang}.md)" . PHP_EOL; |
|
596 | + $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')' . PHP_EOL; |
|
597 | + $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}" . PHP_EOL; |
|
598 | 598 | foreach ([ |
599 | 599 | ['slug', 'link'], |
600 | 600 | ['slug', 'service', 'desc'], |
@@ -604,14 +604,14 @@ discard block |
||
604 | 604 | ['example'], |
605 | 605 | ['slug', 'fields', 'desc'], |
606 | 606 | ] as $anchor) { |
607 | - $str .= " + [{$this->getText($anchor)}](#".implode('-', explode(' ', ($this->lang === 'en' ? mb_strtolower($this->getText($anchor)) : $this->getText($anchor)))).')'.PHP_EOL; |
|
607 | + $str .= " + [{$this->getText($anchor)}](#" . implode('-', explode(' ', ($this->lang === 'en' ? mb_strtolower($this->getText($anchor)) : $this->getText($anchor)))) . ')' . PHP_EOL; |
|
608 | 608 | } |
609 | 609 | if ($this->getText(['menu', 'from_service'])) { |
610 | - $str .= "+ {$this->getText(['slug', 'menu', 'from_service'])}".PHP_EOL; |
|
610 | + $str .= "+ {$this->getText(['slug', 'menu', 'from_service'])}" . PHP_EOL; |
|
611 | 611 | foreach ($this->texts['menu_from_service'] as $fromServiceClass) { |
612 | 612 | $fromServiceObject = new $fromServiceClass([]); |
613 | 613 | $fromServiceObjectWiki = $fromServiceObject->getWiki($this->lang); |
614 | - $str .= " + [{$fromServiceObjectWiki->getText(['service', 'name'])}](../docs/{$fromServiceObjectWiki->getFileName()})".PHP_EOL; |
|
614 | + $str .= " + [{$fromServiceObjectWiki->getText(['service', 'name'])}](../docs/{$fromServiceObjectWiki->getFileName()})" . PHP_EOL; |
|
615 | 615 | } |
616 | 616 | } |
617 | 617 | |
@@ -633,32 +633,32 @@ discard block |
||
633 | 633 | |
634 | 634 | public function view() |
635 | 635 | { |
636 | - $str = $this->getText(['service', 'name']).PHP_EOL; |
|
637 | - $str .= '=============='.PHP_EOL; |
|
638 | - $str .= "{$this->getText(['slug', 'menu'])}".PHP_EOL; |
|
639 | - $str .= '--------------'.PHP_EOL; |
|
640 | - $str .= $this->viewMenu().PHP_EOL.PHP_EOL; |
|
641 | - $str .= "{$this->getText(['slug', 'link'])}".PHP_EOL; |
|
642 | - $str .= '--------------'.PHP_EOL; |
|
643 | - $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})".PHP_EOL.PHP_EOL; |
|
644 | - $str .= "{$this->getText(['slug', 'service', 'desc'])}".PHP_EOL; |
|
645 | - $str .= '--------------'.PHP_EOL; |
|
646 | - $str .= "{$this->getText(['service', 'desc'])}".PHP_EOL.PHP_EOL; |
|
647 | - $str .= "{$this->getText(['slug', 'price'])}".PHP_EOL; |
|
648 | - $str .= '--------------'.PHP_EOL; |
|
649 | - $str .= "{$this->getText(['recognize', 'price'])}".PHP_EOL.PHP_EOL; |
|
650 | - $str .= "{$this->getText(['slug', 'recognize', 'desc'])}".PHP_EOL; |
|
651 | - $str .= '--------------'.PHP_EOL; |
|
652 | - $str .= "{$this->getText(['recognize', 'desc'])}".PHP_EOL.PHP_EOL; |
|
653 | - $str .= "{$this->getText(['install'])}".PHP_EOL; |
|
654 | - $str .= '--------------'.PHP_EOL; |
|
655 | - $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL; |
|
656 | - $str .= "{$this->getText(['example'])}".PHP_EOL; |
|
657 | - $str .= '--------------'.PHP_EOL; |
|
658 | - $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL; |
|
659 | - $str .= "{$this->getText(['slug', 'fields', 'desc'])}".PHP_EOL; |
|
660 | - $str .= '--------------'.PHP_EOL; |
|
661 | - $str .= $this->viewFields().PHP_EOL; |
|
636 | + $str = $this->getText(['service', 'name']) . PHP_EOL; |
|
637 | + $str .= '==============' . PHP_EOL; |
|
638 | + $str .= "{$this->getText(['slug', 'menu'])}" . PHP_EOL; |
|
639 | + $str .= '--------------' . PHP_EOL; |
|
640 | + $str .= $this->viewMenu() . PHP_EOL . PHP_EOL; |
|
641 | + $str .= "{$this->getText(['slug', 'link'])}" . PHP_EOL; |
|
642 | + $str .= '--------------' . PHP_EOL; |
|
643 | + $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})" . PHP_EOL . PHP_EOL; |
|
644 | + $str .= "{$this->getText(['slug', 'service', 'desc'])}" . PHP_EOL; |
|
645 | + $str .= '--------------' . PHP_EOL; |
|
646 | + $str .= "{$this->getText(['service', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
647 | + $str .= "{$this->getText(['slug', 'price'])}" . PHP_EOL; |
|
648 | + $str .= '--------------' . PHP_EOL; |
|
649 | + $str .= "{$this->getText(['recognize', 'price'])}" . PHP_EOL . PHP_EOL; |
|
650 | + $str .= "{$this->getText(['slug', 'recognize', 'desc'])}" . PHP_EOL; |
|
651 | + $str .= '--------------' . PHP_EOL; |
|
652 | + $str .= "{$this->getText(['recognize', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
653 | + $str .= "{$this->getText(['install'])}" . PHP_EOL; |
|
654 | + $str .= '--------------' . PHP_EOL; |
|
655 | + $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL; |
|
656 | + $str .= "{$this->getText(['example'])}" . PHP_EOL; |
|
657 | + $str .= '--------------' . PHP_EOL; |
|
658 | + $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL; |
|
659 | + $str .= "{$this->getText(['slug', 'fields', 'desc'])}" . PHP_EOL; |
|
660 | + $str .= '--------------' . PHP_EOL; |
|
661 | + $str .= $this->viewFields() . PHP_EOL; |
|
662 | 662 | |
663 | 663 | return $str; |
664 | 664 | } |
@@ -670,11 +670,11 @@ discard block |
||
670 | 670 | } |
671 | 671 | $class = $this->class; |
672 | 672 | |
673 | - return (new \ReflectionClass($class))->getShortName().'-'.$lang.'.md'; |
|
673 | + return (new \ReflectionClass($class))->getShortName() . '-' . $lang . '.md'; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | public function save() |
677 | 677 | { |
678 | - file_put_contents(__DIR__.'/../../docs/'.$this->getFileName(), $this->view()); |
|
678 | + file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName(), $this->view()); |
|
679 | 679 | } |
680 | 680 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__.'/../vendor/autoload.php'; |
|
3 | +include_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | $mainWiki = new \jumper423\decaptcha\core\DeCaptchaWikiMain(new \jumper423\decaptcha\services\RuCaptcha([])); |
6 | 6 | foreach (['ru', 'en'] as $lang) { |
@@ -5,23 +5,23 @@ |
||
5 | 5 | $mainWiki = new \jumper423\decaptcha\core\DeCaptchaWikiMain(new \jumper423\decaptcha\services\RuCaptcha([])); |
6 | 6 | foreach (['ru', 'en'] as $lang) { |
7 | 7 | foreach ([ |
8 | - new \jumper423\decaptcha\services\RuCaptcha([]), |
|
9 | - new \jumper423\decaptcha\services\RuCaptchaReCaptcha([]), |
|
10 | - new \jumper423\decaptcha\services\RuCaptchaInstruction([]), |
|
11 | - new \jumper423\decaptcha\services\RuCaptchaGrid([]), |
|
12 | - new \jumper423\decaptcha\services\RuCaptchaClick([]), |
|
13 | - new \jumper423\decaptcha\services\TwoCaptcha([]), |
|
14 | - new \jumper423\decaptcha\services\TwoCaptchaReCaptcha([]), |
|
15 | - new \jumper423\decaptcha\services\TwoCaptchaInstruction([]), |
|
16 | - new \jumper423\decaptcha\services\TwoCaptchaGrid([]), |
|
17 | - new \jumper423\decaptcha\services\TwoCaptchaClick([]), |
|
18 | - new \jumper423\decaptcha\services\Anticaptcha([]), |
|
19 | - new \jumper423\decaptcha\services\AnticaptchaReCaptcha([]), |
|
20 | - new \jumper423\decaptcha\services\AnticaptchaReCaptchaProxeless([]), |
|
21 | - new \jumper423\decaptcha\services\Captcha24([]), |
|
22 | - new \jumper423\decaptcha\services\Pixodrom([]), |
|
23 | - new \jumper423\decaptcha\services\Ripcaptcha([]), |
|
24 | - ] as $class) { |
|
8 | + new \jumper423\decaptcha\services\RuCaptcha([]), |
|
9 | + new \jumper423\decaptcha\services\RuCaptchaReCaptcha([]), |
|
10 | + new \jumper423\decaptcha\services\RuCaptchaInstruction([]), |
|
11 | + new \jumper423\decaptcha\services\RuCaptchaGrid([]), |
|
12 | + new \jumper423\decaptcha\services\RuCaptchaClick([]), |
|
13 | + new \jumper423\decaptcha\services\TwoCaptcha([]), |
|
14 | + new \jumper423\decaptcha\services\TwoCaptchaReCaptcha([]), |
|
15 | + new \jumper423\decaptcha\services\TwoCaptchaInstruction([]), |
|
16 | + new \jumper423\decaptcha\services\TwoCaptchaGrid([]), |
|
17 | + new \jumper423\decaptcha\services\TwoCaptchaClick([]), |
|
18 | + new \jumper423\decaptcha\services\Anticaptcha([]), |
|
19 | + new \jumper423\decaptcha\services\AnticaptchaReCaptcha([]), |
|
20 | + new \jumper423\decaptcha\services\AnticaptchaReCaptchaProxeless([]), |
|
21 | + new \jumper423\decaptcha\services\Captcha24([]), |
|
22 | + new \jumper423\decaptcha\services\Pixodrom([]), |
|
23 | + new \jumper423\decaptcha\services\Ripcaptcha([]), |
|
24 | + ] as $class) { |
|
25 | 25 | $mainWiki->addClass($class); |
26 | 26 | $class->getWiki($lang)->save(); |
27 | 27 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_KEY => '5464654645646', |
14 | 14 | ]); |
15 | 15 | $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU); |
16 | - if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) { |
|
16 | + if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) { |
|
17 | 17 | $this->assertEquals('11111111111111', $captcha->getCode()); |
18 | 18 | } else { |
19 | 19 | $this->assertEquals('Использован несуществующий key', $captcha->getError()); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | \jumper423\decaptcha\services\Anticaptcha::ACTION_FIELD_LANGUAGE => 'ru', |
28 | 28 | ]); |
29 | 29 | $captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU); |
30 | - if ($captcha->recognize(__DIR__.'/data/Captcha.jpg')) { |
|
30 | + if ($captcha->recognize(__DIR__ . '/data/Captcha.jpg')) { |
|
31 | 31 | $this->assertEquals('11111111111111', $captcha->getCode()); |
32 | 32 | } else { |
33 | 33 | $this->assertEquals('Нет в допустимых значениях поля: languagePool = ru', $captcha->getError()); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function testGetBaseUrl() |
20 | 20 | { |
21 | 21 | $abstract = $this->newInstance(); |
22 | - $getBaseUrlCaller = function () { |
|
22 | + $getBaseUrlCaller = function() { |
|
23 | 23 | $this->host = 'domain'; |
24 | 24 | |
25 | 25 | return $this->getBaseUrl(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $this->assertEquals('http://domain/', $bound()); |
29 | 29 | |
30 | 30 | $abstract = $this->newInstance(); |
31 | - $getBaseUrlCaller = function () { |
|
31 | + $getBaseUrlCaller = function() { |
|
32 | 32 | $this->host = 'domain'; |
33 | 33 | $this->scheme = 'https'; |
34 | 34 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | public function testGetFilePath() |
63 | 63 | { |
64 | 64 | $abstract = $this->newInstance(); |
65 | - $getFilePathCaller = function ($val) { |
|
65 | + $getFilePathCaller = function($val) { |
|
66 | 66 | return $this->getFilePath($val); |
67 | 67 | }; |
68 | 68 | $bound = $getFilePathCaller->bindTo($abstract, $abstract); |
69 | - $this->assertEquals(__DIR__.'/data/Captcha.jpg', $bound(__DIR__.'/data/Captcha.jpg')); |
|
69 | + $this->assertEquals(__DIR__ . '/data/Captcha.jpg', $bound(__DIR__ . '/data/Captcha.jpg')); |
|
70 | 70 | $filePathUpload = $bound('https://upload.wikimedia.org/wikipedia/commons/6/69/Captcha.jpg'); |
71 | - $file1 = file_get_contents(__DIR__.'/data/Captcha.jpg'); |
|
71 | + $file1 = file_get_contents(__DIR__ . '/data/Captcha.jpg'); |
|
72 | 72 | $file2 = file_get_contents($filePathUpload); |
73 | 73 | $this->assertEquals($file1, $file2); |
74 | 74 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | public function testGetFilePathErrorFileNotFound() |
81 | 81 | { |
82 | 82 | $abstract = $this->newInstance(); |
83 | - $getFilePathCaller = function ($val) { |
|
83 | + $getFilePathCaller = function($val) { |
|
84 | 84 | return $this->getFilePath($val); |
85 | 85 | }; |
86 | 86 | $bound = $getFilePathCaller->bindTo($abstract, $abstract); |
87 | - $bound(__DIR__.'/data/Captcha1.jpg'); |
|
87 | + $bound(__DIR__ . '/data/Captcha1.jpg'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | public function testGetFilePathErrorFileIsNotLoaded() |
96 | 96 | { |
97 | 97 | $abstract = $this->newInstance(); |
98 | - $getFilePathCaller = function ($val) { |
|
98 | + $getFilePathCaller = function($val) { |
|
99 | 99 | return $this->getFilePath($val); |
100 | 100 | }; |
101 | 101 | $bound = $getFilePathCaller->bindTo($abstract, $abstract); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | public function testExecutionDelayed() |
118 | 118 | { |
119 | 119 | $abstract = $this->newInstance(); |
120 | - $executionDelayedCaller = function ($second, $call = null) { |
|
120 | + $executionDelayedCaller = function($second, $call = null) { |
|
121 | 121 | return $this->executionDelayed($second, $call); |
122 | 122 | }; |
123 | 123 | $bound = $executionDelayedCaller->bindTo($abstract, $abstract); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $this->assertTrue(abs($timePassed - 0.1) < 0.055); |
129 | 129 | |
130 | 130 | $start = microtime(true); |
131 | - $bound(0.15, function () { |
|
131 | + $bound(0.15, function() { |
|
132 | 132 | sleep(0.2); |
133 | 133 | }); |
134 | 134 | $bound(0.1); |
@@ -136,14 +136,14 @@ discard block |
||
136 | 136 | $this->assertTrue(abs($timePassed - 0.25) < 0.055); |
137 | 137 | |
138 | 138 | $start = microtime(true); |
139 | - $bound(0.15, function () { |
|
139 | + $bound(0.15, function() { |
|
140 | 140 | sleep(0.2); |
141 | 141 | }); |
142 | 142 | $bound(0.3); |
143 | 143 | $timePassed = microtime(true) - $start; |
144 | 144 | $this->assertTrue(abs($timePassed - 0.45) < 0.055); |
145 | 145 | |
146 | - $this->assertEquals(2, $bound(0, function () { |
|
146 | + $this->assertEquals(2, $bound(0, function() { |
|
147 | 147 | return 2; |
148 | 148 | })); |
149 | 149 | $this->assertEquals(null, $bound(0)); |
@@ -87,12 +87,12 @@ |
||
87 | 87 | { |
88 | 88 | $str = "+ [{$this->getText(['slug', 'menu', 'another'])}](../{$master}docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
89 | 89 | foreach ([ |
90 | - ['slug', 'menu', 'desc'], |
|
91 | - ['slug', 'menu', 'features'], |
|
92 | - ['slug', 'menu', 'services'], |
|
93 | - ['install'], |
|
94 | - ['example'], |
|
95 | - ] as $anchor) { |
|
90 | + ['slug', 'menu', 'desc'], |
|
91 | + ['slug', 'menu', 'features'], |
|
92 | + ['slug', 'menu', 'services'], |
|
93 | + ['install'], |
|
94 | + ['example'], |
|
95 | + ] as $anchor) { |
|
96 | 96 | $str .= "+ [{$this->getText($anchor)}](#".implode('-', explode(' ', ($this->lang === 'en' ? mb_strtolower($this->getText($anchor)) : $this->getText($anchor)))).')'.PHP_EOL; |
97 | 97 | } |
98 | 98 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | protected function viewMenu($master = '') |
87 | 87 | { |
88 | - $str = "+ [{$this->getText(['slug', 'menu', 'another'])}](../{$master}docs/".$this->getFileName($this->lang == 'ru' ? 'en' : 'ru').')'.PHP_EOL; |
|
88 | + $str = "+ [{$this->getText(['slug', 'menu', 'another'])}](../{$master}docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')' . PHP_EOL; |
|
89 | 89 | foreach ([ |
90 | 90 | ['slug', 'menu', 'desc'], |
91 | 91 | ['slug', 'menu', 'features'], |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | ['install'], |
94 | 94 | ['example'], |
95 | 95 | ] as $anchor) { |
96 | - $str .= "+ [{$this->getText($anchor)}](#".implode('-', explode(' ', ($this->lang === 'en' ? mb_strtolower($this->getText($anchor)) : $this->getText($anchor)))).')'.PHP_EOL; |
|
96 | + $str .= "+ [{$this->getText($anchor)}](#" . implode('-', explode(' ', ($this->lang === 'en' ? mb_strtolower($this->getText($anchor)) : $this->getText($anchor)))) . ')' . PHP_EOL; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $str; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | $tt[$class->getWiki($this->lang)->getFileName()] = true; |
111 | 111 | $fromServiceObjectWiki = $class->getWiki($this->lang); |
112 | - $str .= "+ [{$fromServiceObjectWiki->getText(['service', 'name'])}](../{$master}docs/{$fromServiceObjectWiki->getFileName()})".PHP_EOL; |
|
112 | + $str .= "+ [{$fromServiceObjectWiki->getText(['service', 'name'])}](../{$master}docs/{$fromServiceObjectWiki->getFileName()})" . PHP_EOL; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return $str; |
@@ -117,31 +117,31 @@ discard block |
||
117 | 117 | |
118 | 118 | public function view($master = '') |
119 | 119 | { |
120 | - $str = $this->viewHeader().PHP_EOL; |
|
120 | + $str = $this->viewHeader() . PHP_EOL; |
|
121 | 121 | |
122 | - $str .= "{$this->getText(['slug', 'menu'])}".PHP_EOL; |
|
123 | - $str .= '--------------'.PHP_EOL; |
|
124 | - $str .= $this->viewMenu($master).PHP_EOL.PHP_EOL; |
|
122 | + $str .= "{$this->getText(['slug', 'menu'])}" . PHP_EOL; |
|
123 | + $str .= '--------------' . PHP_EOL; |
|
124 | + $str .= $this->viewMenu($master) . PHP_EOL . PHP_EOL; |
|
125 | 125 | |
126 | - $str .= "{$this->getText(['slug', 'menu', 'desc'])}".PHP_EOL; |
|
127 | - $str .= '--------------'.PHP_EOL; |
|
128 | - $str .= $this->getText(['readme', 'main', 'desc']).PHP_EOL.PHP_EOL; |
|
126 | + $str .= "{$this->getText(['slug', 'menu', 'desc'])}" . PHP_EOL; |
|
127 | + $str .= '--------------' . PHP_EOL; |
|
128 | + $str .= $this->getText(['readme', 'main', 'desc']) . PHP_EOL . PHP_EOL; |
|
129 | 129 | |
130 | - $str .= "{$this->getText(['slug', 'menu', 'features'])}".PHP_EOL; |
|
131 | - $str .= '--------------'.PHP_EOL; |
|
132 | - $str .= $this->getText(['readme', 'main', 'features'], PHP_EOL).PHP_EOL.PHP_EOL; |
|
130 | + $str .= "{$this->getText(['slug', 'menu', 'features'])}" . PHP_EOL; |
|
131 | + $str .= '--------------' . PHP_EOL; |
|
132 | + $str .= $this->getText(['readme', 'main', 'features'], PHP_EOL) . PHP_EOL . PHP_EOL; |
|
133 | 133 | |
134 | - $str .= "{$this->getText(['slug', 'menu', 'services'])}".PHP_EOL; |
|
135 | - $str .= '--------------'.PHP_EOL; |
|
136 | - $str .= "{$this->getText(['readme', 'main', 'services'])}".PHP_EOL.PHP_EOL; |
|
137 | - $str .= "{$this->viewServices($master)}".PHP_EOL.PHP_EOL; |
|
134 | + $str .= "{$this->getText(['slug', 'menu', 'services'])}" . PHP_EOL; |
|
135 | + $str .= '--------------' . PHP_EOL; |
|
136 | + $str .= "{$this->getText(['readme', 'main', 'services'])}" . PHP_EOL . PHP_EOL; |
|
137 | + $str .= "{$this->viewServices($master)}" . PHP_EOL . PHP_EOL; |
|
138 | 138 | |
139 | - $str .= "{$this->getText(['install'])}".PHP_EOL; |
|
140 | - $str .= '--------------'.PHP_EOL; |
|
141 | - $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL; |
|
142 | - $str .= "{$this->getText(['example'])}".PHP_EOL; |
|
143 | - $str .= '--------------'.PHP_EOL; |
|
144 | - $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL; |
|
139 | + $str .= "{$this->getText(['install'])}" . PHP_EOL; |
|
140 | + $str .= '--------------' . PHP_EOL; |
|
141 | + $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL; |
|
142 | + $str .= "{$this->getText(['example'])}" . PHP_EOL; |
|
143 | + $str .= '--------------' . PHP_EOL; |
|
144 | + $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL; |
|
145 | 145 | |
146 | 146 | return $str; |
147 | 147 | } |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $lang = $this->lang; |
153 | 153 | } |
154 | 154 | |
155 | - return 'README-'.$lang.'.md'; |
|
155 | + return 'README-' . $lang . '.md'; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | public function save() |
159 | 159 | { |
160 | - file_put_contents(__DIR__.'/../../docs/'.$this->getFileName(), $this->view()); |
|
161 | - file_put_contents(__DIR__.'/../../README.md', $this->view('master/')); |
|
160 | + file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName(), $this->view()); |
|
161 | + file_put_contents(__DIR__ . '/../../README.md', $this->view('master/')); |
|
162 | 162 | } |
163 | 163 | } |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action]; |
104 | 104 | $decodeFormat = array_key_exists(static::DECODE_FORMAT, $decodeSetting) ? |
105 | - $decodeSetting[static::DECODE_FORMAT] : |
|
106 | - $this->decodeSettings[static::DECODE_FORMAT]; |
|
105 | + $decodeSetting[static::DECODE_FORMAT] : $this->decodeSettings[static::DECODE_FORMAT]; |
|
107 | 106 | $values = []; |
108 | 107 | switch ($decodeFormat) { |
109 | 108 | case static::RESPONSE_TYPE_STRING: |
@@ -180,7 +179,7 @@ discard block |
||
180 | 179 | */ |
181 | 180 | protected function getActionUrl($action) |
182 | 181 | { |
183 | - return $this->getBaseUrl().$this->actions[$action][static::ACTION_URI]; |
|
182 | + return $this->getBaseUrl() . $this->actions[$action][static::ACTION_URI]; |
|
184 | 183 | } |
185 | 184 | |
186 | 185 | /** |
@@ -237,7 +236,7 @@ discard block |
||
237 | 236 | return base64_encode(file_get_contents($this->params[$param])); |
238 | 237 | } |
239 | 238 | |
240 | - return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@'.$this->getFilePath($this->params[$param]); |
|
239 | + return (version_compare(PHP_VERSION, '5.5.0') >= 0) ? new \CURLFile($this->getFilePath($this->params[$param])) : '@' . $this->getFilePath($this->params[$param]); |
|
241 | 240 | case static::PARAM_SPEC_API_KEY: |
242 | 241 | return is_callable($this->params[$param]) ? $this->params[$param]() : $this->params[$param]; |
243 | 242 | case static::PARAM_SPEC_CAPTCHA: |
@@ -300,7 +299,7 @@ discard block |
||
300 | 299 | break; |
301 | 300 | } |
302 | 301 | if (array_key_exists(self::PARAM_SLUG_ENUM, $settings) && !in_array($value, $settings[static::PARAM_SLUG_ENUM])) { |
303 | - throw new DeCaptchaErrors(DeCaptchaErrors::ERROR_PARAM_ENUM, (array_key_exists($field, $this->paramsNames) ? $this->paramsNames[$field] : $field).' = '.$value, $this->errorLang); |
|
302 | + throw new DeCaptchaErrors(DeCaptchaErrors::ERROR_PARAM_ENUM, (array_key_exists($field, $this->paramsNames) ? $this->paramsNames[$field] : $field) . ' = ' . $value, $this->errorLang); |
|
304 | 303 | } |
305 | 304 | $params[$this->paramsNames[$field]] = $value; |
306 | 305 | } |
@@ -364,7 +363,7 @@ discard block |
||
364 | 363 | foreach ($data as $key => $value) { |
365 | 364 | $uri[] = "$key=$value"; |
366 | 365 | } |
367 | - $url .= '?'.implode('&', $uri); |
|
366 | + $url .= '?' . implode('&', $uri); |
|
368 | 367 | } |
369 | 368 | curl_setopt($curl, CURLOPT_URL, $url); |
370 | 369 | if (!$isJson && version_compare(PHP_VERSION, '5.5.0') >= 0 && version_compare(PHP_VERSION, '7.0') < 0 && defined('CURLOPT_SAFE_UPLOAD')) { |
@@ -382,7 +381,7 @@ discard block |
||
382 | 381 | curl_setopt($curl, CURLOPT_HTTPHEADER, [ |
383 | 382 | 'Content-Type: application/json; charset=utf-8', |
384 | 383 | 'Accept: application/json', |
385 | - 'Content-Length: '.strlen($data), |
|
384 | + 'Content-Length: ' . strlen($data), |
|
386 | 385 | ]); |
387 | 386 | } |
388 | 387 | $result = curl_exec($curl); |