Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
e7fab51e
Commit
e7fab51e
authored
Jan 12, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #1870: better fix that is message extractor friendly
parent
cdfaf950
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
30 deletions
+30
-30
BooleanValidator.php
framework/validators/BooleanValidator.php
+2
-2
CompareValidator.php
framework/validators/CompareValidator.php
+2
-2
EmailValidator.php
framework/validators/EmailValidator.php
+2
-2
NumberValidator.php
framework/validators/NumberValidator.php
+6
-6
RangeValidator.php
framework/validators/RangeValidator.php
+2
-2
RegularExpressionValidator.php
framework/validators/RegularExpressionValidator.php
+2
-2
RequiredValidator.php
framework/validators/RequiredValidator.php
+4
-4
StringValidator.php
framework/validators/StringValidator.php
+8
-8
UrlValidator.php
framework/validators/UrlValidator.php
+2
-2
No files found.
framework/validators/BooleanValidator.php
View file @
e7fab51e
...
...
@@ -72,11 +72,11 @@ class BooleanValidator extends Validator
$options
=
[
'trueValue'
=>
$this
->
trueValue
,
'falseValue'
=>
$this
->
falseValue
,
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
'true'
=>
$this
->
trueValue
,
'false'
=>
$this
->
falseValue
,
]),
]
,
Yii
::
$app
->
language
),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/validators/CompareValidator.php
View file @
e7fab51e
...
...
@@ -195,11 +195,11 @@ class CompareValidator extends Validator
$options
[
'skipOnEmpty'
]
=
1
;
}
$options
[
'message'
]
=
Yii
::
t
(
'yii'
,
$this
->
message
,
[
$options
[
'message'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
'compareAttribute'
=>
$compareValue
,
'compareValue'
=>
$compareValue
,
]);
]
,
Yii
::
$app
->
language
);
ValidationAsset
::
register
(
$view
);
return
'yii.validation.compare(value, messages, '
.
json_encode
(
$options
)
.
');'
;
...
...
framework/validators/EmailValidator.php
View file @
e7fab51e
...
...
@@ -98,9 +98,9 @@ class EmailValidator extends Validator
'pattern'
=>
new
JsExpression
(
$this
->
pattern
),
'fullPattern'
=>
new
JsExpression
(
$this
->
fullPattern
),
'allowName'
=>
$this
->
allowName
,
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
]
,
Yii
::
$app
->
language
),
'enableIDN'
=>
(
boolean
)
$this
->
enableIDN
,
];
if
(
$this
->
skipOnEmpty
)
{
...
...
framework/validators/NumberValidator.php
View file @
e7fab51e
...
...
@@ -124,24 +124,24 @@ class NumberValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$this
->
integerOnly
?
$this
->
integerPattern
:
$this
->
numberPattern
),
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$label
,
]),
]
,
Yii
::
$app
->
language
),
];
if
(
$this
->
min
!==
null
)
{
$options
[
'min'
]
=
$this
->
min
;
$options
[
'tooSmall'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooSmall
,
[
$options
[
'tooSmall'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
tooSmall
,
[
'attribute'
=>
$label
,
'min'
=>
$this
->
min
,
]);
]
,
Yii
::
$app
->
language
);
}
if
(
$this
->
max
!==
null
)
{
$options
[
'max'
]
=
$this
->
max
;
$options
[
'tooBig'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooBig
,
[
$options
[
'tooBig'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
tooBig
,
[
'attribute'
=>
$label
,
'max'
=>
$this
->
max
,
]);
]
,
Yii
::
$app
->
language
);
}
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/validators/RangeValidator.php
View file @
e7fab51e
...
...
@@ -73,9 +73,9 @@ class RangeValidator extends Validator
$options
=
[
'range'
=>
$range
,
'not'
=>
$this
->
not
,
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
]
,
Yii
::
$app
->
language
),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/validators/RegularExpressionValidator.php
View file @
e7fab51e
...
...
@@ -80,9 +80,9 @@ class RegularExpressionValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$pattern
),
'not'
=>
$this
->
not
,
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
]
,
Yii
::
$app
->
language
),
];
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/validators/RequiredValidator.php
View file @
e7fab51e
...
...
@@ -90,9 +90,9 @@ class RequiredValidator extends Validator
{
$options
=
[];
if
(
$this
->
requiredValue
!==
null
)
{
$options
[
'message'
]
=
Yii
::
t
(
'yii'
,
$this
->
message
,
[
$options
[
'message'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'requiredValue'
=>
$this
->
requiredValue
,
]);
]
,
Yii
::
$app
->
language
);
$options
[
'requiredValue'
]
=
$this
->
requiredValue
;
}
else
{
$options
[
'message'
]
=
$this
->
message
;
...
...
@@ -101,9 +101,9 @@ class RequiredValidator extends Validator
$options
[
'strict'
]
=
1
;
}
$options
[
'message'
]
=
Yii
::
t
(
'yii'
,
$options
[
'message'
],
[
$options
[
'message'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$options
[
'message'
],
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
]);
]
,
Yii
::
$app
->
language
);
ValidationAsset
::
register
(
$view
);
return
'yii.validation.required(value, messages, '
.
json_encode
(
$options
)
.
');'
;
...
...
framework/validators/StringValidator.php
View file @
e7fab51e
...
...
@@ -151,31 +151,31 @@ class StringValidator extends Validator
$label
=
$object
->
getAttributeLabel
(
$attribute
);
$options
=
[
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'{attribute}'
=>
$label
,
]),
]
,
Yii
::
$app
->
language
),
];
if
(
$this
->
min
!==
null
)
{
$options
[
'min'
]
=
$this
->
min
;
$options
[
'tooShort'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooShort
,
[
$options
[
'tooShort'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
tooShort
,
[
'attribute'
=>
$label
,
'min'
=>
$this
->
min
,
]);
]
,
Yii
::
$app
->
language
);
}
if
(
$this
->
max
!==
null
)
{
$options
[
'max'
]
=
$this
->
max
;
$options
[
'tooLong'
]
=
Yii
::
t
(
'yii'
,
$this
->
tooLong
,
[
$options
[
'tooLong'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
tooLong
,
[
'attribute'
=>
$label
,
'max'
=>
$this
->
max
,
]);
]
,
Yii
::
$app
->
language
);
}
if
(
$this
->
length
!==
null
)
{
$options
[
'is'
]
=
$this
->
length
;
$options
[
'notEqual'
]
=
Yii
::
t
(
'yii'
,
$this
->
notEqual
,
[
$options
[
'notEqual'
]
=
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
notEqual
,
[
'attribute'
=>
$label
,
'length'
=>
$this
->
length
,
]);
]
,
Yii
::
$app
->
language
);
}
if
(
$this
->
skipOnEmpty
)
{
$options
[
'skipOnEmpty'
]
=
1
;
...
...
framework/validators/UrlValidator.php
View file @
e7fab51e
...
...
@@ -121,9 +121,9 @@ class UrlValidator extends Validator
$options
=
[
'pattern'
=>
new
JsExpression
(
$pattern
),
'message'
=>
Yii
::
t
(
'yii'
,
$this
->
message
,
[
'message'
=>
Yii
::
$app
->
getI18n
()
->
format
(
$this
->
message
,
[
'attribute'
=>
$object
->
getAttributeLabel
(
$attribute
),
]),
]
,
Yii
::
$app
->
language
),
'enableIDN'
=>
(
boolean
)
$this
->
enableIDN
,
];
if
(
$this
->
skipOnEmpty
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment