예제 #1
0
 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;
 }
 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;
 }
    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 
        }
    }
예제 #4
0
 public function SettingForm()
 {
     $blog_url = smartblog::GetSmartBlogLink('smartblog');
     $img_desc = '';
     $img_desc .= '' . $this->l('Upload a Avatar from your computer.<br/>N.B : Only jpg image is allowed');
     $img_desc .= '<br/><img style="clear:both;border:1px solid black;" alt="" src="' . __PS_BASE_URI__ . 'modules/smartblog/images/avatar/avatar.jpg" height="100" width="100"/><br />';
     $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
     $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Setting')), 'input' => array(array('type' => 'text', 'label' => $this->l('Meta Title'), 'name' => 'smartblogmetatitle', 'size' => 70, 'required' => true), array('type' => 'text', 'label' => $this->l('Meta Keyword'), 'name' => 'smartblogmetakeyword', 'size' => 70, 'required' => true), array('type' => 'textarea', 'label' => $this->l('Meta Description'), 'name' => 'smartblogmetadescrip', 'rows' => 7, 'cols' => 66, 'required' => true), array('type' => 'text', 'label' => $this->l('Main Blog Url'), 'name' => 'smartmainblogurl', 'size' => 15, 'required' => true, 'desc' => '<p class="alert alert-info"><a href="' . $blog_url . '">' . $blog_url . '</a></p>'), array('type' => 'radio', 'label' => $this->l('Use .html with Friendly Url'), 'name' => 'smartusehtml', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartusehtml', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartusehtml', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'text', 'label' => $this->l('Number of posts per page'), 'name' => 'smartpostperpage', 'size' => 15, 'required' => true), array('type' => 'radio', 'label' => $this->l('Auto accepted comment'), 'name' => 'smartacceptcomment', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartacceptcomment', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartacceptcomment', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Enable Captcha'), 'name' => 'smartcaptchaoption', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartcaptchaoption', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartcaptchaoption', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Enable Comment'), 'name' => 'smartenablecomment', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartenablecomment', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartenablecomment', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Show Author Name'), 'name' => 'smartshowauthor', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartshowauthor', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartshowauthor', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Show Post Viewed'), 'name' => 'smartshowviewed', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartshowviewed', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartshowviewed', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Show Author Name Style'), 'name' => 'smartshowauthorstyle', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'smartshowauthorstyle', 'value' => 1, 'label' => $this->l('First Name, Last Name')), array('id' => 'smartshowauthorstyle', 'value' => 0, 'label' => $this->l('Last Name, First Name')))), array('type' => 'file', 'label' => $this->l('AVATAR Image:'), 'name' => 'avatar', 'display_image' => false, 'desc' => $img_desc), array('type' => 'radio', 'label' => $this->l('Show No Image'), 'name' => 'smartshownoimg', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'smartshownoimg', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartshownoimg', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Show Category'), 'name' => 'smartdisablecatimg', 'required' => false, 'class' => 't', 'desc' => 'Show category image and description on category page', 'is_bool' => true, 'values' => array(array('id' => 'smartdisablecatimg', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'smartdisablecatimg', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Blog Page Column Setting'), 'name' => 'smartshowcolumn', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'smartshowcolumn', 'value' => 0, 'label' => $this->l('Use Both SmartBlog Column')), array('id' => 'smartshowcolumn', 'value' => 1, 'label' => $this->l('Use Only SmartBlog Left Column')), array('id' => 'smartshowcolumn', 'value' => 2, 'label' => $this->l('Use Only SmartBlog Right Column')), array('id' => 'smartshowcolumn', 'value' => 3, 'label' => $this->l('Use Prestashop Column')))), array('type' => 'textarea', 'label' => $this->l('Custom CSS'), 'name' => 'smartcustomcss', 'rows' => 7, 'cols' => 66, 'required' => false)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     $helper = new HelperForm();
     $helper->module = $this;
     $helper->name_controller = $this->name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
     foreach (Language::getLanguages(false) as $lang) {
         $helper->languages[] = array('id_lang' => $lang['id_lang'], 'iso_code' => $lang['iso_code'], 'name' => $lang['name'], 'is_default' => $default_lang == $lang['id_lang'] ? 1 : 0);
     }
     $helper->toolbar_btn = array('save' => array('desc' => $this->l('Save'), 'href' => AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . 'token=' . Tools::getAdminTokenLite('AdminModules')));
     $helper->default_form_language = $default_lang;
     $helper->allow_employee_form_lang = $default_lang;
     $helper->title = $this->displayName;
     $helper->show_toolbar = true;
     $helper->toolbar_scroll = true;
     $helper->submit_action = 'save' . $this->name;
     $helper->fields_value['smartpostperpage'] = Configuration::get('smartpostperpage');
     $helper->fields_value['smartacceptcomment'] = Configuration::get('smartacceptcomment');
     $helper->fields_value['smartshowauthorstyle'] = Configuration::get('smartshowauthorstyle');
     $helper->fields_value['smartshowauthor'] = Configuration::get('smartshowauthor');
     $helper->fields_value['smartmainblogurl'] = Configuration::get('smartmainblogurl');
     $helper->fields_value['smartusehtml'] = Configuration::get('smartusehtml');
     $helper->fields_value['smartshowcolumn'] = Configuration::get('smartshowcolumn');
     $helper->fields_value['smartblogmetakeyword'] = Configuration::get('smartblogmetakeyword');
     $helper->fields_value['smartblogmetatitle'] = Configuration::get('smartblogmetatitle');
     $helper->fields_value['smartblogmetadescrip'] = Configuration::get('smartblogmetadescrip');
     $helper->fields_value['smartshowviewed'] = Configuration::get('smartshowviewed');
     $helper->fields_value['smartdisablecatimg'] = Configuration::get('smartdisablecatimg');
     $helper->fields_value['smartenablecomment'] = Configuration::get('smartenablecomment');
     $helper->fields_value['smartcustomcss'] = Configuration::get('smartcustomcss');
     $helper->fields_value['smartshownoimg'] = Configuration::get('smartshownoimg');
     $helper->fields_value['smartcaptchaoption'] = Configuration::get('smartcaptchaoption');
     return $helper;
 }
    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 
        }
    }