/** * validate criteria for given value * * @param string $criteria the criteria to test against * @param string $value the value being tested * @param string $empty skip empty values or not */ function _is_valid_criteria($criteria, $value, $empty, &$params, &$formvars, $form) { if(SmartyValidate::is_registered_criteria($criteria,$form)) { $_func_name = SmartyValidate::_get_registered_func_name('criteria',$criteria, $form); } else { $_func_name = 'smarty_validate_criteria_' . $criteria; if(!function_exists($_func_name)) { $_smarty_obj =& SmartyValidate::_object_instance('Smarty', $_dummy); if($_plugin_file = $_smarty_obj->_get_plugin_filepath('validate_criteria', $criteria)) { include_once($_plugin_file); } else { trigger_error("SmartyValidate: [is_valid] criteria function '$criteria' was not found."); return false; } } } if(strpos($_func_name,'->') !== false) { // object method preg_match('!(\w+)->(\w+)!', $_func_name, $_match); $_object_name = $_match[1]; $_method_name = $_match[2]; $_object =& SmartyValidate::_object_instance($_object_name, $_dummy); if(!method_exists($_object, $_method_name)) { trigger_error("SmartyValidate: [is_valid] method '$_method_name' is not valid for object '$_object_name'."); return false; } return $_object->$_method_name($value, $empty, $params, $formvars); } else { return $_func_name($value, $empty, $params, $formvars); } }