11<?php
22/**
33 * Venustheme
4- *
4+ *
55 * NOTICE OF LICENSE
6- *
6+ *
77 * This source file is subject to the Venustheme.com license that is
88 * available through the world-wide-web at this URL:
99 * http://www.venustheme.com/license-agreement.html
10- *
10+ *
1111 * DISCLAIMER
12- *
12+ *
1313 * Do not edit or add to this file if you wish to upgrade this extension to newer
1414 * version in the future.
15- *
15+ *
1616 * @category Venustheme
1717 * @package Ves_Blog
1818 * @copyright Copyright (c) 2016 Venustheme (http://www.venustheme.com/)
@@ -57,11 +57,11 @@ class Latest extends \Magento\Framework\View\Element\Template
5757 protected $ _resource ;
5858
5959 /**
60- * @param \Magento\Framework\View\Element\Template\Context $context
61- * @param \Magento\Framework\Registry $registry
62- * @param \Ves\Blog\Model\Post $postFactory
63- * @param \Ves\Blog\Helper\Data $blogHelper
64- * @param array $data
60+ * @param \Magento\Framework\View\Element\Template\Context $context
61+ * @param \Magento\Framework\Registry $registry
62+ * @param \Ves\Blog\Model\Post $postFactory
63+ * @param \Ves\Blog\Helper\Data $blogHelper
64+ * @param array $data
6565 */
6666 public function __construct (
6767 \Magento \Framework \View \Element \Template \Context $ context ,
@@ -169,7 +169,7 @@ public function getCollection(){
169169 * @return $this
170170 */
171171 protected function _prepareLayout ()
172- {
172+ {
173173 $ page_title = $ this ->getConfig ('blog_latest_page/page_title ' );
174174 $ meta_description = $ this ->getConfig ('blog_latest_page/meta_description ' );
175175 $ meta_keywords = $ this ->getConfig ('blog_latest_page/meta_keywords ' );
@@ -178,13 +178,13 @@ protected function _prepareLayout()
178178 $ this ->pageConfig ->addBodyClass ('vesblog-page ' );
179179 $ this ->pageConfig ->addBodyClass ('ves-bloglatest ' );
180180 if ($ page_title ){
181- $ this ->pageConfig ->getTitle ()->set ($ page_title );
181+ $ this ->pageConfig ->getTitle ()->set ($ page_title );
182182 }
183183 if ($ meta_keywords ){
184- $ this ->pageConfig ->setKeywords ($ meta_keywords );
184+ $ this ->pageConfig ->setKeywords ($ meta_keywords );
185185 }
186186 if ($ meta_description ){
187- $ this ->pageConfig ->setDescription ($ meta_description );
187+ $ this ->pageConfig ->setDescription ($ meta_description );
188188 }
189189 return parent ::_prepareLayout ();
190190 }
@@ -205,12 +205,12 @@ public function getToolbarBlock()
205205 public function getPostsBlock ()
206206 {
207207 $ collection = $ this ->getCollection ();
208- $ block = $ this ->_postsBlock ;
208+ $ block = $ this ->_postsBlock ;
209209 $ block ->setData ($ this ->getData ())->setCollection ($ collection );
210210 $ html = $ block ->toHtml ();
211211 if ($ html ) {
212212 return $ html ;
213- }
213+ }
214214 }
215215
216216 /**
@@ -246,7 +246,8 @@ protected function _beforeToHtml()
246246 ->setCurPage (1 );
247247
248248 $ excluedCategories = $ this ->_blogHelper ->getConfig ("blog_latest_page/exclued_categories " );
249- if (trim ($ excluedCategories )) {
249+ $ excluedCategories = $ excluedCategories ? trim ($ excluedCategories ) : "" ;
250+ if ($ excluedCategories ) {
250251 $ postCollection ->getSelect ()->joinLeft (
251252 [
252253 'cat ' => $ this ->_resource ->getTableName ('ves_blog_post_category ' )],
@@ -258,7 +259,7 @@ protected function _beforeToHtml()
258259 'category_id ' => 'category_id '
259260 ]
260261 )
261- ->where ('cat.category_id NOT IN ( ' . trim ( $ excluedCategories) . ') ' );
262+ ->where ('cat.category_id NOT IN ( ' . $ excluedCategories . ') ' );
262263 }
263264 $ postCollection ->getSelect ()->order ("main_table.creation_time " . $ orderby );
264265
@@ -272,4 +273,4 @@ protected function _beforeToHtml()
272273 }
273274 return parent ::_beforeToHtml ();
274275 }
275- }
276+ }
0 commit comments