07-13-2017, 09:48 PM
@karsen I've looked into your code.
required_if - in my view you can just make required work properly (line 47 in my paste) instead of adding whole new rule.
valid_datetime - it's a shame that you haven't tested it because the formats are different and it's returning error every time. Inspired I've implemented my version of this.
>there is no foolproof way to ensure it’s actually an image, but is will weed out most bad images
PHP manual advises against using getimagesize for validation.
I apply finfo, imagecreatefromjpeg (not in validation class but in a separate function because I handle images after validation) and htaccess.
From what I understand @firestorm uses finfo, getimagesize and optionally imagecreate.
in_array - similar to in but you utilize array keys and I use sub-arrays. By the way, you can create unordered list in a single line:
required_if - in my view you can just make required work properly (line 47 in my paste) instead of adding whole new rule.
valid_datetime - it's a shame that you haven't tested it because the formats are different and it's returning error every time. Inspired I've implemented my version of this.
>there is no foolproof way to ensure it’s actually an image, but is will weed out most bad images
PHP manual advises against using getimagesize for validation.
I apply finfo, imagecreatefromjpeg (not in validation class but in a separate function because I handle images after validation) and htaccess.
From what I understand @firestorm uses finfo, getimagesize and optionally imagecreate.
in_array - similar to in but you utilize array keys and I use sub-arrays. By the way, you can create unordered list in a single line:
Code:
$allowed = (empty($rule_value) ? "" : "<ul><li>") . implode("</li><li>", $rule_value) . (empty($rule_value) ? "" : "</li></ul>");