@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | |
73 | 73 | // render view |
74 | 74 | return App::$View->render($this->tpl, [ |
75 | - 'records' => $query |
|
75 | + 'records' => $query |
|
76 | 76 | ]); |
77 | 77 | } |
78 | 78 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * Set default values from configs |
|
29 | - */ |
|
28 | + * Set default values from configs |
|
29 | + */ |
|
30 | 30 | public function before() |
31 | 31 | { |
32 | 32 | $this->categories = Serialize::decode($this->_configs['categories']); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Labels for form |
|
39 | - */ |
|
38 | + * Labels for form |
|
39 | + */ |
|
40 | 40 | public function labels() |
41 | 41 | { |
42 | 42 | return [ |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * Validation rules |
|
51 | - */ |
|
50 | + * Validation rules |
|
51 | + */ |
|
52 | 52 | public function rules() |
53 | 53 | { |
54 | 54 | return [ |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | - * Set default model properties from global configuration |
|
26 | - */ |
|
25 | + * Set default model properties from global configuration |
|
26 | + */ |
|
27 | 27 | public function before() |
28 | 28 | { |
29 | 29 | $this->count = (int)$this->_configs['count']; |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * Form display labels |
|
35 | - */ |
|
34 | + * Form display labels |
|
35 | + */ |
|
36 | 36 | public function labels() |
37 | 37 | { |
38 | 38 | return [ |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * Validation rules |
|
46 | - */ |
|
45 | + * Validation rules |
|
46 | + */ |
|
47 | 47 | public function rules() |
48 | 48 | { |
49 | 49 | return [ |
@@ -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 [ |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | App::$Session->getFlashBag()->add('error', __('User is never exist or password is incorrect!')); |
55 | 55 | // initialize fail event |
56 | 56 | App::$Event->run(static::EVENT_USER_LOGIN_FAIL, [ |
57 | - 'model' => $loginForm |
|
57 | + 'model' => $loginForm |
|
58 | 58 | ]); |
59 | 59 | } |
60 | 60 | |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | if ($registerForm->tryRegister($configs['registrationType'] === 1)) { |
115 | 115 | // initialize succes signup event |
116 | 116 | App::$Event->run(static::EVENT_USER_REGISTER_SUCCESS, [ |
117 | - 'model' => $registerForm |
|
117 | + 'model' => $registerForm |
|
118 | 118 | ]); |
119 | 119 | // send notification of successful registering |
120 | 120 | App::$Session->getFlashBag()->add('success', __('Your account is registered. You must confirm account via email')); |
121 | 121 | } else { |
122 | 122 | // init fail signup event |
123 | 123 | App::$Event->run(static::EVENT_USER_REGISTER_FAIL, [ |
124 | - 'model' => $registerForm |
|
124 | + 'model' => $registerForm |
|
125 | 125 | ]); |
126 | 126 | App::$Session->getFlashBag()->add('error', __('Login or email is always used on website')); |
127 | 127 | } |
@@ -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 |