@@ -10,21 +10,21 @@ discard block |
||
10 | 10 | |
11 | 11 | class Contenttag extends AbstractWidget |
12 | 12 | { |
13 | - use ClassTools; |
|
13 | + use ClassTools; |
|
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 | - private $_lang; |
|
20 | + private $_lang; |
|
21 | 21 | private $_cacheName; |
22 | 22 | |
23 | - /** |
|
24 | - * Set default configurations if not defined |
|
25 | - * {@inheritDoc} |
|
26 | - * @see \Ffcms\Core\Arch\Widget::init() |
|
27 | - */ |
|
23 | + /** |
|
24 | + * Set default configurations if not defined |
|
25 | + * {@inheritDoc} |
|
26 | + * @see \Ffcms\Core\Arch\Widget::init() |
|
27 | + */ |
|
28 | 28 | public function init() |
29 | 29 | { |
30 | 30 | $cfg = $this->getConfigs(); |
@@ -50,27 +50,27 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function display() |
52 | 52 | { |
53 | - // get records rows from cache or directly from db |
|
54 | - $records = null; |
|
55 | - if ($this->cache === 0) { |
|
56 | - $records = $this->makeQuery(); |
|
57 | - } else { |
|
58 | - $records = App::$Cache->get($this->_cacheName); |
|
53 | + // get records rows from cache or directly from db |
|
54 | + $records = null; |
|
55 | + if ($this->cache === 0) { |
|
56 | + $records = $this->makeQuery(); |
|
57 | + } else { |
|
58 | + $records = App::$Cache->get($this->_cacheName); |
|
59 | 59 | if ($records === null) { |
60 | - $records = $this->makeQuery(); |
|
61 | - App::$Cache->set($this->_cacheName, $records, $this->cache); |
|
62 | - } |
|
63 | - } |
|
60 | + $records = $this->makeQuery(); |
|
61 | + App::$Cache->set($this->_cacheName, $records, $this->cache); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - // check if result is not empty |
|
65 | + // check if result is not empty |
|
66 | 66 | if ($records === null || $records->count() < 1) { |
67 | 67 | return __('Content tags is not found'); |
68 | 68 | } |
69 | 69 | |
70 | 70 | // render view |
71 | - return App::$View->render($this->tpl, [ |
|
72 | - 'records' => $records |
|
73 | - ]); |
|
71 | + return App::$View->render($this->tpl, [ |
|
72 | + 'records' => $records |
|
73 | + ]); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | private function makeQuery() |
81 | 81 | { |
82 | 82 | return TagRecord::select([ |
83 | - App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
84 | - App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
85 | - ])->where('lang', '=', $this->_lang) |
|
83 | + App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
84 | + App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
85 | + ])->where('lang', '=', $this->_lang) |
|
86 | 86 | ->groupBy('tag') |
87 | - ->orderBy('count', 'DESC') |
|
88 | - ->take($this->count) |
|
89 | - ->get(); |
|
87 | + ->orderBy('count', 'DESC') |
|
88 | + ->take($this->count) |
|
89 | + ->get(); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php return [ |
2 | - 'instances' => [ |
|
3 | - 'Apps\Controller\Front\Content::buildSitemapSchedule' => 10800, |
|
4 | - 'Apps\Controller\Front\Profile::buildSitemapSchedule' => 10800, |
|
5 | - 'Apps\Controller\Front\Profile::cleanupTablesSchedule' => 86400 |
|
6 | - ] |
|
2 | + 'instances' => [ |
|
3 | + 'Apps\Controller\Front\Content::buildSitemapSchedule' => 10800, |
|
4 | + 'Apps\Controller\Front\Profile::buildSitemapSchedule' => 10800, |
|
5 | + 'Apps\Controller\Front\Profile::cleanupTablesSchedule' => 86400 |
|
6 | + ] |
|
7 | 7 | ]; |
8 | 8 | \ No newline at end of file |