@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | // filter_var suxx |
| 32 | 32 | if (!preg_match('/^(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})\z/i', $string)) { |
| 33 | - $this->addError($model, $attribute, Yii::t('yii', 'This in not valid IPv6 address {sample}', ['sample' => '::1'])); |
|
| 33 | + $this->addError($model, $attribute, Yii::t('yii', 'This in not valid IPv6 address {sample}', [ 'sample' => '::1' ])); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -17,15 +17,15 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class NetAddressValidator extends Validator { |
| 19 | 19 | /** |
| 20 | - * @inheritdoc |
|
| 21 | - */ |
|
| 22 | - public function init() |
|
| 23 | - { |
|
| 24 | - parent::init(); |
|
| 25 | - if ($this->message === null) { |
|
| 26 | - $this->message = Yii::t('yii', "{attribute} is invalid."); |
|
| 27 | - } |
|
| 28 | - } |
|
| 20 | + * @inheritdoc |
|
| 21 | + */ |
|
| 22 | + public function init() |
|
| 23 | + { |
|
| 24 | + parent::init(); |
|
| 25 | + if ($this->message === null) { |
|
| 26 | + $this->message = Yii::t('yii', "{attribute} is invalid."); |
|
| 27 | + } |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | public function validateAttribute($model, $attribute) { |
| 31 | 31 | $string = $model->{$attribute}; |
@@ -32,8 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | // filter_var suxx |
| 35 | - if (! |
|
| 36 | - ( |
|
| 35 | + if (!( |
|
| 37 | 36 | (preg_match('/^((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}\z/', $string) && |
| 38 | 37 | (preg_match('/^(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})\z/i', $string) && |
| 39 | 38 | (preg_match('/^([0-9a-F]{1,2}[\.:-]){5}([0-9a-F]{1,2})$/', $string) |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | // filter_var suxx |
| 32 | 32 | if (!preg_match('/^([0-9a-F]{1,2}[\.:-]){5}([0-9a-F]{1,2})$/', $string)) { |
| 33 | - $this->addError($model, $attribute, Yii::t('yii', 'This in not valid MAC address {sample}', ['sample' => '00:00:00:00:00:01'])); |
|
| 33 | + $this->addError($model, $attribute, Yii::t('yii', 'This in not valid MAC address {sample}', [ 'sample' => '00:00:00:00:00:01' ])); |
|
| 34 | 34 | return false; |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | // filter_var suxx |
| 32 | 32 | if (!preg_match('/^((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}\z/', $string)) { |
| 33 | - $this->addError($model, $attribute, Yii::t('yii', 'This in not valid IPv4 address {sample}', ['sample' => '127.0.0.1'])); |
|
| 33 | + $this->addError($model, $attribute, Yii::t('yii', 'This in not valid IPv4 address {sample}', [ 'sample' => '127.0.0.1' ])); |
|
| 34 | 34 | return false; |
| 35 | 35 | } |
| 36 | 36 | } |