本文整理汇总了PHP中Journal2Utils::getBorderCssProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::getBorderCssProperties方法的具体用法?PHP Journal2Utils::getBorderCssProperties怎么用?PHP Journal2Utils::getBorderCssProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::getBorderCssProperties方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
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&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;
}
示例2: index
//.........这里部分代码省略.........
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')) {
示例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'];
/* 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);
//.........这里部分代码省略.........
示例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_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'));
//.........这里部分代码省略.........
示例5: index
//.........这里部分代码省略.........
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;
}
示例6: 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);
//.........这里部分代码省略.........
示例7: 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;
//.........这里部分代码省略.........
示例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 */
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);
//.........这里部分代码省略.........
示例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: 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;
}
}
示例11: index
public function index()
{
if ($this->journal2->page->getType() !== 'product' && $this->journal2->page->getType() !== 'quickview') {
return;
}
Journal2::startTimer('ProductTabs');
$product_id = $this->journal2->page->getId();
/* recently viewed */
$recently_viewed = isset($this->request->cookie['jrv']) && $this->request->cookie['jrv'] ? explode(',', $this->request->cookie['jrv']) : array();
$recently_viewed = array_diff($recently_viewed, array($product_id));
array_unshift($recently_viewed, $product_id);
$recently_viewed = array_splice($recently_viewed, 0, 10);
setcookie('jrv', implode(',', $recently_viewed), time() + 60 * 60 * 24 * 30, '/', $this->request->server['HTTP_HOST']);
$tabs = $this->model_journal2_module->getProductTabs($product_id);
$tabs = Journal2Utils::sortArray($tabs);
$product_info = $this->model_catalog_product->getProduct($product_id);
$tab_tab = array();
$tab_desc_top = array();
$tab_desc_bottom = array();
$tab_image = array();
$tab_enquiry = array();
foreach ($tabs as $tab) {
if (!$tab['status']) {
continue;
}
$css = array();
if (Journal2Utils::getColor(Journal2Utils::getProperty($tab, 'icon_bg_color.value.color'))) {
$css[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($tab, 'icon_bg_color.value.color'));
}
if (Journal2Utils::getProperty($tab, 'icon_width')) {
$css[] = 'width: ' . Journal2Utils::getProperty($tab, 'icon_width') . 'px';
}
if (Journal2Utils::getProperty($tab, 'icon_height')) {
$css[] = 'height: ' . Journal2Utils::getProperty($tab, 'icon_height') . 'px';
$css[] = 'line-height: ' . Journal2Utils::getProperty($tab, 'icon_height') . 'px';
}
if (Journal2Utils::getProperty($tab, 'icon_border')) {
$css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($tab, 'icon_border')));
}
$position = Journal2Utils::getProperty($tab, 'position');
$name = Journal2Utils::getProperty($tab, 'name.value.' . $this->config->get('config_language_id'));
$has_icon = Journal2Utils::getProperty($tab, 'icon_status');
$icon = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($tab, 'icon'));
$icon_css = implode('; ', $css);
switch (Journal2Utils::getProperty($tab, 'content_type', 'custom')) {
case 'custom':
$content = Journal2Utils::getProperty($tab, 'content.' . $this->config->get('config_language_id'));
break;
case 'description':
$content = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
$this->journal2->settings->set('hide_product_description', true);
break;
case 'enquiry':
$position = 'enquiry';
$this->journal2->settings->set('hide_add_to_cart_button', true);
$href = "javascript:Journal.openPopup('" . (int) Journal2Utils::getProperty($tab, 'popup') . "', '" . $product_id . "')";
$content = "<a class=\"button enquiry-button\" href=\"{$href}\">{$icon}{$name}</a>";
break;
}
$position_desc = $position === 'desc' ? '_' . Journal2Utils::getProperty($tab, 'option_position') : '';
$data = array('name' => $name, 'has_icon' => $has_icon, 'icon' => $icon, 'icon_css' => $icon_css, 'content' => $content);
$var = 'tab_' . $position . $position_desc;
array_push(${$var}, $data);
}
$this->journal2->settings->set('additional_product_tabs', $tab_tab);
$this->journal2->settings->set('additional_product_description_top', $tab_desc_top);
$this->journal2->settings->set('additional_product_description_bottom', $tab_desc_bottom);
$this->journal2->settings->set('additional_product_description_image', $tab_image);
$this->journal2->settings->set('additional_product_enquiry', $tab_enquiry);
Journal2::stopTimer('ProductTabs');
}
示例12: 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_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();
//.........这里部分代码省略.........