public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Utils::getProperty($module_data, 'module_data.disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet())) {
         return;
     }
     $cache_property = "module_journal_fullscreen_slider_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['transition'] = Journal2Utils::getProperty($module_data, 'module_data.transition', 'fade');
         $this->data['transition_speed'] = Journal2Utils::getProperty($module_data, 'module_data.transition_speed', '700');
         $this->data['transition_delay'] = Journal2Utils::getProperty($module_data, 'module_data.transition_delay', '3000');
         if (Journal2Utils::getProperty($module_data, 'module_data.transparent_overlay', '')) {
             $this->data['transparent_overlay'] = Journal2Utils::resizeImage($this->model_tool_image, Journal2Utils::getProperty($module_data, 'module_data.transparent_overlay', ''));
         } else {
             $this->data['transparent_overlay'] = '';
         }
         $this->data['images'] = array();
         $images = Journal2Utils::getProperty($module_data, 'module_data.images', array());
         $images = Journal2Utils::sortArray($images);
         foreach ($images as $image) {
             if (!$image['status']) {
                 continue;
             }
             $image = Journal2Utils::getProperty($image, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             $this->data['images'][] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'title' => '');
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/fullscreen_slider.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addStyle('catalog/view/theme/journal2/lib/supersized/css/supersized.css');
     $this->document->addScript('catalog/view/theme/journal2/lib/supersized/js/jquery.easing.min.js');
     $this->document->addScript('catalog/view/theme/journal2/lib/supersized/js/supersized.3.2.7.min.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     if (!isset($this->request->get['route'])) {
         return;
     }
     switch ($this->request->get['route']) {
         case 'product/category':
             if (!isset($this->request->get['path'])) {
                 return;
             }
             $path = explode('_', $this->request->get['path']);
             $data = array('filter_category_id' => end($path));
             $this->load->model('catalog/product');
             if ($this->model_catalog_product->getTotalProducts($data) == 0) {
                 return;
             }
             break;
         case 'product/manufacturer/info':
             if (!isset($this->request->get['manufacturer_id'])) {
                 return;
             }
             break;
         case 'product/search':
             if (!isset($this->request->get['search']) && !isset($this->request->get['tag'])) {
                 return;
             }
             break;
         case 'product/special':
             $this->load->model('catalog/product');
             if ($this->model_catalog_product->getTotalProductSpecials() == 0) {
                 return;
             }
             break;
         default:
             return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     if (!isset($setting['module_id'])) {
         return;
     }
     $this->journal2->settings->set('config_j2sf', 'on');
     $output = $this->getFilters((int) $setting['module_id']);
     $this->document->addScript('catalog/view/theme/journal2/lib/touch-punch/jquery.ui.touch-punch.min.js');
     $this->document->addScript('catalog/view/theme/journal2/lib/jquery.address/jquery.address.js');
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_blog_comments_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'), 'Not Translated');
         $this->data['default_author_image'] = $this->model_tool_image->resize('data/journal2/misc/avatar.png', 75, 75);
         $this->data['comments'] = array();
         $comments = $this->model_journal2_blog->getLatestComments(Journal2Utils::getProperty($module_data, 'module_data.limit', 5));
         $char_limit = Journal2Utils::getProperty($module_data, 'module_data.char_limit', 50);
         foreach ($comments as $comment) {
             $this->data['comments'][] = array('email' => $comment['email'], 'name' => $comment['name'], 'comment' => utf8_substr(strip_tags(html_entity_decode($comment['comment'], ENT_QUOTES, 'UTF-8')), 0, $char_limit) . '...', 'post' => $comment['post'], 'href' => $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $comment['post_id']) . '#c' . $comment['comment_id']);
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/blog_comments.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_blog_search_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'));
         $this->data['placeholder'] = Journal2Utils::getProperty($module_data, 'module_data.placeholder.value.' . $this->config->get('config_language_id'), 'Blog Search');
         $this->data['search_url'] = str_replace('&', '&', $this->url->link('journal2/blog', 'journal_blog_search='));
         if (isset($this->request->get['journal_blog_search'])) {
             $this->data['search'] = trim($this->request->get['journal_blog_search']);
         } else {
             $this->data['search'] = '';
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/blog_search.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_side_category_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['class'] = $setting['position'] === 'column_right' ? 'side-category-right' : 'side-category-left';
         $this->data['type'] = Journal2Utils::getProperty($module_data, 'module_data.type');
         switch ($this->data['type']) {
             case 'accordion':
                 $this->data['class'] .= ' side-category-accordion';
                 break;
             case 'dropdown':
                 $this->data['class'] .= ' side-category-dropdown';
                 break;
         }
         $this->language->load('module/category');
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'), $this->language->get('heading_title'));
         $tree = array();
         if (Journal2Utils::getProperty($module_data, 'module_data.show_categories')) {
             if (isset($this->request->get['path'])) {
                 $parts = explode('_', (string) $this->request->get['path']);
             } else {
                 $parts = array();
             }
             $sql = "SELECT c.category_id, c.parent_id, cd.name ";
             if ($this->config->get('config_product_count')) {
                 $sql .= ", (SELECT COUNT(p.product_id) FROM " . DB_PREFIX . "product_to_category p2c LEFT JOIN " . DB_PREFIX . "product p ON (p.product_id = p2c.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id)  WHERE p.status = '1' AND p.date_available <= NOW()  AND p2s.store_id = '" . (int) $this->config->get('config_store_id') . "' AND p2c.category_id = c.category_id) as total ";
             }
             $sql .= "FROM " . DB_PREFIX . "category c  LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id)  LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id)  WHERE cd.language_id = '" . (int) $this->config->get('config_language_id') . "'  AND c2s.store_id = '" . (int) $this->config->get('config_store_id') . "'   AND c.status = '1' ORDER BY c.sort_order, LCASE(cd.name)";
             $query = $this->db->query($sql);
             $results = array();
             foreach ($query->rows as $row) {
                 $results[$row['parent_id']][] = $row;
             }
             if (is_array($results) && isset($results['0'])) {
                 $tree = $this->generateMultiLevelCategoryMenu($results, $results[0], '', $parts);
                 if ($this->config->get('config_product_count')) {
                     for ($i = 0; $i < count($tree); $i++) {
                         $this->sum($tree[$i]);
                     }
                 }
             }
         }
         $top_items = array();
         $bottom_items = array();
         foreach (Journal2Utils::getProperty($module_data, 'module_data.sections', array()) as $item_data) {
             $item = array('name' => Journal2Utils::getProperty($item_data, 'name.value.' . $this->config->get('config_language_id'), 'Not translated'), 'href' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($item_data, 'link')), 'target' => Journal2Utils::getProperty($item_data, 'new_window') ? 'target="_blank"' : '', 'sort_order' => Journal2Utils::getProperty($item_data, 'sort_order'));
             $item['class'] = $this->isActive($item['href']);
             if (Journal2Utils::getProperty($item_data, 'position') === 'top') {
                 $top_items[] = $item;
             } else {
                 $bottom_items[] = $item;
             }
         }
         $top_items = Journal2Utils::sortArray($top_items);
         $bottom_items = Journal2Utils::sortArray($bottom_items);
         $this->data['categories'] = $tree;
         $this->data['top_items'] = $top_items;
         $this->data['bottom_items'] = $bottom_items;
         $this->data['show_total'] = $this->config->get('config_product_count');
         $this->template = $this->config->get('config_template') . '/template/journal2/module/side_category.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     if (Journal2Utils::getProperty($module_data, 'hideonmobile') && Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_simple_slider_' . $setting['module_id'], implode('; ', $css));
     }
     $cache_property = "module_journal_simple_slider_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* slider position */
         $height = Journal2Utils::getProperty($module_data, 'height', 400);
         $width = null;
         switch ($setting['position']) {
             case 'column_left':
             case 'column_right':
                 $width = 220;
                 $this->data['width'] = "max-width: {$width}px";
                 break;
             case 'content_top':
             case 'content_bottom':
                 if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
                     $width = $this->journal2->settings->get('site_width', 1024);
                 } else {
                     if ($this->journal2->settings->get('extended_layout')) {
                         $width = $this->journal2->settings->get('site_width', 1024) - 240 * $this->journal2->settings->get('config_columns_count');
                     } else {
                         $width = $this->journal2->settings->get('site_width', 1024) - 40 - 240 * $this->journal2->settings->get('config_columns_count');
                     }
                     $height *= $width / $this->journal2->settings->get('site_width', 1024);
                 }
                 $this->data['width'] = "max-width: {$width}px";
                 break;
             case 'top':
             case 'bottom':
                 $width = $this->journal2->settings->get('site_width', 1024);
                 $this->data['width'] = "max-width: {$width}px";
                 break;
             case 'multi_module':
                 $width = $setting['width'];
                 $height = $setting['height'];
                 $this->data['width'] = "max-width: {$width}px";
                 break;
         }
         /* global style data */
         $this->data['global_style'] = array();
         $slides = Journal2Utils::getProperty($module_data, 'slides', array());
         $slides = Journal2Utils::sortArray($slides);
         $_slides = array();
         $this->data['js_options'] = array('slideSpeed' => (int) Journal2Utils::getProperty($module_data, 'transition_speed', 800), 'stopOnHover' => (bool) Journal2Utils::getProperty($module_data, 'pause_on_hover', 1), 'lazyLoad' => (bool) Journal2Utils::getProperty($module_data, 'preload_images', 1), 'touchDrag' => (bool) Journal2Utils::getProperty($module_data, 'touch_drag', 0), 'navigation' => (bool) Journal2Utils::getProperty($module_data, 'arrows', 1), 'pagination' => (bool) Journal2Utils::getProperty($module_data, 'bullets', 1));
         if (Journal2Utils::getProperty($module_data, 'transition', 'fade') !== 'slide') {
             $this->data['js_options']['transitionStyle'] = Journal2Utils::getProperty($module_data, 'transition', 'fade');
         }
         $this->data['nav_on_hover'] = Journal2Utils::getProperty($module_data, 'show_on_hover', 1) ? 'nav-on-hover' : '';
         if (Journal2Utils::getProperty($module_data, 'autoplay')) {
             $this->data['js_options']['autoPlay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
         } else {
             $this->data['js_options']['autoPlay'] = false;
         }
         $this->data['image_width'] = $width;
         $this->data['image_height'] = $height;
         foreach ($slides as $slide) {
             if (isset($slide['status']) && !$slide['status']) {
                 continue;
             }
             $image = Journal2Utils::getProperty($slide, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             $_slides[] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image, $width, $height, 'crop'), 'name' => Journal2Utils::getProperty($slide, 'slide_name'), 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($slide, 'link')), 'target' => Journal2Utils::getProperty($slide, 'link_new_window') ? 'target="_blank"' : '');
         }
         $this->data['slides'] = $_slides;
         if (count($_slides) <= 1) {
             $this->data['js_options']['autoPlay'] = false;
         }
         $this->data['module'] = $module;
         $this->data['preload_images'] = Journal2Utils::getProperty($module_data, 'preload_images', '1');
         $this->data['height'] = $height;
         $this->template = $this->config->get('config_template') . '/template/journal2/module/slider_simple.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_side_column_menu_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['class'] = $setting['position'] === 'column_right' ? 'side-category-right' : 'side-category-left';
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'));
         $this->data['side_category_type'] = Journal2Utils::getProperty($module_data, 'module_data.side_category_type', 'normal');
         $this->journal2->html_classes->addClass('flyout-active');
         $this->journal2->settings->set('flyout_' . $setting['position'] . '_active', true);
         $this->data['button_cart'] = $this->language->get('button_cart');
         $this->data['button_wishlist'] = $this->language->get('button_wishlist');
         $this->data['button_compare'] = $this->language->get('button_compare');
         $this->data['menu_items'] = array();
         $menu_items = Journal2Utils::getProperty($module_data, 'module_data.items', array());
         $menu_items = Journal2Utils::sortArray($menu_items);
         foreach ($menu_items as $key => $menu_item) {
             if (!Journal2Utils::getProperty($menu_item, 'status', 1)) {
                 continue;
             }
             $width = Journal2Utils::getProperty($menu_item, 'container_width', '764') . 'px';
             $menu_css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($menu_item, 'background'));
             $menu_css[] = "width: {$width}";
             if ($setting['position'] === 'column_right') {
                 $menu_css[] = "left: -{$width}";
             }
             $menu = array('name' => '', 'href' => '', 'class' => '', 'items' => array(), 'mixed_columns' => array(), 'type' => '', 'limit' => Journal2Utils::getProperty($menu_item, 'items_limit', 0), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($menu_item, 'icon')), 'hide_text' => Journal2Utils::getProperty($menu_item, 'hide_text'), 'css' => implode('; ', $menu_css));
             $image_width = Journal2Utils::getProperty($menu_item, 'image_width', 250);
             $image_height = Journal2Utils::getProperty($menu_item, 'image_height', 250);
             $image_resize_type = Journal2Utils::getProperty($menu_item, 'image_type', 'fit');
             $this->generateMenuItem($menu, $menu_item, $image_width, $image_height, $image_resize_type);
             if ($menu_item['type'] === 'mixed') {
                 switch (Journal2Utils::getProperty($menu_item, 'custom.top.menu_type')) {
                     case 'category':
                         $category_info = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
                         if (!$category_info) {
                             continue;
                         }
                         $menu['name'] = $category_info['name'];
                         $menu['href'] = $this->url->link('product/category', 'path=' . $category_info['category_id']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'product':
                         $product_info = $this->model_catalog_product->getProduct(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
                         if (!$product_info) {
                             continue;
                         }
                         $menu['name'] = $product_info['name'];
                         $menu['href'] = $this->url->link('product/product', 'product_id=' . $product_info['product_id']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'manufacturer':
                         $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
                         if (!$manufacturer_info) {
                             continue;
                         }
                         $menu['name'] = $manufacturer_info['name'];
                         $menu['href'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer_info['manufacturer_id']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'information':
                         $information_info = $this->model_catalog_information->getInformation(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
                         if (!$information_info) {
                             continue;
                         }
                         $menu['name'] = $information_info['title'];
                         $menu['href'] = $this->url->link('information/information', 'information_id=' . $information_info['information_id']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'opencart':
                         $customer_name = null;
                         switch (Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.page')) {
                             case 'login':
                                 $menu_item['custom']['top']['menu_item']['page'] = $this->customer->isLogged() ? 'account/account' : 'account/login';
                                 $customer_name = $this->customer->isLogged() ? '{{_customer_}}' : null;
                                 break;
                             case 'register':
                                 $menu_item['custom']['top']['menu_item']['page'] = $this->customer->isLogged() ? 'account/logout' : 'account/register';
                                 break;
                             default:
                         }
                         $menu['name'] = $customer_name ? $customer_name : $this->model_journal2_menu->getMenuName($menu_item['custom']['top']['menu_item']['page']);
                         $menu['href'] = $this->model_journal2_menu->link($menu_item['custom']['top']['menu_item']['page']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'popup':
                         $menu['name'] = Journal2Utils::getProperty($menu_item, 'custom.menu_item.name.value.' . $this->config->get('config_language_id'), 'Not Translated');
                         $menu['href'] = "javascript:Journal.openPopup('" . Journal2Utils::getProperty($menu_item, 'custom.top.menu_item') . "')";
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'blog_home':
                         $menu['name'] = $this->journal2->settings->get('config_blog_settings.title.value.' . $this->config->get('config_language_id'), 'Journal Blog');
                         $menu['href'] = $this->url->link('journal2/blog');
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'blog_category':
                         $category_info = $this->model_journal2_blog->getCategory(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
                         if (!$category_info) {
                             continue;
                         }
                         $menu['name'] = $category_info['name'];
                         $menu['href'] = $this->url->link('journal2/blog', 'journal_blog_category_id=' . $category_info['category_id']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'blog_post':
                         $post_info = $this->model_journal2_blog->getPost(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
                         if (!$post_info) {
                             continue;
                         }
                         $menu['name'] = $post_info['name'];
                         $menu['href'] = $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post_info['post_id']);
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                     case 'custom':
                         $menu['name'] = Journal2Utils::getProperty($menu_item, 'custom.menu_item.name.value.' . $this->config->get('config_language_id'), '');
                         $menu['href'] = Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.url');
                         $menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
                         break;
                 }
                 if ($name_overwrite = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'), '')) {
                     $menu['name'] = $name_overwrite;
                 }
             }
             $this->data['menu_items'][] = $menu;
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/side_column_menu.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     $output = $this->model_journal2_menu->replaceCacheVars($output);
     Journal2::stopTimer(get_class($this));
     return $output;
 }
Пример #8
0
        }
    }
    /* Blog sitemap */
    if ($current_route === 'information/sitemap') {
        $this->execute(new Action('journal2/settings/sitemap'));
    }
    /* Route Parser */
    require_once DIR_SYSTEM . 'journal2/classes/journal2_page.php';
    $journal2->page = new Journal2Page($this->registry, $journal2->html_classes);
    /* Calculate columns */
    $this->execute(new Action('journal2/settings/columns'));
    if (!in_array($current_route, array('module/journal2_side_blocks/load', 'journal2/assets/js', 'journal2/assets/css', 'journal2/assets/outofstock', 'product/product/captcha', 'information/contact/captcha', 'tool/captcha'))) {
        $this->execute(new Action('journal2/product_tabs'));
        $this->execute(new Action('journal2/product_tabs/enquiry'));
        $this->execute(new Action('journal2/modules'));
        if (Front::$IS_OC2) {
            $this->execute(new Action('journal2/menu/header', 'primary_menu'));
            $this->execute(new Action('journal2/menu/header', 'secondary_menu'));
            $this->execute(new Action('journal2/menu/mega', 'mega_menu'));
            $this->execute(new Action('journal2/menu/footer', 'footer_menu'));
        } else {
            $this->execute(new Action('journal2/menu/header', array('primary_menu')));
            $this->execute(new Action('journal2/menu/header', array('secondary_menu')));
            $this->execute(new Action('journal2/menu/mega', array('mega_menu')));
            $this->execute(new Action('journal2/menu/footer', array('footer_menu')));
        }
        $this->execute(new Action('journal2/snippets'));
        $this->execute(new Action('journal2/category/refine_images'));
    }
    Journal2::stopTimer('Engine');
}
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     $this->journal2->html_classes->addClass('side-blocks-active');
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $cache_property = "module_journal_side_blocks_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'module_data.position')) {
             $css[] = 'position: ' . Journal2Utils::getProperty($module_data, 'module_data.position');
         }
         if (Journal2Utils::getProperty($module_data, 'module_data.offset_top')) {
             $css[] = 'top: ' . Journal2Utils::getProperty($module_data, 'module_data.offset_top', 0) . 'px';
         }
         $this->data['icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'module_data.icon'));
         $this->data['icon_bgcolor'] = 'transparent';
         if (Journal2Utils::getProperty($module_data, 'module_data.icon_bg_color')) {
             $this->data['icon_bgcolor'] = Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'module_data.icon_bg_color'));
         }
         $this->data['icon_border'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'module_data.icon_border')));
         $this->data['content_bgcolor'] = 'transparent';
         $position = Journal2Utils::getProperty($module_data, 'module_data.alignment', 'left');
         switch (Journal2Utils::getProperty($module_data, 'module_data.module_type', 'block')) {
             case 'button':
                 $this->data['type'] = 'button';
                 $this->data['url'] = $this->model_journal2_menu->getLink(Journal2Utils::getProperty($module_data, 'module_data.link'));
                 $this->data['target'] = Journal2Utils::getProperty($module_data, 'module_data.new_window') ? 'target="_blank"' : '';
                 if (Journal2Utils::getProperty($module_data, 'module_data.icon_bg_hover_color')) {
                     $this->data['icon_bg_hover_color'] = Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'module_data.icon_bg_hover_color'));
                 } else {
                     $this->data['icon_bg_hover_color'] = false;
                 }
                 $offset = Journal2Utils::getProperty($module_data, 'module_data.offset_side', 0) . 'px';
                 $css[] = "{$position}: {$offset}";
                 break;
             case 'block':
                 $this->data['type'] = 'block';
                 $this->data['url'] = 'index.php?route=module/journal2_side_blocks/load&amp;module_id=' . $setting['module_id'];
                 $this->data['content_padding'] = Journal2Utils::getProperty($module_data, 'module_data.content_padding', 0) . 'px';
                 if (Journal2Utils::getProperty($module_data, 'module_data.content_width', 300)) {
                     $css[] = 'width: ' . Journal2Utils::getProperty($module_data, 'module_data.content_width', 300) . 'px';
                     $css[] = (Journal2Utils::getProperty($module_data, 'module_data.alignment') === 'left' ? 'left' : 'right') . ': -' . Journal2Utils::getProperty($module_data, 'module_data.content_width', 300) . 'px';
                 }
                 if (Journal2Utils::getProperty($module_data, 'module_data.content_bg_color')) {
                     $this->data['content_bgcolor'] = Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'module_data.content_bg_color'));
                 }
                 break;
         }
         $this->data['icon_width'] = Journal2Utils::getProperty($module_data, 'module_data.icon_width', 50) . 'px';
         $this->data['icon_height'] = Journal2Utils::getProperty($module_data, 'module_data.icon_height', 50) . 'px';
         if ($position === 'left') {
             $this->data['pos_offset'] = 'right: -' . $this->data['icon_width'];
         } else {
             $this->data['pos_offset'] = 'left: -' . $this->data['icon_width'];
         }
         $this->data['module'] = $module;
         $this->data['alignment'] = Journal2Utils::getProperty($module_data, 'module_data.alignment');
         $this->data['css'] = implode('; ', $css);
         $this->template = $this->config->get('config_template') . '/template/journal2/module/side_blocks.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $this->data['height'] = Journal2Utils::getProperty($module_data, 'height');
     $this->data['css'] = array();
     $this->data['is_top_bottom'] = false;
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_advanced_grid_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_advanced_grid_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         $this->data['is_top_bottom'] = true;
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = $css;
     }
     $module_spacing = Journal2Utils::getProperty($module_data, 'module_spacing');
     $this->data['module_spacing'] = $module_spacing !== null ? $module_spacing . 'px' : null;
     $this->data['grid_dimensions'] = (int) Journal2Utils::getProperty($module_data, 'grid_dimensions', '1');
     $this->data['css'] = implode('; ', $this->data['css']);
     $cache_property = "module_journal_advanced_grid_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $this->data['module'] = mt_rand();
         $columns = Journal2Utils::getProperty($module_data, 'columns', array());
         $columns = Journal2Utils::sortArray($columns);
         $this->data['columns'] = array();
         foreach ($columns as $column) {
             if (!$column['status']) {
                 continue;
             }
             $modules = Journal2Utils::getProperty($column, 'modules', array());
             $modules = Journal2Utils::sortArray($modules);
             $rendered_modules = array();
             $size = floor($column['width']);
             foreach ($modules as $module) {
                 if (!$module['status']) {
                     continue;
                 }
                 /* device detection */
                 $disable_on_classes = array();
                 if ($this->journal2->settings->get('responsive_design')) {
                     $device = Journal2Utils::getDevice();
                     if (Journal2Utils::getProperty($module, 'enable_on_phone', '1') == '0') {
                         if ($device === 'phone') {
                             continue;
                         } else {
                             $disable_on_classes[] = 'hide-on-phone';
                         }
                     }
                     if (Journal2Utils::getProperty($module, 'enable_on_tablet', '1') == '0') {
                         if ($device === 'tablet') {
                             continue;
                         } else {
                             $disable_on_classes[] = 'hide-on-tablet';
                         }
                     }
                     if (Journal2Utils::getProperty($module, 'enable_on_desktop', '1') == '0') {
                         if ($device === 'desktop') {
                             continue;
                         } else {
                             $disable_on_classes[] = 'hide-on-desktop';
                         }
                     }
                 }
                 $module_id = Journal2Utils::getProperty($module, 'module_id', -1);
                 if ($module_id === -1) {
                     continue;
                 }
                 $module_data = $this->model_journal2_module->getModule($module_id);
                 if (!isset($module_data['module_type'])) {
                     continue;
                 }
                 $module_type = $module_data['module_type'];
                 $m_width = ($this->journal2->settings->get('site_width', 1024) - ($this->data['is_top_bottom'] ? 0 : 240 * $this->journal2->settings->get("config_columns_count"))) * $size / 100;
                 $m_height = round($this->data['height'] * Journal2Utils::getProperty($module, 'height') / 100);
                 $rendered_modules[] = array('class' => $disable_on_classes, 'height' => Journal2Utils::getProperty($module, 'height'), 'content' => $this->getChild('module/' . $module_type, array('module_id' => $module_id, 'layout_id' => -1, 'width' => $m_width, 'height' => $m_height - $module_spacing, 'position' => 'multi_module')));
             }
             $this->data['columns'][] = array('classes' => "xs-{$size} sm-{$size} md-{$size} lg-{$size} xl-{$size}", 'modules' => $rendered_modules);
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/advanced_grid.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_text_rotator_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_text_rotator_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_text_rotator_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['transition_delay'] = Journal2Utils::getProperty($module_data, 'transition_delay', 4000);
         $this->data['bullets_position'] = Journal2Utils::getProperty($module_data, 'bullets_position', 'center');
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'), '');
         /* quote options */
         $css = array();
         $css[] = 'text-align: ' . Journal2Utils::getProperty($module_data, 'text_align', 'center');
         $this->data['text_align'] = Journal2Utils::getProperty($module_data, 'text_align', 'center');
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'text_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'text_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $css[] = 'font-weight: ' . ($weight ? $weight : 400);
             $css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'text_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'system') {
             $css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') !== 'none') {
             $css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_size');
             $css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_style');
             $css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'text_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color')) {
             $css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color'));
         }
         $this->data['quote_css'] = implode('; ', $css);
         /* author options */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'author_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'author_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'author_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'author_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $css[] = 'font-weight: ' . ($weight ? $weight : 400);
             $css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'author_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') === 'system') {
             $css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_weight');
             $css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_family');
         }
         $css[] = 'text-align: ' . Journal2Utils::getProperty($module_data, 'author_align', 'center');
         if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') !== 'none') {
             $css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_size');
             $css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_style');
             $css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'author_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'author_font.value.color.value.color')) {
             $css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'author_font.value.color.value.color'));
         }
         $this->data['author_css'] = implode('; ', $css);
         /* rotator options */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'text_background'));
         $this->data['rotator_css'] = implode('; ', $css);
         /* image options */
         $css = array();
         $css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         switch (Journal2Utils::getProperty($module_data, 'image_align')) {
             case 'left':
                 $this->data['image_align'] = 'left';
                 $css[] = 'float: left';
                 break;
             case 'center':
                 $this->data['image_align'] = 'center';
                 $css[] = 'float: none';
                 $css[] = 'margin:0 auto';
                 $css[] = 'margin-bottom:10px';
                 break;
             case 'right':
                 $this->data['image_align'] = 'right';
                 $css[] = 'float: right';
                 break;
         }
         $this->data['image_css'] = implode('; ', $css);
         /* sections */
         $this->data['random_sections'] = Journal2Utils::getProperty($module_data, 'random_sections', '0');
         $this->data['sections'] = array();
         $sections = Journal2Utils::getProperty($module_data, 'sections', array());
         $sections = Journal2Utils::sortArray($sections);
         $image_width = Journal2Utils::getProperty($module_data, 'image_width', 150);
         $image_height = Journal2Utils::getProperty($module_data, 'image_height', 150);
         foreach ($sections as $section) {
             if (!$section['status']) {
                 continue;
             }
             $image = Journal2Utils::getProperty($section, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             if (!file_exists(DIR_IMAGE . $image)) {
                 $image = false;
             }
             $this->data['sections'][] = array('author' => Journal2Utils::getProperty($section, 'author'), 'image' => $image ? Journal2Utils::resizeImage($this->model_tool_image, $image, $image_width, $image_height, 'crop') : false, 'image_width' => $image_width, 'image_height' => $image_height, 'text' => Journal2Utils::getProperty($section, 'text.value.' . $this->config->get('config_language_id')), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($section, 'icon')));
         }
         /* bullets */
         $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets') && count($this->data['sections']) > 1 ? true : false;
         /* pause on hover */
         $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover', '1');
         $this->template = $this->config->get('config_template') . '/template/journal2/module/text_rotator.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
             $this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
         }
     } else {
         if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
             $fonts = json_decode($fonts, true);
             if (is_array($fonts)) {
                 foreach ($fonts as $font) {
                     $this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
                 }
             }
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addScript('catalog/view/theme/journal2/lib/quovolver/jquery.quovolver.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_custom_sections_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_custom_sections_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_custom_sections_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}" . $this->journal2->cache->getRouteCacheKey();
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['show_title'] = Journal2Utils::getProperty($module_data, 'show_title');
         $this->data['show_title_class'] = $this->data['show_title'] ? '' : 'no-heading';
         $this->data['brand_name'] = Journal2Utils::getProperty($module_data, 'brand_name');
         $this->data['module_type'] = Journal2Utils::getProperty($module_data, 'module_type');
         $this->data['render_as'] = Journal2Utils::getProperty($module_data, 'display_as');
         $this->data['default_section'] = '';
         /* generate sections */
         $this->data['sections'] = array();
         $this->data['items'] = array();
         /* image dimensions */
         $this->data['image_width'] = Journal2Utils::getProperty($module_data, 'image_width', $this->config->get('config_image_product_width'));
         $this->data['image_height'] = Journal2Utils::getProperty($module_data, 'image_height', $height = $this->config->get('config_image_product_height'));
         $this->data['image_resize_type'] = Journal2Utils::getProperty($module_data, 'image_type', 'fit');
         $this->data['dummy_image'] = $this->model_tool_image->resize('data/journal2/transparent.png', $this->data['image_width'], $this->data['image_height']);
         /* image border */
         if (Journal2Utils::getProperty($module_data, 'image_border')) {
             $this->data['image_border_css'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         } else {
             $this->data['image_border_css'] = null;
         }
         /* image background color */
         if (Journal2Utils::getProperty($module_data, 'image_bgcolor.value.color')) {
             $this->data['image_bgcolor'] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'image_bgcolor.value.color'));
         } else {
             $this->data['image_bgcolor'] = null;
         }
         switch ($this->data['module_type']) {
             case 'product':
                 $sections = Journal2Utils::getProperty($module_data, 'product_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateProductSections($sections);
                 $this->data['text_tax'] = $this->language->get('text_tax');
                 $this->data['button_cart'] = $this->language->get('button_cart');
                 $this->data['button_wishlist'] = $this->language->get('button_wishlist');
                 $this->data['button_compare'] = $this->language->get('button_compare');
                 break;
             case 'category':
                 $sections = Journal2Utils::getProperty($module_data, 'category_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateCategorySections($sections);
                 break;
             case 'manufacturer':
                 $sections = Journal2Utils::getProperty($module_data, 'manufacturer_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateManufacturerSections($sections);
                 break;
         }
         if (!$this->has_items) {
             return;
         }
         $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
         $this->data['single_class'] = count($this->data['sections']) == 1 ? 'single-section' : '';
         $this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
         $this->template = $this->config->get('config_template') . "/template/journal2/module/custom_sections_{$this->data['module_type']}.tpl";
         if (self::$CACHEABLE === true && !$this->has_random_products) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addScript('catalog/view/theme/journal2/lib/isotope/jquery.isotope.min.js');
     $this->document->addScript('catalog/view/theme/journal2/lib/isotope/jquery.isotope.sloppy-masonry.min.js');
     if ($this->journal2->html_classes->hasClass('mobile')) {
         $this->document->addScript('catalog/view/theme/journal2/lib/lazy/jquery.lazy.1.6.min.js');
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* hide on mobile */
     if (Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_newsletter_' . $setting['module_id'], implode('; ', $css));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
         }
         $this->data['css'] = implode('; ', $css);
     }
     /* border */
     if (Journal2Utils::getProperty($module_data, 'module_border')) {
         $border = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'module_border')));
         $this->data['css'] = $this->data['css'] ? '; ' . $border : $border;
     }
     $cache_property = "module_journal_carousel_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $this->data['module'] = mt_rand();
         $this->data['text_class'] = Journal2Utils::getProperty($module_data, 'text_position', 'left');
         /* hide on mobile */
         $this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
         /* heading title */
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'));
         /* text */
         $this->data['module_text'] = Journal2Utils::getProperty($module_data, 'module_text.value.' . $this->config->get('config_language_id'));
         $font_css = array();
         if (Journal2Utils::getProperty($module_data, 'module_text_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'module_text_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'module_text_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'module_text_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'module_text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $font_css[] = 'font-weight: ' . ($weight ? $weight : 400);
             $font_css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'module_text_font.value.font_type') === 'system') {
             $font_css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_weight');
             $font_css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'module_text_font.value.font_type') !== 'none') {
             $font_css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_size');
             $font_css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_style');
             $font_css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'module_text_font.value.color.value.color')) {
             $font_css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'module_text_font.value.color.value.color'));
         }
         $this->data['font_css'] = implode('; ', $font_css);
         /* input */
         $this->data['input_placeholder'] = Journal2Utils::getProperty($module_data, 'input_placeholder.value.' . $this->config->get('config_language_id'));
         $input_style = array();
         if (Journal2Utils::getProperty($module_data, 'input_height')) {
             $input_style[] = 'height: ' . Journal2Utils::getProperty($module_data, 'input_height') . 'px';
         }
         $input_field_style = array();
         if (Journal2Utils::getProperty($module_data, 'input_bg_color.value.color')) {
             $input_field_style[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'input_bg_color.value.color'));
         }
         if (Journal2Utils::getProperty($module_data, 'input_border')) {
             $input_field_style = array_merge($input_field_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'input_border')));
         }
         if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'input_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'input_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'input_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'input_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $input_field_style[] = 'font-weight: ' . ($weight ? $weight : 400);
             $input_field_style[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'input_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') === 'system') {
             $input_field_style[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_weight');
             $input_field_style[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') !== 'none') {
             $input_field_style[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_size');
             $input_field_style[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_style');
             $input_field_style[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'input_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'input_font.value.color.value.color')) {
             $input_field_style[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'input_font.value.color.value.color'));
         }
         $this->data['input_style'] = implode('; ', $input_style);
         $this->data['input_field_style'] = implode('; ', $input_field_style);
         /* submit */
         $this->data['button_text'] = Journal2Utils::getProperty($module_data, 'button_text.value.' . $this->config->get('config_language_id'), '');
         $this->data['button_icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'button_icon'));
         $button_style = array();
         if (Journal2Utils::getProperty($module_data, 'button_offset_top')) {
             $button_style[] = 'margin-top: ' . Journal2Utils::getProperty($module_data, 'button_offset_top') . 'px';
         }
         if (Journal2Utils::getProperty($module_data, 'button_offset_left')) {
             $button_style[] = 'right: ' . Journal2Utils::getProperty($module_data, 'button_offset_left') . 'px';
         }
         if (Journal2Utils::getProperty($module_data, 'button_border')) {
             $button_style = array_merge($button_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'button_border')));
         }
         if (Journal2Utils::getProperty($module_data, 'button_font')) {
             $button_style = array_merge($button_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'button_border')));
         }
         if (Journal2Utils::getProperty($module_data, 'button_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'button_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'button_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'button_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'button_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $button_style[] = 'font-weight: ' . ($weight ? $weight : 400);
             $button_style[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'button_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'button_font.value.font_type') === 'system') {
             $button_style[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_weight');
             $button_style[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'button_font.value.font_type') !== 'none') {
             $button_style[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_size');
             $button_style[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_style');
             $button_style[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'button_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'button_font.value.color.value.color')) {
             $button_style[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'button_font.value.color.value.color'));
         }
         if (Journal2Utils::getProperty($module_data, 'button_background.value.color')) {
             $button_style[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'button_background.value.color'));
         }
         $this->data['button_style'] = implode('; ', $button_style);
         /* background */
         $module_css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background'));
         if (Journal2Utils::getProperty($module_data, 'module_padding')) {
             $module_css[] = 'padding: ' . Journal2Utils::getProperty($module_data, 'module_padding') . 'px';
         }
         $this->data['module_css'] = implode('; ', $module_css);
         $this->template = $this->config->get('config_template') . '/template/journal2/module/newsletter.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
             $this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
         }
     } else {
         if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
             $fonts = json_decode($fonts, true);
             if (is_array($fonts)) {
                 foreach ($fonts as $font) {
                     $this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
                 }
             }
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_static_banners_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_static_banners_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_static_banners_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'), '');
         /* icon */
         $this->data['icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'icon'));
         /* bgcolor*/
         $this->data['bgcolor'] = Journal2Utils::getProperty($module_data, 'bgcolor.value.color');
         /* image border */
         $this->data['image_border'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         /* sort sections */
         $sections = Journal2Utils::getProperty($module_data, 'sections', array());
         $sections = Journal2Utils::sortArray($sections);
         /* generate sections */
         $this->data['sections'] = array();
         foreach ($sections as $section) {
             if (!$section['status']) {
                 continue;
             }
             $image = Journal2Utils::getProperty($section, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             if (!$image || !file_exists(DIR_IMAGE . $image)) {
                 $image = Front::$IS_OC2 ? 'no_image.png' : 'no_image.jpg';
             }
             list($width, $height) = getimagesize(DIR_IMAGE . $image);
             $this->data['sections'][] = array('type' => 'image', 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($section, 'link')), 'target' => Journal2Utils::getProperty($section, 'link_new_window') ? 'target="_blank"' : '', 'image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'image_title' => Journal2Utils::getProperty($section, 'image_title.value.' . $this->config->get('config_language_id'), ''), 'image_width' => $width, 'image_height' => $height);
         }
         /* carousel mode */
         $this->data['carousel'] = Journal2Utils::getProperty($module_data, 'carousel', '0');
         if (Journal2Utils::getProperty($module_data, 'autoplay')) {
             $this->data['autoplay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
         } else {
             $this->data['autoplay'] = false;
         }
         $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'transition_speed', 400);
         $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover');
         $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'touch_drag');
         $this->data['default_section'] = '';
         $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'arrows');
         $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets');
         /* grid classes */
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['grid_classes'] = $this->data['carousel'] ? '' : 'xs-100 sm-100 md-100 lg-100 xl-100';
             $this->data['grid'] = $this->data['carousel'] ? array(array(0, 1), array(470, 1), array(760, 1), array(980, 1), array(1100, 1)) : array();
         } else {
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             $this->data['grid_classes'] = $this->data['carousel'] ? '' : Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
             $grid = Journal2Utils::getItemGrid(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
             $this->data['grid'] = $this->data['carousel'] ? array(array(0, (int) $grid['xs']), array(470, (int) $grid['sm']), array(760, (int) $grid['md']), array(980, (int) $grid['lg']), array(1100, (int) $grid['xl'])) : array();
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/static_banners.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
Пример #15
0
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* hide on mobile */
     if ($setting['position'] !== 'ajax' && Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if ($setting['position'] !== 'ajax' && Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     if (!version_compare(VERSION, '2.0.2', '<') && $this->config->get('config_google_captcha_status')) {
         $this->data['site_key'] = $this->config->get('config_google_captcha_public');
     } else {
         $this->data['site_key'] = '';
     }
     $cache_property = "module_journal_popup_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     $this->data['cookie_name'] = 'popup-' . Journal2Utils::getProperty($module_data, 'do_not_show_again_cookie');
     if ($this->data['is_ajax'] = isset($setting['position']) && $setting['position'] === 'ajax') {
         $cache = null;
     } else {
         if (isset($this->request->cookie[$this->data['cookie_name']])) {
             return;
         }
     }
     if ($cache === null || self::$CACHEABLE !== true) {
         /* set global module properties */
         $this->data['module'] = mt_rand();
         $this->data['hide_on_mobile_class'] = $setting['position'] !== 'ajax' && Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
         /* dimensions */
         $width = Journal2Utils::getProperty($module_data, 'width', 600);
         $header_height = Journal2Utils::getProperty($module_data, 'title_height', 40);
         $footer_height = Journal2Utils::getProperty($module_data, 'footer_height', 60);
         $newsletter_height = Journal2Utils::getProperty($module_data, 'newsletter_height', 80);
         $content_height = Journal2Utils::getProperty($module_data, 'height', 400);
         $height = $header_height + $footer_height + $content_height;
         /* newsletter */
         if (Journal2Utils::getProperty($module_data, 'newsletter')) {
             $this->data['newsletter'] = $this->getChild('module/journal2_newsletter', array('module_id' => Journal2Utils::getProperty($module_data, 'newsletter_id'), 'layout_id' => -1, 'position' => 'footer'));
             $this->data['newsletter_style'] = array();
             $color = Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'newsletter_bg_color.value.color'));
             if ($color) {
                 $this->data['newsletter_style'][] = "background-color: {$color}";
             }
             if ($newsletter_height) {
                 $this->data['newsletter_style'][] = "height: {$newsletter_height}px";
                 $height += $newsletter_height;
             }
         } else {
             $this->data['newsletter'] = false;
         }
         /* header */
         $this->data['close_button'] = (int) Journal2Utils::getProperty($module_data, 'close_button');
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'title.value.' . $this->config->get('config_language_id'));
         $this->data['header_style'] = array();
         $color = Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'title_bg_color.value.color'));
         if ($color) {
             $this->data['header_style'][] = "background-color: {$color}";
         }
         if ($header_height) {
             $this->data['header_style'][] = "height: {$header_height}px";
         }
         $this->data['header_style'] = array_merge($this->data['header_style'], $this->getFontSettings($module_data, 'title_font'));
         if (!$this->data['title']) {
             $height -= $header_height;
         }
         /* content */
         $this->data['type'] = Journal2Utils::getProperty($module_data, 'type', 'text');
         if ($this->data['type'] === 'contact') {
             $this->data['is_j2_popup'] = true;
             $this->data['action'] = $this->url->link('information/contact');
             $this->data['captcha'] = '';
             /* reset oc variables */
             foreach (array('content_top', 'name', 'error_name', 'email', 'error_email', 'enquiry', 'error_enquiry', 'captcha', 'error_captcha') as $var) {
                 $this->data[$var] = false;
             }
             /* load language */
             $this->language->load('information/contact');
             $this->data['heading_title'] = $this->language->get('heading_title');
             $this->data['entry_name'] = $this->language->get('entry_name');
             $this->data['entry_email'] = $this->language->get('entry_email');
             $this->data['entry_enquiry'] = $this->language->get('entry_enquiry');
             $this->data['entry_captcha'] = $this->language->get('entry_captcha');
             $this->data['product_id'] = isset($this->request->get['product_id']) ? $this->request->get['product_id'] : null;
             $this->data['button_submit'] = $this->getButtonStyle($module_data, 'button_submit', 'Submit');
         } else {
             $this->data['content'] = Journal2Utils::getProperty($module_data, 'text.' . $this->config->get('config_language_id'), '&nbsp;');
             $this->data['content_style'] = array();
             $this->data['content_style'][] = "height: {$content_height}px";
             if ($padding = Journal2Utils::getProperty($module_data, 'padding')) {
                 $this->data['content_style'][] = "padding: {$padding}px";
             }
             if (!$this->data['content']) {
                 $height -= $content_height;
             }
             if (Journal2Utils::getProperty($module_data, 'content_overflow', '1') == '1') {
                 $this->data['content_overflow'] = 'overflow-on';
             } else {
                 $this->data['content_overflow'] = '';
             }
         }
         /* footer */
         $this->data['footer'] = false;
         $this->data['footer_style'] = array();
         $color = Journal2Utils::getProperty($module_data, 'footer_bg_color.value.color');
         if ($color) {
             $this->data['footer_style'][] = "background-color: " . Journal2Utils::getColor($color);
         }
         if ($footer_height) {
             $this->data['footer_style'][] = "height: {$footer_height}px";
         }
         if ($this->data['type'] === 'contact') {
             $this->data['footer_style'][] = "text-align: " . Journal2Utils::getProperty($module_data, 'button_submit_position');
         }
         $this->data['button_1'] = $this->getButtonStyle($module_data, 'button_1');
         $this->data['button_2'] = $this->getButtonStyle($module_data, 'button_2');
         $this->data['do_not_show_again'] = Journal2Utils::getProperty($module_data, 'do_not_show_again', '0');
         $this->data['do_not_show_again_text'] = Journal2Utils::getProperty($module_data, 'do_not_show_again_text.value.' . $this->config->get('config_language_id'), "Don't show again.");
         $this->data['do_not_show_again_font'] = $this->getFontSettings($module_data, 'do_not_show_again_font');
         $this->data['footer_buttons_class'] = '';
         if ($this->data['button_1']['status'] || $this->data['button_1']['status']) {
             $this->data['footer'] = true;
             $this->data['footer_buttons_class'] = 'has-btn';
         }
         if ($this->data['do_not_show_again']) {
             $this->data['footer'] = true;
         }
         /* global styles */
         $this->data['global_style'] = array();
         $this->data['global_style'][] = "width: {$width}px";
         if ($this->data['type'] === 'text') {
             $this->data['global_style'][] = "height: {$height}px";
         }
         $this->data['global_style'] = array_merge($this->data['global_style'], Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background')));
         /* timers */
         $this->data['open_after'] = (int) Journal2Utils::getProperty($module_data, 'open_after', '0');
         $this->data['close_after'] = (int) Journal2Utils::getProperty($module_data, 'close_after', '0');
         /* render*/
         $this->template = $this->config->get('config_template') . '/template/journal2/module/popup.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
             $this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
         }
     } else {
         if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
             $fonts = json_decode($fonts, true);
             if (is_array($fonts)) {
                 foreach ($fonts as $font) {
                     $this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
                 }
             }
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addScript('catalog/view/theme/journal2/lib/jqueryc/jqueryc.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
Пример #16
0
 public function enquiry()
 {
     Journal2::startTimer('ProductTabs');
     $this->journal2->settings->set('enquiry_products', $this->model_journal2_module->getEnquiryProducts());
     Journal2::stopTimer('ProductTabs');
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     $cache_property = "module_journal_side_products_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}" . $this->journal2->cache->getRouteCacheKey();
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $products = array();
         $limit = Journal2Utils::getProperty($module_data, 'items_limit', 5);
         $this->data['image_width'] = $this->journal2->settings->get('side_product_image_width', 50);
         $this->data['image_height'] = $this->journal2->settings->get('side_product_image_height', 50);
         $this->data['image_resize_type'] = $this->journal2->settings->get('side_product_image_type', 'crop');
         $this->data['text_tax'] = $this->language->get('text_tax');
         $this->data['button_cart'] = $this->language->get('button_cart');
         $this->data['button_wishlist'] = $this->language->get('button_wishlist');
         $this->data['button_compare'] = $this->language->get('button_compare');
         $product_id = Journal2Utils::getProperty($this->request->get, 'product_id');
         $post_id = Journal2Utils::getProperty($this->request->get, 'journal_blog_post_id');
         switch (Journal2Utils::getProperty($module_data, 'section_type')) {
             case 'module':
                 switch (Journal2Utils::getProperty($module_data, 'module_type')) {
                     case 'featured':
                         $products = $this->model_journal2_product->getFeatured($limit, Journal2Utils::getProperty($module_data, 'featured_module_id'), Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'bestsellers':
                         $products = $this->model_journal2_product->getBestsellers($limit, Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'specials':
                         $products = $this->model_journal2_product->getSpecials($limit, Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'latest':
                         $products = $this->model_journal2_product->getLatest($limit, Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'related':
                         if ($product_id) {
                             $products = $this->model_journal2_product->getProductRelated($product_id, $limit);
                         } else {
                             if ($post_id) {
                                 $products = $this->model_journal2_blog->getRelatedProducts($post_id, $limit);
                             } else {
                                 $products = array();
                             }
                         }
                         break;
                     case 'people-also-bought':
                         $products = $this->model_journal2_product->getPeopleAlsoBought($product_id);
                         break;
                     case 'most-viewed':
                         $products = $this->model_journal2_product->getMostViewed($limit);
                         $this->has_random_products = true;
                         break;
                     case 'recently-viewed':
                         $products = $this->model_journal2_product->getRecentlyViewed($limit);
                         $this->has_random_products = true;
                         break;
                 }
                 break;
             case 'category':
                 $category_info = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($module_data, 'category.data.id'));
                 if (!$category_info) {
                     continue;
                 }
                 $products = $this->model_journal2_product->getProductsByCategory($category_info['category_id'], $limit);
                 break;
             case 'manufacturer':
                 $manufacturer = $this->model_catalog_manufacturer->getManufacturer(Journal2Utils::getProperty($module_data, 'manufacturer.data.id'));
                 if (!$manufacturer) {
                     continue;
                 }
                 $products = $this->model_journal2_product->getProductsByManufacturer($manufacturer['manufacturer_id'], $limit);
                 break;
             case 'custom':
                 foreach (Journal2Utils::sortArray(Journal2Utils::getProperty($module_data, 'products', array())) as $product) {
                     $result = $this->model_catalog_product->getProduct((int) Journal2Utils::getProperty($product, 'data.id'));
                     if (!$result) {
                         continue;
                     }
                     $products[] = $result;
                 }
                 break;
             case 'random':
                 $this->has_random_products = true;
                 $random_type = Journal2Utils::getProperty($module_data, 'random_from', 'all');
                 $category_id = $random_type === 'category' ? Journal2Utils::getProperty($module_data, 'random_from_category.id', -1) : -1;
                 $random_products = $this->model_journal2_product->getRandomProducts($limit, $category_id);
                 foreach ($random_products as $product) {
                     $result = $this->model_catalog_product->getProduct($product['product_id']);
                     if (!$result) {
                         continue;
                     }
                     $products[] = $result;
                 }
                 break;
         }
         if (!count($products)) {
             return;
         }
         $products_data = array();
         foreach ($products as $product) {
             $image = Journal2Utils::resizeImage($this->model_tool_image, $product['image'] ? $product['image'] : 'data/journal2/no_image_large.jpg', $this->data['image_width'], $this->data['image_height'], $this->data['image_resize_type']);
             if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
                 $price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
             } else {
                 $price = false;
             }
             if ((double) $product['special']) {
                 $special = $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id'], $this->config->get('config_tax')));
             } else {
                 $special = false;
             }
             if ($this->config->get('config_tax')) {
                 $tax = $this->currency->format((double) $product['special'] ? $product['special'] : $product['price']);
             } else {
                 $tax = false;
             }
             if ($this->config->get('config_review_status')) {
                 $rating = $product['rating'];
             } else {
                 $rating = false;
             }
             $product_sections = isset($this->data['items'][$product['product_id']]) ? $this->data['items'][$product['product_id']]['section_class'] : array();
             $results = $this->model_catalog_product->getProductImages($product['product_id']);
             $products_data[] = array('product_id' => $product['product_id'], 'section_class' => $product_sections, 'thumb' => $image, 'name' => $product['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'description' => utf8_substr(strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..', 'tax' => $tax, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $product['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']), 'labels' => $this->model_journal2_product->getLabels($product['product_id']));
         }
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'section_title.value.' . $this->config->get('config_language_id'));
         $this->data['products'] = $products_data;
         $this->template = $this->config->get('config_template') . "/template/journal2/module/side_products.tpl";
         if (self::$CACHEABLE === true && !$this->has_random_products) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* hide on mobile */
     if (Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_carousel_' . $setting['module_id'], implode('; ', $css));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_carousel_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}" . $this->journal2->cache->getRouteCacheKey();
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['show_title'] = Journal2Utils::getProperty($module_data, 'show_title');
         $this->data['brand_name'] = Journal2Utils::getProperty($module_data, 'brand_name');
         $this->data['module_type'] = Journal2Utils::getProperty($module_data, 'module_type');
         $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'arrows', 'top');
         $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets');
         $this->data['render_as'] = Journal2Utils::getProperty($module_data, 'display_as');
         if (Journal2Utils::getProperty($module_data, 'autoplay')) {
             $this->data['autoplay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
         } else {
             $this->data['autoplay'] = false;
         }
         $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'transition_speed', 400);
         $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover');
         $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'touch_drag');
         $this->data['default_section'] = '';
         /* generate sections */
         $this->data['sections'] = array();
         $this->data['items'] = array();
         /* image dimensions */
         $this->data['image_width'] = Journal2Utils::getProperty($module_data, 'image_width', $this->config->get('config_image_product_width'));
         $this->data['image_height'] = Journal2Utils::getProperty($module_data, 'image_height', $height = $this->config->get('config_image_product_height'));
         $this->data['image_resize_type'] = Journal2Utils::getProperty($module_data, 'image_type', 'fit');
         $this->data['dummy_image'] = $this->model_tool_image->resize('data/journal2/transparent.png', $this->data['image_width'], $this->data['image_height']);
         /* image border */
         if (Journal2Utils::getProperty($module_data, 'image_border')) {
             $this->data['image_border_css'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         } else {
             $this->data['image_border_css'] = null;
         }
         /* image background color */
         if (Journal2Utils::getProperty($module_data, 'image_bgcolor.value.color')) {
             $this->data['image_bgcolor'] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'image_bgcolor.value.color'));
         } else {
             $this->data['image_bgcolor'] = null;
         }
         switch ($this->data['module_type']) {
             case 'product':
                 $sections = Journal2Utils::getProperty($module_data, 'product_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateProductSections($sections);
                 $this->data['text_tax'] = $this->language->get('text_tax');
                 $this->data['button_cart'] = $this->language->get('button_cart');
                 $this->data['button_wishlist'] = $this->language->get('button_wishlist');
                 $this->data['button_compare'] = $this->language->get('button_compare');
                 break;
             case 'category':
                 $sections = Journal2Utils::getProperty($module_data, 'category_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateCategorySections($sections);
                 break;
             case 'manufacturer':
                 $sections = Journal2Utils::getProperty($module_data, 'manufacturer_sections', array());
                 $sections = Journal2Utils::sortArray($sections);
                 $this->generateManufacturerSections($sections);
                 break;
         }
         if (!$this->has_items) {
             return;
         }
         $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
         $this->data['single_class'] = count($this->data['sections']) == 1 ? 'single-tab' : '';
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['grid'] = array(array(0, 1), array(470, 1), array(760, 1), array(980, 1), array(1100, 1));
         } else {
             $grid = Journal2Utils::getItemGrid(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
             $this->data['grid'] = array(array(0, (int) $grid['xs']), array(470, (int) $grid['sm']), array(760, (int) $grid['md']), array(980, (int) $grid['lg']), array(1100, (int) $grid['xl']));
         }
         if (count($this->data['sections']) > 1) {
             $this->data['show_title'] = 1;
         }
         $this->data['show_title_class'] = $this->data['show_title'] ? '' : 'no-heading';
         $this->template = $this->config->get('config_template') . "/template/journal2/module/carousel_{$this->data['module_type']}.tpl";
         if (self::$CACHEABLE === true && !$this->has_random_products) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_cms_blocks_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_cms_blocks_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_cms_blocks_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'), '');
         /* sort sections */
         $sections = Journal2Utils::getProperty($module_data, 'sections', array());
         $sections = Journal2Utils::sortArray($sections);
         /* generate sections */
         $this->data['sections'] = array();
         foreach ($sections as $section) {
             if (!$section['status']) {
                 continue;
             }
             $css = array();
             if (Journal2Utils::getColor(Journal2Utils::getProperty($section, 'icon_bg_color.value.color'))) {
                 $css[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($section, 'icon_bg_color.value.color'));
             }
             if (Journal2Utils::getProperty($section, 'icon_width')) {
                 $css[] = 'width: ' . Journal2Utils::getProperty($section, 'icon_width') . 'px';
             }
             if (Journal2Utils::getProperty($section, 'icon_height')) {
                 $css[] = 'height: ' . Journal2Utils::getProperty($section, 'icon_height') . 'px';
                 $css[] = 'line-height: ' . Journal2Utils::getProperty($section, 'icon_height') . 'px';
             }
             if (Journal2Utils::getProperty($section, 'icon_border')) {
                 $css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($section, 'icon_border')));
             }
             if ($color = Journal2Utils::getProperty($section, 'bg_color.value.color')) {
                 $color = 'background-color: ' . Journal2Utils::getColor($color);
             } else {
                 $color = null;
             }
             $this->data['sections'][] = array('css' => $color, 'has_icon' => Journal2Utils::getProperty($section, 'icon_status'), 'icon_position' => Journal2Utils::getProperty($section, 'icon_position', 'top'), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($section, 'icon')), 'icon_css' => implode('; ', $css), 'type' => 'html', 'title' => Journal2Utils::getProperty($section, 'section_title.value.' . $this->config->get('config_language_id'), ''), 'content_align' => Journal2Utils::getProperty($section, 'text_align', 'left'), 'content' => Journal2Utils::getProperty($section, 'text.' . $this->config->get('config_language_id'), 'Not Translated'));
         }
         /* grid classes */
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['grid_classes'] = 'xs-100 sm-100 md-100 lg-100 xl-100';
         } else {
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             $this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/cms_blocks.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* hide on mobile */
     $disable_mobile = Journal2Utils::getProperty($module_data, 'disable_mobile') && $this->journal2->settings->get('responsive_design');
     if ($disable_mobile && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet())) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     $this->data['disable_mobile'] = $disable_mobile ? 'hide-on-mobile' : '';
     $this->data['height'] = Journal2Utils::getProperty($module_data, 'height');
     $this->data['css'] = array();
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_carousel_grid_' . $setting['module_id'], implode('; ', $css));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
         }
         $this->data['css'] = $css;
     }
     $module_spacing = Journal2Utils::getProperty($module_data, 'module_spacing');
     $this->data['module_spacing'] = $module_spacing !== null ? $module_spacing . 'px' : null;
     $this->data['css'] = implode('; ', $this->data['css']);
     $cache_property = "module_journal_carousel_grid_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $this->data['module'] = mt_rand();
         $columns = Journal2Utils::getProperty($module_data, 'columns', array());
         $columns = Journal2Utils::sortArray($columns);
         $this->data['columns'] = array();
         foreach ($columns as $column) {
             if (!$column['status']) {
                 continue;
             }
             $module_disable_mobile = Journal2Utils::getProperty($column, 'disable_mobile') && $this->journal2->settings->get('responsive_design');
             if ($module_disable_mobile && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet())) {
                 continue;
             }
             /* hide on desktop */
             if (Journal2Utils::getProperty($column, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
                 return;
             }
             $size = floor($column['width']);
             $this->data['columns'][] = array('classes' => "xs-{$size} sm-{$size} md-{$size} lg-{$size} xl-{$size}", 'content' => $this->getChild('module/journal2_carousel', array('module_id' => Journal2Utils::getProperty($column, 'module_id'), 'layout_id' => -1, 'position' => 'multi_module')));
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/carousel_grid.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
Пример #21
0
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     if (Journal2Utils::getProperty($module_data, 'hideonmobile') && Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_slider_' . $setting['module_id'], implode('; ', $css));
     }
     $this->journal2->html_classes->removeClass('backface');
     $cache_property = "module_journal_slider_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $caption_id = 0;
         /* slider position */
         $height = Journal2Utils::getProperty($module_data, 'height', 400);
         $width = null;
         switch ($setting['position']) {
             case 'column_left':
             case 'column_right':
                 $width = 220;
                 $this->data['width'] = "max-width: {$width}px";
                 $this->data['slider_class'] = 'journal-slider';
                 break;
             case 'content_top':
             case 'content_bottom':
                 if ($this->journal2->settings->get('extended_layout')) {
                     $width = $this->journal2->settings->get('site_width', 1024) - 240 * $this->journal2->settings->get('config_columns_count');
                 } else {
                     $width = $this->journal2->settings->get('site_width', 1024) - 40 - 240 * $this->journal2->settings->get('config_columns_count');
                 }
                 $this->data['width'] = "max-width: {$width}px";
                 $this->data['slider_class'] = 'journal-slider';
                 break;
             case 'top':
             case 'bottom':
                 $width = $this->journal2->settings->get('site_width', 1024);
                 if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
                     $this->data['width'] = "max-width: 100%";
                     $this->data['slider_class'] = 'journal-fullwidth-slider';
                 } else {
                     $this->data['width'] = "max-width: {$width}px";
                     $this->data['slider_class'] = 'journal-slider';
                 }
                 break;
             case 'multi_module':
                 $width = $setting['width'];
                 $height = $setting['height'];
                 $this->data['width'] = "max-width: {$width}px";
                 $this->data['slider_class'] = 'journal-slider';
                 break;
         }
         /* global style data */
         $this->data['global_style'] = array();
         $this->data['js_options'] = Journal2Utils::getProperty($module_data, 'js_options', array());
         $this->data['js_options']['startwidth'] = $width;
         $this->data['js_options']['startheight'] = $height;
         $this->data['height'] = $height;
         if (Journal2Utils::getProperty($module_data, 'hidecaptionsonmobile')) {
             $this->data['js_options']['hideAllCaptionAtLimit'] = 760;
         }
         $slides = Journal2Utils::getProperty($module_data, 'slides', array());
         $slides = Journal2Utils::sortArray($slides);
         $_slides = array();
         $first = true;
         foreach ($slides as $slide) {
             if (isset($slide['status']) && !$slide['status']) {
                 continue;
             }
             $slide_data = array();
             if ($first) {
                 $slide_data[] = 'data-fstransition="fade"';
                 $slide_data[] = 'data-fsslotamount="0"';
                 $slide_data[] = 'data-fsmasterspeed="0"';
                 $first = false;
             }
             $slide_data[] = 'data-transition="' . Journal2Utils::getProperty($slide, 'transition', 'fade') . '"';
             $slide_data[] = 'data-easing="' . Journal2Utils::getProperty($slide, 'easing', 'Expo.easeOut') . '"';
             $slide_data[] = 'data-masterspeed="' . Journal2Utils::getProperty($slide, 'masterspeed', 800) . '"';
             if (Journal2Utils::getProperty($slide, 'slotamount')) {
                 $slide_data[] = 'data-slotamount="' . Journal2Utils::getProperty($slide, 'slotamount') . '"';
             }
             if (Journal2Utils::getProperty($slide, 'delay')) {
                 $slide_data[] = 'data-delay="' . Journal2Utils::getProperty($slide, 'delay') . '"';
             }
             $link = $this->model_journal2_menu->getLink(Journal2Utils::getProperty($slide, 'link'));
             if ($link) {
                 $slide_data[] = 'data-link="' . $link . '"';
                 if (Journal2Utils::getProperty($slide, 'link_new_window')) {
                     $slide_data[] = 'data-target="_blank"';
                 }
             }
             $captions = Journal2Utils::getProperty($slide, 'captions', array());
             $captions = Journal2Utils::sortArray($captions);
             $_captions = array();
             foreach ($captions as $caption) {
                 if (isset($caption['status']) && !$caption['status']) {
                     continue;
                 }
                 $caption_id++;
                 $caption_data = array();
                 $caption_classes = array();
                 if (Journal2Utils::getProperty($caption, 'x', '1')) {
                     $caption_data[] = 'data-x="' . Journal2Utils::getProperty($caption, 'x', '1') . '"';
                 }
                 if (Journal2Utils::getProperty($caption, 'y', '1')) {
                     $caption_data[] = 'data-y="' . Journal2Utils::getProperty($caption, 'y', '1') . '"';
                 }
                 if (Journal2Utils::getProperty($caption, 'speed')) {
                     $caption_data[] = 'data-speed="' . Journal2Utils::getProperty($caption, 'speed') . '"';
                 }
                 if (Journal2Utils::getProperty($caption, 'start')) {
                     $caption_data[] = 'data-start="' . Journal2Utils::getProperty($caption, 'start') . '"';
                 }
                 if (Journal2Utils::getProperty($caption, 'endspeed')) {
                     $caption_data[] = 'data-endspeed="' . Journal2Utils::getProperty($caption, 'endspeed') . '"';
                 }
                 if (Journal2Utils::getProperty($caption, 'end')) {
                     $caption_data[] = 'data-end="' . Journal2Utils::getProperty($caption, 'end') . '"';
                 }
                 $caption_data[] = 'data-easing="' . Journal2Utils::getProperty($caption, 'easing', 'Expo.easeOut') . '"';
                 $caption_data[] = 'data-endeasing="' . Journal2Utils::getProperty($caption, 'endeasing', 'Expo.easeOut') . '"';
                 $content = '';
                 $css = array();
                 switch (Journal2Utils::getProperty($caption, 'type')) {
                     case 'image':
                         $image = Journal2Utils::getProperty($caption, 'image', 'no_image.jpg');
                         if (is_array($image)) {
                             $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
                         }
                         if (!$image || !file_exists(DIR_IMAGE . $image)) {
                             $image = 'no_image.jpg';
                         }
                         $image = Journal2Utils::resizeImage($this->model_tool_image, $image);
                         $alt = Journal2Utils::getProperty($caption, 'caption_name');
                         $content = '<img src="' . $image . '" alt="' . $alt . '" />';
                         break;
                     case 'text':
                         if (Journal2Utils::getProperty($caption, 'text_font.value.font_type') === 'google') {
                             $font_name = Journal2Utils::getProperty($caption, 'text_font.value.font_name');
                             $font_subset = Journal2Utils::getProperty($caption, 'text_font.value.font_subset');
                             $font_weight = Journal2Utils::getProperty($caption, 'text_font.value.font_weight');
                             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
                             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
                             $weight = filter_var(Journal2Utils::getProperty($caption, 'text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
                             $css[] = 'font-weight: ' . ($weight ? $weight : 400);
                             $css[] = "font-family: '" . Journal2Utils::getProperty($caption, 'text_font.value.font_name') . "'";
                         }
                         if (Journal2Utils::getProperty($caption, 'text_font.value.font_type') === 'system') {
                             $css[] = 'font-weight: ' . Journal2Utils::getProperty($caption, 'text_font.value.font_weight');
                             $css[] = 'font-family: ' . Journal2Utils::getProperty($caption, 'text_font.value.font_family');
                         }
                         if (Journal2Utils::getProperty($caption, 'text_font.value.font_type') !== 'none') {
                             $css[] = 'font-size: ' . Journal2Utils::getProperty($caption, 'text_font.value.font_size');
                             $css[] = 'font-style: ' . Journal2Utils::getProperty($caption, 'text_font.value.font_style');
                             $css[] = 'text-transform: ' . Journal2Utils::getProperty($caption, 'text_font.value.text_transform');
                         }
                         if (Journal2Utils::getProperty($caption, 'text_font.value.color.value.color')) {
                             $css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($caption, 'text_font.value.color.value.color'));
                         }
                         $css[] = 'text-align: ' . Journal2Utils::getProperty($caption, 'text_align', 'center');
                         if (Journal2Utils::getProperty($caption, 'text_bgcolor.value.color')) {
                             $css[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($caption, 'text_bgcolor.value.color'));
                         }
                         if (Journal2Utils::getProperty($caption, 'text_hover_color.value.color')) {
                             $this->data['global_style'][] = "#jcaption-{$module}-{$caption_id}:hover { color: " . Journal2Utils::getColor(Journal2Utils::getProperty($caption, 'text_hover_color.value.color')) . " !important; }";
                         }
                         if (Journal2Utils::getProperty($caption, 'text_hover_bg_color.value.color')) {
                             $this->data['global_style'][] = "#jcaption-{$module}-{$caption_id}:hover { background-color: " . Journal2Utils::getColor(Journal2Utils::getProperty($caption, 'text_hover_bg_color.value.color')) . " !important; }";
                         }
                         if (Journal2Utils::getProperty($caption, 'text_border')) {
                             $css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($caption, 'text_border')));
                         }
                         if (Journal2Utils::getProperty($caption, 'text_hover_border_color.value.color')) {
                             $this->data['global_style'][] = "#jcaption-{$module}-{$caption_id}:hover { border-color: " . Journal2Utils::getColor(Journal2Utils::getProperty($caption, 'text_hover_border_color.value.color')) . " !important; }";
                         }
                         if (Journal2Utils::getProperty($caption, 'text_padding_top') !== null) {
                             $css[] = 'padding-top: ' . Journal2Utils::getProperty($caption, 'text_padding_top') . 'px';
                         }
                         if (Journal2Utils::getProperty($caption, 'text_padding_right') !== null) {
                             $css[] = 'padding-right: ' . Journal2Utils::getProperty($caption, 'text_padding_right') . 'px';
                         }
                         if (Journal2Utils::getProperty($caption, 'text_padding_bottom') !== null) {
                             $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($caption, 'text_padding_bottom') . 'px';
                         }
                         if (Journal2Utils::getProperty($caption, 'text_padding_left') !== null) {
                             $css[] = 'padding-left: ' . Journal2Utils::getProperty($caption, 'text_padding_left') . 'px';
                         }
                         if (Journal2Utils::getProperty($caption, 'text_line_height')) {
                             $css[] = 'line-height: ' . Journal2Utils::getProperty($caption, 'text_line_height') . 'px';
                         }
                         $content = Journal2Utils::getProperty($caption, 'text.value.' . $this->config->get('config_language_id'));
                         break;
                     case 'video':
                         if (Journal2Utils::getProperty($caption, 'video_fullwidth')) {
                             $caption_classes[] = 'fullscreenvideo';
                             $caption_data[] = 'data-forceCover="1"';
                             $width = '100%';
                             $height = '100%';
                         } else {
                             $width = Journal2Utils::getProperty($caption, 'video_width', 100);
                             $height = Journal2Utils::getProperty($caption, 'video_height', 100);
                         }
                         switch (Journal2Utils::getProperty($caption, 'video_type')) {
                             case 'youtube':
                                 $video_id = Journal2Utils::getProperty($caption, 'video_yt_id');
                                 if (!$video_id) {
                                     continue;
                                 }
                                 $content = '<iframe src="//www.youtube.com/embed/' . $video_id . '?enablejsapi=1&html5=1&amp;hd=1&amp;wmode=opaque&amp;controls=1&amp;showinfo=0;rel=0;" width="' . $width . '" height="' . $height . '"></iframe>';
                                 break;
                             case 'vimeo':
                                 $video_id = Journal2Utils::getProperty($caption, 'video_vm_id');
                                 if (!$video_id) {
                                     continue;
                                 }
                                 $content = '<iframe src="//player.vimeo.com/video/' . $video_id . '?title=0&amp;byline=0&amp;portrait=0;api=1" width="' . $width . '" height="' . $height . '"></iframe>';
                                 break;
                             case 'local':
                                 $file_extensions = array('mp4', 'webm', 'ogg');
                                 $content = '<video class="" preload="none" width="' . $width . '" height="' . $height . '" data-setup="{}" controls';
                                 $poster_path = Journal2Utils::getProperty($caption, 'video_path') . '.png';
                                 if (file_exists(DIR_APPLICATION . '../' . $poster_path)) {
                                     $content .= ' poster="' . $poster_path . '" data-setup="{}"';
                                 }
                                 $content .= '>';
                                 foreach ($file_extensions as $file_extension) {
                                     $video_path = Journal2Utils::getProperty($caption, 'video_path') . '.' . $file_extension;
                                     if (file_exists(DIR_APPLICATION . '../' . $video_path)) {
                                         $content .= '<source src="' . $video_path . '" type="video/' . $file_extension . '" />';
                                     }
                                 }
                                 $content .= '</video>';
                                 break;
                         }
                         if (Journal2Utils::getProperty($caption, 'video_autoplay')) {
                             $caption_data[] = 'data-autoplay="true"';
                             $caption_data[] = 'data-forcerewind="on"';
                         } else {
                             $caption_data[] = 'data-autoplay="false"';
                         }
                         if (Journal2Utils::getProperty($caption, 'video_autoplayonlyfirsttime')) {
                             $caption_data[] = 'data-autoplayonlyfirsttime="true"';
                         } else {
                             $caption_data[] = 'data-autoplayonlyfirsttime="false"';
                         }
                         if (Journal2Utils::getProperty($caption, 'video_nextslideatend')) {
                             $caption_data[] = 'data-nextslideatend="true"';
                         } else {
                             $caption_data[] = 'data-nextslideatend="false"';
                         }
                         if (!Journal2Utils::getProperty($caption, 'video_volume')) {
                             $caption_data[] = 'data-volume="mute"';
                         }
                         break;
                 }
                 $caption_classes[] = Journal2Utils::getProperty($caption, 'animation_in', 'fade');
                 $caption_classes[] = Journal2Utils::getProperty($caption, 'animation_out', 'fadeout');
                 if (Journal2Utils::getProperty($caption, 'animation_in') === 'customin') {
                     $custom_in = array();
                     $custom_out = array();
                     // in
                     if (Journal2Utils::getProperty($caption, 'custom_in_transition_x') !== null) {
                         $custom_in[] = 'x:' . Journal2Utils::getProperty($caption, 'custom_in_transition_x');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_transition_y') !== null) {
                         $custom_in[] = 'y:' . Journal2Utils::getProperty($caption, 'custom_in_transition_y');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_scale_x') !== null) {
                         $custom_in[] = 'scaleX:' . Journal2Utils::getProperty($caption, 'custom_in_scale_x');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_scale_y') !== null) {
                         $custom_in[] = 'scaleY:' . Journal2Utils::getProperty($caption, 'custom_in_scale_y');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_rotation_x') !== null) {
                         $custom_in[] = 'rotationX:' . Journal2Utils::getProperty($caption, 'custom_in_rotation_x');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_rotation_y') !== null) {
                         $custom_in[] = 'rotationY:' . Journal2Utils::getProperty($caption, 'custom_in_rotation_y');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_rotation_z') !== null) {
                         $custom_in[] = 'rotationZ:' . Journal2Utils::getProperty($caption, 'custom_in_rotation_z');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_in_transform_perspective', '500') !== null) {
                         $custom_in[] = 'transformPerspective:' . Journal2Utils::getProperty($caption, 'custom_in_transform_perspective', '500');
                     }
                     $custom_in[] = 'opacity:' . Journal2Utils::getProperty($caption, 'custom_in_opacity');
                     $custom_in[] = 'transformOrigin:' . Journal2Utils::getProperty($caption, 'transformOriginXin', 'center') . ' ' . Journal2Utils::getProperty($caption, 'transformOriginYin', 'center');
                     // out
                     if (Journal2Utils::getProperty($caption, 'custom_out_transition_x') !== null) {
                         $custom_out[] = 'x:' . Journal2Utils::getProperty($caption, 'custom_out_transition_x');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_transition_y') !== null) {
                         $custom_out[] = 'y:' . Journal2Utils::getProperty($caption, 'custom_out_transition_y');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_scale_x') !== null) {
                         $custom_out[] = 'scaleX:' . Journal2Utils::getProperty($caption, 'custom_out_scale_x');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_scale_y') !== null) {
                         $custom_out[] = 'scaleY:' . Journal2Utils::getProperty($caption, 'custom_out_scale_y');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_rotation_x') !== null) {
                         $custom_out[] = 'rotationX:' . Journal2Utils::getProperty($caption, 'custom_out_rotation_x');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_rotation_y') !== null) {
                         $custom_out[] = 'rotationY:' . Journal2Utils::getProperty($caption, 'custom_out_rotation_y');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_rotation_z') !== null) {
                         $custom_out[] = 'rotationZ:' . Journal2Utils::getProperty($caption, 'custom_out_rotation_z');
                     }
                     if (Journal2Utils::getProperty($caption, 'custom_out_transform_perspective', '500') !== null) {
                         $custom_out[] = 'transformPerspective:' . Journal2Utils::getProperty($caption, 'custom_out_transform_perspective', '500');
                     }
                     $custom_out[] = 'opacity:' . Journal2Utils::getProperty($caption, 'custom_out_opacity');
                     $custom_out[] = 'transformOrigin:' . Journal2Utils::getProperty($caption, 'transformOriginXout', 'center') . ' ' . Journal2Utils::getProperty($caption, 'transformOriginYout', 'center');
                     $caption_data[] = 'data-customin="' . implode(';', $custom_in) . '"';
                     $caption_data[] = 'data-customout="' . implode(';', $custom_out) . '"';
                 }
                 $_captions[] = array('id' => "{$module}-{$caption_id}", 'content' => $content, 'data' => implode(' ', $caption_data), 'classes' => implode(' ', $caption_classes), 'css' => implode('; ', $css), 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($caption, 'link')), 'target' => Journal2Utils::getProperty($caption, 'link_new_window') ? ' target="_blank"' : '');
             }
             $image = Journal2Utils::getProperty($slide, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             if (!file_exists(DIR_IMAGE . $image)) {
                 $image = 'no_image.jpg';
             }
             $thumb = Journal2Utils::getProperty($slide, 'thumb');
             if (is_array($thumb)) {
                 $thumb = Journal2Utils::getProperty($thumb, $this->config->get('config_language_id'));
             }
             if (!$thumb || !file_exists(DIR_IMAGE . $thumb)) {
                 $thumb = $image;
             }
             $slide_data[] = 'data-thumb="' . Journal2Utils::resizeImage($this->model_tool_image, $thumb, $this->data['js_options']['thumbWidth'], $this->data['js_options']['thumbHeight'], 'crop') . '"';
             $_slides[] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'name' => Journal2Utils::getProperty($slide, 'slide_name'), 'data' => implode(' ', $slide_data), 'captions' => $_captions);
         }
         $this->data['module'] = $module;
         $this->data['slides'] = $_slides;
         $this->data['js_options']['thumbAmount'] = min($this->data['js_options']['thumbAmount'], count($this->data['slides']));
         $this->data['timer'] = Journal2Utils::getProperty($module_data, 'timer');
         $this->data['preload_images'] = Journal2Utils::getProperty($module_data, 'preload_images', '1');
         $this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'hideonmobile') ? 'hide-on-mobile' : '';
         $this->data['dummy_image'] = Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.png');
         $this->template = $this->config->get('config_template') . '/template/journal2/module/slider_advanced.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
             $this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
         }
     } else {
         if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
             $fonts = json_decode($fonts, true);
             if (is_array($fonts)) {
                 foreach ($fonts as $font) {
                     $this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
                 }
             }
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addStyle('catalog/view/theme/journal2/lib/rs-plugin/css/settings.css');
     $this->document->addScript('catalog/view/theme/journal2/lib/rs-plugin/js/jquery.themepunch.tools.min.js');
     $this->document->addScript('catalog/view/theme/journal2/lib/rs-plugin/js/jquery.themepunch.revolution.min.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_blog_side_posts_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'), 'Not Translated');
         $module_type = Journal2Utils::getProperty($module_data, 'module_data.module_type', 'newest');
         $limit = Journal2Utils::getProperty($module_data, 'module_data.limit', 5);
         $posts = array();
         switch ($module_type) {
             case 'newest':
             case 'comments':
             case 'views':
                 $posts = $this->model_journal2_blog->getPosts(array('sort' => $module_type, 'start' => 0, 'limit' => $limit));
                 break;
             case 'related':
                 if (isset($this->request->get['route']) && $this->request->get['route'] === 'product/product' && isset($this->request->get['product_id'])) {
                     $posts = $this->model_journal2_blog->getRelatedPosts($this->request->get['product_id'], $limit);
                 }
                 break;
             case 'custom':
                 $custom_posts = Journal2Utils::getProperty($module_data, 'module_data.posts', array());
                 $custom_posts_ids = array();
                 foreach ($custom_posts as $custom_post) {
                     $post_id = (int) Journal2Utils::getProperty($custom_post, 'data.id', 0);
                     if ($post_id) {
                         $custom_posts_ids[$post_id] = $post_id;
                     }
                 }
                 if ($custom_posts_ids) {
                     $posts = $this->model_journal2_blog->getPosts(array('post_ids' => implode(',', $custom_posts_ids)));
                 }
                 break;
         }
         if (!$posts) {
             return;
         }
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['is_column'] = true;
             $this->data['grid_classes'] = 'xs-100 sm-100 md-100 lg-100 xl-100';
         } else {
             $this->data['is_column'] = false;
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             $this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
         }
         $this->data['image_width'] = $this->journal2->settings->get('side_post_image_width', 55);
         $this->data['image_height'] = $this->journal2->settings->get('side_post_image_height', 55);
         $this->data['posts'] = array();
         foreach ($posts as $post) {
             $this->data['posts'][] = array('name' => $post['name'], 'comments' => $post['comments'], 'date' => date($this->language->get('date_format_short'), strtotime($post['date'])), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $post, $this->data['image_width'], $this->data['image_height'], 'crop'), 'href' => $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']));
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/blog_side_posts.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* hide on mobile */
     if (Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_headline_rotator_' . $setting['module_id'], implode('; ', $css));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_headline_rotator_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['transition_delay'] = Journal2Utils::getProperty($module_data, 'transition_delay', 4000);
         $this->data['bullets_position'] = Journal2Utils::getProperty($module_data, 'bullets_position', 'center');
         /* quote options */
         $css = array();
         $css[] = 'text-align: ' . Journal2Utils::getProperty($module_data, 'text_align', 'center');
         $this->data['text_align'] = Journal2Utils::getProperty($module_data, 'text_align', 'center');
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'text_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'text_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $css[] = 'font-weight: ' . ($weight ? $weight : 400);
             $css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'text_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'system') {
             $css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') !== 'none') {
             $css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_size');
             $css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_style');
             $css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'text_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color')) {
             $css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color'));
         }
         $this->data['quote_css'] = implode('; ', $css);
         /* rotator options */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'text_background'));
         $this->data['rotator_css'] = implode('; ', $css);
         /* sections */
         $this->data['sections'] = array();
         $sections = Journal2Utils::getProperty($module_data, 'sections', array());
         $sections = Journal2Utils::sortArray($sections);
         foreach ($sections as $section) {
             if (!$section['status']) {
                 continue;
             }
             $offset_style = array();
             if (Journal2Utils::getProperty($section, 'cta_offset_top')) {
                 $offset_style[] = 'top: ' . Journal2Utils::getProperty($section, 'cta_offset_top') . 'px';
             }
             if (Journal2Utils::getProperty($section, 'cta_offset_left')) {
                 $offset_style[] = 'left: ' . Journal2Utils::getProperty($section, 'cta_offset_left') . 'px';
             }
             $this->data['sections'][] = array('text' => Journal2Utils::getProperty($section, 'text.value.' . $this->config->get('config_language_id')), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($section, 'icon')), 'cta_icon_position' => Journal2Utils::getProperty($section, 'cta_icon_position', 'right'), 'cta' => Journal2Utils::getProperty($section, 'cta'), 'cta_position' => Journal2Utils::getProperty($section, 'cta_position'), 'cta_text' => Journal2Utils::getProperty($section, 'cta_text.value.' . $this->config->get('config_language_id')), 'cta_icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($section, 'cta_icon')), 'cta_link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($section, 'cta_link')), 'cta_target' => Journal2Utils::getProperty($section, 'cta_new_window') ? 'target="_blank"' : '', 'cta_style' => implode('; ', $offset_style));
         }
         /* bullets */
         $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets') && count($this->data['sections']) > 1 ? true : false;
         /* pause on hover */
         $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover', '1');
         $this->template = $this->config->get('config_template') . '/template/journal2/module/headline_rotator.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
             $this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
         }
     } else {
         if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
             $fonts = json_decode($fonts, true);
             if (is_array($fonts)) {
                 foreach ($fonts as $font) {
                     $this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
                 }
             }
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addScript('catalog/view/theme/journal2/lib/quovolver/jquery.quovolver.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* hide on mobile */
     if (Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     /* hide on desktop */
     if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
         return;
     }
     $this->data['cookie_name'] = 'header_notice-' . Journal2Utils::getProperty($module_data, 'do_not_show_again_cookie');
     $this->data['do_not_show_again'] = Journal2Utils::getProperty($module_data, 'do_not_show_again', '1');
     if ($this->data['do_not_show_again'] && isset($this->request->cookie[$this->data['cookie_name']])) {
         return;
     }
     $cache_property = "module_journal_header_notice_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['text'] = Journal2Utils::getProperty($module_data, 'text.value.' . $this->config->get('config_language_id'));
         $this->data['icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'icon'));
         $this->data['icon_position'] = Journal2Utils::getProperty($module_data, 'icon_position', 'left');
         $this->data['float_icon'] = Journal2Utils::getProperty($module_data, 'float_icon', '0') == '1' ? 'floated-icon' : '';
         $this->data['fullwidth'] = Journal2Utils::getProperty($module_data, 'fullwidth', '0') == '1' ? 'fullwidth-notice' : '';
         $this->data['close_button_type'] = Journal2Utils::getProperty($module_data, 'close_button_type', 'icon');
         $this->data['close_button_text'] = Journal2Utils::getProperty($module_data, 'close_button_text.value.' . $this->config->get('config_language_id'), 'Close');
         $css = array();
         if (($value = Journal2Utils::getProperty($module_data, 'padding_t.value.text')) !== null) {
             $css[] = 'padding-top: ' . $value . 'px';
         }
         if (($value = Journal2Utils::getProperty($module_data, 'padding_r.value.text')) !== null) {
             $css[] = 'padding-right: ' . $value . 'px';
         }
         if (($value = Journal2Utils::getProperty($module_data, 'padding_b.value.text')) !== null) {
             $css[] = 'padding-bottom: ' . $value . 'px';
         }
         if (($value = Journal2Utils::getProperty($module_data, 'padding_l.value.text')) !== null) {
             $css[] = 'padding-left: ' . $value . 'px';
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'text_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'text_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $css[] = 'font-weight: ' . ($weight ? $weight : 400);
             $css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'text_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'system') {
             $css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') !== 'none') {
             $css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_size');
             $css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_style');
             $css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'text_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color')) {
             $css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color'));
         }
         if ($color = Journal2Utils::getProperty($module_data, 'text_background_color.value.color')) {
             $css[] = "background-color: " . Journal2Utils::getColor($color);
         }
         $this->data['css'] = implode('; ', $css);
         $global_style = array();
         /* link colors */
         if ($color = Journal2Utils::getProperty($module_data, 'text_link_color.value.color')) {
             $global_style[] = "#journal-header-notice-{$module} a { color: " . Journal2Utils::getColor($color) . "}";
         }
         if ($color = Journal2Utils::getProperty($module_data, 'text_link_hover_color.value.color')) {
             $global_style[] = "#journal-header-notice-{$module} a:hover { color: " . Journal2Utils::getColor($color) . "}";
         }
         /* button colors */
         if ($color = Journal2Utils::getProperty($module_data, 'button_color.value.color')) {
             $global_style[] = "#journal-header-notice-{$module} .close-notice { color: " . Journal2Utils::getColor($color) . "}";
         }
         if ($color = Journal2Utils::getProperty($module_data, 'button_hover_color.value.color')) {
             $global_style[] = "#journal-header-notice-{$module} .close-notice:hover { color: " . Journal2Utils::getColor($color) . "}";
         }
         if ($color = Journal2Utils::getProperty($module_data, 'button_bg_color.value.color')) {
             $global_style[] = "#journal-header-notice-{$module} .close-notice { background-color: " . Journal2Utils::getColor($color) . "}";
         }
         if ($color = Journal2Utils::getProperty($module_data, 'button_hover_bg_color.value.color')) {
             $global_style[] = "#journal-header-notice-{$module} .close-notice:hover { background-color: " . Journal2Utils::getColor($color) . "}";
         }
         $this->data['global_style'] = $global_style;
         $this->template = $this->config->get('config_template') . '/template/journal2/module/header_notice.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
             $this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
         }
     } else {
         if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
             $fonts = json_decode($fonts, true);
             if (is_array($fonts)) {
                 foreach ($fonts as $font) {
                     $this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
                 }
             }
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addScript('catalog/view/theme/journal2/lib/jqueryc/jqueryc.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'module_data.enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'module_data.enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'module_data.enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_data.background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'module_data.margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'module_data.margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_blog_posts_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_blog_posts_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'module_data.fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
             $css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_data.module_background')));
             if (Journal2Utils::getProperty($module_data, 'module_data.module_padding')) {
                 $this->data['gutter_on_class'] = 'gutter-on';
                 $css[] = 'padding: 20px';
             }
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_blog_posts_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'));
         $this->data['display'] = Journal2Utils::getProperty($module_data, 'module_data.display', 'grid');
         $this->data['content_align'] = Journal2Utils::getProperty($module_data, 'module_data.content_align', 'center');
         /* carousel */
         $this->data['carousel'] = Journal2Utils::getProperty($module_data, 'module_data.carousel');
         if ($this->data['carousel']) {
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             if ($this->data['display'] === 'list') {
                 $this->data['grid'] = array(array(0, 1), array(470, 1), array(760, 1), array(980, 1), array(1100, 1));
             } else {
                 $this->data['grid'] = Journal2Utils::getItemGrid(Journal2Utils::getProperty($module_data, 'module_data.items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
                 $this->data['grid'] = array(array(0, (int) $this->data['grid']['xs']), array(470, (int) $this->data['grid']['sm']), array(760, (int) $this->data['grid']['md']), array(980, (int) $this->data['grid']['lg']), array(1100, (int) $this->data['grid']['xl']));
             }
             $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'module_data.carousel_arrows');
             $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'module_data.carousel_bullets');
             if (Journal2Utils::getProperty($module_data, 'module_data.autoplay')) {
                 $this->data['autoplay'] = Journal2Utils::getProperty($module_data, 'module_data.transition_delay', 3000);
             } else {
                 $this->data['autoplay'] = false;
             }
             $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'module_data.transition_speed', 400);
             $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'module_data.pause_on_hover');
             $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'module_data.touch_drag');
         }
         $module_type = Journal2Utils::getProperty($module_data, 'module_data.module_type', 'newest');
         $limit = Journal2Utils::getProperty($module_data, 'module_data.limit', 5);
         $posts = array();
         switch ($module_type) {
             case 'newest':
             case 'comments':
             case 'views':
                 $posts = $this->model_journal2_blog->getPosts(array('sort' => $module_type, 'start' => 0, 'limit' => $limit));
                 break;
             case 'related':
                 if (isset($this->request->get['route']) && $this->request->get['route'] === 'product/product' && isset($this->request->get['product_id'])) {
                     $posts = $this->model_journal2_blog->getRelatedPosts($this->request->get['product_id'], $limit);
                 }
                 break;
             case 'custom':
                 $custom_posts = Journal2Utils::getProperty($module_data, 'module_data.posts', array());
                 $custom_posts_ids = array();
                 foreach ($custom_posts as $custom_post) {
                     $post_id = (int) Journal2Utils::getProperty($custom_post, 'data.id', 0);
                     if ($post_id) {
                         $custom_posts_ids[$post_id] = $post_id;
                     }
                 }
                 if ($custom_posts_ids) {
                     $posts = $this->model_journal2_blog->getPosts(array('post_ids' => implode(',', $custom_posts_ids)));
                 }
                 break;
         }
         if (!$posts) {
             return;
         }
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['is_column'] = true;
             $this->data['grid_classes'] = 'xs-100 sm-100 md-100 lg-100 xl-100';
         } else {
             $this->data['is_column'] = false;
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             $this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'module_data.items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
         }
         $this->data['image_width'] = Journal2Utils::getProperty($module_data, 'module_data.image_width', 50);
         $this->data['image_height'] = Journal2Utils::getProperty($module_data, 'module_data.image_height', 50);
         $this->data['image_resize_type'] = Journal2Utils::getProperty($module_data, 'module_data.image_type', 'fit');
         $this->data['show_description'] = Journal2Utils::getProperty($module_data, 'module_data.description', '1');
         $char_limit = Journal2Utils::getProperty($module_data, 'module_data.description_limit', 150);
         $this->data['posts'] = array();
         foreach ($posts as $post) {
             $this->data['posts'][] = array('name' => $post['name'], 'author' => $this->model_journal2_blog->getAuthorName($post), 'comments' => $post['comments'], 'description' => $this->data['show_description'] ? utf8_substr(strip_tags(html_entity_decode($post['description'], ENT_QUOTES, 'UTF-8')), 0, $char_limit) . '...' : false, 'date' => date($this->language->get('date_format_short'), strtotime($post['date'])), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $post['image'] ? $post['image'] : 'data/journal2/no_image_large.jpg', $this->data['image_width'], $this->data['image_height'], $this->data['image_resize_type']), 'href' => $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']));
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/blog_posts.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_photo_gallery_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_photo_gallery_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_photo_gallery_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'gallery_name.value.' . $this->config->get('config_language_id'), '');
         /* image border */
         $this->data['image_border'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
         /* grid */
         $this->data['is_column'] = in_array($setting['position'], array('column_left', 'column_right'));
         if (in_array($setting['position'], array('column_left', 'column_right'))) {
             $this->data['grid_classes'] = 'xs-33 sm-33 md-33 lg-33 xl-33';
         } else {
             $columns = in_array($setting['position'], array('top', 'bottom')) ? 0 : $this->journal2->settings->get('config_columns_count', 0);
             $this->data['grid_classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($module_data, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), $columns);
         }
         /* carousel */
         $this->data['carousel'] = in_array($setting['position'], array('column_left', 'column_right')) ? false : Journal2Utils::getProperty($module_data, 'carousel');
         if ($this->data['carousel']) {
             $this->data['items_per_row'] = Journal2Utils::getProperty($module_data, 'items_per_row.value');
             $this->data['arrows'] = Journal2Utils::getProperty($module_data, 'carousel_arrows');
             $this->data['bullets'] = Journal2Utils::getProperty($module_data, 'carousel_bullets');
             if (Journal2Utils::getProperty($module_data, 'autoplay')) {
                 $this->data['autoplay'] = Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
             } else {
                 $this->data['autoplay'] = false;
             }
             $this->data['slide_speed'] = (int) Journal2Utils::getProperty($module_data, 'transition_speed', 400);
             $this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover');
             $this->data['touch_drag'] = Journal2Utils::getProperty($module_data, 'touch_drag');
         }
         /* sort images */
         $images = Journal2Utils::getProperty($module_data, 'images', array());
         $images = Journal2Utils::sortArray($images);
         /* generate images */
         $this->data['thumbs_limit'] = Journal2Utils::getProperty($module_data, 'thumbs_limit', PHP_INT_MAX);
         $this->data['thumbs_width'] = Journal2Utils::getProperty($module_data, 'thumbs_width', 200);
         $this->data['thumbs_height'] = Journal2Utils::getProperty($module_data, 'thumbs_height', 200);
         $this->data['thumbs_type'] = Journal2Utils::getProperty($module_data, 'thumbs_type', 'crop');
         $this->data['images'] = array();
         foreach ($images as $image) {
             if (isset($image['status']) && !$image['status']) {
                 continue;
             }
             $this->data['images'][] = array('name' => Journal2Utils::getProperty($image, 'name.value.' . $this->config->get('config_language_id'), ''), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'thumb' => Journal2Utils::resizeImage($this->model_tool_image, $image, $this->data['thumbs_width'], $this->data['thumbs_height'], $this->data['thumbs_type']));
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/photo_gallery.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addScript('catalog/view/theme/journal2/lib/swipebox/source/jquery.swipebox.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }