@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Apps\ActiveRecord; |
4 | 4 | |
5 | -use Ffcms\Core\App as AppMain; |
|
6 | 5 | use Ffcms\Core\Arch\ActiveModel; |
7 | 6 | use Ffcms\Core\Helper\FileSystem\File; |
8 | 7 | use Ffcms\Core\Helper\Type\Str; |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use Ffcms\Core\Helper\Type\Str; |
16 | 16 | use Gregwar\Image\Image; |
17 | 17 | use Apps\ActiveRecord\Content as ContentRecord; |
18 | -use Apps\ActiveRecord\ContentRating; |
|
19 | 18 | use Apps\Model\Api\Content\ContentRatingChange; |
20 | 19 | |
21 | 20 | class Content extends ApiController |
@@ -100,12 +100,12 @@ |
||
100 | 100 | </div> |
101 | 101 | <div class="meta"> |
102 | 102 | <?php if ((int)$catConfigs['showRating'] === 1) { |
103 | - echo \App::$View->render('content/_rate', [ |
|
104 | - 'id' => $item['id'], |
|
105 | - 'canRate' => $item['canRate'], |
|
106 | - 'rating' => $item['rating'] |
|
107 | - ]); |
|
108 | - } ?> |
|
103 | + echo \App::$View->render('content/_rate', [ |
|
104 | + 'id' => $item['id'], |
|
105 | + 'canRate' => $item['canRate'], |
|
106 | + 'rating' => $item['rating'] |
|
107 | + ]); |
|
108 | + } ?> |
|
109 | 109 | |
110 | 110 | <span class="spaced hidden-xs"><i class="fa fa-comments"></i> |
111 | 111 | <a href="#"><?= __('Comments') ?>: <span itemprop="commentCount">0</span></a> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | $catConfigs = []; |
17 | 17 | foreach ($model->category['configs'] as $key=>$value) { |
18 | - $catConfigs[$key] = (int)$value === 1; |
|
18 | + $catConfigs[$key] = (int) $value === 1; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $catMeta = [ |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | </div> |
100 | 100 | </div> |
101 | 101 | <div class="meta"> |
102 | - <?php if ((int)$catConfigs['showRating'] === 1) { |
|
102 | + <?php if ((int) $catConfigs['showRating'] === 1) { |
|
103 | 103 | echo \App::$View->render('content/_rate', [ |
104 | 104 | 'id' => $item['id'], |
105 | 105 | 'canRate' => $item['canRate'], |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | <a href="#"><?= __('Comments') ?>: <span itemprop="commentCount">0</span></a> |
112 | 112 | </span> |
113 | 113 | <span class="pull-right"> |
114 | - <?php if ((int)$configs['keywordsAsTags'] === 1 && $item['tags'] !== null && Obj::isArray($item['tags'])): ?> |
|
114 | + <?php if ((int) $configs['keywordsAsTags'] === 1 && $item['tags'] !== null && Obj::isArray($item['tags'])): ?> |
|
115 | 115 | <span class="spaced"><i class="fa fa-tags hidden-xs"></i> |
116 | 116 | <?php |
117 | 117 | foreach ($item['tags'] as $tag) { |
@@ -159,12 +159,12 @@ |
||
159 | 159 | <div class="col-md-12"> |
160 | 160 | <div class="pull-left"> |
161 | 161 | <?php if ($properties['rating']) { |
162 | - echo \App::$View->render('content/_rate', [ |
|
163 | - 'id' => $model->id, |
|
164 | - 'rating' => $model->rating, |
|
165 | - 'canRate' => $model->canRate |
|
166 | - ]); |
|
167 | - } ?> |
|
162 | + echo \App::$View->render('content/_rate', [ |
|
163 | + 'id' => $model->id, |
|
164 | + 'rating' => $model->rating, |
|
165 | + 'canRate' => $model->canRate |
|
166 | + ]); |
|
167 | + } ?> |
|
168 | 168 | <?= \App::$View->render('content/_rateJs') ?> |
169 | 169 | </div> |
170 | 170 | <div class="pull-right"> |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | $properties = [ |
45 | - 'date' => (int)$model->getCategory()->getProperty('showDate') === 1, |
|
46 | - 'author' => (int)$model->getCategory()->getProperty('showAuthor') === 1, |
|
47 | - 'views' => (int)$model->getCategory()->getProperty('showViews') === 1, |
|
48 | - 'category' => (int)$model->getCategory()->getProperty('showCategory') === 1, |
|
49 | - 'rating' => (int)$model->getCategory()->getProperty('showRating') === 1 |
|
45 | + 'date' => (int) $model->getCategory()->getProperty('showDate') === 1, |
|
46 | + 'author' => (int) $model->getCategory()->getProperty('showAuthor') === 1, |
|
47 | + 'views' => (int) $model->getCategory()->getProperty('showViews') === 1, |
|
48 | + 'category' => (int) $model->getCategory()->getProperty('showCategory') === 1, |
|
49 | + 'rating' => (int) $model->getCategory()->getProperty('showRating') === 1 |
|
50 | 50 | ]; |
51 | -$showComments = (int)$model->getCategory()->getProperty('showComments') === 1; |
|
52 | -$showPoster = (int)$model->getCategory()->getProperty('showPoster') === 1; |
|
51 | +$showComments = (int) $model->getCategory()->getProperty('showComments') === 1; |
|
52 | +$showPoster = (int) $model->getCategory()->getProperty('showPoster') === 1; |
|
53 | 53 | |
54 | 54 | \App::$Cache->set('test.me.baby.1', ['key' => 'value']); |
55 | 55 | ?> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | </div> |
105 | 105 | </div> |
106 | 106 | </div> |
107 | - <?php endif ;?> |
|
107 | + <?php endif; ?> |
|
108 | 108 | <?= $model->text ?> |
109 | 109 | </div> |
110 | 110 | <?php if ($model->galleryItems !== null && Obj::isArray($model->galleryItems)): ?> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | <?= \App::$View->render('content/_rateJs') ?> |
169 | 169 | </div> |
170 | 170 | <div class="pull-right"> |
171 | - <?php if ((int)$configs['keywordsAsTags'] === 1): ?> |
|
171 | + <?php if ((int) $configs['keywordsAsTags'] === 1): ?> |
|
172 | 172 | <div id="content-tags"> |
173 | 173 | <?php |
174 | 174 | if (Obj::isArray($model->metaKeywords) && count($model->metaKeywords) > 0 && Str::length($model->metaKeywords[0]) > 0) { |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if ($rating > 0) { |
9 | 9 | $cssRatingClass = 'label-success'; |
10 | 10 | $numericRating = '+' . $rating; |
11 | -} elseif($rating < 0) { |
|
11 | +} elseif ($rating < 0) { |
|
12 | 12 | $cssRatingClass = 'label-danger'; |
13 | 13 | $numericRating = $rating; |
14 | 14 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $this->source = $this->_content->source; |
98 | - $this->views = $this->_content->views+1; |
|
98 | + $this->views = $this->_content->views + 1; |
|
99 | 99 | // check for dependence, add '' for general cat, ex: general/depend1/depend2/.../depend-n |
100 | 100 | $catNestingArray = Arr::merge([0 => ''], explode('/', $this->catPath)); |
101 | 101 | if ($catNestingArray > 1) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $this->rating = $this->_content->rating; |
170 | 170 | $ignoredRate = App::$Session->get('content.rate.ignore'); |
171 | 171 | $this->canRate = true; |
172 | - if (Obj::isArray($ignoredRate) && Arr::in((string)$this->id, $ignoredRate)) { |
|
172 | + if (Obj::isArray($ignoredRate) && Arr::in((string) $this->id, $ignoredRate)) { |
|
173 | 173 | $this->canRate = false; |
174 | 174 | } |
175 | 175 | if (!App::$User->isAuth()) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $this->_path = $path; |
55 | 55 | $this->_configs = $configs; |
56 | - $this->_page = (int)$offset; |
|
56 | + $this->_page = (int) $offset; |
|
57 | 57 | parent::__construct(); |
58 | 58 | } |
59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function before() |
66 | 66 | { |
67 | 67 | // find one or more categories where we must looking for content items |
68 | - if ((int)$this->_configs['multiCategories'] === 1) { |
|
68 | + if ((int) $this->_configs['multiCategories'] === 1) { |
|
69 | 69 | $this->findCategories(); |
70 | 70 | } else { |
71 | 71 | $this->findCategory(); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | // calculate selection offset |
138 | - $itemPerPage = (int)$this->_configs['itemPerCategory']; |
|
138 | + $itemPerPage = (int) $this->_configs['itemPerCategory']; |
|
139 | 139 | if ($itemPerPage < 1) { |
140 | 140 | $itemPerPage = 1; |
141 | 141 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | ]; |
169 | 169 | |
170 | 170 | // check if this category is hidden |
171 | - if ((int)$this->category['configs']['showCategory'] !== 1) { |
|
171 | + if ((int) $this->category['configs']['showCategory'] !== 1) { |
|
172 | 172 | throw new ForbiddenException(__('This category is not available to view')); |
173 | 173 | } |
174 | 174 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | // check if current user can rate item |
213 | 213 | $ignoredRate = App::$Session->get('content.rate.ignore'); |
214 | 214 | $canRate = true; |
215 | - if (Obj::isArray($ignoredRate) && Arr::in((string)$row->id, $ignoredRate)) { |
|
215 | + if (Obj::isArray($ignoredRate) && Arr::in((string) $row->id, $ignoredRate)) { |
|
216 | 216 | $canRate = false; |
217 | 217 | } |
218 | 218 | if (!App::$User->isAuth()) { |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | 'poster' => $row->getPosterUri(), |
230 | 230 | 'thumb' => $row->getPosterThumbUri(), |
231 | 231 | 'thumbSize' => File::size($row->getPosterThumbUri()), |
232 | - 'views' => (int)$row->views, |
|
233 | - 'rating' => (int)$row->rating, |
|
232 | + 'views' => (int) $row->views, |
|
233 | + 'rating' => (int) $row->rating, |
|
234 | 234 | 'canRate' => $canRate, |
235 | 235 | 'category' => $this->categories[$row->category_id], |
236 | 236 | 'uri' => '/content/read/' . $itemPath, |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | App::$Session->set('content.rate.ignore', $ignored); |
65 | 65 | |
66 | 66 | // save rating changes to database |
67 | - switch($this->_type) { |
|
67 | + switch ($this->_type) { |
|
68 | 68 | case 'plus': |
69 | 69 | $this->_content->rating += 1; |
70 | 70 | break; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $this->_content->save(); |
77 | 77 | |
78 | 78 | // update content author rating |
79 | - $authorId = (int)$this->_content->author_id; |
|
79 | + $authorId = (int) $this->_content->author_id; |
|
80 | 80 | if ($authorId > 0 && App::$User->isExist($authorId)) { |
81 | 81 | $authorObject = App::$User->identity($authorId); |
82 | 82 | if ($authorObject !== null) { |