@@ -519,14 +519,14 @@ |
||
| 519 | 519 | $str .= "+ [{$this->getText(['slug','menu','another'])}](../blob/master/docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')'.PHP_EOL; |
| 520 | 520 | $str .= "+ {$this->getText(['slug','menu','anchor'])}".PHP_EOL; |
| 521 | 521 | foreach ([ |
| 522 | - ['slug', 'link'], |
|
| 523 | - ['slug', 'service', 'desc'], |
|
| 524 | - ['slug', 'price'], |
|
| 525 | - ['slug', 'recognize', 'desc'], |
|
| 526 | - ['install'], |
|
| 527 | - ['example'], |
|
| 528 | - ['slug', 'fields', 'desc'] |
|
| 529 | - ] as $anchor) { |
|
| 522 | + ['slug', 'link'], |
|
| 523 | + ['slug', 'service', 'desc'], |
|
| 524 | + ['slug', 'price'], |
|
| 525 | + ['slug', 'recognize', 'desc'], |
|
| 526 | + ['install'], |
|
| 527 | + ['example'], |
|
| 528 | + ['slug', 'fields', 'desc'] |
|
| 529 | + ] as $anchor) { |
|
| 530 | 530 | $str .= " + [{$this->getText($anchor)}](#".implode('-', explode(' ', $this->getText($anchor))).")".PHP_EOL; |
| 531 | 531 | } |
| 532 | 532 | if ($this->getText(['menu','from_service'])) { |
@@ -29,160 +29,160 @@ 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 | ], |
| 35 | - 'field_main_desc_'.$class::ACTION_FIELD_KEY => [ |
|
| 35 | + 'field_main_desc_' . $class::ACTION_FIELD_KEY => [ |
|
| 36 | 36 | 'ru' => 'Ключ от учетной записи', |
| 37 | 37 | ], |
| 38 | - 'field_main_name_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
| 38 | + 'field_main_name_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
| 39 | 39 | 'ru' => 'Язык', |
| 40 | 40 | ], |
| 41 | - 'field_main_desc_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
| 41 | + 'field_main_desc_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
| 42 | 42 | 'ru' => 'На каком языке текст на капче', |
| 43 | 43 | ], |
| 44 | - 'field_main_name_'.$class::ACTION_FIELD_FILE => [ |
|
| 44 | + 'field_main_name_' . $class::ACTION_FIELD_FILE => [ |
|
| 45 | 45 | 'ru' => 'Картинка', |
| 46 | 46 | ], |
| 47 | - 'field_main_desc_'.$class::ACTION_FIELD_FILE => [ |
|
| 47 | + 'field_main_desc_' . $class::ACTION_FIELD_FILE => [ |
|
| 48 | 48 | 'ru' => 'Путь на файл с картинкой или ссылка на него', |
| 49 | 49 | ], |
| 50 | - 'field_main_name_'.$class::ACTION_FIELD_PHRASE => [ |
|
| 50 | + 'field_main_name_' . $class::ACTION_FIELD_PHRASE => [ |
|
| 51 | 51 | 'ru' => 'Несколько слов', |
| 52 | 52 | ], |
| 53 | - 'field_main_desc_'.$class::ACTION_FIELD_PHRASE => [ |
|
| 53 | + 'field_main_desc_' . $class::ACTION_FIELD_PHRASE => [ |
|
| 54 | 54 | 'ru' => 'Работник должен ввести текст с одним или несколькими пробелами', |
| 55 | 55 | ], |
| 56 | - 'field_main_name_'.$class::ACTION_FIELD_REGSENSE => [ |
|
| 56 | + 'field_main_name_' . $class::ACTION_FIELD_REGSENSE => [ |
|
| 57 | 57 | 'ru' => 'Регистр', |
| 58 | 58 | ], |
| 59 | - 'field_main_desc_'.$class::ACTION_FIELD_REGSENSE => [ |
|
| 59 | + 'field_main_desc_' . $class::ACTION_FIELD_REGSENSE => [ |
|
| 60 | 60 | 'ru' => 'Работник должен ввсести ответ с учетом регистра', |
| 61 | 61 | ], |
| 62 | - 'field_main_name_'.$class::ACTION_FIELD_NUMERIC => [ |
|
| 62 | + 'field_main_name_' . $class::ACTION_FIELD_NUMERIC => [ |
|
| 63 | 63 | 'ru' => 'Символы', |
| 64 | 64 | ], |
| 65 | - 'field_main_desc_'.$class::ACTION_FIELD_NUMERIC => [ |
|
| 65 | + 'field_main_desc_' . $class::ACTION_FIELD_NUMERIC => [ |
|
| 66 | 66 | 'ru' => 'Какие символы используется в капче', |
| 67 | 67 | ], |
| 68 | - 'field_main_name_'.$class::ACTION_FIELD_CALC => [ |
|
| 68 | + 'field_main_name_' . $class::ACTION_FIELD_CALC => [ |
|
| 69 | 69 | 'ru' => 'Вычисление', |
| 70 | 70 | ], |
| 71 | - 'field_main_desc_'.$class::ACTION_FIELD_CALC => [ |
|
| 71 | + 'field_main_desc_' . $class::ACTION_FIELD_CALC => [ |
|
| 72 | 72 | 'ru' => 'На капче изображенно математичекая выражение и её необходимо решить', |
| 73 | 73 | ], |
| 74 | - 'field_main_name_'.$class::ACTION_FIELD_MIN_LEN => [ |
|
| 74 | + 'field_main_name_' . $class::ACTION_FIELD_MIN_LEN => [ |
|
| 75 | 75 | 'ru' => 'Длина min', |
| 76 | 76 | ], |
| 77 | - 'field_main_desc_'.$class::ACTION_FIELD_MIN_LEN => [ |
|
| 77 | + 'field_main_desc_' . $class::ACTION_FIELD_MIN_LEN => [ |
|
| 78 | 78 | 'ru' => 'Минимальная длина капчи', |
| 79 | 79 | ], |
| 80 | - 'field_main_name_'.$class::ACTION_FIELD_MAX_LEN => [ |
|
| 80 | + 'field_main_name_' . $class::ACTION_FIELD_MAX_LEN => [ |
|
| 81 | 81 | 'ru' => 'Длина max', |
| 82 | 82 | ], |
| 83 | - 'field_main_desc_'.$class::ACTION_FIELD_MAX_LEN => [ |
|
| 83 | + 'field_main_desc_' . $class::ACTION_FIELD_MAX_LEN => [ |
|
| 84 | 84 | 'ru' => 'Максимальная длина капчи', |
| 85 | 85 | ], |
| 86 | - 'field_main_name_'.$class::ACTION_FIELD_QUESTION => [ |
|
| 86 | + 'field_main_name_' . $class::ACTION_FIELD_QUESTION => [ |
|
| 87 | 87 | 'ru' => 'Вопрос', |
| 88 | 88 | ], |
| 89 | - 'field_main_desc_'.$class::ACTION_FIELD_QUESTION => [ |
|
| 89 | + 'field_main_desc_' . $class::ACTION_FIELD_QUESTION => [ |
|
| 90 | 90 | 'ru' => 'На изображении задан вопрос, работник должен написать ответ', |
| 91 | 91 | ], |
| 92 | - 'field_main_name_'.$class::ACTION_FIELD_IS_RUSSIAN => [ |
|
| 92 | + 'field_main_name_' . $class::ACTION_FIELD_IS_RUSSIAN => [ |
|
| 93 | 93 | 'ru' => 'Кириллица', |
| 94 | 94 | ], |
| 95 | - 'field_main_desc_'.$class::ACTION_FIELD_IS_RUSSIAN => [ |
|
| 95 | + 'field_main_desc_' . $class::ACTION_FIELD_IS_RUSSIAN => [ |
|
| 96 | 96 | 'ru' => 'На изображении присутствуют русские символы', |
| 97 | 97 | ], |
| 98 | - 'field_main_name_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
| 98 | + 'field_main_name_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
| 99 | 99 | 'ru' => 'Язык', |
| 100 | 100 | ], |
| 101 | - 'field_main_desc_'.$class::ACTION_FIELD_LANGUAGE => [ |
|
| 101 | + 'field_main_desc_' . $class::ACTION_FIELD_LANGUAGE => [ |
|
| 102 | 102 | 'ru' => 'Символы какого языка размещенны на капче', |
| 103 | 103 | ], |
| 104 | - 'field_main_name_'.$class::ACTION_FIELD_HEADER_ACAO => [ |
|
| 104 | + 'field_main_name_' . $class::ACTION_FIELD_HEADER_ACAO => [ |
|
| 105 | 105 | 'ru' => 'Кросс-доменный', |
| 106 | 106 | ], |
| 107 | - 'field_main_desc_'.$class::ACTION_FIELD_HEADER_ACAO => [ |
|
| 107 | + 'field_main_desc_' . $class::ACTION_FIELD_HEADER_ACAO => [ |
|
| 108 | 108 | 'ru' => 'Необходимо для кросс-доменных AJAX запросов в браузерных приложениях.', |
| 109 | 109 | ], |
| 110 | - 'field_main_name_'.$class::ACTION_FIELD_INSTRUCTIONS => [ |
|
| 110 | + 'field_main_name_' . $class::ACTION_FIELD_INSTRUCTIONS => [ |
|
| 111 | 111 | 'ru' => 'Инструкция', |
| 112 | 112 | ], |
| 113 | - 'field_main_desc_'.$class::ACTION_FIELD_INSTRUCTIONS => [ |
|
| 113 | + 'field_main_desc_' . $class::ACTION_FIELD_INSTRUCTIONS => [ |
|
| 114 | 114 | 'ru' => 'Текстовая капча или инструкция для прохождения капчи.', |
| 115 | 115 | ], |
| 116 | - 'field_main_name_'.$class::ACTION_FIELD_PINGBACK => [ |
|
| 116 | + 'field_main_name_' . $class::ACTION_FIELD_PINGBACK => [ |
|
| 117 | 117 | 'ru' => 'Ответ на', |
| 118 | 118 | ], |
| 119 | - 'field_main_desc_'.$class::ACTION_FIELD_PINGBACK => [ |
|
| 119 | + 'field_main_desc_' . $class::ACTION_FIELD_PINGBACK => [ |
|
| 120 | 120 | 'ru' => 'Указание для сервера, что после распознания изображения, нужно отправить ответ на указанный адрес.', |
| 121 | 121 | ], |
| 122 | - 'field_main_name_'.$class::ACTION_FIELD_LABEL => [ |
|
| 122 | + 'field_main_name_' . $class::ACTION_FIELD_LABEL => [ |
|
| 123 | 123 | 'ru' => 'От куда', |
| 124 | 124 | ], |
| 125 | - 'field_main_desc_'.$class::ACTION_FIELD_LABEL => [ |
|
| 125 | + 'field_main_desc_' . $class::ACTION_FIELD_LABEL => [ |
|
| 126 | 126 | 'ru' => 'Пояснение от куда пришла капча ("vk", "google", "recaptcha", "yandex", "mailru", "yahoo" и т.д.).', |
| 127 | 127 | ], |
| 128 | - 'field_main_name_'.$class::ACTION_FIELD_PAGEURL => [ |
|
| 128 | + 'field_main_name_' . $class::ACTION_FIELD_PAGEURL => [ |
|
| 129 | 129 | 'ru' => 'Адрес', |
| 130 | 130 | ], |
| 131 | - 'field_main_desc_'.$class::ACTION_FIELD_PAGEURL => [ |
|
| 131 | + 'field_main_desc_' . $class::ACTION_FIELD_PAGEURL => [ |
|
| 132 | 132 | 'ru' => 'Адрес страницы на которой решается капча.', |
| 133 | 133 | ], |
| 134 | - 'field_main_name_'.$class::ACTION_FIELD_GOOGLEKEY => [ |
|
| 134 | + 'field_main_name_' . $class::ACTION_FIELD_GOOGLEKEY => [ |
|
| 135 | 135 | 'ru' => 'Google key', |
| 136 | 136 | ], |
| 137 | - 'field_main_desc_'.$class::ACTION_FIELD_GOOGLEKEY => [ |
|
| 137 | + 'field_main_desc_' . $class::ACTION_FIELD_GOOGLEKEY => [ |
|
| 138 | 138 | 'ru' => 'Ключ-индентификатор рекапчи на целевой странице. <div class="g-recaptcha" data-sitekey="ВОТ_ЭТОТ"></div>', |
| 139 | 139 | ], |
| 140 | - 'field_main_name_'.$class::ACTION_FIELD_GOOGLETOKEN => [ |
|
| 140 | + 'field_main_name_' . $class::ACTION_FIELD_GOOGLETOKEN => [ |
|
| 141 | 141 | 'ru' => 'Google token', |
| 142 | 142 | ], |
| 143 | - 'field_main_desc_'.$class::ACTION_FIELD_GOOGLETOKEN => [ |
|
| 143 | + 'field_main_desc_' . $class::ACTION_FIELD_GOOGLETOKEN => [ |
|
| 144 | 144 | 'ru' => 'Секретный токен для предыдущей версии рекапчи. В большинстве случаев сайты используют новую версию и этот токен не требуется. Секретный токен генерируется на сервере Google и вставляется на страницу в атрибуте data-stoken. Выглядит это примерно так: <script type="text/javascript" src="...." data-type="normal" data-ray="..." async data-sitekey="..." data-stoken="ВОТ_ЭТОТ"></script> Токен действует пару минут после генерации, затем нужно снова зайти на страницу и получить его.', |
| 145 | 145 | ], |
| 146 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYTYPE => [ |
|
| 146 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYTYPE => [ |
|
| 147 | 147 | 'ru' => 'Тип прокси', |
| 148 | 148 | ], |
| 149 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYTYPE => [ |
|
| 149 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYTYPE => [ |
|
| 150 | 150 | 'ru' => 'Тип прокси (http, socks4, ...)', |
| 151 | 151 | ], |
| 152 | - 'field_main_name_'.$class::ACTION_FIELD_PROXY => [ |
|
| 152 | + 'field_main_name_' . $class::ACTION_FIELD_PROXY => [ |
|
| 153 | 153 | 'ru' => 'Адрес прокси', |
| 154 | 154 | ], |
| 155 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXY => [ |
|
| 155 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXY => [ |
|
| 156 | 156 | 'ru' => 'IP адрес прокси ipv4/ipv6.', |
| 157 | 157 | ], |
| 158 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYPORT => [ |
|
| 158 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYPORT => [ |
|
| 159 | 159 | 'ru' => 'Порт прокси', |
| 160 | 160 | ], |
| 161 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYPORT => [ |
|
| 161 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYPORT => [ |
|
| 162 | 162 | 'ru' => 'Порт прокси.', |
| 163 | 163 | ], |
| 164 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYLOGIN => [ |
|
| 164 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYLOGIN => [ |
|
| 165 | 165 | 'ru' => 'Логин прокси', |
| 166 | 166 | ], |
| 167 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYLOGIN => [ |
|
| 167 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYLOGIN => [ |
|
| 168 | 168 | 'ru' => 'Логин от прокси-сервера.', |
| 169 | 169 | ], |
| 170 | - 'field_main_name_'.$class::ACTION_FIELD_PROXYPASS => [ |
|
| 170 | + 'field_main_name_' . $class::ACTION_FIELD_PROXYPASS => [ |
|
| 171 | 171 | 'ru' => 'Пароль прокси', |
| 172 | 172 | ], |
| 173 | - 'field_main_desc_'.$class::ACTION_FIELD_PROXYPASS => [ |
|
| 173 | + 'field_main_desc_' . $class::ACTION_FIELD_PROXYPASS => [ |
|
| 174 | 174 | 'ru' => 'Пароль от прокси-сервера.', |
| 175 | 175 | ], |
| 176 | - 'field_main_name_'.$class::ACTION_FIELD_USERAGENT => [ |
|
| 176 | + 'field_main_name_' . $class::ACTION_FIELD_USERAGENT => [ |
|
| 177 | 177 | 'ru' => 'User-Agent браузера', |
| 178 | 178 | ], |
| 179 | - 'field_main_desc_'.$class::ACTION_FIELD_USERAGENT => [ |
|
| 179 | + 'field_main_desc_' . $class::ACTION_FIELD_USERAGENT => [ |
|
| 180 | 180 | 'ru' => 'User-Agent браузера, используемый в эмуляции. Необходимо использовать подпись современного браузера, иначе Google будет возвращать ошибку, требуя обновить браузер.', |
| 181 | 181 | ], |
| 182 | - 'field_main_name_'.$class::ACTION_FIELD_COOKIES => [ |
|
| 182 | + 'field_main_name_' . $class::ACTION_FIELD_COOKIES => [ |
|
| 183 | 183 | 'ru' => 'Куки', |
| 184 | 184 | ], |
| 185 | - 'field_main_desc_'.$class::ACTION_FIELD_COOKIES => [ |
|
| 185 | + 'field_main_desc_' . $class::ACTION_FIELD_COOKIES => [ |
|
| 186 | 186 | 'ru' => 'Дополнительные cookies которые мы должны использовать во время взаимодействия с целевой страницей.', |
| 187 | 187 | ], |
| 188 | 188 | 'table_th_name' => [ |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | public function getText($name, $separator = '; ') |
| 321 | 321 | { |
| 322 | - $getResult = function ($name, $texts) { |
|
| 322 | + $getResult = function($name, $texts) { |
|
| 323 | 323 | if (is_array($name)) { |
| 324 | 324 | $name = implode('_', $name); |
| 325 | 325 | } |
@@ -348,17 +348,17 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | private function viewInstall() |
| 350 | 350 | { |
| 351 | - $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/).".PHP_EOL; |
|
| 351 | + $str = "{$this->getText(['install', 'preferred'])} [composer](http://getcomposer.org/download/)." . PHP_EOL; |
|
| 352 | 352 | $str .= PHP_EOL; |
| 353 | - $str .= "{$this->getText(['install', 'start'])}".PHP_EOL; |
|
| 354 | - $str .= '```'.PHP_EOL; |
|
| 355 | - $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"'.PHP_EOL; |
|
| 356 | - $str .= '```'.PHP_EOL; |
|
| 357 | - $str .= "{$this->getText(['install', 'add'])}".PHP_EOL; |
|
| 358 | - $str .= '```'.PHP_EOL; |
|
| 359 | - $str .= '"jumper423/decaptcha": "*"'.PHP_EOL; |
|
| 360 | - $str .= '```'.PHP_EOL; |
|
| 361 | - $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`.".PHP_EOL; |
|
| 353 | + $str .= "{$this->getText(['install', 'start'])}" . PHP_EOL; |
|
| 354 | + $str .= '```' . PHP_EOL; |
|
| 355 | + $str .= 'php composer.phar require --prefer-dist jumper423/decaptcha "*"' . PHP_EOL; |
|
| 356 | + $str .= '```' . PHP_EOL; |
|
| 357 | + $str .= "{$this->getText(['install', 'add'])}" . PHP_EOL; |
|
| 358 | + $str .= '```' . PHP_EOL; |
|
| 359 | + $str .= '"jumper423/decaptcha": "*"' . PHP_EOL; |
|
| 360 | + $str .= '```' . PHP_EOL; |
|
| 361 | + $str .= "{$this->getText(['install', 'add', 'file'])} `composer.json`." . PHP_EOL; |
|
| 362 | 362 | |
| 363 | 363 | return $str; |
| 364 | 364 | } |
@@ -368,12 +368,12 @@ discard block |
||
| 368 | 368 | $class = $this->class; |
| 369 | 369 | $rc = (new \ReflectionClass($class)); |
| 370 | 370 | |
| 371 | - $str = "#####{$this->getText(['example', 'initialization'])}".PHP_EOL; |
|
| 372 | - $str .= "{$this->getText(['example', 'initialization', 'desc'])}".PHP_EOL; |
|
| 373 | - $str .= '```'.PHP_EOL; |
|
| 374 | - $str .= "use {$rc->getName()};".PHP_EOL; |
|
| 375 | - $str .= ''.PHP_EOL; |
|
| 376 | - $str .= '$captcha = new '.$rc->getShortName().'(['.PHP_EOL; |
|
| 371 | + $str = "#####{$this->getText(['example', 'initialization'])}" . PHP_EOL; |
|
| 372 | + $str .= "{$this->getText(['example', 'initialization', 'desc'])}" . PHP_EOL; |
|
| 373 | + $str .= '```' . PHP_EOL; |
|
| 374 | + $str .= "use {$rc->getName()};" . PHP_EOL; |
|
| 375 | + $str .= '' . PHP_EOL; |
|
| 376 | + $str .= '$captcha = new ' . $rc->getShortName() . '([' . PHP_EOL; |
|
| 377 | 377 | foreach ($this->texts['constructor_data'] as $key => $val) { |
| 378 | 378 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
| 379 | 379 | if (is_string($val)) { |
@@ -381,14 +381,14 @@ discard block |
||
| 381 | 381 | } else { |
| 382 | 382 | $str .= "{$val}"; |
| 383 | 383 | } |
| 384 | - $str .= ','.PHP_EOL; |
|
| 384 | + $str .= ',' . PHP_EOL; |
|
| 385 | 385 | } |
| 386 | - $str .= ']);'.PHP_EOL; |
|
| 387 | - $str .= '```'.PHP_EOL; |
|
| 386 | + $str .= ']);' . PHP_EOL; |
|
| 387 | + $str .= '```' . PHP_EOL; |
|
| 388 | 388 | |
| 389 | - $str .= "#####{$this->getText(['example', 'recognize'])}".PHP_EOL; |
|
| 390 | - $str .= "{$this->getText(['example', 'recognize', 'desc'])}".PHP_EOL; |
|
| 391 | - $str .= '```'.PHP_EOL; |
|
| 389 | + $str .= "#####{$this->getText(['example', 'recognize'])}" . PHP_EOL; |
|
| 390 | + $str .= "{$this->getText(['example', 'recognize', 'desc'])}" . PHP_EOL; |
|
| 391 | + $str .= '```' . PHP_EOL; |
|
| 392 | 392 | $str .= 'if ($captcha->recognize('; |
| 393 | 393 | if ($this->texts['recognize_file']) { |
| 394 | 394 | $str .= "'{$this->getText(['recognize', 'data', 'file'])}'"; |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | if ($this->texts['recognize_file']) { |
| 398 | 398 | $str .= ', '; |
| 399 | 399 | } |
| 400 | - $str .= '['.PHP_EOL; |
|
| 400 | + $str .= '[' . PHP_EOL; |
|
| 401 | 401 | foreach ($this->texts['recognize_data'] as $key => $val) { |
| 402 | 402 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
| 403 | 403 | if (is_string($val)) { |
@@ -405,46 +405,46 @@ discard block |
||
| 405 | 405 | } else { |
| 406 | 406 | $str .= "{$val}"; |
| 407 | 407 | } |
| 408 | - $str .= ','.PHP_EOL; |
|
| 408 | + $str .= ',' . PHP_EOL; |
|
| 409 | 409 | } |
| 410 | 410 | $str .= ']'; |
| 411 | 411 | } |
| 412 | - $str .= ')) {'.PHP_EOL; |
|
| 413 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
| 414 | - $str .= '} else {'.PHP_EOL; |
|
| 415 | - $str .= ' $error = $captcha->getError();'.PHP_EOL; |
|
| 416 | - $str .= '}'.PHP_EOL; |
|
| 417 | - $str .= '```'.PHP_EOL; |
|
| 412 | + $str .= ')) {' . PHP_EOL; |
|
| 413 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
| 414 | + $str .= '} else {' . PHP_EOL; |
|
| 415 | + $str .= ' $error = $captcha->getError();' . PHP_EOL; |
|
| 416 | + $str .= '}' . PHP_EOL; |
|
| 417 | + $str .= '```' . PHP_EOL; |
|
| 418 | 418 | |
| 419 | 419 | if (in_array('notTrue', get_class_methods($class))) { |
| 420 | - $str .= "#####{$this->getText(['example', 'nottrue'])}".PHP_EOL; |
|
| 421 | - $str .= "{$this->getText(['example', 'nottrue', 'desc'])}".PHP_EOL; |
|
| 422 | - $str .= '```'.PHP_EOL; |
|
| 423 | - $str .= '$captcha->notTrue();'.PHP_EOL; |
|
| 424 | - $str .= '```'.PHP_EOL; |
|
| 420 | + $str .= "#####{$this->getText(['example', 'nottrue'])}" . PHP_EOL; |
|
| 421 | + $str .= "{$this->getText(['example', 'nottrue', 'desc'])}" . PHP_EOL; |
|
| 422 | + $str .= '```' . PHP_EOL; |
|
| 423 | + $str .= '$captcha->notTrue();' . PHP_EOL; |
|
| 424 | + $str .= '```' . PHP_EOL; |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | if (in_array('getBalance', get_class_methods($class))) { |
| 428 | - $str .= "#####{$this->getText(['example', 'balance'])}".PHP_EOL; |
|
| 429 | - $str .= '```'.PHP_EOL; |
|
| 430 | - $str .= '$balance = $captcha->getBalance();'.PHP_EOL; |
|
| 431 | - $str .= '```'.PHP_EOL; |
|
| 428 | + $str .= "#####{$this->getText(['example', 'balance'])}" . PHP_EOL; |
|
| 429 | + $str .= '```' . PHP_EOL; |
|
| 430 | + $str .= '$balance = $captcha->getBalance();' . PHP_EOL; |
|
| 431 | + $str .= '```' . PHP_EOL; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | if ($this->getText(['example', 'error', 'lang', 'if'])) { |
| 435 | - $str .= "#####{$this->getText(['example', 'error', 'lang'])}".PHP_EOL; |
|
| 436 | - $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}".PHP_EOL; |
|
| 437 | - $str .= '```'.PHP_EOL; |
|
| 438 | - $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);'.PHP_EOL; |
|
| 439 | - $str .= '```'.PHP_EOL; |
|
| 435 | + $str .= "#####{$this->getText(['example', 'error', 'lang'])}" . PHP_EOL; |
|
| 436 | + $str .= "{$this->getText(['example', 'error', 'lang', 'desc'])}" . PHP_EOL; |
|
| 437 | + $str .= '```' . PHP_EOL; |
|
| 438 | + $str .= '$captcha->setErrorLang(\jumper423\decaptcha\core\DeCaptchaErrors::LANG_RU);' . PHP_EOL; |
|
| 439 | + $str .= '```' . PHP_EOL; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - $str .= "#####{$this->getText(['example', 'error', 'interception'])}".PHP_EOL; |
|
| 443 | - $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}".PHP_EOL; |
|
| 444 | - $str .= '```'.PHP_EOL; |
|
| 445 | - $str .= '$captcha->setCauseAnError(true);'.PHP_EOL; |
|
| 442 | + $str .= "#####{$this->getText(['example', 'error', 'interception'])}" . PHP_EOL; |
|
| 443 | + $str .= "{$this->getText(['example', 'error', 'interception', 'desc'])}" . PHP_EOL; |
|
| 444 | + $str .= '```' . PHP_EOL; |
|
| 445 | + $str .= '$captcha->setCauseAnError(true);' . PHP_EOL; |
|
| 446 | 446 | $str .= PHP_EOL; |
| 447 | - $str .= 'try {'.PHP_EOL; |
|
| 447 | + $str .= 'try {' . PHP_EOL; |
|
| 448 | 448 | $str .= ' $captcha->recognize('; |
| 449 | 449 | if ($this->texts['recognize_file']) { |
| 450 | 450 | $str .= "'{$this->getText(['recognize', 'data', 'file'])}'"; |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | if ($this->texts['recognize_file']) { |
| 454 | 454 | $str .= ', '; |
| 455 | 455 | } |
| 456 | - $str .= '['.PHP_EOL; |
|
| 456 | + $str .= '[' . PHP_EOL; |
|
| 457 | 457 | foreach ($this->texts['recognize_data'] as $key => $val) { |
| 458 | 458 | $str .= " {$rc->getShortName()}::{$this->getNameConst('ACTION_FIELD_', $key)} => "; |
| 459 | 459 | if (is_string($val)) { |
@@ -461,16 +461,16 @@ discard block |
||
| 461 | 461 | } else { |
| 462 | 462 | $str .= "{$val}"; |
| 463 | 463 | } |
| 464 | - $str .= ','.PHP_EOL; |
|
| 464 | + $str .= ',' . PHP_EOL; |
|
| 465 | 465 | } |
| 466 | 466 | $str .= ' ]'; |
| 467 | 467 | } |
| 468 | - $str .= ');'.PHP_EOL; |
|
| 469 | - $str .= ' $code = $captcha->getCode();'.PHP_EOL; |
|
| 470 | - $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {'.PHP_EOL; |
|
| 471 | - $str .= ' ...'.PHP_EOL; |
|
| 472 | - $str .= '}'.PHP_EOL; |
|
| 473 | - $str .= '```'.PHP_EOL; |
|
| 468 | + $str .= ');' . PHP_EOL; |
|
| 469 | + $str .= ' $code = $captcha->getCode();' . PHP_EOL; |
|
| 470 | + $str .= '} catch (\jumper423\decaptcha\core\DeCaptchaErrors $e) {' . PHP_EOL; |
|
| 471 | + $str .= ' ...' . PHP_EOL; |
|
| 472 | + $str .= '}' . PHP_EOL; |
|
| 473 | + $str .= '```' . PHP_EOL; |
|
| 474 | 474 | |
| 475 | 475 | return $str; |
| 476 | 476 | } |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | private function viewFields() |
| 479 | 479 | { |
| 480 | 480 | $class = $this->class; |
| 481 | - $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; |
|
| 482 | - $str .= ' --- | --- | --- | --- | --- | --- | --- '.PHP_EOL; |
|
| 481 | + $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; |
|
| 482 | + $str .= ' --- | --- | --- | --- | --- | --- | --- ' . PHP_EOL; |
|
| 483 | 483 | foreach ($this->class->actions[$class::ACTION_RECOGNIZE][$class::ACTION_FIELDS] as $param => $setting) { |
| 484 | 484 | if (array_key_exists($class::ACTION_FIELDS, $setting) && is_array($setting[$class::ACTION_FIELDS])) { |
| 485 | 485 | foreach ($setting[$class::ACTION_FIELDS] as $param1 => $setting1) { |
@@ -503,9 +503,9 @@ discard block |
||
| 503 | 503 | $class = $this->class; |
| 504 | 504 | $str = " {$this->getText(['field', 'main', 'name', $param])} |"; |
| 505 | 505 | $str .= " {$this->getNameConst('ACTION_FIELD_', $param)} |"; |
| 506 | - $str .= ' '.substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[$class::PARAM_SLUG_TYPE]), 17).' |'; |
|
| 507 | - $str .= ' '.(array_key_exists($class::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-').' |'; |
|
| 508 | - $str .= ' '.(array_key_exists($class::PARAM_SLUG_DEFAULT, $setting) ? $setting[$class::PARAM_SLUG_DEFAULT] : '').' |'; |
|
| 506 | + $str .= ' ' . substr($this->getNameConst('PARAM_FIELD_TYPE_', $setting[$class::PARAM_SLUG_TYPE]), 17) . ' |'; |
|
| 507 | + $str .= ' ' . (array_key_exists($class::PARAM_SLUG_REQUIRE, $setting) ? '+' : '-') . ' |'; |
|
| 508 | + $str .= ' ' . (array_key_exists($class::PARAM_SLUG_DEFAULT, $setting) ? $setting[$class::PARAM_SLUG_DEFAULT] : '') . ' |'; |
|
| 509 | 509 | $str .= " {$this->getText(['field', 'slug', $class::PARAM_SLUG_ENUM, $param])} |"; |
| 510 | 510 | $str .= " {$this->getText(['field', 'main', 'desc', $param])} |"; |
| 511 | 511 | $str .= PHP_EOL; |
@@ -515,9 +515,9 @@ discard block |
||
| 515 | 515 | |
| 516 | 516 | private function viewMenu() |
| 517 | 517 | { |
| 518 | - $str = "+ [{$this->getText(['slug','menu','main'])}](../docs/README-{$this->lang}.md)".PHP_EOL; |
|
| 519 | - $str .= "+ [{$this->getText(['slug','menu','another'])}](../docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')'.PHP_EOL; |
|
| 520 | - $str .= "+ {$this->getText(['slug','menu','anchor'])}".PHP_EOL; |
|
| 518 | + $str = "+ [{$this->getText(['slug', 'menu', 'main'])}](../docs/README-{$this->lang}.md)" . PHP_EOL; |
|
| 519 | + $str .= "+ [{$this->getText(['slug', 'menu', 'another'])}](../docs/" . $this->getFileName($this->lang == 'ru' ? 'en' : 'ru') . ')' . PHP_EOL; |
|
| 520 | + $str .= "+ {$this->getText(['slug', 'menu', 'anchor'])}" . PHP_EOL; |
|
| 521 | 521 | foreach ([ |
| 522 | 522 | ['slug', 'link'], |
| 523 | 523 | ['slug', 'service', 'desc'], |
@@ -527,10 +527,10 @@ discard block |
||
| 527 | 527 | ['example'], |
| 528 | 528 | ['slug', 'fields', 'desc'] |
| 529 | 529 | ] as $anchor) { |
| 530 | - $str .= " + [{$this->getText($anchor)}](#".implode('-', explode(' ', $this->getText($anchor))).")".PHP_EOL; |
|
| 530 | + $str .= " + [{$this->getText($anchor)}](#" . implode('-', explode(' ', $this->getText($anchor))) . ")" . PHP_EOL; |
|
| 531 | 531 | } |
| 532 | - if ($this->getText(['menu','from_service'])) { |
|
| 533 | - $str .= "+ {$this->getText(['slug','menu','from_service'])}" . PHP_EOL; |
|
| 532 | + if ($this->getText(['menu', 'from_service'])) { |
|
| 533 | + $str .= "+ {$this->getText(['slug', 'menu', 'from_service'])}" . PHP_EOL; |
|
| 534 | 534 | foreach ($this->texts['menu_from_service'] as $fromServiceClass) { |
| 535 | 535 | $fromServiceObject = new $fromServiceClass([]); |
| 536 | 536 | $fromServiceObjectWiki = $fromServiceObject->getWiki($this->lang); |
@@ -556,24 +556,24 @@ discard block |
||
| 556 | 556 | |
| 557 | 557 | public function view() |
| 558 | 558 | { |
| 559 | - $str = $this->getText(['service', 'name']).PHP_EOL; |
|
| 560 | - $str .= '=============='.PHP_EOL; |
|
| 561 | - $str .= "###{$this->getText(['slug', 'menu'])}".PHP_EOL; |
|
| 562 | - $str .= $this->viewMenu().PHP_EOL.PHP_EOL; |
|
| 563 | - $str .= "###{$this->getText(['slug', 'link'])}".PHP_EOL; |
|
| 564 | - $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})".PHP_EOL.PHP_EOL; |
|
| 565 | - $str .= "###{$this->getText(['slug', 'service', 'desc'])}".PHP_EOL; |
|
| 566 | - $str .= "{$this->getText(['service', 'desc'])}".PHP_EOL.PHP_EOL; |
|
| 567 | - $str .= "###{$this->getText(['slug', 'price'])}".PHP_EOL; |
|
| 568 | - $str .= "{$this->getText(['recognize', 'price'])}".PHP_EOL.PHP_EOL; |
|
| 569 | - $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}".PHP_EOL; |
|
| 570 | - $str .= "{$this->getText(['recognize', 'desc'])}".PHP_EOL.PHP_EOL; |
|
| 571 | - $str .= "###{$this->getText(['install'])}".PHP_EOL; |
|
| 572 | - $str .= "{$this->viewInstall()}".PHP_EOL.PHP_EOL; |
|
| 573 | - $str .= "###{$this->getText(['example'])}".PHP_EOL; |
|
| 574 | - $str .= "{$this->viewExamples()}".PHP_EOL.PHP_EOL; |
|
| 575 | - $str .= "###{$this->getText(['slug', 'fields', 'desc'])}".PHP_EOL; |
|
| 576 | - $str .= $this->viewFields().PHP_EOL; |
|
| 559 | + $str = $this->getText(['service', 'name']) . PHP_EOL; |
|
| 560 | + $str .= '==============' . PHP_EOL; |
|
| 561 | + $str .= "###{$this->getText(['slug', 'menu'])}" . PHP_EOL; |
|
| 562 | + $str .= $this->viewMenu() . PHP_EOL . PHP_EOL; |
|
| 563 | + $str .= "###{$this->getText(['slug', 'link'])}" . PHP_EOL; |
|
| 564 | + $str .= "[{$this->getText(['slug', 'link', 'to_service'])} {$this->getText(['service', 'name'])}]({$this->getText(['service', 'href'])})" . PHP_EOL . PHP_EOL; |
|
| 565 | + $str .= "###{$this->getText(['slug', 'service', 'desc'])}" . PHP_EOL; |
|
| 566 | + $str .= "{$this->getText(['service', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
| 567 | + $str .= "###{$this->getText(['slug', 'price'])}" . PHP_EOL; |
|
| 568 | + $str .= "{$this->getText(['recognize', 'price'])}" . PHP_EOL . PHP_EOL; |
|
| 569 | + $str .= "###{$this->getText(['slug', 'recognize', 'desc'])}" . PHP_EOL; |
|
| 570 | + $str .= "{$this->getText(['recognize', 'desc'])}" . PHP_EOL . PHP_EOL; |
|
| 571 | + $str .= "###{$this->getText(['install'])}" . PHP_EOL; |
|
| 572 | + $str .= "{$this->viewInstall()}" . PHP_EOL . PHP_EOL; |
|
| 573 | + $str .= "###{$this->getText(['example'])}" . PHP_EOL; |
|
| 574 | + $str .= "{$this->viewExamples()}" . PHP_EOL . PHP_EOL; |
|
| 575 | + $str .= "###{$this->getText(['slug', 'fields', 'desc'])}" . PHP_EOL; |
|
| 576 | + $str .= $this->viewFields() . PHP_EOL; |
|
| 577 | 577 | |
| 578 | 578 | return $str; |
| 579 | 579 | } |
@@ -585,11 +585,11 @@ discard block |
||
| 585 | 585 | } |
| 586 | 586 | $class = $this->class; |
| 587 | 587 | |
| 588 | - return (new \ReflectionClass($class))->getShortName().'-'.$lang.'.md'; |
|
| 588 | + return (new \ReflectionClass($class))->getShortName() . '-' . $lang . '.md'; |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | public function save() |
| 592 | 592 | { |
| 593 | - file_put_contents(__DIR__.'/../../docs/'.$this->getFileName(), $this->view()); |
|
| 593 | + file_put_contents(__DIR__ . '/../../docs/' . $this->getFileName(), $this->view()); |
|
| 594 | 594 | } |
| 595 | 595 | } |