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
0aff0585
Commit
0aff0585
authored
May 21, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-4' of github.com:kartik-v/yii2 into kartik-v-patch-4
Conflicts: framework/CHANGELOG.md
parents
1803d666
45e355a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
CHANGELOG.md
framework/CHANGELOG.md
+2
-1
UPGRADE.md
framework/UPGRADE.md
+5
-0
BaseHtml.php
framework/helpers/BaseHtml.php
+13
-5
No files found.
framework/CHANGELOG.md
View file @
0aff0585
...
@@ -46,7 +46,8 @@ Yii Framework 2 Change Log
...
@@ -46,7 +46,8 @@ Yii Framework 2 Change Log
-
Enh #3252: Added support for case insensitive matching using ILIKE to PostgreSQL QueryBuilder (cebe)
-
Enh #3252: Added support for case insensitive matching using ILIKE to PostgreSQL QueryBuilder (cebe)
-
Enh #3298: Supported configuring
`View::theme`
using a class name (netyum, qiangxue)
-
Enh #3298: Supported configuring
`View::theme`
using a class name (netyum, qiangxue)
-
Enh #3328:
`BaseMailer`
generates better text body from html body (armab)
-
Enh #3328:
`BaseMailer`
generates better text body from html body (armab)
-
Enh #3518:
`yii\helpers\Html::encode()`
now replaces invalid code sequences with "�" (DaSourcerer)
-
Enh #3472: Added configurable option to encode spaces in dropDownLists and listBoxes (kartik-v)
-
Enh #3518:
`yii\helpers\Html::encode()`
now replaces invalid code sequences with "?" (DaSourcerer)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Added support for using sub-queries when building a DB query with
`IN`
condition (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
-
Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
-
Enh: Added
`yii\web\UrlManager::addRules()`
to simplify adding new URL rules (qiangxue)
-
Enh: Added
`yii\web\UrlManager::addRules()`
to simplify adding new URL rules (qiangxue)
...
...
framework/UPGRADE.md
View file @
0aff0585
...
@@ -33,3 +33,8 @@ Upgrade from Yii 2.0 Beta
...
@@ -33,3 +33,8 @@ Upgrade from Yii 2.0 Beta
*
If you are sharing the same cache across different applications, you should configure
*
If you are sharing the same cache across different applications, you should configure
the
`keyPrefix`
property of the cache component to use some unique string.
the
`keyPrefix`
property of the cache component to use some unique string.
Previously, this property was automatically assigned with a unique string.
Previously, this property was automatically assigned with a unique string.
*
If you are using
`yii\helpers\Html::dropDownList`
or
`yii\helpers\Html::listBox`
, a new parameter
`encodeSpaces`
is now available within the
`options`
array. This defaults to
`false`
. If
set to
`true`
all spaces in the rendered option value and prompt will be replaced with
` `
the HTML non breaking space character.
framework/helpers/BaseHtml.php
View file @
0aff0585
...
@@ -729,6 +729,8 @@ class BaseHtml
...
@@ -729,6 +729,8 @@ class BaseHtml
*
*
* - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options',
* - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options',
* except that the array keys represent the optgroup labels specified in $items.
* except that the array keys represent the optgroup labels specified in $items.
* - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character.
* Defaults to `false`.
*
*
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
...
@@ -743,7 +745,6 @@ class BaseHtml
...
@@ -743,7 +745,6 @@ class BaseHtml
}
}
$options
[
'name'
]
=
$name
;
$options
[
'name'
]
=
$name
;
$selectOptions
=
static
::
renderSelectOptions
(
$selection
,
$items
,
$options
);
$selectOptions
=
static
::
renderSelectOptions
(
$selection
,
$items
,
$options
);
return
static
::
tag
(
'select'
,
"
\n
"
.
$selectOptions
.
"
\n
"
,
$options
);
return
static
::
tag
(
'select'
,
"
\n
"
.
$selectOptions
.
"
\n
"
,
$options
);
}
}
...
@@ -777,6 +778,8 @@ class BaseHtml
...
@@ -777,6 +778,8 @@ class BaseHtml
* - unselect: string, the value that will be submitted when no option is selected.
* - unselect: string, the value that will be submitted when no option is selected.
* When this attribute is set, a hidden field will be generated so that if no option is selected in multiple
* When this attribute is set, a hidden field will be generated so that if no option is selected in multiple
* mode, we can still obtain the posted unselect value.
* mode, we can still obtain the posted unselect value.
* - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character.
* Defaults to `false`.
*
*
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
...
@@ -804,7 +807,6 @@ class BaseHtml
...
@@ -804,7 +807,6 @@ class BaseHtml
$hidden
=
''
;
$hidden
=
''
;
}
}
$selectOptions
=
static
::
renderSelectOptions
(
$selection
,
$items
,
$options
);
$selectOptions
=
static
::
renderSelectOptions
(
$selection
,
$items
,
$options
);
return
$hidden
.
static
::
tag
(
'select'
,
"
\n
"
.
$selectOptions
.
"
\n
"
,
$options
);
return
$hidden
.
static
::
tag
(
'select'
,
"
\n
"
.
$selectOptions
.
"
\n
"
,
$options
);
}
}
...
@@ -1354,6 +1356,8 @@ class BaseHtml
...
@@ -1354,6 +1356,8 @@ class BaseHtml
*
*
* - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options',
* - groups: array, the attributes for the optgroup tags. The structure of this is similar to that of 'options',
* except that the array keys represent the optgroup labels specified in $items.
* except that the array keys represent the optgroup labels specified in $items.
* - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character.
* Defaults to `false`.
*
*
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
...
@@ -1407,6 +1411,8 @@ class BaseHtml
...
@@ -1407,6 +1411,8 @@ class BaseHtml
* - unselect: string, the value that will be submitted when no option is selected.
* - unselect: string, the value that will be submitted when no option is selected.
* When this attribute is set, a hidden field will be generated so that if no option is selected in multiple
* When this attribute is set, a hidden field will be generated so that if no option is selected in multiple
* mode, we can still obtain the posted unselect value.
* mode, we can still obtain the posted unselect value.
* - encodeSpaces: bool, whether to encode spaces in option prompt and option value with ` ` character.
* Defaults to `false`.
*
*
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* The rest of the options will be rendered as the attributes of the resulting tag. The values will
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
* be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered.
...
@@ -1540,15 +1546,17 @@ class BaseHtml
...
@@ -1540,15 +1546,17 @@ class BaseHtml
public
static
function
renderSelectOptions
(
$selection
,
$items
,
&
$tagOptions
=
[])
public
static
function
renderSelectOptions
(
$selection
,
$items
,
&
$tagOptions
=
[])
{
{
$lines
=
[];
$lines
=
[];
$encodeSpaces
=
ArrayHelper
::
remove
(
$tagOptions
,
'encodeSpaces'
,
false
);
if
(
isset
(
$tagOptions
[
'prompt'
]))
{
if
(
isset
(
$tagOptions
[
'prompt'
]))
{
$prompt
=
str_replace
(
' '
,
' '
,
static
::
encode
(
$tagOptions
[
'prompt'
])
);
$prompt
=
$encodeSpaces
?
str_replace
(
' '
,
' '
,
static
::
encode
(
$tagOptions
[
'prompt'
]))
:
static
::
encode
(
$tagOptions
[
'prompt'
]
);
$lines
[]
=
static
::
tag
(
'option'
,
$prompt
,
[
'value'
=>
''
]);
$lines
[]
=
static
::
tag
(
'option'
,
$prompt
,
[
'value'
=>
''
]);
}
}
$options
=
isset
(
$tagOptions
[
'options'
])
?
$tagOptions
[
'options'
]
:
[];
$options
=
isset
(
$tagOptions
[
'options'
])
?
$tagOptions
[
'options'
]
:
[];
$groups
=
isset
(
$tagOptions
[
'groups'
])
?
$tagOptions
[
'groups'
]
:
[];
$groups
=
isset
(
$tagOptions
[
'groups'
])
?
$tagOptions
[
'groups'
]
:
[];
unset
(
$tagOptions
[
'prompt'
],
$tagOptions
[
'options'
],
$tagOptions
[
'groups'
]);
unset
(
$tagOptions
[
'prompt'
],
$tagOptions
[
'options'
],
$tagOptions
[
'groups'
]);
$options
[
'encodeSpaces'
]
=
ArrayHelper
::
getValue
(
$options
,
'encodeSpaces'
,
$encodeSpaces
);
foreach
(
$items
as
$key
=>
$value
)
{
foreach
(
$items
as
$key
=>
$value
)
{
if
(
is_array
(
$value
))
{
if
(
is_array
(
$value
))
{
$groupAttrs
=
isset
(
$groups
[
$key
])
?
$groups
[
$key
]
:
[];
$groupAttrs
=
isset
(
$groups
[
$key
])
?
$groups
[
$key
]
:
[];
...
@@ -1562,7 +1570,7 @@ class BaseHtml
...
@@ -1562,7 +1570,7 @@ class BaseHtml
$attrs
[
'selected'
]
=
$selection
!==
null
&&
$attrs
[
'selected'
]
=
$selection
!==
null
&&
(
!
is_array
(
$selection
)
&&
!
strcmp
(
$key
,
$selection
)
(
!
is_array
(
$selection
)
&&
!
strcmp
(
$key
,
$selection
)
||
is_array
(
$selection
)
&&
in_array
(
$key
,
$selection
));
||
is_array
(
$selection
)
&&
in_array
(
$key
,
$selection
));
$lines
[]
=
static
::
tag
(
'option'
,
str_replace
(
' '
,
' '
,
static
::
encode
(
$value
)),
$attrs
);
$lines
[]
=
static
::
tag
(
'option'
,
(
$encodeSpaces
?
str_replace
(
' '
,
' '
,
static
::
encode
(
$value
))
:
static
::
encode
(
$value
)),
$attrs
);
}
}
}
}
...
...
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