本文整理汇总了PHP中Journal2Utils::getBackgroundCssProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::getBackgroundCssProperties方法的具体用法?PHP Journal2Utils::getBackgroundCssProperties怎么用?PHP Journal2Utils::getBackgroundCssProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::getBackgroundCssProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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')) {
//.........这里部分代码省略.........
示例2: index
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);
//.........这里部分代码省略.........
示例3: index
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'));
//.........这里部分代码省略.........
示例4: index
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');
//.........这里部分代码省略.........
示例5: index
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;
//.........这里部分代码省略.........
示例6: index
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';
//.........这里部分代码省略.........
示例7: index
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);
//.........这里部分代码省略.........
示例8: index
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;
}
示例9: index
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 {
//.........这里部分代码省略.........
示例10: index
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);
//.........这里部分代码省略.........
示例11: index
//.........这里部分代码省略.........
}
$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'), ' ');
$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;
}
示例12: addCssSettings
//.........这里部分代码省略.........
case 'j-opt-text':
if (Journal2Utils::getProperty($setting, 'value.text') !== null) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue($setting['css']['property'], Journal2Utils::getProperty($setting, 'value.text'));
}
break;
case 'j-opt-icon':
switch (Journal2Utils::getProperty($setting, 'value.icon_type')) {
case 'icon':
if (Journal2Utils::getProperty($setting, 'value.icon.icon')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue("content: '%s'", str_replace(array('&#x', ';'), array('\\', ''), Journal2Utils::getProperty($setting, 'value.icon.icon')));
}
if (Journal2Utils::getProperty($setting, 'value.options.font_size')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('font-size', Journal2Utils::getProperty($setting, 'value.options.font_size'));
}
if (Journal2Utils::getProperty($setting, 'value.options.color.value.color')) {
$color = Journal2Utils::getColor(Journal2Utils::getProperty($setting, 'value.options.color.value.color'));
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('color', $color);
$this->journal2->settings->set($setting['name'] . ':color', $color);
}
if (Journal2Utils::getProperty($setting, 'value.options.top')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('top', Journal2Utils::getProperty($setting, 'value.options.top') . 'px');
}
if (Journal2Utils::getProperty($setting, 'value.options.left')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('left', Journal2Utils::getProperty($setting, 'value.options.left') . 'px');
}
break;
case 'image':
if (Journal2Utils::getProperty($setting, 'value.image')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('content', 'url("image/' . Journal2Utils::getProperty($setting, 'value.image') . '")');
}
if (Journal2Utils::getProperty($setting, 'value.options.font_size')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('font-size', Journal2Utils::getProperty($setting, 'value.options.font_size'));
}
if (Journal2Utils::getProperty($setting, 'value.options.color.value.color')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('color', Journal2Utils::getColor(Journal2Utils::getProperty($setting, 'value.options.color.value.color')));
}
if (Journal2Utils::getProperty($setting, 'value.options.top')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('top', Journal2Utils::getProperty($setting, 'value.options.top') . 'px');
}
if (Journal2Utils::getProperty($setting, 'value.options.left')) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue('left', Journal2Utils::getProperty($setting, 'value.options.left') . 'px');
}
break;
}
break;
case 'j-opt-image':
if (Journal2Utils::getProperty($setting, 'value.image') !== null) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue($setting['css']['property'], 'image/' . Journal2Utils::getProperty($setting, 'value.image'));
}
break;
case 'j-opt-select':
if (Journal2Utils::getProperty($setting, 'value') !== null) {
$this->css_settings[$md5_selector]['properties'][] = $this->parseCssValue($setting['css']['property'], Journal2Utils::getProperty($setting, 'value'));
}
break;
case 'j-opt-font':
if (Journal2Utils::getProperty($setting, 'value.font_type') === 'google') {
$this->journal2->google_fonts->add(Journal2Utils::getProperty($setting, 'value.font_name'), Journal2Utils::getProperty($setting, 'value.font_subset'), Journal2Utils::getProperty($setting, 'value.font_weight'));
$weight = filter_var(Journal2Utils::getProperty($setting, 'value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
$this->css_settings[$md5_selector]['properties'][] = 'font-weight: ' . ($weight ? $weight : 400) . $setting['css']['property'];
$this->css_settings[$md5_selector]['properties'][] = 'font-family: "' . Journal2Utils::getProperty($setting, 'value.font_name') . '"' . $setting['css']['property'];
}
if (Journal2Utils::getProperty($setting, 'value.font_type') === 'system') {
$this->css_settings[$md5_selector]['properties'][] = 'font-weight: ' . Journal2Utils::getProperty($setting, 'value.font_weight') . $setting['css']['property'];
$this->css_settings[$md5_selector]['properties'][] = 'font-family: ' . Journal2Utils::getProperty($setting, 'value.font_family') . $setting['css']['property'];
}
if (Journal2Utils::getProperty($setting, 'value.font_type') !== 'none') {
$this->css_settings[$md5_selector]['properties'][] = 'font-style: ' . Journal2Utils::getProperty($setting, 'value.font_style') . $setting['css']['property'];
$this->css_settings[$md5_selector]['properties'][] = 'font-size: ' . Journal2Utils::getProperty($setting, 'value.font_size') . $setting['css']['property'];
$this->css_settings[$md5_selector]['properties'][] = 'text-transform: ' . Journal2Utils::getProperty($setting, 'value.text_transform') . $setting['css']['property'];
if (Journal2Utils::getProperty($setting, 'value.letter_spacing')) {
$this->css_settings[$md5_selector]['properties'][] = 'letter-spacing: ' . Journal2Utils::getProperty($setting, 'value.letter_spacing') . 'px' . $setting['css']['property'];
}
}
if (Journal2Utils::getProperty($setting, 'value.color.value.color')) {
$color = Journal2Utils::getColor(Journal2Utils::getProperty($setting, 'value.color.value.color'));
$this->css_settings[$md5_selector]['properties'][] = 'color: ' . $color . $setting['css']['property'];
$this->journal2->settings->set($setting['name'] . ':color', $color);
}
break;
case 'j-opt-background':
foreach (Journal2Utils::getBackgroundCssProperties($setting) as $sett) {
$this->css_settings[$md5_selector]['properties'][] = $sett;
$parts = explode(':', $sett);
if (count($parts) > 1 && strlen(trim($parts[0])) && strlen(trim($parts[1]))) {
$this->journal2->settings->set($setting['name'] . ':' . trim($parts[0]), trim($parts[1]));
}
}
break;
case 'j-opt-border':
foreach (Journal2Utils::getBorderCssProperties($setting) as $sett) {
$this->css_settings[$md5_selector]['properties'][] = $sett;
$parts = explode(':', $sett);
if (count($parts) > 1 && strlen(trim($parts[0])) && strlen(trim($parts[1]))) {
$this->journal2->settings->set($setting['name'] . ':' . trim($parts[0]), trim($parts[1]));
}
}
break;
}
}
示例13: index
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';
}
//.........这里部分代码省略.........
示例14: index
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');
//.........这里部分代码省略.........
示例15: footer
public function footer($menu)
{
$cache_property = 'config_' . $menu;
$cache = $this->journal2->cache->get($cache_property);
$has_random_products = false;
if ($cache === null || self::$CACHEABLE !== true) {
$rows = $this->journal2->settings->get('config_' . $menu . '.rows', array());
$rows = Journal2Utils::sortArray($rows);
$this->data['rows'] = array();
foreach ($rows as $row) {
if (isset($row['status']) && !$row['status']) {
continue;
}
if ($class = Journal2Utils::getProperty($row, 'disable_mobile') ? 'hide-on-mobile' : '') {
if ((Journal2Cache::$mobile_detect->isMobile() || Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
continue;
}
}
if (Journal2Utils::getProperty($row, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
continue;
}
$row_css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($row, 'background'));
if (Journal2Utils::getProperty($row, 'bottom_spacing') !== null) {
$row_css[] = 'margin-bottom: ' . Journal2Utils::getProperty($row, 'bottom_spacing') . 'px';
}
if (Journal2Utils::getProperty($row, 'padding_top') !== null) {
$row_css[] = 'padding-top: ' . Journal2Utils::getProperty($row, 'padding_top') . 'px';
}
if (Journal2Utils::getProperty($row, 'padding_right') !== null) {
$row_css[] = 'padding-right: ' . Journal2Utils::getProperty($row, 'padding_right') . 'px';
}
if (Journal2Utils::getProperty($row, 'padding_bottom') !== null) {
$row_css[] = 'padding-bottom: ' . Journal2Utils::getProperty($row, 'padding_bottom') . 'px';
}
if (Journal2Utils::getProperty($row, 'padding_left') !== null) {
$row_css[] = 'padding-left: ' . Journal2Utils::getProperty($row, 'padding_left') . 'px';
}
$temp = array('type' => '', 'css' => implode('; ', $row_css), 'class' => $class, 'columns' => array(), 'contacts' => array('left' => array(), 'right' => array()));
switch (Journal2Utils::getProperty($row, 'type')) {
case 'columns':
$temp['type'] = 'columns';
$columns = Journal2Utils::getProperty($row, 'columns');
$columns = Journal2Utils::sortArray($columns);
$temp['classes'] = Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($row, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024), 0);
foreach ($columns as $column) {
if (isset($column['status']) && !$column['status']) {
continue;
}
if ($class = Journal2Utils::getProperty($column, 'disable_mobile') ? 'hide-on-mobile' : '') {
if ((Journal2Cache::$mobile_detect->isMobile() || Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
continue;
}
}
if (Journal2Utils::getProperty($column, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
continue;
}
switch (Journal2Utils::getProperty($column, 'type')) {
case 'text':
/* icon css */
$css = array();
if (Journal2Utils::getColor(Journal2Utils::getProperty($column, 'icon_bg_color.value.color'))) {
$css[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($column, 'icon_bg_color.value.color'));
}
if (Journal2Utils::getProperty($column, 'icon_width')) {
$css[] = 'width: ' . Journal2Utils::getProperty($column, 'icon_width') . 'px';
}
if (Journal2Utils::getProperty($column, 'icon_height')) {
$css[] = 'height: ' . Journal2Utils::getProperty($column, 'icon_height') . 'px';
$css[] = 'line-height: ' . Journal2Utils::getProperty($column, 'icon_height') . 'px';
}
if (Journal2Utils::getProperty($column, 'icon_border')) {
$css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($column, 'icon_border')));
}
$temp['columns'][] = array('class' => $class, 'type' => Journal2Utils::getProperty($column, 'type', 'text'), 'title' => Journal2Utils::getProperty($column, 'title.value.' . $this->config->get('config_language_id')), 'text' => Journal2Utils::getProperty($column, 'text.' . $this->config->get('config_language_id')), 'has_icon' => Journal2Utils::getProperty($column, 'icon_status'), 'icon_position' => Journal2Utils::getProperty($column, 'icon_position', 'top'), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($column, 'icon')), 'icon_css' => implode('; ', $css));
break;
case 'menu':
$temp['columns'][] = array('class' => $class, 'type' => Journal2Utils::getProperty($column, 'type', 'text'), 'title' => Journal2Utils::getProperty($column, 'title.value.' . $this->config->get('config_language_id')), 'items' => $this->generateMenu(Journal2Utils::getProperty($column, 'items', array())));
break;
case 'newsletter':
$temp['columns'][] = array('class' => $class, 'type' => Journal2Utils::getProperty($column, 'type', 'text'), 'title' => Journal2Utils::getProperty($column, 'title.value.' . $this->config->get('config_language_id')), 'content' => $this->getChild('module/journal2_newsletter', array('module_id' => Journal2Utils::getProperty($column, 'newsletter_id'), 'layout_id' => -1, 'position' => 'footer')));
break;
case 'products':
$products = array();
$limit = Journal2Utils::getProperty($column, 'items_limit', 5);
$this->data['image_width'] = $this->journal2->settings->get('footer_product_image_width', 50);
$this->data['image_height'] = $this->journal2->settings->get('footer_product_image_height', 50);
$this->data['image_resize_type'] = $this->journal2->settings->get('footer_product_image_type', 'fit');
$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');
switch (Journal2Utils::getProperty($column, 'section_type')) {
case 'module':
switch (Journal2Utils::getProperty($column, 'module_type')) {
case 'featured':
$products = $this->model_journal2_product->getFeatured($limit, Journal2Utils::getProperty($column, 'featured_module_id'));
break;
case 'bestsellers':
$products = $this->model_journal2_product->getBestsellers($limit);
break;
//.........这里部分代码省略.........