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
6316c424
Commit
6316c424
authored
May 22, 2013
by
Antonio Ramirez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'upstream' into 313-Inflector-Helper
* upstream: Fixes #312. Additional docs on IDN in EmailValidator and UrlValidator.
parents
05523640
a954312a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
EmailValidator.php
framework/yii/validators/EmailValidator.php
+6
-0
UrlValidator.php
framework/yii/validators/UrlValidator.php
+6
-1
No files found.
framework/yii/validators/EmailValidator.php
View file @
6316c424
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
namespace
yii\validators
;
namespace
yii\validators
;
use
Yii
;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\web\JsExpression
;
use
yii\web\JsExpression
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
...
@@ -50,6 +51,8 @@ class EmailValidator extends Validator
...
@@ -50,6 +51,8 @@ class EmailValidator extends Validator
/**
/**
* @var boolean whether validation process should take into account IDN (internationalized domain
* @var boolean whether validation process should take into account IDN (internationalized domain
* names). Defaults to false meaning that validation of emails containing IDN will always fail.
* names). Defaults to false meaning that validation of emails containing IDN will always fail.
* Note that in order to use IDN validation you have to install and enable `intl` PHP extension,
* otherwise an exception would be thrown.
*/
*/
public
$enableIDN
=
false
;
public
$enableIDN
=
false
;
...
@@ -60,6 +63,9 @@ class EmailValidator extends Validator
...
@@ -60,6 +63,9 @@ class EmailValidator extends Validator
public
function
init
()
public
function
init
()
{
{
parent
::
init
();
parent
::
init
();
if
(
$this
->
enableIDN
&&
!
function_exists
(
'idn_to_ascii'
))
{
throw
new
InvalidConfigException
(
'In order to use IDN validation intl extension must be installed and enabled.'
);
}
if
(
$this
->
message
===
null
)
{
if
(
$this
->
message
===
null
)
{
$this
->
message
=
Yii
::
t
(
'yii'
,
'{attribute} is not a valid email address.'
);
$this
->
message
=
Yii
::
t
(
'yii'
,
'{attribute} is not a valid email address.'
);
}
}
...
...
framework/yii/validators/UrlValidator.php
View file @
6316c424
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
namespace
yii\validators
;
namespace
yii\validators
;
use
Yii
;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\web\JsExpression
;
use
yii\web\JsExpression
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
...
@@ -40,7 +41,8 @@ class UrlValidator extends Validator
...
@@ -40,7 +41,8 @@ class UrlValidator extends Validator
/**
/**
* @var boolean whether validation process should take into account IDN (internationalized
* @var boolean whether validation process should take into account IDN (internationalized
* domain names). Defaults to false meaning that validation of URLs containing IDN will always
* domain names). Defaults to false meaning that validation of URLs containing IDN will always
* fail.
* fail. Note that in order to use IDN validation you have to install and enable `intl` PHP
* extension, otherwise an exception would be thrown.
*/
*/
public
$enableIDN
=
false
;
public
$enableIDN
=
false
;
...
@@ -51,6 +53,9 @@ class UrlValidator extends Validator
...
@@ -51,6 +53,9 @@ class UrlValidator extends Validator
public
function
init
()
public
function
init
()
{
{
parent
::
init
();
parent
::
init
();
if
(
$this
->
enableIDN
&&
!
function_exists
(
'idn_to_ascii'
))
{
throw
new
InvalidConfigException
(
'In order to use IDN validation intl extension must be installed and enabled.'
);
}
if
(
$this
->
message
===
null
)
{
if
(
$this
->
message
===
null
)
{
$this
->
message
=
Yii
::
t
(
'yii'
,
'{attribute} is not a valid URL.'
);
$this
->
message
=
Yii
::
t
(
'yii'
,
'{attribute} is not a valid URL.'
);
}
}
...
...
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