/**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $fields array all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field
  */
 function FormValidatorArray(&$form, $field, $type, $message, $fields = array(), $subArray = false)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->_fields = $fields;
     $this->_subArray = $subArray;
     $this->_errorFields = array();
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $radiofields array all the radio buttons to check.
  * @param $twoDim boolean specify if if this is a 2 dimensional array
  */
 function FormValidatorArrayRadios(&$form, $field, $type, $message, $radiofields, $twoDim = false)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->twoDimenstion = $twoDim;
     $this->_radiofields = $radiofields;
     $this->_errorFields = array();
 }
 /**
  * Constructor.
  * The user function is passed the form data as its first argument and $additionalArguments, if set, as the remaining arguments. This function must return a boolean value.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $userFunction callable function the user function to use for validation
  * @param $additionalArguments array optional, a list of additional arguments to pass to $userFunction
  * @param $complementReturn boolean optional, complement the value returned by $userFunction
  */
 function FormValidatorCustom(&$form, $field, $type, $message, $userFunction, $additionalArguments = array(), $complementReturn = false)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->_userFunction = $userFunction;
     $this->_additionalArguments = $additionalArguments;
     $this->_complementReturn = $complementReturn;
 }
Example #4
0
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $dateFormat int the ValidatorDate date format to allow
  * @param $dateScope string the minimum resolution of a date to allow
  * @param $dateScope string the maximum resolution of a date to allow
  */
 function FormValidatorDate(&$form, $field, $type, $message, $dateFormat = DATE_FORMAT_ISO, $dateScopeMin = VALIDATOR_DATE_SCOPE_YEAR, $dateScopeMax = VALIDATOR_DATE_SCOPE_DAY)
 {
     $validator = new ValidatorDate($dateFormat);
     $this->_scopeMin = $dateScopeMin;
     $this->_scopeMax = $dateScopeMax;
     parent::FormValidator($form, $field, $type, $message, $validator);
 }
 /**
  * Constructor.
  * @param $form object
  * @param $userIp string IP address of user request
  * @param $message string Key of message to display on mismatch
  */
 function FormValidatorReCaptcha(&$form, $challengeField, $responseField, $userIp, $message)
 {
     parent::FormValidator($form, $challengeField, FORM_VALIDATOR_REQUIRED_VALUE, $message);
     $this->_challengeField = $challengeField;
     $this->_responseField = $responseField;
     $this->_userIp = $userIp;
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $userFunction function the user function to use for validation
  * @param $additionalArguments array optional, a list of additional arguments to pass to $userFunction
  * @param $complementReturn boolean optional, complement the value returned by $userFunction
  * @param $fields array all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field
  * @param $isLocaleField boolean
  */
 function FormValidatorArrayCustom(&$form, $field, $type, $message, $userFunction, $additionalArguments = array(), $complementReturn = false, $fields = array(), $isLocaleField = false)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->_fields = $fields;
     $this->_errorFields = array();
     $this->_isLocaleField = $isLocaleField;
     $this->_userFunction = $userFunction;
     $this->_additionalArguments = $additionalArguments;
     $this->_complementReturn = $complementReturn;
 }
 /**
  * Constructor.
  * @param $form Form
  * @param $message string the locale key to use (optional)
  */
 function FormValidatorPost(&$form, $message = 'form.postRequired')
 {
     parent::FormValidator($form, 'dummy', FORM_VALIDATOR_REQUIRED_VALUE, $message);
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $regExp string the regular expression (PCRE form)
  */
 function FormValidatorRegExp(&$form, $field, $type, $message, $regExp)
 {
     import('lib.pkp.classes.validation.ValidatorRegExp');
     $validator = new ValidatorRegExp($regExp);
     parent::FormValidator($form, $field, $type, $message, $validator);
 }
 /**
  * Constructor.
  * @param $form object
  * @param $field string Name of captcha value submitted by user
  * @param $captchaIdField string Name of captcha ID field
  * @param $message string Key of message to display on mismatch
  */
 function FormValidatorCaptcha(&$form, $field, $captchaIdField, $message)
 {
     parent::FormValidator($form, $field, FORM_VALIDATOR_REQUIRED_VALUE, $message);
     $this->_captchaIdField = $captchaIdField;
 }
 /**
  * Constructor.
  * @see FormValidator::FormValidator()
  * @param $regExp string the regular expression (PCRE form)
  */
 function FormValidatorRegExp(&$form, $field, $type, $message, $regExp)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->regExp = $regExp;
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $comparator
  * @param $length
  */
 function FormValidatorLength(&$form, $field, $type, $message, $comparator, $length)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->_comparator = $comparator;
     $this->_length = $length;
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorBoolean(&$form, $field, $message)
 {
     parent::FormValidator($form, $field, FORM_VALIDATOR_OPTIONAL_VALUE, $message);
 }
 /**
  * Constructor.
  * @see FormValidator::FormValidator()
  * @param $field string field name specifying an array of fields, i.e. name[]
  * @param $fields array all subfields for each item in the array, i.e. name[][foo]. If empty it is assumed that name[] is a data field
  */
 function FormValidatorArray(&$form, $field, $type, $message, $fields = array())
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->fields = $fields;
     $this->errorFields = array();
 }
 function FormValidatorFileType(&$form, $field, $type, $message)
 {
     parent::FormValidator($form, $field, $type, $message, $this);
 }
 /**
  * Constructor.
  * @see FormValidator::FormValidator()
  * @param message string the locale key to use (optional)
  */
 function FormValidatorPost(&$form, $message = 'form.postRequired')
 {
     parent::FormValidator($form, 'dummy', 'required', $message);
 }
 /**
  * Constructor.
  * @param $form object
  * @param $field string Name of captcha value submitted by user
  * @param $captchaIdField string Name of captcha ID field
  * @param $message string Key of message to display on mismatch
  */
 function FormValidatorCaptcha(&$form, $field, $captchaIdField, $message)
 {
     parent::FormValidator($form, $field, 'required', $message);
     $this->captchaIdField = $captchaIdField;
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorAlphaNum(&$form, $field, $type, $message)
 {
     import('lib.pkp.classes.validation.ValidatorRegExp');
     $validator = new ValidatorRegExp('/^[A-Z0-9]+([\\-_][A-Z0-9]+)*$/i');
     parent::FormValidator($form, $field, $type, $message, $validator);
 }
Example #18
0
 /**
  * Constructor.
  * @see FormValidator::FormValidator()
  * @param $acceptedValues array all possible accepted values
  */
 function FormValidatorInSet(&$form, $field, $type, $message, $acceptedValues)
 {
     parent::FormValidator($form, $field, $type, $message);
     $this->acceptedValues = $acceptedValues;
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorUsername(&$form, $field, $type, $message)
 {
     import('lib.pkp.classes.validation.ValidatorRegExp');
     parent::FormValidator($form, $field, $type, $message, new ValidatorRegExp('/^[a-z0-9]+([\\-_][a-z0-9]+)*$/'));
 }
 function FormValidatorUpload(&$form, $field, $type, $message, $asField)
 {
     $this->_assocField = $asField;
     parent::FormValidator($form, $field, $type, $message, $this);
 }
Example #21
0
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorISSN($form, $field, $type, $message)
 {
     import('lib.pkp.classes.validation.ValidatorISSN');
     $validator = new ValidatorISSN();
     parent::FormValidator($form, $field, $type, $message, $validator);
 }
Example #22
0
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorEmail(&$form, $field, $type = 'optional', $message = 'email.invalid')
 {
     $validator = new ValidatorEmail();
     parent::FormValidator($form, $field, $type, $message, $validator);
     array_push($form->cssValidation[$field], 'email');
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorListbuilder(&$form, $field, $message)
 {
     parent::FormValidator($form, $field, FORM_VALIDATOR_OPTIONAL_VALUE, $message);
 }
Example #24
0
 /**
  * Constructor.
  * @param $form Form
  * @param $message string the locale key to use (optional)
  */
 function FormValidatorCSRF(&$form, $message = 'form.csrfInvalid')
 {
     parent::FormValidator($form, 'dummy', FORM_VALIDATOR_REQUIRED_VALUE, $message);
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $symbolic string
  * @param $assocType int
  * @param $assocId int
  */
 function FormValidatorControlledVocab(&$form, $field, $type, $message, $symbolic, $assocType, $assocId)
 {
     import('lib.pkp.classes.validation.ValidatorControlledVocab');
     $validator = new ValidatorControlledVocab($symbolic, $assocType, $assocId);
     parent::FormValidator($form, $field, $type, $message, $validator);
 }
Example #26
0
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  * @param $allowedSchemes array the allowed URI schemes
  */
 function FormValidatorUri(&$form, $field, $type, $message, $allowedSchemes = null)
 {
     import('lib.pkp.classes.validation.ValidatorUri');
     $validator = new ValidatorUri($allowedSchemes);
     parent::FormValidator($form, $field, $type, $message, $validator);
 }
 /**
  * Constructor.
  * @param $form Form the associated form
  * @param $field string the name of the associated field
  * @param $type string the type of check, either "required" or "optional"
  * @param $message string the error message for validation failures (i18n key)
  */
 function FormValidatorUrl(&$form, $field, $type, $message)
 {
     $validator = new ValidatorUrl();
     parent::FormValidator($form, $field, $type, $message, $validator);
     array_push($form->cssValidation[$field], 'url');
 }
 /**
  * Constructor.
  * @param $form object
  * @param $userIp string IP address of user request
  * @param $message string Key of message to display on mismatch
  */
 function FormValidatorReCaptcha(&$form, $userIp, $message)
 {
     parent::FormValidator($form, RECAPTCHA_RESPONSE_FIELD, FORM_VALIDATOR_REQUIRED_VALUE, $message);
     $this->_userIp = $userIp;
 }