Plugin Directory

Changeset 3451972


Ignore:
Timestamp:
02/02/2026 11:06:32 AM (2 months ago)
Author:
aeyoll
Message:

Release version 1.0.22

Location:
pow-captcha
Files:
53 added
9 edited

Legend:

Unmodified
Added
Removed
  • pow-captcha/trunk/composer.json

    r3420239 r3451972  
    44    "type": "wordpress-plugin",
    55    "license": "GPL-2.0-or-later",
    6     "version": "1.0.21",
     6    "version": "1.0.22",
    77    "require": {
    88    },
  • pow-captcha/trunk/pow-captcha.php

    r3420239 r3451972  
    44 * Plugin Name: Pow Captcha
    55 * Description: Adds Pow Captcha verification to forms.
    6  * Version: 1.0.21
     6 * Version: 1.0.22
    77 * Author: Jean-Philippe Bidegain
    88 * Author URI: https://github.com/aeyoll/pow-captcha-for-wordpress
     
    1818}
    1919
    20 define('POW_CAPTCHA_VERSION', '1.0.21');
     20define('POW_CAPTCHA_VERSION', '1.0.22');
    2121
    2222require_once __DIR__ . '/vendor/autoload.php';
  • pow-captcha/trunk/readme.txt

    r3420239 r3451972  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.0.21
     7Stable tag: 1.0.22
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • pow-captcha/trunk/src/Core.php

    r3369593 r3451972  
    2020    public static $option_captcha_api_url = 'captcha_api_url';
    2121    public static $option_enable_on_login_form = 'enable_on_login_form';
     22    public static $option_difficulty_level = 'pow_captcha_difficulty_level';
     23    public static $default_difficulty_level = 5;
    2224
    2325    /**
     
    8587
    8688    /**
     89     * Retrieves the difficulty level for the captcha.
     90     *
     91     * @return int Returns the difficulty level (defaults to 5).
     92     */
     93    public function get_difficulty_level(): int
     94    {
     95        $level = get_option(self::$option_difficulty_level, self::$default_difficulty_level);
     96
     97        return (int) $level;
     98    }
     99
     100    /**
    87101     * Retrieves the contact form 7 active option.
    88102     *
  • pow-captcha/trunk/src/Modules/GravityForms.php

    r3420239 r3451972  
    77use GFCommon;
    88use GFFormsModel;
    9 use GGFormDisplay;
     9use GFFormDisplay;
    1010
    1111class GravityForms
     
    100100        $form = $validation_result['form'];
    101101
    102         if (!GGFormDisplay::is_last_page($form)) {
     102        if (!GFFormDisplay::is_last_page($form)) {
    103103            return $validation_result;
    104104        }
  • pow-captcha/trunk/src/Settings.php

    r3369593 r3451972  
    3030            PowCaptchaForWordpressCore::$option_enable_on_login_form,
    3131            'sanitize_text_field'
     32        );
     33        register_setting(
     34            PowCaptchaForWordpressCore::$option_group,
     35            PowCaptchaForWordpressCore::$option_difficulty_level,
     36            [
     37                'type' => 'integer',
     38                'sanitize_callback' => 'absint',
     39                'default' => PowCaptchaForWordpressCore::$default_difficulty_level,
     40            ]
    3241        );
    3342
     
    8190            )
    8291        );
     92
     93        // Difficulty level
     94        add_settings_field(
     95            'pow_captcha_settings_difficulty_level_field',
     96            'Difficulty Level',
     97            [$this, 'pow_captcha_settings_field_callback'],
     98            'pow_captcha_admin',
     99            'pow_captcha_general_settings_section',
     100            array(
     101                'option_name' => PowCaptchaForWordpressCore::$option_difficulty_level,
     102                'description' => 'The difficulty level for the captcha challenge (1-10). Higher values require more computational work.',
     103                'type' => 'number',
     104                'min' => 1,
     105                'max' => 10,
     106                'default' => PowCaptchaForWordpressCore::$default_difficulty_level,
     107            )
     108        );
    83109    }
    84110
    85     // field content cb
     111    /**
     112     * Renders a settings field input.
     113     *
     114     * @param array $args Field configuration arguments.
     115     */
    86116    public function pow_captcha_settings_field_callback(array $args)
    87117    {
     
    89119        $option_name  = $args['option_name'];
    90120        $description = $args['description'];
     121        $default = $args['default'] ?? '';
    91122
    92123        // Value of the option
    93         $setting = get_option($option_name);
     124        $setting = get_option($option_name, $default);
    94125
    95126        $value = isset($setting) ? esc_attr($setting) : '';
    96         $checked = "";
     127        $checked = '';
     128        $extra_attrs = '';
    97129
    98         if ($type == "checkbox") {
     130        if ($type === 'checkbox') {
    99131            $value = 1;
    100132            $checked = checked(1, $setting, false);
    101133        }
     134
     135        if ($type === 'number') {
     136            if (isset($args['min'])) {
     137                $extra_attrs .= ' min="' . esc_attr($args['min']) . '"';
     138            }
     139
     140            if (isset($args['max'])) {
     141                $extra_attrs .= ' max="' . esc_attr($args['max']) . '"';
     142            }
     143        }
    102144        ?>
    103145        <input
    104             autcomplete="none"
     146            autocomplete="none"
    105147            type="<?php echo esc_attr($type); ?>"
    106148            name="<?php echo esc_attr($option_name); ?>"
    107149            id="<?php echo esc_attr($option_name); ?>"
    108             value="<?php echo esc_attr($value) ?>" <?php echo esc_attr($checked) ?>>
     150            value="<?php echo esc_attr($value); ?>"
     151            <?php echo esc_attr($checked); ?>
     152            <?php echo $extra_attrs; ?>>
    109153        <label
    110154            class="description"
    111155            for="<?php echo esc_attr($option_name); ?>">
    112             <?php echo esc_html($description) ?>
     156            <?php echo esc_html($description); ?>
    113157        </label>
    114158        <?php
  • pow-captcha/trunk/src/Widget.php

    r3420239 r3451972  
    4646    public function load_challenges()
    4747    {
    48         $response = $this->get_client()->post('GetChallenges?difficultyLevel=5');
     48        $plugin = Core::$instance;
     49        $difficulty_level = $plugin->get_difficulty_level();
     50
     51        $response = $this->get_client()->post('GetChallenges?difficultyLevel=' . $difficulty_level);
    4952        $json = $response->getBody()->getContents();
    5053        $data = json_decode($json, true);
     
    135138            plugin_dir_url(__FILE__) . '../assets/css/pow-captcha.css',
    136139            array(),
    137             '1.0.21'
     140            '1.0.22'
    138141        );
    139142
     
    143146            $plugin->get_captcha_api_url() . '/static/captcha.js',
    144147            array(),
    145             '1.0.21',
     148            '1.0.22',
    146149            true
    147150        );
     
    151154            plugin_dir_url(__FILE__) . '../assets/js/pow-captcha.js',
    152155            array(),
    153             '1.0.21',
     156            '1.0.22',
    154157            true
    155158        );
  • pow-captcha/trunk/vendor/composer/installed.php

    r3420239 r3451972  
    22    'root' => array(
    33        'name' => 'aeyoll/pow-captcha-for-wordpress',
    4         'pretty_version' => '1.0.21',
    5         'version' => '1.0.21.0',
     4        'pretty_version' => '1.0.22',
     5        'version' => '1.0.22.0',
    66        'reference' => null,
    77        'type' => 'wordpress-plugin',
     
    1212    'versions' => array(
    1313        'aeyoll/pow-captcha-for-wordpress' => array(
    14             'pretty_version' => '1.0.21',
    15             'version' => '1.0.21.0',
     14            'pretty_version' => '1.0.22',
     15            'version' => '1.0.22.0',
    1616            'reference' => null,
    1717            'type' => 'wordpress-plugin',
  • pow-captcha/trunk/vendor/vendor/composer/installed.php

    r3420239 r3451972  
    22    'root' => array(
    33        'name' => 'aeyoll/pow-captcha-for-wordpress',
    4         'pretty_version' => '1.0.21',
    5         'version' => '1.0.21.0',
     4        'pretty_version' => '1.0.22',
     5        'version' => '1.0.22.0',
    66        'reference' => null,
    77        'type' => 'wordpress-plugin',
     
    1212    'versions' => array(
    1313        'aeyoll/pow-captcha-for-wordpress' => array(
    14             'pretty_version' => '1.0.21',
    15             'version' => '1.0.21.0',
     14            'pretty_version' => '1.0.22',
     15            'version' => '1.0.22.0',
    1616            'reference' => null,
    1717            'type' => 'wordpress-plugin',
Note: See TracChangeset for help on using the changeset viewer.