diff --git a/apps/advanced/common/models/User.php b/apps/advanced/common/models/User.php index df1d6b0..dd67959 100644 --- a/apps/advanced/common/models/User.php +++ b/apps/advanced/common/models/User.php @@ -2,7 +2,7 @@ namespace common\models; use yii\db\ActiveRecord; -use yii\helpers\SecurityHelper; +use yii\helpers\Security; use yii\web\Identity; /** @@ -72,7 +72,7 @@ class User extends ActiveRecord implements Identity public function validatePassword($password) { - return SecurityHelper::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 = SecurityHelper::generatePasswordHash($this->password); + $this->password_hash = Security::generatePasswordHash($this->password); } if ($this->isNewRecord) { - $this->auth_key = SecurityHelper::generateRandomKey(); + $this->auth_key = Security::generateRandomKey(); } return true; } diff --git a/apps/advanced/frontend/models/SendPasswordResetTokenForm.php b/apps/advanced/frontend/models/SendPasswordResetTokenForm.php index 05c8f99..5e48084 100644 --- a/apps/advanced/frontend/models/SendPasswordResetTokenForm.php +++ b/apps/advanced/frontend/models/SendPasswordResetTokenForm.php @@ -4,7 +4,7 @@ namespace frontend\models; use yii\base\Model; use common\models\User; use yii\base\View; -use yii\helpers\SecurityHelper; +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 = SecurityHelper::generateRandomKey(); + $user->password_reset_token = Security::generateRandomKey(); if ($user->save(false)) { $view = new View(array( 'context' => \Yii::$app->controller, diff --git a/framework/yii/classes.php b/framework/yii/classes.php index 5cd6e3b..41c9a3a 100644 --- a/framework/yii/classes.php +++ b/framework/yii/classes.php @@ -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', ); diff --git a/framework/yii/console/Controller.php b/framework/yii/console/Controller.php index e4d4211..f605893 100644 --- a/framework/yii/console/Controller.php +++ b/framework/yii/console/Controller.php @@ -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: * diff --git a/framework/yii/helpers/ArrayHelper.php b/framework/yii/helpers/ArrayHelper.php index d58341c..085104b 100644 --- a/framework/yii/helpers/ArrayHelper.php +++ b/framework/yii/helpers/ArrayHelper.php @@ -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 * @since 2.0 */ -class ArrayHelper extends base\ArrayHelper +class ArrayHelper extends ArrayHelperBase { } diff --git a/framework/yii/helpers/base/ArrayHelper.php b/framework/yii/helpers/ArrayHelperBase.php similarity index 98% rename from framework/yii/helpers/base/ArrayHelper.php rename to framework/yii/helpers/ArrayHelperBase.php index de64f61..aa12700 100644 --- a/framework/yii/helpers/base/ArrayHelper.php +++ b/framework/yii/helpers/ArrayHelperBase.php @@ -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 * @since 2.0 */ -class ArrayHelper +class ArrayHelperBase { /** * Converts an object or an array of objects into an array. diff --git a/framework/yii/helpers/Console.php b/framework/yii/helpers/Console.php index 0055107..eeadcbc 100644 --- a/framework/yii/helpers/Console.php +++ b/framework/yii/helpers/Console.php @@ -17,6 +17,6 @@ namespace yii\helpers; * @author Carsten Brandt * @since 2.0 */ -class Console extends base\Console +class Console extends ConsoleBase { } diff --git a/framework/yii/helpers/base/Console.php b/framework/yii/helpers/ConsoleBase.php similarity index 98% rename from framework/yii/helpers/base/Console.php rename to framework/yii/helpers/ConsoleBase.php index e3acbd9..2372a64 100644 --- a/framework/yii/helpers/base/Console.php +++ b/framework/yii/helpers/ConsoleBase.php @@ -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 * @since 2.0 */ -class Console +class ConsoleBase { const FG_BLACK = 30; const FG_RED = 31; diff --git a/framework/yii/helpers/FileHelper.php b/framework/yii/helpers/FileHelper.php index 04ce4e1..9241025 100644 --- a/framework/yii/helpers/FileHelper.php +++ b/framework/yii/helpers/FileHelper.php @@ -16,6 +16,6 @@ namespace yii\helpers; * @author Alex Makarov * @since 2.0 */ -class FileHelper extends base\FileHelper +class FileHelper extends FileHelperBase { } diff --git a/framework/yii/helpers/base/FileHelper.php b/framework/yii/helpers/FileHelperBase.php similarity index 97% rename from framework/yii/helpers/base/FileHelper.php rename to framework/yii/helpers/FileHelperBase.php index 72aa8bf..6358ea1 100644 --- a/framework/yii/helpers/base/FileHelper.php +++ b/framework/yii/helpers/FileHelperBase.php @@ -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 * @author Alex Makarov * @since 2.0 */ -class FileHelper +class FileHelperBase { /** * Normalizes a file/directory path. @@ -279,11 +280,11 @@ class FileHelper if ($isDir = is_dir($path)) { $path .= '/'; } - $n = StringHelper2::strlen($path); + $n = StringHelper::strlen($path); if (!empty($options['except'])) { foreach ($options['except'] as $name) { - if (StringHelper2::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 (StringHelper2::substr($path, -StringHelper2::strlen($name), $n) === $name) { + if (StringHelper::substr($path, -StringHelper::strlen($name), $n) === $name) { return true; } } diff --git a/framework/yii/helpers/Html.php b/framework/yii/helpers/Html.php index b3a0743..8e4f1c9 100644 --- a/framework/yii/helpers/Html.php +++ b/framework/yii/helpers/Html.php @@ -13,6 +13,6 @@ namespace yii\helpers; * @author Qiang Xue * @since 2.0 */ -class Html extends base\Html +class Html extends HtmlBase { } diff --git a/framework/yii/helpers/base/Html.php b/framework/yii/helpers/HtmlBase.php similarity index 99% rename from framework/yii/helpers/base/Html.php rename to framework/yii/helpers/HtmlBase.php index 42f0b14..b55098f 100644 --- a/framework/yii/helpers/base/Html.php +++ b/framework/yii/helpers/HtmlBase.php @@ -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 * @since 2.0 */ -class Html +class HtmlBase { /** * @var array list of void elements (element name => 1) diff --git a/framework/yii/helpers/HtmlPurifier.php b/framework/yii/helpers/HtmlPurifier.php index efba874..f7203e4 100644 --- a/framework/yii/helpers/HtmlPurifier.php +++ b/framework/yii/helpers/HtmlPurifier.php @@ -32,6 +32,6 @@ namespace yii\helpers; * @author Alexander Makarov * @since 2.0 */ -class HtmlPurifier extends base\HtmlPurifier +class HtmlPurifier extends HtmlPurifierBase { } diff --git a/framework/yii/helpers/base/HtmlPurifier.php b/framework/yii/helpers/HtmlPurifierBase.php similarity index 76% rename from framework/yii/helpers/base/HtmlPurifier.php rename to framework/yii/helpers/HtmlPurifierBase.php index 9c4835f..e89a589 100644 --- a/framework/yii/helpers/base/HtmlPurifier.php +++ b/framework/yii/helpers/HtmlPurifierBase.php @@ -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. + * HtmlPurifierBase 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 * @since 2.0 */ -class HtmlPurifier +class HtmlPurifierBase { /** * Passes markup through HTMLPurifier making it safe to output to end user diff --git a/framework/yii/helpers/Inflector.php b/framework/yii/helpers/Inflector.php index 72f77a7..ba9c069 100644 --- a/framework/yii/helpers/Inflector.php +++ b/framework/yii/helpers/Inflector.php @@ -13,6 +13,6 @@ namespace yii\helpers; * @author Antonio Ramirez * @since 2.0 */ -class Inflector extends base\Inflector +class Inflector extends InflectorBase { } diff --git a/framework/yii/helpers/base/Inflector.php b/framework/yii/helpers/InflectorBase.php similarity index 98% rename from framework/yii/helpers/base/Inflector.php rename to framework/yii/helpers/InflectorBase.php index f500c4c..e8d85d6 100644 --- a/framework/yii/helpers/base/Inflector.php +++ b/framework/yii/helpers/InflectorBase.php @@ -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 * @since 2.0 */ -class Inflector +class InflectorBase { /** * @var array the rules for converting a word into its plural form. diff --git a/framework/yii/helpers/Json.php b/framework/yii/helpers/Json.php index 117db1f..424de1f 100644 --- a/framework/yii/helpers/Json.php +++ b/framework/yii/helpers/Json.php @@ -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 * @since 2.0 */ -class Json extends base\Json +class Json extends JsonBase { } diff --git a/framework/yii/helpers/base/Json.php b/framework/yii/helpers/JsonBase.php similarity index 92% rename from framework/yii/helpers/base/Json.php rename to framework/yii/helpers/JsonBase.php index 7d05a4a..fa3fb01 100644 --- a/framework/yii/helpers/base/Json.php +++ b/framework/yii/helpers/JsonBase.php @@ -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 * @since 2.0 */ -class Json +class JsonBase { /** * Encodes the given value into a JSON string. diff --git a/framework/yii/helpers/Markdown.php b/framework/yii/helpers/Markdown.php index 3f6c98e..86df045 100644 --- a/framework/yii/helpers/Markdown.php +++ b/framework/yii/helpers/Markdown.php @@ -28,6 +28,6 @@ namespace yii\helpers; * @author Alexander Makarov * @since 2.0 */ -class Markdown extends base\Markdown +class Markdown extends MarkdownBase { } diff --git a/framework/yii/helpers/base/Markdown.php b/framework/yii/helpers/MarkdownBase.php similarity index 60% rename from framework/yii/helpers/base/Markdown.php rename to framework/yii/helpers/MarkdownBase.php index 3e69015..9db5b1e 100644 --- a/framework/yii/helpers/base/Markdown.php +++ b/framework/yii/helpers/MarkdownBase.php @@ -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. + * MarkdownBase 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 * @since 2.0 */ -class Markdown +class MarkdownBase { /** * @var MarkdownExtra diff --git a/framework/yii/helpers/SecurityHelper.php b/framework/yii/helpers/Security.php similarity index 69% rename from framework/yii/helpers/SecurityHelper.php rename to framework/yii/helpers/Security.php index d16e7e6..d0ca2ed 100644 --- a/framework/yii/helpers/SecurityHelper.php +++ b/framework/yii/helpers/Security.php @@ -8,15 +8,15 @@ namespace yii\helpers; /** - * SecurityHelper 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, SecurityHelper 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, SecurityHelper 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 * @since 2.0 */ -class SecurityHelper extends base\SecurityHelper +class Security extends SecurityBase { } diff --git a/framework/yii/helpers/base/SecurityHelper.php b/framework/yii/helpers/SecurityBase.php similarity index 93% rename from framework/yii/helpers/base/SecurityHelper.php rename to framework/yii/helpers/SecurityBase.php index 546ed21..9b743c4 100644 --- a/framework/yii/helpers/base/SecurityHelper.php +++ b/framework/yii/helpers/SecurityBase.php @@ -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; /** - * SecurityHelper provides a set of methods to handle common security-related tasks. + * SecurityBase 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 * @author Tom Worster * @since 2.0 */ -class SecurityHelper +class SecurityBase { /** * Encrypts data. @@ -182,11 +174,11 @@ class SecurityHelper * * ~~~ * // generates the hash (usually done during user registration or when the password is changed) - * $hash = SecurityHelper::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 (SecurityHelper::validatePassword($password, $hash) { + * if (Security::validatePassword($password, $hash) { * // password is good * } else { * // password is bad diff --git a/framework/yii/helpers/StringHelper.php b/framework/yii/helpers/StringHelper.php index 22b881a..ef75790 100644 --- a/framework/yii/helpers/StringHelper.php +++ b/framework/yii/helpers/StringHelper.php @@ -14,6 +14,6 @@ namespace yii\helpers; * @author Alex Makarov * @since 2.0 */ -class StringHelper extends base\StringHelper +class StringHelper extends StringHelperBase { } diff --git a/framework/yii/helpers/base/StringHelper.php b/framework/yii/helpers/StringHelperBase.php similarity index 92% rename from framework/yii/helpers/base/StringHelper.php rename to framework/yii/helpers/StringHelperBase.php index 7fbb960..e7d1d1e 100644 --- a/framework/yii/helpers/base/StringHelper.php +++ b/framework/yii/helpers/StringHelperBase.php @@ -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 * @author Alex Makarov * @since 2.0 */ -class StringHelper +class StringHelperBase { /** * Returns the number of bytes in the given string. diff --git a/framework/yii/helpers/VarDumper.php b/framework/yii/helpers/VarDumper.php index 59a1718..50e543c 100644 --- a/framework/yii/helpers/VarDumper.php +++ b/framework/yii/helpers/VarDumper.php @@ -23,6 +23,6 @@ namespace yii\helpers; * @author Qiang Xue * @since 2.0 */ -class VarDumper extends base\VarDumper +class VarDumper extends VarDumperBase { } diff --git a/framework/yii/helpers/base/VarDumper.php b/framework/yii/helpers/VarDumperBase.php similarity index 90% rename from framework/yii/helpers/base/VarDumper.php rename to framework/yii/helpers/VarDumperBase.php index 730aafe..c7da208 100644 --- a/framework/yii/helpers/base/VarDumper.php +++ b/framework/yii/helpers/VarDumperBase.php @@ -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 * @since 2.0 */ -class VarDumper +class VarDumperBase { private static $_objects; private static $_output; diff --git a/framework/yii/helpers/base/mimeTypes.php b/framework/yii/helpers/mimeTypes.php similarity index 100% rename from framework/yii/helpers/base/mimeTypes.php rename to framework/yii/helpers/mimeTypes.php diff --git a/framework/yii/web/Request.php b/framework/yii/web/Request.php index d6b4843..ee716f1 100644 --- a/framework/yii/web/Request.php +++ b/framework/yii/web/Request.php @@ -9,7 +9,7 @@ namespace yii\web; use Yii; use yii\base\InvalidConfigException; -use yii\helpers\SecurityHelper; +use yii\helpers\Security; /** * @author Qiang Xue @@ -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 = SecurityHelper::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 = SecurityHelper::getSecretKey(__CLASS__ . '/' . Yii::$app->id); + $this->_cookieValidationKey = Security::getSecretKey(__CLASS__ . '/' . Yii::$app->id); } return $this->_cookieValidationKey; } diff --git a/framework/yii/web/Response.php b/framework/yii/web/Response.php index 57b5181..5371122 100644 --- a/framework/yii/web/Response.php +++ b/framework/yii/web/Response.php @@ -13,7 +13,7 @@ use yii\base\InvalidParamException; use yii\helpers\FileHelper; use yii\helpers\Html; use yii\helpers\Json; -use yii\helpers\SecurityHelper; +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 = SecurityHelper::hashData(serialize($value), $validationKey); + $value = Security::hashData(serialize($value), $validationKey); } setcookie($cookie->name, $value, $cookie->expire, $cookie->path, $cookie->domain, $cookie->secure, $cookie->httpOnly); } diff --git a/tests/unit/framework/helpers/FileHelperTest.php b/tests/unit/framework/helpers/FileHelperTest.php index 1fc8d95..4d874de 100644 --- a/tests/unit/framework/helpers/FileHelperTest.php +++ b/tests/unit/framework/helpers/FileHelperTest.php @@ -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