Version Description
We have updated our Timthumb.php file to the latest version (2.8.5 to 2.8.10) in compliance with new WordPress regulations.
Download this release
Release Info
Developer | WPGMaps |
Plugin | WP Google Maps |
Version | 4.14 |
Comparing to | |
See all releases |
Code changes from version 3.2 to 4.14
- css/wpgmza_style.css +9 -3
- csv.php +42 -0
- js/markerclusterer.js +1290 -0
- languages/wp-google-maps-default.mo +0 -0
- languages/wp-google-maps-default.po +499 -0
- readme.txt +98 -14
- wpGoogleMaps.php +1073 -423
css/wpgmza_style.css
CHANGED
@@ -1,4 +1,10 @@
|
|
1 |
#wpgmza_map img {
|
2 |
-
border: none !important;
|
3 |
-
background-color:transparent !important;
|
4 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#wpgmza_map img {
|
2 |
+
border: none !important;
|
3 |
+
background-color:transparent !important;
|
4 |
+
}
|
5 |
+
.wpgmza_map img {
|
6 |
+
border: none !important;
|
7 |
+
background-color:transparent !important;
|
8 |
+
padding:0 !important;
|
9 |
+
margin:0 !important;
|
10 |
+
}
|
csv.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require('../../../wp-load.php' );
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
global $wpdb;
|
8 |
+
$fileName = $wpdb->prefix.'wpgmza.csv';
|
9 |
+
|
10 |
+
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
11 |
+
header('Content-Description: File Transfer');
|
12 |
+
header("Content-type: text/csv");
|
13 |
+
header("Content-Disposition: attachment; filename={$fileName}");
|
14 |
+
header("Expires: 0");
|
15 |
+
header("Pragma: public");
|
16 |
+
|
17 |
+
$fh = @fopen( 'php://output', 'w' );
|
18 |
+
|
19 |
+
|
20 |
+
$query = "SELECT * FROM `{$wpdb->prefix}wpgmza`";
|
21 |
+
$results = $wpdb->get_results( $query, ARRAY_A );
|
22 |
+
|
23 |
+
$headerDisplayed = false;
|
24 |
+
|
25 |
+
foreach ( $results as $data ) {
|
26 |
+
// Add a header row if it hasn't been added yet
|
27 |
+
if ( !$headerDisplayed ) {
|
28 |
+
// Use the keys from $data as the titles
|
29 |
+
fputcsv($fh, array_keys($data));
|
30 |
+
$headerDisplayed = true;
|
31 |
+
}
|
32 |
+
|
33 |
+
// Put the data into the stream
|
34 |
+
fputcsv($fh, $data);
|
35 |
+
}
|
36 |
+
// Close the file
|
37 |
+
fclose($fh);
|
38 |
+
// Make sure nothing else is sent, our file is done
|
39 |
+
exit;
|
40 |
+
|
41 |
+
|
42 |
+
?>
|
js/markerclusterer.js
ADDED
@@ -0,0 +1,1290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// ==ClosureCompiler==
|
2 |
+
// @compilation_level ADVANCED_OPTIMIZATIONS
|
3 |
+
// @externs_url http://closure-compiler.googlecode.com/svn/trunk/contrib/externs/maps/google_maps_api_v3_3.js
|
4 |
+
// ==/ClosureCompiler==
|
5 |
+
|
6 |
+
/**
|
7 |
+
* @name MarkerClusterer for Google Maps v3
|
8 |
+
* @version version 1.0
|
9 |
+
* @author Luke Mahe
|
10 |
+
* @fileoverview
|
11 |
+
* The library creates and manages per-zoom-level clusters for large amounts of
|
12 |
+
* markers.
|
13 |
+
* <br/>
|
14 |
+
* This is a v3 implementation of the
|
15 |
+
* <a href="http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/"
|
16 |
+
* >v2 MarkerClusterer</a>.
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
21 |
+
* you may not use this file except in compliance with the License.
|
22 |
+
* You may obtain a copy of the License at
|
23 |
+
*
|
24 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
25 |
+
*
|
26 |
+
* Unless required by applicable law or agreed to in writing, software
|
27 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
28 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
29 |
+
* See the License for the specific language governing permissions and
|
30 |
+
* limitations under the License.
|
31 |
+
*/
|
32 |
+
|
33 |
+
|
34 |
+
/**
|
35 |
+
* A Marker Clusterer that clusters markers.
|
36 |
+
*
|
37 |
+
* @param {google.maps.Map} map The Google map to attach to.
|
38 |
+
* @param {Array.<google.maps.Marker>=} opt_markers Optional markers to add to
|
39 |
+
* the cluster.
|
40 |
+
* @param {Object=} opt_options support the following options:
|
41 |
+
* 'gridSize': (number) The grid size of a cluster in pixels.
|
42 |
+
* 'maxZoom': (number) The maximum zoom level that a marker can be part of a
|
43 |
+
* cluster.
|
44 |
+
* 'zoomOnClick': (boolean) Whether the default behaviour of clicking on a
|
45 |
+
* cluster is to zoom into it.
|
46 |
+
* 'averageCenter': (boolean) Wether the center of each cluster should be
|
47 |
+
* the average of all markers in the cluster.
|
48 |
+
* 'minimumClusterSize': (number) The minimum number of markers to be in a
|
49 |
+
* cluster before the markers are hidden and a count
|
50 |
+
* is shown.
|
51 |
+
* 'styles': (object) An object that has style properties:
|
52 |
+
* 'url': (string) The image url.
|
53 |
+
* 'height': (number) The image height.
|
54 |
+
* 'width': (number) The image width.
|
55 |
+
* 'anchor': (Array) The anchor position of the label text.
|
56 |
+
* 'textColor': (string) The text color.
|
57 |
+
* 'textSize': (number) The text size.
|
58 |
+
* 'backgroundPosition': (string) The position of the backgound x, y.
|
59 |
+
* @constructor
|
60 |
+
* @extends google.maps.OverlayView
|
61 |
+
*/
|
62 |
+
function MarkerClusterer(map, opt_markers, opt_options) {
|
63 |
+
// MarkerClusterer implements google.maps.OverlayView interface. We use the
|
64 |
+
// extend function to extend MarkerClusterer with google.maps.OverlayView
|
65 |
+
// because it might not always be available when the code is defined so we
|
66 |
+
// look for it at the last possible moment. If it doesn't exist now then
|
67 |
+
// there is no point going ahead :)
|
68 |
+
this.extend(MarkerClusterer, google.maps.OverlayView);
|
69 |
+
this.map_ = map;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @type {Array.<google.maps.Marker>}
|
73 |
+
* @private
|
74 |
+
*/
|
75 |
+
this.markers_ = [];
|
76 |
+
|
77 |
+
/**
|
78 |
+
* @type {Array.<Cluster>}
|
79 |
+
*/
|
80 |
+
this.clusters_ = [];
|
81 |
+
|
82 |
+
this.sizes = [53, 56, 66, 78, 90];
|
83 |
+
|
84 |
+
/**
|
85 |
+
* @private
|
86 |
+
*/
|
87 |
+
this.styles_ = [];
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @type {boolean}
|
91 |
+
* @private
|
92 |
+
*/
|
93 |
+
this.ready_ = false;
|
94 |
+
|
95 |
+
var options = opt_options || {};
|
96 |
+
|
97 |
+
/**
|
98 |
+
* @type {number}
|
99 |
+
* @private
|
100 |
+
*/
|
101 |
+
this.gridSize_ = options['gridSize'] || 60;
|
102 |
+
|
103 |
+
/**
|
104 |
+
* @private
|
105 |
+
*/
|
106 |
+
this.minClusterSize_ = options['minimumClusterSize'] || 2;
|
107 |
+
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @type {?number}
|
111 |
+
* @private
|
112 |
+
*/
|
113 |
+
this.maxZoom_ = options['maxZoom'] || null;
|
114 |
+
|
115 |
+
this.styles_ = options['styles'] || [];
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @type {string}
|
119 |
+
* @private
|
120 |
+
*/
|
121 |
+
this.imagePath_ = options['imagePath'] ||
|
122 |
+
this.MARKER_CLUSTER_IMAGE_PATH_;
|
123 |
+
|
124 |
+
/**
|
125 |
+
* @type {string}
|
126 |
+
* @private
|
127 |
+
*/
|
128 |
+
this.imageExtension_ = options['imageExtension'] ||
|
129 |
+
this.MARKER_CLUSTER_IMAGE_EXTENSION_;
|
130 |
+
|
131 |
+
/**
|
132 |
+
* @type {boolean}
|
133 |
+
* @private
|
134 |
+
*/
|
135 |
+
this.zoomOnClick_ = true;
|
136 |
+
|
137 |
+
if (options['zoomOnClick'] != undefined) {
|
138 |
+
this.zoomOnClick_ = options['zoomOnClick'];
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @type {boolean}
|
143 |
+
* @private
|
144 |
+
*/
|
145 |
+
this.averageCenter_ = false;
|
146 |
+
|
147 |
+
if (options['averageCenter'] != undefined) {
|
148 |
+
this.averageCenter_ = options['averageCenter'];
|
149 |
+
}
|
150 |
+
|
151 |
+
this.setupStyles_();
|
152 |
+
|
153 |
+
this.setMap(map);
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @type {number}
|
157 |
+
* @private
|
158 |
+
*/
|
159 |
+
this.prevZoom_ = this.map_.getZoom();
|
160 |
+
|
161 |
+
// Add the map event listeners
|
162 |
+
var that = this;
|
163 |
+
google.maps.event.addListener(this.map_, 'zoom_changed', function() {
|
164 |
+
var zoom = that.map_.getZoom();
|
165 |
+
|
166 |
+
if (that.prevZoom_ != zoom) {
|
167 |
+
that.prevZoom_ = zoom;
|
168 |
+
that.resetViewport();
|
169 |
+
}
|
170 |
+
});
|
171 |
+
|
172 |
+
google.maps.event.addListener(this.map_, 'idle', function() {
|
173 |
+
that.redraw();
|
174 |
+
});
|
175 |
+
|
176 |
+
// Finally, add the markers
|
177 |
+
if (opt_markers && opt_markers.length) {
|
178 |
+
this.addMarkers(opt_markers, false);
|
179 |
+
}
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
/**
|
184 |
+
* The marker cluster image path.
|
185 |
+
*
|
186 |
+
* @type {string}
|
187 |
+
* @private
|
188 |
+
*/
|
189 |
+
MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ =
|
190 |
+
'http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/' +
|
191 |
+
'images/m';
|
192 |
+
|
193 |
+
|
194 |
+
/**
|
195 |
+
* The marker cluster image path.
|
196 |
+
*
|
197 |
+
* @type {string}
|
198 |
+
* @private
|
199 |
+
*/
|
200 |
+
MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_ = 'png';
|
201 |
+
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Extends a objects prototype by anothers.
|
205 |
+
*
|
206 |
+
* @param {Object} obj1 The object to be extended.
|
207 |
+
* @param {Object} obj2 The object to extend with.
|
208 |
+
* @return {Object} The new extended object.
|
209 |
+
* @ignore
|
210 |
+
*/
|
211 |
+
MarkerClusterer.prototype.extend = function(obj1, obj2) {
|
212 |
+
return (function(object) {
|
213 |
+
for (var property in object.prototype) {
|
214 |
+
this.prototype[property] = object.prototype[property];
|
215 |
+
}
|
216 |
+
return this;
|
217 |
+
}).apply(obj1, [obj2]);
|
218 |
+
};
|
219 |
+
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Implementaion of the interface method.
|
223 |
+
* @ignore
|
224 |
+
*/
|
225 |
+
MarkerClusterer.prototype.onAdd = function() {
|
226 |
+
this.setReady_(true);
|
227 |
+
};
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Implementaion of the interface method.
|
231 |
+
* @ignore
|
232 |
+
*/
|
233 |
+
MarkerClusterer.prototype.draw = function() {};
|
234 |
+
|
235 |
+
/**
|
236 |
+
* Sets up the styles object.
|
237 |
+
*
|
238 |
+
* @private
|
239 |
+
*/
|
240 |
+
MarkerClusterer.prototype.setupStyles_ = function() {
|
241 |
+
if (this.styles_.length) {
|
242 |
+
return;
|
243 |
+
}
|
244 |
+
|
245 |
+
for (var i = 0, size; size = this.sizes[i]; i++) {
|
246 |
+
this.styles_.push({
|
247 |
+
url: this.imagePath_ + (i + 1) + '.' + this.imageExtension_,
|
248 |
+
height: size,
|
249 |
+
width: size
|
250 |
+
});
|
251 |
+
}
|
252 |
+
};
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Fit the map to the bounds of the markers in the clusterer.
|
256 |
+
*/
|
257 |
+
MarkerClusterer.prototype.fitMapToMarkers = function() {
|
258 |
+
var markers = this.getMarkers();
|
259 |
+
var bounds = new google.maps.LatLngBounds();
|
260 |
+
for (var i = 0, marker; marker = markers[i]; i++) {
|
261 |
+
bounds.extend(marker.getPosition());
|
262 |
+
}
|
263 |
+
|
264 |
+
this.map_.fitBounds(bounds);
|
265 |
+
};
|
266 |
+
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Sets the styles.
|
270 |
+
*
|
271 |
+
* @param {Object} styles The style to set.
|
272 |
+
*/
|
273 |
+
MarkerClusterer.prototype.setStyles = function(styles) {
|
274 |
+
this.styles_ = styles;
|
275 |
+
};
|
276 |
+
|
277 |
+
|
278 |
+
/**
|
279 |
+
* Gets the styles.
|
280 |
+
*
|
281 |
+
* @return {Object} The styles object.
|
282 |
+
*/
|
283 |
+
MarkerClusterer.prototype.getStyles = function() {
|
284 |
+
return this.styles_;
|
285 |
+
};
|
286 |
+
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Whether zoom on click is set.
|
290 |
+
*
|
291 |
+
* @return {boolean} True if zoomOnClick_ is set.
|
292 |
+
*/
|
293 |
+
MarkerClusterer.prototype.isZoomOnClick = function() {
|
294 |
+
return this.zoomOnClick_;
|
295 |
+
};
|
296 |
+
|
297 |
+
/**
|
298 |
+
* Whether average center is set.
|
299 |
+
*
|
300 |
+
* @return {boolean} True if averageCenter_ is set.
|
301 |
+
*/
|
302 |
+
MarkerClusterer.prototype.isAverageCenter = function() {
|
303 |
+
return this.averageCenter_;
|
304 |
+
};
|
305 |
+
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Returns the array of markers in the clusterer.
|
309 |
+
*
|
310 |
+
* @return {Array.<google.maps.Marker>} The markers.
|
311 |
+
*/
|
312 |
+
MarkerClusterer.prototype.getMarkers = function() {
|
313 |
+
return this.markers_;
|
314 |
+
};
|
315 |
+
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Returns the number of markers in the clusterer
|
319 |
+
*
|
320 |
+
* @return {Number} The number of markers.
|
321 |
+
*/
|
322 |
+
MarkerClusterer.prototype.getTotalMarkers = function() {
|
323 |
+
return this.markers_.length;
|
324 |
+
};
|
325 |
+
|
326 |
+
|
327 |
+
/**
|
328 |
+
* Sets the max zoom for the clusterer.
|
329 |
+
*
|
330 |
+
* @param {number} maxZoom The max zoom level.
|
331 |
+
*/
|
332 |
+
MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
|
333 |
+
this.maxZoom_ = maxZoom;
|
334 |
+
};
|
335 |
+
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Gets the max zoom for the clusterer.
|
339 |
+
*
|
340 |
+
* @return {number} The max zoom level.
|
341 |
+
*/
|
342 |
+
MarkerClusterer.prototype.getMaxZoom = function() {
|
343 |
+
return this.maxZoom_;
|
344 |
+
};
|
345 |
+
|
346 |
+
|
347 |
+
/**
|
348 |
+
* The function for calculating the cluster icon image.
|
349 |
+
*
|
350 |
+
* @param {Array.<google.maps.Marker>} markers The markers in the clusterer.
|
351 |
+
* @param {number} numStyles The number of styles available.
|
352 |
+
* @return {Object} A object properties: 'text' (string) and 'index' (number).
|
353 |
+
* @private
|
354 |
+
*/
|
355 |
+
MarkerClusterer.prototype.calculator_ = function(markers, numStyles) {
|
356 |
+
var index = 0;
|
357 |
+
var count = markers.length;
|
358 |
+
var dv = count;
|
359 |
+
while (dv !== 0) {
|
360 |
+
dv = parseInt(dv / 10, 10);
|
361 |
+
index++;
|
362 |
+
}
|
363 |
+
|
364 |
+
index = Math.min(index, numStyles);
|
365 |
+
return {
|
366 |
+
text: count,
|
367 |
+
index: index
|
368 |
+
};
|
369 |
+
};
|
370 |
+
|
371 |
+
|
372 |
+
/**
|
373 |
+
* Set the calculator function.
|
374 |
+
*
|
375 |
+
* @param {function(Array, number)} calculator The function to set as the
|
376 |
+
* calculator. The function should return a object properties:
|
377 |
+
* 'text' (string) and 'index' (number).
|
378 |
+
*
|
379 |
+
*/
|
380 |
+
MarkerClusterer.prototype.setCalculator = function(calculator) {
|
381 |
+
this.calculator_ = calculator;
|
382 |
+
};
|
383 |
+
|
384 |
+
|
385 |
+
/**
|
386 |
+
* Get the calculator function.
|
387 |
+
*
|
388 |
+
* @return {function(Array, number)} the calculator function.
|
389 |
+
*/
|
390 |
+
MarkerClusterer.prototype.getCalculator = function() {
|
391 |
+
return this.calculator_;
|
392 |
+
};
|
393 |
+
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Add an array of markers to the clusterer.
|
397 |
+
*
|
398 |
+
* @param {Array.<google.maps.Marker>} markers The markers to add.
|
399 |
+
* @param {boolean=} opt_nodraw Whether to redraw the clusters.
|
400 |
+
*/
|
401 |
+
MarkerClusterer.prototype.addMarkers = function(markers, opt_nodraw) {
|
402 |
+
for (var i = 0, marker; marker = markers[i]; i++) {
|
403 |
+
this.pushMarkerTo_(marker);
|
404 |
+
}
|
405 |
+
if (!opt_nodraw) {
|
406 |
+
this.redraw();
|
407 |
+
}
|
408 |
+
};
|
409 |
+
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Pushes a marker to the clusterer.
|
413 |
+
*
|
414 |
+
* @param {google.maps.Marker} marker The marker to add.
|
415 |
+
* @private
|
416 |
+
*/
|
417 |
+
MarkerClusterer.prototype.pushMarkerTo_ = function(marker) {
|
418 |
+
marker.isAdded = false;
|
419 |
+
if (marker['draggable']) {
|
420 |
+
// If the marker is draggable add a listener so we update the clusters on
|
421 |
+
// the drag end.
|
422 |
+
var that = this;
|
423 |
+
google.maps.event.addListener(marker, 'dragend', function() {
|
424 |
+
marker.isAdded = false;
|
425 |
+
that.repaint();
|
426 |
+
});
|
427 |
+
}
|
428 |
+
this.markers_.push(marker);
|
429 |
+
};
|
430 |
+
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Adds a marker to the clusterer and redraws if needed.
|
434 |
+
*
|
435 |
+
* @param {google.maps.Marker} marker The marker to add.
|
436 |
+
* @param {boolean=} opt_nodraw Whether to redraw the clusters.
|
437 |
+
*/
|
438 |
+
MarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {
|
439 |
+
this.pushMarkerTo_(marker);
|
440 |
+
if (!opt_nodraw) {
|
441 |
+
this.redraw();
|
442 |
+
}
|
443 |
+
};
|
444 |
+
|
445 |
+
|
446 |
+
/**
|
447 |
+
* Removes a marker and returns true if removed, false if not
|
448 |
+
*
|
449 |
+
* @param {google.maps.Marker} marker The marker to remove
|
450 |
+
* @return {boolean} Whether the marker was removed or not
|
451 |
+
* @private
|
452 |
+
*/
|
453 |
+
MarkerClusterer.prototype.removeMarker_ = function(marker) {
|
454 |
+
var index = -1;
|
455 |
+
if (this.markers_.indexOf) {
|
456 |
+
index = this.markers_.indexOf(marker);
|
457 |
+
} else {
|
458 |
+
for (var i = 0, m; m = this.markers_[i]; i++) {
|
459 |
+
if (m == marker) {
|
460 |
+
index = i;
|
461 |
+
break;
|
462 |
+
}
|
463 |
+
}
|
464 |
+
}
|
465 |
+
|
466 |
+
if (index == -1) {
|
467 |
+
// Marker is not in our list of markers.
|
468 |
+
return false;
|
469 |
+
}
|
470 |
+
|
471 |
+
marker.setMap(null);
|
472 |
+
|
473 |
+
this.markers_.splice(index, 1);
|
474 |
+
|
475 |
+
return true;
|
476 |
+
};
|
477 |
+
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Remove a marker from the cluster.
|
481 |
+
*
|
482 |
+
* @param {google.maps.Marker} marker The marker to remove.
|
483 |
+
* @param {boolean=} opt_nodraw Optional boolean to force no redraw.
|
484 |
+
* @return {boolean} True if the marker was removed.
|
485 |
+
*/
|
486 |
+
MarkerClusterer.prototype.removeMarker = function(marker, opt_nodraw) {
|
487 |
+
var removed = this.removeMarker_(marker);
|
488 |
+
|
489 |
+
if (!opt_nodraw && removed) {
|
490 |
+
this.resetViewport();
|
491 |
+
this.redraw();
|
492 |
+
return true;
|
493 |
+
} else {
|
494 |
+
return false;
|
495 |
+
}
|
496 |
+
};
|
497 |
+
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Removes an array of markers from the cluster.
|
501 |
+
*
|
502 |
+
* @param {Array.<google.maps.Marker>} markers The markers to remove.
|
503 |
+
* @param {boolean=} opt_nodraw Optional boolean to force no redraw.
|
504 |
+
*/
|
505 |
+
MarkerClusterer.prototype.removeMarkers = function(markers, opt_nodraw) {
|
506 |
+
var removed = false;
|
507 |
+
|
508 |
+
for (var i = 0, marker; marker = markers[i]; i++) {
|
509 |
+
var r = this.removeMarker_(marker);
|
510 |
+
removed = removed || r;
|
511 |
+
}
|
512 |
+
|
513 |
+
if (!opt_nodraw && removed) {
|
514 |
+
this.resetViewport();
|
515 |
+
this.redraw();
|
516 |
+
return true;
|
517 |
+
}
|
518 |
+
};
|
519 |
+
|
520 |
+
|
521 |
+
/**
|
522 |
+
* Sets the clusterer's ready state.
|
523 |
+
*
|
524 |
+
* @param {boolean} ready The state.
|
525 |
+
* @private
|
526 |
+
*/
|
527 |
+
MarkerClusterer.prototype.setReady_ = function(ready) {
|
528 |
+
if (!this.ready_) {
|
529 |
+
this.ready_ = ready;
|
530 |
+
this.createClusters_();
|
531 |
+
}
|
532 |
+
};
|
533 |
+
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Returns the number of clusters in the clusterer.
|
537 |
+
*
|
538 |
+
* @return {number} The number of clusters.
|
539 |
+
*/
|
540 |
+
MarkerClusterer.prototype.getTotalClusters = function() {
|
541 |
+
return this.clusters_.length;
|
542 |
+
};
|
543 |
+
|
544 |
+
|
545 |
+
/**
|
546 |
+
* Returns the google map that the clusterer is associated with.
|
547 |
+
*
|
548 |
+
* @return {google.maps.Map} The map.
|
549 |
+
*/
|
550 |
+
MarkerClusterer.prototype.getMap = function() {
|
551 |
+
return this.map_;
|
552 |
+
};
|
553 |
+
|
554 |
+
|
555 |
+
/**
|
556 |
+
* Sets the google map that the clusterer is associated with.
|
557 |
+
*
|
558 |
+
* @param {google.maps.Map} map The map.
|
559 |
+
*/
|
560 |
+
MarkerClusterer.prototype.setMap = function(map) {
|
561 |
+
this.map_ = map;
|
562 |
+
};
|
563 |
+
|
564 |
+
|
565 |
+
/**
|
566 |
+
* Returns the size of the grid.
|
567 |
+
*
|
568 |
+
* @return {number} The grid size.
|
569 |
+
*/
|
570 |
+
MarkerClusterer.prototype.getGridSize = function() {
|
571 |
+
return this.gridSize_;
|
572 |
+
};
|
573 |
+
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Sets the size of the grid.
|
577 |
+
*
|
578 |
+
* @param {number} size The grid size.
|
579 |
+
*/
|
580 |
+
MarkerClusterer.prototype.setGridSize = function(size) {
|
581 |
+
this.gridSize_ = size;
|
582 |
+
};
|
583 |
+
|
584 |
+
|
585 |
+
/**
|
586 |
+
* Returns the min cluster size.
|
587 |
+
*
|
588 |
+
* @return {number} The grid size.
|
589 |
+
*/
|
590 |
+
MarkerClusterer.prototype.getMinClusterSize = function() {
|
591 |
+
return this.minClusterSize_;
|
592 |
+
};
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Sets the min cluster size.
|
596 |
+
*
|
597 |
+
* @param {number} size The grid size.
|
598 |
+
*/
|
599 |
+
MarkerClusterer.prototype.setMinClusterSize = function(size) {
|
600 |
+
this.minClusterSize_ = size;
|
601 |
+
};
|
602 |
+
|
603 |
+
|
604 |
+
/**
|
605 |
+
* Extends a bounds object by the grid size.
|
606 |
+
*
|
607 |
+
* @param {google.maps.LatLngBounds} bounds The bounds to extend.
|
608 |
+
* @return {google.maps.LatLngBounds} The extended bounds.
|
609 |
+
*/
|
610 |
+
MarkerClusterer.prototype.getExtendedBounds = function(bounds) {
|
611 |
+
var projection = this.getProjection();
|
612 |
+
|
613 |
+
// Turn the bounds into latlng.
|
614 |
+
var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),
|
615 |
+
bounds.getNorthEast().lng());
|
616 |
+
var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),
|
617 |
+
bounds.getSouthWest().lng());
|
618 |
+
|
619 |
+
// Convert the points to pixels and the extend out by the grid size.
|
620 |
+
var trPix = projection.fromLatLngToDivPixel(tr);
|
621 |
+
trPix.x += this.gridSize_;
|
622 |
+
trPix.y -= this.gridSize_;
|
623 |
+
|
624 |
+
var blPix = projection.fromLatLngToDivPixel(bl);
|
625 |
+
blPix.x -= this.gridSize_;
|
626 |
+
blPix.y += this.gridSize_;
|
627 |
+
|
628 |
+
// Convert the pixel points back to LatLng
|
629 |
+
var ne = projection.fromDivPixelToLatLng(trPix);
|
630 |
+
var sw = projection.fromDivPixelToLatLng(blPix);
|
631 |
+
|
632 |
+
// Extend the bounds to contain the new bounds.
|
633 |
+
bounds.extend(ne);
|
634 |
+
bounds.extend(sw);
|
635 |
+
|
636 |
+
return bounds;
|
637 |
+
};
|
638 |
+
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Determins if a marker is contained in a bounds.
|
642 |
+
*
|
643 |
+
* @param {google.maps.Marker} marker The marker to check.
|
644 |
+
* @param {google.maps.LatLngBounds} bounds The bounds to check against.
|
645 |
+
* @return {boolean} True if the marker is in the bounds.
|
646 |
+
* @private
|
647 |
+
*/
|
648 |
+
MarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) {
|
649 |
+
return bounds.contains(marker.getPosition());
|
650 |
+
};
|
651 |
+
|
652 |
+
|
653 |
+
/**
|
654 |
+
* Clears all clusters and markers from the clusterer.
|
655 |
+
*/
|
656 |
+
MarkerClusterer.prototype.clearMarkers = function() {
|
657 |
+
this.resetViewport(true);
|
658 |
+
|
659 |
+
// Set the markers a empty array.
|
660 |
+
this.markers_ = [];
|
661 |
+
};
|
662 |
+
|
663 |
+
|
664 |
+
/**
|
665 |
+
* Clears all existing clusters and recreates them.
|
666 |
+
* @param {boolean} opt_hide To also hide the marker.
|
667 |
+
*/
|
668 |
+
MarkerClusterer.prototype.resetViewport = function(opt_hide) {
|
669 |
+
// Remove all the clusters
|
670 |
+
for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
|
671 |
+
cluster.remove();
|
672 |
+
}
|
673 |
+
|
674 |
+
// Reset the markers to not be added and to be invisible.
|
675 |
+
for (var i = 0, marker; marker = this.markers_[i]; i++) {
|
676 |
+
marker.isAdded = false;
|
677 |
+
if (opt_hide) {
|
678 |
+
marker.setMap(null);
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
this.clusters_ = [];
|
683 |
+
};
|
684 |
+
|
685 |
+
/**
|
686 |
+
*
|
687 |
+
*/
|
688 |
+
MarkerClusterer.prototype.repaint = function() {
|
689 |
+
var oldClusters = this.clusters_.slice();
|
690 |
+
this.clusters_.length = 0;
|
691 |
+
this.resetViewport();
|
692 |
+
this.redraw();
|
693 |
+
|
694 |
+
// Remove the old clusters.
|
695 |
+
// Do it in a timeout so the other clusters have been drawn first.
|
696 |
+
window.setTimeout(function() {
|
697 |
+
for (var i = 0, cluster; cluster = oldClusters[i]; i++) {
|
698 |
+
cluster.remove();
|
699 |
+
}
|
700 |
+
}, 0);
|
701 |
+
};
|
702 |
+
|
703 |
+
|
704 |
+
/**
|
705 |
+
* Redraws the clusters.
|
706 |
+
*/
|
707 |
+
MarkerClusterer.prototype.redraw = function() {
|
708 |
+
this.createClusters_();
|
709 |
+
};
|
710 |
+
|
711 |
+
|
712 |
+
/**
|
713 |
+
* Calculates the distance between two latlng locations in km.
|
714 |
+
* @see http://www.movable-type.co.uk/scripts/latlong.html
|
715 |
+
*
|
716 |
+
* @param {google.maps.LatLng} p1 The first lat lng point.
|
717 |
+
* @param {google.maps.LatLng} p2 The second lat lng point.
|
718 |
+
* @return {number} The distance between the two points in km.
|
719 |
+
* @private
|
720 |
+
*/
|
721 |
+
MarkerClusterer.prototype.distanceBetweenPoints_ = function(p1, p2) {
|
722 |
+
if (!p1 || !p2) {
|
723 |
+
return 0;
|
724 |
+
}
|
725 |
+
|
726 |
+
var R = 6371; // Radius of the Earth in km
|
727 |
+
var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
|
728 |
+
var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
|
729 |
+
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
730 |
+
Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
|
731 |
+
Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
732 |
+
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
733 |
+
var d = R * c;
|
734 |
+
return d;
|
735 |
+
};
|
736 |
+
|
737 |
+
|
738 |
+
/**
|
739 |
+
* Add a marker to a cluster, or creates a new cluster.
|
740 |
+
*
|
741 |
+
* @param {google.maps.Marker} marker The marker to add.
|
742 |
+
* @private
|
743 |
+
*/
|
744 |
+
MarkerClusterer.prototype.addToClosestCluster_ = function(marker) {
|
745 |
+
var distance = 40000; // Some large number
|
746 |
+
var clusterToAddTo = null;
|
747 |
+
var pos = marker.getPosition();
|
748 |
+
for (var i = 0, cluster; cluster = this.clusters_[i]; i++) {
|
749 |
+
var center = cluster.getCenter();
|
750 |
+
if (center) {
|
751 |
+
var d = this.distanceBetweenPoints_(center, marker.getPosition());
|
752 |
+
if (d < distance) {
|
753 |
+
distance = d;
|
754 |
+
clusterToAddTo = cluster;
|
755 |
+
}
|
756 |
+
}
|
757 |
+
}
|
758 |
+
|
759 |
+
if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
|
760 |
+
clusterToAddTo.addMarker(marker);
|
761 |
+
} else {
|
762 |
+
var cluster = new Cluster(this);
|
763 |
+
cluster.addMarker(marker);
|
764 |
+
this.clusters_.push(cluster);
|
765 |
+
}
|
766 |
+
};
|
767 |
+
|
768 |
+
|
769 |
+
/**
|
770 |
+
* Creates the clusters.
|
771 |
+
*
|
772 |
+
* @private
|
773 |
+
*/
|
774 |
+
MarkerClusterer.prototype.createClusters_ = function() {
|
775 |
+
if (!this.ready_) {
|
776 |
+
return;
|
777 |
+
}
|
778 |
+
|
779 |
+
// Get our current map view bounds.
|
780 |
+
// Create a new bounds object so we don't affect the map.
|
781 |
+
var mapBounds = new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),
|
782 |
+
this.map_.getBounds().getNorthEast());
|
783 |
+
var bounds = this.getExtendedBounds(mapBounds);
|
784 |
+
|
785 |
+
for (var i = 0, marker; marker = this.markers_[i]; i++) {
|
786 |
+
if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {
|
787 |
+
this.addToClosestCluster_(marker);
|
788 |
+
}
|
789 |
+
}
|
790 |
+
};
|
791 |
+
|
792 |
+
|
793 |
+
/**
|
794 |
+
* A cluster that contains markers.
|
795 |
+
*
|
796 |
+
* @param {MarkerClusterer} markerClusterer The markerclusterer that this
|
797 |
+
* cluster is associated with.
|
798 |
+
* @constructor
|
799 |
+
* @ignore
|
800 |
+
*/
|
801 |
+
function Cluster(markerClusterer) {
|
802 |
+
this.markerClusterer_ = markerClusterer;
|
803 |
+
this.map_ = markerClusterer.getMap();
|
804 |
+
this.gridSize_ = markerClusterer.getGridSize();
|
805 |
+
this.minClusterSize_ = markerClusterer.getMinClusterSize();
|
806 |
+
this.averageCenter_ = markerClusterer.isAverageCenter();
|
807 |
+
this.center_ = null;
|
808 |
+
this.markers_ = [];
|
809 |
+
this.bounds_ = null;
|
810 |
+
this.clusterIcon_ = new ClusterIcon(this, markerClusterer.getStyles(),
|
811 |
+
markerClusterer.getGridSize());
|
812 |
+
}
|
813 |
+
|
814 |
+
/**
|
815 |
+
* Determins if a marker is already added to the cluster.
|
816 |
+
*
|
817 |
+
* @param {google.maps.Marker} marker The marker to check.
|
818 |
+
* @return {boolean} True if the marker is already added.
|
819 |
+
*/
|
820 |
+
Cluster.prototype.isMarkerAlreadyAdded = function(marker) {
|
821 |
+
if (this.markers_.indexOf) {
|
822 |
+
return this.markers_.indexOf(marker) != -1;
|
823 |
+
} else {
|
824 |
+
for (var i = 0, m; m = this.markers_[i]; i++) {
|
825 |
+
if (m == marker) {
|
826 |
+
return true;
|
827 |
+
}
|
828 |
+
}
|
829 |
+
}
|
830 |
+
return false;
|
831 |
+
};
|
832 |
+
|
833 |
+
|
834 |
+
/**
|
835 |
+
* Add a marker the cluster.
|
836 |
+
*
|
837 |
+
* @param {google.maps.Marker} marker The marker to add.
|
838 |
+
* @return {boolean} True if the marker was added.
|
839 |
+
*/
|
840 |
+
Cluster.prototype.addMarker = function(marker) {
|
841 |
+
if (this.isMarkerAlreadyAdded(marker)) {
|
842 |
+
return false;
|
843 |
+
}
|
844 |
+
|
845 |
+
if (!this.center_) {
|
846 |
+
this.center_ = marker.getPosition();
|
847 |
+
this.calculateBounds_();
|
848 |
+
} else {
|
849 |
+
if (this.averageCenter_) {
|
850 |
+
var l = this.markers_.length + 1;
|
851 |
+
var lat = (this.center_.lat() * (l-1) + marker.getPosition().lat()) / l;
|
852 |
+
var lng = (this.center_.lng() * (l-1) + marker.getPosition().lng()) / l;
|
853 |
+
this.center_ = new google.maps.LatLng(lat, lng);
|
854 |
+
this.calculateBounds_();
|
855 |
+
}
|
856 |
+
}
|
857 |
+
|
858 |
+
marker.isAdded = true;
|
859 |
+
this.markers_.push(marker);
|
860 |
+
|
861 |
+
var len = this.markers_.length;
|
862 |
+
if (len < this.minClusterSize_ && marker.getMap() != this.map_) {
|
863 |
+
// Min cluster size not reached so show the marker.
|
864 |
+
marker.setMap(this.map_);
|
865 |
+
}
|
866 |
+
|
867 |
+
if (len == this.minClusterSize_) {
|
868 |
+
// Hide the markers that were showing.
|
869 |
+
for (var i = 0; i < len; i++) {
|
870 |
+
this.markers_[i].setMap(null);
|
871 |
+
}
|
872 |
+
}
|
873 |
+
|
874 |
+
if (len >= this.minClusterSize_) {
|
875 |
+
marker.setMap(null);
|
876 |
+
}
|
877 |
+
|
878 |
+
this.updateIcon();
|
879 |
+
return true;
|
880 |
+
};
|
881 |
+
|
882 |
+
|
883 |
+
/**
|
884 |
+
* Returns the marker clusterer that the cluster is associated with.
|
885 |
+
*
|
886 |
+
* @return {MarkerClusterer} The associated marker clusterer.
|
887 |
+
*/
|
888 |
+
Cluster.prototype.getMarkerClusterer = function() {
|
889 |
+
return this.markerClusterer_;
|
890 |
+
};
|
891 |
+
|
892 |
+
|
893 |
+
/**
|
894 |
+
* Returns the bounds of the cluster.
|
895 |
+
*
|
896 |
+
* @return {google.maps.LatLngBounds} the cluster bounds.
|
897 |
+
*/
|
898 |
+
Cluster.prototype.getBounds = function() {
|
899 |
+
var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
|
900 |
+
var markers = this.getMarkers();
|
901 |
+
for (var i = 0, marker; marker = markers[i]; i++) {
|
902 |
+
bounds.extend(marker.getPosition());
|
903 |
+
}
|
904 |
+
return bounds;
|
905 |
+
};
|
906 |
+
|
907 |
+
|
908 |
+
/**
|
909 |
+
* Removes the cluster
|
910 |
+
*/
|
911 |
+
Cluster.prototype.remove = function() {
|
912 |
+
this.clusterIcon_.remove();
|
913 |
+
this.markers_.length = 0;
|
914 |
+
delete this.markers_;
|
915 |
+
};
|
916 |
+
|
917 |
+
|
918 |
+
/**
|
919 |
+
* Returns the center of the cluster.
|
920 |
+
*
|
921 |
+
* @return {number} The cluster center.
|
922 |
+
*/
|
923 |
+
Cluster.prototype.getSize = function() {
|
924 |
+
return this.markers_.length;
|
925 |
+
};
|
926 |
+
|
927 |
+
|
928 |
+
/**
|
929 |
+
* Returns the center of the cluster.
|
930 |
+
*
|
931 |
+
* @return {Array.<google.maps.Marker>} The cluster center.
|
932 |
+
*/
|
933 |
+
Cluster.prototype.getMarkers = function() {
|
934 |
+
return this.markers_;
|
935 |
+
};
|
936 |
+
|
937 |
+
|
938 |
+
/**
|
939 |
+
* Returns the center of the cluster.
|
940 |
+
*
|
941 |
+
* @return {google.maps.LatLng} The cluster center.
|
942 |
+
*/
|
943 |
+
Cluster.prototype.getCenter = function() {
|
944 |
+
return this.center_;
|
945 |
+
};
|
946 |
+
|
947 |
+
|
948 |
+
/**
|
949 |
+
* Calculated the extended bounds of the cluster with the grid.
|
950 |
+
*
|
951 |
+
* @private
|
952 |
+
*/
|
953 |
+
Cluster.prototype.calculateBounds_ = function() {
|
954 |
+
var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
|
955 |
+
this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
|
956 |
+
};
|
957 |
+
|
958 |
+
|
959 |
+
/**
|
960 |
+
* Determines if a marker lies in the clusters bounds.
|
961 |
+
*
|
962 |
+
* @param {google.maps.Marker} marker The marker to check.
|
963 |
+
* @return {boolean} True if the marker lies in the bounds.
|
964 |
+
*/
|
965 |
+
Cluster.prototype.isMarkerInClusterBounds = function(marker) {
|
966 |
+
return this.bounds_.contains(marker.getPosition());
|
967 |
+
};
|
968 |
+
|
969 |
+
|
970 |
+
/**
|
971 |
+
* Returns the map that the cluster is associated with.
|
972 |
+
*
|
973 |
+
* @return {google.maps.Map} The map.
|
974 |
+
*/
|
975 |
+
Cluster.prototype.getMap = function() {
|
976 |
+
return this.map_;
|
977 |
+
};
|
978 |
+
|
979 |
+
|
980 |
+
/**
|
981 |
+
* Updates the cluster icon
|
982 |
+
*/
|
983 |
+
Cluster.prototype.updateIcon = function() {
|
984 |
+
var zoom = this.map_.getZoom();
|
985 |
+
var mz = this.markerClusterer_.getMaxZoom();
|
986 |
+
|
987 |
+
if (mz && zoom > mz) {
|
988 |
+
// The zoom is greater than our max zoom so show all the markers in cluster.
|
989 |
+
for (var i = 0, marker; marker = this.markers_[i]; i++) {
|
990 |
+
marker.setMap(this.map_);
|
991 |
+
}
|
992 |
+
return;
|
993 |
+
}
|
994 |
+
|
995 |
+
if (this.markers_.length < this.minClusterSize_) {
|
996 |
+
// Min cluster size not yet reached.
|
997 |
+
this.clusterIcon_.hide();
|
998 |
+
return;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
var numStyles = this.markerClusterer_.getStyles().length;
|
1002 |
+
var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
|
1003 |
+
this.clusterIcon_.setCenter(this.center_);
|
1004 |
+
this.clusterIcon_.setSums(sums);
|
1005 |
+
this.clusterIcon_.show();
|
1006 |
+
};
|
1007 |
+
|
1008 |
+
|
1009 |
+
/**
|
1010 |
+
* A cluster icon
|
1011 |
+
*
|
1012 |
+
* @param {Cluster} cluster The cluster to be associated with.
|
1013 |
+
* @param {Object} styles An object that has style properties:
|
1014 |
+
* 'url': (string) The image url.
|
1015 |
+
* 'height': (number) The image height.
|
1016 |
+
* 'width': (number) The image width.
|
1017 |
+
* 'anchor': (Array) The anchor position of the label text.
|
1018 |
+
* 'textColor': (string) The text color.
|
1019 |
+
* 'textSize': (number) The text size.
|
1020 |
+
* 'backgroundPosition: (string) The background postition x, y.
|
1021 |
+
* @param {number=} opt_padding Optional padding to apply to the cluster icon.
|
1022 |
+
* @constructor
|
1023 |
+
* @extends google.maps.OverlayView
|
1024 |
+
* @ignore
|
1025 |
+
*/
|
1026 |
+
function ClusterIcon(cluster, styles, opt_padding) {
|
1027 |
+
cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
|
1028 |
+
|
1029 |
+
this.styles_ = styles;
|
1030 |
+
this.padding_ = opt_padding || 0;
|
1031 |
+
this.cluster_ = cluster;
|
1032 |
+
this.center_ = null;
|
1033 |
+
this.map_ = cluster.getMap();
|
1034 |
+
this.div_ = null;
|
1035 |
+
this.sums_ = null;
|
1036 |
+
this.visible_ = false;
|
1037 |
+
|
1038 |
+
this.setMap(this.map_);
|
1039 |
+
}
|
1040 |
+
|
1041 |
+
|
1042 |
+
/**
|
1043 |
+
* Triggers the clusterclick event and zoom's if the option is set.
|
1044 |
+
*/
|
1045 |
+
ClusterIcon.prototype.triggerClusterClick = function() {
|
1046 |
+
var markerClusterer = this.cluster_.getMarkerClusterer();
|
1047 |
+
|
1048 |
+
// Trigger the clusterclick event.
|
1049 |
+
google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_);
|
1050 |
+
|
1051 |
+
if (markerClusterer.isZoomOnClick()) {
|
1052 |
+
// Zoom into the cluster.
|
1053 |
+
this.map_.fitBounds(this.cluster_.getBounds());
|
1054 |
+
}
|
1055 |
+
};
|
1056 |
+
|
1057 |
+
|
1058 |
+
/**
|
1059 |
+
* Adding the cluster icon to the dom.
|
1060 |
+
* @ignore
|
1061 |
+
*/
|
1062 |
+
ClusterIcon.prototype.onAdd = function() {
|
1063 |
+
this.div_ = document.createElement('DIV');
|
1064 |
+
if (this.visible_) {
|
1065 |
+
var pos = this.getPosFromLatLng_(this.center_);
|
1066 |
+
this.div_.style.cssText = this.createCss(pos);
|
1067 |
+
this.div_.innerHTML = this.sums_.text;
|
1068 |
+
}
|
1069 |
+
|
1070 |
+
var panes = this.getPanes();
|
1071 |
+
panes.overlayMouseTarget.appendChild(this.div_);
|
1072 |
+
|
1073 |
+
var that = this;
|
1074 |
+
google.maps.event.addDomListener(this.div_, 'click', function() {
|
1075 |
+
that.triggerClusterClick();
|
1076 |
+
});
|
1077 |
+
};
|
1078 |
+
|
1079 |
+
|
1080 |
+
/**
|
1081 |
+
* Returns the position to place the div dending on the latlng.
|
1082 |
+
*
|
1083 |
+
* @param {google.maps.LatLng} latlng The position in latlng.
|
1084 |
+
* @return {google.maps.Point} The position in pixels.
|
1085 |
+
* @private
|
1086 |
+
*/
|
1087 |
+
ClusterIcon.prototype.getPosFromLatLng_ = function(latlng) {
|
1088 |
+
var pos = this.getProjection().fromLatLngToDivPixel(latlng);
|
1089 |
+
pos.x -= parseInt(this.width_ / 2, 10);
|
1090 |
+
pos.y -= parseInt(this.height_ / 2, 10);
|
1091 |
+
return pos;
|
1092 |
+
};
|
1093 |
+
|
1094 |
+
|
1095 |
+
/**
|
1096 |
+
* Draw the icon.
|
1097 |
+
* @ignore
|
1098 |
+
*/
|
1099 |
+
ClusterIcon.prototype.draw = function() {
|
1100 |
+
if (this.visible_) {
|
1101 |
+
var pos = this.getPosFromLatLng_(this.center_);
|
1102 |
+
this.div_.style.top = pos.y + 'px';
|
1103 |
+
this.div_.style.left = pos.x + 'px';
|
1104 |
+
}
|
1105 |
+
};
|
1106 |
+
|
1107 |
+
|
1108 |
+
/**
|
1109 |
+
* Hide the icon.
|
1110 |
+
*/
|
1111 |
+
ClusterIcon.prototype.hide = function() {
|
1112 |
+
if (this.div_) {
|
1113 |
+
this.div_.style.display = 'none';
|
1114 |
+
}
|
1115 |
+
this.visible_ = false;
|
1116 |
+
};
|
1117 |
+
|
1118 |
+
|
1119 |
+
/**
|
1120 |
+
* Position and show the icon.
|
1121 |
+
*/
|
1122 |
+
ClusterIcon.prototype.show = function() {
|
1123 |
+
if (this.div_) {
|
1124 |
+
var pos = this.getPosFromLatLng_(this.center_);
|
1125 |
+
this.div_.style.cssText = this.createCss(pos);
|
1126 |
+
this.div_.style.display = '';
|
1127 |
+
}
|
1128 |
+
this.visible_ = true;
|
1129 |
+
};
|
1130 |
+
|
1131 |
+
|
1132 |
+
/**
|
1133 |
+
* Remove the icon from the map
|
1134 |
+
*/
|
1135 |
+
ClusterIcon.prototype.remove = function() {
|
1136 |
+
this.setMap(null);
|
1137 |
+
};
|
1138 |
+
|
1139 |
+
|
1140 |
+
/**
|
1141 |
+
* Implementation of the onRemove interface.
|
1142 |
+
* @ignore
|
1143 |
+
*/
|
1144 |
+
ClusterIcon.prototype.onRemove = function() {
|
1145 |
+
if (this.div_ && this.div_.parentNode) {
|
1146 |
+
this.hide();
|
1147 |
+
this.div_.parentNode.removeChild(this.div_);
|
1148 |
+
this.div_ = null;
|
1149 |
+
}
|
1150 |
+
};
|
1151 |
+
|
1152 |
+
|
1153 |
+
/**
|
1154 |
+
* Set the sums of the icon.
|
1155 |
+
*
|
1156 |
+
* @param {Object} sums The sums containing:
|
1157 |
+
* 'text': (string) The text to display in the icon.
|
1158 |
+
* 'index': (number) The style index of the icon.
|
1159 |
+
*/
|
1160 |
+
ClusterIcon.prototype.setSums = function(sums) {
|
1161 |
+
this.sums_ = sums;
|
1162 |
+
this.text_ = sums.text;
|
1163 |
+
this.index_ = sums.index;
|
1164 |
+
if (this.div_) {
|
1165 |
+
this.div_.innerHTML = sums.text;
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
this.useStyle();
|
1169 |
+
};
|
1170 |
+
|
1171 |
+
|
1172 |
+
/**
|
1173 |
+
* Sets the icon to the the styles.
|
1174 |
+
*/
|
1175 |
+
ClusterIcon.prototype.useStyle = function() {
|
1176 |
+
var index = Math.max(0, this.sums_.index - 1);
|
1177 |
+
index = Math.min(this.styles_.length - 1, index);
|
1178 |
+
var style = this.styles_[index];
|
1179 |
+
this.url_ = style['url'];
|
1180 |
+
this.height_ = style['height'];
|
1181 |
+
this.width_ = style['width'];
|
1182 |
+
this.textColor_ = style['textColor'];
|
1183 |
+
this.anchor_ = style['anchor'];
|
1184 |
+
this.textSize_ = style['textSize'];
|
1185 |
+
this.backgroundPosition_ = style['backgroundPosition'];
|
1186 |
+
};
|
1187 |
+
|
1188 |
+
|
1189 |
+
/**
|
1190 |
+
* Sets the center of the icon.
|
1191 |
+
*
|
1192 |
+
* @param {google.maps.LatLng} center The latlng to set as the center.
|
1193 |
+
*/
|
1194 |
+
ClusterIcon.prototype.setCenter = function(center) {
|
1195 |
+
this.center_ = center;
|
1196 |
+
};
|
1197 |
+
|
1198 |
+
|
1199 |
+
/**
|
1200 |
+
* Create the css text based on the position of the icon.
|
1201 |
+
*
|
1202 |
+
* @param {google.maps.Point} pos The position.
|
1203 |
+
* @return {string} The css style text.
|
1204 |
+
*/
|
1205 |
+
ClusterIcon.prototype.createCss = function(pos) {
|
1206 |
+
var style = [];
|
1207 |
+
style.push('background-image:url(' + this.url_ + ');');
|
1208 |
+
var backgroundPosition = this.backgroundPosition_ ? this.backgroundPosition_ : '0 0';
|
1209 |
+
style.push('background-position:' + backgroundPosition + ';');
|
1210 |
+
|
1211 |
+
if (typeof this.anchor_ === 'object') {
|
1212 |
+
if (typeof this.anchor_[0] === 'number' && this.anchor_[0] > 0 &&
|
1213 |
+
this.anchor_[0] < this.height_) {
|
1214 |
+
style.push('height:' + (this.height_ - this.anchor_[0]) +
|
1215 |
+
'px; padding-top:' + this.anchor_[0] + 'px;');
|
1216 |
+
} else {
|
1217 |
+
style.push('height:' + this.height_ + 'px; line-height:' + this.height_ +
|
1218 |
+
'px;');
|
1219 |
+
}
|
1220 |
+
if (typeof this.anchor_[1] === 'number' && this.anchor_[1] > 0 &&
|
1221 |
+
this.anchor_[1] < this.width_) {
|
1222 |
+
style.push('width:' + (this.width_ - this.anchor_[1]) +
|
1223 |
+
'px; padding-left:' + this.anchor_[1] + 'px;');
|
1224 |
+
} else {
|
1225 |
+
style.push('width:' + this.width_ + 'px; text-align:center;');
|
1226 |
+
}
|
1227 |
+
} else {
|
1228 |
+
style.push('height:' + this.height_ + 'px; line-height:' +
|
1229 |
+
this.height_ + 'px; width:' + this.width_ + 'px; text-align:center;');
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
var txtColor = this.textColor_ ? this.textColor_ : 'black';
|
1233 |
+
var txtSize = this.textSize_ ? this.textSize_ : 11;
|
1234 |
+
|
1235 |
+
style.push('cursor:pointer; top:' + pos.y + 'px; left:' +
|
1236 |
+
pos.x + 'px; color:' + txtColor + '; position:absolute; font-size:' +
|
1237 |
+
txtSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
|
1238 |
+
return style.join('');
|
1239 |
+
};
|
1240 |
+
|
1241 |
+
|
1242 |
+
// Export Symbols for Closure
|
1243 |
+
// If you are not going to compile with closure then you can remove the
|
1244 |
+
// code below.
|
1245 |
+
window['MarkerClusterer'] = MarkerClusterer;
|
1246 |
+
MarkerClusterer.prototype['addMarker'] = MarkerClusterer.prototype.addMarker;
|
1247 |
+
MarkerClusterer.prototype['addMarkers'] = MarkerClusterer.prototype.addMarkers;
|
1248 |
+
MarkerClusterer.prototype['clearMarkers'] =
|
1249 |
+
MarkerClusterer.prototype.clearMarkers;
|
1250 |
+
MarkerClusterer.prototype['fitMapToMarkers'] =
|
1251 |
+
MarkerClusterer.prototype.fitMapToMarkers;
|
1252 |
+
MarkerClusterer.prototype['getCalculator'] =
|
1253 |
+
MarkerClusterer.prototype.getCalculator;
|
1254 |
+
MarkerClusterer.prototype['getGridSize'] =
|
1255 |
+
MarkerClusterer.prototype.getGridSize;
|
1256 |
+
MarkerClusterer.prototype['getExtendedBounds'] =
|
1257 |
+
MarkerClusterer.prototype.getExtendedBounds;
|
1258 |
+
MarkerClusterer.prototype['getMap'] = MarkerClusterer.prototype.getMap;
|
1259 |
+
MarkerClusterer.prototype['getMarkers'] = MarkerClusterer.prototype.getMarkers;
|
1260 |
+
MarkerClusterer.prototype['getMaxZoom'] = MarkerClusterer.prototype.getMaxZoom;
|
1261 |
+
MarkerClusterer.prototype['getStyles'] = MarkerClusterer.prototype.getStyles;
|
1262 |
+
MarkerClusterer.prototype['getTotalClusters'] =
|
1263 |
+
MarkerClusterer.prototype.getTotalClusters;
|
1264 |
+
MarkerClusterer.prototype['getTotalMarkers'] =
|
1265 |
+
MarkerClusterer.prototype.getTotalMarkers;
|
1266 |
+
MarkerClusterer.prototype['redraw'] = MarkerClusterer.prototype.redraw;
|
1267 |
+
MarkerClusterer.prototype['removeMarker'] =
|
1268 |
+
MarkerClusterer.prototype.removeMarker;
|
1269 |
+
MarkerClusterer.prototype['removeMarkers'] =
|
1270 |
+
MarkerClusterer.prototype.removeMarkers;
|
1271 |
+
MarkerClusterer.prototype['resetViewport'] =
|
1272 |
+
MarkerClusterer.prototype.resetViewport;
|
1273 |
+
MarkerClusterer.prototype['repaint'] =
|
1274 |
+
MarkerClusterer.prototype.repaint;
|
1275 |
+
MarkerClusterer.prototype['setCalculator'] =
|
1276 |
+
MarkerClusterer.prototype.setCalculator;
|
1277 |
+
MarkerClusterer.prototype['setGridSize'] =
|
1278 |
+
MarkerClusterer.prototype.setGridSize;
|
1279 |
+
MarkerClusterer.prototype['setMaxZoom'] =
|
1280 |
+
MarkerClusterer.prototype.setMaxZoom;
|
1281 |
+
MarkerClusterer.prototype['onAdd'] = MarkerClusterer.prototype.onAdd;
|
1282 |
+
MarkerClusterer.prototype['draw'] = MarkerClusterer.prototype.draw;
|
1283 |
+
|
1284 |
+
Cluster.prototype['getCenter'] = Cluster.prototype.getCenter;
|
1285 |
+
Cluster.prototype['getSize'] = Cluster.prototype.getSize;
|
1286 |
+
Cluster.prototype['getMarkers'] = Cluster.prototype.getMarkers;
|
1287 |
+
|
1288 |
+
ClusterIcon.prototype['onAdd'] = ClusterIcon.prototype.onAdd;
|
1289 |
+
ClusterIcon.prototype['draw'] = ClusterIcon.prototype.draw;
|
1290 |
+
ClusterIcon.prototype['onRemove'] = ClusterIcon.prototype.onRemove;
|
languages/wp-google-maps-default.mo
ADDED
Binary file
|
languages/wp-google-maps-default.po
ADDED
@@ -0,0 +1,499 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: \n"
|
4 |
+
"POT-Creation-Date: \n"
|
5 |
+
"PO-Revision-Date: \n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=iso-8859-1\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
|
12 |
+
#: wpGoogleMaps.php:882
|
13 |
+
msgid "Your settings have been saved."
|
14 |
+
msgstr ""
|
15 |
+
|
16 |
+
#: wpGoogleMaps.php:910
|
17 |
+
msgid "Your marker location has been saved."
|
18 |
+
msgstr ""
|
19 |
+
|
20 |
+
#: wpGoogleMaps.php:956
|
21 |
+
msgid "There was a problem deleting the map."
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: wpGoogleMaps.php:960
|
25 |
+
msgid "Delete your map"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: wpGoogleMaps.php:960
|
29 |
+
msgid "Are you sure you want to delete the map"
|
30 |
+
msgstr ""
|
31 |
+
|
32 |
+
#: wpGoogleMaps.php:960
|
33 |
+
msgid "Yes"
|
34 |
+
msgstr ""
|
35 |
+
|
36 |
+
#: wpGoogleMaps.php:960
|
37 |
+
msgid "No"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: wpGoogleMaps.php:1005
|
41 |
+
#: wpGoogleMaps.php:1009
|
42 |
+
msgid "Your Maps"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: wpGoogleMaps.php:1005
|
46 |
+
msgid "Add New"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: wpGoogleMaps.php:1010
|
50 |
+
msgid "Pro Version"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: wpGoogleMaps.php:1010
|
54 |
+
msgid "Create unlimited maps"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: wpGoogleMaps.php:1010
|
58 |
+
msgid "with the"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: wpGoogleMaps.php:1010
|
62 |
+
msgid "of WP Google Maps for only"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: wpGoogleMaps.php:1041
|
66 |
+
#: wpGoogleMaps.php:1290
|
67 |
+
#: wpGoogleMaps.php:1385
|
68 |
+
msgid "ID"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: wpGoogleMaps.php:1042
|
72 |
+
#: wpGoogleMaps.php:1204
|
73 |
+
#: wpGoogleMaps.php:1387
|
74 |
+
msgid "Title"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: wpGoogleMaps.php:1043
|
78 |
+
#: wpGoogleMaps.php:1153
|
79 |
+
msgid "Width"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: wpGoogleMaps.php:1044
|
83 |
+
#: wpGoogleMaps.php:1157
|
84 |
+
msgid "Height"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: wpGoogleMaps.php:1045
|
88 |
+
msgid "Type"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: wpGoogleMaps.php:1056
|
92 |
+
msgid "Trash"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: wpGoogleMaps.php:1060
|
96 |
+
#: wpGoogleMaps.php:1420
|
97 |
+
msgid "Edit"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: wpGoogleMaps.php:1102
|
101 |
+
msgid "Add custom icons, titles, descriptions, pictures and links to your markers with the"
|
102 |
+
msgstr ""
|
103 |
+
|
104 |
+
#: wpGoogleMaps.php:1102
|
105 |
+
#: wpGoogleMaps.php:1103
|
106 |
+
#: wpGoogleMaps.php:1163
|
107 |
+
#: wpGoogleMaps.php:1256
|
108 |
+
msgid "Pro Edition"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: wpGoogleMaps.php:1102
|
112 |
+
msgid "of this plugin for just"
|
113 |
+
msgstr ""
|
114 |
+
|
115 |
+
#: wpGoogleMaps.php:1103
|
116 |
+
msgid "Purchase the Pro Edition"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: wpGoogleMaps.php:1103
|
120 |
+
msgid "of WP Google Maps and save your markers to a CSV file!"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: wpGoogleMaps.php:1113
|
124 |
+
msgid "Map Settings"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: wpGoogleMaps.php:1145
|
128 |
+
msgid "Short code"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: wpGoogleMaps.php:1146
|
132 |
+
msgid "copy this into your post or page to display the map"
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: wpGoogleMaps.php:1149
|
136 |
+
msgid "Map Name"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: wpGoogleMaps.php:1162
|
140 |
+
msgid "Default Marker Image"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: wpGoogleMaps.php:1163
|
144 |
+
#: wpGoogleMaps.php:1215
|
145 |
+
#: wpGoogleMaps.php:1217
|
146 |
+
msgid "Upload Image"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: wpGoogleMaps.php:1163
|
150 |
+
msgid "available in the"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: wpGoogleMaps.php:1163
|
154 |
+
msgid "only"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: wpGoogleMaps.php:1166
|
158 |
+
msgid "Map type"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: wpGoogleMaps.php:1168
|
162 |
+
msgid "Roadmap"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: wpGoogleMaps.php:1169
|
166 |
+
msgid "Satellite"
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: wpGoogleMaps.php:1170
|
170 |
+
msgid "Hybrid"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: wpGoogleMaps.php:1171
|
174 |
+
msgid "Terrain"
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: wpGoogleMaps.php:1176
|
178 |
+
msgid "Map Alignment"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: wpGoogleMaps.php:1178
|
182 |
+
msgid "Left"
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: wpGoogleMaps.php:1179
|
186 |
+
msgid "Center"
|
187 |
+
msgstr ""
|
188 |
+
|
189 |
+
#: wpGoogleMaps.php:1180
|
190 |
+
msgid "Right"
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
#: wpGoogleMaps.php:1181
|
194 |
+
#: wpGoogleMaps.php:1222
|
195 |
+
msgid "None"
|
196 |
+
msgstr ""
|
197 |
+
|
198 |
+
#: wpGoogleMaps.php:1189
|
199 |
+
msgid "Remember to save your map!"
|
200 |
+
msgstr ""
|
201 |
+
|
202 |
+
#: wpGoogleMaps.php:1191
|
203 |
+
msgid "Save Map"
|
204 |
+
msgstr ""
|
205 |
+
|
206 |
+
#: wpGoogleMaps.php:1193
|
207 |
+
msgid "Tip: Use your mouse to change the layout of your map. When you have positioned the map to your desired location, press \"Save Map\" to keep your settings."
|
208 |
+
msgstr ""
|
209 |
+
|
210 |
+
#: wpGoogleMaps.php:1199
|
211 |
+
msgid "Add a marker"
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: wpGoogleMaps.php:1209
|
215 |
+
msgid "Address/GPS"
|
216 |
+
msgstr ""
|
217 |
+
|
218 |
+
#: wpGoogleMaps.php:1214
|
219 |
+
#: wpGoogleMaps.php:1389
|
220 |
+
msgid "Description"
|
221 |
+
msgstr ""
|
222 |
+
|
223 |
+
#: wpGoogleMaps.php:1215
|
224 |
+
msgid "Pic URL"
|
225 |
+
msgstr ""
|
226 |
+
|
227 |
+
#: wpGoogleMaps.php:1216
|
228 |
+
msgid "Link URL"
|
229 |
+
msgstr ""
|
230 |
+
|
231 |
+
#: wpGoogleMaps.php:1217
|
232 |
+
msgid "Custom Marker"
|
233 |
+
msgstr ""
|
234 |
+
|
235 |
+
#: wpGoogleMaps.php:1219
|
236 |
+
msgid "Animation"
|
237 |
+
msgstr ""
|
238 |
+
|
239 |
+
#: wpGoogleMaps.php:1229
|
240 |
+
msgid "Add Marker"
|
241 |
+
msgstr ""
|
242 |
+
|
243 |
+
#: wpGoogleMaps.php:1229
|
244 |
+
msgid "Adding"
|
245 |
+
msgstr ""
|
246 |
+
|
247 |
+
#: wpGoogleMaps.php:1230
|
248 |
+
msgid "Save Marker"
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
+
#: wpGoogleMaps.php:1230
|
252 |
+
msgid "Saving"
|
253 |
+
msgstr ""
|
254 |
+
|
255 |
+
#: wpGoogleMaps.php:1238
|
256 |
+
msgid "Your Markers"
|
257 |
+
msgstr ""
|
258 |
+
|
259 |
+
#: wpGoogleMaps.php:1247
|
260 |
+
msgid "Add detailed information to your markers!"
|
261 |
+
msgstr ""
|
262 |
+
|
263 |
+
#: wpGoogleMaps.php:1247
|
264 |
+
#: wpGoogleMaps.php:1251
|
265 |
+
#: wpGoogleMaps.php:1255
|
266 |
+
msgid "Add custom markers to your map!"
|
267 |
+
msgstr ""
|
268 |
+
|
269 |
+
#: wpGoogleMaps.php:1248
|
270 |
+
msgid "Add detailed information to your markers for only"
|
271 |
+
msgstr ""
|
272 |
+
|
273 |
+
#: wpGoogleMaps.php:1248
|
274 |
+
#: wpGoogleMaps.php:1256
|
275 |
+
msgid "Click"
|
276 |
+
msgstr ""
|
277 |
+
|
278 |
+
#: wpGoogleMaps.php:1248
|
279 |
+
#: wpGoogleMaps.php:1256
|
280 |
+
msgid "here"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: wpGoogleMaps.php:1252
|
284 |
+
msgid "Add different marker icons, or your own icons to make your map really stand out!"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: wpGoogleMaps.php:1256
|
288 |
+
msgid "Allow your visitors to get directions to your markers!"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: wpGoogleMaps.php:1262
|
292 |
+
msgid "WP Google Maps encourages you to make use of the amazing icons created by Nicolas Mollet's Maps Icons Collection"
|
293 |
+
msgstr ""
|
294 |
+
|
295 |
+
#: wpGoogleMaps.php:1262
|
296 |
+
msgid "and to credit him when doing so."
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: wpGoogleMaps.php:1290
|
300 |
+
msgid "Edit Marker Location"
|
301 |
+
msgstr ""
|
302 |
+
|
303 |
+
#: wpGoogleMaps.php:1299
|
304 |
+
msgid "Marker Latitude"
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: wpGoogleMaps.php:1303
|
308 |
+
msgid "Marker Longitude"
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: wpGoogleMaps.php:1308
|
312 |
+
msgid "Save Marker Location"
|
313 |
+
msgstr ""
|
314 |
+
|
315 |
+
#: wpGoogleMaps.php:1309
|
316 |
+
msgid "Tip: Use your mouse to change the location of the marker. Simply click and drag it to your desired location."
|
317 |
+
msgstr ""
|
318 |
+
|
319 |
+
#: wpGoogleMaps.php:1371
|
320 |
+
msgid "There are too many markers to make use of the live edit function. The maximum amount for this functionality is 2000 markers. Anything more than that number would crash your browser. In order to edit your markers, you would need to download the table in CSV format, edit it and re-upload it."
|
321 |
+
msgstr ""
|
322 |
+
|
323 |
+
#: wpGoogleMaps.php:1386
|
324 |
+
msgid "Icon"
|
325 |
+
msgstr ""
|
326 |
+
|
327 |
+
#: wpGoogleMaps.php:1388
|
328 |
+
msgid "Address"
|
329 |
+
msgstr ""
|
330 |
+
|
331 |
+
#: wpGoogleMaps.php:1390
|
332 |
+
msgid "Image"
|
333 |
+
msgstr ""
|
334 |
+
|
335 |
+
#: wpGoogleMaps.php:1391
|
336 |
+
msgid "Link"
|
337 |
+
msgstr ""
|
338 |
+
|
339 |
+
#: wpGoogleMaps.php:1392
|
340 |
+
msgid "Action"
|
341 |
+
msgstr ""
|
342 |
+
|
343 |
+
#: wpGoogleMaps.php:1409
|
344 |
+
msgid "View this link"
|
345 |
+
msgstr ""
|
346 |
+
|
347 |
+
#: wpGoogleMaps.php:1420
|
348 |
+
#: wpGoogleMaps.php:1421
|
349 |
+
msgid "Edit this marker"
|
350 |
+
msgstr ""
|
351 |
+
|
352 |
+
#: wpGoogleMaps.php:1421
|
353 |
+
msgid "Edit Location"
|
354 |
+
msgstr ""
|
355 |
+
|
356 |
+
#: wpGoogleMaps.php:1422
|
357 |
+
msgid "Delete this marker"
|
358 |
+
msgstr ""
|
359 |
+
|
360 |
+
#: wpGoogleMaps.php:1422
|
361 |
+
msgid "Delete"
|
362 |
+
msgstr ""
|
363 |
+
|
364 |
+
#: wpGoogleMaps.php:1539
|
365 |
+
msgid "The plugin directory does not have 'write' permissions. Please enable 'write' permissions (755) for "
|
366 |
+
msgstr ""
|
367 |
+
|
368 |
+
#: wpGoogleMaps.php:1541
|
369 |
+
msgid "in order for this plugin to work! Please see "
|
370 |
+
msgstr ""
|
371 |
+
|
372 |
+
#: wpGoogleMaps.php:1543
|
373 |
+
msgid "this page"
|
374 |
+
msgstr ""
|
375 |
+
|
376 |
+
#: wpGoogleMaps.php:1545
|
377 |
+
msgid "for help on how to do it."
|
378 |
+
msgstr ""
|
379 |
+
|
380 |
+
msgid "Get great map markers <a href='http://mapicons.nicolasmollet.com/' target='_BLANK' title='Great Google Map Markers'>here</a>"
|
381 |
+
msgstr ""
|
382 |
+
|
383 |
+
msgid "Bounce"
|
384 |
+
msgstr ""
|
385 |
+
|
386 |
+
msgid "Drop"
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
msgid "Or paste image URL"
|
390 |
+
msgstr ""
|
391 |
+
|
392 |
+
msgid "ignore if you want to use the defaul marker"
|
393 |
+
msgstr ""
|
394 |
+
|
395 |
+
msgid "Format: http://www.domain.com"
|
396 |
+
msgstr ""
|
397 |
+
|
398 |
+
msgid "More details"
|
399 |
+
msgstr ""
|
400 |
+
|
401 |
+
msgid "Get directions"
|
402 |
+
msgstr ""
|
403 |
+
|
404 |
+
msgid "From"
|
405 |
+
msgstr ""
|
406 |
+
|
407 |
+
msgid "To"
|
408 |
+
msgstr ""
|
409 |
+
|
410 |
+
msgid "Go"
|
411 |
+
msgstr ""
|
412 |
+
|
413 |
+
msgid "Please fill out both the 'from' and 'to' fields"
|
414 |
+
msgstr ""
|
415 |
+
|
416 |
+
msgid "Geocode was not successful for the following reason"
|
417 |
+
msgstr ""
|
418 |
+
|
419 |
+
msgid "Header 1 should be 'id', not"
|
420 |
+
msgstr ""
|
421 |
+
|
422 |
+
msgid "Header 2 should be 'map_id', not"
|
423 |
+
msgstr ""
|
424 |
+
|
425 |
+
msgid "Header 3 should be 'address', not"
|
426 |
+
msgstr ""
|
427 |
+
|
428 |
+
msgid "Header 4 should be 'desc', not"
|
429 |
+
msgstr ""
|
430 |
+
|
431 |
+
msgid "Header 5 should be 'pic', not"
|
432 |
+
msgstr ""
|
433 |
+
|
434 |
+
msgid "Header 6 should be 'link', not"
|
435 |
+
msgstr ""
|
436 |
+
|
437 |
+
msgid "Header 7 should be 'icon', not"
|
438 |
+
msgstr ""
|
439 |
+
|
440 |
+
msgid "Header 8 should be 'lat', not"
|
441 |
+
msgstr ""
|
442 |
+
|
443 |
+
msgid "Header 9 should be 'lng', not"
|
444 |
+
msgstr ""
|
445 |
+
|
446 |
+
msgid "Header 10 should be 'anim', not"
|
447 |
+
msgstr ""
|
448 |
+
|
449 |
+
msgid "Header 11 should be 'title', not"
|
450 |
+
msgstr ""
|
451 |
+
|
452 |
+
msgid "CSV import failed"
|
453 |
+
msgstr ""
|
454 |
+
|
455 |
+
msgid "Your CSV file has been successfully imported"
|
456 |
+
msgstr ""
|
457 |
+
|
458 |
+
msgid "Download ALL marker data to a CSV file"
|
459 |
+
msgstr ""
|
460 |
+
|
461 |
+
msgid "Advanced Options"
|
462 |
+
msgstr ""
|
463 |
+
|
464 |
+
msgid "Upload File"
|
465 |
+
msgstr ""
|
466 |
+
|
467 |
+
msgid "Upload CSV File"
|
468 |
+
msgstr ""
|
469 |
+
|
470 |
+
msgid "Replace existing data with data in file"
|
471 |
+
msgstr ""
|
472 |
+
|
473 |
+
msgid "OR"
|
474 |
+
msgstr ""
|
475 |
+
|
476 |
+
msgid "including Pro add-on"
|
477 |
+
msgstr ""
|
478 |
+
|
479 |
+
msgid "including Pro & Gold add-ons"
|
480 |
+
msgstr ""
|
481 |
+
|
482 |
+
msgid "Download this data as a CSV file"
|
483 |
+
msgstr ""
|
484 |
+
|
485 |
+
msgid "Advanced Map Styling"
|
486 |
+
msgstr ""
|
487 |
+
|
488 |
+
msgid "Use the <a href='http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html' target='_BLANK'>Google Maps API Styled Map Wizard</a> to get your style settings"
|
489 |
+
msgstr ""
|
490 |
+
|
491 |
+
msgid "Enable Advanced Styling"
|
492 |
+
msgstr ""
|
493 |
+
|
494 |
+
msgid "Paste the JSON data here"
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
msgid "Save Style Settings"
|
498 |
+
msgstr ""
|
499 |
+
|
readme.txt
CHANGED
@@ -1,34 +1,41 @@
|
|
1 |
=== WP Google Maps ===
|
2 |
Contributors: WPGMaps
|
3 |
Donate link: http://www.wpgmaps.com
|
4 |
-
Tags: google maps, maps,
|
5 |
Requires at least: 2.9.2
|
6 |
-
Tested up to: 3.
|
7 |
Stable tag: trunk
|
8 |
|
9 |
-
Create custom Google Maps with high quality markers containing locations, descriptions, images and links.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized Google map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss. no iFrames and super easy to use!
|
14 |
|
15 |
= Key Features =
|
16 |
* WP Google Maps uses the latest Google Maps API (V3)
|
17 |
* Super easy to use, no coding required!
|
18 |
-
* Create as many map markers as you need by simply typing in the address
|
19 |
-
* Edit your markers with the click of a button
|
20 |
-
*
|
21 |
-
*
|
|
|
|
|
|
|
|
|
22 |
* Create a map in less than a 30 seconds!
|
23 |
-
* WordPress 3.0 friendly
|
24 |
-
*
|
|
|
25 |
|
26 |
= Professional Edition =
|
27 |
* Get the [WP Google Maps Professional Edition](http://www.wpgmaps.com/) for only $9.99
|
28 |
-
*
|
29 |
-
* Add
|
30 |
-
*
|
31 |
-
*
|
|
|
|
|
32 |
|
33 |
|
34 |
== Installation ==
|
@@ -44,6 +51,9 @@ Create custom Google Maps with high quality markers containing locations, descri
|
|
44 |
|
45 |
Simply visit http://www.wpgmaps.com and purchase the Professional Edition for $9.99
|
46 |
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
== Screenshots ==
|
@@ -53,8 +63,82 @@ Simply visit http://www.wpgmaps.com and purchase the Professional Edition for $9
|
|
53 |
3. Users can get directions to your markers
|
54 |
4. Add custom markers
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
== Changelog ==
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
= 3.2 =
|
59 |
* A number of UX changes were implemented.
|
60 |
* Fixed the bug where the Pro edition kept getting overwritten everytime the basic version got updated.
|
1 |
=== WP Google Maps ===
|
2 |
Contributors: WPGMaps
|
3 |
Donate link: http://www.wpgmaps.com
|
4 |
+
Tags: google maps, maps, map, map markers, google, interactive, maps api, wp maps, wp google maps, mappress, easy map
|
5 |
Requires at least: 2.9.2
|
6 |
+
Tested up to: 3.4
|
7 |
Stable tag: trunk
|
8 |
|
9 |
+
The easiest to use Map Plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
The easiest to use Map Plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized Google map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss. no iFrames and super easy to use!
|
14 |
|
15 |
= Key Features =
|
16 |
* WP Google Maps uses the latest Google Maps API (V3)
|
17 |
* Super easy to use, no coding required!
|
18 |
+
* Create as many map markers as you need by simply typing in the address.
|
19 |
+
* Edit your markers with the click of a button.
|
20 |
+
* Drag markers to an exact location
|
21 |
+
* Google Maps Streetview supported.
|
22 |
+
* UTF-8 character support
|
23 |
+
* Support for localization
|
24 |
+
* Choose from four map type: roadmap, terrain, satellite and hybrid.
|
25 |
+
* Define your own width, height and zoom level for your Google Map.
|
26 |
* Create a map in less than a 30 seconds!
|
27 |
+
* WordPress 3.0 friendly.
|
28 |
+
* WordPress MU friendly
|
29 |
+
* No advertising or links.
|
30 |
|
31 |
= Professional Edition =
|
32 |
* Get the [WP Google Maps Professional Edition](http://www.wpgmaps.com/) for only $9.99
|
33 |
+
* Create multiple maps!
|
34 |
+
* Add descriptions, links and images to your Google Map markers.
|
35 |
+
* Add different marker icons =, or your own icons to make your map really stand out!
|
36 |
+
* Add animations to your markers and let them stand out!
|
37 |
+
* Allow your visitors to get directions to your markers.
|
38 |
+
* Export your markers to a CSV file for quick editing.
|
39 |
|
40 |
|
41 |
== Installation ==
|
51 |
|
52 |
Simply visit http://www.wpgmaps.com and purchase the Professional Edition for $9.99
|
53 |
|
54 |
+
= I've installed the plugin, now what? =
|
55 |
+
|
56 |
+
Once installed and activated, a link should appear in your left navigation panel within your WP-ADMIN section. Click on the "WP Google Maps" link and follow the on screen instructions.
|
57 |
|
58 |
|
59 |
== Screenshots ==
|
63 |
3. Users can get directions to your markers
|
64 |
4. Add custom markers
|
65 |
|
66 |
+
== Upgrade Notice ==
|
67 |
+
|
68 |
+
= 4.14 =
|
69 |
+
We have updated our Timthumb.php file to the latest version (2.8.5 to 2.8.10) in compliance with new WordPress regulations.
|
70 |
+
|
71 |
+
= 4.5 =
|
72 |
+
Previous versions may cause your blog to slow down. Upgrading to 4.5 will get rid of this bug and increase your page load speed.
|
73 |
+
|
74 |
+
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 4.14 =
|
78 |
+
* We have updated our Timthumb.php file to the latest version (2.8.5 to 2.8.10) in compliance with new WordPress regulations.
|
79 |
+
|
80 |
+
= 4.13 =
|
81 |
+
* Added support for localization
|
82 |
+
|
83 |
+
= 4.12 =
|
84 |
+
* First draft of localization support added for the basic version
|
85 |
+
* Small bug fixes
|
86 |
+
|
87 |
+
= 4.11 =
|
88 |
+
* Small bug fixes
|
89 |
+
|
90 |
+
= 4.10 =
|
91 |
+
* Small bug fixes
|
92 |
+
|
93 |
+
= 4.9 =
|
94 |
+
* Added support for Cyrillic and other UTF-8 addresses, descriptions and titles
|
95 |
+
* Bug fixes
|
96 |
+
|
97 |
+
= 4.8 =
|
98 |
+
* Bug fix: output caused xxxx characters of unexpected output
|
99 |
+
|
100 |
+
= 4.7 =
|
101 |
+
* Fixed small bug that was found when moving from 4.5 to 4.6
|
102 |
+
|
103 |
+
= 4.6 =
|
104 |
+
* Bug Fixes
|
105 |
+
|
106 |
+
= 4.5 =
|
107 |
+
* Bug fixes: slow loading bug
|
108 |
+
|
109 |
+
= 4.4 =
|
110 |
+
* Security fix: The file Timthumb.php no longer allows external sites. Any image you associate to a marker must be on your WP server.
|
111 |
+
|
112 |
+
= 4.3 =
|
113 |
+
* Added functionality to let users drag their markers to an exact location
|
114 |
+
* Fixed a CSS bug (marker styling)
|
115 |
+
* Added functionality for Wordpress MU
|
116 |
+
|
117 |
+
= 4.2 =
|
118 |
+
* Fixed the bug that was causing duplicate function names with other plugins
|
119 |
+
* Fixed the bug where the map wasnt saving correctly in some instances
|
120 |
+
* Fixed the bug that caused a supposedly hidden field to show in IE.
|
121 |
+
|
122 |
+
= 4.1 =
|
123 |
+
* Killed some bugs!
|
124 |
+
|
125 |
+
= 4.0 =
|
126 |
+
* Added multiple maps functionality and everything that goes with it!
|
127 |
+
* Added Map Alignment functionality (Left, Center, Right, None)
|
128 |
+
* Added Map Type functionality (Roadmap, Terrain, Satellite, Hybrid)
|
129 |
+
* Started using the Geocoding API Version 3 instead of Version 2 resulting in quicker address=>gps results.
|
130 |
+
* Fixed bug that didnt import animation data for CSV files
|
131 |
+
* Fixed a bug that defaulted the zoom functionality
|
132 |
+
|
133 |
+
|
134 |
+
= 3.4 =
|
135 |
+
* Fixed some compatibility bugs with Pro and Basic versions
|
136 |
+
|
137 |
+
= 3.3 =
|
138 |
+
* Fixed a bug that was causing a JS error in IE in some instances
|
139 |
+
* Fixed a jQuery issue
|
140 |
+
* Fixed a bug with the shortcode (if there are more than 2 shortcodes on the post/page)
|
141 |
+
|
142 |
= 3.2 =
|
143 |
* A number of UX changes were implemented.
|
144 |
* Fixed the bug where the Pro edition kept getting overwritten everytime the basic version got updated.
|
wpGoogleMaps.php
CHANGED
@@ -2,25 +2,34 @@
|
|
2 |
/*
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: http://www.wpgmaps.com
|
5 |
-
Description: Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
-
Version:
|
7 |
Author: WP Google Maps
|
8 |
Author URI: http://www.wpgmaps.com
|
9 |
*/
|
10 |
|
|
|
11 |
global $wpgmza_version;
|
12 |
global $wpgmza_p_version;
|
13 |
global $wpgmza_t;
|
14 |
global $wpgmza_tblname;
|
|
|
15 |
global $wpdb;
|
16 |
global $wpgmza_p;
|
17 |
global $wpgmza_g;
|
18 |
global $short_code_active;
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
$wpgmza_p = false;
|
20 |
$wpgmza_g = false;
|
21 |
$wpgmza_tblname = $wpdb->prefix . "wpgmza";
|
22 |
-
$
|
23 |
-
$
|
|
|
24 |
$wpgmza_t = "basic";
|
25 |
|
26 |
add_action('admin_head', 'wpgmaps_head');
|
@@ -28,62 +37,102 @@ add_action('admin_footer', 'wpgmaps_reload_map_on_post');
|
|
28 |
register_activation_hook( __FILE__, 'wpgmaps_activate' );
|
29 |
register_deactivation_hook( __FILE__, 'wpgmaps_deactivate' );
|
30 |
add_action('init', 'wpgmaps_init');
|
31 |
-
add_action('save_post', 'wpgmaps_save_postdata');
|
32 |
add_action('admin_menu', 'wpgmaps_admin_menu');
|
33 |
add_filter('widget_text', 'do_shortcode');
|
34 |
|
|
|
|
|
35 |
|
36 |
-
function wpgmaps_activate() {
|
37 |
|
|
|
38 |
global $wpdb;
|
39 |
global $wpgmza_version;
|
40 |
-
|
41 |
$table_name = $wpdb->prefix . "wpgmza";
|
42 |
-
|
43 |
-
wpgmaps_handle_db();
|
44 |
|
|
|
45 |
|
46 |
-
$wpgmza_data = get_option("WPGMZA");
|
47 |
-
if (!$wpgmza_data) { add_option("WPGMZA",array("map_start_lat" => "51.5081290", "map_start_lng" => "-0.1280050", "map_width" => "600", "map_height" => "400", "map_start_location" => "London", "map_start_zoom" => "5", "directions_enable" => '1')); }
|
48 |
-
$results = $wpdb->get_results("SELECT * FROM $table_name WHERE `map_id` = '1'");
|
49 |
-
if (!$results) { $rows_affected = $wpdb->insert( $table_name, array( 'map_id' => '1', 'address' => 'London', 'lat' => '51.5081290', 'lng' => '-0.1280050' ) ); }
|
50 |
-
|
51 |
-
wpgmza_cURL_response("activate");
|
52 |
|
|
|
53 |
|
54 |
-
|
55 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
58 |
-
|
|
|
|
|
59 |
|
60 |
|
61 |
|
62 |
|
|
|
|
|
|
|
|
|
63 |
}
|
64 |
-
function wpgmaps_deactivate() {
|
65 |
-
//delete_option("WPGMZA");
|
66 |
-
wpgmza_cURL_response("deactivate");
|
67 |
-
}
|
68 |
-
|
69 |
function wpgmaps_init() {
|
70 |
wp_enqueue_script("jquery");
|
71 |
-
|
72 |
-
|
73 |
-
}
|
74 |
|
75 |
function wpgmaps_reload_map_on_post() {
|
|
|
76 |
if (isset($_POST['wpgmza_savemap'])){
|
77 |
-
|
78 |
-
$
|
79 |
-
$
|
80 |
-
$
|
81 |
-
$
|
82 |
-
$
|
83 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
85 |
-
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
|
86 |
-
|
87 |
?>
|
88 |
<script type="text/javascript" >
|
89 |
jQuery(function() {
|
@@ -95,21 +144,141 @@ function wpgmaps_reload_map_on_post() {
|
|
95 |
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
96 |
MYMAP.init('#wpgmza_map', myLatLng, <?php echo $start_zoom; ?>);
|
97 |
UniqueCode=Math.round(Math.random()*10010);
|
98 |
-
MYMAP.placeMarkers('<?php echo
|
99 |
|
100 |
});
|
101 |
</script>
|
102 |
<?php
|
103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
}
|
107 |
|
108 |
function wpgmaps_admin_javascript_basic() {
|
|
|
|
|
109 |
$ajax_nonce = wp_create_nonce("wpgmza");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
-
if (is_admin() && $_GET['page'] == 'wp-google-maps-menu') {
|
112 |
-
wpgmaps_update_xml_file();
|
113 |
|
114 |
?>
|
115 |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
@@ -131,31 +300,23 @@ function wpgmaps_admin_javascript_basic() {
|
|
131 |
"bProcessing": true
|
132 |
});
|
133 |
}
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
$wpgmza_lng = $wpgmza_data['map_start_lng'];
|
141 |
-
$wpgmza_width = $wpgmza_data['map_width'];
|
142 |
-
$wpgmza_height = $wpgmza_data['map_height'];
|
143 |
-
$start_zoom = $wpgmza_data['map_start_zoom'];
|
144 |
-
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
145 |
-
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
|
146 |
-
?>
|
147 |
-
|
148 |
|
149 |
jQuery("#wpgmza_map").css({
|
150 |
height:<?php echo $wpgmza_height; ?>,
|
151 |
width:<?php echo $wpgmza_width; ?>
|
152 |
|
153 |
});
|
154 |
-
var
|
155 |
-
|
156 |
-
|
157 |
-
MYMAP.placeMarkers('<?php echo wpgmaps_get_plugin_url(); ?>/markers.xml?u='+UniqueCode);
|
158 |
|
|
|
159 |
jQuery(".wpgmza_del_btn").live("click", function() {
|
160 |
var cur_id = jQuery(this).attr("id");
|
161 |
var wpgm_map_id = "0";
|
@@ -167,20 +328,7 @@ function wpgmaps_admin_javascript_basic() {
|
|
167 |
marker_id: cur_id
|
168 |
};
|
169 |
jQuery.post(ajaxurl, data, function(response) {
|
170 |
-
|
171 |
-
$wpgmza_data = get_option('WPGMZA');
|
172 |
-
$wpgmza_lat = $wpgmza_data['map_start_lat'];
|
173 |
-
$wpgmza_lng = $wpgmza_data['map_start_lng'];
|
174 |
-
$wpgmza_width = $wpgmza_data['map_width'];
|
175 |
-
$wpgmza_height = $wpgmza_data['map_height'];
|
176 |
-
$start_zoom = $wpgmza_data['map_start_zoom'];
|
177 |
-
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
178 |
-
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; } // show London
|
179 |
-
?>
|
180 |
-
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
181 |
-
MYMAP.init('#wpgmza_map', myLatLng, <?php echo $start_zoom; ?>);
|
182 |
-
UniqueCode=Math.round(Math.random()*11200);
|
183 |
-
MYMAP.placeMarkers('<?php echo wpgmaps_get_plugin_url(); ?>/markers.xml?u='+UniqueCode);
|
184 |
jQuery("#wpgmza_marker_holder").html(response);
|
185 |
wpgmza_reinitialisetbl();
|
186 |
//jQuery("#wpgmza_tr_"+cur_id).css("display","none");
|
@@ -193,8 +341,10 @@ function wpgmaps_admin_javascript_basic() {
|
|
193 |
jQuery(".wpgmza_edit_btn").live("click", function() {
|
194 |
var cur_id = jQuery(this).attr("id");
|
195 |
var wpgmza_edit_address = jQuery("#wpgmza_hid_marker_address_"+cur_id).val();
|
|
|
196 |
jQuery("#wpgmza_edit_id").val(cur_id);
|
197 |
jQuery("#wpgmza_add_address").val(wpgmza_edit_address);
|
|
|
198 |
jQuery("#wpgmza_addmarker_div").hide();
|
199 |
jQuery("#wpgmza_editmarker_div").show();
|
200 |
});
|
@@ -206,24 +356,43 @@ function wpgmaps_admin_javascript_basic() {
|
|
206 |
jQuery("#wpgmza_addmarker_loading").show();
|
207 |
|
208 |
var wpgm_address = "0";
|
|
|
209 |
var wpgm_map_id = "0";
|
210 |
if (document.getElementsByName("wpgmza_add_address").length > 0) { wpgm_address = jQuery("#wpgmza_add_address").val(); }
|
211 |
if (document.getElementsByName("wpgmza_id").length > 0) { wpgm_map_id = jQuery("#wpgmza_id").val(); }
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
});
|
|
|
227 |
|
228 |
});
|
229 |
|
@@ -238,124 +407,156 @@ function wpgmaps_admin_javascript_basic() {
|
|
238 |
wpgm_edit_id = parseInt(jQuery("#wpgmza_edit_id").val());
|
239 |
var wpgm_address = "0";
|
240 |
var wpgm_map_id = "0";
|
|
|
241 |
if (document.getElementsByName("wpgmza_add_address").length > 0) { wpgm_address = jQuery("#wpgmza_add_address").val(); }
|
242 |
if (document.getElementsByName("wpgmza_id").length > 0) { wpgm_map_id = jQuery("#wpgmza_id").val(); }
|
243 |
|
244 |
-
var data = {
|
245 |
-
action: 'edit_marker',
|
246 |
-
security: '<?php echo $ajax_nonce; ?>',
|
247 |
-
map_id: wpgm_map_id,
|
248 |
-
edit_id: wpgm_edit_id,
|
249 |
-
address: wpgm_address
|
250 |
-
};
|
251 |
-
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
wpgmza_reinitialisetbl();
|
274 |
|
275 |
|
276 |
-
});
|
277 |
|
278 |
});
|
279 |
});
|
280 |
|
281 |
});
|
282 |
|
283 |
-
|
|
|
284 |
var MYMAP = {
|
285 |
map: null,
|
286 |
bounds: null
|
287 |
}
|
288 |
MYMAP.init = function(selector, latLng, zoom) {
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
|
298 |
-
|
|
|
|
|
299 |
jQuery.get(filename, function(xml){
|
300 |
jQuery(xml).find("marker").each(function(){
|
301 |
-
var
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
jQuery("#wpgmza_start_zoom").val(zoomLevel);
|
326 |
-
if (zoomLevel == 0) {
|
327 |
-
MYMAP.map.setZoom(10);
|
328 |
-
}
|
329 |
-
});
|
330 |
-
google.maps.event.addListener(MYMAP.map, 'center_changed', function() {
|
331 |
-
var location = MYMAP.map.getCenter();
|
332 |
-
jQuery("#wpgmza_start_location").val(location.lat()+","+location.lng());
|
333 |
-
jQuery("#wpgmaps_save_reminder").show();
|
334 |
-
});
|
335 |
-
|
336 |
|
337 |
});
|
338 |
});
|
339 |
}
|
340 |
|
|
|
|
|
|
|
|
|
|
|
341 |
</script>
|
342 |
<?php
|
343 |
}
|
|
|
344 |
|
345 |
}
|
346 |
|
347 |
|
348 |
function wpgmaps_user_javascript_basic() {
|
349 |
global $short_code_active;
|
|
|
|
|
|
|
350 |
if ($short_code_active) {
|
351 |
|
352 |
$ajax_nonce = wp_create_nonce("wpgmza");
|
353 |
-
|
354 |
-
|
355 |
-
$
|
356 |
-
|
357 |
-
|
358 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
360 |
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
|
361 |
|
@@ -363,16 +564,16 @@ function wpgmaps_user_javascript_basic() {
|
|
363 |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
364 |
<link rel='stylesheet' id='wpgooglemaps-css' href='<?php echo wpgmaps_get_plugin_url(); ?>/css/wpgmza_style.css' type='text/css' media='all' />
|
365 |
<script type="text/javascript" >
|
366 |
-
|
367 |
|
368 |
-
|
369 |
|
370 |
|
371 |
|
372 |
-
|
373 |
|
374 |
|
375 |
-
|
376 |
height:<?php echo $wpgmza_height; ?>,
|
377 |
width:<?php echo $wpgmza_width; ?>
|
378 |
|
@@ -380,7 +581,7 @@ function wpgmaps_user_javascript_basic() {
|
|
380 |
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
381 |
MYMAP.init('#wpgmza_map', myLatLng, <?php echo $start_zoom; ?>);
|
382 |
UniqueCode=Math.round(Math.random()*10000);
|
383 |
-
MYMAP.placeMarkers('<?php echo
|
384 |
|
385 |
|
386 |
});
|
@@ -394,37 +595,42 @@ function wpgmaps_user_javascript_basic() {
|
|
394 |
var myOptions = {
|
395 |
zoom:zoom,
|
396 |
center: latLng,
|
397 |
-
mapTypeId: google.maps.MapTypeId
|
398 |
}
|
399 |
-
|
|
|
400 |
this.bounds = new google.maps.LatLngBounds();
|
401 |
|
402 |
}
|
403 |
|
404 |
|
405 |
|
406 |
-
MYMAP.placeMarkers = function(filename) {
|
407 |
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
var lat = jWPGMZA(this).find('lat').text();
|
412 |
-
var lng = jWPGMZA(this).find('lng').text();
|
413 |
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
map: MYMAP.map
|
419 |
-
});
|
420 |
-
var infoWindow = new google.maps.InfoWindow();
|
421 |
-
var html='<strong>'+wpmgza_address+'</strong>';
|
422 |
|
423 |
-
|
424 |
-
|
425 |
-
|
|
|
|
|
|
|
|
|
|
|
426 |
|
427 |
-
|
|
|
|
|
|
|
|
|
|
|
428 |
});
|
429 |
});
|
430 |
}
|
@@ -432,15 +638,22 @@ function wpgmaps_user_javascript_basic() {
|
|
432 |
</script>
|
433 |
<?php
|
434 |
}
|
|
|
435 |
}
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
-
function wpgmaps_update_xml_file() {
|
441 |
-
|
442 |
|
|
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
global $wpdb;
|
445 |
$dom = new DOMDocument('1.0');
|
446 |
$dom->formatOutput = true;
|
@@ -452,7 +665,8 @@ function wpgmaps_update_xml_file() {
|
|
452 |
"
|
453 |
SELECT *
|
454 |
FROM $table_name
|
455 |
-
|
|
|
456 |
"
|
457 |
);
|
458 |
|
@@ -468,8 +682,15 @@ function wpgmaps_update_xml_file() {
|
|
468 |
if ($link_url) { } else { $link_url = ""; }
|
469 |
$lat = $result->lat;
|
470 |
$lng = $result->lng;
|
|
|
|
|
|
|
471 |
|
472 |
$channel = $channel_main->appendChild($dom->createElement('marker'));
|
|
|
|
|
|
|
|
|
473 |
$title = $channel->appendChild($dom->createElement('address'));
|
474 |
$title->appendChild($dom->CreateTextNode($address));
|
475 |
$desc = $channel->appendChild($dom->createElement('desc'));
|
@@ -484,18 +705,34 @@ function wpgmaps_update_xml_file() {
|
|
484 |
$bd->appendChild($dom->CreateTextNode($lat));
|
485 |
$bd = $channel->appendChild($dom->createElement('lng'));
|
486 |
$bd->appendChild($dom->CreateTextNode($lng));
|
|
|
|
|
487 |
|
488 |
|
489 |
}
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
|
|
|
|
|
|
|
495 |
}
|
496 |
|
497 |
|
498 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
|
500 |
|
501 |
|
@@ -505,24 +742,19 @@ function wpgmaps_action_callback_basic() {
|
|
505 |
global $wpgmza_p;
|
506 |
$check = check_ajax_referer( 'wpgmza', 'security' );
|
507 |
$table_name = $wpdb->prefix . "wpgmza";
|
|
|
508 |
if ($check == 1) {
|
509 |
|
510 |
if ($_POST['action'] == "add_marker") {
|
511 |
-
$
|
512 |
-
$
|
513 |
-
|
514 |
-
$rows_affected = $wpdb->insert( $table_name, array( 'map_id' => $_POST['map_id'], 'address' => $_POST['address'], 'lat' => $lat, 'lng' => $lng ) );
|
515 |
-
wpgmaps_update_xml_file();
|
516 |
-
echo wpgmza_return_marker_list();
|
517 |
}
|
518 |
if ($_POST['action'] == "edit_marker") {
|
519 |
-
$gps = wpgmza_get_lat_long($_POST['address']);
|
520 |
-
$lat = $gps['lat'];
|
521 |
-
$lng = $gps['lng'];
|
522 |
$cur_id = $_POST['edit_id'];
|
523 |
-
$rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET address = %s, lat = %f, lng = %f WHERE id = %d", $_POST['address'], $lat, $lng, $cur_id) );
|
524 |
-
wpgmaps_update_xml_file();
|
525 |
-
echo wpgmza_return_marker_list();
|
526 |
}
|
527 |
if ($_POST['action'] == "delete_marker") {
|
528 |
$marker_id = $_POST['marker_id'];
|
@@ -533,8 +765,8 @@ function wpgmaps_action_callback_basic() {
|
|
533 |
LIMIT 1
|
534 |
"
|
535 |
);
|
536 |
-
wpgmaps_update_xml_file();
|
537 |
-
echo wpgmza_return_marker_list();
|
538 |
|
539 |
}
|
540 |
}
|
@@ -544,23 +776,44 @@ function wpgmaps_action_callback_basic() {
|
|
544 |
}
|
545 |
|
546 |
function wpgmaps_load_maps_api() {
|
|
|
547 |
wp_enqueue_script('google-maps' , 'http://maps.google.com/maps/api/js?sensor=true' , false , '3');
|
|
|
548 |
}
|
549 |
|
550 |
function wpgmaps_tag_basic( $atts ) {
|
551 |
-
|
552 |
-
|
|
|
|
|
553 |
), $atts ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
|
555 |
$ret_msg = "
|
556 |
<style>
|
557 |
#wpgmza_map img { max-width:none !important; }
|
558 |
</style>
|
559 |
-
<div id=\"wpgmza_map\"> </div>
|
560 |
|
561 |
|
562 |
";
|
563 |
return $ret_msg;
|
|
|
564 |
}
|
565 |
|
566 |
function wpgmaps_get_plugin_url() {
|
@@ -570,34 +823,99 @@ function wpgmaps_get_plugin_url() {
|
|
570 |
}
|
571 |
|
572 |
function wpgmaps_head() {
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
|
|
|
|
|
|
|
|
|
|
|
576 |
|
577 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
578 |
|
579 |
-
$data['map_name'] = attribute_escape($_POST['wpgmza_name']);
|
580 |
-
$data['map_height'] = attribute_escape($_POST['wpgmza_height']);
|
581 |
-
$data['map_width'] = attribute_escape($_POST['wpgmza_width']);
|
582 |
-
$data['map_start_location'] = attribute_escape($_POST['wpgmza_start_location']);
|
583 |
-
$data['map_start_zoom'] = intval($_POST['wpgmza_start_zoom']);
|
584 |
-
$data['directions_enabled'] = intval($_POST['wpgmza_directions']);
|
585 |
-
$gps = wpgmza_get_lat_long($data['map_start_location']);
|
586 |
-
$data['map_start_lat'] = $gps['lat'];
|
587 |
-
$data['map_start_lng'] = $gps['lng'];
|
588 |
-
$data['map_default_marker'] = $_POST['upload_default_marker'];
|
589 |
-
|
590 |
-
update_option('WPGMZA', $data);
|
591 |
-
$wpgmza_data = get_option('WPGMZA');
|
592 |
-
echo "
|
593 |
-
<div class='updated'>
|
594 |
-
Your settings have been saved.
|
595 |
-
</div>
|
596 |
-
";
|
597 |
}
|
598 |
|
599 |
|
600 |
|
|
|
601 |
|
602 |
}
|
603 |
|
@@ -607,45 +925,199 @@ function wpgmaps_head() {
|
|
607 |
|
608 |
|
609 |
function wpgmaps_admin_menu() {
|
610 |
-
add_menu_page('
|
|
|
|
|
|
|
|
|
611 |
// add_options_page('WP Google Maps', 'WP Google Maps', 'manage_options', 'wp-google-maps-menu', 'wpgmaps_menu_layout');
|
612 |
}
|
613 |
function wpgmaps_menu_layout() {
|
614 |
-
|
615 |
//check to see if we have write permissions to the plugin folder
|
616 |
-
|
617 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
618 |
|
619 |
}
|
|
|
|
|
|
|
|
|
620 |
|
|
|
621 |
|
|
|
|
|
622 |
|
623 |
-
|
624 |
-
|
625 |
-
|
|
|
|
|
|
|
|
|
|
|
626 |
|
627 |
-
if ($wpgmza_data['map_start_zoom']) { $wpgmza_zoom[$wpgmza_data['map_start_zoom']] = "SELECTED"; } else { $wpgmza_zoom[8] = "SELECTED"; }
|
628 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
629 |
|
630 |
-
$
|
631 |
-
$
|
632 |
-
|
|
|
633 |
|
634 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
635 |
echo "
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
<
|
642 |
-
<
|
643 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
644 |
|
645 |
<input type='hidden' name='http_referer' value='".$_SERVER['PHP_SELF']."' />
|
646 |
-
<input type='hidden' name='wpgmza_id' id='wpgmza_id' value='".$
|
647 |
-
<input id='wpgmza_start_location' name='wpgmza_start_location' type='hidden' size='40' maxlength='100' value='".$
|
648 |
-
<select id='wpgmza_start_zoom' name='wpgmza_start_zoom'
|
649 |
<option value=\"1\" ".$wpgmza_zoom[1].">1</option>
|
650 |
<option value=\"2\" ".$wpgmza_zoom[2].">2</option>
|
651 |
<option value=\"3\" ".$wpgmza_zoom[3].">3</option>
|
@@ -668,120 +1140,238 @@ function wpgmza_basic_menu() {
|
|
668 |
<option value=\"20\" ".$wpgmza_zoom[20].">20</option>
|
669 |
<option value=\"21\" ".$wpgmza_zoom[21].">21</option>
|
670 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
671 |
|
672 |
|
673 |
-
|
674 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
676 |
|
677 |
-
|
678 |
|
|
|
|
|
679 |
|
680 |
|
|
|
681 |
|
682 |
-
<p class='submit'><input type='submit' name='wpgmza_savemap' value='Save Map »' /></p>
|
683 |
-
<div id=\"wpgmaps_save_reminder\" style=\"display:none;\"><span style=\"font-size:16px; color:#1C62B9;\">Remember to save your map!</span></div>
|
684 |
-
<p style=\"width:600px; color:#808080;\">Tip: Use your mouse to change the layout of your map. When you have positioned the map to your desired location, press \"Save Map\" to keep your settings.</p>
|
685 |
|
686 |
-
|
687 |
-
<div id=\"wpgmza_map\"> </div>
|
688 |
-
<div style=\"display:block; overflow:auto; background-color:#FFFBCC; padding:10px; border:1px solid #E6DB55; margin-top:5px; margin-bottom:5px;\">
|
689 |
-
<h2 style=\"padding-top:0; margin-top:0;\">Add a marker</h2>
|
690 |
-
<p>
|
691 |
-
<table>
|
692 |
-
<input type=\"hidden\" name=\"wpgmza_edit_id\" id=\"wpgmza_edit_id\" value=\"\" />
|
693 |
-
<tr>
|
694 |
-
<td>Address: </td>
|
695 |
-
<td><input id='wpgmza_add_address' name='wpgmza_add_address' type='text' size='35' maxlength='200' value='' /> <br /></td>
|
696 |
|
697 |
-
|
698 |
|
699 |
-
|
700 |
-
<tr><td>Pic URL: </td><td><input id='wpgmza_add_pic' name=\"wpgmza_add_pic\" type='text' size='35' maxlength='700' value='' ".$wpgmza_act."/> <input id=\"upload_image_button\" type=\"button\" value=\"Upload Image\" $wpgmza_act /><br /></td></tr>
|
701 |
-
<tr><td>Link URL: </td><td><input id='wpgmza_link_url' name='wpgmza_link_url' type='text' size='35' maxlength='700' value='' ".$wpgmza_act." /></td></tr>
|
702 |
-
<tr><td>Custom Marker: </td><td><input id='wpgmza_add_custom_marker' name=\"wpgmza_add_custom_marker\" type='hidden' size='35' maxlength='700' value='' ".$wpgmza_act."/> <input id=\"upload_custom_marker_button\" type=\"button\" value=\"Upload Image\" $wpgmza_act /> </td></tr>
|
703 |
|
704 |
-
|
705 |
-
<td></td>
|
706 |
-
<td>
|
707 |
-
<span id=\"wpgmza_addmarker_div\"><a href='javascript:void(0);' id='wpgmza_addmarker'><big>Add Marker >></big></a></span> <span id=\"wpgmza_addmarker_loading\" style=\"display:none;\">Adding...</span>
|
708 |
-
<span id=\"wpgmza_editmarker_div\" style=\"display:none;\"><a href='javascript:void(0);' id='wpgmza_editmarker'><big>Save Marker >></big></a></span><span id=\"wpgmza_editmarker_loading\" style=\"display:none;\">Saving...</span>
|
709 |
-
</td>
|
710 |
|
711 |
-
|
712 |
|
713 |
-
</table>
|
714 |
-
</div>
|
715 |
-
<p>$wpgmza_act_msg</p>
|
716 |
-
<h2 style=\"padding-top:0; margin-top:0;\">Your Markers</h2>
|
717 |
-
<div id=\"wpgmza_marker_holder\">
|
718 |
-
".wpgmza_return_marker_list()."
|
719 |
-
</div>
|
720 |
-
|
721 |
-
<br /><br />$wpgmza_csv
|
722 |
-
|
723 |
-
<table>
|
724 |
-
<tr>
|
725 |
-
<td><img src=\"".wpgmaps_get_plugin_url()."/images/custom_markers.jpg\" width=\"160\" style=\"border:3px solid #808080;\" title=\"Add detailed information to your markers!\" alt=\"Add custom markers to your map!\" /><br /><br /></td>
|
726 |
-
<td valign=\"middle\"><span style=\"font-size:18px; color:#666;\">Add detailed information to your markers for only <strong>$9.99</strong>. Click <a href=\"http://www.wpgmaps.com/purchase-professional-version/\" title=\"Pro Edition\" target=\"_BLANK\">here</a></span></td>
|
727 |
-
</tr>
|
728 |
-
<tr>
|
729 |
-
<td><img src=\"".wpgmaps_get_plugin_url()."/images/custom_marker_icons.jpg\" width=\"160\" style=\"border:3px solid #808080;\" title=\"Add custom markers to your map!\" alt=\"Add custom markers to your map!\" /><br /><br /></td>
|
730 |
-
<td valign=\"middle\"><span style=\"font-size:18px; color:#666;\">Add different marker icons, or your own icons to make your map really stand out!</span></td>
|
731 |
-
</tr>
|
732 |
-
<tr>
|
733 |
-
<td><img src=\"".wpgmaps_get_plugin_url()."/images/get_directions.jpg\" width=\"160\" style=\"border:3px solid #808080;\" title=\"Add custom markers to your map!\" alt=\"Add custom markers to your map!\" /><br /><br /></td>
|
734 |
-
<td valign=\"middle\"><span style=\"font-size:18px; color:#666;\">Allow your visitors to get directions to your markers! Click <a href=\"http://www.wpgmaps.com/purchase-professional-version/\" title=\"Pro Edition\" target=\"_BLANK\">here</a></span></td>
|
735 |
-
</tr>
|
736 |
-
</table>
|
737 |
|
738 |
-
</form>
|
739 |
|
740 |
-
|
741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
|
|
|
|
|
743 |
|
744 |
-
</div>
|
745 |
|
|
|
746 |
|
747 |
|
748 |
-
";
|
749 |
|
|
|
|
|
|
|
750 |
|
751 |
|
752 |
|
753 |
}
|
754 |
|
755 |
|
756 |
-
|
|
|
|
|
|
|
|
|
757 |
wp_enqueue_script('media-upload');
|
758 |
wp_enqueue_script('thickbox');
|
759 |
wp_register_script('my-upload', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/upload.js', array('jquery','media-upload','thickbox'));
|
760 |
wp_enqueue_script('my-upload');
|
761 |
-
|
762 |
|
763 |
}
|
764 |
|
765 |
-
function
|
766 |
wp_enqueue_style('thickbox');
|
767 |
}
|
768 |
|
769 |
if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
|
|
|
770 |
|
771 |
-
add_action('admin_print_scripts', '
|
772 |
-
add_action('admin_print_styles', '
|
|
|
773 |
}
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
-
function wpgmza_return_marker_list() {
|
|
|
|
|
779 |
global $wpdb;
|
780 |
global $wpgmza_tblname;
|
781 |
|
782 |
-
$marker_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpgmza_tblname;" ) );
|
783 |
if ($marker_count > 2000) {
|
784 |
-
return "There are too many markers to make use of the live edit function. The maximum amount for this functionality is 2000 markers. Anything more than that number would crash your browser. In order to edit your markers, you would need to download the table in CSV format, edit it and re-upload it.";
|
785 |
} else {
|
786 |
|
787 |
|
@@ -789,19 +1379,20 @@ function wpgmza_return_marker_list() {
|
|
789 |
$results = $wpdb->get_results("
|
790 |
SELECT *
|
791 |
FROM $wpgmza_tblname
|
792 |
-
WHERE `map_id` = '
|
793 |
");
|
794 |
$wpgmza_tmp .= "
|
795 |
<table id=\"wpgmza_table\" class=\"display\" cellspacing=\"0\" cellpadding=\"0\">
|
796 |
<thead>
|
797 |
<tr>
|
798 |
-
<th><strong>ID</strong></th>
|
799 |
-
<th><strong>Icon</strong></th>
|
800 |
-
<th><strong>
|
801 |
-
<th><strong>
|
802 |
-
<th><strong>
|
803 |
-
<th><strong>
|
804 |
-
<th><strong>
|
|
|
805 |
</tr>
|
806 |
</thead>
|
807 |
<tbody>
|
@@ -818,51 +1409,31 @@ function wpgmza_return_marker_list() {
|
|
818 |
|
819 |
if (!$img) { $pic = ""; } else { $pic = "<img src=\"".$result->pic."\" width=\"40\" />"; }
|
820 |
if (!$icon) { $icon = $default_icon; } else { $icon = "<img src='".$result->icon."' />"; }
|
821 |
-
if (!$link) { $linktd = ""; } else { $linktd = "<a href=\"".$result->link."\" target=\"_BLANK\" title=\"View this link\">>></a>"; }
|
822 |
$wpgmza_tmp .= "
|
823 |
<tr id=\"wpgmza_tr_".$result->id."\">
|
824 |
<td height=\"40\">".$result->id."</td>
|
825 |
-
<td height=\"40\">".$icon."<input type=\"hidden\" id=\"wpgmza_hid_marker_icon_".$result->id."\" value=\"".$result->icon."\" /></td>
|
|
|
826 |
<td>".$result->address."<input type=\"hidden\" id=\"wpgmza_hid_marker_address_".$result->id."\" value=\"".$result->address."\" /></td>
|
827 |
<td>".$result->desc."<input type=\"hidden\" id=\"wpgmza_hid_marker_desc_".$result->id."\" value=\"".$result->desc."\" /></td>
|
828 |
<td>$pic<input type=\"hidden\" id=\"wpgmza_hid_marker_pic_".$result->id."\" value=\"".$result->pic."\" /></td>
|
829 |
<td>$linktd<input type=\"hidden\" id=\"wpgmza_hid_marker_link_".$result->id."\" value=\"".$result->link."\" /></td>
|
830 |
<td>
|
831 |
-
<a href=\"#wpgmaps_marker\" title=\"Edit this marker\" class=\"wpgmza_edit_btn\" id=\"".$result->id."\">Edit</a> |
|
832 |
-
<a href=\"
|
|
|
833 |
</td>
|
834 |
</tr>";
|
835 |
}
|
836 |
$wpgmza_tmp .= "</tbody></table>";
|
837 |
|
|
|
838 |
return $wpgmza_tmp;
|
839 |
}
|
840 |
}
|
841 |
|
842 |
|
843 |
-
function wpgmaps_save_postdata( $post_id ) {
|
844 |
-
|
845 |
-
|
846 |
-
if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__) )) {
|
847 |
-
return $post_id;
|
848 |
-
}
|
849 |
-
|
850 |
-
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
|
851 |
-
return $post_id;
|
852 |
-
|
853 |
-
if ( 'page' == $_POST['post_type'] ) {
|
854 |
-
if ( !current_user_can( 'edit_page', $post_id ) )
|
855 |
-
return $post_id;
|
856 |
-
} else {
|
857 |
-
if ( !current_user_can( 'edit_post', $post_id ) )
|
858 |
-
return $post_id;
|
859 |
-
}
|
860 |
-
|
861 |
-
|
862 |
-
$mydata = $_POST['myplugin_new_field'];
|
863 |
-
|
864 |
-
return $mydata;
|
865 |
-
}
|
866 |
|
867 |
|
868 |
function wpgmaps_chmodr($path, $filemode) {
|
@@ -890,65 +1461,6 @@ function wpgmaps_chmodr($path, $filemode) {
|
|
890 |
return FALSE;
|
891 |
}
|
892 |
|
893 |
-
function wpgmza_get_lat_long($address) {
|
894 |
-
|
895 |
-
|
896 |
-
define("MAPS_HOST", "maps.google.com");
|
897 |
-
// define("KEY", "ABQIAAAA3lby-Oyzu5Elblu1dTk6khRkbnrZzb7DRK_IleYVa0py8MpCNhSBQRpvzubFzk3Bgbu_0aDhfMiAng");
|
898 |
-
define("KEY", "AIzaSyABfpdsxk4_64Cdj3gCRlh0HkXXu2hiVBc");
|
899 |
-
$base_url = "http://" . MAPS_HOST . "/maps/geo?output=xml" . "&key=" . KEY;
|
900 |
-
|
901 |
-
|
902 |
-
$geocode_pending = true;
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
while ($geocode_pending) {
|
907 |
-
|
908 |
-
$request_url = $base_url . "&q=" . urlencode($address);
|
909 |
-
//$xml = simplexml_load_file($request_url) or die("url not loading");
|
910 |
-
$ch = curl_init();
|
911 |
-
curl_setopt($ch, CURLOPT_URL, $request_url);
|
912 |
-
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
913 |
-
// get the result of http query
|
914 |
-
$output = curl_exec($ch);
|
915 |
-
curl_close($ch);
|
916 |
-
$xml = simplexml_load_string($output) or die("There was a problem connecting to the Google API. Please ensure that cURL is enabled on your server.");
|
917 |
-
|
918 |
-
$status = $xml->Response->Status->code;
|
919 |
-
|
920 |
-
if (strcmp($status, "200") == 0) {
|
921 |
-
// Successful geocode
|
922 |
-
$geocode_pending = false;
|
923 |
-
$coordinates = $xml->Response->Placemark->Point->coordinates;
|
924 |
-
$coordinatesSplit = split(",", $coordinates);
|
925 |
-
// Format: Longitude, Latitude, Altitude
|
926 |
-
$gps['lat'] = $coordinatesSplit[1];
|
927 |
-
$gps['lng'] = $coordinatesSplit[0];
|
928 |
-
return $gps;
|
929 |
-
|
930 |
-
} else if (strcmp($status, "620") == 0) {
|
931 |
-
|
932 |
-
$delay += 100000;
|
933 |
-
|
934 |
-
} else {
|
935 |
-
|
936 |
-
$geocode_pending = false;
|
937 |
-
echo "Address " . $address . " failed to geocoded. ";
|
938 |
-
echo "Received status " . $status . "
|
939 |
-
|
940 |
-
\n";
|
941 |
-
|
942 |
-
}
|
943 |
-
|
944 |
-
usleep($delay);
|
945 |
-
|
946 |
-
|
947 |
-
}
|
948 |
-
|
949 |
-
}
|
950 |
-
|
951 |
-
|
952 |
if (function_exists(wpgmza_register_pro_version)) {
|
953 |
add_action('wp_ajax_add_marker', 'wpgmaps_action_callback_pro');
|
954 |
add_action('wp_ajax_delete_marker', 'wpgmaps_action_callback_pro');
|
@@ -956,10 +1468,10 @@ if (function_exists(wpgmza_register_pro_version)) {
|
|
956 |
add_action('template_redirect','wpgmaps_check_shortcode');
|
957 |
|
958 |
if (function_exists(wpgmza_register_gold_version)) {
|
959 |
-
add_action('
|
960 |
add_action('admin_head', 'wpgmaps_admin_javascript_gold');
|
961 |
} else {
|
962 |
-
add_action('
|
963 |
add_action('admin_head', 'wpgmaps_admin_javascript_pro');
|
964 |
}
|
965 |
add_shortcode( 'wpgmza', 'wpgmaps_tag_pro' );
|
@@ -969,23 +1481,31 @@ if (function_exists(wpgmza_register_pro_version)) {
|
|
969 |
add_action('wp_ajax_delete_marker', 'wpgmaps_action_callback_basic');
|
970 |
add_action('wp_ajax_edit_marker', 'wpgmaps_action_callback_basic');
|
971 |
add_action('template_redirect','wpgmaps_check_shortcode');
|
972 |
-
add_action('
|
973 |
add_shortcode( 'wpgmza', 'wpgmaps_tag_basic' );
|
974 |
}
|
975 |
|
|
|
976 |
function wpgmaps_check_shortcode() {
|
|
|
977 |
global $posts;
|
978 |
global $short_code_active;
|
979 |
$short_code_active = false;
|
980 |
$pattern = get_shortcode_regex();
|
981 |
-
preg_match('/'.$pattern.'/s', $posts[0]->post_content, $matches);
|
982 |
-
if (is_array($matches) && $matches[2] == 'wpgmza') {
|
983 |
-
$short_code_active = true;
|
984 |
-
}
|
985 |
-
|
986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
}
|
988 |
-
|
989 |
function wpgmza_cURL_response($action) {
|
990 |
if (function_exists('curl_version')) {
|
991 |
global $wpgmza_version;
|
@@ -1018,22 +1538,39 @@ function wpgmaps_check_permissions() {
|
|
1018 |
|
1019 |
}
|
1020 |
function wpgmaps_permission_warning() {
|
1021 |
-
echo "<div class='error below-h1'>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1022 |
}
|
1023 |
|
1024 |
|
1025 |
// handle database check upon upgrade
|
1026 |
function wpgmaps_update_db_check() {
|
|
|
|
|
1027 |
global $wpgmza_version;
|
1028 |
if (get_option('wpgmza_db_version') != $wpgmza_version) {
|
1029 |
wpgmaps_handle_db();
|
1030 |
}
|
|
|
|
|
|
|
|
|
|
|
1031 |
}
|
1032 |
|
1033 |
|
1034 |
add_action('plugins_loaded', 'wpgmaps_update_db_check');
|
1035 |
|
1036 |
function wpgmaps_handle_db() {
|
|
|
|
|
1037 |
global $wpdb;
|
1038 |
global $wpgmza_version;
|
1039 |
|
@@ -1043,13 +1580,40 @@ function wpgmaps_handle_db() {
|
|
1043 |
CREATE TABLE `".$table_name."` (
|
1044 |
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1045 |
`map_id` int(11) NOT NULL,
|
1046 |
-
`address` varchar(700) NOT NULL,
|
1047 |
`desc` varchar(700) NOT NULL,
|
1048 |
`pic` varchar(700) NOT NULL,
|
1049 |
`link` varchar(700) NOT NULL,
|
1050 |
`icon` varchar(700) NOT NULL,
|
1051 |
`lat` varchar(100) NOT NULL,
|
1052 |
`lng` varchar(100) NOT NULL,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1053 |
PRIMARY KEY (`id`)
|
1054 |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
1055 |
";
|
@@ -1057,7 +1621,93 @@ function wpgmaps_handle_db() {
|
|
1057 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
1058 |
dbDelta($sql);
|
1059 |
|
|
|
|
|
1060 |
add_option("wpgmza_db_version", $wpgmza_version);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1061 |
}
|
1062 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1063 |
?>
|
2 |
/*
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: http://www.wpgmaps.com
|
5 |
+
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
+
Version: 4.14
|
7 |
Author: WP Google Maps
|
8 |
Author URI: http://www.wpgmaps.com
|
9 |
*/
|
10 |
|
11 |
+
error_reporting(E_ERROR);
|
12 |
global $wpgmza_version;
|
13 |
global $wpgmza_p_version;
|
14 |
global $wpgmza_t;
|
15 |
global $wpgmza_tblname;
|
16 |
+
global $wpgmza_tblname_maps;
|
17 |
global $wpdb;
|
18 |
global $wpgmza_p;
|
19 |
global $wpgmza_g;
|
20 |
global $short_code_active;
|
21 |
+
global $wpgmza_current_map_id;
|
22 |
+
global $debug;
|
23 |
+
global $debug_step;
|
24 |
+
global $debug_start;
|
25 |
+
$debug = false;
|
26 |
+
$debug_step = 0;
|
27 |
$wpgmza_p = false;
|
28 |
$wpgmza_g = false;
|
29 |
$wpgmza_tblname = $wpdb->prefix . "wpgmza";
|
30 |
+
$wpgmza_tblname_maps = $wpdb->prefix . "wpgmza_maps";
|
31 |
+
$wpgmza_version = "4.14";
|
32 |
+
$wpgmza_p_version = "4.14";
|
33 |
$wpgmza_t = "basic";
|
34 |
|
35 |
add_action('admin_head', 'wpgmaps_head');
|
37 |
register_activation_hook( __FILE__, 'wpgmaps_activate' );
|
38 |
register_deactivation_hook( __FILE__, 'wpgmaps_deactivate' );
|
39 |
add_action('init', 'wpgmaps_init');
|
|
|
40 |
add_action('admin_menu', 'wpgmaps_admin_menu');
|
41 |
add_filter('widget_text', 'do_shortcode');
|
42 |
|
43 |
+
$debug_start = (float) array_sum(explode(' ',microtime()));
|
44 |
+
|
45 |
|
|
|
46 |
|
47 |
+
function wpgmaps_activate() {
|
48 |
global $wpdb;
|
49 |
global $wpgmza_version;
|
|
|
50 |
$table_name = $wpdb->prefix . "wpgmza";
|
51 |
+
$table_name_maps = $wpdb->prefix . "wpgmza_maps";
|
|
|
52 |
|
53 |
+
wpgmaps_debugger("activate_start");
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
wpgmaps_handle_db();
|
57 |
|
58 |
+
$wpgmza_data = get_option("WPGMZA");
|
59 |
+
if (!$wpgmza_data) {
|
60 |
+
// load first map as an example map (i.e. if the user has not installed this plugin before, this must run
|
61 |
+
$res_maps = $wpdb->get_results("SELECT * FROM $table_name_maps");
|
62 |
+
$wpdb->show_errors();
|
63 |
+
if (!$res_maps) { $rows_affected = $wpdb->insert( $table_name_maps, array(
|
64 |
+
"map_title" => "Your first map",
|
65 |
+
"map_start_lat" => "51.5081290",
|
66 |
+
"map_start_lng" => "-0.1280050",
|
67 |
+
"map_width" => "600",
|
68 |
+
"map_height" => "400",
|
69 |
+
"map_start_location" => "51.5081290,-0.1280050",
|
70 |
+
"map_start_zoom" => "5",
|
71 |
+
"directions_enabled" => '1',
|
72 |
+
"default_marker" => "0",
|
73 |
+
"alignment" => "0",
|
74 |
+
"styling_enabled" => "0",
|
75 |
+
"styling_json" => "",
|
76 |
+
"active" => "0",
|
77 |
+
"type" => "1")
|
78 |
+
); }
|
79 |
+
} else {
|
80 |
+
$rows_affected = $wpdb->insert( $table_name_maps, array( "map_start_lat" => "".$wpgmza_data['map_start_lat']."",
|
81 |
+
"map_start_lng" => "".$wpgmza_data['map_start_lng']."",
|
82 |
+
"map_title" => "Your Map",
|
83 |
+
"map_width" => "".$wpgmza_data['map_width']."",
|
84 |
+
"map_height" => "".$wpgmza_data['map_height']."",
|
85 |
+
"map_start_location" => "".$wpgmza_data['map_start_lat'].",".$wpgmza_data['map_start_lng']."",
|
86 |
+
"map_start_zoom" => "".$wpgmza_data['map_start_zoom']."",
|
87 |
+
"default_marker" => "".$wpgmza_data['map_default_marker']."",
|
88 |
+
"type" => "".$wpgmza_data['map_type']."",
|
89 |
+
"alignment" => "".$wpgmza_data['map_align']."",
|
90 |
+
"styling_enabled" => "0",
|
91 |
+
"styling_json" => "",
|
92 |
+
"active" => "0",
|
93 |
+
"directions_enabled" => "".$wpgmza_data['directions_enabled'].""
|
94 |
+
) );
|
95 |
+
delete_option("WPGMZA");
|
96 |
|
97 |
+
}
|
98 |
+
// load first marker as an example marker
|
99 |
+
$results = $wpdb->get_results("SELECT * FROM $table_name WHERE `map_id` = '1'");
|
100 |
+
if (!$results) { $rows_affected = $wpdb->insert( $table_name, array( 'map_id' => '1', 'address' => 'London', 'lat' => '51.5081290', 'lng' => '-0.1280050' ) ); }
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
+
wpgmza_cURL_response("activate");
|
106 |
+
//check to see if you have write permissions to the plugin folder (version 2.2)
|
107 |
+
if (!wpgmaps_check_permissions()) { wpgmaps_permission_warning(); } else { wpgmaps_update_all_xml_file(); }
|
108 |
+
wpgmaps_debugger("activate_end");
|
109 |
}
|
110 |
+
function wpgmaps_deactivate() { wpgmza_cURL_response("deactivate"); }
|
|
|
|
|
|
|
|
|
111 |
function wpgmaps_init() {
|
112 |
wp_enqueue_script("jquery");
|
113 |
+
$plugin_dir = basename(dirname(__FILE__))."/languages/";
|
114 |
+
load_plugin_textdomain( 'wp-google-maps', false, $plugin_dir );
|
115 |
+
}
|
116 |
|
117 |
function wpgmaps_reload_map_on_post() {
|
118 |
+
wpgmaps_debugger("reload_map_start");
|
119 |
if (isset($_POST['wpgmza_savemap'])){
|
120 |
+
|
121 |
+
$res = wpgmza_get_map_data($_GET['map_id']);
|
122 |
+
$wpgmza_lat = $res->map_start_lat;
|
123 |
+
$wpgmza_lng = $res->map_start_lng;
|
124 |
+
$wpgmza_width = $res->map_width;
|
125 |
+
$wpgmza_height = $res->map_height;
|
126 |
+
$wpgmza_map_type = $res->type;
|
127 |
+
if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
|
128 |
+
else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
|
129 |
+
else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
|
130 |
+
else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
|
131 |
+
else { $wpgmza_map_type = "ROADMAP"; }
|
132 |
+
$start_zoom = $res->map_start_zoom;
|
133 |
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
134 |
+
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
|
135 |
+
|
136 |
?>
|
137 |
<script type="text/javascript" >
|
138 |
jQuery(function() {
|
144 |
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
145 |
MYMAP.init('#wpgmza_map', myLatLng, <?php echo $start_zoom; ?>);
|
146 |
UniqueCode=Math.round(Math.random()*10010);
|
147 |
+
MYMAP.placeMarkers('<?php echo wpgmaps_get_marker_url($_GET['map_id']); ?>?u='+UniqueCode,<?php echo $_GET['map_id']; ?>);
|
148 |
|
149 |
});
|
150 |
</script>
|
151 |
<?php
|
152 |
}
|
153 |
+
wpgmaps_debugger("reload_map_end");
|
154 |
+
|
155 |
+
|
156 |
+
}
|
157 |
+
function wpgmaps_get_marker_url($mapid = false) {
|
158 |
+
|
159 |
+
if (!$mapid) {
|
160 |
+
$mapid = $_POST['map_id'];
|
161 |
+
}
|
162 |
+
if (!$mapid) {
|
163 |
+
$mapid = $_GET['map_id'];
|
164 |
+
}
|
165 |
+
if (!$mapid) {
|
166 |
+
global $wpgmza_current_map_id;
|
167 |
+
$mapid = $wpgmza_current_map_id;
|
168 |
+
}
|
169 |
+
|
170 |
+
if (is_multisite()) {
|
171 |
+
global $blog_id;
|
172 |
+
return wpgmaps_get_plugin_url()."/".$blog_id."-".$mapid."markers.xml";
|
173 |
+
} else {
|
174 |
+
return wpgmaps_get_plugin_url()."/".$mapid."markers.xml";
|
175 |
+
}
|
176 |
+
|
177 |
+
|
178 |
+
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
+
function wpgmaps_admin_edit_marker_javascript() {
|
183 |
+
wpgmaps_debugger("edit_marker_start");
|
184 |
|
185 |
+
$res = wpgmza_get_marker_data($_GET['id']);
|
186 |
+
$wpgmza_lat = $res->lat;
|
187 |
+
$wpgmza_lng = $res->lng;
|
188 |
+
$wpgmza_map_type = "ROADMAP";
|
189 |
+
|
190 |
+
|
191 |
+
?>
|
192 |
+
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
193 |
+
<link rel='stylesheet' id='wpgooglemaps-css' href='<?php echo wpgmaps_get_plugin_url(); ?>/css/wpgmza_style.css' type='text/css' media='all' />
|
194 |
+
<link rel="stylesheet" type="text/css" media="all" href="<?php echo wpgmaps_get_plugin_url(); ?>/css/data_table.css" />
|
195 |
+
<script type="text/javascript" src="<?php echo wpgmaps_get_plugin_url(); ?>/js/jquery.dataTables.js"></script>
|
196 |
+
<script type="text/javascript" >
|
197 |
+
jQuery(document).ready(function(){
|
198 |
+
function wpgmza_InitMap() {
|
199 |
+
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
200 |
+
MYMAP.init('#wpgmza_map', myLatLng, 15);
|
201 |
+
}
|
202 |
+
jQuery("#wpgmza_map").css({
|
203 |
+
height:400,
|
204 |
+
width:400
|
205 |
+
});
|
206 |
+
wpgmza_InitMap();
|
207 |
+
});
|
208 |
+
|
209 |
+
var MYMAP = {
|
210 |
+
map: null,
|
211 |
+
bounds: null
|
212 |
+
}
|
213 |
+
MYMAP.init = function(selector, latLng, zoom) {
|
214 |
+
var myOptions = {
|
215 |
+
zoom:zoom,
|
216 |
+
center: latLng,
|
217 |
+
mapTypeId: google.maps.MapTypeId.<?php echo $wpgmza_map_type; ?>
|
218 |
+
}
|
219 |
+
this.map = new google.maps.Map(jQuery(selector)[0], myOptions);
|
220 |
+
this.bounds = new google.maps.LatLngBounds();
|
221 |
+
|
222 |
+
updateMarkerPosition(latLng);
|
223 |
+
|
224 |
+
|
225 |
+
var marker = new google.maps.Marker({
|
226 |
+
position: latLng,
|
227 |
+
map: this.map,
|
228 |
+
draggable: true
|
229 |
+
});
|
230 |
+
google.maps.event.addListener(marker, 'drag', function() {
|
231 |
+
updateMarkerPosition(marker.getPosition());
|
232 |
+
});
|
233 |
+
}
|
234 |
+
function updateMarkerPosition(latLng) {
|
235 |
+
jQuery("#wpgmaps_marker_lat").val(latLng.lat());
|
236 |
+
jQuery("#wpgmaps_marker_lng").val(latLng.lng());
|
237 |
+
}
|
238 |
+
|
239 |
+
|
240 |
+
</script>
|
241 |
+
<?php
|
242 |
+
|
243 |
+
wpgmaps_debugger("edit_marker_end");
|
244 |
|
245 |
}
|
246 |
|
247 |
function wpgmaps_admin_javascript_basic() {
|
248 |
+
global $wpdb;
|
249 |
+
global $wpgmza_tblname_maps;
|
250 |
$ajax_nonce = wp_create_nonce("wpgmza");
|
251 |
+
wpgmaps_debugger("admin_js_basic_start");
|
252 |
+
|
253 |
+
if (is_admin() && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "edit_marker") {
|
254 |
+
wpgmaps_admin_edit_marker_javascript();
|
255 |
+
|
256 |
+
}
|
257 |
+
|
258 |
+
else if (is_admin() && $_GET['page'] == 'wp-google-maps-menu' && $_GET['action'] == "edit") {
|
259 |
+
|
260 |
+
if ($debug) { echo ""; }
|
261 |
+
|
262 |
+
if (!$_GET['map_id']) { break; }
|
263 |
+
wpgmaps_update_xml_file($_GET['map_id']);
|
264 |
+
//$wpgmza_data = get_option('WPGMZA');
|
265 |
+
|
266 |
+
$res = wpgmza_get_map_data($_GET['map_id']);
|
267 |
+
|
268 |
+
$wpgmza_lat = $res->map_start_lat;
|
269 |
+
$wpgmza_lng = $res->map_start_lng;
|
270 |
+
$wpgmza_width = $res->map_width;
|
271 |
+
$wpgmza_height = $res->map_height;
|
272 |
+
$wpgmza_map_type = $res->type;
|
273 |
+
if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
|
274 |
+
else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
|
275 |
+
else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
|
276 |
+
else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
|
277 |
+
else { $wpgmza_map_type = "ROADMAP"; }
|
278 |
+
$start_zoom = $res->map_start_zoom;
|
279 |
+
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
280 |
+
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
|
281 |
|
|
|
|
|
282 |
|
283 |
?>
|
284 |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
300 |
"bProcessing": true
|
301 |
});
|
302 |
}
|
303 |
+
function wpgmza_InitMap() {
|
304 |
+
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
305 |
+
MYMAP.init('#wpgmza_map', myLatLng, <?php echo $start_zoom; ?>);
|
306 |
+
UniqueCode=Math.round(Math.random()*10000);
|
307 |
+
MYMAP.placeMarkers('<?php echo wpgmaps_get_marker_url($_GET['map_id']); ?>?u='+UniqueCode,<?php echo $_GET['map_id']; ?>);
|
308 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
|
310 |
jQuery("#wpgmza_map").css({
|
311 |
height:<?php echo $wpgmza_height; ?>,
|
312 |
width:<?php echo $wpgmza_width; ?>
|
313 |
|
314 |
});
|
315 |
+
var geocoder = new google.maps.Geocoder();
|
316 |
+
wpgmza_InitMap();
|
317 |
+
|
|
|
318 |
|
319 |
+
|
320 |
jQuery(".wpgmza_del_btn").live("click", function() {
|
321 |
var cur_id = jQuery(this).attr("id");
|
322 |
var wpgm_map_id = "0";
|
328 |
marker_id: cur_id
|
329 |
};
|
330 |
jQuery.post(ajaxurl, data, function(response) {
|
331 |
+
wpgmza_InitMap();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
jQuery("#wpgmza_marker_holder").html(response);
|
333 |
wpgmza_reinitialisetbl();
|
334 |
//jQuery("#wpgmza_tr_"+cur_id).css("display","none");
|
341 |
jQuery(".wpgmza_edit_btn").live("click", function() {
|
342 |
var cur_id = jQuery(this).attr("id");
|
343 |
var wpgmza_edit_address = jQuery("#wpgmza_hid_marker_address_"+cur_id).val();
|
344 |
+
var wpgmza_edit_title = jQuery("#wpgmza_hid_marker_title_"+cur_id).val();
|
345 |
jQuery("#wpgmza_edit_id").val(cur_id);
|
346 |
jQuery("#wpgmza_add_address").val(wpgmza_edit_address);
|
347 |
+
jQuery("#wpgmza_add_title").val(wpgmza_edit_title);
|
348 |
jQuery("#wpgmza_addmarker_div").hide();
|
349 |
jQuery("#wpgmza_editmarker_div").show();
|
350 |
});
|
356 |
jQuery("#wpgmza_addmarker_loading").show();
|
357 |
|
358 |
var wpgm_address = "0";
|
359 |
+
var wpgm_gps = "0";
|
360 |
var wpgm_map_id = "0";
|
361 |
if (document.getElementsByName("wpgmza_add_address").length > 0) { wpgm_address = jQuery("#wpgmza_add_address").val(); }
|
362 |
if (document.getElementsByName("wpgmza_id").length > 0) { wpgm_map_id = jQuery("#wpgmza_id").val(); }
|
363 |
|
364 |
+
|
365 |
+
geocoder.geocode( { 'address': wpgm_address, 'language': 'russian'}, function(results, status) {
|
366 |
+
if (status == google.maps.GeocoderStatus.OK) {
|
367 |
+
wpgm_gps = String(results[0].geometry.location);
|
368 |
+
var latlng1 = wpgm_gps.replace("(","");
|
369 |
+
var latlng2 = latlng1.replace(")","");
|
370 |
+
var latlngStr = latlng2.split(",",2);
|
371 |
+
var wpgm_lat = parseFloat(latlngStr[0]);
|
372 |
+
var wpgm_lng = parseFloat(latlngStr[1]);
|
373 |
+
|
374 |
+
var data = {
|
375 |
+
action: 'add_marker',
|
376 |
+
security: '<?php echo $ajax_nonce; ?>',
|
377 |
+
map_id: wpgm_map_id,
|
378 |
+
address: wpgm_address,
|
379 |
+
lat: wpgm_lat,
|
380 |
+
lng: wpgm_lng
|
381 |
+
};
|
382 |
+
|
383 |
+
jQuery.post(ajaxurl, data, function(response) {
|
384 |
+
wpgmza_InitMap();
|
385 |
+
jQuery("#wpgmza_marker_holder").html(response);
|
386 |
+
jQuery("#wpgmza_addmarker").show();
|
387 |
+
jQuery("#wpgmza_addmarker_loading").hide();
|
388 |
+
wpgmza_reinitialisetbl();
|
389 |
+
});
|
390 |
+
|
391 |
+
} else {
|
392 |
+
alert("Geocode was not successful for the following reason: " + status);
|
393 |
+
}
|
394 |
});
|
395 |
+
|
396 |
|
397 |
});
|
398 |
|
407 |
wpgm_edit_id = parseInt(jQuery("#wpgmza_edit_id").val());
|
408 |
var wpgm_address = "0";
|
409 |
var wpgm_map_id = "0";
|
410 |
+
var wpgm_gps = "0";
|
411 |
if (document.getElementsByName("wpgmza_add_address").length > 0) { wpgm_address = jQuery("#wpgmza_add_address").val(); }
|
412 |
if (document.getElementsByName("wpgmza_id").length > 0) { wpgm_map_id = jQuery("#wpgmza_id").val(); }
|
413 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
414 |
|
415 |
+
geocoder.geocode( { 'address': wpgm_address}, function(results, status) {
|
416 |
+
if (status == google.maps.GeocoderStatus.OK) {
|
417 |
+
wpgm_gps = String(results[0].geometry.location);
|
418 |
+
var latlng1 = wpgm_gps.replace("(","");
|
419 |
+
var latlng2 = latlng1.replace(")","");
|
420 |
+
var latlngStr = latlng2.split(",",2);
|
421 |
+
var wpgm_lat = parseFloat(latlngStr[0]);
|
422 |
+
var wpgm_lng = parseFloat(latlngStr[1]);
|
423 |
+
|
424 |
+
var data = {
|
425 |
+
action: 'edit_marker',
|
426 |
+
security: '<?php echo $ajax_nonce; ?>',
|
427 |
+
map_id: wpgm_map_id,
|
428 |
+
edit_id: wpgm_edit_id,
|
429 |
+
address: wpgm_address,
|
430 |
+
lat: wpgm_lat,
|
431 |
+
lng: wpgm_lng
|
432 |
+
};
|
433 |
+
|
434 |
+
jQuery.post(ajaxurl, data, function(response) {
|
435 |
+
wpgmza_InitMap();
|
436 |
+
jQuery("#wpgmza_add_address").val("");
|
437 |
+
jQuery("#wpgmza_add_title").val("");
|
438 |
+
jQuery("#wpgmza_marker_holder").html(response);
|
439 |
+
jQuery("#wpgmza_addmarker_div").show();
|
440 |
+
jQuery("#wpgmza_editmarker_loading").hide();
|
441 |
+
jQuery("#wpgmza_edit_id").val("");
|
442 |
+
wpgmza_reinitialisetbl();
|
443 |
+
});
|
444 |
|
445 |
+
} else {
|
446 |
+
alert("Geocode was not successful for the following reason: " + status);
|
447 |
+
}
|
448 |
+
});
|
|
|
449 |
|
450 |
|
|
|
451 |
|
452 |
});
|
453 |
});
|
454 |
|
455 |
});
|
456 |
|
457 |
+
|
458 |
+
|
459 |
var MYMAP = {
|
460 |
map: null,
|
461 |
bounds: null
|
462 |
}
|
463 |
MYMAP.init = function(selector, latLng, zoom) {
|
464 |
+
var myOptions = {
|
465 |
+
zoom:zoom,
|
466 |
+
center: latLng,
|
467 |
+
mapTypeId: google.maps.MapTypeId.<?php echo $wpgmza_map_type; ?>
|
468 |
+
}
|
469 |
+
this.map = new google.maps.Map(jQuery(selector)[0], myOptions);
|
470 |
+
this.bounds = new google.maps.LatLngBounds();
|
471 |
+
|
472 |
+
|
473 |
+
google.maps.event.addListener(MYMAP.map, 'zoom_changed', function() {
|
474 |
+
zoomLevel = MYMAP.map.getZoom();
|
475 |
+
|
476 |
+
jQuery("#wpgmza_start_zoom").val(zoomLevel);
|
477 |
+
if (zoomLevel == 0) {
|
478 |
+
MYMAP.map.setZoom(10);
|
479 |
+
}
|
480 |
+
});
|
481 |
+
google.maps.event.addListener(MYMAP.map, 'center_changed', function() {
|
482 |
+
var location = MYMAP.map.getCenter();
|
483 |
+
jQuery("#wpgmza_start_location").val(location.lat()+","+location.lng());
|
484 |
+
jQuery("#wpgmaps_save_reminder").show();
|
485 |
+
});
|
486 |
+
|
487 |
+
|
488 |
}
|
489 |
|
490 |
+
|
491 |
+
MYMAP.placeMarkers = function(filename,map_id) {
|
492 |
+
marker_array = [];
|
493 |
jQuery.get(filename, function(xml){
|
494 |
jQuery(xml).find("marker").each(function(){
|
495 |
+
var wpmgza_map_id = jQuery(this).find('map_id').text();
|
496 |
+
if (wpmgza_map_id == map_id) {
|
497 |
+
var wpmgza_address = jQuery(this).find('address').text();
|
498 |
+
var lat = jQuery(this).find('lat').text();
|
499 |
+
var lng = jQuery(this).find('lng').text();
|
500 |
+
var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
|
501 |
+
MYMAP.bounds.extend(point);
|
502 |
+
var marker = new google.maps.Marker({
|
503 |
+
position: point,
|
504 |
+
map: MYMAP.map
|
505 |
+
|
506 |
+
|
507 |
+
});
|
508 |
+
var infoWindow = new google.maps.InfoWindow();
|
509 |
+
var html='<strong>'+wpmgza_address+'</strong>';
|
510 |
+
|
511 |
+
google.maps.event.addListener(marker, 'click', function() {
|
512 |
+
infoWindow.setContent(html);
|
513 |
+
infoWindow.open(MYMAP.map, marker);
|
514 |
+
});
|
515 |
+
//MYMAP.map.fitBounds(MYMAP.bounds);
|
516 |
+
|
517 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
});
|
520 |
});
|
521 |
}
|
522 |
|
523 |
+
|
524 |
+
|
525 |
+
|
526 |
+
|
527 |
+
|
528 |
</script>
|
529 |
<?php
|
530 |
}
|
531 |
+
wpgmaps_debugger("admin_js_basic_end");
|
532 |
|
533 |
}
|
534 |
|
535 |
|
536 |
function wpgmaps_user_javascript_basic() {
|
537 |
global $short_code_active;
|
538 |
+
global $wpgmza_current_map_id;
|
539 |
+
wpgmaps_debugger("u_js_b_start");
|
540 |
+
|
541 |
if ($short_code_active) {
|
542 |
|
543 |
$ajax_nonce = wp_create_nonce("wpgmza");
|
544 |
+
|
545 |
+
|
546 |
+
$res = wpgmza_get_map_data($wpgmza_current_map_id);
|
547 |
+
|
548 |
+
|
549 |
+
$wpgmza_lat = $res->map_start_lat;
|
550 |
+
$wpgmza_lng = $res->map_start_lng;
|
551 |
+
$wpgmza_width = $res->map_width;
|
552 |
+
$wpgmza_height = $res->map_height;
|
553 |
+
$wpgmza_map_type = $res->type;
|
554 |
+
if (!$wpgmza_map_type || $wpgmza_map_type == "" || $wpgmza_map_type == "1") { $wpgmza_map_type = "ROADMAP"; }
|
555 |
+
else if ($wpgmza_map_type == "2") { $wpgmza_map_type = "SATELLITE"; }
|
556 |
+
else if ($wpgmza_map_type == "3") { $wpgmza_map_type = "HYBRID"; }
|
557 |
+
else if ($wpgmza_map_type == "4") { $wpgmza_map_type = "TERRAIN"; }
|
558 |
+
else { $wpgmza_map_type = "ROADMAP"; }
|
559 |
+
$start_zoom = $res->map_start_zoom;
|
560 |
if ($start_zoom < 1 || !$start_zoom) { $start_zoom = 5; }
|
561 |
if (!$wpgmza_lat || !$wpgmza_lng) { $wpgmza_lat = "51.5081290"; $wpgmza_lng = "-0.1280050"; }
|
562 |
|
564 |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
|
565 |
<link rel='stylesheet' id='wpgooglemaps-css' href='<?php echo wpgmaps_get_plugin_url(); ?>/css/wpgmza_style.css' type='text/css' media='all' />
|
566 |
<script type="text/javascript" >
|
567 |
+
|
568 |
|
569 |
+
jQuery(function() {
|
570 |
|
571 |
|
572 |
|
573 |
+
jQuery(document).ready(function(){
|
574 |
|
575 |
|
576 |
+
jQuery("#wpgmza_map").css({
|
577 |
height:<?php echo $wpgmza_height; ?>,
|
578 |
width:<?php echo $wpgmza_width; ?>
|
579 |
|
581 |
var myLatLng = new google.maps.LatLng(<?php echo $wpgmza_lat; ?>,<?php echo $wpgmza_lng; ?>);
|
582 |
MYMAP.init('#wpgmza_map', myLatLng, <?php echo $start_zoom; ?>);
|
583 |
UniqueCode=Math.round(Math.random()*10000);
|
584 |
+
MYMAP.placeMarkers('<?php echo wpgmaps_get_marker_url($wpgmza_current_map_id); ?>?u='+UniqueCode,<?php echo $wpgmza_current_map_id; ?>);
|
585 |
|
586 |
|
587 |
});
|
595 |
var myOptions = {
|
596 |
zoom:zoom,
|
597 |
center: latLng,
|
598 |
+
mapTypeId: google.maps.MapTypeId.<?php echo $wpgmza_map_type; ?>
|
599 |
}
|
600 |
+
|
601 |
+
this.map = new google.maps.Map(jQuery(selector)[0], myOptions);
|
602 |
this.bounds = new google.maps.LatLngBounds();
|
603 |
|
604 |
}
|
605 |
|
606 |
|
607 |
|
608 |
+
MYMAP.placeMarkers = function(filename,map_id) {
|
609 |
|
610 |
+
jQuery.get(filename, function(xml){
|
611 |
+
jQuery(xml).find("marker").each(function(){
|
612 |
+
var wpmgza_map_id = jQuery(this).find('map_id').text();
|
|
|
|
|
613 |
|
614 |
+
if (wpmgza_map_id == map_id) {
|
615 |
+
var wpmgza_address = jQuery(this).find('address').text();
|
616 |
+
var lat = jQuery(this).find('lat').text();
|
617 |
+
var lng = jQuery(this).find('lng').text();
|
|
|
|
|
|
|
|
|
618 |
|
619 |
+
var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
|
620 |
+
MYMAP.bounds.extend(point);
|
621 |
+
var marker = new google.maps.Marker({
|
622 |
+
position: point,
|
623 |
+
map: MYMAP.map
|
624 |
+
});
|
625 |
+
var infoWindow = new google.maps.InfoWindow();
|
626 |
+
var html='<strong>'+wpmgza_address+'</strong>';
|
627 |
|
628 |
+
google.maps.event.addListener(marker, 'click', function(evt) {
|
629 |
+
infoWindow.setContent(html);
|
630 |
+
infoWindow.open(MYMAP.map, marker);
|
631 |
+
|
632 |
+
});
|
633 |
+
}
|
634 |
});
|
635 |
});
|
636 |
}
|
638 |
</script>
|
639 |
<?php
|
640 |
}
|
641 |
+
wpgmaps_debugger("u_js_b_end");
|
642 |
}
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
+
function wpgmaps_update_xml_file($mapid = false) {
|
|
|
648 |
|
649 |
+
// wpgmaps_debugger("update_xml_start");
|
650 |
|
651 |
+
if (!$mapid) {
|
652 |
+
$mapid = $_POST['map_id'];
|
653 |
+
}
|
654 |
+
if (!$mapid) {
|
655 |
+
$mapid = $_GET['map_id'];
|
656 |
+
}
|
657 |
global $wpdb;
|
658 |
$dom = new DOMDocument('1.0');
|
659 |
$dom->formatOutput = true;
|
665 |
"
|
666 |
SELECT *
|
667 |
FROM $table_name
|
668 |
+
WHERE `map_id` = '$mapid'
|
669 |
+
|
670 |
"
|
671 |
);
|
672 |
|
682 |
if ($link_url) { } else { $link_url = ""; }
|
683 |
$lat = $result->lat;
|
684 |
$lng = $result->lng;
|
685 |
+
$anim = $result->anim;
|
686 |
+
$mtitle = $result->title;
|
687 |
+
$map_id = $result->map_id;
|
688 |
|
689 |
$channel = $channel_main->appendChild($dom->createElement('marker'));
|
690 |
+
$title = $channel->appendChild($dom->createElement('map_id'));
|
691 |
+
$title->appendChild($dom->CreateTextNode($map_id));
|
692 |
+
$title = $channel->appendChild($dom->createElement('title'));
|
693 |
+
$title->appendChild($dom->CreateTextNode($mtitle));
|
694 |
$title = $channel->appendChild($dom->createElement('address'));
|
695 |
$title->appendChild($dom->CreateTextNode($address));
|
696 |
$desc = $channel->appendChild($dom->createElement('desc'));
|
705 |
$bd->appendChild($dom->CreateTextNode($lat));
|
706 |
$bd = $channel->appendChild($dom->createElement('lng'));
|
707 |
$bd->appendChild($dom->CreateTextNode($lng));
|
708 |
+
$bd = $channel->appendChild($dom->createElement('anim'));
|
709 |
+
$bd->appendChild($dom->CreateTextNode($anim));
|
710 |
|
711 |
|
712 |
}
|
713 |
+
if (is_multisite()) {
|
714 |
+
global $blog_id;
|
715 |
+
@$dom->save(WP_PLUGIN_DIR.'/'.plugin_basename(dirname(__FILE__)).'/'.$blog_id.'-'.$mapid.'markers.xml');
|
716 |
+
} else {
|
717 |
|
718 |
+
@$dom->save(WP_PLUGIN_DIR.'/'.plugin_basename(dirname(__FILE__)).'/'.$mapid.'markers.xml');
|
719 |
+
}
|
720 |
+
//wpgmaps_debugger("update_xml_end");
|
721 |
}
|
722 |
|
723 |
|
724 |
|
725 |
+
function wpgmaps_update_all_xml_file() {
|
726 |
+
global $wpdb;
|
727 |
+
|
728 |
+
$table_name = $wpdb->prefix . "wpgmza_maps";
|
729 |
+
$results = $wpdb->get_results("SELECT `id` FROM $table_name WHERE `active` = 0");
|
730 |
+
|
731 |
+
foreach ( $results as $result ) {
|
732 |
+
$map_id = $result->id;
|
733 |
+
wpgmaps_update_xml_file($map_id);
|
734 |
+
}
|
735 |
+
}
|
736 |
|
737 |
|
738 |
|
742 |
global $wpgmza_p;
|
743 |
$check = check_ajax_referer( 'wpgmza', 'security' );
|
744 |
$table_name = $wpdb->prefix . "wpgmza";
|
745 |
+
|
746 |
if ($check == 1) {
|
747 |
|
748 |
if ($_POST['action'] == "add_marker") {
|
749 |
+
$rows_affected = $wpdb->insert( $table_name, array( 'map_id' => $_POST['map_id'], 'address' => $_POST['address'], 'lat' => $_POST['lat'], 'lng' => $_POST['lng'] ) );
|
750 |
+
wpgmaps_update_xml_file($_POST['map_id']);
|
751 |
+
echo wpgmza_return_marker_list($_POST['map_id']);
|
|
|
|
|
|
|
752 |
}
|
753 |
if ($_POST['action'] == "edit_marker") {
|
|
|
|
|
|
|
754 |
$cur_id = $_POST['edit_id'];
|
755 |
+
$rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET address = %s, lat = %f, lng = %f WHERE id = %d", $_POST['address'], $_POST['lat'], $_POST['lng'], $cur_id) );
|
756 |
+
wpgmaps_update_xml_file($_POST['map_id']);
|
757 |
+
echo wpgmza_return_marker_list($_POST['map_id']);
|
758 |
}
|
759 |
if ($_POST['action'] == "delete_marker") {
|
760 |
$marker_id = $_POST['marker_id'];
|
765 |
LIMIT 1
|
766 |
"
|
767 |
);
|
768 |
+
wpgmaps_update_xml_file($_POST['map_id']);
|
769 |
+
echo wpgmza_return_marker_list($_POST['map_id']);
|
770 |
|
771 |
}
|
772 |
}
|
776 |
}
|
777 |
|
778 |
function wpgmaps_load_maps_api() {
|
779 |
+
wpgmaps_debugger("load_maps_api_start");
|
780 |
wp_enqueue_script('google-maps' , 'http://maps.google.com/maps/api/js?sensor=true' , false , '3');
|
781 |
+
wpgmaps_debugger("load_maps_api_end");
|
782 |
}
|
783 |
|
784 |
function wpgmaps_tag_basic( $atts ) {
|
785 |
+
wpgmaps_debugger("tag_basic_start");
|
786 |
+
global $wpgmza_current_map_id;
|
787 |
+
extract( shortcode_atts( array(
|
788 |
+
'id' => '1'
|
789 |
), $atts ) );
|
790 |
+
|
791 |
+
$wpgmza_current_map_id = $atts['id'];
|
792 |
+
|
793 |
+
$res = wpgmza_get_map_data($atts['id']);
|
794 |
+
|
795 |
+
//$wpgmza_data = get_option('WPGMZA');
|
796 |
+
$map_align = $res->alignment;
|
797 |
+
|
798 |
+
|
799 |
+
|
800 |
+
if (!$map_align || $map_align == "" || $map_align == "1") { $map_align = "float:left;"; }
|
801 |
+
else if ($map_align == "2") { $map_align = "margin-left:auto !important; margin-right:auto; !important; align:center;"; }
|
802 |
+
else if ($map_align == "3") { $map_align = "float:right;"; }
|
803 |
+
else if ($map_align == "4") { $map_align = ""; }
|
804 |
+
$map_style = "style=\"display:block; width:".$res->map_width."px; height:".$res->map_height."px; $map_align\"";
|
805 |
+
|
806 |
|
807 |
$ret_msg = "
|
808 |
<style>
|
809 |
#wpgmza_map img { max-width:none !important; }
|
810 |
</style>
|
811 |
+
<div id=\"wpgmza_map\" $map_style> </div>
|
812 |
|
813 |
|
814 |
";
|
815 |
return $ret_msg;
|
816 |
+
wpgmaps_debugger("tag_basic_end");
|
817 |
}
|
818 |
|
819 |
function wpgmaps_get_plugin_url() {
|
823 |
}
|
824 |
|
825 |
function wpgmaps_head() {
|
826 |
+
wpgmaps_debugger("head_start");
|
827 |
+
|
828 |
+
global $wpgmza_tblname_maps;
|
829 |
+
|
830 |
+
if (isset($_POST['wpgmza_savemap'])){
|
831 |
+
global $wpdb;
|
832 |
|
833 |
+
$map_id = attribute_escape($_POST['wpgmza_id']);
|
834 |
+
$map_title = attribute_escape($_POST['wpgmza_title']);
|
835 |
+
$map_height = attribute_escape($_POST['wpgmza_height']);
|
836 |
+
$map_width = attribute_escape($_POST['wpgmza_width']);
|
837 |
+
$map_start_location = attribute_escape($_POST['wpgmza_start_location']);
|
838 |
+
$map_start_zoom = intval($_POST['wpgmza_start_zoom']);
|
839 |
+
$type = intval($_POST['wpgmza_map_type']);
|
840 |
+
$alignment = intval($_POST['wpgmza_map_align']);
|
841 |
+
$directions_enabled = intval($_POST['wpgmza_directions']);
|
842 |
+
$gps = explode(",",$map_start_location);
|
843 |
+
$map_start_lat = $gps[0];
|
844 |
+
$map_start_lng = $gps[1];
|
845 |
+
$map_default_marker = $_POST['upload_default_marker'];
|
846 |
+
|
847 |
+
|
848 |
+
$rows_affected = $wpdb->query( $wpdb->prepare(
|
849 |
+
"UPDATE $wpgmza_tblname_maps SET
|
850 |
+
map_title = %s,
|
851 |
+
map_width = %s,
|
852 |
+
map_height = %s,
|
853 |
+
map_start_lat = %f,
|
854 |
+
map_start_lng = %f,
|
855 |
+
map_start_location = %s,
|
856 |
+
map_start_zoom = %d,
|
857 |
+
default_marker = %s,
|
858 |
+
type = %d,
|
859 |
+
alignment = %d,
|
860 |
+
directions_enabled = %d
|
861 |
+
WHERE id = %d",
|
862 |
+
|
863 |
+
$map_title,
|
864 |
+
$map_width,
|
865 |
+
$map_height,
|
866 |
+
$map_start_lat,
|
867 |
+
$map_start_lng,
|
868 |
+
$map_start_location,
|
869 |
+
$map_start_zoom,
|
870 |
+
$map_default_marker,
|
871 |
+
$type,
|
872 |
+
$alignment,
|
873 |
+
$directions_enabled,
|
874 |
+
$map_id)
|
875 |
+
);
|
876 |
+
|
877 |
+
|
878 |
+
|
879 |
+
|
880 |
+
//update_option('WPGMZA', $data);
|
881 |
+
echo "<div class='updated'>";
|
882 |
+
_e("Your settings have been saved.");
|
883 |
+
echo "</div>";
|
884 |
+
|
885 |
+
}
|
886 |
|
887 |
+
else if (isset($_POST['wpgmza_save_maker_location'])){
|
888 |
+
global $wpdb;
|
889 |
+
global $wpgmza_tblname;
|
890 |
+
$mid = attribute_escape($_POST['wpgmaps_marker_id']);
|
891 |
+
$wpgmaps_marker_lat = attribute_escape($_POST['wpgmaps_marker_lat']);
|
892 |
+
$wpgmaps_marker_lng = attribute_escape($_POST['wpgmaps_marker_lng']);
|
893 |
|
894 |
+
$rows_affected = $wpdb->query( $wpdb->prepare(
|
895 |
+
"UPDATE $wpgmza_tblname SET
|
896 |
+
lat = %s,
|
897 |
+
lng = %s
|
898 |
+
WHERE id = %d",
|
899 |
|
900 |
+
$wpgmaps_marker_lat,
|
901 |
+
$wpgmaps_marker_lng,
|
902 |
+
$mid)
|
903 |
+
);
|
904 |
+
|
905 |
+
|
906 |
+
|
907 |
+
|
908 |
+
//update_option('WPGMZA', $data);
|
909 |
+
echo "<div class='updated'>";
|
910 |
+
_e("Your marker location has been saved.");
|
911 |
+
echo "</div>";
|
912 |
+
|
913 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
914 |
}
|
915 |
|
916 |
|
917 |
|
918 |
+
wpgmaps_debugger("head_end");
|
919 |
|
920 |
}
|
921 |
|
925 |
|
926 |
|
927 |
function wpgmaps_admin_menu() {
|
928 |
+
add_menu_page('WPGoogle Maps', 'Maps', 'manage_options', 'wp-google-maps-menu', 'wpgmaps_menu_layout', wpgmaps_get_plugin_url()."/images/map_app_small.png");
|
929 |
+
if (function_exists(wpgmza_pro_advanced_menu)) {
|
930 |
+
add_submenu_page('wp-google-maps-menu', 'WP Google Maps - Advanced Options', 'Advanced', 'manage_options' , 'wp-google-maps-menu-advanced', 'wpgmaps_menu_advanced_layout');
|
931 |
+
}
|
932 |
+
|
933 |
// add_options_page('WP Google Maps', 'WP Google Maps', 'manage_options', 'wp-google-maps-menu', 'wpgmaps_menu_layout');
|
934 |
}
|
935 |
function wpgmaps_menu_layout() {
|
|
|
936 |
//check to see if we have write permissions to the plugin folder
|
937 |
+
//
|
938 |
+
//
|
939 |
+
wpgmaps_debugger("menu_start");
|
940 |
+
|
941 |
+
|
942 |
+
if (!$_GET['action']) {
|
943 |
+
|
944 |
+
wpgmza_map_page();
|
945 |
+
|
946 |
+
} else {
|
947 |
+
|
948 |
+
|
949 |
+
if ($_GET['action'] == "trash" && isset($_GET['map_id'])) {
|
950 |
+
|
951 |
+
if ($_GET['s'] == "1") {
|
952 |
+
if (wpgmaps_trash_map($_GET['map_id'])) {
|
953 |
+
//wp_redirect( admin_url('admin.php?page=wp-google-maps-menu') );
|
954 |
+
echo "<script>window.location = \"".get_option('siteurl')."/wp-admin/admin.php?page=wp-google-maps-menu\"</script>";
|
955 |
+
} else {
|
956 |
+
_e("There was a problem deleting the map.");;
|
957 |
+
}
|
958 |
+
} else {
|
959 |
+
$res = wpgmza_get_map_data($_GET['map_id']);
|
960 |
+
echo "<h2>".__("Delete your map","wp-google-maps")."</h2><p>".__("Are you sure you want to delete the map","wp-google-maps")." <strong>\"".$res->map_title."?\"</strong> <br /><a href='?page=wp-google-maps-menu&action=trash&map_id=".$_GET['map_id']."&s=1'>".__("Yes","wp-google-maps")."</a> | <a href='?page=wp-google-maps-menu'>".__("No","wp-google-maps")."</a></p>";
|
961 |
+
}
|
962 |
+
|
963 |
+
|
964 |
+
}
|
965 |
+
else if ($_GET['action'] == "edit_marker" && isset($_GET['id'])) {
|
966 |
+
|
967 |
+
wpgmza_edit_marker($_GET['id']);
|
968 |
+
|
969 |
+
}
|
970 |
+
else {
|
971 |
+
|
972 |
+
if (function_exists(wpgmza_register_pro_version)) {
|
973 |
+
|
974 |
+
$prov = get_option("WPGMZA_PRO");
|
975 |
+
$wpgmza_pro_version = $prov['version'];
|
976 |
+
if (floatval($wpgmza_pro_version) < 3 || $wpgmza_pro_version == null) {
|
977 |
+
wpgmaps_upgrade_notice();
|
978 |
+
} else {
|
979 |
+
wpgmza_pro_menu();
|
980 |
+
}
|
981 |
+
|
982 |
+
|
983 |
+
} else {
|
984 |
+
wpgmza_basic_menu();
|
985 |
+
|
986 |
+
}
|
987 |
+
|
988 |
+
}
|
989 |
+
}
|
990 |
+
|
991 |
+
wpgmaps_debugger("menu_end");
|
992 |
|
993 |
}
|
994 |
+
function wpgmaps_menu_advanced_layout() {
|
995 |
+
if (function_exists(wpgmza_register_pro_version)) {
|
996 |
+
wpgmza_pro_advanced_menu();
|
997 |
+
}
|
998 |
|
999 |
+
}
|
1000 |
|
1001 |
+
function wpgmza_map_page() {
|
1002 |
+
wpgmaps_debugger("map_page_start");
|
1003 |
|
1004 |
+
if (function_exists(wpgmza_register_pro_version)) {
|
1005 |
+
echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("Your Maps","wp-google-maps")." <a href=\"admin.php?page=wp-google-maps-menu&action=new\" class=\"add-new-h2\">".__("Add New","wp-google-maps")."</a></h2>";
|
1006 |
+
wpgmaps_check_versions();
|
1007 |
+
wpgmaps_list_maps();
|
1008 |
+
} else {
|
1009 |
+
echo"<div class=\"wrap\"><div id=\"icon-edit\" class=\"icon32 icon32-posts-post\"><br></div><h2>".__("Your Maps","wp-google-maps")."</h2>";
|
1010 |
+
echo"<p><i><a href='http://www.wpgmaps.com/purchase-professional-version/' title='".__("Pro Version")."'>".__("Create unlimited maps","wp-google-maps")."</a> ".__("with the","wp-google-maps")." <a href='http://www.wpgmaps.com/purchase-professional-version/' title='Pro Version'>".__("Pro Version","wp-google-maps")."</a> ".__("of WP Google Maps for only","wp-google-maps")." <strong>$9.99!</strong></i></p>";
|
1011 |
+
wpgmaps_list_maps();
|
1012 |
|
|
|
1013 |
|
1014 |
+
}
|
1015 |
+
echo "</div>";
|
1016 |
+
wpgmaps_debugger("map_page_end");
|
1017 |
+
|
1018 |
+
}
|
1019 |
+
function wpgmaps_list_maps() {
|
1020 |
+
wpgmaps_debugger("list_maps_start");
|
1021 |
|
1022 |
+
global $wpdb;
|
1023 |
+
global $wpgmza_tblname_maps;
|
1024 |
+
|
1025 |
+
if ($wpgmza_tblname_maps) { $table_name = $wpgmza_tblname_maps; } else { $table_name = $wpdb->prefix . "wpgmza_maps"; }
|
1026 |
|
1027 |
|
1028 |
+
$results = $wpdb->get_results(
|
1029 |
+
"
|
1030 |
+
SELECT *
|
1031 |
+
FROM $table_name
|
1032 |
+
WHERE `active` = 0
|
1033 |
+
ORDER BY `id` DESC
|
1034 |
+
"
|
1035 |
+
);
|
1036 |
echo "
|
1037 |
+
|
1038 |
+
<table class=\"wp-list-table widefat fixed \" cellspacing=\"0\">
|
1039 |
+
<thead>
|
1040 |
+
<tr>
|
1041 |
+
<th scope='col' id='id' class='manage-column column-id sortable desc' style=''><span>".__("ID","wp-google-maps")."</span></th>
|
1042 |
+
<th scope='col' id='map_title' class='manage-column column-map_title sortable desc' style=''><span>".__("Title","wp-google-maps")."</span></th>
|
1043 |
+
<th scope='col' id='map_width' class='manage-column column-map_width' style=\"\">".__("Width","wp-google-maps")."</th>
|
1044 |
+
<th scope='col' id='map_height' class='manage-column column-map_height' style=\"\">".__("Height","wp-google-maps")."</th>
|
1045 |
+
<th scope='col' id='type' class='manage-column column-type sortable desc' style=\"\"><span>".__("Type","wp-google-maps")."</span></th>
|
1046 |
+
</tr>
|
1047 |
+
</thead>
|
1048 |
+
<tbody id=\"the-list\" class='list:wp_list_text_link'>
|
1049 |
+
";
|
1050 |
+
foreach ( $results as $result ) {
|
1051 |
+
if ($result->type == "1") { $map_type = "Roadmap"; }
|
1052 |
+
else if ($result->type == "2") { $map_type = "Satellite"; }
|
1053 |
+
else if ($result->type == "3") { $map_type = "Hybrid"; }
|
1054 |
+
else if ($result->type == "4") { $map_type = "Terrain"; }
|
1055 |
+
if (function_exists(wpgmza_register_pro_version)) {
|
1056 |
+
$trashlink = "| <a href=\"?page=wp-google-maps-menu&action=trash&map_id=".$result->id."\" title=\"Trash\">".__("Trash","wp-google-maps")."</a>";
|
1057 |
+
}
|
1058 |
+
echo "<tr id=\"record_".$result->id."\">";
|
1059 |
+
echo "<td class='id column-id'>".$result->id."</td>";
|
1060 |
+
echo "<td class='map_title column-map_title'><strong><big><a href=\"?page=wp-google-maps-menu&action=edit&map_id=".$result->id."\" title=\"".__("Edit","wp-google-maps")."\">".$result->map_title."</a></big></strong><br /><a href=\"?page=wp-google-maps-menu&action=edit&map_id=".$result->id."\" title=\"".__("Edit","wp-google-maps")."\">".__("Edit","wp-google-maps")."</a> $trashlink</td>";
|
1061 |
+
echo "<td class='map_width column-map_width'>".$result->map_width."</td>";
|
1062 |
+
echo "<td class='map_width column-map_height'>".$result->map_height."</td>";
|
1063 |
+
echo "<td class='type column-type'>".$map_type."</td>";
|
1064 |
+
echo "</tr>";
|
1065 |
+
|
1066 |
+
|
1067 |
+
}
|
1068 |
+
echo "</table>";
|
1069 |
+
wpgmaps_debugger("list_maps_end");
|
1070 |
+
}
|
1071 |
+
|
1072 |
+
function wpgmaps_check_versions() {
|
1073 |
+
wpgmaps_debugger("check_versions_start");
|
1074 |
+
|
1075 |
+
$prov = get_option("WPGMZA_PRO");
|
1076 |
+
$wpgmza_pro_version = $prov['version'];
|
1077 |
+
if (floatval($wpgmza_pro_version) < 3 || $wpgmza_pro_version == null) {
|
1078 |
+
wpgmaps_upgrade_notice();
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
|
1082 |
+
wpgmaps_debugger("check_versions_end");
|
1083 |
+
}
|
1084 |
+
|
1085 |
+
function wpgmza_basic_menu() {
|
1086 |
+
wpgmaps_debugger("bm_start");
|
1087 |
+
|
1088 |
+
global $wpgmza_tblname_maps;
|
1089 |
+
global $wpdb;
|
1090 |
+
if (!wpgmaps_check_permissions()) { wpgmaps_permission_warning(); }
|
1091 |
+
if ($_GET['action'] == "edit" && isset($_GET['map_id'])) {
|
1092 |
+
|
1093 |
+
$res = wpgmza_get_map_data($_GET['map_id']);
|
1094 |
+
|
1095 |
+
|
1096 |
+
if ($res->map_start_zoom) { $wpgmza_zoom[intval($res->map_start_zoom)] = "SELECTED"; } else { $wpgmza_zoom[8] = "SELECTED"; }
|
1097 |
+
if ($res->type) { $wpgmza_map_type[intval($res->type)] = "SELECTED"; } else { $wpgmza_map_type[1] = "SELECTED"; }
|
1098 |
+
if ($res->alignment) { $wpgmza_map_align[intval($res->alignment)] = "SELECTED"; } else { $wpgmza_map_align[1] = "SELECTED"; }
|
1099 |
+
|
1100 |
+
|
1101 |
+
$wpgmza_act = "disabled readonly";
|
1102 |
+
$wpgmza_act_msg = "<span style=\"font-size:16px; color:#666;\">".__("Add custom icons, titles, descriptions, pictures and links to your markers with the","wp-google-maps")." \"<a href=\"http://www.wpgmaps.com/purchase-professional-version/\" title=\"".__("Pro Edition","wp-google-maps")."\" target=\"_BLANK\">".__("Pro Edition","wp-google-maps")."</a>\" ".__("of this plugin for just","wp-google-maps")." <strong>$9.99</strong></span>";
|
1103 |
+
$wpgmza_csv = "<p><a href=\"http://www.wpgmaps.com/\" title=\"".__("Pro Edition","wp-google-maps")."\">".__("Purchase the Pro Edition","wp-google-maps")."</a> ".__("of WP Google Maps and save your markers to a CSV file!","wp-google-maps")."</p>";
|
1104 |
+
}
|
1105 |
+
echo "
|
1106 |
+
|
1107 |
+
<div class='wrap'>
|
1108 |
+
<h1>WP Google Maps</h1>
|
1109 |
+
<div class='wide'>
|
1110 |
+
|
1111 |
+
|
1112 |
+
|
1113 |
+
<h2>".__("Map Settings","wp-google-maps")."</h2>
|
1114 |
+
<form action='' method='post' id='wpgmaps_options'>
|
1115 |
+
<p></p>
|
1116 |
|
1117 |
<input type='hidden' name='http_referer' value='".$_SERVER['PHP_SELF']."' />
|
1118 |
+
<input type='hidden' name='wpgmza_id' id='wpgmza_id' value='".$res->id."' />
|
1119 |
+
<input id='wpgmza_start_location' name='wpgmza_start_location' type='hidden' size='40' maxlength='100' value='".$res->map_start_location."' />
|
1120 |
+
<select id='wpgmza_start_zoom' name='wpgmza_start_zoom' style=\"display:none;\">
|
1121 |
<option value=\"1\" ".$wpgmza_zoom[1].">1</option>
|
1122 |
<option value=\"2\" ".$wpgmza_zoom[2].">2</option>
|
1123 |
<option value=\"3\" ".$wpgmza_zoom[3].">3</option>
|
1140 |
<option value=\"20\" ".$wpgmza_zoom[20].">20</option>
|
1141 |
<option value=\"21\" ".$wpgmza_zoom[21].">21</option>
|
1142 |
</select>
|
1143 |
+
<table>
|
1144 |
+
<tr>
|
1145 |
+
<td>".__("Short code","wp-google-maps").":</td>
|
1146 |
+
<td><input type='text' readonly name='shortcode' style='font-size:18px; text-align:center;' value='[wpgmza id=\"".$res->id."\"]' /> <small><i>".__("copy this into your post or page to display the map","wp-google-maps")."</i></td>
|
1147 |
+
</tr>
|
1148 |
+
<tr>
|
1149 |
+
<td>".__("Map Name","wp-google-maps").":</td>
|
1150 |
+
<td><input id='wpgmza_title' name='wpgmza_title' type='text' size='20' maxlength='50' value='".$res->map_title."' /></td>
|
1151 |
+
</tr>
|
1152 |
+
<tr>
|
1153 |
+
<td>".__("Width","wp-google-maps").":</td>
|
1154 |
+
<td><input id='wpgmza_width' name='wpgmza_width' type='text' size='4' maxlength='4' value='".$res->map_width."' /> px </td>
|
1155 |
+
</tr>
|
1156 |
+
<tr>
|
1157 |
+
<td>".__("Height","wp-google-maps").":</td>
|
1158 |
+
<td><input id='wpgmza_height' name='wpgmza_height' type='text' size='4' maxlength='4' value='".$res->map_height."' /> px</td>
|
1159 |
+
</tr>
|
1160 |
+
|
1161 |
+
<tr>
|
1162 |
+
<td>".__("Default Marker Image","wp-google-maps").":</td>
|
1163 |
+
<td><input id=\"upload_default_marker\" name=\"upload_default_marker\" type='hidden' size='35' maxlength='700' value='' ".$wpgmza_act."/> <input id=\"upload_default_marker_btn\" type=\"button\" value=\"".__("Upload Image","wp-google-maps")."\" $wpgmza_act /><small><i> ".__("available in the","wp-google-maps")." <a href=\"http://www.wpgmaps.com/purchase-professional-version/\" title=\"".__("Pro Edition","wp-google-maps")."\" target=\"_BLANK\">".__("Pro Edition","wp-google-maps")."</a> ".__("only","wp-google-maps").". </i></small></td>
|
1164 |
+
</tr>
|
1165 |
+
<tr>
|
1166 |
+
<td>".__("Map type","wp-google-maps").":</td>
|
1167 |
+
<td><select id='wpgmza_map_type' name='wpgmza_map_type'>
|
1168 |
+
<option value=\"1\" ".$wpgmza_map_type[1].">".__("Roadmap","wp-google-maps")."</option>
|
1169 |
+
<option value=\"2\" ".$wpgmza_map_type[2].">".__("Satellite","wp-google-maps")."</option>
|
1170 |
+
<option value=\"3\" ".$wpgmza_map_type[3].">".__("Hybrid","wp-google-maps")."</option>
|
1171 |
+
<option value=\"4\" ".$wpgmza_map_type[4].">".__("Terrain","wp-google-maps")."</option>
|
1172 |
+
</select>
|
1173 |
+
</td>
|
1174 |
+
</tr>
|
1175 |
+
<tr>
|
1176 |
+
<td>".__("Map Alignment","wp-google-maps").":</td>
|
1177 |
+
<td><select id='wpgmza_map_align' name='wpgmza_map_align'>
|
1178 |
+
<option value=\"1\" ".$wpgmza_map_align[1].">".__("Left","wp-google-maps")."</option>
|
1179 |
+
<option value=\"2\" ".$wpgmza_map_align[2].">".__("Center","wp-google-maps")."</option>
|
1180 |
+
<option value=\"3\" ".$wpgmza_map_align[3].">".__("Right","wp-google-maps")."</option>
|
1181 |
+
<option value=\"4\" ".$wpgmza_map_align[4].">".__("None","wp-google-maps")."</option>
|
1182 |
+
</select>
|
1183 |
+
</td>
|
1184 |
+
</tr>
|
1185 |
|
1186 |
|
1187 |
+
</table>
|
1188 |
+
<div id=\"wpgmaps_save_reminder\" style=\"display:none;\"><span style=\"font-size:16px; color:#1C62B9;\">
|
1189 |
+
".__("Remember to save your map!","wp-google-maps")."
|
1190 |
+
</span></div>
|
1191 |
+
<p class='submit'><input type='submit' name='wpgmza_savemap' class='button-primary' value='".__("Save Map","wp-google-maps")." »' /></p>
|
1192 |
+
<p style=\"width:600px; color:#808080;\">
|
1193 |
+
".__("Tip: Use your mouse to change the layout of your map. When you have positioned the map to your desired location, press \"Save Map\" to keep your settings.","wp-google-maps")."</p>
|
1194 |
+
|
1195 |
+
|
1196 |
+
<div id=\"wpgmza_map\"> </div>
|
1197 |
+
<div style=\"display:block; overflow:auto; background-color:#FFFBCC; padding:10px; border:1px solid #E6DB55; margin-top:5px; margin-bottom:5px;\">
|
1198 |
+
<h2 style=\"padding-top:0; margin-top:0;\">".__("Add a marker","wp-google-maps")."</h2>
|
1199 |
+
<p>
|
1200 |
+
<table>
|
1201 |
+
<input type=\"hidden\" name=\"wpgmza_edit_id\" id=\"wpgmza_edit_id\" value=\"\" />
|
1202 |
+
<tr>
|
1203 |
+
<td>".__("Title","wp-google-maps").": </td>
|
1204 |
+
<td><input id='wpgmza_add_title' name='wpgmza_add_title' type='text' size='35' maxlength='200' value='' $wpgmza_act /> <br /></td>
|
1205 |
+
|
1206 |
+
</tr>
|
1207 |
+
<tr>
|
1208 |
+
<td>".__("Address/GPS","wp-google-maps").": </td>
|
1209 |
+
<td><input id='wpgmza_add_address' name='wpgmza_add_address' type='text' size='35' maxlength='200' value='' /> <br /></td>
|
1210 |
+
|
1211 |
+
</tr>
|
1212 |
+
|
1213 |
+
<tr><td>".__("Description","wp-google-maps").": </td>
|
1214 |
+
<td><input id='wpgmza_add_desc' name='wpgmza_add_desc' type='text' size='35' maxlength='300' value='' ".$wpgmza_act."/> <br /></td></tr>
|
1215 |
+
<tr><td>".__("Pic URL","wp-google-maps").": </td>
|
1216 |
+
<td><input id='wpgmza_add_pic' name=\"wpgmza_add_pic\" type='text' size='35' maxlength='700' value='' ".$wpgmza_act."/> <input id=\"upload_image_button\" type=\"button\" value=\"".__("Upload Image","wp-google-maps")."\" $wpgmza_act /><br /></td></tr>
|
1217 |
+
<tr><td>".__("Link URL","wp-google-maps").": </td>
|
1218 |
+
<td><input id='wpgmza_link_url' name='wpgmza_link_url' type='text' size='35' maxlength='700' value='' ".$wpgmza_act." /></td></tr>
|
1219 |
+
<tr><td>".__("Custom Marker","wp-google-maps").": </td>
|
1220 |
+
<td><input id='wpgmza_add_custom_marker' name=\"wpgmza_add_custom_marker\" type='hidden' size='35' maxlength='700' value='' ".$wpgmza_act."/> <input id=\"upload_custom_marker_button\" type=\"button\" value=\"".__("Upload Image","wp-google-maps")."\" $wpgmza_act /> </td></tr>
|
1221 |
+
<tr>
|
1222 |
+
<td>".__("Animation","wp-google-maps").": </td>
|
1223 |
+
<td>
|
1224 |
+
<select name=\"wpgmza_animation\" id=\"wpgmza_animation\" readonly disabled>
|
1225 |
+
<option value=\"0\">".__("None","wp-google-maps")."</option>
|
1226 |
+
</td>
|
1227 |
+
</tr>
|
1228 |
+
|
1229 |
+
<tr>
|
1230 |
+
<td></td>
|
1231 |
+
<td>
|
1232 |
+
<span id=\"wpgmza_addmarker_div\"><input type=\"button\" class='button-primary' id='wpgmza_addmarker' value='".__("Add Marker","wp-google-maps")."' /></span> <span id=\"wpgmza_addmarker_loading\" style=\"display:none;\">".__("Adding","wp-google-maps")."...</span>
|
1233 |
+
<span id=\"wpgmza_editmarker_div\" style=\"display:none;\"><input type=\"button\" id='wpgmza_editmarker' class='button-primary' value='".__("Save Marker","wp-google-maps")."' /></span><span id=\"wpgmza_editmarker_loading\" style=\"display:none;\">".__("Saving","wp-google-maps")."...</span>
|
1234 |
+
</td>
|
1235 |
+
|
1236 |
+
</tr>
|
1237 |
+
|
1238 |
+
</table>
|
1239 |
+
</div>
|
1240 |
+
<p>$wpgmza_act_msg</p>
|
1241 |
+
<h2 style=\"padding-top:0; margin-top:0;\">".__("Your Markers","wp-google-maps")."</h2>
|
1242 |
+
<div id=\"wpgmza_marker_holder\">
|
1243 |
+
".wpgmza_return_marker_list($_GET['map_id'])."
|
1244 |
+
</div>
|
1245 |
+
|
1246 |
+
<br /><br />$wpgmza_csv
|
1247 |
|
1248 |
+
<table>
|
1249 |
+
<tr>
|
1250 |
+
<td><img src=\"".wpgmaps_get_plugin_url()."/images/custom_markers.jpg\" width=\"160\" style=\"border:3px solid #808080;\" title=\"".__("Add detailed information to your markers!")."\" alt=\"".__("Add custom markers to your map!","wp-google-maps")."\" /><br /><br /></td>
|
1251 |
+
<td valign=\"middle\"><span style=\"font-size:18px; color:#666;\">".__("Add detailed information to your markers for only","wp-google-maps")." <strong>$9.99</strong>. ".__("Click","wp-google-maps")." <a href=\"http://www.wpgmaps.com/purchase-professional-version/\" title=\"Pro Edition\" target=\"_BLANK\">".__("here","wp-google-maps")."</a></span></td>
|
1252 |
+
</tr>
|
1253 |
+
<tr>
|
1254 |
+
<td><img src=\"".wpgmaps_get_plugin_url()."/images/custom_marker_icons.jpg\" width=\"160\" style=\"border:3px solid #808080;\" title=\"".__("Add custom markers to your map!","wp-google-maps")."\" alt=\"".__("Add custom markers to your map!","wp-google-maps")."\" /><br /><br /></td>
|
1255 |
+
<td valign=\"middle\"><span style=\"font-size:18px; color:#666;\">".__("Add different marker icons, or your own icons to make your map really stand out!","wp-google-maps")."</span></td>
|
1256 |
+
</tr>
|
1257 |
+
<tr>
|
1258 |
+
<td><img src=\"".wpgmaps_get_plugin_url()."/images/get_directions.jpg\" width=\"160\" style=\"border:3px solid #808080;\" title=\"".__("Add custom markers to your map!","wp-google-maps")."\" alt=\"".__("Add custom markers to your map!","wp-google-maps")."\" /><br /><br /></td>
|
1259 |
+
<td valign=\"middle\"><span style=\"font-size:18px; color:#666;\">".__("Allow your visitors to get directions to your markers!","wp-google-maps")." ".__("Click","wp-google-maps")." <a href=\"http://www.wpgmaps.com/purchase-professional-version/\" title=\"".__("Pro Edition","wp-google-maps")."\" target=\"_BLANK\">".__("here","wp-google-maps")."</a></span></td>
|
1260 |
+
</tr>
|
1261 |
+
</table>
|
1262 |
|
1263 |
+
</form>
|
1264 |
|
1265 |
+
<p><br /><br />".__("WP Google Maps encourages you to make use of the amazing icons created by Nicolas Mollet's Maps Icons Collection","wp-google-maps")." <a href='http://mapicons.nicolasmollet.com'>http://mapicons.nicolasmollet.com/</a> ".__("and to credit him when doing so.","wp-google-maps")."</p>
|
1266 |
+
</div>
|
1267 |
|
1268 |
|
1269 |
+
</div>
|
1270 |
|
|
|
|
|
|
|
1271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1272 |
|
1273 |
+
";
|
1274 |
|
1275 |
+
|
|
|
|
|
|
|
1276 |
|
1277 |
+
wpgmaps_debugger("bm_end");
|
|
|
|
|
|
|
|
|
|
|
1278 |
|
1279 |
+
}
|
1280 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1281 |
|
|
|
1282 |
|
1283 |
+
function wpgmza_edit_marker($mid) {
|
1284 |
+
global $wpgmza_tblname_maps;
|
1285 |
+
global $wpdb;
|
1286 |
+
if ($_GET['action'] == "edit_marker" && isset($mid)) {
|
1287 |
+
$res = wpgmza_get_marker_data($mid);
|
1288 |
+
echo "
|
1289 |
+
<div class='wrap'>
|
1290 |
+
<h1>WP Google Maps</h1>
|
1291 |
+
<div class='wide'>
|
1292 |
+
|
1293 |
+
<h2>".__("Edit Marker Location","wp-google-maps")." ".__("ID","wp-google-maps")."#$mid</h2>
|
1294 |
+
<form action='?page=wp-google-maps-menu&action=edit&map_id=".$res->map_id."' method='post' id='wpgmaps_edit_marker'>
|
1295 |
+
<p></p>
|
1296 |
+
|
1297 |
+
<input type='hidden' name='wpgmaps_marker_id' id='wpgmaps_marker_id' value='".$mid."' />
|
1298 |
+
<div id=\"wpgmaps_status\"></div>
|
1299 |
+
<table>
|
1300 |
+
|
1301 |
+
<tr>
|
1302 |
+
<td>".__("Marker Latitude","wp-google-maps").":</td>
|
1303 |
+
<td><input id='wpgmaps_marker_lat' name='wpgmaps_marker_lat' type='text' size='15' maxlength='100' value='".$res->lat."' /></td>
|
1304 |
+
</tr>
|
1305 |
+
<tr>
|
1306 |
+
<td>".__("Marker Longitude","wp-google-maps").":</td>
|
1307 |
+
<td><input id='wpgmaps_marker_lng' name='wpgmaps_marker_lng' type='text' size='15' maxlength='100' value='".$res->lng."' /></td>
|
1308 |
+
</tr>
|
1309 |
+
|
1310 |
+
</table>
|
1311 |
+
<p class='submit'><input type='submit' name='wpgmza_save_maker_location' class='button-primary' value='".__("Save Marker Location","wp-google-maps")." »' /></p>
|
1312 |
+
<p style=\"width:600px; color:#808080;\">".__("Tip: Use your mouse to change the location of the marker. Simply click and drag it to your desired location.","wp-google-maps")."</p>
|
1313 |
+
|
1314 |
+
|
1315 |
+
<div id=\"wpgmza_map\"> </div>
|
1316 |
+
|
1317 |
+
<p>$wpgmza_act_msg</p>
|
1318 |
+
|
1319 |
+
|
1320 |
|
1321 |
+
</form>
|
1322 |
+
</div>
|
1323 |
|
|
|
1324 |
|
1325 |
+
</div>
|
1326 |
|
1327 |
|
|
|
1328 |
|
1329 |
+
";
|
1330 |
+
|
1331 |
+
}
|
1332 |
|
1333 |
|
1334 |
|
1335 |
}
|
1336 |
|
1337 |
|
1338 |
+
|
1339 |
+
|
1340 |
+
|
1341 |
+
function wpgmaps_admin_scripts() {
|
1342 |
+
wpgmaps_debugger("admin_scripts_start");
|
1343 |
wp_enqueue_script('media-upload');
|
1344 |
wp_enqueue_script('thickbox');
|
1345 |
wp_register_script('my-upload', WP_PLUGIN_URL.'/'.plugin_basename(dirname(__FILE__)).'/upload.js', array('jquery','media-upload','thickbox'));
|
1346 |
wp_enqueue_script('my-upload');
|
1347 |
+
wpgmaps_debugger("admin_scripts_end");
|
1348 |
|
1349 |
}
|
1350 |
|
1351 |
+
function wpgmaps_admin_styles() {
|
1352 |
wp_enqueue_style('thickbox');
|
1353 |
}
|
1354 |
|
1355 |
if (isset($_GET['page']) && $_GET['page'] == 'wp-google-maps-menu') {
|
1356 |
+
wpgmaps_debugger("load_scripts_styles_start");
|
1357 |
|
1358 |
+
add_action('admin_print_scripts', 'wpgmaps_admin_scripts');
|
1359 |
+
add_action('admin_print_styles', 'wpgmaps_admin_styles');
|
1360 |
+
wpgmaps_debugger("load_scripts_styles_end");
|
1361 |
}
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
+
function wpgmza_return_marker_list($map_id) {
|
1367 |
+
wpgmaps_debugger("return_marker_start");
|
1368 |
+
|
1369 |
global $wpdb;
|
1370 |
global $wpgmza_tblname;
|
1371 |
|
1372 |
+
$marker_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpgmza_tblname WHERE `map_id` = '$map_id';" ) );
|
1373 |
if ($marker_count > 2000) {
|
1374 |
+
return __("There are too many markers to make use of the live edit function. The maximum amount for this functionality is 2000 markers. Anything more than that number would crash your browser. In order to edit your markers, you would need to download the table in CSV format, edit it and re-upload it.","wp-google-maps");
|
1375 |
} else {
|
1376 |
|
1377 |
|
1379 |
$results = $wpdb->get_results("
|
1380 |
SELECT *
|
1381 |
FROM $wpgmza_tblname
|
1382 |
+
WHERE `map_id` = '$map_id' ORDER BY `id` DESC
|
1383 |
");
|
1384 |
$wpgmza_tmp .= "
|
1385 |
<table id=\"wpgmza_table\" class=\"display\" cellspacing=\"0\" cellpadding=\"0\">
|
1386 |
<thead>
|
1387 |
<tr>
|
1388 |
+
<th><strong>".__("ID","wp-google-maps")."</strong></th>
|
1389 |
+
<th><strong>".__("Icon","wp-google-maps")."</strong></th>
|
1390 |
+
<th><strong>".__("Title","wp-google-maps")."</strong></th>
|
1391 |
+
<th><strong>".__("Address","wp-google-maps")."</strong></th>
|
1392 |
+
<th><strong>".__("Description","wp-google-maps")."</strong></th>
|
1393 |
+
<th><strong>".__("Image","wp-google-maps")."</strong></th>
|
1394 |
+
<th><strong>".__("Link","wp-google-maps")."</strong></th>
|
1395 |
+
<th><strong>".__("Action","wp-google-maps")."</strong></th>
|
1396 |
</tr>
|
1397 |
</thead>
|
1398 |
<tbody>
|
1409 |
|
1410 |
if (!$img) { $pic = ""; } else { $pic = "<img src=\"".$result->pic."\" width=\"40\" />"; }
|
1411 |
if (!$icon) { $icon = $default_icon; } else { $icon = "<img src='".$result->icon."' />"; }
|
1412 |
+
if (!$link) { $linktd = ""; } else { $linktd = "<a href=\"".$result->link."\" target=\"_BLANK\" title=\"".__("View this link","wp-google-maps")."\">>></a>"; }
|
1413 |
$wpgmza_tmp .= "
|
1414 |
<tr id=\"wpgmza_tr_".$result->id."\">
|
1415 |
<td height=\"40\">".$result->id."</td>
|
1416 |
+
<td height=\"40\">".$icon."<input type=\"hidden\" id=\"wpgmza_hid_marker_icon_".$result->id."\" value=\"".$result->icon."\" /><input type=\"hidden\" id=\"wpgmza_hid_marker_anim_".$result->id."\" value=\"".$result->anim."\" /></td>
|
1417 |
+
<td>".$result->title."<input type=\"hidden\" id=\"wpgmza_hid_marker_title_".$result->id."\" value=\"".$result->title."\" /></td>
|
1418 |
<td>".$result->address."<input type=\"hidden\" id=\"wpgmza_hid_marker_address_".$result->id."\" value=\"".$result->address."\" /></td>
|
1419 |
<td>".$result->desc."<input type=\"hidden\" id=\"wpgmza_hid_marker_desc_".$result->id."\" value=\"".$result->desc."\" /></td>
|
1420 |
<td>$pic<input type=\"hidden\" id=\"wpgmza_hid_marker_pic_".$result->id."\" value=\"".$result->pic."\" /></td>
|
1421 |
<td>$linktd<input type=\"hidden\" id=\"wpgmza_hid_marker_link_".$result->id."\" value=\"".$result->link."\" /></td>
|
1422 |
<td>
|
1423 |
+
<a href=\"#wpgmaps_marker\" title=\"".__("Edit this marker","wp-google-maps")."\" class=\"wpgmza_edit_btn\" id=\"".$result->id."\">".__("Edit","wp-google-maps")."</a> |
|
1424 |
+
<a href=\"?page=wp-google-maps-menu&action=edit_marker&id=".$result->id."\" title=\"".__("Edit this marker","wp-google-maps")."\" class=\"wpgmza_edit_btn\" id=\"".$result->id."\">".__("Edit Location","wp-google-maps")."</a> |
|
1425 |
+
<a href=\"javascript:void(0);\" title=\"".__("Delete this marker","wp-google-maps")."\" class=\"wpgmza_del_btn\" id=\"".$result->id."\">".__("Delete","wp-google-maps")."</a>
|
1426 |
</td>
|
1427 |
</tr>";
|
1428 |
}
|
1429 |
$wpgmza_tmp .= "</tbody></table>";
|
1430 |
|
1431 |
+
wpgmaps_debugger("return_marker_end");
|
1432 |
return $wpgmza_tmp;
|
1433 |
}
|
1434 |
}
|
1435 |
|
1436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1437 |
|
1438 |
|
1439 |
function wpgmaps_chmodr($path, $filemode) {
|
1461 |
return FALSE;
|
1462 |
}
|
1463 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1464 |
if (function_exists(wpgmza_register_pro_version)) {
|
1465 |
add_action('wp_ajax_add_marker', 'wpgmaps_action_callback_pro');
|
1466 |
add_action('wp_ajax_delete_marker', 'wpgmaps_action_callback_pro');
|
1468 |
add_action('template_redirect','wpgmaps_check_shortcode');
|
1469 |
|
1470 |
if (function_exists(wpgmza_register_gold_version)) {
|
1471 |
+
add_action('wp_footer', 'wpgmaps_user_javascript_gold');
|
1472 |
add_action('admin_head', 'wpgmaps_admin_javascript_gold');
|
1473 |
} else {
|
1474 |
+
add_action('wp_footer', 'wpgmaps_user_javascript_pro');
|
1475 |
add_action('admin_head', 'wpgmaps_admin_javascript_pro');
|
1476 |
}
|
1477 |
add_shortcode( 'wpgmza', 'wpgmaps_tag_pro' );
|
1481 |
add_action('wp_ajax_delete_marker', 'wpgmaps_action_callback_basic');
|
1482 |
add_action('wp_ajax_edit_marker', 'wpgmaps_action_callback_basic');
|
1483 |
add_action('template_redirect','wpgmaps_check_shortcode');
|
1484 |
+
add_action('wp_footer', 'wpgmaps_user_javascript_basic');
|
1485 |
add_shortcode( 'wpgmza', 'wpgmaps_tag_basic' );
|
1486 |
}
|
1487 |
|
1488 |
+
|
1489 |
function wpgmaps_check_shortcode() {
|
1490 |
+
wpgmaps_debugger("check_for_sc_start");
|
1491 |
global $posts;
|
1492 |
global $short_code_active;
|
1493 |
$short_code_active = false;
|
1494 |
$pattern = get_shortcode_regex();
|
|
|
|
|
|
|
|
|
|
|
1495 |
|
1496 |
+
foreach ($posts as $post) {
|
1497 |
+
preg_match_all('/'.$pattern.'/s', $post->post_content, $matches);
|
1498 |
+
foreach ($matches as $match) {
|
1499 |
+
if (is_array($match)) {
|
1500 |
+
foreach($match as $key => $val) {
|
1501 |
+
$pos = strpos($val, "wpgmza");
|
1502 |
+
if ($pos === false) { } else { $short_code_active = true; }
|
1503 |
+
}
|
1504 |
+
}
|
1505 |
+
}
|
1506 |
+
}
|
1507 |
+
wpgmaps_debugger("check_for_sc_end");
|
1508 |
}
|
|
|
1509 |
function wpgmza_cURL_response($action) {
|
1510 |
if (function_exists('curl_version')) {
|
1511 |
global $wpgmza_version;
|
1538 |
|
1539 |
}
|
1540 |
function wpgmaps_permission_warning() {
|
1541 |
+
echo "<div class='error below-h1'>";
|
1542 |
+
_e("The plugin directory does not have 'write' permissions. Please enable 'write' permissions (755) for ");
|
1543 |
+
echo "\"".dirname( __FILE__ )."\" ";
|
1544 |
+
_e("in order for this plugin to work! Please see ");
|
1545 |
+
echo "<a href='http://codex.wordpress.org/Changing_File_Permissions#Using_an_FTP_Client'>";
|
1546 |
+
_e("this page");
|
1547 |
+
echo "</a> ";
|
1548 |
+
_e("for help on how to do it.");
|
1549 |
+
echo "</div>";
|
1550 |
}
|
1551 |
|
1552 |
|
1553 |
// handle database check upon upgrade
|
1554 |
function wpgmaps_update_db_check() {
|
1555 |
+
wpgmaps_debugger("update_db_start");
|
1556 |
+
|
1557 |
global $wpgmza_version;
|
1558 |
if (get_option('wpgmza_db_version') != $wpgmza_version) {
|
1559 |
wpgmaps_handle_db();
|
1560 |
}
|
1561 |
+
|
1562 |
+
// create all XML files
|
1563 |
+
wpgmaps_update_all_xml_file();
|
1564 |
+
|
1565 |
+
wpgmaps_debugger("update_db_end");
|
1566 |
}
|
1567 |
|
1568 |
|
1569 |
add_action('plugins_loaded', 'wpgmaps_update_db_check');
|
1570 |
|
1571 |
function wpgmaps_handle_db() {
|
1572 |
+
wpgmaps_debugger("handle_db_start");
|
1573 |
+
|
1574 |
global $wpdb;
|
1575 |
global $wpgmza_version;
|
1576 |
|
1580 |
CREATE TABLE `".$table_name."` (
|
1581 |
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1582 |
`map_id` int(11) NOT NULL,
|
1583 |
+
`address` varchar(700) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
|
1584 |
`desc` varchar(700) NOT NULL,
|
1585 |
`pic` varchar(700) NOT NULL,
|
1586 |
`link` varchar(700) NOT NULL,
|
1587 |
`icon` varchar(700) NOT NULL,
|
1588 |
`lat` varchar(100) NOT NULL,
|
1589 |
`lng` varchar(100) NOT NULL,
|
1590 |
+
`anim` varchar(3) NOT NULL,
|
1591 |
+
`title` varchar(700) NOT NULL,
|
1592 |
+
PRIMARY KEY (`id`)
|
1593 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
1594 |
+
";
|
1595 |
+
|
1596 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
1597 |
+
dbDelta($sql);
|
1598 |
+
|
1599 |
+
$table_name = $wpdb->prefix . "wpgmza_maps";
|
1600 |
+
$sql = "
|
1601 |
+
CREATE TABLE `".$table_name."` (
|
1602 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1603 |
+
`map_title` varchar(50) NOT NULL,
|
1604 |
+
`map_width` varchar(6) NOT NULL,
|
1605 |
+
`map_height` varchar(6) NOT NULL,
|
1606 |
+
`map_start_lat` varchar(700) NOT NULL,
|
1607 |
+
`map_start_lng` varchar(700) NOT NULL,
|
1608 |
+
`map_start_location` varchar(700) NOT NULL,
|
1609 |
+
`map_start_zoom` INT(10) NOT NULL,
|
1610 |
+
`default_marker` varchar(700) NOT NULL,
|
1611 |
+
`type` INT(10) NOT NULL,
|
1612 |
+
`alignment` INT(10) NOT NULL,
|
1613 |
+
`directions_enabled` INT(10) NOT NULL,
|
1614 |
+
`styling_enabled` INT(10) NOT NULL,
|
1615 |
+
`styling_json` mediumtext NOT NULL,
|
1616 |
+
`active` INT(1) NOT NULL,
|
1617 |
PRIMARY KEY (`id`)
|
1618 |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
1619 |
";
|
1621 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
1622 |
dbDelta($sql);
|
1623 |
|
1624 |
+
|
1625 |
+
|
1626 |
add_option("wpgmza_db_version", $wpgmza_version);
|
1627 |
+
update_option("wpgmza_db_version",$wpgmza_version);
|
1628 |
+
wpgmaps_debugger("handle_db_end");
|
1629 |
+
}
|
1630 |
+
|
1631 |
+
function wpgmza_get_map_data($map_id) {
|
1632 |
+
global $wpdb;
|
1633 |
+
global $wpgmza_tblname_maps;
|
1634 |
+
|
1635 |
+
$result = $wpdb->get_results("
|
1636 |
+
SELECT *
|
1637 |
+
FROM $wpgmza_tblname_maps
|
1638 |
+
WHERE `id` = '".$map_id."' LIMIT 1
|
1639 |
+
");
|
1640 |
+
|
1641 |
+
$res = $result[0];
|
1642 |
+
return $res;
|
1643 |
+
|
1644 |
+
}
|
1645 |
+
function wpgmza_get_marker_data($mid) {
|
1646 |
+
global $wpdb;
|
1647 |
+
global $wpgmza_tblname;
|
1648 |
+
|
1649 |
+
$result = $wpdb->get_results("
|
1650 |
+
SELECT *
|
1651 |
+
FROM $wpgmza_tblname
|
1652 |
+
WHERE `id` = '".$mid."' LIMIT 1
|
1653 |
+
");
|
1654 |
+
|
1655 |
+
$res = $result[0];
|
1656 |
+
return $res;
|
1657 |
+
|
1658 |
+
}
|
1659 |
+
function wpgmaps_upgrade_notice() {
|
1660 |
+
echo "<div class='error below-h1'>
|
1661 |
+
<big><big>
|
1662 |
+
<p>Dear Pro User. <br /></p>
|
1663 |
+
|
1664 |
+
<p>We recently upgraded the WP Google Maps plugin to include functionality for <strong>multiple maps.</strong>
|
1665 |
+
You need to upgrade your Pro version to the <strong>latest version</strong> in order for the plugin to continue
|
1666 |
+
working. We apologise for the inconvenience but would urge you to consider that we are attempting to make this
|
1667 |
+
the best map plugin available on the market. There was a big need for multiple maps and the only way we could
|
1668 |
+
achieve this was to make major changes to the code, thus resulting in the need for the latest version!<br /></p>
|
1669 |
+
|
1670 |
+
<p>You should have already received an email with the download link for the latest version, if not please
|
1671 |
+
<big><a href='http://www.wpgmaps.com/d/wp-google-maps-pro.zip' target='_blank'>download it here</a></big>! (This link will only be available
|
1672 |
+
for 1 week, thereafter please <a href='http://www.wpgmaps.com/contact-us/'>contact us</a>)<br /><br /></p>
|
1673 |
+
|
1674 |
+
<p><strong>Installation Instructions:</strong><br />
|
1675 |
+
<ul>
|
1676 |
+
<li>- Once downloaded, please <strong>deactivate</strong> and <strong>delete</strong> your old Pro plugin (your marker information wont be affected at all).</li>
|
1677 |
+
<li>- <a href=\"".get_option('siteurl')."/wp-admin/plugin-install.php?tab=upload\" target=\"_BLANK\">Upload the new</a> plugin ZIP file.</li>
|
1678 |
+
<li>- You will notice the left hand navigation has now changed from \"WP Google Maps\" to just \"Maps\".</li>
|
1679 |
+
<li>- Enjoy creating multiple maps!</li>
|
1680 |
+
|
1681 |
+
</p>
|
1682 |
+
|
1683 |
+
<p>If you run into any bugs, please let me know so that I can get it sorted out ASAP</p>
|
1684 |
+
|
1685 |
+
<p>Kind regards,<br /><a href='http://www.wpgmaps.com/'>WP Google Maps</a></p>
|
1686 |
+
</big></big>
|
1687 |
+
</div>";
|
1688 |
+
}
|
1689 |
+
function wpgmaps_trash_map($map_id) {
|
1690 |
+
global $wpdb;
|
1691 |
+
global $wpgmza_tblname_maps;
|
1692 |
+
if (isset($map_id)) {
|
1693 |
+
$rows_affected = $wpdb->query( $wpdb->prepare( "UPDATE $wpgmza_tblname_maps SET active = %d WHERE id = %d", 1, $map_id) );
|
1694 |
+
return true;
|
1695 |
+
} else {
|
1696 |
+
return false;
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
|
1700 |
}
|
1701 |
|
1702 |
+
function wpgmaps_debugger($section) {
|
1703 |
+
|
1704 |
+
global $debug;
|
1705 |
+
global $debug_start;
|
1706 |
+
global $debug_step;
|
1707 |
+
if ($debug) {
|
1708 |
+
$end = (float) array_sum(explode(' ',microtime()));
|
1709 |
+
echo "<!-- $section processing time: ". sprintf("%.4f", ($end-$debug_start))." seconds\n -->";
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
}
|
1713 |
?>
|