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
8b2b7915
Commit
8b2b7915
authored
Feb 05, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed application to app.
parent
fcf3f2c8
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
87 additions
and
86 deletions
+87
-86
YiiBase.php
framework/YiiBase.php
+7
-6
Application.php
framework/base/Application.php
+2
-2
Controller.php
framework/base/Controller.php
+3
-3
ErrorHandler.php
framework/base/ErrorHandler.php
+6
-6
Module.php
framework/base/Module.php
+6
-6
SecurityManager.php
framework/base/SecurityManager.php
+4
-4
Theme.php
framework/base/Theme.php
+1
-1
UrlManager.php
framework/base/UrlManager.php
+5
-5
View.php
framework/base/View.php
+14
-14
Widget.php
framework/base/Widget.php
+1
-1
DbCache.php
framework/caching/DbCache.php
+1
-1
DbDependency.php
framework/caching/DbDependency.php
+1
-1
DummyCache.php
framework/caching/DummyCache.php
+1
-1
FileCache.php
framework/caching/FileCache.php
+1
-1
HelpController.php
framework/console/controllers/HelpController.php
+2
-2
MigrateController.php
framework/console/controllers/MigrateController.php
+5
-5
ActiveRecord.php
framework/db/ActiveRecord.php
+1
-1
Command.php
framework/db/Command.php
+1
-1
Migration.php
framework/db/Migration.php
+1
-1
Query.php
framework/db/Query.php
+1
-1
Schema.php
framework/db/Schema.php
+2
-2
I18N.php
framework/i18n/I18N.php
+2
-2
MessageSource.php
framework/i18n/MessageSource.php
+1
-1
DbTarget.php
framework/logging/DbTarget.php
+1
-1
FileTarget.php
framework/logging/FileTarget.php
+1
-1
ProfileTarget.php
framework/logging/ProfileTarget.php
+1
-1
Router.php
framework/logging/Router.php
+1
-1
Target.php
framework/logging/Target.php
+1
-1
WebTarget.php
framework/logging/WebTarget.php
+1
-1
FileHelper.php
framework/util/FileHelper.php
+2
-2
CaptchaValidator.php
framework/validators/CaptchaValidator.php
+2
-2
StringValidator.php
framework/validators/StringValidator.php
+1
-1
AssetManager.php
framework/web/AssetManager.php
+2
-2
Controller.php
framework/web/Controller.php
+2
-2
Request.php
framework/web/Request.php
+1
-1
Sort.php
framework/web/Sort.php
+1
-1
Theme.php
framework/web/Theme.php
+1
-1
No files found.
framework/YiiBase.php
View file @
8b2b7915
...
@@ -65,7 +65,7 @@ class YiiBase
...
@@ -65,7 +65,7 @@ class YiiBase
/**
/**
* @var yii\base\Application the application instance
* @var yii\base\Application the application instance
*/
*/
public
static
$app
lication
;
public
static
$app
;
/**
/**
* @var array registered path aliases
* @var array registered path aliases
* @see getAlias
* @see getAlias
...
@@ -125,8 +125,8 @@ class YiiBase
...
@@ -125,8 +125,8 @@ class YiiBase
*
*
* To import a class or a directory, one can use either path alias or class name (can be namespaced):
* To import a class or a directory, one can use either path alias or class name (can be namespaced):
*
*
* - `@app
lication
/components/GoogleMap`: importing the `GoogleMap` class with a path alias;
* - `@app/components/GoogleMap`: importing the `GoogleMap` class with a path alias;
* - `@app
lication
/components/*`: importing the whole `components` directory with a path alias;
* - `@app/components/*`: importing the whole `components` directory with a path alias;
* - `GoogleMap`: importing the `GoogleMap` class with a class name. [[autoload()]] will be used
* - `GoogleMap`: importing the `GoogleMap` class with a class name. [[autoload()]] will be used
* when this class is used for the first time.
* when this class is used for the first time.
*
*
...
@@ -262,6 +262,7 @@ class YiiBase
...
@@ -262,6 +262,7 @@ class YiiBase
*
*
* @param string $className class name
* @param string $className class name
* @return boolean whether the class has been loaded successfully
* @return boolean whether the class has been loaded successfully
* @throws Exception if the class file does not exist
*/
*/
public
static
function
autoload
(
$className
)
public
static
function
autoload
(
$className
)
{
{
...
@@ -322,12 +323,12 @@ class YiiBase
...
@@ -322,12 +323,12 @@ class YiiBase
* the class. For example,
* the class. For example,
*
*
* - `\app\components\GoogleMap`: fully-qualified namespaced class.
* - `\app\components\GoogleMap`: fully-qualified namespaced class.
* - `@app
lication
/components/GoogleMap`: an alias
* - `@app/components/GoogleMap`: an alias
*
*
* Below are some usage examples:
* Below are some usage examples:
*
*
* ~~~
* ~~~
* $object = \Yii::createObject('@app
lication
/components/GoogleMap');
* $object = \Yii::createObject('@app/components/GoogleMap');
* $object = \Yii::createObject(array(
* $object = \Yii::createObject(array(
* 'class' => '\app\components\GoogleMap',
* 'class' => '\app\components\GoogleMap',
* 'apiKey' => 'xyz',
* 'apiKey' => 'xyz',
...
@@ -520,6 +521,6 @@ class YiiBase
...
@@ -520,6 +521,6 @@ class YiiBase
*/
*/
public
static
function
t
(
$message
,
$params
=
array
(),
$language
=
null
)
public
static
function
t
(
$message
,
$params
=
array
(),
$language
=
null
)
{
{
Yii
::
$app
lication
->
getI18N
()
->
translate
(
$message
,
$params
,
$language
);
Yii
::
$app
->
getI18N
()
->
translate
(
$message
,
$params
,
$language
);
}
}
}
}
framework/base/Application.php
View file @
8b2b7915
...
@@ -105,7 +105,7 @@ class Application extends Module
...
@@ -105,7 +105,7 @@ class Application extends Module
*/
*/
public
function
__construct
(
$id
,
$basePath
,
$config
=
array
())
public
function
__construct
(
$id
,
$basePath
,
$config
=
array
())
{
{
Yii
::
$app
lication
=
$this
;
Yii
::
$app
=
$this
;
$this
->
id
=
$id
;
$this
->
id
=
$id
;
$this
->
setBasePath
(
$basePath
);
$this
->
setBasePath
(
$basePath
);
...
@@ -342,7 +342,7 @@ class Application extends Module
...
@@ -342,7 +342,7 @@ class Application extends Module
*/
*/
public
function
registerDefaultAliases
()
public
function
registerDefaultAliases
()
{
{
Yii
::
$aliases
[
'@app
lication
'
]
=
$this
->
getBasePath
();
Yii
::
$aliases
[
'@app'
]
=
$this
->
getBasePath
();
Yii
::
$aliases
[
'@entry'
]
=
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
]);
Yii
::
$aliases
[
'@entry'
]
=
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
]);
Yii
::
$aliases
[
'@www'
]
=
''
;
Yii
::
$aliases
[
'@www'
]
=
''
;
}
}
...
...
framework/base/Controller.php
View file @
8b2b7915
...
@@ -72,9 +72,9 @@ class Controller extends Component
...
@@ -72,9 +72,9 @@ class Controller extends Component
*
*
* ~~~
* ~~~
* return array(
* return array(
* 'action1' => '@app
lication
/components/Action1',
* 'action1' => '@app/components/Action1',
* 'action2' => array(
* 'action2' => array(
* 'class' => '@app
lication
/components/Action2',
* 'class' => '@app/components/Action2',
* 'property1' => 'value1',
* 'property1' => 'value1',
* 'property2' => 'value2',
* 'property2' => 'value2',
* ),
* ),
...
@@ -139,7 +139,7 @@ class Controller extends Component
...
@@ -139,7 +139,7 @@ class Controller extends Component
}
elseif
(
$pos
>
0
)
{
}
elseif
(
$pos
>
0
)
{
return
$this
->
module
->
runAction
(
$route
,
$params
);
return
$this
->
module
->
runAction
(
$route
,
$params
);
}
else
{
}
else
{
return
\Yii
::
$app
lication
->
runAction
(
ltrim
(
$route
,
'/'
),
$params
);
return
\Yii
::
$app
->
runAction
(
ltrim
(
$route
,
'/'
),
$params
);
}
}
}
}
...
...
framework/base/ErrorHandler.php
View file @
8b2b7915
...
@@ -36,7 +36,7 @@ class ErrorHandler extends Component
...
@@ -36,7 +36,7 @@ class ErrorHandler extends Component
public
$discardExistingOutput
=
true
;
public
$discardExistingOutput
=
true
;
/**
/**
* @var string the route (eg 'site/error') to the controller action that will be used to display external errors.
* @var string the route (eg 'site/error') to the controller action that will be used to display external errors.
* Inside the action, it can retrieve the error information by \Yii::$app
lication
->errorHandler->error.
* Inside the action, it can retrieve the error information by \Yii::$app->errorHandler->error.
* This property defaults to null, meaning ErrorHandler will handle the error display.
* This property defaults to null, meaning ErrorHandler will handle the error display.
*/
*/
public
$errorAction
;
public
$errorAction
;
...
@@ -71,14 +71,14 @@ class ErrorHandler extends Component
...
@@ -71,14 +71,14 @@ class ErrorHandler extends Component
protected
function
render
(
$exception
)
protected
function
render
(
$exception
)
{
{
if
(
$this
->
errorAction
!==
null
)
{
if
(
$this
->
errorAction
!==
null
)
{
\Yii
::
$app
lication
->
runAction
(
$this
->
errorAction
);
\Yii
::
$app
->
runAction
(
$this
->
errorAction
);
}
elseif
(
\Yii
::
$app
lication
instanceof
\yii\web\Application
)
{
}
elseif
(
\Yii
::
$app
instanceof
\yii\web\Application
)
{
if
(
!
headers_sent
())
{
if
(
!
headers_sent
())
{
$errorCode
=
$exception
instanceof
HttpException
?
$exception
->
statusCode
:
500
;
$errorCode
=
$exception
instanceof
HttpException
?
$exception
->
statusCode
:
500
;
header
(
"HTTP/1.0
$errorCode
"
.
get_class
(
$exception
));
header
(
"HTTP/1.0
$errorCode
"
.
get_class
(
$exception
));
}
}
if
(
isset
(
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
])
&&
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
]
===
'XMLHttpRequest'
)
{
if
(
isset
(
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
])
&&
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
]
===
'XMLHttpRequest'
)
{
\Yii
::
$app
lication
->
renderException
(
$exception
);
\Yii
::
$app
->
renderException
(
$exception
);
}
else
{
}
else
{
$view
=
new
View
(
$this
);
$view
=
new
View
(
$this
);
if
(
!
YII_DEBUG
||
$exception
instanceof
UserException
)
{
if
(
!
YII_DEBUG
||
$exception
instanceof
UserException
)
{
...
@@ -91,7 +91,7 @@ class ErrorHandler extends Component
...
@@ -91,7 +91,7 @@ class ErrorHandler extends Component
));
));
}
}
}
else
{
}
else
{
\Yii
::
$app
lication
->
renderException
(
$exception
);
\Yii
::
$app
->
renderException
(
$exception
);
}
}
}
}
...
@@ -239,7 +239,7 @@ class ErrorHandler extends Component
...
@@ -239,7 +239,7 @@ class ErrorHandler extends Component
public
function
htmlEncode
(
$text
)
public
function
htmlEncode
(
$text
)
{
{
return
htmlspecialchars
(
$text
,
ENT_QUOTES
,
\Yii
::
$app
lication
->
charset
);
return
htmlspecialchars
(
$text
,
ENT_QUOTES
,
\Yii
::
$app
->
charset
);
}
}
public
function
clearOutput
()
public
function
clearOutput
()
...
...
framework/base/Module.php
View file @
8b2b7915
...
@@ -73,9 +73,9 @@ abstract class Module extends Component
...
@@ -73,9 +73,9 @@ abstract class Module extends Component
*
*
* ~~~
* ~~~
* array(
* array(
* 'account' => '@app
lication
/controllers/UserController',
* 'account' => '@app/controllers/UserController',
* 'article' => array(
* 'article' => array(
* 'class' => '@app
lication
/controllers/PostController',
* 'class' => '@app/controllers/PostController',
* 'pageTitle' => 'something new',
* 'pageTitle' => 'something new',
* ),
* ),
* )
* )
...
@@ -311,7 +311,7 @@ abstract class Module extends Component
...
@@ -311,7 +311,7 @@ abstract class Module extends Component
*
*
* ~~~
* ~~~
* array(
* array(
* '@models' => '@app
lication
/models', // an existing alias
* '@models' => '@app/models', // an existing alias
* '@backend' => __DIR__ . '/../backend', // a directory
* '@backend' => __DIR__ . '/../backend', // a directory
* )
* )
* ~~~
* ~~~
...
@@ -563,10 +563,10 @@ abstract class Module extends Component
...
@@ -563,10 +563,10 @@ abstract class Module extends Component
if
(
is_array
(
$result
))
{
if
(
is_array
(
$result
))
{
/** @var $controller Controller */
/** @var $controller Controller */
list
(
$controller
,
$actionID
)
=
$result
;
list
(
$controller
,
$actionID
)
=
$result
;
$oldController
=
Yii
::
$app
lication
->
controller
;
$oldController
=
Yii
::
$app
->
controller
;
Yii
::
$app
lication
->
controller
=
$controller
;
Yii
::
$app
->
controller
=
$controller
;
$status
=
$controller
->
runAction
(
$actionID
,
$params
);
$status
=
$controller
->
runAction
(
$actionID
,
$params
);
Yii
::
$app
lication
->
controller
=
$oldController
;
Yii
::
$app
->
controller
=
$oldController
;
return
$status
;
return
$status
;
}
else
{
}
else
{
throw
new
InvalidRouteException
(
'Unable to resolve the request: '
.
trim
(
$this
->
getUniqueId
()
.
'/'
.
$route
,
'/'
));
throw
new
InvalidRouteException
(
'Unable to resolve the request: '
.
trim
(
$this
->
getUniqueId
()
.
'/'
.
$route
,
'/'
));
...
...
framework/base/SecurityManager.php
View file @
8b2b7915
...
@@ -59,12 +59,12 @@ class SecurityManager extends Component
...
@@ -59,12 +59,12 @@ class SecurityManager extends Component
if
(
$this
->
_validationKey
!==
null
)
{
if
(
$this
->
_validationKey
!==
null
)
{
return
$this
->
_validationKey
;
return
$this
->
_validationKey
;
}
else
{
}
else
{
if
((
$key
=
\Yii
::
$app
lication
->
getGlobalState
(
self
::
STATE_VALIDATION_KEY
))
!==
null
)
{
if
((
$key
=
\Yii
::
$app
->
getGlobalState
(
self
::
STATE_VALIDATION_KEY
))
!==
null
)
{
$this
->
setValidationKey
(
$key
);
$this
->
setValidationKey
(
$key
);
}
else
{
}
else
{
$key
=
$this
->
generateRandomKey
();
$key
=
$this
->
generateRandomKey
();
$this
->
setValidationKey
(
$key
);
$this
->
setValidationKey
(
$key
);
\Yii
::
$app
lication
->
setGlobalState
(
self
::
STATE_VALIDATION_KEY
,
$key
);
\Yii
::
$app
->
setGlobalState
(
self
::
STATE_VALIDATION_KEY
,
$key
);
}
}
return
$this
->
_validationKey
;
return
$this
->
_validationKey
;
}
}
...
@@ -92,12 +92,12 @@ class SecurityManager extends Component
...
@@ -92,12 +92,12 @@ class SecurityManager extends Component
if
(
$this
->
_encryptionKey
!==
null
)
{
if
(
$this
->
_encryptionKey
!==
null
)
{
return
$this
->
_encryptionKey
;
return
$this
->
_encryptionKey
;
}
else
{
}
else
{
if
((
$key
=
\Yii
::
$app
lication
->
getGlobalState
(
self
::
STATE_ENCRYPTION_KEY
))
!==
null
)
{
if
((
$key
=
\Yii
::
$app
->
getGlobalState
(
self
::
STATE_ENCRYPTION_KEY
))
!==
null
)
{
$this
->
setEncryptionKey
(
$key
);
$this
->
setEncryptionKey
(
$key
);
}
else
{
}
else
{
$key
=
$this
->
generateRandomKey
();
$key
=
$this
->
generateRandomKey
();
$this
->
setEncryptionKey
(
$key
);
$this
->
setEncryptionKey
(
$key
);
\Yii
::
$app
lication
->
setGlobalState
(
self
::
STATE_ENCRYPTION_KEY
,
$key
);
\Yii
::
$app
->
setGlobalState
(
self
::
STATE_ENCRYPTION_KEY
,
$key
);
}
}
return
$this
->
_encryptionKey
;
return
$this
->
_encryptionKey
;
}
}
...
...
framework/base/Theme.php
View file @
8b2b7915
...
@@ -58,7 +58,7 @@ class Theme extends Component
...
@@ -58,7 +58,7 @@ class Theme extends Component
if
(
empty
(
$this
->
pathMap
))
{
if
(
empty
(
$this
->
pathMap
))
{
if
(
$this
->
basePath
!==
null
)
{
if
(
$this
->
basePath
!==
null
)
{
$this
->
basePath
=
FileHelper
::
ensureDirectory
(
$this
->
basePath
);
$this
->
basePath
=
FileHelper
::
ensureDirectory
(
$this
->
basePath
);
$this
->
pathMap
=
array
(
Yii
::
$app
lication
->
getBasePath
()
=>
$this
->
basePath
);
$this
->
pathMap
=
array
(
Yii
::
$app
->
getBasePath
()
=>
$this
->
basePath
);
}
else
{
}
else
{
throw
new
InvalidConfigException
(
"Theme::basePath must be set."
);
throw
new
InvalidConfigException
(
"Theme::basePath must be set."
);
}
}
...
...
framework/base/UrlManager.php
View file @
8b2b7915
...
@@ -112,7 +112,7 @@ use \yii\base\Component;
...
@@ -112,7 +112,7 @@ use \yii\base\Component;
* </ul>
* </ul>
*
*
* UrlManager is a default application component that may be accessed via
* UrlManager is a default application component that may be accessed via
* {@link \Yii::$app
lication
->urlManager}.
* {@link \Yii::$app->urlManager}.
*
*
* @property string $baseUrl The base URL of the application (the part after host name and before query string).
* @property string $baseUrl The base URL of the application (the part after host name and before query string).
* If {@link showScriptName} is true, it will include the script name part.
* If {@link showScriptName} is true, it will include the script name part.
...
@@ -214,7 +214,7 @@ class UrlManager extends Component
...
@@ -214,7 +214,7 @@ class UrlManager extends Component
{
{
if
(
empty
(
$this
->
rules
)
||
$this
->
getUrlFormat
()
===
self
::
GET_FORMAT
)
if
(
empty
(
$this
->
rules
)
||
$this
->
getUrlFormat
()
===
self
::
GET_FORMAT
)
return
;
return
;
if
(
$this
->
cacheID
!==
false
&&
(
$cache
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
cacheID
))
!==
null
)
if
(
$this
->
cacheID
!==
false
&&
(
$cache
=
\Yii
::
$app
->
getComponent
(
$this
->
cacheID
))
!==
null
)
{
{
$hash
=
md5
(
serialize
(
$this
->
rules
));
$hash
=
md5
(
serialize
(
$this
->
rules
));
if
((
$data
=
$cache
->
get
(
self
::
CACHE_KEY
))
!==
false
&&
isset
(
$data
[
1
])
&&
$data
[
1
]
===
$hash
)
if
((
$data
=
$cache
->
get
(
self
::
CACHE_KEY
))
!==
false
&&
isset
(
$data
[
1
])
&&
$data
[
1
]
===
$hash
)
...
@@ -464,9 +464,9 @@ class UrlManager extends Component
...
@@ -464,9 +464,9 @@ class UrlManager extends Component
else
else
{
{
if
(
$this
->
showScriptName
)
if
(
$this
->
showScriptName
)
$this
->
_baseUrl
=
\Yii
::
$app
lication
->
getRequest
()
->
getScriptUrl
();
$this
->
_baseUrl
=
\Yii
::
$app
->
getRequest
()
->
getScriptUrl
();
else
else
$this
->
_baseUrl
=
\Yii
::
$app
lication
->
getRequest
()
->
getBaseUrl
();
$this
->
_baseUrl
=
\Yii
::
$app
->
getRequest
()
->
getBaseUrl
();
return
$this
->
_baseUrl
;
return
$this
->
_baseUrl
;
}
}
}
}
...
@@ -755,7 +755,7 @@ class CUrlRule extends CBaseUrlRule
...
@@ -755,7 +755,7 @@ class CUrlRule extends CBaseUrlRule
if
(
$this
->
hasHostInfo
)
if
(
$this
->
hasHostInfo
)
{
{
$hostInfo
=
\Yii
::
$app
lication
->
getRequest
()
->
getHostInfo
();
$hostInfo
=
\Yii
::
$app
->
getRequest
()
->
getHostInfo
();
if
(
stripos
(
$url
,
$hostInfo
)
===
0
)
if
(
stripos
(
$url
,
$hostInfo
)
===
0
)
$url
=
substr
(
$url
,
strlen
(
$hostInfo
));
$url
=
substr
(
$url
,
strlen
(
$hostInfo
));
}
}
...
...
framework/base/View.php
View file @
8b2b7915
...
@@ -148,7 +148,7 @@ class View extends Component
...
@@ -148,7 +148,7 @@ class View extends Component
*/
*/
public
function
renderFile
(
$file
,
$params
=
array
())
public
function
renderFile
(
$file
,
$params
=
array
())
{
{
$renderer
=
Yii
::
$app
lication
->
getViewRenderer
();
$renderer
=
Yii
::
$app
->
getViewRenderer
();
if
(
$renderer
!==
null
)
{
if
(
$renderer
!==
null
)
{
return
$renderer
->
render
(
$this
,
$file
,
$params
);
return
$renderer
->
render
(
$this
,
$file
,
$params
);
}
else
{
}
else
{
...
@@ -344,7 +344,7 @@ class View extends Component
...
@@ -344,7 +344,7 @@ class View extends Component
*
*
* A view name can be specified in one of the following formats:
* A view name can be specified in one of the following formats:
*
*
* - path alias (e.g. "@app
lication
/views/site/index");
* - path alias (e.g. "@app/views/site/index");
* - absolute path within application (e.g. "//site/index"): the view name starts with double slashes.
* - absolute path within application (e.g. "//site/index"): the view name starts with double slashes.
* The actual view file will be looked for under the [[Application::viewPath|view path]] of the application.
* The actual view file will be looked for under the [[Application::viewPath|view path]] of the application.
* - absolute path within module (e.g. "/site/index"): the view name starts with a single slash.
* - absolute path within module (e.g. "/site/index"): the view name starts with a single slash.
...
@@ -374,7 +374,7 @@ class View extends Component
...
@@ -374,7 +374,7 @@ class View extends Component
$view
.=
'.php'
;
$view
.=
'.php'
;
}
}
if
(
strncmp
(
$view
,
'@'
,
1
)
===
0
)
{
if
(
strncmp
(
$view
,
'@'
,
1
)
===
0
)
{
// e.g. "@app
lication
/views/common"
// e.g. "@app/views/common"
if
((
$file
=
Yii
::
getAlias
(
$view
))
===
false
)
{
if
((
$file
=
Yii
::
getAlias
(
$view
))
===
false
)
{
throw
new
InvalidConfigException
(
"Invalid path alias:
$view
"
);
throw
new
InvalidConfigException
(
"Invalid path alias:
$view
"
);
}
}
...
@@ -386,18 +386,18 @@ class View extends Component
...
@@ -386,18 +386,18 @@ class View extends Component
$class
=
new
\ReflectionClass
(
$this
->
owner
);
$class
=
new
\ReflectionClass
(
$this
->
owner
);
$file
=
dirname
(
$class
->
getFileName
())
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
$view
;
$file
=
dirname
(
$class
->
getFileName
())
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
$view
;
}
else
{
}
else
{
$file
=
Yii
::
$app
lication
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
$file
=
Yii
::
$app
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
}
}
}
elseif
(
strncmp
(
$view
,
'//'
,
2
)
!==
0
&&
Yii
::
$app
lication
->
controller
!==
null
)
{
}
elseif
(
strncmp
(
$view
,
'//'
,
2
)
!==
0
&&
Yii
::
$app
->
controller
!==
null
)
{
// e.g. "/site/index"
// e.g. "/site/index"
$file
=
Yii
::
$app
lication
->
controller
->
module
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
ltrim
(
$view
,
'/'
);
$file
=
Yii
::
$app
->
controller
->
module
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
ltrim
(
$view
,
'/'
);
}
else
{
}
else
{
// e.g. "//layouts/main"
// e.g. "//layouts/main"
$file
=
Yii
::
$app
lication
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
ltrim
(
$view
,
'/'
);
$file
=
Yii
::
$app
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
ltrim
(
$view
,
'/'
);
}
}
if
(
is_file
(
$file
))
{
if
(
is_file
(
$file
))
{
if
(
$this
->
enableTheme
&&
(
$theme
=
Yii
::
$app
lication
->
getTheme
())
!==
null
)
{
if
(
$this
->
enableTheme
&&
(
$theme
=
Yii
::
$app
->
getTheme
())
!==
null
)
{
$file
=
$theme
->
apply
(
$file
);
$file
=
$theme
->
apply
(
$file
);
}
}
return
$this
->
enableI18N
?
FileHelper
::
localize
(
$file
,
$this
->
language
,
$this
->
sourceLanguage
)
:
$file
;
return
$this
->
enableI18N
?
FileHelper
::
localize
(
$file
,
$this
->
language
,
$this
->
sourceLanguage
)
:
$file
;
...
@@ -423,7 +423,7 @@ class View extends Component
...
@@ -423,7 +423,7 @@ class View extends Component
*
*
* Like view names, a layout name can take several formats:
* Like view names, a layout name can take several formats:
*
*
* - path alias (e.g. "@app
lication
/views/layouts/main");
* - path alias (e.g. "@app/views/layouts/main");
* - absolute path (e.g. "/main"): the layout name starts with a slash. The actual layout file will be
* - absolute path (e.g. "/main"): the layout name starts with a slash. The actual layout file will be
* looked for under the [[Application::layoutPath|layout path]] of the application;
* looked for under the [[Application::layoutPath|layout path]] of the application;
* - relative path (e.g. "main"): the actual layout layout file will be looked for under the
* - relative path (e.g. "main"): the actual layout layout file will be looked for under the
...
@@ -444,10 +444,10 @@ class View extends Component
...
@@ -444,10 +444,10 @@ class View extends Component
{
{
/** @var $module Module */
/** @var $module Module */
if
(
is_string
(
$this
->
layout
))
{
if
(
is_string
(
$this
->
layout
))
{
if
(
Yii
::
$app
lication
->
controller
)
{
if
(
Yii
::
$app
->
controller
)
{
$module
=
Yii
::
$app
lication
->
controller
->
module
;
$module
=
Yii
::
$app
->
controller
->
module
;
}
else
{
}
else
{
$module
=
Yii
::
$app
lication
;
$module
=
Yii
::
$app
;
}
}
$view
=
$this
->
layout
;
$view
=
$this
->
layout
;
}
elseif
(
$this
->
owner
instanceof
Controller
)
{
}
elseif
(
$this
->
owner
instanceof
Controller
)
{
...
@@ -477,13 +477,13 @@ class View extends Component
...
@@ -477,13 +477,13 @@ class View extends Component
throw
new
InvalidConfigException
(
"Invalid path alias:
$view
"
);
throw
new
InvalidConfigException
(
"Invalid path alias:
$view
"
);
}
}
}
elseif
(
strncmp
(
$view
,
'/'
,
1
)
===
0
)
{
}
elseif
(
strncmp
(
$view
,
'/'
,
1
)
===
0
)
{
$file
=
Yii
::
$app
lication
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
$file
=
Yii
::
$app
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
}
else
{
}
else
{
$file
=
$module
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
$file
=
$module
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
}
}
if
(
is_file
(
$file
))
{
if
(
is_file
(
$file
))
{
if
(
$this
->
enableTheme
&&
(
$theme
=
Yii
::
$app
lication
->
getTheme
())
!==
null
)
{
if
(
$this
->
enableTheme
&&
(
$theme
=
Yii
::
$app
->
getTheme
())
!==
null
)
{
$file
=
$theme
->
apply
(
$file
);
$file
=
$theme
->
apply
(
$file
);
}
}
return
$this
->
enableI18N
?
FileHelper
::
localize
(
$file
,
$this
->
language
,
$this
->
sourceLanguage
)
:
$file
;
return
$this
->
enableI18N
?
FileHelper
::
localize
(
$file
,
$this
->
language
,
$this
->
sourceLanguage
)
:
$file
;
...
...
framework/base/Widget.php
View file @
8b2b7915
...
@@ -80,7 +80,7 @@ class Widget extends Component
...
@@ -80,7 +80,7 @@ class Widget extends Component
* To determine which view file should be rendered, the method calls [[findViewFile()]] which
* To determine which view file should be rendered, the method calls [[findViewFile()]] which
* will search in the directories as specified by [[basePath]].
* will search in the directories as specified by [[basePath]].
*
*
* View name can be a path alias representing an absolute file path (e.g. `@app
lication
/views/layout/index`),
* View name can be a path alias representing an absolute file path (e.g. `@app/views/layout/index`),
* or a path relative to [[basePath]]. The file suffix is optional and defaults to `.php` if not given
* or a path relative to [[basePath]]. The file suffix is optional and defaults to `.php` if not given
* in the view name.
* in the view name.
*
*
...
...
framework/caching/DbCache.php
View file @
8b2b7915
...
@@ -74,7 +74,7 @@ class DbCache extends Cache
...
@@ -74,7 +74,7 @@ class DbCache extends Cache
public
function
getDb
()
public
function
getDb
()
{
{
if
(
$this
->
_db
===
null
)
{
if
(
$this
->
_db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$db
=
\Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$db
instanceof
Connection
)
{
if
(
$db
instanceof
Connection
)
{
$this
->
_db
=
$db
;
$this
->
_db
=
$db
;
}
else
{
}
else
{
...
...
framework/caching/DbDependency.php
View file @
8b2b7915
...
@@ -91,7 +91,7 @@ class DbDependency extends Dependency
...
@@ -91,7 +91,7 @@ class DbDependency extends Dependency
public
function
getDb
()
public
function
getDb
()
{
{
if
(
$this
->
_db
===
null
)
{
if
(
$this
->
_db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$db
=
\Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$db
instanceof
Connection
)
{
if
(
$db
instanceof
Connection
)
{
$this
->
_db
=
$db
;
$this
->
_db
=
$db
;
}
else
{
}
else
{
...
...
framework/caching/DummyCache.php
View file @
8b2b7915
...
@@ -13,7 +13,7 @@ namespace yii\caching;
...
@@ -13,7 +13,7 @@ namespace yii\caching;
* DummyCache is a placeholder cache component.
* DummyCache is a placeholder cache component.
*
*
* DummyCache does not cache anything. It is provided so that one can always configure
* DummyCache does not cache anything. It is provided so that one can always configure
* a 'cache' application component and save the check of existence of `\Yii::$app
lication
->cache`.
* a 'cache' application component and save the check of existence of `\Yii::$app->cache`.
* By replacing DummyCache with some other cache component, one can quickly switch from
* By replacing DummyCache with some other cache component, one can quickly switch from
* non-caching mode to caching mode.
* non-caching mode to caching mode.
*
*
...
...
framework/caching/FileCache.php
View file @
8b2b7915
...
@@ -28,7 +28,7 @@ class FileCache extends Cache
...
@@ -28,7 +28,7 @@ class FileCache extends Cache
/**
/**
* @var string the directory to store cache files. You may use path alias here.
* @var string the directory to store cache files. You may use path alias here.
*/
*/
public
$cachePath
=
'@app
lication
/runtime/cache'
;
public
$cachePath
=
'@app/runtime/cache'
;
/**
/**
* @var string cache file suffix. Defaults to '.bin'.
* @var string cache file suffix. Defaults to '.bin'.
*/
*/
...
...
framework/console/controllers/HelpController.php
View file @
8b2b7915
...
@@ -55,7 +55,7 @@ class HelpController extends Controller
...
@@ -55,7 +55,7 @@ class HelpController extends Controller
public
function
actionIndex
(
$command
=
null
)
public
function
actionIndex
(
$command
=
null
)
{
{
if
(
$command
!==
null
)
{
if
(
$command
!==
null
)
{
$result
=
Yii
::
$app
lication
->
createController
(
$command
);
$result
=
Yii
::
$app
->
createController
(
$command
);
if
(
$result
===
false
)
{
if
(
$result
===
false
)
{
throw
new
Exception
(
Yii
::
t
(
'yii|No help for unknown command "{command}".'
,
array
(
throw
new
Exception
(
Yii
::
t
(
'yii|No help for unknown command "{command}".'
,
array
(
'{command}'
=>
$command
,
'{command}'
=>
$command
,
...
@@ -81,7 +81,7 @@ class HelpController extends Controller
...
@@ -81,7 +81,7 @@ class HelpController extends Controller
*/
*/
public
function
getCommands
()
public
function
getCommands
()
{
{
$commands
=
$this
->
getModuleCommands
(
Yii
::
$app
lication
);
$commands
=
$this
->
getModuleCommands
(
Yii
::
$app
);
sort
(
$commands
);
sort
(
$commands
);
return
array_unique
(
$commands
);
return
array_unique
(
$commands
);
}
}
...
...
framework/console/controllers/MigrateController.php
View file @
8b2b7915
...
@@ -70,7 +70,7 @@ class MigrateController extends Controller
...
@@ -70,7 +70,7 @@ class MigrateController extends Controller
* @var string the directory storing the migration classes. This can be either
* @var string the directory storing the migration classes. This can be either
* a path alias or a directory.
* a path alias or a directory.
*/
*/
public
$migrationPath
=
'@app
lication
/migrations'
;
public
$migrationPath
=
'@app/migrations'
;
/**
/**
* @var string the name of the table for keeping applied migration information.
* @var string the name of the table for keeping applied migration information.
*/
*/
...
@@ -82,7 +82,7 @@ class MigrateController extends Controller
...
@@ -82,7 +82,7 @@ class MigrateController extends Controller
public
$connectionID
=
'db'
;
public
$connectionID
=
'db'
;
/**
/**
* @var string the template file for generating new migrations.
* @var string the template file for generating new migrations.
* This can be either a path alias (e.g. "@app
lication
/migrations/template.php")
* This can be either a path alias (e.g. "@app/migrations/template.php")
* or a file path.
* or a file path.
*/
*/
public
$templateFile
=
'@yii/views/migration.php'
;
public
$templateFile
=
'@yii/views/migration.php'
;
...
@@ -121,7 +121,7 @@ class MigrateController extends Controller
...
@@ -121,7 +121,7 @@ class MigrateController extends Controller
}
}
$this
->
migrationPath
=
$path
;
$this
->
migrationPath
=
$path
;
$this
->
db
=
Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
!
$this
->
db
instanceof
Connection
)
{
if
(
!
$this
->
db
instanceof
Connection
)
{
throw
new
Exception
(
"Invalid DB connection
\"
{
$this
->
connectionID
}
\"
."
);
throw
new
Exception
(
"Invalid DB connection
\"
{
$this
->
connectionID
}
\"
."
);
}
}
...
@@ -150,7 +150,7 @@ class MigrateController extends Controller
...
@@ -150,7 +150,7 @@ class MigrateController extends Controller
{
{
if
((
$migrations
=
$this
->
getNewMigrations
())
===
array
())
{
if
((
$migrations
=
$this
->
getNewMigrations
())
===
array
())
{
echo
"No new migration found. Your system is up-to-date.
\n
"
;
echo
"No new migration found. Your system is up-to-date.
\n
"
;
Yii
::
$app
lication
->
end
();
Yii
::
$app
->
end
();
}
}
$total
=
count
(
$migrations
);
$total
=
count
(
$migrations
);
...
@@ -576,7 +576,7 @@ class MigrateController extends Controller
...
@@ -576,7 +576,7 @@ class MigrateController extends Controller
if
(
$this
->
db
!==
null
)
{
if
(
$this
->
db
!==
null
)
{
return
$this
->
db
;
return
$this
->
db
;
}
else
{
}
else
{
$this
->
db
=
Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$this
->
db
instanceof
Connection
)
{
if
(
$this
->
db
instanceof
Connection
)
{
return
$this
->
db
;
return
$this
->
db
;
}
else
{
}
else
{
...
...
framework/db/ActiveRecord.php
View file @
8b2b7915
...
@@ -96,7 +96,7 @@ class ActiveRecord extends Model
...
@@ -96,7 +96,7 @@ class ActiveRecord extends Model
*/
*/
public
static
function
getDb
()
public
static
function
getDb
()
{
{
return
\Yii
::
$app
lication
->
getDb
();
return
\Yii
::
$app
->
getDb
();
}
}
/**
/**
...
...
framework/db/Command.php
View file @
8b2b7915
...
@@ -387,7 +387,7 @@ class Command extends \yii\base\Component
...
@@ -387,7 +387,7 @@ class Command extends \yii\base\Component
/** @var $cache \yii\caching\Cache */
/** @var $cache \yii\caching\Cache */
if
(
$db
->
enableQueryCache
&&
$method
!==
''
)
{
if
(
$db
->
enableQueryCache
&&
$method
!==
''
)
{
$cache
=
\Yii
::
$app
lication
->
getComponent
(
$db
->
queryCacheID
);
$cache
=
\Yii
::
$app
->
getComponent
(
$db
->
queryCacheID
);
}
}
if
(
isset
(
$cache
))
{
if
(
isset
(
$cache
))
{
...
...
framework/db/Migration.php
View file @
8b2b7915
...
@@ -51,7 +51,7 @@ class Migration extends \yii\base\Component
...
@@ -51,7 +51,7 @@ class Migration extends \yii\base\Component
{
{
parent
::
init
();
parent
::
init
();
if
(
$this
->
db
===
null
)
{
if
(
$this
->
db
===
null
)
{
$this
->
db
=
\Yii
::
$app
lication
->
getComponent
(
'db'
);
$this
->
db
=
\Yii
::
$app
->
getComponent
(
'db'
);
}
}
}
}
...
...
framework/db/Query.php
View file @
8b2b7915
...
@@ -117,7 +117,7 @@ class Query extends \yii\base\Component
...
@@ -117,7 +117,7 @@ class Query extends \yii\base\Component
public
function
createCommand
(
$db
=
null
)
public
function
createCommand
(
$db
=
null
)
{
{
if
(
$db
===
null
)
{
if
(
$db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
db
;
$db
=
\Yii
::
$app
->
db
;
}
}
$sql
=
$db
->
getQueryBuilder
()
->
build
(
$this
);
$sql
=
$db
->
getQueryBuilder
()
->
build
(
$this
);
return
$db
->
createCommand
(
$sql
,
$this
->
params
);
return
$db
->
createCommand
(
$sql
,
$this
->
params
);
...
...
framework/db/Schema.php
View file @
8b2b7915
...
@@ -87,7 +87,7 @@ abstract class Schema extends \yii\base\Object
...
@@ -87,7 +87,7 @@ abstract class Schema extends \yii\base\Object
$realName
=
$this
->
getRealTableName
(
$name
);
$realName
=
$this
->
getRealTableName
(
$name
);
/** @var $cache Cache */
/** @var $cache Cache */
if
(
$db
->
enableSchemaCache
&&
(
$cache
=
\Yii
::
$app
lication
->
getComponent
(
$db
->
schemaCacheID
))
!==
null
&&
!
in_array
(
$name
,
$db
->
schemaCacheExclude
,
true
))
{
if
(
$db
->
enableSchemaCache
&&
(
$cache
=
\Yii
::
$app
->
getComponent
(
$db
->
schemaCacheID
))
!==
null
&&
!
in_array
(
$name
,
$db
->
schemaCacheExclude
,
true
))
{
$key
=
$this
->
getCacheKey
(
$cache
,
$name
);
$key
=
$this
->
getCacheKey
(
$cache
,
$name
);
if
(
$refresh
||
(
$table
=
$cache
->
get
(
$key
))
===
false
)
{
if
(
$refresh
||
(
$table
=
$cache
->
get
(
$key
))
===
false
)
{
$table
=
$this
->
loadTableSchema
(
$realName
);
$table
=
$this
->
loadTableSchema
(
$realName
);
...
@@ -171,7 +171,7 @@ abstract class Schema extends \yii\base\Object
...
@@ -171,7 +171,7 @@ abstract class Schema extends \yii\base\Object
public
function
refresh
()
public
function
refresh
()
{
{
/** @var $cache \yii\caching\Cache */
/** @var $cache \yii\caching\Cache */
if
(
$this
->
db
->
enableSchemaCache
&&
(
$cache
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
db
->
schemaCacheID
))
!==
null
)
{
if
(
$this
->
db
->
enableSchemaCache
&&
(
$cache
=
\Yii
::
$app
->
getComponent
(
$this
->
db
->
schemaCacheID
))
!==
null
)
{
foreach
(
$this
->
_tables
as
$name
=>
$table
)
{
foreach
(
$this
->
_tables
as
$name
=>
$table
)
{
$cache
->
delete
(
$this
->
getCacheKey
(
$cache
,
$name
));
$cache
->
delete
(
$this
->
getCacheKey
(
$cache
,
$name
));
}
}
...
...
framework/i18n/I18N.php
View file @
8b2b7915
...
@@ -10,10 +10,10 @@ class I18N extends Component
...
@@ -10,10 +10,10 @@ class I18N extends Component
public
function
translate
(
$message
,
$params
=
array
(),
$language
=
null
)
public
function
translate
(
$message
,
$params
=
array
(),
$language
=
null
)
{
{
if
(
$language
===
null
)
{
if
(
$language
===
null
)
{
$language
=
Yii
::
$app
lication
->
language
;
$language
=
Yii
::
$app
->
language
;
}
}
if
(
preg_match
(
'/^([\w\-\.]+)\|(.*)/'
,
$message
,
$matches
))
{
if
(
strpos
(
$message
,
'|'
)
!==
false
&&
preg_match
(
'/^([\w\-\.]+)\|(.*)/'
,
$message
,
$matches
))
{
$category
=
$matches
[
1
];
$category
=
$matches
[
1
];
$message
=
$matches
[
2
];
$message
=
$matches
[
2
];
}
else
{
}
else
{
...
...
framework/i18n/MessageSource.php
View file @
8b2b7915
...
@@ -49,7 +49,7 @@ class MessageSource extends Component
...
@@ -49,7 +49,7 @@ class MessageSource extends Component
{
{
parent
::
init
();
parent
::
init
();
if
(
$this
->
sourceLanguage
===
null
)
{
if
(
$this
->
sourceLanguage
===
null
)
{
$this
->
sourceLanguage
=
Yii
::
$app
lication
->
sourceLanguage
;
$this
->
sourceLanguage
=
Yii
::
$app
->
sourceLanguage
;
}
}
}
}
...
...
framework/logging/DbTarget.php
View file @
8b2b7915
...
@@ -69,7 +69,7 @@ class DbTarget extends Target
...
@@ -69,7 +69,7 @@ class DbTarget extends Target
public
function
getDb
()
public
function
getDb
()
{
{
if
(
$this
->
_db
===
null
)
{
if
(
$this
->
_db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$db
=
\Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$db
instanceof
Connection
)
{
if
(
$db
instanceof
Connection
)
{
$this
->
_db
=
$db
;
$this
->
_db
=
$db
;
}
else
{
}
else
{
...
...
framework/logging/FileTarget.php
View file @
8b2b7915
...
@@ -48,7 +48,7 @@ class FileTarget extends Target
...
@@ -48,7 +48,7 @@ class FileTarget extends Target
{
{
parent
::
init
();
parent
::
init
();
if
(
$this
->
logFile
===
null
)
{
if
(
$this
->
logFile
===
null
)
{
$this
->
logFile
=
\Yii
::
$app
lication
->
getRuntimePath
()
.
DIRECTORY_SEPARATOR
.
'application.log'
;
$this
->
logFile
=
\Yii
::
$app
->
getRuntimePath
()
.
DIRECTORY_SEPARATOR
.
'application.log'
;
}
else
{
}
else
{
$this
->
logFile
=
\Yii
::
getAlias
(
$this
->
logFile
);
$this
->
logFile
=
\Yii
::
getAlias
(
$this
->
logFile
);
}
}
...
...
framework/logging/ProfileTarget.php
View file @
8b2b7915
...
@@ -71,7 +71,7 @@ class CProfileLogRoute extends CWebLogRoute
...
@@ -71,7 +71,7 @@ class CProfileLogRoute extends CWebLogRoute
*/
*/
public
function
processLogs
(
$logs
)
public
function
processLogs
(
$logs
)
{
{
$app
=
\Yii
::
$app
lication
;
$app
=
\Yii
::
$app
;
if
(
!
(
$app
instanceof
CWebApplication
)
||
$app
->
getRequest
()
->
getIsAjaxRequest
())
if
(
!
(
$app
instanceof
CWebApplication
)
||
$app
->
getRequest
()
->
getIsAjaxRequest
())
return
;
return
;
...
...
framework/logging/Router.php
View file @
8b2b7915
...
@@ -52,7 +52,7 @@ use yii\base\Application;
...
@@ -52,7 +52,7 @@ use yii\base\Application;
* as follows:
* as follows:
*
*
* ~~~
* ~~~
* Yii::$app
lication
->log->targets['file']->enabled = false;
* Yii::$app->log->targets['file']->enabled = false;
* ~~~
* ~~~
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
...
...
framework/logging/Target.php
View file @
8b2b7915
...
@@ -110,7 +110,7 @@ abstract class Target extends \yii\base\Component
...
@@ -110,7 +110,7 @@ abstract class Target extends \yii\base\Component
protected
function
getContextMessage
()
protected
function
getContextMessage
()
{
{
$context
=
array
();
$context
=
array
();
if
(
$this
->
logUser
&&
(
$user
=
\Yii
::
$app
lication
->
getComponent
(
'user'
,
false
))
!==
null
)
{
if
(
$this
->
logUser
&&
(
$user
=
\Yii
::
$app
->
getComponent
(
'user'
,
false
))
!==
null
)
{
$context
[]
=
'User: '
.
$user
->
getName
()
.
' (ID: '
.
$user
->
getId
()
.
')'
;
$context
[]
=
'User: '
.
$user
->
getName
()
.
' (ID: '
.
$user
->
getId
()
.
')'
;
}
}
...
...
framework/logging/WebTarget.php
View file @
8b2b7915
...
@@ -46,7 +46,7 @@ class CWebLogRoute extends CLogRoute
...
@@ -46,7 +46,7 @@ class CWebLogRoute extends CLogRoute
*/
*/
protected
function
render
(
$view
,
$data
)
protected
function
render
(
$view
,
$data
)
{
{
$app
=
\Yii
::
$app
lication
;
$app
=
\Yii
::
$app
;
$isAjax
=
$app
->
getRequest
()
->
getIsAjaxRequest
();
$isAjax
=
$app
->
getRequest
()
->
getIsAjaxRequest
();
if
(
$this
->
showInFireBug
)
if
(
$this
->
showInFireBug
)
...
...
framework/util/FileHelper.php
View file @
8b2b7915
...
@@ -91,10 +91,10 @@ class FileHelper
...
@@ -91,10 +91,10 @@ class FileHelper
public
static
function
localize
(
$file
,
$language
=
null
,
$sourceLanguage
=
null
)
public
static
function
localize
(
$file
,
$language
=
null
,
$sourceLanguage
=
null
)
{
{
if
(
$language
===
null
)
{
if
(
$language
===
null
)
{
$language
=
\Yii
::
$app
lication
->
getLanguage
();
$language
=
\Yii
::
$app
->
getLanguage
();
}
}
if
(
$sourceLanguage
===
null
)
{
if
(
$sourceLanguage
===
null
)
{
$sourceLanguage
=
\Yii
::
$app
lication
->
sourceLanguage
;
$sourceLanguage
=
\Yii
::
$app
->
sourceLanguage
;
}
}
if
(
$language
===
$sourceLanguage
)
{
if
(
$language
===
$sourceLanguage
)
{
return
$file
;
return
$file
;
...
...
framework/validators/CaptchaValidator.php
View file @
8b2b7915
...
@@ -61,13 +61,13 @@ class CaptchaValidator extends Validator
...
@@ -61,13 +61,13 @@ class CaptchaValidator extends Validator
public
function
getCaptchaAction
()
public
function
getCaptchaAction
()
{
{
if
(
strpos
(
$this
->
captchaAction
,
'/'
)
!==
false
)
{
// contains controller or module
if
(
strpos
(
$this
->
captchaAction
,
'/'
)
!==
false
)
{
// contains controller or module
$ca
=
\Yii
::
$app
lication
->
createController
(
$this
->
captchaAction
);
$ca
=
\Yii
::
$app
->
createController
(
$this
->
captchaAction
);
if
(
$ca
!==
null
)
{
if
(
$ca
!==
null
)
{
list
(
$controller
,
$actionID
)
=
$ca
;
list
(
$controller
,
$actionID
)
=
$ca
;
$action
=
$controller
->
createAction
(
$actionID
);
$action
=
$controller
->
createAction
(
$actionID
);
}
}
}
else
{
}
else
{
$action
=
\Yii
::
$app
lication
->
getController
()
->
createAction
(
$this
->
captchaAction
);
$action
=
\Yii
::
$app
->
getController
()
->
createAction
(
$this
->
captchaAction
);
}
}
if
(
$action
===
null
)
{
if
(
$action
===
null
)
{
...
...
framework/validators/StringValidator.php
View file @
8b2b7915
...
@@ -82,7 +82,7 @@ class StringValidator extends Validator
...
@@ -82,7 +82,7 @@ class StringValidator extends Validator
}
}
if
(
function_exists
(
'mb_strlen'
)
&&
$this
->
encoding
!==
false
)
{
if
(
function_exists
(
'mb_strlen'
)
&&
$this
->
encoding
!==
false
)
{
$length
=
mb_strlen
(
$value
,
$this
->
encoding
?
$this
->
encoding
:
\Yii
::
$app
lication
->
charset
);
$length
=
mb_strlen
(
$value
,
$this
->
encoding
?
$this
->
encoding
:
\Yii
::
$app
->
charset
);
}
else
{
}
else
{
$length
=
strlen
(
$value
);
$length
=
strlen
(
$value
);
}
}
...
...
framework/web/AssetManager.php
View file @
8b2b7915
...
@@ -97,7 +97,7 @@ class CAssetManager extends CApplicationComponent
...
@@ -97,7 +97,7 @@ class CAssetManager extends CApplicationComponent
{
{
if
(
$this
->
_basePath
===
null
)
if
(
$this
->
_basePath
===
null
)
{
{
$request
=
\Yii
::
$app
lication
->
getRequest
();
$request
=
\Yii
::
$app
->
getRequest
();
$this
->
setBasePath
(
dirname
(
$request
->
getScriptFile
())
.
DIRECTORY_SEPARATOR
.
self
::
DEFAULT_BASEPATH
);
$this
->
setBasePath
(
dirname
(
$request
->
getScriptFile
())
.
DIRECTORY_SEPARATOR
.
self
::
DEFAULT_BASEPATH
);
}
}
return
$this
->
_basePath
;
return
$this
->
_basePath
;
...
@@ -125,7 +125,7 @@ class CAssetManager extends CApplicationComponent
...
@@ -125,7 +125,7 @@ class CAssetManager extends CApplicationComponent
{
{
if
(
$this
->
_baseUrl
===
null
)
if
(
$this
->
_baseUrl
===
null
)
{
{
$request
=
\Yii
::
$app
lication
->
getRequest
();
$request
=
\Yii
::
$app
->
getRequest
();
$this
->
setBaseUrl
(
$request
->
getBaseUrl
()
.
'/'
.
self
::
DEFAULT_BASEPATH
);
$this
->
setBaseUrl
(
$request
->
getBaseUrl
()
.
'/'
.
self
::
DEFAULT_BASEPATH
);
}
}
return
$this
->
_baseUrl
;
return
$this
->
_baseUrl
;
...
...
framework/web/Controller.php
View file @
8b2b7915
...
@@ -59,9 +59,9 @@ class Controller extends \yii\base\Controller
...
@@ -59,9 +59,9 @@ class Controller extends \yii\base\Controller
else
{
else
{
$name
=
ucfirst
(
basename
(
$this
->
id
));
$name
=
ucfirst
(
basename
(
$this
->
id
));
if
(
$this
->
action
!==
null
&&
strcasecmp
(
$this
->
action
->
id
,
$this
->
defaultAction
))
if
(
$this
->
action
!==
null
&&
strcasecmp
(
$this
->
action
->
id
,
$this
->
defaultAction
))
return
$this
->
_pageTitle
=
\Yii
::
$app
lication
->
name
.
' - '
.
ucfirst
(
$this
->
action
->
id
)
.
' '
.
$name
;
return
$this
->
_pageTitle
=
\Yii
::
$app
->
name
.
' - '
.
ucfirst
(
$this
->
action
->
id
)
.
' '
.
$name
;
else
else
return
$this
->
_pageTitle
=
\Yii
::
$app
lication
->
name
.
' - '
.
$name
;
return
$this
->
_pageTitle
=
\Yii
::
$app
->
name
.
' - '
.
$name
;
}
}
}
}
...
...
framework/web/Request.php
View file @
8b2b7915
...
@@ -87,7 +87,7 @@ class Request extends \yii\base\Request
...
@@ -87,7 +87,7 @@ class Request extends \yii\base\Request
}
}
if
(
$this
->
enableCsrfValidation
)
{
if
(
$this
->
enableCsrfValidation
)
{
\Yii
::
$app
lication
->
on
(
'beginRequest'
,
array
(
$this
,
'validateCsrfToken'
));
\Yii
::
$app
->
on
(
'beginRequest'
,
array
(
$this
,
'validateCsrfToken'
));
}
}
}
}
...
...
framework/web/Sort.php
View file @
8b2b7915
...
@@ -307,7 +307,7 @@ class CSort extends CComponent
...
@@ -307,7 +307,7 @@ class CSort extends CComponent
$directions
=
array
(
$attribute
=>
$descending
);
$directions
=
array
(
$attribute
=>
$descending
);
}
}
$url
=
$this
->
createUrl
(
\Yii
::
$app
lication
->
getController
(),
$directions
);
$url
=
$this
->
createUrl
(
\Yii
::
$app
->
getController
(),
$directions
);
return
$this
->
createLink
(
$attribute
,
$label
,
$url
,
$htmlOptions
);
return
$this
->
createLink
(
$attribute
,
$label
,
$url
,
$htmlOptions
);
}
}
...
...
framework/web/Theme.php
View file @
8b2b7915
...
@@ -126,7 +126,7 @@ class CTheme extends CComponent
...
@@ -126,7 +126,7 @@ class CTheme extends CComponent
$module
=
$module
->
getParentModule
();
$module
=
$module
->
getParentModule
();
}
}
if
(
$module
===
null
)
if
(
$module
===
null
)
$layoutName
=
\Yii
::
$app
lication
->
layout
;
$layoutName
=
\Yii
::
$app
->
layout
;
else
else
{
{
$layoutName
=
$module
->
layout
;
$layoutName
=
$module
->
layout
;
...
...
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