*/ class LSformRule_imagefile extends LSformRule { /** * Validate form element value * * @param mixed $value The value to validate * @param array $options Validation options: * - Type MIME : $options['params']['mimeType'] * - Type MIME (regex) : $options['params']['mimeTypeRegEx'] * @param LSformElement &$formElement The related LSformElement object * * @return boolean True if value is valid, False otherwise */ public static function validate($value, $options, &$formElement) { $file = LSsession :: getTmpFile($value); $mimetype = mime_content_type($file); $mimeType = LSconfig :: get('params.mimeType', null, null, $options); $mimeTypeRegEx = LSconfig :: get('params.mimeTypeRegEx', null, null, $options); if ( is_null($mimeType) && is_null($mimeTypeRegEx)) { $options = array( 'params' => array( 'mimeTypeRegEx' => '/image\/.*/' ) ); } return LSformRule_mimetype :: validate($value,$options,$formElement); } }