From 7f1e0dff6ada0e8db8e76079453fd299332a527c Mon Sep 17 00:00:00 2001 From: nishizoe Date: Fri, 26 Aug 2022 19:11:34 +0900 Subject: [PATCH] =?UTF-8?q?(fixed=20#4557,=20BP=20from=20#4288)=20?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=95=E3=82=A3=E3=83=BC=E3=83=AB=E3=81=A7?= =?UTF-8?q?=E3=80=8E=E3=83=86=E3=82=AD=E3=82=B9=E3=83=88(=E8=A4=87?= =?UTF-8?q?=E6=95=B0=E8=A1=8C)=E3=80=8F=E3=81=A7=E3=80=8E=E5=85=A5?= =?UTF-8?q?=E5=8A=9B=E5=80=A4=E3=82=BF=E3=82=A4=E3=83=97=E3=80=8F=E3=81=8C?= =?UTF-8?q?=E3=80=8E=E6=95=B0=E5=80=A4=E3=80=8F=E3=80=8E=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=82=A2=E3=83=89=E3=83=AC=E3=82=B9=E3=80=8F=E3=80=8E?= =?UTF-8?q?URL=E3=80=8F=E3=81=AE=E5=A0=B4=E5=90=88=E3=81=AB=E6=94=B9?= =?UTF-8?q?=E8=A1=8C=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E8=A8=B1=E5=AE=B9?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/util/opFormItemGenerator.class.php | 27 ++++++++++++-- .../opValidatorMultipleEmail.class.php | 36 +++++++++++++++++++ .../opValidatorMultipleInteger.class.php | 36 +++++++++++++++++++ .../opValidatorMultipleUrl.class.php | 36 +++++++++++++++++++ 4 files changed, 132 insertions(+), 3 deletions(-) create mode 100644 lib/validator/opValidatorMultipleEmail.class.php create mode 100644 lib/validator/opValidatorMultipleInteger.class.php create mode 100644 lib/validator/opValidatorMultipleUrl.class.php diff --git a/lib/util/opFormItemGenerator.class.php b/lib/util/opFormItemGenerator.class.php index 8d3a29662..e8ca24919 100644 --- a/lib/util/opFormItemGenerator.class.php +++ b/lib/util/opFormItemGenerator.class.php @@ -256,7 +256,14 @@ public static function generateValidator($field, $choices = array()) switch ($field['ValueType']) { case 'email': - $obj = new sfValidatorEmail($option); + if ('textarea' === $field['FormType']) + { + $obj = new opValidatorMultipleEmail($option); + } + else + { + $obj = new sfValidatorEmail($option); + } break; case 'pc_email': $obj = new opValidatorPCEmail($option); @@ -265,14 +272,28 @@ public static function generateValidator($field, $choices = array()) $obj = new sfValidatorMobileEmail($option); break; case 'integer': - $obj = new sfValidatorInteger($option); + if ('textarea' === $field['FormType']) + { + $obj = new opValidatorMultipleInteger($option); + } + else + { + $obj = new sfValidatorInteger($option); + } break; case 'regexp': $option['pattern'] = $field['ValueRegexp']; $obj = new sfValidatorRegex($option); break; case 'url': - $obj = new sfValidatorUrl($option); + if ('textarea' === $field['FormType']) + { + $obj = new opValidatorMultipleUrl($option); + } + else + { + $obj = new sfValidatorUrl($option); + } break; case 'password': $obj = new sfValidatorPassword($option); diff --git a/lib/validator/opValidatorMultipleEmail.class.php b/lib/validator/opValidatorMultipleEmail.class.php new file mode 100644 index 000000000..9d21ecbfa --- /dev/null +++ b/lib/validator/opValidatorMultipleEmail.class.php @@ -0,0 +1,36 @@ +