diff --git a/plugins/extend/recaptcha/class/ConfigAction.php b/plugins/extend/recaptcha/class/ConfigAction.php index 40356b5..61a4c67 100644 --- a/plugins/extend/recaptcha/class/ConfigAction.php +++ b/plugins/extend/recaptcha/class/ConfigAction.php @@ -5,6 +5,7 @@ use Sunlight\Plugin\Action\ConfigAction as BaseConfigAction; use Sunlight\Util\ConfigurationFile; use Sunlight\Util\Form; +use Sunlight\Util\Request; class ConfigAction extends BaseConfigAction { @@ -15,27 +16,27 @@ protected function getFields(): array return [ 'site_key' => [ 'label' => _lang('recaptcha.site_key'), - 'input' => '<input type="text" name="config[site_key]" value="' . Form::restorePostValue('site_key', $config['site_key'], false) . '">', + 'input' => Form::input('text', 'config[site_key]', Request::post('config[site_key]', $config['site_key']), ['class' => 'inputmedium']), 'type' => 'text', ], 'secret_key' => [ 'label' => _lang('recaptcha.secret_key'), - 'input' => '<input type="text" name="config[secret_key]" value="' . Form::restorePostValue('secret_key', $config['secret_key'], false) . '">', + 'input' => Form::input('text', 'config[secret_key]', Request::post('config[secret_key]', $config['secret_key']), ['class' => 'inputmedium']), 'type' => 'text', ], 'use_curl' => [ 'label' => _lang('recaptcha.use_curl'), - 'input' => '<input type="checkbox" name="config[use_curl]" value="1"' . Form::activateCheckbox($config['use_curl']) . '>', + 'input' => Form::input('checkbox', 'config[use_curl]', '1', ['checked' => Form::loadCheckbox('config', $config['use_curl'], 'use_curl')]), 'type' => 'checkbox' ], 'use_recaptcha_v3' => [ 'label' => _lang('recaptcha.use_recaptcha_v3'), - 'input' => '<input type="checkbox" name="config[use_recaptcha_v3]" value="1"' . Form::activateCheckbox($config['use_recaptcha_v3']) . '>', + 'input' => Form::input('checkbox', 'config[use_recaptcha_v3]', '1', ['checked' => Form::loadCheckbox('config', $config['use_recaptcha_v3'], 'use_recaptcha_v3')]), 'type' => 'checkbox' ], 'score_treshold' => [ 'label' => _lang('recaptcha.score_treshold'), - 'input' => '<input type="number" name="config[score_treshold]" min="0" max="1" step="0.1" value="' . Form::restorePostValue('score_treshold', $config['score_treshold'], false) . '" class="inputsmall">', + 'input' => Form::input('text', 'config[score_treshold]', Request::post('config[score_treshold]', $config['score_treshold']), ['class' => 'inputsmall', 'step' => '0.1', 'min' => '0', 'max' => '1']), ], ]; } diff --git a/plugins/extend/recaptcha/plugin.json b/plugins/extend/recaptcha/plugin.json index c9ddef3..6327547 100644 --- a/plugins/extend/recaptcha/plugin.json +++ b/plugins/extend/recaptcha/plugin.json @@ -2,9 +2,9 @@ "$schema": "../../../system/schema/extend.json", "name": "ReCaptcha", "description": "Protect forms by using the Google reCaptcha API", - "version": "1.0.0", + "version": "1.1.0", "environment": { - "system": "^8.0" + "system": "^8.1" }, "authors": [ {"name": "Friends of Sunlight CMS", "url": "https://github.com/friends-of-sunlight-cms/"}