@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | $cfg = $this->getConfigs(); |
| 23 | 23 | // check cache is defined |
| 24 | 24 | if ($this->cache === null || !Obj::isLikeInt($this->cache)) { |
| 25 | - $this->cache = (int)$cfg['cache']; |
|
| 25 | + $this->cache = (int) $cfg['cache']; |
|
| 26 | 26 | } |
| 27 | 27 | // check tag count is defined |
| 28 | 28 | if ($this->count === null || !Obj::isLikeInt($this->count)) { |
| 29 | - $this->count = (int)$cfg['count']; |
|
| 29 | + $this->count = (int) $cfg['count']; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | if ($this->cache === 0) { |
| 41 | 41 | $records = $this->makeQuery(); |
| 42 | 42 | } else { |
| 43 | - $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
| 43 | + $records === App::$Cache->get('widget.contenttag.'.$classHash); |
|
| 44 | 44 | if ($records === null) { |
| 45 | 45 | $records = $this->makeQuery(); |
| 46 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
| 46 | + App::$Cache->set('widget.contenttag'.$classHash, $records, $this->cache); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Make query to database |
| 81 | - * @return object |
|
| 81 | + * @return string |
|
| 82 | 82 | */ |
| 83 | 83 | private function makeQuery() |
| 84 | 84 | { |
@@ -10,18 +10,18 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | class Contenttag extends AbstractWidget |
| 12 | 12 | { |
| 13 | - use OopTools; |
|
| 13 | + use OopTools; |
|
| 14 | 14 | |
| 15 | - public $count; |
|
| 16 | - public $cache; |
|
| 15 | + public $count; |
|
| 16 | + public $cache; |
|
| 17 | 17 | |
| 18 | - public $tpl = 'widgets/contenttag/default'; |
|
| 18 | + public $tpl = 'widgets/contenttag/default'; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Set default configurations if not defined |
|
| 22 | - * {@inheritDoc} |
|
| 23 | - * @see \Ffcms\Core\Arch\Widget::init() |
|
| 24 | - */ |
|
| 20 | + /** |
|
| 21 | + * Set default configurations if not defined |
|
| 22 | + * {@inheritDoc} |
|
| 23 | + * @see \Ffcms\Core\Arch\Widget::init() |
|
| 24 | + */ |
|
| 25 | 25 | public function init() |
| 26 | 26 | { |
| 27 | 27 | $cfg = $this->getConfigs(); |
@@ -43,29 +43,29 @@ discard block |
||
| 43 | 43 | public function display() |
| 44 | 44 | { |
| 45 | 45 | // get special properties hash |
| 46 | - $classHash = $this->createStringClassSnapshotHash(); |
|
| 46 | + $classHash = $this->createStringClassSnapshotHash(); |
|
| 47 | 47 | |
| 48 | - // get records rows from cache or directly from db |
|
| 49 | - $records = null; |
|
| 50 | - if ($this->cache === 0) { |
|
| 51 | - $records = $this->makeQuery(); |
|
| 52 | - } else { |
|
| 53 | - $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
| 54 | - if ($records === null) { |
|
| 55 | - $records = $this->makeQuery(); |
|
| 56 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
| 57 | - } |
|
| 58 | - } |
|
| 48 | + // get records rows from cache or directly from db |
|
| 49 | + $records = null; |
|
| 50 | + if ($this->cache === 0) { |
|
| 51 | + $records = $this->makeQuery(); |
|
| 52 | + } else { |
|
| 53 | + $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
| 54 | + if ($records === null) { |
|
| 55 | + $records = $this->makeQuery(); |
|
| 56 | + App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - // check if result is not empty |
|
| 60 | + // check if result is not empty |
|
| 61 | 61 | if ($records === null || $records->count() < 1) { |
| 62 | 62 | return __('Content tags is not found'); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // render view |
| 66 | - return App::$View->render($this->tpl, [ |
|
| 67 | - 'records' => $records |
|
| 68 | - ]); |
|
| 66 | + return App::$View->render($this->tpl, [ |
|
| 67 | + 'records' => $records |
|
| 68 | + ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | private function makeQuery() |
| 76 | 76 | { |
| 77 | 77 | return TagRecord::select([ |
| 78 | - App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
| 79 | - App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
| 80 | - ])->groupBy('tag') |
|
| 81 | - ->orderBy('count', 'DESC') |
|
| 82 | - ->take($this->count) |
|
| 83 | - ->get(); |
|
| 78 | + App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
| 79 | + App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
| 80 | + ])->groupBy('tag') |
|
| 81 | + ->orderBy('count', 'DESC') |
|
| 82 | + ->take($this->count) |
|
| 83 | + ->get(); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | // this environment is based on json response type |
| 13 | 13 | define('env_type', 'json'); |
| 14 | 14 | |
| 15 | -require_once(root . '/Loader/Autoload.php'); |
|
| 15 | +require_once(root.'/Loader/Autoload.php'); |
|
| 16 | 16 | |
| 17 | 17 | // make fast-access alias \App::$Object |
| 18 | 18 | // class_alias('Ffcms\Core\App', 'App'); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | // this environment is based on json response type |
| 13 | 13 | define('env_type', 'json'); |
| 14 | 14 | |
| 15 | -require_once(root . '/Loader/Autoload.php'); |
|
| 15 | +require_once(root.'/Loader/Autoload.php'); |
|
| 16 | 16 | |
| 17 | 17 | // make fast-access alias \App::$Object |
| 18 | 18 | // class_alias('Ffcms\Core\App', 'App'); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | // this environment is based on json response type |
| 13 | 13 | define('env_type', 'json'); |
| 14 | 14 | |
| 15 | -require_once(root . '/Loader/Autoload.php'); |
|
| 15 | +require_once(root.'/Loader/Autoload.php'); |
|
| 16 | 16 | |
| 17 | 17 | // make fast-access alias \App::$Object |
| 18 | 18 | // class_alias('Ffcms\Core\App', 'App'); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | // render view output |
| 31 | 31 | return App::$View->render('index', [ |
| 32 | - 'model' => $model |
|
| 32 | + 'model' => $model |
|
| 33 | 33 | ]); |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | <?php if ($useCaptcha === true) { |
| 32 | 32 | if (\App::$Captcha->isFull()) { |
| 33 | - echo '<div class="col-md-offset-3 col-md-9">' . \App::$Captcha->get() . '</div>'; |
|
| 33 | + echo '<div class="col-md-offset-3 col-md-9">'.\App::$Captcha->get().'</div>'; |
|
| 34 | 34 | } else { |
| 35 | 35 | echo $form->field('captcha', 'captcha', ['class' => 'form-control'], __('Enter data from security image to prove that you are human. If you can\'t read symbols - click on image to reload')); |
| 36 | 36 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | <?php if ($useCaptcha === true) { |
| 32 | 32 | if (\App::$Captcha->isFull()) { |
| 33 | - echo '<div class="col-md-offset-3 col-md-9">' . \App::$Captcha->get() . '</div>'; |
|
| 33 | + echo '<div class="col-md-offset-3 col-md-9">'.\App::$Captcha->get().'</div>'; |
|
| 34 | 34 | } else { |
| 35 | 35 | echo $form->field('captcha', 'captcha', ['class' => 'form-control'], __('Enter data from security image to prove that you are human. If you can\'t read symbols - click on image to reload')); |
| 36 | 36 | } |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | if (Obj::isArray($notify) && count($notify) > 0) { |
| 31 | 31 | foreach ($notify as $type => $messages) { |
| 32 | 32 | foreach ($messages as $message) { |
| 33 | - echo '<p class="alert ' . type2html($type) . '"> |
|
| 33 | + echo '<p class="alert '.type2html($type).'"> |
|
| 34 | 34 | <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' |
| 35 | - . \Ffcms\Core\App::$Security->strip_tags($message) . '</p>'; |
|
| 35 | + . \Ffcms\Core\App::$Security->strip_tags($message).'</p>'; |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -5,5 +5,5 @@ |
||
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | 7 | <?php foreach ($records as $row) { |
| 8 | - echo Url::link(['content/tag', $row['tag']], $row['tag'], ['class' => 'label label-default']) . ' '; |
|
| 8 | + echo Url::link(['content/tag', $row['tag']], $row['tag'], ['class' => 'label label-default']).' '; |
|
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file |