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
3d4661ec
Commit
3d4661ec
authored
May 03, 2013
by
root
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/LAV45/yii2
parents
57e17555
c5bad9ea
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
64 deletions
+53
-64
main.php
apps/bootstrap/protected/config/main.php
+10
-0
main.php
apps/bootstrap/protected/views/layouts/main.php
+4
-2
contact.php
apps/bootstrap/protected/views/site/contact.php
+3
-1
login.php
apps/bootstrap/protected/views/site/login.php
+3
-1
Application.php
framework/base/Application.php
+0
-1
Object.php
framework/base/Object.php
+8
-0
Controller.php
framework/console/Controller.php
+13
-48
Logger.php
framework/logging/Logger.php
+4
-2
Router.php
framework/logging/Router.php
+6
-7
DbSession.php
framework/web/DbSession.php
+2
-2
No files found.
apps/bootstrap/protected/config/main.php
View file @
3d4661ec
...
...
@@ -3,6 +3,7 @@
return
array
(
'id'
=>
'hello'
,
'basePath'
=>
dirname
(
__DIR__
),
'preload'
=>
array
(
'log'
),
'components'
=>
array
(
'cache'
=>
array
(
'class'
=>
'yii\caching\FileCache'
,
...
...
@@ -14,6 +15,15 @@ return array(
'assetManager'
=>
array
(
'bundles'
=>
require
(
__DIR__
.
'/assets.php'
),
),
'log'
=>
array
(
'class'
=>
'yii\logging\Router'
,
'targets'
=>
array
(
'file'
=>
array
(
'class'
=>
'yii\logging\FileTarget'
,
'levels'
=>
array
(
'error'
,
'warning'
),
),
),
),
),
'params'
=>
array
(
'adminEmail'
=>
'admin@example.com'
,
...
...
apps/bootstrap/protected/views/layouts/main.php
View file @
3d4661ec
<?php
use
yii\helpers\Html
;
use
yii\widgets\Menu
;
/**
* @var $this \yii\base\View
* @var $content string
*/
use
yii\helpers\Html
;
$this
->
registerAssetBundle
(
'app'
);
?>
<?php
$this
->
beginPage
();
?>
...
...
@@ -23,7 +25,7 @@ $this->registerAssetBundle('app');
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<div
class=
"container"
>
<?php
$this
->
widget
(
'yii\widgets\Menu'
,
array
(
<?php
$this
->
widget
(
Menu
::
className
()
,
array
(
'options'
=>
array
(
'class'
=>
'nav'
),
'items'
=>
array
(
array
(
'label'
=>
'Home'
,
'url'
=>
array
(
'/site/index'
)),
...
...
apps/bootstrap/protected/views/site/contact.php
View file @
3d4661ec
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/**
* @var yii\base\View $this
* @var yii\widgets\ActiveForm $form
...
...
@@ -20,7 +22,7 @@ $this->params['breadcrumbs'][] = $this->title;
If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
</p>
<?php
$form
=
$this
->
beginWidget
(
'yii\widgets\ActiveForm'
,
array
(
<?php
$form
=
$this
->
beginWidget
(
ActiveForm
::
className
()
,
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
),
'fieldConfig'
=>
array
(
'inputOptions'
=>
array
(
'class'
=>
'input-xlarge'
)),
));
?>
...
...
apps/bootstrap/protected/views/site/login.php
View file @
3d4661ec
<?php
use
yii\helpers\Html
;
use
yii\widgets\ActiveForm
;
/**
* @var yii\base\View $this
* @var yii\widgets\ActiveForm $form
...
...
@@ -12,7 +14,7 @@ $this->params['breadcrumbs'][] = $this->title;
<p>
Please fill out the following fields to login:
</p>
<?php
$form
=
$this
->
beginWidget
(
'yii\widgets\ActiveForm'
,
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<?php
$form
=
$this
->
beginWidget
(
ActiveForm
::
className
()
,
array
(
'options'
=>
array
(
'class'
=>
'form-horizontal'
)));
?>
<?php
echo
$form
->
field
(
$model
,
'username'
)
->
textInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'password'
)
->
passwordInput
();
?>
<?php
echo
$form
->
field
(
$model
,
'rememberMe'
)
->
checkbox
();
?>
...
...
framework/base/Application.php
View file @
3d4661ec
...
...
@@ -8,7 +8,6 @@
namespace
yii\base
;
use
Yii
;
use
yii\helpers\FileHelper
;
/**
* Application is the base class for all application classes.
...
...
framework/base/Object.php
View file @
3d4661ec
...
...
@@ -15,6 +15,14 @@ namespace yii\base;
class
Object
{
/**
* @return string the fully qualified name of this class.
*/
public
static
function
className
()
{
return
get_called_class
();
}
/**
* Constructor.
* The default implementation does two things:
*
...
...
framework/console/Controller.php
View file @
3d4661ec
...
...
@@ -36,10 +36,12 @@ class Controller extends \yii\base\Controller
public
$interactive
=
true
;
/**
* @var bool whether to enable ANSI style in output. If not set it will be auto detected.
* Default is disabled on Windows systems and enabled on linux.
* @var bool whether to enable ANSI style in output.
* Setting this will affect [[ansiFormat()]], [[stdout()]] and [[stderr()]].
* If not set it will be auto detected using [[yii\helpers\Console::streamSupportsAnsiColors()]] with STDOUT
* for [[ansiFormat()]] and [[stdout()]] and STDERR for [[stderr()]].
*/
public
$
ansi
;
public
$
colors
;
/**
* Runs an action with the specified action ID and parameters.
...
...
@@ -128,13 +130,13 @@ class Controller extends \yii\base\Controller
*
* Example:
* ~~~
* $this->
formatString
('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE);
* $this->
ansiFormat
('This will be red and underlined.', Console::FG_RED, Console::UNDERLINE);
* ~~~
*
* @param string $string the string to be formatted
* @return string
*/
public
function
formatString
(
$string
)
public
function
ansiFormat
(
$string
)
{
if
(
$this
->
ansi
===
true
||
$this
->
ansi
===
null
&&
Console
::
streamSupportsAnsiColors
(
STDOUT
))
{
$args
=
func_get_args
();
...
...
@@ -193,47 +195,6 @@ class Controller extends \yii\base\Controller
}
/**
* Asks the user for input. Ends when the user types a carriage return (PHP_EOL). Optionally, It also provides a
* prompt.
*
* @param string $prompt the prompt (optional)
* @return string the user's input
*/
public
function
input
(
$prompt
=
null
)
{
if
(
isset
(
$prompt
))
{
static
::
stdout
(
$prompt
);
}
return
static
::
stdin
();
}
/**
* Prints text to STDOUT appended with a carriage return (PHP_EOL).
*
* @param string $text
* @param bool $raw
*
* @return mixed Number of bytes printed or bool false on error
*/
public
function
output
(
$text
=
null
)
{
return
static
::
stdout
(
$text
.
PHP_EOL
);
}
/**
* Prints text to STDERR appended with a carriage return (PHP_EOL).
*
* @param string $text
* @param bool $raw
*
* @return mixed Number of bytes printed or false on error
*/
public
function
error
(
$text
=
null
)
{
return
static
::
stderr
(
$text
.
PHP_EOL
);
}
/**
* Prompts the user for input and validates it
*
* @param string $text prompt string
...
...
@@ -248,7 +209,11 @@ class Controller extends \yii\base\Controller
*/
public
function
prompt
(
$text
,
$options
=
array
())
{
return
Console
::
prompt
(
$text
,
$options
);
if
(
$this
->
interactive
)
{
return
Console
::
prompt
(
$text
,
$options
);
}
else
{
return
isset
(
$options
[
'default'
])
?
$options
[
'default'
]
:
''
;
}
}
/**
...
...
@@ -276,7 +241,7 @@ class Controller extends \yii\base\Controller
*
* @return string An option character the user chose
*/
public
static
function
select
(
$prompt
,
$options
=
array
())
public
function
select
(
$prompt
,
$options
=
array
())
{
return
Console
::
select
(
$prompt
,
$options
);
}
...
...
framework/logging/Logger.php
View file @
3d4661ec
...
...
@@ -6,7 +6,9 @@
*/
namespace
yii\logging
;
use
yii\base\InvalidConfigException
;
use
\yii\base\Component
;
use
\yii\base\InvalidConfigException
;
/**
* Logger records logged messages in memory.
...
...
@@ -17,7 +19,7 @@ use yii\base\InvalidConfigException;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Logger
extends
\yii\base\
Component
class
Logger
extends
Component
{
/**
* Error message level. An error message is one that indicates the abnormal termination of the
...
...
framework/logging/Router.php
View file @
3d4661ec
...
...
@@ -28,16 +28,16 @@ use yii\base\Application;
* 'preload' => array('log'),
* 'components' => array(
* 'log' => array(
* 'class' => '
\
yii\logging\Router',
* 'class' => 'yii\logging\Router',
* 'targets' => array(
* 'file' => array(
* 'class' => '
\
yii\logging\FileTarget',
* 'levels' =>
'trace, info'
,
* 'categories' =>
'yii\*'
,
* 'class' => 'yii\logging\FileTarget',
* 'levels' =>
array('trace', 'info')
,
* 'categories' =>
array('yii\*')
,
* ),
* 'email' => array(
* 'class' => '
\
yii\logging\EmailTarget',
* 'levels' =>
'error, warning'
,
* 'class' => 'yii\logging\EmailTarget',
* 'levels' =>
array('error', 'warning')
,
* 'emails' => array('admin@example.com'),
* ),
* ),
...
...
@@ -73,7 +73,6 @@ class Router extends Component
public
function
init
()
{
parent
::
init
();
foreach
(
$this
->
targets
as
$name
=>
$target
)
{
if
(
!
$target
instanceof
Target
)
{
$this
->
targets
[
$name
]
=
Yii
::
createObject
(
$target
);
...
...
framework/web/DbSession.php
View file @
3d4661ec
...
...
@@ -71,13 +71,13 @@ class DbSession extends Session
*/
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
(
"DbSession::db must be either a DB connection instance or the application component ID of a DB connection."
);
}
}
parent
::
init
();
}
/**
...
...
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