Nickbur /
Sunrise-CMS
| 1 | <?php |
||||
| 2 | |||||
| 3 | /* Divine CMS - Open source CMS for widespread use. |
||||
| 4 | Copyright (c) 2019 Mykola Burakov ([email protected]) |
||||
| 5 | |||||
| 6 | See SOURCE.txt for other and additional information. |
||||
| 7 | |||||
| 8 | This file is part of Divine CMS. |
||||
| 9 | |||||
| 10 | This program is free software: you can redistribute it and/or modify |
||||
| 11 | it under the terms of the GNU General Public License as published by |
||||
| 12 | the Free Software Foundation, either version 3 of the License, or |
||||
| 13 | (at your option) any later version. |
||||
| 14 | |||||
| 15 | This program is distributed in the hope that it will be useful, |
||||
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
| 18 | GNU General Public License for more details. |
||||
| 19 | |||||
| 20 | You should have received a copy of the GNU General Public License |
||||
| 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
||||
| 22 | |||||
| 23 | class ControllerExtensionModuleBlogPopular extends \Divine\Engine\Core\Controller |
||||
|
0 ignored issues
–
show
|
|||||
| 24 | { |
||||
| 25 | public function index($setting) |
||||
|
0 ignored issues
–
show
|
|||||
| 26 | { |
||||
| 27 | $this->load->language('extension/module/blog_popular'); |
||||
| 28 | |||||
| 29 | $data['heading_title'] = $this->language->get('heading_title'); |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
| 30 | |||||
| 31 | $data['text_views'] = $this->language->get('text_views'); |
||||
| 32 | $data['button_more'] = $this->language->get('button_more'); |
||||
| 33 | |||||
| 34 | $this->load->model('blog/article'); |
||||
| 35 | |||||
| 36 | |||||
| 37 | |||||
| 38 | $data['articles'] = array(); |
||||
| 39 | |||||
| 40 | $filter_data = array( |
||||
| 41 | 'sort' => 'p.viewed', |
||||
| 42 | 'order' => 'DESC', |
||||
| 43 | 'start' => 0, |
||||
| 44 | 'limit' => $setting['limit'] |
||||
| 45 | ); |
||||
| 46 | |||||
| 47 | $results = $this->model_blog_article->getArticles($filter_data); |
||||
| 48 | |||||
| 49 | if ($results) { |
||||
| 50 | foreach ($results as $result) { |
||||
| 51 | if ($result['image']) { |
||||
| 52 | $image = '/public_html/assets/images/' . $result['image']; |
||||
| 53 | } else { |
||||
| 54 | $image = '/public_html/assets/images/no_image.png'; |
||||
| 55 | } |
||||
| 56 | |||||
| 57 | $data['configblog_review_status'] = $this->config->get('configblog_review_status'); |
||||
| 58 | |||||
| 59 | $data['articles'][] = array( |
||||
| 60 | 'article_id' => $result['article_id'], |
||||
| 61 | 'thumb' => $image, |
||||
| 62 | 'name' => $result['name'], |
||||
| 63 | 'description' => \voku\helper\UTF8::substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get('configblog_article_description_length')) . '..', |
||||
|
0 ignored issues
–
show
Are you sure
voku\helper\UTF8::substr...e_description_length')) of type false|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 64 | 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), |
||||
| 65 | 'viewed' => $result['viewed'], |
||||
| 66 | 'reviews' => sprintf($this->language->get('text_reviews'), (int)$result['reviews']), |
||||
| 67 | 'href' => $this->url->link('blog/article', 'article_id=' . $result['article_id']), |
||||
| 68 | ); |
||||
| 69 | } |
||||
| 70 | |||||
| 71 | return $this->load->view('extension/module/blog_popular', $data); |
||||
| 72 | } |
||||
| 73 | } |
||||
| 74 | } |
||||
| 75 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.