本文整理汇总了PHP中Journal2Utils::getProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::getProperty方法的具体用法?PHP Journal2Utils::getProperty怎么用?PHP Journal2Utils::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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')));
}
示例2: index
public function index($setting)
{
if (!defined('JOURNAL_INSTALLED')) {
return;
}
Journal2::startTimer(get_class($this));
/* get module data from db */
$module_data = $this->model_journal2_module->getModule($setting['module_id']);
if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
return;
}
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;
}
示例3: 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('&', '&', $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;
}
示例4: 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;
}
示例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';
}
}
}
/* 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 {
//.........这里部分代码省略.........
示例6: 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());
}
示例7: 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')));
}
示例8: 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++;
}
}
示例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';
}
}
}
$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');
//.........这里部分代码省略.........
示例10: 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;
}
示例11: registerAccount
private function registerAccount()
{
$redirect = '';
$data = $this->getAddressData($this->request->post, 'payment_');
$data = array_merge($data, array('firstname' => Journal2Utils::getProperty($this->request->post, 'firstname'), 'lastname' => Journal2Utils::getProperty($this->request->post, 'lastname'), 'customer_group_id' => Journal2Utils::getProperty($this->request->post, 'customer_group_id', $this->config->get('config_customer_group_id')), 'custom_field' => array('account' => Journal2Utils::getProperty($this->request->post, 'custom_field'), 'address' => Journal2Utils::getProperty($this->request->post, 'payment_custom_field')), 'email' => Journal2Utils::getProperty($this->request->post, 'email'), 'telephone' => Journal2Utils::getProperty($this->request->post, 'telephone'), 'fax' => Journal2Utils::getProperty($this->request->post, 'fax'), 'password' => Journal2Utils::getProperty($this->request->post, 'password'), 'newsletter' => Journal2Utils::getProperty($this->request->post, 'newsletter')));
$customer_id = $this->model_account_customer->addCustomer($data);
// Clear any previous login attempts for unregistered accounts.
if (Front::$IS_OC2) {
$this->model_account_customer->deleteLoginAttempts($data['email']);
}
$this->session->data['account'] = 'register';
$customer_group_info = $this->model_account_customer_group->getCustomerGroup(Journal2Utils::getProperty($this->request->post, 'customer_group_id', $this->config->get('config_customer_group_id')));
if ($customer_group_info && !$customer_group_info['approval']) {
$this->customer->login($data['email'], $data['password']);
if (Journal2Utils::getProperty($this->request->post, 'shipping_address') != '1') {
$this->model_account_address->addAddress($this->getAddressData($this->request->post, 'shipping_'));
}
// Add to activity log
$activity_data = array('customer_id' => $customer_id, 'name' => $data['firstname'] . ' ' . $data['lastname']);
if (Front::$IS_OC2) {
$this->model_account_activity->addActivity('register', $activity_data);
}
} else {
$redirect = $this->url->link('account/success');
}
return $redirect;
}
示例12: edit_comment
public function edit_comment()
{
if (!$this->user->hasPermission('modify', 'module/journal2')) {
throw new Exception('You do not have permissions to modify Journal2 module');
}
$comment_id = (int) $this->get_data['comment_id'];
$name = $this->db->escape(Journal2Utils::getProperty($this->post_data, 'name', ''));
$website = $this->db->escape(Journal2Utils::getProperty($this->post_data, 'website', ''));
$email = $this->db->escape(Journal2Utils::getProperty($this->post_data, 'email', ''));
$comment = $this->db->escape(Journal2Utils::getProperty($this->post_data, 'comment.value.text', ''));
$status = (int) $this->db->escape(Journal2Utils::getProperty($this->post_data, 'status', ''));
$this->db->query("\n UPDATE `{$this->db_prefix}journal2_blog_comments` SET\n name = '{$name}',\n website = '{$website}',\n email = '{$email}',\n comment = '{$comment}',\n status = {$status}\n WHERE comment_id = {$comment_id}\n ");
return null;
}
示例13: products
//.........这里部分代码省略.........
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_tax')) {
$tax = $this->currency->format((double) $result['special'] ? $result['special'] : $result['price']);
} else {
$tax = false;
}
if ($this->config->get('config_review_status')) {
$rating = (int) $result['rating'];
} else {
$rating = false;
}
switch ($data['route']) {
case 'product/category':
$href = $this->url->link('product/product', 'path=' . $data['path'] . '&product_id=' . $result['product_id'] . $url);
break;
case 'product/manufacturer':
$href = $this->url->link('product/product', '&manufacturer_id=' . $data['manufacturer_id'] . '&product_id=' . $result['product_id'] . $url);
break;
default:
$href = $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url);
break;
}
$date_end = false;
if ($special && $this->journal2->settings->get('show_countdown', 'never') !== 'never') {
$this->load->model('journal2/product');
$date_end = $this->model_journal2_product->getSpecialCountdown($result['product_id']);
if ($date_end === '0000-00-00') {
$date_end = false;
}
}
$this->data['products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'thumb2' => $image2, 'name' => $result['name'], 'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, Front::$IS_OC2 ? $this->config->get('config_product_description_length') : 100) . '..', 'price' => $price, 'special' => $special, 'date_end' => $date_end, 'tax' => $tax, 'rating' => $result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $href, 'labels' => $this->model_journal2_product->getLabels($result['product_id']));
}
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->page = $data['page'];
$pagination->limit = $data['limit'];
$pagination->text = $this->language->get('text_pagination');
switch ($data['route']) {
case 'product/category':
$route = 'product/category';
$pagination->url = $this->url->link('product/category', 'path=' . $data['path'] . $url . '&page={page}');
break;
case 'product/manufacturer/info':
$route = 'product/manufacturer/info';
$pagination->url = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $data['manufacturer_id'] . $url . '&page={page}');
break;
case 'product/search':
$route = 'product/search';
$pagination->url = $this->url->link('product/search', $url . '&page={page}');
break;
case 'product/special':
$route = 'product/special';
$pagination->url = $this->url->link('product/special', $url . '&page={page}');
break;
default:
$route = '';
}
$this->data['pagination'] = $pagination->render();
if (Front::$IS_OC2) {
$l = (int) Journal2Utils::getProperty($data, 'limit');
if (!$l) {
$data['limit'] = 15;
}
$this->data['results'] = sprintf($this->language->get('text_pagination'), $product_total ? ($data['page'] - 1) * $data['limit'] + 1 : 0, ($data['page'] - 1) * $data['limit'] > $product_total - $data['limit'] ? $product_total : ($data['page'] - 1) * $data['limit'] + $data['limit'], $product_total, ceil($product_total / $data['limit']));
}
$this->data['order'] = $data['order'];
$this->data['sort'] = $data['sort'];
$this->data['sorts'] = array();
$this->data['sorts'][] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link($route, 'sort=p.sort_order&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link($route, 'sort=pd.name&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link($route, 'sort=pd.name&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link($route, 'sort=p.price&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link($route, 'sort=p.price&order=DESC' . $url));
if ($this->config->get('config_review_status')) {
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link($route, 'sort=rating&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link($route, 'sort=rating&order=ASC' . $url));
}
$this->data['sorts'][] = array('text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link($route, 'sort=p.model&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link($route, 'sort=p.model&order=DESC' . $url));
$this->data['limit'] = $data['limit'];
$this->data['limits'] = array();
$limits = array_unique(array($this->config->get('config_catalog_limit'), 25, 50, 75, 100));
sort($limits);
foreach ($limits as $limit) {
$this->data['limits'][] = array('text' => $limit, 'value' => $limit, 'href' => $this->url->link($route, $url . '&limit=' . $limit));
}
$this->data['continue'] = $this->url->link('common/home');
$this->language->load('product/search');
$this->data['text_no_results'] = $this->language->get('text_empty');
$this->template = $this->config->get('config_template') . '/template/journal2/module/super_filter_product.tpl';
$this->response->setOutput($this->render());
}
示例14: get
public function get($key, $default = null)
{
$value = Journal2Utils::getProperty($this->settings, $key, FALSE);
return $value === FALSE ? $default : $value;
}
示例15: index
public function index($setting)
{
if (!defined('JOURNAL_INSTALLED')) {
return;
}
Journal2::startTimer(get_class($this));
/* get module data from db */
$module_data = $this->model_journal2_module->getModule($setting['module_id']);
if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
return;
}
$module_data = $module_data['module_data'];
/* hide on mobile */
if (Journal2Utils::getProperty($module_data, 'disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet()) && $this->journal2->settings->get('responsive_design')) {
return;
}
/* hide on desktop */
if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
return;
}
$this->data['css'] = '';
/* css for top / bottom positions */
if (in_array($setting['position'], array('top', 'bottom'))) {
$padding = $this->journal2->settings->get('module_margins', 20) . 'px';
/* outer */
$css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
$css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
$css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
$this->journal2->settings->set('module_journal2_newsletter_' . $setting['module_id'], implode('; ', $css));
/* inner css */
$css = array();
if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
$css[] = 'max-width: 100%';
$css[] = 'padding-left: ' . $padding;
$css[] = 'padding-right: ' . $padding;
} else {
$css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
}
$this->data['css'] = implode('; ', $css);
}
/* border */
if (Journal2Utils::getProperty($module_data, 'module_border')) {
$border = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'module_border')));
$this->data['css'] = $this->data['css'] ? '; ' . $border : $border;
}
$cache_property = "module_journal_carousel_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
$cache = $this->journal2->cache->get($cache_property);
if ($cache === null || self::$CACHEABLE !== true) {
$this->data['module'] = mt_rand();
$this->data['text_class'] = Journal2Utils::getProperty($module_data, 'text_position', 'left');
/* hide on mobile */
$this->data['hide_on_mobile_class'] = Journal2Utils::getProperty($module_data, 'disable_mobile') ? 'hide-on-mobile' : '';
/* heading title */
$this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'));
/* text */
$this->data['module_text'] = Journal2Utils::getProperty($module_data, 'module_text.value.' . $this->config->get('config_language_id'));
$font_css = array();
if (Journal2Utils::getProperty($module_data, 'module_text_font.value.font_type') === 'google') {
$font_name = Journal2Utils::getProperty($module_data, 'module_text_font.value.font_name');
$font_subset = Journal2Utils::getProperty($module_data, 'module_text_font.value.font_subset');
$font_weight = Journal2Utils::getProperty($module_data, 'module_text_font.value.font_weight');
$this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
$this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
$weight = filter_var(Journal2Utils::getProperty($module_data, 'module_text_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
$font_css[] = 'font-weight: ' . ($weight ? $weight : 400);
$font_css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_name') . "'";
}
if (Journal2Utils::getProperty($module_data, 'module_text_font.value.font_type') === 'system') {
$font_css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_weight');
$font_css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_family');
}
if (Journal2Utils::getProperty($module_data, 'module_text_font.value.font_type') !== 'none') {
$font_css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_size');
$font_css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.font_style');
$font_css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'module_text_font.value.text_transform');
}
if (Journal2Utils::getProperty($module_data, 'module_text_font.value.color.value.color')) {
$font_css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'module_text_font.value.color.value.color'));
}
$this->data['font_css'] = implode('; ', $font_css);
/* input */
$this->data['input_placeholder'] = Journal2Utils::getProperty($module_data, 'input_placeholder.value.' . $this->config->get('config_language_id'));
$input_style = array();
if (Journal2Utils::getProperty($module_data, 'input_height')) {
$input_style[] = 'height: ' . Journal2Utils::getProperty($module_data, 'input_height') . 'px';
}
$input_field_style = array();
if (Journal2Utils::getProperty($module_data, 'input_bg_color.value.color')) {
$input_field_style[] = 'background-color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'input_bg_color.value.color'));
}
if (Journal2Utils::getProperty($module_data, 'input_border')) {
$input_field_style = array_merge($input_field_style, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'input_border')));
}
if (Journal2Utils::getProperty($module_data, 'input_font.value.font_type') === 'google') {
$font_name = Journal2Utils::getProperty($module_data, 'input_font.value.font_name');
$font_subset = Journal2Utils::getProperty($module_data, 'input_font.value.font_subset');
$font_weight = Journal2Utils::getProperty($module_data, 'input_font.value.font_weight');
$this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
$this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
$weight = filter_var(Journal2Utils::getProperty($module_data, 'input_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
//.........这里部分代码省略.........