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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
a6cd7b72
Commit
a6cd7b72
authored
Jul 17, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored helper organization.
parent
7ebbc46a
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
124 additions
and
131 deletions
+124
-131
User.php
apps/advanced/common/models/User.php
+4
-4
SendPasswordResetTokenForm.php
apps/advanced/frontend/models/SendPasswordResetTokenForm.php
+2
-2
classes.php
framework/yii/classes.php
+35
-15
Controller.php
framework/yii/console/Controller.php
+3
-3
ArrayHelper.php
framework/yii/helpers/ArrayHelper.php
+2
-2
ArrayHelperBase.php
framework/yii/helpers/ArrayHelperBase.php
+5
-4
Console.php
framework/yii/helpers/Console.php
+1
-1
ConsoleBase.php
framework/yii/helpers/ConsoleBase.php
+4
-14
FileHelper.php
framework/yii/helpers/FileHelper.php
+1
-1
FileHelperBase.php
framework/yii/helpers/FileHelperBase.php
+8
-7
Html.php
framework/yii/helpers/Html.php
+1
-1
HtmlBase.php
framework/yii/helpers/HtmlBase.php
+5
-3
HtmlPurifier.php
framework/yii/helpers/HtmlPurifier.php
+1
-1
HtmlPurifierBase.php
framework/yii/helpers/HtmlPurifierBase.php
+4
-4
Inflector.php
framework/yii/helpers/Inflector.php
+1
-1
InflectorBase.php
framework/yii/helpers/InflectorBase.php
+5
-3
Json.php
framework/yii/helpers/Json.php
+4
-2
JsonBase.php
framework/yii/helpers/JsonBase.php
+6
-5
Markdown.php
framework/yii/helpers/Markdown.php
+1
-1
MarkdownBase.php
framework/yii/helpers/MarkdownBase.php
+4
-17
Security.php
framework/yii/helpers/Security.php
+4
-4
SecurityBase.php
framework/yii/helpers/SecurityBase.php
+6
-14
StringHelper.php
framework/yii/helpers/StringHelper.php
+1
-1
StringHelperBase.php
framework/yii/helpers/StringHelperBase.php
+5
-3
VarDumper.php
framework/yii/helpers/VarDumper.php
+1
-1
VarDumperBase.php
framework/yii/helpers/VarDumperBase.php
+4
-11
mimeTypes.php
framework/yii/helpers/mimeTypes.php
+0
-0
Request.php
framework/yii/web/Request.php
+3
-3
Response.php
framework/yii/web/Response.php
+2
-2
FileHelperTest.php
tests/unit/framework/helpers/FileHelperTest.php
+1
-1
No files found.
apps/advanced/common/models/User.php
View file @
a6cd7b72
...
...
@@ -2,7 +2,7 @@
namespace
common\models
;
use
yii\db\ActiveRecord
;
use
yii\helpers\Security
Helper
;
use
yii\helpers\Security
;
use
yii\web\Identity
;
/**
...
...
@@ -72,7 +72,7 @@ class User extends ActiveRecord implements Identity
public
function
validatePassword
(
$password
)
{
return
Security
Helper
::
validatePassword
(
$password
,
$this
->
password_hash
);
return
Security
::
validatePassword
(
$password
,
$this
->
password_hash
);
}
public
function
rules
()
...
...
@@ -105,10 +105,10 @@ class User extends ActiveRecord implements Identity
{
if
(
parent
::
beforeSave
(
$insert
))
{
if
((
$this
->
isNewRecord
||
$this
->
getScenario
()
===
'resetPassword'
)
&&
!
empty
(
$this
->
password
))
{
$this
->
password_hash
=
Security
Helper
::
generatePasswordHash
(
$this
->
password
);
$this
->
password_hash
=
Security
::
generatePasswordHash
(
$this
->
password
);
}
if
(
$this
->
isNewRecord
)
{
$this
->
auth_key
=
Security
Helper
::
generateRandomKey
();
$this
->
auth_key
=
Security
::
generateRandomKey
();
}
return
true
;
}
...
...
apps/advanced/frontend/models/SendPasswordResetTokenForm.php
View file @
a6cd7b72
...
...
@@ -4,7 +4,7 @@ namespace frontend\models;
use
yii\base\Model
;
use
common\models\User
;
use
yii\base\View
;
use
yii\helpers\Security
Helper
;
use
yii\helpers\Security
;
/**
* SendPasswordResetTokenForm is the model behind requesting password reset token form.
...
...
@@ -33,7 +33,7 @@ class SendPasswordResetTokenForm extends Model
'status'
=>
User
::
STATUS_ACTIVE
,
));
if
(
$user
)
{
$user
->
password_reset_token
=
Security
Helper
::
generateRandomKey
();
$user
->
password_reset_token
=
Security
::
generateRandomKey
();
if
(
$user
->
save
(
false
))
{
$view
=
new
View
(
array
(
'context'
=>
\Yii
::
$app
->
controller
,
...
...
framework/yii/classes.php
View file @
a6cd7b72
...
...
@@ -46,19 +46,34 @@ return array(
'yii\base\ViewRenderer'
=>
YII_PATH
.
'/base/ViewRenderer.php'
,
'yii\base\Widget'
=>
YII_PATH
.
'/base/Widget.php'
,
'yii\behaviors\AutoTimestamp'
=>
YII_PATH
.
'/behaviors/AutoTimestamp.php'
,
'yii\bootstrap\AffixAsset'
=>
YII_PATH
.
'/bootstrap/AffixAsset.php'
,
'yii\bootstrap\Alert'
=>
YII_PATH
.
'/bootstrap/Alert.php'
,
'yii\bootstrap\AlertAsset'
=>
YII_PATH
.
'/bootstrap/AlertAsset.php'
,
'yii\bootstrap\BootstrapAsset'
=>
YII_PATH
.
'/bootstrap/BootstrapAsset.php'
,
'yii\bootstrap\Button'
=>
YII_PATH
.
'/bootstrap/Button.php'
,
'yii\bootstrap\ButtonAsset'
=>
YII_PATH
.
'/bootstrap/ButtonAsset.php'
,
'yii\bootstrap\ButtonDropdown'
=>
YII_PATH
.
'/bootstrap/ButtonDropdown.php'
,
'yii\bootstrap\ButtonGroup'
=>
YII_PATH
.
'/bootstrap/ButtonGroup.php'
,
'yii\bootstrap\Carousel'
=>
YII_PATH
.
'/bootstrap/Carousel.php'
,
'yii\bootstrap\CarouselAsset'
=>
YII_PATH
.
'/bootstrap/CarouselAsset.php'
,
'yii\bootstrap\Collapse'
=>
YII_PATH
.
'/bootstrap/Collapse.php'
,
'yii\bootstrap\CollapseAsset'
=>
YII_PATH
.
'/bootstrap/CollapseAsset.php'
,
'yii\bootstrap\Dropdown'
=>
YII_PATH
.
'/bootstrap/Dropdown.php'
,
'yii\bootstrap\DropdownAsset'
=>
YII_PATH
.
'/bootstrap/DropdownAsset.php'
,
'yii\bootstrap\Modal'
=>
YII_PATH
.
'/bootstrap/Modal.php'
,
'yii\bootstrap\ModalAsset'
=>
YII_PATH
.
'/bootstrap/ModalAsset.php'
,
'yii\bootstrap\Nav'
=>
YII_PATH
.
'/bootstrap/Nav.php'
,
'yii\bootstrap\NavBar'
=>
YII_PATH
.
'/bootstrap/NavBar.php'
,
'yii\bootstrap\PopoverAsset'
=>
YII_PATH
.
'/bootstrap/PopoverAsset.php'
,
'yii\bootstrap\Progress'
=>
YII_PATH
.
'/bootstrap/Progress.php'
,
'yii\bootstrap\ResponsiveAsset'
=>
YII_PATH
.
'/bootstrap/ResponsiveAsset.php'
,
'yii\bootstrap\ScrollspyAsset'
=>
YII_PATH
.
'/bootstrap/ScrollspyAsset.php'
,
'yii\bootstrap\TabAsset'
=>
YII_PATH
.
'/bootstrap/TabAsset.php'
,
'yii\bootstrap\Tabs'
=>
YII_PATH
.
'/bootstrap/Tabs.php'
,
'yii\bootstrap\TypeAhead'
=>
YII_PATH
.
'/bootstrap/TypeAhead.php'
,
'yii\bootstrap\TooltipAsset'
=>
YII_PATH
.
'/bootstrap/TooltipAsset.php'
,
'yii\bootstrap\TransitionAsset'
=>
YII_PATH
.
'/bootstrap/TransitionAsset.php'
,
'yii\bootstrap\Typeahead'
=>
YII_PATH
.
'/bootstrap/Typeahead.php'
,
'yii\bootstrap\TypeaheadAsset'
=>
YII_PATH
.
'/bootstrap/TypeaheadAsset.php'
,
'yii\bootstrap\Widget'
=>
YII_PATH
.
'/bootstrap/Widget.php'
,
'yii\caching\ApcCache'
=>
YII_PATH
.
'/caching/ApcCache.php'
,
'yii\caching\Cache'
=>
YII_PATH
.
'/caching/Cache.php'
,
...
...
@@ -109,27 +124,27 @@ return array(
'yii\db\TableSchema'
=>
YII_PATH
.
'/db/TableSchema.php'
,
'yii\db\Transaction'
=>
YII_PATH
.
'/db/Transaction.php'
,
'yii\helpers\ArrayHelper'
=>
YII_PATH
.
'/helpers/ArrayHelper.php'
,
'yii\helpers\base\ArrayHelper'
=>
YII_PATH
.
'/helpers/base/ArrayHelper.php'
,
'yii\helpers\base\Console'
=>
YII_PATH
.
'/helpers/base/Console.php'
,
'yii\helpers\base\FileHelper'
=>
YII_PATH
.
'/helpers/base/FileHelper.php'
,
'yii\helpers\base\Html'
=>
YII_PATH
.
'/helpers/base/Html.php'
,
'yii\helpers\base\HtmlPurifier'
=>
YII_PATH
.
'/helpers/base/HtmlPurifier.php'
,
'yii\helpers\base\Inflector'
=>
YII_PATH
.
'/helpers/base/Inflector.php'
,
'yii\helpers\base\Json'
=>
YII_PATH
.
'/helpers/base/Json.php'
,
'yii\helpers\base\Markdown'
=>
YII_PATH
.
'/helpers/base/Markdown.php'
,
'yii\helpers\base\SecurityHelper'
=>
YII_PATH
.
'/helpers/base/SecurityHelper.php'
,
'yii\helpers\base\StringHelper'
=>
YII_PATH
.
'/helpers/base/StringHelper.php'
,
'yii\helpers\base\VarDumper'
=>
YII_PATH
.
'/helpers/base/VarDumper.php'
,
'yii\helpers\ArrayHelperBase'
=>
YII_PATH
.
'/helpers/ArrayHelperBase.php'
,
'yii\helpers\Console'
=>
YII_PATH
.
'/helpers/Console.php'
,
'yii\helpers\ConsoleBase'
=>
YII_PATH
.
'/helpers/ConsoleBase.php'
,
'yii\helpers\FileHelper'
=>
YII_PATH
.
'/helpers/FileHelper.php'
,
'yii\helpers\FileHelperBase'
=>
YII_PATH
.
'/helpers/FileHelperBase.php'
,
'yii\helpers\Html'
=>
YII_PATH
.
'/helpers/Html.php'
,
'yii\helpers\HtmlBase'
=>
YII_PATH
.
'/helpers/HtmlBase.php'
,
'yii\helpers\HtmlPurifier'
=>
YII_PATH
.
'/helpers/HtmlPurifier.php'
,
'yii\helpers\HtmlPurifierBase'
=>
YII_PATH
.
'/helpers/HtmlPurifierBase.php'
,
'yii\helpers\Inflector'
=>
YII_PATH
.
'/helpers/Inflector.php'
,
'yii\helpers\InflectorBase'
=>
YII_PATH
.
'/helpers/InflectorBase.php'
,
'yii\helpers\Json'
=>
YII_PATH
.
'/helpers/Json.php'
,
'yii\helpers\JsonBase'
=>
YII_PATH
.
'/helpers/JsonBase.php'
,
'yii\helpers\Markdown'
=>
YII_PATH
.
'/helpers/Markdown.php'
,
'yii\helpers\SecurityHelper'
=>
YII_PATH
.
'/helpers/SecurityHelper.php'
,
'yii\helpers\MarkdownBase'
=>
YII_PATH
.
'/helpers/MarkdownBase.php'
,
'yii\helpers\Security'
=>
YII_PATH
.
'/helpers/Security.php'
,
'yii\helpers\SecurityBase'
=>
YII_PATH
.
'/helpers/SecurityBase.php'
,
'yii\helpers\StringHelper'
=>
YII_PATH
.
'/helpers/StringHelper.php'
,
'yii\helpers\StringHelperBase'
=>
YII_PATH
.
'/helpers/StringHelperBase.php'
,
'yii\helpers\VarDumper'
=>
YII_PATH
.
'/helpers/VarDumper.php'
,
'yii\helpers\VarDumperBase'
=>
YII_PATH
.
'/helpers/VarDumperBase.php'
,
'yii\i18n\DbMessageSource'
=>
YII_PATH
.
'/i18n/DbMessageSource.php'
,
'yii\i18n\Formatter'
=>
YII_PATH
.
'/i18n/Formatter.php'
,
'yii\i18n\GettextFile'
=>
YII_PATH
.
'/i18n/GettextFile.php'
,
...
...
@@ -162,12 +177,14 @@ return array(
'yii\validators\FilterValidator'
=>
YII_PATH
.
'/validators/FilterValidator.php'
,
'yii\validators\InlineValidator'
=>
YII_PATH
.
'/validators/InlineValidator.php'
,
'yii\validators\NumberValidator'
=>
YII_PATH
.
'/validators/NumberValidator.php'
,
'yii\validators\PunycodeAsset'
=>
YII_PATH
.
'/validators/PunycodeAsset.php'
,
'yii\validators\RangeValidator'
=>
YII_PATH
.
'/validators/RangeValidator.php'
,
'yii\validators\RegularExpressionValidator'
=>
YII_PATH
.
'/validators/RegularExpressionValidator.php'
,
'yii\validators\RequiredValidator'
=>
YII_PATH
.
'/validators/RequiredValidator.php'
,
'yii\validators\StringValidator'
=>
YII_PATH
.
'/validators/StringValidator.php'
,
'yii\validators\UniqueValidator'
=>
YII_PATH
.
'/validators/UniqueValidator.php'
,
'yii\validators\UrlValidator'
=>
YII_PATH
.
'/validators/UrlValidator.php'
,
'yii\validators\ValidationAsset'
=>
YII_PATH
.
'/validators/ValidationAsset.php'
,
'yii\validators\Validator'
=>
YII_PATH
.
'/validators/Validator.php'
,
'yii\web\AccessControl'
=>
YII_PATH
.
'/web/AccessControl.php'
,
'yii\web\AccessRule'
=>
YII_PATH
.
'/web/AccessRule.php'
,
...
...
@@ -186,6 +203,7 @@ return array(
'yii\web\HttpException'
=>
YII_PATH
.
'/web/HttpException.php'
,
'yii\web\IAssetConverter'
=>
YII_PATH
.
'/web/IAssetConverter.php'
,
'yii\web\Identity'
=>
YII_PATH
.
'/web/Identity.php'
,
'yii\web\JqueryAsset'
=>
YII_PATH
.
'/web/JqueryAsset.php'
,
'yii\web\JsExpression'
=>
YII_PATH
.
'/web/JsExpression.php'
,
'yii\web\PageCache'
=>
YII_PATH
.
'/web/PageCache.php'
,
'yii\web\Request'
=>
YII_PATH
.
'/web/Request.php'
,
...
...
@@ -201,20 +219,22 @@ return array(
'yii\web\UserEvent'
=>
YII_PATH
.
'/web/UserEvent.php'
,
'yii\web\VerbFilter'
=>
YII_PATH
.
'/web/VerbFilter.php'
,
'yii\web\XmlResponseFormatter'
=>
YII_PATH
.
'/web/XmlResponseFormatter.php'
,
'yii\web\YiiAsset'
=>
YII_PATH
.
'/web/YiiAsset.php'
,
'yii\widgets\ActiveField'
=>
YII_PATH
.
'/widgets/ActiveField.php'
,
'yii\widgets\ActiveForm'
=>
YII_PATH
.
'/widgets/ActiveForm.php'
,
'yii\widgets\
BaseListView'
=>
YII_PATH
.
'/widgets/BaseListView
.php'
,
'yii\widgets\
ActiveFormAsset'
=>
YII_PATH
.
'/widgets/ActiveFormAsset
.php'
,
'yii\widgets\Block'
=>
YII_PATH
.
'/widgets/Block.php'
,
'yii\widgets\Breadcrumbs'
=>
YII_PATH
.
'/widgets/Breadcrumbs.php'
,
'yii\widgets\Captcha'
=>
YII_PATH
.
'/widgets/Captcha.php'
,
'yii\widgets\CaptchaAsset'
=>
YII_PATH
.
'/widgets/CaptchaAsset.php'
,
'yii\widgets\ContentDecorator'
=>
YII_PATH
.
'/widgets/ContentDecorator.php'
,
'yii\widgets\DetailView'
=>
YII_PATH
.
'/widgets/DetailView.php'
,
'yii\widgets\FragmentCache'
=>
YII_PATH
.
'/widgets/FragmentCache.php'
,
'yii\widgets\InputWidget'
=>
YII_PATH
.
'/widgets/InputWidget.php'
,
'yii\widgets\LinkPager'
=>
YII_PATH
.
'/widgets/LinkPager.php'
,
'yii\widgets\ListPager'
=>
YII_PATH
.
'/widgets/ListPager.php'
,
'yii\widgets\ListView'
=>
YII_PATH
.
'/widgets/ListView.php'
,
'yii\widgets\MaskedInput'
=>
YII_PATH
.
'/widgets/MaskedInput.php'
,
'yii\widgets\MaskedInputAsset'
=>
YII_PATH
.
'/widgets/MaskedInputAsset.php'
,
'yii\widgets\Menu'
=>
YII_PATH
.
'/widgets/Menu.php'
,
'yii\widgets\Spaceless'
=>
YII_PATH
.
'/widgets/Spaceless.php'
,
);
framework/yii/console/Controller.php
View file @
a6cd7b72
...
...
@@ -137,7 +137,7 @@ class Controller extends \yii\base\Controller
/**
* Formats a string with ANSI codes
*
* You may pass additional parameters using the constants defined in [[yii\helpers\
base\
Console]].
* You may pass additional parameters using the constants defined in [[yii\helpers\Console]].
*
* Example:
*
...
...
@@ -162,7 +162,7 @@ class Controller extends \yii\base\Controller
* Prints a string to STDOUT
*
* You may optionally format the string with ANSI codes by
* passing additional parameters using the constants defined in [[yii\helpers\
base\
Console]].
* passing additional parameters using the constants defined in [[yii\helpers\Console]].
*
* Example:
*
...
...
@@ -187,7 +187,7 @@ class Controller extends \yii\base\Controller
* Prints a string to STDERR
*
* You may optionally format the string with ANSI codes by
* passing additional parameters using the constants defined in [[yii\helpers\
base\
Console]].
* passing additional parameters using the constants defined in [[yii\helpers\Console]].
*
* Example:
*
...
...
framework/yii/helpers/ArrayHelper.php
View file @
a6cd7b72
...
...
@@ -8,12 +8,12 @@
namespace
yii\helpers
;
/**
* ArrayHelper provides additional array functionality you can use in your
* ArrayHelper provides additional array functionality
that
you can use in your
* application.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
ArrayHelper
extends
base\ArrayHelper
class
ArrayHelper
extends
ArrayHelperBase
{
}
framework/yii/helpers/
base/ArrayHelper
.php
→
framework/yii/helpers/
ArrayHelperBase
.php
View file @
a6cd7b72
...
...
@@ -5,20 +5,21 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
Yii
;
use
yii\base\Arrayable
;
use
yii\base\InvalidParamException
;
/**
* ArrayHelper provides additional array functionality you can use in your
* application.
* ArrayHelperBase provides concrete implementation for [[ArrayHelper]].
*
* Do not use ArrayHelperBase. Use [[ArrayHelper]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
ArrayHelper
class
ArrayHelper
Base
{
/**
* Converts an object or an array of objects into an array.
...
...
framework/yii/helpers/Console.php
View file @
a6cd7b72
...
...
@@ -17,6 +17,6 @@ namespace yii\helpers;
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
Console
extends
base\Consol
e
class
Console
extends
ConsoleBas
e
{
}
framework/yii/helpers/
base/Consol
e.php
→
framework/yii/helpers/
ConsoleBas
e.php
View file @
a6cd7b72
...
...
@@ -5,27 +5,17 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
/**
* TODO adjust phpdoc
* TODO test this on all kinds of terminals, especially windows (check out lib ncurses)
*
* Console View is the base class for console view components
*
* A console view provides functionality to create rich console application by allowing to format output
* by adding color and font style to it.
*
* The following constants are available for formatting:
*
* TODO document constants
*
* ConsoleBase provides concrete implementation for [[Console]].
*
* Do not use ConsoleBase. Use [[Console]] instead.
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
Console
class
Console
Base
{
const
FG_BLACK
=
30
;
const
FG_RED
=
31
;
...
...
framework/yii/helpers/FileHelper.php
View file @
a6cd7b72
...
...
@@ -16,6 +16,6 @@ namespace yii\helpers;
* @author Alex Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
FileHelper
extends
base\FileHelper
class
FileHelper
extends
FileHelperBase
{
}
framework/yii/helpers/
base/FileHelper
.php
→
framework/yii/helpers/
FileHelperBase
.php
View file @
a6cd7b72
...
...
@@ -7,19 +7,20 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
Yii
;
use
yii\helpers\StringHelper
as
StringHelper2
;
/**
* Filesystem helper
* FileHelperBase provides concrete implementation for [[FileHelper]].
*
* Do not use FileHelperBase. Use [[FileHelper]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Alex Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
FileHelper
class
FileHelper
Base
{
/**
* Normalizes a file/directory path.
...
...
@@ -279,11 +280,11 @@ class FileHelper
if
(
$isDir
=
is_dir
(
$path
))
{
$path
.=
'/'
;
}
$n
=
StringHelper
2
::
strlen
(
$path
);
$n
=
StringHelper
::
strlen
(
$path
);
if
(
!
empty
(
$options
[
'except'
]))
{
foreach
(
$options
[
'except'
]
as
$name
)
{
if
(
StringHelper
2
::
substr
(
$path
,
-
StringHelper2
::
strlen
(
$name
),
$n
)
===
$name
)
{
if
(
StringHelper
::
substr
(
$path
,
-
StringHelper
::
strlen
(
$name
),
$n
)
===
$name
)
{
return
false
;
}
}
...
...
@@ -291,7 +292,7 @@ class FileHelper
if
(
!
$isDir
&&
!
empty
(
$options
[
'only'
]))
{
foreach
(
$options
[
'only'
]
as
$name
)
{
if
(
StringHelper
2
::
substr
(
$path
,
-
StringHelper2
::
strlen
(
$name
),
$n
)
===
$name
)
{
if
(
StringHelper
::
substr
(
$path
,
-
StringHelper
::
strlen
(
$name
),
$n
)
===
$name
)
{
return
true
;
}
}
...
...
framework/yii/helpers/Html.php
View file @
a6cd7b72
...
...
@@ -13,6 +13,6 @@ namespace yii\helpers;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Html
extends
base\Html
class
Html
extends
HtmlBase
{
}
framework/yii/helpers/
base/Html
.php
→
framework/yii/helpers/
HtmlBase
.php
View file @
a6cd7b72
...
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
Yii
;
use
yii\base\InvalidParamException
;
...
...
@@ -13,12 +13,14 @@ use yii\web\Request;
use
yii\base\Model
;
/**
* Html provides a set of static methods for generating commonly used HTML tags.
* HtmlBase provides concrete implementation for [[Html]].
*
* Do not use HtmlBase. Use [[Html]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Html
class
Html
Base
{
/**
* @var array list of void elements (element name => 1)
...
...
framework/yii/helpers/HtmlPurifier.php
View file @
a6cd7b72
...
...
@@ -32,6 +32,6 @@ namespace yii\helpers;
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
HtmlPurifier
extends
base\HtmlPurifier
class
HtmlPurifier
extends
HtmlPurifierBase
{
}
framework/yii/helpers/
base/HtmlPurifier
.php
→
framework/yii/helpers/
HtmlPurifierBase
.php
View file @
a6cd7b72
...
...
@@ -4,17 +4,17 @@
* @link http://www.yiiframework.com/
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
/**
* HtmlPurifier
is the concrete implementation of the [[yii\helpers\HtmlPurifier]] class
.
* HtmlPurifier
Base provides concrete implementation for [[HtmlPurifier]]
.
*
*
You should use [[yii\helpers\HtmlPurifier]] instead of this class in your application
.
*
Do not use HtmlPurifierBase. Use [[HtmlPurifier]] instead
.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
HtmlPurifier
class
HtmlPurifier
Base
{
/**
* Passes markup through HTMLPurifier making it safe to output to end user
...
...
framework/yii/helpers/Inflector.php
View file @
a6cd7b72
...
...
@@ -13,6 +13,6 @@ namespace yii\helpers;
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @since 2.0
*/
class
Inflector
extends
base\Inflector
class
Inflector
extends
InflectorBase
{
}
framework/yii/helpers/
base/Inflector
.php
→
framework/yii/helpers/
InflectorBase
.php
View file @
a6cd7b72
...
...
@@ -5,17 +5,19 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
Yii
;
/**
* Inflector pluralizes and singularizes English nouns. It also contains some other useful methods.
* InflectorBase provides concrete implementation for [[Inflector]].
*
* Do not use InflectorBase. Use [[Inflector]] instead.
*
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @since 2.0
*/
class
Inflector
class
Inflector
Base
{
/**
* @var array the rules for converting a word into its plural form.
...
...
framework/yii/helpers/Json.php
View file @
a6cd7b72
...
...
@@ -8,10 +8,12 @@
namespace
yii\helpers
;
/**
*
* Json is a helper class providing JSON data encoding and decoding.
* It enhances the PHP built-in functions `json_encode()` and `json_decode()`
* by supporting encoding JavaScript expressions and throwing exceptions when decoding fails.
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Json
extends
base\Json
class
Json
extends
JsonBase
{
}
framework/yii/helpers/
base/Json
.php
→
framework/yii/helpers/
JsonBase
.php
View file @
a6cd7b72
...
...
@@ -5,20 +5,21 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
yii\base\InvalidParamException
;
use
yii\base\Arrayable
;
use
yii\web\JsExpression
;
/**
* Json is a helper class providing JSON data encoding and decoding.
* It enhances the PHP built-in functions `json_encode()` and `json_decode()`
* by supporting encoding JavaScript expressions and throwing exceptions when decoding fails.
* JsonBase provides concrete implementation for [[Json]].
*
* Do not use JsonBase. Use [[Json]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Json
class
Json
Base
{
/**
* Encodes the given value into a JSON string.
...
...
framework/yii/helpers/Markdown.php
View file @
a6cd7b72
...
...
@@ -28,6 +28,6 @@ namespace yii\helpers;
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
Markdown
extends
base\Markdown
class
Markdown
extends
MarkdownBase
{
}
framework/yii/helpers/
base/Markdown
.php
→
framework/yii/helpers/
MarkdownBase
.php
View file @
a6cd7b72
...
...
@@ -5,32 +5,19 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
Michelf\MarkdownExtra
;
/**
* Markdown
provides an ability to transform markdown into HTML
.
* Markdown
Base provides concrete implementation for [[Markdown]]
.
*
*
Basic usage is the following:
*
Do not use MarkdownBase. Use [[Markdown]] instead.
*
* ```php
* $myHtml = Markdown::process($myText);
* ```
*
* If you want to configure the parser:
*
* ```php
* $myHtml = Markdown::process($myText, array(
* 'fn_id_prefix' => 'footnote_',
* ));
* ```
*
* For more details please refer to [PHP Markdown library documentation](http://michelf.ca/projects/php-markdown/).
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
Markdown
class
Markdown
Base
{
/**
* @var MarkdownExtra
...
...
framework/yii/helpers/Security
Helper
.php
→
framework/yii/helpers/Security.php
View file @
a6cd7b72
...
...
@@ -8,15 +8,15 @@
namespace
yii\helpers
;
/**
* Security
Helper
provides a set of methods to handle common security-related tasks.
* Security provides a set of methods to handle common security-related tasks.
*
* In particular, Security
Helper
supports the following features:
* In particular, Security supports the following features:
*
* - Encryption/decryption: [[encrypt()]] and [[decrypt()]]
* - Data tampering prevention: [[hashData()]] and [[validateData()]]
* - Password validation: [[generatePasswordHash()]] and [[validatePassword()]]
*
* Additionally, Security
Helper
provides [[getSecretKey()]] to support generating
* Additionally, Security provides [[getSecretKey()]] to support generating
* named secret keys. These secret keys, once generated, will be stored in a file
* and made available in future requests.
*
...
...
@@ -24,6 +24,6 @@ namespace yii\helpers;
* @author Tom Worster <fsb@thefsb.org>
* @since 2.0
*/
class
Security
Helper
extends
base\SecurityHelper
class
Security
extends
SecurityBase
{
}
framework/yii/helpers/
base/SecurityHelper
.php
→
framework/yii/helpers/
SecurityBase
.php
View file @
a6cd7b72
...
...
@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
use
Yii
;
use
yii\base\Exception
;
...
...
@@ -13,23 +13,15 @@ use yii\base\InvalidConfigException;
use
yii\base\InvalidParamException
;
/**
* Security
Helper provides a set of methods to handle common security-related tasks
.
* Security
Base provides concrete implementation for [[Security]]
.
*
* In particular, SecurityHelper supports the following features:
*
* - Encryption/decryption: [[encrypt()]] and [[decrypt()]]
* - Data tampering prevention: [[hashData()]] and [[validateData()]]
* - Password validation: [[generatePasswordHash()]] and [[validatePassword()]]
*
* Additionally, SecurityHelper provides [[getSecretKey()]] to support generating
* named secret keys. These secret keys, once generated, will be stored in a file
* and made available in future requests.
* Do not use SecurityBase. Use [[Security]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Tom Worster <fsb@thefsb.org>
* @since 2.0
*/
class
Security
Helper
class
Security
Base
{
/**
* Encrypts data.
...
...
@@ -182,11 +174,11 @@ class SecurityHelper
*
* ~~~
* // generates the hash (usually done during user registration or when the password is changed)
* $hash = Security
Helper
::generatePasswordHash($password);
* $hash = Security::generatePasswordHash($password);
* // ...save $hash in database...
*
* // during login, validate if the password entered is correct using $hash fetched from database
* if (Security
Helper
::validatePassword($password, $hash) {
* if (Security::validatePassword($password, $hash) {
* // password is good
* } else {
* // password is bad
...
...
framework/yii/helpers/StringHelper.php
View file @
a6cd7b72
...
...
@@ -14,6 +14,6 @@ namespace yii\helpers;
* @author Alex Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
StringHelper
extends
base\StringHelper
class
StringHelper
extends
StringHelperBase
{
}
framework/yii/helpers/
base/StringHelper
.php
→
framework/yii/helpers/
StringHelperBase
.php
View file @
a6cd7b72
...
...
@@ -5,16 +5,18 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
/**
* StringHelper
* StringHelperBase provides concrete implementation for [[StringHelper]].
*
* Do not use StringHelperBase. Use [[StringHelper]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Alex Makarov <sam@rmcreative.ru>
* @since 2.0
*/
class
StringHelper
class
StringHelper
Base
{
/**
* Returns the number of bytes in the given string.
...
...
framework/yii/helpers/VarDumper.php
View file @
a6cd7b72
...
...
@@ -23,6 +23,6 @@ namespace yii\helpers;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
VarDumper
extends
base\VarDumper
class
VarDumper
extends
VarDumperBase
{
}
framework/yii/helpers/
base/VarDumper
.php
→
framework/yii/helpers/
VarDumperBase
.php
View file @
a6cd7b72
...
...
@@ -6,24 +6,17 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\helpers
\base
;
namespace
yii\helpers
;
/**
* VarDumper is intended to replace the buggy PHP function var_dump and print_r.
* It can correctly identify the recursively referenced objects in a complex
* object structure. It also has a recursive depth control to avoid indefinite
* recursive display of some peculiar variables.
* VarDumperBase provides concrete implementation for [[VarDumper]].
*
* VarDumper can be used as follows,
*
* ~~~
* VarDumper::dump($var);
* ~~~
* Do not use VarDumperBase. Use [[VarDumper]] instead.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
VarDumper
class
VarDumper
Base
{
private
static
$_objects
;
private
static
$_output
;
...
...
framework/yii/helpers/
base/
mimeTypes.php
→
framework/yii/helpers/mimeTypes.php
View file @
a6cd7b72
File moved
framework/yii/web/Request.php
View file @
a6cd7b72
...
...
@@ -9,7 +9,7 @@ namespace yii\web;
use
Yii
;
use
yii\base\InvalidConfigException
;
use
yii\helpers\Security
Helper
;
use
yii\helpers\Security
;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
...
...
@@ -823,7 +823,7 @@ class Request extends \yii\base\Request
if
(
$this
->
enableCookieValidation
)
{
$key
=
$this
->
getCookieValidationKey
();
foreach
(
$_COOKIE
as
$name
=>
$value
)
{
if
(
is_string
(
$value
)
&&
(
$value
=
Security
Helper
::
validateData
(
$value
,
$key
))
!==
false
)
{
if
(
is_string
(
$value
)
&&
(
$value
=
Security
::
validateData
(
$value
,
$key
))
!==
false
)
{
$cookies
[
$name
]
=
new
Cookie
(
array
(
'name'
=>
$name
,
'value'
=>
@
unserialize
(
$value
),
...
...
@@ -850,7 +850,7 @@ class Request extends \yii\base\Request
public
function
getCookieValidationKey
()
{
if
(
$this
->
_cookieValidationKey
===
null
)
{
$this
->
_cookieValidationKey
=
Security
Helper
::
getSecretKey
(
__CLASS__
.
'/'
.
Yii
::
$app
->
id
);
$this
->
_cookieValidationKey
=
Security
::
getSecretKey
(
__CLASS__
.
'/'
.
Yii
::
$app
->
id
);
}
return
$this
->
_cookieValidationKey
;
}
...
...
framework/yii/web/Response.php
View file @
a6cd7b72
...
...
@@ -13,7 +13,7 @@ use yii\base\InvalidParamException;
use
yii\helpers\FileHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Json
;
use
yii\helpers\Security
Helper
;
use
yii\helpers\Security
;
use
yii\helpers\StringHelper
;
/**
...
...
@@ -313,7 +313,7 @@ class Response extends \yii\base\Response
foreach
(
$this
->
getCookies
()
as
$cookie
)
{
$value
=
$cookie
->
value
;
if
(
$cookie
->
expire
!=
1
&&
isset
(
$validationKey
))
{
$value
=
Security
Helper
::
hashData
(
serialize
(
$value
),
$validationKey
);
$value
=
Security
::
hashData
(
serialize
(
$value
),
$validationKey
);
}
setcookie
(
$cookie
->
name
,
$value
,
$cookie
->
expire
,
$cookie
->
path
,
$cookie
->
domain
,
$cookie
->
secure
,
$cookie
->
httpOnly
);
}
...
...
tests/unit/framework/helpers/FileHelperTest.php
View file @
a6cd7b72
...
...
@@ -4,7 +4,7 @@ use yii\helpers\FileHelper;
use
yii\test\TestCase
;
/**
* Unit test for [[yii\helpers\
base\
FileHelper]]
* Unit test for [[yii\helpers\FileHelper]]
* @see FileHelper
*/
class
FileHelperTest
extends
TestCase
...
...
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