Google Maps Easy - Version 1.11.4

Version Description

Download this release

Release Info

Developer supsystic.com
Plugin Icon 128x128 Google Maps Easy
Version 1.11.4
Comparing to
See all releases

Code changes from version 1.11.3 to 1.11.4

classes/html.php CHANGED
@@ -216,8 +216,8 @@ class htmlGmp {
216
  if(isset($params['preview']) && $params['preview'])
217
  $out .= self::img($params['value'], 0, array('attrs' => 'id="prev_'.$name.'" '.$display.' class="previewpicture"'));
218
  $out .= '<span class="delete_option" id="delete_'.$name.'" '.$display.'></span>';
219
- $out .= '<script type="text/javascript">// <!--
220
- jQuery(document).ready(function(){
221
  new AjaxUpload("#toeUploadbut_'.$name.'", {
222
  action: "'.$params['url'].'",
223
  name: "'. $name. '" '.
@@ -228,8 +228,13 @@ class htmlGmp {
228
  (empty($params['onSubmit']) ? '' : ', onSubmit: '. $params['onSubmit']. '').
229
  (empty($params['onComplete']) ? '' : ', onComplete: '. $params['onComplete']. '').
230
  '});
231
- });
232
- // --></script>';
 
 
 
 
 
233
  return $out;
234
  }
235
  static public function button($params = array('attrs' => '', 'value' => '')) {
@@ -499,40 +504,45 @@ class htmlGmp {
499
  $params['slide'] = 'toeSliderMove';
500
  }
501
  if(!empty($params)) {
502
- if(isset($params['min']) && empty($params['min'])) {
503
- $params['min'] = 0;
504
- }
505
- $paramsArr = array();
506
- foreach($params as $k => $v) {
507
- if(in_array($k, array('attrs')) || strpos($k, '-')) continue;
508
- $value = (is_numeric($v) || in_array($k, array('slide'))) ? $v : '"'. $v. '"';
509
- $paramsArr[] = $k. ': '. $value;
510
- }
511
- $paramsStr = implode(', ', $paramsArr);
512
  }
513
-
514
  $res = '<div id="toeSliderDisplay_'. $id. '" class="toeSliderDisplay" data-unit="">'. (isset($params['value']) ? $params['value'] . ' <span class="customControlsUnit"></span>' : '') . '</div>';
515
  $res .= '<div id="'. $id. '"></div>';
516
  $params['attrs'] = 'id="toeSliderInput_'. $id. '"';
517
  $res .= self::hidden($name, $params);
518
- $res .= '<script type="text/javascript">
519
- jQuery(function() {
520
- var iter = 0;
521
-
522
- function toeAddSlider() {
523
- if(typeof(jQuery("#' . $id . '").slider) == "function" && typeof(toeSliderMove) == "function") {
524
- jQuery("#' . $id . '").slider({' . $paramsStr . '});
525
- iter = 0;
526
- } else {
527
- iter++;
528
- if(iter < 15) {
529
- setTimeout(toeAddSlider, 500);
530
- }
531
- }
532
- }
533
- toeAddSlider();
534
- });
535
- </script>';
 
 
 
 
 
 
536
  return $res;
537
  }
538
  static public function capcha() {
@@ -582,10 +592,11 @@ class htmlGmp {
582
  });
583
  });
584
  ';
585
- wp_add_inline_script( 'common', $script, 'after' );
586
-
587
-
588
-
 
589
  return $out;
590
  }
591
  static public function fontsList($name, $params = array('value' => '')) {
216
  if(isset($params['preview']) && $params['preview'])
217
  $out .= self::img($params['value'], 0, array('attrs' => 'id="prev_'.$name.'" '.$display.' class="previewpicture"'));
218
  $out .= '<span class="delete_option" id="delete_'.$name.'" '.$display.'></span>';
219
+
220
+ $script = 'jQuery(document).ready(function(){
221
  new AjaxUpload("#toeUploadbut_'.$name.'", {
222
  action: "'.$params['url'].'",
223
  name: "'. $name. '" '.
228
  (empty($params['onSubmit']) ? '' : ', onSubmit: '. $params['onSubmit']. '').
229
  (empty($params['onComplete']) ? '' : ', onComplete: '. $params['onComplete']. '').
230
  '});
231
+ });';
232
+ if (is_admin()) {
233
+ wp_add_inline_script( 'common', $script, 'after' );
234
+ } else {
235
+ wp_add_inline_script( 'commonGmp', $script, 'after' );
236
+ }
237
+
238
  return $out;
239
  }
240
  static public function button($params = array('attrs' => '', 'value' => '')) {
504
  $params['slide'] = 'toeSliderMove';
505
  }
506
  if(!empty($params)) {
507
+ if(isset($params['min']) && empty($params['min'])) {
508
+ $params['min'] = 0;
509
+ }
510
+ $paramsArr = array();
511
+ foreach($params as $k => $v) {
512
+ if(in_array($k, array('attrs')) || strpos($k, '-')) continue;
513
+ $value = (is_numeric($v) || in_array($k, array('slide'))) ? $v : '"'. $v. '"';
514
+ $paramsArr[] = $k. ': '. $value;
515
+ }
516
+ $paramsStr = implode(', ', $paramsArr);
517
  }
 
518
  $res = '<div id="toeSliderDisplay_'. $id. '" class="toeSliderDisplay" data-unit="">'. (isset($params['value']) ? $params['value'] . ' <span class="customControlsUnit"></span>' : '') . '</div>';
519
  $res .= '<div id="'. $id. '"></div>';
520
  $params['attrs'] = 'id="toeSliderInput_'. $id. '"';
521
  $res .= self::hidden($name, $params);
522
+ $script = '
523
+ jQuery(function(){
524
+ jQuery(document).ready(function($){
525
+ var iter = 0;
526
+ function toeAddSlider() {
527
+ if(typeof(jQuery("#' . $id . '").slider) == "function" && typeof(toeSliderMove) == "function") {
528
+ jQuery("#' . $id . '").slider({' . $paramsStr . '});
529
+ iter = 0;
530
+ } else {
531
+ iter++;
532
+ if(iter < 15) {
533
+ setTimeout(toeAddSlider, 500);
534
+ }
535
+ }
536
+ }
537
+ toeAddSlider();
538
+ });
539
+ });
540
+ ';
541
+ if (is_admin()) {
542
+ wp_add_inline_script( 'common', $script, 'after' );
543
+ } else {
544
+ wp_add_inline_script( 'commonGmp', $script, 'after' );
545
+ }
546
  return $res;
547
  }
548
  static public function capcha() {
592
  });
593
  });
594
  ';
595
+ if (is_admin()) {
596
+ wp_add_inline_script( 'common', $script, 'after' );
597
+ } else {
598
+ wp_add_inline_script( 'commonGmp', $script, 'after' );
599
+ }
600
  return $out;
601
  }
602
  static public function fontsList($name, $params = array('value' => '')) {
classes/installerDbUpdater.php CHANGED
@@ -1,12 +1,10 @@
1
  <?php
2
  class installerDbUpdaterGmp {
3
  static public function runUpdate() {
4
- self::update_105();
5
- self::update_109();
6
- self::update_117();
7
- self::update_192();
8
  }
9
- public static function update_105() {
10
  if(!dbGmp::exist('gmp_modules', 'code', 'csv')) {
11
  global $wpdb;
12
  $tableName = $wpdb->prefix . "gmp_modules";
@@ -21,7 +19,7 @@ class installerDbUpdaterGmp {
21
  ));
22
  }
23
  }
24
- public static function update_109() {
25
  if(!dbGmp::exist('gmp_modules', 'code', 'maps_widget')) {
26
  global $wpdb;
27
  $tableName = $wpdb->prefix . "gmp_modules";
@@ -36,35 +34,4 @@ class installerDbUpdaterGmp {
36
  ));
37
  }
38
  }
39
- public static function update_117() {
40
- global $wpdb;
41
- $tableName = $wpdb->prefix . "gmp_options";
42
- $data_update = array(
43
- 'value_type' => 'array',
44
- );
45
- $data_where = array(
46
- 'code' => 'infowindow_size'
47
- );
48
- $wpdb->update($tableName, $data_update, $data_where);
49
- }
50
-
51
- public static function update_192() {
52
- global $wpdb;
53
- $wpPrefix = $wpdb->prefix;
54
-
55
- $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$wpdb->prefix}gmp_markers' AND column_name = 'period_from'" );
56
- if(empty($row)) {
57
- $res = $wpdb->query("ALTER TABLE {$wpdb->prefix}gmp_markers ADD COLUMN `period_from` DATE NULL");
58
- }
59
-
60
- $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$wpdb->prefix}gmp_markers' AND column_name = 'period_to'" );
61
- if(empty($row)) {
62
- $res = $wpdb->query("ALTER TABLE {$wpdb->prefix}gmp_markers ADD COLUMN `period_to` DATE NULL");
63
- }
64
-
65
- $row = $wpdb->get_results( "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$wpdb->prefix}gmp_markers' AND column_name = 'hash'" );
66
- if(empty($row)) {
67
- $res = $wpdb->query("ALTER TABLE {$wpdb->prefix}gmp_markers ADD COLUMN `hash` varchar(32) DEFAULT NULL");
68
- }
69
- }
70
  }
1
  <?php
2
  class installerDbUpdaterGmp {
3
  static public function runUpdate() {
4
+ self::update_201();
5
+ self::update_202();
 
 
6
  }
7
+ public static function update_201() {
8
  if(!dbGmp::exist('gmp_modules', 'code', 'csv')) {
9
  global $wpdb;
10
  $tableName = $wpdb->prefix . "gmp_modules";
19
  ));
20
  }
21
  }
22
+ public static function update_202() {
23
  if(!dbGmp::exist('gmp_modules', 'code', 'maps_widget')) {
24
  global $wpdb;
25
  $tableName = $wpdb->prefix . "gmp_modules";
34
  ));
35
  }
36
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  }
classes/req.php CHANGED
@@ -88,6 +88,11 @@ class reqGmp {
88
  return sanitize_text_field($_SERVER[$name]);
89
  }
90
  }
 
 
 
 
 
91
  break;
92
  case 'cookie':
93
  if(isset($_COOKIE[$name])) {
88
  return sanitize_text_field($_SERVER[$name]);
89
  }
90
  }
91
+ break;
92
+ case 'file':
93
+ case 'files':
94
+ if(isset($_FILES[$name]))
95
+ return $_FILES[$name];
96
  break;
97
  case 'cookie':
98
  if(isset($_COOKIE[$name])) {
classes/view.php CHANGED
@@ -60,7 +60,8 @@ abstract class viewGmp extends baseObjectGmp {
60
  if (empty(self::$_allowedHtml)) {
61
  $allowedHtml = wp_kses_allowed_html();
62
  $allowedDiv = array(
63
- 'div' => array( 'data-tabs-for' => 1, 'data-type' => 1,'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'title' => 1, 'id' => 1, 'data-tooltip-content' => 1,),
 
64
  'section' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'title' => 1, 'id' => 1,),
65
  'nav' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'title' => 1, 'id' => 1,),
66
  'small' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
@@ -88,7 +89,7 @@ abstract class viewGmp extends baseObjectGmp {
88
  'i' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'data-tooltip-content' => 1,),
89
  'u' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
90
  'img' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
91
- 'a' => array( 'data-active-label' => 1, 'data-apply-label' => 1, 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'link' => 1, 'rel' => 1, 'href' => 1, 'target' => 1, ),
92
  'abbr' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
93
  'address' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
94
  'blockquote' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,) ,
@@ -110,7 +111,7 @@ abstract class viewGmp extends baseObjectGmp {
110
  'option' => array( 'name' => 1, 'checked' => 1, 'disabled' => 1, 'selected' => 1, 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'value' => 1, ),
111
  'sup' => array() ,
112
  'sub' => array() ,
113
- 'button' => array( 'style' => 1, 'class' => 1, 'id' => 1 ) ,
114
  'img' => array( 'src' => 1, 'style' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'class' => 1, 'alt' => 1, 'border' => 1, ) ,
115
  'track' => array( 'src' => 1, 'kind' => 1, 'label' => 1, 'srclang' => 1, ) ,
116
  'source' => array( 'src' => 1, 'type' => 1, ) ,
60
  if (empty(self::$_allowedHtml)) {
61
  $allowedHtml = wp_kses_allowed_html();
62
  $allowedDiv = array(
63
+ 'style' => array(),
64
+ 'div' => array( 'data-slider-type' => 1, 'data-unit' => 1, 'data-unit' => 1, 'data-mapid' => 1, 'data-viewid' => 1, 'onclick' => 1, 'data-is-mobile' => 1, 'data-tab-link' => 1, 'data-tab-item' => 1, 'data-today' => 1, 'data-tabs-for' => 1, 'data-type' => 1, 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'title' => 1, 'id' => 1, 'data-tooltip-content' => 1,),
65
  'section' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'title' => 1, 'id' => 1,),
66
  'nav' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'title' => 1, 'id' => 1,),
67
  'small' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
89
  'i' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'data-tooltip-content' => 1,),
90
  'u' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
91
  'img' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
92
+ 'a' => array( 'data-nonce' => 1, 'data-url' => 1, 'onclick' => 1, 'data-active-label' => 1, 'data-apply-label' => 1, 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'link' => 1, 'rel' => 1, 'href' => 1, 'target' => 1, ),
93
  'abbr' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
94
  'address' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,),
95
  'blockquote' => array( 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1,) ,
111
  'option' => array( 'name' => 1, 'checked' => 1, 'disabled' => 1, 'selected' => 1, 'style' => 1, 'title' => 1, 'align' => 1, 'class' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'value' => 1, ),
112
  'sup' => array() ,
113
  'sub' => array() ,
114
+ 'button' => array( 'style' => 1, 'class' => 1, 'id' => 1, 'data-mapid' => 1, 'data-viewid' => 1, 'onclick' => 1, ) ,
115
  'img' => array( 'src' => 1, 'style' => 1, 'width' => 1, 'height' => 1, 'id' => 1, 'class' => 1, 'alt' => 1, 'border' => 1, ) ,
116
  'track' => array( 'src' => 1, 'kind' => 1, 'label' => 1, 'srclang' => 1, ) ,
117
  'source' => array( 'src' => 1, 'type' => 1, ) ,
config.php CHANGED
@@ -49,7 +49,7 @@
49
  define('GMP_EOL', "\n");
50
 
51
  define('GMP_PLUGIN_INSTALLED', true);
52
- define('GMP_VERSION_PLUGIN', '1.11.3'); //GMP_VERSION is pre-defined constant for PHP GMP module http://php.net/manual/en/book.gmp.php
53
  define('GMP_USER', 'user');
54
 
55
  define('GMP_CLASS_PREFIX', 'gmpc');
49
  define('GMP_EOL', "\n");
50
 
51
  define('GMP_PLUGIN_INSTALLED', true);
52
+ define('GMP_VERSION_PLUGIN', '1.11.4'); //GMP_VERSION is pre-defined constant for PHP GMP module http://php.net/manual/en/book.gmp.php
53
  define('GMP_USER', 'user');
54
 
55
  define('GMP_CLASS_PREFIX', 'gmpc');
gmp.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Easy Google Maps
4
  * Plugin URI: https://supsystic.com/plugins/google-maps-plugin/
5
  * Description: The easiest way to create Google Map with markers or locations. Display any data on the map: text, images, videos. Custom map marker icons
6
- * Version: 1.11.3
7
  * Author: supsystic.com
8
  * Author URI: https://supsystic.com
9
  * Text Domain: google-maps-easy
3
  * Plugin Name: Easy Google Maps
4
  * Plugin URI: https://supsystic.com/plugins/google-maps-plugin/
5
  * Description: The easiest way to create Google Map with markers or locations. Display any data on the map: text, images, videos. Custom map marker icons
6
+ * Version: 1.11.4
7
  * Author: supsystic.com
8
  * Author URI: https://supsystic.com
9
  * Text Domain: google-maps-easy
js/common.js CHANGED
@@ -197,6 +197,11 @@ function toeStrFirstUp(str) {
197
  }
198
  function URLToArray(url) {
199
  var request = {};
 
 
 
 
 
200
  var pairs = url.substring(url.indexOf('?') + 1).split('&');
201
  for (var i = 0; i < pairs.length; i++) {
202
  if(!pairs[i])
197
  }
198
  function URLToArray(url) {
199
  var request = {};
200
+
201
+ if(typeof url != 'string') {
202
+ url = url[0];
203
+ }
204
+
205
  var pairs = url.substring(url.indexOf('?') + 1).split('&');
206
  for (var i = 0; i < pairs.length; i++) {
207
  if(!pairs[i])
modules/csv/controller.php ADDED
@@ -0,0 +1,397 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class csvControllerGmp extends controllerGmp {
3
+ public function exportMaps() {
4
+ $data = reqGmp::get('get');
5
+ $delimiter = !empty($data['delimiter']) ? $data['delimiter'] : ';';
6
+ $fileDate = str_replace(array('/', '.', ':'), '_', date(GMP_DATE_FORMAT_HIS));
7
+ $fileName = sprintf(__('Maps from %s - %s', GMP_LANG_CODE), get_bloginfo('name'), $fileDate);
8
+ $maps = frameGmp::_()->getModule('gmap')->getModel()->getAllMaps(array()); // Only maps data
9
+ if(empty($maps)) {
10
+ _e('You have no maps for now.', GMP_LANG_CODE);
11
+ exit();
12
+ }
13
+
14
+ // Remove unneeded values
15
+ foreach($maps as $key => $val) {
16
+ unset($maps[$key]['original_id']);
17
+ unset($maps[$key]['view_id']);
18
+ unset($maps[$key]['view_html_id']);
19
+ unset($maps[$key]['params']['view_id']);
20
+ unset($maps[$key]['params']['view_html_id']);
21
+ unset($maps[$key]['params']['id']);
22
+ }
23
+
24
+ $keys = $this->_getKeys($maps[0]);
25
+ $c = $r = 0;
26
+ $this->_connectCsvLib();
27
+ $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array($fileName));
28
+ $csvGenerator->setDelimiter($delimiter);
29
+ foreach($keys as $k) {
30
+ $csvGenerator->addCell($r, $c, $k);
31
+ $c++;
32
+ }
33
+ $c = 0;
34
+ $r = 1;
35
+ foreach($maps as $map) {
36
+ $c = 0;
37
+ foreach($keys as $k) {
38
+ $mapValue = $this->_prepareValueToExport( $this->_getKeyVal($map, $k) );
39
+ if(is_array($mapValue)) {
40
+ $mapValue = implode(';', $mapValue);
41
+ }
42
+ $csvGenerator->addCell($r, $c, $mapValue);
43
+ $c++;
44
+ }
45
+ $r++;
46
+ }
47
+ $csvGenerator->generate();
48
+ frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('csv.export.maps');
49
+ exit();
50
+ }
51
+ public function exportMarkers() {
52
+ $data = reqGmp::get('get');
53
+ $delimiter = !empty($data['delimiter']) ? $data['delimiter'] : ';';
54
+ $fileSiteDate = str_replace(array('/', '.', ':'), '_', esc_html(get_bloginfo('name')). ' - '. date(GMP_DATE_FORMAT_HIS));
55
+ $fileName = sprintf(__('Markers from %s', GMP_LANG_CODE), $fileSiteDate);
56
+ $markers = frameGmp::_()->getModule('marker')->getModel()->getAllMarkers();
57
+ if(empty($markers)) {
58
+ _e('You have no markers for now.', GMP_LANG_CODE);
59
+ exit();
60
+ }
61
+ $this->_connectCsvLib();
62
+ $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array($fileName));
63
+ if(!empty($data['delimiter'])) {
64
+ $csvGenerator->setDelimiter($delimiter);
65
+ }
66
+ $c = $r = 0;
67
+ $keys = array('id', 'map_id', 'title', 'description', 'coord_x', 'coord_y',);
68
+ $marker_keys = array();
69
+ foreach($markers as $m) {
70
+ $marker_keys = array_unique(array_merge($marker_keys, $this->_getKeys($m)));
71
+ }
72
+ sort($marker_keys);
73
+ $keys = array_unique(array_merge($keys, $marker_keys));
74
+ foreach($keys as $k) {
75
+ $csvGenerator->addCell($r, $c, $k);
76
+ $c++;
77
+ }
78
+ $c = 0;
79
+ $r = 1;
80
+ foreach($markers as $marker) {
81
+ $c = 0;
82
+ foreach($keys as $k) {
83
+ $markerValue = $this->_prepareValueToExport( $this->_getKeyVal($marker, $k) );
84
+ $csvGenerator->addCell($r, $c, $markerValue);
85
+ $c++;
86
+ }
87
+ $r++;
88
+ }
89
+ $csvGenerator->generate();
90
+ frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('csv.export.markers');
91
+ exit();
92
+ }
93
+ public function exportFigures() {
94
+ $data = reqGmp::get('get');
95
+ $delimiter = !empty($data['delimiter']) ? $data['delimiter'] : ';';
96
+ $fileSiteDate = str_replace(array('/', '.', ':'), '_', esc_html(get_bloginfo('name')). ' - '. date(GMP_DATE_FORMAT_HIS));
97
+ $fileName = sprintf(__('Figures from %s', GMP_LANG_CODE), $fileSiteDate);
98
+ $figures = frameGmp::_()->getModule('shape')->getModel()->getAllShapes();
99
+ if(empty($figures)) {
100
+ _e('You have no figures for now.', GMP_LANG_CODE);
101
+ exit();
102
+ }
103
+ $this->_connectCsvLib();
104
+ $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array($fileName));
105
+ if(!empty($data['delimiter'])) {
106
+ $csvGenerator->setDelimiter($delimiter);
107
+ }
108
+ $c = $r = 0;
109
+ $keys = array('id', 'title', 'description', 'type', 'map_id', 'create_date', 'animation', 'sort_order');
110
+ $figures_keys = array();
111
+ foreach($figures as $m) {
112
+ $figures_keys = array_unique(array_merge($figures_keys, $this->_getKeys($m)));
113
+ }
114
+ sort($figures_keys);
115
+ $keys = array_unique(array_merge($keys, $figures_keys));
116
+ foreach($keys as $k) {
117
+ $csvGenerator->addCell($r, $c, $k);
118
+ $c++;
119
+ }
120
+ $c = 0;
121
+ $r = 1;
122
+ foreach($figures as $figure) {
123
+ $c = 0;
124
+ foreach($keys as $k) {
125
+ $figureValue = $this->_prepareValueToExport( $this->_getKeyVal($figure, $k) );
126
+ $csvGenerator->addCell($r, $c, $figureValue);
127
+ $c++;
128
+ }
129
+ $r++;
130
+ }
131
+ $csvGenerator->generate();
132
+ frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('csv.export.figures');
133
+ exit();
134
+ }
135
+ public function exportHeatmap() {
136
+ $data = reqGmp::get('get');
137
+ $delimiter = !empty($data['delimiter']) ? $data['delimiter'] : ';';
138
+ $fileSiteDate = str_replace(array('/', '.', ':'), '_', esc_html(get_bloginfo('name')). ' - '. date(GMP_DATE_FORMAT_HIS));
139
+ $fileName = sprintf(__('Heatmap from %s', GMP_LANG_CODE), $fileSiteDate);
140
+ $heatmaps = frameGmp::_()->getModule('heatmap')->getModel()->getAllHeatmap();
141
+ if(empty($heatmaps)) {
142
+ _e('You have no heatmap for now.', GMP_LANG_CODE);
143
+ exit();
144
+ }
145
+ $this->_connectCsvLib();
146
+ $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array($fileName));
147
+ if(!empty($data['delimiter'])) {
148
+ $csvGenerator->setDelimiter($delimiter);
149
+ }
150
+ $c = $r = 0;
151
+ $keys = array('id', 'map_id');
152
+ $heatmap_keys = array();
153
+ foreach($heatmaps as $m) {
154
+ $heatmap_keys = array_unique(array_merge($heatmap_keys, $this->_getKeys($m)));
155
+ }
156
+ sort($heatmap_keys);
157
+ $keys = array_unique(array_merge($keys, $heatmap_keys));
158
+ foreach($keys as $k) {
159
+ $csvGenerator->addCell($r, $c, $k);
160
+ $c++;
161
+ }
162
+ $c = 0;
163
+ $r = 1;
164
+
165
+ foreach($heatmaps as $heatmap) {
166
+ $c = 0;
167
+ foreach($keys as $k) {
168
+ $heatmapValue = $this->_prepareValueToExport( $this->_getKeyVal($heatmap, $k) );
169
+ $csvGenerator->addCell($r, $c, $heatmapValue);
170
+ $c++;
171
+ }
172
+ $r++;
173
+ }
174
+ $csvGenerator->generate();
175
+ frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('csv.export.heatmap');
176
+ exit();
177
+ }
178
+ public function import() {
179
+ $data = reqGmp::get('post');
180
+ @ini_set('auto_detect_line_endings', true);
181
+ $res = new responseGmp();
182
+ $this->_connectCsvLib();
183
+ $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array(''));
184
+ $type = reqGmp::getVar('type');
185
+
186
+ if(reqGmp::getVar('csv_import_file_maps', 'file')){
187
+ $file = reqGmp::getVar('csv_import_file_maps', 'file');
188
+ $type = 'maps';
189
+ }elseif (reqGmp::getVar('csv_import_file_markers', 'file')){
190
+ $file = reqGmp::getVar('csv_import_file_markers', 'file');
191
+ $type = 'markers';
192
+ }elseif (reqGmp::getVar('csv_import_file_figures', 'file')){
193
+ $file = reqGmp::getVar('csv_import_file_figures', 'file');
194
+ $type = 'figures';
195
+ }elseif (reqGmp::getVar('csv_import_file_heatmap', 'file')){
196
+ $file = reqGmp::getVar('csv_import_file_heatmap', 'file');
197
+ $type = 'heatmap';
198
+ }
199
+
200
+ if(empty($file) || empty($file['size']))
201
+ $res->pushError (__('Missing File', GMP_LANG_CODE));
202
+ if(!empty($file['error']))
203
+ $res->pushError (sprintf(__('File uploaded with error code %s', $file['error'])));
204
+ if(!$res->error()) {
205
+ $fileArray = array();
206
+ $handle = fopen($file['tmp_name'], 'r');
207
+ $csvParams['delimiter'] = !empty($data['delimiter']) ? $data['delimiter'] : $csvGenerator->getDelimiter();
208
+ $csvParams['enclosure'] = $csvGenerator->getEnclosure();
209
+ $csvParams['escape'] = $csvGenerator->getEscape();
210
+ //if(version_compare( phpversion(), '5.3.0' ) == -1) //for PHP lower than 5.3.0 third parameter - escape - is not implemented
211
+ while($row = @fgetcsv( $handle, 0, $csvParams['delimiter'], '"' )) $fileArray[] = $row;
212
+ /*else
213
+ while($row = @fgetcsv( $handle, 0, $csvParams['delimiter'], $csvParams['enclosure'], $csvParams['escape'] )) $fileArray[] = $row;*/
214
+ // /*var_dump($fileArray);
215
+ // exit();*/
216
+ // var_dump($fileArray);
217
+ // exit();
218
+ if(!empty($fileArray)) {
219
+ if(count($fileArray) > 1) {
220
+ //$overwriteSameNames = (int) reqGmp::getVar('overwrite_same_names');
221
+ $keys = array_shift($fileArray);
222
+ switch($type) {
223
+ case 'maps':
224
+ $mapModel = frameGmp::_()->getModule('gmap')->getModel();
225
+ foreach($fileArray as $i => $row) {
226
+ $map = array();
227
+ foreach($keys as $j => $key) {
228
+ $value = $this->_prepareValueToImport($row[ $j ]);
229
+ if(strpos($key, '.')) {
230
+ $realKeys = explode('.', $key);
231
+ $realKey = array_pop( $realKeys );
232
+ $realPreKey = array_pop( $realKeys );
233
+ if($realPreKey == 'map_center') {
234
+ $valueMapCenter = isset($map['map_center']) ? $map['map_center'] : array();
235
+ $valueMapCenter[ $realKey ] = $value;
236
+ $value = $valueMapCenter;
237
+ $realKey = 'map_center';
238
+ }
239
+ } else
240
+ $realKey = $key;
241
+ if($value === '')
242
+ $value = NULL;
243
+ $map[ $realKey ] = $value;
244
+ }
245
+ if(isset($map['id']) && $mapModel->existsId($map['id'])) {
246
+ $mapModel->updateMap($map);
247
+ } else {
248
+ $originalMapId = isset($map['id']) ? $map['id'] : 0;
249
+ if(isset($map['id']))
250
+ unset($map['id']);
251
+ $newMapId = $mapModel->saveNewMap($map);
252
+ if($newMapId && $originalMapId) {
253
+ dbGmp::query("UPDATE @__maps SET id = '$originalMapId' WHERE id = '$newMapId'");
254
+ if($originalMapId > $newMapId)
255
+ dbGmp::setAutoIncrement('@__maps', $originalMapId + 1);
256
+ }
257
+ }
258
+ }
259
+ break;
260
+ case 'markers':
261
+ $markerModel = frameGmp::_()->getModule('marker')->getModel();
262
+ foreach($fileArray as $i => $row) {
263
+ $marker = array();
264
+ foreach($keys as $j => $key) {
265
+ $this->_setKeyVal($marker, $key, $this->_prepareValueToImport($row[ $j ]));
266
+ }
267
+ if(isset($marker['id']) && !$markerModel->existsId($marker['id'])) {
268
+ unset($marker['id']);
269
+ }
270
+ $markerModel->save($marker);
271
+ }
272
+ break;
273
+ case 'figures':
274
+ $figuresModel = frameGmp::_()->getModule('shape')->getModel();
275
+ foreach($fileArray as $i => $row) {
276
+ $figures = array();
277
+ foreach($keys as $j => $key) {
278
+ if(!empty($row[ $j ])){
279
+ $this->_setKeyVal($figures, $key, $this->_prepareValueToImport($row[ $j ]));
280
+ }
281
+ }
282
+ if(isset($figures['id']) && !$figuresModel->existsId($figures['id'])) {
283
+ unset($figures['id']);
284
+ }
285
+ $figuresModel->save($figures);
286
+ }
287
+ break;
288
+ case 'heatmap':
289
+ $heatmapModel = frameGmp::_()->getModule('heatmap')->getModel();
290
+ foreach($fileArray as $i => $row) {
291
+ $heatmap = array();
292
+ foreach($keys as $j => $key) {
293
+ if(!empty($row[ $j ])){
294
+ $this->_setKeyVal($heatmap, $key, $this->_prepareValueToImport($row[ $j ]));
295
+ }
296
+ }
297
+ if(isset($heatmap['id']) && !$heatmapModel->existsId($heatmap['id'])) {
298
+ unset($heatmap['id']);
299
+ }
300
+ $heatmapModel->save($heatmap);
301
+ }
302
+ break;
303
+ }
304
+ /*$importRes = $this->getModel()->import($fileArray, $overwriteSameNames);
305
+ if($importRes) {
306
+ if($importRes['map']['added'])
307
+ $res->addMessage (sprintf(__('Added %s maps', GMP_LANG_CODE), $importRes['map']['added']));
308
+ if($importRes['map']['updated'])
309
+ $res->addMessage (sprintf(__('Updated %s maps', GMP_LANG_CODE), $importRes['map']['added']));
310
+ if($importRes['marker']['added'])
311
+ $res->addMessage (sprintf(__('Added %s markers', GMP_LANG_CODE), $importRes['map']['added']));
312
+ if($importRes['marker']['updated'])
313
+ $res->addMessage (sprintf(__('Updated %s markers', GMP_LANG_CODE), $importRes['map']['added']));
314
+ } else
315
+ $res->pushError ($this->getModel()->getErrors());*/
316
+ } else
317
+ $res->pushError (__('File should contain more then 1 row, at least 1 row should be for headers', GMP_LANG_CODE));
318
+ } else
319
+ $res->pushError (__('Empty data in file', GMP_LANG_CODE));
320
+ }
321
+ frameGmp::_()->getModule('supsystic_promo')->getModel()->saveUsageStat('csv.import');
322
+ $res->ajaxExec();
323
+ }
324
+ public function saveCsvOptions() {
325
+ $res = new responseGmp();
326
+ if(frameGmp::_()->getModule('options')->getModel()->saveGroup(reqGmp::get('post'))) {
327
+ $res->addMessage(__('Done', GMP_LANG_CODE));
328
+ } else
329
+ $res->pushError ($this->getModel('options')->getErrors());
330
+ return $res->ajaxExec();
331
+ }
332
+ private function _connectCsvLib() {
333
+ importClassGmp('filegeneratorGmp');
334
+ importClassGmp('csvgeneratorGmp');
335
+ }
336
+ private function _getSitePath() {
337
+ return $this->getModel()->getSitePath();
338
+ }
339
+ private function _getKeys($data, $prefix = array()) {
340
+ $keys = array();
341
+ foreach($data as $k => $v) {
342
+ if(is_array($v)) {
343
+ $newPrefix = $prefix;
344
+ $newPrefix[] = $k;
345
+ $keys = array_merge($keys, $this->_getKeys($v, $newPrefix));
346
+ } else {
347
+ $keys[] = empty($prefix) ? $k : implode('.', $prefix). '.'. $k;
348
+ }
349
+ }
350
+ return $keys;
351
+ }
352
+ private function _getKeyVal($data, $key) {
353
+ if(strpos($key, '.')) {
354
+ $keys = explode('.', $key);
355
+ $firstKey = array_shift($keys);
356
+ return isset($data[ $firstKey ]) ? $this->_getKeyVal($data[ $firstKey ], implode('.', $keys)) : '';
357
+ } else {
358
+ return isset($data[ $key ]) ? $data[ $key ] : '';
359
+ }
360
+ }
361
+ private function _setKeyVal(&$data, $key, $val) {
362
+ if(strpos($key, '.')) {
363
+ $keys = explode('.', $key);
364
+ $firstKey = array_shift($keys);
365
+ if(!isset($data[ $firstKey ]))
366
+ $data[ $firstKey ] = array();
367
+ $this->_setKeyVal($data[ $firstKey ], implode('.', $keys), $val);
368
+ } else {
369
+ $data[ $key ] = $val;
370
+ }
371
+ }
372
+ private function _prepareValueToExport($val) {
373
+ $sitePath = $this->_getSitePath();
374
+ return htmlspecialchars(str_replace($sitePath, '[GMP_SITE_PATH]', $val));
375
+ }
376
+ private function _prepareValueToImport($val) {
377
+ $sitePath = $this->_getSitePath();
378
+ return str_replace('[GMP_SITE_PATH]', $sitePath, htmlspecialchars_decode(addslashes($val)));
379
+ }
380
+ private function _toYesNo($val) {
381
+ return empty($val) ? 'No' : 'Yes';
382
+ }
383
+ private function _fromYesNo($val) {
384
+ return $val === 'No' ? 0 : 1;
385
+ }
386
+
387
+ /**
388
+ * @see controller::getPermissions();
389
+ */
390
+ public function getPermissions() {
391
+ return array(
392
+ GMP_USERLEVELS => array(
393
+ GMP_ADMIN => array('exportMaps', 'exportMaps', 'import', 'saveCsvOptions')
394
+ ),
395
+ );
396
+ }
397
+ }
modules/csv/js/admin.csv.js ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var gmpCsvImportData = {};
2
+ jQuery(document).ready(function(){
3
+ jQuery('#gmpCsvExportMapsBtn').click(function(){
4
+ var delimiter = jQuery('#gmpCsvExportDelimiter').val() || ';';
5
+ toeRedirect(createAjaxLinkGmp({
6
+ page: 'csv'
7
+ , action: 'exportMaps'
8
+ , withMarkers: 1
9
+ , delimiter: delimiter
10
+ , onSubmit: gmpCsvImportOnSubmit
11
+ , onComplete: gmpCsvImportOnComplete
12
+ }));
13
+ return false;
14
+ });
15
+ jQuery('#gmpCsvExportMarkersBtn').click(function(){
16
+ var delimiter = jQuery('#gmpCsvExportDelimiter').val() || ';';
17
+ toeRedirect(createAjaxLinkGmp({
18
+ page: 'csv'
19
+ , action: 'exportMarkers'
20
+ , delimiter: delimiter
21
+ , onSubmit: gmpCsvImportOnSubmit
22
+ , onComplete: gmpCsvImportOnComplete
23
+ }));
24
+ return false;
25
+ });
26
+ jQuery('#gmpCsvExportFiguresBtn').click(function(){
27
+ var delimiter = jQuery('#gmpCsvExportDelimiter').val() || ';';
28
+ toeRedirect(createAjaxLinkGmp({
29
+ page: 'csv'
30
+ , action: 'exportFigures'
31
+ , delimiter: delimiter
32
+ , onSubmit: gmpCsvImportOnSubmit
33
+ , onComplete: gmpCsvImportOnComplete
34
+ }));
35
+ return false;
36
+ });
37
+ jQuery('#gmpCsvExportHeatmapBtn').click(function(){
38
+ var delimiter = jQuery('#gmpCsvExportDelimiter').val() || ';';
39
+ toeRedirect(createAjaxLinkGmp({
40
+ page: 'csv'
41
+ , action: 'exportHeatmap'
42
+ , delimiter: delimiter
43
+ , onSubmit: gmpCsvImportOnSubmit
44
+ , onComplete: gmpCsvImportOnComplete
45
+ }));
46
+ return false;
47
+ });
48
+ jQuery('#gmpCsvSaveBtn').click(function () {
49
+ jQuery('#gmpCsvForm').submit();
50
+ return false;
51
+ });
52
+ jQuery('#gmpCsvForm').submit(function () {
53
+ jQuery(this).sendFormGmp({
54
+ btn: '#gmpCsvSaveBtn'
55
+ });
56
+ return false;
57
+ });
58
+
59
+ /*jQuery('#gmpCsvImportMarkersBtn').on('click', function () {
60
+ jQuery('input[name="csv_import_file"]').click();
61
+ });*/
62
+ });
63
+ function gmpCsvImportOnSubmit() {
64
+ var msg = jQuery('#gmpCsvImportMsg');
65
+
66
+ msg.showLoaderGmp();
67
+ msg.removeClass('toeErrorMsg');
68
+ msg.removeClass('toeSuccessMsg');
69
+
70
+ // Add CSV options to request data
71
+ gmpCsvImportData['delimiter'] = jQuery('#gmpCsvExportDelimiter').val() || ';';
72
+ //gmpCsvImportData['overwrite_same_names'] = jQuery('#gmpCsvOverwriteSameNames').attr('checked') ? 1 : 0;
73
+ }
74
+ function gmpCsvImportOnComplete(file, res) {
75
+ toeProcessAjaxResponseGmp(res, 'gmpCsvImportMsg');
76
+ }
modules/csv/mod.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class csvGmp extends moduleGmp {
3
+ private $_markerHeaders = array();
4
+ private $_mapHeaders = array();
5
+
6
+ public function init() {
7
+ dispatcherGmp::addFilter('mainAdminTabs', array($this, 'addAdminTab'));
8
+ }
9
+ public function addAdminTab($tabs) {
10
+ $tabs[ $this->getCode() ] = array(
11
+ 'label' => __('Maps Import / Export', GMP_LANG_CODE), 'callback' => array($this, 'getTabContent'), 'fa_icon' => 'fa-download', 'sort_order' => 50,
12
+ );
13
+ return $tabs;
14
+ }
15
+ public function getTabContent() {
16
+ frameGmp::_()->addScript('admin.csv', $this->getModPath(). 'js/admin.csv.js');
17
+ return $this->getView()->getTabContent();
18
+ }
19
+ /*public function addSettingsBlock($bloks) {
20
+ frameGmp::_()->addScript('admin.csv', $this->getModPath(). 'js/admin.csv.js');
21
+ $bloks['csvImportExport'] = $this->getView()->getSettitngsBlockHtml();
22
+ return $bloks;
23
+ }*/
24
+ public function getMarkerHeadersList() {
25
+ if(empty($this->_markerHeaders)) {
26
+ $this->_markerHeaders = array(
27
+ 'id' => 'ID',
28
+ 'title' => 'Title',
29
+ 'description' => 'Description',
30
+ 'map_id' => 'Map ID',
31
+ 'address' => 'Address',
32
+ 'coord_x' => 'Longitude',
33
+ 'coord_y' => 'Latitude',
34
+ 'animation' => 'Animation',
35
+
36
+ 'icon' => 'Icon ID',
37
+ 'icon_path' => 'Icon Path',
38
+ 'icon_title' => 'Icon Title',
39
+
40
+ 'marker_group_id' => 'Group ID',
41
+ 'marker_group_title' => 'Group Title',
42
+ 'marker_group_description' => 'Group Description',
43
+
44
+ 'more_info_link' => 'Add More info in description window',
45
+ 'icon_fit_standard_size' => 'Fit icon in standard size',
46
+ );
47
+ }
48
+ return $this->_markerHeaders;
49
+ }
50
+ public function getMapHeadersList() {
51
+ if(empty($this->_mapHeaders)) {
52
+ $this->_mapHeaders = array(
53
+ 'id' => 'ID',
54
+ 'title' => 'Title',
55
+ 'description' => 'Description',
56
+ // params
57
+ 'enable_zoom' => 'Enable Zoom',
58
+ 'enable_mouse_zoom' => 'Enable Mouse Zoom',
59
+ 'description_mouse_hover' => 'Infowindow on mouse over',
60
+ 'zoom' => 'Zoom',
61
+ 'type' => 'Type',
62
+ 'language' => 'Language',
63
+ 'map_display_mode' => 'Display mode',
64
+ 'map_center' => 'Map Center',
65
+ 'infowindow_height' => 'Infowindow Height',
66
+ 'infowindow_width' => 'Infowindow Width',
67
+ 'enable_marker_clasterer' => 'Enable markers clusterization',
68
+ 'markers_list_show_only_visible' => 'Show only visible markers in list',
69
+ 'disable_search_table' => 'Disable search in markers list',
70
+ 'disable_categories_selection' => 'Disable categories selection',
71
+ 'markers_desc_show_get_direction' => 'Get Directions link',
72
+ 'markers_desc_show_get_direction' => 'Get Directions link',
73
+ 'markers_desc_show_view_on_google_maps' => 'View on Google Maps link',
74
+ 'ad_publisher_id' => 'AD Publisher ID (PRO)',
75
+ 'ad_pos' => 'AD Position (PRO)',
76
+ 'markers_list_type' => 'Markers list type (PRO)',
77
+ 'custom_map_controls' => 'Custom map controls (PRO)',
78
+ 'stylization' => 'Stylization (PRO)',
79
+ 'enable_full_screen_btn' => 'Enable full screen button (PRO)',
80
+ 'enable_trafic_layer' => 'Enable trafic layer (PRO)',
81
+ 'enable_transit_layer' => 'Enable transit layer (PRO)',
82
+ 'enable_bicycling_layer' => 'Enable bicycling layer (PRO)',
83
+ // html options
84
+ 'width' => 'Width',
85
+ 'width_units' => 'Width units',
86
+ 'height' => 'Height',
87
+ 'align' => 'Align',
88
+ 'margin' => 'Margin',
89
+ 'border_color' => 'Border Color',
90
+ 'border_width' => 'Border Width',
91
+ );
92
+ }
93
+ return $this->_mapHeaders;
94
+ }
95
+ }
modules/csv/models/csv.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class csvModelGmp extends modelGmp {
3
+ private $_sitePath = '';
4
+ public function getSitePath() {
5
+ if(!$this->_sitePath) {
6
+ $this->_sitePath = get_bloginfo('wpurl');
7
+ }
8
+ return $this->_sitePath;
9
+ }
10
+ private function _detectMarkerGoupId($marker) {
11
+ if(!empty($marker['marker_group_id'])) {
12
+ $groupByTitle = frameGmp::_()->getModule('marker_groups')->getModel()->getGroupByTitle($marker['marker_group_title']);
13
+ if($groupByTitle) {
14
+ return $groupByTitle['id'];
15
+ } else {
16
+ return frameGmp::_()->getModule('marker_groups')->getModel()->saveGroup(array(
17
+ 'title' => $marker['marker_group_title'],
18
+ 'description' => $marker['marker_group_description'],
19
+ ));
20
+ }
21
+ }
22
+ return 0;
23
+ }
24
+ private function _beforeInsert($field) {
25
+ $field = trim(htmlspecialchars_decode($field));
26
+ // Remove double quotes from start and end of the value
27
+ if(strpos($field, '"') === 0) {
28
+ $field = substr($field, 1, strlen($field));
29
+ $field = substr($field, 0, strlen($field)-1);
30
+ }
31
+ $field = str_replace('[GMP_SITE_PATH]', $this->getSitePath(), $field);
32
+ return $field;
33
+ }
34
+ public function import($fileArray, $overwriteSameNames = 1) {
35
+ $inputFields = $this->_getFieldsListFromInput($fileArray);
36
+ if(!empty($inputFields)) {
37
+ if($importType = $this->_detectImportType($inputFields)) {
38
+ $counters = array('map' => array(), 'marker' => array());
39
+ $counters['map'] = $counters['marker'] = array('added' => 0, 'updated' => 0);
40
+ $lastMapId = 0;
41
+ //var_dump($inputFields);
42
+ for($i = 1; $i < count($fileArray); $i++) { // $i = 1 - we will ignore first (0) row - as it is titles
43
+ $addData = array();
44
+ $res = false;
45
+ for($j = 0; $j < count($fileArray[$i]); $j++) {
46
+ /*$addData[ $inputFields[$j] ] = trim(htmlspecialchars_decode($fileArray[$i][$j]));
47
+ // Remove double quotes from start and end of the value
48
+ if(strpos($addData[ $inputFields[$j] ], '"') === 0) {
49
+ $addData[ $inputFields[$j] ] = substr($addData[ $inputFields[$j] ], 1, strlen($addData[ $inputFields[$j] ]));
50
+ $addData[ $inputFields[$j] ] = substr($addData[ $inputFields[$j] ], 0, strlen($addData[ $inputFields[$j] ])-1);
51
+ }*/
52
+ $addData[ $inputFields[$j] ] = $this->_beforeInsert($fileArray[$i][$j]);
53
+ }
54
+ $currentImporType = $importType;
55
+ if($importType == 'map_marker') {
56
+ $countMap = $countMarker = 0;
57
+ foreach($addData as $fieldKey => $fieldData) {
58
+ if(strpos($fieldKey, 'for_marker_') === 0) {
59
+ $countMarker++;
60
+ } else {
61
+ $countMap++;
62
+ }
63
+ }
64
+ //var_dump($countMarker, $countMap, $addData);
65
+ $countMarker ? $currentImporType = 'marker' : $currentImporType = 'map';
66
+ //var_dump($currentImporType);
67
+ if($currentImporType == 'marker') {
68
+ $newAddData = array();
69
+ foreach($addData as $fieldKey => $fieldVal) {
70
+ $newAddData[ str_replace('for_marker_', '', $fieldKey) ] = $fieldVal;
71
+ }
72
+ $addData = $newAddData;
73
+ $addData['map_id'] = $lastMapId;
74
+ $addData['group_id'] = $this->_detectMarkerGoupId($addData);
75
+ }
76
+ }
77
+ /*var_dump($addData);
78
+ exit();*/
79
+ switch($currentImporType) {
80
+ case 'marker':
81
+ if(isset($addData['id'] ))
82
+ unset($addData['id']);
83
+ $updateId = 0;
84
+ if($overwriteSameNames) {
85
+ $marker = frameGmp::_()->getModule('marker')->getModel()->getMarkerByTitle($addData['title']);
86
+ if($marker && $marker['id']) {
87
+ $updateId = $marker['id'];
88
+ }
89
+ }
90
+ if($updateId) {
91
+ $addData['id'] = $updateId;
92
+ }
93
+ $res = frameGmp::_()->getModule('marker')->getModel()->save($addData);
94
+ if($res) {
95
+ $updateId ? $counters['marker']['updated']++ : $counters['marker']['added']++;
96
+ }
97
+ break;
98
+ case 'map':
99
+
100
+ // Fix empty map after import with invalid "map_center" value.
101
+ if (array_key_exists('map_center', $addData)) {
102
+ $center = explode(',', $addData['map_center']);
103
+
104
+ $addData['map_center'] = array(
105
+ 'coord_x' => trim($center[0]),
106
+ 'coord_y' => trim($center[1]),
107
+ );
108
+ }
109
+
110
+ $updateId = 0;
111
+ if($overwriteSameNames) {
112
+ $map = frameGmp::_()->getModule('gmap')->getModel()->getMapByTitle($addData['title']);
113
+ if($map && $map['id']) {
114
+ $updateId = $map['id'];
115
+ }
116
+ }
117
+ if($updateId) {
118
+ $addData['id'] = $updateId;
119
+ $lastMapId = $updateId;
120
+ $res = frameGmp::_()->getModule('gmap')->getModel()->updateMap($addData);
121
+ } else {
122
+ $res = frameGmp::_()->getModule('gmap')->getModel()->saveNewMap($addData);
123
+ $lastMapId = $res;
124
+ }
125
+ if($res) {
126
+ $updateId ? $counters['map']['updated']++ : $counters['map']['added']++;
127
+ }
128
+ break;
129
+ }
130
+ }
131
+ return $counters;
132
+ } else
133
+ $this->pushError (__('Can not detect import list type', GMP_LANG_CODE));
134
+ } else
135
+ $this->pushError (__('Can not find fields names', GMP_LANG_CODE));
136
+ return false;
137
+ }
138
+ public function importMaps($fileArray, $inputFields) {
139
+
140
+ }
141
+ public function importMarkers($fileArray) {
142
+
143
+ }
144
+ private function _getFieldsListFromInput($fileArray) {
145
+ $fields = array();
146
+ foreach($fileArray[0] as $headLabel) {
147
+ $field = $this->_getFieldNameFromStr($headLabel);
148
+ if($field)
149
+ $fields[] = $field;
150
+ }
151
+ return $fields;
152
+ }
153
+ private function _getFieldNameFromStr($str) {
154
+ $str = trim($str);
155
+ preg_match('/\[(?<key>.+)\]/i', $str, $matches);
156
+ if($matches && isset($matches['key']) && !empty($matches['key'])) {
157
+ $key = trim($matches['key']);
158
+ if(strpos($str, 'Marker - ') === 0)
159
+ $key = 'for_marker_'. $key;
160
+ return $key;
161
+ }
162
+ return false;
163
+ }
164
+ private function _detectImportType($inputFields) {
165
+ $markerInputFields = $this->getModule()->getMarkerHeadersList();
166
+ $mapInputFields = $this->getModule()->getMapHeadersList();
167
+
168
+ $intersectWithMarkers = array_intersect($inputFields, array_keys($markerInputFields));
169
+ $intersectWithMaps = array_intersect($inputFields, array_keys($mapInputFields));
170
+ foreach($inputFields as $key) {
171
+ if(strpos($key, 'for_marker') === 0)
172
+ return 'map_marker';
173
+ }
174
+ if(count($intersectWithMarkers) == 17 && count($intersectWithMaps) == 21)
175
+ return 'map_marker';
176
+ if(count($intersectWithMarkers) > count($intersectWithMaps)) {
177
+ return 'marker';
178
+ } elseif(count($intersectWithMarkers) < count($intersectWithMaps)) {
179
+ return 'map';
180
+ }
181
+ return false;
182
+ }
183
+ }
modules/csv/views/csv.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class csvViewGmp extends viewGmp {
3
+ public function getTabContent() {
4
+ $options = frameGmp::_()->getModule('options')->getModel()->getAll();
5
+ $csv_options = !empty($options['csv_options']) && !empty($options['csv_options']['value']) ? $options['csv_options']['value'] : array();
6
+ $this->assign('delimiters', array(';' => ';', ',' => ','));
7
+ $this->assign('options', $csv_options);
8
+ return parent::getContent('csvTabContent');
9
+ }
10
+ }
modules/csv/views/tpl/csvTabContent.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <section>
2
+ <div class="supsystic-item supsystic-panel">
3
+ <div id="containerWrapper">
4
+ <table class="form-table">
5
+ <tr>
6
+ <th scope="row">
7
+ <label>
8
+ <?php _e('Maps', GMP_LANG_CODE); ?>
9
+ </label>
10
+ </th>
11
+ <td>
12
+ <button id="gmpCsvExportMapsBtn" class="button">
13
+ <?php _e('Export', GMP_LANG_CODE); ?>
14
+ </button>
15
+ <?php echo htmlGmp::ajaxfile('csv_import_file_maps', array(
16
+ 'url' => uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'csv', 'action' => 'import', 'type' => 'maps', 'reqType' => 'ajax')),
17
+ 'data' => 'gmpCsvImportData',
18
+ 'buttonName' => __('Import', GMP_LANG_CODE),
19
+ 'responseType' => 'json',
20
+ 'onSubmit' => 'gmpCsvImportOnSubmit',
21
+ 'onComplete' => 'gmpCsvImportOnComplete',
22
+ 'btn_class' => 'button',
23
+ ))?>
24
+ </td>
25
+ </tr>
26
+ <tr>
27
+ <th scope="row">
28
+ <label for="gmpCsvExportMarkersBtn">
29
+ <?php _e('Markers', GMP_LANG_CODE); ?>
30
+ </label>
31
+ </th>
32
+ <td>
33
+ <button id="gmpCsvExportMarkersBtn" class="button">
34
+ <?php _e('Export', GMP_LANG_CODE); ?>
35
+ </button>
36
+ <?php echo htmlGmp::ajaxfile('csv_import_file_markers', array(
37
+ 'url' => uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'csv', 'action' => 'import', 'type' => 'markers', 'reqType' => 'ajax')),
38
+ 'data' => 'gmpCsvImportData',
39
+ 'buttonName' => __('Import', GMP_LANG_CODE),
40
+ 'responseType' => 'json',
41
+ 'onSubmit' => 'gmpCsvImportOnSubmit',
42
+ 'onComplete' => 'gmpCsvImportOnComplete',
43
+ 'btn_class' => 'button',
44
+ ))?>
45
+ </td>
46
+ </tr>
47
+ <tr>
48
+ <th scope="row">
49
+ <label for="gmpCsvExportFiguresBtn">
50
+ <?php _e('Figures', GMP_LANG_CODE); ?>
51
+ </label>
52
+ </th>
53
+ <td>
54
+ <button id="gmpCsvExportFiguresBtn" class="button">
55
+ <?php _e('Export', GMP_LANG_CODE); ?>
56
+ </button>
57
+ <?php echo htmlGmp::ajaxfile('csv_import_file_figures', array(
58
+ 'url' => uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'csv', 'action' => 'import', 'type' => 'figures', 'reqType' => 'ajax')),
59
+ 'data' => 'gmpCsvImportData',
60
+ 'buttonName' => __('Import', GMP_LANG_CODE),
61
+ 'responseType' => 'json',
62
+ 'onSubmit' => 'gmpCsvImportOnSubmit',
63
+ 'onComplete' => 'gmpCsvImportOnComplete',
64
+ 'btn_class' => 'button',
65
+ ))?>
66
+ </td>
67
+ </tr>
68
+ <tr>
69
+ <th scope="row">
70
+ <label for="gmpCsvExportHeatMapBtn">
71
+ <?php _e('HeatMap Layer', GMP_LANG_CODE); ?>
72
+ </label>
73
+ </th>
74
+ <td>
75
+ <button id="gmpCsvExportHeatmapBtn" class="button">
76
+ <?php _e('Export', GMP_LANG_CODE); ?>
77
+ </button>
78
+ <?php echo htmlGmp::ajaxfile('csv_import_file_heatmap', array(
79
+ 'url' => uriGmp::_(array('baseUrl' => admin_url('admin-ajax.php'), 'page' => 'csv', 'action' => 'import', 'type' => 'heatmap', 'reqType' => 'ajax')),
80
+ 'data' => 'gmpCsvImportData',
81
+ 'buttonName' => __('Import', GMP_LANG_CODE),
82
+ 'responseType' => 'json',
83
+ 'onSubmit' => 'gmpCsvImportOnSubmit',
84
+ 'onComplete' => 'gmpCsvImportOnComplete',
85
+ 'btn_class' => 'button',
86
+ ))?>
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <td colspan="2"><div id="gmpCsvImportMsg"></div></td>
91
+ </tr>
92
+ </table>
93
+ <h3><?php _e('CSV Options', GMP_LANG_CODE)?></h3>
94
+ <form id="gmpCsvForm">
95
+ <table class="form-table no-border">
96
+ <tr>
97
+ <th scope="row">
98
+ <label for="gmpCsvExportDelimiter">
99
+ <?php _e('Delimiter', GMP_LANG_CODE); ?>
100
+ </label>
101
+ </th>
102
+ <td>
103
+ <?php echo htmlGmp::selectbox('opt_values[csv_options][delimiter]', array(
104
+ 'options' => $this->delimiters,
105
+ 'value' => !empty($this->options['delimiter']) ? $this->options['delimiter'] : ';',
106
+ 'attrs' => 'style="min-width: 150px;" id="gmpCsvExportDelimiter"'))?>
107
+ </td>
108
+ </tr>
109
+ </table>
110
+ <?php echo htmlGmp::hidden('page', array('value' => 'csv'))?>
111
+ <?php echo htmlGmp::hidden('action', array('value' => 'saveCsvOptions'))?>
112
+ </form>
113
+ <button id="gmpCsvSaveBtn" class="button">
114
+ <i class="fa fa-save"></i>
115
+ <?php _e('Save', GMP_LANG_CODE)?>
116
+ </button>
117
+ </div>
118
+ </div>
119
+ </section>
modules/gmap/js/admin.gmap.edit.js CHANGED
@@ -178,7 +178,9 @@ jQuery(document).ready(function(){
178
  jQuery('#gmpMapForm input[name="map_opts[id]"]').val( res.data.map_id );
179
 
180
  // Update Markers table link
181
- gmpMarkersTblDataUrl = gmpMarkersTblDataUrl[0];
 
 
182
  var mrParams = URLToArray(gmpMarkersTblDataUrl)
183
  , newMarkersTblUrl = gmpMarkersTblDataUrl.substring(0, gmpMarkersTblDataUrl.indexOf('?') + 1);
184
 
@@ -190,7 +192,11 @@ shrinkToFit: false, });
190
 
191
  // Update Shapes table link
192
  if(GMP_DATA.isPro) {
193
- gmpMarkersTblDataUrl = gmpMarkersTblDataUrl[0];
 
 
 
 
194
  var shParams = URLToArray(gmpShapesTblDataUrl)
195
  , newShapesTblUrl = gmpShapesTblDataUrl.substring(0, gmpShapesTblDataUrl.indexOf('?') + 1);
196
 
178
  jQuery('#gmpMapForm input[name="map_opts[id]"]').val( res.data.map_id );
179
 
180
  // Update Markers table link
181
+ if(typeof gmpMarkersTblDataUrl != 'string') {
182
+ gmpMarkersTblDataUrl = gmpMarkersTblDataUrl[0];
183
+ }
184
  var mrParams = URLToArray(gmpMarkersTblDataUrl)
185
  , newMarkersTblUrl = gmpMarkersTblDataUrl.substring(0, gmpMarkersTblDataUrl.indexOf('?') + 1);
186
 
192
 
193
  // Update Shapes table link
194
  if(GMP_DATA.isPro) {
195
+
196
+ if(typeof gmpShapesTblDataUrl != 'string') {
197
+ gmpShapesTblDataUrl = gmpShapesTblDataUrl[0];
198
+ }
199
+
200
  var shParams = URLToArray(gmpShapesTblDataUrl)
201
  , newShapesTblUrl = gmpShapesTblDataUrl.substring(0, gmpShapesTblDataUrl.indexOf('?') + 1);
202
 
modules/gmap/views/tpl/gmapEditMap.php CHANGED
@@ -844,17 +844,27 @@
844
  <label for="map_opts_custom_controls_bg_color">
845
  <?php _e('Background color', GMP_LANG_CODE)?>
846
  </label></br>
 
847
  <?php echo htmlGmp::wpKsesHtml(htmlGmp::colorpicker('map_opts[custom_controls_bg_color]', array(
848
  'attrs' => 'class="gmpProOpt"',
849
  'value' => $this->editMap && isset($this->map['params']['custom_controls_bg_color']) ? esc_attr($this->map['params']['custom_controls_bg_color']) : '#55BA68')))?>
 
 
 
 
850
  </div>
851
  <div style="margin-top: 10px;">
852
  <label for="map_opts_custom_controls_txt_color">
853
  <?php _e('Text color', GMP_LANG_CODE)?>
854
  </label></br>
855
- <?php echo htmlGmp::wpKsesHtml(htmlGmp::colorpicker('map_opts[custom_controls_txt_color]', array(
856
- 'attrs' => 'class="gmpProOpt"',
857
- 'value' => $this->editMap && isset($this->map['params']['custom_controls_txt_color']) ? esc_attr($this->map['params']['custom_controls_txt_color']) : '#000000')))?>
 
 
 
 
 
858
  </div>
859
  <div style="margin-top: 10px;">
860
  <?php echo htmlGmp::wpKsesHtml(htmlGmp::checkboxHiddenVal('map_opts[custom_filter_show_all]', array(
844
  <label for="map_opts_custom_controls_bg_color">
845
  <?php _e('Background color', GMP_LANG_CODE)?>
846
  </label></br>
847
+ <?php if(!$this->isPro){?>
848
  <?php echo htmlGmp::wpKsesHtml(htmlGmp::colorpicker('map_opts[custom_controls_bg_color]', array(
849
  'attrs' => 'class="gmpProOpt"',
850
  'value' => $this->editMap && isset($this->map['params']['custom_controls_bg_color']) ? esc_attr($this->map['params']['custom_controls_bg_color']) : '#55BA68')))?>
851
+ <?php } else {?>
852
+ <?php echo htmlGmp::wpKsesHtml(htmlGmp::colorpicker('map_opts[custom_controls_bg_color]', array(
853
+ 'value' => $this->editMap && isset($this->map['params']['custom_controls_bg_color']) ? esc_attr($this->map['params']['custom_controls_bg_color']) : '#55BA68')))?>
854
+ <?php }?>
855
  </div>
856
  <div style="margin-top: 10px;">
857
  <label for="map_opts_custom_controls_txt_color">
858
  <?php _e('Text color', GMP_LANG_CODE)?>
859
  </label></br>
860
+ <?php if(!$this->isPro){?>
861
+ <?php echo htmlGmp::wpKsesHtml(htmlGmp::colorpicker('map_opts[custom_controls_txt_color]', array(
862
+ 'attrs' => 'class="gmpProOpt"',
863
+ 'value' => $this->editMap && isset($this->map['params']['custom_controls_txt_color']) ? esc_attr($this->map['params']['custom_controls_txt_color']) : '#000000')))?>
864
+ <?php } else {?>
865
+ <?php echo htmlGmp::wpKsesHtml(htmlGmp::colorpicker('map_opts[custom_controls_txt_color]', array(
866
+ 'value' => $this->editMap && isset($this->map['params']['custom_controls_txt_color']) ? esc_attr($this->map['params']['custom_controls_txt_color']) : '#000000')))?>
867
+ <?php }?>
868
  </div>
869
  <div style="margin-top: 10px;">
870
  <?php echo htmlGmp::wpKsesHtml(htmlGmp::checkboxHiddenVal('map_opts[custom_filter_show_all]', array(
modules/marker/models/marker.php CHANGED
@@ -109,7 +109,7 @@ class markerModelGmp extends modelGmp {
109
  );
110
  $wpdb->delete($tableName, $data_where);
111
 
112
- if (!empty($markerGroupIds)) {
113
  foreach ($markerGroupIds as $markerId) {
114
  global $wpdb;
115
  $tableName = $wpdb->prefix . "gmp_marker_groups_relation";
@@ -122,6 +122,16 @@ class markerModelGmp extends modelGmp {
122
  }
123
 
124
  }
 
 
 
 
 
 
 
 
 
 
125
  }
126
  dispatcherGmp::doAction('afterMarkerUpdate', $id, $marker);
127
  }
109
  );
110
  $wpdb->delete($tableName, $data_where);
111
 
112
+ if (!empty($markerGroupIds) && is_array($markerGroupIds)) {
113
  foreach ($markerGroupIds as $markerId) {
114
  global $wpdb;
115
  $tableName = $wpdb->prefix . "gmp_marker_groups_relation";
122
  }
123
 
124
  }
125
+ } else {
126
+ global $wpdb;
127
+ $tableName = $wpdb->prefix . "gmp_marker_groups_relation";
128
+ $dbRes = $wpdb->insert($tableName, array(
129
+ 'marker_id' => $marker['id'],
130
+ 'groups_id' => $markerGroupIds,
131
+ ));
132
+ if ($dbRes) {
133
+ $dbResId = $wpdb->insert_id;;
134
+ }
135
  }
136
  dispatcherGmp::doAction('afterMarkerUpdate', $id, $marker);
137
  }
modules/marker_groups/models/marker_groups.php CHANGED
@@ -24,6 +24,7 @@ class marker_groupsModelGmp extends modelGmp {
24
  global $wpdb;
25
  $ids = implode(',', array_map('absint', $ids));
26
  $groups = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}gmp_marker_groups WHERE id IN (%1s) ORDER BY sort_order", $ids), ARRAY_A);
 
27
  //$groups = frameGmp::_()->getTable('marker_groups')->orderBy('sort_order')->get('*', array('additionalCondition' => 'id IN (' . implode(',', $ids) . ')'));
28
  $groups = $this->_afterGet($groups);
29
  if(!empty($groups)) {
@@ -218,7 +219,6 @@ class marker_groupsModelGmp extends modelGmp {
218
  }
219
  }
220
  $markerGroups = $this->getMarkerGroupsByIds($groupsForCurMap);
221
-
222
  if(!empty($markerGroups)) {
223
  $markerGroups = $this->updateMarkerGroupsListByParents($markerGroups, $groupsForCurMap);
224
  $markerGroupsTree = $this->getMarkerGroupsTree($markerGroups);
24
  global $wpdb;
25
  $ids = implode(',', array_map('absint', $ids));
26
  $groups = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}gmp_marker_groups WHERE id IN (%1s) ORDER BY sort_order", $ids), ARRAY_A);
27
+
28
  //$groups = frameGmp::_()->getTable('marker_groups')->orderBy('sort_order')->get('*', array('additionalCondition' => 'id IN (' . implode(',', $ids) . ')'));
29
  $groups = $this->_afterGet($groups);
30
  if(!empty($groups)) {
219
  }
220
  }
221
  $markerGroups = $this->getMarkerGroupsByIds($groupsForCurMap);
 
222
  if(!empty($markerGroups)) {
223
  $markerGroups = $this->updateMarkerGroupsListByParents($markerGroups, $groupsForCurMap);
224
  $markerGroupsTree = $this->getMarkerGroupsTree($markerGroups);
modules/marker_groups/views/marker_groups.php CHANGED
@@ -41,4 +41,4 @@ class marker_groupsViewGmp extends viewGmp {
41
  public function _getPageLink($name) {
42
  return frameGmp::_()->getModule('options')->getTabUrl($name);
43
  }
44
- }
41
  public function _getPageLink($name) {
42
  return frameGmp::_()->getModule('options')->getTabUrl($name);
43
  }
44
+ }
modules/templates/mod.php CHANGED
@@ -44,6 +44,11 @@ class templatesGmp extends moduleGmp {
44
  public function loadCoreJs() {
45
  static $loaded = false;
46
 
 
 
 
 
 
47
  if(!$loaded) {
48
  frameGmp::_()->addScript('jquery');
49
  frameGmp::_()->addScript('commonGmp', GMP_JS_PATH. 'common.js', array('jquery'));
44
  public function loadCoreJs() {
45
  static $loaded = false;
46
 
47
+ add_filter( 'safe_style_css', function( $styles ) {
48
+ $styles[] = 'display';
49
+ return $styles;
50
+ } );
51
+
52
  if(!$loaded) {
53
  frameGmp::_()->addScript('jquery');
54
  frameGmp::_()->addScript('commonGmp', GMP_JS_PATH. 'common.js', array('jquery'));
readme.txt CHANGED
@@ -4,8 +4,8 @@ Author URI: https://supsystic.com/
4
  Plugin URI: https://supsystic.com/plugins/google-maps-plugin
5
  Donate link: https://supsystic.com/plugins/google-maps-plugin
6
  Tags: google map, map, Google Maps, map markers, location
7
- Tested up to: 5.8
8
- Stable tag: 1.11.3
9
 
10
  Google Maps with markers, locations and clusterization, KML layers and filters. Custom Google map markers with text, images, videos, links.
11
 
@@ -289,6 +289,11 @@ Easy Google Maps Plugin admin area. Add a marker to the google map.
289
 
290
 
291
  == Changelog ==
 
 
 
 
 
292
  = Easy Google Map Plugin v1.11.3 / 13.12.2021 =
293
  * Minor fixes
294
 
4
  Plugin URI: https://supsystic.com/plugins/google-maps-plugin
5
  Donate link: https://supsystic.com/plugins/google-maps-plugin
6
  Tags: google map, map, Google Maps, map markers, location
7
+ Tested up to: 5.9
8
+ Stable tag: 1.11.4
9
 
10
  Google Maps with markers, locations and clusterization, KML layers and filters. Custom Google map markers with text, images, videos, links.
11
 
289
 
290
 
291
  == Changelog ==
292
+
293
+ = Easy Google Map Plugin v1.11.4 / 28.01.2021 =
294
+ * Add fix for google maps
295
+ * Fixes for export/import
296
+
297
  = Easy Google Map Plugin v1.11.3 / 13.12.2021 =
298
  * Minor fixes
299