コード例 #1
0
ファイル: decimal.php プロジェクト: openly/Openjuice-Package
 public function validate($args)
 {
     $valueToTest = $args[$this->getDisplayFieldName()];
     if (!OJUtil::checkNotBlank($valueToTest) || preg_match('/^\\+?-?\\d+\\.+\\d*$/', $valueToTest)) {
         return true;
     }
     $this->error = array('message' => t('Field "%s" is not a vaild Decimal number.', $this->label), 'name' => $this->fieldName);
     return false;
 }
コード例 #2
0
ファイル: integer.php プロジェクト: openly/Openjuice-Package
 public function validate($args)
 {
     $valueToTest = $args[$this->getDisplayFieldName()];
     if (!OJUtil::checkNotBlank($valueToTest) || $this->isInteger($valueToTest)) {
         return true;
     }
     $this->error = array('message' => t('Field "%s" is not an integer.', $this->label), 'name' => $this->fieldName);
     return false;
 }
コード例 #3
0
ファイル: currency.php プロジェクト: openly/Openjuice-Package
 public function validate($args)
 {
     $valueToTest = $args[$this->getDisplayFieldName()];
     if (!OJUtil::checkNotBlank($valueToTest) || preg_match('/^\\$?.?.?.?[1-9]\\d*(?:\\.?\\d{0,2})?$/', $valueToTest)) {
         return true;
     }
     $this->error = array('message' => t('Field "%s" is not a vaild currency.', $this->label), 'name' => $this->fieldName);
     return false;
 }
コード例 #4
0
ファイル: email.php プロジェクト: openly/Openjuice-Package
 public function validate($args)
 {
     $valueToTest = $args[$this->getDisplayFieldName()];
     if (!OJUtil::checkNotBlank($valueToTest) || preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9\\._-])+.([a-zA-Z0-9\\._-]+)+$/', $valueToTest)) {
         return true;
     }
     $this->error = array('message' => t('Field "%s" is not a vaild email address.', $this->label), 'name' => $this->fieldName);
     return false;
 }
コード例 #5
0
ファイル: required.php プロジェクト: openly/Openjuice-Package
 public function validate($args)
 {
     //	var_dump($args);
     if (OJUtil::checkNotBlank($args[$this->getDisplayFieldName()])) {
         return true;
     }
     $this->error = array('message' => t('Field "%s" is required.', $this->label), 'name' => $this->fieldName);
     return false;
 }
コード例 #6
0
ファイル: field.php プロジェクト: openly/Openjuice-Package
 public function setVars(&$hash)
 {
     if (OJUtil::checkNotBlank($hash['name'])) {
         $this->fieldName = $hash['name'];
     } else {
         throw new Exception("Field name cannot be blank", 1);
     }
     $this->label = $hash['name'];
     foreach ($hash as $key => $val) {
         $this->{$key} = $val;
     }
 }