@@ -6,7 +6,6 @@ |
||
6 | 6 | use yii\base\Model; |
7 | 7 | use yii\helpers\Url; |
8 | 8 | use yii\helpers\Json; |
9 | -use yii\caching\TagDependency; |
|
10 | 9 | use yii\data\ActiveDataProvider; |
11 | 10 | use ogheo\comments\assets\CommentsAsset; |
12 | 11 | use ogheo\comments\helpers\CommentsHelper; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | { |
235 | 235 | if ($this->dataProviderConfig === null) { |
236 | 236 | $this->dataProviderConfig = [ |
237 | - 'key' => function ($model) { |
|
237 | + 'key' => function($model) { |
|
238 | 238 | return CommentsHelper::encodeId($model->id); |
239 | 239 | }, |
240 | 240 | 'pagination' => [ |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | 'layout' => '{items}<div class="text-center">{pager}</div>', |
263 | 263 | 'options' => ['class' => 'comments-list'], |
264 | 264 | 'itemOptions' => ['class' => 'media'], |
265 | - 'itemView' => function ($model, $key, $index, $widget) { |
|
265 | + 'itemView' => function($model, $key, $index, $widget) { |
|
266 | 266 | return $this->render($this->commentView, [ |
267 | 267 | 'maxNestedLevel' => $this->maxNestedLevel, |
268 | 268 | 'nestedLevel' => 1, |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $cookies = Yii::$app->response->cookies; |
79 | 79 | $cookies->add(new \yii\web\Cookie([ |
80 | 80 | 'name' => CommentsModule::getInstance()->guestUsernameCookieName, |
81 | - 'expire' => time() + (int)CommentsModule::getInstance()->guestCookieDuration, |
|
81 | + 'expire' => time() + (int) CommentsModule::getInstance()->guestCookieDuration, |
|
82 | 82 | 'value' => $username, |
83 | 83 | ])); |
84 | 84 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $cookies = Yii::$app->response->cookies; |
115 | 115 | $cookies->add(new \yii\web\Cookie([ |
116 | 116 | 'name' => CommentsModule::getInstance()->guestEmailCookieName, |
117 | - 'expire' => time() + (int)CommentsModule::getInstance()->guestCookieDuration, |
|
117 | + 'expire' => time() + (int) CommentsModule::getInstance()->guestCookieDuration, |
|
118 | 118 | 'value' => $email, |
119 | 119 | ])); |
120 | 120 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | |
194 | 194 | $cookies->add(new \yii\web\Cookie([ |
195 | 195 | 'name' => CommentsModule::getInstance()->upRatedCookieName, |
196 | - 'expire' => time() + (int)CommentsModule::getInstance()->ratingCookieDuration, |
|
196 | + 'expire' => time() + (int) CommentsModule::getInstance()->ratingCookieDuration, |
|
197 | 197 | 'value' => $uprated, |
198 | 198 | ])); |
199 | 199 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $uprated = implode(',', $uprated_arr); |
218 | 218 | $cookies->add(new \yii\web\Cookie([ |
219 | 219 | 'name' => CommentsModule::getInstance()->upRatedCookieName, |
220 | - 'expire' => time() + (int)CommentsModule::getInstance()->ratingCookieDuration, |
|
220 | + 'expire' => time() + (int) CommentsModule::getInstance()->ratingCookieDuration, |
|
221 | 221 | 'value' => $uprated, |
222 | 222 | ])); |
223 | 223 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | $cookies->add(new \yii\web\Cookie([ |
279 | 279 | 'name' => CommentsModule::getInstance()->downRatedCookieName, |
280 | - 'expire' => time() + (int)CommentsModule::getInstance()->ratingCookieDuration, |
|
280 | + 'expire' => time() + (int) CommentsModule::getInstance()->ratingCookieDuration, |
|
281 | 281 | 'value' => $downrated, |
282 | 282 | ])); |
283 | 283 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $downrated = implode(',', $downrated_arr); |
302 | 302 | $cookies->add(new \yii\web\Cookie([ |
303 | 303 | 'name' => CommentsModule::getInstance()->downRatedCookieName, |
304 | - 'expire' => time() + (int)CommentsModule::getInstance()->ratingCookieDuration, |
|
304 | + 'expire' => time() + (int) CommentsModule::getInstance()->ratingCookieDuration, |
|
305 | 305 | 'value' => $downrated, |
306 | 306 | ])); |
307 | 307 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | <?= Yii::t('comments', '<a href="{url}">Log in</a> to post a comment.', ['url' => Url::to(Yii::$app->getUser()->loginUrl)]) ?> |
19 | 19 | </div> |
20 | 20 | |
21 | - <?php else: ?> |
|
21 | + <?php else { |
|
22 | + : ?> |
|
22 | 23 | |
23 | 24 | <?php $form = ActiveForm::begin([ |
24 | 25 | 'action' => Url::to( |
@@ -92,12 +93,17 @@ discard block |
||
92 | 93 | </div> |
93 | 94 | <?php } else { ?> |
94 | 95 | <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 user-data"> |
95 | - <?= Yii::t('comments', 'As') . ' <b>' . $commentModel->username . '</b>'; ?> |
|
96 | + <?= Yii::t('comments', 'As') . ' <b>' . $commentModel->username . '</b>'; |
|
97 | +} |
|
98 | +?> |
|
96 | 99 | </div> |
97 | 100 | <?php } ?> |
98 | - <?php else: ?> |
|
101 | + <?php else { |
|
102 | + : ?> |
|
99 | 103 | <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 user-data"> |
100 | - <?= Yii::t('comments', 'As') . ' <b>' . Yii::$app->user->identity->username . '</b>'; ?> |
|
104 | + <?= Yii::t('comments', 'As') . ' <b>' . Yii::$app->user->identity->username . '</b>'; |
|
105 | +} |
|
106 | +?> |
|
101 | 107 | </div> |
102 | 108 | <?php endif; ?> |
103 | 109 |
@@ -131,7 +131,7 @@ |
||
131 | 131 | [['content'], 'required'], |
132 | 132 | [['username', 'email'], 'required', 'on' => self::SCENARIO_GUEST], |
133 | 133 | [['main_parent_id', 'created_by', 'updated_by', 'created_at', 'updated_at', 'status'], 'integer'], |
134 | - [['parent_id'], function ($attribute, $params, $validator) { |
|
134 | + [['parent_id'], function($attribute, $params, $validator) { |
|
135 | 135 | $parent_id = CommentsHelper::decodeId($this->$attribute); |
136 | 136 | if ((!intval($parent_id)) || (!self::find()->where(['id' => $parent_id])->exists())) { |
137 | 137 | $this->addError( |
@@ -94,7 +94,7 @@ |
||
94 | 94 | return [ |
95 | 95 | [['comment_id', 'status'], 'required'], |
96 | 96 | [['created_by', 'updated_by', 'created_at', 'updated_at', 'status'], 'integer'], |
97 | - [['comment_id'], function ($attribute, $params, $validator) { |
|
97 | + [['comment_id'], function($attribute, $params, $validator) { |
|
98 | 98 | if ($this->scenario === self::SCENARIO_UPDATE) { |
99 | 99 | $comment_id = $this->$attribute; |
100 | 100 | } else { |