Google Maps Plugin by Intergeo - Version 1.1.5

Version Description

  • Fixed compatibility with old version of PHP ( < 5.2 )
  • Fixed issue with marker text using rich editor
  • Fixed issue with https websites which were loading content over http
Download this release

Release Info

Developer codeinwp
Plugin Icon 128x128 Google Maps Plugin by Intergeo
Version 1.1.5
Comparing to
See all releases

Code changes from version 1.1.0 to 1.1.5

CHANGELOG.md CHANGED
@@ -1,20 +1 @@
1
 
2
-
3
- ### 1.0.4.1 - 05/04/2016
4
-
5
- Changes:
6
-
7
-
8
- * added freemius
9
-
10
-
11
- ### 1.0.4 - 05/04/2016
12
-
13
- Changes:
14
-
15
-
16
- * fix readme
17
- * added freemius support
18
- added pro support
19
- * added freemius support
20
- added pro support
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/frontend.css CHANGED
@@ -1 +1,5 @@
 
 
 
 
1
  .intergeo_map_canvas img{max-width:none!important;-webkit-box-shadow:none!important;box-shadow:none!important;border-radius:0!important;border:none!important}
1
+ /*
2
+ * Version: 1.1.5
3
+ */
4
+
5
  .intergeo_map_canvas img{max-width:none!important;-webkit-box-shadow:none!important;box-shadow:none!important;border-radius:0!important;border:none!important}
index.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Plugin Name: Intergeo Lite- Google Maps Plugin
4
  Plugin URI: http://themeisle.com/plugins/intergeo-maps-lite/
5
  Description: A simple, easy and quite powerful Google Map tool to create, manage and embed custom Google Maps into your WordPress posts and pages. The plugin allows you to deeply customize look and feel of a map, add overlays like markers, rectangles, circles, polylines and polygons to your map. It could even be integraded with your Google Adsense account and show ad on your maps.
6
- Version: 1.1.0
7
  Author: Themeisle
8
  Author URI: http://themeisle.com
9
  License: GPL v2.0 or later
@@ -11,49 +11,41 @@ License URI: http://www.opensource.org/licenses/gpl-license.php
11
  Text Domain: intergeo
12
  Domain Path: /languages
13
  */
14
-
15
  // <editor-fold defaultstate="collapsed" desc="constants">
16
-
17
  define( 'INTERGEO_PLUGIN_NAME', 'intergeo' ); // don't change it whatever
18
- define( 'INTERGEO_VERSION', '1.1.0' );
19
- define( 'INTERGEO_ABSPATH', dirname( __FILE__ ) );
20
- define( 'INTERGEO_ABSURL', plugins_url( '/', __FILE__ ) );
21
- define( 'INTERGEO_PRO_URL', "http://themeisle.com/plugins/intergeo-maps-pro/" );
22
  // Added by Ash/Upwork
23
- defined('WPLANG') || define( 'WPLANG', '' );
24
  // Added by Ash/Upwork
25
-
26
  // Added by Ash/Upwork
27
- if ( class_exists( 'IntergeoMaps_Pro', false ) ){
28
- define( 'IntergeoMaps_Pro', true);
29
  }
30
  // Added by Ash/Upwork
31
-
32
  // </editor-fold>
33
-
34
  // <editor-fold defaultstate="collapsed" desc="plugin init">
35
-
36
  function im_fs() {
37
  global $im_fs;
38
-
39
  if ( ! isset( $im_fs ) ) {
40
  // Include Freemius SDK.
41
- require_once dirname(__FILE__) . '/freemius/start.php';
42
-
43
  $im_fs = fs_dynamic_init( array(
44
- 'id' => '239',
45
- 'slug' => 'intergeo-maps',
46
- 'public_key' => 'pk_35c86b731f06c8d4ba25b490af632',
47
- 'is_premium' => false,
48
- 'has_addons' => false,
49
- 'has_paid_plans' => false,
50
- 'anonymous_mode' => true,
51
- 'menu' => array(
52
- 'slug' => 'intergeo',
53
- 'account' => false,
54
- 'support' => false,
55
- 'contact' => false,
56
- 'parent' => array(
57
  'slug' => 'upload.php',
58
  ),
59
  ),
@@ -62,9 +54,9 @@ function im_fs() {
62
 
63
  return $im_fs;
64
  }
 
65
  // Init Freemius.
66
  im_fs();
67
-
68
  add_filter( 'plugin_action_links', 'intergeo_action_links', 10, 2 );
69
  function intergeo_action_links( $links, $file ) {
70
  if ( $file == plugin_basename( __FILE__ ) ) {
@@ -74,6 +66,7 @@ function intergeo_action_links( $links, $file ) {
74
  sprintf( '<a href="%s">%s</a>', admin_url( 'options-media.php' ), __( "Settings", INTERGEO_PLUGIN_NAME ) )
75
  );
76
  }
 
77
  return $links;
78
  }
79
 
@@ -88,63 +81,58 @@ function intergeo_frontend_enqueue_scripts() {
88
  wp_register_style( 'intergeo-frontend', INTERGEO_ABSURL . 'css/frontend.css', array(), INTERGEO_VERSION );
89
  }
90
 
91
- add_action("plugins_loaded", 'intergeo_i18n');
92
- function intergeo_i18n(){
93
- $pluginDirName = dirname(plugin_basename(__FILE__));
94
- $domain = INTERGEO_PLUGIN_NAME;
95
- $locale = apply_filters("plugin_locale", get_locale(), $domain);
96
- load_textdomain($domain, WP_LANG_DIR . "/" . $pluginDirName . "/" . $domain . "-" . $locale . ".mo");
97
- load_plugin_textdomain($domain, "", $pluginDirName . "/languages/");
98
  }
99
 
100
  // </editor-fold>
101
-
102
  // <editor-fold defaultstate="collapsed" desc="settings">
103
-
104
  function intergeo_settings_init() {
105
- if (isset($_POST["sb-intergeo"]) && wp_verify_nonce($_POST["intergeo-nonce"], "intergeo-settings")) {
106
- update_option( 'intergeo_map_api_key', sanitize_text_field($_POST['intergeo_map_api_key']) );
107
- update_option( 'intergeo_adsense_publisher_id', sanitize_text_field($_POST['intergeo_adsense_publisher_id']) );
108
- }
109
-
110
- echo "<form method='post' action=''>";
111
  register_setting( 'intergeo', 'intergeo-settings-map-api-key', 'trim' );
112
- add_settings_section( 'intergeo-settings-maps', __('Intergeo Google Maps', INTERGEO_PLUGIN_NAME), 'intergeo_settings_init_map', INTERGEO_PLUGIN_NAME );
113
- add_settings_field( 'intergeo_map_api_key', __('Maps API Key', INTERGEO_PLUGIN_NAME), 'intergeo_settings_print_field', INTERGEO_PLUGIN_NAME, 'intergeo-settings-maps', array(
114
  '<input type="text" name="%s" value="%s" class="regular-text">',
115
  'intergeo_map_api_key',
116
  esc_attr( get_option( 'intergeo_map_api_key' ) ),
117
  ) );
118
-
119
  register_setting( 'intergeo', 'intergeo_adsense_publisher_id', 'trim' );
120
- add_settings_section( 'intergeo-settings-adsense', __('Intergeo Google Maps AdSense Integration', INTERGEO_PLUGIN_NAME), 'intergeo_settings_init_adsense', INTERGEO_PLUGIN_NAME );
121
- add_settings_field( 'intergeo_adsense_publisher_id', __('AdSense Publisher Id', INTERGEO_PLUGIN_NAME), 'intergeo_settings_print_field', INTERGEO_PLUGIN_NAME, 'intergeo-settings-adsense', array(
122
  '<input type="text" name="%s" value="%s" class="regular-text">',
123
  'intergeo_adsense_publisher_id',
124
  esc_attr( get_option( 'intergeo_adsense_publisher_id' ) ),
125
  ) );
126
-
127
- do_settings_sections(INTERGEO_PLUGIN_NAME);
128
- submit_button(__("Save Changes", INTERGEO_PLUGIN_NAME), "primary", "sb-intergeo");
129
- wp_nonce_field("intergeo-settings", "intergeo-nonce");
130
-
131
- echo "</form>";
132
  }
133
 
134
  function intergeo_settings_init_map() {
135
  ?><p><?php
136
- printf( esc_html__(' Below shows how to find your API Key, after retrieving your key add it to the "Maps API Key" input box.', INTERGEO_PLUGIN_NAME ) );
137
  ?></p>
138
 
139
- <iframe width="560" height="315" src="https://www.youtube.com/embed/gbFDMBGPCcs" frameborder="0" allowfullscreen></iframe>
 
140
  <?php
141
  }
142
 
143
  function intergeo_settings_init_adsense() {
144
  ?><p><?php
145
- printf( esc_html__( "Adding display ads to your map requires that you have an AdSense account enabled for AdSense for Content. If you don't yet have an AdSense account, %1\$ssign up%3\$s for one. Once you have done so (or if you already have an account) make sure you've also enabled the account with %2\$sAdSense for Content%3\$s.", INTERGEO_PLUGIN_NAME ), '<a href="https://www.google.com/adsense/support/bin/answer.py?answer=10162" target="_blank">', '<a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=17470" target="_blank">', '</a>' )
146
  ?></p><p><?php
147
- esc_html_e( 'Once you have an Adsense for Content account, you will have received an AdSense for Content (AFC) publisher ID. This publisher ID is used to link any advertising shown to your AdSense account, allowing you to share in advertising revenue when a user clicks on one of the ads shown on your maps.', INTERGEO_PLUGIN_NAME )
148
  ?></p><?php
149
  }
150
 
@@ -153,56 +141,48 @@ function intergeo_settings_print_field( array $args ) {
153
  }
154
 
155
  // </editor-fold>
156
-
157
  // <editor-fold defaultstate="collapsed" desc="common">
158
-
159
  function intergeo_enqueue_google_maps_script( $libraries = false ) {
160
  global $wp_scripts;
161
-
162
  if ( is_array( $libraries ) ) {
163
  $libraries = implode( ',', $libraries );
164
  }
165
-
166
  if ( wp_script_is( 'google-maps-v3' ) ) {
167
-
168
  $params = array();
169
- parse_str( end( explode( '?', $wp_scripts->registered['google-maps-v3']->src ) ), $params );
170
- $params['libraries'] = implode( ',', array_unique( array_merge( isset( $params['libraries'] ) ? explode( ',', $params['libraries'] ) : array(), explode( ',', $libraries ) ) ) );
 
171
  $wp_scripts->registered['google-maps-v3']->src = '//maps.googleapis.com/maps/api/js?' . http_build_query( $params );
172
 
173
  } else {
174
-
175
- $lang = explode( '_', WPLANG ? WPLANG : 'en_US' );
176
  $params = array(
177
- 'region' => isset( $lang[1] ) ? $lang[1] : 'US',
178
- 'language' => $lang[0],
179
  );
180
-
181
- if ( !empty( $libraries ) ) {
182
  $params['libraries'] = $libraries;
183
  }
184
-
185
  $api_key = get_option( 'intergeo_map_api_key' );
186
- if ( !empty( $api_key ) ) {
187
  $params['key'] = $api_key;
188
  }
189
-
190
- if (wp_script_is("google-maps")) wp_dequeue_script("google-maps");
191
- wp_enqueue_script( 'google-maps-v3', '//maps.googleapis.com/maps/api/js?' . http_build_query( $params ), array(), null );
 
192
  }
193
  }
194
 
195
  function intergeo_check_libraries( $json, $libraries = array() ) {
196
- if ( isset( $json['layer']['adsense'] ) && $json['layer']['adsense'] && !in_array( 'adsense', $libraries ) ) {
197
  $libraries[] = 'adsense';
198
  }
199
-
200
- if ( isset( $json['layer']['panoramio'] ) && $json['layer']['panoramio'] && !in_array( 'panoramio', $libraries ) ) {
201
  $libraries[] = 'panoramio';
202
  }
203
-
204
  if ( ( isset( $json['layer']['weather'] ) && $json['layer']['weather'] ) || ( isset( $json['layer']['cloud'] ) && $json['layer']['cloud'] ) ) {
205
- if ( !in_array( 'weather', $libraries ) ) {
206
  $libraries[] = 'weather';
207
  }
208
  }
@@ -219,22 +199,19 @@ function intergeo_decode( $code ) {
219
  }
220
 
221
  // </editor-fold>
222
-
223
  // <editor-fold defaultstate="collapsed" desc="iframe">
224
-
225
  // <editor-fold defaultstate="collapsed" desc="rendering">
226
-
227
  add_filter( 'media_upload_tabs', 'intergeo_media_upload_tabs' );
228
  function intergeo_media_upload_tabs( $tabs ) {
229
  $tabs['intergeo_map'] = __( 'Intergeo Maps', INTERGEO_PLUGIN_NAME );
 
230
  return $tabs;
231
  }
232
 
233
  add_action( 'media_upload_intergeo_map', 'intergeo_map_popup_init' );
234
  function intergeo_map_popup_init() {
235
  $post_id = filter_input( INPUT_GET, 'post_id', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
236
- $map_id = filter_input( INPUT_GET, 'map' );
237
-
238
  $send_to_editor = false;
239
  if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
240
  $shortcode = intergeo_save_map( $map_id, $post_id );
@@ -249,11 +226,13 @@ function intergeo_map_popup_init() {
249
  exit;
250
  }
251
  }
252
-
253
  intergeo_enqueue_google_maps_script( 'adsense,panoramio,weather,drawing,places' );
254
- wp_enqueue_script('jquery-ddslick', INTERGEO_ABSURL . 'js/jquery.ddslick.min.js', array('jquery'));
255
-
256
- wp_enqueue_script( 'intergeo-editor', INTERGEO_ABSURL . 'js/editor.js', array( 'jquery-ddslick', 'wp-color-picker', 'google-maps-v3' ), INTERGEO_VERSION );
 
 
 
257
  wp_localize_script( 'intergeo-editor', 'intergeo_options', array(
258
  'send_to_editor' => $send_to_editor,
259
  'adsense' => array( 'publisher_id' => get_option( 'intergeo_adsense_publisher_id' ) ),
@@ -261,71 +240,70 @@ function intergeo_map_popup_init() {
261
  'nonce' => wp_create_nonce( 'editor_popup' . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ),
262
  'l10n' => array(
263
  'marker' => __( 'marker', INTERGEO_PLUGIN_NAME ),
264
- 'error' => array(
265
  'style' => __( 'Styles are broken. Please, fix it and try again.', INTERGEO_PLUGIN_NAME ),
266
  'directions' => __( 'Direction was not found.', INTERGEO_PLUGIN_NAME ),
267
  ),
268
  ),
269
  ) );
270
-
271
  wp_enqueue_style( 'wp-color-picker' );
272
  wp_enqueue_style( 'intergeo-editor', INTERGEO_ABSURL . 'css/editor.css', array(), INTERGEO_VERSION );
273
-
274
- // Added by Ash/Upwork
275
- if( defined( 'IntergeoMaps_Pro' ) ){
276
- global $IntergeoMaps_Pro;
277
- $IntergeoMaps_Pro->enqueueScriptsAndStyles(array('intergeo-editor'), array("mapID" => $map_id));
278
- }
279
- // Added by Ash/Upwork
280
-
281
  wp_iframe( 'intergeo_iframe', $post_id, $map_id );
282
  }
283
 
284
  function intergeo_iframe( $post_id = false, $map_id = false ) {
285
- $publisher_id = trim( get_option( 'intergeo_adsense_publisher_id' ) );
286
  $show_map_center = get_option( 'intergeo_show_map_center', true );
287
-
288
  $submit_text = __( 'Insert into post', INTERGEO_PLUGIN_NAME );
289
-
290
- if ( !$post_id ) {
291
  $submit_text = __( 'Create the map', INTERGEO_PLUGIN_NAME );
292
  }
293
-
294
  $copy = false;
295
- if ( !$map_id ) {
296
- $copy = true;
297
  $map_id = filter_input( INPUT_GET, 'copy' );
298
  }
299
-
300
  $json = array();
301
  if ( $map_id ) {
302
  $map = get_post( intergeo_decode( $map_id ) );
303
  if ( $map->post_type == INTERGEO_PLUGIN_NAME ) {
304
  $json = json_decode( $map->post_content, true );
305
- if ( !$copy ) {
306
  $submit_text = __( 'Update the map', INTERGEO_PLUGIN_NAME );
307
  }
308
  }
309
  }
310
-
311
  require INTERGEO_ABSPATH . '/templates/iframe/form.php';
312
  }
313
 
314
  // </editor-fold>
315
-
316
  // <editor-fold defaultstate="collapsed" desc="filtering">
317
-
318
  function intergeo_filter_value( $value, $array ) {
319
  $value = strtoupper( $value );
320
- return !in_array( $value, $array ) ? null : $value;
 
321
  }
322
 
323
  function intergeo_filter_position( $position ) {
324
  return intergeo_filter_value( $position, array(
325
- 'TOP_LEFT', 'TOP_CENTER', 'TOP_RIGHT',
326
- 'RIGHT_TOP', 'RIGHT_CENTER', 'RIGHT_BOTTOM',
327
- 'BOTTOM_RIGHT', 'BOTTOM_CENTER', 'BOTTOM_LEFT',
328
- 'LEFT_BOTTOM', 'LEFT_CENTER', 'LEFT_TOP'
 
 
 
 
 
 
 
 
329
  ) );
330
  }
331
 
@@ -374,13 +352,13 @@ function intergeo_filter_adsense_format( $format ) {
374
 
375
  function intergeo_filter_custom_style( $style ) {
376
  $style = trim( $style );
377
- $json = @json_decode( $style, true );
378
 
379
  return empty( $json ) ? null : $json;
380
  }
381
 
382
  function intergeo_filter_overlays_marker( $marker ) {
383
- if ( !isset( $marker['position'] ) || !preg_match( '/^-?\d+\.?\d*,-?\d+\.?\d*$/', $marker['position'] ) ) {
384
  return false;
385
  }
386
 
@@ -394,17 +372,15 @@ function intergeo_filter_overlays_marker( $marker ) {
394
  }
395
 
396
  function intergeo_filter_overlays_polyline( $polyline ) {
397
- if ( !isset( $polyline['path'] ) ) {
398
  return false;
399
  }
400
-
401
  $path = array();
402
- foreach( explode( ';', $polyline['path'] ) as $point ) {
403
  if ( preg_match( '/^-?\d+\.?\d*,-?\d+\.?\d*$/', $point ) ) {
404
  $path[] = explode( ',', $point );
405
  }
406
  }
407
-
408
  if ( count( $path ) < 2 ) {
409
  return false;
410
  }
@@ -412,54 +388,92 @@ function intergeo_filter_overlays_polyline( $polyline ) {
412
  return array(
413
  'path' => $path,
414
  'weight' => isset( $polyline['weight'] )
415
- ? filter_var( $polyline['weight'], FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1, 'default' => '' ) ) )
 
 
 
 
 
416
  : '',
417
  'opacity' => isset( $polyline['opacity'] )
418
- ? filter_var( $polyline['opacity'], FILTER_VALIDATE_FLOAT, array( 'options' => array( 'min_range' => 0, 'max_range' => 1, 'default' => '' ) ) )
 
 
 
 
 
 
419
  : '',
420
  'color' => isset( $polyline['color'] )
421
- ? filter_var( $polyline['color'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', 'default' => '#000000' ) ) )
 
 
 
 
 
422
  : '#000000',
423
  );
424
  }
425
 
426
  function intergeo_filter_overlays_polyoverlay( $polygon ) {
427
- if ( !isset( $polygon['path'] ) ) {
428
  return false;
429
  }
430
-
431
  $path = array();
432
- foreach( explode( ';', $polygon['path'] ) as $point ) {
433
  if ( preg_match( '/^-?\d+\.?\d*,-?\d+\.?\d*$/', $point ) ) {
434
  $path[] = explode( ',', $point );
435
  }
436
  }
437
-
438
  if ( count( $path ) < 2 ) {
439
  return false;
440
  }
441
-
442
  $position = isset( $polygon['position'] ) ? strtoupper( trim( $polygon['position'] ) ) : 'CENTER';
443
 
444
  return array(
445
  'path' => $path,
446
  'position' => in_array( $position, array( 'CENTER', 'INSIDE', 'OUTSIDE' ) ) ? $position : 'CENTER',
447
- 'weight' => isset( $polygon['weight'] ) ? filter_var( $polygon['weight'], FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1, 'default' => '' ) ) ) : '',
448
- 'stroke_opacity' => isset( $polygon['stroke_opacity'] ) ? filter_var( $polygon['stroke_opacity'], FILTER_VALIDATE_FLOAT, array( 'options' => array( 'min_range' => 0, 'max_range' => 1, 'default' => '' ) ) ) : '',
449
- 'stroke_color' => isset( $polygon['stroke_color'] ) ? filter_var( $polygon['stroke_color'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', 'default' => '#000000' ) ) ) : '#000000',
450
- 'fill_opacity' => isset( $polygon['fill_opacity'] ) ? filter_var( $polygon['fill_opacity'], FILTER_VALIDATE_FLOAT, array( 'options' => array( 'min_range' => 0, 'max_range' => 1, 'default' => '' ) ) ) : '',
451
- 'fill_color' => isset( $polygon['fill_color'] ) ? filter_var( $polygon['fill_color'], FILTER_VALIDATE_REGEXP, array( 'options' => array( 'regexp' => '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/', 'default' => '#000000' ) ) ) : '#000000',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452
  );
453
  }
454
 
455
  function intergeo_filter_directions( $direction ) {
456
- $to = isset( $direction['to'] ) ? trim( $direction['to'] ) : '';
457
  $from = isset( $direction['from'] ) ? trim( $direction['from'] ) : '';
458
-
459
  if ( empty( $to ) || empty( $from ) ) {
460
  return false;
461
  }
462
-
463
  $mode = isset( $direction['mode'] ) ? strtoupper( trim( $direction['mode'] ) ) : 'DRIVING';
464
 
465
  return array(
@@ -470,30 +484,62 @@ function intergeo_filter_directions( $direction ) {
470
  }
471
 
472
  function intergeo_filter_input() {
473
- $color_regexp = '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/';
474
  $postion_filter = array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_position' );
475
-
476
- $validationArray = array (
477
- 'lat' => array( 'filter' => FILTER_VALIDATE_FLOAT, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'min_range' => -90, 'max_range' => 90, 'default' => 48.1366069 ) ),
478
- 'lng' => array( 'filter' => FILTER_VALIDATE_FLOAT, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'min_range' => -180, 'max_range' => 180, 'default' => 11.577085099999977 ) ),
479
- 'zoom' => array( 'filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'min_range' => 0, 'max_range' => 19, 'default' => 5 ) ),
 
 
 
 
 
 
 
 
 
 
 
480
  'address' => FILTER_SANITIZE_STRING,
481
- 'map_mapTypeId' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_map_type' ),
 
 
 
482
  'map_draggable' => FILTER_VALIDATE_BOOLEAN,
483
- 'map_minZoom' => array( 'filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'min_range' => 0, 'max_range' => 19, 'default' => 0 ) ),
484
- 'map_maxZoom' => array( 'filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_SCALAR, 'options' => array( 'min_range' => 0, 'max_range' => 19, 'default' => 19 ) ),
 
 
 
 
 
 
 
 
485
  'map_scrollwheel' => FILTER_VALIDATE_BOOLEAN,
486
  'map_zoomControl' => FILTER_VALIDATE_BOOLEAN,
487
  'map_zoomControlOptions_position' => $postion_filter,
488
- 'map_zoomControlOptions_style' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_zoom_style' ),
 
 
 
489
  'map_panControl' => FILTER_VALIDATE_BOOLEAN,
490
  'map_panControlOptions_position' => $postion_filter,
491
  'map_scaleControl' => FILTER_VALIDATE_BOOLEAN,
492
  'map_scaleControlOptions_position' => $postion_filter,
493
  'map_mapTypeControl' => FILTER_VALIDATE_BOOLEAN,
494
  'map_mapTypeControlOptions_position' => $postion_filter,
495
- 'map_mapTypeControlOptions_style' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_map_type_style' ),
496
- 'map_mapTypeControlOptions_mapTypeIds' => array( 'filter' => FILTER_CALLBACK, 'flags' => FILTER_REQUIRE_ARRAY, 'options' => 'intergeo_filter_map_type' ),
 
 
 
 
 
 
 
497
  'map_streetViewControl' => FILTER_VALIDATE_BOOLEAN,
498
  'map_streetViewControlOptions_position' => $postion_filter,
499
  'map_rotateControl' => FILTER_VALIDATE_BOOLEAN,
@@ -504,24 +550,66 @@ function intergeo_filter_input() {
504
  'layer_bicycling' => FILTER_VALIDATE_BOOLEAN,
505
  'layer_cloud' => FILTER_VALIDATE_BOOLEAN,
506
  'layer_weather' => FILTER_VALIDATE_BOOLEAN,
507
- 'weather_temperatureUnits' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_temperature_units' ),
508
- 'weather_windSpeedUnits' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_wind_speed_units' ),
 
 
 
 
 
 
509
  'layer_panoramio' => FILTER_VALIDATE_BOOLEAN,
510
  'panoramio_tag' => FILTER_SANITIZE_STRING,
511
  'panoramio_userId' => FILTER_SANITIZE_STRING,
512
  'layer_adsense' => FILTER_VALIDATE_BOOLEAN,
513
- 'adsense_format' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_adsense_format' ),
 
 
 
514
  'adsense_position' => $postion_filter,
515
- 'adsense_backgroundColor' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array( 'regexp' => $color_regexp, 'default' => '#c4d4f3' ) ),
516
- 'adsense_borderColor' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array( 'regexp' => $color_regexp, 'default' => '#e5ecf9' ) ),
517
- 'adsense_titleColor' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array( 'regexp' => $color_regexp, 'default' => '#0000cc' ) ),
518
- 'adsense_textColor' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array( 'regexp' => $color_regexp, 'default' => '#000000' ) ),
519
- 'adsense_urlColor' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array( 'regexp' => $color_regexp, 'default' => '#009900' ) ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
520
  'container_width' => FILTER_SANITIZE_STRING,
521
  'container_height' => FILTER_SANITIZE_STRING,
522
  'container_styles' => FILTER_SANITIZE_STRING,
523
  'styles_type' => FILTER_SANITIZE_STRING,
524
- 'styles_custom' => array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_custom_style' ),
 
 
 
525
  'overlays_marker' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
526
  'overlays_polyline' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
527
  'overlays_polygon' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
@@ -529,8 +617,7 @@ function intergeo_filter_input() {
529
  'overlays_circle' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
530
  'directions' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
531
  );
532
-
533
- $defaults = array (
534
  'lat' => 48.1366069,
535
  'lng' => 11.577085099999977,
536
  'zoom' => 5,
@@ -586,116 +673,98 @@ function intergeo_filter_input() {
586
  'overlays_circle' => array(),
587
  'directions' => array(),
588
  );
589
-
590
- // Added by Ash/Upwork
591
- if( defined( 'IntergeoMaps_Pro' ) ){
592
- global $IntergeoMaps_Pro;
593
- $IntergeoMaps_Pro->addValidations($validationArray, $defaults);
594
- }
595
- // Added by Ash/Upwork
596
-
597
  $options = filter_input_array( INPUT_POST, $validationArray );
598
-
599
  $results = array();
600
  foreach ( $options as $key => $value ) {
601
  if ( array_key_exists( $key, $defaults ) ) {
602
- $equals = $defaults[$key] == $value;
603
  if ( is_array( $value ) ) {
604
- $equals = ( count( $value ) == count( $defaults[$key] ) ) && ( count( array_diff( (array)$defaults[$key], $value ) ) == 0 );
605
  }
606
-
607
- if ( !$equals ) {
608
- $results[$key] = $value;
609
  }
610
  }
611
  }
612
-
613
- if ( !empty( $results['overlays_marker'] ) ) {
614
- $results['overlays_marker'] = array_filter( array_map( 'intergeo_filter_overlays_marker', $results['overlays_marker'] ) );
615
  }
616
-
617
- if ( !empty( $results['overlays_polyline'] ) ) {
618
- $results['overlays_polyline'] = array_filter( array_map( 'intergeo_filter_overlays_polyline', $results['overlays_polyline'] ) );
619
  }
620
-
621
- if ( !empty( $results['directions'] ) ) {
622
- $results['directions'] = array_filter( array_map( 'intergeo_filter_directions', $results['directions'] ) );
623
  }
624
-
625
  foreach ( array( 'polygon', 'rectangle', 'circle' ) as $overlay ) {
626
  $overlay = 'overlays_' . $overlay;
627
- if ( !empty( $results[$overlay] ) ) {
628
- $results[$overlay] = array_filter( array_map( 'intergeo_filter_overlays_polyoverlay', $results[$overlay] ) );
629
  }
630
  }
 
 
 
 
 
631
 
632
- // Added by Ash/Upwork
633
- if( defined( 'IntergeoMaps_Pro' ) ){
634
- global $IntergeoMaps_Pro;
635
- $IntergeoMaps_Pro->processResults($results);
636
- }
637
- // Added by Ash/Upwork
638
-
639
  return $results;
640
  }
641
 
642
  // </editor-fold>
643
-
644
  // <editor-fold defaultstate="collapsed" desc="saving">
645
-
646
  function intergeo_save_map( $map_id = false, $post_id = false ) {
647
- $options = array();
648
  $array_ptr = &$options;
649
  foreach ( intergeo_filter_input() as $key => $value ) {
650
- if ( !is_null( $value ) ) {
651
- $keys = explode( '_', $key );
652
  $last_key = array_pop( $keys );
653
-
654
  while ( $arr_key = array_shift( $keys ) ) {
655
- if ( !array_key_exists( $arr_key, $array_ptr ) ) {
656
- $array_ptr[$arr_key] = array( );
657
  }
658
- $array_ptr = &$array_ptr[$arr_key];
659
  }
660
-
661
- $array_ptr[$last_key] = $value;
662
- $array_ptr = &$options;
663
  }
664
  }
665
-
666
  $address = '';
667
- if ( !empty( $options['address'] ) ) {
668
  $address = $options['address'] = trim( $options['address'] );
669
  }
670
-
671
  $args = array(
672
  'post_type' => INTERGEO_PLUGIN_NAME,
673
  'post_content' => addcslashes( json_encode( $options ), '\\' ),
674
  'post_status' => 'private',
675
  );
676
-
677
  $update = false;
678
  if ( $map_id ) {
679
  $post = get_post( intergeo_decode( $map_id ) );
680
  if ( $post && $post->post_type == INTERGEO_PLUGIN_NAME ) {
681
- $update = true;
682
  $args['ID'] = $post->ID;
683
  }
684
  }
685
-
686
  $id = wp_insert_post( $args );
687
-
688
- if ( !empty( $id ) && !is_wp_error( $id ) ) {
689
- if ( !$post_id ) {
690
  intergeo_set_info( $update
691
  ? __( 'The map has been updated successfully.', INTERGEO_PLUGIN_NAME )
692
  : __( 'The map has been created successfully.', INTERGEO_PLUGIN_NAME )
693
  );
694
  }
 
695
  return sprintf( '[intergeo id="%s"]%s[/intergeo]', intergeo_encode( $id ), $address );
696
  }
697
-
698
- if ( !$post_id ) {
699
  intergeo_set_error( $update
700
  ? __( 'The map updating failed.', INTERGEO_PLUGIN_NAME )
701
  : __( 'The map creation failed.', INTERGEO_PLUGIN_NAME )
@@ -706,30 +775,23 @@ function intergeo_save_map( $map_id = false, $post_id = false ) {
706
  }
707
 
708
  // </editor-fold>
709
-
710
  // <editor-fold defaultstate="collapsed" desc="ajax stuff">
711
-
712
  add_action( 'wp_ajax_intergeo_show_map_center', 'intergeo_show_map_center_changed' );
713
  function intergeo_show_map_center_changed() {
714
  $nonce = filter_input( INPUT_POST, 'nonce' );
715
  if ( wp_verify_nonce( $nonce, 'editor_popup' . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ) ) {
716
- update_option( 'intergeo_show_map_center', (int)filter_input( INPUT_POST, 'status', FILTER_VALIDATE_BOOLEAN ) );
717
  }
718
  }
719
 
720
  // </editor-fold>
721
-
722
  // </editor-fold>
723
-
724
  // <editor-fold defaultstate="collapsed" desc="shortcode">
725
-
726
  add_filter( 'widget_text', 'do_shortcode' );
727
  add_filter( 'term_description', 'do_shortcode' );
728
-
729
  add_shortcode( INTERGEO_PLUGIN_NAME, 'intergeo_shortcode' );
730
  function intergeo_shortcode( $attrs, $address = '' ) {
731
- do_action("intergeo_shortcode_render_before", $attrs);
732
-
733
  $args = shortcode_atts( array(
734
  'id' => false,
735
  'hook' => false,
@@ -738,65 +800,58 @@ function intergeo_shortcode( $attrs, $address = '' ) {
738
  'style' => false,
739
  'zoom' => false,
740
  ), $attrs );
741
-
742
  $address = trim( $address );
743
  if ( empty( $args['id'] ) && empty( $address ) ) {
744
  return '';
745
  }
746
-
747
  $json = array();
748
- if ( !empty( $args['id'] ) ) {
749
  $post = get_post( intergeo_decode( $args['id'] ) );
750
- if ( !$post || $post->post_type != INTERGEO_PLUGIN_NAME ) {
751
  return '';
752
  }
753
-
754
  $json = json_decode( $post->post_content, true );
755
  } else {
756
- $args['id'] = intergeo_encode( rand( 0, 100 ) . rand( 0, 10000 ) );
757
  $json['zoom'] = intval( $args['zoom'] ) ? intval( $args['zoom'] ) : 15;
758
  }
759
-
760
- if ( !empty( $address ) ) {
761
  $json['address'] = $address;
762
  }
763
-
764
  if ( trim( $args['hook'] ) != '' ) {
765
  $json = apply_filters( $args['hook'], $json );
766
  }
767
-
768
  wp_enqueue_style( 'intergeo-frontend' );
769
  intergeo_enqueue_google_maps_script( intergeo_check_libraries( $json ) );
770
- if ( !wp_script_is( 'intergeo-rendering' ) ) {
771
- wp_enqueue_script( 'intergeo-rendering', INTERGEO_ABSURL . 'js/rendering.js', array( 'jquery', 'google-maps-v3' ), INTERGEO_VERSION );
 
 
 
772
  wp_localize_script( 'intergeo-rendering', 'intergeo_options', array(
773
  'adsense' => array( 'publisher_id' => get_option( 'intergeo_adsense_publisher_id' ) )
774
  ) );
775
  }
776
-
777
  $container = array();
778
  if ( isset( $json['container'] ) ) {
779
  $container = $json['container'];
780
  unset( $json['container'] );
781
  }
782
-
783
- $width = !empty( $container['width'] ) ? esc_attr( $container['width'] ) : '100%';
784
  if ( trim( $args['width'] ) != '' ) {
785
  $width = $args['width'];
786
  }
787
  if ( is_numeric( $width ) ) {
788
  $width .= 'px';
789
  }
790
-
791
- $height = !empty( $container['height'] ) ? esc_attr( $container['height'] ) : '300px';
792
  if ( trim( $args['height'] ) != '' ) {
793
  $height = $args['height'];
794
  }
795
  if ( is_numeric( $height ) ) {
796
  $height .= 'px';
797
  }
798
-
799
- $styles = !empty( $container['styles'] ) ? esc_attr( $container['styles'] ) : '';
800
  if ( trim( $args['style'] ) != '' ) {
801
  $styles = $args['style'];
802
  }
@@ -820,13 +875,11 @@ function intergeo_shortcode( $attrs, $address = '' ) {
820
  }
821
 
822
  // </editor-fold>
823
-
824
  // <editor-fold defaultstate="collapsed" desc="library">
825
-
826
  add_action( 'admin_menu', 'intergeo_admin_menu' );
827
  function intergeo_admin_menu() {
828
- add_options_page( __('Intergeo Maps Library', INTERGEO_PLUGIN_NAME), __('Intergeo Maps', INTERGEO_PLUGIN_NAME), 'edit_posts', INTERGEO_PLUGIN_NAME, 'intergeo_settings_init' );
829
- $page = add_submenu_page( 'upload.php', __('Intergeo Maps Library', INTERGEO_PLUGIN_NAME), __('Intergeo Maps', INTERGEO_PLUGIN_NAME), 'edit_posts', INTERGEO_PLUGIN_NAME, 'intergeo_library' );
830
  if ( $page ) {
831
  add_action( "load-{$page}", 'intergeo_library_init' );
832
  }
@@ -835,9 +888,7 @@ function intergeo_admin_menu() {
835
  function intergeo_library_init() {
836
  wp_enqueue_style( 'intergeo_library', INTERGEO_ABSURL . 'css/library.css', array(), INTERGEO_VERSION );
837
  wp_enqueue_media();
838
-
839
  $screen = get_current_screen();
840
-
841
  $screen->add_help_tab( array(
842
  'title' => esc_html__( 'Overview', INTERGEO_PLUGIN_NAME ),
843
  'id' => 'overview',
@@ -847,7 +898,6 @@ function intergeo_library_init() {
847
  esc_html__( "If you want to delete a map, click on the trash icon in the right bottom corner of a map and confirm your action. Pay attention that whole information about the map will be removed from the system, but all shortcodes will be left where you embed it. However these deprecated shortcodes won't be rendered anymore, so you don't have to worry about it while the plugin is enabled.", INTERGEO_PLUGIN_NAME ),
848
  ) ) ),
849
  ) );
850
-
851
  $screen->add_help_tab( array(
852
  'title' => esc_html__( 'Shortcodes', INTERGEO_PLUGIN_NAME ),
853
  'id' => 'shortcodes',
@@ -862,19 +912,19 @@ function intergeo_library() {
862
  if ( filter_input( INPUT_GET, 'do' ) == 'delete' ) {
863
  intergeo_library_delete();
864
  }
865
-
866
  $query = new WP_Query( array(
867
  'orderby' => 'ID',
868
  'order' => 'DESC',
869
  'post_type' => INTERGEO_PLUGIN_NAME,
870
  'posts_per_page' => 9,
871
- 'paged' => filter_input( INPUT_GET, 'pagenum', FILTER_VALIDATE_INT, array( 'options' => array(
872
- 'min_range' => 1,
873
- 'default' => 1,
874
- ) ) ),
 
 
875
  ) );
876
-
877
- $libraries = array();
878
  $pagination = paginate_links( array(
879
  'base' => add_query_arg( array(
880
  'pagenum' => '%#%',
@@ -885,44 +935,41 @@ function intergeo_library() {
885
  'total' => $query->max_num_pages,
886
  'type' => 'array',
887
  ) );
888
-
889
  require INTERGEO_ABSPATH . '/templates/library/list.php';
890
-
891
  intergeo_enqueue_google_maps_script( $libraries );
892
-
893
- wp_enqueue_script( 'intergeo-rendering', INTERGEO_ABSURL . 'js/rendering.js', array( 'jquery', 'google-maps-v3' ), INTERGEO_VERSION );
894
- wp_enqueue_script( 'intergeo-library', INTERGEO_ABSURL . 'js/library.js', array( 'intergeo-rendering', 'media-views' ), INTERGEO_VERSION );
895
-
 
 
 
 
896
  wp_localize_script( 'intergeo-rendering', 'intergeo_options', array(
897
  'adsense' => array( 'publisher_id' => get_option( 'intergeo_adsense_publisher_id' ) )
898
  ) );
899
-
900
- // Added by Ash/Upwork
901
- if( defined( 'IntergeoMaps_Pro' ) ){
902
- global $IntergeoMaps_Pro;
903
- $IntergeoMaps_Pro->enqueueScriptsAndStyles(array('intergeo-rendering'));
904
- }
905
- // Added by Ash/Upwork
906
-
907
  }
908
 
909
  function intergeo_library_delete() {
910
- if ( !current_user_can( 'delete_posts' ) ) {
911
  return;
912
  }
913
-
914
  $id = intergeo_decode( trim( filter_input( INPUT_GET, 'map' ) ) );
915
- if ( !$id ) {
916
  return;
917
  }
918
-
919
  $post = get_post( $id );
920
  if ( wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), $id . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ) && $post->post_type == INTERGEO_PLUGIN_NAME ) {
921
  if ( wp_delete_post( $id, true ) ) {
922
  intergeo_set_info( __( 'The map was deleted successfully.', INTERGEO_PLUGIN_NAME ) );
923
  }
924
  }
925
-
926
  if ( filter_input( INPUT_GET, 'noheader', FILTER_VALIDATE_BOOLEAN ) ) {
927
  wp_redirect( add_query_arg( 'page', INTERGEO_PLUGIN_NAME, admin_url( 'upload.php' ) ) );
928
  exit;
@@ -930,20 +977,16 @@ function intergeo_library_delete() {
930
  }
931
 
932
  // </editor-fold>
933
-
934
  // <editor-fold defaultstate="collapsed" desc="messaging functions">
935
-
936
  function intergeo_set_message( $message, $is_normal, $user_id = false ) {
937
  $messages = get_option( 'intergeo_messages', array() );
938
  if ( $user_id === false ) {
939
  $user_id = get_current_user_id();
940
  }
941
-
942
- if ( !isset( $messages[$user_id] ) ) {
943
- $messages[$user_id] = array();
944
  }
945
-
946
- $messages[$user_id][] = array( $message, $is_normal );
947
  update_option( 'intergeo_messages', $messages );
948
  }
949
 
@@ -958,275 +1001,295 @@ function intergeo_set_error( $message, $user_id = false ) {
958
  add_action( 'admin_notices', 'intergeo_print_messages' );
959
  function intergeo_print_messages() {
960
  global $pagenow;
961
-
962
- // Added by Ash/Upwork
963
- intergeo_show_nag();
964
- // Added by Ash/Upwork
965
-
966
  if ( $pagenow != 'upload.php' ) {
967
  return;
968
  }
969
-
970
  $messages = get_option( 'intergeo_messages', array() );
971
- $user_id = get_current_user_id();
972
-
973
- if ( !isset( $messages[$user_id] ) ) {
974
  return;
975
  }
976
-
977
- foreach ( $messages[$user_id] as $message ) {
978
- printf( $message[1] ? '<div class="updated"><p>%s</p></div>' : '<div class="error"><p>%s</p></div>', __($message[0], INTERGEO_PLUGIN_NAME) );
979
  }
980
-
981
- $messages[$user_id] = array();
982
  update_option( 'intergeo_messages', $messages );
983
  }
984
 
985
  // Added by Ash/Upwork
986
  add_action( 'admin_enqueue_scripts', 'intergeo_enqueue_scripts' );
987
- function intergeo_enqueue_scripts()
988
- {
989
  wp_enqueue_script( 'intergeo-misc', INTERGEO_ABSURL . 'js/misc.js', array( 'jquery' ), INTERGEO_VERSION );
990
  wp_localize_script( 'intergeo-misc', 'intergeo_misc', array(
991
- "ajax" => array(
992
- "action" => "intergeo_dismiss_nag",
993
- "themeisle_feedback_action" => "themeisle_feedback_dismiss_nag",
994
- "themeisle_feedback_slug" => INTERGEO_PLUGIN_NAME,
995
- "nonce" => wp_create_nonce(INTERGEO_PLUGIN_NAME . INTERGEO_VERSION),
996
- )
997
- ));
998
  }
999
 
1000
  add_action( 'wp_ajax_intergeo_dismiss_nag', 'intergeo_dismiss_nag' );
1001
  function intergeo_dismiss_nag() {
1002
- check_ajax_referer(INTERGEO_PLUGIN_NAME . INTERGEO_VERSION, "security");
1003
-
1004
- update_option("intergeo_nag_dismissed", true);
1005
- wp_die();
1006
  }
1007
 
1008
- function intergeo_show_nag()
1009
- {
1010
  global $pagenow;
1011
-
1012
- if ( $pagenow == 'plugins.php' && !get_option("intergeo_nag_dismissed", false)) {
1013
- include_once INTERGEO_ABSPATH . '/templates/nag.php';
1014
- }
1015
- }
1016
- // Added by Ash/Upwork
1017
-
1018
- // </editor-fold>
1019
-
1020
- // Added by Ash/Upwork
1021
- register_activation_hook(__FILE__ , "intergeo_activate");
1022
- function intergeo_activate()
1023
- {
1024
- if (get_option("intergeo-activation-date", false) === false) {
1025
- update_option("intergeo-activation-date", time());
1026
- }
1027
  }
1028
 
1029
- add_action("admin_init", "intergeo_init_triggered_feedback");
1030
- function intergeo_init_triggered_feedback()
1031
- {
1032
- /*
1033
- array(
1034
- "name_of_trigger_filter_that_returns_true" => array(
1035
- "behaviour" => array(
1036
- "show_when" => strtotime compliant time,
1037
- "show_where" => "name_of_filter"
1038
- ),
1039
- "notifications" => array(
1040
- array(
1041
- "description" => mandatory, dont show the notification if this is empty,
1042
- "button_ok_link" => mandatory, dont show the notification if this is empty,
1043
- "button_ok_text" => mandatory, dont show the notification if thihs is empty,
1044
- "button_hide_text" => optional, default value is 'Hide',
1045
- "button_done_text" => optional, default value is "I've already done it"
1046
- ),
1047
- )
1048
- )
1049
- )
1050
- */
1051
- $feedback_config = array(
1052
- "intergeo_created_3_maps" => array(
1053
  "behaviour" => array(
1054
- "show_when" => "+6 hours",
1055
- "show_where" => "intergeo_triggered_feedback_show_notification_filter"
1056
  ),
1057
  "notifications" => array(
1058
  array(
1059
- "description" => "Hey, it seems you are doing great creating maps using the Intergeo plugin. Would you like to share you experience with other users who are using it ?",
1060
- "button_ok_link" => "http://bit.ly/2btLtsk",
1061
- "button_ok_text" => "I'd love to do it :D ",
1062
- "button_hide_text" => "Not now :(",
1063
- "button_done_text" => "Already done it :) ",
 
 
 
 
 
 
 
1064
  ),
1065
  array(
1066
- "description" => "Hey, <br/> It seems you created a bunch of maps using the Intergeo plugin. Would you like to share you experience with other users who are using the plugin ? ",
1067
- "button_ok_link" => "http://bit.ly/2c11uJ0",
1068
- "button_ok_text" => "Sure ",
1069
- "button_hide_text" => "Not really",
1070
- "button_done_text" => "Done that ",
 
 
 
 
 
 
 
1071
  ),
1072
  )
1073
  ),
1074
- "intergeo_plugin_1week_old" => array(
1075
  "behaviour" => array(
1076
- "show_when" => "+6 hours",
1077
- "show_where" => "intergeo_triggered_feedback_show_notification_filter"
1078
  ),
1079
  "notifications" => array(
1080
  array(
1081
- "description" => "Hey, you are using Intergeo for a great amount of time and we would love to get your review about the experience using it in order to improve the future versions. Would you like to share your feedback with us ? ",
1082
- "button_ok_link" => "http://bit.ly/2bkAJuE",
1083
- "button_ok_text" => "Sure, i would like to help ",
1084
- "button_hide_text" => "Not now",
1085
- "button_done_text" => "Already sent it",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1086
  ),
1087
  )
1088
  ),
1089
- "intergeo_map_frontend_display" => array(
1090
  "behaviour" => array(
1091
- "show_when" => "+6 hours",
1092
- "show_where" => "intergeo_triggered_feedback_show_notification_filter"
1093
  ),
1094
  "notifications" => array(
1095
  array(
1096
- "description" => "Hey, it seems you are already using the Intergeo maps shortcode in your site and your users are enjoying it. What do you think of sharing your experience with us ? ",
1097
- "button_ok_link" => "http://bit.ly/2bSh5HC",
1098
- "button_ok_text" => "Sure ",
1099
- "button_hide_text" => "Not now",
1100
- "button_done_text" => "I've already done it",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1101
  ),
1102
  )
1103
  ),
1104
  );
1105
-
1106
-
1107
  // add the configuration with the slug and trigger the generic action
1108
- do_action("themeisle_triggered_feedback_add_config", $feedback_config, INTERGEO_PLUGIN_NAME);
1109
  }
1110
 
1111
- add_action("themeisle_triggered_feedback_add_config", "themeisle_triggered_feedback_add_config", 10, 2);
1112
- function themeisle_triggered_feedback_add_config($config, $slug)
1113
- {
1114
- global $pagenow;
1115
-
1116
- $trigger_time = $slug . "-triggered-feedback-time";
1117
- $trigger_type = $slug . "-triggered-feedback-type";
1118
- $fuse_lit = get_option($trigger_time, false);
1119
-
1120
- if ($fuse_lit !== false) {
1121
- if (ctype_digit($fuse_lit) && $fuse_lit != -1 && time() >= $fuse_lit) {
1122
- // it is time to explode
1123
- $trigger = get_option($trigger_type);
1124
- $attributes = $config[$trigger];
1125
- if (apply_filters($attributes["behaviour"]["show_where"], $pagenow) === true) {
1126
- $notification = $attributes["notifications"][rand(0, count($attributes["notifications"]) - 1)];
1127
- do_action("themeisle_triggered_feedback_show_notification", $notification, $slug);
1128
- }
1129
- }
1130
- } else {
1131
- foreach ($config as $trigger=>$attributes) {
1132
- $pull_trigger = apply_filters($trigger, false);
1133
- if ($pull_trigger === true) {
1134
- // light fuse
1135
- update_option($trigger_time, strtotime($attributes["behaviour"]["show_when"]));
1136
- update_option($trigger_type, $trigger);
1137
- }
1138
- }
1139
- }
 
 
 
1140
  }
1141
 
1142
  global $themeisle_notification;
1143
-
1144
- add_action("themeisle_triggered_feedback_show_notification", "themeisle_triggered_feedback_show_notification", 10, 2);
1145
- function themeisle_triggered_feedback_show_notification($notification, $slug)
1146
- {
1147
  global $themeisle_notification;
1148
-
1149
- if (
1150
- !isset($notification["description"]) || empty($notification["description"])
1151
- || !isset($notification["button_ok_link"]) || empty($notification["button_ok_link"])
1152
- || !isset($notification["button_ok_text"]) || empty($notification["button_ok_text"])
1153
- ) return;
1154
-
1155
- if (!isset($notification["button_hide_text"]) || empty($notification["button_hide_text"])) {
1156
- $notification["button_hide_text"] = __("Hide", INTERGEO_PLUGIN_NAME);
1157
- }
1158
- if (!isset($notification["button_done_text"]) || empty($notification["button_done_text"])) {
1159
- $notification["button_done_text"] = __("I've already done it", INTERGEO_PLUGIN_NAME);
1160
- }
1161
-
1162
- $themeisle_notification = '
1163
  <style type="text/css">.ti-feedback-notice .themeisle-feedback-click { margin-left:5px; }</style><div class="updated activated notice is-dismissible themeisle_triggered_feedback_nag">'
1164
- . '<p>' . $notification["description"] . '</p>'
1165
- . '<p class="ti-feedback-notice"><a href="' . $notification["button_ok_link"] . '" target="_new"><input type="button" class="button button-secondary themeisle-feedback-click" value="' . $notification["button_ok_text"] . '"></a>'
1166
- . '<input type="button" class="button button-secondary themeisle-feedback-click" value="' . $notification["button_hide_text"] . '">'
1167
- . '<input type="button" class="button button-secondary themeisle-feedback-click" value="' . $notification["button_done_text"] . '">'
1168
- . '</p></div>';
1169
-
1170
- add_action("admin_notices", "themeisle_triggered_feedback_show_admin_notice");
1171
  }
1172
 
1173
- function themeisle_triggered_feedback_show_admin_notice()
1174
- {
1175
- global $themeisle_notification;
1176
-
1177
- echo $themeisle_notification;
1178
  }
1179
 
1180
  add_action( 'wp_ajax_themeisle_feedback_dismiss_nag', 'themeisle_feedback_dismiss_nag' );
1181
  function themeisle_feedback_dismiss_nag() {
1182
- check_ajax_referer(INTERGEO_PLUGIN_NAME . INTERGEO_VERSION, "security");
 
 
 
1183
 
1184
- update_option(sanitize_text_field($_REQUEST["slug"]) . "-triggered-feedback-time", -1);
1185
- wp_die();
 
1186
  }
1187
 
1188
- add_filter("intergeo_triggered_feedback_show_notification_filter", "intergeo_triggered_feedback_show_notification_filter");
1189
- function intergeo_triggered_feedback_show_notification_filter($pagenow)
1190
- {
1191
- return ($pagenow == 'upload.php' || $pagenow == 'options-general.php') && isset($_GET["page"]) && $_GET["page"] == INTERGEO_PLUGIN_NAME;
 
 
 
 
 
1192
  }
1193
 
1194
- add_filter("intergeo_created_3_maps", "intergeo_created_3_maps");
1195
- function intergeo_created_3_maps()
1196
- {
1197
- $maps = get_posts(array(
1198
- 'post_type' => INTERGEO_PLUGIN_NAME,
1199
- 'posts_per_page' => 4,
1200
- 'post_status' => 'private',
1201
- ) );
1202
 
1203
- return count($maps) > 3;
1204
 
1205
  }
1206
 
1207
- add_filter("intergeo_plugin_1week_old", "intergeo_plugin_1week_old");
1208
- function intergeo_plugin_1week_old()
1209
- {
1210
- $activation_date = get_option("intergeo-activation-date", false);
1211
- if ($activation_date !== false) {
1212
- return ((time() - $activation_date) >= 7 * 24 * 60 * 60);
1213
- }
1214
- return false;
1215
  }
1216
 
1217
- add_filter("intergeo_map_frontend_display", "intergeo_map_frontend_display");
1218
- function intergeo_map_frontend_display()
1219
- {
1220
- return get_option("intergeo-frontend-used", 0) > 0;
1221
  }
1222
 
1223
- add_action("intergeo_shortcode_render_before", "intergeo_shortcode_render_before");
1224
- function intergeo_shortcode_render_before($atts)
1225
- {
1226
- // set a flag if the map has been shown on the front end
1227
- if (!is_admin() && get_option("intergeo-frontend-used", 0) != 1) {
1228
- update_option("intergeo-frontend-used", 1);
1229
- }
1230
  }
1231
- // Added by Ash/Upwork
1232
 
1
  <?php
2
  /*
3
+ Plugin Name: Intergeo Lite - Google Maps Plugin
4
  Plugin URI: http://themeisle.com/plugins/intergeo-maps-lite/
5
  Description: A simple, easy and quite powerful Google Map tool to create, manage and embed custom Google Maps into your WordPress posts and pages. The plugin allows you to deeply customize look and feel of a map, add overlays like markers, rectangles, circles, polylines and polygons to your map. It could even be integraded with your Google Adsense account and show ad on your maps.
6
+ Version: 1.1.5
7
  Author: Themeisle
8
  Author URI: http://themeisle.com
9
  License: GPL v2.0 or later
11
  Text Domain: intergeo
12
  Domain Path: /languages
13
  */
 
14
  // <editor-fold defaultstate="collapsed" desc="constants">
 
15
  define( 'INTERGEO_PLUGIN_NAME', 'intergeo' ); // don't change it whatever
16
+ define( 'INTERGEO_VERSION', '1.1.5' );
17
+ define( 'INTERGEO_ABSPATH', dirname( __FILE__ ) );
18
+ define( 'INTERGEO_ABSURL', plugins_url( '/', __FILE__ ) );
19
+ define( 'INTERGEO_PRO_URL', "http://themeisle.com/plugins/intergeo-maps-pro/" );
20
  // Added by Ash/Upwork
21
+ defined( 'WPLANG' ) || define( 'WPLANG', '' );
22
  // Added by Ash/Upwork
 
23
  // Added by Ash/Upwork
24
+ if ( class_exists( 'IntergeoMaps_Pro', false ) ) {
25
+ define( 'IntergeoMaps_Pro', true );
26
  }
27
  // Added by Ash/Upwork
 
28
  // </editor-fold>
 
29
  // <editor-fold defaultstate="collapsed" desc="plugin init">
 
30
  function im_fs() {
31
  global $im_fs;
 
32
  if ( ! isset( $im_fs ) ) {
33
  // Include Freemius SDK.
34
+ require_once dirname( __FILE__ ) . '/freemius/start.php';
 
35
  $im_fs = fs_dynamic_init( array(
36
+ 'id' => '239',
37
+ 'slug' => 'intergeo-maps',
38
+ 'public_key' => 'pk_35c86b731f06c8d4ba25b490af632',
39
+ 'is_premium' => false,
40
+ 'has_addons' => false,
41
+ 'has_paid_plans' => false,
42
+ 'anonymous_mode' => true,
43
+ 'menu' => array(
44
+ 'slug' => 'intergeo',
45
+ 'account' => false,
46
+ 'support' => false,
47
+ 'contact' => false,
48
+ 'parent' => array(
49
  'slug' => 'upload.php',
50
  ),
51
  ),
54
 
55
  return $im_fs;
56
  }
57
+
58
  // Init Freemius.
59
  im_fs();
 
60
  add_filter( 'plugin_action_links', 'intergeo_action_links', 10, 2 );
61
  function intergeo_action_links( $links, $file ) {
62
  if ( $file == plugin_basename( __FILE__ ) ) {
66
  sprintf( '<a href="%s">%s</a>', admin_url( 'options-media.php' ), __( "Settings", INTERGEO_PLUGIN_NAME ) )
67
  );
68
  }
69
+
70
  return $links;
71
  }
72
 
81
  wp_register_style( 'intergeo-frontend', INTERGEO_ABSURL . 'css/frontend.css', array(), INTERGEO_VERSION );
82
  }
83
 
84
+ add_action( "plugins_loaded", 'intergeo_i18n' );
85
+ function intergeo_i18n() {
86
+ $pluginDirName = dirname( plugin_basename( __FILE__ ) );
87
+ $domain = INTERGEO_PLUGIN_NAME;
88
+ $locale = apply_filters( "plugin_locale", get_locale(), $domain );
89
+ load_textdomain( $domain, WP_LANG_DIR . "/" . $pluginDirName . "/" . $domain . "-" . $locale . ".mo" );
90
+ load_plugin_textdomain( $domain, "", $pluginDirName . "/languages/" );
91
  }
92
 
93
  // </editor-fold>
 
94
  // <editor-fold defaultstate="collapsed" desc="settings">
 
95
  function intergeo_settings_init() {
96
+ if ( isset( $_POST["sb-intergeo"] ) && wp_verify_nonce( $_POST["intergeo-nonce"], "intergeo-settings" ) ) {
97
+ update_option( 'intergeo_map_api_key', sanitize_text_field( $_POST['intergeo_map_api_key'] ) );
98
+ update_option( 'intergeo_adsense_publisher_id', sanitize_text_field( $_POST['intergeo_adsense_publisher_id'] ) );
99
+ }
100
+ echo "<form method='post' action=''>";
 
101
  register_setting( 'intergeo', 'intergeo-settings-map-api-key', 'trim' );
102
+ add_settings_section( 'intergeo-settings-maps', __( 'Intergeo Google Maps', INTERGEO_PLUGIN_NAME ), 'intergeo_settings_init_map', INTERGEO_PLUGIN_NAME );
103
+ add_settings_field( 'intergeo_map_api_key', __( 'Maps API Key', INTERGEO_PLUGIN_NAME ), 'intergeo_settings_print_field', INTERGEO_PLUGIN_NAME, 'intergeo-settings-maps', array(
104
  '<input type="text" name="%s" value="%s" class="regular-text">',
105
  'intergeo_map_api_key',
106
  esc_attr( get_option( 'intergeo_map_api_key' ) ),
107
  ) );
 
108
  register_setting( 'intergeo', 'intergeo_adsense_publisher_id', 'trim' );
109
+ add_settings_section( 'intergeo-settings-adsense', __( 'Intergeo Google Maps AdSense Integration', INTERGEO_PLUGIN_NAME ), 'intergeo_settings_init_adsense', INTERGEO_PLUGIN_NAME );
110
+ add_settings_field( 'intergeo_adsense_publisher_id', __( 'AdSense Publisher Id', INTERGEO_PLUGIN_NAME ), 'intergeo_settings_print_field', INTERGEO_PLUGIN_NAME, 'intergeo-settings-adsense', array(
111
  '<input type="text" name="%s" value="%s" class="regular-text">',
112
  'intergeo_adsense_publisher_id',
113
  esc_attr( get_option( 'intergeo_adsense_publisher_id' ) ),
114
  ) );
115
+ do_settings_sections( INTERGEO_PLUGIN_NAME );
116
+ submit_button( __( "Save Changes", INTERGEO_PLUGIN_NAME ), "primary", "sb-intergeo" );
117
+ wp_nonce_field( "intergeo-settings", "intergeo-nonce" );
118
+ echo "</form>";
 
 
119
  }
120
 
121
  function intergeo_settings_init_map() {
122
  ?><p><?php
123
+ printf( esc_html__( ' Below shows how to find your API Key, after retrieving your key add it to the "Maps API Key" input box.', INTERGEO_PLUGIN_NAME ) );
124
  ?></p>
125
 
126
+ <iframe width="560" height="315" src="https://www.youtube.com/embed/gbFDMBGPCcs" frameborder="0"
127
+ allowfullscreen></iframe>
128
  <?php
129
  }
130
 
131
  function intergeo_settings_init_adsense() {
132
  ?><p><?php
133
+ printf( esc_html__( "Adding display ads to your map requires that you have an AdSense account enabled for AdSense for Content. If you don't yet have an AdSense account, %1\$ssign up%3\$s for one. Once you have done so (or if you already have an account) make sure you've also enabled the account with %2\$sAdSense for Content%3\$s.", INTERGEO_PLUGIN_NAME ), '<a href="https://www.google.com/adsense/support/bin/answer.py?answer=10162" target="_blank">', '<a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=17470" target="_blank">', '</a>' )
134
  ?></p><p><?php
135
+ esc_html_e( 'Once you have an Adsense for Content account, you will have received an AdSense for Content (AFC) publisher ID. This publisher ID is used to link any advertising shown to your AdSense account, allowing you to share in advertising revenue when a user clicks on one of the ads shown on your maps.', INTERGEO_PLUGIN_NAME )
136
  ?></p><?php
137
  }
138
 
141
  }
142
 
143
  // </editor-fold>
 
144
  // <editor-fold defaultstate="collapsed" desc="common">
 
145
  function intergeo_enqueue_google_maps_script( $libraries = false ) {
146
  global $wp_scripts;
 
147
  if ( is_array( $libraries ) ) {
148
  $libraries = implode( ',', $libraries );
149
  }
 
150
  if ( wp_script_is( 'google-maps-v3' ) ) {
 
151
  $params = array();
152
+ $arr = explode( '?', $wp_scripts->registered['google-maps-v3']->src );
153
+ parse_str( end( $arr ), $params );
154
+ $params['libraries'] = implode( ',', array_unique( array_merge( isset( $params['libraries'] ) ? explode( ',', $params['libraries'] ) : array(), explode( ',', $libraries ) ) ) );
155
  $wp_scripts->registered['google-maps-v3']->src = '//maps.googleapis.com/maps/api/js?' . http_build_query( $params );
156
 
157
  } else {
158
+ $lang = explode( '_', WPLANG ? WPLANG : 'en_US' );
 
159
  $params = array(
160
+ 'region' => isset( $lang[1] ) ? $lang[1] : 'US',
161
+ 'language' => $lang[0],
162
  );
163
+ if ( ! empty( $libraries ) ) {
 
164
  $params['libraries'] = $libraries;
165
  }
 
166
  $api_key = get_option( 'intergeo_map_api_key' );
167
+ if ( ! empty( $api_key ) ) {
168
  $params['key'] = $api_key;
169
  }
170
+ if ( wp_script_is( "google-maps" ) ) {
171
+ wp_dequeue_script( "google-maps" );
172
+ }
173
+ wp_enqueue_script( 'google-maps-v3', '//maps.googleapis.com/maps/api/js?' . http_build_query( $params ), array(), null );
174
  }
175
  }
176
 
177
  function intergeo_check_libraries( $json, $libraries = array() ) {
178
+ if ( isset( $json['layer']['adsense'] ) && $json['layer']['adsense'] && ! in_array( 'adsense', $libraries ) ) {
179
  $libraries[] = 'adsense';
180
  }
181
+ if ( isset( $json['layer']['panoramio'] ) && $json['layer']['panoramio'] && ! in_array( 'panoramio', $libraries ) ) {
 
182
  $libraries[] = 'panoramio';
183
  }
 
184
  if ( ( isset( $json['layer']['weather'] ) && $json['layer']['weather'] ) || ( isset( $json['layer']['cloud'] ) && $json['layer']['cloud'] ) ) {
185
+ if ( ! in_array( 'weather', $libraries ) ) {
186
  $libraries[] = 'weather';
187
  }
188
  }
199
  }
200
 
201
  // </editor-fold>
 
202
  // <editor-fold defaultstate="collapsed" desc="iframe">
 
203
  // <editor-fold defaultstate="collapsed" desc="rendering">
 
204
  add_filter( 'media_upload_tabs', 'intergeo_media_upload_tabs' );
205
  function intergeo_media_upload_tabs( $tabs ) {
206
  $tabs['intergeo_map'] = __( 'Intergeo Maps', INTERGEO_PLUGIN_NAME );
207
+
208
  return $tabs;
209
  }
210
 
211
  add_action( 'media_upload_intergeo_map', 'intergeo_map_popup_init' );
212
  function intergeo_map_popup_init() {
213
  $post_id = filter_input( INPUT_GET, 'post_id', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
214
+ $map_id = filter_input( INPUT_GET, 'map' );
 
215
  $send_to_editor = false;
216
  if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
217
  $shortcode = intergeo_save_map( $map_id, $post_id );
226
  exit;
227
  }
228
  }
 
229
  intergeo_enqueue_google_maps_script( 'adsense,panoramio,weather,drawing,places' );
230
+ wp_enqueue_script( 'jquery-ddslick', INTERGEO_ABSURL . 'js/jquery.ddslick.min.js', array( 'jquery' ) );
231
+ wp_enqueue_script( 'intergeo-editor', INTERGEO_ABSURL . 'js/editor.js', array(
232
+ 'jquery-ddslick',
233
+ 'wp-color-picker',
234
+ 'google-maps-v3'
235
+ ), INTERGEO_VERSION );
236
  wp_localize_script( 'intergeo-editor', 'intergeo_options', array(
237
  'send_to_editor' => $send_to_editor,
238
  'adsense' => array( 'publisher_id' => get_option( 'intergeo_adsense_publisher_id' ) ),
240
  'nonce' => wp_create_nonce( 'editor_popup' . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ),
241
  'l10n' => array(
242
  'marker' => __( 'marker', INTERGEO_PLUGIN_NAME ),
243
+ 'error' => array(
244
  'style' => __( 'Styles are broken. Please, fix it and try again.', INTERGEO_PLUGIN_NAME ),
245
  'directions' => __( 'Direction was not found.', INTERGEO_PLUGIN_NAME ),
246
  ),
247
  ),
248
  ) );
 
249
  wp_enqueue_style( 'wp-color-picker' );
250
  wp_enqueue_style( 'intergeo-editor', INTERGEO_ABSURL . 'css/editor.css', array(), INTERGEO_VERSION );
251
+ // Added by Ash/Upwork
252
+ if ( defined( 'IntergeoMaps_Pro' ) ) {
253
+ global $IntergeoMaps_Pro;
254
+ $IntergeoMaps_Pro->enqueueScriptsAndStyles( array( 'intergeo-editor' ), array( "mapID" => $map_id ) );
255
+ }
256
+ // Added by Ash/Upwork
 
 
257
  wp_iframe( 'intergeo_iframe', $post_id, $map_id );
258
  }
259
 
260
  function intergeo_iframe( $post_id = false, $map_id = false ) {
261
+ $publisher_id = trim( get_option( 'intergeo_adsense_publisher_id' ) );
262
  $show_map_center = get_option( 'intergeo_show_map_center', true );
 
263
  $submit_text = __( 'Insert into post', INTERGEO_PLUGIN_NAME );
264
+ if ( ! $post_id ) {
 
265
  $submit_text = __( 'Create the map', INTERGEO_PLUGIN_NAME );
266
  }
 
267
  $copy = false;
268
+ if ( ! $map_id ) {
269
+ $copy = true;
270
  $map_id = filter_input( INPUT_GET, 'copy' );
271
  }
 
272
  $json = array();
273
  if ( $map_id ) {
274
  $map = get_post( intergeo_decode( $map_id ) );
275
  if ( $map->post_type == INTERGEO_PLUGIN_NAME ) {
276
  $json = json_decode( $map->post_content, true );
277
+ if ( ! $copy ) {
278
  $submit_text = __( 'Update the map', INTERGEO_PLUGIN_NAME );
279
  }
280
  }
281
  }
 
282
  require INTERGEO_ABSPATH . '/templates/iframe/form.php';
283
  }
284
 
285
  // </editor-fold>
 
286
  // <editor-fold defaultstate="collapsed" desc="filtering">
 
287
  function intergeo_filter_value( $value, $array ) {
288
  $value = strtoupper( $value );
289
+
290
+ return ! in_array( $value, $array ) ? null : $value;
291
  }
292
 
293
  function intergeo_filter_position( $position ) {
294
  return intergeo_filter_value( $position, array(
295
+ 'TOP_LEFT',
296
+ 'TOP_CENTER',
297
+ 'TOP_RIGHT',
298
+ 'RIGHT_TOP',
299
+ 'RIGHT_CENTER',
300
+ 'RIGHT_BOTTOM',
301
+ 'BOTTOM_RIGHT',
302
+ 'BOTTOM_CENTER',
303
+ 'BOTTOM_LEFT',
304
+ 'LEFT_BOTTOM',
305
+ 'LEFT_CENTER',
306
+ 'LEFT_TOP'
307
  ) );
308
  }
309
 
352
 
353
  function intergeo_filter_custom_style( $style ) {
354
  $style = trim( $style );
355
+ $json = @json_decode( $style, true );
356
 
357
  return empty( $json ) ? null : $json;
358
  }
359
 
360
  function intergeo_filter_overlays_marker( $marker ) {
361
+ if ( ! isset( $marker['position'] ) || ! preg_match( '/^-?\d+\.?\d*,-?\d+\.?\d*$/', $marker['position'] ) ) {
362
  return false;
363
  }
364
 
372
  }
373
 
374
  function intergeo_filter_overlays_polyline( $polyline ) {
375
+ if ( ! isset( $polyline['path'] ) ) {
376
  return false;
377
  }
 
378
  $path = array();
379
+ foreach ( explode( ';', $polyline['path'] ) as $point ) {
380
  if ( preg_match( '/^-?\d+\.?\d*,-?\d+\.?\d*$/', $point ) ) {
381
  $path[] = explode( ',', $point );
382
  }
383
  }
 
384
  if ( count( $path ) < 2 ) {
385
  return false;
386
  }
388
  return array(
389
  'path' => $path,
390
  'weight' => isset( $polyline['weight'] )
391
+ ? filter_var( $polyline['weight'], FILTER_VALIDATE_INT, array(
392
+ 'options' => array(
393
+ 'min_range' => 1,
394
+ 'default' => ''
395
+ )
396
+ ) )
397
  : '',
398
  'opacity' => isset( $polyline['opacity'] )
399
+ ? filter_var( $polyline['opacity'], FILTER_VALIDATE_FLOAT, array(
400
+ 'options' => array(
401
+ 'min_range' => 0,
402
+ 'max_range' => 1,
403
+ 'default' => ''
404
+ )
405
+ ) )
406
  : '',
407
  'color' => isset( $polyline['color'] )
408
+ ? filter_var( $polyline['color'], FILTER_VALIDATE_REGEXP, array(
409
+ 'options' => array(
410
+ 'regexp' => '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/',
411
+ 'default' => '#000000'
412
+ )
413
+ ) )
414
  : '#000000',
415
  );
416
  }
417
 
418
  function intergeo_filter_overlays_polyoverlay( $polygon ) {
419
+ if ( ! isset( $polygon['path'] ) ) {
420
  return false;
421
  }
 
422
  $path = array();
423
+ foreach ( explode( ';', $polygon['path'] ) as $point ) {
424
  if ( preg_match( '/^-?\d+\.?\d*,-?\d+\.?\d*$/', $point ) ) {
425
  $path[] = explode( ',', $point );
426
  }
427
  }
 
428
  if ( count( $path ) < 2 ) {
429
  return false;
430
  }
 
431
  $position = isset( $polygon['position'] ) ? strtoupper( trim( $polygon['position'] ) ) : 'CENTER';
432
 
433
  return array(
434
  'path' => $path,
435
  'position' => in_array( $position, array( 'CENTER', 'INSIDE', 'OUTSIDE' ) ) ? $position : 'CENTER',
436
+ 'weight' => isset( $polygon['weight'] ) ? filter_var( $polygon['weight'], FILTER_VALIDATE_INT, array(
437
+ 'options' => array(
438
+ 'min_range' => 1,
439
+ 'default' => ''
440
+ )
441
+ ) ) : '',
442
+ 'stroke_opacity' => isset( $polygon['stroke_opacity'] ) ? filter_var( $polygon['stroke_opacity'], FILTER_VALIDATE_FLOAT, array(
443
+ 'options' => array(
444
+ 'min_range' => 0,
445
+ 'max_range' => 1,
446
+ 'default' => ''
447
+ )
448
+ ) ) : '',
449
+ 'stroke_color' => isset( $polygon['stroke_color'] ) ? filter_var( $polygon['stroke_color'], FILTER_VALIDATE_REGEXP, array(
450
+ 'options' => array(
451
+ 'regexp' => '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/',
452
+ 'default' => '#000000'
453
+ )
454
+ ) ) : '#000000',
455
+ 'fill_opacity' => isset( $polygon['fill_opacity'] ) ? filter_var( $polygon['fill_opacity'], FILTER_VALIDATE_FLOAT, array(
456
+ 'options' => array(
457
+ 'min_range' => 0,
458
+ 'max_range' => 1,
459
+ 'default' => ''
460
+ )
461
+ ) ) : '',
462
+ 'fill_color' => isset( $polygon['fill_color'] ) ? filter_var( $polygon['fill_color'], FILTER_VALIDATE_REGEXP, array(
463
+ 'options' => array(
464
+ 'regexp' => '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/',
465
+ 'default' => '#000000'
466
+ )
467
+ ) ) : '#000000',
468
  );
469
  }
470
 
471
  function intergeo_filter_directions( $direction ) {
472
+ $to = isset( $direction['to'] ) ? trim( $direction['to'] ) : '';
473
  $from = isset( $direction['from'] ) ? trim( $direction['from'] ) : '';
 
474
  if ( empty( $to ) || empty( $from ) ) {
475
  return false;
476
  }
 
477
  $mode = isset( $direction['mode'] ) ? strtoupper( trim( $direction['mode'] ) ) : 'DRIVING';
478
 
479
  return array(
484
  }
485
 
486
  function intergeo_filter_input() {
487
+ $color_regexp = '/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/';
488
  $postion_filter = array( 'filter' => FILTER_CALLBACK, 'options' => 'intergeo_filter_position' );
489
+ $validationArray = array(
490
+ 'lat' => array(
491
+ 'filter' => FILTER_VALIDATE_FLOAT,
492
+ 'flags' => FILTER_REQUIRE_SCALAR,
493
+ 'options' => array( 'min_range' => - 90, 'max_range' => 90, 'default' => 48.1366069 )
494
+ ),
495
+ 'lng' => array(
496
+ 'filter' => FILTER_VALIDATE_FLOAT,
497
+ 'flags' => FILTER_REQUIRE_SCALAR,
498
+ 'options' => array( 'min_range' => - 180, 'max_range' => 180, 'default' => 11.577085099999977 )
499
+ ),
500
+ 'zoom' => array(
501
+ 'filter' => FILTER_VALIDATE_INT,
502
+ 'flags' => FILTER_REQUIRE_SCALAR,
503
+ 'options' => array( 'min_range' => 0, 'max_range' => 19, 'default' => 5 )
504
+ ),
505
  'address' => FILTER_SANITIZE_STRING,
506
+ 'map_mapTypeId' => array(
507
+ 'filter' => FILTER_CALLBACK,
508
+ 'options' => 'intergeo_filter_map_type'
509
+ ),
510
  'map_draggable' => FILTER_VALIDATE_BOOLEAN,
511
+ 'map_minZoom' => array(
512
+ 'filter' => FILTER_VALIDATE_INT,
513
+ 'flags' => FILTER_REQUIRE_SCALAR,
514
+ 'options' => array( 'min_range' => 0, 'max_range' => 19, 'default' => 0 )
515
+ ),
516
+ 'map_maxZoom' => array(
517
+ 'filter' => FILTER_VALIDATE_INT,
518
+ 'flags' => FILTER_REQUIRE_SCALAR,
519
+ 'options' => array( 'min_range' => 0, 'max_range' => 19, 'default' => 19 )
520
+ ),
521
  'map_scrollwheel' => FILTER_VALIDATE_BOOLEAN,
522
  'map_zoomControl' => FILTER_VALIDATE_BOOLEAN,
523
  'map_zoomControlOptions_position' => $postion_filter,
524
+ 'map_zoomControlOptions_style' => array(
525
+ 'filter' => FILTER_CALLBACK,
526
+ 'options' => 'intergeo_filter_zoom_style'
527
+ ),
528
  'map_panControl' => FILTER_VALIDATE_BOOLEAN,
529
  'map_panControlOptions_position' => $postion_filter,
530
  'map_scaleControl' => FILTER_VALIDATE_BOOLEAN,
531
  'map_scaleControlOptions_position' => $postion_filter,
532
  'map_mapTypeControl' => FILTER_VALIDATE_BOOLEAN,
533
  'map_mapTypeControlOptions_position' => $postion_filter,
534
+ 'map_mapTypeControlOptions_style' => array(
535
+ 'filter' => FILTER_CALLBACK,
536
+ 'options' => 'intergeo_filter_map_type_style'
537
+ ),
538
+ 'map_mapTypeControlOptions_mapTypeIds' => array(
539
+ 'filter' => FILTER_CALLBACK,
540
+ 'flags' => FILTER_REQUIRE_ARRAY,
541
+ 'options' => 'intergeo_filter_map_type'
542
+ ),
543
  'map_streetViewControl' => FILTER_VALIDATE_BOOLEAN,
544
  'map_streetViewControlOptions_position' => $postion_filter,
545
  'map_rotateControl' => FILTER_VALIDATE_BOOLEAN,
550
  'layer_bicycling' => FILTER_VALIDATE_BOOLEAN,
551
  'layer_cloud' => FILTER_VALIDATE_BOOLEAN,
552
  'layer_weather' => FILTER_VALIDATE_BOOLEAN,
553
+ 'weather_temperatureUnits' => array(
554
+ 'filter' => FILTER_CALLBACK,
555
+ 'options' => 'intergeo_filter_temperature_units'
556
+ ),
557
+ 'weather_windSpeedUnits' => array(
558
+ 'filter' => FILTER_CALLBACK,
559
+ 'options' => 'intergeo_filter_wind_speed_units'
560
+ ),
561
  'layer_panoramio' => FILTER_VALIDATE_BOOLEAN,
562
  'panoramio_tag' => FILTER_SANITIZE_STRING,
563
  'panoramio_userId' => FILTER_SANITIZE_STRING,
564
  'layer_adsense' => FILTER_VALIDATE_BOOLEAN,
565
+ 'adsense_format' => array(
566
+ 'filter' => FILTER_CALLBACK,
567
+ 'options' => 'intergeo_filter_adsense_format'
568
+ ),
569
  'adsense_position' => $postion_filter,
570
+ 'adsense_backgroundColor' => array(
571
+ 'filter' => FILTER_VALIDATE_REGEXP,
572
+ 'options' => array(
573
+ 'regexp' => $color_regexp,
574
+ 'default' => '#c4d4f3'
575
+ )
576
+ ),
577
+ 'adsense_borderColor' => array(
578
+ 'filter' => FILTER_VALIDATE_REGEXP,
579
+ 'options' => array(
580
+ 'regexp' => $color_regexp,
581
+ 'default' => '#e5ecf9'
582
+ )
583
+ ),
584
+ 'adsense_titleColor' => array(
585
+ 'filter' => FILTER_VALIDATE_REGEXP,
586
+ 'options' => array(
587
+ 'regexp' => $color_regexp,
588
+ 'default' => '#0000cc'
589
+ )
590
+ ),
591
+ 'adsense_textColor' => array(
592
+ 'filter' => FILTER_VALIDATE_REGEXP,
593
+ 'options' => array(
594
+ 'regexp' => $color_regexp,
595
+ 'default' => '#000000'
596
+ )
597
+ ),
598
+ 'adsense_urlColor' => array(
599
+ 'filter' => FILTER_VALIDATE_REGEXP,
600
+ 'options' => array(
601
+ 'regexp' => $color_regexp,
602
+ 'default' => '#009900'
603
+ )
604
+ ),
605
  'container_width' => FILTER_SANITIZE_STRING,
606
  'container_height' => FILTER_SANITIZE_STRING,
607
  'container_styles' => FILTER_SANITIZE_STRING,
608
  'styles_type' => FILTER_SANITIZE_STRING,
609
+ 'styles_custom' => array(
610
+ 'filter' => FILTER_CALLBACK,
611
+ 'options' => 'intergeo_filter_custom_style'
612
+ ),
613
  'overlays_marker' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
614
  'overlays_polyline' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
615
  'overlays_polygon' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
617
  'overlays_circle' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
618
  'directions' => array( 'filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_ARRAY ),
619
  );
620
+ $defaults = array(
 
621
  'lat' => 48.1366069,
622
  'lng' => 11.577085099999977,
623
  'zoom' => 5,
673
  'overlays_circle' => array(),
674
  'directions' => array(),
675
  );
676
+ // Added by Ash/Upwork
677
+ if ( defined( 'IntergeoMaps_Pro' ) ) {
678
+ global $IntergeoMaps_Pro;
679
+ $IntergeoMaps_Pro->addValidations( $validationArray, $defaults );
680
+ }
681
+ // Added by Ash/Upwork
 
 
682
  $options = filter_input_array( INPUT_POST, $validationArray );
 
683
  $results = array();
684
  foreach ( $options as $key => $value ) {
685
  if ( array_key_exists( $key, $defaults ) ) {
686
+ $equals = $defaults[ $key ] == $value;
687
  if ( is_array( $value ) ) {
688
+ $equals = ( count( $value ) == count( $defaults[ $key ] ) ) && ( count( array_diff( (array) $defaults[ $key ], $value ) ) == 0 );
689
  }
690
+ if ( ! $equals ) {
691
+ $results[ $key ] = $value;
 
692
  }
693
  }
694
  }
695
+ if ( ! empty( $results['overlays_marker'] ) ) {
696
+ $results['overlays_marker'] = array_filter( array_map( 'intergeo_filter_overlays_marker', $results['overlays_marker'] ) );
 
697
  }
698
+ if ( ! empty( $results['overlays_polyline'] ) ) {
699
+ $results['overlays_polyline'] = array_filter( array_map( 'intergeo_filter_overlays_polyline', $results['overlays_polyline'] ) );
 
700
  }
701
+ if ( ! empty( $results['directions'] ) ) {
702
+ $results['directions'] = array_filter( array_map( 'intergeo_filter_directions', $results['directions'] ) );
 
703
  }
 
704
  foreach ( array( 'polygon', 'rectangle', 'circle' ) as $overlay ) {
705
  $overlay = 'overlays_' . $overlay;
706
+ if ( ! empty( $results[ $overlay ] ) ) {
707
+ $results[ $overlay ] = array_filter( array_map( 'intergeo_filter_overlays_polyoverlay', $results[ $overlay ] ) );
708
  }
709
  }
710
+ // Added by Ash/Upwork
711
+ if ( defined( 'IntergeoMaps_Pro' ) ) {
712
+ global $IntergeoMaps_Pro;
713
+ $IntergeoMaps_Pro->processResults( $results );
714
+ }
715
 
716
+ // Added by Ash/Upwork
 
 
 
 
 
 
717
  return $results;
718
  }
719
 
720
  // </editor-fold>
 
721
  // <editor-fold defaultstate="collapsed" desc="saving">
 
722
  function intergeo_save_map( $map_id = false, $post_id = false ) {
723
+ $options = array();
724
  $array_ptr = &$options;
725
  foreach ( intergeo_filter_input() as $key => $value ) {
726
+ if ( ! is_null( $value ) ) {
727
+ $keys = explode( '_', $key );
728
  $last_key = array_pop( $keys );
 
729
  while ( $arr_key = array_shift( $keys ) ) {
730
+ if ( ! array_key_exists( $arr_key, $array_ptr ) ) {
731
+ $array_ptr[ $arr_key ] = array();
732
  }
733
+ $array_ptr = &$array_ptr[ $arr_key ];
734
  }
735
+ $array_ptr[ $last_key ] = $value;
736
+ $array_ptr = &$options;
 
737
  }
738
  }
 
739
  $address = '';
740
+ if ( ! empty( $options['address'] ) ) {
741
  $address = $options['address'] = trim( $options['address'] );
742
  }
 
743
  $args = array(
744
  'post_type' => INTERGEO_PLUGIN_NAME,
745
  'post_content' => addcslashes( json_encode( $options ), '\\' ),
746
  'post_status' => 'private',
747
  );
 
748
  $update = false;
749
  if ( $map_id ) {
750
  $post = get_post( intergeo_decode( $map_id ) );
751
  if ( $post && $post->post_type == INTERGEO_PLUGIN_NAME ) {
752
+ $update = true;
753
  $args['ID'] = $post->ID;
754
  }
755
  }
 
756
  $id = wp_insert_post( $args );
757
+ if ( ! empty( $id ) && ! is_wp_error( $id ) ) {
758
+ if ( ! $post_id ) {
 
759
  intergeo_set_info( $update
760
  ? __( 'The map has been updated successfully.', INTERGEO_PLUGIN_NAME )
761
  : __( 'The map has been created successfully.', INTERGEO_PLUGIN_NAME )
762
  );
763
  }
764
+
765
  return sprintf( '[intergeo id="%s"]%s[/intergeo]', intergeo_encode( $id ), $address );
766
  }
767
+ if ( ! $post_id ) {
 
768
  intergeo_set_error( $update
769
  ? __( 'The map updating failed.', INTERGEO_PLUGIN_NAME )
770
  : __( 'The map creation failed.', INTERGEO_PLUGIN_NAME )
775
  }
776
 
777
  // </editor-fold>
 
778
  // <editor-fold defaultstate="collapsed" desc="ajax stuff">
 
779
  add_action( 'wp_ajax_intergeo_show_map_center', 'intergeo_show_map_center_changed' );
780
  function intergeo_show_map_center_changed() {
781
  $nonce = filter_input( INPUT_POST, 'nonce' );
782
  if ( wp_verify_nonce( $nonce, 'editor_popup' . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ) ) {
783
+ update_option( 'intergeo_show_map_center', (int) filter_input( INPUT_POST, 'status', FILTER_VALIDATE_BOOLEAN ) );
784
  }
785
  }
786
 
787
  // </editor-fold>
 
788
  // </editor-fold>
 
789
  // <editor-fold defaultstate="collapsed" desc="shortcode">
 
790
  add_filter( 'widget_text', 'do_shortcode' );
791
  add_filter( 'term_description', 'do_shortcode' );
 
792
  add_shortcode( INTERGEO_PLUGIN_NAME, 'intergeo_shortcode' );
793
  function intergeo_shortcode( $attrs, $address = '' ) {
794
+ do_action( "intergeo_shortcode_render_before", $attrs );
 
795
  $args = shortcode_atts( array(
796
  'id' => false,
797
  'hook' => false,
800
  'style' => false,
801
  'zoom' => false,
802
  ), $attrs );
 
803
  $address = trim( $address );
804
  if ( empty( $args['id'] ) && empty( $address ) ) {
805
  return '';
806
  }
 
807
  $json = array();
808
+ if ( ! empty( $args['id'] ) ) {
809
  $post = get_post( intergeo_decode( $args['id'] ) );
810
+ if ( ! $post || $post->post_type != INTERGEO_PLUGIN_NAME ) {
811
  return '';
812
  }
 
813
  $json = json_decode( $post->post_content, true );
814
  } else {
815
+ $args['id'] = intergeo_encode( rand( 0, 100 ) . rand( 0, 10000 ) );
816
  $json['zoom'] = intval( $args['zoom'] ) ? intval( $args['zoom'] ) : 15;
817
  }
818
+ if ( ! empty( $address ) ) {
 
819
  $json['address'] = $address;
820
  }
 
821
  if ( trim( $args['hook'] ) != '' ) {
822
  $json = apply_filters( $args['hook'], $json );
823
  }
 
824
  wp_enqueue_style( 'intergeo-frontend' );
825
  intergeo_enqueue_google_maps_script( intergeo_check_libraries( $json ) );
826
+ if ( ! wp_script_is( 'intergeo-rendering' ) ) {
827
+ wp_enqueue_script( 'intergeo-rendering', INTERGEO_ABSURL . 'js/rendering.js', array(
828
+ 'jquery',
829
+ 'google-maps-v3'
830
+ ), INTERGEO_VERSION );
831
  wp_localize_script( 'intergeo-rendering', 'intergeo_options', array(
832
  'adsense' => array( 'publisher_id' => get_option( 'intergeo_adsense_publisher_id' ) )
833
  ) );
834
  }
 
835
  $container = array();
836
  if ( isset( $json['container'] ) ) {
837
  $container = $json['container'];
838
  unset( $json['container'] );
839
  }
840
+ $width = ! empty( $container['width'] ) ? esc_attr( $container['width'] ) : '100%';
 
841
  if ( trim( $args['width'] ) != '' ) {
842
  $width = $args['width'];
843
  }
844
  if ( is_numeric( $width ) ) {
845
  $width .= 'px';
846
  }
847
+ $height = ! empty( $container['height'] ) ? esc_attr( $container['height'] ) : '300px';
 
848
  if ( trim( $args['height'] ) != '' ) {
849
  $height = $args['height'];
850
  }
851
  if ( is_numeric( $height ) ) {
852
  $height .= 'px';
853
  }
854
+ $styles = ! empty( $container['styles'] ) ? esc_attr( $container['styles'] ) : '';
 
855
  if ( trim( $args['style'] ) != '' ) {
856
  $styles = $args['style'];
857
  }
875
  }
876
 
877
  // </editor-fold>
 
878
  // <editor-fold defaultstate="collapsed" desc="library">
 
879
  add_action( 'admin_menu', 'intergeo_admin_menu' );
880
  function intergeo_admin_menu() {
881
+ add_options_page( __( 'Intergeo Maps Library', INTERGEO_PLUGIN_NAME ), __( 'Intergeo Maps', INTERGEO_PLUGIN_NAME ), 'edit_posts', INTERGEO_PLUGIN_NAME, 'intergeo_settings_init' );
882
+ $page = add_submenu_page( 'upload.php', __( 'Intergeo Maps Library', INTERGEO_PLUGIN_NAME ), __( 'Intergeo Maps', INTERGEO_PLUGIN_NAME ), 'edit_posts', INTERGEO_PLUGIN_NAME, 'intergeo_library' );
883
  if ( $page ) {
884
  add_action( "load-{$page}", 'intergeo_library_init' );
885
  }
888
  function intergeo_library_init() {
889
  wp_enqueue_style( 'intergeo_library', INTERGEO_ABSURL . 'css/library.css', array(), INTERGEO_VERSION );
890
  wp_enqueue_media();
 
891
  $screen = get_current_screen();
 
892
  $screen->add_help_tab( array(
893
  'title' => esc_html__( 'Overview', INTERGEO_PLUGIN_NAME ),
894
  'id' => 'overview',
898
  esc_html__( "If you want to delete a map, click on the trash icon in the right bottom corner of a map and confirm your action. Pay attention that whole information about the map will be removed from the system, but all shortcodes will be left where you embed it. However these deprecated shortcodes won't be rendered anymore, so you don't have to worry about it while the plugin is enabled.", INTERGEO_PLUGIN_NAME ),
899
  ) ) ),
900
  ) );
 
901
  $screen->add_help_tab( array(
902
  'title' => esc_html__( 'Shortcodes', INTERGEO_PLUGIN_NAME ),
903
  'id' => 'shortcodes',
912
  if ( filter_input( INPUT_GET, 'do' ) == 'delete' ) {
913
  intergeo_library_delete();
914
  }
 
915
  $query = new WP_Query( array(
916
  'orderby' => 'ID',
917
  'order' => 'DESC',
918
  'post_type' => INTERGEO_PLUGIN_NAME,
919
  'posts_per_page' => 9,
920
+ 'paged' => filter_input( INPUT_GET, 'pagenum', FILTER_VALIDATE_INT, array(
921
+ 'options' => array(
922
+ 'min_range' => 1,
923
+ 'default' => 1,
924
+ )
925
+ ) ),
926
  ) );
927
+ $libraries = array();
 
928
  $pagination = paginate_links( array(
929
  'base' => add_query_arg( array(
930
  'pagenum' => '%#%',
935
  'total' => $query->max_num_pages,
936
  'type' => 'array',
937
  ) );
 
938
  require INTERGEO_ABSPATH . '/templates/library/list.php';
 
939
  intergeo_enqueue_google_maps_script( $libraries );
940
+ wp_enqueue_script( 'intergeo-rendering', INTERGEO_ABSURL . 'js/rendering.js', array(
941
+ 'jquery',
942
+ 'google-maps-v3'
943
+ ), INTERGEO_VERSION );
944
+ wp_enqueue_script( 'intergeo-library', INTERGEO_ABSURL . 'js/library.js', array(
945
+ 'intergeo-rendering',
946
+ 'media-views'
947
+ ), INTERGEO_VERSION );
948
  wp_localize_script( 'intergeo-rendering', 'intergeo_options', array(
949
  'adsense' => array( 'publisher_id' => get_option( 'intergeo_adsense_publisher_id' ) )
950
  ) );
951
+ // Added by Ash/Upwork
952
+ if ( defined( 'IntergeoMaps_Pro' ) ) {
953
+ global $IntergeoMaps_Pro;
954
+ $IntergeoMaps_Pro->enqueueScriptsAndStyles( array( 'intergeo-rendering' ) );
955
+ }
956
+ // Added by Ash/Upwork
 
 
957
  }
958
 
959
  function intergeo_library_delete() {
960
+ if ( ! current_user_can( 'delete_posts' ) ) {
961
  return;
962
  }
 
963
  $id = intergeo_decode( trim( filter_input( INPUT_GET, 'map' ) ) );
964
+ if ( ! $id ) {
965
  return;
966
  }
 
967
  $post = get_post( $id );
968
  if ( wp_verify_nonce( filter_input( INPUT_GET, 'nonce' ), $id . filter_input( INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP ) ) && $post->post_type == INTERGEO_PLUGIN_NAME ) {
969
  if ( wp_delete_post( $id, true ) ) {
970
  intergeo_set_info( __( 'The map was deleted successfully.', INTERGEO_PLUGIN_NAME ) );
971
  }
972
  }
 
973
  if ( filter_input( INPUT_GET, 'noheader', FILTER_VALIDATE_BOOLEAN ) ) {
974
  wp_redirect( add_query_arg( 'page', INTERGEO_PLUGIN_NAME, admin_url( 'upload.php' ) ) );
975
  exit;
977
  }
978
 
979
  // </editor-fold>
 
980
  // <editor-fold defaultstate="collapsed" desc="messaging functions">
 
981
  function intergeo_set_message( $message, $is_normal, $user_id = false ) {
982
  $messages = get_option( 'intergeo_messages', array() );
983
  if ( $user_id === false ) {
984
  $user_id = get_current_user_id();
985
  }
986
+ if ( ! isset( $messages[ $user_id ] ) ) {
987
+ $messages[ $user_id ] = array();
 
988
  }
989
+ $messages[ $user_id ][] = array( $message, $is_normal );
 
990
  update_option( 'intergeo_messages', $messages );
991
  }
992
 
1001
  add_action( 'admin_notices', 'intergeo_print_messages' );
1002
  function intergeo_print_messages() {
1003
  global $pagenow;
1004
+ // Added by Ash/Upwork
1005
+ intergeo_show_nag();
1006
+ // Added by Ash/Upwork
 
 
1007
  if ( $pagenow != 'upload.php' ) {
1008
  return;
1009
  }
 
1010
  $messages = get_option( 'intergeo_messages', array() );
1011
+ $user_id = get_current_user_id();
1012
+ if ( ! isset( $messages[ $user_id ] ) ) {
 
1013
  return;
1014
  }
1015
+ foreach ( $messages[ $user_id ] as $message ) {
1016
+ printf( $message[1] ? '<div class="updated"><p>%s</p></div>' : '<div class="error"><p>%s</p></div>', __( $message[0], INTERGEO_PLUGIN_NAME ) );
 
1017
  }
1018
+ $messages[ $user_id ] = array();
 
1019
  update_option( 'intergeo_messages', $messages );
1020
  }
1021
 
1022
  // Added by Ash/Upwork
1023
  add_action( 'admin_enqueue_scripts', 'intergeo_enqueue_scripts' );
1024
+ function intergeo_enqueue_scripts() {
 
1025
  wp_enqueue_script( 'intergeo-misc', INTERGEO_ABSURL . 'js/misc.js', array( 'jquery' ), INTERGEO_VERSION );
1026
  wp_localize_script( 'intergeo-misc', 'intergeo_misc', array(
1027
+ "ajax" => array(
1028
+ "action" => "intergeo_dismiss_nag",
1029
+ "themeisle_feedback_action" => "themeisle_feedback_dismiss_nag",
1030
+ "themeisle_feedback_slug" => INTERGEO_PLUGIN_NAME,
1031
+ "nonce" => wp_create_nonce( INTERGEO_PLUGIN_NAME . INTERGEO_VERSION ),
1032
+ )
1033
+ ) );
1034
  }
1035
 
1036
  add_action( 'wp_ajax_intergeo_dismiss_nag', 'intergeo_dismiss_nag' );
1037
  function intergeo_dismiss_nag() {
1038
+ check_ajax_referer( INTERGEO_PLUGIN_NAME . INTERGEO_VERSION, "security" );
1039
+ update_option( "intergeo_nag_dismissed", true );
1040
+ wp_die();
 
1041
  }
1042
 
1043
+ function intergeo_show_nag() {
 
1044
  global $pagenow;
1045
+ if ( $pagenow == 'plugins.php' && ! get_option( "intergeo_nag_dismissed", false ) ) {
1046
+ include_once INTERGEO_ABSPATH . '/templates/nag.php';
1047
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
1048
  }
1049
 
1050
+ add_action( "admin_init", "intergeo_init_triggered_feedback" );
1051
+ function intergeo_init_triggered_feedback() {
1052
+ /*
1053
+ array(
1054
+ "name_of_trigger_filter_that_returns_true" => array(
1055
+ "behaviour" => array(
1056
+ "show_when" => strtotime compliant time,
1057
+ "show_where" => "name_of_filter"
1058
+ ),
1059
+ "notifications" => array(
1060
+ array(
1061
+ "description" => mandatory, dont show the notification if this is empty,
1062
+ "button_ok_link" => mandatory, dont show the notification if this is empty,
1063
+ "button_ok_text" => mandatory, dont show the notification if thihs is empty,
1064
+ "button_hide_text" => optional, default value is 'Hide',
1065
+ "button_done_text" => optional, default value is "I've already done it"
1066
+ ),
1067
+ )
1068
+ )
1069
+ )
1070
+ */
1071
+ $feedback_config = array(
1072
+ "intergeo_created_3_maps" => array(
 
1073
  "behaviour" => array(
1074
+ "show_when" => "+6 hours",
1075
+ "show_where" => "intergeo_triggered_feedback_show_notification_filter"
1076
  ),
1077
  "notifications" => array(
1078
  array(
1079
+ "description" => "Hey, looks like you’re doing a great job creating maps with the Intergeo plugin. Can you share your experience with other people who are using it ? ",
1080
+ "button_ok_link" => "http://bit.ly/2cNQyMz",
1081
+ "button_ok_text" => " Sure, I can do it ",
1082
+ "button_hide_text" => "Not now ",
1083
+ "button_done_text" => "Already did it",
1084
+ ),
1085
+ array(
1086
+ "description" => "Hey, looks like you’re doing a great job creating maps with the Intergeo plugin. Can you share your experience with other people who are using it ?",
1087
+ "button_ok_link" => "http://bit.ly/2cE92Qp",
1088
+ "button_ok_text" => "Yes, cool",
1089
+ "button_hide_text" => "Not right now",
1090
+ "button_done_text" => "Done it",
1091
  ),
1092
  array(
1093
+ "description" => "Looks like you rock using the Intergeo plugin. Would you like to share your experience with others?",
1094
+ "button_ok_link" => "http://bit.ly/2cFhgv0",
1095
+ "button_ok_text" => "Yes, sure",
1096
+ "button_hide_text" => "Not really",
1097
+ "button_done_text" => "Already did",
1098
+ ),
1099
+ array(
1100
+ "description" => "You’re quite productive using the Intergeo plugin. Would you like to share your experience with the rest of the users?",
1101
+ "button_ok_link" => "http://bit.ly/2cVFijo",
1102
+ "button_ok_text" => "Yes please",
1103
+ "button_hide_text" => "Nope ",
1104
+ "button_done_text" => "I've done it already",
1105
  ),
1106
  )
1107
  ),
1108
+ "intergeo_plugin_1week_old" => array(
1109
  "behaviour" => array(
1110
+ "show_when" => "+6 hours",
1111
+ "show_where" => "intergeo_triggered_feedback_show_notification_filter"
1112
  ),
1113
  "notifications" => array(
1114
  array(
1115
+ "description" => "You’ve been using Intergeo plugin for over 1 week. Would you like to leave a review about your experience so far?",
1116
+ "button_ok_link" => "http://bit.ly/2d7Gq54",
1117
+ "button_ok_text" => "Yep ",
1118
+ "button_hide_text" => "Nope ",
1119
+ "button_done_text" => " Already did",
1120
+ ),
1121
+ array(
1122
+ "description" => "How is Intergeo plugin working for you? Would you mind leaving a review for others to see how it works?",
1123
+ "button_ok_link" => "http://bit.ly/2cVFrDs",
1124
+ "button_ok_text" => "Sure ",
1125
+ "button_hide_text" => " Not today ",
1126
+ "button_done_text" => " Already did ",
1127
+ ),
1128
+ array(
1129
+ "description" => "We would love to get your feedback about using the Intergeo plugin so far. Can you share your thoughts with us in order to improve the future versions?",
1130
+ "button_ok_link" => "http://bit.ly/2bkAJuE",
1131
+ "button_ok_text" => "Okay ",
1132
+ "button_hide_text" => " Not now ",
1133
+ "button_done_text" => " I already did ",
1134
  ),
1135
  )
1136
  ),
1137
+ "intergeo_map_frontend_display" => array(
1138
  "behaviour" => array(
1139
+ "show_when" => "+6 hours",
1140
+ "show_where" => "intergeo_triggered_feedback_show_notification_filter"
1141
  ),
1142
  "notifications" => array(
1143
  array(
1144
+ "description" => "Hey, it seems you are already using the Intergeo maps shortcode in your site and your users are enjoying it. How about rating this plugin, it would help others learn about it.",
1145
+ "button_ok_link" => "http://bit.ly/2cE9sGr",
1146
+ "button_ok_text" => "Sure ",
1147
+ "button_hide_text" => "Not now",
1148
+ "button_done_text" => "I've already done it",
1149
+ ),
1150
+ array(
1151
+ "description" => "It seems you are successfully using the Intergeo plugin and your users are enjoying it. Would you like to share your experience with other site owners?",
1152
+ "button_ok_link" => "http://bit.ly/2czU8st",
1153
+ "button_ok_text" => "Sure ",
1154
+ "button_hide_text" => "Not now",
1155
+ "button_done_text" => "I've already done it",
1156
+ ),
1157
+ array(
1158
+ "description" => "Looks like you have successfully published your first map with the Intergeo plugin. Would you like to rate your experience with the plugin?",
1159
+ "button_ok_link" => "http://bit.ly/2d1djQE",
1160
+ "button_ok_text" => "Sure ",
1161
+ "button_hide_text" => "Not now",
1162
+ "button_done_text" => "I've already done it",
1163
  ),
1164
  )
1165
  ),
1166
  );
 
 
1167
  // add the configuration with the slug and trigger the generic action
1168
+ do_action( "themeisle_triggered_feedback_add_config", $feedback_config, INTERGEO_PLUGIN_NAME );
1169
  }
1170
 
1171
+ add_action( "themeisle_triggered_feedback_add_config", "themeisle_triggered_feedback_add_config", 10, 2 );
1172
+ function themeisle_triggered_feedback_add_config( $config, $slug ) {
1173
+ global $pagenow;
1174
+ $trigger_time = $slug . "-triggered-feedback-time";
1175
+ $trigger_type = $slug . "-triggered-feedback-type";
1176
+ $fuse_lit = get_option( $trigger_time, false );
1177
+ if ( $fuse_lit !== false ) {
1178
+ if ( ctype_digit( $fuse_lit ) && $fuse_lit != - 1 && time() >= $fuse_lit ) {
1179
+ // it is time to explode
1180
+ $trigger = get_option( $trigger_type );
1181
+ $attributes = $config[ $trigger ];
1182
+ if ( apply_filters( $attributes["behaviour"]["show_where"], $pagenow ) === true ) {
1183
+ $notification = $attributes["notifications"][ rand( 0, count( $attributes["notifications"] ) - 1 ) ];
1184
+ do_action( "themeisle_triggered_feedback_show_notification", $notification, $slug );
1185
+ }
1186
+ }
1187
+ } else {
1188
+ //if multiple triggers are available, choose a random one
1189
+ $triggers_available = array();
1190
+ foreach ( $config as $trigger => $attributes ) {
1191
+ $pull_trigger = apply_filters( $trigger, false );
1192
+ if ( $pull_trigger === true ) {
1193
+ // light fuse
1194
+ $triggers_available[] = $trigger;
1195
+ }
1196
+ }
1197
+ if( ! empty ($triggers_available) ){
1198
+ $trigger_fuse = $triggers_available[ rand(0, ( count($triggers_available) - 1 ) ) ];
1199
+ update_option( $trigger_time, strtotime( $config[$trigger_fuse]["behaviour"]["show_when"] ) );
1200
+ update_option( $trigger_type, $trigger );
1201
+ }
1202
+ }
1203
  }
1204
 
1205
  global $themeisle_notification;
1206
+ add_action( "themeisle_triggered_feedback_show_notification", "themeisle_triggered_feedback_show_notification", 10, 2 );
1207
+ function themeisle_triggered_feedback_show_notification( $notification, $slug ) {
 
 
1208
  global $themeisle_notification;
1209
+ if (
1210
+ ! isset( $notification["description"] ) || empty( $notification["description"] )
1211
+ || ! isset( $notification["button_ok_link"] ) || empty( $notification["button_ok_link"] )
1212
+ || ! isset( $notification["button_ok_text"] ) || empty( $notification["button_ok_text"] )
1213
+ ) {
1214
+ return;
1215
+ }
1216
+ if ( ! isset( $notification["button_hide_text"] ) || empty( $notification["button_hide_text"] ) ) {
1217
+ $notification["button_hide_text"] = __( "Hide", INTERGEO_PLUGIN_NAME );
1218
+ }
1219
+ if ( ! isset( $notification["button_done_text"] ) || empty( $notification["button_done_text"] ) ) {
1220
+ $notification["button_done_text"] = __( "I've already done it", INTERGEO_PLUGIN_NAME );
1221
+ }
1222
+ $themeisle_notification = '
 
1223
  <style type="text/css">.ti-feedback-notice .themeisle-feedback-click { margin-left:5px; }</style><div class="updated activated notice is-dismissible themeisle_triggered_feedback_nag">'
1224
+ . '<p>' . $notification["description"] . '</p>'
1225
+ . '<p class="ti-feedback-notice"><a href="' . $notification["button_ok_link"] . '" target="_new"><input type="button" class="button button-secondary themeisle-feedback-click" value="' . $notification["button_ok_text"] . '"></a>'
1226
+ . '<input type="button" class="button button-secondary themeisle-feedback-click" value="' . $notification["button_hide_text"] . '">'
1227
+ . '<input type="button" class="button button-secondary themeisle-feedback-click" value="' . $notification["button_done_text"] . '">'
1228
+ . '</p></div>';
1229
+ add_action( "admin_notices", "themeisle_triggered_feedback_show_admin_notice" );
 
1230
  }
1231
 
1232
+ function themeisle_triggered_feedback_show_admin_notice() {
1233
+ global $themeisle_notification;
1234
+ echo $themeisle_notification;
 
 
1235
  }
1236
 
1237
  add_action( 'wp_ajax_themeisle_feedback_dismiss_nag', 'themeisle_feedback_dismiss_nag' );
1238
  function themeisle_feedback_dismiss_nag() {
1239
+ check_ajax_referer( INTERGEO_PLUGIN_NAME . INTERGEO_VERSION, "security" );
1240
+ update_option( sanitize_text_field( $_REQUEST["slug"] ) . "-triggered-feedback-time", - 1 );
1241
+ wp_die();
1242
+ }
1243
 
1244
+ add_filter( "intergeo_triggered_feedback_show_notification_filter", "intergeo_triggered_feedback_show_notification_filter" );
1245
+ function intergeo_triggered_feedback_show_notification_filter( $pagenow ) {
1246
+ return ( $pagenow == 'upload.php' || $pagenow == 'options-general.php' ) && isset( $_GET["page"] ) && $_GET["page"] == INTERGEO_PLUGIN_NAME;
1247
  }
1248
 
1249
+
1250
+
1251
+
1252
+
1253
+ register_activation_hook( __FILE__, "intergeo_activate" );
1254
+ function intergeo_activate() {
1255
+ if ( get_option( "intergeo-activation-date", false ) === false ) {
1256
+ update_option( "intergeo-activation-date", time() );
1257
+ }
1258
  }
1259
 
1260
+ ///events triggered for feedback
1261
+ add_filter( "intergeo_created_3_maps", "intergeo_created_3_maps" );
1262
+ function intergeo_created_3_maps() {
1263
+ $maps = get_posts( array(
1264
+ 'post_type' => INTERGEO_PLUGIN_NAME,
1265
+ 'posts_per_page' => 4,
1266
+ 'post_status' => 'private',
1267
+ ) );
1268
 
1269
+ return count( $maps ) > 3;
1270
 
1271
  }
1272
 
1273
+ add_filter( "intergeo_plugin_1week_old", "intergeo_plugin_1week_old" );
1274
+ function intergeo_plugin_1week_old() {
1275
+ $activation_date = get_option( "intergeo-activation-date", false );
1276
+ if ( $activation_date !== false ) {
1277
+ return ( ( time() - $activation_date ) >= 7 * 24 * 60 * 60 );
1278
+ }
1279
+
1280
+ return false;
1281
  }
1282
 
1283
+ add_filter( "intergeo_map_frontend_display", "intergeo_map_frontend_display" );
1284
+ function intergeo_map_frontend_display() {
1285
+ return get_option( "intergeo-frontend-used", 0 ) > 0;
 
1286
  }
1287
 
1288
+ add_action( "intergeo_shortcode_render_before", "intergeo_shortcode_render_before" );
1289
+ function intergeo_shortcode_render_before( $atts ) {
1290
+ // set a flag if the map has been shown on the front end
1291
+ if ( ! is_admin() && get_option( "intergeo-frontend-used", 0 ) != 1 ) {
1292
+ update_option( "intergeo-frontend-used", 1 );
1293
+ }
 
1294
  }
 
1295
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,themeisle,Madalin_ThemeIsle
3
  Tags: directions, easy map, google, google map, google map plugin, google maps, latitude, location, longitude, map, map directions, map markers, map plugin, map widget, maps, marker, polygons, polylines, routes, store locator, streetview, wp google map, wp google maps, wp maps,plugin,admin,widget,shortcode,google maps, maps, map, map markers, google, google map, maps api, wp maps, wp google maps, easy map, embed, marker, placemark, icon, geocode, shortcode, custom post type, multisite, marker clustering
4
  Requires at least: 3.5
5
- Tested up to: 4.6
6
  Stable tag: trunk
7
  License: GPL v2.0 or later
8
  License URI: http://www.opensource.org/licenses/gpl-license.php
@@ -134,6 +134,13 @@ function filter_intergeo_map_settings( $options ) {
134
 
135
  == Changelog ==
136
 
 
 
 
 
 
 
 
137
  = 1.1.0 =
138
 
139
  * Updated instructions for adding Google Maps Api key
2
  Contributors: codeinwp,marius2012,marius_codeinwp,hardeepasrani,themeisle,Madalin_ThemeIsle
3
  Tags: directions, easy map, google, google map, google map plugin, google maps, latitude, location, longitude, map, map directions, map markers, map plugin, map widget, maps, marker, polygons, polylines, routes, store locator, streetview, wp google map, wp google maps, wp maps,plugin,admin,widget,shortcode,google maps, maps, map, map markers, google, google map, maps api, wp maps, wp google maps, easy map, embed, marker, placemark, icon, geocode, shortcode, custom post type, multisite, marker clustering
4
  Requires at least: 3.5
5
+ Tested up to: 4.6.1
6
  Stable tag: trunk
7
  License: GPL v2.0 or later
8
  License URI: http://www.opensource.org/licenses/gpl-license.php
134
 
135
  == Changelog ==
136
 
137
+ = 1.1.5 =
138
+
139
+ * Fixed compatibility with old version of PHP ( < 5.2 )
140
+ * Fixed issue with marker text using rich editor
141
+ * Fixed issue with https websites which were loading content over http
142
+
143
+
144
  = 1.1.0 =
145
 
146
  * Updated instructions for adding Google Maps Api key
templates/iframe/popups.php CHANGED
@@ -44,21 +44,21 @@
44
  <tr>
45
  <td>
46
  <select name="intergeo_tlbr_marker_icon_select" id="intergeo_tlbr_marker_icon_select" class="intergeo_tlbr_marker_icon_select intergeo_tlbr_cntrl_txt">
47
- <option value="http://maps.google.com/mapfiles/ms/icons/red-dot.png" data-imagesrc="http://maps.google.com/mapfiles/ms/icons/red-dot.png"><?php _e("Default", INTERGEO_PLUGIN_NAME);?></option>
48
- <option value="http://maps.google.com/mapfiles/ms/icons/blue-dot.png" data-imagesrc="http://maps.google.com/mapfiles/ms/icons/blue-dot.png"><?php _e("Blue", INTERGEO_PLUGIN_NAME);?></option>
49
  <option value="custom"><?php _e("Custom", INTERGEO_PLUGIN_NAME);?></option>
50
  </select>
51
  <input type="text" style="display: none"
52
  class="intergeo_tlbr_marker_icon intergeo_tlbr_cntrl_txt"
53
  placeholder="<?php esc_attr_e( 'Enter icon URL', INTERGEO_PLUGIN_NAME ) ?>"
54
  title="<?php esc_attr_e( 'Enter icon URL', INTERGEO_PLUGIN_NAME ) ?>"
55
- value="http://maps.google.com/mapfiles/ms/icons/red-dot.png"
56
  >
57
  </td>
58
  </tr>
59
  <tr>
60
  <td>
61
- <?php wp_editor("", "intergeo-marker-editor", array("media_buttons" => false, "textarea_rows" => 5, "teeny"=> true, "editor_class" => "intergeo_tlbr_marker_info intergeo_tlbr_cntrl_txt"));?>
62
  </td>
63
  </tr>
64
  <tr>
44
  <tr>
45
  <td>
46
  <select name="intergeo_tlbr_marker_icon_select" id="intergeo_tlbr_marker_icon_select" class="intergeo_tlbr_marker_icon_select intergeo_tlbr_cntrl_txt">
47
+ <option value="//maps.google.com/mapfiles/ms/icons/red-dot.png" data-imagesrc="//maps.google.com/mapfiles/ms/icons/red-dot.png"><?php _e("Default", INTERGEO_PLUGIN_NAME);?></option>
48
+ <option value="//maps.google.com/mapfiles/ms/icons/blue-dot.png" data-imagesrc="//maps.google.com/mapfiles/ms/icons/blue-dot.png"><?php _e("Blue", INTERGEO_PLUGIN_NAME);?></option>
49
  <option value="custom"><?php _e("Custom", INTERGEO_PLUGIN_NAME);?></option>
50
  </select>
51
  <input type="text" style="display: none"
52
  class="intergeo_tlbr_marker_icon intergeo_tlbr_cntrl_txt"
53
  placeholder="<?php esc_attr_e( 'Enter icon URL', INTERGEO_PLUGIN_NAME ) ?>"
54
  title="<?php esc_attr_e( 'Enter icon URL', INTERGEO_PLUGIN_NAME ) ?>"
55
+ value="//maps.google.com/mapfiles/ms/icons/red-dot.png"
56
  >
57
  </td>
58
  </tr>
59
  <tr>
60
  <td>
61
+ <?php wp_editor("", "intergeo-marker-editor", array("media_buttons" => false, "textarea_rows" => 5, "teeny"=> true, "editor_class" => "intergeo_tlbr_marker_info intergeo_tlbr_cntrl_txt", "quicktags" => false));?>
62
  </td>
63
  </tr>
64
  <tr>
templates/library/list.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="wrap">
2
  <?php
3
- if (empty(get_option("intergeo_map_api_key"))) {
4
  ?>
5
  <div class="notice notice-warning"><p><?php echo sprintf(__("You have not added an API Key. Your maps may not display properly. Please add an API Key %shere%s", INTERGEO_PLUGIN_NAME), "<a href='" . admin_url("options-general.php?page=" . INTERGEO_PLUGIN_NAME) . "'>", "</a>");?></p></div>
6
  <?php
1
  <div class="wrap">
2
  <?php
3
+ if (!get_option("intergeo_map_api_key")) {
4
  ?>
5
  <div class="notice notice-warning"><p><?php echo sprintf(__("You have not added an API Key. Your maps may not display properly. Please add an API Key %shere%s", INTERGEO_PLUGIN_NAME), "<a href='" . admin_url("options-general.php?page=" . INTERGEO_PLUGIN_NAME) . "'>", "</a>");?></p></div>
6
  <?php