コード例 #1
0
ファイル: install-2.0.1.php プロジェクト: zangles/lennyba
function upgrade_module_2_0_1($object)
{
    upgrade_addquickaccess();
    Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'smart_blog_post` ADD is_featured int(11) DEFAULT NULL');
    $smartblog = new smartblog();
    $smartblog->registerHook('displayBackOfficeHeader');
    $smartblog->SmartHookInsert();
    Configuration::updateGlobalValue('smartshowviewed', '1');
    Configuration::updateGlobalValue('smartcaptchaoption', '1');
    Configuration::updateGlobalValue('smartdisablecatimg', '1');
    return true;
}
コード例 #2
0
ファイル: smartblog.php プロジェクト: johnulist/smartblog
 public static function getToltalFeed($id_lang)
 {
     $result = array();
     $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'smart_blog_post_lang pl, ' . _DB_PREFIX_ . 'smart_blog_post p 
             WHERE pl.id_lang=' . $id_lang . ' and p.active = 1 AND pl.id_smart_blog_post=p.id_smart_blog_post 
             ORDER BY p.id_smart_blog_post DESC';
     if (!($posts = Db::getInstance()->executeS($sql))) {
         return false;
     }
     $i = 0;
     $BlogCategory = new BlogCategory();
     foreach ($posts as $post) {
         $result[$i]['id_post'] = $post['id_smart_blog_post'];
         $result[$i]['viewed'] = $post['viewed'];
         $result[$i]['meta_title'] = $post['meta_title'];
         $result[$i]['meta_description'] = $post['meta_description'];
         $result[$i]['short_description'] = $post['short_description'];
         $result[$i]['content'] = $post['content'];
         $result[$i]['meta_keyword'] = $post['meta_keyword'];
         //$result[$i]['id_category'] = $post['id_category'];
         $result[$i]['link_rewrite'] = $post['link_rewrite'];
         //$result[$i]['cat_link_rewrite'] = $BlogCategory->getCatLinkRewrite($post['id_category']);
         $employee = new Employee($post['id_author']);
         $result[$i]['lastname'] = $employee->lastname;
         $result[$i]['firstname'] = $employee->firstname;
         if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/' . $post['id_smart_blog_post'] . '.jpg')) {
             $image = $post['id_smart_blog_post'];
             $result[$i]['post_img'] = $image;
         } else {
             $result[$i]['post_img'] = 'no';
         }
         $options = array();
         $options['id_post'] = $post['id_smart_blog_post'];
         $options['slug'] = $post['link_rewrite'];
         $result[$i]['created'] = $post['created'];
         $result[$i]['blink'] = smartblog::GetSmartBlogLink('smartblog_post', $options);
         $i++;
     }
     return $result;
 }
コード例 #3
0
 public function getPreviewUrl(SmartBlogPost $smart_blog_post)
 {
     $id_lang = Configuration::get('PS_LANG_DEFAULT', null, null, Context::getContext()->shop->id);
     if (!ShopUrl::getMainShopDomain()) {
         return false;
     }
     $is_rewrite_active = (bool) Configuration::get('PS_REWRITING_SETTINGS');
     $blog_url = $preview_url = smartblog::GetSmartBlogLink('smartblog_post', array('id_post' => $smart_blog_post->id, 'slug' => $smart_blog_post->link_rewrite[$id_lang]));
     if (!$smart_blog_post->active) {
         $admin_dir = dirname($_SERVER['PHP_SELF']);
         $admin_dir = substr($admin_dir, strrpos($admin_dir, '/') + 1);
         $preview_url .= (strpos($preview_url, '?') === false ? '?' : '&') . 'adtoken=' . $this->token . '&ad=' . $admin_dir . '&id_employee=' . (int) $this->context->employee->id;
     }
     return $preview_url;
 }
コード例 #4
0
ファイル: smartblog.php プロジェクト: Beattle/perrino-shop
 public static function GetSmartBlogLink($rewrite = 'smartblog', $params = null, $id_shop = null, $id_lang = null)
 {
     $url = smartblog::GetSmartBlogUrl();
     $dispatcher = Dispatcher::getInstance();
     if ($params != null) {
         return $url . $dispatcher->createUrl($rewrite, $id_lang, $params);
     } else {
         return $url . $dispatcher->createUrl($rewrite);
     }
 }
コード例 #5
0
ファイル: SmartBlogLink.php プロジェクト: johnulist/smartblog
 public function getSmartBlogTag($tagName)
 {
     $rewrite = 'smartblog_tag';
     $params = array();
     $params['tag'] = $tagName;
     $url = smartblog::GetSmartBlogUrl();
     $dispatcher = Dispatcher::getInstance();
     $id_lang = (int) Context::getContext()->language->id;
     if ($params != null) {
         return $url . $dispatcher->createUrl($rewrite, $id_lang, $params, $this->allow);
     } else {
         $params = array();
         return $url . $dispatcher->createUrl($rewrite, $id_lang, $params, $this->allow);
     }
 }
コード例 #6
0
ファイル: install-2.1.0.php プロジェクト: johnulist/smartblog
function upgrade_module_2_1_0($object)
{
    Configuration::updateGlobalValue('smartdataformat', 'm/d/Y H:i:s');
    upgrade_addquickaccess();
    $smartblog = new smartblog();
    $smartblog->registerHook('actionsbdeletecat');
    $smartblog->registerHook('actionsbnewcat');
    $smartblog->registerHook('actionsbupdatecat');
    $smartblog->registerHook('actionsbtogglecat');
    $smartblog->registerHook('actionsbdeletepost');
    $smartblog->registerHook('actionsbnewpost');
    $smartblog->registerHook('actionsbupdatepost');
    $smartblog->registerHook('actionsbtogglepost');
    $smartblog->registerHook('actionHtaccessCreate');
    $smartblog->registerHook('displaySmartBlogLeft');
    $smartblog->registerHook('displaySmartBlogRight');
    $smartblog->registerHook('displaySmartBeforePost');
    $smartblog->registerHook('displaySmartAfterPost');
    Configuration::updateGlobalValue('smartshowviewed', '1');
    Configuration::updateGlobalValue('smartcaptchaoption', '1');
    Configuration::updateGlobalValue('smartdisablecatimg', '1');
    //----------------------------------------------------------------------------------
    Db::getInstance()->execute('DROP TABLE `' . _DB_PREFIX_ . 'smart_blog_product_related`');
    //----------------------------------------------------------------------------------
    Db::getInstance()->execute('ALTER TABLE  `' . _DB_PREFIX_ . 'smart_blog_post_category` CHANGE `id_smart_blog_post_category` `id_smart_blog_post` INT(11) NOT NULL');
    Db::getInstance()->execute('ALTER TABLE `' . _DB_PREFIX_ . 'smart_blog_post_category` ADD PRIMARY KEY( `id_smart_blog_post`, `id_smart_blog_category`)');
    $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT  id_smart_blog_post	, id_category  FROM ' . _DB_PREFIX_ . 'smart_blog_post ');
    $res = null;
    foreach ($results as $result) {
        $sql = 'INSERT INTO `' . _DB_PREFIX_ . 'smart_blog_post_category` (`id_smart_blog_post`, `id_smart_blog_category`) VALUES (' + $result['id_smart_blog_post'] + ', ' + $result['id_category'] + ')';
        //  $res .= Db::getInstance()->execute($sql);
    }
    //-------------------------------------------------------------------------------------
    $results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
			SELECT  id_smart_blog_post	, id_category  FROM ' . _DB_PREFIX_ . 'smart_blog_post ');
    foreach ($results as $result) {
        Db::getInstance()->insert('smart_blog_post_category', array('id_smart_blog_post' => (int) $result['id_smart_blog_post'], 'id_smart_blog_category' => (int) $result['id_category']));
    }
    //--------------------------------------------------------------------------------------
    $id_tab = (int) Tab::getIdFromClassName('AdminSmartBlogAjax');
    if (!$id_tab) {
        $tab = new Tab();
        $tab->active = 1;
        $tab->class_name = 'AdminSmartBlogAjax';
        $tab->name = array();
        foreach (Language::getLanguages(true) as $lang) {
            $tab->name[$lang['id_lang']] = 'SmartBlogAjax';
        }
        $tab->id_parent = -1;
        $tab->module = $object->name;
        $tab->add();
    }
    //--------------------------------------------------------------------------------------
    $sql = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'smart_blog_gallary_images` (
      `id_smart_blog_gallary_images` INT(11) NOT NULL AUTO_INCREMENT,
      `id_smart_blog_post` int(11) NOT NULL,
      `position` int(11) NOT NULL,
       PRIMARY KEY (`id_smart_blog_gallary_images`,`id_smart_blog_post`)
    ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
    Db::getInstance()->execute($sql);
    $sql1 = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'smart_blog_gallary_images_lang` (
        `id_smart_blog_gallary_images` INT(11) NOT NULL,
        `id_lang` int(11) NOT NULL,
        `legend` varchar(256) NOT NULL,
        PRIMARY KEY (`id_smart_blog_gallary_images`,`id_lang`)
        ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8';
    Db::getInstance()->execute($sql1);
    // Changes for shop table
    $tables = array(_DB_PREFIX_ . 'smart_blog_category_shop' => 'id_smart_blog_category_shop', _DB_PREFIX_ . 'smart_blog_comment_shop' => 'id_smart_blog_comment_shop', _DB_PREFIX_ . 'smart_blog_post_shop' => 'id_smart_blog_post_shop');
    $sqltorun = '';
    foreach ($tables as $table => $col) {
        $test = Db::getInstance()->executeS("SHOW COLUMNS from `{$table}` WHERE FIELD LIKE '{$col}'", true, false);
        if (count($test)) {
            $sqltorun .= "ALTER TABLE `{$table}` DROP COLUMN `{$col}`;\n";
        }
    }
    if (!empty($sqltorun)) {
        Db::getInstance()->execute($sqltorun);
    }
    //--------------------------------------------------------------------------------------
    $test = Db::getInstance()->executeS("SHOW COLUMNS from `" . _DB_PREFIX_ . "smart_blog_post` WHERE FIELD LIKE 'associations'", true, false);
    if (!count($test)) {
        Db::getInstance()->execute('ALTER TABLE  `' . _DB_PREFIX_ . 'smart_blog_post` ADD `associations` TEXT NOT NULL AFTER `comment_status`');
    }
    //--------------------------------------------------------------------------------------
    Configuration::updateGlobalValue('smartenableguestcomment', '1');
    //--------------------------------------------------------------------------------------
    Db::getInstance()->execute('CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'smart_blog_post_meta` (  
  `id_smart_blog_post_meta` int(11) NOT NULL auto_increment,
  `id_smart_blog_post` int(11) NOT NULL,  
  `meta_key` VARCHAR(50) NOT NULL,  
  `meta_value` LONGTEXT,  
    PRIMARY KEY (`id_smart_blog_post_meta`, `id_smart_blog_post`),
    KEY `id_smart_blog_post` (`id_smart_blog_post`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8');
    //--------------------------------------------------------------------------------------
    Configuration::updateGlobalValue('smartblogurlpattern', '2');
    Configuration::updateGlobalValue('smartshowhomepost', 4);
    Configuration::updateGlobalValue('smartshowrelatedproduct', 5);
    Configuration::updateGlobalValue('smartshowrelatedproductpost', 5);
    Configuration::updateGlobalValue('smart_update_period', 'hourly');
    Configuration::updateGlobalValue('smart_update_frequency', '1');
    Configuration::updateGlobalValue('smartshowrelatedpost', 3);
    Configuration::updateGlobalValue('sort_category_by', 'id_desc');
    Configuration::updateGlobalValue('latestnews_sort_by', 'id_desc');
    //--------------------------------------------------------------------------------------
    return true;
}
コード例 #7
0
ファイル: details.php プロジェクト: johnulist/smartblog
 public function initContent()
 {
     $smartblogurlpattern = (int) Configuration::get('smartblogurlpattern');
     //now we will check whihc option we need to url rewrite
     $id_post = null;
     switch ($smartblogurlpattern) {
         case 1:
             $SmartBlog = new smartblog();
             $slug = Tools::getValue('slug');
             $id_post = $SmartBlog->slug2id($slug);
             break;
         case 2:
             $id_post = pSQL(Tools::getvalue('id_post'));
             break;
         case 3:
             $id_post = pSQL(Tools::getvalue('id_post'));
             break;
         default:
             $id_post = pSQL(Tools::getvalue('id_post'));
     }
     if ($id_post) {
         $this->post = new SmartBlogPost($id_post, true, $this->context->language->id, $this->context->shop->id);
     }
     if (!Validate::isLoadedObject($this->post)) {
         header('HTTP/1.1 404 Not Found');
         header('Status: 404 Not Found');
         $this->errors[] = Tools::displayError('Post not found');
     }
     parent::initContent();
     $this->canonicalRedirection();
     if (!$this->errors) {
         Hook::exec('actionsbsingle', array('id_post' => $this->post));
         $blogcomment = new Blogcomment();
         $SmartBlogPost = new SmartBlogPost();
         $BlogCategory = new BlogCategory();
         $id_lang = $this->context->language->id;
         $post = $SmartBlogPost->getPost($id_post, $id_lang);
         $title_category = array();
         $getPostCategories = $this->getPostCategories($id_post);
         $i = 0;
         foreach ($getPostCategories as $category) {
             $title_category[] = $BlogCategory->getNameCategory($getPostCategories[$i]['id_smart_blog_category']);
             $i++;
         }
         $post['post_img'] = null;
         //--extra added
         $tags = $SmartBlogPost->getProductTags($id_post);
         $comment = $blogcomment->getComment($id_post);
         $countcomment = $blogcomment->getToltalComment($id_post);
         $id_cate = $post['id_category'];
         //$title_category = $BlogCategory->getNameCategory($id_cate);
         if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/' . $id_post . '.jpg')) {
             $post_img = $id_post . '.jpg';
         } else {
             $post_img = 'no';
         }
         $posts_previous = SmartBlogPost::getPreviousPostsById($id_lang, $id_post);
         $posts_next = SmartBlogPost::getNextPostsById($id_lang, $id_post);
         /* Server Params */
         $protocol_link = Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://';
         $protocol_content = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
         $smartbloglink = new SmartBlogLink($protocol_link, $protocol_content);
         SmartBlogPost::postViewed($id_post);
         //here we can give validation if category page or other page it will show
         $post['date'] = Smartblog::displayDate($post['created']);
         $this->context->smarty->assign(array('smartbloglink' => $smartbloglink, 'post' => $post, 'posts_next' => $posts_next, 'posts_previous' => $posts_previous, 'comments' => $comment, 'enableguestcomment' => Configuration::get('smartenableguestcomment'), 'is_looged' => $this->context->customer->isLogged(), 'is_looged_id' => $this->context->customer->id, 'is_looged_email' => $this->context->customer->email, 'is_looged_fname' => $this->context->customer->firstname, 'tags' => $tags, 'title_category' => $title_category, 'meta_title' => $post['meta_title'], 'post_active' => $post['active'], 'blogcontent' => $post['content'], 'id_post' => $post['id_post'], 'smartshowauthorstyle' => Configuration::get('smartshowauthorstyle'), 'smartshowauthor' => Configuration::get('smartshowauthor'), 'created' => Smartblog::displayDate($post['created']), 'firstname' => $post['firstname'], 'lastname' => $post['lastname'], 'smartcustomcss' => Configuration::get('smartcustomcss'), 'smartshownoimg' => Configuration::get('smartshownoimg'), 'comment_status' => $post['comment_status'], 'countcomment' => $countcomment, 'post_img' => $post_img, '_report' => $this->_report, 'id_category' => $post['id_category']));
         $this->context->smarty->assign('HOOK_SMART_BLOG_POST_FOOTER', Hook::exec('displaySmartAfterPost'));
     }
     $this->setTemplate('posts.tpl');
 }
    function content_5627a0e39aed71_45878629($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_date_format')) {
            include '/home/u481889647/public_html/tools/smarty/plugins/modifier.date_format.php';
        }
        $_smarty_tpl->tpl_vars['option_tpl'] = new Smarty_variable(OvicLayoutControl::getTemplateFile('smartblog_latest_news.tpl', 'smartbloghomelatestnews'), null, 0);
        if ($_smarty_tpl->tpl_vars['option_tpl']->value !== null) {
            ?>
    <?php 
            echo $_smarty_tpl->getSubTemplate($_smarty_tpl->tpl_vars['option_tpl']->value, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 9999, null, array(), 0);
            ?>

<?php 
        } else {
            ?>
	
	<div class="lg-margin2x hidden-sm hidden-xs"></div>
	<div class="md-margin2x visible-sm visible-xs"></div>
	<div class="carousel-container">
		<h2 class="carousel-title"><?php 
            echo smartyTranslate(array('s' => 'From the blog', 'mod' => 'smartbloghomelatestnews'), $_smarty_tpl);
            ?>
</h2>
		<div class="row">
			<?php 
            if (isset($_smarty_tpl->tpl_vars['view_data']->value) && !empty($_smarty_tpl->tpl_vars['view_data']->value)) {
                ?>
			<div class="owl-carousel from-theblog-carousel from-theblog-wide">
				<?php 
                $_smarty_tpl->tpl_vars['i'] = new Smarty_variable(1, null, 0);
                ?>
				<?php 
                $_smarty_tpl->tpl_vars['post'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['post']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['view_data']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['post']->key => $_smarty_tpl->tpl_vars['post']->value) {
                    $_smarty_tpl->tpl_vars['post']->_loop = true;
                    ?>
                    <?php 
                    $_smarty_tpl->tpl_vars["options"] = new Smarty_variable(null, null, 0);
                    ?>
                    <?php 
                    $_smarty_tpl->createLocalArrayVariable('options', null, 0);
                    $_smarty_tpl->tpl_vars['options']->value['id_post'] = $_smarty_tpl->tpl_vars['post']->value['id'];
                    ?>
                    <?php 
                    $_smarty_tpl->createLocalArrayVariable('options', null, 0);
                    $_smarty_tpl->tpl_vars['options']->value['slug'] = $_smarty_tpl->tpl_vars['post']->value['link_rewrite'];
                    ?>
                    <article class="article">
                        <div class="article-media-container"><a href="<?php 
                    echo smartblog::GetSmartBlogLink('smartblog_post', $_smarty_tpl->tpl_vars['options']->value);
                    ?>
"><img src="<?php 
                    echo $_smarty_tpl->tpl_vars['modules_dir']->value;
                    ?>
smartblog/images/<?php 
                    echo $_smarty_tpl->tpl_vars['post']->value['post_img'];
                    ?>
-home-default.jpg" class="img-responsive" alt="<?php 
                    echo $_smarty_tpl->tpl_vars['post']->value['title'];
                    ?>
"></a></div>
                        <div class="article-meta-box"><span class="article-icon article-date-icon"></span> <span class="meta-box-text"><?php 
                    echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['post']->value['date_added'], "%d %b");
                    ?>
</span></div>
                        <div class="article-meta-box article-meta-comments"><span class="article-icon article-comment-icon"></span> <a href="#" class="meta-box-text"><?php 
                    echo Blogcomment::getToltalComment($_smarty_tpl->tpl_vars['post']->value['id']);
                    ?>
 <?php 
                    echo smartyTranslate(array('s' => 'Com', 'mod' => 'smartbloghomelatestnews'), $_smarty_tpl);
                    ?>
</a></div>
                        <h3><a href="<?php 
                    echo smartblog::GetSmartBlogLink('smartblog_post', $_smarty_tpl->tpl_vars['options']->value);
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['post']->value['title'];
                    ?>
</a></h3>
                        <p><?php 
                    echo mb_convert_encoding(htmlspecialchars($_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER]['truncate'][0][0]->smarty_modifier_truncate($_smarty_tpl->tpl_vars['post']->value['short_description'], 150, "..."), ENT_QUOTES, 'UTF-8', true), "HTML-ENTITIES", 'UTF-8');
                    ?>
</p>
                        <a href="<?php 
                    echo smartblog::GetSmartBlogLink('smartblog_post', $_smarty_tpl->tpl_vars['options']->value);
                    ?>
" class="readmore" role="button"><?php 
                    echo smartyTranslate(array('s' => 'Read More', 'mod' => 'smartbloghomelatestnews'), $_smarty_tpl);
                    ?>
</a>
                     </article>
				<?php 
                }
                ?>
				
			</div>			
			<?php 
            }
            ?>
		</div>		
	</div>

	
<?php 
        }
    }
コード例 #9
0
ファイル: category.php プロジェクト: johnulist/smartblog
 public function initContent()
 {
     $category_status = '';
     $totalpages = '';
     $cat_image = 'no';
     $categoryinfo = '';
     $title_category = '';
     $cat_link_rewrite = '';
     $blogcomment = new Blogcomment();
     $SmartBlogPost = new SmartBlogPost();
     $BlogCategory = new BlogCategory();
     $BlogPostCategory = new BlogPostCategory();
     $smartblogurlpattern = (int) Configuration::get('smartblogurlpattern');
     //now we will check whihc option we need to url rewrite
     switch ($smartblogurlpattern) {
         case 1:
             $SmartBlog = new smartblog();
             $slug = Tools::getValue('slug');
             $id_category = $SmartBlog->categoryslug2id($slug);
             break;
         case 2:
             $SmartBlog = new smartblog();
             $id_category = Tools::getValue('id_category');
             //                if($id_category==''){
             //                   $id_category = $SmartBlog->categoryslug2id($slug);
             //                }
             break;
         default:
             $id_category = Tools::getValue('id_category');
     }
     //$categoryinfo = $BlogCategory->getNameCategory($id_category);
     $posts_per_page = Configuration::get('smartpostperpage');
     $limit_start = 0;
     $limit = $posts_per_page;
     if (!$id_category) {
         $total = (int) $SmartBlogPost->getToltal($this->context->language->id);
     } else {
         $total = (int) $SmartBlogPost->getToltalByCategory($this->context->language->id, $id_category);
         Hook::exec('actionsbcat', array('id_category' => pSQL(Tools::getvalue('id_category'))));
     }
     if ($total != '' || $total != 0) {
         $totalpages = ceil($total / $posts_per_page);
     }
     if ((bool) Tools::getValue('page')) {
         $c = (int) Tools::getValue('page');
         $limit_start = $posts_per_page * ($c - 1);
     }
     if (!$id_category) {
         $allNews = $SmartBlogPost->getAllPost($this->context->language->id, $limit_start, $limit);
     } else {
         if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/category/' . $id_category . '.jpg')) {
             $cat_image = $id_category;
         } else {
             $cat_image = 'no';
         }
         $categoryinfo = $BlogCategory->getNameCategory($id_category);
         $title_category = $categoryinfo[0]['name'];
         $category_status = $categoryinfo[0]['active'];
         $cat_link_rewrite = $categoryinfo[0]['link_rewrite'];
         if ($category_status == 1) {
             $allNews = $BlogPostCategory->getToltalByCategory($this->context->language->id, $id_category, $limit_start, $limit);
         } elseif ($category_status == 0) {
             $allNews = '';
         }
     }
     $i = 0;
     $to = array();
     if (!empty($allNews)) {
         foreach ($allNews as $item) {
             $to[$i] = $blogcomment->getToltalComment($item['id_post']);
             $i++;
             if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/' . $item['id_post'] . '.jpg')) {
                 $item['post_img'] = $item['id_post'] . '.jpg';
             } else {
                 $item['post_img'] = 'no';
             }
         }
         $j = 0;
         foreach ($to as $item) {
             if ($item == '') {
                 $allNews[$j]['totalcomment'] = 0;
             } else {
                 $allNews[$j]['totalcomment'] = $item;
             }
             $j++;
         }
     }
     $protocol_link = Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://';
     $protocol_content = (isset($useSSL) and $useSSL and Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
     $smartbloglink = new SmartBlogLink($protocol_link, $protocol_content);
     $i = 0;
     foreach ($allNews as $post) {
         $allNews[$i]['created'] = Smartblog::displayDate($post['created']);
         $i++;
     }
     parent::initContent();
     $this->canonicalRedirection();
     $this->context->smarty->assign(array('smartbloglink' => $smartbloglink, 'postcategory' => $allNews, 'category_status' => $category_status, 'title_category' => $title_category, 'cat_link_rewrite' => $cat_link_rewrite, 'id_category' => $id_category, 'cat_image' => $cat_image, 'categoryinfo' => $categoryinfo, 'smartshowauthorstyle' => Configuration::get('smartshowauthorstyle'), 'smartshowauthor' => Configuration::get('smartshowauthor'), 'limit' => isset($limit) ? $limit : 0, 'limit_start' => isset($limit_start) ? $limit_start : 0, 'c' => isset($c) ? $c : 1, 'total' => $total, 'smartblogliststyle' => Configuration::get('smartblogliststyle'), 'smartcustomcss' => Configuration::get('smartcustomcss'), 'smartshownoimg' => Configuration::get('smartshownoimg'), 'smartdisablecatimg' => Configuration::get('smartdisablecatimg'), 'smartshowviewed' => Configuration::get('smartshowviewed'), 'post_per_page' => $posts_per_page, 'pagenums' => $totalpages - 1, 'totalpages' => $totalpages));
     $template_name = 'postcategory.tpl';
     $this->setTemplate($template_name);
 }
    function content_5627a0e37dc8d0_80754417($_smarty_tpl)
    {
        if (isset($_smarty_tpl->tpl_vars['posts']->value) && !empty($_smarty_tpl->tpl_vars['posts']->value)) {
            ?>
<div class="widget">
   <h3><?php 
            echo smartyTranslate(array('s' => 'Popular Posts', 'mod' => 'smartblogpopularposts'), $_smarty_tpl);
            ?>
 </h3>
   <div class="owl-carousel popular-posts-slider">
      <?php 
            $_smarty_tpl->tpl_vars['nextItem'] = new Smarty_variable(0, null, 0);
            ?>
      <div class="article-list"> 
      <?php 
            $_smarty_tpl->tpl_vars["post"] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars["post"]->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['posts']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            $_smarty_tpl->tpl_vars["post"]->total = $_smarty_tpl->_count($_from);
            $_smarty_tpl->tpl_vars["post"]->iteration = 0;
            $_smarty_tpl->tpl_vars['smarty']->value['foreach']['blog_posts']['index'] = -1;
            foreach ($_from as $_smarty_tpl->tpl_vars["post"]->key => $_smarty_tpl->tpl_vars["post"]->value) {
                $_smarty_tpl->tpl_vars["post"]->_loop = true;
                $_smarty_tpl->tpl_vars["post"]->iteration++;
                $_smarty_tpl->tpl_vars["post"]->last = $_smarty_tpl->tpl_vars["post"]->iteration === $_smarty_tpl->tpl_vars["post"]->total;
                $_smarty_tpl->tpl_vars['smarty']->value['foreach']['blog_posts']['index']++;
                $_smarty_tpl->tpl_vars['smarty']->value['foreach']['blog_posts']['last'] = $_smarty_tpl->tpl_vars["post"]->last;
                ?>
            <?php 
                $_smarty_tpl->tpl_vars["options"] = new Smarty_variable(null, null, 0);
                ?>
            <?php 
                $_smarty_tpl->createLocalArrayVariable('options', null, 0);
                $_smarty_tpl->tpl_vars['options']->value['id_post'] = $_smarty_tpl->tpl_vars['post']->value['id_smart_blog_post'];
                ?>
            <?php 
                $_smarty_tpl->createLocalArrayVariable('options', null, 0);
                $_smarty_tpl->tpl_vars['options']->value['slug'] = $_smarty_tpl->tpl_vars['post']->value['link_rewrite'];
                ?>
          
            <article class="article">
	            <div class="article-meta-box"><span class="article-icon article-date-icon"></span> <span class="meta-box-text"><?php 
                echo date('d M', strtotime($_smarty_tpl->tpl_vars['post']->value['created']));
                ?>
</span></div>
	            <h4><a href="<?php 
                echo smartblog::GetSmartBlogLink('smartblog_post', $_smarty_tpl->tpl_vars['options']->value);
                ?>
" title="<?php 
                echo $_smarty_tpl->tpl_vars['post']->value['meta_title'];
                ?>
"><?php 
                echo $_smarty_tpl->tpl_vars['post']->value['meta_title'];
                ?>
</a></h4>
	         </article>		         
	         <?php 
                if ($_smarty_tpl->getVariable('smarty')->value['foreach']['blog_posts']['index'] % 3 == 2 && !$_smarty_tpl->getVariable('smarty')->value['foreach']['blog_posts']['last']) {
                    ?>
 
				</div>
				<div class="article-list"> 
			<?php 
                }
                ?>
	                                        
        <?php 
            }
            ?>
  
        </div>    	
   </div>
</div>
<?php 
        }
    }
コード例 #11
0
ファイル: rss.php プロジェクト: johnulist/smartblog
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <*****@*****.**>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
require_once dirname(__FILE__) . '/smartblog.php';
$allNews = smartblog::getToltalFeed((int) Context::getContext()->language->id);
header("Content-Type:text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
	<channel>
		<title><![CDATA[<?php 
echo Configuration::get('smartblogmetatitle');
?>