public function _afterGet($marker, $widthMapData = false, $withoutIcons = false) { if (!empty($marker)) { if (!$withoutIcons) { $marker['icon_data'] = frameGmp::_()->getModule('icons')->getModel()->getIconFromId($marker['icon']); } $marker['params'] = utilsGmp::unserialize($marker['params']); /*$marker['position'] = array( 'coord_x' => $marker['coord_x'], 'coord_y' => $marker['coord_y'], );*/ if (isset($marker['params']['marker_title_link']) && !empty($marker['params']['marker_title_link']) && strpos($marker['params']['marker_title_link'], 'http') !== 0) { $marker['params']['marker_title_link'] = 'http://' . $marker['params']['marker_title_link']; } if (!isset($marker['params']['title_is_link'])) { $marker['params']['title_is_link'] = false; } // Go to absolute path as "../wp-content/" will not work on frontend $marker['description'] = str_replace('../wp-content/', GMP_SITE_URL . 'wp-content/', $marker['description']); if (uriGmp::isHttps()) { $marker['description'] = uriGmp::makeHttps($marker['description']); } if ($widthMapData && !empty($marker['map_id'])) { $marker['map'] = frameGmp::_()->getModule('gmap')->getModel()->getMapById($marker['map_id'], false); } } return $marker; }
public function init() { if (frameGmp::isAdminPlugPage()) { $this->_styles = array('styleGmp' => array('path' => GMP_CSS_PATH . 'style.css'), 'adminStylesGmp' => array('path' => GMP_CSS_PATH . 'adminStyles.css'), 'farbtastic' => array(), 'wp-jquery-ui-dialog' => array(), 'jquery-dialog' => array('path' => GMP_CSS_PATH . 'jquery-dialog.css')); } $defaultPlugTheme = frameGmp::_()->getModule('options')->get('default_theme'); $ajaxurl = admin_url('admin-ajax.php'); if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) { $ajaxurl = uriGmp::makeHttps($ajaxurl); } $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'cssPath' => GMP_CSS_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langGmp::getData(), 'options' => frameGmp::_()->getModule('options')->getAllowedPublicOptions(), 'GMP_CODE' => GMP_CODE, 'ball_loader' => GMP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => GMP_IMG_PATH . 'ok-icon.png', 'isHttps' => uriGmp::isHttps()); if (frameGmp::isAdminPlugPage()) { frameGmp::_()->addScript('commonGmp', GMP_JS_PATH . 'common.js'); frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js'); $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData); frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData); frameGmp::_()->addScript('datatable', GMP_JS_PATH . 'jquery.dataTables.min.js'); frameGmp::_()->addScript('farbtastic', get_bloginfo('wpurl') . '/wp-admin/js/farbtastic.js', array('jquery')); frameGmp::_()->addScript('jquery-ui-tabs', '', array('jquery'), false, true); frameGmp::_()->addScript('jquery-ui-autocomplete', '', array('jquery'), false, true); frameGmp::_()->getModule('marker')->connectAssets(); frameGmp::_()->addScript('jquery-ui-dialog', '', array('jquery')); frameGmp::_()->addScript('adminOptionsGmp', GMP_JS_PATH . 'admin.options.js'); } if (is_admin()) { frameGmp::_()->addScript('ajaxupload', GMP_JS_PATH . 'ajaxupload.js'); frameGmp::_()->addScript('postbox', get_bloginfo('wpurl') . '/wp-admin/js/postbox.js'); add_action('wp_enqueue_scripts', array($this, 'addThickbox')); $jsData['allCheckRegPlugs'] = modInstallerGmp::getCheckRegPlugs(); } else { } foreach ($this->_styles as $s => $sInfo) { if (isset($sInfo['for'])) { if ($sInfo['for'] == 'frontend' && is_admin() || $sInfo['for'] == 'admin' && !is_admin()) { continue; } } $canBeSubstituted = true; if (isset($sInfo['substituteFor'])) { switch ($sInfo['substituteFor']) { case 'frontend': $canBeSubstituted = !is_admin(); break; case 'admin': $canBeSubstituted = is_admin(); break; } } if ($canBeSubstituted && file_exists(GMP_TEMPLATES_DIR . $defaultPlugTheme . DS . $s . '.css')) { frameGmp::_()->addStyle($s, GMP_TEMPLATES_PATH . $defaultPlugTheme . '/' . $s . '.css'); } elseif ($canBeSubstituted && file_exists(utilsGmp::getCurrentWPThemeDir() . 'gmp' . DS . $s . '.css')) { frameGmp::_()->addStyle($s, utilsGmp::getCurrentWPThemePath() . '/toe/' . $s . '.css'); } elseif (!empty($sInfo['path'])) { frameGmp::_()->addStyle($s, $sInfo['path']); } else { frameGmp::_()->addStyle($s); } } parent::init(); }
public function getCdnUrl() { if (empty($this->_cdnUrl)) { if (uriGmp::isHttps()) { $this->_cdnUrl = 'https://supsystic.com/'; } else { $this->_cdnUrl = 'http://cdn.supsystic.com/'; } } return $this->_cdnUrl; }
public function drawMap($params) { $ajaxurl = admin_url('admin-ajax.php'); if (frameGmp::_()->getModule('options')->get('ssl_on_ajax')) { $ajaxurl = uriGmp::makeHttps($ajaxurl); } $jsData = array('siteUrl' => GMP_SITE_URL, 'imgPath' => GMP_IMG_PATH, 'loader' => GMP_LOADER_IMG, 'close' => GMP_IMG_PATH . 'cross.gif', 'ajaxurl' => $ajaxurl, 'animationSpeed' => frameGmp::_()->getModule('options')->get('js_animation_speed'), 'siteLang' => langGmp::getData(), 'options' => frameGmp::_()->getModule('options')->getAllowedPublicOptions(), 'GMP_CODE' => GMP_CODE, 'ball_loader' => GMP_IMG_PATH . 'ajax-loader-ball.gif', 'ok_icon' => GMP_IMG_PATH . 'ok-icon.png', 'isHttps' => uriGmp::isHttps()); frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js'); $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData); frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData); frameGmp::_()->addScript('jquery', '', array('jquery')); $mapObj = frameGmp::_()->getModule('gmap')->getModel()->getMapById($params['id']); if (isset($params['map_center']) && is_string($params['map_center'])) { if (strpos($params['map_center'], ';')) { $centerXY = array_map('trim', explode(';', $params['map_center'])); $params['map_center'] = array('coord_x' => $centerXY[0], 'coord_y' => $centerXY[1]); } elseif (is_numeric($params['map_center'])) { // Map center - is coords of one of it's marker $params['map_center'] = (int) trim($params['map_center']); $found = false; if (!empty($mapObj['markers'])) { foreach ($mapObj['markers'] as $marker) { if ($marker['id'] == $params['map_center']) { $params['map_center'] = array('coord_x' => $marker['coord_x'], 'coord_y' => $marker['coord_y']); $found = true; break; } } } // If no marker with such ID were found - just unset it to prevent map broke if (!$found) { unset($params['map_center']); } } else { // If it is set, but not valid - just unset it to not break user map unset($params['map_center']); } } $shortCodeHtmlParams = array('width', 'height', 'align'); $paramsCanNotBeEmpty = array('width', 'height'); foreach ($shortCodeHtmlParams as $code) { if (isset($params[$code])) { if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) { continue; } $mapObj['html_options'][$code] = $params[$code]; } } $shortCodeMapParams = $this->getModel()->getParamsList(); //array('map_display_mode', 'language', 'type', 'zoom', 'enable_zoom', 'enable_mouse_zoom'); foreach ($shortCodeMapParams as $code) { if (isset($params[$code])) { if (in_array($code, $paramsCanNotBeEmpty) && empty($params[$code])) { continue; } $mapObj['params'][$code] = $params[$code]; } } if (isset($params['display_as_img']) && $params['display_as_img']) { $mapObj['params']['map_display_mode'] = 'popup'; } if ($mapObj['params']['map_display_mode'] == 'popup') { frameGmp::_()->addScript('bpopup', GMP_JS_PATH . '/bpopup.js'); } frameGmp::_()->addScript('google_maps_api_' . $mapObj['params']['language'], $this->getApiUrl() . $mapObj['params']['language']); frameGmp::_()->addScript('map.options', $this->getModule()->getModPath() . 'js/map.options.js', array('jquery')); frameGmp::_()->addStyle('map_params', $this->getModule()->getModPath() . 'css/map.css'); frameGmp::_()->getModule('marker')->connectAssets(); if (empty($mapObj['params']['map_display_mode'])) { $mapObj['params']['map_display_mode'] = 'map'; } // This is for posibility to show multy maps with same ID on one page $mapObj['original_id'] = $mapObj['id']; if (isset($this->_idToRandId[$mapObj['original_id']])) { $mapObj['id'] = $this->_idToRandId[$mapObj['original_id']]; } else { $this->_idToRandId[$mapObj['original_id']] = $mapObj['id'] = mt_rand(1, 99999) . $mapObj['id']; } $indoWindowSize = utilsGmp::unserialize(frameGmp::_()->getModule('options')->getModel('options')->get('infowindow_size')); $this->assign('indoWindowSize', $indoWindowSize); $this->assign('currentMap', $mapObj); $markersDisplayType = ''; if (isset($params['display_type'])) { $markersDisplayType = $params['display_type']; } else { if (isset($params['markers_list_type'])) { $markersDisplayType = $params['markers_list_type']; } else { if (isset($mapObj['params']['markers_list_type']) && !empty($mapObj['params']['markers_list_type'])) { $markersDisplayType = $mapObj['params']['markers_list_type']; } } } $mapObj['params']['markers_list_type'] = $markersDisplayType; $this->addMapData($mapObj); $this->assign('markersDisplayType', $markersDisplayType); // This will require only in PRO, but we will make it here - to avoid code doubling $this->assign('mapCategories', frameGmp::_()->getModule('marker_groups')->getModel()->getListForMarkers(isset($mapObj['markers']) ? $mapObj['markers'] : false)); return parent::getContent('mapPreview'); }
function getIconUrl($icon) { if (!empty($icon)) { $isUrl = strpos($icon, 'http'); if ($isUrl === false) { $icon = $this->getIconsFullDir() . $icon; } if (uriGmp::isHttps()) { $icon = uriGmp::makeHttps($icon); } } return $icon; }