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
Show 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
/**
* @var yii\base\Application the application instance
*/
public
static
$app
lication
;
public
static
$app
;
/**
* @var array registered path aliases
* @see getAlias
...
...
@@ -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):
*
* - `@app
lication
/components/GoogleMap`: importing the `GoogleMap` class with a path alias;
* - `@app
lication
/components/*`: importing the whole `components` directory with a path alias;
* - `@app/components/GoogleMap`: importing the `GoogleMap` class 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
* when this class is used for the first time.
*
...
...
@@ -262,6 +262,7 @@ class YiiBase
*
* @param string $className class name
* @return boolean whether the class has been loaded successfully
* @throws Exception if the class file does not exist
*/
public
static
function
autoload
(
$className
)
{
...
...
@@ -322,12 +323,12 @@ class YiiBase
* the class. For example,
*
* - `\app\components\GoogleMap`: fully-qualified namespaced class.
* - `@app
lication
/components/GoogleMap`: an alias
* - `@app/components/GoogleMap`: an alias
*
* Below are some usage examples:
*
* ~~~
* $object = \Yii::createObject('@app
lication
/components/GoogleMap');
* $object = \Yii::createObject('@app/components/GoogleMap');
* $object = \Yii::createObject(array(
* 'class' => '\app\components\GoogleMap',
* 'apiKey' => 'xyz',
...
...
@@ -520,6 +521,6 @@ class YiiBase
*/
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
*/
public
function
__construct
(
$id
,
$basePath
,
$config
=
array
())
{
Yii
::
$app
lication
=
$this
;
Yii
::
$app
=
$this
;
$this
->
id
=
$id
;
$this
->
setBasePath
(
$basePath
);
...
...
@@ -342,7 +342,7 @@ class Application extends Module
*/
public
function
registerDefaultAliases
()
{
Yii
::
$aliases
[
'@app
lication
'
]
=
$this
->
getBasePath
();
Yii
::
$aliases
[
'@app'
]
=
$this
->
getBasePath
();
Yii
::
$aliases
[
'@entry'
]
=
dirname
(
$_SERVER
[
'SCRIPT_FILENAME'
]);
Yii
::
$aliases
[
'@www'
]
=
''
;
}
...
...
framework/base/Controller.php
View file @
8b2b7915
...
...
@@ -72,9 +72,9 @@ class Controller extends Component
*
* ~~~
* return array(
* 'action1' => '@app
lication
/components/Action1',
* 'action1' => '@app/components/Action1',
* 'action2' => array(
* 'class' => '@app
lication
/components/Action2',
* 'class' => '@app/components/Action2',
* 'property1' => 'value1',
* 'property2' => 'value2',
* ),
...
...
@@ -139,7 +139,7 @@ class Controller extends Component
}
elseif
(
$pos
>
0
)
{
return
$this
->
module
->
runAction
(
$route
,
$params
);
}
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
public
$discardExistingOutput
=
true
;
/**
* @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.
*/
public
$errorAction
;
...
...
@@ -71,14 +71,14 @@ class ErrorHandler extends Component
protected
function
render
(
$exception
)
{
if
(
$this
->
errorAction
!==
null
)
{
\Yii
::
$app
lication
->
runAction
(
$this
->
errorAction
);
}
elseif
(
\Yii
::
$app
lication
instanceof
\yii\web\Application
)
{
\Yii
::
$app
->
runAction
(
$this
->
errorAction
);
}
elseif
(
\Yii
::
$app
instanceof
\yii\web\Application
)
{
if
(
!
headers_sent
())
{
$errorCode
=
$exception
instanceof
HttpException
?
$exception
->
statusCode
:
500
;
header
(
"HTTP/1.0
$errorCode
"
.
get_class
(
$exception
));
}
if
(
isset
(
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
])
&&
$_SERVER
[
'HTTP_X_REQUESTED_WITH'
]
===
'XMLHttpRequest'
)
{
\Yii
::
$app
lication
->
renderException
(
$exception
);
\Yii
::
$app
->
renderException
(
$exception
);
}
else
{
$view
=
new
View
(
$this
);
if
(
!
YII_DEBUG
||
$exception
instanceof
UserException
)
{
...
...
@@ -91,7 +91,7 @@ class ErrorHandler extends Component
));
}
}
else
{
\Yii
::
$app
lication
->
renderException
(
$exception
);
\Yii
::
$app
->
renderException
(
$exception
);
}
}
...
...
@@ -239,7 +239,7 @@ class ErrorHandler extends Component
public
function
htmlEncode
(
$text
)
{
return
htmlspecialchars
(
$text
,
ENT_QUOTES
,
\Yii
::
$app
lication
->
charset
);
return
htmlspecialchars
(
$text
,
ENT_QUOTES
,
\Yii
::
$app
->
charset
);
}
public
function
clearOutput
()
...
...
framework/base/Module.php
View file @
8b2b7915
...
...
@@ -73,9 +73,9 @@ abstract class Module extends Component
*
* ~~~
* array(
* 'account' => '@app
lication
/controllers/UserController',
* 'account' => '@app/controllers/UserController',
* 'article' => array(
* 'class' => '@app
lication
/controllers/PostController',
* 'class' => '@app/controllers/PostController',
* 'pageTitle' => 'something new',
* ),
* )
...
...
@@ -311,7 +311,7 @@ abstract class Module extends Component
*
* ~~~
* array(
* '@models' => '@app
lication
/models', // an existing alias
* '@models' => '@app/models', // an existing alias
* '@backend' => __DIR__ . '/../backend', // a directory
* )
* ~~~
...
...
@@ -563,10 +563,10 @@ abstract class Module extends Component
if
(
is_array
(
$result
))
{
/** @var $controller Controller */
list
(
$controller
,
$actionID
)
=
$result
;
$oldController
=
Yii
::
$app
lication
->
controller
;
Yii
::
$app
lication
->
controller
=
$controller
;
$oldController
=
Yii
::
$app
->
controller
;
Yii
::
$app
->
controller
=
$controller
;
$status
=
$controller
->
runAction
(
$actionID
,
$params
);
Yii
::
$app
lication
->
controller
=
$oldController
;
Yii
::
$app
->
controller
=
$oldController
;
return
$status
;
}
else
{
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
if
(
$this
->
_validationKey
!==
null
)
{
return
$this
->
_validationKey
;
}
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
);
}
else
{
$key
=
$this
->
generateRandomKey
();
$this
->
setValidationKey
(
$key
);
\Yii
::
$app
lication
->
setGlobalState
(
self
::
STATE_VALIDATION_KEY
,
$key
);
\Yii
::
$app
->
setGlobalState
(
self
::
STATE_VALIDATION_KEY
,
$key
);
}
return
$this
->
_validationKey
;
}
...
...
@@ -92,12 +92,12 @@ class SecurityManager extends Component
if
(
$this
->
_encryptionKey
!==
null
)
{
return
$this
->
_encryptionKey
;
}
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
);
}
else
{
$key
=
$this
->
generateRandomKey
();
$this
->
setEncryptionKey
(
$key
);
\Yii
::
$app
lication
->
setGlobalState
(
self
::
STATE_ENCRYPTION_KEY
,
$key
);
\Yii
::
$app
->
setGlobalState
(
self
::
STATE_ENCRYPTION_KEY
,
$key
);
}
return
$this
->
_encryptionKey
;
}
...
...
framework/base/Theme.php
View file @
8b2b7915
...
...
@@ -58,7 +58,7 @@ class Theme extends Component
if
(
empty
(
$this
->
pathMap
))
{
if
(
$this
->
basePath
!==
null
)
{
$this
->
basePath
=
FileHelper
::
ensureDirectory
(
$this
->
basePath
);
$this
->
pathMap
=
array
(
Yii
::
$app
lication
->
getBasePath
()
=>
$this
->
basePath
);
$this
->
pathMap
=
array
(
Yii
::
$app
->
getBasePath
()
=>
$this
->
basePath
);
}
else
{
throw
new
InvalidConfigException
(
"Theme::basePath must be set."
);
}
...
...
framework/base/UrlManager.php
View file @
8b2b7915
...
...
@@ -112,7 +112,7 @@ use \yii\base\Component;
* </ul>
*
* 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).
* If {@link showScriptName} is true, it will include the script name part.
...
...
@@ -214,7 +214,7 @@ class UrlManager extends Component
{
if
(
empty
(
$this
->
rules
)
||
$this
->
getUrlFormat
()
===
self
::
GET_FORMAT
)
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
));
if
((
$data
=
$cache
->
get
(
self
::
CACHE_KEY
))
!==
false
&&
isset
(
$data
[
1
])
&&
$data
[
1
]
===
$hash
)
...
...
@@ -464,9 +464,9 @@ class UrlManager extends Component
else
{
if
(
$this
->
showScriptName
)
$this
->
_baseUrl
=
\Yii
::
$app
lication
->
getRequest
()
->
getScriptUrl
();
$this
->
_baseUrl
=
\Yii
::
$app
->
getRequest
()
->
getScriptUrl
();
else
$this
->
_baseUrl
=
\Yii
::
$app
lication
->
getRequest
()
->
getBaseUrl
();
$this
->
_baseUrl
=
\Yii
::
$app
->
getRequest
()
->
getBaseUrl
();
return
$this
->
_baseUrl
;
}
}
...
...
@@ -755,7 +755,7 @@ class CUrlRule extends CBaseUrlRule
if
(
$this
->
hasHostInfo
)
{
$hostInfo
=
\Yii
::
$app
lication
->
getRequest
()
->
getHostInfo
();
$hostInfo
=
\Yii
::
$app
->
getRequest
()
->
getHostInfo
();
if
(
stripos
(
$url
,
$hostInfo
)
===
0
)
$url
=
substr
(
$url
,
strlen
(
$hostInfo
));
}
...
...
framework/base/View.php
View file @
8b2b7915
...
...
@@ -148,7 +148,7 @@ class View extends Component
*/
public
function
renderFile
(
$file
,
$params
=
array
())
{
$renderer
=
Yii
::
$app
lication
->
getViewRenderer
();
$renderer
=
Yii
::
$app
->
getViewRenderer
();
if
(
$renderer
!==
null
)
{
return
$renderer
->
render
(
$this
,
$file
,
$params
);
}
else
{
...
...
@@ -344,7 +344,7 @@ class View extends Component
*
* 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.
* 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.
...
...
@@ -374,7 +374,7 @@ class View extends Component
$view
.=
'.php'
;
}
if
(
strncmp
(
$view
,
'@'
,
1
)
===
0
)
{
// e.g. "@app
lication
/views/common"
// e.g. "@app/views/common"
if
((
$file
=
Yii
::
getAlias
(
$view
))
===
false
)
{
throw
new
InvalidConfigException
(
"Invalid path alias:
$view
"
);
}
...
...
@@ -386,18 +386,18 @@ class View extends Component
$class
=
new
\ReflectionClass
(
$this
->
owner
);
$file
=
dirname
(
$class
->
getFileName
())
.
DIRECTORY_SEPARATOR
.
'views'
.
DIRECTORY_SEPARATOR
.
$view
;
}
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"
$file
=
Yii
::
$app
lication
->
controller
->
module
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
ltrim
(
$view
,
'/'
);
$file
=
Yii
::
$app
->
controller
->
module
->
getViewPath
()
.
DIRECTORY_SEPARATOR
.
ltrim
(
$view
,
'/'
);
}
else
{
// 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
(
$this
->
enableTheme
&&
(
$theme
=
Yii
::
$app
lication
->
getTheme
())
!==
null
)
{
if
(
$this
->
enableTheme
&&
(
$theme
=
Yii
::
$app
->
getTheme
())
!==
null
)
{
$file
=
$theme
->
apply
(
$file
);
}
return
$this
->
enableI18N
?
FileHelper
::
localize
(
$file
,
$this
->
language
,
$this
->
sourceLanguage
)
:
$file
;
...
...
@@ -423,7 +423,7 @@ class View extends Component
*
* 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
* 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
...
...
@@ -444,10 +444,10 @@ class View extends Component
{
/** @var $module Module */
if
(
is_string
(
$this
->
layout
))
{
if
(
Yii
::
$app
lication
->
controller
)
{
$module
=
Yii
::
$app
lication
->
controller
->
module
;
if
(
Yii
::
$app
->
controller
)
{
$module
=
Yii
::
$app
->
controller
->
module
;
}
else
{
$module
=
Yii
::
$app
lication
;
$module
=
Yii
::
$app
;
}
$view
=
$this
->
layout
;
}
elseif
(
$this
->
owner
instanceof
Controller
)
{
...
...
@@ -477,13 +477,13 @@ class View extends Component
throw
new
InvalidConfigException
(
"Invalid path alias:
$view
"
);
}
}
elseif
(
strncmp
(
$view
,
'/'
,
1
)
===
0
)
{
$file
=
Yii
::
$app
lication
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
$file
=
Yii
::
$app
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
}
else
{
$file
=
$module
->
getLayoutPath
()
.
DIRECTORY_SEPARATOR
.
$view
;
}
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
);
}
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
* To determine which view file should be rendered, the method calls [[findViewFile()]] which
* 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
* in the view name.
*
...
...
framework/caching/DbCache.php
View file @
8b2b7915
...
...
@@ -74,7 +74,7 @@ class DbCache extends Cache
public
function
getDb
()
{
if
(
$this
->
_db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$db
=
\Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$db
instanceof
Connection
)
{
$this
->
_db
=
$db
;
}
else
{
...
...
framework/caching/DbDependency.php
View file @
8b2b7915
...
...
@@ -91,7 +91,7 @@ class DbDependency extends Dependency
public
function
getDb
()
{
if
(
$this
->
_db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$db
=
\Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$db
instanceof
Connection
)
{
$this
->
_db
=
$db
;
}
else
{
...
...
framework/caching/DummyCache.php
View file @
8b2b7915
...
...
@@ -13,7 +13,7 @@ namespace yii\caching;
* DummyCache is a placeholder cache component.
*
* 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
* non-caching mode to caching mode.
*
...
...
framework/caching/FileCache.php
View file @
8b2b7915
...
...
@@ -28,7 +28,7 @@ class FileCache extends Cache
/**
* @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'.
*/
...
...
framework/console/controllers/HelpController.php
View file @
8b2b7915
...
...
@@ -55,7 +55,7 @@ class HelpController extends Controller
public
function
actionIndex
(
$command
=
null
)
{
if
(
$command
!==
null
)
{
$result
=
Yii
::
$app
lication
->
createController
(
$command
);
$result
=
Yii
::
$app
->
createController
(
$command
);
if
(
$result
===
false
)
{
throw
new
Exception
(
Yii
::
t
(
'yii|No help for unknown command "{command}".'
,
array
(
'{command}'
=>
$command
,
...
...
@@ -81,7 +81,7 @@ class HelpController extends Controller
*/
public
function
getCommands
()
{
$commands
=
$this
->
getModuleCommands
(
Yii
::
$app
lication
);
$commands
=
$this
->
getModuleCommands
(
Yii
::
$app
);
sort
(
$commands
);
return
array_unique
(
$commands
);
}
...
...
framework/console/controllers/MigrateController.php
View file @
8b2b7915
...
...
@@ -70,7 +70,7 @@ class MigrateController extends Controller
* @var string the directory storing the migration classes. This can be either
* 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.
*/
...
...
@@ -82,7 +82,7 @@ class MigrateController extends Controller
public
$connectionID
=
'db'
;
/**
* @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.
*/
public
$templateFile
=
'@yii/views/migration.php'
;
...
...
@@ -121,7 +121,7 @@ class MigrateController extends Controller
}
$this
->
migrationPath
=
$path
;
$this
->
db
=
Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
!
$this
->
db
instanceof
Connection
)
{
throw
new
Exception
(
"Invalid DB connection
\"
{
$this
->
connectionID
}
\"
."
);
}
...
...
@@ -150,7 +150,7 @@ class MigrateController extends Controller
{
if
((
$migrations
=
$this
->
getNewMigrations
())
===
array
())
{
echo
"No new migration found. Your system is up-to-date.
\n
"
;
Yii
::
$app
lication
->
end
();
Yii
::
$app
->
end
();
}
$total
=
count
(
$migrations
);
...
...
@@ -576,7 +576,7 @@ class MigrateController extends Controller
if
(
$this
->
db
!==
null
)
{
return
$this
->
db
;
}
else
{
$this
->
db
=
Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$this
->
db
=
Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$this
->
db
instanceof
Connection
)
{
return
$this
->
db
;
}
else
{
...
...
framework/db/ActiveRecord.php
View file @
8b2b7915
...
...
@@ -96,7 +96,7 @@ class ActiveRecord extends Model
*/
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
/** @var $cache \yii\caching\Cache */
if
(
$db
->
enableQueryCache
&&
$method
!==
''
)
{
$cache
=
\Yii
::
$app
lication
->
getComponent
(
$db
->
queryCacheID
);
$cache
=
\Yii
::
$app
->
getComponent
(
$db
->
queryCacheID
);
}
if
(
isset
(
$cache
))
{
...
...
framework/db/Migration.php
View file @
8b2b7915
...
...
@@ -51,7 +51,7 @@ class Migration extends \yii\base\Component
{
parent
::
init
();
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
public
function
createCommand
(
$db
=
null
)
{
if
(
$db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
db
;
$db
=
\Yii
::
$app
->
db
;
}
$sql
=
$db
->
getQueryBuilder
()
->
build
(
$this
);
return
$db
->
createCommand
(
$sql
,
$this
->
params
);
...
...
framework/db/Schema.php
View file @
8b2b7915
...
...
@@ -87,7 +87,7 @@ abstract class Schema extends \yii\base\Object
$realName
=
$this
->
getRealTableName
(
$name
);
/** @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
);
if
(
$refresh
||
(
$table
=
$cache
->
get
(
$key
))
===
false
)
{
$table
=
$this
->
loadTableSchema
(
$realName
);
...
...
@@ -171,7 +171,7 @@ abstract class Schema extends \yii\base\Object
public
function
refresh
()
{
/** @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
)
{
$cache
->
delete
(
$this
->
getCacheKey
(
$cache
,
$name
));
}
...
...
framework/i18n/I18N.php
View file @
8b2b7915
...
...
@@ -10,10 +10,10 @@ class I18N extends Component
public
function
translate
(
$message
,
$params
=
array
(),
$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
];
$message
=
$matches
[
2
];
}
else
{
...
...
framework/i18n/MessageSource.php
View file @
8b2b7915
...
...
@@ -49,7 +49,7 @@ class MessageSource extends Component
{
parent
::
init
();
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
public
function
getDb
()
{
if
(
$this
->
_db
===
null
)
{
$db
=
\Yii
::
$app
lication
->
getComponent
(
$this
->
connectionID
);
$db
=
\Yii
::
$app
->
getComponent
(
$this
->
connectionID
);
if
(
$db
instanceof
Connection
)
{
$this
->
_db
=
$db
;
}
else
{
...
...
framework/logging/FileTarget.php
View file @
8b2b7915
...
...
@@ -48,7 +48,7 @@ class FileTarget extends Target
{
parent
::
init
();
if
(
$this
->
logFile
===
null
)
{
$this
->
logFile
=
\Yii
::
$app
lication
->
getRuntimePath
()
.
DIRECTORY_SEPARATOR
.
'application.log'
;
$this
->
logFile
=
\Yii
::
$app
->
getRuntimePath
()
.
DIRECTORY_SEPARATOR
.
'application.log'
;
}
else
{
$this
->
logFile
=
\Yii
::
getAlias
(
$this
->
logFile
);
}
...
...
framework/logging/ProfileTarget.php
View file @
8b2b7915
...
...
@@ -71,7 +71,7 @@ class CProfileLogRoute extends CWebLogRoute
*/
public
function
processLogs
(
$logs
)
{
$app
=
\Yii
::
$app
lication
;
$app
=
\Yii
::
$app
;
if
(
!
(
$app
instanceof
CWebApplication
)
||
$app
->
getRequest
()
->
getIsAjaxRequest
())
return
;
...
...
framework/logging/Router.php
View file @
8b2b7915
...
...
@@ -52,7 +52,7 @@ use yii\base\Application;
* as follows:
*
* ~~~
* Yii::$app
lication
->log->targets['file']->enabled = false;
* Yii::$app->log->targets['file']->enabled = false;
* ~~~
*
* @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
protected
function
getContextMessage
()
{
$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
()
.
')'
;
}
...
...
framework/logging/WebTarget.php
View file @
8b2b7915
...
...
@@ -46,7 +46,7 @@ class CWebLogRoute extends CLogRoute
*/
protected
function
render
(
$view
,
$data
)
{
$app
=
\Yii
::
$app
lication
;
$app
=
\Yii
::
$app
;
$isAjax
=
$app
->
getRequest
()
->
getIsAjaxRequest
();
if
(
$this
->
showInFireBug
)
...
...
framework/util/FileHelper.php
View file @
8b2b7915
...
...
@@ -91,10 +91,10 @@ class FileHelper
public
static
function
localize
(
$file
,
$language
=
null
,
$sourceLanguage
=
null
)
{
if
(
$language
===
null
)
{
$language
=
\Yii
::
$app
lication
->
getLanguage
();
$language
=
\Yii
::
$app
->
getLanguage
();
}
if
(
$sourceLanguage
===
null
)
{
$sourceLanguage
=
\Yii
::
$app
lication
->
sourceLanguage
;
$sourceLanguage
=
\Yii
::
$app
->
sourceLanguage
;
}
if
(
$language
===
$sourceLanguage
)
{
return
$file
;
...
...
framework/validators/CaptchaValidator.php
View file @
8b2b7915
...
...
@@ -61,13 +61,13 @@ class CaptchaValidator extends Validator
public
function
getCaptchaAction
()
{
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
)
{
list
(
$controller
,
$actionID
)
=
$ca
;
$action
=
$controller
->
createAction
(
$actionID
);
}
}
else
{
$action
=
\Yii
::
$app
lication
->
getController
()
->
createAction
(
$this
->
captchaAction
);
$action
=
\Yii
::
$app
->
getController
()
->
createAction
(
$this
->
captchaAction
);
}
if
(
$action
===
null
)
{
...
...
framework/validators/StringValidator.php
View file @
8b2b7915
...
...
@@ -82,7 +82,7 @@ class StringValidator extends Validator
}
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
{
$length
=
strlen
(
$value
);
}
...
...
framework/web/AssetManager.php
View file @
8b2b7915
...
...
@@ -97,7 +97,7 @@ class CAssetManager extends CApplicationComponent
{
if
(
$this
->
_basePath
===
null
)
{
$request
=
\Yii
::
$app
lication
->
getRequest
();
$request
=
\Yii
::
$app
->
getRequest
();
$this
->
setBasePath
(
dirname
(
$request
->
getScriptFile
())
.
DIRECTORY_SEPARATOR
.
self
::
DEFAULT_BASEPATH
);
}
return
$this
->
_basePath
;
...
...
@@ -125,7 +125,7 @@ class CAssetManager extends CApplicationComponent
{
if
(
$this
->
_baseUrl
===
null
)
{
$request
=
\Yii
::
$app
lication
->
getRequest
();
$request
=
\Yii
::
$app
->
getRequest
();
$this
->
setBaseUrl
(
$request
->
getBaseUrl
()
.
'/'
.
self
::
DEFAULT_BASEPATH
);
}
return
$this
->
_baseUrl
;
...
...
framework/web/Controller.php
View file @
8b2b7915
...
...
@@ -59,9 +59,9 @@ class Controller extends \yii\base\Controller
else
{
$name
=
ucfirst
(
basename
(
$this
->
id
));
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
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
}
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
$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
);
}
...
...
framework/web/Theme.php
View file @
8b2b7915
...
...
@@ -126,7 +126,7 @@ class CTheme extends CComponent
$module
=
$module
->
getParentModule
();
}
if
(
$module
===
null
)
$layoutName
=
\Yii
::
$app
lication
->
layout
;
$layoutName
=
\Yii
::
$app
->
layout
;
else
{
$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