Plugin Directory

Changeset 1607090


Ignore:
Timestamp:
03/03/2017 10:45:00 AM (9 years ago)
Author:
junaidpv
Message:

Improve form select field heper function. Improve int and float form field sanitization functions.

Location:
wtools/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wtools/trunk/includes/form-sanitization.php

    r1606332 r1607090  
    3131function wtools_form_sanitize_field_type_value_int($str) {
    3232    $return = filter_var($str, FILTER_SANITIZE_NUMBER_INT);
    33     return $return === FALSE ? NULL : $return;
     33    return $return === FALSE ? NULL : (int) $return;
    3434}
    3535
    3636function wtools_form_sanitize_field_type_value_float($str) {
    3737    $return = filter_var($str, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
    38     return $return === FALSE ? NULL : $return;
     38    return $return === FALSE ? NULL : (float) $return;
    3939}
  • wtools/trunk/includes/form.php

    r1606332 r1607090  
    188188            }
    189189            $value = static::arrayGetNestedValue($this->values, $field);
    190             if (empty($value)) {
     190            if (empty($value) && !is_numeric($value)) {
    191191                $this->setError($field, sprintf(_("'%s' is required."), $label));
    192192            }
  • wtools/trunk/wtools.php

    r1606345 r1607090  
    88  Plugin URI: https://wordpress.org/plugins/wtools/
    99  Description: WTools brings various functions and classes to make developing other plugins faster.
    10   Version: 0.6
     10  Version: 0.7
    1111  Author: Junaid
    1212  License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.