Chamilo is a learning management system focused on ease of use and accessibility
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chamilo-lms/main/inc/lib/pear/HTML/QuickForm/Rule/MinText.php

26 lines
733 B

<?php
/* For licensing terms, see /license.txt */
9 years ago
/**
* 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
{
9 years ago
/**
* 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
9 years ago
* @return boolean True if text has the minimum number of chars required
*/
public function validate($text, $count)
9 years ago
{
$checkMinText = function($a, $b) {
return strlen(utf8_decode($a)) >= $b;
};
return $checkMinText($text, $count);
9 years ago
}
}