Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439 Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
26 lines
733 B
PHP
26 lines
733 B
PHP
<?php
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
/**
|
|
* QuickForm rule to check a text field has a minimum of X chars
|
|
* @package chamilo.include
|
|
*/
|
|
class Html_Quickform_Rule_MinText extends HTML_QuickForm_Rule
|
|
{
|
|
/**
|
|
* Function to check a text field has a minimum of X chars
|
|
* @see HTML_QuickForm_Rule
|
|
* @param string $text A text
|
|
* @param int $count The minimum number of characters that the text should contain
|
|
* @return boolean True if text has the minimum number of chars required
|
|
*/
|
|
public function validate($text, $count)
|
|
{
|
|
$checkMinText = function($a, $b) {
|
|
return strlen(utf8_decode($a)) >= $b;
|
|
};
|
|
|
|
return $checkMinText($text, $count);
|
|
}
|
|
}
|