本文整理汇总了PHP中Journal2Utils::getIconOptions2方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::getIconOptions2方法的具体用法?PHP Journal2Utils::getIconOptions2怎么用?PHP Journal2Utils::getIconOptions2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::getIconOptions2方法的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($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;
}
示例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_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');
//.........这里部分代码省略.........
示例4: generateMenuItem
//.........这里部分代码省略.........
case 'popup':
$menu['name'] = Journal2Utils::getProperty($menu_item, 'custom.menu_item.name.value.' . $this->config->get('config_language_id'), 'Not Translated');
$menu['href'] = "javascript:Journal.openPopup('" . Journal2Utils::getProperty($menu_item, 'custom.top.menu_item') . "')";
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'blog_home':
$menu['name'] = $this->journal2->settings->get('config_blog_settings.title.value.' . $this->config->get('config_language_id'), 'Journal Blog');
$menu['href'] = $this->url->link('journal2/blog');
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'blog_category':
$category_info = $this->model_journal2_blog->getCategory(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
if (!$category_info) {
continue;
}
$menu['name'] = $category_info['name'];
$menu['href'] = $this->url->link('journal2/blog', 'journal_blog_category_id=' . $category_info['category_id']);
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'blog_post':
$post_info = $this->model_journal2_blog->getPost(Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.id', -1));
if (!$post_info) {
continue;
}
$menu['name'] = $post_info['name'];
$menu['href'] = $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post_info['post_id']);
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
case 'custom':
$menu['name'] = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'), 'Not Translated');
$menu['href'] = Journal2Utils::getProperty($menu_item, 'custom.top.menu_item.url');
$menu['subcategories'] = $this->generateMenu(Journal2Utils::getProperty($menu_item, 'custom.items', array()));
break;
}
if ($name_overwrite = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'))) {
$menu['name'] = $name_overwrite;
}
break;
/* html */
/* html */
case 'html':
$menu['type'] = 'mega-menu-html';
$menu['name'] = Journal2Utils::getProperty($menu_item, 'html.' . $this->config->get('config_language_id'));
$menu['html_blocks'] = array();
$menu['href'] = $this->model_journal2_menu->getLink(Journal2Utils::getProperty($menu_item, 'html_menu_link'));
foreach (Journal2Utils::sortArray(Journal2Utils::getProperty($menu_item, 'html_blocks', array())) as $block) {
if (!Journal2Utils::getProperty($block, 'status')) {
continue;
}
$menu['html_blocks'][] = array('title' => Journal2Utils::getProperty($block, 'title.value.' . $this->config->get('config_language_id'), ''), 'text' => Journal2Utils::getProperty($block, 'text.' . $this->config->get('config_language_id')), 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($block, 'link')));
}
break;
/* mixed */
/* mixed */
case 'mixed':
$menu['type'] = 'mega-menu-mixed';
$menu['name'] = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'));
$menu['html_blocks'] = array();
$menu['href'] = $this->model_journal2_menu->getLink(Journal2Utils::getProperty($menu_item, 'html_menu_link'));
$columns = Journal2Utils::getProperty($menu_item, 'mixed_columns', array());
$columns = Journal2Utils::sortArray($columns);
foreach ($columns as $column) {
$image_width = Journal2Utils::getProperty($column, 'image_width', 250);
$image_height = Journal2Utils::getProperty($column, 'image_height', 250);
$image_resize_type = Journal2Utils::getProperty($column, 'image_type', 'fit');
if (!Journal2Utils::getProperty($column, 'status', 1)) {
continue;
}
$class = Journal2Utils::getProperty($column, 'hide_on_mobile') ? 'hide-on-mobile' : '';
if ($class === 'hide-on-mobile' && (Journal2Cache::$mobile_detect->isMobile() || Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
continue;
}
if (Journal2Utils::getProperty($column, 'hide_on_desktop', '0') === '1' && !Journal2Cache::$mobile_detect->isMobile()) {
continue;
}
$cms_blocks = array('top' => array(), 'bottom' => array());
foreach (Journal2Utils::getProperty($column, 'cms_blocks', array()) as $cms_block) {
if (!$cms_block['status']) {
return;
}
$cms_blocks[Journal2Utils::getProperty($cms_block, 'position', 'top')][] = array('content' => Journal2Utils::getProperty($cms_block, 'content.' . $this->config->get('config_language_id')), 'sort_order' => Journal2Utils::getProperty($cms_block, 'sort_order'));
}
$column_menu = array('top_cms_blocks' => Journal2Utils::sortArray($cms_blocks['top']), 'bottom_cms_blocks' => Journal2Utils::sortArray($cms_blocks['bottom']), 'name' => '', 'href' => '', 'items' => array(), 'type' => '', 'class' => $class, 'width' => Journal2Utils::getProperty($column, 'width', '25') . '%', 'classes' => Journal2Utils::getProductGridClasses(Journal2Utils::getProperty($column, 'items_per_row.value'), $this->journal2->settings->get('site_width', 1024)), 'limit' => Journal2Utils::getProperty($column, 'items_limit', 0), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($menu_item, 'icon')), 'hide_text' => Journal2Utils::getProperty($menu_item, 'hide_text'));
$this->generateMenuItem($column_menu, $column, $image_width, $image_height, $image_resize_type);
$name_overwrite = Journal2Utils::getProperty($column, 'name.value.' . $this->config->get('config_language_id'));
if ($name_overwrite) {
$column_menu['name'] = $name_overwrite;
}
$menu['mixed_columns'][] = $column_menu;
}
break;
/* html block */
/* html block */
case 'html-block':
$menu['type'] = 'mega-menu-html-block';
$menu['name'] = Journal2Utils::getProperty($menu_item, 'html.' . $this->config->get('config_language_id'));
$menu['html_text'] = Journal2Utils::getProperty($menu_item, 'html_text.' . $this->config->get('config_language_id'));
break;
}
}
示例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;
}
$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'));
//.........这里部分代码省略.........
示例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'];
/* hide on mobile */
if (Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
return;
}
/* hide on desktop */
if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
return;
}
$this->data['cookie_name'] = 'header_notice-' . Journal2Utils::getProperty($module_data, 'do_not_show_again_cookie');
$this->data['do_not_show_again'] = Journal2Utils::getProperty($module_data, 'do_not_show_again', '1');
if ($this->data['do_not_show_again'] && isset($this->request->cookie[$this->data['cookie_name']])) {
return;
}
$cache_property = "module_journal_header_notice_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
$cache = $this->journal2->cache->get($cache_property);
if ($cache === null || self::$CACHEABLE !== true) {
$module = mt_rand();
$this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
/* set global module properties */
$this->data['module'] = $module;
$this->data['text'] = Journal2Utils::getProperty($module_data, 'text.value.' . $this->config->get('config_language_id'));
$this->data['icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'icon'));
$this->data['icon_position'] = Journal2Utils::getProperty($module_data, 'icon_position', 'left');
$this->data['float_icon'] = Journal2Utils::getProperty($module_data, 'float_icon', '0') == '1' ? 'floated-icon' : '';
$this->data['fullwidth'] = Journal2Utils::getProperty($module_data, 'fullwidth', '0') == '1' ? 'fullwidth-notice' : '';
$this->data['close_button_type'] = Journal2Utils::getProperty($module_data, 'close_button_type', 'icon');
$this->data['close_button_text'] = Journal2Utils::getProperty($module_data, 'close_button_text.value.' . $this->config->get('config_language_id'), 'Close');
$css = array();
if (($value = Journal2Utils::getProperty($module_data, 'padding_t.value.text')) !== null) {
$css[] = 'padding-top: ' . $value . 'px';
}
if (($value = Journal2Utils::getProperty($module_data, 'padding_r.value.text')) !== null) {
$css[] = 'padding-right: ' . $value . 'px';
}
if (($value = Journal2Utils::getProperty($module_data, 'padding_b.value.text')) !== null) {
$css[] = 'padding-bottom: ' . $value . 'px';
}
if (($value = Journal2Utils::getProperty($module_data, 'padding_l.value.text')) !== null) {
$css[] = 'padding-left: ' . $value . 'px';
}
if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'google') {
$font_name = Journal2Utils::getProperty($module_data, 'text_font.value.font_name');
$font_subset = Journal2Utils::getProperty($module_data, 'text_font.value.font_subset');
$font_weight = Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
$this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
$this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
$weight = filter_var(Journal2Utils::getProperty($module_data, 'text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
$css[] = 'font-weight: ' . ($weight ? $weight : 400);
$css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'text_font.value.font_name') . "'";
}
if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'system') {
$css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
$css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_family');
}
if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') !== 'none') {
$css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_size');
$css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_style');
$css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'text_font.value.text_transform');
}
if (Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color')) {
$css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color'));
}
if ($color = Journal2Utils::getProperty($module_data, 'text_background_color.value.color')) {
$css[] = "background-color: " . Journal2Utils::getColor($color);
}
$this->data['css'] = implode('; ', $css);
$global_style = array();
/* link colors */
if ($color = Journal2Utils::getProperty($module_data, 'text_link_color.value.color')) {
$global_style[] = "#journal-header-notice-{$module} a { color: " . Journal2Utils::getColor($color) . "}";
}
if ($color = Journal2Utils::getProperty($module_data, 'text_link_hover_color.value.color')) {
$global_style[] = "#journal-header-notice-{$module} a:hover { color: " . Journal2Utils::getColor($color) . "}";
}
/* button colors */
if ($color = Journal2Utils::getProperty($module_data, 'button_color.value.color')) {
$global_style[] = "#journal-header-notice-{$module} .close-notice { color: " . Journal2Utils::getColor($color) . "}";
}
if ($color = Journal2Utils::getProperty($module_data, 'button_hover_color.value.color')) {
$global_style[] = "#journal-header-notice-{$module} .close-notice:hover { color: " . Journal2Utils::getColor($color) . "}";
}
if ($color = Journal2Utils::getProperty($module_data, 'button_bg_color.value.color')) {
$global_style[] = "#journal-header-notice-{$module} .close-notice { background-color: " . Journal2Utils::getColor($color) . "}";
}
if ($color = Journal2Utils::getProperty($module_data, 'button_hover_bg_color.value.color')) {
$global_style[] = "#journal-header-notice-{$module} .close-notice:hover { background-color: " . Journal2Utils::getColor($color) . "}";
}
$this->data['global_style'] = $global_style;
//.........这里部分代码省略.........
示例7: getEnquiryProducts
public function getEnquiryProducts()
{
$product_ids = array();
$category_ids = array();
$manufacturer_ids = array();
$query = $this->db->query('SELECT * FROM ' . DB_PREFIX . 'journal2_modules WHERE module_type = "journal2_product_tabs"');
foreach ($query->rows as $row) {
if (isset($row['module_data'])) {
$tab = json_decode($row['module_data'], true);
if (!$tab['status']) {
continue;
}
$store_id = Journal2Utils::getProperty($tab, 'store_id', -1);
if ($store_id != -1 && $store_id != $this->config->get('config_store_id')) {
continue;
}
if (Journal2Utils::getProperty($tab, 'content_type') !== 'enquiry') {
continue;
}
$this->journal2->settings->set('enquiry_button_text', Journal2Utils::getProperty($tab, 'name.value.' . $this->config->get('config_language_id')));
$this->journal2->settings->set('enquiry_button_icon', Journal2Utils::getIconOptions2(Journal2Utils::getProperty($tab, 'icon')));
$this->journal2->settings->set('enquiry_popup_code', (int) Journal2Utils::getProperty($tab, 'popup'));
switch (Journal2Utils::getProperty($tab, 'global')) {
case 0:
foreach (Journal2Utils::getProperty($tab, 'products', array()) as $product) {
$id = (int) Journal2Utils::getProperty($product, 'data.id');
$product_ids[$id] = $id;
}
break;
case 1:
return 'all';
break;
case 2:
foreach (Journal2Utils::getProperty($tab, 'categories', array()) as $category) {
$id = (int) Journal2Utils::getProperty($category, 'data.id');
$category_ids[$id] = $id;
}
break;
case 3:
foreach (Journal2Utils::getProperty($tab, 'manufacturers', array()) as $manufacturer) {
$id = (int) Journal2Utils::getProperty($manufacturer, 'data.id');
$manufacturer_ids[$id] = $id;
}
break;
}
}
}
/* add products from categories */
if (count($category_ids)) {
$query = $this->db->query('SELECT product_id FROM ' . DB_PREFIX . 'product_to_category WHERE category_id IN (' . implode(',', $category_ids) . ')');
foreach ($query->rows as $row) {
$id = (int) $row['product_id'];
$product_ids[$id] = $id;
}
}
/* add products from brands */
if (count($manufacturer_ids)) {
$query = $this->db->query('SELECT product_id FROM ' . DB_PREFIX . 'product WHERE manufacturer_id IN (' . implode(',', $manufacturer_ids) . ')');
foreach ($query->rows as $row) {
$id = (int) $row['product_id'];
$product_ids[$id] = $id;
}
}
return $product_ids;
}
示例8: index
//.........这里部分代码省略.........
$input_field_style = array();
if (Journal2Utils::getProperty($module_data, 'input_bg_color.value.color')) {
$input_field_style[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'input_bg_color.value.color'));
}
if (Journal2Utils::getProperty($module_data, 'input_border')) {
$input_field_style = array_merge($input_field_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'input_border')));
}
if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') === 'google') {
$font_name = Journal2Utils::getProperty($module_data, 'input_font.value.font_name');
$font_subset = Journal2Utils::getProperty($module_data, 'input_font.value.font_subset');
$font_weight = Journal2Utils::getProperty($module_data, 'input_font.value.font_weight');
$this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
$this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
$weight = filter_var(Journal2Utils::getProperty($module_data, 'input_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
$input_field_style[] = 'font-weight: ' . ($weight ? $weight : 400);
$input_field_style[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'input_font.value.font_name') . "'";
}
if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') === 'system') {
$input_field_style[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_weight');
$input_field_style[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_family');
}
if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') !== 'none') {
$input_field_style[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_size');
$input_field_style[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'input_font.value.font_style');
$input_field_style[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'input_font.value.text_transform');
}
if (Journal2Utils::getProperty($module_data, 'input_font.value.color.value.color')) {
$input_field_style[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'input_font.value.color.value.color'));
}
$this->data['input_style'] = implode('; ', $input_style);
$this->data['input_field_style'] = implode('; ', $input_field_style);
/* submit */
$this->data['button_text'] = Journal2Utils::getProperty($module_data, 'button_text.value.' . $this->config->get('config_language_id'), '');
$this->data['button_icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'button_icon'));
$button_style = array();
if (Journal2Utils::getProperty($module_data, 'button_offset_top')) {
$button_style[] = 'margin-top: ' . Journal2Utils::getProperty($module_data, 'button_offset_top') . 'px';
}
if (Journal2Utils::getProperty($module_data, 'button_offset_left')) {
$button_style[] = 'right: ' . Journal2Utils::getProperty($module_data, 'button_offset_left') . 'px';
}
if (Journal2Utils::getProperty($module_data, 'button_border')) {
$button_style = array_merge($button_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'button_border')));
}
if (Journal2Utils::getProperty($module_data, 'button_font')) {
$button_style = array_merge($button_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'button_border')));
}
if (Journal2Utils::getProperty($module_data, 'button_font.value.font_type') === 'google') {
$font_name = Journal2Utils::getProperty($module_data, 'button_font.value.font_name');
$font_subset = Journal2Utils::getProperty($module_data, 'button_font.value.font_subset');
$font_weight = Journal2Utils::getProperty($module_data, 'button_font.value.font_weight');
$this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
$this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
$weight = filter_var(Journal2Utils::getProperty($module_data, 'button_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
$button_style[] = 'font-weight: ' . ($weight ? $weight : 400);
$button_style[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'button_font.value.font_name') . "'";
}
if (Journal2Utils::getProperty($module_data, 'button_font.value.font_type') === 'system') {
$button_style[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_weight');
$button_style[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_family');
}
if (Journal2Utils::getProperty($module_data, 'button_font.value.font_type') !== 'none') {
$button_style[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_size');
$button_style[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'button_font.value.font_style');
$button_style[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'button_font.value.text_transform');
}
示例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: getButtonStyle
private function getButtonStyle($module_data, $property, $default = '')
{
$style = $this->getFontSettings($module_data, $property . '_font');
if ($color = Journal2Utils::getProperty($module_data, $property . '_bgcolor.value.color')) {
$style[] = 'background-color: ' . Journal2Utils::getColor($color);
}
$hover_style = array();
if ($color = Journal2Utils::getProperty($module_data, $property . '_hover_bgcolor.value.color')) {
$hover_style[] = 'background-color: ' . Journal2Utils::getColor($color) . ' !important';
}
return array('status' => Journal2Utils::getProperty($module_data, $property), 'text' => Journal2Utils::getProperty($module_data, $property . '_text.value.' . $this->config->get('config_language_id'), $default), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, $property . '_icon')), 'icon_position' => Journal2Utils::getProperty($module_data, $property . '_icon_position', 'right'), 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($module_data, $property . '_link')), 'target' => Journal2Utils::getProperty($module_data, $property . '_new_window') ? 'target="_blank"' : '', 'style' => implode('; ', $style), 'hover_style' => implode('; ', $hover_style));
}
示例11: addCpSettings
private function addCpSettings($setting)
{
switch ($setting['type']) {
case 'j-opt-color':
case 'j-opt-color-gradient':
if (Journal2Utils::getProperty($setting, 'value.color') !== null) {
$this->journal2->settings->set($setting['name'], Journal2Utils::getColor(Journal2Utils::getProperty($setting, 'value.color')));
}
break;
case 'j-opt-text':
if (Journal2Utils::getProperty($setting, 'value.text') !== null) {
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value.text'));
}
break;
case 'j-opt-textarea':
if (Journal2Utils::getProperty($setting, 'value.text') !== null) {
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value.text'));
}
break;
case 'j-opt-text-lang':
if (Journal2Utils::getProperty($setting, 'value') !== null) {
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value.' . $this->config->get('config_language_id')));
}
break;
case 'j-opt-image':
if (Journal2Utils::getProperty($setting, 'value.image') !== null) {
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value.image'));
}
break;
case 'j-opt-select':
if (Journal2Utils::getProperty($setting, 'value') !== null) {
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value'));
}
break;
case 'j-opt-font':
case 'j-opt-border':
break;
case 'j-opt-background':
break;
case 'j-opt-icon':
$icon = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($setting, 'value'));
$this->journal2->settings->set($setting['name'], $icon);
break;
case 'j-opt-items-per-row':
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value'));
break;
case 'j-opt-slider':
$this->journal2->settings->set($setting['name'], Journal2Utils::getProperty($setting, 'value'));
break;
case 'j-opt-sharethis':
$share_this_data = json_decode(file_get_contents(DIR_SYSTEM . 'journal2/data/share_this.json'), true);
$items = array();
foreach ($setting as $k => $v) {
if (is_numeric($k)) {
$items[] = array('class' => 'st_' . str_replace('st_li_', '', $v['id']), 'name' => $share_this_data[$v['id']]['name']);
}
}
$this->journal2->settings->set('config_share_buttons', $items);
break;
default:
trigger_error($setting['type'] . ' not parsed!');
}
return false;
}
示例12: 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');
}