Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
yii2bootstrap
Project
Project
Details
Activity
Releases
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
夏彬
yii2bootstrap
Commits
004a069c
Commit
004a069c
authored
Jun 08, 2013
by
gevik
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'upstream/master'
parents
e45e061c
cf1e12ad
Changes
70
Show whitespace changes
Inline
Side-by-side
Showing
70 changed files
with
2170 additions
and
1897 deletions
+2170
-1897
YiiBase.php
framework/yii/YiiBase.php
+26
-1
ErrorHandler.php
framework/yii/base/ErrorHandler.php
+1
-1
Formatter.php
framework/yii/base/Formatter.php
+0
-1
HttpException.php
framework/yii/base/HttpException.php
+3
-60
InvalidCallException.php
framework/yii/base/InvalidCallException.php
+0
-1
InvalidConfigException.php
framework/yii/base/InvalidConfigException.php
+0
-1
InvalidParamException.php
framework/yii/base/InvalidParamException.php
+0
-1
InvalidRouteException.php
framework/yii/base/InvalidRouteException.php
+0
-1
Jsonable.php
framework/yii/base/Jsonable.php
+22
-0
Model.php
framework/yii/base/Model.php
+12
-1
Module.php
framework/yii/base/Module.php
+667
-667
NotSupportedException.php
framework/yii/base/NotSupportedException.php
+0
-1
Object.php
framework/yii/base/Object.php
+16
-3
Theme.php
framework/yii/base/Theme.php
+1
-1
UnknownClassException.php
framework/yii/base/UnknownClassException.php
+0
-1
UnknownMethodException.php
framework/yii/base/UnknownMethodException.php
+0
-1
UnknownPropertyException.php
framework/yii/base/UnknownPropertyException.php
+0
-1
Button.php
framework/yii/bootstrap/Button.php
+1
-2
ButtonDropdown.php
framework/yii/bootstrap/ButtonDropdown.php
+1
-1
ButtonGroup.php
framework/yii/bootstrap/ButtonGroup.php
+0
-1
Collapse.php
framework/yii/bootstrap/Collapse.php
+1
-1
Dropdown.php
framework/yii/bootstrap/Dropdown.php
+0
-1
Nav.php
framework/yii/bootstrap/Nav.php
+1
-1
Progress.php
framework/yii/bootstrap/Progress.php
+0
-1
Widget.php
framework/yii/bootstrap/Widget.php
+0
-1
DbCache.php
framework/yii/caching/DbCache.php
+1
-1
XCache.php
framework/yii/caching/XCache.php
+0
-1
Exception.php
framework/yii/console/Exception.php
+0
-1
AssetController.php
framework/yii/console/controllers/AssetController.php
+3
-3
MessageController.php
framework/yii/console/controllers/MessageController.php
+1
-2
MigrateController.php
framework/yii/console/controllers/MigrateController.php
+635
-635
Connection.php
framework/yii/db/Connection.php
+2
-5
PDO.php
framework/yii/db/pgsql/PDO.php
+0
-103
Schema.php
framework/yii/db/pgsql/Schema.php
+65
-67
Module.php
framework/yii/debug/Module.php
+1
-1
DefaultController.php
framework/yii/debug/controllers/DefaultController.php
+1
-1
Json.php
framework/yii/helpers/Json.php
+0
-1
Console.php
framework/yii/helpers/base/Console.php
+2
-3
Html.php
framework/yii/helpers/base/Html.php
+0
-1
Inflector.php
framework/yii/helpers/base/Inflector.php
+3
-3
Json.php
framework/yii/helpers/base/Json.php
+12
-8
DbMessageSource.php
framework/yii/i18n/DbMessageSource.php
+158
-0
I18N.php
framework/yii/i18n/I18N.php
+2
-7
MessageSource.php
framework/yii/i18n/MessageSource.php
+0
-1
Accordion.php
framework/yii/jui/Accordion.php
+1
-1
Menu.php
framework/yii/jui/Menu.php
+0
-1
Widget.php
framework/yii/jui/Widget.php
+0
-1
DbManager.php
framework/yii/rbac/DbManager.php
+2
-1
PhpManager.php
framework/yii/rbac/PhpManager.php
+1
-1
requirements.php
framework/yii/requirements/requirements.php
+1
-1
CaptchaValidator.php
framework/yii/validators/CaptchaValidator.php
+0
-1
DateValidator.php
framework/yii/validators/DateValidator.php
+0
-1
DefaultValueValidator.php
framework/yii/validators/DefaultValueValidator.php
+0
-1
ExistValidator.php
framework/yii/validators/ExistValidator.php
+0
-1
FilterValidator.php
framework/yii/validators/FilterValidator.php
+1
-0
RangeValidator.php
framework/yii/validators/RangeValidator.php
+1
-1
RegularExpressionValidator.php
framework/yii/validators/RegularExpressionValidator.php
+1
-1
StringValidator.php
framework/yii/validators/StringValidator.php
+0
-1
UrlValidator.php
framework/yii/validators/UrlValidator.php
+1
-1
Validator.php
framework/yii/validators/Validator.php
+1
-1
HeaderCollection.php
framework/yii/web/HeaderCollection.php
+0
-1
PageCache.php
framework/yii/web/PageCache.php
+103
-103
Request.php
framework/yii/web/Request.php
+0
-1
Response.php
framework/yii/web/Response.php
+242
-1
UploadedFile.php
framework/yii/web/UploadedFile.php
+1
-1
User.php
framework/yii/web/User.php
+1
-1
FragmentCache.php
framework/yii/widgets/FragmentCache.php
+174
-174
ListPager.php
framework/yii/widgets/ListPager.php
+0
-1
config.php
tests/unit/data/config.php
+0
-3
ResponseTest.php
tests/unit/framework/web/ResponseTest.php
+1
-0
No files found.
framework/yii/YiiBase.php
View file @
004a069c
...
@@ -606,11 +606,36 @@ class YiiBase
...
@@ -606,11 +606,36 @@ class YiiBase
public
static
function
t
(
$category
,
$message
,
$params
=
array
(),
$language
=
null
)
public
static
function
t
(
$category
,
$message
,
$params
=
array
(),
$language
=
null
)
{
{
if
(
self
::
$app
!==
null
)
{
if
(
self
::
$app
!==
null
)
{
return
self
::
$app
->
getI18N
()
->
translate
(
$category
,
$message
,
$params
,
$language
);
return
self
::
$app
->
getI18N
()
->
translate
(
$category
,
$message
,
$params
,
$language
?:
self
::
$app
->
language
);
}
else
{
}
else
{
return
is_array
(
$params
)
?
strtr
(
$message
,
$params
)
:
$message
;
return
is_array
(
$params
)
?
strtr
(
$message
,
$params
)
:
$message
;
}
}
}
}
/**
* Configures an object with the initial property values.
* @param object $object the object to be configured
* @param array $properties the property initial values given in terms of name-value pairs.
*/
public
static
function
configure
(
$object
,
$properties
)
{
foreach
(
$properties
as
$name
=>
$value
)
{
$object
->
$name
=
$value
;
}
}
/**
* Returns the public member variables of an object.
* This method is provided such that we can get the public member variables of an object.
* It is different from "get_object_vars()" because the latter will return private
* and protected variables if it is called within the object itself.
* @param object $object the object to be handled
* @return array the public member variables of the object
*/
public
static
function
getObjectVars
(
$object
)
{
return
get_object_vars
(
$object
);
}
}
}
YiiBase
::
$aliases
=
array
(
YiiBase
::
$aliases
=
array
(
...
...
framework/yii/base/ErrorHandler.php
View file @
004a069c
...
@@ -255,7 +255,7 @@ class ErrorHandler extends Component
...
@@ -255,7 +255,7 @@ class ErrorHandler extends Component
if
(
isset
(
$_SERVER
[
'SERVER_SOFTWARE'
]))
{
if
(
isset
(
$_SERVER
[
'SERVER_SOFTWARE'
]))
{
foreach
(
$serverUrls
as
$url
=>
$keywords
)
{
foreach
(
$serverUrls
as
$url
=>
$keywords
)
{
foreach
(
$keywords
as
$keyword
)
{
foreach
(
$keywords
as
$keyword
)
{
if
(
stripos
(
$_SERVER
[
'SERVER_SOFTWARE'
],
$keyword
)
!==
false
)
{
if
(
stripos
(
$_SERVER
[
'SERVER_SOFTWARE'
],
$keyword
)
!==
false
)
{
return
'<a href="'
.
$url
.
'" target="_blank">'
.
$this
->
htmlEncode
(
$_SERVER
[
'SERVER_SOFTWARE'
])
.
'</a>'
;
return
'<a href="'
.
$url
.
'" target="_blank">'
.
$this
->
htmlEncode
(
$_SERVER
[
'SERVER_SOFTWARE'
])
.
'</a>'
;
}
}
}
}
...
...
framework/yii/base/Formatter.php
View file @
004a069c
...
@@ -12,7 +12,6 @@ use DateTime;
...
@@ -12,7 +12,6 @@ use DateTime;
use
yii\helpers\HtmlPurifier
;
use
yii\helpers\HtmlPurifier
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
* Formatter provides a set of commonly used data formatting methods.
* Formatter provides a set of commonly used data formatting methods.
*
*
...
...
framework/yii/base/HttpException.php
View file @
004a069c
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
namespace
yii\base
;
namespace
yii\base
;
/**
/**
* HttpException represents an exception caused by an improper request of the end-user.
* HttpException represents an exception caused by an improper request of the end-user.
*
*
...
@@ -42,66 +43,8 @@ class HttpException extends UserException
...
@@ -42,66 +43,8 @@ class HttpException extends UserException
*/
*/
public
function
getName
()
public
function
getName
()
{
{
static
$httpCodes
=
array
(
if
(
isset
(
\yii\web\Response
::
$statusTexts
[
$this
->
statusCode
]))
{
100
=>
'Continue'
,
return
\yii\web\Response
::
$statusTexts
[
$this
->
statusCode
];
101
=>
'Switching Protocols'
,
102
=>
'Processing'
,
118
=>
'Connection timed out'
,
200
=>
'OK'
,
201
=>
'Created'
,
202
=>
'Accepted'
,
203
=>
'Non-Authoritative'
,
204
=>
'No Content'
,
205
=>
'Reset Content'
,
206
=>
'Partial Content'
,
207
=>
'Multi-Status'
,
210
=>
'Content Different'
,
300
=>
'Multiple Choices'
,
301
=>
'Moved Permanently'
,
302
=>
'Found'
,
303
=>
'See Other'
,
304
=>
'Not Modified'
,
305
=>
'Use Proxy'
,
307
=>
'Temporary Redirect'
,
310
=>
'Too many Redirect'
,
400
=>
'Bad Request'
,
401
=>
'Unauthorized'
,
402
=>
'Payment Required'
,
403
=>
'Forbidden'
,
404
=>
'Not Found'
,
405
=>
'Method Not Allowed'
,
406
=>
'Not Acceptable'
,
407
=>
'Proxy Authentication Required'
,
408
=>
'Request Time-out'
,
409
=>
'Conflict'
,
410
=>
'Gone'
,
411
=>
'Length Required'
,
412
=>
'Precondition Failed'
,
413
=>
'Request Entity Too Large'
,
414
=>
'Request-URI Too Long'
,
415
=>
'Unsupported Media Type'
,
416
=>
'Requested range unsatisfiable'
,
417
=>
'Expectation failed'
,
418
=>
'I’m a teapot'
,
422
=>
'Unprocessable entity'
,
423
=>
'Locked'
,
424
=>
'Method failure'
,
425
=>
'Unordered Collection'
,
426
=>
'Upgrade Required'
,
449
=>
'Retry With'
,
450
=>
'Blocked by Windows Parental Controls'
,
500
=>
'Internal Server Error'
,
501
=>
'Not Implemented'
,
502
=>
'Bad Gateway ou Proxy Error'
,
503
=>
'Service Unavailable'
,
504
=>
'Gateway Time-out'
,
505
=>
'HTTP Version not supported'
,
507
=>
'Insufficient storage'
,
509
=>
'Bandwidth Limit Exceeded'
,
);
if
(
isset
(
$httpCodes
[
$this
->
statusCode
]))
{
return
$httpCodes
[
$this
->
statusCode
];
}
else
{
}
else
{
return
'Error'
;
return
'Error'
;
}
}
...
...
framework/yii/base/InvalidCallException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class InvalidCallException extends Exception
...
@@ -23,4 +23,3 @@ class InvalidCallException extends Exception
return
\Yii
::
t
(
'yii'
,
'Invalid Call'
);
return
\Yii
::
t
(
'yii'
,
'Invalid Call'
);
}
}
}
}
framework/yii/base/InvalidConfigException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class InvalidConfigException extends Exception
...
@@ -23,4 +23,3 @@ class InvalidConfigException extends Exception
return
\Yii
::
t
(
'yii'
,
'Invalid Configuration'
);
return
\Yii
::
t
(
'yii'
,
'Invalid Configuration'
);
}
}
}
}
framework/yii/base/InvalidParamException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class InvalidParamException extends Exception
...
@@ -23,4 +23,3 @@ class InvalidParamException extends Exception
return
\Yii
::
t
(
'yii'
,
'Invalid Parameter'
);
return
\Yii
::
t
(
'yii'
,
'Invalid Parameter'
);
}
}
}
}
framework/yii/base/InvalidRouteException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class InvalidRouteException extends UserException
...
@@ -23,4 +23,3 @@ class InvalidRouteException extends UserException
return
\Yii
::
t
(
'yii'
,
'Invalid Route'
);
return
\Yii
::
t
(
'yii'
,
'Invalid Route'
);
}
}
}
}
framework/yii/base/Jsonable.php
0 → 100644
View file @
004a069c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\base
;
/**
* Jsonable should be implemented by classes that need to be represented in JSON format.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
interface
Jsonable
{
/**
* @return string the JSON representation of this object
*/
public
function
toJson
();
}
framework/yii/base/Model.php
View file @
004a069c
...
@@ -10,6 +10,7 @@ namespace yii\base;
...
@@ -10,6 +10,7 @@ namespace yii\base;
use
ArrayObject
;
use
ArrayObject
;
use
ArrayIterator
;
use
ArrayIterator
;
use
yii\helpers\Inflector
;
use
yii\helpers\Inflector
;
use
yii\helpers\Json
;
use
yii\validators\RequiredValidator
;
use
yii\validators\RequiredValidator
;
use
yii\validators\Validator
;
use
yii\validators\Validator
;
...
@@ -41,7 +42,7 @@ use yii\validators\Validator;
...
@@ -41,7 +42,7 @@ use yii\validators\Validator;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Model
extends
Component
implements
\IteratorAggregate
,
\ArrayAccess
class
Model
extends
Component
implements
\IteratorAggregate
,
\ArrayAccess
,
Jsonable
{
{
/**
/**
* @event ModelEvent an event raised at the beginning of [[validate()]]. You may set
* @event ModelEvent an event raised at the beginning of [[validate()]]. You may set
...
@@ -637,6 +638,16 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
...
@@ -637,6 +638,16 @@ class Model extends Component implements \IteratorAggregate, \ArrayAccess
return
$attributes
;
return
$attributes
;
}
}
/**
* Returns the JSON representation of this object.
* The default implementation will return [[attributes]].
* @return string the JSON representation of this object.
*/
public
function
toJson
()
{
return
Json
::
encode
(
$this
->
getAttributes
());
}
/**
/**
* Returns an iterator for traversing the attributes in the model.
* Returns an iterator for traversing the attributes in the model.
* This method is required by the interface IteratorAggregate.
* This method is required by the interface IteratorAggregate.
...
...
framework/yii/base/Module.php
View file @
004a069c
framework/yii/base/NotSupportedException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class NotSupportedException extends Exception
...
@@ -23,4 +23,3 @@ class NotSupportedException extends Exception
return
\Yii
::
t
(
'yii'
,
'Not Supported'
);
return
\Yii
::
t
(
'yii'
,
'Not Supported'
);
}
}
}
}
framework/yii/base/Object.php
View file @
004a069c
...
@@ -7,12 +7,15 @@
...
@@ -7,12 +7,15 @@
namespace
yii\base
;
namespace
yii\base
;
use
Yii
;
use
yii\helpers\Json
;
/**
/**
* @include @yii/base/Object.md
* @include @yii/base/Object.md
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Object
class
Object
implements
Jsonable
{
{
/**
/**
* @return string the fully qualified name of this class.
* @return string the fully qualified name of this class.
...
@@ -38,8 +41,8 @@ class Object
...
@@ -38,8 +41,8 @@ class Object
*/
*/
public
function
__construct
(
$config
=
array
())
public
function
__construct
(
$config
=
array
())
{
{
foreach
(
$config
as
$name
=>
$value
)
{
if
(
!
empty
(
$config
)
)
{
$this
->
$name
=
$value
;
Yii
::
configure
(
$this
,
$config
)
;
}
}
$this
->
init
();
$this
->
init
();
}
}
...
@@ -216,4 +219,14 @@ class Object
...
@@ -216,4 +219,14 @@ class Object
{
{
return
method_exists
(
$this
,
'set'
.
$name
)
||
$checkVar
&&
property_exists
(
$this
,
$name
);
return
method_exists
(
$this
,
'set'
.
$name
)
||
$checkVar
&&
property_exists
(
$this
,
$name
);
}
}
/**
* Returns the JSON representation of this object.
* The default implementation will return all public member variables.
* @return string the JSON representation of this object.
*/
public
function
toJson
()
{
return
Json
::
encode
(
Yii
::
getObjectVars
(
$this
));
}
}
}
framework/yii/base/Theme.php
View file @
004a069c
framework/yii/base/UnknownClassException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class UnknownClassException extends Exception
...
@@ -23,4 +23,3 @@ class UnknownClassException extends Exception
return
\Yii
::
t
(
'yii'
,
'Unknown Class'
);
return
\Yii
::
t
(
'yii'
,
'Unknown Class'
);
}
}
}
}
framework/yii/base/UnknownMethodException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class UnknownMethodException extends Exception
...
@@ -23,4 +23,3 @@ class UnknownMethodException extends Exception
return
\Yii
::
t
(
'yii'
,
'Unknown Method'
);
return
\Yii
::
t
(
'yii'
,
'Unknown Method'
);
}
}
}
}
framework/yii/base/UnknownPropertyException.php
View file @
004a069c
...
@@ -23,4 +23,3 @@ class UnknownPropertyException extends Exception
...
@@ -23,4 +23,3 @@ class UnknownPropertyException extends Exception
return
\Yii
::
t
(
'yii'
,
'Unknown Property'
);
return
\Yii
::
t
(
'yii'
,
'Unknown Property'
);
}
}
}
}
framework/yii/bootstrap/Button.php
View file @
004a069c
...
@@ -6,9 +6,8 @@
...
@@ -6,9 +6,8 @@
*/
*/
namespace
yii\bootstrap
;
namespace
yii\bootstrap
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
* Button renders a bootstrap button.
* Button renders a bootstrap button.
...
...
framework/yii/bootstrap/ButtonDropdown.php
View file @
004a069c
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
*/
*/
namespace
yii\bootstrap
;
namespace
yii\bootstrap
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
* ButtonDropdown renders a group or split button dropdown bootstrap component.
* ButtonDropdown renders a group or split button dropdown bootstrap component.
...
...
framework/yii/bootstrap/ButtonGroup.php
View file @
004a069c
...
@@ -10,7 +10,6 @@ namespace yii\bootstrap;
...
@@ -10,7 +10,6 @@ namespace yii\bootstrap;
use
yii\helpers\base\ArrayHelper
;
use
yii\helpers\base\ArrayHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
* ButtonGroup renders a button group bootstrap component.
* ButtonGroup renders a button group bootstrap component.
*
*
...
...
framework/yii/bootstrap/Collapse.php
View file @
004a069c
framework/yii/bootstrap/Dropdown.php
View file @
004a069c
...
@@ -11,7 +11,6 @@ use yii\base\InvalidConfigException;
...
@@ -11,7 +11,6 @@ use yii\base\InvalidConfigException;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
* Dropdown renders a Bootstrap dropdown menu component.
* Dropdown renders a Bootstrap dropdown menu component.
*
*
...
...
framework/yii/bootstrap/Nav.php
View file @
004a069c
...
@@ -118,7 +118,7 @@ class Nav extends Widget
...
@@ -118,7 +118,7 @@ class Nav extends Widget
$url
=
Html
::
url
(
ArrayHelper
::
getValue
(
$item
,
'url'
,
'#'
));
$url
=
Html
::
url
(
ArrayHelper
::
getValue
(
$item
,
'url'
,
'#'
));
$linkOptions
=
ArrayHelper
::
getValue
(
$item
,
'linkOptions'
,
array
());
$linkOptions
=
ArrayHelper
::
getValue
(
$item
,
'linkOptions'
,
array
());
if
(
ArrayHelper
::
getValue
(
$item
,
'active'
))
{
if
(
ArrayHelper
::
getValue
(
$item
,
'active'
))
{
$this
->
addCssClass
(
$options
,
'active'
);
$this
->
addCssClass
(
$options
,
'active'
);
}
}
...
...
framework/yii/bootstrap/Progress.php
View file @
004a069c
...
@@ -11,7 +11,6 @@ use yii\base\InvalidConfigException;
...
@@ -11,7 +11,6 @@ use yii\base\InvalidConfigException;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\ArrayHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
/**
/**
* Progress renders a bootstrap progress bar component.
* Progress renders a bootstrap progress bar component.
*
*
...
...
framework/yii/bootstrap/Widget.php
View file @
004a069c
...
@@ -11,7 +11,6 @@ use Yii;
...
@@ -11,7 +11,6 @@ use Yii;
use
yii\base\View
;
use
yii\base\View
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
/**
/**
* \yii\bootstrap\Widget is the base class for all bootstrap widgets.
* \yii\bootstrap\Widget is the base class for all bootstrap widgets.
*
*
...
...
framework/yii/caching/DbCache.php
View file @
004a069c
framework/yii/caching/XCache.php
View file @
004a069c
...
@@ -86,4 +86,3 @@ class XCache extends Cache
...
@@ -86,4 +86,3 @@ class XCache extends Cache
return
true
;
return
true
;
}
}
}
}
framework/yii/console/Exception.php
View file @
004a069c
...
@@ -25,4 +25,3 @@ class Exception extends UserException
...
@@ -25,4 +25,3 @@ class Exception extends UserException
return
\Yii
::
t
(
'yii'
,
'Error'
);
return
\Yii
::
t
(
'yii'
,
'Error'
);
}
}
}
}
framework/yii/console/controllers/AssetController.php
View file @
004a069c
...
@@ -164,7 +164,6 @@ class AssetController extends Controller
...
@@ -164,7 +164,6 @@ class AssetController extends Controller
protected
function
loadConfiguration
(
$configFile
)
protected
function
loadConfiguration
(
$configFile
)
{
{
echo
"Loading configuration from '
{
$configFile
}
'...
\n
"
;
echo
"Loading configuration from '
{
$configFile
}
'...
\n
"
;
foreach
(
require
(
$configFile
)
as
$name
=>
$value
)
{
foreach
(
require
(
$configFile
)
as
$name
=>
$value
)
{
if
(
property_exists
(
$this
,
$name
)
||
$this
->
canSetProperty
(
$name
))
{
if
(
property_exists
(
$this
,
$name
)
||
$this
->
canSetProperty
(
$name
))
{
$this
->
$name
=
$value
;
$this
->
$name
=
$value
;
...
@@ -221,7 +220,8 @@ class AssetController extends Controller
...
@@ -221,7 +220,8 @@ class AssetController extends Controller
* @param array $result already loaded bundles list.
* @param array $result already loaded bundles list.
* @throws \yii\console\Exception on failure.
* @throws \yii\console\Exception on failure.
*/
*/
protected
function
loadBundleDependency
(
$name
,
$bundle
,
&
$result
)
{
protected
function
loadBundleDependency
(
$name
,
$bundle
,
&
$result
)
{
if
(
!
empty
(
$bundle
->
depends
))
{
if
(
!
empty
(
$bundle
->
depends
))
{
$assetManager
=
$this
->
getAssetManager
();
$assetManager
=
$this
->
getAssetManager
();
foreach
(
$bundle
->
depends
as
$dependencyName
)
{
foreach
(
$bundle
->
depends
as
$dependencyName
)
{
...
@@ -573,7 +573,7 @@ EOD;
...
@@ -573,7 +573,7 @@ EOD;
$inputFileRelativePathParts
=
explode
(
'/'
,
$inputFileRelativePath
);
$inputFileRelativePathParts
=
explode
(
'/'
,
$inputFileRelativePath
);
$outputFileRelativePathParts
=
explode
(
'/'
,
$outputFileRelativePath
);
$outputFileRelativePathParts
=
explode
(
'/'
,
$outputFileRelativePath
);
$callback
=
function
(
$matches
)
use
(
$inputFileRelativePathParts
,
$outputFileRelativePathParts
)
{
$callback
=
function
(
$matches
)
use
(
$inputFileRelativePathParts
,
$outputFileRelativePathParts
)
{
$fullMatch
=
$matches
[
0
];
$fullMatch
=
$matches
[
0
];
$inputUrl
=
$matches
[
1
];
$inputUrl
=
$matches
[
1
];
...
...
framework/yii/console/controllers/MessageController.php
View file @
004a069c
...
@@ -179,8 +179,7 @@ class MessageController extends Controller
...
@@ -179,8 +179,7 @@ class MessageController extends Controller
}
}
ksort
(
$translated
);
ksort
(
$translated
);
foreach
(
$translated
as
$message
=>
$translation
)
{
foreach
(
$translated
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeOld
)
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeOld
)
{
{
if
(
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
if
(
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
$todo
[
$message
]
=
$translation
;
$todo
[
$message
]
=
$translation
;
}
else
{
}
else
{
...
...
framework/yii/console/controllers/MigrateController.php
View file @
004a069c
...
@@ -115,7 +115,7 @@ class MigrateController extends Controller
...
@@ -115,7 +115,7 @@ class MigrateController extends Controller
}
}
$this
->
migrationPath
=
$path
;
$this
->
migrationPath
=
$path
;
if
(
$action
->
id
!==
'create'
)
{
if
(
$action
->
id
!==
'create'
)
{
if
(
is_string
(
$this
->
db
))
{
if
(
is_string
(
$this
->
db
))
{
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
db
);
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
db
);
}
}
...
...
framework/yii/db/Connection.php
View file @
004a069c
...
@@ -305,8 +305,7 @@ class Connection extends Component
...
@@ -305,8 +305,7 @@ class Connection extends Component
$this
->
pdo
=
$this
->
createPdoInstance
();
$this
->
pdo
=
$this
->
createPdoInstance
();
$this
->
initConnection
();
$this
->
initConnection
();
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
endProfile
(
$token
,
__METHOD__
);
}
}
catch
(
\PDOException
$e
)
{
catch
(
\PDOException
$e
)
{
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
error
(
"Failed to open DB connection (
{
$this
->
dsn
}
): "
.
$e
->
getMessage
(),
__METHOD__
);
Yii
::
error
(
"Failed to open DB connection (
{
$this
->
dsn
}
): "
.
$e
->
getMessage
(),
__METHOD__
);
$message
=
YII_DEBUG
?
'Failed to open DB connection: '
.
$e
->
getMessage
()
:
'Failed to open DB connection.'
;
$message
=
YII_DEBUG
?
'Failed to open DB connection: '
.
$e
->
getMessage
()
:
'Failed to open DB connection.'
;
...
@@ -343,8 +342,6 @@ class Connection extends Component
...
@@ -343,8 +342,6 @@ class Connection extends Component
$driver
=
strtolower
(
substr
(
$this
->
dsn
,
0
,
$pos
));
$driver
=
strtolower
(
substr
(
$this
->
dsn
,
0
,
$pos
));
if
(
$driver
===
'mssql'
||
$driver
===
'dblib'
||
$driver
===
'sqlsrv'
)
{
if
(
$driver
===
'mssql'
||
$driver
===
'dblib'
||
$driver
===
'sqlsrv'
)
{
$pdoClass
=
'yii\db\mssql\PDO'
;
$pdoClass
=
'yii\db\mssql\PDO'
;
}
else
if
(
$driver
===
'pgsql'
)
{
$pdoClass
=
'yii\db\pgsql\PDO'
;
}
}
}
}
return
new
$pdoClass
(
$this
->
dsn
,
$this
->
username
,
$this
->
password
,
$this
->
attributes
);
return
new
$pdoClass
(
$this
->
dsn
,
$this
->
username
,
$this
->
password
,
$this
->
attributes
);
...
@@ -510,7 +507,7 @@ class Connection extends Component
...
@@ -510,7 +507,7 @@ class Connection extends Component
{
{
$db
=
$this
;
$db
=
$this
;
return
preg_replace_callback
(
'/(\\{\\{([%\w\-\. ]+)\\}\\}|\\[\\[([\w\-\. ]+)\\]\\])/'
,
return
preg_replace_callback
(
'/(\\{\\{([%\w\-\. ]+)\\}\\}|\\[\\[([\w\-\. ]+)\\]\\])/'
,
function
(
$matches
)
use
(
$db
)
{
function
(
$matches
)
use
(
$db
)
{
if
(
isset
(
$matches
[
3
]))
{
if
(
isset
(
$matches
[
3
]))
{
return
$db
->
quoteColumnName
(
$matches
[
3
]);
return
$db
->
quoteColumnName
(
$matches
[
3
]);
}
else
{
}
else
{
...
...
framework/yii/db/pgsql/PDO.php
deleted
100644 → 0
View file @
e45e061c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db\pgsql
;
/**
* This is an extension of the default PDO class for PostgreSQL drivers.
* It provides additional low level functionality for setting database
* configuration parameters.
*
* @author Gevik babakhani <gevikb@gmail.com>
* @since 2.0
*/
class
PDO
extends
\PDO
{
const
OPT_SEARCH_PATH
=
'search_path'
;
const
OPT_DEFAULT_SCHEMA
=
'default_schema'
;
const
DEFAULT_SCHEMA
=
'public'
;
private
$_currentDatabase
;
/**
* Returns value of the last inserted ID.
* @param string|null $sequence the sequence name. Defaults to null.
* @return integer last inserted ID value.
*/
public
function
lastInsertId
(
$sequence
=
null
)
{
if
(
$sequence
!==
null
)
{
$sequence
=
$this
->
quote
(
$sequence
);
return
$this
->
query
(
"SELECT currval(
{
$sequence
}
)"
)
->
fetchColumn
();
}
else
{
return
null
;
}
}
/**
* Here we override the default PDO constructor in order to
* find and set the default schema search path.
*/
public
function
__construct
(
$dsn
,
$username
,
$passwd
,
$options
)
{
$searchPath
=
null
;
if
(
is_array
(
$options
))
{
if
(
isset
(
$options
[
self
::
OPT_SEARCH_PATH
]))
{
$matches
=
null
;
if
(
preg_match
(
"/(\s?)+(\w)+((\s+)?,(\s+)?\w+)*/"
,
$options
[
self
::
OPT_SEARCH_PATH
],
$matches
)
===
1
)
{
$searchPath
=
$matches
[
0
];
}
}
if
(
isset
(
$options
[
self
::
OPT_DEFAULT_SCHEMA
]))
{
$schema
=
trim
(
$options
[
self
::
OPT_DEFAULT_SCHEMA
]);
if
(
!
empty
(
$schema
))
{
Schema
::
$DEFAULT_SCHEMA
=
$schema
;
}
}
if
(
is_null
(
Schema
::
$DEFAULT_SCHEMA
)
||
empty
(
Schema
::
$DEFAULT_SCHEMA
))
{
Schema
::
$DEFAULT_SCHEMA
=
self
::
DEFAULT_SCHEMA
;
}
}
parent
::
__construct
(
$dsn
,
$username
,
$passwd
,
$options
);
if
(
!
is_null
(
$searchPath
))
{
$this
->
setSchemaSearchPath
(
$searchPath
);
}
}
/**
* Returns the name of the current (connected) database
* @return string
*/
public
function
getCurrentDatabase
()
{
if
(
is_null
(
$this
->
_currentDatabase
))
{
return
$this
->
query
(
'select current_database()'
)
->
fetchColumn
();
}
}
/**
* Sets the schema search path of the current users session.
* The syntax of the path is a comma separated string with
* your custom search path at the beginning and the "public"
* schema at the end.
*
* This method automatically adds the "public" schema at the
* end of the search path if it is not provied.
* @param string custom schema search path. defaults to public
*/
public
function
setSchemaSearchPath
(
$searchPath
=
'public'
)
{
$schemas
=
explode
(
','
,
str_replace
(
' '
,
''
,
$searchPath
));
if
(
end
(
$schemas
)
!==
'public'
)
{
$schemas
[]
=
'public'
;
}
foreach
(
$schemas
as
$k
=>
$item
)
{
$schemas
[
$k
]
=
'"'
.
str_replace
(
array
(
'"'
,
"'"
,
';'
),
''
,
$item
)
.
'"'
;
}
$path
=
implode
(
', '
,
$schemas
);
$this
->
exec
(
'SET search_path TO '
.
$path
);
}
}
framework/yii/db/pgsql/Schema.php
View file @
004a069c
...
@@ -22,11 +22,10 @@ class Schema extends \yii\db\Schema
...
@@ -22,11 +22,10 @@ class Schema extends \yii\db\Schema
{
{
/**
/**
* The default schema used for the current session. This value is
* The default schema used for the current session.
* automatically set to "public" by the PDO driver.
* @var string
* @var string
*/
*/
public
static
$DEFAULT_SCHEMA
;
public
$defaultSchema
=
'public'
;
/**
/**
* @var array mapping from physical column types (keys) to abstract
* @var array mapping from physical column types (keys) to abstract
...
@@ -77,7 +76,8 @@ class Schema extends \yii\db\Schema
...
@@ -77,7 +76,8 @@ class Schema extends \yii\db\Schema
* Creates a query builder for the MySQL database.
* Creates a query builder for the MySQL database.
* @return QueryBuilder query builder instance
* @return QueryBuilder query builder instance
*/
*/
public
function
createQueryBuilder
()
{
public
function
createQueryBuilder
()
{
return
new
QueryBuilder
(
$this
->
db
);
return
new
QueryBuilder
(
$this
->
db
);
}
}
...
@@ -86,7 +86,8 @@ class Schema extends \yii\db\Schema
...
@@ -86,7 +86,8 @@ class Schema extends \yii\db\Schema
* @param TableSchema $table the table metadata object
* @param TableSchema $table the table metadata object
* @param string $name the table name
* @param string $name the table name
*/
*/
protected
function
resolveTableNames
(
$table
,
$name
)
{
protected
function
resolveTableNames
(
$table
,
$name
)
{
$parts
=
explode
(
'.'
,
str_replace
(
'"'
,
''
,
$name
));
$parts
=
explode
(
'.'
,
str_replace
(
'"'
,
''
,
$name
));
if
(
isset
(
$parts
[
1
]))
{
if
(
isset
(
$parts
[
1
]))
{
$table
->
schemaName
=
$parts
[
0
];
$table
->
schemaName
=
$parts
[
0
];
...
@@ -95,7 +96,7 @@ class Schema extends \yii\db\Schema
...
@@ -95,7 +96,7 @@ class Schema extends \yii\db\Schema
$table
->
name
=
$parts
[
0
];
$table
->
name
=
$parts
[
0
];
}
}
if
(
$table
->
schemaName
===
null
)
{
if
(
$table
->
schemaName
===
null
)
{
$table
->
schemaName
=
self
::
$DEFAULT_SCHEMA
;
$table
->
schemaName
=
$this
->
defaultSchema
;
}
}
}
}
...
@@ -105,7 +106,8 @@ class Schema extends \yii\db\Schema
...
@@ -105,7 +106,8 @@ class Schema extends \yii\db\Schema
* @param string $name table name
* @param string $name table name
* @return string the properly quoted table name
* @return string the properly quoted table name
*/
*/
public
function
quoteSimpleTableName
(
$name
)
{
public
function
quoteSimpleTableName
(
$name
)
{
return
strpos
(
$name
,
'"'
)
!==
false
?
$name
:
'"'
.
$name
.
'"'
;
return
strpos
(
$name
,
'"'
)
!==
false
?
$name
:
'"'
.
$name
.
'"'
;
}
}
...
@@ -114,12 +116,15 @@ class Schema extends \yii\db\Schema
...
@@ -114,12 +116,15 @@ class Schema extends \yii\db\Schema
* @param string $name table name
* @param string $name table name
* @return TableSchema|null driver dependent table metadata. Null if the table does not exist.
* @return TableSchema|null driver dependent table metadata. Null if the table does not exist.
*/
*/
public
function
loadTableSchema
(
$name
)
{
public
function
loadTableSchema
(
$name
)
{
$table
=
new
TableSchema
();
$table
=
new
TableSchema
();
$this
->
resolveTableNames
(
$table
,
$name
);
$this
->
resolveTableNames
(
$table
,
$name
);
if
(
$this
->
findColumns
(
$table
))
{
if
(
$this
->
findColumns
(
$table
))
{
$this
->
findConstraints
(
$table
);
$this
->
findConstraints
(
$table
);
return
$table
;
return
$table
;
}
else
{
return
null
;
}
}
}
}
...
@@ -127,11 +132,11 @@ class Schema extends \yii\db\Schema
...
@@ -127,11 +132,11 @@ class Schema extends \yii\db\Schema
* Collects the foreign key column details for the given table.
* Collects the foreign key column details for the given table.
* @param TableSchema $table the table metadata
* @param TableSchema $table the table metadata
*/
*/
protected
function
findConstraints
(
$table
)
{
protected
function
findConstraints
(
$table
)
{
$tableName
=
$this
->
quoteValue
(
$table
->
name
);
$tableName
=
$this
->
quoteValue
(
$table
->
name
);
$tableSchema
=
$this
->
quoteValue
(
$table
->
schemaName
);
$tableSchema
=
$this
->
quoteValue
(
$table
->
schemaName
);
$database
=
$this
->
quoteValue
(
$this
->
db
->
pdo
->
getCurrentDatabase
());
//We need to extract the constraints de hard way since:
//We need to extract the constraints de hard way since:
//http://www.postgresql.org/message-id/26677.1086673982@sss.pgh.pa.us
//http://www.postgresql.org/message-id/26677.1086673982@sss.pgh.pa.us
...
@@ -158,14 +163,9 @@ where
...
@@ -158,14 +163,9 @@ where
ct.contype='f'
ct.contype='f'
and c.relname={$tableName}
and c.relname={$tableName}
and ns.nspname={$tableSchema}
and ns.nspname={$tableSchema}
and current_database() = {$database}
SQL;
SQL;
try
{
$constraints
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
$constraints
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
}
catch
(
\Exception
$e
)
{
return
false
;
}
foreach
(
$constraints
as
$constraint
)
{
foreach
(
$constraints
as
$constraint
)
{
$columns
=
explode
(
','
,
$constraint
[
'columns'
]);
$columns
=
explode
(
','
,
$constraint
[
'columns'
]);
$fcolumns
=
explode
(
','
,
$constraint
[
'foreign_columns'
]);
$fcolumns
=
explode
(
','
,
$constraint
[
'foreign_columns'
]);
...
@@ -175,7 +175,6 @@ SQL;
...
@@ -175,7 +175,6 @@ SQL;
}
}
$table
->
foreignKeys
[]
=
$citem
;
$table
->
foreignKeys
[]
=
$citem
;
}
}
return
true
;
}
}
/**
/**
...
@@ -183,8 +182,8 @@ SQL;
...
@@ -183,8 +182,8 @@ SQL;
* @param TableSchema $table the table metadata
* @param TableSchema $table the table metadata
* @return boolean whether the table exists in the database
* @return boolean whether the table exists in the database
*/
*/
protected
function
findColumns
(
$table
)
{
protected
function
findColumns
(
$table
)
$dbname
=
$this
->
db
->
quoteValue
(
$this
->
db
->
pdo
->
getCurrentDatabase
());
{
$tableName
=
$this
->
db
->
quoteValue
(
$table
->
name
);
$tableName
=
$this
->
db
->
quoteValue
(
$table
->
name
);
$schemaName
=
$this
->
db
->
quoteValue
(
$table
->
schemaName
);
$schemaName
=
$this
->
db
->
quoteValue
(
$table
->
schemaName
);
$sql
=
<<<SQL
$sql
=
<<<SQL
...
@@ -239,16 +238,15 @@ WHERE
...
@@ -239,16 +238,15 @@ WHERE
a.attnum > 0
a.attnum > 0
and c.relname = {$tableName}
and c.relname = {$tableName}
and d.nspname = {$schemaName}
and d.nspname = {$schemaName}
and current_database() = {$dbname}
ORDER BY
ORDER BY
a.attnum;
a.attnum;
SQL;
SQL;
try
{
$columns
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
$columns
=
$this
->
db
->
createCommand
(
$sql
)
->
queryAll
();
}
catch
(
\Exception
$e
)
{
if
(
empty
(
$columns
)
)
{
return
false
;
return
false
;
}
}
foreach
(
$columns
as
$column
)
{
foreach
(
$columns
as
$column
)
{
$column
=
$this
->
loadColumnSchema
(
$column
);
$column
=
$this
->
loadColumnSchema
(
$column
);
$table
->
columns
[
$column
->
name
]
=
$column
;
$table
->
columns
[
$column
->
name
]
=
$column
;
...
@@ -267,7 +265,8 @@ SQL;
...
@@ -267,7 +265,8 @@ SQL;
* @param array $info column information
* @param array $info column information
* @return ColumnSchema the column schema object
* @return ColumnSchema the column schema object
*/
*/
protected
function
loadColumnSchema
(
$info
)
{
protected
function
loadColumnSchema
(
$info
)
{
$column
=
new
ColumnSchema
();
$column
=
new
ColumnSchema
();
$column
->
allowNull
=
$info
[
'is_nullable'
];
$column
->
allowNull
=
$info
[
'is_nullable'
];
$column
->
autoIncrement
=
$info
[
'is_autoinc'
];
$column
->
autoIncrement
=
$info
[
'is_autoinc'
];
...
@@ -290,5 +289,4 @@ SQL;
...
@@ -290,5 +289,4 @@ SQL;
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
$column
->
phpType
=
$this
->
getColumnPhpType
(
$column
);
return
$column
;
return
$column
;
}
}
}
}
framework/yii/debug/Module.php
View file @
004a069c
framework/yii/debug/controllers/DefaultController.php
View file @
004a069c
framework/yii/helpers/Json.php
View file @
004a069c
...
@@ -14,5 +14,4 @@ namespace yii\helpers;
...
@@ -14,5 +14,4 @@ namespace yii\helpers;
*/
*/
class
Json
extends
base\Json
class
Json
extends
base\Json
{
{
}
}
framework/yii/helpers/base/Console.php
View file @
004a069c
...
@@ -286,7 +286,7 @@ class Console
...
@@ -286,7 +286,7 @@ class Console
* You can pass any of the FG_*, BG_* and TEXT_* constants and also [[xtermFgColor]] and [[xtermBgColor]].
* You can pass any of the FG_*, BG_* and TEXT_* constants and also [[xtermFgColor]] and [[xtermBgColor]].
* @return string
* @return string
*/
*/
public
static
function
ansiFormat
(
$string
,
$format
=
array
())
public
static
function
ansiFormat
(
$string
,
$format
=
array
())
{
{
$code
=
implode
(
';'
,
$format
);
$code
=
implode
(
';'
,
$format
);
return
"
\033
[0m"
.
(
$code
!==
''
?
"
\033
["
.
$code
.
"m"
:
''
)
.
$string
.
"
\033
[0m"
;
return
"
\033
[0m"
.
(
$code
!==
''
?
"
\033
["
.
$code
.
"m"
:
''
)
.
$string
.
"
\033
[0m"
;
...
@@ -589,11 +589,10 @@ class Console
...
@@ -589,11 +589,10 @@ class Console
if
(
static
::
isRunningOnWindows
())
{
if
(
static
::
isRunningOnWindows
())
{
$output
=
array
();
$output
=
array
();
exec
(
'mode con'
,
$output
);
exec
(
'mode con'
,
$output
);
if
(
isset
(
$output
)
&&
strpos
(
$output
[
1
],
'CON'
)
!==
false
)
{
if
(
isset
(
$output
)
&&
strpos
(
$output
[
1
],
'CON'
)
!==
false
)
{
return
$size
=
array
((
int
)
preg_replace
(
'~[^0-9]~'
,
''
,
$output
[
3
]),
(
int
)
preg_replace
(
'~[^0-9]~'
,
''
,
$output
[
4
]));
return
$size
=
array
((
int
)
preg_replace
(
'~[^0-9]~'
,
''
,
$output
[
3
]),
(
int
)
preg_replace
(
'~[^0-9]~'
,
''
,
$output
[
4
]));
}
}
}
else
{
}
else
{
// try stty if available
// try stty if available
$stty
=
array
();
$stty
=
array
();
if
(
exec
(
'stty -a 2>&1'
,
$stty
)
&&
preg_match
(
'/rows\s+(\d+);\s*columns\s+(\d+);/mi'
,
implode
(
' '
,
$stty
),
$matches
))
{
if
(
exec
(
'stty -a 2>&1'
,
$stty
)
&&
preg_match
(
'/rows\s+(\d+);\s*columns\s+(\d+);/mi'
,
implode
(
' '
,
$stty
),
$matches
))
{
...
...
framework/yii/helpers/base/Html.php
View file @
004a069c
...
@@ -1479,5 +1479,4 @@ class Html
...
@@ -1479,5 +1479,4 @@ class Html
$name
=
strtolower
(
static
::
getInputName
(
$model
,
$attribute
));
$name
=
strtolower
(
static
::
getInputName
(
$model
,
$attribute
));
return
str_replace
(
array
(
'[]'
,
']['
,
'['
,
']'
,
' '
),
array
(
''
,
'-'
,
'-'
,
''
,
'-'
),
$name
);
return
str_replace
(
array
(
'[]'
,
']['
,
'['
,
']'
,
' '
),
array
(
''
,
'-'
,
'-'
,
''
,
'-'
),
$name
);
}
}
}
}
framework/yii/helpers/base/Inflector.php
View file @
004a069c
...
@@ -468,7 +468,7 @@ class Inflector
...
@@ -468,7 +468,7 @@ class Inflector
if
(
in_array
((
$number
%
100
),
range
(
11
,
13
)))
{
if
(
in_array
((
$number
%
100
),
range
(
11
,
13
)))
{
return
$number
.
'th'
;
return
$number
.
'th'
;
}
}
switch
(
(
$number
%
10
)
)
{
switch
(
$number
%
10
)
{
case
1
:
return
$number
.
'st'
;
case
1
:
return
$number
.
'st'
;
case
2
:
return
$number
.
'nd'
;
case
2
:
return
$number
.
'nd'
;
case
3
:
return
$number
.
'rd'
;
case
3
:
return
$number
.
'rd'
;
...
...
framework/yii/helpers/base/Json.php
View file @
004a069c
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
namespace
yii\helpers\base
;
namespace
yii\helpers\base
;
use
yii\base\InvalidParamException
;
use
yii\base\InvalidParamException
;
use
yii\base\Jsonable
;
use
yii\web\JsExpression
;
use
yii\web\JsExpression
;
/**
/**
...
@@ -90,7 +91,9 @@ class Json
...
@@ -90,7 +91,9 @@ class Json
$token
=
'!{['
.
count
(
$expressions
)
.
']}!'
;
$token
=
'!{['
.
count
(
$expressions
)
.
']}!'
;
$expressions
[
'"'
.
$token
.
'"'
]
=
$data
->
expression
;
$expressions
[
'"'
.
$token
.
'"'
]
=
$data
->
expression
;
return
$token
;
return
$token
;
}
}
elseif
(
$data
instanceof
Jsonable
)
{
return
$data
->
toJson
();
}
else
{
$result
=
array
();
$result
=
array
();
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
if
(
is_array
(
$value
)
||
is_object
(
$value
))
{
if
(
is_array
(
$value
)
||
is_object
(
$value
))
{
...
@@ -100,6 +103,7 @@ class Json
...
@@ -100,6 +103,7 @@ class Json
}
}
}
}
return
$result
;
return
$result
;
}
}
else
{
}
else
{
return
$data
;
return
$data
;
}
}
...
...
framework/yii/i18n/DbMessageSource.php
0 → 100644
View file @
004a069c
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\i18n
;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\ArrayHelper
;
use
yii\caching\Cache
;
use
yii\db\Connection
;
use
yii\db\Query
;
/**
* DbMessageSource extends [[MessageSource]] and represents a message source that stores translated
* messages in database.
*
* The database must contain the following two tables:
*
* ~~~
* CREATE TABLE tbl_source_message (
* id INTEGER PRIMARY KEY,
* category VARCHAR(32),
* message TEXT
* );
*
* CREATE TABLE tbl_message (
* id INTEGER,
* language VARCHAR(16),
* translation TEXT,
* PRIMARY KEY (id, language),
* CONSTRAINT fk_message_source_message FOREIGN KEY (id)
* REFERENCES tbl_source_message (id) ON DELETE CASCADE ON UPDATE RESTRICT
* );
* ~~~
*
* The `tbl_source_message` table stores the messages to be translated, and the `tbl_message` table stores
* the translated messages. The name of these two tables can be customized by setting [[sourceMessageTable]]
* and [[messageTable]], respectively.
*
* @author resurtm <resurtm@gmail.com>
* @since 2.0
*/
class
DbMessageSource
extends
MessageSource
{
/**
* Prefix which would be used when generating cache key.
*/
const
CACHE_KEY_PREFIX
=
'DbMessageSource'
;
/**
* @var Connection|string the DB connection object or the application component ID of the DB connection.
* After the DbMessageSource object is created, if you want to change this property, you should only assign
* it with a DB connection object.
*/
public
$db
=
'db'
;
/**
* @var Cache|string the cache object or the application component ID of the cache object.
* The messages data will be cached using this cache object. Note, this property has meaning only
* in case [[cachingDuration]] set to non-zero value.
* After the DbMessageSource object is created, if you want to change this property, you should only assign
* it with a cache object.
*/
public
$cache
=
'cache'
;
/**
* @var string the name of the source message table.
*/
public
$sourceMessageTable
=
'tbl_source_message'
;
/**
* @var string the name of the translated message table.
*/
public
$messageTable
=
'tbl_message'
;
/**
* @var integer the time in seconds that the messages can remain valid in cache.
* Use 0 to indicate that the cached data will never expire.
* @see enableCaching
*/
public
$cachingDuration
=
0
;
/**
* @var boolean whether to enable caching translated messages
*/
public
$enableCaching
=
false
;
/**
* Initializes the DbMessageSource component.
* This method will initialize the [[db]] property to make sure it refers to a valid DB connection.
* Configured [[cache]] component would also be initialized.
* @throws InvalidConfigException if [[db]] is invalid or [[cache]] is invalid.
*/
public
function
init
()
{
parent
::
init
();
if
(
is_string
(
$this
->
db
))
{
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
db
);
}
if
(
!
$this
->
db
instanceof
Connection
)
{
throw
new
InvalidConfigException
(
"DbMessageSource::db must be either a DB connection instance or the application component ID of a DB connection."
);
}
if
(
$this
->
enableCaching
)
{
if
(
is_string
(
$this
->
cache
))
{
$this
->
cache
=
Yii
::
$app
->
getComponent
(
$this
->
cache
);
}
if
(
!
$this
->
cache
instanceof
Cache
)
{
throw
new
InvalidConfigException
(
"DbMessageSource::cache must be either a cache object or the application component ID of the cache object."
);
}
}
}
/**
* Loads the message translation for the specified language and category.
* Child classes should override this method to return the message translations of
* the specified language and category.
* @param string $category the message category
* @param string $language the target language
* @return array the loaded messages. The keys are original messages, and the values
* are translated messages.
*/
protected
function
loadMessages
(
$category
,
$language
)
{
if
(
$this
->
enableCaching
)
{
$key
=
array
(
__CLASS__
,
$category
,
$language
,
);
$messages
=
$this
->
cache
->
get
(
$key
);
if
(
$messages
===
false
)
{
$messages
=
$this
->
loadMessagesFromDb
(
$category
,
$language
);
$this
->
cache
->
set
(
$key
,
$messages
,
$this
->
cachingDuration
);
}
return
$messages
;
}
else
{
return
$this
->
loadMessagesFromDb
(
$category
,
$language
);
}
}
/**
* Loads the messages from database.
* You may override this method to customize the message storage in the database.
* @param string $category the message category.
* @param string $language the target language.
* @return array the messages loaded from database.
*/
protected
function
loadMessagesFromDb
(
$category
,
$language
)
{
$query
=
new
Query
();
$messages
=
$query
->
select
(
array
(
't1.message message'
,
't2.translation translation'
))
->
from
(
array
(
$this
->
sourceMessageTable
.
' t1'
,
$this
->
messageTable
.
' t2'
))
->
where
(
't1.id = t2.id AND t1.category = :category AND t2.language = :language'
)
->
params
(
array
(
':category'
=>
$category
,
':language'
=>
$language
))
->
createCommand
(
$this
->
db
)
->
queryAll
();
return
ArrayHelper
::
map
(
$messages
,
'message'
,
'translation'
);
}
}
framework/yii/i18n/I18N.php
View file @
004a069c
...
@@ -78,16 +78,11 @@ class I18N extends Component
...
@@ -78,16 +78,11 @@ class I18N extends Component
* @param string $category the message category.
* @param string $category the message category.
* @param string $message the message to be translated.
* @param string $message the message to be translated.
* @param array $params the parameters that will be used to replace the corresponding placeholders in the message.
* @param array $params the parameters that will be used to replace the corresponding placeholders in the message.
* @param string $language the language code (e.g. `en_US`, `en`). If this is null, the current
* @param string $language the language code (e.g. `en_US`, `en`).
* [[\yii\base\Application::language|application language]] will be used.
* @return string the translated message.
* @return string the translated message.
*/
*/
public
function
translate
(
$category
,
$message
,
$params
=
array
(),
$language
=
null
)
public
function
translate
(
$category
,
$message
,
$params
,
$language
)
{
{
if
(
$language
===
null
)
{
$language
=
Yii
::
$app
->
language
;
}
$message
=
$this
->
getMessageSource
(
$category
)
->
translate
(
$category
,
$message
,
$language
);
$message
=
$this
->
getMessageSource
(
$category
)
->
translate
(
$category
,
$message
,
$language
);
if
(
!
is_array
(
$params
))
{
if
(
!
is_array
(
$params
))
{
...
...
framework/yii/i18n/MessageSource.php
View file @
004a069c
...
@@ -118,4 +118,3 @@ class MessageSource extends Component
...
@@ -118,4 +118,3 @@ class MessageSource extends Component
}
}
}
}
}
}
framework/yii/jui/Accordion.php
View file @
004a069c
...
@@ -125,7 +125,7 @@ class Accordion extends Widget
...
@@ -125,7 +125,7 @@ class Accordion extends Widget
$items
[]
=
Html
::
tag
(
$headerTag
,
$item
[
'header'
],
$headerOptions
);
$items
[]
=
Html
::
tag
(
$headerTag
,
$item
[
'header'
],
$headerOptions
);
$options
=
array_merge
(
$this
->
itemOptions
,
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
()));
$options
=
array_merge
(
$this
->
itemOptions
,
ArrayHelper
::
getValue
(
$item
,
'options'
,
array
()));
$tag
=
ArrayHelper
::
remove
(
$options
,
'tag'
,
'div'
);
$tag
=
ArrayHelper
::
remove
(
$options
,
'tag'
,
'div'
);
$items
[]
=
Html
::
tag
(
$tag
,
$item
[
'content'
],
$options
);
;
$items
[]
=
Html
::
tag
(
$tag
,
$item
[
'content'
],
$options
);
}
}
return
implode
(
"
\n
"
,
$items
);
return
implode
(
"
\n
"
,
$items
);
...
...
framework/yii/jui/Menu.php
View file @
004a069c
...
@@ -10,7 +10,6 @@ namespace yii\jui;
...
@@ -10,7 +10,6 @@ namespace yii\jui;
use
Yii
;
use
Yii
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
/**
/**
* Menu renders a menu jQuery UI widget.
* Menu renders a menu jQuery UI widget.
*
*
...
...
framework/yii/jui/Widget.php
View file @
004a069c
...
@@ -10,7 +10,6 @@ namespace yii\jui;
...
@@ -10,7 +10,6 @@ namespace yii\jui;
use
Yii
;
use
Yii
;
use
yii\helpers\Json
;
use
yii\helpers\Json
;
/**
/**
* \yii\jui\Widget is the base class for all jQuery UI widgets.
* \yii\jui\Widget is the base class for all jQuery UI widgets.
*
*
...
...
framework/yii/rbac/DbManager.php
View file @
004a069c
...
@@ -493,9 +493,10 @@ class DbManager extends Manager
...
@@ -493,9 +493,10 @@ class DbManager extends Manager
'bizRule'
=>
$row
[
'biz_rule'
],
'bizRule'
=>
$row
[
'biz_rule'
],
'data'
=>
$data
,
'data'
=>
$data
,
));
));
}
else
}
else
{
return
null
;
return
null
;
}
}
}
/**
/**
* Saves an authorization item to persistent storage.
* Saves an authorization item to persistent storage.
...
...
framework/yii/rbac/PhpManager.php
View file @
004a069c
framework/yii/requirements/requirements.php
View file @
004a069c
framework/yii/validators/CaptchaValidator.php
View file @
004a069c
...
@@ -117,4 +117,3 @@ class CaptchaValidator extends Validator
...
@@ -117,4 +117,3 @@ class CaptchaValidator extends Validator
return
'yii.validation.captcha(value, messages, '
.
json_encode
(
$options
)
.
');'
;
return
'yii.validation.captcha(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
}
}
framework/yii/validators/DateValidator.php
View file @
004a069c
...
@@ -73,4 +73,3 @@ class DateValidator extends Validator
...
@@ -73,4 +73,3 @@ class DateValidator extends Validator
return
DateTime
::
createFromFormat
(
$this
->
format
,
$value
)
!==
false
;
return
DateTime
::
createFromFormat
(
$this
->
format
,
$value
)
!==
false
;
}
}
}
}
framework/yii/validators/DefaultValueValidator.php
View file @
004a069c
...
@@ -40,4 +40,3 @@ class DefaultValueValidator extends Validator
...
@@ -40,4 +40,3 @@ class DefaultValueValidator extends Validator
}
}
}
}
}
}
framework/yii/validators/ExistValidator.php
View file @
004a069c
...
@@ -99,4 +99,3 @@ class ExistValidator extends Validator
...
@@ -99,4 +99,3 @@ class ExistValidator extends Validator
return
$query
->
exists
();
return
$query
->
exists
();
}
}
}
}
framework/yii/validators/FilterValidator.php
View file @
004a069c
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
namespace
yii\validators
;
namespace
yii\validators
;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
/**
/**
...
...
framework/yii/validators/RangeValidator.php
View file @
004a069c
framework/yii/validators/RegularExpressionValidator.php
View file @
004a069c
framework/yii/validators/StringValidator.php
View file @
004a069c
...
@@ -174,4 +174,3 @@ class StringValidator extends Validator
...
@@ -174,4 +174,3 @@ class StringValidator extends Validator
return
'yii.validation.string(value, messages, '
.
json_encode
(
$options
)
.
');'
;
return
'yii.validation.string(value, messages, '
.
json_encode
(
$options
)
.
');'
;
}
}
}
}
framework/yii/validators/UrlValidator.php
View file @
004a069c
...
@@ -99,7 +99,7 @@ class UrlValidator extends Validator
...
@@ -99,7 +99,7 @@ class UrlValidator extends Validator
}
}
if
(
$this
->
enableIDN
)
{
if
(
$this
->
enableIDN
)
{
$value
=
preg_replace_callback
(
'/:\/\/([^\/]+)/'
,
function
(
$matches
)
{
$value
=
preg_replace_callback
(
'/:\/\/([^\/]+)/'
,
function
(
$matches
)
{
return
'://'
.
idn_to_ascii
(
$matches
[
1
]);
return
'://'
.
idn_to_ascii
(
$matches
[
1
]);
},
$value
);
},
$value
);
}
}
...
...
framework/yii/validators/Validator.php
View file @
004a069c
framework/yii/web/HeaderCollection.php
View file @
004a069c
...
@@ -11,7 +11,6 @@ use Yii;
...
@@ -11,7 +11,6 @@ use Yii;
use
yii\base\Object
;
use
yii\base\Object
;
use
ArrayIterator
;
use
ArrayIterator
;
/**
/**
* HeaderCollection is used by [[Response]] to maintain the currently registered HTTP headers.
* HeaderCollection is used by [[Response]] to maintain the currently registered HTTP headers.
*
*
...
...
framework/yii/web/PageCache.php
View file @
004a069c
framework/yii/web/Request.php
View file @
004a069c
...
@@ -792,4 +792,3 @@ class Request extends \yii\base\Request
...
@@ -792,4 +792,3 @@ class Request extends \yii\base\Request
}
}
}
}
}
}
framework/yii/web/Response.php
View file @
004a069c
...
@@ -9,8 +9,10 @@ namespace yii\web;
...
@@ -9,8 +9,10 @@ namespace yii\web;
use
Yii
;
use
Yii
;
use
yii\base\HttpException
;
use
yii\base\HttpException
;
use
yii\base\InvalidParamException
;
use
yii\helpers\FileHelper
;
use
yii\helpers\FileHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\helpers\Json
;
use
yii\helpers\StringHelper
;
use
yii\helpers\StringHelper
;
/**
/**
...
@@ -27,9 +29,122 @@ class Response extends \yii\base\Response
...
@@ -27,9 +29,122 @@ class Response extends \yii\base\Response
* @see redirect
* @see redirect
*/
*/
public
$ajaxRedirectCode
=
278
;
public
$ajaxRedirectCode
=
278
;
/**
* @var string
*/
public
$content
;
/**
* @var string
*/
public
$statusText
;
/**
* @var string the charset to use. If not set, [[\yii\base\Application::charset]] will be used.
*/
public
$charset
;
/**
* @var string the version of the HTTP protocol to use
*/
public
$version
=
'1.0'
;
/**
* @var array list of HTTP status codes and the corresponding texts
*/
public
static
$statusTexts
=
array
(
100
=>
'Continue'
,
101
=>
'Switching Protocols'
,
102
=>
'Processing'
,
118
=>
'Connection timed out'
,
200
=>
'OK'
,
201
=>
'Created'
,
202
=>
'Accepted'
,
203
=>
'Non-Authoritative'
,
204
=>
'No Content'
,
205
=>
'Reset Content'
,
206
=>
'Partial Content'
,
207
=>
'Multi-Status'
,
208
=>
'Already Reported'
,
210
=>
'Content Different'
,
226
=>
'IM Used'
,
300
=>
'Multiple Choices'
,
301
=>
'Moved Permanently'
,
302
=>
'Found'
,
303
=>
'See Other'
,
304
=>
'Not Modified'
,
305
=>
'Use Proxy'
,
306
=>
'Reserved'
,
307
=>
'Temporary Redirect'
,
308
=>
'Permanent Redirect'
,
310
=>
'Too many Redirect'
,
400
=>
'Bad Request'
,
401
=>
'Unauthorized'
,
402
=>
'Payment Required'
,
403
=>
'Forbidden'
,
404
=>
'Not Found'
,
405
=>
'Method Not Allowed'
,
406
=>
'Not Acceptable'
,
407
=>
'Proxy Authentication Required'
,
408
=>
'Request Time-out'
,
409
=>
'Conflict'
,
410
=>
'Gone'
,
411
=>
'Length Required'
,
412
=>
'Precondition Failed'
,
413
=>
'Request Entity Too Large'
,
414
=>
'Request-URI Too Long'
,
415
=>
'Unsupported Media Type'
,
416
=>
'Requested range unsatisfiable'
,
417
=>
'Expectation failed'
,
418
=>
'I’m a teapot'
,
422
=>
'Unprocessable entity'
,
423
=>
'Locked'
,
424
=>
'Method failure'
,
425
=>
'Unordered Collection'
,
426
=>
'Upgrade Required'
,
428
=>
'Precondition Required'
,
429
=>
'Too Many Requests'
,
431
=>
'Request Header Fields Too Large'
,
449
=>
'Retry With'
,
450
=>
'Blocked by Windows Parental Controls'
,
500
=>
'Internal Server Error'
,
501
=>
'Not Implemented'
,
502
=>
'Bad Gateway ou Proxy Error'
,
503
=>
'Service Unavailable'
,
504
=>
'Gateway Time-out'
,
505
=>
'HTTP Version not supported'
,
507
=>
'Insufficient storage'
,
508
=>
'Loop Detected'
,
509
=>
'Bandwidth Limit Exceeded'
,
510
=>
'Not Extended'
,
511
=>
'Network Authentication Required'
,
);
private
$_statusCode
=
200
;
/**
* @var HeaderCollection
*/
private
$_headers
;
private
$_headers
;
public
function
init
()
{
if
(
$this
->
charset
===
null
)
{
$this
->
charset
=
Yii
::
$app
->
charset
;
}
}
public
function
getStatusCode
()
{
return
$this
->
_statusCode
;
}
public
function
setStatusCode
(
$value
)
{
$this
->
_statusCode
=
(
int
)
$value
;
if
(
$this
->
isInvalid
())
{
throw
new
InvalidParamException
(
"The HTTP status code is invalid:
$value
"
);
}
$this
->
statusText
=
isset
(
self
::
$statusTexts
[
$this
->
_statusCode
])
?
self
::
$statusTexts
[
$this
->
_statusCode
]
:
''
;
}
/**
/**
* Returns the header collection.
* Returns the header collection.
* The header collection contains the currently registered HTTP headers.
* The header collection contains the currently registered HTTP headers.
...
@@ -43,6 +158,52 @@ class Response extends \yii\base\Response
...
@@ -43,6 +158,52 @@ class Response extends \yii\base\Response
return
$this
->
_headers
;
return
$this
->
_headers
;
}
}
public
function
renderJson
(
$data
)
{
$this
->
getHeaders
()
->
set
(
'content-type'
,
'application/json'
);
$this
->
content
=
Json
::
encode
(
$data
);
}
public
function
renderJsonp
(
$data
,
$callbackName
)
{
$this
->
getHeaders
()
->
set
(
'content-type'
,
'text/javascript'
);
$data
=
Json
::
encode
(
$data
);
$this
->
content
=
"
$callbackName
(
$data
);"
;
}
/**
* Sends the response to the client.
* @return boolean true if the response was sent
*/
public
function
send
()
{
$this
->
sendHeaders
();
$this
->
sendContent
();
}
/**
* Sends the response headers to the client
*/
protected
function
sendHeaders
()
{
header
(
"HTTP/
{
$this
->
version
}
"
.
$this
->
getStatusCode
()
.
"
{
$this
->
statusText
}
"
);
foreach
(
$this
->
_headers
as
$name
=>
$values
)
{
foreach
(
$values
as
$value
)
{
header
(
"
$name
:
$value
"
);
}
}
$this
->
_headers
->
removeAll
();
}
/**
* Sends the response content to the client
*/
protected
function
sendContent
()
{
echo
$this
->
content
;
$this
->
content
=
null
;
}
/**
/**
* Sends a file to user.
* Sends a file to user.
* @param string $fileName file name
* @param string $fileName file name
...
@@ -201,7 +362,7 @@ class Response extends \yii\base\Response
...
@@ -201,7 +362,7 @@ class Response extends \yii\base\Response
}
}
if
(
!
isset
(
$options
[
'mimeType'
]))
{
if
(
!
isset
(
$options
[
'mimeType'
]))
{
if
((
$options
[
'mimeType'
]
=
C
FileHelper
::
getMimeTypeByExtension
(
$filePath
))
===
null
)
{
if
((
$options
[
'mimeType'
]
=
FileHelper
::
getMimeTypeByExtension
(
$filePath
))
===
null
)
{
$options
[
'mimeType'
]
=
'text/plain'
;
$options
[
'mimeType'
]
=
'text/plain'
;
}
}
}
}
...
@@ -303,4 +464,84 @@ class Response extends \yii\base\Response
...
@@ -303,4 +464,84 @@ class Response extends \yii\base\Response
{
{
return
Yii
::
$app
->
getRequest
()
->
getCookies
();
return
Yii
::
$app
->
getRequest
()
->
getCookies
();
}
}
/**
* @return boolean whether this response has a valid [[statusCode]].
*/
public
function
isInvalid
()
{
return
$this
->
getStatusCode
()
<
100
||
$this
->
getStatusCode
()
>=
600
;
}
/**
* @return boolean whether this response is informational
*/
public
function
isInformational
()
{
return
$this
->
getStatusCode
()
>=
100
&&
$this
->
getStatusCode
()
<
200
;
}
/**
* @return boolean whether this response is successfully
*/
public
function
isSuccessful
()
{
return
$this
->
getStatusCode
()
>=
200
&&
$this
->
getStatusCode
()
<
300
;
}
/**
* @return boolean whether this response is a redirection
*/
public
function
isRedirection
()
{
return
$this
->
getStatusCode
()
>=
300
&&
$this
->
getStatusCode
()
<
400
;
}
/**
* @return boolean whether this response indicates a client error
*/
public
function
isClientError
()
{
return
$this
->
getStatusCode
()
>=
400
&&
$this
->
getStatusCode
()
<
500
;
}
/**
* @return boolean whether this response indicates a server error
*/
public
function
isServerError
()
{
return
$this
->
getStatusCode
()
>=
500
&&
$this
->
getStatusCode
()
<
600
;
}
/**
* @return boolean whether this response is OK
*/
public
function
isOk
()
{
return
200
===
$this
->
getStatusCode
();
}
/**
* @return boolean whether this response indicates the current request is forbidden
*/
public
function
isForbidden
()
{
return
403
===
$this
->
getStatusCode
();
}
/**
* @return boolean whether this response indicates the currently requested resource is not found
*/
public
function
isNotFound
()
{
return
404
===
$this
->
getStatusCode
();
}
/**
* @return boolean whether this response is empty
*/
public
function
isEmpty
()
{
return
in_array
(
$this
->
getStatusCode
(),
array
(
201
,
204
,
304
));
}
}
}
framework/yii/web/UploadedFile.php
View file @
004a069c
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
namespace
yii\web
;
namespace
yii\web
;
use
yii\
widget
s\Html
;
use
yii\
helper
s\Html
;
/**
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
...
...
framework/yii/web/User.php
View file @
004a069c
framework/yii/widgets/FragmentCache.php
View file @
004a069c
framework/yii/widgets/ListPager.php
View file @
004a069c
...
@@ -91,5 +91,4 @@ class ListPager extends Widget
...
@@ -91,5 +91,4 @@ class ListPager extends Widget
'{page}'
=>
$page
+
1
,
'{page}'
=>
$page
+
1
,
));
));
}
}
}
}
tests/unit/data/config.php
View file @
004a069c
...
@@ -22,9 +22,6 @@ return array(
...
@@ -22,9 +22,6 @@ return array(
'dsn'
=>
'pgsql:host=localhost;dbname=yiitest;port=5432;'
,
'dsn'
=>
'pgsql:host=localhost;dbname=yiitest;port=5432;'
,
'username'
=>
'postgres'
,
'username'
=>
'postgres'
,
'password'
=>
'postgres'
,
'password'
=>
'postgres'
,
'attributes'
=>
array
(
'search_path'
=>
'master,hello'
),
'fixture'
=>
__DIR__
.
'/postgres.sql'
,
'fixture'
=>
__DIR__
.
'/postgres.sql'
,
)
)
)
)
...
...
tests/unit/framework/web/ResponseTest.php
View file @
004a069c
...
@@ -32,6 +32,7 @@ class ResponseTest extends \yiiunit\TestCase
...
@@ -32,6 +32,7 @@ class ResponseTest extends \yiiunit\TestCase
protected
function
setUp
()
protected
function
setUp
()
{
{
parent
::
setUp
();
parent
::
setUp
();
$this
->
mockApplication
();
$this
->
reset
();
$this
->
reset
();
}
}
...
...
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