当前位置: 首页>>代码示例>>PHP>>正文


PHP Journal2Utils类代码示例

本文整理汇总了PHP中Journal2Utils的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils类的具体用法?PHP Journal2Utils怎么用?PHP Journal2Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Journal2Utils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: refine_images

 public function refine_images()
 {
     if (!in_array($this->journal2->settings->get('refine_category'), array('grid', 'carousel'))) {
         return;
     }
     if (!isset($this->request->get['route']) || $this->request->get['route'] !== 'product/category') {
         return;
     }
     $path = isset($this->request->get['path']) ? $this->request->get['path'] : false;
     if ($path) {
         $this->load->model('catalog/category');
         $parts = explode('_', (string) $path);
         $category_id = (int) array_pop($parts);
         $categories = $this->model_catalog_category->getCategories($category_id);
         $image_width = $this->journal2->settings->get('refine_image_width', 175);
         $image_height = $this->journal2->settings->get('refine_image_height', 175);
         $image_type = $this->journal2->settings->get('refine_image_type', 'fit');
         $data = array();
         foreach ($categories as $category) {
             $filters = array('filter_category_id' => $category['category_id'], 'filter_sub_category' => true);
             if ($this->config->get('config_product_count')) {
                 $product_total = ' (' . $this->model_catalog_product->getTotalProducts($filters) . ')';
             } else {
                 $product_total = '';
             }
             $data[] = array('name' => $category['name'] . $product_total, 'href' => $this->url->link('product/category', 'path=' . $path . '_' . $category['category_id']), 'thumb' => Journal2Utils::resizeImage($this->model_tool_image, $category, $image_width, $image_height, $image_type));
         }
         $this->journal2->settings->set('refine_category_images', $data);
     }
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:30,代码来源:category.php

示例2: price

 public function price()
 {
     $this->load->model('catalog/product');
     $this->language->load('product/product');
     $product_id = isset($this->request->post['product_id']) ? $this->request->post['product_id'] : 0;
     $product_info = $this->model_catalog_product->getProduct($product_id);
     if (!$product_info) {
         $this->response->setOutput(json_encode(array('error' => 'Product not found')));
         return;
     }
     if (!isset($product_info['tax_class_id'])) {
         $product_info['tax_class_id'] = '';
     }
     $price = 0;
     $special = 0;
     $extra = 0;
     $quantity = $product_info['quantity'];
     if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
         $price = $product_info['price'];
     }
     if ((double) $product_info['special']) {
         $special = $product_info['special'];
     }
     $product_options = $this->model_catalog_product->getProductOptions($product_id);
     foreach ($product_options as $option) {
         if (!in_array($option['type'], array('select', 'radio', 'checkbox', 'image'))) {
             continue;
         }
         $option_ids = Journal2Utils::getProperty($this->request->post, 'option.' . $option['product_option_id'], array());
         if (is_scalar($option_ids)) {
             $option_ids = array($option_ids);
         }
         foreach ($option_ids as $option_id) {
             foreach (Journal2Utils::getProperty($option, Front::$IS_OC2 ? 'product_option_value' : 'option_value', array()) as $option_value) {
                 if ($option_id == $option_value['product_option_value_id']) {
                     $quantity = min($quantity, (int) $option_value['quantity']);
                     if ($option_value['price_prefix'] === '+') {
                         $extra += (double) $option_value['price'];
                     } else {
                         $extra -= (double) $option_value['price'];
                     }
                 }
             }
         }
     }
     $tax = $special ? $special : $price;
     $price += $extra;
     $special += $extra;
     $tax += $extra;
     if ($quantity <= 0) {
         $stock = $product_info['stock_status'];
     } elseif ($this->config->get('config_stock_display')) {
         $stock = $quantity;
     } else {
         $stock = $this->language->get('text_instock');
     }
     $this->response->setOutput(json_encode(array('price' => $this->currency->format($this->tax->calculate($price, $product_info['tax_class_id'], $this->config->get('config_tax'))), 'special' => $this->currency->format($this->tax->calculate($special, $product_info['tax_class_id'], $this->config->get('config_tax'))), 'tax' => $this->language->get('text_tax') . ' ' . $this->currency->format($tax), 'stock' => $stock, 'cls' => $quantity ? 'instock' : 'outofstock')));
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:58,代码来源:ajax.php

示例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;
     }
     if (Journal2Utils::getProperty($module_data, 'module_data.disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet())) {
         return;
     }
     $cache_property = "module_journal_fullscreen_slider_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['transition'] = Journal2Utils::getProperty($module_data, 'module_data.transition', 'fade');
         $this->data['transition_speed'] = Journal2Utils::getProperty($module_data, 'module_data.transition_speed', '700');
         $this->data['transition_delay'] = Journal2Utils::getProperty($module_data, 'module_data.transition_delay', '3000');
         if (Journal2Utils::getProperty($module_data, 'module_data.transparent_overlay', '')) {
             $this->data['transparent_overlay'] = Journal2Utils::resizeImage($this->model_tool_image, Journal2Utils::getProperty($module_data, 'module_data.transparent_overlay', ''));
         } else {
             $this->data['transparent_overlay'] = '';
         }
         $this->data['images'] = array();
         $images = Journal2Utils::getProperty($module_data, 'module_data.images', array());
         $images = Journal2Utils::sortArray($images);
         foreach ($images as $image) {
             if (!$image['status']) {
                 continue;
             }
             $image = Journal2Utils::getProperty($image, 'image');
             if (is_array($image)) {
                 $image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
             }
             $this->data['images'][] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'title' => '');
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/fullscreen_slider.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $this->document->addStyle('catalog/view/theme/journal2/lib/supersized/css/supersized.css');
     $this->document->addScript('catalog/view/theme/journal2/lib/supersized/js/jquery.easing.min.js');
     $this->document->addScript('catalog/view/theme/journal2/lib/supersized/js/supersized.3.2.7.min.js');
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:56,代码来源:journal2_fullscreen_slider.php

示例4: index

 public function index()
 {
     $this->load->model('journal2/search');
     $this->load->model('catalog/product');
     $this->load->model('tool/image');
     $json = array('results' => array());
     if (isset($this->request->get['search'])) {
         $results = $this->model_journal2_search->search($this->request->get['search'], $this->journal2->settings->get('autosuggest_limit', 0), $this->journal2->settings->get('search_autocomplete_include_description', '1') === '1');
         $image_width = $this->journal2->settings->get('autosuggest_product_image_width', 50);
         $image_height = $this->journal2->settings->get('autosuggest_product_image_height', 50);
         $image_type = $this->journal2->settings->get('autosuggest_product_image_type', 'fit');
         foreach ($results as $result) {
             $result = $this->model_catalog_product->getProduct($result['product_id']);
             if (self::$SHOW_IMAGES) {
                 $image = Journal2Utils::resizeImage($this->model_tool_image, $result['image'], $image_width, $image_height, $image_type);
             } else {
                 $image = null;
             }
             if (self::$SHOW_PRICE && ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price'))) {
                 $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
             } else {
                 $price = null;
             }
             if (self::$SHOW_PRICE && (double) $result['special']) {
                 $special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
             } else {
                 $special = null;
             }
             $json['results'][] = array('name' => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'), 'url' => htmlspecialchars_decode($this->url->link('product/product', '&product_id=' . $result['product_id'])), 'image' => $image, 'price' => $price, 'special' => $special);
         }
         if ($json['results']) {
             $json['view_more_text'] = $this->journal2->settings->get('autosuggest_view_more_text', 'View More');
             if (VERSION === '1.5.4' || VERSION === '1.5.4.1') {
                 $json['view_more_url'] = $this->url->link('product/search', '&filter_name=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')));
             } else {
                 $json['view_more_url'] = $this->url->link('product/search', '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')));
             }
         } else {
             $this->language->load('product/search');
             $json['view_more_text'] = $this->language->get('text_empty');
             $json['view_more_url'] = '';
         }
     }
     $this->response->setOutput(json_encode($json));
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:45,代码来源:search.php

示例5: index

 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_blog_search_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'));
         $this->data['placeholder'] = Journal2Utils::getProperty($module_data, 'module_data.placeholder.value.' . $this->config->get('config_language_id'), 'Blog Search');
         $this->data['search_url'] = str_replace('&amp;', '&', $this->url->link('journal2/blog', 'journal_blog_search='));
         if (isset($this->request->get['journal_blog_search'])) {
             $this->data['search'] = trim($this->request->get['journal_blog_search']);
         } else {
             $this->data['search'] = '';
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/blog_search.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:44,代码来源:journal2_blog_search.php

示例6: index

 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     if (!$this->model_journal2_blog->isEnabled()) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
         return;
     }
     $hash = isset($this->request->server['REQUEST_URI']) ? md5($this->request->server['REQUEST_URI']) : null;
     $cache_property = "module_journal_blog_comments_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}_{$hash}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true || $hash === null) {
         $module = mt_rand();
         $this->data['module'] = $module;
         $this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_data.title.value.' . $this->config->get('config_language_id'), 'Not Translated');
         $this->data['default_author_image'] = $this->model_tool_image->resize('data/journal2/misc/avatar.png', 75, 75);
         $this->data['comments'] = array();
         $comments = $this->model_journal2_blog->getLatestComments(Journal2Utils::getProperty($module_data, 'module_data.limit', 5));
         $char_limit = Journal2Utils::getProperty($module_data, 'module_data.char_limit', 50);
         foreach ($comments as $comment) {
             $this->data['comments'][] = array('email' => $comment['email'], 'name' => $comment['name'], 'comment' => utf8_substr(strip_tags(html_entity_decode($comment['comment'], ENT_QUOTES, 'UTF-8')), 0, $char_limit) . '...', 'post' => $comment['post'], 'href' => $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $comment['post_id']) . '#c' . $comment['comment_id']);
         }
         $this->template = $this->config->get('config_template') . '/template/journal2/module/blog_comments.tpl';
         if (self::$CACHEABLE === true) {
             $html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
             $this->journal2->cache->set($cache_property, $html);
         }
     } else {
         $this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
         $this->data['cache'] = $cache;
     }
     $output = $this->render();
     Journal2::stopTimer(get_class($this));
     return $output;
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:44,代码来源:journal2_blog_comments.php

示例7: __construct

 public function __construct($registry)
 {
     $config = $registry->get('config');
     $currency = $registry->get('currency');
     $this->request = $registry->get('request');
     $this->store_id = $config->get('config_store_id');
     $this->language_id = $config->get('config_language_id');
     $this->currency_id = $currency->getCode();
     if (self::$mobile_detect->isMobile()) {
         if (self::$mobile_detect->isTablet()) {
             self::$device = 'tablet';
         } else {
             self::$device = 'mobile';
         }
     }
     $this->logged_in = $registry->get('customer')->isLogged() ? 1 : 0;
     $this->price = $config->get('config_customer_price') && $registry->get('customer')->isLogged() || !$config->get('config_customer_price') ? 'price' : 'noprice';
     $this->hostname = md5(Journal2Utils::getHostName());
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:19,代码来源:journal2_cache.php

示例8: getFeaturedProducts

 private function getFeaturedProducts($featured_module_id)
 {
     if (!Front::$IS_OC2) {
         return explode(',', $this->config->get('featured_product'));
     }
     return Journal2Utils::getProperty($this->model_extension_module->getModule($featured_module_id), 'product', array());
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:7,代码来源:product.php

示例9: load

 public function load()
 {
     $module_id = isset($this->request->get['module_id']) ? $this->request->get['module_id'] : -1;
     $module_data = $this->model_journal2_module->getModule($module_id);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $this->response->setOutput(Journal2Utils::getProperty($module_data, 'module_data.content.' . $this->config->get('config_language_id')));
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:9,代码来源:journal2_side_blocks.php

示例10: generateManufacturerSections

 private function generateManufacturerSections($sections_data)
 {
     $section_index = 0;
     foreach ($sections_data as $section) {
         if (!$section['status']) {
             continue;
         }
         $manufacturers = array();
         $section_manufacturers = array();
         $section_name = Journal2Utils::getProperty($section, 'section_title.value.' . $this->config->get('config_language_id'), 'Not Translated');
         switch (Journal2Utils::getProperty($section, 'section_type')) {
             case 'all':
                 $manufacturers = $this->model_catalog_manufacturer->getManufacturers(array('start' => 0, 'limit' => Journal2Utils::getProperty($section, 'items_limit', 5)));
                 break;
             case 'custom':
                 foreach (Journal2Utils::getProperty($section, 'manufacturers', array()) as $manufacturer) {
                     $manufacturers[] = array('manufacturer_id' => Journal2Utils::getProperty($manufacturer, 'data.id', -1));
                 }
         }
         foreach ($manufacturers as $manufacturer) {
             $this->has_items = true;
             $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($manufacturer['manufacturer_id']);
             if (!$manufacturer_info) {
                 continue;
             }
             $manufacturer_sections = isset($this->data['items'][$manufacturer_info['manufacturer_id']]) ? $this->data['items'][$manufacturer_info['manufacturer_id']]['section_class'] : array();
             $manufacturer_sections[$section_index] = 'section-' . $section_index;
             $manufacturer_data = array('section_class' => $manufacturer_sections, 'name' => $manufacturer_info['name'], 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer_info['manufacturer_id']), 'thumb' => Journal2Utils::resizeImage($this->model_tool_image, $manufacturer_info['image'] ? $manufacturer_info['image'] : 'data/journal2/no_image_large.jpg', $this->data['image_width'], $this->data['image_height'], $this->data['image_resize_type']));
             $section_manufacturers[] = $manufacturer_data;
         }
         $this->data['sections'][] = array('section_class' => $section_index, 'section_name' => $section_name, 'items' => $section_manufacturers, 'is_link' => Journal2Utils::getProperty($section, 'section_type') === 'link', 'url' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($section, 'link')), 'target' => Journal2Utils::getProperty($section, 'new_window') ? 'target="_blank"' : '');
         if (Journal2Utils::getProperty($section, 'default_section')) {
             $this->data['default_section'] = $section_index;
         }
         $section_index++;
     }
 }
开发者ID:deepakdesai,项目名称:CressoyoWebApp,代码行数:37,代码来源:journal2_carousel.php

示例11: index

 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     /* device detection */
     $this->data['disable_on_classes'] = array();
     if ($this->journal2->settings->get('responsive_design')) {
         $device = Journal2Utils::getDevice();
         if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
             if ($device === 'phone') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-phone';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
             if ($device === 'tablet') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-tablet';
             }
         }
         if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
             if ($device === 'desktop') {
                 return;
             } else {
                 $this->data['disable_on_classes'][] = 'hide-on-desktop';
             }
         }
     }
     $this->data['css'] = '';
     /* css for top / bottom positions */
     if (in_array($setting['position'], array('top', 'bottom'))) {
         $padding = $this->journal2->settings->get('module_margins', 20) . 'px';
         /* outer */
         $css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
         $css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
         $css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
         $this->journal2->settings->set('module_journal2_text_rotator_' . $setting['module_id'], implode('; ', $css));
         $this->journal2->settings->set('module_journal2_text_rotator_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
         /* inner css */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
             $css[] = 'max-width: 100%';
             $css[] = 'padding-left: ' . $padding;
             $css[] = 'padding-right: ' . $padding;
         } else {
             $css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
         }
         $this->data['css'] = implode('; ', $css);
     }
     $cache_property = "module_journal_text_rotator_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $module = mt_rand();
         /* set global module properties */
         $this->data['module'] = $module;
         $this->data['transition_delay'] = Journal2Utils::getProperty($module_data, 'transition_delay', 4000);
         $this->data['bullets_position'] = Journal2Utils::getProperty($module_data, 'bullets_position', 'center');
         $this->data['title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'), '');
         /* quote options */
         $css = array();
         $css[] = 'text-align: ' . Journal2Utils::getProperty($module_data, 'text_align', 'center');
         $this->data['text_align'] = Journal2Utils::getProperty($module_data, 'text_align', 'center');
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'text_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'text_font.value.font_subset');
             $font_weight = Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
             $this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
             $weight = filter_var(Journal2Utils::getProperty($module_data, 'text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
             $css[] = 'font-weight: ' . ($weight ? $weight : 400);
             $css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'text_font.value.font_name') . "'";
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') === 'system') {
             $css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_weight');
             $css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_family');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.font_type') !== 'none') {
             $css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_size');
             $css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'text_font.value.font_style');
             $css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'text_font.value.text_transform');
         }
         if (Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color')) {
             $css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color'));
         }
         $this->data['quote_css'] = implode('; ', $css);
         /* author options */
         $css = array();
         if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') === 'google') {
             $font_name = Journal2Utils::getProperty($module_data, 'author_font.value.font_name');
             $font_subset = Journal2Utils::getProperty($module_data, 'author_font.value.font_subset');
//.........这里部分代码省略.........
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:101,代码来源:journal2_text_rotator.php

示例12: getBorderCssProperties

 public static function getBorderCssProperties($settings)
 {
     $res = array();
     $unit = Journal2Utils::getProperty($settings, 'value.border_radius_unit', 'px');
     $has_border = false;
     /* width */
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border.value.text'))) {
         $has_border = true;
         $res[] = 'border-width: ' . Journal2Utils::getProperty($settings, 'value.border.value.text') . 'px';
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_top.value.text'))) {
         $has_border = true;
         $res[] = 'border-top-width: ' . Journal2Utils::getProperty($settings, 'value.border_top.value.text') . 'px';
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_right.value.text'))) {
         $has_border = true;
         $res[] = 'border-right-width: ' . Journal2Utils::getProperty($settings, 'value.border_right.value.text') . 'px';
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_bottom.value.text'))) {
         $has_border = true;
         $res[] = 'border-bottom-width: ' . Journal2Utils::getProperty($settings, 'value.border_bottom.value.text') . 'px';
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_left.value.text'))) {
         $has_border = true;
         $res[] = 'border-left-width: ' . Journal2Utils::getProperty($settings, 'value.border_left.value.text') . 'px';
     }
     /* radius */
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_radius.value.text'))) {
         $res[] = 'border-radius: ' . Journal2Utils::getProperty($settings, 'value.border_radius.value.text') . $unit;
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_radius_top.value.text'))) {
         $res[] = 'border-top-left-radius: ' . Journal2Utils::getProperty($settings, 'value.border_radius_top.value.text') . $unit;
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_radius_right.value.text'))) {
         $res[] = 'border-top-right-radius: ' . Journal2Utils::getProperty($settings, 'value.border_radius_right.value.text') . $unit;
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_radius_bottom.value.text'))) {
         $res[] = 'border-bottom-right-radius: ' . Journal2Utils::getProperty($settings, 'value.border_radius_bottom.value.text') . $unit;
     }
     if (is_numeric(Journal2Utils::getProperty($settings, 'value.border_radius_left.value.text'))) {
         $res[] = 'border-bottom-left-radius: ' . Journal2Utils::getProperty($settings, 'value.border_radius_left.value.text') . $unit;
     }
     /* style */
     if ($has_border && Journal2Utils::getProperty($settings, 'value.border_type', 'solid')) {
         $res[] = 'border-style: ' . Journal2Utils::getProperty($settings, 'value.border_type', 'solid');
     }
     /* color */
     if (Journal2Utils::getProperty($settings, 'value.border_color.value.color')) {
         $res[] = 'border-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($settings, 'value.border_color.value.color'));
     }
     return $res;
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:52,代码来源:journal2_utils.php

示例13: index

 public function index($setting)
 {
     if (!defined('JOURNAL_INSTALLED')) {
         return;
     }
     Journal2::startTimer(get_class($this));
     /* get module data from db */
     $module_data = $this->model_journal2_module->getModule($setting['module_id']);
     if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
         return;
     }
     $module_data = $module_data['module_data'];
     $cache_property = "module_journal_side_products_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}" . $this->journal2->cache->getRouteCacheKey();
     $cache = $this->journal2->cache->get($cache_property);
     if ($cache === null || self::$CACHEABLE !== true) {
         $products = array();
         $limit = Journal2Utils::getProperty($module_data, 'items_limit', 5);
         $this->data['image_width'] = $this->journal2->settings->get('side_product_image_width', 50);
         $this->data['image_height'] = $this->journal2->settings->get('side_product_image_height', 50);
         $this->data['image_resize_type'] = $this->journal2->settings->get('side_product_image_type', 'crop');
         $this->data['text_tax'] = $this->language->get('text_tax');
         $this->data['button_cart'] = $this->language->get('button_cart');
         $this->data['button_wishlist'] = $this->language->get('button_wishlist');
         $this->data['button_compare'] = $this->language->get('button_compare');
         $product_id = Journal2Utils::getProperty($this->request->get, 'product_id');
         $post_id = Journal2Utils::getProperty($this->request->get, 'journal_blog_post_id');
         switch (Journal2Utils::getProperty($module_data, 'section_type')) {
             case 'module':
                 switch (Journal2Utils::getProperty($module_data, 'module_type')) {
                     case 'featured':
                         $products = $this->model_journal2_product->getFeatured($limit, Journal2Utils::getProperty($module_data, 'featured_module_id'), Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'bestsellers':
                         $products = $this->model_journal2_product->getBestsellers($limit, Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'specials':
                         $products = $this->model_journal2_product->getSpecials($limit, Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'latest':
                         $products = $this->model_journal2_product->getLatest($limit, Journal2Utils::getProperty($module_data, 'filter_category', 0) !== null);
                         break;
                     case 'related':
                         if ($product_id) {
                             $products = $this->model_journal2_product->getProductRelated($product_id, $limit);
                         } else {
                             if ($post_id) {
                                 $products = $this->model_journal2_blog->getRelatedProducts($post_id, $limit);
                             } else {
                                 $products = array();
                             }
                         }
                         break;
                     case 'people-also-bought':
                         $products = $this->model_journal2_product->getPeopleAlsoBought($product_id);
                         break;
                     case 'most-viewed':
                         $products = $this->model_journal2_product->getMostViewed($limit);
                         $this->has_random_products = true;
                         break;
                     case 'recently-viewed':
                         $products = $this->model_journal2_product->getRecentlyViewed($limit);
                         $this->has_random_products = true;
                         break;
                 }
                 break;
             case 'category':
                 $category_info = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($module_data, 'category.data.id'));
                 if (!$category_info) {
                     continue;
                 }
                 $products = $this->model_journal2_product->getProductsByCategory($category_info['category_id'], $limit);
                 break;
             case 'manufacturer':
                 $manufacturer = $this->model_catalog_manufacturer->getManufacturer(Journal2Utils::getProperty($module_data, 'manufacturer.data.id'));
                 if (!$manufacturer) {
                     continue;
                 }
                 $products = $this->model_journal2_product->getProductsByManufacturer($manufacturer['manufacturer_id'], $limit);
                 break;
             case 'custom':
                 foreach (Journal2Utils::sortArray(Journal2Utils::getProperty($module_data, 'products', array())) as $product) {
                     $result = $this->model_catalog_product->getProduct((int) Journal2Utils::getProperty($product, 'data.id'));
                     if (!$result) {
                         continue;
                     }
                     $products[] = $result;
                 }
                 break;
             case 'random':
                 $this->has_random_products = true;
                 $random_type = Journal2Utils::getProperty($module_data, 'random_from', 'all');
                 $category_id = $random_type === 'category' ? Journal2Utils::getProperty($module_data, 'random_from_category.id', -1) : -1;
                 $random_products = $this->model_journal2_product->getRandomProducts($limit, $category_id);
                 foreach ($random_products as $product) {
                     $result = $this->model_catalog_product->getProduct($product['product_id']);
                     if (!$result) {
                         continue;
                     }
                     $products[] = $result;
                 }
//.........这里部分代码省略.........
开发者ID:nabeelkausari,项目名称:beelzak,代码行数:101,代码来源:journal2_side_products.php

示例14: add

 public function add()
 {
     $this->load->language('product/compare');
     $json = array();
     if (!isset($this->session->data['compare'])) {
         $this->session->data['compare'] = array();
     }
     if (isset($this->request->post['product_id'])) {
         $product_id = $this->request->post['product_id'];
     } else {
         $product_id = 0;
     }
     $this->load->model('catalog/product');
     $this->load->model('journal2/product');
     $product_info = $this->model_catalog_product->getProduct($product_id);
     if ($product_info) {
         if (!in_array($this->request->post['product_id'], $this->session->data['compare'])) {
             if (count($this->session->data['compare']) >= 4) {
                 array_shift($this->session->data['compare']);
             }
             $this->session->data['compare'][] = $this->request->post['product_id'];
         }
         if (strpos($this->config->get('config_template'), 'journal2') === 0) {
             $this->load->model('tool/image');
             $json['image'] = Journal2Utils::resizeImage($this->model_tool_image, $product_info['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
         }
         $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('product/compare'));
         $json['total'] = sprintf($this->language->get('text_compare'), isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0);
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput(json_encode($json));
 }
开发者ID:nabeelkausari,项目名称:beelzak,代码行数:32,代码来源:compare.php

示例15: add

 public function add()
 {
     $this->load->language('checkout/cart');
     $json = array();
     if (isset($this->request->post['product_id'])) {
         $product_id = (int) $this->request->post['product_id'];
     } else {
         $product_id = 0;
     }
     $this->load->model('catalog/product');
     $product_info = $this->model_catalog_product->getProduct($product_id);
     if ($product_info) {
         if (isset($this->request->post['quantity']) && (int) $this->request->post['quantity'] >= $product_info['minimum']) {
             $quantity = (int) $this->request->post['quantity'];
         } else {
             $quantity = $product_info['minimum'] ? $product_info['minimum'] : 1;
         }
         if (isset($this->request->post['option'])) {
             $option = array_filter($this->request->post['option']);
         } else {
             $option = array();
         }
         $product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
         foreach ($product_options as $product_option) {
             if ($product_option['required'] && empty($option[$product_option['product_option_id']])) {
                 $json['error']['option'][$product_option['product_option_id']] = sprintf($this->language->get('error_required'), $product_option['name']);
             }
         }
         if (isset($this->request->post['recurring_id'])) {
             $recurring_id = $this->request->post['recurring_id'];
         } else {
             $recurring_id = 0;
         }
         $recurrings = $this->model_catalog_product->getProfiles($product_info['product_id']);
         if ($recurrings) {
             $recurring_ids = array();
             foreach ($recurrings as $recurring) {
                 $recurring_ids[] = $recurring['recurring_id'];
             }
             if (!in_array($recurring_id, $recurring_ids)) {
                 $json['error']['recurring'] = $this->language->get('error_recurring_required');
             }
         }
         if (!$json) {
             $this->cart->add($this->request->post['product_id'], $quantity, $option, $recurring_id);
             // added by KC - for Flash Sales purpose
             if ($product_info['ontime_close']) {
                 $this->model_catalog_product->updateQtyBeZero($product_info['product_id']);
             }
             if (strpos($this->config->get('config_template'), 'journal2') === 0) {
                 $this->load->model('tool/image');
                 $json['image'] = Journal2Utils::resizeImage($this->model_tool_image, $product_info['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
             }
             $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
             unset($this->session->data['shipping_method']);
             unset($this->session->data['shipping_methods']);
             unset($this->session->data['payment_method']);
             unset($this->session->data['payment_methods']);
             // Totals
             $this->load->model('extension/extension');
             $total_data = array();
             $total = 0;
             $taxes = $this->cart->getTaxes();
             // Display prices
             if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
                 $sort_order = array();
                 $results = $this->model_extension_extension->getExtensions('total');
                 foreach ($results as $key => $value) {
                     $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
                 }
                 array_multisort($sort_order, SORT_ASC, $results);
                 foreach ($results as $result) {
                     if ($this->config->get($result['code'] . '_status')) {
                         $this->load->model('total/' . $result['code']);
                         $this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
                     }
                 }
                 $sort_order = array();
                 foreach ($total_data as $key => $value) {
                     $sort_order[$key] = $value['sort_order'];
                 }
                 array_multisort($sort_order, SORT_ASC, $total_data);
             }
             $json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
         } else {
             $json['redirect'] = str_replace('&amp;', '&', $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']));
         }
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput(json_encode($json));
 }
开发者ID:kctan0620,项目名称:onlinestore,代码行数:91,代码来源:cart.php


注:本文中的Journal2Utils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。