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
1cfa5bc9
Commit
1cfa5bc9
authored
Aug 18, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #4740: Added `yii\web\Session::addFlash()`
parent
f1aeac5d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
CHANGELOG.md
framework/CHANGELOG.md
+2
-1
Session.php
framework/web/Session.php
+11
-10
No files found.
framework/CHANGELOG.md
View file @
1cfa5bc9
...
@@ -183,9 +183,10 @@ Yii Framework 2 Change Log
...
@@ -183,9 +183,10 @@ Yii Framework 2 Change Log
-
Enh #4607: AR model will throw an exception if it does not have a primary key to avoid updating/deleting data massively (qiangxue)
-
Enh #4607: AR model will throw an exception if it does not have a primary key to avoid updating/deleting data massively (qiangxue)
-
Enh #4630: Added automatic generating of unique slug value to
`yii\behaviors\Sluggable`
(klimov-paul)
-
Enh #4630: Added automatic generating of unique slug value to
`yii\behaviors\Sluggable`
(klimov-paul)
-
Enh #4636: Added
`yii\web\Response::setDownloadHeaders()`
(pawzar)
-
Enh #4636: Added
`yii\web\Response::setDownloadHeaders()`
(pawzar)
-
Enh #4644: Added
`
\
yii\db\Schema::createColumnSchema()`
to be able to customize column schema used (mcd-php)
-
Enh #4644: Added
`yii\db\Schema::createColumnSchema()`
to be able to customize column schema used (mcd-php)
-
Enh #4656: HtmlPurifier helper config can now be a closure to change the purifier config object after it was created (Alex-Code)
-
Enh #4656: HtmlPurifier helper config can now be a closure to change the purifier config object after it was created (Alex-Code)
-
Enh #4691: Encoding on
`ActiveForm`
and
`ActiveField`
validation errors is now configurable (Alex-Code)
-
Enh #4691: Encoding on
`ActiveForm`
and
`ActiveField`
validation errors is now configurable (Alex-Code)
-
Enh #4740: Added
`yii\web\Session::addFlash()`
(restyler)
-
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/web/Session.php
View file @
1cfa5bc9
...
@@ -699,9 +699,10 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
...
@@ -699,9 +699,10 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
}
}
/**
/**
* S
tore
s a flash message.
* S
et
s a flash message.
* A flash message will be automatically deleted after it is accessed in a request and the deletion will happen
* A flash message will be automatically deleted after it is accessed in a request and the deletion will happen
* in the next request.
* in the next request.
* If there is already an existing flash message with the same key, it will be overwritten by the new one.
* @param string $key the key identifying the flash message. Note that flash messages
* @param string $key the key identifying the flash message. Note that flash messages
* and normal session variables share the same name space. If you have a normal
* and normal session variables share the same name space. If you have a normal
* session variable using the same name, its value will be overwritten by this method.
* session variable using the same name, its value will be overwritten by this method.
...
@@ -722,14 +723,14 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
...
@@ -722,14 +723,14 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
}
}
/**
/**
* Appends new flash message to the specified key.
* Adds a flash message.
* If there are existing flash messages with the same key, the new one will be appended to the existing message array.
* @param string $key the key identifying the flash message.
* @param string $key the key identifying the flash message.
* @param mixed $value flash message
* @param mixed $value flash message
* @param boolean $removeAfterAccess whether the flash message should be automatically removed only if
* @param boolean $removeAfterAccess whether the flash message should be automatically removed only if
* it is accessed. If false, the flash message will be automatically removed after the next request,
* it is accessed. If false, the flash message will be automatically removed after the next request,
* regardless if it is accessed or not. If true (default value), the flash message will remain until after
* regardless if it is accessed or not. If true (default value), the flash message will remain until after
* it is accessed.
* it is accessed.
* @throws InvalidParamException if exising session variable is not array.
* @see getFlash()
* @see getFlash()
* @see removeFlash()
* @see removeFlash()
*/
*/
...
@@ -737,16 +738,16 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
...
@@ -737,16 +738,16 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
{
{
$counters
=
$this
->
get
(
$this
->
flashParam
,
[]);
$counters
=
$this
->
get
(
$this
->
flashParam
,
[]);
$counters
[
$key
]
=
$removeAfterAccess
?
-
1
:
0
;
$counters
[
$key
]
=
$removeAfterAccess
?
-
1
:
0
;
if
(
!
empty
(
$_SESSION
[
$key
]))
{
$_SESSION
[
$this
->
flashParam
]
=
$counters
;
// If it's not an array, convert it to array
if
(
empty
(
$_SESSION
[
$key
]))
{
if
(
!
is_array
(
$_SESSION
[
$key
]))
{
$_SESSION
[
$key
]
=
[
$value
];
$_SESSION
[
$key
]
=
[
$_SESSION
[
$key
]];
}
else
{
}
if
(
is_array
(
$_SESSION
[
$key
]))
{
$_SESSION
[
$key
][]
=
$value
;
$_SESSION
[
$key
][]
=
$value
;
}
else
{
}
else
{
$_SESSION
[
$key
]
=
[
$value
];
$_SESSION
[
$key
]
=
[
$_SESSION
[
$key
],
$value
];
}
}
}
$_SESSION
[
$this
->
flashParam
]
=
$counters
;
}
}
/**
/**
...
...
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