diff --git a/.gitignore b/.gitignore
index 0e3c68a..bb473da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ node_modules
*.zip
dist
*.map
+.DS_Store
diff --git a/composer.lock b/composer.lock
index 3536b1c..18a20bc 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "7a93568ac8ad8943978c2656b568b574",
+ "content-hash": "978b7fe126b61796750d67c4c7231417",
"packages": [
{
"name": "cleverogre/plugin-framework",
diff --git a/inc/class-settings.php b/inc/class-settings.php
index fd90748..c8126af 100644
--- a/inc/class-settings.php
+++ b/inc/class-settings.php
@@ -103,7 +103,16 @@ final class Settings {
public function menu() {
if (!current_user_can(self::CAPABILITY)) return;
- add_options_page(sprintf(Plugin::__('%s Settings'), Plugin::get_title()), Plugin::get_title(), self::CAPABILITY, Plugin::get_id(), [$this, 'page']);
+ add_options_page(
+ sprintf(
+ Plugin::__('%s Settings'),
+ Plugin::get_title()
+ ),
+ Plugin::__('CAPTCHA'),
+ self::CAPABILITY,
+ Plugin::get_id(),
+ [$this, 'page']
+ );
}
public function init() {
@@ -139,6 +148,7 @@ final class Settings {
args: [
'name' => 'site_key',
'description' => Plugin::__('Provide your Cap site key.'),
+ 'type' => 'password',
]
);
@@ -150,6 +160,7 @@ final class Settings {
args: [
'name' => 'secret_key',
'description' => Plugin::__('Provide your Cap secret key.'),
+ 'type' => 'password',
]
);
@@ -175,10 +186,11 @@ final class Settings {
self::LOCATION_LOGIN_PAGE => Plugin::__('Login page'),
self::LOCATION_REGISTRATION_PAGE => Plugin::__('Registration page'),
self::LOCATION_LOST_PASSWORD_FORM => Plugin::__('Lost password page'),
- self::LOCATION_LOGIN_FORM => Plugin::__('Custom login form (requires Login Page)'),
+ self::LOCATION_LOGIN_FORM => Plugin::__('Custom login form'),
self::LOCATION_COMMENT_FORM => Plugin::__('Comment form'),
self::LOCATION_POST_PASSWORD_FORM => Plugin::__('Password-protected posts and pages'),
],
+ 'description' => Plugin::__('Custom login form requires login page to also be enabled.'),
]
);
}
@@ -210,7 +222,7 @@ final class Settings {
if (empty($args['name'] ?? '')) return;
$attributes = [
- 'type' => 'text',
+ 'type' => $args['type'] ?? 'text',
'class' => 'regular-text',
'name' => sprintf(
'%s[%s]',
@@ -261,21 +273,28 @@ final class Settings {
}
public function checkbox_field(array $args):void {
- if (empty($args['name'] ?? '') || !isset($options) || empty($options)) return;
+ if (empty($args['name'] ?? '') || empty($args['options'] ?? [])) return;
echo implode('
', array_map(
fn (string $name, string $label):string => sprintf(
- '',
+ '',
esc_attr(Plugin::get_id()),
esc_attr($args['name']),
esc_attr($name),
checked(self::is_checked($args['name'], $name), display: false),
- esc_html($label),
- esc_html($name)
+ esc_html($label)
),
array_keys($args['options']),
array_values($args['options'])
));
+
+ if (!empty($args['description'] ?? '')) {
+ printf(
+ '
%s
', + esc_attr($args['name']), + nl2br($args['description']) + ); + } } public static function get_url():string {