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
e1f7763a
Commit
e1f7763a
authored
Oct 09, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:yiisoft/yii2
parents
15c8935d
1b052f3e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
14 deletions
+23
-14
README.md
docs/guide-uz/README.md
+2
-2
Formatter.php
framework/i18n/Formatter.php
+21
-11
Request.php
framework/web/Request.php
+0
-1
No files found.
docs/guide-uz/README.md
View file @
e1f7763a
Yii 2.0 bo'yicha to'liq qo'llanma
Yii 2.0 bo'yicha to'liq qo'llanma
=============================
=============================
====
Ushbu qo'llanma
[
Yii qo'llanmalarining holati
bilan
](
http://www.yiiframework.com/doc/terms/
)
bilan mos holda yo'lga qo'yildi.
Ushbu qo'llanma
[
Yii qo'llanmalarining holati
](
http://www.yiiframework.com/doc/terms/
)
bilan mos holda yo'lga qo'yildi.
All Rights Reserved.
All Rights Reserved.
...
...
framework/i18n/Formatter.php
View file @
e1f7763a
...
@@ -7,7 +7,9 @@
...
@@ -7,7 +7,9 @@
namespace
yii\i18n
;
namespace
yii\i18n
;
use
DateInterval
;
use
DateTime
;
use
DateTime
;
use
DateTimeInterface
;
use
DateTimeZone
;
use
DateTimeZone
;
use
IntlDateFormatter
;
use
IntlDateFormatter
;
use
NumberFormatter
;
use
NumberFormatter
;
...
@@ -566,7 +568,7 @@ class Formatter extends Component
...
@@ -566,7 +568,7 @@ class Formatter extends Component
*/
*/
protected
function
normalizeDatetimeValue
(
$value
)
protected
function
normalizeDatetimeValue
(
$value
)
{
{
if
(
$value
===
null
||
$value
instanceof
DateTime
)
{
if
(
$value
===
null
||
$value
instanceof
DateTime
||
$value
instanceof
DateTimeInterface
)
{
// skip any processing
// skip any processing
return
$value
;
return
$value
;
}
}
...
@@ -595,13 +597,13 @@ class Formatter extends Component
...
@@ -595,13 +597,13 @@ class Formatter extends Component
/**
/**
* Formats a date, time or datetime in a float number as UNIX timestamp (seconds since 01-01-1970).
* Formats a date, time or datetime in a float number as UNIX timestamp (seconds since 01-01-1970).
* @param integer|string|DateTime
|\DateInterval
$value the value to be formatted. The following
* @param integer|string|DateTime $value the value to be formatted. The following
* types of value are supported:
* types of value are supported:
*
*
* - an integer representing a UNIX timestamp
* - an integer representing a UNIX timestamp
* - a string that can be
parsed into a UNIX timestamp via `strtotime()` or that can be passed to a DateInterval constructor
.
* - a string that can be
[parsed to create a DateTime object](http://php.net/manual/en/datetime.formats.php)
.
*
- a PHP DateTime object
*
The timestamp is assumed to be in UTC unless a timezone is explicitly given.
* - a PHP
DateInterval object (a positive time interval will refer to the past, a negative one to the future)
* - a PHP
[DateTime](http://php.net/manual/en/class.datetime.php) object
*
*
* @return string the formatted result.
* @return string the formatted result.
*/
*/
...
@@ -617,15 +619,23 @@ class Formatter extends Component
...
@@ -617,15 +619,23 @@ class Formatter extends Component
/**
/**
* Formats the value as the time interval between a date and now in human readable form.
* Formats the value as the time interval between a date and now in human readable form.
*
*
* @param integer|string|DateTime|\DateInterval $value the value to be formatted. The following
* This method can be used in three different ways:
*
* 1. Using a timestamp that is relative to `now`.
* 2. Using a timestamp that is relative to the `$referenceTime`.
* 3. Using a `DateInterval` object.
*
* @param integer|string|DateTime|DateInterval $value the value to be formatted. The following
* types of value are supported:
* types of value are supported:
*
*
* - an integer representing a UNIX timestamp
* - an integer representing a UNIX timestamp
* - a string that can be parsed into a UNIX timestamp via `strtotime()` or that can be passed to a DateInterval constructor.
* - a string that can be [parsed to create a DateTime object](http://php.net/manual/en/datetime.formats.php).
* - a PHP DateTime object
* The timestamp is assumed to be in UTC unless a timezone is explicitly given.
* - a PHP [DateTime](http://php.net/manual/en/class.datetime.php) object
* - a PHP DateInterval object (a positive time interval will refer to the past, a negative one to the future)
* - a PHP DateInterval object (a positive time interval will refer to the past, a negative one to the future)
*
*
* @param integer|string|DateTime|\DateInterval $referenceTime if specified the value is used instead of `now`.
* @param integer|string|DateTime $referenceTime if specified the value is used as a reference time instead of `now`
* when `$value` is not a `DateInterval` object.
* @return string the formatted result.
* @return string the formatted result.
* @throws InvalidParamException if the input value can not be evaluated as a date value.
* @throws InvalidParamException if the input value can not be evaluated as a date value.
*/
*/
...
@@ -635,7 +645,7 @@ class Formatter extends Component
...
@@ -635,7 +645,7 @@ class Formatter extends Component
return
$this
->
nullDisplay
;
return
$this
->
nullDisplay
;
}
}
if
(
$value
instanceof
\
DateInterval
)
{
if
(
$value
instanceof
DateInterval
)
{
$interval
=
$value
;
$interval
=
$value
;
}
else
{
}
else
{
$timestamp
=
$this
->
normalizeDatetimeValue
(
$value
);
$timestamp
=
$this
->
normalizeDatetimeValue
(
$value
);
...
@@ -644,7 +654,7 @@ class Formatter extends Component
...
@@ -644,7 +654,7 @@ class Formatter extends Component
// $value is not a valid date/time value, so we try
// $value is not a valid date/time value, so we try
// to create a DateInterval with it
// to create a DateInterval with it
try
{
try
{
$interval
=
new
\
DateInterval
(
$value
);
$interval
=
new
DateInterval
(
$value
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
// invalid date/time and invalid interval
// invalid date/time and invalid interval
return
$this
->
nullDisplay
;
return
$this
->
nullDisplay
;
...
...
framework/web/Request.php
View file @
e1f7763a
...
@@ -1287,7 +1287,6 @@ class Request extends \yii\base\Request
...
@@ -1287,7 +1287,6 @@ class Request extends \yii\base\Request
$config
[
'value'
]
=
$token
;
$config
[
'value'
]
=
$token
;
Yii
::
$app
->
getResponse
()
->
getCookies
()
->
add
(
new
Cookie
(
$config
));
Yii
::
$app
->
getResponse
()
->
getCookies
()
->
add
(
new
Cookie
(
$config
));
}
else
{
}
else
{
$token
=
Yii
::
$app
->
getSecurity
()
->
generateRandomString
();
Yii
::
$app
->
getSession
()
->
set
(
$this
->
csrfParam
,
$token
);
Yii
::
$app
->
getSession
()
->
set
(
$this
->
csrfParam
,
$token
);
}
}
return
$token
;
return
$token
;
...
...
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