Example #1
0
 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;
 }
Example #2
0
 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();
 }
Example #3
0
 public function getTabContent()
 {
     frameGmp::_()->getModule('templates')->loadJqGrid();
     frameGmp::_()->addScript('admin.mgr.list', $this->getModule()->getModPath() . 'js/admin.marker_groups.list.js');
     frameGmp::_()->addJSVar('admin.mgr.list', 'mgrTblDataUrl', uriGmp::mod('marker_groups', 'getListForTbl', array('reqType' => 'ajax')));
     $this->assign('addNewLink', frameGmp::_()->getModule('options')->getTabUrl('marker_groups_add_new'));
     return parent::getContent('mgrAdmin');
 }
Example #4
0
    public function initJsVars()
    {
        $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'), 'GMP_CODE' => GMP_CODE);
        return '<script type="text/javascript">
		// <!--
			var GMP_DATA = ' . utilsGmp::jsonEncode($jsData) . ';
		// -->
		</script>';
    }
Example #5
0
 public function loadCoreJs()
 {
     static $loaded = false;
     if (!$loaded) {
         frameGmp::_()->addScript('jquery');
         frameGmp::_()->addScript('commonGmp', GMP_JS_PATH . 'common.js', array('jquery'));
         frameGmp::_()->addScript('coreGmp', GMP_JS_PATH . 'core.js', array('jquery'));
         $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, 'GMP_CODE' => GMP_CODE, 'isAdmin' => is_admin());
         if (is_admin()) {
             $jsData['isPro'] = frameGmp::_()->getModule('supsystic_promo')->isPro();
         }
         $jsData = dispatcherGmp::applyFilters('jsInitVariables', $jsData);
         frameGmp::_()->addJSVar('coreGmp', 'GMP_DATA', $jsData);
         $loaded = true;
     }
 }
Example #6
0
 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');
 }
Example #7
0
 public function addStyle($handle, $src = false, $deps = array(), $ver = false, $media = 'all')
 {
     $src = empty($src) ? $src : uriGmp::_($src);
     if ($this->_stylesInitialized) {
         wp_enqueue_style($handle, $src, $deps, $ver, $media);
     } else {
         $this->_styles[] = array('handle' => $handle, 'src' => $src, 'deps' => $deps, 'ver' => $ver, 'media' => $media);
     }
 }
Example #8
0
 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;
 }
Example #9
0
?>
						</button>
						<?php 
echo htmlGmp::ajaxfile('csv_import_file_maps', array('url' => uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'csv', 'action' => 'import', 'type' => 'maps', 'reqType' => 'ajax')), 'data' => 'gmpCsvImportData', 'buttonName' => __('Import', GMP_LANG_CODE), 'responseType' => 'json', 'onSubmit' => 'gmpCsvImportOnSubmit', 'onComplete' => 'gmpCsvImportOnComplete', 'btn_class' => 'button'));
?>
					</td>
				</tr>
				<tr>
					<th scope="row">
						<label for="gmpCsvExportMarkersBtn">
							<?php 
_e('Markers', GMP_LANG_CODE);
?>
						</label>
					</th>
					<td>
						<button id="gmpCsvExportMarkersBtn" class="button">
							<?php 
_e('Export', GMP_LANG_CODE);
?>
						</button>
						<?php 
echo htmlGmp::ajaxfile('csv_import_file_markers', array('url' => uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'csv', 'action' => 'import', 'type' => 'markers', 'reqType' => 'ajax')), 'data' => 'gmpCsvImportData', 'buttonName' => __('Import', GMP_LANG_CODE), 'responseType' => 'json', 'onSubmit' => 'gmpCsvImportOnSubmit', 'onComplete' => 'gmpCsvImportOnComplete', 'btn_class' => 'button'));
?>
					</td>
				</tr>
				</tbody>
			</table>
		</div>
	</div>
</section>
Example #10
0
											<?php 
echo htmlGmp::text('map_opts[kml_file_url][]', array('value' => '', 'attrs' => 'class="gmpProOpt" style="width: 90%;" disabled="disabled"'));
?>
											<span
												class="gmpKmlUploadMsg"
												style="	float: right; width: 100%; text-align: right;"
											></span>
											<a
												href="#"
												class="gmpKmlUploadFileBtn button gmpProOpt"
												data-nonce="<?php 
echo wp_create_nonce('upload-kml-file');
?>
"
												data-url="<?php 
echo uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'kml', 'action' => 'addFromFile', 'reqType' => 'ajax', 'pl' => GMP_CODE));
?>
"
												id="gmpKmlUploadFileBtn"
												style="margin: 5px 0px; float: right;"
											>
												<?php 
_e('or Upload KML file', GMP_LANG_CODE);
?>
											</a><br />
										</div>
										<div id="gmpKmlFileRowsShell"></div>
										<a
										 	href="#"
											class="button gmpProOpt"
											id="gmpKmlAddFileRowBtn"
Example #11
0
 public function addSettingsLinkForPlug($links)
 {
     array_unshift($links, '<a href="' . uriGmp::_(array('baseUrl' => admin_url('admin.php'), 'page' => frameGmp::_()->getModule('adminmenu')->getView()->getMainSlug())) . '">' . langGmp::_('Settings') . '</a>');
     return $links;
 }
Example #12
0
 public function getMainLink()
 {
     return uriGmp::_(array('baseUrl' => admin_url('admin.php'), 'page' => $this->getMainSlug()));
 }
Example #13
0
 public function showWelcomePage()
 {
     $this->assign('askOptions', array(1 => array('label' => 'Google'), 2 => array('label' => 'Worgmpess.org'), 3 => array('label' => 'Refer a friend'), 4 => array('label' => 'Find on the web'), 5 => array('label' => 'Other way...')));
     $this->assign('originalPage', uriGmp::getFullUrl());
     parent::display('welcomePage');
 }
Example #14
0
 public static function ajaxfile($name, $params = array('url' => '', 'value' => '', 'fid' => '', 'buttonName' => ''))
 {
     frameGmp::_()->addScript('ajaxupload', GMP_JS_PATH . 'ajaxupload.js');
     $out = '';
     if (strpos($params['url'], 'pl=' . GMP_CODE) === false) {
         $params['url'] = uriGmp::_(array('baseUrl' => $params['url'], 'pl' => GMP_CODE));
     }
     $out .= self::button(array('value' => empty($params['buttonName']) ? __('Upload') : $params['buttonName'], 'attrs' => 'id="toeUploadbut_' . $name . '" class="button"'));
     $display = empty($params['value']) ? 'style="display: none;"' : '';
     if (isset($params['preview']) && $params['preview']) {
         $out .= self::img($params['value'], 0, array('attrs' => 'id="prev_' . $name . '" ' . $display . ' class="previewpicture"'));
     }
     $out .= '<span class="delete_option" id="delete_' . $name . '" ' . $display . '></span>';
     $out .= '<script type="text/javascript">// <!--
             jQuery(document).ready(function(){
                 new AjaxUpload("#toeUploadbut_' . $name . '", { 
                     action: "' . $params['url'] . '", 
                     name: "' . $name . '" ' . (empty($params['data']) ? '' : ',  data: ' . $params['data'] . '') . (empty($params['autoSubmit']) ? '' : ',  autoSubmit: "' . $params['autoSubmit'] . '"') . (empty($params['responseType']) ? '' : ',  responseType: "' . $params['responseType'] . '"') . (empty($params['onChange']) ? '' : ',  onChange: ' . $params['onChange'] . '') . (empty($params['onSubmit']) ? '' : ',  onSubmit: ' . $params['onSubmit'] . '') . (empty($params['onComplete']) ? '' : ',  onComplete: ' . $params['onComplete'] . '') . '});
             });
         // --></script>';
     return $out;
 }
Example #15
0
 /**
  * Replace symbols to special html caracters in one output
  */
 public static function oneHtmlEnc()
 {
     self::$_oneHtmlEnc = true;
 }