octicon-rss(16/)
You've already forked yii2
mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-10 02:13:17 +08:00
Merge branch 'cache-for-htmlpurifier-lexer' of https://github.com/webdevsega/yii2 into webdevsega-cache-for-htmlpurifier-lexer
Conflicts: framework/CHANGELOG.md
This commit is contained in:
octicon-git-branch(16/)
octicon-tag(16/)
octicon-diff(16/tw-mr-1) 2 changed files with 4 additions and 3 deletions
@@ -31,7 +31,6 @@ Yii Framework 2 Change Log
|
||||
- Bug: Fixed string comparison in `BaseActiveRecord::unlink()` which may result in wrong comparison result for hash valued primary keys starting with `0e` (cebe)
|
||||
- Bug: Pass correct action name to `yii\console\Controller::options()` when default action was requested (cebe)
|
||||
- Bug: Automatic garbage collection in `yii\caching\FileCache` was not triggered (kidol)
|
||||
- Enh: Add translation for Norwegian Bokmål (atmoz)
|
||||
- Enh #3335: Implemented `SchemaBuilder` (pana1990, vaseninm, samdark)
|
||||
- Enh #6043: Specification for 'class' and 'style' in array format added to `yii\helpers\Html` (klimov-paul)
|
||||
- Enh #6853: Console application will now register PHP constants for `STDIN`, `STDOUT`, and `STDERR` itself if they are not defined (cebe)
|
||||
@@ -53,6 +52,7 @@ Yii Framework 2 Change Log
|
||||
- Enh #9177: Added password hash cost setting to Security component (freezy-sk)
|
||||
- Chg #6354: `ErrorHandler::logException()` will now log the whole exception object instead of only its string representation (cebe)
|
||||
- Chg #8556: Extracted `yii\web\User::getAuthManager()` method (samdark)
|
||||
- Chg #9181: `yii\helpers\BaseStringHelper::truncateHtml()` is now using `runtime` directory for `HTMLPurifier` cache (webdevsega)
|
||||
|
||||
|
||||
2.0.5 July 11, 2015
|
||||
|
||||
@@ -105,7 +105,7 @@ class BaseStringHelper
|
||||
public static function truncate($string, $length, $suffix = '...', $encoding = null, $asHtml = false)
|
||||
{
|
||||
if ($asHtml) {
|
||||
return self::truncateHtml($string, $length, $suffix, $encoding ?: Yii::$app->charset);
|
||||
return static::truncateHtml($string, $length, $suffix, $encoding ?: Yii::$app->charset);
|
||||
}
|
||||
|
||||
if (mb_strlen($string, $encoding ?: Yii::$app->charset) > $length) {
|
||||
@@ -128,7 +128,7 @@ class BaseStringHelper
|
||||
public static function truncateWords($string, $count, $suffix = '...', $asHtml = false)
|
||||
{
|
||||
if ($asHtml) {
|
||||
return self::truncateHtml($string, $count, $suffix);
|
||||
return static::truncateHtml($string, $count, $suffix);
|
||||
}
|
||||
|
||||
$words = preg_split('/(\s+)/u', trim($string), null, PREG_SPLIT_DELIM_CAPTURE);
|
||||
@@ -152,6 +152,7 @@ class BaseStringHelper
|
||||
protected static function truncateHtml($string, $count, $suffix, $encoding = false)
|
||||
{
|
||||
$config = \HTMLPurifier_Config::create(null);
|
||||
$config->set('Cache.SerializerPath', \Yii::$app->getRuntimePath());
|
||||
$lexer = \HTMLPurifier_Lexer::create($config);
|
||||
$tokens = $lexer->tokenizeHTML($string, $config, null);
|
||||
$openTokens = 0;
|
||||
|
||||
Reference in New Issue
Block a user