function magiczoomplus($content, $currentController = false, $type = false, $info = false) { if (VERSION < 2) { $magiczoomplus_status = $currentController->config->get('magiczoomplus_status'); } else { $settings = $currentController->config->get('magiczoomplus_settings'); $magiczoomplus_status = $settings['magiczoomplus_status']; } if ($magiczoomplus_status != 0) { $tool =& magiczoomplus_load_core_class($currentController); //set_params_from_config($currentController->config); $enabled_on_this_page = false; unset($GLOBALS['magictoolbox']['items']); $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'No'); if ($tool->type == 'standard') { //do not apply MSS-like modules to category & product pages if ($type && $type == 'category' && !$tool->params->checkValue('use-effect-on-category-page', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-category-page', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-category-page', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } if ($type && $type == 'manufacturers' && !$tool->params->checkValue('use-effect-on-manufacturers-page', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-manufacturers-page', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-manufacturers-page', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } if ($type && $type == 'search' && !$tool->params->checkValue('use-effect-on-search-page', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-search-page', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-search-page', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } if ($type && $type == 'product' && !$tool->params->checkValue('use-effect-on-product-page', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-product-page', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-product-page', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } else { if ($tool->params->checkValue('use-effect-on-product-page', 'Swap images only')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'Yes'); } } } } } if ($tool->type == 'circle') { //Apply 360 only to Products Page if ($type && $type == 'product') { $enabled_on_this_page = true; } } else { if ($type && ($type == 'latest_home_category' || $type == 'latest_home' || $type == 'latest_right' || $type == 'latest_left' || $type == 'latest_content_top' || $type == 'latest_content_bottom' || $type == 'latest_column_left' || $type == 'latest_column_right') && !$tool->params->checkValue('use-effect-on-latest-box', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-latest-box', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-latest-box', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } if ($type && ($type == 'featured_home' || $type == 'featured_right' || $type == 'featured_left' || $type == 'featured_left' || $type == 'featured_content_top' || $type == 'featured_content_bottom' || $type == 'featured_column_left' || $type == 'featured_column_right') && !$tool->params->checkValue('use-effect-on-featured-box', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-featured-box', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-featured-box', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } if ($type && ($type == 'special_home' || $type == 'special_right' || $type == 'special_left' || $type == 'special_content_top' || $type == 'special_content_bottom' || $type == 'special_column_left' || $type == 'special_column_right') && !$tool->params->checkValue('use-effect-on-special-box', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-special-box', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-special-box', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } if ($type && ($type == 'bestseller_home' || $type == 'bestseller_right' || $type == 'bestseller_left' || $type == 'bestseller_content_top' || $type == 'bestseller_content_bottom' || $type == 'bestseller_column_left' || $type == 'bestseller_column_right') && !$tool->params->checkValue('use-effect-on-bestsellers-box', 'No')) { $enabled_on_this_page = true; if ($tool->params->checkValue('use-effect-on-bestsellers-box', 'Zoom')) { $tool->params->set('disable-expand', 'Yes'); $tool->params->set('disable-zoom', 'No'); } else { if ($tool->params->checkValue('use-effect-on-bestsellers-box', 'Expand')) { $tool->params->set('disable-expand', 'No'); $tool->params->set('disable-zoom', 'Yes'); } } } } if ($enabled_on_this_page) { if ($type && $info) { $GLOBALS['magictoolbox']['page_type'] = $type; $GLOBALS['magictoolbox']['prods_info'] = $info; } else { return $content; } $oldContent = $content; $content = magiczoomplus_parse_contents($content, $currentController); if ($oldContent != $content) { $content = magiczoomplus_set_headers($content); } if ($type == 'product' && $tool->type == 'standard' && isset($GLOBALS['magictoolbox']['MagicZoomPlus']['main'])) { // template helper class require_once MTOOLBOX_ADMIN_FOLDER_magiczoomplus . 'magictoolbox.templatehelper.class.php'; MagicToolboxTemplateHelperClass::setPath(MTOOLBOX_ADMIN_FOLDER_magiczoomplus . 'templates'); MagicToolboxTemplateHelperClass::setOptions($tool->params); $html = MagicToolboxTemplateHelperClass::render(array('main' => $GLOBALS['magictoolbox']['MagicZoomPlus']['main'], 'thumbs' => count($GLOBALS['magictoolbox']['MagicZoomPlus']['selectors']) > 1 ? $GLOBALS['magictoolbox']['MagicZoomPlus']['selectors'] : array(), 'pid' => $GLOBALS['magictoolbox']['prods_info']['product_id'])); $content = str_replace('MAGICTOOLBOX_PLACEHOLDER', $html, $content); } } } return $content; }
protected function index() { $this->data['title'] = $this->document->getTitle(); if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) { $server = $this->config->get('config_ssl'); } else { $server = $this->config->get('config_url'); } if (isset($this->session->data['error']) && !empty($this->session->data['error'])) { $this->data['error'] = $this->session->data['error']; unset($this->session->data['error']); } else { $this->data['error'] = ''; } $this->data['base'] = $server; $this->data['description'] = $this->document->getDescription(); $this->data['keywords'] = $this->document->getKeywords(); $this->data['links'] = $this->document->getLinks(); $this->data['styles'] = $this->document->getStyles(); $this->data['scripts'] = $this->document->getScripts(); $this->data['lang'] = $this->language->get('code'); $this->data['direction'] = $this->language->get('direction'); $this->data['google_analytics'] = html_entity_decode($this->config->get('config_google_analytics'), ENT_QUOTES, 'UTF-8'); $this->data['name'] = $this->config->get('config_name'); if ($this->config->get('config_icon') && file_exists(DIR_IMAGE . $this->config->get('config_icon'))) { $this->data['icon'] = $server . 'image/' . $this->config->get('config_icon'); } else { $this->data['icon'] = ''; } if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) { $this->data['logo'] = $server . 'image/' . $this->config->get('config_logo'); } else { $this->data['logo'] = ''; } $this->language->load('common/header'); $this->data['text_home'] = $this->language->get('text_home'); $this->data['text_wishlist'] = sprintf($this->language->get('text_wishlist'), isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0); $this->data['text_shopping_cart'] = $this->language->get('text_shopping_cart'); $this->data['text_search'] = $this->language->get('text_search'); $this->data['text_welcome'] = sprintf($this->language->get('text_welcome'), $this->url->link('account/login', '', 'SSL'), $this->url->link('account/register', '', 'SSL')); $this->data['text_logged'] = sprintf($this->language->get('text_logged'), $this->url->link('account/account', '', 'SSL'), $this->customer->getFirstName(), $this->url->link('account/logout', '', 'SSL')); $this->data['text_account'] = $this->language->get('text_account'); $this->data['text_checkout'] = $this->language->get('text_checkout'); $this->data['home'] = $this->url->link('common/home'); $this->data['wishlist'] = $this->url->link('account/wishlist', '', 'SSL'); $this->data['logged'] = $this->customer->isLogged(); $this->data['account'] = $this->url->link('account/account', '', 'SSL'); $this->data['shopping_cart'] = $this->url->link('checkout/cart'); $this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL'); // Daniel's robot detector $status = true; if (isset($this->request->server['HTTP_USER_AGENT'])) { $robots = explode("\n", trim($this->config->get('config_robots'))); foreach ($robots as $robot) { if ($robot && strpos($this->request->server['HTTP_USER_AGENT'], trim($robot)) !== false) { $status = false; break; } } } // A dirty hack to try to set a cookie for the multi-store feature $this->load->model('setting/store'); $this->data['stores'] = array(); if ($this->config->get('config_shared') && $status) { $this->data['stores'][] = $server . 'catalog/view/javascript/crossdomain.php?session_id=' . $this->session->getId(); $stores = $this->model_setting_store->getStores(); foreach ($stores as $store) { $this->data['stores'][] = $store['url'] . 'catalog/view/javascript/crossdomain.php?session_id=' . $this->session->getId(); } } // Search if (isset($this->request->get['search'])) { $this->data['search'] = $this->request->get['search']; } else { $this->data['search'] = ''; } // Menu $this->load->model('catalog/category'); $this->load->model('catalog/product'); $this->data['categories'] = array(); $categories = $this->model_catalog_category->getCategories(0); foreach ($categories as $category) { if ($category['top']) { // Level 2 $children_data = array(); $children = $this->model_catalog_category->getCategories($category['category_id']); foreach ($children as $child) { $data = array('filter_category_id' => $child['category_id'], 'filter_sub_category' => true); $product_total = $this->model_catalog_product->getTotalProducts($data); $children_data[] = array('name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $product_total . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])); } // Level 1 $this->data['categories'][] = array('name' => $category['name'], 'children' => $children_data, 'column' => $category['column'] ? $category['column'] : 1, 'href' => $this->url->link('product/category', 'path=' . $category['category_id'])); } } $this->children = array('module/language', 'module/currency', 'module/cart'); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/header.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/header.tpl'; } else { $this->template = 'default/template/common/header.tpl'; } $magicArray = array("magiczoom" => false, "magiczoomplus" => false, "magicthumb" => false, "magictouch" => false, "magicmagnify" => false, "magicmagnifyplus" => false, "magicscroll" => false, "magicslideshow" => false, "magic360" => false); $this->render(); /* Magictoolbox magiczoomplus module BEGIN */ if ($this->config->get('magiczoomplus_status') != 0) { $tool = magiczoomplus_load_core_class($this); if (magiczoomplus_use_effect_on($tool)) { $magicArray['magiczoomplus'] = true; } } /* Magictoolbox magiczoomplus module END */ foreach ($magicArray as $toolId => $run) { if ($run) { $func = "{$toolId}" . '_set_headers'; $this->output = $func($this->output); } } }
<?php // error_reporting(E_ALL); // ini_set('display_errors', '1'); require_once DIR_APPLICATION . 'controller/module/magiczoomplus-opencart-module/module.php'; $tool =& magiczoomplus_load_core_class(); class ControllerModuleMagicZoomPlus extends Controller { private $error = array(); private $params = array(); public function index() { $tool = $GLOBALS["magictoolbox"]["magiczoomplus"]; $shop_dir = str_replace('system/', '', DIR_SYSTEM); $image_dir = str_replace($shop_dir, '', DIR_IMAGE); $pathToCache = '/' . $image_dir . 'magictoolbox_cache'; $this->language->load('module/magiczoomplus'); // load lang. file if (method_exists($this->document, 'setTitle')) { $this->document->setTitle($this->language->get('title')); } else { $this->document->title = $this->language->get('title'); //load title } $this->load->model('setting/setting'); //just include file admin/model/setting/setting.php and create object ModelSettingSetting $token = isset($this->session->data['token']) ? '&token=' . $this->session->data['token'] : ''; if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) { if (isset($this->request->post['clear_cache']) && $this->request->post['clear_cache'] == '1') { //clear cache $this->params = $this->model_setting_setting->getSetting('magiczoomplus');