@@ -1,6 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | -use Ffcms\Core\Helper\Date; |
|
| 3 | -use Ffcms\Core\Helper\Text; |
|
| 4 | 2 | use Ffcms\Core\Helper\Url; |
| 5 | 3 | use Apps\Model\Api\Comments\EntityCommentData; |
| 6 | 4 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | <ul class="list-inline list-info"> |
| 23 | 23 | <li><i class="fa fa-calendar"></i> <?= $data['date'] ?></li> |
| 24 | 24 | <li><i class="fa fa-user"></i> |
| 25 | - <?php if ((int)$data['user']['id'] > 0): ?> |
|
| 25 | + <?php if ((int) $data['user']['id'] > 0): ?> |
|
| 26 | 26 | <?= Url::link(['profile/show', $data['user']['id']], $data['user']['name']) ?> |
| 27 | 27 | <?php else: ?> |
| 28 | 28 | <?= $data['user']['name'] ?> |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | <img class="media-object img-responsive" src="<?= $data['user']['avatar']?>" style="width: 64px; height: 64px;" alt="Picture of user <?= $data['user']['name'] ?>"> |
| 36 | 36 | </span> |
| 37 | 37 | <div class="media-body"> |
| 38 | - <a href="<?= \App::$Alias->baseUrl . $data['pathway'] ?>"><?= $data['text'] ?></a> |
|
| 38 | + <a href="<?= \App::$Alias->baseUrl.$data['pathway'] ?>"><?= $data['text'] ?></a> |
|
| 39 | 39 | </div> |
| 40 | 40 | </li> |
| 41 | 41 | </ul> |
@@ -24,9 +24,12 @@ |
||
| 24 | 24 | <li><i class="fa fa-user"></i> |
| 25 | 25 | <?php if ((int)$data['user']['id'] > 0): ?> |
| 26 | 26 | <?= Url::link(['profile/show', $data['user']['id']], $data['user']['name']) ?> |
| 27 | - <?php else: ?> |
|
| 27 | + <?php else { |
|
| 28 | + : ?> |
|
| 28 | 29 | <?= $data['user']['name'] ?> |
| 29 | - <?php endif; ?> |
|
| 30 | + <?php endif; |
|
| 31 | +} |
|
| 32 | +?> |
|
| 30 | 33 | </li> |
| 31 | 34 | </ul> |
| 32 | 35 | </li> |
@@ -6,7 +6,6 @@ |
||
| 6 | 6 | use Extend\Core\Arch\FrontWidget as AbstractWidget; |
| 7 | 7 | use Ffcms\Core\Traits\OopTools; |
| 8 | 8 | use Apps\ActiveRecord\CommentPost; |
| 9 | -use Apps\Model\Api\Comments\EntityCommentData; |
|
| 10 | 9 | |
| 11 | 10 | class Newcomment extends AbstractWidget |
| 12 | 11 | { |
@@ -12,22 +12,22 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | use OopTools; |
| 14 | 14 | |
| 15 | - public $snippet; |
|
| 16 | - public $count; |
|
| 17 | - public $cache; |
|
| 15 | + public $snippet; |
|
| 16 | + public $count; |
|
| 17 | + public $cache; |
|
| 18 | 18 | |
| 19 | 19 | public function init() |
| 20 | 20 | { |
| 21 | - $cfg = $this->getConfigs(); |
|
| 22 | - if ($this->snippet === null) { |
|
| 23 | - $this->snippet = $cfg['snippet']; |
|
| 24 | - } |
|
| 25 | - if ($this->count === null) { |
|
| 26 | - $this->count = $cfg['count']; |
|
| 27 | - } |
|
| 28 | - if ($this->cache === null) { |
|
| 29 | - $this->cache = $cfg['cache']; |
|
| 30 | - } |
|
| 21 | + $cfg = $this->getConfigs(); |
|
| 22 | + if ($this->snippet === null) { |
|
| 23 | + $this->snippet = $cfg['snippet']; |
|
| 24 | + } |
|
| 25 | + if ($this->count === null) { |
|
| 26 | + $this->count = $cfg['count']; |
|
| 27 | + } |
|
| 28 | + if ($this->cache === null) { |
|
| 29 | + $this->cache = $cfg['cache']; |
|
| 30 | + } |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function display() |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | return __('Comments not yet found'); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return App::$View->render('widgets/newcomment/default', [ |
|
| 53 | - 'records' => $records, |
|
| 54 | - 'snippet' => $this->snippet |
|
| 55 | - ]); |
|
| 52 | + return App::$View->render('widgets/newcomment/default', [ |
|
| 53 | + 'records' => $records, |
|
| 54 | + 'snippet' => $this->snippet |
|
| 55 | + ]); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | private function makeQuery() |
@@ -35,9 +35,9 @@ |
||
| 35 | 35 | $classHash = $this->createStringClassSnapshotHash(); |
| 36 | 36 | |
| 37 | 37 | $records = null; |
| 38 | - if ((int)$this->cache > 0) { |
|
| 39 | - if (App::$Cache->get('widget.newcomment.' . $classHash) !== null) { |
|
| 40 | - $records = App::$Cache->get('widget.newcomment.' . $classHash); |
|
| 38 | + if ((int) $this->cache > 0) { |
|
| 39 | + if (App::$Cache->get('widget.newcomment.'.$classHash) !== null) { |
|
| 40 | + $records = App::$Cache->get('widget.newcomment.'.$classHash); |
|
| 41 | 41 | } else { |
| 42 | 42 | $records = $this->makeQuery(); |
| 43 | 43 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * Set default values from configs |
|
| 27 | - */ |
|
| 26 | + * Set default values from configs |
|
| 27 | + */ |
|
| 28 | 28 | public function before() |
| 29 | 29 | { |
| 30 | 30 | $this->snippet = (int)$this->_configs['snippet']; |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * Labels for form display |
|
| 37 | - */ |
|
| 36 | + * Labels for form display |
|
| 37 | + */ |
|
| 38 | 38 | public function labels() |
| 39 | 39 | { |
| 40 | 40 | return [ |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * Settings validation rules |
|
| 49 | - */ |
|
| 48 | + * Settings validation rules |
|
| 49 | + */ |
|
| 50 | 50 | public function rules() |
| 51 | 51 | { |
| 52 | 52 | return [ |
@@ -27,9 +27,9 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function before() |
| 29 | 29 | { |
| 30 | - $this->snippet = (int)$this->_configs['snippet']; |
|
| 31 | - $this->count = (int)$this->_configs['count']; |
|
| 32 | - $this->cache = (int)$this->_configs['cache']; |
|
| 30 | + $this->snippet = (int) $this->_configs['snippet']; |
|
| 31 | + $this->count = (int) $this->_configs['count']; |
|
| 32 | + $this->cache = (int) $this->_configs['cache']; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |