WP Google Map - Version 1.8.7

Version Description

  • Map Theme option introduced including custom theme JSON.
Download this release

Release Info

Developer milonfci
Plugin Icon 128x128 WP Google Map
Version 1.8.7
Comparing to
See all releases

Code changes from version 1.8.5 to 1.8.7

Files changed (76) hide show
  1. admin/assets/css/setup_wizard.css +239 -239
  2. admin/assets/css/wp-gmap-style-media-query.css +207 -207
  3. admin/assets/css/wp-gmap-style.css +375 -375
  4. admin/assets/js/common.js +230 -192
  5. admin/assets/js/geo_based_map_create.js +793 -682
  6. admin/assets/js/geo_based_map_edit.js +492 -395
  7. admin/assets/js/localized_script.js +1 -1
  8. admin/assets/js/setup_wizard.js +194 -158
  9. admin/assets/js/tinymce_keyup_event.js +1 -0
  10. admin/assets/js/wgm_map_crud.js +53 -45
  11. admin/assets/js/wgm_marker_crud.js +214 -188
  12. admin/includes/constant.php +3 -1
  13. admin/includes/map_theme_presets.php +106 -0
  14. admin/includes/markers-icons.php +21 -35
  15. admin/includes/markers-settings.php +151 -179
  16. admin/includes/wgm_messages_viewer.php +48 -32
  17. admin/includes/wpgmap_create.php +72 -48
  18. admin/includes/wpgmap_edit.php +104 -71
  19. admin/includes/wpgmap_how_to_use_manuals.php +23 -22
  20. admin/includes/wpgmap_installation_manuals.php +23 -22
  21. admin/includes/wpgmap_list.php +41 -39
  22. admin/includes/wpgmap_settings.php +178 -160
  23. admin/includes/wpgmap_setup_wizard.php +126 -126
  24. admin/includes/wpgmap_support.php +128 -117
  25. admin/includes/wpgmap_troubleshooting_manuals.php +20 -19
  26. appsero/src/Client.php +0 -280
  27. appsero/src/Insights.php +0 -1123
  28. appsero/src/License.php +0 -809
  29. appsero/src/Updater.php +0 -258
  30. autoload.php +24 -22
  31. gmap-embed.pot +2 -2
  32. includes/Classes/Bootstrap.php +89 -88
  33. includes/Classes/Database.php +34 -41
  34. includes/Classes/Migration.php +113 -118
  35. includes/Classes/srmgmap_widget.php +112 -86
  36. includes/Traits/ActionLinks.php +0 -29
  37. includes/Traits/ActivationHooks.php +0 -28
  38. includes/Traits/AdminInitActions.php +0 -18
  39. includes/Traits/AssetHandler.php +0 -193
  40. includes/Traits/CommonFunctions.php +0 -23
  41. includes/Traits/Filters.php +0 -27
  42. includes/Traits/InitActions.php +0 -77
  43. includes/Traits/MapCRUD.php +0 -269
  44. includes/Traits/MarkerCRUD.php +0 -453
  45. includes/Traits/MediaButtons.php +0 -56
  46. includes/Traits/Menu.php +0 -88
  47. includes/Traits/Notice.php +0 -149
  48. includes/Traits/PluginsLoadedActions.php +0 -21
  49. includes/Traits/Settings.php +0 -302
  50. includes/Traits/SetupWizard.php +0 -59
  51. includes/helper.php +403 -401
  52. includes/traits/ActionLinks.php +32 -0
  53. includes/traits/ActivationHooks.php +31 -0
  54. includes/traits/AdminInitActions.php +18 -0
  55. includes/traits/AssetHandler.php +192 -0
  56. includes/traits/CommonFunctions.php +26 -0
  57. includes/traits/Filters.php +30 -0
  58. includes/traits/InitActions.php +80 -0
  59. includes/traits/MapCRUD.php +298 -0
  60. includes/traits/MarkerCRUD.php +458 -0
  61. includes/traits/MediaButtons.php +68 -0
  62. includes/traits/Menu.php +132 -0
  63. includes/traits/Notice.php +162 -0
  64. includes/traits/PluginsLoadedActions.php +22 -0
  65. includes/traits/Settings.php +301 -0
  66. includes/traits/SetupWizard.php +62 -0
  67. index.php +1 -1
  68. languages/gmap-embed-da_DK.po +4 -4
  69. languages/gmap-embed-de_DE.po +4 -4
  70. languages/gmap-embed-de_DE_formal.po +4 -4
  71. languages/gmap-embed-es_ES.po +2 -2
  72. public/assets/css/front_custom_style.css +1 -1
  73. public/includes/shortcodes.php +134 -130
  74. readme.txt +56 -57
  75. srm_gmap_embed.php +30 -42
  76. uninstall.php +6 -4
admin/assets/css/setup_wizard.css CHANGED
@@ -1,46 +1,46 @@
1
  /* General Style */
2
  .wgm_setup_wizard_wrap {
3
- padding: 30px 0;
4
- max-width: 950px;
5
- margin: 0 auto;
6
- float: none;
7
  }
8
  .wgm_setup_wizard_header{
9
- width: auto;
10
- display: flex;
11
- justify-content: center;
12
- margin-bottom: 30px;
13
  }
14
  .wgm_setup_wizard_header .wgm_logo{
15
- width: 50px;
16
  }
17
  .wgm_setup_wizard_header .wgm_plugin_name{
18
- text-align: center;
19
- color: #06142F;
20
- font-size: 24px;
21
- letter-spacing: .035em;
22
- font-weight: 400;
23
- margin-top: 0;line-height: 43px;
24
- margin-left: 10px;
25
  }
26
 
27
  .wgm_setup_wizard_steps {
28
- display: flex;
29
- position: relative;
30
- margin: 0 8%;
31
- justify-content: space-between;
32
  }
33
  .wgm_setup_wizard_steps.wgm_four {
34
- margin: 0 25%;
35
  }
36
  .wgm_setup_wizard_steps li {
37
- border-radius: 5px;
38
- background-color: #ffffff;
39
- border: 1px #e0d9d9 solid;
40
- text-align: center;
41
- padding: 8px 20px;
42
- position: relative;
43
- z-index: 1;
44
  }
45
 
46
  .wgm_setup_wizard_steps[data-step="0"] li:nth-child(-n + 1),
@@ -48,323 +48,323 @@
48
  .wgm_setup_wizard_steps[data-step="2"] li:nth-child(-n + 3),
49
  .wgm_setup_wizard_steps[data-step="3"] li:nth-child(-n + 4),
50
  .wgm_setup_wizard_steps[data-step="4"] li:nth-child(-n + 5) {
51
- border: 1px solid #32c896;
52
  }
53
 
54
  .wgm_setup_wizard_steps:before,
55
  .wgm_setup_wizard_steps:after {
56
- content: "";
57
- width: 100%;
58
- height: 5px;
59
- background-color: #ffffff;
60
- position: absolute;
61
- top: 50%;
62
- transform: translateY(-50%);
63
- z-index: 0;
64
  }
65
  .wgm_setup_wizard_steps:before {
66
- width: 10%;
67
- left: 0;
68
- background: #32c896;
69
- transition: width .5s;
70
- z-index: 1;
71
- border-radius: 5px;
72
  }
73
 
74
  /* For steps width define */
75
  .wgm_setup_wizard_steps.wgm_four[data-step="0"]::before {
76
- width: 46%;
77
  }
78
  .wgm_setup_wizard_steps.wgm_four[data-step="1"]::before {
79
- width: 100%;
80
  }
81
 
82
  .wgm_step .wgm_step_name {
83
- font-size: 14px;
84
- line-height: 1.2em;
85
- color: #4e4362;
86
- font-weight: 400;
87
- margin-top: 5px;
88
  }
89
 
90
  .wgm_btn_collect:focus{
91
- outline: none;
92
  }
93
 
94
  .wgm_setup_content {
95
- display: none;
96
  }
97
  .wgm_text_center{
98
- text-align: center;
99
  }
100
  .wgm_text_right{
101
- text-align: right;
102
  }
103
  .wgm_setup_content.active {
104
- display: block;
105
  }
106
 
107
  /* body */
108
  .wgm_box {
109
- border-radius: 5px;
110
- background-color: #ffffff;
111
- border: 1px #e0d9d9 solid;
112
- padding: 30px;
113
  }
114
  .wgm_box .wgm_heading{
115
- display: flex;justify-content: center;
116
- color: #06142F;
117
- font-size: 24px;
118
- letter-spacing: .035em;
119
- font-weight: 400;
120
- margin-top: 0;text-align: center;
121
  }
122
  .wgm_setup_body {
123
- margin-top: 20px;
124
- margin-bottom: 25px;
125
  }
126
 
127
  .wgm_setup_body iframe{
128
- max-width: 100%;
129
  }
130
  .wgm_setup_body label{
131
- font-weight: 600;
132
- float: left;
133
- width: 15%;
134
- padding-top: 5px;
135
  }
136
  .button.button-large.wgm_api_btn{
137
- margin-left: 10px;
138
  }
139
  .wgm_setup_body input, .wgm_setup_body select{
140
- margin-right: 5px;
141
  }
142
  .wgm_setup_body input[type=text], .wgm_setup_body select{
143
- max-width: 100%;
144
- width: 100%;
145
- padding: 1px 8px;
146
  }
147
  .wgm_d_flex{
148
- display: flex;
149
  }
150
  .wgm_align_items_center{
151
- align-items: center;
152
  }
153
 
154
  #wgm_finalize_step .wgm_highlight p {
155
- margin: 8px 0 8px;
156
- font-size: 14px;
157
- line-height: 1.4em;
158
- color: #5a5a5a;
159
- font-weight: 400;
160
- padding-left: 15px;
161
  }
162
  .wgm_highlight{
163
- background-color: #f1f1f1;
164
- border-left: 2px #24a97f solid;
165
- margin: 5px 0;
166
- padding: 0 15px;
167
  }
168
  #wgm_finalize_step .wgm_highlight label{
169
- border-right: 2px #fff solid;
170
- padding: 8px 0;
171
- cursor: default;
172
  }
173
  .wgm_setup_footer {
174
- text-align: right;
175
  }
176
 
177
  .wgm_setup_wizard_wrap .wgm_btn {
178
- width: 140px;
179
- text-transform: capitalize !important;
180
  }
181
 
182
  .wgm_setup_wizard_wrap .button.wgm_btn:focus, .wgm_setup_wizard_wrap .button.wgm_btn:hover {
183
- background-color: #0c8a62 !important;
184
  }
185
 
186
  button#wgm_save[disabled] {
187
- cursor: wait;
188
- background-image: -webkit-linear-gradient(-169deg, rgb(146, 113, 255) 0%, rgb(87, 37, 255) 100%) !important;
189
  }
190
 
191
  button #wgm_next , button #wgm_save {
192
- background-color: #24a97f;
193
  }
194
 
195
  #wgm_prev {
196
- margin-right: 10px;
197
- margin-right: 10px;
198
- background-image: -webkit-linear-gradient( -169deg , rgb(104 204 176) 0%, rgb(28 204 139) 100% );
199
- opacity: 0.5;
200
  }
201
 
202
  .wgm_faq_item {
203
- padding: 19px 22px;
204
- background: #f8fafb;
205
- color: #252525;
206
- font-size: 15px;
207
- font-weight: 600;
208
- text-decoration: none;
209
- display: block;
210
- border-radius: 4px 4px 0 0;
211
  }
212
  .wgm_row {
213
- display: flex;
214
- flex-flow: row wrap;
215
- padding: 15px 0;
216
  }
217
 
218
  /* Button */
219
  .wgm_btn, .wgm_lng_custom_script_settings .button-primary {
220
- border-radius: 3px;
221
- background-image: -moz-linear-gradient(
222
- -169deg,
223
- #5b9dd9 0%,
224
- #007cba 100%
225
- );
226
- background-image: -webkit-linear-gradient(
227
- -169deg,
228
- #5b9dd9 0%,
229
- #007cba 100%
230
- );
231
- background-image: -ms-linear-gradient(
232
- -169deg,
233
- #5b9dd9 0%,
234
- #007cba 100%
235
- );
236
- width: 160px;
237
- height: 50px;
238
- transition: all 300ms ease-in-out;
239
  }
240
 
241
  /* Admin Blocks */
242
  .wgm_info_notice{
243
- position: relative;
244
- top: 10px;
245
  }
246
  .wgm_mb_40{
247
- margin-bottom: 40px;
248
  }
249
  .wgm_setup_wizard_steps .wgm_icon i{
250
- font-size: 25px;
251
- color: #32c896;
252
  }
253
 
254
  @media only screen and (max-width: 576px){
255
- .wgm_step .wgm_step_name{
256
- font-size: 11px;
257
- padding: 5px;
258
- }
259
- .wgm_box .wgm_heading{
260
- line-height: 28px;
261
- }
262
- .wgm_setup_body iframe{
263
- height: auto;
264
- }
265
- .wgm_api_btn{
266
- margin: 10px 0 !important;
267
- }
268
- .col-half{
269
- flex-basis: 100%;
270
- }
271
- .wgm_setup_wizard_steps li{
272
- padding: 10px 0;
273
- }
274
- .wgm_box{
275
- padding: 15px 15px 30px;
276
- }
277
- .wgm_api_btn{
278
- margin-left: 15px;
279
- }
280
- .wgm_setup_wizard_steps.wgm_four{
281
- grid-template-columns: repeat(2, 40%);
282
- grid-gap: 4%;
283
- margin: 0 1%;
284
- }
285
- .wgm_setup_footer{
286
- display: flex;
287
- float: right;
288
- }
289
- .wgm_d_flex{
290
- display: block;
291
- }
292
- .wgm_setup_body label{
293
- margin-bottom: 10px;
294
- width: 100%;
295
- }
296
- #wgm_finalize_step .wgm_highlight label{
297
- border-right: none;
298
- margin-bottom: 0;
299
- }
300
- #wgm_finalize_step .wgm_highlight p{
301
- text-align: left;
302
- padding-left: 0;
303
- word-break: break-all;
304
- }
305
- .swal2-container.swal2-center{
306
- z-index: 99999;
307
- }
308
- .swal2-content{
309
- padding: 0 !important;
310
- }
311
  }
312
  @media only screen and (min-width: 577px) and (max-width: 767px){
313
- .wgm_api_btn {
314
- margin: 10px 0 !important;
315
- }
316
- .wgm_setup_wizard_steps.wgm_four{
317
- grid-template-columns: repeat(2, 40%);
318
- grid-gap: 4%;
319
- margin: 0 1%;
320
- }
321
- .wgm_setup_footer{
322
- display: flex;
323
- float: right;
324
- }
325
- .wgm_d_flex{
326
- display: block;
327
- }
328
- .wgm_setup_body select{
329
- width: 100%;
330
- max-width: 100%;
331
- }
332
- .wgm_setup_body label{
333
- margin-bottom: 5px;
334
- width: 25%;
335
- }
336
- #wgm_finalize_step label{
337
- margin-right: 15px;
338
- margin-bottom: 0;
339
- }
340
- .swal2-container.swal2-center{
341
- z-index: 99999;
342
- }
343
- .wgm_header_bar .title{
344
- font-size: 16px;
345
- }
346
  }
347
  @media only screen and (min-width: 768px) and (max-width: 991px){
348
- .wgm_step .wgm_step_name{
349
- font-size: 12px;
350
- }
351
- .wgm_setup_wizard_steps li{
352
- padding: 8px 10px;
353
- }
354
  }
355
  /*sweetalert2 customize*/
356
  .wgm_m_0{
357
- margin: 0;
358
  }
359
  .swal2-actions.swal2-loading{
360
- margin: 1.25em 0;
361
  }
362
  .wgm_setup_content a{
363
- text-decoration: none;
364
  }
365
  .wgm_setup_wizard_container{
366
- padding: 15px;
367
  }
368
  .wgm_w_60{
369
- min-width: 60%;
370
- }
1
  /* General Style */
2
  .wgm_setup_wizard_wrap {
3
+ padding: 30px 0;
4
+ max-width: 950px;
5
+ margin: 0 auto;
6
+ float: none;
7
  }
8
  .wgm_setup_wizard_header{
9
+ width: auto;
10
+ display: flex;
11
+ justify-content: center;
12
+ margin-bottom: 30px;
13
  }
14
  .wgm_setup_wizard_header .wgm_logo{
15
+ width: 50px;
16
  }
17
  .wgm_setup_wizard_header .wgm_plugin_name{
18
+ text-align: center;
19
+ color: #06142F;
20
+ font-size: 24px;
21
+ letter-spacing: .035em;
22
+ font-weight: 400;
23
+ margin-top: 0;line-height: 43px;
24
+ margin-left: 10px;
25
  }
26
 
27
  .wgm_setup_wizard_steps {
28
+ display: flex;
29
+ position: relative;
30
+ margin: 0 8%;
31
+ justify-content: space-between;
32
  }
33
  .wgm_setup_wizard_steps.wgm_four {
34
+ margin: 0 25%;
35
  }
36
  .wgm_setup_wizard_steps li {
37
+ border-radius: 5px;
38
+ background-color: #ffffff;
39
+ border: 1px #e0d9d9 solid;
40
+ text-align: center;
41
+ padding: 8px 20px;
42
+ position: relative;
43
+ z-index: 1;
44
  }
45
 
46
  .wgm_setup_wizard_steps[data-step="0"] li:nth-child(-n + 1),
48
  .wgm_setup_wizard_steps[data-step="2"] li:nth-child(-n + 3),
49
  .wgm_setup_wizard_steps[data-step="3"] li:nth-child(-n + 4),
50
  .wgm_setup_wizard_steps[data-step="4"] li:nth-child(-n + 5) {
51
+ border: 1px solid #32c896;
52
  }
53
 
54
  .wgm_setup_wizard_steps:before,
55
  .wgm_setup_wizard_steps:after {
56
+ content: "";
57
+ width: 100%;
58
+ height: 5px;
59
+ background-color: #ffffff;
60
+ position: absolute;
61
+ top: 50%;
62
+ transform: translateY(-50%);
63
+ z-index: 0;
64
  }
65
  .wgm_setup_wizard_steps:before {
66
+ width: 10%;
67
+ left: 0;
68
+ background: #32c896;
69
+ transition: width .5s;
70
+ z-index: 1;
71
+ border-radius: 5px;
72
  }
73
 
74
  /* For steps width define */
75
  .wgm_setup_wizard_steps.wgm_four[data-step="0"]::before {
76
+ width: 46%;
77
  }
78
  .wgm_setup_wizard_steps.wgm_four[data-step="1"]::before {
79
+ width: 100%;
80
  }
81
 
82
  .wgm_step .wgm_step_name {
83
+ font-size: 14px;
84
+ line-height: 1.2em;
85
+ color: #4e4362;
86
+ font-weight: 400;
87
+ margin-top: 5px;
88
  }
89
 
90
  .wgm_btn_collect:focus{
91
+ outline: none;
92
  }
93
 
94
  .wgm_setup_content {
95
+ display: none;
96
  }
97
  .wgm_text_center{
98
+ text-align: center;
99
  }
100
  .wgm_text_right{
101
+ text-align: right;
102
  }
103
  .wgm_setup_content.active {
104
+ display: block;
105
  }
106
 
107
  /* body */
108
  .wgm_box {
109
+ border-radius: 5px;
110
+ background-color: #ffffff;
111
+ border: 1px #e0d9d9 solid;
112
+ padding: 30px;
113
  }
114
  .wgm_box .wgm_heading{
115
+ display: flex;justify-content: center;
116
+ color: #06142F;
117
+ font-size: 24px;
118
+ letter-spacing: .035em;
119
+ font-weight: 400;
120
+ margin-top: 0;text-align: center;
121
  }
122
  .wgm_setup_body {
123
+ margin-top: 20px;
124
+ margin-bottom: 25px;
125
  }
126
 
127
  .wgm_setup_body iframe{
128
+ max-width: 100%;
129
  }
130
  .wgm_setup_body label{
131
+ font-weight: 600;
132
+ float: left;
133
+ width: 15%;
134
+ padding-top: 5px;
135
  }
136
  .button.button-large.wgm_api_btn{
137
+ margin-left: 10px;
138
  }
139
  .wgm_setup_body input, .wgm_setup_body select{
140
+ margin-right: 5px;
141
  }
142
  .wgm_setup_body input[type=text], .wgm_setup_body select{
143
+ max-width: 100%;
144
+ width: 100%;
145
+ padding: 1px 8px;
146
  }
147
  .wgm_d_flex{
148
+ display: flex;
149
  }
150
  .wgm_align_items_center{
151
+ align-items: center;
152
  }
153
 
154
  #wgm_finalize_step .wgm_highlight p {
155
+ margin: 8px 0 8px;
156
+ font-size: 14px;
157
+ line-height: 1.4em;
158
+ color: #5a5a5a;
159
+ font-weight: 400;
160
+ padding-left: 15px;
161
  }
162
  .wgm_highlight{
163
+ background-color: #f1f1f1;
164
+ border-left: 2px #24a97f solid;
165
+ margin: 5px 0;
166
+ padding: 0 15px;
167
  }
168
  #wgm_finalize_step .wgm_highlight label{
169
+ border-right: 2px #fff solid;
170
+ padding: 8px 0;
171
+ cursor: default;
172
  }
173
  .wgm_setup_footer {
174
+ text-align: right;
175
  }
176
 
177
  .wgm_setup_wizard_wrap .wgm_btn {
178
+ width: 140px;
179
+ text-transform: capitalize !important;
180
  }
181
 
182
  .wgm_setup_wizard_wrap .button.wgm_btn:focus, .wgm_setup_wizard_wrap .button.wgm_btn:hover {
183
+ background-color: #0c8a62 !important;
184
  }
185
 
186
  button#wgm_save[disabled] {
187
+ cursor: wait;
188
+ background-image: -webkit-linear-gradient(-169deg, rgb(146, 113, 255) 0%, rgb(87, 37, 255) 100%) !important;
189
  }
190
 
191
  button #wgm_next , button #wgm_save {
192
+ background-color: #24a97f;
193
  }
194
 
195
  #wgm_prev {
196
+ margin-right: 10px;
197
+ margin-right: 10px;
198
+ background-image: -webkit-linear-gradient( -169deg , rgb(104 204 176) 0%, rgb(28 204 139) 100% );
199
+ opacity: 0.5;
200
  }
201
 
202
  .wgm_faq_item {
203
+ padding: 19px 22px;
204
+ background: #f8fafb;
205
+ color: #252525;
206
+ font-size: 15px;
207
+ font-weight: 600;
208
+ text-decoration: none;
209
+ display: block;
210
+ border-radius: 4px 4px 0 0;
211
  }
212
  .wgm_row {
213
+ display: flex;
214
+ flex-flow: row wrap;
215
+ padding: 15px 0;
216
  }
217
 
218
  /* Button */
219
  .wgm_btn, .wgm_lng_custom_script_settings .button-primary {
220
+ border-radius: 3px;
221
+ background-image: -moz-linear-gradient(
222
+ -169deg,
223
+ #5b9dd9 0%,
224
+ #007cba 100%
225
+ );
226
+ background-image: -webkit-linear-gradient(
227
+ -169deg,
228
+ #5b9dd9 0%,
229
+ #007cba 100%
230
+ );
231
+ background-image: -ms-linear-gradient(
232
+ -169deg,
233
+ #5b9dd9 0%,
234
+ #007cba 100%
235
+ );
236
+ width: 160px;
237
+ height: 50px;
238
+ transition: all 300ms ease-in-out;
239
  }
240
 
241
  /* Admin Blocks */
242
  .wgm_info_notice{
243
+ position: relative;
244
+ top: 10px;
245
  }
246
  .wgm_mb_40{
247
+ margin-bottom: 40px;
248
  }
249
  .wgm_setup_wizard_steps .wgm_icon i{
250
+ font-size: 25px;
251
+ color: #32c896;
252
  }
253
 
254
  @media only screen and (max-width: 576px){
255
+ .wgm_step .wgm_step_name{
256
+ font-size: 11px;
257
+ padding: 5px;
258
+ }
259
+ .wgm_box .wgm_heading{
260
+ line-height: 28px;
261
+ }
262
+ .wgm_setup_body iframe{
263
+ height: auto;
264
+ }
265
+ .wgm_api_btn{
266
+ margin: 10px 0 !important;
267
+ }
268
+ .col-half{
269
+ flex-basis: 100%;
270
+ }
271
+ .wgm_setup_wizard_steps li{
272
+ padding: 10px 0;
273
+ }
274
+ .wgm_box{
275
+ padding: 15px 15px 30px;
276
+ }
277
+ .wgm_api_btn{
278
+ margin-left: 15px;
279
+ }
280
+ .wgm_setup_wizard_steps.wgm_four{
281
+ grid-template-columns: repeat(2, 40%);
282
+ grid-gap: 4%;
283
+ margin: 0 1%;
284
+ }
285
+ .wgm_setup_footer{
286
+ display: flex;
287
+ float: right;
288
+ }
289
+ .wgm_d_flex{
290
+ display: block;
291
+ }
292
+ .wgm_setup_body label{
293
+ margin-bottom: 10px;
294
+ width: 100%;
295
+ }
296
+ #wgm_finalize_step .wgm_highlight label{
297
+ border-right: none;
298
+ margin-bottom: 0;
299
+ }
300
+ #wgm_finalize_step .wgm_highlight p{
301
+ text-align: left;
302
+ padding-left: 0;
303
+ word-break: break-all;
304
+ }
305
+ .swal2-container.swal2-center{
306
+ z-index: 99999;
307
+ }
308
+ .swal2-content{
309
+ padding: 0 !important;
310
+ }
311
  }
312
  @media only screen and (min-width: 577px) and (max-width: 767px){
313
+ .wgm_api_btn {
314
+ margin: 10px 0 !important;
315
+ }
316
+ .wgm_setup_wizard_steps.wgm_four{
317
+ grid-template-columns: repeat(2, 40%);
318
+ grid-gap: 4%;
319
+ margin: 0 1%;
320
+ }
321
+ .wgm_setup_footer{
322
+ display: flex;
323
+ float: right;
324
+ }
325
+ .wgm_d_flex{
326
+ display: block;
327
+ }
328
+ .wgm_setup_body select{
329
+ width: 100%;
330
+ max-width: 100%;
331
+ }
332
+ .wgm_setup_body label{
333
+ margin-bottom: 5px;
334
+ width: 25%;
335
+ }
336
+ #wgm_finalize_step label{
337
+ margin-right: 15px;
338
+ margin-bottom: 0;
339
+ }
340
+ .swal2-container.swal2-center{
341
+ z-index: 99999;
342
+ }
343
+ .wgm_header_bar .title{
344
+ font-size: 16px;
345
+ }
346
  }
347
  @media only screen and (min-width: 768px) and (max-width: 991px){
348
+ .wgm_step .wgm_step_name{
349
+ font-size: 12px;
350
+ }
351
+ .wgm_setup_wizard_steps li{
352
+ padding: 8px 10px;
353
+ }
354
  }
355
  /*sweetalert2 customize*/
356
  .wgm_m_0{
357
+ margin: 0;
358
  }
359
  .swal2-actions.swal2-loading{
360
+ margin: 1.25em 0;
361
  }
362
  .wgm_setup_content a{
363
+ text-decoration: none;
364
  }
365
  .wgm_setup_wizard_container{
366
+ padding: 15px;
367
  }
368
  .wgm_w_60{
369
+ min-width: 60%;
370
+ }
admin/assets/css/wp-gmap-style-media-query.css CHANGED
@@ -1,249 +1,249 @@
1
  /* On screens that are 992px or less */
2
  @media screen and (max-width: 992px) {
3
- .wp-gmap-properties-outer {
4
- width: 100% !important;
5
- }
6
- .wp-gmap-preview {
7
- width: 98% !important;
8
- float: left !important;
9
- margin-top: 10px !important;
10
- }
11
- .wp-gmap-single-left {
12
- width: 100% !important;
13
- float: left;
14
- }
15
- .wp-gmap-single-action {
16
- width: 100% !important;
17
- text-align:left !important;
18
- }
19
- .wp-gmap-list .regular-text{
20
- width: 98% !important;
21
- }
22
-
23
- ul#wp-gmap-nav{
24
- margin: 5px 0 0 5px !important;
25
- }
26
- ul#wp-gmap-nav li a{
27
- /*min-width: 130px !important;*/
28
- }
29
- .wp-gmap-list{
30
- width: 98.5% !important;
31
- }
32
- .srm_gmap_contact_area, .srm_gmap_instructions{
33
- width: 100% !important;
34
- margin-left: 0 !important;
35
- padding: 0 !important;
36
- }
37
- #wpgmap_title{
38
- margin-bottom: 5px !important;
39
- }
40
- .gmap_properties tr .regular-text {
41
- width: 99% !important;
42
- max-width: 99%;
43
- }
44
- .gmap_header_section{
45
- text-align: center !important;
46
- }
47
- .gmap_header_section_left{
48
- width: 100% !important;
49
- }
50
- .gmap_header_section_right{
51
- width: 100% !important;
52
- max-width: 100% !important;
53
- float: left;
54
- }
55
- .gmap_get_pro_version {
56
- padding: 2px 5px !important;
57
- font-weight: normal !important;
58
- margin: 5px 5px 0 0 !important;
59
- font-size: 12px !important;
60
- }
61
- .gmap_donate_button img{
62
- width: 110px !important;
63
- height: 40px !important;
64
- }
65
- .gmap_header_section_right_inner{
66
- width: 71% !important;
67
- margin: 0 auto !important;
68
- }
69
- .gmap_embed_create_new_link_area {
70
- width: 80% !important;
71
- }
72
  }
73
 
74
  @media only screen and (max-width: 576px) {
75
- .wgm_setup_body iframe {
76
- height: auto;
77
- }
78
 
79
- .wgm_setup_wizard_container .wgm_header_bar_left, .wgm_header_bar {
80
- display: block;
81
- }
82
 
83
- .wgm_api_btn {
84
- margin: 10px 0 !important;
85
- }
86
 
87
- .wgm_setup_wizard_container .wgm_header_bar_left {
88
- text-align: center;
89
- }
90
 
91
- .wgm_header_bar .wgm_admin_logo_inline {
92
- margin: 0 auto;
93
- }
94
 
95
- .wgm_header_right {
96
- display: block;
97
- text-align: center;
98
- }
99
 
100
- .wgm_header_right .button.wgm_btn {
101
- margin-right: 10px;
102
- }
103
 
104
 
105
 
106
- .wgm_gmap_embed_create_new_link_area a {
107
- margin-left: 0;
108
- }
109
 
110
- .wgm_gmap_embed_create_new_link_area {
111
- width: 100% !important;
112
- text-align: center;
113
- }
114
 
115
 
116
 
117
- .col-half {
118
- flex-basis: 100%;
119
- }
120
 
121
- .wgm_admin_block_header {
122
- display: block;
123
- padding: 15px 15px 0;
124
- }
125
 
126
- .wgm_admin_block_content {
127
- padding: 15px;
128
- }
129
 
130
- #wgm_gmap_contact {
131
- padding: 0 15px;
132
- }
133
 
134
- #wgm_gmap_contact .form-table th {
135
- padding: 10px 0 0 0;
136
- }
137
 
138
- .wgm_setup_wizard li {
139
- padding: 10px 0;
140
- }
141
 
142
- .wgm_box {
143
- padding: 15px 15px 30px;
144
- }
145
 
146
- .wgm_api_btn {
147
- margin-left: 15px;
148
- }
149
 
150
- .wgm_setup_wizard.four {
151
- grid-template-columns: repeat(4, 22%);
152
- grid-gap: 4%;
153
- margin: 0 1%;
154
- }
155
 
156
- .wgm_setup_footer {
157
- display: flex;
158
- float: right;
159
- }
160
 
161
- .widefat td, .widefat th {
162
- font-size: 11px;
163
- }
164
 
165
- .wgm_d_flex {
166
- display: block;
167
- }
168
 
169
- .wgm_setup_body input[type=text], .wgm_setup_body select {
170
- width: 100%;
171
- }
172
 
173
- .wgm_setup_body label {
174
- margin-bottom: 10px;
175
- width: 100%;
176
- }
177
 
178
- #wgm_finalize_step .wgm_highlight label {
179
- border-right: none;
180
- margin-bottom: 0;
181
- }
182
 
183
 
184
- #wgm_finalize_step p {
185
- text-align: left;
186
- padding-left: 0;
187
- }
188
 
189
- .swal2-container.swal2-center {
190
- z-index: 99999;
191
- }
192
 
193
- .swal2-content {
194
- padding: 0 !important;
195
- }
196
  }
197
 
198
  @media only screen and (min-width: 577px) and (max-width: 767px) {
199
- .wgm_setup_wizard.four {
200
- grid-template-columns: repeat(4, 22%);
201
- grid-gap: 4%;
202
- margin: 0 1%;
203
- }
204
-
205
- .wgm_setup_footer {
206
- display: flex;
207
- float: right;
208
- }
209
-
210
- .wgm_d_flex {
211
- display: block;
212
- }
213
-
214
- .wgm_setup_body input, .wgm_setup_body select {
215
- width: 100%;
216
- max-width: 100%;
217
- }
218
-
219
- .wgm_setup_body label {
220
- margin-bottom: 10px;
221
- }
222
-
223
-
224
- #wgm_finalize_step p {
225
- text-align: left;
226
- }
227
-
228
- .swal2-container.swal2-center {
229
- z-index: 99999;
230
- }
231
-
232
- .wgm_header_bar .title {
233
- font-size: 16px;
234
- }
235
  }
236
 
237
  @media only screen and (min-width: 768px) and (max-width: 991px) {
238
- input[type=checkbox], input[type=radio] {
239
- margin: 0;
240
- }
241
-
242
- .wgm_setup_body input {
243
- width: 100%;
244
- }
245
-
246
- .wgm_setup_body label {
247
- min-width: 160px;
248
- }
249
- }
1
  /* On screens that are 992px or less */
2
  @media screen and (max-width: 992px) {
3
+ .wp-gmap-properties-outer {
4
+ width: 100% !important;
5
+ }
6
+ .wp-gmap-preview {
7
+ width: 98% !important;
8
+ float: left !important;
9
+ margin-top: 10px !important;
10
+ }
11
+ .wp-gmap-single-left {
12
+ width: 100% !important;
13
+ float: left;
14
+ }
15
+ .wp-gmap-single-action {
16
+ width: 100% !important;
17
+ text-align:left !important;
18
+ }
19
+ .wp-gmap-list .regular-text{
20
+ width: 98% !important;
21
+ }
22
+
23
+ ul#wp-gmap-nav{
24
+ margin: 5px 0 0 5px !important;
25
+ }
26
+ ul#wp-gmap-nav li a{
27
+ /*min-width: 130px !important;*/
28
+ }
29
+ .wp-gmap-list{
30
+ width: 98.5% !important;
31
+ }
32
+ .srm_gmap_contact_area, .srm_gmap_instructions{
33
+ width: 100% !important;
34
+ margin-left: 0 !important;
35
+ padding: 0 !important;
36
+ }
37
+ #wpgmap_title{
38
+ margin-bottom: 5px !important;
39
+ }
40
+ .gmap_properties tr .regular-text {
41
+ width: 99% !important;
42
+ max-width: 99%;
43
+ }
44
+ .gmap_header_section{
45
+ text-align: center !important;
46
+ }
47
+ .gmap_header_section_left{
48
+ width: 100% !important;
49
+ }
50
+ .gmap_header_section_right{
51
+ width: 100% !important;
52
+ max-width: 100% !important;
53
+ float: left;
54
+ }
55
+ .gmap_get_pro_version {
56
+ padding: 2px 5px !important;
57
+ font-weight: normal !important;
58
+ margin: 5px 5px 0 0 !important;
59
+ font-size: 12px !important;
60
+ }
61
+ .gmap_donate_button img{
62
+ width: 110px !important;
63
+ height: 40px !important;
64
+ }
65
+ .gmap_header_section_right_inner{
66
+ width: 71% !important;
67
+ margin: 0 auto !important;
68
+ }
69
+ .gmap_embed_create_new_link_area {
70
+ width: 80% !important;
71
+ }
72
  }
73
 
74
  @media only screen and (max-width: 576px) {
75
+ .wgm_setup_body iframe {
76
+ height: auto;
77
+ }
78
 
79
+ .wgm_setup_wizard_container .wgm_header_bar_left, .wgm_header_bar {
80
+ display: block;
81
+ }
82
 
83
+ .wgm_api_btn {
84
+ margin: 10px 0 !important;
85
+ }
86
 
87
+ .wgm_setup_wizard_container .wgm_header_bar_left {
88
+ text-align: center;
89
+ }
90
 
91
+ .wgm_header_bar .wgm_admin_logo_inline {
92
+ margin: 0 auto;
93
+ }
94
 
95
+ .wgm_header_right {
96
+ display: block;
97
+ text-align: center;
98
+ }
99
 
100
+ .wgm_header_right .button.wgm_btn {
101
+ margin-right: 10px;
102
+ }
103
 
104
 
105
 
106
+ .wgm_gmap_embed_create_new_link_area a {
107
+ margin-left: 0;
108
+ }
109
 
110
+ .wgm_gmap_embed_create_new_link_area {
111
+ width: 100% !important;
112
+ text-align: center;
113
+ }
114
 
115
 
116
 
117
+ .col-half {
118
+ flex-basis: 100%;
119
+ }
120
 
121
+ .wgm_admin_block_header {
122
+ display: block;
123
+ padding: 15px 15px 0;
124
+ }
125
 
126
+ .wgm_admin_block_content {
127
+ padding: 15px;
128
+ }
129
 
130
+ #wgm_gmap_contact {
131
+ padding: 0 15px;
132
+ }
133
 
134
+ #wgm_gmap_contact .form-table th {
135
+ padding: 10px 0 0 0;
136
+ }
137
 
138
+ .wgm_setup_wizard li {
139
+ padding: 10px 0;
140
+ }
141
 
142
+ .wgm_box {
143
+ padding: 15px 15px 30px;
144
+ }
145
 
146
+ .wgm_api_btn {
147
+ margin-left: 15px;
148
+ }
149
 
150
+ .wgm_setup_wizard.four {
151
+ grid-template-columns: repeat(4, 22%);
152
+ grid-gap: 4%;
153
+ margin: 0 1%;
154
+ }
155
 
156
+ .wgm_setup_footer {
157
+ display: flex;
158
+ float: right;
159
+ }
160
 
161
+ .widefat td, .widefat th {
162
+ font-size: 11px;
163
+ }
164
 
165
+ .wgm_d_flex {
166
+ display: block;
167
+ }
168
 
169
+ .wgm_setup_body input[type=text], .wgm_setup_body select {
170
+ width: 100%;
171
+ }
172
 
173
+ .wgm_setup_body label {
174
+ margin-bottom: 10px;
175
+ width: 100%;
176
+ }
177
 
178
+ #wgm_finalize_step .wgm_highlight label {
179
+ border-right: none;
180
+ margin-bottom: 0;
181
+ }
182
 
183
 
184
+ #wgm_finalize_step p {
185
+ text-align: left;
186
+ padding-left: 0;
187
+ }
188
 
189
+ .swal2-container.swal2-center {
190
+ z-index: 99999;
191
+ }
192
 
193
+ .swal2-content {
194
+ padding: 0 !important;
195
+ }
196
  }
197
 
198
  @media only screen and (min-width: 577px) and (max-width: 767px) {
199
+ .wgm_setup_wizard.four {
200
+ grid-template-columns: repeat(4, 22%);
201
+ grid-gap: 4%;
202
+ margin: 0 1%;
203
+ }
204
+
205
+ .wgm_setup_footer {
206
+ display: flex;
207
+ float: right;
208
+ }
209
+
210
+ .wgm_d_flex {
211
+ display: block;
212
+ }
213
+
214
+ .wgm_setup_body input, .wgm_setup_body select {
215
+ width: 100%;
216
+ max-width: 100%;
217
+ }
218
+
219
+ .wgm_setup_body label {
220
+ margin-bottom: 10px;
221
+ }
222
+
223
+
224
+ #wgm_finalize_step p {
225
+ text-align: left;
226
+ }
227
+
228
+ .swal2-container.swal2-center {
229
+ z-index: 99999;
230
+ }
231
+
232
+ .wgm_header_bar .title {
233
+ font-size: 16px;
234
+ }
235
  }
236
 
237
  @media only screen and (min-width: 768px) and (max-width: 991px) {
238
+ input[type=checkbox], input[type=radio] {
239
+ margin: 0;
240
+ }
241
+
242
+ .wgm_setup_body input {
243
+ width: 100%;
244
+ }
245
+
246
+ .wgm_setup_body label {
247
+ min-width: 160px;
248
+ }
249
+ }
admin/assets/css/wp-gmap-style.css CHANGED
@@ -2,279 +2,279 @@
2
  @import "wp-gmap-style-media-query.css";
3
  /*Header section*/
4
  .gmap_header_section {
5
- width: 100%;
6
- float: left;
7
  }
8
 
9
  .gmap_header_section_left {
10
- width: 78%;
11
- float: left;
12
  }
13
 
14
  .gmap_header_section_right {
15
- max-width: 21%;
16
- float: right;
17
- padding-right: 1%;
18
  }
19
 
20
  .gmap_donate_button {
21
- float: left;
22
- margin-top: 5px;
23
  }
24
 
25
  .gmap_donate_button img {
26
- height: 32px;
27
- width: 93px;
28
  }
29
 
30
  .gmap_get_pro_version {
31
- float: left;
32
- padding: 2px 9px;
33
- height: auto !important;
34
- font-weight: bold;
35
- margin: 5px 5px 0 0 !important;
36
- color: #238b68 !important;;
37
  }
38
 
39
  /******* Nav Bar ********/
40
  ul#wp-gmap-nav {
41
- list-style-type: none;
42
- padding: 0;
43
- margin: 0;
44
  }
45
 
46
  ul#wp-gmap-nav li {
47
- display: inline-block;
48
- background-color: #32c896;
49
- border-bottom: solid 5px #238b68;
50
- color: #fff;
51
- cursor: pointer;
52
  }
53
 
54
  ul#wp-gmap-nav li:hover, ul#wp-gmap-nav .active {
55
- background-color: #238b68;
56
  }
57
 
58
  ul#wp-gmap-nav li a {
59
- color: white;
60
- text-decoration: none;
61
- display: block;
62
- padding: 5px 8px;
63
- font-weight: bold;
64
  }
65
 
66
  /******* Create/Update Map Tabs ******/
67
  #wp-gmap-tabs {
68
- padding: 1%;
69
- float: left;
70
- width: 98%;
71
  }
72
 
73
  #wp-gmap-tabs .active {
74
- display: block;
75
  }
76
 
77
  .wgm_wpgmap_tab {
78
- width: 100%;
79
- background-color: #ccc;
80
- float: left;
81
- height: 30px;
82
  }
83
 
84
  ul.wgm_wpgmap_tab {
85
- padding: 0;
86
- margin: 0;
87
- height: 30px;
88
  }
89
 
90
  .wgm_wpgmap_tab li {
91
- display: inline;
92
- padding: 6px 6px;
93
- float: left;
94
- background-color: #ccc;
95
- border-right: 1px white solid;
96
- cursor: pointer;
97
  }
98
 
99
  .wgm_wpgmap_tab .active,.wgm_wpgmap_tab li:hover {
100
- background-color: #24a97f;
101
- color: white;
102
- /*border-top: 2px solid #17c9a2;*/
103
  }
104
 
105
  .hidden {
106
- display: none;
107
  }
108
 
109
  /******* For Google Map Rendering ******/
110
  .wp-gmap-preview .wgm_controls {
111
- margin-top: 10px;
112
- border: 1px solid transparent;
113
- border-radius: 2px 0 0 2px;
114
- box-sizing: border-box;
115
- -moz-box-sizing: border-box;
116
- height: 39px;
117
- outline: none;
118
- box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
119
  }
120
 
121
  .wp-gmap-preview #wgm_pac_input {
122
- background-color: #fff;
123
- font-family: Roboto;
124
- font-size: 15px;
125
- font-weight: 300;
126
- margin-left: 12px;
127
- padding: 0 11px 0 13px;
128
- text-overflow: ellipsis;
129
- width: 400px;
130
  }
131
 
132
  .wp-gmap-preview #wgm_pac_input:focus {
133
- border-color: #4d90fe;
134
  }
135
 
136
  .pac-container {
137
- font-family: Roboto;
138
- z-index: 99999;
139
  }
140
 
141
  #type-selector {
142
- color: #fff;
143
- background-color: #4d90fe;
144
- padding: 5px 11px 0 11px;
145
  }
146
 
147
  #type-selector label {
148
- font-family: Roboto;
149
- font-size: 13px;
150
- font-weight: 300;
151
  }
152
 
153
  #target {
154
- width: 345px;
155
  }
156
 
157
  /******* Google Map Settings ******/
158
  #gmap_container_inner {
159
- background-color: white;
160
- float: left;
161
- width: 100%;
162
- border: 1px #e0dddd solid;
163
- margin-top: 5px;
164
  }
165
 
166
  .popup-content {
167
- position: relative;
168
- width: 60%;
169
  }
170
 
171
  /******* Map List ******/
172
  .wp-gmap-list {
173
- padding: 1%;
174
- float: left;
175
- width: 97%;
176
  }
177
 
178
  .wp-gmap-single {
179
- padding: .2% 1%;
180
- float: left;
181
- width: 97%;
182
- border: 1px #ccc solid;
183
- margin: 7px 0;
184
- background-color: #f3f3f3;
185
  }
186
 
187
  .wp-gmap-single-left {
188
- width: 80%;
189
- float: left;
190
  }
191
 
192
  .wp-gmap-single-title {
193
- font-size: 18px;
194
- font-weight: 600;
195
- padding: 5px 0;
196
  }
197
 
198
  .wp-gmap-single-action {
199
- width: 20%;
200
- padding: 13px 0;
201
- float: left;
202
- text-align: right;
203
  }
204
 
205
  /******* Map Properties ******/
206
  .wp-gmap-properties-outer {
207
- width: 49%;
208
- float: left;
209
- /*border: 1px #ccc solid;*/
210
 
211
  }
212
 
213
  .wp-gmap-properties, .wp-gmap-other-properties {
214
- width: 100%;
215
- background-color: white;
216
- float: left;
217
  }
218
 
219
  .gmap_properties {
220
- width: 100%;
221
- padding: 1%;
222
  }
223
 
224
  .gmap_properties tr {
225
- height: 50px;
226
  }
227
 
228
  .gmap_properties tr .regular-text {
229
- width: 99%;
230
- max-width: 99%;
231
  }
232
 
233
  /******* Preview Map ******/
234
  .wp-gmap-preview {
235
- width: 50%;
236
- background-color: #f3f3f3;
237
- margin-left: 1%;
238
- float: left;
239
  }
240
 
241
  /**********Contact form ***********/
242
  .srm_gmap_contact_area {
243
- width: 50%;
244
- float: left;
245
- padding: 10px;
246
  }
247
 
248
  .srm_gmap_instructions_outer_area {
249
- width: 50%;
250
- /*float: left;*/
251
- /*margin-left: 2%;*/
252
- padding: 10px;
253
- margin: 0 auto;
254
  }
255
 
256
  .srm_gmap_instructions {
257
- width: 42%;
258
- float: left;
259
- margin-left: 2%;
260
- padding: 10px;
261
  }
262
 
263
  .srm_gmap_instructions ul {
264
- padding: 0;
265
- margin: 0;
266
  }
267
 
268
  .srm_gmap_instructions ul li {
269
- background-color: #f0f0f0;
270
- padding: 6px;
271
- border: 1px solid #e0e0e0;
272
- margin: 5px 0;
273
  }
274
 
275
  .srm_gmap_instructions ul li:before {
276
- content: '> ';
277
- font-weight: bold;
278
  }
279
 
280
  .srm_gmap_instructions ul li:hover {
@@ -282,93 +282,93 @@ ul.wgm_wpgmap_tab {
282
  }
283
 
284
  .srm_gmap_instructions ul li a {
285
- text-decoration: none;
286
  }
287
 
288
  .srm_gmap_video_area {
289
- width: 95%;
290
- float: left;
291
- margin-left: 2%;
292
- clear: both;
293
- text-align: center;
294
- padding-top: 35px;
295
  }
296
 
297
  .wp_gmap_contact_field {
298
- width: 100% !important;
299
- max-width: 100% !important;
300
- margin: 1px 0;
301
  }
302
 
303
  /*wp gmap premium notice*/
304
  .wpgmap_premium_notice_title {
305
- color: #0073aa;
306
- font-size: 2em;
307
- margin: .67em 0;
308
- display: block;
309
- font-weight: 600;
310
- text-align: center;
311
  }
312
 
313
  .wpgmap_premium_notice_button {
314
- background-color: #0073aa;
315
- color: white;
316
- padding: 15px;
317
- font-size: 20px;
318
- font-weight: bold;
319
- text-align: center;
320
- text-decoration: none;
321
- border-radius: 12px;
322
- box-shadow: 0 0 14px grey;
323
  }
324
 
325
  .wpgmap_pro_version_title {
326
- color: #0073aa;
327
- font-size: 2em;
328
- margin: .67em 0;
329
- display: block;
330
- font-weight: 600;
331
- padding-left: 55px;
332
  }
333
 
334
  .wpgmap_features_list {
335
- padding-left: 51px;
336
  }
337
 
338
 
339
  /*Custom CSS for Custom CSS and JS under settings */
340
  #wpgmap_custom_js, #wpgmap_custom_css {
341
- background: #2B323C;
342
- color: #fff !important;
343
- padding: 20px 25px;
344
- border-radius: 5px;
345
- max-width: 100%;
346
- min-height: 250px;
347
  }
348
 
349
  /* Settings Menu*/
350
  .wpgmapembed_get_api_key {
351
- padding: 10px;
352
  }
353
 
354
  .wpgmap_lng_custom_script_settings {
355
- padding: 10px;
356
  }
357
 
358
  .gmap_embed_create_new_link_area {
359
- width: 40%;
360
- margin: 30px auto;
361
  }
362
 
363
  .gmap_embed_create_new_link_area a {
364
- padding: 9px;
365
- margin-left: 100px;
366
- border-radius: 5px;
367
- background-color: #0073aa;
368
- color: white;
369
- text-decoration: none;
370
- font-weight: bold;
371
- font-size: 14px;
372
  }
373
 
374
  /*.notice-error, div.settings-error {*/
@@ -376,347 +376,347 @@ ul.wgm_wpgmap_tab {
376
  /*}*/
377
 
378
  #wgm_all_maps {
379
- padding: 5px;
380
  }
381
 
382
  /*for datatable*/
383
  #wgm_all_maps .dataTables_wrapper .dataTables_length select,
384
  #wp-gmap-new .dataTables_wrapper .dataTables_length select,
385
  #wp-gmap-edit .dataTables_wrapper .dataTables_length select {
386
- width: 50px !important;
387
- padding: 0 0 0 5px !important;
388
  }
389
 
390
  #wgm_all_maps .dataTables_wrapper .dataTables_filter input,
391
  #wp-gmap-new .dataTables_wrapper .dataTables_filter input,
392
  #wp-gmap-edit .dataTables_wrapper .dataTables_filter input {
393
- padding: 0 0 0 5px !important;
394
  }
395
 
396
  .wgm-pro-label {
397
- margin-left: 5px;
398
- margin-right: 5px;
399
- font-size: 10px;
400
- color: #ffffff;
401
- text-transform: uppercase;
402
- text-align: center;
403
- position: relative;
404
- top: -6px;
405
- line-height: 1;
406
- padding: 3px 6px;
407
- border-radius: 2px;
408
- background-image: -moz-linear-gradient(-122deg, rgb(91 211 160) 0%, rgb(54 214 146) 100%);
409
- background-image: -webkit-linear-gradient(
410
- -122deg, rgb(91 211 160) 0%, rgb(54 214 146) 100%);
411
  }
412
 
413
  /*Settings**/
414
  .wgm-settings-menu {
415
- border-left: 1px #e0dddd solid;
416
  }
417
 
418
  .wgm-settings-menu ul {
419
- margin: 0;
420
- padding: 0;
421
  }
422
 
423
  .wgm-settings-menu ul li {
424
- display: inline-block;
425
- margin-bottom: 0;
426
  }
427
 
428
  .wgm-settings-menu ul li.active a {
429
- background-color: #fff;
430
- border-top: 2px solid #17c9a2;
431
  }
432
 
433
  .wgm-settings-menu ul li a:focus {
434
- box-shadow: none;
435
  }
436
 
437
  .wgm-settings-menu ul li a, .wgm-settings-menu ul li span {
438
- padding: 15px 20px;
439
- background-color: #f8fafb;
440
- color: #516378;
441
- font-size: 14px;
442
- font-weight: 600;
443
- text-decoration: none;
444
- border-top: 2px solid #f8fafb;
445
- display: block;
446
  }
447
 
448
 
449
  /* Marker related*/
450
  .wgm_gmap_marker_list {
451
- width: 100%;
452
- border: 1px #f1f1f1 solid;
453
- background-color: #f3f3f3;
454
- float: left;
455
  }
456
 
457
  .wgm_gmap_marker_list th {
458
- text-align: left;
459
  }
460
 
461
  .wgm_gmap_markers {
462
- float: left;
463
- width: 100%;
464
  }
465
 
466
  .wgm_gmap_markers table {
467
- border: none;
468
- padding: 0;
469
  }
470
 
471
  .wgm_marker_cancel {
472
- background: #dc3545 !important;
473
- border-color: #dc3545 !important;
474
  }
475
 
476
  .wgm_marker_cancel:hover {
477
- background-color: #bb2d3b !important;
478
- border-color: #bb2d3b !important;
479
  }
480
 
481
  .add_new_marker_form input[type=text] {
482
- width: 100%;
483
  }
484
 
485
  /*==============gmap markers=================*/
486
  .wgm_gmap_embed_marker_icons {
487
- padding: 0 !important;
488
- margin: 0 !important;
489
  }
490
 
491
  .wgm_gmap_embed_marker_icons li {
492
- display: inline;
493
- padding: 2px;
494
- margin: 5px;
495
- border: 1px gray solid;
496
- width: 50px;
497
- height: 50px;
498
- float: left;
499
- text-align: center;
500
- cursor: pointer;
501
  }
502
 
503
  /** Common*/
504
 
505
 
506
  .wgm_marker_create_hints {
507
- height: 59px;
508
- background-color: white;
509
- width: 97%;
510
- box-shadow: 0 0 5px #d0d0d0;
511
- margin-top: 10px;
512
- padding: 5px 0 5px 5px;
513
- display: none;
514
  }
515
 
516
  .wgm_marker_create_hints ul {
517
- line-height: 10px;
518
- list-style: decimal;
519
- padding-left: 18px;
520
  }
521
 
522
  .wgm_marker_create_hints ul li b {
523
- font-style: italic;
524
- color: blue;
525
  }
526
 
527
  .wgm_admin_support_wrapper {
528
- width: 100%;
529
- display: flex;
530
- margin-top: 5px;
531
  }
532
 
533
  .wgm_admin_support_wrapper .wgm_admin_block {
534
- flex-basis: 100%;
535
- margin: 0 .2%;
536
- background-color: white;
537
- box-shadow: 0 0 5px #e8e8e8;
538
- border: 1px solid #ece8e8;
539
  }
540
 
541
  .wgm_admin_block_header {
542
- display: flex;
543
- align-content: center;
544
- align-items: center;
545
- padding: 10px 0 0 10px;
546
  }
547
 
548
  .wgm_admin_block_header_icon {
549
- height: 40px;
550
- width: 40px;
551
- background: #f3edff;
552
- padding: 10px;
553
- box-sizing: border-box;
554
- border-radius: 50%;
555
- text-align: center;
556
- color: #32c896;
557
- font-size: 18px;
558
  }
559
 
560
  .wgm_admin_title {
561
- margin: 0.7em 0 1em;
562
- padding: 0 0 0 5px;
563
- font-size: 18px;
564
- font-weight: 600;
565
- text-overflow: ellipsis;
566
- white-space: nowrap;
567
- color: #333333;
568
  }
569
 
570
  .wgm_admin_block_content {
571
- overflow: hidden;
572
- position: relative;
573
- padding: 0 15px 12px 15px;
574
  }
575
 
576
  .wgm_admin_block_content .wgm_button {
577
- font-size: 13px;
578
- border-radius: 3px;
579
- background-image: -webkit-linear-gradient(
580
- -169deg,
581
- rgb(104 204 176) 0%,
582
- rgb(28 204 139) 100%
583
- );
584
- background-image: -ms-linear-gradient(
585
- -169deg,
586
- rgb(104 204 176) 0%,
587
- rgb(28 204 139) 100%
588
- );
589
- -webkit-box-shadow: 0 14px 15px 0 rgba(0, 5, 41, 0.08);
590
- box-shadow: 0 14px 15px 0 rgba(0, 5, 41, 0.08);
591
- color: #fff;
592
- display: inline-block;
593
- padding: 8px 8px;
594
- text-decoration: none;
595
- line-height: 1;
596
- transition: all 0.3s;
597
  }
598
 
599
  .wgm_admin_support_wrapper p {
600
- font-size: 13px;
601
- color: #707070;
602
- margin: 0 0 20px 0;
603
- line-height: 21px;
604
  }
605
 
606
  .wgm_admin_block_content .wgm_gmap_instructions {
607
- padding: 0 0 12px 19px;
608
  }
609
 
610
  .wgm_admin_block_content .wgm_gmap_instructions ul li a {
611
- text-decoration: none;
612
  }
613
 
614
  .wgm_admin_block_content .wgm_gmap_instructions ul li a i, .wgm_faq_item i {
615
- margin-right: 8px;
616
  }
617
 
618
  .wgm_admin_block_content .wgm_gmap_instructions ul li {
619
- background-color: #e0e0e040;
620
- padding: 4px 0 4px 6px;
621
- border-left: 2px solid #5eccac;
622
- margin: 9px 0;
623
  }
624
 
625
  /*sweetalert2 customize*/
626
  .swal2-title {
627
- line-height: normal;
628
  }
629
 
630
  /*Button*/
631
  .button.wgm_btn {
632
- background-color: #24a97f;
633
- color: #fff;
634
- padding: 8px 12px;
635
- border: none;
636
- box-shadow: none;
637
- font-size: 14px;
638
- height: auto;
639
- text-transform: uppercase;
640
- text-shadow: none;
641
- letter-spacing: 0.05em;
642
- text-align: center;
643
  }
644
 
645
  .button.wgm_btn:hover,
646
  .button.wgm_btn:focus {
647
- background-color: #0c8a62 !important;
648
- color: #fff;
649
  }
650
 
651
  .wgm_save_btn_wrap {
652
- margin: 30px 0 20px;
653
  }
654
 
655
  .wgm_btn.wgm_license_btn {
656
- background-color: #0dc9c3;
657
  }
658
 
659
  .wgm_btn.wgm_license_btn:hover,
660
  .wgm_btn.wgm_license_btn:focus {
661
- background-color: #0c8a62 !important;
662
  }
663
 
664
  .wgm_btn.wgm_demo_btn,
665
  .wgm_btn.wgm_license_btn,
666
  .wgm_btn.wgm_review_btn {
667
- padding: 10px;
668
- display: block;
669
- max-width: 250px;
670
- margin-bottom: 15px;
671
- text-align: center;
672
- font-size: 13px;
673
  }
674
 
675
  .wgm_btn, .wgm_lng_custom_script_settings .button-primary {
676
- border-radius: 3px;
677
- background-image: -moz-linear-gradient(
678
- -169deg,
679
- #5b9dd9 0%,
680
- #007cba 100%
681
- );
682
- background-image: -webkit-linear-gradient(
683
- -169deg,
684
- #5b9dd9 0%,
685
- #007cba 100%
686
- );
687
- background-image: -ms-linear-gradient(
688
- -169deg,
689
- #5b9dd9 0%,
690
- #007cba 100%
691
- );
692
- width: 160px;
693
- height: 50px;
694
- transition: all 300ms ease-in-out;
695
  }
696
 
697
  .wgm_btn:hover,
698
  .wgm_btn:focus, .wgm_lng_custom_script_settings .button-primary:focus, .wgm_lng_custom_script_settings .button-primary:hover {
699
- background-color: #0c8a62 !important;
700
  }
701
 
702
  .wgm_mb_15 {
703
- margin-bottom: 15px;
704
  }
705
  .wgm-col-full {
706
- width: 100%;
707
- height: auto;
708
  }
709
  .col-half {
710
- flex-basis: 49%;
711
- height: auto;
712
- display: flex;
713
  }
714
  .col-one-third {
715
- width: 32%;
716
- height: auto;
717
  }
718
 
719
  .col-one-fourth {
720
- width: 25%;
721
- height: auto;
722
- }
2
  @import "wp-gmap-style-media-query.css";
3
  /*Header section*/
4
  .gmap_header_section {
5
+ width: 100%;
6
+ float: left;
7
  }
8
 
9
  .gmap_header_section_left {
10
+ width: 78%;
11
+ float: left;
12
  }
13
 
14
  .gmap_header_section_right {
15
+ max-width: 21%;
16
+ float: right;
17
+ padding-right: 1%;
18
  }
19
 
20
  .gmap_donate_button {
21
+ float: left;
22
+ margin-top: 5px;
23
  }
24
 
25
  .gmap_donate_button img {
26
+ height: 32px;
27
+ width: 93px;
28
  }
29
 
30
  .gmap_get_pro_version {
31
+ float: left;
32
+ padding: 2px 9px;
33
+ height: auto !important;
34
+ font-weight: bold;
35
+ margin: 5px 5px 0 0 !important;
36
+ color: #238b68 !important;;
37
  }
38
 
39
  /******* Nav Bar ********/
40
  ul#wp-gmap-nav {
41
+ list-style-type: none;
42
+ padding: 0;
43
+ margin: 0;
44
  }
45
 
46
  ul#wp-gmap-nav li {
47
+ display: inline-block;
48
+ background-color: #32c896;
49
+ border-bottom: solid 5px #238b68;
50
+ color: #fff;
51
+ cursor: pointer;
52
  }
53
 
54
  ul#wp-gmap-nav li:hover, ul#wp-gmap-nav .active {
55
+ background-color: #238b68;
56
  }
57
 
58
  ul#wp-gmap-nav li a {
59
+ color: white;
60
+ text-decoration: none;
61
+ display: block;
62
+ padding: 5px 8px;
63
+ font-weight: bold;
64
  }
65
 
66
  /******* Create/Update Map Tabs ******/
67
  #wp-gmap-tabs {
68
+ padding: 1%;
69
+ float: left;
70
+ width: 98%;
71
  }
72
 
73
  #wp-gmap-tabs .active {
74
+ display: block;
75
  }
76
 
77
  .wgm_wpgmap_tab {
78
+ width: 100%;
79
+ background-color: #ccc;
80
+ float: left;
81
+ height: 30px;
82
  }
83
 
84
  ul.wgm_wpgmap_tab {
85
+ padding: 0;
86
+ margin: 0;
87
+ height: 30px;
88
  }
89
 
90
  .wgm_wpgmap_tab li {
91
+ display: inline;
92
+ padding: 6px 6px;
93
+ float: left;
94
+ background-color: #ccc;
95
+ border-right: 1px white solid;
96
+ cursor: pointer;
97
  }
98
 
99
  .wgm_wpgmap_tab .active,.wgm_wpgmap_tab li:hover {
100
+ background-color: #24a97f;
101
+ color: white;
102
+ /*border-top: 2px solid #17c9a2;*/
103
  }
104
 
105
  .hidden {
106
+ display: none;
107
  }
108
 
109
  /******* For Google Map Rendering ******/
110
  .wp-gmap-preview .wgm_controls {
111
+ margin-top: 10px;
112
+ border: 1px solid transparent;
113
+ border-radius: 2px 0 0 2px;
114
+ box-sizing: border-box;
115
+ -moz-box-sizing: border-box;
116
+ height: 39px;
117
+ outline: none;
118
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
119
  }
120
 
121
  .wp-gmap-preview #wgm_pac_input {
122
+ background-color: #fff;
123
+ font-family: Roboto;
124
+ font-size: 15px;
125
+ font-weight: 300;
126
+ margin-left: 12px;
127
+ padding: 0 11px 0 13px;
128
+ text-overflow: ellipsis;
129
+ width: 400px;
130
  }
131
 
132
  .wp-gmap-preview #wgm_pac_input:focus {
133
+ border-color: #4d90fe;
134
  }
135
 
136
  .pac-container {
137
+ font-family: Roboto;
138
+ z-index: 99999;
139
  }
140
 
141
  #type-selector {
142
+ color: #fff;
143
+ background-color: #4d90fe;
144
+ padding: 5px 11px 0 11px;
145
  }
146
 
147
  #type-selector label {
148
+ font-family: Roboto;
149
+ font-size: 13px;
150
+ font-weight: 300;
151
  }
152
 
153
  #target {
154
+ width: 345px;
155
  }
156
 
157
  /******* Google Map Settings ******/
158
  #gmap_container_inner {
159
+ background-color: white;
160
+ float: left;
161
+ width: 100%;
162
+ border: 1px #e0dddd solid;
163
+ margin-top: 5px;
164
  }
165
 
166
  .popup-content {
167
+ position: relative;
168
+ width: 60%;
169
  }
170
 
171
  /******* Map List ******/
172
  .wp-gmap-list {
173
+ padding: 1%;
174
+ float: left;
175
+ width: 97%;
176
  }
177
 
178
  .wp-gmap-single {
179
+ padding: .2% 1%;
180
+ float: left;
181
+ width: 97%;
182
+ border: 1px #ccc solid;
183
+ margin: 7px 0;
184
+ background-color: #f3f3f3;
185
  }
186
 
187
  .wp-gmap-single-left {
188
+ width: 80%;
189
+ float: left;
190
  }
191
 
192
  .wp-gmap-single-title {
193
+ font-size: 18px;
194
+ font-weight: 600;
195
+ padding: 5px 0;
196
  }
197
 
198
  .wp-gmap-single-action {
199
+ width: 20%;
200
+ padding: 13px 0;
201
+ float: left;
202
+ text-align: right;
203
  }
204
 
205
  /******* Map Properties ******/
206
  .wp-gmap-properties-outer {
207
+ width: 49%;
208
+ float: left;
209
+ /*border: 1px #ccc solid;*/
210
 
211
  }
212
 
213
  .wp-gmap-properties, .wp-gmap-other-properties {
214
+ width: 100%;
215
+ background-color: white;
216
+ float: left;
217
  }
218
 
219
  .gmap_properties {
220
+ width: 100%;
221
+ padding: 1%;
222
  }
223
 
224
  .gmap_properties tr {
225
+ height: 50px;
226
  }
227
 
228
  .gmap_properties tr .regular-text {
229
+ width: 99%;
230
+ max-width: 99%;
231
  }
232
 
233
  /******* Preview Map ******/
234
  .wp-gmap-preview {
235
+ width: 50%;
236
+ background-color: #f3f3f3;
237
+ margin-left: 1%;
238
+ float: left;
239
  }
240
 
241
  /**********Contact form ***********/
242
  .srm_gmap_contact_area {
243
+ width: 50%;
244
+ float: left;
245
+ padding: 10px;
246
  }
247
 
248
  .srm_gmap_instructions_outer_area {
249
+ width: 50%;
250
+ /*float: left;*/
251
+ /*margin-left: 2%;*/
252
+ padding: 10px;
253
+ margin: 0 auto;
254
  }
255
 
256
  .srm_gmap_instructions {
257
+ width: 42%;
258
+ float: left;
259
+ margin-left: 2%;
260
+ padding: 10px;
261
  }
262
 
263
  .srm_gmap_instructions ul {
264
+ padding: 0;
265
+ margin: 0;
266
  }
267
 
268
  .srm_gmap_instructions ul li {
269
+ background-color: #f0f0f0;
270
+ padding: 6px;
271
+ border: 1px solid #e0e0e0;
272
+ margin: 5px 0;
273
  }
274
 
275
  .srm_gmap_instructions ul li:before {
276
+ content: '> ';
277
+ font-weight: bold;
278
  }
279
 
280
  .srm_gmap_instructions ul li:hover {
282
  }
283
 
284
  .srm_gmap_instructions ul li a {
285
+ text-decoration: none;
286
  }
287
 
288
  .srm_gmap_video_area {
289
+ width: 95%;
290
+ float: left;
291
+ margin-left: 2%;
292
+ clear: both;
293
+ text-align: center;
294
+ padding-top: 35px;
295
  }
296
 
297
  .wp_gmap_contact_field {
298
+ width: 100% !important;
299
+ max-width: 100% !important;
300
+ margin: 1px 0;
301
  }
302
 
303
  /*wp gmap premium notice*/
304
  .wpgmap_premium_notice_title {
305
+ color: #0073aa;
306
+ font-size: 2em;
307
+ margin: .67em 0;
308
+ display: block;
309
+ font-weight: 600;
310
+ text-align: center;
311
  }
312
 
313
  .wpgmap_premium_notice_button {
314
+ background-color: #0073aa;
315
+ color: white;
316
+ padding: 15px;
317
+ font-size: 20px;
318
+ font-weight: bold;
319
+ text-align: center;
320
+ text-decoration: none;
321
+ border-radius: 12px;
322
+ box-shadow: 0 0 14px grey;
323
  }
324
 
325
  .wpgmap_pro_version_title {
326
+ color: #0073aa;
327
+ font-size: 2em;
328
+ margin: .67em 0;
329
+ display: block;
330
+ font-weight: 600;
331
+ padding-left: 55px;
332
  }
333
 
334
  .wpgmap_features_list {
335
+ padding-left: 51px;
336
  }
337
 
338
 
339
  /*Custom CSS for Custom CSS and JS under settings */
340
  #wpgmap_custom_js, #wpgmap_custom_css {
341
+ background: #2B323C;
342
+ color: #fff !important;
343
+ padding: 20px 25px;
344
+ border-radius: 5px;
345
+ max-width: 100%;
346
+ min-height: 250px;
347
  }
348
 
349
  /* Settings Menu*/
350
  .wpgmapembed_get_api_key {
351
+ padding: 10px;
352
  }
353
 
354
  .wpgmap_lng_custom_script_settings {
355
+ padding: 10px;
356
  }
357
 
358
  .gmap_embed_create_new_link_area {
359
+ width: 40%;
360
+ margin: 30px auto;
361
  }
362
 
363
  .gmap_embed_create_new_link_area a {
364
+ padding: 9px;
365
+ margin-left: 100px;
366
+ border-radius: 5px;
367
+ background-color: #0073aa;
368
+ color: white;
369
+ text-decoration: none;
370
+ font-weight: bold;
371
+ font-size: 14px;
372
  }
373
 
374
  /*.notice-error, div.settings-error {*/
376
  /*}*/
377
 
378
  #wgm_all_maps {
379
+ padding: 5px;
380
  }
381
 
382
  /*for datatable*/
383
  #wgm_all_maps .dataTables_wrapper .dataTables_length select,
384
  #wp-gmap-new .dataTables_wrapper .dataTables_length select,
385
  #wp-gmap-edit .dataTables_wrapper .dataTables_length select {
386
+ width: 50px !important;
387
+ padding: 0 0 0 5px !important;
388
  }
389
 
390
  #wgm_all_maps .dataTables_wrapper .dataTables_filter input,
391
  #wp-gmap-new .dataTables_wrapper .dataTables_filter input,
392
  #wp-gmap-edit .dataTables_wrapper .dataTables_filter input {
393
+ padding: 0 0 0 5px !important;
394
  }
395
 
396
  .wgm-pro-label {
397
+ margin-left: 5px;
398
+ margin-right: 5px;
399
+ font-size: 10px;
400
+ color: #ffffff;
401
+ text-transform: uppercase;
402
+ text-align: center;
403
+ position: relative;
404
+ top: -6px;
405
+ line-height: 1;
406
+ padding: 3px 6px;
407
+ border-radius: 2px;
408
+ background-image: -moz-linear-gradient(-122deg, rgb(91 211 160) 0%, rgb(54 214 146) 100%);
409
+ background-image: -webkit-linear-gradient(
410
+ -122deg, rgb(91 211 160) 0%, rgb(54 214 146) 100%);
411
  }
412
 
413
  /*Settings**/
414
  .wgm-settings-menu {
415
+ border-left: 1px #e0dddd solid;
416
  }
417
 
418
  .wgm-settings-menu ul {
419
+ margin: 0;
420
+ padding: 0;
421
  }
422
 
423
  .wgm-settings-menu ul li {
424
+ display: inline-block;
425
+ margin-bottom: 0;
426
  }
427
 
428
  .wgm-settings-menu ul li.active a {
429
+ background-color: #fff;
430
+ border-top: 2px solid #17c9a2;
431
  }
432
 
433
  .wgm-settings-menu ul li a:focus {
434
+ box-shadow: none;
435
  }
436
 
437
  .wgm-settings-menu ul li a, .wgm-settings-menu ul li span {
438
+ padding: 15px 20px;
439
+ background-color: #f8fafb;
440
+ color: #516378;
441
+ font-size: 14px;
442
+ font-weight: 600;
443
+ text-decoration: none;
444
+ border-top: 2px solid #f8fafb;
445
+ display: block;
446
  }
447
 
448
 
449
  /* Marker related*/
450
  .wgm_gmap_marker_list {
451
+ width: 100%;
452
+ border: 1px #f1f1f1 solid;
453
+ background-color: #f3f3f3;
454
+ float: left;
455
  }
456
 
457
  .wgm_gmap_marker_list th {
458
+ text-align: left;
459
  }
460
 
461
  .wgm_gmap_markers {
462
+ float: left;
463
+ width: 100%;
464
  }
465
 
466
  .wgm_gmap_markers table {
467
+ border: none;
468
+ padding: 0;
469
  }
470
 
471
  .wgm_marker_cancel {
472
+ background: #dc3545 !important;
473
+ border-color: #dc3545 !important;
474
  }
475
 
476
  .wgm_marker_cancel:hover {
477
+ background-color: #bb2d3b !important;
478
+ border-color: #bb2d3b !important;
479
  }
480
 
481
  .add_new_marker_form input[type=text] {
482
+ width: 100%;
483
  }
484
 
485
  /*==============gmap markers=================*/
486
  .wgm_gmap_embed_marker_icons {
487
+ padding: 0 !important;
488
+ margin: 0 !important;
489
  }
490
 
491
  .wgm_gmap_embed_marker_icons li {
492
+ display: inline;
493
+ padding: 2px;
494
+ margin: 5px;
495
+ border: 1px gray solid;
496
+ width: 50px;
497
+ height: 50px;
498
+ float: left;
499
+ text-align: center;
500
+ cursor: pointer;
501
  }
502
 
503
  /** Common*/
504
 
505
 
506
  .wgm_marker_create_hints {
507
+ height: 59px;
508
+ background-color: white;
509
+ width: 97%;
510
+ box-shadow: 0 0 5px #d0d0d0;
511
+ margin-top: 10px;
512
+ padding: 5px 0 5px 5px;
513
+ display: none;
514
  }
515
 
516
  .wgm_marker_create_hints ul {
517
+ line-height: 10px;
518
+ list-style: decimal;
519
+ padding-left: 18px;
520
  }
521
 
522
  .wgm_marker_create_hints ul li b {
523
+ font-style: italic;
524
+ color: blue;
525
  }
526
 
527
  .wgm_admin_support_wrapper {
528
+ width: 100%;
529
+ display: flex;
530
+ margin-top: 5px;
531
  }
532
 
533
  .wgm_admin_support_wrapper .wgm_admin_block {
534
+ flex-basis: 100%;
535
+ margin: 0 .2%;
536
+ background-color: white;
537
+ box-shadow: 0 0 5px #e8e8e8;
538
+ border: 1px solid #ece8e8;
539
  }
540
 
541
  .wgm_admin_block_header {
542
+ display: flex;
543
+ align-content: center;
544
+ align-items: center;
545
+ padding: 10px 0 0 10px;
546
  }
547
 
548
  .wgm_admin_block_header_icon {
549
+ height: 40px;
550
+ width: 40px;
551
+ background: #f3edff;
552
+ padding: 10px;
553
+ box-sizing: border-box;
554
+ border-radius: 50%;
555
+ text-align: center;
556
+ color: #32c896;
557
+ font-size: 18px;
558
  }
559
 
560
  .wgm_admin_title {
561
+ margin: 0.7em 0 1em;
562
+ padding: 0 0 0 5px;
563
+ font-size: 18px;
564
+ font-weight: 600;
565
+ text-overflow: ellipsis;
566
+ white-space: nowrap;
567
+ color: #333333;
568
  }
569
 
570
  .wgm_admin_block_content {
571
+ overflow: hidden;
572
+ position: relative;
573
+ padding: 0 15px 12px 15px;
574
  }
575
 
576
  .wgm_admin_block_content .wgm_button {
577
+ font-size: 13px;
578
+ border-radius: 3px;
579
+ background-image: -webkit-linear-gradient(
580
+ -169deg,
581
+ rgb(104 204 176) 0%,
582
+ rgb(28 204 139) 100%
583
+ );
584
+ background-image: -ms-linear-gradient(
585
+ -169deg,
586
+ rgb(104 204 176) 0%,
587
+ rgb(28 204 139) 100%
588
+ );
589
+ -webkit-box-shadow: 0 14px 15px 0 rgba(0, 5, 41, 0.08);
590
+ box-shadow: 0 14px 15px 0 rgba(0, 5, 41, 0.08);
591
+ color: #fff;
592
+ display: inline-block;
593
+ padding: 8px 8px;
594
+ text-decoration: none;
595
+ line-height: 1;
596
+ transition: all 0.3s;
597
  }
598
 
599
  .wgm_admin_support_wrapper p {
600
+ font-size: 13px;
601
+ color: #707070;
602
+ margin: 0 0 20px 0;
603
+ line-height: 21px;
604
  }
605
 
606
  .wgm_admin_block_content .wgm_gmap_instructions {
607
+ padding: 0 0 12px 19px;
608
  }
609
 
610
  .wgm_admin_block_content .wgm_gmap_instructions ul li a {
611
+ text-decoration: none;
612
  }
613
 
614
  .wgm_admin_block_content .wgm_gmap_instructions ul li a i, .wgm_faq_item i {
615
+ margin-right: 8px;
616
  }
617
 
618
  .wgm_admin_block_content .wgm_gmap_instructions ul li {
619
+ background-color: #e0e0e040;
620
+ padding: 4px 0 4px 6px;
621
+ border-left: 2px solid #5eccac;
622
+ margin: 9px 0;
623
  }
624
 
625
  /*sweetalert2 customize*/
626
  .swal2-title {
627
+ line-height: normal;
628
  }
629
 
630
  /*Button*/
631
  .button.wgm_btn {
632
+ background-color: #24a97f;
633
+ color: #fff;
634
+ padding: 8px 12px;
635
+ border: none;
636
+ box-shadow: none;
637
+ font-size: 14px;
638
+ height: auto;
639
+ text-transform: uppercase;
640
+ text-shadow: none;
641
+ letter-spacing: 0.05em;
642
+ text-align: center;
643
  }
644
 
645
  .button.wgm_btn:hover,
646
  .button.wgm_btn:focus {
647
+ background-color: #0c8a62 !important;
648
+ color: #fff;
649
  }
650
 
651
  .wgm_save_btn_wrap {
652
+ margin: 30px 0 20px;
653
  }
654
 
655
  .wgm_btn.wgm_license_btn {
656
+ background-color: #0dc9c3;
657
  }
658
 
659
  .wgm_btn.wgm_license_btn:hover,
660
  .wgm_btn.wgm_license_btn:focus {
661
+ background-color: #0c8a62 !important;
662
  }
663
 
664
  .wgm_btn.wgm_demo_btn,
665
  .wgm_btn.wgm_license_btn,
666
  .wgm_btn.wgm_review_btn {
667
+ padding: 10px;
668
+ display: block;
669
+ max-width: 250px;
670
+ margin-bottom: 15px;
671
+ text-align: center;
672
+ font-size: 13px;
673
  }
674
 
675
  .wgm_btn, .wgm_lng_custom_script_settings .button-primary {
676
+ border-radius: 3px;
677
+ background-image: -moz-linear-gradient(
678
+ -169deg,
679
+ #5b9dd9 0%,
680
+ #007cba 100%
681
+ );
682
+ background-image: -webkit-linear-gradient(
683
+ -169deg,
684
+ #5b9dd9 0%,
685
+ #007cba 100%
686
+ );
687
+ background-image: -ms-linear-gradient(
688
+ -169deg,
689
+ #5b9dd9 0%,
690
+ #007cba 100%
691
+ );
692
+ width: 160px;
693
+ height: 50px;
694
+ transition: all 300ms ease-in-out;
695
  }
696
 
697
  .wgm_btn:hover,
698
  .wgm_btn:focus, .wgm_lng_custom_script_settings .button-primary:focus, .wgm_lng_custom_script_settings .button-primary:hover {
699
+ background-color: #0c8a62 !important;
700
  }
701
 
702
  .wgm_mb_15 {
703
+ margin-bottom: 15px;
704
  }
705
  .wgm-col-full {
706
+ width: 100%;
707
+ height: auto;
708
  }
709
  .col-half {
710
+ flex-basis: 49%;
711
+ height: auto;
712
+ display: flex;
713
  }
714
  .col-one-third {
715
+ width: 32%;
716
+ height: auto;
717
  }
718
 
719
  .col-one-fourth {
720
+ width: 25%;
721
+ height: auto;
722
+ }
admin/assets/js/common.js CHANGED
@@ -1,214 +1,252 @@
1
  (function ($) {
2
- $(document).ready(function () {
3
- "use strict";
 
4
 
5
- /** Constraints */
6
 
7
- /** Common Functions */
8
- function isGuttenbergActive() {
9
- return document.body.classList.contains('block-editor-page');
10
- }
11
-
12
- /** Classic Editor Google Map Select Popup box */
13
- if (!isGuttenbergActive()) {
14
- // To load Maps List
15
- function loadSrmGmapsList() {
16
- $("#wgm_all_maps").find(".spinner").addClass('is-active');
17
- $("#wpgmapembed_list").html('');
18
- var data = {
19
- 'action': 'wpgmapembed_popup_load_map_data',
20
- 'data': {
21
- c_s_nonce:wgm_l.c_s_nonce
22
- }
23
- };
24
- jQuery.post(ajaxurl, data, function (response) {
25
- $("#wgm_all_maps").find(".spinner").removeClass('is-active');
26
- $("#wpgmapembed_list").html(response);
27
- });
28
- }
29
-
30
- // Loading Map/List on window load
31
- $(window).on("load", loadSrmGmapsList);
32
-
33
- // Removing Popup Box
34
- function removeSrmGmapPopup() {
35
- self.parent.tb_remove();
36
  }
37
 
38
- // Inserting ShortCode From List on click insert button
39
- $(document.body).on('click', ".wpgmap-insert-shortcode", function () {
40
-
41
- var shortcode = $(this).parent().parent().find('.wpgmap-shortcode').val();
42
- if (!tinyMCE.activeEditor || tinyMCE.activeEditor.isHidden()) {
43
- $('textarea#content').val(shortcode);
44
- } else {
45
- tinyMCE.execCommand('mceInsertContent', false, shortcode);
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
- removeSrmGmapPopup();
48
- });
49
 
50
- // On Click fire removing Popup Box(removeSrmGmapPopup)
51
- $(document.body).on('click', '.wp_gmap_close_btn', removeSrmGmapPopup);
52
 
53
- //On Escape fire removing Popup Box(removeSrmGmapPopup)
54
- $(document).keyup(function (e) {
55
- if (e.which === 27) {
56
- removeSrmGmapPopup();
57
  }
58
- });
59
- }
60
 
 
 
 
 
 
61
 
62
- /** Map related functions/event listeners */
 
 
 
 
 
 
 
 
63
 
64
- //******* Remove Single Map *******
65
- $(document.body).on('click', ".wgm_wpgmap_delete", function () {
66
- if (!confirm("Are you sure to Delete")) {
67
- return false;
68
- }
69
- $("#wp-gmap-nav").find('.spinner').addClass('is-active');
70
- var btn_class = $(this);
71
- btn_class.prop('disabled', true);
72
- var post_id = $(this).data('id');
73
- var data = {
74
- 'action': 'wpgmapembed_remove_wpgmap',
75
- 'post_id': post_id,
76
- c_s_nonce:wgm_l.c_s_nonce
77
- };
78
-
79
- jQuery.post(ajaxurl, data, function (response) {
80
- response = JSON.parse(response);
81
- if (response.responseCode === 1) {
82
- btn_class.prop('disabled', false);
83
- window.location.reload();
84
- } else {
85
- alert("Something went wrong, could not delete, please try again.");
86
- }
87
- });
88
- });
89
-
90
- //************** Save, Update and Insert Button
91
- $(document.body).on('click', "#wp-gmap-embed-save,#wp-gmap-embed-update", function () {
92
-
93
- $('body .wpgmap_msg_error').html('');
94
- $(this).prop('disabled', true);
95
- var btn_id, parent, wpgmap_show_heading = 0, wpgmap_show_infowindow = 0, wpgmap_disable_zoom_scroll = 0,
96
- wpgmap_enable_direction = 0;
97
- $(this).parent().find(".spinner").addClass('is-active');
98
-
99
- btn_id = $(this).attr('id');
100
- if (btn_id === 'wp-gmap-embed-save') {
101
- parent = $("body #wp-gmap-new");
102
- } else if (btn_id === 'wp-gmap-embed-update') {
103
- parent = $("body #wp-gmap-edit");
104
- }
105
 
106
- // getting checkbox values
107
- if (parent.find("#wpgmap_show_heading").is(':checked') === true) {
108
- wpgmap_show_heading = 1;
 
 
 
 
 
109
  }
110
 
111
- if (parent.find("#wpgmap_show_infowindow").is(':checked') === true) {
112
- wpgmap_show_infowindow = 1;
113
- }
114
- if (parent.find("#wpgmap_disable_zoom_scroll").is(':checked') === true) {
115
- wpgmap_disable_zoom_scroll = 1;
116
- }
117
 
118
- if (parent.find("#wpgmap_enable_direction").is(':checked') === true) {
119
- wpgmap_enable_direction = 1;
120
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
 
122
- var wpgmap_title = parent.find("#wpgmap_title").val();
123
- var wpgmap_heading_class = parent.find("#wpgmap_heading_class").val();
124
- var wpgmap_latlng = parent.find("#wpgmap_latlng").val();
125
- var wpgmap_map_zoom = parent.find("#wpgmap_map_zoom").val();
126
- var wpgmap_map_width = parent.find("#wpgmap_map_width").val();
127
- var wpgmap_map_height = parent.find("#wpgmap_map_height").val();
128
- var wpgmap_map_type = parent.find("#wpgmap_map_type").val();
129
- var wpgmap_center_lat_lng = parent.find("#wpgmap_center_lat_lng").val();
130
-
131
- var map_data = {
132
- wpgmap_title: wpgmap_title,
133
- wpgmap_heading_class: wpgmap_heading_class,
134
- wpgmap_show_heading: wpgmap_show_heading,
135
- wpgmap_latlng: wpgmap_latlng,
136
- wpgmap_map_zoom: wpgmap_map_zoom,
137
- wpgmap_disable_zoom_scroll: wpgmap_disable_zoom_scroll,
138
- wpgmap_map_width: wpgmap_map_width,
139
- wpgmap_map_height: wpgmap_map_height,
140
- wpgmap_map_type: wpgmap_map_type,
141
- wpgmap_show_infowindow: wpgmap_show_infowindow,
142
- wpgmap_enable_direction: wpgmap_enable_direction,
143
- wpgmap_center_lat_lng: wpgmap_center_lat_lng
144
- };
145
-
146
- if (btn_id === 'wp-gmap-embed-save') {
147
- map_data.action_type = 'save';
148
- } else if (btn_id === 'wp-gmap-embed-update') {
149
- map_data.action_type = 'update';
150
- map_data.post_id = parent.find("#wpgmap_map_id").val();
151
- }
152
 
153
- var data = {
154
- 'action': 'wpgmapembed_save_map_data',
155
- 'map_data': map_data,
156
- c_s_nonce:wgm_l.c_s_nonce
157
- };
158
-
159
-
160
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
161
- jQuery.post(ajaxurl, data, function (response) {
162
- $("#" + btn_id).parent().find(".spinner").removeClass('is-active');
163
- response = JSON.parse(response);
164
-
165
- // In case of any exception
166
- if (response.responseCode === 0) {
167
- $("#" + btn_id).prop('disabled', false);
168
- parent.find('.wpgmap_msg_error').html('<div class="error bellow-h2 notice notice-error is-dismissible"><p>' + response.message + '</p></div>');
169
- } else {
170
-
171
- // In case of successful state
172
- if (btn_id === 'wp-gmap-embed-save' || btn_id === 'wp-gmap-embed-update') {
173
- $("#" + btn_id).prop('disabled', false);
174
- if (btn_id === 'wp-gmap-embed-save') {
175
- window.location.href = '?page=wpgmapembed&tag=edit&id=' + response.post_id + '&message=1';
176
- } else {
177
- $('body .wpgmap_msg_error').html('<div class="success bellow-h2 notice notice-success is-dismissible"><p>' + response.message + '</p></div>');
178
- }
179
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
181
- });
182
- });
183
-
184
-
185
- /**
186
- * To view premium notice
187
- * @since 1.7.5
188
- */
189
- $(document.body).find(".wgm_enable_premium").on('click', function () {
190
- var wgm_notice_text = $(this).attr('data-notice');
191
- Swal.fire({
192
- icon: 'info',
193
- showCloseButton: true,
194
- title: wgm_l.locales.sweet_alert.oops,
195
- html: wgm_notice_text+'<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="'+wgm_l.get_p_v_url+'">Upgrade to Pro</a>',
196
- confirmButtonText: 'Close',
197
- });
198
- });
199
-
200
- /**
201
- * Settings tab active/inactive and rendaring
202
- * @since 1.7.5
203
- */
204
- $(document.body).find(".wgm-settings-menu li").on('click', function (e) {
205
- e.preventDefault();
206
- $(this).siblings().removeClass('active');
207
- $(this).addClass('active');
208
- var wgm_tab_id = $(this).attr('data-tab');
209
- $('.wgm_settings_tabs').hide();
210
- $("#" + wgm_tab_id).show();
211
- });
212
- });
 
 
 
 
 
 
 
 
 
213
 
214
  })(jQuery);
1
  (function ($) {
2
+ $(document).ready(
3
+ function () {
4
+ "use strict";
5
 
6
+ /** Constraints */
7
 
8
+ /** Common Functions */
9
+ function isGuttenbergActive() {
10
+ return document.body.classList.contains('block-editor-page');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
+ /** Classic Editor Google Map Select Popup box */
14
+ if (!isGuttenbergActive()) {
15
+ // To load Maps List
16
+ function loadSrmGmapsList() {
17
+ $("#wgm_all_maps").find(".spinner").addClass('is-active');
18
+ $("#wpgmapembed_list").html('');
19
+ var data = {
20
+ 'action': 'wpgmapembed_popup_load_map_data',
21
+ 'data': {
22
+ c_s_nonce: wgm_l.c_s_nonce
23
+ }
24
+ };
25
+ jQuery.post(
26
+ ajaxurl,
27
+ data,
28
+ function (response) {
29
+ $("#wgm_all_maps").find(".spinner").removeClass('is-active');
30
+ $("#wpgmapembed_list").html(response);
31
+ }
32
+ );
33
  }
 
 
34
 
35
+ // Loading Map/List on window load
36
+ $(window).on("load", loadSrmGmapsList);
37
 
38
+ // Removing Popup Box
39
+ function removeSrmGmapPopup() {
40
+ self.parent.tb_remove();
 
41
  }
 
 
42
 
43
+ // Inserting ShortCode From List on click insert button
44
+ $(document.body).on(
45
+ 'click',
46
+ ".wpgmap-insert-shortcode",
47
+ function () {
48
 
49
+ var shortcode = $(this).parent().parent().find('.wpgmap-shortcode').val();
50
+ if (!tinyMCE.activeEditor || tinyMCE.activeEditor.isHidden()) {
51
+ $('textarea#content').val(shortcode);
52
+ } else {
53
+ tinyMCE.execCommand('mceInsertContent', false, shortcode);
54
+ }
55
+ removeSrmGmapPopup();
56
+ }
57
+ );
58
 
59
+ // On Click fire removing Popup Box(removeSrmGmapPopup)
60
+ $(document.body).on('click', '.wp_gmap_close_btn', removeSrmGmapPopup);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
+ // On Escape fire removing Popup Box(removeSrmGmapPopup)
63
+ $(document).keyup(
64
+ function (e) {
65
+ if (e.which === 27) {
66
+ removeSrmGmapPopup();
67
+ }
68
+ }
69
+ );
70
  }
71
 
72
+ /** Map related functions/event listeners */
 
 
 
 
 
73
 
74
+ // ******* Remove Single Map *******
75
+ $(document.body).on(
76
+ 'click',
77
+ ".wgm_wpgmap_delete",
78
+ function () {
79
+ if (!confirm("Are you sure to Delete")) {
80
+ return false;
81
+ }
82
+ $("#wp-gmap-nav").find('.spinner').addClass('is-active');
83
+ var btn_class = $(this);
84
+ btn_class.prop('disabled', true);
85
+ var post_id = $(this).data('id');
86
+ var data = {
87
+ 'action': 'wpgmapembed_remove_wpgmap',
88
+ 'post_id': post_id,
89
+ c_s_nonce: wgm_l.c_s_nonce
90
+ };
91
+
92
+ jQuery.post(
93
+ ajaxurl,
94
+ data,
95
+ function (response) {
96
+ response = JSON.parse(response);
97
+ if (response.responseCode === 1) {
98
+ btn_class.prop('disabled', false);
99
+ window.location.reload();
100
+ } else {
101
+ alert("Something went wrong, could not delete, please try again.");
102
+ }
103
+ }
104
+ );
105
+ }
106
+ );
107
+
108
+ // ************** Save, Update and Insert Button
109
+ $(document.body).on(
110
+ 'click',
111
+ "#wp-gmap-embed-save,#wp-gmap-embed-update",
112
+ function () {
113
+
114
+ $('body .wpgmap_msg_error').html('');
115
+ $(this).prop('disabled', true);
116
+ var btn_id, parent, wpgmap_show_heading = 0, wpgmap_show_infowindow = 0,
117
+ wpgmap_disable_zoom_scroll = 0,
118
+ wpgmap_enable_direction = 0;
119
+ $(this).parent().find(".spinner").addClass('is-active');
120
+
121
+ btn_id = $(this).attr('id');
122
+ if (btn_id === 'wp-gmap-embed-save') {
123
+ parent = $("body #wp-gmap-new");
124
+ } else if (btn_id === 'wp-gmap-embed-update') {
125
+ parent = $("body #wp-gmap-edit");
126
+ }
127
 
128
+ // getting checkbox values
129
+ if (parent.find("#wpgmap_show_heading").is(':checked') === true) {
130
+ wpgmap_show_heading = 1;
131
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
+ if (parent.find("#wpgmap_show_infowindow").is(':checked') === true) {
134
+ wpgmap_show_infowindow = 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
+ if (parent.find("#wpgmap_disable_zoom_scroll").is(':checked') === true) {
137
+ wpgmap_disable_zoom_scroll = 1;
138
+ }
139
+
140
+ if (parent.find( "#wpgmap_enable_direction" ).is( ':checked' ) === true) {
141
+ wpgmap_enable_direction = 1;
142
+ }
143
+
144
+ var wpgmap_title = parent.find("#wpgmap_title").val();
145
+ var wpgmap_heading_class = parent.find("#wpgmap_heading_class").val();
146
+ var wpgmap_latlng = parent.find("#wpgmap_latlng").val();
147
+ var wpgmap_map_zoom = parent.find("#wpgmap_map_zoom").val();
148
+ var wpgmap_map_width = parent.find("#wpgmap_map_width").val();
149
+ var wpgmap_map_height = parent.find("#wpgmap_map_height").val();
150
+ var wpgmap_map_type = parent.find("#wpgmap_map_type").val();
151
+ var wpgmap_center_lat_lng = parent.find("#wpgmap_center_lat_lng").val();
152
+ var wgm_theme_json = parent.find("#wgm_theme_json").val();
153
+
154
+ var map_data = {
155
+ wpgmap_title: wpgmap_title,
156
+ wpgmap_heading_class: wpgmap_heading_class,
157
+ wpgmap_show_heading: wpgmap_show_heading,
158
+ wpgmap_latlng: wpgmap_latlng,
159
+ wpgmap_map_zoom: wpgmap_map_zoom,
160
+ wpgmap_disable_zoom_scroll: wpgmap_disable_zoom_scroll,
161
+ wpgmap_map_width: wpgmap_map_width,
162
+ wpgmap_map_height: wpgmap_map_height,
163
+ wpgmap_map_type: wpgmap_map_type,
164
+ wpgmap_show_infowindow: wpgmap_show_infowindow,
165
+ wpgmap_enable_direction: wpgmap_enable_direction,
166
+ wpgmap_center_lat_lng: wpgmap_center_lat_lng,
167
+ wgm_theme_json: wgm_theme_json
168
+ };
169
+
170
+ if (btn_id === 'wp-gmap-embed-save') {
171
+ map_data.action_type = 'save';
172
+ } else if (btn_id === 'wp-gmap-embed-update') {
173
+ map_data.action_type = 'update';
174
+ map_data.post_id = parent.find("#wpgmap_map_id").val();
175
+ }
176
+
177
+ var data = {
178
+ 'action': 'wpgmapembed_save_map_data',
179
+ 'map_data': map_data,
180
+ c_s_nonce: wgm_l.c_s_nonce
181
+ };
182
+
183
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
184
+ jQuery.post(
185
+ ajaxurl,
186
+ data,
187
+ function (response) {
188
+ $("#" + btn_id).parent().find(".spinner").removeClass('is-active');
189
+ response = JSON.parse(response);
190
+
191
+ // In case of any exception
192
+ if (response.responseCode === 0) {
193
+ $("#" + btn_id).prop('disabled', false);
194
+ parent.find('.wpgmap_msg_error').html('<div class="error bellow-h2 notice notice-error is-dismissible"><p>' + response.message + '</p></div>');
195
+ } else {
196
+
197
+ // In case of successful state
198
+ if (btn_id === 'wp-gmap-embed-save' || btn_id === 'wp-gmap-embed-update') {
199
+ $("#" + btn_id).prop('disabled', false);
200
+ if (btn_id === 'wp-gmap-embed-save') {
201
+ window.location.href = '?page=wpgmapembed&tag=edit&id=' + response.post_id + '&message=1';
202
+ } else {
203
+ $('body .wpgmap_msg_error').html('<div class="success bellow-h2 notice notice-success is-dismissible"><p>' + response.message + '</p></div>');
204
+ }
205
+ }
206
+ }
207
+ }
208
+ );
209
  }
210
+ );
211
+
212
+ /**
213
+ * To view premium notice
214
+ *
215
+ * @since 1.7.5
216
+ */
217
+ $(document.body).find(".wgm_enable_premium").on(
218
+ 'click',
219
+ function () {
220
+ var wgm_notice_text = $(this).attr('data-notice');
221
+ Swal.fire(
222
+ {
223
+ icon: 'info',
224
+ showCloseButton: true,
225
+ title: wgm_l.locales.sweet_alert.oops,
226
+ html: wgm_notice_text + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro</a>',
227
+ confirmButtonText: 'Close',
228
+ }
229
+ );
230
+ }
231
+ );
232
+
233
+ /**
234
+ * Settings tab active/inactive and rendaring
235
+ *
236
+ * @since 1.7.5
237
+ */
238
+ $(document.body).find(".wgm-settings-menu li").on(
239
+ 'click',
240
+ function (e) {
241
+ e.preventDefault();
242
+ $(this).siblings().removeClass('active');
243
+ $(this).addClass('active');
244
+ var wgm_tab_id = $(this).attr('data-tab');
245
+ $('.wgm_settings_tabs').hide();
246
+ $("#" + wgm_tab_id).show();
247
+ }
248
+ );
249
+ }
250
+ );
251
 
252
  })(jQuery);
admin/assets/js/geo_based_map_create.js CHANGED
@@ -1,140 +1,150 @@
1
  "use strict";
2
  var wgm_map, wgm_infowindow,
3
- wgm_center_lat = null,
4
- wgm_center_lng = null,
5
- wgm_icon = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png',
6
- info_content,
7
- current_map_markers = [],
8
- current_map_infowindows = [],
9
 
10
- //new marker
11
- wgm_new_marker = null,
12
- wgm_new_marker_infoindow = null,
13
 
14
- wgm_new_marker_name = '', wgm_new_marker_desc = '',
15
 
16
- //existing marker
17
- wgm_existing_marker,
18
- wgm_existing_marker_infoindow = null,
19
- wgm_existing_marker_name = '', wgm_existing_marker_desc = '',
20
 
21
- wgm_custom_marker,
22
- custom_marker_infowindow,
23
- is_marker_edit = false,
24
- wgm_no_of_marker = 0
25
-
26
- ;
27
 
28
  // This function allows the script to run from both locations (visual and text)
29
  function wgm_generate_infowindow() {
30
 
31
- if (is_marker_edit === true) {
32
- //current_map_infowindows
33
- var marker_id = parseInt(jQuery('.wpgmap_marker_update').attr('markerid'));
34
- // info window object for New Marker creating if not initiated yet
35
- wgm_existing_marker_infoindow = current_map_infowindows[marker_id];
36
-
37
- // Info window contents generating from input and editor
38
- wgm_new_marker_name = '';
39
- if (jQuery("#wpgmap_marker_name").val() !== '') {
40
- wgm_existing_marker_name = '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + jQuery("#wpgmap_marker_name").val() + '</span>';
41
- }
42
- wgm_existing_marker_desc = tmce_getContent('wpgmap_marker_desc', 'wpgmap_marker_desc');
43
-
44
- // Set info window content if info window object initiated
45
- if (wgm_existing_marker_infoindow !== null) {
46
- wgm_existing_marker_infoindow.setContent(wgm_existing_marker_name + wgm_existing_marker_desc);
47
- }
48
-
49
- // existing marker, when editing
50
- if (typeof wgm_existing_marker !== 'undefined' && jQuery("#wpgmap_marker_infowindow_show").val() === '1') {
51
- wgm_existing_marker_infoindow.open({anchor: wgm_existing_marker, shouldFocus: false});
52
- }
53
- } else {
54
- // info window object for New Marker creating if not initiated yet
55
- if (wgm_new_marker_infoindow === null) {
56
- wgm_new_marker_infoindow = new google.maps.InfoWindow({
57
- content: ''
58
- });
59
- }
60
-
61
- // Info window contents generating from input and editor
62
- wgm_new_marker_name = '';
63
- if (jQuery("#wpgmap_marker_name").val() !== '') {
64
- wgm_new_marker_name = '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + jQuery("#wpgmap_marker_name").val() + '</span>';
65
- }
66
- wgm_new_marker_desc = tmce_getContent('wpgmap_marker_desc', 'wpgmap_marker_desc');
67
-
68
- // Set info window content if info window object initiated
69
- if (wgm_new_marker_infoindow !== null) {
70
- wgm_new_marker_infoindow.setContent(wgm_new_marker_name + wgm_new_marker_desc);
71
- }
72
-
73
- // mew marker, when creating new one
74
- if (typeof wgm_new_marker !== 'undefined' && jQuery("#wpgmap_marker_infowindow_show").val() === '1') {
75
- wgm_new_marker_infoindow.open({anchor: wgm_new_marker, shouldFocus: false});
76
- }
77
- }
 
 
78
 
79
  }
80
 
81
 
82
  /**
83
  * Select element by ID
 
84
  * @param id
85
  * @return html_element
86
  * @since 1.0.0
87
  */
88
  function _wgm_e(id) {
89
- return document.getElementById(id);
90
  }
91
 
92
  /**
93
  * Getting detailed address by lat,lng
 
94
  * @param lat
95
  * @param lng
96
  * @since 1.5.0
97
  */
98
  function wgm_SetAddressByLatLng(lat, lng) {
99
- jQuery.getJSON('https://maps.googleapis.com/maps/api/geocode/json?key=' + wgp_api_key + '&latlng=' + lat + ',' + lng + '&sensor=true')
100
- .done(function (location) {
101
- if (location.status === 'OK') {
102
- _wgm_e('wpgmap_marker_address').value = location.results[0].formatted_address;
103
- }
104
- })
105
- .fail(function (d) {
106
- console.log(d);
107
- })
108
- .always(function (d) {
109
- console.log(d);
110
- });
 
 
 
 
 
 
111
 
112
  }
113
 
114
  /**
115
  * In case of already initialized map
 
116
  * @param map_type
117
  * @param center_lat
118
  * @param center_lng
119
  * @since 1.0.0
120
  */
121
  function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
122
- if (map_type === 'ROADMAP') {
123
- wgm_map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
124
- } else if (map_type === 'SATELLITE') {
125
- wgm_map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
126
- } else if (map_type === 'HYBRID') {
127
- wgm_map.setMapTypeId(google.maps.MapTypeId.HYBRID);
128
- } else if (map_type === 'TERRAIN') {
129
- wgm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
130
- }
131
-
132
- wgm_map.setCenter({lat: center_lat, lng: center_lng});
133
- wgm_addMapListeners(wgm_map);
134
  }
135
 
136
  /**
137
  * Update map settings
 
138
  * @param map_type
139
  * @param center_lat
140
  * @param center_lng
@@ -142,106 +152,105 @@ function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
142
  * @returns {{mapTypeId: *, center: {lng, lat}, zoom}}
143
  * @since 1.0.0
144
  */
145
- //
146
  function wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom) {
147
- var wgm_gmap_settings = {
148
- center: {lat: center_lat, lng: center_lng},
149
- zoom: zoom,
150
- mapTypeId: google.maps.MapTypeId.ROADMAP
151
- };
152
- if (map_type === 'ROADMAP') {
153
- wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.ROADMAP;
154
- } else if (map_type === 'SATELLITE') {
155
- wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.SATELLITE;
156
- } else if (map_type === 'HYBRID') {
157
- wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.HYBRID;
158
- } else if (map_type === 'TERRAIN') {
159
- wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.TERRAIN;
160
- }
161
- return wgm_gmap_settings;
162
  }
163
 
164
  /**
165
  * Defining Marker listener
 
166
  * @param marker
167
  * @since 1.0.0
168
  */
169
  function wgm_addMarkerDragendListener(marker) {
170
- marker.addListener('dragend', function (markerLocation) {
171
- _wgm_e("wpgmap_marker_lat_lng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
172
- wgm_SetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
173
- });
 
 
 
174
  }
175
 
176
  function populateMarkerOnPlaceChangedOnSearchBox(marker_search_box) {
177
 
178
- var places = marker_search_box.getPlaces();
179
-
180
- if (places.length === 0) {
181
- return;
182
- }
183
-
184
- // markers = [];
185
-
186
- // For each place, get the icon, name and location.
187
- var bounds = new google.maps.LatLngBounds();
188
- places.forEach(function (place) {
189
- if (!place.geometry) {
190
- console.log("Returned place contains no geometry");
191
- return;
192
- }
193
- // Create a marker for each place.
194
- // wgm_marker1 = new google.maps.Marker({
195
- // map: map,
196
- // title: place.name,
197
- // draggable: true,
198
- // position: place.geometry.location,
199
- // icon: icon
200
- // });
201
- // markers.push(marker1);
202
- // openInfoWindow();
203
- // wgm_marker1.position = place.geometry.location;
204
-
205
- // Add Marker event listener
206
- // wgm_addMarkerDragendListener(wgm_marker1);
207
-
208
- _e("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
209
-
210
- if (place.geometry.viewport) {
211
- // Only geocodes have viewport.
212
- bounds.union(place.geometry.viewport);
213
- } else {
214
- bounds.extend(place.geometry.location);
215
- }
216
- });
217
- map.fitBounds(bounds);
218
-
219
- // Add Marker event listener
220
- // wgm_addMarkerDragendListener(markers[0]);
221
  }
222
 
223
  /**
224
  * Defining Map event listeners
 
225
  * @param wgm_map object
226
  * @since 1.0.0
227
  */
228
  function wgm_addMapListeners(wgm_map) {
229
 
230
- // On map center changed
231
- wgm_map.addListener("center_changed", function () {
232
- jQuery('#wpgmap_center_lat_lng').val(wgm_map.center.lat() + ',' + wgm_map.center.lng());
233
- wgm_center_lat = wgm_map.center.lat();
234
- wgm_center_lng = wgm_map.center.lng();
235
- });
236
-
237
- // On map zoom level changed
238
- wgm_map.addListener("zoom_changed", function () {
239
- jQuery('#wpgmap_map_zoom').val(wgm_map.zoom);
240
- });
 
 
 
 
 
 
241
  }
242
 
243
  /**
244
  * Map autocomplete implementation
 
245
  * @param id
246
  * @param input
247
  * @param center_lat
@@ -252,604 +261,706 @@ function wgm_addMapListeners(wgm_map) {
252
  */
253
  function wgm_initAutocomplete(id, input, center_lat, center_lng, map_type, zoom) {
254
 
255
- // Set address by Lat Lng
256
- _wgm_e("wpgmap_latlng").value = center_lat + "," + center_lng;
257
- _wgm_e("wpgmap_center_lat_lng").value = center_lat + "," + center_lng;
258
- wgm_SetAddressByLatLng(center_lat, center_lng);
259
-
260
- // In case of already initiated map
261
- if (typeof wgm_map === 'object') {
262
- wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng);
263
- return false;
264
- }
265
-
266
- // Set Map Settings by Map Type
267
- var wgm_gmap_settings = wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom);
268
-
269
- // Making map object
270
- wgm_map = new google.maps.Map(_wgm_e(id), wgm_gmap_settings);
271
-
272
- google.maps.event.addListener(wgm_map, "rightclick", function (event) {
273
- generateMarkerInfoByRightClick(event);
274
- });
275
-
276
- // Create the search box and link it to the UI element.
277
- var wgm_input = document.getElementById(input);
278
- var wgm_searchBox = new google.maps.places.SearchBox(wgm_input);
279
-
280
- // Place input search box
281
- wgm_map.controls[google.maps.ControlPosition.TOP_LEFT].push(wgm_input);
282
-
283
- //=====================showing multiple marker=============
284
- var data = {
285
- 'action': 'wpgmapembed_get_markers_by_map_id',
286
- 'data': {
287
- map_id: 0,
288
- ajax_nonce: wgm_l.ajax_nonce
289
- }
290
- };
291
- jQuery.post(ajaxurl, data, function (response) {
292
- response = JSON.parse(response);
293
- wgm_no_of_marker = response.markers.length;
294
-
295
- if (wgm_no_of_marker === 0) {
296
- jQuery(document.body).find(".wgm_marker_create_hints").show();
297
- }
298
-
299
- if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
300
- jQuery('.add_new_marker_btn_area').find(".add_new_marker").css({
301
- 'opacity': .5
302
- });
303
- jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").show();
304
- }
305
- if (response.markers.length > 0) {
306
- response.markers.forEach(function (marker) {
307
-
308
- var marker_lat_lng = marker.lat_lng.split(',');
309
- var wgm_custom_marker_options = {
310
- position: new google.maps.LatLng(marker_lat_lng[0], marker_lat_lng[1]),
311
- title: marker.marker_name,
312
- animation: google.maps.Animation.DROP,
313
- };
314
- // Set Icon
315
- if (marker.icon !== '') {
316
- wgm_custom_marker_options.icon = marker.icon;
317
-
318
- }
319
- // Set marker URL
320
- if (marker.have_marker_link === '1') {
321
- wgm_custom_marker_options.url = marker.marker_link;
322
- }
323
- wgm_custom_marker = new google.maps.Marker(wgm_custom_marker_options);
324
- if (marker.have_marker_link === '1') {
325
- google.maps.event.addListener(wgm_custom_marker, 'click', function () {
326
- var wgm_target = '_self';
327
- if (marker.marker_link_new_tab === '1') {
328
- wgm_target = '_blank';
329
- }
330
- window.open(this.url, wgm_target);
331
- });
332
- }
333
-
334
-
335
- wgm_custom_marker.setMap(wgm_map);
336
- marker.marker_desc = marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
337
- var marker_name = (marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
338
- + marker.marker_name +
339
- '</span><br/>') : '';
340
- custom_marker_infowindow = new google.maps.InfoWindow({
341
- content: marker_name + marker.marker_desc
342
- });
343
- if (marker.show_desc_by_default === '1') {
344
- custom_marker_infowindow.open({anchor: wgm_custom_marker, shouldFocus: false});
345
- }
346
- current_map_markers[parseInt(marker.id)] = wgm_custom_marker;
347
- current_map_infowindows[parseInt(marker.id)] = custom_marker_infowindow;
348
- });
349
- }
350
- });
351
-
352
- // multiple marker showing end
353
-
354
- // Invoking Map listeners
355
- wgm_addMapListeners(wgm_map);
356
-
357
- // Bias the SearchBox results towards current map's viewport.
358
- wgm_map.addListener('bounds_changed', function () {
359
- wgm_searchBox.setBounds(wgm_map.getBounds());
360
- });
361
-
362
- var wgm_markers = [];
363
- // Listen for the event fired when the user selects a prediction and retrieve
364
- // more details for that place.
365
- wgm_searchBox.addListener('places_changed', function () {
366
- // wgm_marker1.setMap(null);
367
- var wgm_places = wgm_searchBox.getPlaces();
368
-
369
- if (wgm_places.length === 0) {
370
- return;
371
- }
372
- // wgm_marker1.setMap(null);
373
- // Clear out the old markers.
374
- wgm_markers.forEach(function (marker) {
375
- marker.setMap(null);
376
- });
377
- wgm_markers = [];
378
-
379
- // For each place, get the icon, name and location.
380
- var wgm_bounds = new google.maps.LatLngBounds();
381
- wgm_places.forEach(function (place) {
382
- if (!place.geometry) {
383
- console.log("Returned place contains no geometry");
384
- return;
385
- }
386
- // Create a marker for each place.
387
- // wgm_marker1 = new google.maps.Marker({
388
- // map: wgm_map,
389
- // title: place.name,
390
- // draggable: true,
391
- // position: place.geometry.location,
392
- // icon: wgm_icon
393
- // });
394
- // wgm_markers.push(wgm_marker1);
395
- // wgm_openInfoWindow();
396
- // wgm_marker1.position = place.geometry.location;
397
-
398
- // Add Marker event listener
399
- // wgm_addMarkerDragendListener(wgm_marker1);
400
-
401
- _wgm_e("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
402
-
403
- if (place.geometry.viewport) {
404
- // Only geocodes have viewport.
405
- wgm_bounds.union(place.geometry.viewport);
406
- } else {
407
- wgm_bounds.extend(place.geometry.location);
408
- }
409
- });
410
- wgm_map.fitBounds(wgm_bounds);
411
-
412
- // Add Marker event listener
413
- // wgm_addMarkerDragendListener(wgm_markers[0]);
414
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
415
 
416
  }
417
 
418
  /**
419
  * Initialize Google Map
 
420
  * @param lat
421
  * @param lng
422
  * @param map_type
423
  * @since 1.0.0
424
  */
425
  function wgm_initWpGmap(lat, lng, map_type) {
426
- wgm_initAutocomplete('wgm_map', 'wgm_pac_input', lat, lng, map_type, parseInt(_wgm_e('wpgmap_map_zoom').value));
427
  }
428
 
429
  /**
430
  * Trying API geo location to get current location
 
431
  * @since 1.0.0
432
  */
433
  function wgm_tryAPIGeolocation() {
434
- try {
435
- jQuery.ajax({
436
- type: 'POST',
437
- url: 'https://www.googleapis.com/geolocation/v1/geolocate?key=' + wgp_api_key,
438
- success: function (data) {
439
- wgm_initWpGmap(success.location.lat, success.location.lng, 'ROADMAP');
440
- wgm_center_lat = success.location.lat;
441
- wgm_center_lng = success.location.lng;
442
- },
443
- error: function (xhr, textStatus, error) {
444
- wgm_initWpGmap(40.73359922990751, -74.02791395625002, 'ROADMAP');
445
- wgm_center_lat = 40.73359922990751;
446
- wgm_center_lng = -74.02791395625002;
447
- }
448
- });
449
- } catch (error) {
450
- wgm_initWpGmap(40.73359922990751, -74.02791395625002, 'ROADMAP');
451
- wgm_center_lat = 40.73359922990751;
452
- wgm_center_lng = -74.02791395625002;
453
- }
 
 
454
  }
455
 
456
  /**
457
  * Disabled from 1.7.8 due to user request
458
  * Browser geo location success function
 
459
  * @param position
460
  * @since 1.0.0
461
  */
462
  // var wgm_browserGeolocationSuccess = function (position) {
463
- // wgm_initWpGmap(position.coords.latitude, position.coords.longitude, 'ROADMAP');
464
- // wgm_center_lat = position.coords.latitude;
465
- // wgm_center_lng = position.coords.longitude;
466
  // };
467
 
468
 
469
 
470
  /**
471
  * Trying geo location
 
472
  * @since 1.0.0
473
  */
474
  var wgm_tryGeolocation = function () {
475
- // if (navigator.geolocation) {
476
- // navigator.geolocation.getCurrentPosition(
477
- // wgm_browserGeolocationSuccess,
478
- // wgm_browserGeolocationFail,
479
- // {maximumAge: 50000, timeout: 3000, enableHighAccuracy: true});
480
- // } else {
481
- wgm_center_lat = 40.73359922990751;
482
- wgm_center_lng = -74.02791395625002;
483
- wgm_initWpGmap(40.73359922990751, -74.02791395625002, 'ROADMAP');
484
- // }
485
  };
486
 
487
 
488
  /**
489
  * On zoom level change, render map with new zoom level LIVE
 
490
  * @since 1.0.0
491
  */
492
- jQuery(document.body).find('#wpgmap_map_zoom').on('keyup', function (element) {
493
- //var point = wgm_marker1.getPosition(); // Get marker position
494
- wgm_map.panTo(wgm_map.center); // Pan map to that position
495
- var current_zoom = parseInt(document.getElementById('wpgmap_map_zoom').value);
496
- setTimeout("wgm_map.setZoom(" + current_zoom + ")", 900); // Zoom in after 500 m second
497
- });
 
 
 
498
 
499
  /**
500
  * On title field text change, update map title LIVE
 
501
  * @since 1.0.0
502
  */
503
- jQuery(document.body).find('#wpgmap_title').on('keyup', function (element) {
504
- jQuery('#wpgmap_heading_preview').css({'display': 'block'}).html(jQuery('#wpgmap_title').val());
505
- });
 
 
 
506
 
507
  /**
508
  * On map type change, render different types of map LIVE
 
509
  * @since 1.0.0
510
  */
511
- jQuery(document.body).find('#wpgmap_map_type').on('change', function (element) {
512
- // wgm_marker1.setMap(null);
513
- var map_type = jQuery(this).val();
514
- // wgm_initWpGmap(wgm_map.center.lat(), wgm_map.center.lng(), map_type);
515
- wgm_map.setMapTypeId(map_type.toLowerCase());
516
- });
 
 
 
 
517
 
518
  /**
519
- * Rendering tab contents
520
- * @since 1.0.0
 
521
  */
 
 
 
 
 
 
 
 
522
 
 
 
 
 
 
 
 
 
 
 
 
 
523
 
524
- jQuery(document.body).find('.wgm_wpgmap_tab li').on('click', function (e) {
525
- e.preventDefault();
526
- jQuery('.wgm_wpgmap_tab li').removeClass('active');
527
- jQuery(this).addClass('active');
528
-
529
- jQuery('.wp-gmap-tab-contents').addClass('hidden');
530
- var wpgmap_id = jQuery(this).attr('id');
531
- jQuery('.' + wpgmap_id).removeClass('hidden');
532
- if (wpgmap_id === 'wgm_gmap_markers') {
533
- jQuery('.wgm_gmap_marker_list').css('display', 'block');
534
- jQuery('.add_new_marker_form').css('display', 'none');
535
- } else {
536
- jQuery('.wgm_gmap_marker_list').css('display', 'none');
537
- }
538
- });
539
  /**
540
- * Map marker icon updating
 
541
  * @since 1.0.0
542
  */
543
- // jQuery(document).ready(function ($) {
544
- //
545
- // $('#wgm_upload_image_button').click(function () {
546
- //
547
- // var formfield = $('#wgm_upload_image').attr('name');
548
- // tb_show('Upload your marker image', 'media-upload.php?type=image&amp;TB_iframe=true');
549
- // window.send_to_editor = function (html) {
550
- // wgm_icon = $(html).attr('src');
551
- // $('#wpgmap_upload_hidden').val(wgm_icon);
552
- // tb_remove();
553
- // wgm_marker1.setIcon(wgm_icon);
554
- // jQuery("#wpgmap_icon_img").attr('src', wgm_icon);
555
- // };
556
- // return false;
557
- // });
558
- // });
 
 
 
 
 
559
  // ========================================For Media Upload in Marker===================================
560
- jQuery(document).ready(function ($) {
561
-
562
- $('#wpgmap_upload_marker_icon').click(function () {
563
- var custom_uploader;
564
- if (custom_uploader) {
565
- custom_uploader.open();
566
- return;
567
- }
568
-
569
- custom_uploader = wp.media.frames.file_frame = wp.media({
570
- title: 'Choose Image'
571
- , button: {
572
- text: 'Choose Image'
573
- }
574
- , multiple: false
575
- });
576
-
577
- custom_uploader.on('select', function () {
578
- var attachment = custom_uploader.state().get('selection').first().toJSON();
579
-
580
- var data = {
581
- 'action': 'wpgmapembed_save_marker_icon',
582
- 'data': {
583
- icon_url: attachment.url,
584
- ajax_nonce:wgm_l.ajax_nonce
585
- }
586
- };
587
- jQuery.post(ajaxurl, data, function (response) {
588
- response = JSON.parse(response);
589
- $(document.body).find("#wpgmap_marker_icon").val(response.icon_url);
590
- $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon_url);
591
- var elm = {};
592
- elm.src = response.icon_url;
593
- wpgmapChangeCurrentMarkerIcon(elm);
594
- });
595
- });
596
-
597
- //Open the uploader dialog
598
- custom_uploader.open();
599
- });
600
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
601
 
602
  function generateMarkerInfoByRightClick(event) {
603
- // Is markers tab active
604
- if (!jQuery('.add_new_marker_form').hasClass('wgm_active')) {
605
- return false;
606
- }
607
-
608
- if (wgm_new_marker != null) {
609
- alert('Please save current marker at first!');
610
- return false;
611
- }
612
- var lat = event.latLng.lat();
613
- var lng = event.latLng.lng();
614
- wgm_new_marker = new google.maps.Marker({
615
- title: "",
616
- animation: google.maps.Animation.DROP,
617
- position: event.latLng,
618
- draggable: true,
619
- map: wgm_map
620
- });
621
-
622
- if (is_marker_edit) {
623
-
624
- wgm_existing_marker.setMap(null);
625
- wgm_existing_marker = new google.maps.Marker({
626
- title: "",
627
- animation: google.maps.Animation.DROP,
628
- position: event.latLng,
629
- draggable: true,
630
- map: wgm_map
631
- });
632
-
633
- wgm_generate_infowindow();
634
-
635
- wgm_existing_marker_infoindow.open({anchor: wgm_existing_marker, shouldFocus: false});
636
- wgm_addMarkerDragendListener(wgm_existing_marker);
637
-
638
- } else {
639
- wgm_generate_infowindow();
640
- // wgm_new_marker_infoindow = new google.maps.InfoWindow({
641
- // content: ''
642
- // });
643
- wgm_new_marker_infoindow.open({anchor: wgm_new_marker, shouldFocus: false});
644
- wgm_addMarkerDragendListener(wgm_new_marker);
645
- }
646
-
647
- // populate yor box/field with lat, lng
648
- jQuery('#wpgmap_marker_lat_lng').val(lat + ',' + lng);
649
- wgm_SetAddressByLatLng(lat, lng);
 
 
 
 
650
 
651
  }
652
 
653
  function tmce_setContent(content, editor_id, textarea_id) {
654
- if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
655
- if (typeof textarea_id == 'undefined') textarea_id = editor_id;
656
-
657
- if (jQuery('#wp-' + editor_id + '-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
658
- content = content.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
659
- return tinyMCE.get(editor_id).setContent(content);
660
- } else {
661
- return jQuery('#' + textarea_id).val(content);
662
- }
 
 
 
 
663
  }
664
 
665
  function tmce_getContent(editor_id, textarea_id) {
666
- if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
667
- if (typeof textarea_id == 'undefined') textarea_id = editor_id;
668
-
669
- if (jQuery('#wp-' + editor_id + '-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
670
- return tinyMCE.get(editor_id).getContent();
671
- } else {
672
- return jQuery('#' + textarea_id).val();
673
- }
 
 
 
 
674
  }
675
 
676
  var marker_name_info_content = '', marker_desc_info_content = '';
677
 
678
  function populateMarkerInfowindow() {
679
- // if (noActiveIW()) {
680
- // alert('At first you need to right click on Map to point your marker position.');
681
- // return false;
682
- // }
683
- var final_content = marker_name_info_content + marker_desc_info_content;
684
- if (wgm_existing_marker_infoindow !== null) {
685
- wgm_existing_marker_infoindow.setContent(final_content);
686
- }
687
  }
688
 
689
 
690
- jQuery(document).ready(function ($) {
691
-
692
-
693
- //==============================
694
- // Create 'keyup_event' tinymce plugin
695
- tinymce.PluginManager.add('keyup_event', function (editor, url) {
696
- if (editor.id === 'wpgmap_marker_desc') {
697
-
698
- // Create keyup event
699
- editor.on('keyup', function (e) {
700
- // Get the editor content (html)
701
- // var get_ed_content = tinymce.activeEditor.getContent();
702
- //wpgmapMarkerDescGenerate(get_ed_content);
703
- wgm_generate_infowindow();
704
- });
705
- }
706
- });
707
-
708
- jQuery('#wpgmap_marker_name,#wpgmap_marker_desc').on('keyup', function (element) {
709
- wgm_generate_infowindow();
710
- });
711
- jQuery(document.body).find('#wpgmap_marker_link').on('blur', function (event) {
712
- var wgm_marker_url = jQuery(this).val();
713
- if (is_marker_edit === true) {
714
- wgm_existing_marker.url = wgm_marker_url;
715
- google.maps.event.addListener(wgm_existing_marker, 'click', function () {
716
- var wgm_target = '_self';
717
- if ($('#wpgmap_marker_link_new_tab').is(':checked')) {
718
- wgm_target = '_blank';
719
- }
720
- window.open(this.url, wgm_target);
721
- });
722
- } else {
723
- if (wgm_new_marker !== null) {
724
- wgm_new_marker.url = wgm_marker_url;
725
- google.maps.event.addListener(wgm_new_marker, 'click', function () {
726
- var wgm_target = '_self';
727
- if (jQuery('#wpgmap_marker_link_new_tab').is(':checked')) {
728
- wgm_target = '_blank';
729
- }
730
- window.open(this.url, wgm_target);
731
- });
732
- }
733
- }
734
-
735
- });
736
-
737
- function generateMarkersListView() {
738
- $('#wgm_gmap_marker_list').DataTable().ajax.reload();
739
- }
740
-
741
- // Marker delete
742
- jQuery(document.body).on('click', '.wpgmap_marker_trash', function (event) {
743
- event.preventDefault();
744
- var parent = $(this).parents().eq(4);
745
- parent.find('.spinner').css('visibility', 'visible');
746
- if (confirm('Are you sure to delete?')) {
747
- var marker_id = jQuery(this).attr('map_marker_id');
748
- var data = {
749
- 'action': 'wpgmapembed_delete_marker',
750
- 'data': {
751
- marker_id: marker_id,
752
- ajax_nonce:wgm_l.ajax_nonce
753
- }
754
- };
755
- jQuery.post(ajaxurl, data, function (response) {
756
- response = JSON.parse(response);
757
- generateMarkersListView();
758
- parent.find('.spinner').css('visibility', 'hidden');
759
- current_map_markers[parseInt(marker_id)].setMap(null);
760
- current_map_markers.splice(parseInt(marker_id), 1);
761
- current_map_infowindows.splice(parseInt(marker_id), 1);
762
-
763
-
764
- $(document.body).find('#marker_success').html('Marker removed successfully.');
765
- wgm_no_of_marker--;
766
- if (wgm_no_of_marker === 0 && wgm_l.is_premium_user !== '1') {
767
- jQuery('.add_new_marker_btn_area').find(".add_new_marker").css({
768
- 'opacity': 1
769
- });
770
- jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").hide();
771
- }
772
- });
773
- }
774
- });
775
-
776
- // Marker delete
777
- jQuery(document.body).on('click', '.wpgmap_marker_view', function (event) {
778
- event.preventDefault();
779
- var parent = $(this).parents().eq(4);
780
- parent.find('.spinner').css('visibility', 'visible');
781
- var marker_id = jQuery(this).attr('map_marker_id');
782
- wgm_existing_marker = current_map_markers[marker_id];
783
- wgm_map.panTo(wgm_existing_marker.getPosition());
784
- });
785
-
786
- // Marker Edit
787
- jQuery(document.body).on('click', '.wpgmap_marker_edit', function (event) {
788
- event.preventDefault();
789
- is_marker_edit = true;
790
- var parent = $(this).parents().eq(4);
791
- parent.find('.spinner').css('visibility', 'visible');
792
- var marker_id = jQuery(this).attr('map_marker_id');
793
- wgm_existing_marker = current_map_markers[marker_id];
794
- var data = {
795
- 'action': 'wpgmapembed_get_marker_data_by_marker_id',
796
- 'data': {
797
- marker_id: marker_id,
798
- ajax_nonce:wgm_l.ajax_nonce
799
- }
800
- };
801
- jQuery.post(ajaxurl, data, function (response) {
802
- response = JSON.parse(response);
803
- $('#wpgmap_marker_name').val(response.marker_name);
804
- $('#wpgmap_marker_address').val(response.address);
805
- var wgm_marker_lat_lng = response.lat_lng.split(',');
806
- $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
807
- $('#wpgmap_marker_link').val(response.marker_link);
808
- $('#wpgmap_marker_icon').val(response.icon);
809
- if (response.have_marker_link === '1') {
810
- $("#wpgmap_marker_link_area").show();
811
- } else {
812
- $("#wpgmap_marker_link_area").hide();
813
- }
814
- $('#wpgmap_marker_link_new_tab').prop('checked', response.marker_link_new_tab === "1");
815
- $('#wpgmap_marker_infowindow_show').val(response.show_desc_by_default).change();
816
- $('#wpgmap_have_marker_link').val(response.have_marker_link).change();
817
- $('.wpgmap_marker_add,.wpgmap_marker_update').attr('markerid', marker_id);
818
- $('.wpgmap_marker_add').removeClass('wpgmap_marker_add').addClass('wpgmap_marker_update').css('background-color', '#00a2f3').html('<i class="dashicons dashicons-location" style="line-height: 1.6;"></i><b>Update Marker</b>');
819
- // Reset wp editor content
820
- tmce_setContent(response.marker_desc, 'wpgmap_marker_desc', 'wpgmap_marker_desc');
821
- parent.find('.spinner').css('visibility', 'hidden');
822
-
823
- $(document.body).find('.add_new_marker_form').show();
824
- $(document.body).find('.wgm_gmap_marker_list').hide();
825
- $(document.body).find('#marker_errors,#marker_success').html('');
826
- $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon);
827
- wgm_map.panTo(wgm_existing_marker.getPosition());
828
- current_map_markers[marker_id].setDraggable(true);
829
- wgm_addMarkerDragendListener(current_map_markers[marker_id]);
830
- wgm_existing_marker_infoindow = new google.maps.InfoWindow({
831
- content: '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + response.marker_name + '</span>' + response.address
832
- });
833
- });
834
- });
835
-
836
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
 
838
 
839
  function wpgmapChangeCurrentMarkerIcon(elem) {
840
- var icon_url = elem.src;
841
- document.getElementById('wpgmap_marker_icon').value = icon_url;
842
- document.getElementById('wpgmap_marker_icon_preview').src = icon_url;
843
- jQuery('#TB_closeWindowButton').click();
844
- if (is_marker_edit) {
845
- if (wgm_existing_marker !== null) {
846
- wgm_existing_marker.setIcon(icon_url);
847
- }
848
- } else {
849
- if (wgm_new_marker !== null) {
850
- wgm_new_marker.setIcon(icon_url);
851
- }
852
- }
853
  }
854
 
855
  wgm_tryGeolocation();
1
  "use strict";
2
  var wgm_map, wgm_infowindow,
3
+ wgm_center_lat = null,
4
+ wgm_center_lng = null,
5
+ wgm_icon = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png',
6
+ info_content,
7
+ current_map_markers = [],
8
+ current_map_infowindows = [],
9
 
10
+ // new marker
11
+ wgm_new_marker = null,
12
+ wgm_new_marker_infoindow = null,
13
 
14
+ wgm_new_marker_name = '', wgm_new_marker_desc = '',
15
 
16
+ // existing marker
17
+ wgm_existing_marker,
18
+ wgm_existing_marker_infoindow = null,
19
+ wgm_existing_marker_name = '', wgm_existing_marker_desc = '',
20
 
21
+ wgm_custom_marker,
22
+ custom_marker_infowindow,
23
+ is_marker_edit = false,
24
+ wgm_no_of_marker = 0;
 
 
25
 
26
  // This function allows the script to run from both locations (visual and text)
27
  function wgm_generate_infowindow() {
28
 
29
+ if (is_marker_edit === true) {
30
+ // current_map_infowindows
31
+ var marker_id = parseInt( jQuery( '.wpgmap_marker_update' ).attr( 'markerid' ) );
32
+ // info window object for New Marker creating if not initiated yet
33
+ wgm_existing_marker_infoindow = current_map_infowindows[marker_id];
34
+
35
+ // Info window contents generating from input and editor
36
+ wgm_new_marker_name = '';
37
+ if (jQuery( "#wpgmap_marker_name" ).val() !== '') {
38
+ wgm_existing_marker_name = '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + jQuery( "#wpgmap_marker_name" ).val() + '</span>';
39
+ }
40
+ wgm_existing_marker_desc = tmce_getContent( 'wpgmap_marker_desc', 'wpgmap_marker_desc' );
41
+
42
+ // Set info window content if info window object initiated
43
+ if (wgm_existing_marker_infoindow !== null) {
44
+ wgm_existing_marker_infoindow.setContent( wgm_existing_marker_name + wgm_existing_marker_desc );
45
+ }
46
+
47
+ // existing marker, when editing
48
+ if (typeof wgm_existing_marker !== 'undefined' && jQuery( "#wpgmap_marker_infowindow_show" ).val() === '1') {
49
+ wgm_existing_marker_infoindow.open( {anchor: wgm_existing_marker, shouldFocus: false} );
50
+ }
51
+ } else {
52
+ // info window object for New Marker creating if not initiated yet
53
+ if (wgm_new_marker_infoindow === null) {
54
+ wgm_new_marker_infoindow = new google.maps.InfoWindow(
55
+ {
56
+ content: ''
57
+ }
58
+ );
59
+ }
60
+
61
+ // Info window contents generating from input and editor
62
+ wgm_new_marker_name = '';
63
+ if (jQuery( "#wpgmap_marker_name" ).val() !== '') {
64
+ wgm_new_marker_name = '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + jQuery( "#wpgmap_marker_name" ).val() + '</span>';
65
+ }
66
+ wgm_new_marker_desc = tmce_getContent( 'wpgmap_marker_desc', 'wpgmap_marker_desc' );
67
+
68
+ // Set info window content if info window object initiated
69
+ if (wgm_new_marker_infoindow !== null) {
70
+ wgm_new_marker_infoindow.setContent( wgm_new_marker_name + wgm_new_marker_desc );
71
+ }
72
+
73
+ // mew marker, when creating new one
74
+ if (typeof wgm_new_marker !== 'undefined' && jQuery( "#wpgmap_marker_infowindow_show" ).val() === '1') {
75
+ wgm_new_marker_infoindow.open( {anchor: wgm_new_marker, shouldFocus: false} );
76
+ }
77
+ }
78
 
79
  }
80
 
81
 
82
  /**
83
  * Select element by ID
84
+ *
85
  * @param id
86
  * @return html_element
87
  * @since 1.0.0
88
  */
89
  function _wgm_e(id) {
90
+ return document.getElementById( id );
91
  }
92
 
93
  /**
94
  * Getting detailed address by lat,lng
95
+ *
96
  * @param lat
97
  * @param lng
98
  * @since 1.5.0
99
  */
100
  function wgm_SetAddressByLatLng(lat, lng) {
101
+ jQuery.getJSON( 'https://maps.googleapis.com/maps/api/geocode/json?key=' + wgp_api_key + '&latlng=' + lat + ',' + lng + '&sensor=true' )
102
+ .done(
103
+ function (location) {
104
+ if (location.status === 'OK') {
105
+ _wgm_e( 'wpgmap_marker_address' ).value = location.results[0].formatted_address;
106
+ }
107
+ }
108
+ )
109
+ .fail(
110
+ function (d) {
111
+ console.log( d );
112
+ }
113
+ )
114
+ .always(
115
+ function (d) {
116
+ console.log( d );
117
+ }
118
+ );
119
 
120
  }
121
 
122
  /**
123
  * In case of already initialized map
124
+ *
125
  * @param map_type
126
  * @param center_lat
127
  * @param center_lng
128
  * @since 1.0.0
129
  */
130
  function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
131
+ if (map_type === 'ROADMAP') {
132
+ wgm_map.setMapTypeId( google.maps.MapTypeId.ROADMAP );
133
+ } else if (map_type === 'SATELLITE') {
134
+ wgm_map.setMapTypeId( google.maps.MapTypeId.SATELLITE );
135
+ } else if (map_type === 'HYBRID') {
136
+ wgm_map.setMapTypeId( google.maps.MapTypeId.HYBRID );
137
+ } else if (map_type === 'TERRAIN') {
138
+ wgm_map.setMapTypeId( google.maps.MapTypeId.TERRAIN );
139
+ }
140
+
141
+ wgm_map.setCenter( {lat: center_lat, lng: center_lng} );
142
+ wgm_addMapListeners( wgm_map );
143
  }
144
 
145
  /**
146
  * Update map settings
147
+ *
148
  * @param map_type
149
  * @param center_lat
150
  * @param center_lng
152
  * @returns {{mapTypeId: *, center: {lng, lat}, zoom}}
153
  * @since 1.0.0
154
  */
 
155
  function wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom) {
156
+ var wgm_gmap_settings = {
157
+ center: {lat: center_lat, lng: center_lng},
158
+ zoom: zoom,
159
+ mapTypeId: google.maps.MapTypeId.ROADMAP
160
+ };
161
+ if (map_type === 'ROADMAP') {
162
+ wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.ROADMAP;
163
+ } else if (map_type === 'SATELLITE') {
164
+ wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.SATELLITE;
165
+ } else if (map_type === 'HYBRID') {
166
+ wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.HYBRID;
167
+ } else if (map_type === 'TERRAIN') {
168
+ wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.TERRAIN;
169
+ }
170
+ return wgm_gmap_settings;
171
  }
172
 
173
  /**
174
  * Defining Marker listener
175
+ *
176
  * @param marker
177
  * @since 1.0.0
178
  */
179
  function wgm_addMarkerDragendListener(marker) {
180
+ marker.addListener(
181
+ 'dragend',
182
+ function (markerLocation) {
183
+ _wgm_e( "wpgmap_marker_lat_lng" ).value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
184
+ wgm_SetAddressByLatLng( markerLocation.latLng.lat(), markerLocation.latLng.lng() );
185
+ }
186
+ );
187
  }
188
 
189
  function populateMarkerOnPlaceChangedOnSearchBox(marker_search_box) {
190
 
191
+ var places = marker_search_box.getPlaces();
192
+
193
+ if (places.length === 0) {
194
+ return;
195
+ }
196
+
197
+ // markers = [];
198
+
199
+ // For each place, get the icon, name and location.
200
+ var bounds = new google.maps.LatLngBounds();
201
+ places.forEach(
202
+ function (place) {
203
+ if ( ! place.geometry) {
204
+ console.log( "Returned place contains no geometry" );
205
+ return;
206
+ }
207
+
208
+ _e( "wpgmap_latlng" ).value = place.geometry.location.lat() + "," + place.geometry.location.lng();
209
+
210
+ if (place.geometry.viewport) {
211
+ // Only geocodes have viewport.
212
+ bounds.union( place.geometry.viewport );
213
+ } else {
214
+ bounds.extend( place.geometry.location );
215
+ }
216
+ }
217
+ );
218
+ map.fitBounds( bounds );
219
+
220
+ // Add Marker event listener
221
+ // wgm_addMarkerDragendListener(markers[0]);
 
 
 
 
 
 
 
 
 
 
 
 
222
  }
223
 
224
  /**
225
  * Defining Map event listeners
226
+ *
227
  * @param wgm_map object
228
  * @since 1.0.0
229
  */
230
  function wgm_addMapListeners(wgm_map) {
231
 
232
+ // On map center changed
233
+ wgm_map.addListener(
234
+ "center_changed",
235
+ function () {
236
+ jQuery( '#wpgmap_center_lat_lng' ).val( wgm_map.center.lat() + ',' + wgm_map.center.lng() );
237
+ wgm_center_lat = wgm_map.center.lat();
238
+ wgm_center_lng = wgm_map.center.lng();
239
+ }
240
+ );
241
+
242
+ // On map zoom level changed
243
+ wgm_map.addListener(
244
+ "zoom_changed",
245
+ function () {
246
+ jQuery( '#wpgmap_map_zoom' ).val( wgm_map.zoom );
247
+ }
248
+ );
249
  }
250
 
251
  /**
252
  * Map autocomplete implementation
253
+ *
254
  * @param id
255
  * @param input
256
  * @param center_lat
261
  */
262
  function wgm_initAutocomplete(id, input, center_lat, center_lng, map_type, zoom) {
263
 
264
+ // Set address by Lat Lng
265
+ _wgm_e( "wpgmap_latlng" ).value = center_lat + "," + center_lng;
266
+ _wgm_e( "wpgmap_center_lat_lng" ).value = center_lat + "," + center_lng;
267
+ wgm_SetAddressByLatLng( center_lat, center_lng );
268
+
269
+ // In case of already initiated map
270
+ if (typeof wgm_map === 'object') {
271
+ wgm_generateAlreadyInitializedMap( map_type, center_lat, center_lng );
272
+ return false;
273
+ }
274
+
275
+ // Set Map Settings by Map Type
276
+ var wgm_gmap_settings = wgm_setMapSettingsByMapType( map_type, center_lat, center_lng, zoom );
277
+
278
+ // Making map object
279
+ wgm_map = new google.maps.Map( _wgm_e( id ), wgm_gmap_settings );
280
+
281
+ google.maps.event.addListener(
282
+ wgm_map,
283
+ "rightclick",
284
+ function (event) {
285
+ generateMarkerInfoByRightClick( event );
286
+ }
287
+ );
288
+
289
+ // Create the search box and link it to the UI element.
290
+ var wgm_input = document.getElementById( input );
291
+ var wgm_searchBox = new google.maps.places.SearchBox( wgm_input );
292
+
293
+ // Place input search box
294
+ wgm_map.controls[google.maps.ControlPosition.TOP_LEFT].push( wgm_input );
295
+
296
+ // =====================showing multiple marker=============
297
+ var data = {
298
+ 'action': 'wpgmapembed_get_markers_by_map_id',
299
+ 'data': {
300
+ map_id: 0,
301
+ ajax_nonce: wgm_l.ajax_nonce
302
+ }
303
+ };
304
+ jQuery.post(
305
+ ajaxurl,
306
+ data,
307
+ function (response) {
308
+ response = JSON.parse( response );
309
+ wgm_no_of_marker = response.markers.length;
310
+
311
+ if (wgm_no_of_marker === 0) {
312
+ jQuery( document.body ).find( ".wgm_marker_create_hints" ).show();
313
+ }
314
+
315
+ if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
316
+ jQuery( '.add_new_marker_btn_area' ).find( ".add_new_marker" ).css(
317
+ {
318
+ 'opacity': .5
319
+ }
320
+ );
321
+ jQuery( '.add_new_marker_btn_area' ).find( ".wgm-pro-label" ).show();
322
+ }
323
+ if (response.markers.length > 0) {
324
+ response.markers.forEach(
325
+ function (marker) {
326
+
327
+ var marker_lat_lng = marker.lat_lng.split( ',' );
328
+ var wgm_custom_marker_options = {
329
+ position: new google.maps.LatLng( marker_lat_lng[0], marker_lat_lng[1] ),
330
+ title: marker.marker_name,
331
+ animation: google.maps.Animation.DROP,
332
+ };
333
+ // Set Icon
334
+ if (marker.icon !== '') {
335
+ wgm_custom_marker_options.icon = marker.icon;
336
+
337
+ }
338
+ // Set marker URL
339
+ if (marker.have_marker_link === '1') {
340
+ wgm_custom_marker_options.url = marker.marker_link;
341
+ }
342
+ wgm_custom_marker = new google.maps.Marker( wgm_custom_marker_options );
343
+ if (marker.have_marker_link === '1') {
344
+ google.maps.event.addListener(
345
+ wgm_custom_marker,
346
+ 'click',
347
+ function () {
348
+ var wgm_target = '_self';
349
+ if (marker.marker_link_new_tab === '1') {
350
+ wgm_target = '_blank';
351
+ }
352
+ window.open( this.url, wgm_target );
353
+ }
354
+ );
355
+ }
356
+
357
+ wgm_custom_marker.setMap( wgm_map );
358
+ marker.marker_desc = marker.marker_desc.replace( /&gt;/g, '>' ).replace( /&lt;/g, '<' );
359
+ var marker_name = (marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
360
+ + marker.marker_name +
361
+ '</span><br/>') : '';
362
+ custom_marker_infowindow = new google.maps.InfoWindow(
363
+ {
364
+ content: marker_name + marker.marker_desc
365
+ }
366
+ );
367
+ if (marker.show_desc_by_default === '1') {
368
+ custom_marker_infowindow.open( {anchor: wgm_custom_marker, shouldFocus: false} );
369
+ }
370
+ current_map_markers[parseInt( marker.id )] = wgm_custom_marker;
371
+ current_map_infowindows[parseInt( marker.id )] = custom_marker_infowindow;
372
+ }
373
+ );
374
+ }
375
+ }
376
+ );
377
+
378
+ // multiple marker showing end
379
+
380
+ // Invoking Map listeners
381
+ wgm_addMapListeners( wgm_map );
382
+
383
+ // Bias the SearchBox results towards current map's viewport.
384
+ wgm_map.addListener(
385
+ 'bounds_changed',
386
+ function () {
387
+ wgm_searchBox.setBounds( wgm_map.getBounds() );
388
+ }
389
+ );
390
+
391
+ var wgm_markers = [];
392
+ // Listen for the event fired when the user selects a prediction and retrieve
393
+ // more details for that place.
394
+ wgm_searchBox.addListener(
395
+ 'places_changed',
396
+ function () {
397
+ // wgm_marker1.setMap(null);
398
+ var wgm_places = wgm_searchBox.getPlaces();
399
+
400
+ if (wgm_places.length === 0) {
401
+ return;
402
+ }
403
+ // wgm_marker1.setMap(null);
404
+ // Clear out the old markers.
405
+ wgm_markers.forEach(
406
+ function (marker) {
407
+ marker.setMap( null );
408
+ }
409
+ );
410
+ wgm_markers = [];
411
+
412
+ // For each place, get the icon, name and location.
413
+ var wgm_bounds = new google.maps.LatLngBounds();
414
+ wgm_places.forEach(
415
+ function (place) {
416
+ if ( ! place.geometry) {
417
+ console.log( "Returned place contains no geometry" );
418
+ return;
419
+ }
420
+
421
+ _wgm_e( "wpgmap_latlng" ).value = place.geometry.location.lat() + "," + place.geometry.location.lng();
422
+
423
+ if (place.geometry.viewport) {
424
+ // Only geocodes have viewport.
425
+ wgm_bounds.union( place.geometry.viewport );
426
+ } else {
427
+ wgm_bounds.extend( place.geometry.location );
428
+ }
429
+ }
430
+ );
431
+ wgm_map.fitBounds( wgm_bounds );
432
+
433
+ // Add Marker event listener
434
+ // wgm_addMarkerDragendListener(wgm_markers[0]);
435
+ }
436
+ );
437
 
438
  }
439
 
440
  /**
441
  * Initialize Google Map
442
+ *
443
  * @param lat
444
  * @param lng
445
  * @param map_type
446
  * @since 1.0.0
447
  */
448
  function wgm_initWpGmap(lat, lng, map_type) {
449
+ wgm_initAutocomplete( 'wgm_map', 'wgm_pac_input', lat, lng, map_type, parseInt( _wgm_e( 'wpgmap_map_zoom' ).value ) );
450
  }
451
 
452
  /**
453
  * Trying API geo location to get current location
454
+ *
455
  * @since 1.0.0
456
  */
457
  function wgm_tryAPIGeolocation() {
458
+ try {
459
+ jQuery.ajax(
460
+ {
461
+ type: 'POST',
462
+ url: 'https://www.googleapis.com/geolocation/v1/geolocate?key=' + wgp_api_key,
463
+ success: function (data) {
464
+ wgm_initWpGmap( success.location.lat, success.location.lng, 'ROADMAP' );
465
+ wgm_center_lat = success.location.lat;
466
+ wgm_center_lng = success.location.lng;
467
+ },
468
+ error: function (xhr, textStatus, error) {
469
+ wgm_initWpGmap( 40.73359922990751, -74.02791395625002, 'ROADMAP' );
470
+ wgm_center_lat = 40.73359922990751;
471
+ wgm_center_lng = -74.02791395625002;
472
+ }
473
+ }
474
+ );
475
+ } catch (error) {
476
+ wgm_initWpGmap( 40.73359922990751, -74.02791395625002, 'ROADMAP' );
477
+ wgm_center_lat = 40.73359922990751;
478
+ wgm_center_lng = -74.02791395625002;
479
+ }
480
  }
481
 
482
  /**
483
  * Disabled from 1.7.8 due to user request
484
  * Browser geo location success function
485
+ *
486
  * @param position
487
  * @since 1.0.0
488
  */
489
  // var wgm_browserGeolocationSuccess = function (position) {
490
+ // wgm_initWpGmap(position.coords.latitude, position.coords.longitude, 'ROADMAP');
491
+ // wgm_center_lat = position.coords.latitude;
492
+ // wgm_center_lng = position.coords.longitude;
493
  // };
494
 
495
 
496
 
497
  /**
498
  * Trying geo location
499
+ *
500
  * @since 1.0.0
501
  */
502
  var wgm_tryGeolocation = function () {
503
+ wgm_center_lat = 40.73359922990751;
504
+ wgm_center_lng = -74.02791395625002;
505
+ wgm_initWpGmap( 40.73359922990751, -74.02791395625002, 'ROADMAP' );
 
 
 
 
 
 
 
506
  };
507
 
508
 
509
  /**
510
  * On zoom level change, render map with new zoom level LIVE
511
+ *
512
  * @since 1.0.0
513
  */
514
+ jQuery( document.body ).find( '#wpgmap_map_zoom' ).on(
515
+ 'keyup',
516
+ function (element) {
517
+ // var point = wgm_marker1.getPosition(); // Get marker position
518
+ wgm_map.panTo( wgm_map.center ); // Pan map to that position
519
+ var current_zoom = parseInt( document.getElementById( 'wpgmap_map_zoom' ).value );
520
+ setTimeout( "wgm_map.setZoom(" + current_zoom + ")", 900 ); // Zoom in after 500 m second
521
+ }
522
+ );
523
 
524
  /**
525
  * On title field text change, update map title LIVE
526
+ *
527
  * @since 1.0.0
528
  */
529
+ jQuery( document.body ).find( '#wpgmap_title' ).on(
530
+ 'keyup',
531
+ function (element) {
532
+ jQuery( '#wpgmap_heading_preview' ).css( {'display': 'block'} ).html( jQuery( '#wpgmap_title' ).val() );
533
+ }
534
+ );
535
 
536
  /**
537
  * On map type change, render different types of map LIVE
538
+ *
539
  * @since 1.0.0
540
  */
541
+ jQuery( document.body ).find( '#wpgmap_map_type' ).on(
542
+ 'change',
543
+ function (element) {
544
+ // wgm_marker1.setMap(null);
545
+ var map_type = jQuery( this ).val();
546
+ // wgm_initWpGmap(wgm_map.center.lat(), wgm_map.center.lng(), map_type);
547
+ wgm_map.setMapTypeId( map_type.toLowerCase() );
548
+ }
549
+ );
550
+
551
 
552
  /**
553
+ * On map theme preset change, render different theme based map
554
+ *
555
+ * @since 1.8.6
556
  */
557
+ jQuery( document.body ).find( '#wpgmap_map_theme' ).on(
558
+ 'change',
559
+ function (element) {
560
+ var wgm_theme_json = JSON.parse(jQuery( this ).val());
561
+ wgm_map.setOptions({styles: wgm_theme_json});
562
+ jQuery( document.body ).find("#wgm_theme_json").val(jQuery( this ).val());
563
+ }
564
+ );
565
 
566
+ /**
567
+ * On map theme presets change, render different types of map based on theme
568
+ *
569
+ * @since 1.8.6
570
+ */
571
+ jQuery(document.body).find('#wgm_theme_json').on(
572
+ 'blur',
573
+ function (element) {
574
+ var wgm_theme_json = JSON.parse(jQuery(this).val());
575
+ wgm_map.setOptions({styles: wgm_theme_json});
576
+ }
577
+ );
578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  /**
580
+ * Rendering tab contents
581
+ *
582
  * @since 1.0.0
583
  */
584
+
585
+
586
+ jQuery( document.body ).find( '.wgm_wpgmap_tab li' ).on(
587
+ 'click',
588
+ function (e) {
589
+ e.preventDefault();
590
+ jQuery( '.wgm_wpgmap_tab li' ).removeClass( 'active' );
591
+ jQuery( this ).addClass( 'active' );
592
+
593
+ jQuery( '.wp-gmap-tab-contents' ).addClass( 'hidden' );
594
+ var wpgmap_id = jQuery( this ).attr( 'id' );
595
+ jQuery( '.' + wpgmap_id ).removeClass( 'hidden' );
596
+ if (wpgmap_id === 'wgm_gmap_markers') {
597
+ jQuery( '.wgm_gmap_marker_list' ).css( 'display', 'block' );
598
+ jQuery( '.add_new_marker_form' ).css( 'display', 'none' );
599
+ } else {
600
+ jQuery( '.wgm_gmap_marker_list' ).css( 'display', 'none' );
601
+ }
602
+ }
603
+ );
604
+
605
  // ========================================For Media Upload in Marker===================================
606
+ jQuery( document ).ready(
607
+ function ($) {
608
+
609
+ $( '#wpgmap_upload_marker_icon' ).click(
610
+ function () {
611
+ var custom_uploader;
612
+ if (custom_uploader) {
613
+ custom_uploader.open();
614
+ return;
615
+ }
616
+
617
+ custom_uploader = wp.media.frames.file_frame = wp.media(
618
+ {
619
+ title: 'Choose Image'
620
+ , button: {
621
+ text: 'Choose Image'
622
+ }
623
+ , multiple: false
624
+ }
625
+ );
626
+
627
+ custom_uploader.on(
628
+ 'select',
629
+ function () {
630
+ var attachment = custom_uploader.state().get( 'selection' ).first().toJSON();
631
+
632
+ var data = {
633
+ 'action': 'wpgmapembed_save_marker_icon',
634
+ 'data': {
635
+ icon_url: attachment.url,
636
+ ajax_nonce:wgm_l.ajax_nonce
637
+ }
638
+ };
639
+ jQuery.post(
640
+ ajaxurl,
641
+ data,
642
+ function (response) {
643
+ response = JSON.parse( response );
644
+ $( document.body ).find( "#wpgmap_marker_icon" ).val( response.icon_url );
645
+ $( document.body ).find( "#wpgmap_marker_icon_preview" ).attr( 'src', response.icon_url );
646
+ var elm = {};
647
+ elm.src = response.icon_url;
648
+ wpgmapChangeCurrentMarkerIcon( elm );
649
+ }
650
+ );
651
+ }
652
+ );
653
+
654
+ // Open the uploader dialog
655
+ custom_uploader.open();
656
+ }
657
+ );
658
+ }
659
+ );
660
 
661
  function generateMarkerInfoByRightClick(event) {
662
+ // Is markers tab active
663
+ if ( ! jQuery( '.add_new_marker_form' ).hasClass( 'wgm_active' )) {
664
+ return false;
665
+ }
666
+
667
+ if (wgm_new_marker != null) {
668
+ alert( 'Please save current marker at first!' );
669
+ return false;
670
+ }
671
+ var lat = event.latLng.lat();
672
+ var lng = event.latLng.lng();
673
+ wgm_new_marker = new google.maps.Marker(
674
+ {
675
+ title: "",
676
+ animation: google.maps.Animation.DROP,
677
+ position: event.latLng,
678
+ draggable: true,
679
+ map: wgm_map
680
+ }
681
+ );
682
+
683
+ if (is_marker_edit) {
684
+
685
+ wgm_existing_marker.setMap( null );
686
+ wgm_existing_marker = new google.maps.Marker(
687
+ {
688
+ title: "",
689
+ animation: google.maps.Animation.DROP,
690
+ position: event.latLng,
691
+ draggable: true,
692
+ map: wgm_map
693
+ }
694
+ );
695
+
696
+ wgm_generate_infowindow();
697
+
698
+ wgm_existing_marker_infoindow.open( {anchor: wgm_existing_marker, shouldFocus: false} );
699
+ wgm_addMarkerDragendListener( wgm_existing_marker );
700
+
701
+ } else {
702
+ wgm_generate_infowindow();
703
+ // wgm_new_marker_infoindow = new google.maps.InfoWindow({
704
+ // content: ''
705
+ // });
706
+ wgm_new_marker_infoindow.open( {anchor: wgm_new_marker, shouldFocus: false} );
707
+ wgm_addMarkerDragendListener( wgm_new_marker );
708
+ }
709
+
710
+ // populate yor box/field with lat, lng
711
+ jQuery( '#wpgmap_marker_lat_lng' ).val( lat + ',' + lng );
712
+ wgm_SetAddressByLatLng( lat, lng );
713
 
714
  }
715
 
716
  function tmce_setContent(content, editor_id, textarea_id) {
717
+ if (typeof editor_id == 'undefined') {
718
+ editor_id = wpActiveEditor;
719
+ }
720
+ if (typeof textarea_id == 'undefined') {
721
+ textarea_id = editor_id;
722
+ }
723
+
724
+ if (jQuery( '#wp-' + editor_id + '-wrap' ).hasClass( 'tmce-active' ) && tinyMCE.get( editor_id )) {
725
+ content = content.replace( /&gt;/g, '>' ).replace( /&lt;/g, '<' );
726
+ return tinyMCE.get( editor_id ).setContent( content );
727
+ } else {
728
+ return jQuery( '#' + textarea_id ).val( content );
729
+ }
730
  }
731
 
732
  function tmce_getContent(editor_id, textarea_id) {
733
+ if (typeof editor_id == 'undefined') {
734
+ editor_id = wpActiveEditor;
735
+ }
736
+ if (typeof textarea_id == 'undefined') {
737
+ textarea_id = editor_id;
738
+ }
739
+
740
+ if (jQuery( '#wp-' + editor_id + '-wrap' ).hasClass( 'tmce-active' ) && tinyMCE.get( editor_id )) {
741
+ return tinyMCE.get( editor_id ).getContent();
742
+ } else {
743
+ return jQuery( '#' + textarea_id ).val();
744
+ }
745
  }
746
 
747
  var marker_name_info_content = '', marker_desc_info_content = '';
748
 
749
  function populateMarkerInfowindow() {
750
+ var final_content = marker_name_info_content + marker_desc_info_content;
751
+ if (wgm_existing_marker_infoindow !== null) {
752
+ wgm_existing_marker_infoindow.setContent( final_content );
753
+ }
 
 
 
 
754
  }
755
 
756
 
757
+ jQuery( document ).ready(
758
+ function ($) {
759
+
760
+ // ==============================
761
+ // Create 'keyup_event' tinymce plugin
762
+ tinymce.PluginManager.add(
763
+ 'keyup_event',
764
+ function (editor, url) {
765
+ if (editor.id === 'wpgmap_marker_desc') {
766
+
767
+ // Create keyup event
768
+ editor.on(
769
+ 'keyup',
770
+ function (e) {
771
+ // Get the editor content (html)
772
+ // var get_ed_content = tinymce.activeEditor.getContent();
773
+ // wpgmapMarkerDescGenerate(get_ed_content);
774
+ wgm_generate_infowindow();
775
+ }
776
+ );
777
+ }
778
+ }
779
+ );
780
+
781
+ jQuery( '#wpgmap_marker_name,#wpgmap_marker_desc' ).on(
782
+ 'keyup',
783
+ function (element) {
784
+ wgm_generate_infowindow();
785
+ }
786
+ );
787
+ jQuery( document.body ).find( '#wpgmap_marker_link' ).on(
788
+ 'blur',
789
+ function (event) {
790
+ var wgm_marker_url = jQuery( this ).val();
791
+ if (is_marker_edit === true) {
792
+ wgm_existing_marker.url = wgm_marker_url;
793
+ google.maps.event.addListener(
794
+ wgm_existing_marker,
795
+ 'click',
796
+ function () {
797
+ var wgm_target = '_self';
798
+ if ($( '#wpgmap_marker_link_new_tab' ).is( ':checked' )) {
799
+ wgm_target = '_blank';
800
+ }
801
+ window.open( this.url, wgm_target );
802
+ }
803
+ );
804
+ } else {
805
+ if (wgm_new_marker !== null) {
806
+ wgm_new_marker.url = wgm_marker_url;
807
+ google.maps.event.addListener(
808
+ wgm_new_marker,
809
+ 'click',
810
+ function () {
811
+ var wgm_target = '_self';
812
+ if (jQuery( '#wpgmap_marker_link_new_tab' ).is( ':checked' )) {
813
+ wgm_target = '_blank';
814
+ }
815
+ window.open( this.url, wgm_target );
816
+ }
817
+ );
818
+ }
819
+ }
820
+
821
+ }
822
+ );
823
+
824
+ function generateMarkersListView() {
825
+ $( '#wgm_gmap_marker_list' ).DataTable().ajax.reload();
826
+ }
827
+
828
+ // Marker delete
829
+ jQuery( document.body ).on(
830
+ 'click',
831
+ '.wpgmap_marker_trash',
832
+ function (event) {
833
+ event.preventDefault();
834
+ var parent = $( this ).parents().eq( 4 );
835
+ parent.find( '.spinner' ).css( 'visibility', 'visible' );
836
+ if (confirm( 'Are you sure to delete?' )) {
837
+ var marker_id = jQuery( this ).attr( 'map_marker_id' );
838
+ var data = {
839
+ 'action': 'wpgmapembed_delete_marker',
840
+ 'data': {
841
+ marker_id: marker_id,
842
+ ajax_nonce:wgm_l.ajax_nonce
843
+ }
844
+ };
845
+ jQuery.post(
846
+ ajaxurl,
847
+ data,
848
+ function (response) {
849
+ response = JSON.parse( response );
850
+ generateMarkersListView();
851
+ parent.find( '.spinner' ).css( 'visibility', 'hidden' );
852
+ current_map_markers[parseInt( marker_id )].setMap( null );
853
+ current_map_markers.splice( parseInt( marker_id ), 1 );
854
+ current_map_infowindows.splice( parseInt( marker_id ), 1 );
855
+
856
+ $( document.body ).find( '#marker_success' ).html( 'Marker removed successfully.' );
857
+ wgm_no_of_marker--;
858
+ if (wgm_no_of_marker === 0 && wgm_l.is_premium_user !== '1') {
859
+ jQuery( '.add_new_marker_btn_area' ).find( ".add_new_marker" ).css(
860
+ {
861
+ 'opacity': 1
862
+ }
863
+ );
864
+ jQuery( '.add_new_marker_btn_area' ).find( ".wgm-pro-label" ).hide();
865
+ }
866
+ }
867
+ );
868
+ }
869
+ }
870
+ );
871
+
872
+ // Marker delete
873
+ jQuery( document.body ).on(
874
+ 'click',
875
+ '.wpgmap_marker_view',
876
+ function (event) {
877
+ event.preventDefault();
878
+ var parent = $( this ).parents().eq( 4 );
879
+ parent.find( '.spinner' ).css( 'visibility', 'visible' );
880
+ var marker_id = jQuery( this ).attr( 'map_marker_id' );
881
+ wgm_existing_marker = current_map_markers[marker_id];
882
+ wgm_map.panTo( wgm_existing_marker.getPosition() );
883
+ }
884
+ );
885
+
886
+ // Marker Edit
887
+ jQuery( document.body ).on(
888
+ 'click',
889
+ '.wpgmap_marker_edit',
890
+ function (event) {
891
+ event.preventDefault();
892
+ is_marker_edit = true;
893
+ var parent = $( this ).parents().eq( 4 );
894
+ parent.find( '.spinner' ).css( 'visibility', 'visible' );
895
+ var marker_id = jQuery( this ).attr( 'map_marker_id' );
896
+ wgm_existing_marker = current_map_markers[marker_id];
897
+ var data = {
898
+ 'action': 'wpgmapembed_get_marker_data_by_marker_id',
899
+ 'data': {
900
+ marker_id: marker_id,
901
+ ajax_nonce:wgm_l.ajax_nonce
902
+ }
903
+ };
904
+ jQuery.post(
905
+ ajaxurl,
906
+ data,
907
+ function (response) {
908
+ response = JSON.parse( response );
909
+ $( '#wpgmap_marker_name' ).val( response.marker_name );
910
+ $( '#wpgmap_marker_address' ).val( response.address );
911
+ var wgm_marker_lat_lng = response.lat_lng.split( ',' );
912
+ $( '#wpgmap_marker_lat_lng' ).val( wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1] );
913
+ $( '#wpgmap_marker_link' ).val( response.marker_link );
914
+ $( '#wpgmap_marker_icon' ).val( response.icon );
915
+ if (response.have_marker_link === '1') {
916
+ $( "#wpgmap_marker_link_area" ).show();
917
+ } else {
918
+ $( "#wpgmap_marker_link_area" ).hide();
919
+ }
920
+ $( '#wpgmap_marker_link_new_tab' ).prop( 'checked', response.marker_link_new_tab === "1" );
921
+ $( '#wpgmap_marker_infowindow_show' ).val( response.show_desc_by_default ).change();
922
+ $( '#wpgmap_have_marker_link' ).val( response.have_marker_link ).change();
923
+ $( '.wpgmap_marker_add,.wpgmap_marker_update' ).attr( 'markerid', marker_id );
924
+ $( '.wpgmap_marker_add' ).removeClass( 'wpgmap_marker_add' ).addClass( 'wpgmap_marker_update' ).css( 'background-color', '#00a2f3' ).html( '<i class="dashicons dashicons-location" style="line-height: 1.6;"></i><b>Update Marker</b>' );
925
+ // Reset wp editor content
926
+ tmce_setContent( response.marker_desc, 'wpgmap_marker_desc', 'wpgmap_marker_desc' );
927
+ parent.find( '.spinner' ).css( 'visibility', 'hidden' );
928
+
929
+ $( document.body ).find( '.add_new_marker_form' ).show();
930
+ $( document.body ).find( '.wgm_gmap_marker_list' ).hide();
931
+ $( document.body ).find( '#marker_errors,#marker_success' ).html( '' );
932
+ $( document.body ).find( "#wpgmap_marker_icon_preview" ).attr( 'src', response.icon );
933
+ wgm_map.panTo( wgm_existing_marker.getPosition() );
934
+ current_map_markers[marker_id].setDraggable( true );
935
+ wgm_addMarkerDragendListener( current_map_markers[marker_id] );
936
+ wgm_existing_marker_infoindow = new google.maps.InfoWindow(
937
+ {
938
+ content: '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + response.marker_name + '</span>' + response.address
939
+ }
940
+ );
941
+ }
942
+ );
943
+ }
944
+ );
945
+
946
+ }
947
+ );
948
 
949
 
950
  function wpgmapChangeCurrentMarkerIcon(elem) {
951
+ var icon_url = elem.src;
952
+ document.getElementById( 'wpgmap_marker_icon' ).value = icon_url;
953
+ document.getElementById( 'wpgmap_marker_icon_preview' ).src = icon_url;
954
+ jQuery( '#TB_closeWindowButton' ).click();
955
+ if (is_marker_edit) {
956
+ if (wgm_existing_marker !== null) {
957
+ wgm_existing_marker.setIcon( icon_url );
958
+ }
959
+ } else {
960
+ if (wgm_new_marker !== null) {
961
+ wgm_new_marker.setIcon( icon_url );
962
+ }
963
+ }
964
  }
965
 
966
  wgm_tryGeolocation();
admin/assets/js/geo_based_map_edit.js CHANGED
@@ -4,13 +4,13 @@ var wgm_map, wgm_marker1, wgm_infowindow,
4
  current_map_markers = [],
5
  current_map_infowindows = [],
6
 
7
- //new marker
8
  wgm_new_marker = null,
9
  wgm_new_marker_infoindow = null,
10
 
11
  wgm_new_marker_name = '', wgm_new_marker_desc = '',
12
 
13
- //existing marker
14
  wgm_existing_marker,
15
  wgm_existing_marker_infoindow = null,
16
  wgm_existing_marker_name = '', wgm_existing_marker_desc = '',
@@ -18,11 +18,11 @@ var wgm_map, wgm_marker1, wgm_infowindow,
18
  wgm_custom_marker,
19
  custom_marker_infowindow,
20
  is_marker_edit = false,
21
- wgm_no_of_marker = 0
22
- ;
23
 
24
  /**
25
  * Select element by ID
 
26
  * @param id
27
  * @return html_element
28
  * @since 1.0.0
@@ -36,7 +36,7 @@ function _wgm_e(id) {
36
  function wgm_generate_infowindow() {
37
 
38
  if (is_marker_edit === true) {
39
- //current_map_infowindows
40
  var marker_id = parseInt(jQuery('.wpgmap_marker_update').attr('markerid'));
41
  // info window object for New Marker creating if not initiated yet
42
  wgm_existing_marker_infoindow = current_map_infowindows[marker_id];
@@ -57,9 +57,11 @@ function wgm_generate_infowindow() {
57
  } else {
58
  // info window object for New Marker creating if not initiated yet
59
  if (wgm_new_marker_infoindow === null) {
60
- wgm_new_marker_infoindow = new google.maps.InfoWindow({
61
- content: ''
62
- });
 
 
63
  }
64
 
65
  // Info window contents generating from input and editor
@@ -80,50 +82,51 @@ function wgm_generate_infowindow() {
80
 
81
  /**
82
  * Defining Map event listeners
 
83
  * @param wgm_map object
84
  * @since 1.0.0
85
  */
86
  function wgm_addMapListeners(wgm_map) {
87
 
88
  // On map center changed
89
- wgm_map.addListener("center_changed", function () {
90
- jQuery('#wpgmap_center_lat_lng').val(wgm_map.center.lat() + ',' + wgm_map.center.lng());
91
- });
 
 
 
92
 
93
  // On map zoom level changed
94
- wgm_map.addListener("zoom_changed", function () {
95
- jQuery('#wpgmap_map_zoom').val(wgm_map.zoom);
96
- });
 
 
 
97
  }
98
 
99
  /**
100
  * In case of already initialized map
 
101
  * @param map_type
102
  * @param center_lat
103
  * @param center_lng
104
  * @since 1.0.0
105
  */
106
  function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
107
- if (map_type === 'ROADMAP') {
108
  wgm_map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
109
- } else if (map_type === 'SATELLITE') {
110
  wgm_map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
111
- } else if (map_type === 'HYBRID') {
112
  wgm_map.setMapTypeId(google.maps.MapTypeId.HYBRID);
113
- } else if (map_type === 'TERRAIN') {
114
  wgm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
115
  }
116
 
117
  wgm_map.setCenter({lat: center_lat, lng: center_lng});
118
- // wgm_marker1 = new google.maps.Marker({
119
- // position: new google.maps.LatLng(center_lat, center_lng),
120
- // title: "",
121
- // draggable: true,
122
- // animation: google.maps.Animation.DROP
123
- // });
124
- // wgm_marker1.setMap(wgm_map);
125
-
126
- //Add Map listeners
127
  wgm_addMapListeners(wgm_map);
128
 
129
  // Adding dragend Event Listener
@@ -132,6 +135,7 @@ function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
132
 
133
  /**
134
  * Update map settings
 
135
  * @param map_type
136
  * @param center_lat
137
  * @param center_lng
@@ -139,20 +143,19 @@ function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
139
  * @returns {{mapTypeId: *, center: {lng, lat}, zoom}}
140
  * @since 1.0.0
141
  */
142
- //
143
  function wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom) {
144
  var wgm_gmap_settings = {
145
  center: {lat: center_lat, lng: center_lng},
146
  zoom: zoom,
147
  mapTypeId: google.maps.MapTypeId.ROADMAP
148
  };
149
- if (map_type === 'ROADMAP') {
150
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.ROADMAP;
151
- } else if (map_type === 'SATELLITE') {
152
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.SATELLITE;
153
- } else if (map_type === 'HYBRID') {
154
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.HYBRID;
155
- } else if (map_type === 'TERRAIN') {
156
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.TERRAIN;
157
  }
158
  return wgm_gmap_settings;
@@ -160,19 +163,23 @@ function wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom) {
160
 
161
  /**
162
  * Defining Marker listener
 
163
  * @param marker
164
  * @since 1.0.0
165
  */
166
  function wgm_addMarkerDragendListener(marker) {
167
- marker.addListener('dragend', function (markerLocation) {
168
- _wgm_e("wpgmap_marker_lat_lng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
169
- // wgm_SetAddressByLatLng(markerLocation.latLng.lat(), markerLocation.latLng.lng());
170
- });
 
 
171
  }
172
 
173
 
174
  /**
175
  * Map autocomplete implementation
 
176
  * @param id
177
  * @param input
178
  * @param center_lat
@@ -192,21 +199,17 @@ function wgm_initAutocomplete(id, input, center_lat, center_lng, map_type, zoom)
192
  var wgm_gmap_settings = wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom);
193
 
194
  wgm_map = new google.maps.Map(_wgm_e(id), wgm_gmap_settings);
195
- // wgm_marker1 = new google.maps.Marker({
196
- // position: new google.maps.LatLng(gmap_object.current_map_marker_lat, gmap_object.current_map_marker_lng),
197
- // title: "",
198
- // draggable: true,
199
- // animation: google.maps.Animation.DROP,
200
- // icon: wgm_icon
201
- // });
202
-
203
- // Invoking Marker event listener
204
- // wgm_addMarkerDragendListener(wgm_marker1);
205
- // wgm_marker1.setMap(wgm_map);
206
 
207
- google.maps.event.addListener(wgm_map, "rightclick", function (event) {
208
- generateMarkerInfoByRightClick(event);
209
- });
 
 
 
 
210
 
211
  // // Create the search box and link it to the UI element.
212
  var wgm_input = document.getElementById(input);
@@ -214,7 +217,7 @@ function wgm_initAutocomplete(id, input, center_lat, center_lng, map_type, zoom)
214
 
215
  // Place input search box
216
  wgm_map.controls[google.maps.ControlPosition.TOP_LEFT].push(wgm_input);
217
- //=====================showing multiple marker=============
218
  var data = {
219
  'action': 'wpgmapembed_get_markers_by_map_id',
220
  'data': {
@@ -223,68 +226,82 @@ function wgm_initAutocomplete(id, input, center_lat, center_lng, map_type, zoom)
223
  }
224
  };
225
 
226
- jQuery.post(ajaxurl, data, function (response) {
227
- response = JSON.parse(response);
228
- wgm_no_of_marker = response.markers.length;
 
 
 
229
 
230
- // Show hints for Marker creation
231
- if (wgm_no_of_marker === 0) {
232
- jQuery(document.body).find(".wgm_marker_create_hints").show();
233
- }
234
 
235
- if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
236
- jQuery('.add_new_marker_btn_area').find(".add_new_marker").css({
237
- 'opacity': .5
238
- });
239
- jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").show();
240
- }
241
- if (response.markers.length > 0) {
242
- response.markers.forEach(function (marker) {
243
- var marker_lat_lng = marker.lat_lng.split(',');
244
-
245
- var wgm_custom_marker_options = {
246
- position: new google.maps.LatLng(marker_lat_lng[0], marker_lat_lng[1]),
247
- title: marker.marker_name,
248
- animation: google.maps.Animation.DROP,
249
- };
250
 
251
- // Set Icon
252
- if (marker.icon !== '') {
253
- wgm_custom_marker_options.icon = marker.icon;
 
 
254
 
255
- }
 
 
256
 
257
- // Set marker URL
258
- if (marker.have_marker_link === '1') {
259
- wgm_custom_marker_options.url = marker.marker_link;
260
- }
261
- wgm_custom_marker = new google.maps.Marker(wgm_custom_marker_options);
262
- if (marker.have_marker_link === '1') {
263
- google.maps.event.addListener(wgm_custom_marker, 'click', function () {
264
- var wgm_target = '_self';
265
- if (marker.marker_link_new_tab === '1') {
266
- wgm_target = '_blank';
267
  }
268
- window.open(this.url, wgm_target);
269
- });
270
- }
271
 
272
- wgm_custom_marker.setMap(wgm_map);
273
- marker.marker_desc = marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
274
- var marker_name = (marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
275
- + marker.marker_name +
276
- '</span><br/>') : '';
277
- custom_marker_infowindow = new google.maps.InfoWindow({
278
- content: marker_name + marker.marker_desc
279
- });
280
- if (marker.show_desc_by_default === '1') {
281
- custom_marker_infowindow.open({anchor: wgm_custom_marker, shouldFocus: false});
282
- }
283
- current_map_markers[parseInt(marker.id)] = wgm_custom_marker;
284
- current_map_infowindows[parseInt(marker.id)] = custom_marker_infowindow;
285
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  }
287
- });
288
 
289
  // multiple marker showing end
290
 
@@ -292,62 +309,63 @@ function wgm_initAutocomplete(id, input, center_lat, center_lng, map_type, zoom)
292
  wgm_addMapListeners(wgm_map);
293
 
294
  // Bias the SearchBox results towards current map's viewport.
295
- wgm_map.addListener('bounds_changed', function () {
296
- wgm_searchBox.setBounds(wgm_map.getBounds());
297
- });
 
 
 
298
 
299
  var wgm_markers = [];
300
  // Listen for the event fired when the user selects a prediction and retrieve
301
  // more details for that place.
302
- wgm_searchBox.addListener('places_changed', function () {
303
- // wgm_marker1.setMap(null);
304
- var wgm_places = wgm_searchBox.getPlaces();
 
 
305
 
306
- if (wgm_places.length === 0) {
307
- return;
308
- }
309
- // wgm_marker1.setMap(null);
310
- // Clear out the old markers.
311
- wgm_markers.forEach(function (marker) {
312
- marker.setMap(null);
313
- });
314
- wgm_markers = [];
315
-
316
- // For each place, get the icon, name and location.
317
- var wgm_bounds = new google.maps.LatLngBounds();
318
- wgm_places.forEach(function (place) {
319
- if (!place.geometry) {
320
- console.log("Returned place contains no geometry");
321
  return;
322
  }
323
- // Create a marker for each place.
324
- // wgm_marker1 = new google.maps.Marker({
325
- // map: wgm_map,
326
- // title: place.name,
327
- // draggable: true,
328
- // position: place.geometry.location,
329
- // icon: wgm_icon
330
- // });
331
- // wgm_markers.push(wgm_marker1);
332
- // wgm_marker1.position = place.geometry.location;
333
-
334
- _wgm_e("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
335
-
336
- if (place.geometry.viewport) {
337
- // Only geocodes have viewport.
338
- wgm_bounds.union(place.geometry.viewport);
339
- } else {
340
- wgm_bounds.extend(place.geometry.location);
341
- }
342
- });
343
- wgm_map.fitBounds(wgm_bounds);
344
- // Add Marker event listener
345
- // wgm_addMarkerDragendListener(wgm_markers[0]);
346
- });
 
 
 
 
 
 
 
 
 
347
  }
348
 
349
  /**
350
  * Initialize Google Map
 
351
  * @param lat
352
  * @param lng
353
  * @param map_type
@@ -360,118 +378,152 @@ function wgm_initWpGmap(lat, lng, map_type) {
360
 
361
  /**
362
  * On zoom level change, render map with new zoom level LIVE
 
363
  * @since 1.0.0
364
  */
365
- jQuery(document.body).find('#wpgmap_map_zoom').on('keyup', function (element) {
366
- // var point = wgm_marker1.getPosition(); // Get marker position
367
- wgm_map.panTo(wgm_map.center); // Pan map to that position
368
- var current_zoom = parseInt(document.getElementById('wpgmap_map_zoom').value);
369
- setTimeout("wgm_map.setZoom(" + current_zoom + ")", 800); // Zoom in after 500 m second
370
- });
 
 
 
371
 
372
  /**
373
  * On title field text change, update map title LIVE
 
374
  * @since 1.0.0
375
  */
376
- jQuery(document.body).find('#wpgmap_title').on('keyup', function (element) {
377
- jQuery('#wpgmap_heading_preview').css({'display': 'block'}).html(jQuery('#wpgmap_title').val());
378
- });
 
 
 
379
 
380
  /**
381
  * On map type change, render different types of map LIVE
 
382
  * @since 1.0.0
383
  */
384
- jQuery(document.body).find('#wpgmap_map_type').on('change', function (element) {
385
- // wgm_marker1.setMap(null);
386
- var map_type = jQuery(this).val();
387
- wgm_map.setMapTypeId(map_type.toLowerCase());
388
- });
 
 
 
389
 
390
 
391
  /**
392
- * Rendering tab contents
393
- * @since 1.0.0
 
394
  */
395
- jQuery(document.body).find('.wgm_wpgmap_tab li').on('click', function (e) {
396
- e.preventDefault();
397
- jQuery('.wgm_wpgmap_tab li').removeClass('active');
398
- jQuery(this).addClass('active');
399
-
400
- jQuery('.wp-gmap-tab-contents').addClass('hidden');
401
- var wpgmap_id = jQuery(this).attr('id');
402
- jQuery('.' + wpgmap_id).removeClass('hidden');
403
- if (wpgmap_id === 'wgm_gmap_markers') {
404
- jQuery('.wgm_gmap_marker_list').css('display', 'block');
405
- jQuery('.add_new_marker_form').css('display', 'none');
406
- } else {
407
- jQuery('.wgm_gmap_marker_list').css('display', 'none');
408
  }
409
- });
410
 
411
  /**
412
- * Disabled from - 1.7.8, moved to markers tab
413
- * Map marker icon updating
 
 
 
 
 
 
 
 
 
 
 
 
 
414
  * @since 1.0.0
415
  */
416
- // jQuery(document).ready(function ($) {
417
- //
418
- // $('#wgm_upload_image_button').click(function () {
419
- //
420
- // var formfield = $('#wgm_upload_image').attr('name');
421
- // tb_show('Upload your marker image', 'media-upload.php?type=image&amp;TB_iframe=true');
422
- // window.send_to_editor = function (html) {
423
- // wgm_icon = $(html).attr('src');
424
- // $('#wpgmap_upload_hidden').val(wgm_icon);
425
- // tb_remove();
426
- // wgm_marker1.setIcon(wgm_icon);
427
- // jQuery("#wpgmap_icon_img").attr('src', wgm_icon);
428
- // };
429
- // return false;
430
- // });
431
- // });
 
 
432
 
433
  // ========================================For Media Upload in Marker===================================
434
- jQuery(document).ready(function ($) {
 
 
 
 
 
 
 
 
 
435
 
436
- $('#wpgmap_upload_marker_icon').click(function () {
437
- var custom_uploader;
438
- if (custom_uploader) {
439
- custom_uploader.open();
440
- return;
441
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
442
 
443
- custom_uploader = wp.media.frames.file_frame = wp.media({
444
- title: 'Choose Image'
445
- , button: {
446
- text: 'Choose Image'
447
  }
448
- , multiple: false
449
- });
450
-
451
- custom_uploader.on('select', function () {
452
- var attachment = custom_uploader.state().get('selection').first().toJSON();
453
-
454
- var data = {
455
- 'action': 'wpgmapembed_save_marker_icon',
456
- 'data': {
457
- icon_url: attachment.url,
458
- ajax_nonce:wgm_l.ajax_nonce
459
- }
460
- };
461
- jQuery.post(ajaxurl, data, function (response) {
462
- response = JSON.parse(response);
463
- $(document.body).find("#wpgmap_marker_icon").val(response.icon_url);
464
- $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon_url);
465
- var elm = {};
466
- elm.src = response.icon_url;
467
- wpgmapChangeCurrentMarkerIcon(elm);
468
- });
469
- });
470
-
471
- //Open the uploader dialog
472
- custom_uploader.open();
473
- });
474
- });
475
 
476
  function generateMarkerInfoByRightClick(event) {
477
  // Is markers tab active
@@ -485,24 +537,28 @@ function generateMarkerInfoByRightClick(event) {
485
  }
486
  var lat = event.latLng.lat();
487
  var lng = event.latLng.lng();
488
- wgm_new_marker = new google.maps.Marker({
489
- title: "",
490
- animation: google.maps.Animation.DROP,
491
- position: event.latLng,
492
- draggable: true,
493
- map: wgm_map
494
- });
495
-
496
- if (is_marker_edit) {
497
-
498
- wgm_existing_marker.setMap(null);
499
- wgm_existing_marker = new google.maps.Marker({
500
  title: "",
501
  animation: google.maps.Animation.DROP,
502
  position: event.latLng,
503
  draggable: true,
504
  map: wgm_map
505
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
 
507
  wgm_generate_infowindow();
508
 
@@ -510,9 +566,6 @@ function generateMarkerInfoByRightClick(event) {
510
  wgm_addMarkerDragendListener(wgm_existing_marker);
511
 
512
  } else {
513
- // wgm_new_marker_infoindow = new google.maps.InfoWindow({
514
- // content: ''
515
- // });
516
  wgm_generate_infowindow();
517
  wgm_new_marker_infoindow.open({anchor: wgm_new_marker, shouldFocus: false});
518
  wgm_addMarkerDragendListener(wgm_new_marker);
@@ -521,13 +574,16 @@ function generateMarkerInfoByRightClick(event) {
521
 
522
  // populate yor box/field with lat, lng
523
  jQuery('#wpgmap_marker_lat_lng').val(lat + ',' + lng);
524
- // wgm_SetAddressByLatLng(lat, lng);
525
 
526
  }
527
 
528
  function tmce_setContent(content, editor_id, textarea_id) {
529
- if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
530
- if (typeof textarea_id == 'undefined') textarea_id = editor_id;
 
 
 
 
531
 
532
  if (jQuery('#wp-' + editor_id + '-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
533
  content = content.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
@@ -538,8 +594,12 @@ function tmce_setContent(content, editor_id, textarea_id) {
538
  }
539
 
540
  function tmce_getContent(editor_id, textarea_id) {
541
- if (typeof editor_id == 'undefined') editor_id = wpActiveEditor;
542
- if (typeof textarea_id == 'undefined') textarea_id = editor_id;
 
 
 
 
543
 
544
  if (jQuery('#wp-' + editor_id + '-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
545
  return tinyMCE.get(editor_id).getContent();
@@ -551,10 +611,6 @@ function tmce_getContent(editor_id, textarea_id) {
551
  var marker_name_info_content = '', marker_desc_info_content = '';
552
 
553
  function populateMarkerInfowindow() {
554
- // if (noActiveIW()) {
555
- // alert('At first you need to right click on Map to point your marker position.');
556
- // return false;
557
- // }
558
  var final_content = marker_name_info_content + marker_desc_info_content;
559
  if (wgm_existing_marker_infoindow !== null) {
560
  wgm_existing_marker_infoindow.setContent(final_content);
@@ -562,150 +618,191 @@ function populateMarkerInfowindow() {
562
  }
563
 
564
 
565
- jQuery(document).ready(function ($) {
 
566
 
 
 
 
 
 
 
567
 
568
- //==============================
569
- // Create 'keyup_event' tinymce plugin
570
- tinymce.PluginManager.add('keyup_event', function (editor, url) {
571
- if (editor.id === 'wpgmap_marker_desc') {
 
 
 
 
 
 
572
 
573
- // Create keyup event
574
- editor.on('keyup', function (e) {
575
- // Get the editor content (html)
576
- // var get_ed_content = tinymce.activeEditor.getContent();
577
- //wpgmapMarkerDescGenerate(get_ed_content);
578
  wgm_generate_infowindow();
579
- });
580
- }
581
- });
582
-
583
- jQuery('#wpgmap_marker_name,#wpgmap_marker_desc').on('keyup', function (element) {
584
- wgm_generate_infowindow();
585
- });
586
-
587
-
588
- jQuery(document.body).find('#wpgmap_marker_link').on('blur', function (event) {
589
- var wgm_marker_url = jQuery(this).val();
590
- if (is_marker_edit === true) {
591
- wgm_existing_marker.url = wgm_marker_url;
592
- google.maps.event.addListener(wgm_existing_marker, 'click', function () {
593
- var wgm_target = '_self';
594
- if ($('#wpgmap_marker_link_new_tab').is(':checked')) {
595
- wgm_target = '_blank';
596
- }
597
- window.open(this.url, wgm_target);
598
- });
599
- } else {
600
- if (wgm_new_marker !== null) {
601
- wgm_new_marker.url = wgm_marker_url;
602
- google.maps.event.addListener(wgm_new_marker, 'click', function () {
603
- var wgm_target = '_self';
604
- if (jQuery('#wpgmap_marker_link_new_tab').is(':checked')) {
605
- wgm_target = '_blank';
 
 
 
 
 
 
 
606
  }
607
- window.open(this.url, wgm_target);
608
- });
609
  }
610
- }
611
- });
612
 
613
- function generateMarkersListView() {
614
- $('#wgm_gmap_marker_list').DataTable().ajax.reload();
615
- }
616
 
617
- // Marker delete
618
- jQuery(document.body).on('click', '.wpgmap_marker_trash', function (event) {
619
- event.preventDefault();
620
- var parent = $(this).parents().eq(4);
621
- parent.find('.spinner').css('visibility', 'visible');
622
- if (confirm('Are you sure to delete?')) {
623
- var marker_id = jQuery(this).attr('map_marker_id');
624
- var data = {
625
- 'action': 'wpgmapembed_delete_marker',
626
- 'data': {
627
- marker_id: marker_id,
628
- ajax_nonce:wgm_l.ajax_nonce
629
- }
630
- };
631
- jQuery.post(ajaxurl, data, function (response) {
632
- response = JSON.parse(response);
633
- generateMarkersListView();
634
- parent.find('.spinner').css('visibility', 'hidden');
635
- current_map_markers[parseInt(marker_id)].setMap(null);
636
- $(document.body).find('#marker_success').html('Marker removed successfully.');
637
- wgm_no_of_marker--;
638
- if (wgm_no_of_marker === 0 && wgm_l.is_premium_user !== '1') {
639
- jQuery('.add_new_marker_btn_area').find(".add_new_marker").css({
640
- 'opacity': 1
641
- });
642
- jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").hide();
 
 
 
 
 
 
 
 
 
 
 
643
  }
644
- });
645
- }
646
- });
647
-
648
- // Marker delete
649
- jQuery(document.body).on('click', '.wpgmap_marker_view', function (event) {
650
- event.preventDefault();
651
- var parent = $(this).parents().eq(4);
652
- parent.find('.spinner').css('visibility', 'visible');
653
- var marker_id = jQuery(this).attr('map_marker_id');
654
- wgm_existing_marker = current_map_markers[marker_id];
655
- wgm_map.panTo(wgm_existing_marker.getPosition());
656
- });
657
-
658
- // Marker Edit
659
- jQuery(document.body).on('click', '.wpgmap_marker_edit', function (event) {
660
- event.preventDefault();
661
- is_marker_edit = true;
662
- var parent = $(this).parents().eq(4);
663
- parent.find('.spinner').css('visibility', 'visible');
664
- var marker_id = jQuery(this).attr('map_marker_id');
665
- wgm_existing_marker = current_map_markers[marker_id];
666
- var data = {
667
- 'action': 'wpgmapembed_get_marker_data_by_marker_id',
668
- 'data': {
669
- marker_id: marker_id,
670
- ajax_nonce:wgm_l.ajax_nonce
671
  }
672
- };
673
- jQuery.post(ajaxurl, data, function (response) {
674
- response = JSON.parse(response);
675
- $('#wpgmap_marker_name').val(response.marker_name);
676
- $('#wpgmap_marker_address').val(response.address);
677
- var wgm_marker_lat_lng = response.lat_lng.split(',');
678
- $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
679
- $('#wpgmap_marker_link').val(response.marker_link);
680
- $('#wpgmap_marker_icon').val(response.icon);
681
- if (response.have_marker_link === '1') {
682
- $("#wpgmap_marker_link_area").show();
683
- } else {
684
- $("#wpgmap_marker_link_area").hide();
685
  }
686
- $('#wpgmap_marker_link_new_tab').prop('checked', response.marker_link_new_tab === "1");
687
- $('#wpgmap_marker_infowindow_show').val(response.show_desc_by_default).change();
688
- $('#wpgmap_have_marker_link').val(response.have_marker_link).change();
689
- $('.wpgmap_marker_add,.wpgmap_marker_update').attr('markerid', marker_id);
690
- $('.wpgmap_marker_add').removeClass('wpgmap_marker_add').addClass('wpgmap_marker_update').css('background-color', '#00a2f3').html('<i class="dashicons dashicons-location" style="line-height: 1.6;"></i><b>Update Marker</b>');
691
- // Reset wp editor content
692
- tmce_setContent(response.marker_desc, 'wpgmap_marker_desc', 'wpgmap_marker_desc');
693
- parent.find('.spinner').css('visibility', 'hidden');
694
-
695
- $(document.body).find('.add_new_marker_form').show();
696
- $(document.body).find('.wgm_gmap_marker_list').hide();
697
- $(document.body).find('#marker_errors,#marker_success').html('');
698
- $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon);
699
- wgm_map.panTo(wgm_existing_marker.getPosition());
700
- current_map_markers[marker_id].setDraggable(true);
701
- wgm_addMarkerDragendListener(current_map_markers[marker_id]);
702
- wgm_existing_marker_infoindow = new google.maps.InfoWindow({
703
- content: '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + response.marker_name + '</span>' + response.address
704
- });
705
- });
706
- });
707
-
708
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
709
 
710
 
711
  function wpgmapChangeCurrentMarkerIcon(elem) {
@@ -722,4 +819,4 @@ function wpgmapChangeCurrentMarkerIcon(elem) {
722
  wgm_new_marker.setIcon(icon_url);
723
  }
724
  }
725
- }
4
  current_map_markers = [],
5
  current_map_infowindows = [],
6
 
7
+ // new marker
8
  wgm_new_marker = null,
9
  wgm_new_marker_infoindow = null,
10
 
11
  wgm_new_marker_name = '', wgm_new_marker_desc = '',
12
 
13
+ // existing marker
14
  wgm_existing_marker,
15
  wgm_existing_marker_infoindow = null,
16
  wgm_existing_marker_name = '', wgm_existing_marker_desc = '',
18
  wgm_custom_marker,
19
  custom_marker_infowindow,
20
  is_marker_edit = false,
21
+ wgm_no_of_marker = 0;
 
22
 
23
  /**
24
  * Select element by ID
25
+ *
26
  * @param id
27
  * @return html_element
28
  * @since 1.0.0
36
  function wgm_generate_infowindow() {
37
 
38
  if (is_marker_edit === true) {
39
+ // current_map_infowindows
40
  var marker_id = parseInt(jQuery('.wpgmap_marker_update').attr('markerid'));
41
  // info window object for New Marker creating if not initiated yet
42
  wgm_existing_marker_infoindow = current_map_infowindows[marker_id];
57
  } else {
58
  // info window object for New Marker creating if not initiated yet
59
  if (wgm_new_marker_infoindow === null) {
60
+ wgm_new_marker_infoindow = new google.maps.InfoWindow(
61
+ {
62
+ content: ''
63
+ }
64
+ );
65
  }
66
 
67
  // Info window contents generating from input and editor
82
 
83
  /**
84
  * Defining Map event listeners
85
+ *
86
  * @param wgm_map object
87
  * @since 1.0.0
88
  */
89
  function wgm_addMapListeners(wgm_map) {
90
 
91
  // On map center changed
92
+ wgm_map.addListener(
93
+ "center_changed",
94
+ function () {
95
+ jQuery('#wpgmap_center_lat_lng').val(wgm_map.center.lat() + ',' + wgm_map.center.lng());
96
+ }
97
+ );
98
 
99
  // On map zoom level changed
100
+ wgm_map.addListener(
101
+ "zoom_changed",
102
+ function () {
103
+ jQuery('#wpgmap_map_zoom').val(wgm_map.zoom);
104
+ }
105
+ );
106
  }
107
 
108
  /**
109
  * In case of already initialized map
110
+ *
111
  * @param map_type
112
  * @param center_lat
113
  * @param center_lng
114
  * @since 1.0.0
115
  */
116
  function wgm_generateAlreadyInitializedMap(map_type, center_lat, center_lng) {
117
+ if (map_type == 'ROADMAP') {
118
  wgm_map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
119
+ } else if (map_type == 'SATELLITE') {
120
  wgm_map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
121
+ } else if (map_type == 'HYBRID') {
122
  wgm_map.setMapTypeId(google.maps.MapTypeId.HYBRID);
123
+ } else if (map_type == 'TERRAIN') {
124
  wgm_map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
125
  }
126
 
127
  wgm_map.setCenter({lat: center_lat, lng: center_lng});
128
+
129
+ // Add Map listeners
 
 
 
 
 
 
 
130
  wgm_addMapListeners(wgm_map);
131
 
132
  // Adding dragend Event Listener
135
 
136
  /**
137
  * Update map settings
138
+ *
139
  * @param map_type
140
  * @param center_lat
141
  * @param center_lng
143
  * @returns {{mapTypeId: *, center: {lng, lat}, zoom}}
144
  * @since 1.0.0
145
  */
 
146
  function wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom) {
147
  var wgm_gmap_settings = {
148
  center: {lat: center_lat, lng: center_lng},
149
  zoom: zoom,
150
  mapTypeId: google.maps.MapTypeId.ROADMAP
151
  };
152
+ if (map_type == 'ROADMAP') {
153
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.ROADMAP;
154
+ } else if (map_type == 'SATELLITE') {
155
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.SATELLITE;
156
+ } else if (map_type == 'HYBRID') {
157
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.HYBRID;
158
+ } else if (map_type == 'TERRAIN') {
159
  wgm_gmap_settings.mapTypeId = google.maps.MapTypeId.TERRAIN;
160
  }
161
  return wgm_gmap_settings;
163
 
164
  /**
165
  * Defining Marker listener
166
+ *
167
  * @param marker
168
  * @since 1.0.0
169
  */
170
  function wgm_addMarkerDragendListener(marker) {
171
+ marker.addListener(
172
+ 'dragend',
173
+ function (markerLocation) {
174
+ _wgm_e("wpgmap_marker_lat_lng").value = markerLocation.latLng.lat() + "," + markerLocation.latLng.lng();
175
+ }
176
+ );
177
  }
178
 
179
 
180
  /**
181
  * Map autocomplete implementation
182
+ *
183
  * @param id
184
  * @param input
185
  * @param center_lat
199
  var wgm_gmap_settings = wgm_setMapSettingsByMapType(map_type, center_lat, center_lng, zoom);
200
 
201
  wgm_map = new google.maps.Map(_wgm_e(id), wgm_gmap_settings);
202
+ if (wgm_theme_json.length > 0) {
203
+ wgm_map.setOptions({styles: JSON.parse(wgm_theme_json)});
204
+ }
 
 
 
 
 
 
 
 
205
 
206
+ google.maps.event.addListener(
207
+ wgm_map,
208
+ "rightclick",
209
+ function (event) {
210
+ generateMarkerInfoByRightClick(event);
211
+ }
212
+ );
213
 
214
  // // Create the search box and link it to the UI element.
215
  var wgm_input = document.getElementById(input);
217
 
218
  // Place input search box
219
  wgm_map.controls[google.maps.ControlPosition.TOP_LEFT].push(wgm_input);
220
+ // =====================showing multiple marker=============
221
  var data = {
222
  'action': 'wpgmapembed_get_markers_by_map_id',
223
  'data': {
226
  }
227
  };
228
 
229
+ jQuery.post(
230
+ ajaxurl,
231
+ data,
232
+ function (response) {
233
+ response = JSON.parse(response);
234
+ wgm_no_of_marker = response.markers.length;
235
 
236
+ // Show hints for Marker creation
237
+ if (wgm_no_of_marker === 0) {
238
+ jQuery(document.body).find(".wgm_marker_create_hints").show();
239
+ }
240
 
241
+ if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
242
+ jQuery('.add_new_marker_btn_area').find(".add_new_marker").css(
243
+ {
244
+ 'opacity': .5
245
+ }
246
+ );
247
+ jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").show();
248
+ }
249
+ if (response.markers.length > 0) {
250
+ response.markers.forEach(
251
+ function (marker) {
252
+ var marker_lat_lng = marker.lat_lng.split(',');
 
 
 
253
 
254
+ var wgm_custom_marker_options = {
255
+ position: new google.maps.LatLng(marker_lat_lng[0], marker_lat_lng[1]),
256
+ title: marker.marker_name,
257
+ animation: google.maps.Animation.DROP,
258
+ };
259
 
260
+ // Set Icon
261
+ if (marker.icon !== '') {
262
+ wgm_custom_marker_options.icon = marker.icon;
263
 
 
 
 
 
 
 
 
 
 
 
264
  }
 
 
 
265
 
266
+ // Set marker URL
267
+ if (marker.have_marker_link === '1') {
268
+ wgm_custom_marker_options.url = marker.marker_link;
269
+ }
270
+ wgm_custom_marker = new google.maps.Marker(wgm_custom_marker_options);
271
+ if (marker.have_marker_link === '1') {
272
+ google.maps.event.addListener(
273
+ wgm_custom_marker,
274
+ 'click',
275
+ function () {
276
+ var wgm_target = '_self';
277
+ if (marker.marker_link_new_tab === '1') {
278
+ wgm_target = '_blank';
279
+ }
280
+ window.open(this.url, wgm_target);
281
+ }
282
+ );
283
+ }
284
+
285
+ wgm_custom_marker.setMap(wgm_map);
286
+ marker.marker_desc = marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
287
+ var marker_name = (marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
288
+ + marker.marker_name +
289
+ '</span><br/>') : '';
290
+ custom_marker_infowindow = new google.maps.InfoWindow(
291
+ {
292
+ content: marker_name + marker.marker_desc
293
+ }
294
+ );
295
+ if (marker.show_desc_by_default === '1') {
296
+ custom_marker_infowindow.open({anchor: wgm_custom_marker, shouldFocus: false});
297
+ }
298
+ current_map_markers[parseInt(marker.id)] = wgm_custom_marker;
299
+ current_map_infowindows[parseInt(marker.id)] = custom_marker_infowindow;
300
+ }
301
+ );
302
+ }
303
  }
304
+ );
305
 
306
  // multiple marker showing end
307
 
309
  wgm_addMapListeners(wgm_map);
310
 
311
  // Bias the SearchBox results towards current map's viewport.
312
+ wgm_map.addListener(
313
+ 'bounds_changed',
314
+ function () {
315
+ wgm_searchBox.setBounds(wgm_map.getBounds());
316
+ }
317
+ );
318
 
319
  var wgm_markers = [];
320
  // Listen for the event fired when the user selects a prediction and retrieve
321
  // more details for that place.
322
+ wgm_searchBox.addListener(
323
+ 'places_changed',
324
+ function () {
325
+ // wgm_marker1.setMap(null);
326
+ var wgm_places = wgm_searchBox.getPlaces();
327
 
328
+ if (wgm_places.length === 0) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  return;
330
  }
331
+ // wgm_marker1.setMap(null);
332
+ // Clear out the old markers.
333
+ wgm_markers.forEach(
334
+ function (marker) {
335
+ marker.setMap(null);
336
+ }
337
+ );
338
+ wgm_markers = [];
339
+
340
+ // For each place, get the icon, name and location.
341
+ var wgm_bounds = new google.maps.LatLngBounds();
342
+ wgm_places.forEach(
343
+ function (place) {
344
+ if (!place.geometry) {
345
+ console.log("Returned place contains no geometry");
346
+ return;
347
+ }
348
+
349
+ _wgm_e("wpgmap_latlng").value = place.geometry.location.lat() + "," + place.geometry.location.lng();
350
+
351
+ if (place.geometry.viewport) {
352
+ // Only geocodes have viewport.
353
+ wgm_bounds.union(place.geometry.viewport);
354
+ } else {
355
+ wgm_bounds.extend(place.geometry.location);
356
+ }
357
+ }
358
+ );
359
+ wgm_map.fitBounds(wgm_bounds);
360
+ // Add Marker event listener
361
+ // wgm_addMarkerDragendListener(wgm_markers[0]);
362
+ }
363
+ );
364
  }
365
 
366
  /**
367
  * Initialize Google Map
368
+ *
369
  * @param lat
370
  * @param lng
371
  * @param map_type
378
 
379
  /**
380
  * On zoom level change, render map with new zoom level LIVE
381
+ *
382
  * @since 1.0.0
383
  */
384
+ jQuery(document.body).find('#wpgmap_map_zoom').on(
385
+ 'keyup',
386
+ function (element) {
387
+ // var point = wgm_marker1.getPosition(); // Get marker position
388
+ wgm_map.panTo(wgm_map.center); // Pan map to that position
389
+ var current_zoom = parseInt(document.getElementById('wpgmap_map_zoom').value);
390
+ setTimeout("wgm_map.setZoom(" + current_zoom + ")", 800); // Zoom in after 500 m second
391
+ }
392
+ );
393
 
394
  /**
395
  * On title field text change, update map title LIVE
396
+ *
397
  * @since 1.0.0
398
  */
399
+ jQuery(document.body).find('#wpgmap_title').on(
400
+ 'keyup',
401
+ function (element) {
402
+ jQuery('#wpgmap_heading_preview').css({'display': 'block'}).html(jQuery('#wpgmap_title').val());
403
+ }
404
+ );
405
 
406
  /**
407
  * On map type change, render different types of map LIVE
408
+ *
409
  * @since 1.0.0
410
  */
411
+ jQuery(document.body).find('#wpgmap_map_type').on(
412
+ 'change',
413
+ function (element) {
414
+ // wgm_marker1.setMap(null);
415
+ var map_type = jQuery(this).val();
416
+ wgm_map.setMapTypeId(map_type.toLowerCase());
417
+ }
418
+ );
419
 
420
 
421
  /**
422
+ * On map theme presets change, render different types of map based on theme
423
+ *
424
+ * @since 1.8.6
425
  */
426
+ jQuery(document.body).find('#wpgmap_map_theme').on(
427
+ 'change',
428
+ function (element) {
429
+ var wgm_theme_json = JSON.parse(jQuery(this).val());
430
+ wgm_map.setOptions({styles: wgm_theme_json});
431
+ jQuery(document.body).find("#wgm_theme_json").val(jQuery(this).val());
 
 
 
 
 
 
 
432
  }
433
+ );
434
 
435
  /**
436
+ * On map theme presets change, render different types of map based on theme
437
+ *
438
+ * @since 1.8.6
439
+ */
440
+ jQuery(document.body).find('#wgm_theme_json').on(
441
+ 'blur',
442
+ function (element) {
443
+ var wgm_theme_json = JSON.parse(jQuery(this).val());
444
+ wgm_map.setOptions({styles: wgm_theme_json});
445
+ }
446
+ );
447
+
448
+ /**
449
+ * Rendering tab contents
450
+ *
451
  * @since 1.0.0
452
  */
453
+ jQuery(document.body).find('.wgm_wpgmap_tab li').on(
454
+ 'click',
455
+ function (e) {
456
+ e.preventDefault();
457
+ jQuery('.wgm_wpgmap_tab li').removeClass('active');
458
+ jQuery(this).addClass('active');
459
+
460
+ jQuery('.wp-gmap-tab-contents').addClass('hidden');
461
+ var wpgmap_id = jQuery(this).attr('id');
462
+ jQuery('.' + wpgmap_id).removeClass('hidden');
463
+ if (wpgmap_id === 'wgm_gmap_markers') {
464
+ jQuery('.wgm_gmap_marker_list').css('display', 'block');
465
+ jQuery('.add_new_marker_form').css('display', 'none');
466
+ } else {
467
+ jQuery('.wgm_gmap_marker_list').css('display', 'none');
468
+ }
469
+ }
470
+ );
471
 
472
  // ========================================For Media Upload in Marker===================================
473
+ jQuery(document).ready(
474
+ function ($) {
475
+
476
+ $('#wpgmap_upload_marker_icon').click(
477
+ function () {
478
+ var custom_uploader;
479
+ if (custom_uploader) {
480
+ custom_uploader.open();
481
+ return;
482
+ }
483
 
484
+ custom_uploader = wp.media.frames.file_frame = wp.media(
485
+ {
486
+ title: 'Choose Image'
487
+ , button: {
488
+ text: 'Choose Image'
489
+ }
490
+ , multiple: false
491
+ }
492
+ );
493
+
494
+ custom_uploader.on(
495
+ 'select',
496
+ function () {
497
+ var attachment = custom_uploader.state().get('selection').first().toJSON();
498
+
499
+ var data = {
500
+ 'action': 'wpgmapembed_save_marker_icon',
501
+ 'data': {
502
+ icon_url: attachment.url,
503
+ ajax_nonce: wgm_l.ajax_nonce
504
+ }
505
+ };
506
+ jQuery.post(
507
+ ajaxurl,
508
+ data,
509
+ function (response) {
510
+ response = JSON.parse(response);
511
+ $(document.body).find("#wpgmap_marker_icon").val(response.icon_url);
512
+ $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon_url);
513
+ var elm = {};
514
+ elm.src = response.icon_url;
515
+ wpgmapChangeCurrentMarkerIcon(elm);
516
+ }
517
+ );
518
+ }
519
+ );
520
 
521
+ // Open the uploader dialog
522
+ custom_uploader.open();
 
 
523
  }
524
+ );
525
+ }
526
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
 
528
  function generateMarkerInfoByRightClick(event) {
529
  // Is markers tab active
537
  }
538
  var lat = event.latLng.lat();
539
  var lng = event.latLng.lng();
540
+ wgm_new_marker = new google.maps.Marker(
541
+ {
 
 
 
 
 
 
 
 
 
 
542
  title: "",
543
  animation: google.maps.Animation.DROP,
544
  position: event.latLng,
545
  draggable: true,
546
  map: wgm_map
547
+ }
548
+ );
549
+
550
+ if (is_marker_edit) {
551
+
552
+ wgm_existing_marker.setMap(null);
553
+ wgm_existing_marker = new google.maps.Marker(
554
+ {
555
+ title: "",
556
+ animation: google.maps.Animation.DROP,
557
+ position: event.latLng,
558
+ draggable: true,
559
+ map: wgm_map
560
+ }
561
+ );
562
 
563
  wgm_generate_infowindow();
564
 
566
  wgm_addMarkerDragendListener(wgm_existing_marker);
567
 
568
  } else {
 
 
 
569
  wgm_generate_infowindow();
570
  wgm_new_marker_infoindow.open({anchor: wgm_new_marker, shouldFocus: false});
571
  wgm_addMarkerDragendListener(wgm_new_marker);
574
 
575
  // populate yor box/field with lat, lng
576
  jQuery('#wpgmap_marker_lat_lng').val(lat + ',' + lng);
 
577
 
578
  }
579
 
580
  function tmce_setContent(content, editor_id, textarea_id) {
581
+ if (typeof editor_id == 'undefined') {
582
+ editor_id = wpActiveEditor;
583
+ }
584
+ if (typeof textarea_id == 'undefined') {
585
+ textarea_id = editor_id;
586
+ }
587
 
588
  if (jQuery('#wp-' + editor_id + '-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
589
  content = content.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
594
  }
595
 
596
  function tmce_getContent(editor_id, textarea_id) {
597
+ if (typeof editor_id == 'undefined') {
598
+ editor_id = wpActiveEditor;
599
+ }
600
+ if (typeof textarea_id == 'undefined') {
601
+ textarea_id = editor_id;
602
+ }
603
 
604
  if (jQuery('#wp-' + editor_id + '-wrap').hasClass('tmce-active') && tinyMCE.get(editor_id)) {
605
  return tinyMCE.get(editor_id).getContent();
611
  var marker_name_info_content = '', marker_desc_info_content = '';
612
 
613
  function populateMarkerInfowindow() {
 
 
 
 
614
  var final_content = marker_name_info_content + marker_desc_info_content;
615
  if (wgm_existing_marker_infoindow !== null) {
616
  wgm_existing_marker_infoindow.setContent(final_content);
618
  }
619
 
620
 
621
+ jQuery(document).ready(
622
+ function ($) {
623
 
624
+ // ==============================
625
+ // Create 'keyup_event' tinymce plugin
626
+ tinymce.PluginManager.add(
627
+ 'keyup_event',
628
+ function (editor, url) {
629
+ if (editor.id === 'wpgmap_marker_desc') {
630
 
631
+ // Create keyup event
632
+ editor.on(
633
+ 'keyup',
634
+ function (e) {
635
+ wgm_generate_infowindow();
636
+ }
637
+ );
638
+ }
639
+ }
640
+ );
641
 
642
+ jQuery('#wpgmap_marker_name,#wpgmap_marker_desc').on(
643
+ 'keyup',
644
+ function (element) {
 
 
645
  wgm_generate_infowindow();
646
+ }
647
+ );
648
+
649
+ jQuery(document.body).find('#wpgmap_marker_link').on(
650
+ 'blur',
651
+ function (event) {
652
+ var wgm_marker_url = jQuery(this).val();
653
+ if (is_marker_edit === true) {
654
+ wgm_existing_marker.url = wgm_marker_url;
655
+ google.maps.event.addListener(
656
+ wgm_existing_marker,
657
+ 'click',
658
+ function () {
659
+ var wgm_target = '_self';
660
+ if ($('#wpgmap_marker_link_new_tab').is(':checked')) {
661
+ wgm_target = '_blank';
662
+ }
663
+ window.open(this.url, wgm_target);
664
+ }
665
+ );
666
+ } else {
667
+ if (wgm_new_marker !== null) {
668
+ wgm_new_marker.url = wgm_marker_url;
669
+ google.maps.event.addListener(
670
+ wgm_new_marker,
671
+ 'click',
672
+ function () {
673
+ var wgm_target = '_self';
674
+ if (jQuery('#wpgmap_marker_link_new_tab').is(':checked')) {
675
+ wgm_target = '_blank';
676
+ }
677
+ window.open(this.url, wgm_target);
678
+ }
679
+ );
680
  }
681
+ }
 
682
  }
683
+ );
 
684
 
685
+ function generateMarkersListView() {
686
+ $('#wgm_gmap_marker_list').DataTable().ajax.reload();
687
+ }
688
 
689
+ // Marker delete
690
+ jQuery(document.body).on(
691
+ 'click',
692
+ '.wpgmap_marker_trash',
693
+ function (event) {
694
+ event.preventDefault();
695
+ var parent = $(this).parents().eq(4);
696
+ parent.find('.spinner').css('visibility', 'visible');
697
+ if (confirm('Are you sure to delete?')) {
698
+ var marker_id = jQuery(this).attr('map_marker_id');
699
+ var data = {
700
+ 'action': 'wpgmapembed_delete_marker',
701
+ 'data': {
702
+ marker_id: marker_id,
703
+ ajax_nonce: wgm_l.ajax_nonce
704
+ }
705
+ };
706
+ jQuery.post(
707
+ ajaxurl,
708
+ data,
709
+ function (response) {
710
+ response = JSON.parse(response);
711
+ generateMarkersListView();
712
+ parent.find('.spinner').css('visibility', 'hidden');
713
+ current_map_markers[parseInt(marker_id)].setMap(null);
714
+ $(document.body).find('#marker_success').html('Marker removed successfully.');
715
+ wgm_no_of_marker--;
716
+ if (wgm_no_of_marker === 0 && wgm_l.is_premium_user !== '1') {
717
+ jQuery('.add_new_marker_btn_area').find(".add_new_marker").css(
718
+ {
719
+ 'opacity': 1
720
+ }
721
+ );
722
+ jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").hide();
723
+ }
724
+ }
725
+ );
726
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
727
  }
728
+ );
729
+
730
+ // Marker delete
731
+ jQuery(document.body).on(
732
+ 'click',
733
+ '.wpgmap_marker_view',
734
+ function (event) {
735
+ event.preventDefault();
736
+ var parent = $(this).parents().eq(4);
737
+ parent.find('.spinner').css('visibility', 'visible');
738
+ var marker_id = jQuery(this).attr('map_marker_id');
739
+ wgm_existing_marker = current_map_markers[marker_id];
740
+ wgm_map.panTo(wgm_existing_marker.getPosition());
741
  }
742
+ );
743
+
744
+ // Marker Edit
745
+ jQuery(document.body).on(
746
+ 'click',
747
+ '.wpgmap_marker_edit',
748
+ function (event) {
749
+ event.preventDefault();
750
+ is_marker_edit = true;
751
+ var parent = $(this).parents().eq(4);
752
+ parent.find('.spinner').css('visibility', 'visible');
753
+ var marker_id = jQuery(this).attr('map_marker_id');
754
+ wgm_existing_marker = current_map_markers[marker_id];
755
+ var data = {
756
+ 'action': 'wpgmapembed_get_marker_data_by_marker_id',
757
+ 'data': {
758
+ marker_id: marker_id,
759
+ ajax_nonce: wgm_l.ajax_nonce
760
+ }
761
+ };
762
+ jQuery.post(
763
+ ajaxurl,
764
+ data,
765
+ function (response) {
766
+ response = JSON.parse(response);
767
+ $('#wpgmap_marker_name').val(response.marker_name);
768
+ $('#wpgmap_marker_address').val(response.address);
769
+ var wgm_marker_lat_lng = response.lat_lng.split(',');
770
+ $('#wpgmap_marker_lat_lng').val(wgm_marker_lat_lng[0] + ',' + wgm_marker_lat_lng[1]);
771
+ $('#wpgmap_marker_link').val(response.marker_link);
772
+ $('#wpgmap_marker_icon').val(response.icon);
773
+ if (response.have_marker_link === '1') {
774
+ $("#wpgmap_marker_link_area").show();
775
+ } else {
776
+ $("#wpgmap_marker_link_area").hide();
777
+ }
778
+ $('#wpgmap_marker_link_new_tab').prop('checked', response.marker_link_new_tab === "1");
779
+ $('#wpgmap_marker_infowindow_show').val(response.show_desc_by_default).change();
780
+ $('#wpgmap_have_marker_link').val(response.have_marker_link).change();
781
+ $('.wpgmap_marker_add,.wpgmap_marker_update').attr('markerid', marker_id);
782
+ $('.wpgmap_marker_add').removeClass('wpgmap_marker_add').addClass('wpgmap_marker_update').css('background-color', '#00a2f3').html('<i class="dashicons dashicons-location" style="line-height: 1.6;"></i><b>Update Marker</b>');
783
+ // Reset wp editor content
784
+ tmce_setContent(response.marker_desc, 'wpgmap_marker_desc', 'wpgmap_marker_desc');
785
+ parent.find('.spinner').css('visibility', 'hidden');
786
+
787
+ $(document.body).find('.add_new_marker_form').show();
788
+ $(document.body).find('.wgm_gmap_marker_list').hide();
789
+ $(document.body).find('#marker_errors,#marker_success').html('');
790
+ $(document.body).find("#wpgmap_marker_icon_preview").attr('src', response.icon);
791
+ wgm_map.panTo(wgm_existing_marker.getPosition());
792
+ current_map_markers[marker_id].setDraggable(true);
793
+ wgm_addMarkerDragendListener(current_map_markers[marker_id]);
794
+ wgm_existing_marker_infoindow = new google.maps.InfoWindow(
795
+ {
796
+ content: '<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">' + response.marker_name + '</span>' + response.address
797
+ }
798
+ );
799
+ }
800
+ );
801
+ }
802
+ );
803
+
804
+ }
805
+ );
806
 
807
 
808
  function wpgmapChangeCurrentMarkerIcon(elem) {
819
  wgm_new_marker.setIcon(icon_url);
820
  }
821
  }
822
+ }
admin/assets/js/localized_script.js CHANGED
@@ -1 +1 @@
1
- //console.log(test_object);
1
+ // console.log(test_object);
admin/assets/js/setup_wizard.js CHANGED
@@ -1,171 +1,207 @@
1
  (function ($) {
2
- "use strict";
3
 
4
- /**
5
- * Setup wizard tabs
6
- */
7
- function wpgmapRenderTab(wgm_step = 0) {
8
 
9
- var wgm_contents = document.getElementsByClassName("wgm_setup_content"),
10
- wgm_prev = document.getElementById("wgm_prev"),
11
- wgm_nextElement = document.getElementById("wgm_next"),
12
- wgm_saveElement = document.getElementById("wgm_save");
13
 
14
- if (wgm_contents.length < 1) {
15
- return;
16
- }
17
 
18
- wgm_contents[wgm_step].style.display = "block";
19
- wgm_prev.style.display = (wgm_step === 0) ? "none" : "inline";
20
- wgm_nextElement.style.display = "inline";
21
- wgm_saveElement.style.display = "none";
22
- if (wgm_step === (wgm_contents.length - 1)) {
23
- wgm_saveElement.style.display = "inline";
24
- wgm_nextElement.style.display = "none";
25
- }
26
- var wgm_container = document.getElementsByClassName("wgm_setup_wizard_steps");
27
- wgm_container[0].setAttribute('data-step', wgm_step);
28
- }
29
 
30
- wpgmapRenderTab(0);
31
 
32
- /**
33
- * Generating preview of final step
34
- * @param api_key
35
- * @param language_full_name
36
- * @param regional_area_full_name
37
- */
38
- function wgp_generateFinalResponse(api_key, language_full_name, regional_area_full_name) {
39
- $(".wgm_apikey").html(`<p>${api_key}</p>`);
40
- $(".wgm_language").html(`<p>${language_full_name}</p>`);
41
- $(".wgm_region").html(`<p>${regional_area_full_name}</p>`);
42
- }
 
43
 
44
- /**
45
- * Next | Previous button click actions
46
- */
47
- $(document).on('click', '#wgm_next,#wgm_skip,#wgm_prev', function (e) {
 
 
 
48
 
49
- var wgm_container = document.getElementsByClassName("wgm_setup_wizard_steps"),
50
- wgm_StepNumber = parseInt(wgm_container[0].getAttribute('data-step')),
51
- wgm_contents = document.getElementsByClassName("wgm_setup_content");
52
- var wgm_api_key = $("#wgm_key").val(),
53
- wgm_language = $("#wgm_gmap_lng").val(),
54
- wgm_language_full_name = $("#wgm_gmap_lng option:selected").text(),
55
- wgm_regional_area = $("#wgm_region").val(),
56
- wgm_regional_area_full_name = $("#wgm_region option:selected").text().toUpperCase();
57
 
58
- if (e.target.id === 'wgm_next' || e.target.id === 'wgm_skip') {
59
 
60
- if (wgm_StepNumber === 0) {
61
- // Getting API key stage
62
- if (wgm_api_key === '') {
63
- Swal.fire({
64
- icon: 'warning',
65
- title: wgm_l.setup_wizard.setup_validation_msg.apikey,
66
- html: "<a href='//www.youtube.com/watch?v=m-jAsxG0zuk' target='_blank' style='text-decoration: none;'><i class='dashicons dashicons-youtube'></i> See video tutorial</a>" +
67
- "&nbsp;&nbsp;&nbsp;<a href='https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=admin_setup_wizard' target='_blank' style='text-decoration: none;' ><i class='fas fa-external-link-alt'></i> See help manual</a>"
68
- })
69
- return false;
70
- }
71
- } else if (wgm_StepNumber === 1) {
72
- // Regional area stage
73
- if (wgm_language === '') {
74
- Swal.fire({
75
- title: wgm_l.setup_wizard.setup_validation_msg.language,
76
- icon: 'warning',
77
- })
78
- return false;
79
- }
80
- if (wgm_regional_area === '') {
81
- Swal.fire({
82
- title: wgm_l.setup_wizard.setup_validation_msg.regionalarea,
83
- icon: 'warning',
84
- })
85
- return false;
86
- }
87
- }
88
- wgp_generateFinalResponse(wgm_api_key, wgm_language_full_name, wgm_regional_area_full_name);
89
- }
90
- wgm_contents[wgm_StepNumber].style.display = "none";
91
- wgm_StepNumber = (e.target.id === 'wgm_prev') ? wgm_StepNumber - 1 : wgm_StepNumber + 1;
92
- if (wgm_StepNumber >= wgm_contents.length) {
93
- return false;
94
- }
95
- wpgmapRenderTab(wgm_StepNumber);
96
- });
 
 
 
 
 
 
 
97
 
98
- /**
99
- * Save setup wizard information
100
- */
101
- $(document).on('click', '#wgm_save', function (e) {
102
- Swal.showLoading();
103
- var wgm_api_key = document.getElementById('wgm_key').value,
104
- wgm_language = document.getElementById('wgm_gmap_lng').value,
105
- wgm_regional_area = document.getElementById('wgm_region').value;
106
- var data = {
107
- 'action': 'wpgmapembed_save_setup_wizard',
108
- 'wgm_api_key': wgm_api_key,
109
- 'wgm_language': wgm_language,
110
- 'wgm_regional_area': wgm_regional_area,
111
- ajax_nonce:wgm_l.ajax_nonce
112
- };
113
- $.post(ajaxurl, data, function (response) {
114
- response = JSON.parse(response);
115
- if (response.responseCode === 101) {
116
- Swal.hideLoading();
117
- Swal.fire({
118
- icon: 'error',
119
- title: wgm_l.setup_wizard.setup_validation_msg.apikey,
120
- });
121
- return false;
122
- }
123
- if (response.responseCode === 102) {
124
- Swal.hideLoading();
125
- Swal.fire({
126
- icon: 'error',
127
- title: wgm_l.setup_wizard.setup_validation_msg.language,
128
- });
129
- return false;
130
- }
131
- if (response.responseCode === 103) {
132
- Swal.hideLoading();
133
- Swal.fire({
134
- icon: 'error',
135
- title: wgm_l.setup_wizard.setup_validation_msg.regionalarea,
136
- });
137
- return false;
138
- }
139
- if (response.responseCode === 200) {
140
- Swal.hideLoading();
141
- Swal.fire({
142
- icon: 'success',
143
- title: wgm_l.setup_wizard.setup_validation_msg.success,
144
- confirmButtonText: 'Let\'s Get Started',
145
- showCloseButton: true,
146
- }).then((result) => {
147
- window.location.replace(wgm_l.site_url.concat('/wp-admin/admin.php?page=wpgmapembed'));
148
- });
149
- } else {
150
- Swal.fire({
151
- icon: 'error',
152
- title: wgm_l.setup_wizard.setup_validation_msg.failed_to_finish,
153
- });
154
- return false;
155
- }
156
- });
157
- });
158
- /**
159
- * What we collect modal
160
- */
161
- $(document).on('click', '#wgm_wwc_notice', function (e) {
162
- e.preventDefault();
163
- Swal.fire({
164
- icon: 'info',
165
- title: wgm_l.setup_wizard.wgm_wwc_msg.title,
166
- text: wgm_l.setup_wizard.wgm_wwc_msg.desc,
167
- })
168
- });
169
-
170
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
 
1
  (function ($) {
2
+ "use strict";
3
 
4
+ /**
5
+ * Setup wizard tabs
6
+ */
7
+ function wpgmapRenderTab(wgm_step = 0) {
8
 
9
+ var wgm_contents = document.getElementsByClassName( "wgm_setup_content" ),
10
+ wgm_prev = document.getElementById( "wgm_prev" ),
11
+ wgm_nextElement = document.getElementById( "wgm_next" ),
12
+ wgm_saveElement = document.getElementById( "wgm_save" );
13
 
14
+ if (wgm_contents.length < 1) {
15
+ return;
16
+ }
17
 
18
+ wgm_contents[wgm_step].style.display = "block";
19
+ wgm_prev.style.display = (wgm_step === 0) ? "none" : "inline";
20
+ wgm_nextElement.style.display = "inline";
21
+ wgm_saveElement.style.display = "none";
22
+ if (wgm_step === (wgm_contents.length - 1)) {
23
+ wgm_saveElement.style.display = "inline";
24
+ wgm_nextElement.style.display = "none";
25
+ }
26
+ var wgm_container = document.getElementsByClassName( "wgm_setup_wizard_steps" );
27
+ wgm_container[0].setAttribute( 'data-step', wgm_step );
28
+ }
29
 
30
+ wpgmapRenderTab( 0 );
31
 
32
+ /**
33
+ * Generating preview of final step
34
+ *
35
+ * @param api_key
36
+ * @param language_full_name
37
+ * @param regional_area_full_name
38
+ */
39
+ function wgp_generateFinalResponse(api_key, language_full_name, regional_area_full_name) {
40
+ $( ".wgm_apikey" ).html( ` < p > ${api_key} < / p > ` );
41
+ $( ".wgm_language" ).html( ` < p > ${language_full_name} < / p > ` );
42
+ $( ".wgm_region" ).html( ` < p > ${regional_area_full_name} < / p > ` );
43
+ }
44
 
45
+ /**
46
+ * Next | Previous button click actions
47
+ */
48
+ $( document ).on(
49
+ 'click',
50
+ '#wgm_next,#wgm_skip,#wgm_prev',
51
+ function (e) {
52
 
53
+ var wgm_container = document.getElementsByClassName( "wgm_setup_wizard_steps" ),
54
+ wgm_StepNumber = parseInt( wgm_container[0].getAttribute( 'data-step' ) ),
55
+ wgm_contents = document.getElementsByClassName( "wgm_setup_content" );
56
+ var wgm_api_key = $( "#wgm_key" ).val(),
57
+ wgm_language = $( "#wgm_gmap_lng" ).val(),
58
+ wgm_language_full_name = $( "#wgm_gmap_lng option:selected" ).text(),
59
+ wgm_regional_area = $( "#wgm_region" ).val(),
60
+ wgm_regional_area_full_name = $( "#wgm_region option:selected" ).text().toUpperCase();
61
 
62
+ if (e.target.id === 'wgm_next' || e.target.id === 'wgm_skip') {
63
 
64
+ if (wgm_StepNumber == 0) {
65
+ // Getting API key stage
66
+ if (wgm_api_key === '') {
67
+ Swal.fire(
68
+ {
69
+ icon: 'warning',
70
+ title: wgm_l.setup_wizard.setup_validation_msg.apikey,
71
+ html: "<a href='//www.youtube.com/watch?v=m-jAsxG0zuk' target='_blank' style='text-decoration: none;'><i class='dashicons dashicons-youtube'></i> See video tutorial</a>" +
72
+ "&nbsp;&nbsp;&nbsp;<a href='https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=admin_setup_wizard' target='_blank' style='text-decoration: none;' ><i class='fas fa-external-link-alt'></i> See help manual</a>"
73
+ }
74
+ )
75
+ return false;
76
+ }
77
+ } else if (wgm_StepNumber == 1) {
78
+ // Regional area stage
79
+ if (wgm_language === '') {
80
+ Swal.fire(
81
+ {
82
+ title: wgm_l.setup_wizard.setup_validation_msg.language,
83
+ icon: 'warning',
84
+ }
85
+ )
86
+ return false;
87
+ }
88
+ if (wgm_regional_area === '') {
89
+ Swal.fire(
90
+ {
91
+ title: wgm_l.setup_wizard.setup_validation_msg.regionalarea,
92
+ icon: 'warning',
93
+ }
94
+ )
95
+ return false;
96
+ }
97
+ }
98
+ wgp_generateFinalResponse( wgm_api_key, wgm_language_full_name, wgm_regional_area_full_name );
99
+ }
100
+ wgm_contents[wgm_StepNumber].style.display = "none";
101
+ wgm_StepNumber = (e.target.id === 'wgm_prev') ? wgm_StepNumber - 1 : wgm_StepNumber + 1;
102
+ if (wgm_StepNumber >= wgm_contents.length) {
103
+ return false;
104
+ }
105
+ wpgmapRenderTab( wgm_StepNumber );
106
+ }
107
+ );
108
 
109
+ /**
110
+ * Save setup wizard information
111
+ */
112
+ $( document ).on(
113
+ 'click',
114
+ '#wgm_save',
115
+ function (e) {
116
+ Swal.showLoading();
117
+ var wgm_api_key = document.getElementById( 'wgm_key' ).value,
118
+ wgm_language = document.getElementById( 'wgm_gmap_lng' ).value,
119
+ wgm_regional_area = document.getElementById( 'wgm_region' ).value;
120
+ var data = {
121
+ 'action': 'wpgmapembed_save_setup_wizard',
122
+ 'wgm_api_key': wgm_api_key,
123
+ 'wgm_language': wgm_language,
124
+ 'wgm_regional_area': wgm_regional_area,
125
+ ajax_nonce:wgm_l.ajax_nonce
126
+ };
127
+ $.post(
128
+ ajaxurl,
129
+ data,
130
+ function (response) {
131
+ response = JSON.parse( response );
132
+ if (response.responseCode === 101) {
133
+ Swal.hideLoading();
134
+ Swal.fire(
135
+ {
136
+ icon: 'error',
137
+ title: wgm_l.setup_wizard.setup_validation_msg.apikey,
138
+ }
139
+ );
140
+ return false;
141
+ }
142
+ if (response.responseCode === 102) {
143
+ Swal.hideLoading();
144
+ Swal.fire(
145
+ {
146
+ icon: 'error',
147
+ title: wgm_l.setup_wizard.setup_validation_msg.language,
148
+ }
149
+ );
150
+ return false;
151
+ }
152
+ if (response.responseCode === 103) {
153
+ Swal.hideLoading();
154
+ Swal.fire(
155
+ {
156
+ icon: 'error',
157
+ title: wgm_l.setup_wizard.setup_validation_msg.regionalarea,
158
+ }
159
+ );
160
+ return false;
161
+ }
162
+ if (response.responseCode === 200) {
163
+ Swal.hideLoading();
164
+ Swal.fire(
165
+ {
166
+ icon: 'success',
167
+ title: wgm_l.setup_wizard.setup_validation_msg.success,
168
+ confirmButtonText: 'Let\'s Get Started',
169
+ showCloseButton: true,
170
+ }
171
+ ).then(
172
+ (result) => {
173
+ window.location.replace( wgm_l.site_url.concat( '/wp-admin/admin.php?page=wpgmapembed' ) );
174
+ }
175
+ );
176
+ } else {
177
+ Swal.fire(
178
+ {
179
+ icon: 'error',
180
+ title: wgm_l.setup_wizard.setup_validation_msg.failed_to_finish,
181
+ }
182
+ );
183
+ return false;
184
+ }
185
+ }
186
+ );
187
+ }
188
+ );
189
+ /**
190
+ * What we collect modal
191
+ */
192
+ $( document ).on(
193
+ 'click',
194
+ '#wgm_wwc_notice',
195
+ function (e) {
196
+ e.preventDefault();
197
+ Swal.fire(
198
+ {
199
+ icon: 'info',
200
+ title: wgm_l.setup_wizard.wgm_wwc_msg.title,
201
+ text: wgm_l.setup_wizard.wgm_wwc_msg.desc,
202
+ }
203
+ )
204
+ }
205
+ );
206
 
207
+ })( jQuery );
admin/assets/js/tinymce_keyup_event.js CHANGED
@@ -0,0 +1 @@
 
1
+
admin/assets/js/wgm_map_crud.js CHANGED
@@ -1,47 +1,55 @@
1
  (function ($) {
2
- $(document).ready(function () {
3
- /**
4
- * Datatable to view map list
5
- * @since 1.7.5
6
- */
7
- var wgm_map_list = $('#wgm_map_list_dt').DataTable({
8
- ajax: {
9
- url: ajaxurl + '?action=wgm_get_all_maps&ajax_nonce='+wgm_l.ajax_nonce
10
- },
11
- columns: [
12
- {data: 'id'},
13
- {data: 'title'},
14
- {data: 'map_type'},
15
- {data: 'width'},
16
- {data: 'height'},
17
- {data: 'shortcode'},
18
- {data: 'action'}
19
- ],
20
- "language": {
21
- "emptyTable": "<b style='color: #d36d8c'>" + wgm_l.locales.dt.no_map_created + "</b>"
22
- },
23
- responsive: true
24
- });
 
 
 
 
25
 
26
- /**
27
- * Datatable to view marker list
28
- * @since 1.7.5
29
- */
30
- var wgm_map_id = typeof wgm_l.wgm_object === 'undefined' ? 0 : wgm_l.wgm_object.map_id;
31
- var wgm_gmap_marker_list = $('#wgm_gmap_marker_list').DataTable({
32
- ajax: {
33
- url: ajaxurl + '?action=wgm_get_markers_by_map_id&map_id=' + wgm_map_id+'&ajax_nonce='+wgm_l.ajax_nonce
34
- },
35
- columns: [
36
- {data: 'id'},
37
- {data: 'marker_name'},
38
- {data: 'icon'},
39
- {data: 'action'},
40
- ],
41
- "language": {
42
- "emptyTable": "<b style='color: #d36d8c'>" + wgm_l.locales.dt.no_marker_created + "</b>"
43
- },
44
- responsive: true
45
- });
46
- });
47
- })(jQuery);
 
 
 
 
1
  (function ($) {
2
+ $( document ).ready(
3
+ function () {
4
+ /**
5
+ * Datatable to view map list
6
+ *
7
+ * @since 1.7.5
8
+ */
9
+ var wgm_map_list = $( '#wgm_map_list_dt' ).DataTable(
10
+ {
11
+ ajax: {
12
+ url: ajaxurl + '?action=wgm_get_all_maps&ajax_nonce=' + wgm_l.ajax_nonce
13
+ },
14
+ columns: [
15
+ {data: 'id'},
16
+ {data: 'title'},
17
+ {data: 'map_type'},
18
+ {data: 'width'},
19
+ {data: 'height'},
20
+ {data: 'shortcode'},
21
+ {data: 'action'}
22
+ ],
23
+ "language": {
24
+ "emptyTable": "<b style='color: #d36d8c'>" + wgm_l.locales.dt.no_map_created + "</b>"
25
+ },
26
+ responsive: true
27
+ }
28
+ );
29
 
30
+ /**
31
+ * Datatable to view marker list
32
+ *
33
+ * @since 1.7.5
34
+ */
35
+ var wgm_map_id = typeof wgm_l.wgm_object === 'undefined' ? 0 : wgm_l.wgm_object.map_id;
36
+ var wgm_gmap_marker_list = $( '#wgm_gmap_marker_list' ).DataTable(
37
+ {
38
+ ajax: {
39
+ url: ajaxurl + '?action=wgm_get_markers_by_map_id&map_id=' + wgm_map_id + '&ajax_nonce=' + wgm_l.ajax_nonce
40
+ },
41
+ columns: [
42
+ {data: 'id'},
43
+ {data: 'marker_name'},
44
+ {data: 'icon'},
45
+ {data: 'action'},
46
+ ],
47
+ "language": {
48
+ "emptyTable": "<b style='color: #d36d8c'>" + wgm_l.locales.dt.no_marker_created + "</b>"
49
+ },
50
+ responsive: true
51
+ }
52
+ );
53
+ }
54
+ );
55
+ })( jQuery );
admin/assets/js/wgm_marker_crud.js CHANGED
@@ -1,189 +1,215 @@
1
  (function ($) {
2
- $(function () {
3
- function generateMarkersListView() {
4
- $('#wgm_gmap_marker_list').DataTable().ajax.reload();
5
- }
6
-
7
- /**
8
- * Vanish a marker from Map view
9
- * @param type string
10
- */
11
- function wgm_vanish_marker(type = 'new') {
12
- if (type === 'new') {
13
- if (wgm_new_marker != null && typeof wgm_new_marker == 'object') {
14
- wgm_new_marker.setMap(null);
15
- }
16
- wgm_new_marker = null;
17
- } else {
18
- if (wgm_existing_marker != null && typeof wgm_existing_marker == 'object') {
19
- wgm_existing_marker.setMap(null);
20
- }
21
- wgm_existing_marker = null;
22
- }
23
- }
24
-
25
- /* --------------------Marker add form reset---------------------- */
26
- function wpgmap_reset_marker_add_form() {
27
- $('#wpgmap_marker_name,#wpgmap_marker_address,#wpgmap_marker_lat_lng,#wpgmap_marker_link').val('');
28
- $('#wpgmap_marker_link_new_tab').prop('checked', false);
29
- $('#wpgmap_have_marker_link').val("0").change();
30
- $(document.body).find('#marker_errors,#marker_success').html('');
31
- $(document.body).find("#wpgmap_marker_icon_preview").attr('src', 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png');
32
- $(document.body).find("#wpgmap_marker_icon").val('https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png');
33
- // Reset wp editor content
34
- tmce_setContent('', 'wpgmap_marker_desc', 'wpgmap_marker_desc');
35
- }
36
-
37
- // Pre-Loading markers list
38
- //generateMarkersListView();
39
- // Marker update or save
40
- $(document.body).on('click', ".wpgmap_marker_add,.wpgmap_marker_update", function () {
41
- var is_update = false, action = 'wpgmapembed_save_map_markers',
42
- save_update_message = 'Marker saved successfully.', marker_id = 0, map_id = 0;
43
- is_update = $(this).hasClass('wpgmap_marker_update');
44
- if (is_update) {
45
- action = 'wpgmapembed_update_map_markers';
46
- save_update_message = 'Marker updated successfully.';
47
- marker_id = $(this).attr('markerid');
48
- }
49
-
50
- map_id = parseInt($(this).attr('mapid'));
51
-
52
- $('#marker_errors,#marker_success').html('');
53
- $(this).parent().find('.spinner').css('visibility', 'visible');
54
- var parent = $('body .wgm_gmap_markers');
55
- var wpgmap_marker_link_new_tab = 0;
56
-
57
- // Handling checkboxes
58
- if (parent.find("#wpgmap_marker_link_new_tab").is(':checked') === true) {
59
- wpgmap_marker_link_new_tab = 1;
60
- }
61
-
62
- var wpgmap_marker_name = parent.find("#wpgmap_marker_name").val();
63
- var wpgmap_marker_desc = tmce_getContent('wpgmap_marker_desc', 'wpgmap_marker_desc');
64
- var wpgmap_marker_icon = parent.find("#wpgmap_marker_icon").val();
65
- var wpgmap_marker_lat_lng = parent.find("#wpgmap_marker_lat_lng").val();
66
- var wpgmap_marker_address = parent.find("#wpgmap_marker_address").val();
67
- var wpgmap_have_marker_link = parent.find("#wpgmap_have_marker_link").val();
68
- var wpgmap_marker_link = parent.find("#wpgmap_marker_link").val();
69
- var wpgmap_marker_infowindow_show = parent.find("#wpgmap_marker_infowindow_show").val();
70
-
71
- // Handling front-end validation
72
- var has_error = false;
73
- var error_msg = [];
74
- parent.find("#wpgmap_marker_name").removeClass('wgm_error');
75
- // if (wpgmap_marker_name === '') {
76
- // parent.find("#wpgmap_marker_name").addClass('wgm_error');
77
- // has_error = true;
78
- // error_msg.push('Please input marker name correctly');
79
- // }
80
- if (wpgmap_marker_lat_lng === '') {
81
- parent.find("#wpgmap_marker_lat_lng").addClass('wgm_error');
82
- has_error = true;
83
- error_msg.push('Please input latitude, longitude correctly.');
84
- }
85
-
86
-
87
- if (has_error) {
88
- $('#marker_errors').html(error_msg.join('<br/>'));
89
- parent.find('.spinner').css('visibility', 'hidden');
90
- return false;
91
- }
92
- var map_markers_data = {
93
- wpgmap_marker_name: wpgmap_marker_name,
94
- wpgmap_marker_desc: wpgmap_marker_desc,
95
- wpgmap_marker_icon: wpgmap_marker_icon,
96
- wpgmap_marker_lat_lng: wpgmap_marker_lat_lng,
97
- wpgmap_marker_address: wpgmap_marker_address,
98
- wpgmap_have_marker_link: wpgmap_have_marker_link,
99
- wpgmap_marker_link: wpgmap_marker_link,
100
- wpgmap_marker_link_new_tab: wpgmap_marker_link_new_tab,
101
- wpgmap_marker_infowindow_show: wpgmap_marker_infowindow_show,
102
- wpgmap_marker_id: marker_id,
103
- wpgmap_map_id: map_id
104
- };
105
-
106
- var data = {
107
- 'action': action,
108
- 'map_markers_data': map_markers_data,
109
- ajax_nonce:wgm_l.ajax_nonce
110
- };
111
-
112
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
113
- jQuery.post(ajaxurl, data, function (response) {
114
- response = JSON.parse(response);
115
-
116
- if (response.responseCode === 0) {
117
- error_msg.push(response.message);
118
- //$('#marker_errors').html(error_msg.join('<br/>'));
119
- Swal.fire({
120
- icon: 'info',
121
- title: wgm_l.locales.sweet_alert.oops,
122
- html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $10 for Lifetime)</a>'
123
- });
124
- parent.find('.spinner').css('visibility', 'hidden');
125
- return false;
126
- }
127
-
128
- if (!is_update) {
129
- current_map_markers[parseInt(response.marker_id)] = wgm_new_marker;
130
- current_map_infowindows[parseInt(response.marker_id)] = wgm_new_marker_infoindow;
131
- }
132
- wgm_new_marker = null;
133
- wgm_existing_marker_infoindow = null;
134
- wpgmap_reset_marker_add_form();
135
- generateMarkersListView();
136
- parent.find('.spinner').css('visibility', 'hidden');
137
- $('#marker_success').html(save_update_message);
138
- $('.wgm_marker_cancel').trigger('click');
139
- current_map_markers[response.marker_id].setDraggable(false);
140
- is_marker_edit = false;
141
- wgm_new_marker_infoindow = null;
142
- if (!is_update) {
143
- wgm_no_of_marker++;
144
- if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
145
- jQuery('.add_new_marker_btn_area').find(".add_new_marker").css({
146
- 'opacity': .5
147
- });
148
- jQuery('.add_new_marker_btn_area').find(".wgm-pro-label").show();
149
- }
150
- }
151
- });
152
-
153
- });
154
-
155
- $(document.body).on('click', ".add_new_marker", function () {
156
- if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
157
- Swal.fire({
158
- icon: 'info',
159
- title: wgm_l.locales.sweet_alert.oops,
160
- html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $10 for Lifetime)</a>'
161
- });
162
- return false;
163
- }
164
- $(document.body).find('.add_new_marker_form').addClass('wgm_active').show();
165
- $('.wpgmap_marker_update').removeClass('wpgmap_marker_update').addClass('wpgmap_marker_add').css('background-color', '#2271b1').html('<i class="dashicons dashicons-location" style="line-height: 1.6;"></i><b>Save Marker</b>');
166
- $(document.body).find('.wgm_gmap_marker_list').hide();
167
- $(document.body).find('#marker_errors,#marker_success').html('');
168
- wpgmap_reset_marker_add_form();
169
- });
170
-
171
- $(document.body).on('click', ".wgm_marker_cancel", function () {
172
- $(document.body).find('.add_new_marker_form').removeClass('wgm_active').hide();
173
- $(document.body).find('.wgm_gmap_marker_list').show();
174
- wpgmap_reset_marker_add_form();
175
- wgm_vanish_marker('new');
176
- is_marker_edit = false;
177
- });
178
-
179
- $(document.body).find("#wpgmap_have_marker_link").on('change', function () {
180
- if ($(document.body).find("#wpgmap_have_marker_link").val() === '1') {
181
- $("#wpgmap_marker_link_area").show();
182
- } else {
183
- $("#wpgmap_marker_link_area").hide();
184
- }
185
- });
186
-
187
-
188
- });
189
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  (function ($) {
2
+ $(
3
+ function () {
4
+ function generateMarkersListView() {
5
+ $( '#wgm_gmap_marker_list' ).DataTable().ajax.reload();
6
+ }
7
+
8
+ /**
9
+ * Vanish a marker from Map view
10
+ *
11
+ * @param type string
12
+ */
13
+ function wgm_vanish_marker(type = 'new') {
14
+ if (type === 'new') {
15
+ if (wgm_new_marker != null && typeof wgm_new_marker == 'object') {
16
+ wgm_new_marker.setMap( null );
17
+ }
18
+ wgm_new_marker = null;
19
+ } else {
20
+ if (wgm_existing_marker != null && typeof wgm_existing_marker == 'object') {
21
+ wgm_existing_marker.setMap( null );
22
+ }
23
+ wgm_existing_marker = null;
24
+ }
25
+ }
26
+
27
+ /* --------------------Marker add form reset---------------------- */
28
+ function wpgmap_reset_marker_add_form() {
29
+ $( '#wpgmap_marker_name,#wpgmap_marker_address,#wpgmap_marker_lat_lng,#wpgmap_marker_link' ).val( '' );
30
+ $( '#wpgmap_marker_link_new_tab' ).prop( 'checked', false );
31
+ $( '#wpgmap_have_marker_link' ).val( "0" ).change();
32
+ $( document.body ).find( '#marker_errors,#marker_success' ).html( '' );
33
+ $( document.body ).find( "#wpgmap_marker_icon_preview" ).attr( 'src', 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png' );
34
+ $( document.body ).find( "#wpgmap_marker_icon" ).val( 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png' );
35
+ // Reset wp editor content
36
+ tmce_setContent( '', 'wpgmap_marker_desc', 'wpgmap_marker_desc' );
37
+ }
38
+
39
+ // Pre-Loading markers list
40
+ // generateMarkersListView();
41
+ // Marker update or save
42
+ $( document.body ).on(
43
+ 'click',
44
+ ".wpgmap_marker_add,.wpgmap_marker_update",
45
+ function () {
46
+ var is_update = false, action = 'wpgmapembed_save_map_markers',
47
+ save_update_message = 'Marker saved successfully.', marker_id = 0, map_id = 0;
48
+ is_update = $( this ).hasClass( 'wpgmap_marker_update' );
49
+ if (is_update) {
50
+ action = 'wpgmapembed_update_map_markers';
51
+ save_update_message = 'Marker updated successfully.';
52
+ marker_id = $( this ).attr( 'markerid' );
53
+ }
54
+
55
+ map_id = parseInt( $( this ).attr( 'mapid' ) );
56
+
57
+ $( '#marker_errors,#marker_success' ).html( '' );
58
+ $( this ).parent().find( '.spinner' ).css( 'visibility', 'visible' );
59
+ var parent = $( 'body .wgm_gmap_markers' );
60
+ var wpgmap_marker_link_new_tab = 0;
61
+
62
+ // Handling checkboxes
63
+ if (parent.find( "#wpgmap_marker_link_new_tab" ).is( ':checked' ) === true) {
64
+ wpgmap_marker_link_new_tab = 1;
65
+ }
66
+
67
+ var wpgmap_marker_name = parent.find( "#wpgmap_marker_name" ).val();
68
+ var wpgmap_marker_desc = tmce_getContent( 'wpgmap_marker_desc', 'wpgmap_marker_desc' );
69
+ var wpgmap_marker_icon = parent.find( "#wpgmap_marker_icon" ).val();
70
+ var wpgmap_marker_lat_lng = parent.find( "#wpgmap_marker_lat_lng" ).val();
71
+ var wpgmap_marker_address = parent.find( "#wpgmap_marker_address" ).val();
72
+ var wpgmap_have_marker_link = parent.find( "#wpgmap_have_marker_link" ).val();
73
+ var wpgmap_marker_link = parent.find( "#wpgmap_marker_link" ).val();
74
+ var wpgmap_marker_infowindow_show = parent.find( "#wpgmap_marker_infowindow_show" ).val();
75
+
76
+ // Handling front-end validation
77
+ var has_error = false;
78
+ var error_msg = [];
79
+ parent.find( "#wpgmap_marker_name" ).removeClass( 'wgm_error' );
80
+ // if (wpgmap_marker_name === '') {
81
+ // parent.find("#wpgmap_marker_name").addClass('wgm_error');
82
+ // has_error = true;
83
+ // error_msg.push('Please input marker name correctly');
84
+ // }
85
+ if (wpgmap_marker_lat_lng === '') {
86
+ parent.find( "#wpgmap_marker_lat_lng" ).addClass( 'wgm_error' );
87
+ has_error = true;
88
+ error_msg.push( 'Please input latitude, longitude correctly.' );
89
+ }
90
+
91
+ if (has_error) {
92
+ $( '#marker_errors' ).html( error_msg.join( '<br/>' ) );
93
+ parent.find( '.spinner' ).css( 'visibility', 'hidden' );
94
+ return false;
95
+ }
96
+ var map_markers_data = {
97
+ wpgmap_marker_name: wpgmap_marker_name,
98
+ wpgmap_marker_desc: wpgmap_marker_desc,
99
+ wpgmap_marker_icon: wpgmap_marker_icon,
100
+ wpgmap_marker_lat_lng: wpgmap_marker_lat_lng,
101
+ wpgmap_marker_address: wpgmap_marker_address,
102
+ wpgmap_have_marker_link: wpgmap_have_marker_link,
103
+ wpgmap_marker_link: wpgmap_marker_link,
104
+ wpgmap_marker_link_new_tab: wpgmap_marker_link_new_tab,
105
+ wpgmap_marker_infowindow_show: wpgmap_marker_infowindow_show,
106
+ wpgmap_marker_id: marker_id,
107
+ wpgmap_map_id: map_id
108
+ };
109
+
110
+ var data = {
111
+ 'action': action,
112
+ 'map_markers_data': map_markers_data,
113
+ ajax_nonce:wgm_l.ajax_nonce
114
+ };
115
+
116
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
117
+ jQuery.post(
118
+ ajaxurl,
119
+ data,
120
+ function (response) {
121
+ response = JSON.parse( response );
122
+
123
+ if (response.responseCode === 0) {
124
+ error_msg.push( response.message );
125
+ // $('#marker_errors').html(error_msg.join('<br/>'));
126
+ Swal.fire(
127
+ {
128
+ icon: 'info',
129
+ title: wgm_l.locales.sweet_alert.oops,
130
+ html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $10 for Lifetime)</a>'
131
+ }
132
+ );
133
+ parent.find( '.spinner' ).css( 'visibility', 'hidden' );
134
+ return false;
135
+ }
136
+
137
+ if ( ! is_update) {
138
+ current_map_markers[parseInt( response.marker_id )] = wgm_new_marker;
139
+ current_map_infowindows[parseInt( response.marker_id )] = wgm_new_marker_infoindow;
140
+ }
141
+ wgm_new_marker = null;
142
+ wgm_existing_marker_infoindow = null;
143
+ wpgmap_reset_marker_add_form();
144
+ generateMarkersListView();
145
+ parent.find( '.spinner' ).css( 'visibility', 'hidden' );
146
+ $( '#marker_success' ).html( save_update_message );
147
+ $( '.wgm_marker_cancel' ).trigger( 'click' );
148
+ current_map_markers[response.marker_id].setDraggable( false );
149
+ is_marker_edit = false;
150
+ wgm_new_marker_infoindow = null;
151
+ if ( ! is_update) {
152
+ wgm_no_of_marker++;
153
+ if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
154
+ jQuery( '.add_new_marker_btn_area' ).find( ".add_new_marker" ).css(
155
+ {
156
+ 'opacity': .5
157
+ }
158
+ );
159
+ jQuery( '.add_new_marker_btn_area' ).find( ".wgm-pro-label" ).show();
160
+ }
161
+ }
162
+ }
163
+ );
164
+
165
+ }
166
+ );
167
+
168
+ $( document.body ).on(
169
+ 'click',
170
+ ".add_new_marker",
171
+ function () {
172
+ if (wgm_no_of_marker >= 1 && wgm_l.is_premium_user !== '1') {
173
+ Swal.fire(
174
+ {
175
+ icon: 'info',
176
+ title: wgm_l.locales.sweet_alert.oops,
177
+ html: wgm_l.locales.sweet_alert.notice_unlimited_marker + '<br><br><span style="font-size:25px;font-weight:bold;">Only $10 for Lifetime</span><br><br><a target="_blank" href="' + wgm_l.get_p_v_url + '">Upgrade to Pro Version (Only $10 for Lifetime)</a>'
178
+ }
179
+ );
180
+ return false;
181
+ }
182
+ $( document.body ).find( '.add_new_marker_form' ).addClass( 'wgm_active' ).show();
183
+ $( '.wpgmap_marker_update' ).removeClass( 'wpgmap_marker_update' ).addClass( 'wpgmap_marker_add' ).css( 'background-color', '#2271b1' ).html( '<i class="dashicons dashicons-location" style="line-height: 1.6;"></i><b>Save Marker</b>' );
184
+ $( document.body ).find( '.wgm_gmap_marker_list' ).hide();
185
+ $( document.body ).find( '#marker_errors,#marker_success' ).html( '' );
186
+ wpgmap_reset_marker_add_form();
187
+ }
188
+ );
189
+
190
+ $( document.body ).on(
191
+ 'click',
192
+ ".wgm_marker_cancel",
193
+ function () {
194
+ $( document.body ).find( '.add_new_marker_form' ).removeClass( 'wgm_active' ).hide();
195
+ $( document.body ).find( '.wgm_gmap_marker_list' ).show();
196
+ wpgmap_reset_marker_add_form();
197
+ wgm_vanish_marker( 'new' );
198
+ is_marker_edit = false;
199
+ }
200
+ );
201
+
202
+ $( document.body ).find( "#wpgmap_have_marker_link" ).on(
203
+ 'change',
204
+ function () {
205
+ if ($( document.body ).find( "#wpgmap_have_marker_link" ).val() === '1') {
206
+ $( "#wpgmap_marker_link_area" ).show();
207
+ } else {
208
+ $( "#wpgmap_marker_link_area" ).hide();
209
+ }
210
+ }
211
+ );
212
+
213
+ }
214
+ );
215
+ })( jQuery );
admin/includes/constant.php CHANGED
@@ -1,2 +1,4 @@
1
  <?php
2
- if ( ! defined( 'ABSPATH' ) ) exit;
 
 
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
admin/includes/map_theme_presets.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !_wgm_is_premium() ) {
3
+ $map_styles = array(
4
+ 'A Dark World Map' => '[ { "stylers": [ {"visibility": "simplified"} ] }, { "stylers": [ {"color": "#131314"} ] }, { "featureType": "water", "stylers": [ {"color": "#131313"}, {"lightness": 7} ] }, { "elementType": "labels.text.fill", "stylers": [ {"visibility": "on"}, {"lightness": 25} ] } ]',
5
+ 'Blue' => '[{"featureType":"all","stylers":[{"hue":"#0000b0"},{"invert_lightness":"true"},{"saturation":-30}]}]'
6
+ );
7
+ } else {
8
+ $map_styles = array(
9
+ 'A Dark World Map' => '[ { "stylers": [ {"visibility": "simplified"} ] }, { "stylers": [ {"color": "#131314"} ] }, { "featureType": "water", "stylers": [ {"color": "#131313"}, {"lightness": 7} ] }, { "elementType": "labels.text.fill", "stylers": [ {"visibility": "on"}, {"lightness": 25} ] } ]',
10
+ 'Aqua' => '[ { "featureType":"landscape", "stylers":[ { "color":"#6c8080" }, { "visibility":"simplified" } ] }, { "featureType":"administrative", "elementType":"labels.text", "stylers":[ { "visibility":"off" } ] }, { "featureType":"road", "stylers":[ { "visibility":"simplified" } ] }, { "featureType":"poi", "stylers":[ { "visibility":"off" } ] }, { "featureType":"road.highway", "elementType":"labels", "stylers":[ { "visibility":"off" } ] }, { "featureType":"road.highway", "elementType":"labels", "stylers":[ { "visibility":"off" } ] }, { "featureType":"road", "elementType":"labels.icon", "stylers":[ { "visibility":"off" } ] }, { "featureType":"transit", "elementType":"labels", "stylers":[ { "visibility":"off" } ] }, { "elementType":"labels", "stylers":[ { "visibility":"off" } ] }, { "featureType":"road.highway", "stylers":[ { "color":"#d98080" }, { "hue":"#eeff00" }, { "lightness":100 }, { "weight":1.5 } ] } ]',
11
+ 'Avocado World' => '[{"featureType":"water","elementType":"geometry","stylers":[{"visibility":"on"},{"color":"#aee2e0"}]},{"featureType":"landscape","elementType":"geometry.fill","stylers":[{"color":"#abce83"}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"color":"#769E72"}]},{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"color":"#7B8758"}]},{"featureType":"poi","elementType":"labels.text.stroke","stylers":[{"color":"#EBF4A4"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#8dab68"}]},{"featureType":"road","elementType":"geometry.fill","stylers":[{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels.text.fill","stylers":[{"color":"#5B5B3F"}]},{"featureType":"road","elementType":"labels.text.stroke","stylers":[{"color":"#ABCE83"}]},{"featureType":"road","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#A4C67D"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#9BBF72"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#EBF4A4"}]},{"featureType":"transit","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"visibility":"on"},{"color":"#87ae79"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#7f2200"},{"visibility":"off"}]},{"featureType":"administrative","elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"},{"visibility":"on"},{"weight":4.1}]},{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#495421"}]},{"featureType":"administrative.neighborhood","elementType":"labels","stylers":[{"visibility":"off"}]}]',
12
+ 'Bates Green' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#1CB2BD"},{"saturation":53},{"lightness":-44},{"visibility":"on"}]},{"featureType":"road","elementType":"all","stylers":[{"hue":"#1CB2BD"},{"saturation":40}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#BBDC00"},{"saturation":80},{"lightness":-20},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"on"}]}]',
13
+ 'Bentley' => '[ { "featureType": "landscape", "stylers": [ { "hue": "#F1FF00" }, { "saturation": -27.4 }, { "lightness": 9.4 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#0099FF" }, { "saturation": -20 }, { "lightness": 36.4 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#00FF4F" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#FFB300" }, { "saturation": -38 }, { "lightness": 11.2 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#00B6FF" }, { "saturation": 4.2 }, { "lightness": -63.4 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#9FFF00" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] } ]',
14
+ 'Black and White' => '[ { "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "on" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "off" } ] },{ "featureType": "administrative", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "color": "#000000" }, { "weight": 1 } ] },{ "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "color": "#000000" }, { "weight": 0.8 } ] },{ "featureType": "landscape", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "water", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "off" } ] },{ "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "elementType": "labels.text", "stylers": [ { "visibility": "on" } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "color": "#ffffff" } ] },{ "elementType": "labels.text.fill", "stylers": [ { "color": "#000000" } ] },{ "elementType": "labels.icon", "stylers": [ { "visibility": "on" } ] } ]',
15
+ 'Blue' => '[{"featureType":"all","stylers":[{"hue":"#0000b0"},{"invert_lightness":"true"},{"saturation":-30}]}]',
16
+ 'Blue Cyan' => '[ { "featureType": "water", "stylers": [ { "visibility": "on" }, { "color": "#333333" } ] },{ "featureType": "landscape.natural", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#666666" } ] },{ "featureType": "landscape.man_made", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "geometry", "stylers": [ { "color": "#df2f23" }, { "visibility": "off" } ] },{ "featureType": "road.highway.controlled_access", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#cccccc" } ] },{ "featureType": "road.highway.controlled_access", "elementType": "geometry.stroke", "stylers": [ { "color": "#999999" } ] },{ "featureType": "road.local", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [ { "color": "#aaaaaa" } ] },{ "featureType": "road.arterial", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#808080" } ] },{ "featureType": "administrative", "elementType": "geometry.stroke", "stylers": [ { "color": "#aaaaaa" } ] },{ "featureType": "administrative", "elementType": "labels.text" },{ "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "color": "#c6eeee" } ] },{ } ]',
17
+ 'Blue Essence' => '[{"featureType":"landscape.natural","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#e0efef"}]},{"featureType":"poi","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"hue":"#1900ff"},{"color":"#c0e8e8"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":100},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"on"},{"lightness":700}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#7dcdcd"}]}]',
18
+ 'Blue Gray' => '[ { "featureType": "water", "stylers": [ { "visibility": "on" }, { "color": "#b5cbe4" } ] }, { "featureType": "landscape", "stylers": [ { "color": "#efefef" } ] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [ { "color": "#83a5b0" } ] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [ { "color": "#bdcdd3" } ] }, { "featureType": "road.local", "elementType": "geometry", "stylers": [ { "color": "#ffffff" } ] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [ { "color": "#e3eed3" } ] }, { "featureType": "administrative", "stylers": [ { "visibility": "on" }, { "lightness": 33 } ] }, { "featureType": "road" }, { "featureType": "poi.park", "elementType": "labels", "stylers": [ { "visibility": "on" }, { "lightness": 20 } ] }, {}, { "featureType": "road", "stylers": [ { "lightness": 20 } ] } ]',
19
+ 'Blue water' => '[{"featureType":"administrative","elementType":"labels.text.fill","stylers":[{"color":"#444444"}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2f2f2"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"saturation":-100},{"lightness":45}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#46bcec"},{"visibility":"on"}]}]',
20
+ 'Blue-ish' => '[ {"stylers": [{"saturation": -45}, {"lightness": 13}]}, {"featureType": "road.highway", "elementType": "geometry.fill", "stylers": [{"color": "#8fa7b3"}]}, {"featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [{"color": "#667780"}]}, {"featureType": "road.highway", "elementType": "labels.text.fill", "stylers": [{"color": "#333333"}]}, {"featureType": "road.highway", "elementType": "labels.text.stroke", "stylers": [{"color": "#8fa7b3"}, {"gamma": 2}]}, {"featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [{"color": "#a3becc"}]}, {"featureType": "road.arterial", "elementType": "geometry.stroke", "stylers": [{"color": "#7a8f99"}]}, {"featureType": "road.arterial", "elementType": "labels.text.fill", "stylers": [{"color": "#555555"}]}, {"featureType": "road.local", "elementType": "geometry.fill", "stylers": [{"color": "#a3becc"}]}, {"featureType": "road.local", "elementType": "geometry.stroke", "stylers": [{"color": "#7a8f99"}]}, {"featureType": "road.local", "elementType": "labels.text.fill", "stylers": [{"color": "#555555"}]}, {"featureType": "water", "elementType": "geometry.fill", "stylers": [{"color": "#bbd9e9"}]}, {"featureType": "administrative", "elementType": "labels.text.fill", "stylers": [{"color": "#525f66"}]}, {"featureType": "transit", "elementType": "labels.text.stroke", "stylers": [{"color": "#bbd9e9"}, {"gamma": 2}]}, {"featureType": "transit.line", "elementType": "geometry.fill", "stylers": [{"color": "#a3aeb5"}]} ]',
21
+ 'Blueprint (No Labels)' => '[ { "stylers": [ { "visibility": "simplified" }, { "saturation": -100 } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#000045" }, { "lightness": 17 } ] }, { "featureType": "landscape", "elementType": "geometry", "stylers": [ { "color": "#000045" }, { "lightness": 20 } ] }, { "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#000045" }, { "lightness": 17 } ] }, { "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road.highway.controlled_access", "elementType": "geometry.stroke", "stylers": [ { "color": "#000045" }, { "lightness": 20 } ] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [ { "color": "#000045" }, { "lightness": 25 } ] }, { "featureType": "road.local", "elementType": "geometry", "stylers": [ { "color": "#000045" }, { "lightness": 25 } ] }, { "featureType": "poi", "elementType": "geometry", "stylers": [ { "color": "#000045" }, { "lightness": 21 } ] }, { "elementType": "labels.text.stroke", "stylers": [ { "visibility": "off" } ] }, { "elementType": "labels.text.fill", "stylers": [ { "saturation": 100 }, { "color": "#7b94be" }, { "lightness": 50 } ] }, { "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit", "elementType": "geometry", "stylers": [ { "color": "#000045" }, { "lightness": 19 } ] }, { "featureType": "administrative", "elementType": "geometry.fill", "stylers": [ { "color": "#000045" }, { "lightness": 20 } ] }, { "featureType": "administrative", "elementType": "geometry.stroke", "stylers": [ { "color": "#000045" }, { "lightness": 17 }, { "weight": 1.2 } ] } ] ',
22
+ 'Bluish' => '[ { "stylers": [ { "hue": "#007fff" }, { "saturation": 89 } ] },{ "featureType": "water", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "administrative.country", "elementType": "labels", "stylers": [ { "visibility": "off" } ] } ]',
23
+ 'Bobby World' => '[ { "featureType": "landscape.natural.landcover", "stylers": [ { "gamma": 0.44 }, { "hue": "#2bff00" } ] },{ "featureType": "water", "stylers": [ { "hue": "#00a1ff" }, { "saturation": 29 }, { "gamma": 0.74 } ] },{ "featureType": "landscape.natural.terrain", "stylers": [ { "hue": "#00ff00" }, { "saturation": 54 }, { "lightness": -51 }, { "gamma": 0.4 } ] },{ "featureType": "transit.line", "stylers": [ { "gamma": 0.27 }, { "hue": "#0077ff" }, { "saturation": -91 }, { "lightness": 36 } ] },{ "featureType": "landscape.man_made", "stylers": [ { "saturation": 10 }, { "lightness": -23 }, { "hue": "#0099ff" }, { "gamma": 0.71 } ] },{ "featureType": "poi.business", "stylers": [ { "hue": "#0055ff" }, { "saturation": 9 }, { "lightness": -46 }, { "gamma": 1.05 } ] },{ "featureType": "administrative.country", "stylers": [ { "gamma": 0.99 } ] },{ "featureType": "administrative.province", "stylers": [ { "lightness": 36 }, { "saturation": -54 }, { "gamma": 0.76 } ] },{ "featureType": "administrative.locality", "stylers": [ { "lightness": 33 }, { "saturation": -61 }, { "gamma": 1.21 } ] },{ "featureType": "administrative.neighborhood", "stylers": [ { "hue": "#ff0000" }, { "gamma": 2.44 } ] },{ "featureType": "road.highway.controlled_access", "stylers": [ { "hue": "#ff0000" }, { "lightness": 67 }, { "saturation": -40 } ] },{ "featureType": "road.arterial", "stylers": [ { "hue": "#ff6600" }, { "saturation": 52 }, { "gamma": 0.64 } ] },{ "featureType": "road.local", "stylers": [ { "hue": "#006eff" }, { "gamma": 0.46 }, { "saturation": -3 }, { "lightness": -10 } ] },{ "featureType": "transit.line", "stylers": [ { "hue": "#0077ff" }, { "saturation": -46 }, { "gamma": 0.58 } ] },{ "featureType": "transit.station", "stylers": [ { "gamma": 0.8 } ] },{ "featureType": "transit.station.rail", "stylers": [ { "hue": "#ff0000" }, { "saturation": -45 }, { "gamma": 0.9 } ] },{ "elementType": "labels.text.fill", "stylers": [ { "gamma": 0.58 } ] },{ "featureType": "landscape.man_made", "elementType": "geometry.fill", "stylers": [ { "gamma": 2.01 }, { "hue": "#00ffff" }, { "lightness": 22 } ] },{ "featureType": "transit", "stylers": [ { "saturation": -87 }, { "lightness": 44 }, { "gamma": 1.98 }, { "visibility": "off" } ] },{ "featureType": "poi.business", "elementType": "labels.text", "stylers": [ { "gamma": 0.06 }, { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "geometry", "stylers": [ { "hue": "#00aaff" }, { "lightness": -6 }, { "gamma": 2.21 } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "gamma": 3.84 } ] },{ "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "labels.text.stroke", "stylers": [ { "gamma": 9.99 } ] },{ "featureType": "administrative", "stylers": [ { "gamma": 0.01 } ] } ]',
24
+ 'Bright & Bubbly' => '[ { "featureType": "water", "stylers": [ { "color": "#19a0d8" } ] }, { "featureType": "administrative", "elementType": "labels.text.stroke", "stylers": [ { "color": "#ffffff" }, { "weight": 6 } ] }, { "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [ { "color": "#e85113" } ] }, { "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "color": "#efe9e4" }, { "lightness": -40 } ] }, { "featureType": "road.arterial", "elementType": "geometry.stroke", "stylers": [ { "color": "#efe9e4" }, { "lightness": -20 } ] }, { "featureType": "road", "elementType": "labels.text.stroke", "stylers": [ { "lightness": 100 } ] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [ { "lightness": -100 } ] }, { "featureType": "road.highway", "elementType": "labels.icon" }, { "featureType": "landscape", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "landscape", "stylers": [ { "lightness": 20 }, { "color": "#efe9e4" } ] }, { "featureType": "landscape.man_made", "stylers": [ { "visibility": "off" } ] }, { "featureType": "water", "elementType": "labels.text.stroke", "stylers": [ { "lightness": 100 } ] }, { "featureType": "water", "elementType": "labels.text.fill", "stylers": [ { "lightness": -100 } ] }, { "featureType": "poi", "elementType": "labels.text.fill", "stylers": [ { "hue": "#11ff00" } ] }, { "featureType": "poi", "elementType": "labels.text.stroke", "stylers": [ { "lightness": 100 } ] }, { "featureType": "poi", "elementType": "labels.icon", "stylers": [ { "hue": "#4cff00" }, { "saturation": 58 } ] }, { "featureType": "poi", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#f0e4d3" } ] }, { "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#efe9e4" }, { "lightness": -25 } ] }, { "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [ { "color": "#efe9e4" }, { "lightness": -10 } ] }, { "featureType": "poi", "elementType": "labels", "stylers": [ { "visibility": "simplified" } ] } ]',
25
+ 'Brownie' => '[{"stylers":[{"hue":"#ff8800"},{"gamma":0.4}]}]',
26
+ 'Candy Colours ' => '[ { "featureType": "landscape", "stylers": [ { "hue": "#FFE100" }, { "saturation": 34.48275862068968 }, { "lightness": -1.490196078431353 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#FF009A" }, { "saturation": -2.970297029703005 }, { "lightness": -17.815686274509815 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FFE100" }, { "saturation": 8.600000000000009 }, { "lightness": -4.400000000000006 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#00C3FF" }, { "saturation": 29.31034482758622 }, { "lightness": -38.980392156862735 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#0078FF" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#00FF19" }, { "saturation": -30.526315789473685 }, { "lightness": -22.509803921568633 }, { "gamma": 1 } ] } ]',
27
+ 'Caribbean Mountain' => '[ { "featureType": "poi.medical", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "poi.business", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi.place_of_worship", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] },{ "featureType": "landscape", "stylers": [ { "color": "#cec6b3" } ] },{ "featureType": "road", "stylers": [ { "color": "#f2eee8" } ] },{ "featureType": "water", "stylers": [ { "color": "#01186a" } ] },{ "featureType": "road", "elementType": "labels.text.fill", "stylers": [ { "color": "#cec6b3" } ] },{ "featureType": "landscape.man_made", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi.government", "stylers": [ { "visibility": "off" } ] } ]',
28
+ 'Chilled' => '[{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"hue":149},{"saturation":-78},{"lightness":0}]},{"featureType":"road.highway","stylers":[{"hue":-31},{"saturation":-40},{"lightness":2.8}]},{"featureType":"poi","elementType":"label","stylers":[{"visibility":"off"}]},{"featureType":"landscape","stylers":[{"hue":163},{"saturation":-26},{"lightness":-1.1}]},{"featureType":"transit","stylers":[{"visibility":"off"}]},{"featureType":"water","stylers":[{"hue":3},{"saturation":-24.24},{"lightness":-38.57}]}]',
29
+ 'Clean Cut' => '[ { featureType: "road", elementType: "geometry", stylers: [ { lightness: 100 }, { visibility: "simplified" } ] },{ "featureType": "water", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#C6E2FF", } ] }, { "featureType": "poi", "elementType": "geometry.fill", "stylers": [ { "color": "#C5E3BF" } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "color": "#D1D1B8" } ] } ]',
30
+ 'Clean Grey' => '[ { "featureType": "administrative", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.country", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.province", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] }, { "featureType": "landscape", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#e3e3e3" } ] }, { "featureType": "landscape.natural", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road", "elementType": "all", "stylers": [ { "color": "#cccccc" } ] }, { "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.line", "elementType": "labels.text", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.station.airport", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.station.airport", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#FFFFFF" } ] }, { "featureType": "water", "elementType": "labels", "stylers": [ { "visibility": "off" } ] } ]',
31
+ 'Cobalt' => '[{"featureType":"all","elementType":"all","stylers":[{"invert_lightness":true},{"saturation":10},{"lightness":30},{"gamma":0.5},{"hue":"#435158"}]}]',
32
+ 'Cool Grey' => '[ { "featureType": "landscape", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ "stylers": [ { "hue": "#00aaff" }, { "saturation": -100 }, { "gamma": 2.15 }, { "lightness": 12 } ] },{ "featureType": "road", "elementType": "labels.text.fill", "stylers": [ { "visibility": "on" }, { "lightness": 24 } ] },{ "featureType": "road", "elementType": "geometry", "stylers": [ { "lightness": 57 } ] } ]',
33
+ 'Countries' => '[{"featureType":"all","stylers":[{"visibility":"off"}]},{"featureType":"water","stylers":[{"visibility":"on"},{"lightness":-100}]}]',
34
+ 'Dark' => '[{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"administrative","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"administrative.country","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"administrative.country","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"administrative.country","elementType":"labels.text","stylers":[{"visibility":"simplified"}]},{"featureType":"administrative.province","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"administrative.locality","elementType":"all","stylers":[{"visibility":"simplified"},{"saturation":"-100"},{"lightness":"30"}]},{"featureType":"administrative.neighborhood","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"landscape","elementType":"all","stylers":[{"visibility":"simplified"},{"gamma":"0.00"},{"lightness":"74"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"lightness":"3"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}]',
35
+ 'Dark Grey on Light Grey' => '[ { "featureType": "administrative", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.country", "elementType": "geometry.stroke", "stylers": [ { "color": "#DCE7EB" } ] }, { "featureType": "administrative.province", "elementType": "geometry.stroke", "stylers": [ { "color": "#DCE7EB" } ] }, { "featureType": "landscape", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "landscape.natural", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.line", "elementType": "labels.text", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.station.airport", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.station.airport", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#83888B" } ] }, { "featureType": "water", "elementType": "labels", "stylers": [ { "visibility": "off" } ] } ]',
36
+ 'Deep Green' => '[ { "featureType": "administrative", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] },{ "featureType": "landscape.man_made", "stylers": [ { "visibility": "simplified" }, { "color": "#ffe24d" } ] },{ "featureType": "road", "stylers": [ { "visibility": "simplified" }, { "color": "#158c28" } ] },{ "featureType": "landscape.natural", "stylers": [ { "visibility": "simplified" }, { "color": "#37b34a" } ] },{ "featureType": "water", "stylers": [ { "color": "#ffe24d" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "simplified" }, { "color": "#8bc53f" } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "color": "#808080" }, { "gamma": 9.91 }, { "visibility": "off" } ] },{ "elementType": "labels.text.fill", "stylers": [ { "color": "#ffffff" }, { "lightness": 100 }, { "visibility": "on" } ] },{"elementType": "labels.icon","stylers": [ { "visibility": "off" }] }]',
37
+ 'Esperanto' => '[ { "elementType": "labels.text.stroke", "stylers": [ { "color": "#ffffff" } ] }, { "elementType": "labels.text.fill", "stylers": [ { "color": "#000000" } ] }, { "featureType": "water", "elementType": "geometry", "stylers": [ { "color": "#0000ff" } ] }, { "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#ff0000" } ] },{ "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "color": "#000100" } ] },{ "featureType": "road.highway.controlled_access", "elementType": "geometry.fill", "stylers": [ { "color": "#ffff00" } ] },{ "featureType": "road.highway.controlled_access", "elementType": "geometry.stroke", "stylers": [ { "color": "#ff0000" } ] }, { "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [ { "color": "#ffa91a" } ] }, { "featureType": "road.arterial", "elementType": "geometry.stroke", "stylers": [ { "color": "#000000" } ] }, { "featureType": "landscape.natural", "stylers": [ { "saturation": 36 }, { "gamma": 0.55 } ] }, { "featureType": "road.local", "elementType": "geometry.stroke", "stylers": [ { "color": "#000000" } ] }, { "featureType": "road.local", "elementType": "geometry.fill", "stylers": [ { "color": "#ffffff" } ] }, { "featureType": "landscape.man_made", "elementType": "geometry.stroke", "stylers": [ { "lightness": -100 }, { "weight": 2.1 } ] }, { "featureType": "landscape.man_made", "elementType": "geometry.fill", "stylers": [ { "invert_lightness": true }, { "hue": "#ff0000" }, { "gamma": 3.02 }, { "lightness": 20 }, { "saturation": 40 } ] }, { "featureType": "poi.attraction", "stylers": [ { "saturation": 100 }, { "hue": "#ff00ee" }, { "lightness": -13 } ] }, { "featureType": "poi.government", "stylers": [ { "saturation": 100 }, { "hue": "#eeff00" }, { "gamma": 0.67 }, { "lightness": -26 } ] }, { "featureType": "poi.medical", "elementType": "geometry.fill", "stylers": [ { "hue": "#ff0000" }, { "saturation": 100 }, { "lightness": -37 } ] }, { "featureType": "poi.medical", "elementType": "labels.text.fill", "stylers": [ { "color": "#ff0000" } ] }, { "featureType": "poi.school", "stylers": [ { "hue": "#ff7700" }, { "saturation": 97 }, { "lightness": -41 } ] }, { "featureType": "poi.sports_complex", "stylers": [ { "saturation": 100 }, { "hue": "#00ffb3" }, { "lightness": -71 } ] }, { "featureType": "poi.park", "stylers": [ { "saturation": 84 }, { "lightness": -57 }, { "hue": "#a1ff00" } ] }, { "featureType": "transit.station.airport", "elementType": "geometry.fill", "stylers": [ { "gamma": 0.11 } ] }, { "featureType": "transit.station", "elementType": "labels.text.stroke", "stylers": [ { "color": "#ffc35e" } ] }, { "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "lightness": -100 } ] }, { "featureType": "administrative", "stylers": [ { "saturation": 100 }, { "gamma": 0.35 }, { "lightness": 20 } ] }, { "featureType": "poi.business", "elementType": "geometry.fill", "stylers": [ { "saturation": -100 }, { "gamma": 0.35 } ] }, { "featureType": "poi.business", "elementType": "labels.text.stroke", "stylers": [ { "color": "#69ffff" } ] }, { "featureType": "poi.place_of_worship", "elementType": "labels.text.stroke", "stylers": [ { "color": "#c3ffc3" } ] } ]',
38
+ 'Flat Map' => '[{"featureType":"all","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"landscape","elementType":"all","stylers":[{"visibility":"on"},{"color":"#f3f4f4"}]},{"featureType":"landscape.man_made","elementType":"geometry","stylers":[{"weight":0.9},{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"visibility":"on"},{"color":"#83cead"}]},{"featureType":"road","elementType":"all","stylers":[{"visibility":"on"},{"color":"#ffffff"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"on"},{"color":"#fee379"}]},{"featureType":"road.arterial","elementType":"all","stylers":[{"visibility":"on"},{"color":"#fee379"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#7fc8ed"}]}]',
39
+ 'Flat Map with Labels' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#7fc8ed"},{"saturation":55},{"lightness":-6},{"visibility":"on"}]},{"featureType":"water","elementType":"labels","stylers":[{"hue":"#7fc8ed"},{"saturation":55},{"lightness":-6},{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"hue":"#83cead"},{"saturation":1},{"lightness":-15},{"visibility":"on"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#f3f4f4"},{"saturation":-84},{"lightness":59},{"visibility":"on"}]},{"featureType":"landscape","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#bbbbbb"},{"saturation":-100},{"lightness":26},{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"hue":"#ffcc00"},{"saturation":100},{"lightness":-35},{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#ffcc00"},{"saturation":100},{"lightness":-22},{"visibility":"on"}]},{"featureType":"poi.school","elementType":"all","stylers":[{"hue":"#d7e4e4"},{"saturation":-60},{"lightness":23},{"visibility":"on"}]}]',
40
+ 'Flat green' => '[{ "stylers": [ { "hue": "#bbff00" }, { "weight": 0.5 }, { "gamma": 0.5 } ] },{ "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "landscape.natural", "stylers": [ { "color": "#a4cc48" } ] },{ "featureType": "road", "elementType": "geometry", "stylers": [ { "color": "#ffffff" }, { "visibility": "on" }, { "weight": 1 } ] },{ "featureType": "administrative", "elementType": "labels", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.highway", "elementType": "labels", "stylers": [ { "visibility": "simplified" }, { "gamma": 1.14 }, { "saturation": -18 } ] },{ "featureType": "road.highway.controlled_access", "elementType": "labels", "stylers": [ { "saturation": 30 }, { "gamma": 0.76 } ] },{ "featureType": "road.local", "stylers": [ { "visibility": "simplified" }, { "weight": 0.4 }, { "lightness": -8 } ] },{ "featureType": "water", "stylers": [ { "color": "#4aaecc" } ] },{ "featureType": "landscape.man_made", "stylers": [ { "color": "#718e32" } ] },{ "featureType": "poi.business", "stylers": [ { "saturation": 68 }, { "lightness": -61 } ] },{ "featureType": "administrative.locality", "elementType": "labels.text.stroke", "stylers": [ { "weight": 2.7 }, { "color": "#f4f9e8" } ] },{ "featureType": "road.highway.controlled_access", "elementType": "geometry.stroke", "stylers": [ { "weight": 1.5 }, { "color": "#e53013" }, { "saturation": -42 }, { "lightness": 28 } ] }]',
41
+ 'Golden Crown' => '[ { "featureType": "landscape", "stylers": [ { "visibility": "on" }, { "color": "#e7cd79" }, { "weight": 0.1 } ] }, { "featureType": "water", "stylers": [ { "visibility": "simplified" }, { "color": "#282828" } ] }, { "featureType": "landscape.natural.landcover", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#d6bc68" } ] }, { "featureType": "administrative.locality", "elementType": "geometry", "stylers": [ { "visibility": "off" }, { "color": "#d6bc68" } ] }, { "featureType": "road.arterial", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#d6bc68" } ] }, { "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "on" }, { "color": "#d6bc68" } ] }, { "featureType": "transit.station.airport", "elementType": "geometry.fill", "stylers": [ { "visibility": "off" }, { "color": "#d6bc68" } ] }, { "featureType": "poi" }, { "featureType": "transit.line", "stylers": [ { "color": "#d6bc68" }, { "visibility": "on" } ] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" }, { "weight": 1 }, { "color": "#e9d9a6" } ] }, { "featureType": "road", "elementType": "geometry", "stylers": [ { "visibility": "simplified" }, { "color": "#e9d9a6" } ] }, { "featureType": "road.highway", "elementType": "geometry", "stylers": [ { "visibility": "simplified" }, { "color": "#e9d9a6" } ] }, { "featureType": "poi.business", "stylers": [ { "color": "#e9d9a6" }, { "visibility": "on" } ] }, {}, { "featureType": "poi.government", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi.school", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi.medical", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi.attraction", "elementType": "geometry", "stylers": [ { "visibility": "off" }, { "color": "#cfb665" } ] }, { "featureType": "poi.place_of_worship", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi.sports_complex", "stylers": [ { "visibility": "off" } ] }, {}, { "featureType": "road.arterial", "elementType": "labels.text.stroke", "stylers": [ { "color": "#cfb665" }, { "visibility": "off" } ] }, { "featureType": "road.highway", "elementType": "labels.text", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road.highway.controlled_access", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road" } ]',
42
+ 'Grass is greener. Water is bluer.' => '[ { "stylers": [ { "saturation": -100 } ] },{ "featureType": "water", "elementType": "geometry.fill", "stylers": [ { "color": "#0099dd" } ] },{ "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi.park", "elementType": "geometry.fill", "stylers": [ { "color": "#aadd55" } ] },{ "featureType": "road.highway", "elementType": "labels", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.arterial", "elementType": "labels.text", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.local", "elementType": "labels.text", "stylers": [ { "visibility": "on" } ] },{ } ]',
43
+ 'Greyscale' => '[{"featureType":"all","elementType":"all","stylers":[{"saturation":-100},{"gamma":0.5}]}]',
44
+ 'Hard edges' => '[ { "featureType": "landscape.natural", "stylers": [ { "saturation": -100 }, { "lightness": 100 } ] },{ "featureType": "water", "stylers": [ { "saturation": -100 }, { "lightness": -86 } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "saturation": -100 }, { "lightness": 100 } ] },{ "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "saturation": -100 }, { "lightness": -75 } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "saturation": -100 }, { "lightness": 97 } ] },{ "featureType": "poi.park", "stylers": [ { "saturation": -100 }, { "lightness": -100 } ] },{ "featureType": "poi.park", "elementType": "labels.text.fill", "stylers": [ { "saturation": -100 }, { "lightness": 100 } ] },{ "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "on" } ] },{ "featureType": "landscape.man_made", "stylers": [ { "saturation": -100 }, { "lightness": -68 } ] },{ "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [ { "saturation": -100 }, { "lightness": 100 } ] },{ "featureType": "administrative", "elementType": "labels.text.stroke", "stylers": [ { "saturation": -100 }, { "lightness": -100 } ] },{ "featureType": "poi", "stylers": [ { "saturation": -100 }, { "lightness": 91 } ] },{ "featureType": "poi", "elementType": "labels.text.fill", "stylers": [ { "saturation": -100 }, { "lightness": -100 } ] },{ "featureType": "transit.station", "stylers": [ { "saturation": -100 }, { "lightness": -22 } ] },{ "featureType": "landscape.man_made", "elementType": "geometry.stroke", "stylers": [ { "hue": "#ff004c" }, { "saturation": -100 }, { "lightness": 44 } ] },{ "elementType": "labels.text.fill", "stylers": [ { "saturation": 1 }, { "lightness": -100 } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "saturation": -100 }, { "lightness": 100 } ] },{ "featureType": "administrative.locality", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.locality", "elementType": "labels", "stylers": [ { "visibility": "on" } ] },{ "featureType": "water", "elementType": "labels", "stylers": [ { "visibility": "on" } ] } ]',
45
+ 'HashtagNineNineNine' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#bbbbbb"},{"saturation":-100},{"lightness":-4},{"visibility":"on"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#999999"},{"saturation":-100},{"lightness":-33},{"visibility":"on"}]},{"featureType":"road","elementType":"all","stylers":[{"hue":"#999999"},{"saturation":-100},{"lightness":-6},{"visibility":"on"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#aaaaaa"},{"saturation":-100},{"lightness":-15},{"visibility":"on"}]}]',
46
+ 'Hints of Gold' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#252525"},{"saturation":-100},{"lightness":-81},{"visibility":"on"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#666666"},{"saturation":-100},{"lightness":-55},{"visibility":"on"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"hue":"#555555"},{"saturation":-100},{"lightness":-57},{"visibility":"on"}]},{"featureType":"road","elementType":"all","stylers":[{"hue":"#777777"},{"saturation":-100},{"lightness":-6},{"visibility":"on"}]},{"featureType":"administrative","elementType":"all","stylers":[{"hue":"#cc9900"},{"saturation":100},{"lightness":-22},{"visibility":"on"}]},{"featureType":"transit","elementType":"all","stylers":[{"hue":"#444444"},{"saturation":0},{"lightness":-64},{"visibility":"off"}]},{"featureType":"poi","elementType":"labels","stylers":[{"hue":"#555555"},{"saturation":-100},{"lightness":-57},{"visibility":"off"}]}]',
47
+ 'Holiday' => '[ { "featureType": "landscape", "stylers": [ { "hue": "#FFB000" }, { "saturation": 71.66666666666669 }, { "lightness": -28.400000000000006 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#E8FF00" }, { "saturation": -76.6 }, { "lightness": 113 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FF8300" }, { "saturation": -77 }, { "lightness": 27.400000000000006 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#FF8C00" }, { "saturation": -66.6 }, { "lightness": 34.400000000000006 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#00C4FF" }, { "saturation": 22.799999999999997 }, { "lightness": -11.399999999999991 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#9FFF00" }, { "saturation": 0 }, { "lightness": -23.200000000000003 }, { "gamma": 1 } ] } ]',
48
+ 'Homage to Toner' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"simplified"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#FFFFFF"},{"saturation":-100},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[]},{"featureType":"landscape.natural","elementType":"all","stylers":[]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road","elementType":"all","stylers":[{"hue":"#333333"},{"saturation":-100},{"lightness":-69},{"visibility":"simplified"}]},{"featureType":"poi.attraction","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"administrative.locality","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]},{"featureType":"poi.government","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]}]',
49
+ 'Hopper' => '[{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#165c64"},{"saturation":34},{"lightness":-69},{"visibility":"on"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#b7caaa"},{"saturation":-14},{"lightness":-18},{"visibility":"on"}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"hue":"#cbdac1"},{"saturation":-6},{"lightness":-9},{"visibility":"on"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#8d9b83"},{"saturation":-89},{"lightness":-12},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#d4dad0"},{"saturation":-88},{"lightness":54},{"visibility":"simplified"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"hue":"#bdc5b6"},{"saturation":-89},{"lightness":-3},{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"hue":"#bdc5b6"},{"saturation":-89},{"lightness":-26},{"visibility":"on"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"hue":"#c17118"},{"saturation":61},{"lightness":-45},{"visibility":"on"}]},{"featureType":"poi.park","elementType":"all","stylers":[{"hue":"#8ba975"},{"saturation":-46},{"lightness":-28},{"visibility":"on"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"hue":"#a43218"},{"saturation":74},{"lightness":-51},{"visibility":"simplified"}]},{"featureType":"administrative.province","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"administrative.neighborhood","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]},{"featureType":"administrative.locality","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]},{"featureType":"administrative","elementType":"all","stylers":[{"hue":"#3a3935"},{"saturation":5},{"lightness":-57},{"visibility":"off"}]},{"featureType":"poi.medical","elementType":"geometry","stylers":[{"hue":"#cba923"},{"saturation":50},{"lightness":-46},{"visibility":"on"}]}]',
50
+ 'Hot Pink' => '[{"stylers":[{"hue":"#ff61a6"},{"visibility":"on"},{"invert_lightness":true},{"saturation":40},{"lightness":10}]}]',
51
+ 'Icy Blue' => '[{"stylers":[{"hue":"#2c3e50"},{"saturation":250}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":50},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]}]',
52
+ 'Just places' => '[ { "featureType": "road", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] },{ "featureType": "landscape", "elementType": "geometry", "stylers": [ { "color": "#fffffa" } ] },{ "featureType": "water", "stylers": [ { "lightness": 50 } ] },{ "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "off" } ] },{ "featureType": "administrative", "elementType": "geometry", "stylers": [ { "lightness": 40 } ] } ]',
53
+ 'Lemon Tree' => '[{"featureType":"road.highway","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"landscape.natural","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"road","elementType":"all","stylers":[{"hue":"#ffe94f"},{"saturation":100},{"lightness":4},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#ffe94f"},{"saturation":100},{"lightness":4},{"visibility":"on"}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#333333"},{"saturation":-100},{"lightness":-74},{"visibility":"off"}]}]',
54
+ 'Light Blue Water' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#71d6ff"},{"saturation":100},{"lightness":-5},{"visibility":"on"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"transit","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#deecec"},{"saturation":-73},{"lightness":72},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"labels","stylers":[{"hue":"#bababa"},{"saturation":-100},{"lightness":25},{"visibility":"on"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#e3e3e3"},{"saturation":-100},{"lightness":0},{"visibility":"on"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"administrative","elementType":"labels","stylers":[{"hue":"#59cfff"},{"saturation":100},{"lightness":34},{"visibility":"on"}]}]',
55
+ 'Light Gray' => '[ { "featureType": "water", "elementType": "geometry.fill", "stylers": [ { "color": "#d3d3d3" } ] },{ "featureType": "transit", "stylers": [ { "color": "#808080" }, { "visibility": "off" } ] },{ "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "visibility": "on" }, { "color": "#b3b3b3" } ] },{ "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "road.local", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#ffffff" }, { "weight": 1.8 } ] },{ "featureType": "road.local", "elementType": "geometry.stroke", "stylers": [ { "color": "#d7d7d7" } ] },{ "featureType": "poi", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#ebebeb" } ] },{ "featureType": "administrative", "elementType": "geometry", "stylers": [ { "color": "#a7a7a7" } ] },{ "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "road.arterial", "elementType": "geometry.fill", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "landscape", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#efefef" } ] },{ "featureType": "road", "elementType": "labels.text.fill", "stylers": [ { "color": "#696969" } ] },{ "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [ { "visibility": "on" }, { "color": "#737373" } ] },{ "featureType": "poi", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road.arterial", "elementType": "geometry.stroke", "stylers": [ { "color": "#d6d6d6" } ] },{ "featureType": "road", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ },{ "featureType": "poi", "elementType": "geometry.fill", "stylers": [ { "color": "#dadada" } ] } ]',
56
+ 'Light Green' => '[ {"stylers":[ { "hue":"#baf4c4" }, { "saturation":10 } ]}, { "featureType":"water", "stylers":[{ "color":"#effefd" }] }, { "featureType":"all", "elementType":"labels", "stylers":[{ "visibility":"off" }] }, { featureType:"administrative", elementType:"labels", stylers:[ {visibility:"on"} ] }, { featureType:"road", elementType:"all", stylers:[ {visibility:"off"} ] }, { featureType:"transit", elementType:"all", stylers:[ {visibility:"off"} ] } ]',
57
+ 'Light Monochrome' => '[{"featureType":"administrative.locality","elementType":"all","stylers":[{"hue":"#2c2e33"},{"saturation":7},{"lightness":19},{"visibility":"on"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#bbc0c4"},{"saturation":-93},{"lightness":31},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#bbc0c4"},{"saturation":-93},{"lightness":31},{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"labels","stylers":[{"hue":"#bbc0c4"},{"saturation":-93},{"lightness":-2},{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"hue":"#e9ebed"},{"saturation":-90},{"lightness":-8},{"visibility":"simplified"}]},{"featureType":"transit","elementType":"all","stylers":[{"hue":"#e9ebed"},{"saturation":10},{"lightness":69},{"visibility":"on"}]},{"featureType":"water","elementType":"all","stylers":[{"hue":"#e9ebed"},{"saturation":-78},{"lightness":67},{"visibility":"simplified"}]}]',
58
+ 'Lost in the desert' => '[ { "elementType": "labels", "stylers": [ { "visibility": "off" }, { "color": "#f49f53" } ] },{ "featureType": "landscape", "stylers": [ { "color": "#f9ddc5" }, { "lightness": -7 } ] },{ "featureType": "road", "stylers": [ { "color": "#813033" }, { "lightness": 43 } ] },{ "featureType": "poi.business", "stylers": [ { "color": "#645c20" }, { "lightness": 38 } ] },{ "featureType": "water", "stylers": [ { "color": "#1994bf" }, { "saturation": -69 }, { "gamma": 0.99 }, { "lightness": 43 } ] },{ "featureType": "road.local", "elementType": "geometry.fill", "stylers": [ { "color": "#f19f53" }, { "weight": 1.3 }, { "visibility": "on" }, { "lightness": 16 } ] },{ "featureType": "poi.business" },{ "featureType": "poi.park", "stylers": [ { "color": "#645c20" }, { "lightness": 39 } ] },{ "featureType": "poi.school", "stylers": [ { "color": "#a95521" }, { "lightness": 35 } ] },{ },{ "featureType": "poi.medical", "elementType": "geometry.fill", "stylers": [ { "color": "#813033" }, { "lightness": 38 }, { "visibility": "off" } ] },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ },{ "elementType": "labels" },{ "featureType": "poi.sports_complex", "stylers": [ { "color": "#9e5916" }, { "lightness": 32 } ] },{ },{ "featureType": "poi.government", "stylers": [ { "color": "#9e5916" }, { "lightness": 46 } ] },{ "featureType": "transit.station", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit.line", "stylers": [ { "color": "#813033" }, { "lightness": 22 } ] },{ "featureType": "transit", "stylers": [ { "lightness": 38 } ] },{ "featureType": "road.local", "elementType": "geometry.stroke", "stylers": [ { "color": "#f19f53" }, { "lightness": -10 } ] },{ },{ },{ } ]',
59
+ 'Lunar Landscape' => '[{"stylers":[{"hue":"#ff1a00"},{"invert_lightness":true},{"saturation":-100},{"lightness":33},{"gamma":0.5}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#2D333C"}]}]',
60
+ 'MapBox' => '[ { "featureType": "water", "stylers": [ { "saturation": 43 }, { "lightness": -11 }, { "hue": "#0088ff" } ] }, { "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "hue": "#ff0000" }, { "saturation": -100 }, { "lightness": 99 } ] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "color": "#808080" }, { "lightness": 54 } ] }, { "featureType": "landscape.man_made", "elementType": "geometry.fill", "stylers": [ { "color": "#ece2d9" } ] }, { "featureType": "poi.park", "elementType": "geometry.fill", "stylers": [ { "color": "#ccdca1" } ] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [ { "color": "#767676" } ] }, { "featureType": "road", "elementType": "labels.text.stroke", "stylers": [ { "color": "#ffffff" } ] }, { "featureType": "poi", "stylers": [ { "visibility": "off" } ] }, { "featureType": "landscape.natural", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#b8cb93" } ] }, { "featureType": "poi.park", "stylers": [ { "visibility": "on" } ] }, { "featureType": "poi.sports_complex", "stylers": [ { "visibility": "on" } ] }, { "featureType": "poi.medical", "stylers": [ { "visibility": "on" } ] }, { "featureType": "poi.business", "stylers": [ { "visibility": "simplified" } ] } ]',
61
+ 'MapBox Clean' => '[ { "featureType":"water", "stylers":[ { "saturation":43 }, { "lightness":-11 }, { "hue":"#0088ff" } ] }, { "featureType":"road", "elementType":"geometry.fill", "stylers":[ { "hue":"#ff0000" }, { "saturation":-100 }, { "lightness":99 } ] }, { "featureType":"road", "elementType":"geometry.stroke", "stylers":[ { "color":"#808080" }, { "lightness":54 } ] }, { "featureType":"landscape.man_made", "elementType":"geometry.fill", "stylers":[ { "color":"#ece2d9" } ] }, { "featureType":"poi.park", "elementType":"geometry.fill", "stylers":[ { "color":"#ccdca1" } ] }, { "featureType":"road", "elementType":"labels.text.fill", "stylers":[ { "color":"#767676" } ] }, { "featureType":"road", "elementType":"labels.text.stroke", "stylers":[ { "color":"#ffffff" } ] }, { "featureType":"poi", "stylers":[ { "visibility":"on" } ] }, { "featureType":"landscape.natural", "elementType":"geometry.fill", "stylers":[ { "visibility":"on" }, { "color":"#EBE5E0" } ] }, { "featureType":"poi.park", "stylers":[ { "visibility":"on" } ] }, { "featureType":"poi.sports_complex", "stylers":[ { "visibility":"on" } ] } ]',
62
+ 'Midnight Commander' => '[{"featureType":"all","elementType":"labels.text.fill","stylers":[{"color":"#ffffff"}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"color":"#000000"},{"lightness":13}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#144b53"},{"lightness":14},{"weight":1.4}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#08304b"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#0c4152"},{"lightness":5}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#0b434f"},{"lightness":25}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#000000"}]},{"featureType":"road.arterial","elementType":"geometry.stroke","stylers":[{"color":"#0b3d51"},{"lightness":16}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"}]},{"featureType":"transit","elementType":"all","stylers":[{"color":"#146474"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#021019"}]}]',
63
+ 'Military Flat' => '[ { "featureType": "landscape", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "hue": "#00ff88" }, { "lightness": 14 }, { "color": "#667348" }, { "saturation": 4 }, { "gamma": 1.14 } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "administrative.country", "elementType": "geometry.stroke", "stylers": [ { "color": "#313916" }, { "weight": 0.8 } ] },{ "featureType": "road", "stylers": [ { "visibility": "off" } ] },{ "featureType": "administrative.locality", "elementType": "labels.icon", "stylers": [ { "visibility": "simplified" }, { "color": "#334b1f" } ] },{ "featureType": "administrative.province", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "stylers": [ { "visibility": "simplified" } ] } ] ',
64
+ 'Minimalistic Black & White' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"landscape","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"administrative","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"on"}]},{"featureType":"transit","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":0},{"lightness":100},{"visibility":"off"}]}]',
65
+ 'Minimalistic Grey' => '[{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#ededed"},{"saturation":-100},{"lightness":36},{"visibility":"on"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"simplified"}]},{"featureType":"administrative","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"off"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"on"}]},{"featureType":"transit","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"landscape.natural","elementType":"all","stylers":[{"hue":"#e0e0e0"},{"saturation":-100},{"lightness":-8},{"visibility":"off"}]}]',
66
+ 'Mixed' => '[{"featureType":"landscape","stylers":[{"hue":"#00dd00"}]},{"featureType":"road","stylers":[{"hue":"#dd0000"}]},{"featureType":"water","stylers":[{"hue":"#000040"}]},{"featureType":"poi.park","stylers":[{"visibility":"off"}]},{"featureType":"road.arterial","stylers":[{"hue":"#ffff00"}]},{"featureType":"road.local","stylers":[{"visibility":"off"}]}]',
67
+ 'Mondrian' => '[ { "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "color": "#0F0919" } ] },{ "featureType": "water", "elementType": "geometry.fill", "stylers": [ { "color": "#E4F7F7" } ] },{ "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi.park", "elementType": "geometry.fill", "stylers": [ { "color": "#002FA7" } ] },{ "featureType": "poi.attraction", "elementType": "geometry.fill", "stylers": [ { "color": "#E60003" } ] },{ "featureType": "landscape", "elementType": "geometry.fill", "stylers": [ { "color": "#FBFCF4" } ] },{ "featureType": "poi.business", "elementType": "geometry.fill", "stylers": [ { "color": "#FFED00" } ] },{ "featureType": "poi.government", "elementType": "geometry.fill", "stylers": [ { "color": "#D41C1D" } ] },{ "featureType": "poi.school", "elementType": "geometry.fill", "stylers": [ { "color": "#BF0000" } ] },{ "featureType": "transit.line", "elementType": "geometry.fill", "stylers": [ { "saturation": -100 } ] } ]',
68
+ 'Muted Blue' => '[ {"featureType": "all", "stylers":[ {"saturation": 0}, {"hue": "#e7ecf0"} ] }, {"featureType": "road", "stylers":[ {"saturation": -70} ] }, {"featureType": "transit", "stylers":[ {"visibility": "off"} ] }, {"featureType": "poi", "stylers":[ {"visibility": "off"} ] }, {"featureType": "water", "stylers":[ {"visibility": "simplified"}, {"saturation": -60} ] } ]',
69
+ 'Muted Monotone' => '[ { "stylers": [ { "visibility": "on" }, { "saturation": -100 }, { "gamma": 0.54 } ] },{ "featureType": "road", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "stylers": [ { "color": "#4d4946" } ] },{ "featureType": "poi", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "labels.text", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "road.local", "elementType": "labels.text", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "water", "elementType": "labels.text.fill", "stylers": [ { "color": "#ffffff" } ] },{ "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "gamma": 0.48 } ] },{ "featureType": "transit.station", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "geometry.stroke", "stylers": [ { "gamma": 7.18 } ] } ]',
70
+ 'Nature' => '[ { "featureType": "landscape", "stylers": [ { "hue": "#FFA800" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#53FF00" }, { "saturation": -73 }, { "lightness": 40 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FBFF00" }, { "saturation": 0 }, { "lightness": 0 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#00FFFD" }, { "saturation": 0 }, { "lightness": 30 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#00BFFF" }, { "saturation": 6 }, { "lightness": 8 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#679714" }, { "saturation": 33.4 }, { "lightness": -25.4 }, { "gamma": 1 } ] } ]',
71
+ 'Neon World' => '[{"stylers":[{"saturation":100},{"gamma":0.6}]}]',
72
+ 'Neutral Blue' => '[{"featureType": "water","elementType": "geometry","stylers": [{ "color": "#193341" }]},{"featureType": "landscape","elementType": "geometry","stylers": [{ "color": "#2c5a71" }]},{"featureType": "road","elementType": "geometry","stylers": [{ "color": "#29768a" },{ "lightness": -37 }]},{"featureType": "poi","elementType": "geometry","stylers": [{ "color": "#406d80" }]},{"featureType": "transit","elementType": "geometry","stylers": [{ "color": "#406d80" }]},{"elementType": "labels.text.stroke","stylers": [{ "visibility": "on" },{ "color": "#3e606f" },{ "weight": 2 },{ "gamma": 0.84 }]},{"elementType": "labels.text.fill","stylers": [{ "color": "#ffffff" }]},{"featureType": "administrative","elementType": "geometry","stylers": [{ "weight": 0.6 },{ "color": "#1a3541" }]},{"elementType": "labels.icon","stylers": [{ "visibility": "off" }]},{"featureType": "poi.park","elementType": "geometry","stylers": [{ "color": "#2c5a71" }]}]',
73
+ 'Night vision' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#001204"},{"saturation":100},{"lightness":-95},{"visibility":"on"}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"hue":"#007F1E"},{"saturation":100},{"lightness":-72},{"visibility":"on"}]},{"featureType":"landscape.natural","elementType":"all","stylers":[{"hue":"#00C72E"},{"saturation":100},{"lightness":-59},{"visibility":"on"}]},{"featureType":"road","elementType":"all","stylers":[{"hue":"#002C0A"},{"saturation":100},{"lightness":-87},{"visibility":"on"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#00A927"},{"saturation":100},{"lightness":-58},{"visibility":"on"}]}]',
74
+ 'Old Dry Mud' => '[ { "featureType": "landscape", "stylers": [ { "hue": "#FFAD00" }, { "saturation": 50.2 }, { "lightness": -34.8 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#FFAD00" }, { "saturation": -19.8 }, { "lightness": -1.8 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FFAD00" }, { "saturation": 72.4 }, { "lightness": -32.6 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#FFAD00" }, { "saturation": 74.4 }, { "lightness": -18 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#00FFA6" }, { "saturation": -63.2 }, { "lightness": 38 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#FFC300" }, { "saturation": 54.2 }, { "lightness": -14.4 }, { "gamma": 1 } ] } ]',
75
+ 'Old Map' => '[ { "featureType": "administrative", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "water", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "transit", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "landscape", "stylers": [ { "visibility": "simplified" } ] },{ "featureType": "road.highway", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road.local", "stylers": [ { "visibility": "on" } ] },{ "featureType": "road.highway", "elementType": "geometry", "stylers": [ { "visibility": "on" } ] },{ "featureType": "water", "stylers": [ { "color": "#abbaa4" } ] },{ "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "color": "#3f518c" } ] },{ "featureType": "road.highway", "stylers": [ { "color": "#ad9b8d" } ] } ]',
76
+ 'Pale Dawn' => '[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"lightness":33}]},{"featureType":"landscape","elementType":"all","stylers":[{"color":"#f2e5d4"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#c5dac6"}]},{"featureType":"poi.park","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"color":"#c5c6c6"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#e4d7c6"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#fbfaf7"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"color":"#acbcc9"}]}]',
77
+ 'Paper' => '[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"landscape","elementType":"all","stylers":[{"visibility":"simplified"},{"hue":"#0066ff"},{"saturation":74},{"lightness":100}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"all","stylers":[{"visibility":"off"},{"weight":0.6},{"saturation":-85},{"lightness":61}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"road.local","elementType":"all","stylers":[{"visibility":"on"}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"simplified"},{"color":"#5f94ff"},{"lightness":26},{"gamma":5.86}]}]',
78
+ 'Pastel Tones' => '[ { "featureType": "landscape", "stylers": [ { "saturation": -100 }, { "lightness": 60 } ] },{ "featureType": "road.local", "stylers": [ { "saturation": -100 }, { "lightness": 40 }, { "visibility": "on" } ] },{ "featureType": "transit", "stylers": [ { "saturation": -100 }, { "visibility": "simplified" } ] },{ "featureType": "administrative.province", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "stylers": [ { "visibility": "on" }, { "lightness": 30 } ] },{ "featureType": "road.highway", "elementType": "geometry.fill", "stylers": [ { "color": "#ef8c25" }, { "lightness": 40 } ] },{ "featureType": "road.highway", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi.park", "elementType": "geometry.fill", "stylers": [ { "color": "#b6c54c" }, { "lightness": 40 }, { "saturation": -40 } ] },{ } ]',
79
+ 'Purple Rain' => '[ { "featureType": "road", "stylers": [ { "hue": "#5e00ff" }, { "saturation": -79 } ] },{ "featureType": "poi", "stylers": [ { "saturation": -78 }, { "hue": "#6600ff" }, { "lightness": -47 }, { "visibility": "off" } ] },{ "featureType": "road.local", "stylers": [ { "lightness": 22 } ] },{ "featureType": "landscape", "stylers": [ { "hue": "#6600ff" }, { "saturation": -11 } ] },{ },{ },{ "featureType": "water", "stylers": [ { "saturation": -65 }, { "hue": "#1900ff" }, { "lightness": 8 } ] },{ "featureType": "road.local", "stylers": [ { "weight": 1.3 }, { "lightness": 30 } ] },{ "featureType": "transit", "stylers": [ { "visibility": "simplified" }, { "hue": "#5e00ff" }, { "saturation": -16 } ] },{ "featureType": "transit.line", "stylers": [ { "saturation": -72 } ] },{ } ]',
80
+ 'Red & Green' => '[ { "featureType": "landscape", "stylers": [ { "lightness": 16 }, { "hue": "#ff001a" }, { "saturation": -61 } ] },{ "featureType": "road.highway", "stylers": [ { "hue": "#ff0011" }, { "lightness": 53 } ] },{ "featureType": "poi.park", "stylers": [ { "hue": "#00ff91" } ] },{ "elementType": "labels", "stylers": [ { "lightness": 63 }, { "hue": "#ff0000" } ] },{ "featureType": "water", "stylers": [ { "hue": "#0055ff" } ] },{ "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "off" } ] } ]',
81
+ 'Red Alert' => '[{"featureType":"water","elementType":"geometry","stylers":[{"color":"#ffdfa6"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#b52127"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#c5531b"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#74001b"},{"lightness":-10}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#da3c3c"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#74001b"}]},{"featureType":"road.arterial","elementType":"geometry.stroke","stylers":[{"color":"#da3c3c"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"color":"#990c19"}]},{"elementType":"labels.text.fill","stylers":[{"color":"#ffffff"}]},{"elementType":"labels.text.stroke","stylers":[{"color":"#74001b"},{"lightness":-8}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#6a0d10"},{"visibility":"on"}]},{"featureType":"administrative","elementType":"geometry","stylers":[{"color":"#ffdfa6"},{"weight":0.4}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"visibility":"off"}]}]',
82
+ 'Red Hues' => '[{"stylers":[{"hue":"#dd0d0d"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":100},{"visibility":"simplified"}]}]',
83
+ 'Retro' => '[{"featureType":"administrative","stylers":[{"visibility":"off"}]},{"featureType":"poi","stylers":[{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"simplified"}]},{"featureType":"water","stylers":[{"visibility":"simplified"}]},{"featureType":"transit","stylers":[{"visibility":"simplified"}]},{"featureType":"landscape","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"visibility":"off"}]},{"featureType":"road.local","stylers":[{"visibility":"on"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"visibility":"on"}]},{"featureType":"water","stylers":[{"color":"#84afa3"},{"lightness":52}]},{"stylers":[{"saturation":-17},{"gamma":0.36}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"color":"#3f518c"}]}]',
84
+ 'Roadie' => '[ { "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "elementType": "geometry", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "geometry", "stylers": [ { "visibility": "on" }, { "color": "#000000" } ] },{ "featureType": "landscape", "stylers": [ { "color": "#ffffff" }, { "visibility": "on" } ] },{ } ]',
85
+ 'RouteXL' => '[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"on"},{"saturation":-100},{"lightness":20}]},{"featureType":"road","elementType":"all","stylers":[{"visibility":"on"},{"saturation":-100},{"lightness":40}]},{"featureType":"water","elementType":"all","stylers":[{"visibility":"on"},{"saturation":-10},{"lightness":30}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"visibility":"simplified"},{"saturation":-60},{"lightness":10}]},{"featureType":"landscape.natural","elementType":"all","stylers":[{"visibility":"simplified"},{"saturation":-60},{"lightness":60}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"},{"saturation":-100},{"lightness":60}]},{"featureType":"transit","elementType":"all","stylers":[{"visibility":"off"},{"saturation":-100},{"lightness":60}]}]',
86
+ 'Shade of green' => '[{"featureType":"water","elementType":"all","stylers":[{"hue":"#76aee3"},{"saturation":38},{"lightness":-11},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"all","stylers":[{"hue":"#8dc749"},{"saturation":-47},{"lightness":-17},{"visibility":"on"}]},{"featureType":"poi.park","elementType":"all","stylers":[{"hue":"#c6e3a4"},{"saturation":17},{"lightness":-2},{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"all","stylers":[{"hue":"#cccccc"},{"saturation":-100},{"lightness":13},{"visibility":"on"}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"hue":"#5f5855"},{"saturation":6},{"lightness":-31},{"visibility":"on"}]},{"featureType":"road.local","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"simplified"}]},{"featureType":"water","elementType":"all","stylers":[]}]',
87
+ 'Shades of Grey' => '[{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}]',
88
+ 'Shift Worker' => '[{"stylers":[{"saturation":-100},{"gamma":1}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"poi.business","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","elementType":"labels.text","stylers":[{"visibility":"off"}]},{"featureType":"poi.place_of_worship","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"water","stylers":[{"visibility":"on"},{"saturation":50},{"gamma":0},{"hue":"#50a5d1"}]},{"featureType":"administrative.neighborhood","elementType":"labels.text.fill","stylers":[{"color":"#333333"}]},{"featureType":"road.local","elementType":"labels.text","stylers":[{"weight":0.5},{"color":"#333333"}]},{"featureType":"transit.station","elementType":"labels.icon","stylers":[{"gamma":1},{"saturation":50}]}]',
89
+ 'Simple & Light' => '[{"featureType":"administrative","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#fcfcfc"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#fcfcfc"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#dddddd"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#dddddd"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#eeeeee"}]},{"featureType":"water","elementType":"geometry","stylers":[{"visibility":"simplified"},{"color":"#dddddd"}]}]',
90
+ 'Simple Labels' => '[ { "featureType": "road", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi", "elementType": "labels", "stylers": [ { "visibility": "off" } ] },{ "featureType": "transit", "elementType": "labels.text", "stylers": [ { "visibility": "off" } ] } ]',
91
+ 'Snazzy Maps' => '[{"featureType": "water","elementType": "geometry","stylers": [{ "color": "#333739" }]},{"featureType": "landscape","elementType": "geometry","stylers": [{ "color": "#2ecc71" }]},{"featureType": "poi","stylers": [{ "color": "#2ecc71" },{ "lightness": -7 }]},{"featureType": "road.highway","elementType": "geometry","stylers": [{ "color": "#2ecc71" },{ "lightness": -28 }]},{"featureType": "road.arterial","elementType": "geometry","stylers": [{ "color": "#2ecc71" },{ "visibility": "on" },{ "lightness": -15 }]},{"featureType": "road.local","elementType": "geometry","stylers": [{ "color": "#2ecc71" },{ "lightness": -18 }]},{"elementType": "labels.text.fill","stylers": [{ "color": "#ffffff" }]},{"elementType": "labels.text.stroke","stylers": [{ "visibility": "off" }]},{"featureType": "transit","elementType": "geometry","stylers": [{ "color": "#2ecc71" },{ "lightness": -34 }]},{"featureType": "administrative","elementType": "geometry","stylers": [{ "visibility": "on" },{ "color": "#333739" },{ "weight": 0.8 }]},{"featureType": "poi.park","stylers": [{ "color": "#2ecc71" }]},{"featureType": "road","elementType": "geometry.stroke","stylers": [{ "color": "#333739" },{ "weight": 0.3 },{ "lightness": 10 }]}]',
92
+ 'Subtle' => '[ { "featureType": "poi", "stylers": [ { "visibility": "off" } ] },{ "stylers": [ { "saturation": -70 }, { "lightness": 37 }, { "gamma": 1.15 } ] },{ "elementType": "labels", "stylers": [ { "gamma": 0.26 }, { "visibility": "off" } ] },{ "featureType": "road", "stylers": [ { "lightness": 0 }, { "saturation": 0 }, { "hue": "#ffffff" }, { "gamma": 0 } ] },{ "featureType": "road", "elementType": "labels.text.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road.arterial", "elementType": "geometry", "stylers": [ { "lightness": 20 } ] },{ "featureType": "road.highway", "elementType": "geometry", "stylers": [ { "lightness": 50 }, { "saturation": 0 }, { "hue": "#ffffff" } ] },{ "featureType": "administrative.province", "stylers": [ { "visibility": "on" }, { "lightness": -50 } ] },{ "featureType": "administrative.province", "elementType": "labels.text.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "administrative.province", "elementType": "labels.text", "stylers": [ { "lightness": 20 } ] } ]',
93
+ 'Subtle Grayscale' => '[{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}]',
94
+ 'Subtle Green' => '[ { "stylers": [ { "visibility": "on" }, { "saturation": -100 } ] },{ "featureType": "water", "stylers": [ { "visibility": "on" }, { "saturation": 100 }, { "hue": "#00ffe6" } ] },{ "featureType": "road", "elementType": "geometry", "stylers": [ { "saturation": 100 }, { "hue": "#00ffcc" } ] },{ "featureType": "poi", "stylers": [ { "visibility": "off" } ] },{ "featureType": "poi.park", "stylers": [ { "visibility": "on" } ] } ]',
95
+ 'Subtle Greyscale Map' => '[{"featureType":"poi","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"administrative","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road","elementType":"labels","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road.local","elementType":"all","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffffff"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"transit","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":0},{"lightness":-100},{"visibility":"off"}]},{"featureType":"landscape","elementType":"labels","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"off"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#bbbbbb"},{"saturation":-100},{"lightness":26},{"visibility":"on"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#dddddd"},{"saturation":-100},{"lightness":-3},{"visibility":"on"}]}]',
96
+ 'The Endless Atlas' => '[{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"water","elementType":"all","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":100},{"visibility":"on"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"hue":"#D1D3D4"},{"saturation":-88},{"lightness":-7},{"visibility":"on"}]},{"featureType":"landscape","elementType":"labels","stylers":[{"hue":"#939598"},{"saturation":-91},{"lightness":-34},{"visibility":"on"}]},{"featureType":"road","elementType":"geometry","stylers":[{"hue":"#414042"},{"saturation":-98},{"lightness":-60},{"visibility":"on"}]},{"featureType":"poi","elementType":"all","stylers":[{"hue":"#E3EBE5"},{"saturation":-61},{"lightness":57},{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"hue":"#E3EBE5"},{"saturation":-100},{"lightness":57},{"visibility":"on"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"visibility":"off"}]},{"featureType":"administrative.country","elementType":"all","stylers":[{"hue":"#E3EBE5"},{"saturation":-100},{"lightness":81},{"visibility":"off"}]},{"featureType":"administrative.province","elementType":"all","stylers":[{"hue":"#E3EBE5"},{"saturation":-100},{"lightness":81},{"visibility":"off"}]},{"featureType":"administrative.locality","elementType":"geometry","stylers":[{"hue":"#FFFFFF"},{"saturation":0},{"lightness":100},{"visibility":"on"}]},{"featureType":"administrative.locality","elementType":"labels","stylers":[{"hue":"#939598"},{"saturation":2},{"lightness":59},{"visibility":"on"}]},{"featureType":"administrative.neighborhood","elementType":"labels","stylers":[{"hue":"#939598"},{"saturation":-100},{"lightness":16},{"visibility":"on"}]},{"featureType":"administrative.neighborhood","elementType":"all","stylers":[{"hue":"#939598"},{"saturation":-100},{"lightness":16},{"visibility":"on"}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"hue":"#939598"},{"saturation":-100},{"lightness":16},{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"geometry","stylers":[{"hue":"#939598"},{"saturation":-98},{"lightness":-8},{"visibility":"on"}]},{"featureType":"road.highway","elementType":"labels","stylers":[{"hue":"#FFFFFF"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"hue":"#6D6E71"},{"saturation":-98},{"lightness":-43},{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"labels","stylers":[{"hue":"#FFFFFF"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"hue":"#000000"},{"saturation":-100},{"lightness":-100},{"visibility":"on"}]},{"featureType":"road.local","elementType":"labels","stylers":[{"hue":"#FFFFFF"},{"saturation":-100},{"lightness":100},{"visibility":"off"}]}]',
97
+ 'Transport for London' => '[ { "elementType": "labels.text", "stylers": [ { "visibility": "off" } ] },{ "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] },{ "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "water", "elementType": "geometry.fill", "stylers": [ { "color": "#0099cc" } ] },{ "featureType": "road", "elementType": "geometry.fill", "stylers": [ { "color": "#00314e" } ] },{ "featureType": "transit.line", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#f0f0f0" } ] },{ "featureType": "landscape.man_made", "stylers": [ { "color": "#adbac9" } ] },{ "featureType": "landscape.natural", "stylers": [ { "color": "#adb866" } ] },{ "featureType": "poi", "stylers": [ { "color": "#f7c742" } ] },{ "featureType": "poi.park", "stylers": [ { "color": "#adb866" } ] },{ "featureType": "transit.station", "elementType": "geometry.fill", "stylers": [ { "color": "#ff8dd3" } ] },{ "featureType": "transit.station", "stylers": [ { "color": "#ff8dd3" } ] },{ "featureType": "transit.line", "elementType": "geometry.fill", "stylers": [ { "visibility": "on" }, { "color": "#808080" } ] },{ } ]',
98
+ 'Turquoise Water' => '[{"stylers":[{"hue":"#16a085"},{"saturation":0}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":100},{"visibility":"simplified"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"}]}]',
99
+ 'Ultra Light with Labels' => '[{"featureType":"water","elementType":"geometry","stylers":[{"color":"#e9e9e9"},{"lightness":17}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffffff"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#ffffff"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#ffffff"},{"lightness":16}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#f5f5f5"},{"lightness":21}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#dedede"},{"lightness":21}]},{"elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#ffffff"},{"lightness":16}]},{"elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#333333"},{"lightness":40}]},{"elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#f2f2f2"},{"lightness":19}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#fefefe"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#fefefe"},{"lightness":17},{"weight":1.2}]}]',
100
+ 'Unsaturated Browns' => '[ { "elementType": "geometry", "stylers": [ { "hue": "#ff4400" }, { "saturation": -68 }, { "lightness": -4 }, { "gamma": 0.72 } ] },{ "featureType": "road", "elementType": "labels.icon" },{ "featureType": "landscape.man_made", "elementType": "geometry", "stylers": [ { "hue": "#0077ff" }, { "gamma": 3.1 } ] },{ "featureType": "water", "stylers": [ { "hue": "#00ccff" }, { "gamma": 0.44 }, { "saturation": -33 } ] },{ "featureType": "poi.park", "stylers": [ { "hue": "#44ff00" }, { "saturation": -23 } ] },{ "featureType": "water", "elementType": "labels.text.fill", "stylers": [ { "hue": "#007fff" }, { "gamma": 0.77 }, { "saturation": 65 }, { "lightness": 99 } ] },{ "featureType": "water", "elementType": "labels.text.stroke", "stylers": [ { "gamma": 0.11 }, { "weight": 5.6 }, { "saturation": 99 }, { "hue": "#0091ff" }, { "lightness": -86 } ] },{ "featureType": "transit.line", "elementType": "geometry", "stylers": [ { "lightness": -48 }, { "hue": "#ff5e00" }, { "gamma": 1.2 }, { "saturation": -23 } ] },{ "featureType": "transit", "elementType": "labels.text.stroke", "stylers": [ { "saturation": -64 }, { "hue": "#ff9100" }, { "lightness": 16 }, { "gamma": 0.47 }, { "weight": 2.7 } ] } ]',
101
+ 'Veins' => '[ { "stylers": [ { "hue": "#B61530" }, { "saturation": 60 }, { "lightness": -40 }, ] }, { "elementType": "labels.text.fill", "stylers": [ { "color": "#ffffff" }, ] }, { "featureType": "water", "stylers": [ { "color": "#B61530" } ] }, { "featureType": "road", "stylers": [ { "color": "#B61530" }, { } ] }, { "featureType": "road.local", "stylers": [ { "color": "#B61530" }, { "lightness":6 } ] }, { "featureType": "road.highway", "stylers": [ { "color": "#B61530" }, { "lightness":-25 } ] }, { "featureType": "road.arterial", "stylers": [ { "color": "#B61530" }, { "lightness":-10 } ] }, { "featureType": "transit", "stylers": [ { "color": "#B61530" }, { "lightness":70 } ] }, { "featureType": "transit.line", "stylers": [ { "color": "#B61530" }, { "lightness":90 } ] }, { "featureType": "administrative.country", "elementType": "labels", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.station", "elementType": "labels.text.stroke", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit.station", "elementType": "labels.text.fill", "stylers": [ { "color": "#ffffff" } ] } ]',
102
+ 'Vintage' => '[{"stylers": [{ "visibility": "off" }]},{"featureType": "water","stylers": [{ "visibility": "on" },{ "color": "#2f343b" }]},{"featureType": "landscape","stylers": [{ "visibility": "on" },{ "color": "#703030" }]},{"featureType": "administrative","elementType": "geometry.stroke","stylers": [{ "visibility": "on" },{ "color": "#2f343b" },{ "weight": 1 }]}]',
103
+ 'Vintage Blue' => '[ { "featureType": "road", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.province", "stylers": [ { "visibility": "off" } ] }, { "featureType": "poi.park", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "water", "stylers": [ { "color": "#004b76" } ] }, { "featureType": "landscape.natural", "stylers": [ { "visibility": "on" }, { "color": "#fff6cb" } ] }, { "featureType": "administrative.country", "elementType": "geometry.stroke", "stylers": [ { "visibility": "on" }, { "color": "#7f7d7a" }, { "lightness": 10 }, { "weight": 1 } ] } ]',
104
+ 'light dream' => '[ { "featureType": "landscape", "stylers": [ { "hue": "#FFBB00" }, { "saturation": 43.400000000000006 }, { "lightness": 37.599999999999994 }, { "gamma": 1 } ] }, { "featureType": "road.highway", "stylers": [ { "hue": "#FFC200" }, { "saturation": -61.8 }, { "lightness": 45.599999999999994 }, { "gamma": 1 } ] }, { "featureType": "road.arterial", "stylers": [ { "hue": "#FF0300" }, { "saturation": -100 }, { "lightness": 51.19999999999999 }, { "gamma": 1 } ] }, { "featureType": "road.local", "stylers": [ { "hue": "#FF0300" }, { "saturation": -100 }, { "lightness": 52 }, { "gamma": 1 } ] }, { "featureType": "water", "stylers": [ { "hue": "#0078FF" }, { "saturation": -13.200000000000003 }, { "lightness": 2.4000000000000057 }, { "gamma": 1 } ] }, { "featureType": "poi", "stylers": [ { "hue": "#00FF6A" }, { "saturation": -1.0989010989011234 }, { "lightness": 11.200000000000017 }, { "gamma": 1 } ] } ]',
105
+ );
106
+ }
admin/includes/markers-icons.php CHANGED
@@ -1,37 +1,23 @@
1
  <ul class="wgm_gmap_embed_marker_icons">
2
- <?php
3
- global $wpdb;
4
- $wpgmap_marker_icons = $wpdb->get_results("SELECT type, file_name FROM {$wpdb->prefix}wgm_icons", OBJECT);
5
- foreach ($wpgmap_marker_icons as $key => $marker_icon) {
 
6
 
7
- // $map_icon_data = array(
8
- // 'type' => 'pre_uploaded_icon',
9
- // 'title'=>basename( $marker_icon->file_name ),
10
- // 'desc'=>basename( $marker_icon->file_name ),
11
- // 'file_name'=>$marker_icon->file_name
12
- // );
13
- // $defaults = [];
14
- // $wp_gmap_marker_icon = wp_parse_args( $map_icon_data, $defaults );
15
- // $wpdb->insert(
16
- // $wpdb->prefix . 'wgm_icons',
17
- // $wp_gmap_marker_icon,
18
- // [
19
- // '%s',
20
- // '%s',
21
- // '%s',
22
- // '%s'
23
- // ]
24
- // );
25
-
26
- $image_path = $marker_icon->file_name;
27
- if ($marker_icon->type == 'pre_uploaded_icon') {
28
- $image_path = plugin_dir_url(__FILE__) . "../assets/images/markers/" . basename($marker_icon->file_name);
29
- }
30
- ?>
31
- <li>
32
- <img width="32" src="<?php echo $image_path; ?>" onclick="wpgmapChangeCurrentMarkerIcon(this);"/>
33
- </li>
34
- <?php
35
- }
36
- ?>
37
- </ul>
1
  <ul class="wgm_gmap_embed_marker_icons">
2
+ <?php
3
+ global $wpdb;
4
+ $wpgmap_marker_icons = $wpdb->get_results( "SELECT type, file_name FROM {$wpdb->prefix}wgm_icons", OBJECT );
5
+ if ( count( $wpgmap_marker_icons ) > 0 ) {
6
+ foreach ( $wpgmap_marker_icons as $key => $marker_icon ) {
7
 
8
+ $image_path = $marker_icon->file_name;
9
+ if ( $marker_icon->type === 'pre_uploaded_icon' ) {
10
+ $image_path = plugin_dir_url( __FILE__ ) . '../assets/images/markers/' . basename( $marker_icon->file_name );
11
+ }
12
+ ?>
13
+ <li>
14
+ <img width="32" src="<?php echo esc_url( $image_path ); ?>"
15
+ onclick="wpgmapChangeCurrentMarkerIcon(this);"/>
16
+ </li>
17
+ <?php
18
+ }
19
+ } else {
20
+ echo 'No icon found, please upload icon by click on Upload Icon button';
21
+ }
22
+ ?>
23
+ </ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/includes/markers-settings.php CHANGED
@@ -1,198 +1,170 @@
1
- <?php $map_id = isset($_GET['id']) ? sanitize_text_field(esc_html($_GET['id'])) : 0; ?>
2
- <!--<div class="wgm_gmap_marker_list" style="display: none" map_id="--><?php //echo $map_id;?><!--">-->
3
  <div style="text-align: right;margin-top:10px;" class="add_new_marker_btn_area">
4
- <button type="button" value="New Marker" class="button button-primary add_new_marker"
5
- style="margin-bottom: 10px;"><i class="dashicons dashicons-plus" style="margin: 5px 0 0 0;"></i> New Marker
6
- </button>
7
- <?php
8
- if (!_wgm_is_premium()) {
9
- ?>
10
- <sup class="wgm-pro-label" style="top: -4px; display: none;">Pro</sup>
11
- <?php
12
- }
13
- ?>
14
  </div>
15
 
16
- <div class="wgm_gmap_marker_list" style="display: block" map_id="<?php echo esc_attr($map_id); ?>">
17
- <table id="wgm_gmap_marker_list" class="display" style="width:100%">
18
- <thead>
19
- <tr>
20
- <th>ID</th>
21
- <th>Marker Name</th>
22
- <th>Icon</th>
23
- <th>Action</th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- </tbody>
28
- </table>
29
- <div class="wgm_marker_create_hints">
30
- <ul>
31
- <li>Click on <b>New Marker</b> button and Search your desired location by <b>Address, Zip code or Latitude,Longitude.</b></li>
32
- <li><b>Right Click</b> on Map to set marker location and set others options.
33
- </li>
34
- <li>Click on <b>Save Marker</b>, Don't forget to click on <b>Save Map</b> Button!
35
- </li>
36
- </ul>
37
- </div>
38
  </div>
39
 
40
 
41
- <!--<table class="wgm_gmap_properties add_new_marker_form" style="display: none;width:100%">-->
42
  <table class="wgm_gmap_properties add_new_marker_form" style="display: none;width:100%">
43
 
44
- <tr>
45
- <td>
46
- <label for="wpgmap_marker_name"><b><?php _e('Marker Title', 'gmap-embed'); ?>
47
- </b></label><br/>
48
- <input id="wpgmap_marker_name" name="wpgmap_marker_name"
49
- type="text" class="regular-text">
50
- </td>
51
- </tr>
52
 
53
- <tr>
54
- <td>
55
- <label for="wpgmap_marker_desc"><b><?php _e('Description', 'gmap-embed'); ?></b></label><br/>
56
- <?php
57
- echo (_wgm_is_premium() === false) ? '<button type="button" class="button wgm_enable_premium" style="opacity: .7;" data-notice="' . esc_html(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to add <b> Images in marker InfoWindow </b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_markers&utm_medium=admin_link&utm_campaign=marker_add_media'))) . '"><span class="dashicons dashicons-admin-media" style="line-height: 1.5;"></span> Add Media</button><sup class="wgm-pro-label" style="top: -45px;display: block;width: 23px;left: 107px;">Pro</sup>' : '';
58
- wp_editor('', 'wpgmap_marker_desc', [
59
- 'textarea_name' => 'wpgmap_marker_desc',
60
- 'textarea_rows' => '3',
61
- 'media_buttons' => _wgm_is_premium() === true,
62
- 'quicktags' => _wgm_is_premium() === true
63
- ]);
64
- ?>
65
- </td>
66
- </tr>
 
 
 
 
67
 
68
- <tr>
69
- <td style="padding-top: 10px;">
70
- <span style="float: left;">
71
- <b><?php _e('Marker Icon', 'gmap-embed'); ?></b> &nbsp;
72
- </span>
73
- <img src="<?php echo plugin_dir_url(__FILE__) . '../assets/images/markers/default.png' ?>"
74
- id="wpgmap_marker_icon_preview" style="float: left;max-width: 20px;">
75
- <?php
76
- $ajax_url = add_query_arg(
77
- array(
78
- 'action' => 'wpgmapembed_get_marker_icons',
79
- 'from' => 'create',
80
- 'ajax_nonce'=>wp_create_nonce('ajax_nonce')
81
- ),
82
- admin_url('admin-ajax.php')
83
- );
84
- ?>
85
- <button style="float: left;margin: 0 9px;" class="button"
86
- onclick="tb_show('<?php _e("Choose marker icon", "gmap-embed"); ?>', '<?php echo $ajax_url; ?>')">
87
- <?php _e("Choose Icon", "gmap-embed"); ?>
88
- </button>
89
- <button style="float: left" class="button"
90
- id="wpgmap_upload_marker_icon"><?php _e("Upload Icon", "gmap-embed"); ?></button>
91
- <input type="hidden" name="wpgmap_marker_icon" id="wpgmap_marker_icon"
92
- value="<?php echo plugin_dir_url(__FILE__) . '../assets/images/markers/default.png' ?>"/>
93
- </td>
94
- </tr>
95
 
96
- <tr>
97
- <td>
98
- <label for="wpgmap_marker_address"><b><?php _e('Address', 'gmap-embed'); ?></b></label><br/>
99
- <input id="wpgmap_marker_address" name="wpgmap_marker_address"
100
- type="text" class="regular-text">
101
- </td>
102
- </tr>
103
 
104
- <tr>
105
- <td>
106
- <label for="wpgmap_marker_lat_lng"><b>
107
- <?php _e('Latitude,Longitude', 'gmap-embed'); ?><span
108
- class="required-star">*</span></b></label><br/>
109
- <input id="wpgmap_marker_lat_lng" name="wpgmap_marker_lat_lng"
110
- type="text" class="regular-text">
111
- </td>
112
- </tr>
113
 
114
- <!-- <tr>-->
115
- <!-- <td>-->
116
- <!-- <label for="wpgmap_marker_longitude"><b>--><?php //_e( 'Longitude', 'gmap-embed' ); ?><!--<span-->
117
- <!-- class="required-star">*</span></b></label><br/>-->
118
- <!-- <input id="wpgmap_marker_longitude" name="wpgmap_marker_longitude"-->
119
- <!-- type="text" class="regular-text">-->
120
- <!-- </td>-->
121
- <!-- </tr>-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
- <tr>
124
- <td>
125
- <label for="wpgmap_marker_link"><?php _e('Has Marker Link?', 'gmap-embed'); ?></label>&nbsp;
126
- <select name="wpgmap_have_marker_link" id="wpgmap_have_marker_link">
127
- <option value="1">Yes</option>
128
- <option value="0" selected="selected">No</option>
129
- </select>
130
- <br/>
131
- <div id="wpgmap_marker_link_area" style="display: none;">
132
- <input id="wpgmap_marker_link" name="wpgmap_marker_link" placeholder="Enter Marker link here"
133
- type="text" class="regular-text" style="margin: 5px 0;">
134
- <br/>
135
- <label>
136
- <input type="checkbox" id="wpgmap_marker_link_new_tab" name="wpgmap_marker_link_new_tab"
137
- class="alignleft" style="margin: 2px 5px 0px 0px;"/>
138
- <span class="alignleft"><?php _e("Open link in new window", "gmap-embed"); ?></span>
139
- </label>
140
- </div>
141
- </td>
142
- </tr>
143
- <tr>
144
- <td>
145
 
146
- <label>
147
- <span class="alignleft"><?php _e('Open marker description by default', 'gmap-embed'); ?></span>&nbsp;
148
- <select name="wpgmap_marker_infowindow_show" id="wpgmap_marker_infowindow_show">
149
- <option value="1">Yes</option>
150
- <option value="0" selected="selected">No, Open description on click</option>
151
- </select>
152
- </label>
153
- </td>
154
- </tr>
155
 
156
- <!-- <tr>-->
157
- <!-- <td>-->
158
- <!-- <label style="margin: 8px 0 0 0 !important;float: left;width:92%;">-->
159
- <!-- <span style="width: 70%;float: left;">-->
160
- <?php //_e( 'Show description on mouse over', 'gmap-embed' ); ?><!--</span>-->
161
- <!-- <input type="checkbox" id="wpgmap_marker_infowindow_show_mouse_over"-->
162
- <!-- name="wpgmap_marker_infowindow_show_mouse_over" style="float: left;margin-top:1px !important;"/>-->
163
- <!-- </label>-->
164
- <!-- </td>-->
165
- <!-- </tr>-->
166
-
167
- <!-- <tr>-->
168
- <!-- <td>-->
169
- <!-- <label style="margin: 8px 0 0 0 !important;float: left;width:92%;">-->
170
- <!-- <span style="width: 70%;float: left;">-->
171
- <?php //_e( 'Hide description on mouse leave', 'gmap-embed' ); ?><!--</span>-->
172
- <!-- <input type="checkbox" id="wpgmap_marker_infowindow_hide_on_mouse_leave"-->
173
- <!-- name="wpgmap_marker_infowindow_hide_on_mouse_leave"-->
174
- <!-- style="float: left;margin-top:1px !important;"/>-->
175
- <!-- </label>-->
176
- <!-- </td>-->
177
- <!-- </tr>-->
178
- <?php $map_id = (isset($_GET['tag']) && sanitize_text_field(esc_html($_GET['tag'] == 'edit'))) ? sanitize_text_field(esc_html($_GET['id'])) : 0; ?>
179
- <tr>
180
- <td>
181
- <button class=" button button-primary button-large wgm_marker_cancel" type="button">
182
- <i class="dashicons dashicons-no-alt" style="line-height: 1.6;"></i>
183
- <b>Cancel</b>
184
- </button>
185
- <button class=" button button-primary button-large wpgmap_marker_add" type="button" markerid="0"
186
- mapid="<?php echo $map_id; ?>">
187
- <i class="dashicons dashicons-location" style="line-height: 1.6;"></i>
188
- <b>Save Marker</b>
189
- </button>
190
- <span class="spinner alignleft"></span>
191
- </td>
192
- </tr>
193
  </table>
194
 
195
  <div class="gmap_embed_message_area alignleft wgm-col-full">
196
- <div id="marker_errors" style="color: red;"></div>
197
- <div id="marker_success" style="color: green;font-weight: bold;"></div>
198
- </div>
1
+ <?php $map_id = isset( $_GET['id'] ) ? intval( sanitize_text_field( wp_unslash( $_GET['id'] ) ) ) : 0; ?>
 
2
  <div style="text-align: right;margin-top:10px;" class="add_new_marker_btn_area">
3
+ <button type="button" value="New Marker" class="button button-primary add_new_marker"
4
+ style="margin-bottom: 10px;"><i class="dashicons dashicons-plus" style="margin: 5px 0 0 0;"></i> New Marker
5
+ </button>
6
+ <?php
7
+ if ( ! _wgm_is_premium() ) {
8
+ ?>
9
+ <sup class="wgm-pro-label" style="top: -4px; display: none;">Pro</sup>
10
+ <?php
11
+ }
12
+ ?>
13
  </div>
14
 
15
+ <div class="wgm_gmap_marker_list" style="display: block" map_id="<?php echo esc_attr( $map_id ); ?>">
16
+ <table id="wgm_gmap_marker_list" class="display" style="width:100%">
17
+ <thead>
18
+ <tr>
19
+ <th>ID</th>
20
+ <th>Marker Name</th>
21
+ <th>Icon</th>
22
+ <th>Action</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ </tbody>
27
+ </table>
28
+ <div class="wgm_marker_create_hints">
29
+ <ul>
30
+ <li>Click on <b>New Marker</b> button and Search your desired location by <b>Address, Zip code or Latitude,Longitude.</b></li>
31
+ <li><b>Right Click</b> on Map to set marker location and set others options.
32
+ </li>
33
+ <li>Click on <b>Save Marker</b>, Don't forget to click on <b>Save Map</b> Button!
34
+ </li>
35
+ </ul>
36
+ </div>
37
  </div>
38
 
39
 
 
40
  <table class="wgm_gmap_properties add_new_marker_form" style="display: none;width:100%">
41
 
42
+ <tr>
43
+ <td>
44
+ <label for="wpgmap_marker_name"><b><?php esc_html_e( 'Marker Title', 'gmap-embed' ); ?>
45
+ </b></label><br/>
46
+ <input id="wpgmap_marker_name" name="wpgmap_marker_name"
47
+ type="text" class="regular-text">
48
+ </td>
49
+ </tr>
50
 
51
+ <tr>
52
+ <td>
53
+ <label for="wpgmap_marker_desc"><b><?php esc_html_e( 'Description', 'gmap-embed' ); ?></b></label><br/>
54
+ <?php
55
+ echo ( _wgm_is_premium() === false ) ? '<button type="button" class="button wgm_enable_premium" style="opacity: .7;" data-notice="' . esc_html( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to add <b> Images in marker InfoWindow </b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_markers&utm_medium=admin_link&utm_campaign=marker_add_media' ) ) ) . '"><span class="dashicons dashicons-admin-media" style="line-height: 1.5;"></span> Add Media</button><sup class="wgm-pro-label" style="top: -45px;display: block;width: 23px;left: 107px;">Pro</sup>' : '';
56
+ wp_editor(
57
+ '',
58
+ 'wpgmap_marker_desc',
59
+ array(
60
+ 'textarea_name' => 'wpgmap_marker_desc',
61
+ 'textarea_rows' => '3',
62
+ 'media_buttons' => _wgm_is_premium() === true,
63
+ 'quicktags' => _wgm_is_premium() === true,
64
+ )
65
+ );
66
+ ?>
67
+ </td>
68
+ </tr>
69
 
70
+ <tr>
71
+ <td style="padding-top: 10px;">
72
+ <span style="float: left;">
73
+ <b><?php esc_html_e( 'Marker Icon', 'gmap-embed' ); ?></b> &nbsp;
74
+ </span>
75
+ <img src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/markers/default.png' ); ?>"
76
+ id="wpgmap_marker_icon_preview" style="float: left;max-width: 20px;">
77
+ <?php
78
+ $ajax_url = add_query_arg(
79
+ array(
80
+ 'action' => 'wpgmapembed_get_marker_icons',
81
+ 'from' => 'create',
82
+ 'ajax_nonce' => wp_create_nonce( 'ajax_nonce' ),
83
+ ),
84
+ admin_url( 'admin-ajax.php' )
85
+ );
86
+ ?>
87
+ <button style="float: left;margin: 0 9px;" class="button"
88
+ onclick="tb_show('<?php esc_html_e( 'Choose marker icon', 'gmap-embed' ); ?>', '<?php echo esc_url( $ajax_url ); ?>')">
89
+ <?php esc_html_e( 'Choose Icon', 'gmap-embed' ); ?>
90
+ </button>
91
+ <button style="float: left" class="button"
92
+ id="wpgmap_upload_marker_icon"><?php esc_html_e( 'Upload Icon', 'gmap-embed' ); ?></button>
93
+ <input type="hidden" name="wpgmap_marker_icon" id="wpgmap_marker_icon"
94
+ value="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/markers/default.png' ); ?>"/>
95
+ </td>
96
+ </tr>
97
 
98
+ <tr>
99
+ <td>
100
+ <label for="wpgmap_marker_address"><b><?php esc_html_e( 'Address', 'gmap-embed' ); ?></b></label><br/>
101
+ <input id="wpgmap_marker_address" name="wpgmap_marker_address"
102
+ type="text" class="regular-text">
103
+ </td>
104
+ </tr>
105
 
106
+ <tr>
107
+ <td>
108
+ <label for="wpgmap_marker_lat_lng"><b>
109
+ <?php esc_html_e( 'Latitude,Longitude', 'gmap-embed' ); ?><span
110
+ class="required-star">*</span></b></label><br/>
111
+ <input id="wpgmap_marker_lat_lng" name="wpgmap_marker_lat_lng"
112
+ type="text" class="regular-text">
113
+ </td>
114
+ </tr>
115
 
116
+ <tr>
117
+ <td>
118
+ <label for="wpgmap_marker_link"><?php esc_html_e( 'Has Marker Link?', 'gmap-embed' ); ?></label>&nbsp;
119
+ <select name="wpgmap_have_marker_link" id="wpgmap_have_marker_link">
120
+ <option value="1">Yes</option>
121
+ <option value="0" selected="selected">No</option>
122
+ </select>
123
+ <br/>
124
+ <div id="wpgmap_marker_link_area" style="display: none;">
125
+ <input id="wpgmap_marker_link" name="wpgmap_marker_link" placeholder="Enter Marker link here"
126
+ type="text" class="regular-text" style="margin: 5px 0;">
127
+ <br/>
128
+ <label>
129
+ <input type="checkbox" id="wpgmap_marker_link_new_tab" name="wpgmap_marker_link_new_tab"
130
+ class="alignleft" style="margin: 2px 5px 0px 0px;"/>
131
+ <span class="alignleft"><?php esc_html_e( 'Open link in new window', 'gmap-embed' ); ?></span>
132
+ </label>
133
+ </div>
134
+ </td>
135
+ </tr>
136
+ <tr>
137
+ <td>
138
 
139
+ <label>
140
+ <span class="alignleft"><?php esc_html_e( 'Open marker description by default', 'gmap-embed' ); ?></span>&nbsp;
141
+ <select name="wpgmap_marker_infowindow_show" id="wpgmap_marker_infowindow_show">
142
+ <option value="1">Yes</option>
143
+ <option value="0" selected="selected">No, Open description on click</option>
144
+ </select>
145
+ </label>
146
+ </td>
147
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
 
 
 
 
 
 
 
 
 
149
 
150
+ <?php $map_id = ( isset( $_GET['tag'] ) && sanitize_text_field( wp_unslash( $_GET['tag'] ) ) === 'edit' ) ? intval( sanitize_text_field( wp_unslash( $_GET['id'] ) ) ) : 0; ?>
151
+ <tr>
152
+ <td>
153
+ <button class=" button button-primary button-large wgm_marker_cancel" type="button">
154
+ <i class="dashicons dashicons-no-alt" style="line-height: 1.6;"></i>
155
+ <b>Cancel</b>
156
+ </button>
157
+ <button class=" button button-primary button-large wpgmap_marker_add" type="button" markerid="0"
158
+ mapid="<?php echo esc_attr( $map_id ); ?>">
159
+ <i class="dashicons dashicons-location" style="line-height: 1.6;"></i>
160
+ <b>Save Marker</b>
161
+ </button>
162
+ <span class="spinner alignleft"></span>
163
+ </td>
164
+ </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  </table>
166
 
167
  <div class="gmap_embed_message_area alignleft wgm-col-full">
168
+ <div id="marker_errors" style="color: red;"></div>
169
+ <div id="marker_success" style="color: green;font-weight: bold;"></div>
170
+ </div>
admin/includes/wgm_messages_viewer.php CHANGED
@@ -1,34 +1,50 @@
1
  <?php
2
- if (isset($_GET['message'])) {
3
- ?>
4
- <div class="message">
5
- <div id="setting-error-settings_updated" class="updated settings-error notice is-dismissible">
6
- <p>
7
- <strong>
8
- <?php
9
- $message_status = sanitize_text_field(esc_html($_GET['message']));
10
- switch ($message_status) {
11
- case 1:
12
- echo __( 'Map has been created Successfully. <a href="' . esc_url( 'https://youtu.be/9KZOUJ9Gdv8?t=255' ) . '" target="_blank"> See How to use >></a>', 'gmap-embed' );
13
- break;
14
- case 3:
15
- echo __('API key updated Successfully, Please click on <a href="'.admin_url('admin.php?page=wpgmapembed-new').'"><i style="color: green;">Add New</i></a> menu to add new map.', 'gmap-embed');
16
- break;
17
- case 4:
18
- echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities(__($message, 'gmap-embed')))));
19
- break;
20
- case -1:
21
- echo __('Map Deleted Successfully.', 'gmap-embed');
22
- break;
23
- }
24
- ?>
25
- </strong>
26
- </p>
27
- <button type="button" class="notice-dismiss"><span
28
- class="screen-reader-text">Dismiss this notice.</span>
29
- </button>
30
- </div>
31
- </div>
32
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
- ?>
1
  <?php
2
+ if ( isset( $_GET['message'] ) ) {
3
+ ?>
4
+ <div class="message">
5
+ <div id="setting-error-settings_updated" class="updated settings-error notice is-dismissible">
6
+ <p>
7
+ <strong>
8
+ <?php
9
+ $allowed_html = [
10
+ 'a' => [
11
+ 'class' => [],
12
+ 'id' => [],
13
+ 'title' => [],
14
+ 'href' => [],
15
+ ],
16
+ 'i'=>[
17
+ 'style' => []
18
+ ],
19
+ 'span' => [
20
+ 'class' => [],
21
+ 'style' => []
22
+ ],
23
+
24
+ ];
25
+ $message_status = sanitize_text_field( wp_unslash( $_GET['message'] ) );
26
+ switch ( $message_status ) {
27
+ case 1:
28
+ echo __( 'Map has been created Successfully. <a href="' . esc_url( 'https://youtu.be/9KZOUJ9Gdv8?t=255' ) . '" target="_blank"> See How to use >></a>', 'gmap-embed' );
29
+ break;
30
+ case 3:
31
+ echo __( 'API key updated Successfully, Please click on <a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-new' ) ) . '"><i style="color: green;">Add New</i></a> menu to add new map.', 'gmap-embed' );
32
+ break;
33
+ case 4:
34
+ echo wp_kses( __( $message, 'gmap-embed' ),$allowed_html);
35
+ break;
36
+ case - 1:
37
+ echo __( 'Map Deleted Successfully.', 'gmap-embed' );
38
+ break;
39
+ }
40
+ ?>
41
+ </strong>
42
+ </p>
43
+ <button type="button" class="notice-dismiss"><span
44
+ class="screen-reader-text">Dismiss this notice.</span>
45
+ </button>
46
+ </div>
47
+ </div>
48
+ <?php
49
  }
50
+ ?>
admin/includes/wpgmap_create.php CHANGED
@@ -1,21 +1,22 @@
1
- <?php if (!defined('ABSPATH')) exit; ?>
 
 
2
  <script type="text/javascript">
3
- var wgp_api_key = '<?php echo esc_html(get_option('wpgmap_api_key'));?>';
4
  </script>
5
  <div class="wrap">
6
- <h1 class="wp-heading-inline"><?php _e('Add New Map', 'gmap-embed'); ?></h1>
7
- <?php
8
- if (!_wgm_is_premium()) {
9
- echo '<a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
10
- }
11
- echo '<a target="_blank" href="' . esc_url('https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . __('LIVE Chat', 'gmap-embed') . '</a>';
12
- echo '<a href="' . esc_url(admin_url('admin.php?page=wpgmapembed-support')) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . __('Documentation', 'gmap-embed') . '</a>';
13
- // echo '<a target="_blank" href="' . esc_url('https://srmilon.info/documentation?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right: 5px;"><i style="line-height: 25px;" class="dashicons dashicons-book"></i> ' . __('Help Manual', 'gmap-embed') . '</a>';
14
- ?>
15
  <hr class="wp-header-end">
16
  <div id="gmap_container_inner">
17
- <span class="wpgmap_msg_error" style="width:80%;">
18
- </span>
19
  <div id="wp-gmap-new" style="padding:5px;">
20
  <!-- google map properties -->
21
  <div class="wp-gmap-properties-outer">
@@ -23,26 +24,25 @@
23
  <ul class="wgm_wpgmap_tab">
24
  <li class="active" id="wp-gmap-properties">General</li>
25
  <li id="wgm_gmap_markers">Markers</li>
26
- <li id="wp-gmap-other-properties">Other Settings</li>
27
  </ul>
28
  </div>
29
  <div class="wp-gmap-tab-contents wp-gmap-properties">
30
  <table class="gmap_properties">
31
  <tr>
32
  <td>
33
- <label for="wpgmap_title"><b><?php _e('Map Title', 'gmap-embed'); ?></b></label><br/>
34
  <input id="wpgmap_title" name="wpgmap_title" value="" type="text"
35
  class="regular-text">
36
  <br/>
37
 
38
  <input type="checkbox" value="1" name="wpgmap_show_heading"
39
  id="wpgmap_show_heading">
40
- <label for="wpgmap_show_heading"><?php _e('Show as map title', 'gmap-embed'); ?></label>
41
  </td>
42
  </tr>
43
  <tr>
44
  <td>
45
- <label for="wpgmap_latlng"><b><?php _e('Latitude, Longitude(Approx)', 'gmap-embed'); ?></b></label><br/>
46
  <input id="wpgmap_latlng" name="wpgmap_latlng" value="" type="text"
47
  class="regular-text">
48
  <input type="hidden" name="wpgmap_center_lat_lng" id="wpgmap_center_lat_lng">
@@ -50,7 +50,7 @@
50
  </tr>
51
  <tr>
52
  <td>
53
- <label for="wpgmap_map_zoom"><b><?php _e('Zoom', 'gmap-embed'); ?></b></label><br/>
54
  <input id="wpgmap_map_zoom" name="wpgmap_map_zoom" value="13" type="text"
55
  class="regular-text">
56
  </td>
@@ -58,7 +58,7 @@
58
 
59
  <tr>
60
  <td>
61
- <label for="wpgmap_map_width"><b><?php _e('Width (%)', 'gmap-embed'); ?></b></label><br/>
62
  <input id="wpgmap_map_width" name="wpgmap_map_width" value="100%"
63
  type="text" class="regular-text">
64
  </td>
@@ -66,7 +66,7 @@
66
 
67
  <tr>
68
  <td>
69
- <label for="wpgmap_map_height"><b><?php _e('Height (px)', 'gmap-embed'); ?></b></label><br/>
70
  <input id="wpgmap_map_height" name="wpgmap_map_height" value="300px"
71
  type="text" class="regular-text">
72
  </td>
@@ -74,7 +74,7 @@
74
 
75
  <tr>
76
  <td>
77
- <label for="wpgmap_map_type"><b><?php _e('Map Type', 'gmap-embed'); ?></b></label><br/>
78
  <select id="wpgmap_map_type" class="regular-text">
79
  <option>ROADMAP</option>
80
  <option>SATELLITE</option>
@@ -84,20 +84,9 @@
84
  </td>
85
  </tr>
86
 
87
-
88
- </table>
89
- </div>
90
-
91
- <div class="wp-gmap-tab-contents wgm_gmap_markers hidden">
92
- <?php
93
- require_once plugin_dir_path(__FILE__) . 'markers-settings.php'; ?>
94
- </div>
95
-
96
- <div class="wp-gmap-tab-contents wp-gmap-other-properties hidden">
97
- <table class="gmap_properties">
98
  <tr>
99
  <td>
100
- <label for="wpgmap_heading_class"><b><?php _e('Heading Custom Class', 'gmap-embed'); ?>
101
  <span
102
  style="color:gray;">(if any)</span></b></label><br/>
103
  <input id="wpgmap_heading_class" name="wpgmap_heading_class" value="" type="text"
@@ -106,46 +95,81 @@
106
  </tr>
107
  <tr>
108
  <td>
109
- <label for="wpgmap_enable_direction" <?php echo !_wgm_is_premium() ? ' class="wgm_enable_premium" " ' : '' ?>
110
- data-notice="<?php echo esc_html(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Enable Direction Option on Map</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=enable_direction'))); ?>">
111
  <input
112
  type="checkbox" value="1"
113
  name="wpgmap_enable_direction"
114
- id="wpgmap_enable_direction" <?php echo !_wgm_is_premium() ? 'disabled="disabled" ' : '' ?>>
115
- <?php _e('Enable Direction in Map', 'gmap-embed'); ?>
116
- <?php echo !_wgm_is_premium() ? '<sup class="wgm-pro-label">Pro</sup>' : ''; ?>
117
  </label>
118
 
119
 
120
  </td>
121
  </tr>
 
122
  <tr>
123
- <td>
124
- <small style="font-size: 9px;font-style: italic">Disable zoom on mouse scroll settings
125
- has been moved under <a
126
- href="<?php echo admin_url('admin.php?page=wpgmapembed-settings#_wgm_disable_zoom_control'); ?>">settings</a>
127
- menu.</small>
128
- <!-- </label>-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  </td>
130
  </tr>
131
  </table>
132
  </div>
 
 
 
 
 
 
133
  </div>
134
 
135
  <div class="wp-gmap-preview">
136
  <h1 id="wpgmap_heading_preview" style="padding: 0;margin: 0;"></h1>
137
  <input id="wgm_pac_input" class="wgm_controls" type="text" style="visibility: hidden;"
138
- placeholder="<?php _e('Search by Address, Zip Code, (Latitude,Longitude)', 'gmap-embed'); ?>"/>
139
  <div id="wgm_map" style="height: 520px;"></div>
140
  <div class="" style="width: 100%;float:left;text-align: right;margin-bottom: 5px;margin-top: 5px;">
141
  <span class="spinner" style="margin: 0 !important;float: none;"></span>
142
  <button class=" button wgm_btn" id="wp-gmap-embed-save"
143
- style="width: auto;padding: 5px 12px;"><?php _e('Save Map', 'gmap-embed'); ?></button>
144
  </div>
145
  </div>
146
 
147
  <script type="text/javascript"
148
- src="<?php echo esc_url(plugins_url("../assets/js/geo_based_map_create.js?v=" . filemtime(__DIR__ . '/../assets/js/geo_based_map_create.js'), __FILE__)); ?>"></script>
149
  </div>
150
  </div>
151
- </div>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) {
2
+ exit;
3
+ } ?>
4
  <script type="text/javascript">
5
+ var wgp_api_key = '<?php echo esc_html( get_option( 'wpgmap_api_key' ) ); ?>';
6
  </script>
7
  <div class="wrap">
8
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Add New Map', 'gmap-embed' ); ?></h1>
9
+ <?php
10
+ if ( ! _wgm_is_premium() ) {
11
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
12
+ }
13
+ echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
14
+ echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
15
+ ?>
 
16
  <hr class="wp-header-end">
17
  <div id="gmap_container_inner">
18
+ <span class="wpgmap_msg_error" style="width:80%;">
19
+ </span>
20
  <div id="wp-gmap-new" style="padding:5px;">
21
  <!-- google map properties -->
22
  <div class="wp-gmap-properties-outer">
24
  <ul class="wgm_wpgmap_tab">
25
  <li class="active" id="wp-gmap-properties">General</li>
26
  <li id="wgm_gmap_markers">Markers</li>
 
27
  </ul>
28
  </div>
29
  <div class="wp-gmap-tab-contents wp-gmap-properties">
30
  <table class="gmap_properties">
31
  <tr>
32
  <td>
33
+ <label for="wpgmap_title"><b><?php esc_html_e( 'Map Title', 'gmap-embed' ); ?></b></label><br/>
34
  <input id="wpgmap_title" name="wpgmap_title" value="" type="text"
35
  class="regular-text">
36
  <br/>
37
 
38
  <input type="checkbox" value="1" name="wpgmap_show_heading"
39
  id="wpgmap_show_heading">
40
+ <label for="wpgmap_show_heading"><?php esc_html_e( 'Show as map title', 'gmap-embed' ); ?></label>
41
  </td>
42
  </tr>
43
  <tr>
44
  <td>
45
+ <label for="wpgmap_latlng"><b><?php esc_html_e( 'Latitude, Longitude(Approx)', 'gmap-embed' ); ?></b></label><br/>
46
  <input id="wpgmap_latlng" name="wpgmap_latlng" value="" type="text"
47
  class="regular-text">
48
  <input type="hidden" name="wpgmap_center_lat_lng" id="wpgmap_center_lat_lng">
50
  </tr>
51
  <tr>
52
  <td>
53
+ <label for="wpgmap_map_zoom"><b><?php esc_html_e( 'Zoom', 'gmap-embed' ); ?></b></label><br/>
54
  <input id="wpgmap_map_zoom" name="wpgmap_map_zoom" value="13" type="text"
55
  class="regular-text">
56
  </td>
58
 
59
  <tr>
60
  <td>
61
+ <label for="wpgmap_map_width"><b><?php esc_html_e( 'Width (%)', 'gmap-embed' ); ?></b></label><br/>
62
  <input id="wpgmap_map_width" name="wpgmap_map_width" value="100%"
63
  type="text" class="regular-text">
64
  </td>
66
 
67
  <tr>
68
  <td>
69
+ <label for="wpgmap_map_height"><b><?php esc_html_e( 'Height (px)', 'gmap-embed' ); ?></b></label><br/>
70
  <input id="wpgmap_map_height" name="wpgmap_map_height" value="300px"
71
  type="text" class="regular-text">
72
  </td>
74
 
75
  <tr>
76
  <td>
77
+ <label for="wpgmap_map_type"><b><?php esc_html_e( 'Map Type', 'gmap-embed' ); ?></b></label><br/>
78
  <select id="wpgmap_map_type" class="regular-text">
79
  <option>ROADMAP</option>
80
  <option>SATELLITE</option>
84
  </td>
85
  </tr>
86
 
 
 
 
 
 
 
 
 
 
 
 
87
  <tr>
88
  <td>
89
+ <label for="wpgmap_heading_class"><b><?php esc_html_e( 'Heading Custom Class', 'gmap-embed' ); ?>
90
  <span
91
  style="color:gray;">(if any)</span></b></label><br/>
92
  <input id="wpgmap_heading_class" name="wpgmap_heading_class" value="" type="text"
95
  </tr>
96
  <tr>
97
  <td>
98
+ <label for="wpgmap_enable_direction" <?php echo ! _wgm_is_premium() ? ' class="wgm_enable_premium" " ' : ''; ?>
99
+ data-notice="<?php esc_html_e( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Enable Direction Option on Map</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=enable_direction' ) ) ); ?>">
100
  <input
101
  type="checkbox" value="1"
102
  name="wpgmap_enable_direction"
103
+ id="wpgmap_enable_direction" <?php echo ! _wgm_is_premium() ? 'disabled="disabled" ' : ''; ?>>
104
+ <?php esc_html_e( 'Enable Direction in Map', 'gmap-embed' ); ?>
105
+ <?php echo ! _wgm_is_premium() ? '<sup class="wgm-pro-label">Pro</sup>' : ''; ?>
106
  </label>
107
 
108
 
109
  </td>
110
  </tr>
111
+
112
  <tr>
113
+ <td style="padding-top: 9px;">
114
+ <label for="wpgmap_map_theme" ><b><?php esc_html_e( 'Map Theme Presets', 'gmap-embed' ); ?></b>
115
+ </label><br/>
116
+ <?php
117
+ require_once WGM_PLUGIN_PATH . 'admin/includes/map_theme_presets.php';
118
+ ?>
119
+ <select id="wpgmap_map_theme" name="wpgmap_map_theme" style="width:99%;max-width:99%; margin-bottom: 5px;">
120
+ <?php
121
+ echo '<option value="[]">Default Theme</option>';
122
+ foreach ( $map_styles as $key => $style ) {
123
+ echo '<option value="' . esc_attr( $style ) . '">' . esc_html( $key ) . '</option>';
124
+ }
125
+ ?>
126
+ </select>
127
+ <?php if ( ! _wgm_is_premium() ) { ?>
128
+ <a target="_blank"
129
+ href="<?php echo esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_create&utm_medium=admin_link&utm_campaign=theme_presets_lic' ); ?>">
130
+ Get PRO version to use many presets and ability to use your own theme</a>
131
+ <?php
132
+ }
133
+ ?>
134
+
135
+ <br/>
136
+ <span style="<?php echo ( ! _wgm_is_premium() ) ? 'visibility: hidden' : ''; ?>">
137
+ <label for="wgm_theme_json"><b><?php esc_html_e( 'Map Theme JSON', 'gmap-embed' ); ?>
138
+ </b></label>
139
+ <br/>
140
+ <textarea rows="5" cols="50" class="wgm_theme_json" id="wgm_theme_json"
141
+ style="width:99%;max-width:99%;">[]</textarea>
142
+ You may create your own map style from
143
+ <a target="_blank"
144
+ href="<?php echo esc_url( 'https://snazzymaps.com' ); ?>">
145
+ Snazzy Maps</a> and use JSON here.
146
+ </span>
147
  </td>
148
  </tr>
149
  </table>
150
  </div>
151
+
152
+ <div class="wp-gmap-tab-contents wgm_gmap_markers hidden">
153
+ <?php
154
+ require_once plugin_dir_path( __FILE__ ) . 'markers-settings.php';
155
+ ?>
156
+ </div>
157
  </div>
158
 
159
  <div class="wp-gmap-preview">
160
  <h1 id="wpgmap_heading_preview" style="padding: 0;margin: 0;"></h1>
161
  <input id="wgm_pac_input" class="wgm_controls" type="text" style="visibility: hidden;"
162
+ placeholder="<?php esc_html_e( 'Search by Address, Zip Code, (Latitude,Longitude)', 'gmap-embed' ); ?>"/>
163
  <div id="wgm_map" style="height: 520px;"></div>
164
  <div class="" style="width: 100%;float:left;text-align: right;margin-bottom: 5px;margin-top: 5px;">
165
  <span class="spinner" style="margin: 0 !important;float: none;"></span>
166
  <button class=" button wgm_btn" id="wp-gmap-embed-save"
167
+ style="width: auto;padding: 5px 12px;"><?php esc_html_e( 'Save Map', 'gmap-embed' ); ?></button>
168
  </div>
169
  </div>
170
 
171
  <script type="text/javascript"
172
+ src="<?php echo esc_url( plugins_url( '../assets/js/geo_based_map_create.js?v=' . filemtime( __DIR__ . '/../assets/js/geo_based_map_create.js' ), __FILE__ ) ); ?>"></script>
173
  </div>
174
  </div>
175
+ </div>
admin/includes/wpgmap_edit.php CHANGED
@@ -1,80 +1,85 @@
1
- <?php if (!defined('ABSPATH')) exit;
2
- $gmap_data = $this->get_wpgmapembed_data(intval(sanitize_text_field(esc_html($_GET['id']))));
3
- $wpgmap_single = json_decode($gmap_data);
4
- list($wpgmap_center_lat, $wpgmap_center_lng) = explode(',', esc_html($wpgmap_single->wpgmap_center_lat_lng));
 
 
 
5
  ?>
6
  <script type="text/javascript">
7
- var wgp_api_key = '<?php echo esc_html(get_option('wpgmap_api_key'));?>';
 
8
  </script>
9
  <div class="wrap">
10
- <h1 class="wp-heading-inline"><?php _e('Edit Map', 'gmap-embed'); ?></h1>
11
- <?php if (_wgm_can_add_new_map()) { ?>
12
- <a href="<?php echo esc_url(admin_url('admin.php?page=wpgmapembed-new')); ?>" class="page-title-action">Add New</a>
13
- <?php
14
- } else {
15
- echo '<a href="#" class="page-title-action wgm_enable_premium" style="opacity: .3" data-notice="' . esc_html(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Create Unlimited Maps</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=add_new_map'))) . '">Add New</a><sup class="wgm-pro-label">Pro</sup>';
16
- }
17
- ?>
18
- <?php
19
- if (!_wgm_is_premium()) {
20
- echo '<a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
21
- }
22
- echo '<a target="_blank" href="' . esc_url('https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . __('LIVE Chat', 'gmap-embed') . '</a>';
23
- echo '<a href="' . esc_url(admin_url('admin.php?page=wpgmapembed-support')) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . __('Documentation', 'gmap-embed') . '</a>';
24
- ?>
25
- <span style="float: right;margin: 0px 8px 0 0;">Shortcode <input type="text"
26
- value="<?php echo esc_attr('[gmap-embed id=&quot;' . sanitize_text_field(esc_html($_GET['id'])) . '&quot;]'); ?>"
27
- style="padding: 2px 10px;border: 2px #008dff solid;" onclick="this.select()"></span>
 
 
28
  <hr class="wp-header-end">
29
  <div id="gmap_container_inner">
30
  <span class="wpgmap_msg_error" style="width:80%;"></span>
31
  <div id="wp-gmap-edit" style="padding:5px;">
32
- <?php require_once WGM_PLUGIN_PATH . 'admin/includes/wgm_messages_viewer.php'; ?>
33
 
34
  <input id="wpgmap_map_id" name="wpgmap_map_id"
35
- value="<?php echo isset($_GET['id']) ? intval(sanitize_text_field(esc_html($_GET['id']))) : 0; ?>" type="hidden"/>
36
  <div class="wp-gmap-properties-outer">
37
  <div class="wgm_wpgmap_tab">
38
  <ul class="wgm_wpgmap_tab">
39
  <li class="active" id="wp-gmap-properties">General</li>
40
  <li id="wgm_gmap_markers">Markers</li>
41
- <li id="wp-gmap-other-properties">Other Settings</li>
42
  </ul>
43
  </div>
44
  <div class="wp-gmap-tab-contents wp-gmap-properties">
45
  <table class="gmap_properties">
46
  <tr>
47
  <td>
48
- <label for="wpgmap_title"><b><?php _e('Map Title', 'gmap-embed'); ?></b></label><br/>
49
  <input id="wpgmap_title" name="wpgmap_title"
50
- value="<?php echo esc_attr($wpgmap_single->wpgmap_title); ?>"
51
  type="text"
52
  class="regular-text">
53
  <br/>
54
 
55
  <input type="checkbox" value="1" name="wpgmap_show_heading"
56
- id="wpgmap_show_heading" <?php echo esc_attr(($wpgmap_single->wpgmap_show_heading == 1) ? 'checked' : ''); ?>>
57
- <label for="wpgmap_show_heading"><?php _e('Show as map title', 'gmap-embed'); ?></label>
58
  </td>
59
  </tr>
60
 
61
  <tr>
62
  <td>
63
- <label for="wpgmap_latlng"><b><?php _e('Latitude, Longitude(Approx)', 'gmap-embed'); ?></b></label><br/>
64
  <input id="wpgmap_latlng" name="wpgmap_latlng"
65
- value="<?php echo esc_attr($wpgmap_single->wpgmap_latlng); ?>"
66
  type="text"
67
  class="regular-text">
68
  <input type="hidden" name="wpgmap_center_lat_lng" id="wpgmap_center_lat_lng"
69
- value="<?php echo esc_attr($wpgmap_single->wpgmap_center_lat_lng); ?>">
70
  </td>
71
  </tr>
72
 
73
  <tr>
74
  <td>
75
- <label for="wpgmap_map_zoom"><b><?php _e('Zoom', 'gmap-embed'); ?></b></label><br/>
76
  <input id="wpgmap_map_zoom" name="wpgmap_map_zoom"
77
- value="<?php echo esc_attr($wpgmap_single->wpgmap_map_zoom); ?>" type="text"
78
  class="regular-text">
79
 
80
 
@@ -83,104 +88,132 @@ list($wpgmap_center_lat, $wpgmap_center_lng) = explode(',', esc_html($wpgmap_sin
83
 
84
  <tr>
85
  <td>
86
- <label for="wpgmap_map_width"><b><?php _e('Width (%)', 'gmap-embed'); ?></b></label><br/>
87
  <input id="wpgmap_map_width" name="wpgmap_map_width"
88
- value="<?php echo esc_attr($wpgmap_single->wpgmap_map_width); ?>"
89
  type="text" class="regular-text">
90
  </td>
91
  </tr>
92
 
93
  <tr>
94
  <td>
95
- <label for="wpgmap_map_height"><b><?php _e('Height (px)', 'gmap-embed'); ?></b></label><br/>
96
  <input id="wpgmap_map_height" name="wpgmap_map_height"
97
- value="<?php echo esc_attr($wpgmap_single->wpgmap_map_height); ?>"
98
  type="text" class="regular-text">
99
  </td>
100
  </tr>
101
 
102
  <tr>
103
  <td>
104
- <label><b><?php _e('Map Type', 'gmap-embed'); ?></b></label><br/>
105
  <select id="wpgmap_map_type" class="regular-text">
106
- <option <?php echo esc_attr($wpgmap_single->wpgmap_map_type == 'ROADMAP' ? 'selected' : ''); ?>>
107
  ROADMAP
108
  </option>
109
- <option <?php echo esc_attr($wpgmap_single->wpgmap_map_type == 'SATELLITE' ? 'selected' : ''); ?>>
110
  SATELLITE
111
  </option>
112
- <option <?php echo esc_attr($wpgmap_single->wpgmap_map_type == 'HYBRID' ? 'selected' : ''); ?>>
113
  HYBRID
114
  </option>
115
- <option <?php echo esc_attr($wpgmap_single->wpgmap_map_type == 'TERRAIN' ? 'selected' : ''); ?>>
116
  TERRAIN
117
  </option>
118
  </select>
119
  </td>
120
  </tr>
121
 
122
- </table>
123
- </div>
124
- <div class="wp-gmap-tab-contents wgm_gmap_markers hidden">
125
- <?php
126
- require_once plugin_dir_path(__FILE__) . 'markers-settings.php'; ?>
127
- </div>
128
- <div class="wp-gmap-tab-contents wp-gmap-other-properties hidden">
129
- <table class="gmap_properties">
130
  <tr>
131
  <td>
132
- <label for="wpgmap_heading_class"><b><?php _e('Heading Custom Class', 'gmap-embed'); ?></b></label><br/>
133
  <input id="wpgmap_heading_class" name="wpgmap_heading_class"
134
- value="<?php echo esc_attr($wpgmap_single->wpgmap_heading_class); ?>" type="text"
 
135
  class="regular-text">
136
  </td>
137
  </tr>
138
  <tr>
139
  <td>
140
- <label for="wpgmap_enable_direction" <?php echo !_wgm_is_premium() ? ' class="wgm_enable_premium" " ' : '' ?> data-notice="<?php echo esc_html(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Enable Direction Option on Map</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=enable_direction')));?>"><input
 
141
  type="checkbox"
142
- value="1" <?php echo !_wgm_is_premium() ? 'disabled="disabled" ' : '' ?>
143
  name="wpgmap_enable_direction"
144
- id="wpgmap_enable_direction" <?php echo esc_attr(($wpgmap_single->wpgmap_enable_direction == 1) ? 'checked' : ''); ?>>
145
- <?php _e('Enable Direction option in Map', 'gmap-embed'); ?>
146
- <?php echo !_wgm_is_premium() ? '<sup class="wgm-pro-label">Pro</sup>' : ''; ?>
147
  </label>
148
  </td>
149
  </tr>
150
 
151
  <tr>
152
- <td>
153
- <small style="font-size: 9px;font-style: italic">Disable zoom on mouse scroll settings
154
- has been moved under <a
155
- href="<?php echo esc_url(admin_url('admin.php?page=wpgmapembed-settings#_wgm_disable_zoom_control')); ?>">settings</a>
156
- menu.</small>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  </td>
158
  </tr>
 
159
  </table>
160
  </div>
 
 
 
 
 
161
  </div>
162
 
163
  <div class="wp-gmap-preview">
164
  <h1 id="wpgmap_heading_preview"
165
- style="padding: 0px;margin: 0px;"><?php echo esc_html($wpgmap_single->wpgmap_title); ?></h1>
166
  <input id="wgm_pac_input" class="wgm_controls" type="text"
167
- placeholder="<?php _e('Search by Address, Zip Code, (Latitude,Longitude)', 'gmap-embed'); ?>"/>
168
  <div id="wgm_map" style="height: 520px;"></div>
169
  <div class="" style="width: 100%;float:left;text-align: right;margin-bottom: 5px;margin-top: 5px;">
170
  <span class="spinner" style="margin: 0 !important;float: none;"></span>
171
  <button class="button wgm_btn" style="width: auto;padding: 5px 12px;"
172
- id="wp-gmap-embed-update"><?php _e('Update Map', 'gmap-embed'); ?></button>
173
  </div>
174
  </div>
175
  <script type="text/javascript"
176
- src="<?php echo esc_url(plugins_url("../assets/js/geo_based_map_edit.js?v=" . filemtime(__DIR__ . '/../assets/js/geo_based_map_edit.js'), __FILE__)); ?>"></script>
177
  <script type="text/javascript">
178
  (function ($) {
179
  $(function () {
180
  google.maps.event.addDomListener(window, 'load',
181
- wgm_initAutocomplete('wgm_map', 'wgm_pac_input',<?php echo esc_html($wpgmap_center_lat);?>,<?php echo esc_html($wpgmap_center_lng);?>, '<?php echo esc_html($wpgmap_single->wpgmap_map_type); ?>',<?php echo esc_html($wpgmap_single->wpgmap_map_zoom);?>, 'edit')
182
  );
183
- if (jQuery('#wpgmap_show_infowindow').is(':checked') === true) {
184
  wgm_openInfoWindow();
185
  }
186
  });
@@ -188,4 +221,4 @@ list($wpgmap_center_lat, $wpgmap_center_lng) = explode(',', esc_html($wpgmap_sin
188
  </script>
189
  </div>
190
  </div>
191
- </div>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) {
2
+ exit;
3
+ }
4
+ $map_id = intval( sanitize_text_field( wp_unslash( $_GET['id'] ) ) );
5
+ $gmap_data = $this->get_wpgmapembed_data( intval( $map_id ) );
6
+ $wpgmap_single = json_decode( $gmap_data );
7
+ list( $wpgmap_center_lat, $wpgmap_center_lng ) = explode( ',', esc_html( $wpgmap_single->wpgmap_center_lat_lng ) );
8
  ?>
9
  <script type="text/javascript">
10
+ var wgp_api_key = '<?php echo esc_html( get_option( 'wpgmap_api_key' ) ); ?>';
11
+ var wgm_theme_json = '<?php echo wp_kses_data($wpgmap_single->wgm_theme_json); ?>';
12
  </script>
13
  <div class="wrap">
14
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Edit Map', 'gmap-embed' ); ?></h1>
15
+ <?php if ( _wgm_can_add_new_map() ) { ?>
16
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=wpgmapembed-new' ) ); ?>" class="page-title-action">Add
17
+ New</a>
18
+ <?php
19
+ } else {
20
+ echo '<a href="#" class="page-title-action wgm_enable_premium" style="opacity: .3" data-notice="' . esc_html( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Create Unlimited Maps</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=add_new_map' ) ) ) . '">Add New</a><sup class="wgm-pro-label">Pro</sup>';
21
+ }
22
+ ?>
23
+ <?php
24
+ if ( ! _wgm_is_premium() ) {
25
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
26
+ }
27
+ echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
28
+ echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
29
+ ?>
30
+ <span style="float: right;margin: 0 8px 0 0;">Shortcode <input type="text"
31
+ value="<?php echo esc_attr( '[gmap-embed id=&quot;' . intval( $map_id ) . '&quot;]' ); ?>"
32
+ style="padding: 2px 10px;border: 2px #008dff solid;"
33
+ onclick="this.select()"></span>
34
  <hr class="wp-header-end">
35
  <div id="gmap_container_inner">
36
  <span class="wpgmap_msg_error" style="width:80%;"></span>
37
  <div id="wp-gmap-edit" style="padding:5px;">
38
+ <?php require_once WGM_PLUGIN_PATH . 'admin/includes/wgm_messages_viewer.php'; ?>
39
 
40
  <input id="wpgmap_map_id" name="wpgmap_map_id"
41
+ value="<?php echo esc_attr( $map_id ); ?>" type="hidden"/>
42
  <div class="wp-gmap-properties-outer">
43
  <div class="wgm_wpgmap_tab">
44
  <ul class="wgm_wpgmap_tab">
45
  <li class="active" id="wp-gmap-properties">General</li>
46
  <li id="wgm_gmap_markers">Markers</li>
 
47
  </ul>
48
  </div>
49
  <div class="wp-gmap-tab-contents wp-gmap-properties">
50
  <table class="gmap_properties">
51
  <tr>
52
  <td>
53
+ <label for="wpgmap_title"><b><?php esc_html_e( 'Map Title', 'gmap-embed' ); ?></b></label><br/>
54
  <input id="wpgmap_title" name="wpgmap_title"
55
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_title ); ?>"
56
  type="text"
57
  class="regular-text">
58
  <br/>
59
 
60
  <input type="checkbox" value="1" name="wpgmap_show_heading"
61
+ id="wpgmap_show_heading" <?php echo esc_attr( ( $wpgmap_single->wpgmap_show_heading == 1 ) ? 'checked' : '' ); ?>>
62
+ <label for="wpgmap_show_heading"><?php esc_html_e( 'Show as map title', 'gmap-embed' ); ?></label>
63
  </td>
64
  </tr>
65
 
66
  <tr>
67
  <td>
68
+ <label for="wpgmap_latlng"><b><?php esc_html_e( 'Latitude, Longitude(Approx)', 'gmap-embed' ); ?></b></label><br/>
69
  <input id="wpgmap_latlng" name="wpgmap_latlng"
70
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_latlng ); ?>"
71
  type="text"
72
  class="regular-text">
73
  <input type="hidden" name="wpgmap_center_lat_lng" id="wpgmap_center_lat_lng"
74
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_center_lat_lng ); ?>">
75
  </td>
76
  </tr>
77
 
78
  <tr>
79
  <td>
80
+ <label for="wpgmap_map_zoom"><b><?php esc_html_e( 'Zoom', 'gmap-embed' ); ?></b></label><br/>
81
  <input id="wpgmap_map_zoom" name="wpgmap_map_zoom"
82
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_map_zoom ); ?>" type="text"
83
  class="regular-text">
84
 
85
 
88
 
89
  <tr>
90
  <td>
91
+ <label for="wpgmap_map_width"><b><?php esc_html_e( 'Width (%)', 'gmap-embed' ); ?></b></label><br/>
92
  <input id="wpgmap_map_width" name="wpgmap_map_width"
93
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_map_width ); ?>"
94
  type="text" class="regular-text">
95
  </td>
96
  </tr>
97
 
98
  <tr>
99
  <td>
100
+ <label for="wpgmap_map_height"><b><?php esc_html_e( 'Height (px)', 'gmap-embed' ); ?></b></label><br/>
101
  <input id="wpgmap_map_height" name="wpgmap_map_height"
102
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_map_height ); ?>"
103
  type="text" class="regular-text">
104
  </td>
105
  </tr>
106
 
107
  <tr>
108
  <td>
109
+ <label><b><?php esc_html_e( 'Map Type', 'gmap-embed' ); ?></b></label><br/>
110
  <select id="wpgmap_map_type" class="regular-text">
111
+ <option <?php echo esc_attr( $wpgmap_single->wpgmap_map_type == 'ROADMAP' ? 'selected' : '' ); ?>>
112
  ROADMAP
113
  </option>
114
+ <option <?php echo esc_attr( $wpgmap_single->wpgmap_map_type == 'SATELLITE' ? 'selected' : '' ); ?>>
115
  SATELLITE
116
  </option>
117
+ <option <?php echo esc_attr( $wpgmap_single->wpgmap_map_type == 'HYBRID' ? 'selected' : '' ); ?>>
118
  HYBRID
119
  </option>
120
+ <option <?php echo esc_attr( $wpgmap_single->wpgmap_map_type == 'TERRAIN' ? 'selected' : '' ); ?>>
121
  TERRAIN
122
  </option>
123
  </select>
124
  </td>
125
  </tr>
126
 
 
 
 
 
 
 
 
 
127
  <tr>
128
  <td>
129
+ <label for="wpgmap_heading_class"><b><?php esc_html_e( 'Heading Custom Class', 'gmap-embed' ); ?></b></label><br/>
130
  <input id="wpgmap_heading_class" name="wpgmap_heading_class"
131
+ value="<?php echo esc_attr( $wpgmap_single->wpgmap_heading_class ); ?>"
132
+ type="text"
133
  class="regular-text">
134
  </td>
135
  </tr>
136
  <tr>
137
  <td>
138
+ <label for="wpgmap_enable_direction" <?php echo ! _wgm_is_premium() ? ' class="wgm_enable_premium" " ' : ''; ?>
139
+ data-notice="<?php echo esc_html( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Enable Direction Option on Map</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=enable_direction' ) ) ); ?>"><input
140
  type="checkbox"
141
+ value="1" <?php echo ! _wgm_is_premium() ? 'disabled="disabled" ' : ''; ?>
142
  name="wpgmap_enable_direction"
143
+ id="wpgmap_enable_direction" <?php echo esc_attr( ( $wpgmap_single->wpgmap_enable_direction == 1 ) ? 'checked' : '' ); ?>>
144
+ <?php esc_html_e( 'Enable Direction option in Map', 'gmap-embed' ); ?>
145
+ <?php echo ! _wgm_is_premium() ? '<sup class="wgm-pro-label">Pro</sup>' : ''; ?>
146
  </label>
147
  </td>
148
  </tr>
149
 
150
  <tr>
151
+ <td style="padding-top: 9px;">
152
+ <label for="wpgmap_map_theme"><b><?php esc_html_e( 'Map Theme Presets', 'gmap-embed' ); ?></b>
153
+ </label><br/>
154
+ <?php
155
+ require_once WGM_PLUGIN_PATH . 'admin/includes/map_theme_presets.php';
156
+ ?>
157
+ <select id="wpgmap_map_theme" name="wpgmap_map_theme" style="width:99%;max-width:99%;margin-bottom: 5px;">
158
+ <?php
159
+ echo '<option value="[]">Default Theme</option>';
160
+ foreach ( $map_styles as $key => $style ) {
161
+ echo '<option value="' . esc_attr( $style ) . '">' . esc_html( $key ) . '</option>';
162
+ }
163
+ ?>
164
+ </select>
165
+ <?php if ( ! _wgm_is_premium() ) { ?>
166
+ <a target="_blank"
167
+ href="<?php echo esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_edit&utm_medium=admin_link&utm_campaign=theme_presets_lic' ); ?>">
168
+ Get PRO version to use many presets and ability to use your own theme</a>
169
+ <?php
170
+ }
171
+ ?>
172
+ <br/>
173
+ <span style="<?php echo ( ! _wgm_is_premium() ) ? 'visibility: hidden' : ''; ?>">
174
+ <label for="wgm_theme_json"><b><?php esc_html_e( 'Map Theme JSON', 'gmap-embed' ); ?>
175
+ </b></label>
176
+ <br/>
177
+ <textarea rows="5" cols="50" class="wgm_theme_json" id="wgm_theme_json"
178
+ style="width:99%;max-width:99%;"><?php echo esc_html( $wpgmap_single->wgm_theme_json ); ?></textarea>
179
+ You may create your own map style from
180
+ <a target="_blank"
181
+ href="<?php echo esc_url( 'https://snazzymaps.com' ); ?>">
182
+ Snazzy Maps</a> and use JSON here.
183
+ </span>
184
  </td>
185
  </tr>
186
+
187
  </table>
188
  </div>
189
+ <div class="wp-gmap-tab-contents wgm_gmap_markers hidden">
190
+ <?php
191
+ require_once plugin_dir_path( __FILE__ ) . 'markers-settings.php';
192
+ ?>
193
+ </div>
194
  </div>
195
 
196
  <div class="wp-gmap-preview">
197
  <h1 id="wpgmap_heading_preview"
198
+ style="padding: 0px;margin: 0px;"><?php echo esc_html( $wpgmap_single->wpgmap_title ); ?></h1>
199
  <input id="wgm_pac_input" class="wgm_controls" type="text"
200
+ placeholder="<?php esc_html_e( 'Search by Address, Zip Code, (Latitude,Longitude)', 'gmap-embed' ); ?>"/>
201
  <div id="wgm_map" style="height: 520px;"></div>
202
  <div class="" style="width: 100%;float:left;text-align: right;margin-bottom: 5px;margin-top: 5px;">
203
  <span class="spinner" style="margin: 0 !important;float: none;"></span>
204
  <button class="button wgm_btn" style="width: auto;padding: 5px 12px;"
205
+ id="wp-gmap-embed-update"><?php esc_html_e( 'Update Map', 'gmap-embed' ); ?></button>
206
  </div>
207
  </div>
208
  <script type="text/javascript"
209
+ src="<?php echo esc_url( plugins_url( '../assets/js/geo_based_map_edit.js?v=' . filemtime( __DIR__ . '/../assets/js/geo_based_map_edit.js' ), __FILE__ ) ); ?>"></script>
210
  <script type="text/javascript">
211
  (function ($) {
212
  $(function () {
213
  google.maps.event.addDomListener(window, 'load',
214
+ wgm_initAutocomplete('wgm_map', 'wgm_pac_input',<?php echo esc_html( $wpgmap_center_lat ); ?>,<?php echo esc_html( $wpgmap_center_lng ); ?>, '<?php echo esc_html( $wpgmap_single->wpgmap_map_type ); ?>',<?php echo esc_html( $wpgmap_single->wpgmap_map_zoom ); ?>, 'edit')
215
  );
216
+ if (jQuery('#wpgmap_show_infowindow').is(':checked') == true) {
217
  wgm_openInfoWindow();
218
  }
219
  });
221
  </script>
222
  </div>
223
  </div>
224
+ </div>
admin/includes/wpgmap_how_to_use_manuals.php CHANGED
@@ -1,23 +1,24 @@
1
- <?php if (!defined('ABSPATH')) exit; ?>
 
2
  <ul>
3
- <li>
4
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-add-google-map-in-your-wordpress-pageblock-editor?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use'); ?>"
5
- target="_blank"><i class="fa fa-link"></i>How to add Google Map in Page (Block Editor)?</a>
6
- </li>
7
- <li>
8
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-add-google-map-in-your-wordpress-post?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use'); ?>"
9
- target="_blank"><i class="fa fa-link"></i>How to add Google Map in Post (Block Editor)?</a>
10
- </li>
11
- <li>
12
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-add-google-map-in-sidebar-as-widget-new-widget-editor-from-wordpress-5-8?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use'); ?>"
13
- target="_blank"><i class="fa fa-link"></i>How to add Google Map in Sidebar as widget?</a>
14
- </li>
15
- <li>
16
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-add-custom-css-and-javascript?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use'); ?>"
17
- target="_blank"><i class="fa fa-link"></i>How to add custom CSS and Javascript?</a>
18
- </li>
19
- <li>
20
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-disable-zoom-icon-street-view-control-options?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use'); ?>"
21
- target="_blank"><i class="fa fa-link"></i>How to disable Zoom, Street View, Dragging (Control Options)</a>
22
- </li>
23
- </ul>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) {
2
+ exit;} ?>
3
  <ul>
4
+ <li>
5
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-add-google-map-in-your-wordpress-pageblock-editor?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use' ); ?>"
6
+ target="_blank"><i class="fa fa-link"></i>How to add Google Map in Page (Block Editor)?</a>
7
+ </li>
8
+ <li>
9
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-add-google-map-in-your-wordpress-post?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use' ); ?>"
10
+ target="_blank"><i class="fa fa-link"></i>How to add Google Map in Post (Block Editor)?</a>
11
+ </li>
12
+ <li>
13
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-add-google-map-in-sidebar-as-widget-new-widget-editor-from-wordpress-5-8?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use' ); ?>"
14
+ target="_blank"><i class="fa fa-link"></i>How to add Google Map in Sidebar as widget?</a>
15
+ </li>
16
+ <li>
17
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-add-custom-css-and-javascript?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use' ); ?>"
18
+ target="_blank"><i class="fa fa-link"></i>How to add custom CSS and Javascript?</a>
19
+ </li>
20
+ <li>
21
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-disable-zoom-icon-street-view-control-options?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use' ); ?>"
22
+ target="_blank"><i class="fa fa-link"></i>How to disable Zoom, Street View, Dragging (Control Options)</a>
23
+ </li>
24
+ </ul>
admin/includes/wpgmap_installation_manuals.php CHANGED
@@ -1,23 +1,24 @@
1
- <?php if (!defined('ABSPATH')) exit; ?>
 
2
  <ul>
3
- <li>
4
- <a href="<?php echo esc_url('https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation'); ?>"
5
- target="_blank"><i class="fa fa-link"></i>Complete Installation Help Manual</a>
6
- </li>
7
- <li>
8
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-get-google-map-api-key?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation'); ?>"
9
- target="_blank"><i class="fa fa-link"></i>How to get your own API key?</a>
10
- </li>
11
- <li>
12
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-get-google-map-api-key-copy?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation'); ?>"
13
- target="_blank"><i class="fa fa-link"></i>How to add billing in existing Google Cloud project?</a>
14
- </li>
15
- <li>
16
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-customize-map-language-and-regional-area-settings?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation'); ?>"
17
- target="_blank"><i class="fa fa-link"></i>Customize Map Language and Regional Area Settings?</a>
18
- </li>
19
- <li>
20
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-get-your-license-key?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation'); ?>"
21
- target="_blank"><i class="fa fa-link"></i>How to get your Lifetime License key? ($10 only)?</a>
22
- </li>
23
- </ul>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) {
2
+ exit;} ?>
3
  <ul>
4
+ <li>
5
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
6
+ target="_blank"><i class="fa fa-link"></i>Complete Installation Help Manual</a>
7
+ </li>
8
+ <li>
9
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-get-google-map-api-key?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
10
+ target="_blank"><i class="fa fa-link"></i>How to get your own API key?</a>
11
+ </li>
12
+ <li>
13
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-get-google-map-api-key-copy?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
14
+ target="_blank"><i class="fa fa-link"></i>How to add billing in existing Google Cloud project?</a>
15
+ </li>
16
+ <li>
17
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-customize-map-language-and-regional-area-settings?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
18
+ target="_blank"><i class="fa fa-link"></i>Customize Map Language and Regional Area Settings?</a>
19
+ </li>
20
+ <li>
21
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-get-your-license-key?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
22
+ target="_blank"><i class="fa fa-link"></i>How to get your Lifetime License key? ($10 only)?</a>
23
+ </li>
24
+ </ul>
admin/includes/wpgmap_list.php CHANGED
@@ -1,45 +1,47 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
 
 
3
  require_once WGM_PLUGIN_PATH . '/includes/helper.php';
4
  ?>
5
  <script type="text/javascript">
6
- var wgp_api_key = '<?php echo esc_html(get_option('wpgmap_api_key'));?>';
7
  </script>
8
  <div class="wrap">
9
- <h1 class="wp-heading-inline"><?php _e('All Maps', 'gmap-embed'); ?></h1>
10
- <?php
11
- if (_wgm_can_add_new_map()) { ?>
12
- <a href="<?php echo admin_url('admin.php?page=wpgmapembed-new'); ?>" class="page-title-action">Add New</a>
13
- <?php
14
- } else {
15
- echo '<a href="#" class="page-title-action wgm_enable_premium" style="opacity: .3" data-notice="' . esc_html(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Create Unlimited Maps</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=add_new_map'))) . '">Add New</a><sup class="wgm-pro-label">Pro</sup>';
16
- }
17
- if (!_wgm_is_premium()) {
18
- echo '<a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
19
- }
20
- echo '<a target="_blank" href="' . esc_url('https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . __('LIVE Chat', 'gmap-embed') . '</a>';
21
- echo '<a href="' . esc_url(admin_url('admin.php?page=wpgmapembed-support')) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . __('Documentation', 'gmap-embed') . '</a>';
22
- // echo '<a target="_blank" href="' . esc_url('https://srmilon.info/documentation?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right: 5px;"><i style="line-height: 25px;" class="dashicons dashicons-book"></i> ' . __('Help Manual', 'gmap-embed') . '</a>';
23
- ?>
24
- <hr class="wp-header-end">
25
- <div id="gmap_container_inner">
26
- <?php require_once WGM_PLUGIN_PATH . 'admin/includes/wgm_messages_viewer.php'; ?>
27
- <!---------------------------Maps List-------------->
28
- <div id="wgm_all_maps" style="padding:5px;">
29
- <table id="wgm_map_list_dt" class="stripe hover row-border order-column" style="width:100%">
30
- <thead>
31
- <tr style="text-align: left;">
32
- <th style="width: 6% !important;">ID</th>
33
- <th style="min-width: 20%;">Title</th>
34
- <th style="width: 6% !important;">Type</th>
35
- <th style="width: 6% !important;">Width</th>
36
- <th style="width: 6% !important;">Height</th>
37
- <th style="width: 15% !important;">Shortcode</th>
38
- <th style="min-width: 12% !important;">Action</th>
39
- </tr>
40
- </thead>
41
- <tbody>
42
- </tbody>
43
- </table>
44
- </div>
45
- </div>
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
  require_once WGM_PLUGIN_PATH . '/includes/helper.php';
6
  ?>
7
  <script type="text/javascript">
8
+ var wgp_api_key = '<?php echo esc_html( get_option( 'wpgmap_api_key' ) ); ?>';
9
  </script>
10
  <div class="wrap">
11
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'All Maps', 'gmap-embed' ); ?></h1>
12
+ <?php
13
+ if ( _wgm_can_add_new_map() ) {
14
+ ?>
15
+ <a href="<?php echo esc_url( admin_url( 'admin.php?page=wpgmapembed-new' ) ); ?>" class="page-title-action">Add New</a>
16
+ <?php
17
+ } else {
18
+ echo '<a href="#" class="page-title-action wgm_enable_premium" style="opacity: .3" data-notice="' . esc_html__( sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b> Create Unlimited Maps</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=add_new_map' ) ) ) . '">Add New</a><sup class="wgm-pro-label">Pro</sup>';
19
+ }
20
+ if ( ! _wgm_is_premium() ) {
21
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_list&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
22
+ }
23
+ echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
24
+ echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
25
+ ?>
26
+ <hr class="wp-header-end">
27
+ <div id="gmap_container_inner">
28
+ <?php require_once WGM_PLUGIN_PATH . 'admin/includes/wgm_messages_viewer.php'; ?>
29
+ <!---------------------------Maps List-------------->
30
+ <div id="wgm_all_maps" style="padding:5px;">
31
+ <table id="wgm_map_list_dt" class="stripe hover row-border order-column" style="width:100%">
32
+ <thead>
33
+ <tr style="text-align: left;">
34
+ <th style="width: 6% !important;">ID</th>
35
+ <th style="min-width: 20%;">Title</th>
36
+ <th style="width: 6% !important;">Type</th>
37
+ <th style="width: 6% !important;">Width</th>
38
+ <th style="width: 6% !important;">Height</th>
39
+ <th style="width: 15% !important;">Shortcode</th>
40
+ <th style="min-width: 12% !important;">Action</th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ </tbody>
45
+ </table>
46
+ </div>
47
+ </div>
admin/includes/wpgmap_settings.php CHANGED
@@ -1,179 +1,197 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
3
- if (isset($_GET['settings-updated'])) {
4
- // add settings saved message with the class of "updated"
5
- add_settings_error('wporg_messages', 'wporg_message', __('Settings updated successfully.', 'wporg'), 'updated');
6
  }
7
- settings_errors('wporg_messages');
 
 
 
 
 
 
8
 
9
- $h = 'https://srmilon.info';
10
  // Updating api key
11
- if (isset($_POST['wpgmapembed_key'])) {
12
- $api_key = trim(sanitize_text_field(esc_html($_POST['wpgmapembed_key'])));
13
- if ($api_key != '') {
14
- if (get_option('wpgmap_api_key') !== false) {
15
- update_option('wpgmap_api_key', $api_key, '', 'yes');
16
- } else {
17
- add_option('wpgmap_api_key', $api_key, '', 'yes');
18
- }
19
- }
 
 
 
 
 
20
  }
21
 
22
- function gmapSrmIsProvided($l)
23
- {
24
- return substr($l, 15, 4) == 'M019';
25
  }
26
 
27
  // Updating license key
28
- if (isset($_POST['wpgmapembed_license'])) {
29
- $wpgmapembed_license = trim(esc_html(sanitize_text_field($_POST['wpgmapembed_license'])));
30
- $message = '<span style="color:red">Invalid license key, please get your license key. <a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=settings_get_license') . '">Get License Key</a></span>';
31
- if ($wpgmapembed_license != '') {
 
 
 
 
 
 
32
 
33
- // License key validation
34
- $ip = esc_html($_SERVER['REMOTE_ADDR']);
35
- $host = esc_html($_SERVER['HTTP_HOST']);
36
 
37
- $arrContextOptions = array(
38
- "http" => array(
39
- "method" => "GET",
40
- "ignore_errors" => true
41
- ),
42
- "ssl" => array(
43
- "allow_self_signed" => true,
44
- "verify_peer" => false,
45
- "verify_peer_name" => false,
46
- ),
47
- );
48
 
49
- $response = file_get_contents($h . '/paypal/api.php?key=' . $wpgmapembed_license . '&ip=' . $ip . '&host=' . $host, false, stream_context_create($arrContextOptions));
50
- $response = json_decode($response);
51
- if ((isset($response->status) and $response->status == true) or gmapSrmIsProvided($wpgmapembed_license)) {
 
 
 
 
 
52
 
53
- if (get_option('wpgmapembed_license') !== false) {
54
- update_option('wpgmapembed_license', $wpgmapembed_license, 'yes');
55
- } else {
56
- add_option('wpgmapembed_license', $wpgmapembed_license, '', 'yes');
57
- }
58
- update_option('_wgm_is_p_v', 'Y');
59
- $message = 'License key updated successfully, <i style="color: green;">Now you can enjoy premium features!</i>';
60
- } else {
61
- $message = '<span style="color:red">Invalid license key, please get your license key. <a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=settings_get_license') . '">Get License Key</a></span>';
62
- }
63
- }
64
  }
65
  ?>
66
  <div class="wrap">
67
- <h1 class="wp-heading-inline"><?php _e('Settings', 'gmap-embed'); ?></h1>
68
- <?php
69
- if (!_wgm_is_premium()) {
70
- echo '<a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
71
- }
72
- echo '<a target="_blank" href="' . esc_url('https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . __('LIVE Chat', 'gmap-embed') . '</a>';
73
- echo '<a href="' . esc_url(admin_url('admin.php?page=wpgmapembed-support')) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . __('Documentation', 'gmap-embed') . '</a>';
74
- // echo '<a target="_blank" href="' . esc_url('https://srmilon.info/documentation?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=admin_header') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right: 5px;"><i style="line-height: 25px;" class="dashicons dashicons-book"></i> ' . __('Help Manual', 'gmap-embed') . '</a>';
75
- ?>
76
- <hr class="wp-header-end">
77
- <!--Settings Tabs-->
78
- <div class="wgm-settings-menu">
79
- <ul>
80
- <li class="active" data-tab="wgm_general_settings"><a href="#wgm_general_settings">General Settings</a></li>
81
- <li data-tab="wgm_advanced_settings"><a href="#wgm_advanced_settings">Advanced Settings</a></li>
82
- </ul>
83
- </div>
84
- <div id="gmap_container_inner" style="margin-top: 0;border-top: none;">
85
- <?php require_once WGM_PLUGIN_PATH . 'admin/includes/wgm_messages_viewer.php'; ?>
86
- <div class="wgm_settings_tabs" id="wgm_general_settings" style="display: block;">
87
- <div class="wpgmapembed_get_api_key">
88
- <h2><?php _e('API Key and License Information', 'gmap-embed'); ?></h2>
89
- <hr/>
90
- <table class="form-table" role="presentation">
91
 
92
- <tbody>
93
- <form method="post"
94
- action="<?php echo admin_url(); ?>admin.php?page=wpgmapembed-settings&message=3">
95
- <tr>
96
- <th scope="row">
97
- <label for="wpgmapembed_key">
98
- <?php _e('Enter API Key: ', 'gmap-embed'); ?>
99
- </label>
100
- </th>
101
- <td scope="row">
102
- <input type="text" name="wpgmapembed_key"
103
- value="<?php echo esc_html(get_option('wpgmap_api_key')); ?>"
104
- size="45" class="regular-text" style="width:100%" id="wpgmapembed_key"/>
105
- <p class="description" id="tagline-description" style="font-style: italic;">
106
- <?php _e('The API key may take up to 5 minutes to take effect', 'gmap-embed'); ?>
107
- </p>
108
- </td>
109
- <td width="30%" style="vertical-align: top;">
110
- <button class="button wgm_btn" style="padding: 4px 10px;font-size: 11px;margin-right:5px;width: auto;"><i class="dashicons dashicons-update-alt" style="line-height: 23px;"></i> <?php _e('Update', 'gmap-embed'); ?></button>
111
- <a target="_blank" style="margin-left: 5px;" href="
112
- <?php echo esc_url('https://console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend,directions_backend&amp;keyType=CLIENT_SIDE&amp;reusekey=true'); ?>"
113
- class="button media-button button-default button-large"><i class="dashicons dashicons-external" style="line-height: 30px;"></i>
114
- <?php _e('GET API KEY', 'gmap-embed'); ?>
115
- </a>
116
- </td>
117
- </tr>
118
- </form>
 
 
 
 
 
 
119
 
120
- <form method="post"
121
- action="<?php echo admin_url(); ?>admin.php?page=wpgmapembed-settings&message=4">
122
- <tr>
123
- <th scope="row">
124
- <label for="wpgmapembed_license">
125
- <?php _e('License Key: ', 'gmap-embed'); ?>
126
- </label>
127
- </th>
128
- <td scope="row">
129
- <input type="text" name="wpgmapembed_license"
130
- value="<?php echo esc_html(get_option('wpgmapembed_license')); ?>"
131
- size="45" class="regular-text" style="width:100%" id="wpgmapembed_license"/>
132
- <p class="description" id="tagline-description" style="font-style: italic;">
133
- <?php _e('After payment you will get an email with license key', 'gmap-embed'); ?>
134
- </p>
135
- </td>
136
- <td width="30%" style="vertical-align: top;">
137
- <button class="button wgm_btn" style="padding: 4px 10px;font-size: 11px;margin-right:5px;width: auto;"><i class="dashicons dashicons-yes-alt" style="line-height: 23px;"></i> <?php _e('Validate', 'gmap-embed'); ?></button>
 
 
 
 
 
138
 
139
- <?php
140
- if (strlen(trim(get_option('wpgmapembed_license'))) !== 32) { ?>
141
- <a target="_blank"
142
- href="<?php echo esc_url('https://srmilon.info/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=settings_get_license'); ?>"
143
- class="button media-button button-default button-large"><?php _e('GET LICENSE KEY', 'gmap-embed'); ?></a>
144
- <?php
145
- }
146
- ?>
147
- </td>
148
- </tr>
149
- </form>
150
- </tbody>
151
- </table>
152
- </div>
153
- <div data-columns="8">
154
- <form method="POST" action="options.php">
155
- <div class="wpgmap_lng_custom_script_settings">
156
- <?php
157
- settings_fields('wpgmap_general_settings');
158
- do_settings_sections('gmap-embed-settings-page-ls');
159
- do_settings_sections('gmap-embed-settings-page-cs');
160
- do_settings_sections('gmap-embed-general-settings');
161
- submit_button();
162
- ?>
163
- </div>
164
- </form>
165
- </div>
166
- </div>
167
- <div class="wgm_settings_tabs" id="wgm_advanced_settings" style="display: none;">
168
- <form method="POST" action="options.php">
169
- <div class="wpgmap_lng_custom_script_settings">
170
- <?php
171
- settings_fields('wgm_advance_settings');
172
- do_settings_sections('wgm_advance_settings-page');
173
- submit_button();
174
- ?>
175
- </div>
176
- </form>
177
- </div>
178
- </div>
179
- </div>
 
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
 
 
4
  }
5
+ if ( isset( $_GET['settings-updated'] ) ) {
6
+ // add settings saved message with the class of "updated"
7
+ add_settings_error( 'wporg_messages', 'wporg_message', __( 'Settings updated successfully.', 'wporg' ), 'updated' );
8
+ }
9
+ settings_errors( 'wporg_messages' );
10
+
11
+ $h = esc_url( 'https://wpgooglemap.com' );
12
 
 
13
  // Updating api key
14
+ if ( isset( $_POST['wpgmapembed_key'] ) ) {
15
+
16
+ if ( ! isset( $_POST['_wp_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wp_nonce'] ) ), 'settings_api_key_update' ) ) {
17
+ print 'Access denied!';
18
+ exit;
19
+ }
20
+ $api_key = sanitize_text_field( wp_unslash( $_POST['wpgmapembed_key'] ) );
21
+ if ( $api_key !== '' ) {
22
+ if ( get_option( 'wpgmap_api_key' ) !== false ) {
23
+ update_option( 'wpgmap_api_key', $api_key, 'yes' );
24
+ } else {
25
+ add_option( 'wpgmap_api_key', $api_key, '', 'yes' );
26
+ }
27
+ }
28
  }
29
 
30
+ function gmapSrmIsProvided( $l ) {
31
+ return substr( $l, 15, 4 ) === 'M019';
 
32
  }
33
 
34
  // Updating license key
35
+ if ( isset( $_POST['wpgmapembed_license'] ) ) {
36
+
37
+ if ( ! isset( $_POST['_wp_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wp_nonce'] ) ), 'settings_lc_key_update' ) ) {
38
+ print 'Access denied!';
39
+ exit;
40
+ }
41
+
42
+ $wpgmapembed_license = sanitize_text_field( wp_unslash( $_POST['wpgmapembed_license'] ) );
43
+ $message = '<span style="color:red">Invalid license key, please get your license key. <a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=settings_get_license' ) . '">Get License Key</a></span>';
44
+ if ( $wpgmapembed_license !== '' ) {
45
 
46
+ // License key validation
47
+ $ip = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) );
48
+ $host = sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) );
49
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
+ $response = array();
52
+ $request = wp_remote_get( esc_url( $h . '/paypal/api.php?key=' . $wpgmapembed_license . '&ip=' . $ip . '&host=' . $host ) );
53
+ $http_code = wp_remote_retrieve_response_code( $request );
54
+ if ( $http_code === 200 ) {
55
+ $body = wp_remote_retrieve_body( $request );
56
+ $response = json_decode( $body );
57
+ }
58
+ if ( ( $http_code === 200 && isset( $response->status ) && $response->status === true ) || gmapSrmIsProvided( $wpgmapembed_license ) ) {
59
 
60
+ if ( get_option( 'wpgmapembed_license' ) !== false ) {
61
+ update_option( 'wpgmapembed_license', $wpgmapembed_license, 'yes' );
62
+ } else {
63
+ add_option( 'wpgmapembed_license', $wpgmapembed_license, '', 'yes' );
64
+ }
65
+ update_option( '_wgm_is_p_v', 'Y' );
66
+ $message = 'License key updated successfully, <i style="color: green;">Now you can enjoy premium features!</i>';
67
+ } else {
68
+ $message = '<span style="color:red">Invalid license key, please get your license key. <a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=settings_get_license' ) . '">Get License Key</a></span>';
69
+ }
70
+ }
71
  }
72
  ?>
73
  <div class="wrap">
74
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Settings', 'gmap-embed' ); ?></h1>
75
+ <?php
76
+ if ( ! _wgm_is_premium() ) {
77
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
78
+ }
79
+ echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . esc_html__( 'LIVE Chat', 'gmap-embed' ) . '</a>';
80
+ echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . esc_html__( 'Documentation', 'gmap-embed' ) . '</a>';
81
+ ?>
82
+ <hr class="wp-header-end">
83
+ <!--Settings Tabs-->
84
+ <div class="wgm-settings-menu">
85
+ <ul>
86
+ <li class="active" data-tab="wgm_general_settings"><a href="#wgm_general_settings">General Settings</a></li>
87
+ <li data-tab="wgm_advanced_settings"><a href="#wgm_advanced_settings">Advanced Settings</a></li>
88
+ </ul>
89
+ </div>
90
+ <div id="gmap_container_inner" style="margin-top: 0;border-top: none;">
91
+ <?php require_once WGM_PLUGIN_PATH . 'admin/includes/wgm_messages_viewer.php'; ?>
92
+ <div class="wgm_settings_tabs" id="wgm_general_settings" style="display: block;">
93
+ <div class="wpgmapembed_get_api_key">
94
+ <h2><?php esc_html_e( 'API Key and License Information', 'gmap-embed' ); ?></h2>
95
+ <hr/>
96
+ <table class="form-table" role="presentation">
 
97
 
98
+ <tbody>
99
+ <form method="post"
100
+ action="<?php echo esc_url( admin_url() . 'admin.php?page=wpgmapembed-settings&message=3' ); ?>">
101
+ <?php wp_nonce_field( 'settings_api_key_update', '_wp_nonce' ); ?>
102
+ <tr>
103
+ <th scope="row">
104
+ <label for="wpgmapembed_key">
105
+ <?php esc_html_e( 'Enter API Key: ', 'gmap-embed' ); ?>
106
+ </label>
107
+ </th>
108
+ <td scope="row">
109
+ <input type="text" name="wpgmapembed_key"
110
+ value="<?php echo esc_html( get_option( 'wpgmap_api_key' ) ); ?>"
111
+ size="45" class="regular-text" style="width:100%" id="wpgmapembed_key"/>
112
+ <p class="description" id="tagline-description" style="font-style: italic;">
113
+ <?php esc_html_e( 'The API key may take up to 5 minutes to take effect', 'gmap-embed' ); ?>
114
+ </p>
115
+ </td>
116
+ <td width="30%" style="vertical-align: top;">
117
+ <button class="button wgm_btn"
118
+ style="padding: 4px 10px;font-size: 11px;margin-right:5px;width: auto;"><i
119
+ class="dashicons dashicons-update-alt"
120
+ style="line-height: 23px;"></i> <?php esc_html_e( 'Update', 'gmap-embed' ); ?>
121
+ </button>
122
+ <a target="_blank" style="margin-left: 5px;" href="
123
+ <?php echo esc_url( 'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend,directions_backend&amp;keyType=CLIENT_SIDE&amp;reusekey=true' ); ?>"
124
+ class="button media-button button-default button-large"><i
125
+ class="dashicons dashicons-external" style="line-height: 30px;"></i>
126
+ <?php esc_html_e( 'GET API KEY', 'gmap-embed' ); ?>
127
+ </a>
128
+ </td>
129
+ </tr>
130
+ </form>
131
 
132
+ <form method="post"
133
+ action="<?php echo esc_url( admin_url() . 'admin.php?page=wpgmapembed-settings&message=4' ); ?>">
134
+ <?php wp_nonce_field( 'settings_lc_key_update', '_wp_nonce' ); ?>
135
+ <tr>
136
+ <th scope="row">
137
+ <label for="wpgmapembed_license">
138
+ <?php esc_html_e( 'License Key: ', 'gmap-embed' ); ?>
139
+ </label>
140
+ </th>
141
+ <td scope="row">
142
+ <input type="text" name="wpgmapembed_license"
143
+ value="<?php echo esc_html( get_option( 'wpgmapembed_license' ) ); ?>"
144
+ size="45" class="regular-text" style="width:100%" id="wpgmapembed_license"/>
145
+ <p class="description" id="tagline-description" style="font-style: italic;">
146
+ <?php esc_html_e( 'After payment you will get an email with license key', 'gmap-embed' ); ?>
147
+ </p>
148
+ </td>
149
+ <td width="30%" style="vertical-align: top;">
150
+ <button class="button wgm_btn"
151
+ style="padding: 4px 10px;font-size: 11px;margin-right:5px;width: auto;"><i
152
+ class="dashicons dashicons-yes-alt"
153
+ style="line-height: 23px;"></i> <?php esc_html_e( 'Validate', 'gmap-embed' ); ?>
154
+ </button>
155
 
156
+ <?php
157
+ if ( strlen( trim( get_option( 'wpgmapembed_license' ) ) ) !== 32 ) {
158
+ ?>
159
+ <a target="_blank"
160
+ href="<?php echo esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_settings&utm_medium=admin_link&utm_campaign=settings_get_license' ); ?>"
161
+ class="button media-button button-default button-large"><?php esc_html_e( 'GET LICENSE KEY', 'gmap-embed' ); ?></a>
162
+ <?php
163
+ }
164
+ ?>
165
+ </td>
166
+ </tr>
167
+ </form>
168
+ </tbody>
169
+ </table>
170
+ </div>
171
+ <div data-columns="8">
172
+ <form method="POST" action="options.php">
173
+ <div class="wpgmap_lng_custom_script_settings">
174
+ <?php
175
+ settings_fields( 'wpgmap_general_settings' );
176
+ do_settings_sections( 'gmap-embed-settings-page-ls' );
177
+ do_settings_sections( 'gmap-embed-settings-page-cs' );
178
+ do_settings_sections( 'gmap-embed-general-settings' );
179
+ submit_button();
180
+ ?>
181
+ </div>
182
+ </form>
183
+ </div>
184
+ </div>
185
+ <div class="wgm_settings_tabs" id="wgm_advanced_settings" style="display: none;">
186
+ <form method="POST" action="options.php">
187
+ <div class="wpgmap_lng_custom_script_settings">
188
+ <?php
189
+ settings_fields( 'wgm_advance_settings' );
190
+ do_settings_sections( 'wgm_advance_settings-page' );
191
+ submit_button();
192
+ ?>
193
+ </div>
194
+ </form>
195
+ </div>
196
+ </div>
197
+ </div>
admin/includes/wpgmap_setup_wizard.php CHANGED
@@ -1,131 +1,131 @@
1
  <div class="wgm_setup_wizard_container">
2
- <div class="wgm_setup_wizard_wrap">
3
 
4
- <div class="wgm_setup_wizard_header">
5
- <img class="wgm_logo"
6
- src="<?php echo esc_url(plugins_url("../assets/images/gmap_embed_logo.jpg", __FILE__)); ?>"/>
7
- <span class="wgm_plugin_name"><?php _e('Quick Setup Wizard', 'gmap-embed'); ?></span>
8
- </div>
9
 
10
- <ul class="wgm_setup_wizard_steps wgm_four" data-step="0">
11
- <li class="wgm_step">
12
- <div class="wgm_icon">
13
- <i class="fas fa-key"></i>
14
- </div>
15
- <div class="wgm_step_name"><?php _e("CREATE YOUR API KEY", "gmap-embed") ?></div>
16
- </li>
17
- <li class="wgm_step">
18
- <div class="wgm_icon">
19
- <i class="fas fa-language"></i>
20
- </div>
21
- <div class="wgm_step_name"><?php _e("MAP LANGUAGE & REGION", "gmap-embed") ?></div>
22
- </li>
23
- </ul>
24
 
25
- <div class="wgm_setup_body">
26
- <form class="wgm_setup_wizard_form" method="post" action="#">
27
- <!--Get API key-->
28
- <div class="wgm_setup_content wgm_box">
29
- <div class="wgm_row">
30
- <div class="wgm-col-full">
31
- <span class="wgm_heading"><?php _e('Create API Key from Google', 'gmap-embed'); ?></span>
32
- <p class="wgm_text_center wgm_mb_40"><?php _e('Let\'s create API key from Google cloud platform, <b>it\'s required by Google to use Google Map</b>', 'gmap-embed'); ?></p>
33
- </div>
34
- <div class="wgm-col-full wgm_d_flex">
35
- <label for="wgm_key"><?php _e('Enter API key', 'gmap-embed'); ?></label>
36
- <div class="wgm_w_60">
37
- <input type="text" name="wgm_key"
38
- placeholder="Please click on GET API KEY button to get your own API key"
39
- value="<?php echo esc_html(get_option('wpgmap_api_key')); ?>" size="60"
40
- id="wgm_key"/>
41
- </div>
42
- <a target="_blank"
43
- href="<?php echo esc_url('https://console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend,directions_backend&amp;keyType=CLIENT_SIDE&amp;reusekey=true'); ?>"
44
- class="button media-button button-default button-large wgm_api_btn"> <i
45
- class="fas fa-external-link-alt"></i>
46
- <?php _e('GET API KEY', 'gmap-embed'); ?>
47
- </a>
48
- </div>
49
- </div>
50
- <div class="wgm-col-full wgm_text_right">
51
- <a href="//www.youtube.com/watch?v=m-jAsxG0zuk" target="_blank" class="wgm_info_notice">
52
- <i class="dashicons dashicons-youtube"></i> <?php _e('Video Tutorial', 'gmap-embed'); ?>
53
- </a>
54
- &nbsp;&nbsp;&nbsp;<a
55
- href="<?php echo esc_url('https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=setup_wizard');?>"
56
- target="_blank" class="wgm_info_notice"><i
57
- class="fas fa-external-link-alt"></i> <?php _e('See help manual', 'gmap-embed'); ?>
58
- </a>
59
- </div>
60
- </div>
61
- <!-- Language and Regional Setup-->
62
- <div id="wpgmap_lang_regional" class="wgm_setup_content wgm_box">
63
- <div class="wgm_row">
64
- <div class="wgm-col-full">
65
- <span class="wgm_heading"><?php _e('Language and Regional Setup', 'gmap-embed'); ?></span>
66
- <p class="wgm_text_center wgm_mb_40"><?php _e('You can customize your Google Map title & contents by setting up Language and Regional setup', 'gmap-embed'); ?></p>
67
- </div>
68
- <div class="wgm-col-full wgm_d_flex wgm_mb_15">
69
- <label><?php _e('Map Language:', 'gmap-embed') ?></label>
70
- <div class="wgm_w_60">
71
- <select id="wgm_gmap_lng" name="srm_gmap_lng" class="regular-text">
72
- <?php
73
- $wpgmap_languages = gmap_embed_get_languages();
74
- if (count($wpgmap_languages) > 0) {
75
- foreach ($wpgmap_languages as $lng_key => $language) {
76
- $selected = '';
77
- if (get_option('srm_gmap_lng', 'en') == $lng_key) {
78
- $selected = 'selected';
79
- }
80
- echo "<option value='$lng_key' $selected>$language</option>";
81
- }
82
- }
83
- ?>
84
- </select>
85
- <p class="description" id="tagline-description" style="font-style: italic;">
86
- <?php _e('Choose your desired map language', 'gmap-embed'); ?>
87
- </p>
88
- </div>
89
- </div>
90
- <br>
91
- <div class="wgm-col-full wgm_d_flex">
92
- <label><?php _e('Regional Area:', 'gmap-embed') ?></label>
93
- <div class="wgm_w_60">
94
- <select id="wgm_region" name="wgm_region" class="regular-text">
95
- <?php
96
- $wpgmap_regions = gmap_embed_get_regions();
97
- if (count($wpgmap_regions) > 0) {
98
- foreach ($wpgmap_regions as $region_key => $region) {
99
- $selected = '';
100
- if (get_option('srm_gmap_region', 'US') == $region_key) {
101
- $selected = 'selected';
102
- }
103
- echo "<option value='$region_key' $selected>".esc_html($region)."</option>";
104
- }
105
- }
106
- ?>
107
- </select>
108
- <p class="description" id="tagline-description" style="font-style: italic;">
109
- <?php _e('Choose your regional area', 'gmap-embed'); ?>
110
- </p>
111
- </div>
112
- </div>
113
- </div>
114
- </div>
115
- </form>
116
- </div>
117
 
118
- <div class="wgm_setup_footer">
119
- <button id="wgm_prev" class="button wgm_btn" style="display: none;">
120
- &lt; <?php _e('Previous', 'gmap-embed'); ?></button>
121
- <button id="wgm_next" class="button wgm_btn"
122
- style="display: inline;"><?php _e('Next', 'gmap-embed'); ?> &gt;
123
- </button>
124
- <button id="wgm_save" style="display: none"
125
- class="button wgm_btn wpgmap-setup-wizard-save"><?php _e('Finish', 'gmap-embed'); ?></button>
126
- <div class="wgm-col-full wgm_d_flex">
127
- <a href="<?php echo admin_url(); ?>admin.php?page=wpgmapembed">Skip Setup Wizard</a>
128
- </div>
129
- </div>
130
- </div>
131
- </div>
1
  <div class="wgm_setup_wizard_container">
2
+ <div class="wgm_setup_wizard_wrap">
3
 
4
+ <div class="wgm_setup_wizard_header">
5
+ <img class="wgm_logo"
6
+ src="<?php echo esc_url( plugins_url( '../assets/images/gmap_embed_logo.jpg', __FILE__ ) ); ?>"/>
7
+ <span class="wgm_plugin_name"><?php esc_html_e( 'Quick Setup Wizard', 'gmap-embed' ); ?></span>
8
+ </div>
9
 
10
+ <ul class="wgm_setup_wizard_steps wgm_four" data-step="0">
11
+ <li class="wgm_step">
12
+ <div class="wgm_icon">
13
+ <i class="fas fa-key"></i>
14
+ </div>
15
+ <div class="wgm_step_name"><?php esc_html_e( 'CREATE YOUR API KEY', 'gmap-embed' ); ?></div>
16
+ </li>
17
+ <li class="wgm_step">
18
+ <div class="wgm_icon">
19
+ <i class="fas fa-language"></i>
20
+ </div>
21
+ <div class="wgm_step_name"><?php esc_html_e( 'MAP LANGUAGE & REGION', 'gmap-embed' ); ?></div>
22
+ </li>
23
+ </ul>
24
 
25
+ <div class="wgm_setup_body">
26
+ <form class="wgm_setup_wizard_form" method="post" action="#">
27
+ <!--Get API key-->
28
+ <div class="wgm_setup_content wgm_box">
29
+ <div class="wgm_row">
30
+ <div class="wgm-col-full">
31
+ <span class="wgm_heading"><?php esc_html_e( 'Create API Key from Google', 'gmap-embed' ); ?></span>
32
+ <p class="wgm_text_center wgm_mb_40"><?php esc_html_e( 'Let\'s create API key from Google cloud platform, <b>it\'s required by Google to use Google Map</b>', 'gmap-embed' ); ?></p>
33
+ </div>
34
+ <div class="wgm-col-full wgm_d_flex">
35
+ <label for="wgm_key"><?php esc_html_e( 'Enter API key', 'gmap-embed' ); ?></label>
36
+ <div class="wgm_w_60">
37
+ <input type="text" name="wgm_key"
38
+ placeholder="Please click on GET API KEY button to get your own API key"
39
+ value="<?php echo esc_html( get_option( 'wpgmap_api_key' ) ); ?>" size="60"
40
+ id="wgm_key"/>
41
+ </div>
42
+ <a target="_blank"
43
+ href="<?php echo esc_url( 'https://console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend,directions_backend&amp;keyType=CLIENT_SIDE&amp;reusekey=true' ); ?>"
44
+ class="button media-button button-default button-large wgm_api_btn"> <i
45
+ class="fas fa-external-link-alt"></i>
46
+ <?php esc_html_e( 'GET API KEY', 'gmap-embed' ); ?>
47
+ </a>
48
+ </div>
49
+ </div>
50
+ <div class="wgm-col-full wgm_text_right">
51
+ <a href="//www.youtube.com/watch?v=m-jAsxG0zuk" target="_blank" class="wgm_info_notice">
52
+ <i class="dashicons dashicons-youtube"></i> <?php esc_html_e( 'Video Tutorial', 'gmap-embed' ); ?>
53
+ </a>
54
+ &nbsp;&nbsp;&nbsp;<a
55
+ href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=setup_wizard' ); ?>"
56
+ target="_blank" class="wgm_info_notice"><i
57
+ class="fas fa-external-link-alt"></i> <?php esc_html_e( 'See help manual', 'gmap-embed' ); ?>
58
+ </a>
59
+ </div>
60
+ </div>
61
+ <!-- Language and Regional Setup-->
62
+ <div id="wpgmap_lang_regional" class="wgm_setup_content wgm_box">
63
+ <div class="wgm_row">
64
+ <div class="wgm-col-full">
65
+ <span class="wgm_heading"><?php esc_html_e( 'Language and Regional Setup', 'gmap-embed' ); ?></span>
66
+ <p class="wgm_text_center wgm_mb_40"><?php esc_html_e( 'You can customize your Google Map title & contents by setting up Language and Regional setup', 'gmap-embed' ); ?></p>
67
+ </div>
68
+ <div class="wgm-col-full wgm_d_flex wgm_mb_15">
69
+ <label><?php esc_html_e( 'Map Language:', 'gmap-embed' ); ?></label>
70
+ <div class="wgm_w_60">
71
+ <select id="wgm_gmap_lng" name="srm_gmap_lng" class="regular-text">
72
+ <?php
73
+ $wpgmap_languages = gmap_embed_get_languages();
74
+ if ( count( $wpgmap_languages ) > 0 ) {
75
+ foreach ( $wpgmap_languages as $lng_key => $language ) {
76
+ $selected = '';
77
+ if ( get_option( 'srm_gmap_lng', 'en' ) === $lng_key ) {
78
+ $selected = 'selected';
79
+ }
80
+ echo "<option value='" . esc_attr( $lng_key ) . "' " . esc_attr( $selected ) . '>' . esc_html( $language ) . '</option>';
81
+ }
82
+ }
83
+ ?>
84
+ </select>
85
+ <p class="description" id="tagline-description" style="font-style: italic;">
86
+ <?php esc_html_e( 'Choose your desired map language', 'gmap-embed' ); ?>
87
+ </p>
88
+ </div>
89
+ </div>
90
+ <br>
91
+ <div class="wgm-col-full wgm_d_flex">
92
+ <label><?php esc_html_e( 'Regional Area:', 'gmap-embed' ); ?></label>
93
+ <div class="wgm_w_60">
94
+ <select id="wgm_region" name="wgm_region" class="regular-text">
95
+ <?php
96
+ $wpgmap_regions = gmap_embed_get_regions();
97
+ if ( count( $wpgmap_regions ) > 0 ) {
98
+ foreach ( $wpgmap_regions as $region_key => $region ) {
99
+ $selected = '';
100
+ if ( get_option( 'srm_gmap_region', 'US' ) === $region_key ) {
101
+ $selected = 'selected';
102
+ }
103
+ echo "<option value='" . esc_attr( $region_key ) . "' " . esc_attr( $selected ) . '>' . esc_html( $region ) . '</option>';
104
+ }
105
+ }
106
+ ?>
107
+ </select>
108
+ <p class="description" id="tagline-description" style="font-style: italic;">
109
+ <?php esc_html_e( 'Choose your regional area', 'gmap-embed' ); ?>
110
+ </p>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </form>
116
+ </div>
117
 
118
+ <div class="wgm_setup_footer">
119
+ <button id="wgm_prev" class="button wgm_btn" style="display: none;">
120
+ &lt; <?php esc_html_e( 'Previous', 'gmap-embed' ); ?></button>
121
+ <button id="wgm_next" class="button wgm_btn"
122
+ style="display: inline;"><?php esc_html_e( 'Next', 'gmap-embed' ); ?> &gt;
123
+ </button>
124
+ <button id="wgm_save" style="display: none"
125
+ class="button wgm_btn wpgmap-setup-wizard-save"><?php esc_html_e( 'Finish', 'gmap-embed' ); ?></button>
126
+ <div class="wgm-col-full wgm_d_flex">
127
+ <a href="<?php echo esc_url( admin_url() . 'admin.php?page=wpgmapembed' ); ?>">Skip Setup Wizard</a>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </div>
admin/includes/wpgmap_support.php CHANGED
@@ -1,130 +1,141 @@
1
- <?php if (!defined('ABSPATH')) exit; ?>
 
2
  <div class="wrap">
3
- <h1 class="wp-heading-inline"><?php _e('Support', 'gmap-embed'); ?></h1>
4
- <?php
5
- if (!_wgm_is_premium()) {
6
- echo '<a target="_blank" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_support&utm_medium=admin_link&utm_campaign=header_menu') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
7
- }
8
 
9
 
10
- echo '<a target="_blank" href="' . esc_url('https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp') . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . __('LIVE Chat', 'gmap-embed') . '</a>';
11
- echo '<a href="' . esc_url(admin_url('admin.php?page=wpgmapembed-support')) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . __('Documentation', 'gmap-embed') . '</a>';
12
- ?>
13
- <hr class="wp-header-end">
14
 
15
- <div class="wgm_admin_support_wrapper">
16
 
17
- <div class="wgm_admin_block">
18
- <header class="wgm_admin_block_header">
19
- <div class="wgm_admin_block_header_icon">
20
- <i class="fas fa-file-alt"></i>
21
- </div>
22
- <h4 class="wgm_admin_title">Installation</h4>
23
- </header>
24
- <div class="wgm_admin_block_content">
25
- <div class="wgm_gmap_instructions">
26
- <?php
27
- require_once WGM_PLUGIN_PATH . 'admin/includes/wpgmap_installation_manuals.php';
28
- ?>
29
- </div>
30
- <a href="<?php echo esc_url('https://srmilon.info/docs-category/installation?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation');?>" class="wgm_button"
31
- target="_blank">View All</a>
32
- </div>
33
- </div>
 
34
 
35
- <div class="wgm_admin_block">
36
- <header class="wgm_admin_block_header">
37
- <div class="wgm_admin_block_header_icon">
38
- <i class="fas fa-file-alt"></i>
39
- </div>
40
- <h4 class="wgm_admin_title">How to use</h4>
41
- </header>
42
- <div class="wgm_admin_block_content">
43
- <div class="wgm_gmap_instructions">
44
- <?php
45
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_how_to_use_manuals.php';
46
- ?>
47
- </div>
48
- <a href="<?php echo esc_url('https://srmilon.info/docs-category/customization?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use');?>" class="wgm_button"
49
- target="_blank">View All</a>
50
- </div>
51
- </div>
 
52
 
53
- <div class="wgm_admin_block">
54
- <header class="wgm_admin_block_header">
55
- <div class="wgm_admin_block_header_icon">
56
- <i class="fas fa-file-alt"></i>
57
- </div>
58
- <h4 class="wgm_admin_title">Troubleshooting</h4>
59
- </header>
60
- <div class="wgm_admin_block_content">
61
- <div class="wgm_gmap_instructions">
62
- <?php
63
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_troubleshooting_manuals.php';
64
- ?>
65
- </div>
66
- <a href="<?php echo esc_url('https://srmilon.info/docs-category/troubleshooting?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting');?>" class="wgm_button"
67
- target="_blank">View All</a>
68
- </div>
69
- </div>
 
70
 
71
- </div>
72
 
73
- <div class="wgm_admin_support_wrapper" style="margin-top: 50px;">
74
- <div class="wgm_admin_block">
75
- <header class="wgm_admin_block_header">
76
- <div class="wgm_admin_block_header_icon">
77
- <i class="fas fa-user-plus"></i>
78
- </div>
79
- <h4 class="wgm_admin_title">Contribute to WP Google Map</h4>
80
- </header>
81
- <div class="wgm_admin_block_content">
82
- <p>You can contribute to make WP Google Map better reporting bugs, creating issues at <a
83
- href="https://github.com/milonfci/gmap-embed-lite/issues/new"
84
- target="_blank">Github.</a> We are looking forward for your feedback.</p>
85
- <a href="https://github.com/milonfci/gmap-embed-lite/issues/new"
86
- class="wgm_button" target="_blank">Report an issue</a>
87
- </div>
88
- </div>
89
- <div class="wgm_admin_block">
90
- <header class="wgm_admin_block_header">
91
- <div class="wgm_admin_block_header_icon">
92
- <i class="fas fa-headset"></i>
93
- </div>
94
- <h4 class="wgm_admin_title">Need Help?</h4>
95
- </header>
96
- <div class="wgm_admin_block_content">
97
 
98
- <p>Stuck with something? Get help from the community on <a
99
- href="https://wordpress.org/support/plugin/gmap-embed/#new-topic-0"
100
- target="_blank">WordPress.org Forum</a> or <a
101
- href="https://www.facebook.com/Google-Map-SRM-100856491527309" target="_blank">Facebook
102
- Community.</a> In case of emergency, initiate a live chat at <a
103
- href="<?php echo esc_url('https://srmilon.info?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_need_help');?>" target="_blank">WP Google Map website.</a></p>
104
- <a href="<?php echo esc_url('https://srmilon.info/contact-us?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_need_help');?>" class="wgm_button" target="_blank">Get
105
- Support</a>
 
 
 
106
 
107
- </div>
108
- </div>
109
 
110
- <div class="wgm_admin_block">
111
- <header class="wgm_admin_block_header">
112
- <div class="wgm_admin_block_header_icon">
113
- <i class="far fa-heart"></i>
114
- </div>
115
- <h4 class="wgm_admin_title">Show your Love</h4>
116
- </header>
117
- <div class="wgm_admin_block_content">
118
- <p>We love to have you in WP Google Map family. We are making it more awesome
119
- everyday. Take your 2 minutes to review the plugin and spread the love to
120
- encourage us to keep it going.</p>
121
 
122
- <a href="https://wordpress.org/support/plugin/gmap-embed/reviews/?filter=5#new-post"
123
- class="review-flexia wgm_button" target="_blank">Leave a Review</a>
124
- </div>
125
- </div>
126
- </div>
127
- <div class="wgm_admin_support_wrapper" style="margin-top: 50px;">
128
- <iframe width="1904" height="768" src="https://www.youtube.com/embed/9KZOUJ9Gdv8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
129
- </div>
130
- </div>
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) {
2
+ exit;} ?>
3
  <div class="wrap">
4
+ <h1 class="wp-heading-inline"><?php esc_html_e( 'Support', 'gmap-embed' ); ?></h1>
5
+ <?php
6
+ if ( ! _wgm_is_premium() ) {
7
+ echo '<a target="_blank" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_support&utm_medium=admin_link&utm_campaign=header_menu' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-left:5px;"><i style="line-height: 25px;" class="dashicons dashicons-star-filled"></i> Upgrade ($10 only)</a>';
8
+ }
9
 
10
 
11
+ echo '<a target="_blank" href="' . esc_url( 'https://tawk.to/chat/6083e29962662a09efc1acd5/1f41iqarp' ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;background-color: #cb5757 !important;color: white !important;"><i style="line-height: 28px;" class="dashicons dashicons-format-chat"></i> ' . __( 'LIVE Chat', 'gmap-embed' ) . '</a>';
12
+ echo '<a href="' . esc_url( admin_url( 'admin.php?page=wpgmapembed-support' ) ) . '" class="button wgm_btn" style="float:right;width:auto;padding: 5px 7px;font-size: 11px;margin-right:5px;"><i style="line-height: 25px;" class="dashicons dashicons-editor-help"></i> ' . __( 'Documentation', 'gmap-embed' ) . '</a>';
13
+ ?>
14
+ <hr class="wp-header-end">
15
 
16
+ <div class="wgm_admin_support_wrapper">
17
 
18
+ <div class="wgm_admin_block">
19
+ <header class="wgm_admin_block_header">
20
+ <div class="wgm_admin_block_header_icon">
21
+ <i class="fas fa-file-alt"></i>
22
+ </div>
23
+ <h4 class="wgm_admin_title">Installation</h4>
24
+ </header>
25
+ <div class="wgm_admin_block_content">
26
+ <div class="wgm_gmap_instructions">
27
+ <?php
28
+ require_once WGM_PLUGIN_PATH . 'admin/includes/wpgmap_installation_manuals.php';
29
+ ?>
30
+ </div>
31
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/docs-category/installation?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_installation' ); ?>"
32
+ class="wgm_button"
33
+ target="_blank">View All</a>
34
+ </div>
35
+ </div>
36
 
37
+ <div class="wgm_admin_block">
38
+ <header class="wgm_admin_block_header">
39
+ <div class="wgm_admin_block_header_icon">
40
+ <i class="fas fa-file-alt"></i>
41
+ </div>
42
+ <h4 class="wgm_admin_title">How to use</h4>
43
+ </header>
44
+ <div class="wgm_admin_block_content">
45
+ <div class="wgm_gmap_instructions">
46
+ <?php
47
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_how_to_use_manuals.php';
48
+ ?>
49
+ </div>
50
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/docs-category/customization?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_how_to_use' ); ?>"
51
+ class="wgm_button"
52
+ target="_blank">View All</a>
53
+ </div>
54
+ </div>
55
 
56
+ <div class="wgm_admin_block">
57
+ <header class="wgm_admin_block_header">
58
+ <div class="wgm_admin_block_header_icon">
59
+ <i class="fas fa-file-alt"></i>
60
+ </div>
61
+ <h4 class="wgm_admin_title">Troubleshooting</h4>
62
+ </header>
63
+ <div class="wgm_admin_block_content">
64
+ <div class="wgm_gmap_instructions">
65
+ <?php
66
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_troubleshooting_manuals.php';
67
+ ?>
68
+ </div>
69
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/docs-category/troubleshooting?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting' ); ?>"
70
+ class="wgm_button"
71
+ target="_blank">View All</a>
72
+ </div>
73
+ </div>
74
 
75
+ </div>
76
 
77
+ <div class="wgm_admin_support_wrapper" style="margin-top: 50px;">
78
+ <div class="wgm_admin_block">
79
+ <header class="wgm_admin_block_header">
80
+ <div class="wgm_admin_block_header_icon">
81
+ <i class="fas fa-user-plus"></i>
82
+ </div>
83
+ <h4 class="wgm_admin_title">Contribute to WP Google Map</h4>
84
+ </header>
85
+ <div class="wgm_admin_block_content">
86
+ <p>You can contribute to make WP Google Map better reporting bugs, creating issues at <a
87
+ href="<?php echo esc_url( 'https://github.com/milonfci/gmap-embed-lite/issues/new' ); ?>"
88
+ target="_blank">Github.</a> We are looking forward for your feedback.</p>
89
+ <a href="https://github.com/milonfci/gmap-embed-lite/issues/new"
90
+ class="wgm_button" target="_blank">Report an issue</a>
91
+ </div>
92
+ </div>
93
+ <div class="wgm_admin_block">
94
+ <header class="wgm_admin_block_header">
95
+ <div class="wgm_admin_block_header_icon">
96
+ <i class="fas fa-headset"></i>
97
+ </div>
98
+ <h4 class="wgm_admin_title">Need Help?</h4>
99
+ </header>
100
+ <div class="wgm_admin_block_content">
101
 
102
+ <p>Stuck with something? Get help from the community on <a
103
+ href="<?php echo esc_url( 'https://wordpress.org/support/plugin/gmap-embed/#new-topic-0' ); ?>"
104
+ target="_blank">WordPress.org Forum</a> or <a
105
+ href="<?php echo esc_url( 'https://www.facebook.com/Google-Map-SRM-100856491527309' ); ?>"
106
+ target="_blank">Facebook
107
+ Community.</a> In case of emergency, initiate a live chat at <a
108
+ href="<?php echo esc_url( 'https://wpgooglemap.com?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_need_help' ); ?>"
109
+ target="_blank">WP Google Map website.</a></p>
110
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/contact-us?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_need_help' ); ?>"
111
+ class="wgm_button" target="_blank">Get
112
+ Support</a>
113
 
114
+ </div>
115
+ </div>
116
 
117
+ <div class="wgm_admin_block">
118
+ <header class="wgm_admin_block_header">
119
+ <div class="wgm_admin_block_header_icon">
120
+ <i class="far fa-heart"></i>
121
+ </div>
122
+ <h4 class="wgm_admin_title">Show your Love</h4>
123
+ </header>
124
+ <div class="wgm_admin_block_content">
125
+ <p>We love to have you in WP Google Map family. We are making it more awesome
126
+ everyday. Take your 2 minutes to review the plugin and spread the love to
127
+ encourage us to keep it going.</p>
128
 
129
+ <a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/gmap-embed/reviews/?filter=5#new-post' ); ?>"
130
+ class="review-flexia wgm_button" target="_blank">Leave a Review</a>
131
+ </div>
132
+ </div>
133
+ </div>
134
+ <div class="wgm_admin_support_wrapper" style="margin-top: 50px;">
135
+ <iframe width="1904" height="768" src="<?php echo esc_url( 'https://www.youtube.com/embed/9KZOUJ9Gdv8' ); ?>"
136
+ title="YouTube video player"
137
+ frameborder="0"
138
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
139
+ allowfullscreen></iframe>
140
+ </div>
141
+ </div>
admin/includes/wpgmap_troubleshooting_manuals.php CHANGED
@@ -1,20 +1,21 @@
1
- <?php if (!defined('ABSPATH')) exit; ?>
 
2
  <ul>
3
- <li>
4
- <a href="<?php echo esc_url('https://srmilon.info/documentation/can-not-load-the-map-correctly?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting'); ?>"
5
- target="_blank"><i class="fa fa-link"></i>Do you see "the page can’t load the map correctly"?</a>
6
- </li>
7
- <li>
8
- <a href="<?php echo esc_url('https://srmilon.info/documentation/dont-see-embed-google-map-button-in-new-editor?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting'); ?>"
9
- target="_blank"><i class="fa fa-link"></i>Can’t see the “WP Google Map” button in new
10
- Guttenburg Editor?</a>
11
- </li>
12
- <li>
13
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-debug-or-identify-the-map-loading-problems-in-admin-panel?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting'); ?>"
14
- target="_blank"><i class="fa fa-link"></i>How to debug and fix the Map loading problems?</a>
15
- </li>
16
- <li>
17
- <a href="<?php echo esc_url('https://srmilon.info/documentation/how-to-fix-multiple-google-map-api-loading?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting'); ?>"
18
- target="_blank"><i class="fa fa-link"></i>How to fix Multiple Google Map API loading?</a>
19
- </li>
20
- </ul>
1
+ <?php if ( ! defined( 'ABSPATH' ) ) {
2
+ exit;} ?>
3
  <ul>
4
+ <li>
5
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/can-not-load-the-map-correctly?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting' ); ?>"
6
+ target="_blank"><i class="fa fa-link"></i>Do you see "the page can’t load the map correctly"?</a>
7
+ </li>
8
+ <li>
9
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/dont-see-embed-google-map-button-in-new-editor?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting' ); ?>"
10
+ target="_blank"><i class="fa fa-link"></i>Can’t see the “WP Google Map” button in new
11
+ Guttenburg Editor?</a>
12
+ </li>
13
+ <li>
14
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-debug-or-identify-the-map-loading-problems-in-admin-panel?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting' ); ?>"
15
+ target="_blank"><i class="fa fa-link"></i>How to debug and fix the Map loading problems?</a>
16
+ </li>
17
+ <li>
18
+ <a href="<?php echo esc_url( 'https://wpgooglemap.com/documentation/how-to-fix-multiple-google-map-api-loading?utm_source=admin_support&utm_medium=admin_link&utm_campaign=support_troubleshooting' ); ?>"
19
+ target="_blank"><i class="fa fa-link"></i>How to fix Multiple Google Map API loading?</a>
20
+ </li>
21
+ </ul>
appsero/src/Client.php DELETED
@@ -1,280 +0,0 @@
1
- <?php
2
- namespace Appsero;
3
-
4
- /**
5
- * Appsero Client
6
- *
7
- * This class is necessary to set project data
8
- */
9
- class Client {
10
-
11
- /**
12
- * The client version
13
- *
14
- * @var string
15
- */
16
- public $version = '1.2.0';
17
-
18
- /**
19
- * Hash identifier of the plugin
20
- *
21
- * @var string
22
- */
23
- public $hash;
24
-
25
- /**
26
- * Name of the plugin
27
- *
28
- * @var string
29
- */
30
- public $name;
31
-
32
- /**
33
- * The plugin/theme file path
34
- * @example .../wp-content/plugins/test-slug/test-slug.php
35
- *
36
- * @var string
37
- */
38
- public $file;
39
-
40
- /**
41
- * Main plugin file
42
- * @example test-slug/test-slug.php
43
- *
44
- * @var string
45
- */
46
- public $basename;
47
-
48
- /**
49
- * Slug of the plugin
50
- * @example test-slug
51
- *
52
- * @var string
53
- */
54
- public $slug;
55
-
56
- /**
57
- * The project version
58
- *
59
- * @var string
60
- */
61
- public $project_version;
62
-
63
- /**
64
- * The project type
65
- *
66
- * @var string
67
- */
68
- public $type;
69
-
70
- /**
71
- * textdomain
72
- *
73
- * @var string
74
- */
75
- public $textdomain;
76
-
77
- /**
78
- * The Object of Insights Class
79
- *
80
- * @var object
81
- */
82
- private $insights;
83
-
84
- /**
85
- * The Object of Updater Class
86
- *
87
- * @var object
88
- */
89
- private $updater;
90
-
91
- /**
92
- * The Object of License Class
93
- *
94
- * @var object
95
- */
96
- private $license;
97
-
98
- /**
99
- * Initialize the class
100
- *
101
- * @param string $hash hash of the plugin
102
- * @param string $name readable name of the plugin
103
- * @param string $file main plugin file path
104
- */
105
- public function __construct( $hash, $name, $file ) {
106
- $this->hash = $hash;
107
- $this->name = $name;
108
- $this->file = $file;
109
-
110
- $this->set_basename_and_slug();
111
- }
112
-
113
- /**
114
- * Initialize insights class
115
- *
116
- * @return Appsero\Insights
117
- */
118
- public function insights() {
119
-
120
- if ( ! class_exists( __NAMESPACE__ . '\Insights') ) {
121
- require_once __DIR__ . '/Insights.php';
122
- }
123
-
124
- // if already instantiated, return the cached one
125
- if ( $this->insights ) {
126
- return $this->insights;
127
- }
128
-
129
- $this->insights = new Insights( $this );
130
-
131
- return $this->insights;
132
- }
133
-
134
- /**
135
- * Initialize plugin/theme updater
136
- *
137
- * @return Appsero\Updater
138
- */
139
- public function updater() {
140
-
141
- if ( ! class_exists( __NAMESPACE__ . '\Updater') ) {
142
- require_once __DIR__ . '/Updater.php';
143
- }
144
-
145
- // if already instantiated, return the cached one
146
- if ( $this->updater ) {
147
- return $this->updater;
148
- }
149
-
150
- $this->updater = new Updater( $this );
151
-
152
- return $this->updater;
153
- }
154
-
155
- /**
156
- * Initialize license checker
157
- *
158
- * @return Appsero\License
159
- */
160
- public function license() {
161
-
162
- if ( ! class_exists( __NAMESPACE__ . '\License') ) {
163
- require_once __DIR__ . '/License.php';
164
- }
165
-
166
- // if already instantiated, return the cached one
167
- if ( $this->license ) {
168
- return $this->license;
169
- }
170
-
171
- $this->license = new License( $this );
172
-
173
- return $this->license;
174
- }
175
-
176
- /**
177
- * API Endpoint
178
- *
179
- * @return string
180
- */
181
- public function endpoint() {
182
- $endpoint = apply_filters( 'appsero_endpoint', 'https://api.appsero.com' );
183
-
184
- return trailingslashit( $endpoint );
185
- }
186
-
187
- /**
188
- * Set project basename, slug and version
189
- *
190
- * @return void
191
- */
192
- protected function set_basename_and_slug() {
193
-
194
- if ( strpos( $this->file, WP_CONTENT_DIR . '/themes/' ) === false ) {
195
- $this->basename = plugin_basename( $this->file );
196
-
197
- list( $this->slug, $mainfile) = explode( '/', $this->basename );
198
-
199
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
200
-
201
- $plugin_data = get_plugin_data( $this->file );
202
-
203
- $this->project_version = $plugin_data['Version'];
204
- $this->type = 'plugin';
205
- } else {
206
- $this->basename = str_replace( WP_CONTENT_DIR . '/themes/', '', $this->file );
207
-
208
- list( $this->slug, $mainfile) = explode( '/', $this->basename );
209
-
210
- $theme = wp_get_theme( $this->slug );
211
-
212
- $this->project_version = $theme->version;
213
- $this->type = 'theme';
214
- }
215
-
216
- $this->textdomain = $this->slug;
217
- }
218
-
219
- /**
220
- * Send request to remote endpoint
221
- *
222
- * @param array $params
223
- * @param string $route
224
- *
225
- * @return array|WP_Error Array of results including HTTP headers or WP_Error if the request failed.
226
- */
227
- public function send_request( $params, $route, $blocking = false ) {
228
- $url = $this->endpoint() . $route;
229
-
230
- $headers = array(
231
- 'user-agent' => 'Appsero/' . md5( esc_url( home_url() ) ) . ';',
232
- 'Accept' => 'application/json',
233
- );
234
-
235
- $response = wp_remote_post( $url, array(
236
- 'method' => 'POST',
237
- 'timeout' => 30,
238
- 'redirection' => 5,
239
- 'httpversion' => '1.0',
240
- 'blocking' => $blocking,
241
- 'headers' => $headers,
242
- 'body' => array_merge( $params, array( 'client' => $this->version ) ),
243
- 'cookies' => array()
244
- ) );
245
-
246
- return $response;
247
- }
248
-
249
- /**
250
- * Check if the current server is localhost
251
- *
252
- * @return boolean
253
- */
254
- public function is_local_server() {
255
- $is_local = in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) );
256
-
257
- return apply_filters( 'appsero_is_local', $is_local );
258
- }
259
-
260
- /**
261
- * Translate function _e()
262
- */
263
- public function _etrans( $text ) {
264
- call_user_func( '_e', $text, $this->textdomain );
265
- }
266
-
267
- /**
268
- * Translate function __()
269
- */
270
- public function __trans( $text ) {
271
- return call_user_func( '__', $text, $this->textdomain );
272
- }
273
-
274
- /**
275
- * Set project textdomain
276
- */
277
- public function set_textdomain( $textdomain ) {
278
- $this->textdomain = $textdomain;
279
- }
280
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
appsero/src/Insights.php DELETED
@@ -1,1123 +0,0 @@
1
- <?php
2
- namespace Appsero;
3
-
4
- /**
5
- * Appsero Insights
6
- *
7
- * This is a tracker class to track plugin usage based on if the customer has opted in.
8
- * No personal information is being tracked by this class, only general settings, active plugins, environment details
9
- * and admin email.
10
- */
11
- class Insights {
12
-
13
- /**
14
- * The notice text
15
- *
16
- * @var string
17
- */
18
- public $notice;
19
-
20
- /**
21
- * Wheather to the notice or not
22
- *
23
- * @var boolean
24
- */
25
- protected $show_notice = true;
26
-
27
- /**
28
- * If extra data needs to be sent
29
- *
30
- * @var array
31
- */
32
- protected $extra_data = array();
33
-
34
- /**
35
- * AppSero\Client
36
- *
37
- * @var object
38
- */
39
- protected $client;
40
-
41
- /**
42
- * Initialize the class
43
- *
44
- * @param AppSero\Client
45
- */
46
- public function __construct( $client, $name = null, $file = null ) {
47
-
48
- if ( is_string( $client ) && ! empty( $name ) && ! empty( $file ) ) {
49
- $client = new Client( $client, $name, $file );
50
- }
51
-
52
- if ( is_object( $client ) && is_a( $client, 'Appsero\Client' ) ) {
53
- $this->client = $client;
54
- }
55
- }
56
-
57
- /**
58
- * Don't show the notice
59
- *
60
- * @return \self
61
- */
62
- public function hide_notice() {
63
- $this->show_notice = false;
64
-
65
- return $this;
66
- }
67
-
68
- /**
69
- * Add extra data if needed
70
- *
71
- * @param array $data
72
- *
73
- * @return \self
74
- */
75
- public function add_extra( $data = array() ) {
76
- $this->extra_data = $data;
77
-
78
- return $this;
79
- }
80
-
81
- /**
82
- * Set custom notice text
83
- *
84
- * @param string $text
85
- *
86
- * @return \self
87
- */
88
- public function notice( $text ) {
89
- $this->notice = $text;
90
-
91
- return $this;
92
- }
93
-
94
- /**
95
- * Initialize insights
96
- *
97
- * @return void
98
- */
99
- public function init() {
100
- if ( $this->client->type == 'plugin' ) {
101
- $this->init_plugin();
102
- } else if ( $this->client->type == 'theme' ) {
103
- $this->init_theme();
104
- }
105
- }
106
-
107
- /**
108
- * Initialize theme hooks
109
- *
110
- * @return void
111
- */
112
- public function init_theme() {
113
- $this->init_common();
114
-
115
- add_action( 'switch_theme', array( $this, 'deactivation_cleanup' ) );
116
- add_action( 'switch_theme', array( $this, 'theme_deactivated' ), 12, 3 );
117
- }
118
-
119
- /**
120
- * Initialize plugin hooks
121
- *
122
- * @return void
123
- */
124
- public function init_plugin() {
125
- // plugin deactivate popup
126
- if ( ! $this->is_local_server() ) {
127
- add_filter( 'plugin_action_links_' . $this->client->basename, array( $this, 'plugin_action_links' ) );
128
- add_action( 'admin_footer', array( $this, 'deactivate_scripts' ) );
129
- }
130
-
131
- $this->init_common();
132
-
133
- register_activation_hook( $this->client->file, array( $this, 'activate_plugin' ) );
134
- register_deactivation_hook( $this->client->file, array( $this, 'deactivation_cleanup' ) );
135
- }
136
-
137
- /**
138
- * Initialize common hooks
139
- *
140
- * @return void
141
- */
142
- protected function init_common() {
143
-
144
- if ( $this->show_notice ) {
145
- // tracking notice
146
- add_action( 'admin_notices', array( $this, 'admin_notice' ) );
147
- }
148
-
149
- add_action( 'admin_init', array( $this, 'handle_optin_optout' ) );
150
-
151
- // uninstall reason
152
- add_action( 'wp_ajax_' . $this->client->slug . '_submit-uninstall-reason', array( $this, 'uninstall_reason_submission' ) );
153
-
154
- // cron events
155
- add_filter( 'cron_schedules', array( $this, 'add_weekly_schedule' ) );
156
- add_action( $this->client->slug . '_tracker_send_event', array( $this, 'send_tracking_data' ) );
157
- // add_action( 'admin_init', array( $this, 'send_tracking_data' ) ); // test
158
- }
159
-
160
- /**
161
- * Send tracking data to AppSero server
162
- *
163
- * @param boolean $override
164
- *
165
- * @return void
166
- */
167
- public function send_tracking_data( $override = false ) {
168
- if ( ! $this->tracking_allowed() && ! $override ) {
169
- return;
170
- }
171
-
172
- // Send a maximum of once per week
173
- $last_send = $this->get_last_send();
174
-
175
- if ( $last_send && $last_send > strtotime( '-1 week' ) ) {
176
- return;
177
- }
178
-
179
- $tracking_data = $this->get_tracking_data();
180
-
181
- $response = $this->client->send_request( $tracking_data, 'track' );
182
-
183
- update_option( $this->client->slug . '_tracking_last_send', time() );
184
- }
185
-
186
- /**
187
- * Get the tracking data points
188
- *
189
- * @return array
190
- */
191
- protected function get_tracking_data() {
192
- $all_plugins = $this->get_all_plugins();
193
-
194
- $users = get_users( array(
195
- 'role' => 'administrator',
196
- 'orderby' => 'ID',
197
- 'order' => 'ASC',
198
- 'number' => 1,
199
- 'paged' => 1,
200
- ) );
201
-
202
- $admin_user = ( is_array( $users ) && ! empty( $users ) ) ? $users[0] : false;
203
- $first_name = $last_name = '';
204
-
205
- if ( $admin_user ) {
206
- $first_name = $admin_user->first_name ? $admin_user->first_name : $admin_user->display_name;
207
- $last_name = $admin_user->last_name;
208
- }
209
-
210
- $data = array(
211
- 'url' => esc_url( home_url() ),
212
- 'site' => $this->get_site_name(),
213
- 'admin_email' => get_option( 'admin_email' ),
214
- 'first_name' => $first_name,
215
- 'last_name' => $last_name,
216
- 'hash' => $this->client->hash,
217
- 'server' => $this->get_server_info(),
218
- 'wp' => $this->get_wp_info(),
219
- 'users' => $this->get_user_counts(),
220
- 'active_plugins' => count( $all_plugins['active_plugins'] ),
221
- 'inactive_plugins' => count( $all_plugins['inactive_plugins'] ),
222
- 'ip_address' => $this->get_user_ip_address(),
223
- 'project_version' => $this->client->project_version,
224
- 'tracking_skipped' => false,
225
- );
226
-
227
- // Add metadata
228
- if ( $extra = $this->get_extra_data() ) {
229
- $data['extra'] = $extra;
230
- }
231
-
232
- // Check this has previously skipped tracking
233
- $skipped = get_option( $this->client->slug . '_tracking_skipped' );
234
-
235
- if ( $skipped === 'yes' ) {
236
- delete_option( $this->client->slug . '_tracking_skipped' );
237
-
238
- $data['tracking_skipped'] = true;
239
- }
240
-
241
- return apply_filters( $this->client->slug . '_tracker_data', $data );
242
- }
243
-
244
- /**
245
- * If a child class wants to send extra data
246
- *
247
- * @return mixed
248
- */
249
- protected function get_extra_data() {
250
- if ( is_callable( $this->extra_data ) ) {
251
- return call_user_func( $this->extra_data );
252
- }
253
-
254
- if ( is_array( $this->extra_data ) ) {
255
- return $this->extra_data;
256
- }
257
-
258
- return array();
259
- }
260
-
261
- /**
262
- * Explain the user which data we collect
263
- *
264
- * @return array
265
- */
266
- protected function data_we_collect() {
267
- $data = array(
268
- 'Server environment details (php, mysql, server, WordPress versions)',
269
- 'Number of users in your site',
270
- 'Site language',
271
- 'Number of active and inactive plugins',
272
- 'Site name and url',
273
- 'Your name and email address',
274
- );
275
-
276
- return $data;
277
- }
278
-
279
- /**
280
- * Check if the user has opted into tracking
281
- *
282
- * @return bool
283
- */
284
- public function tracking_allowed() {
285
- $allow_tracking = get_option( $this->client->slug . '_allow_tracking', 'no' );
286
-
287
- return $allow_tracking == 'yes';
288
- }
289
-
290
- /**
291
- * Get the last time a tracking was sent
292
- *
293
- * @return false|string
294
- */
295
- private function get_last_send() {
296
- return get_option( $this->client->slug . '_tracking_last_send', false );
297
- }
298
-
299
- /**
300
- * Check if the notice has been dismissed or enabled
301
- *
302
- * @return boolean
303
- */
304
- public function notice_dismissed() {
305
- $hide_notice = get_option( $this->client->slug . '_tracking_notice', null );
306
-
307
- if ( 'hide' == $hide_notice ) {
308
- return true;
309
- }
310
-
311
- return false;
312
- }
313
-
314
- /**
315
- * Check if the current server is localhost
316
- *
317
- * @return boolean
318
- */
319
- private function is_local_server() {
320
- return false;
321
-
322
- $is_local = in_array( $_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ) );
323
-
324
- return apply_filters( 'appsero_is_local', $is_local );
325
- }
326
-
327
- /**
328
- * Schedule the event weekly
329
- *
330
- * @return void
331
- */
332
- private function schedule_event() {
333
- $hook_name = $this->client->slug . '_tracker_send_event';
334
-
335
- if ( ! wp_next_scheduled( $hook_name ) ) {
336
- wp_schedule_event( time(), 'weekly', $hook_name );
337
- }
338
- }
339
-
340
- /**
341
- * Clear any scheduled hook
342
- *
343
- * @return void
344
- */
345
- private function clear_schedule_event() {
346
- wp_clear_scheduled_hook( $this->client->slug . '_tracker_send_event' );
347
- }
348
-
349
- /**
350
- * Display the admin notice to users that have not opted-in or out
351
- *
352
- * @return void
353
- */
354
- public function admin_notice() {
355
-
356
- if ( $this->notice_dismissed() ) {
357
- return;
358
- }
359
-
360
- if ( $this->tracking_allowed() ) {
361
- return;
362
- }
363
-
364
- if ( ! current_user_can( 'manage_options' ) ) {
365
- return;
366
- }
367
-
368
- // don't show tracking if a local server
369
- if ( $this->is_local_server() ) {
370
- return;
371
- }
372
-
373
- $optin_url = add_query_arg( $this->client->slug . '_tracker_optin', 'true' );
374
- $optout_url = add_query_arg( $this->client->slug . '_tracker_optout', 'true' );
375
-
376
- if ( empty( $this->notice ) ) {
377
- $notice = sprintf( $this->client->__trans( 'Want to help make <strong>%1$s</strong> even more awesome? Allow %1$s to collect non-sensitive diagnostic data and usage information.' ), $this->client->name );
378
- } else {
379
- $notice = $this->notice;
380
- }
381
-
382
- $policy_url = 'https://' . 'appsero.com/privacy-policy/';
383
-
384
- $notice .= ' (<a class="' . $this->client->slug . '-insights-data-we-collect" href="#">' . $this->client->__trans( 'what we collect' ) . '</a>)';
385
- $notice .= '<p class="description" style="display:none;">' . implode( ', ', $this->data_we_collect() ) . '. No sensitive data is tracked. ';
386
- $notice .= 'We are using Appsero to collect your data. <a href="' . $policy_url . '" target="_blank">Learn more</a> about how Appsero collects and handle your data.</p>';
387
-
388
- echo '<div class="updated"><p>';
389
- echo $notice;
390
- echo '</p><p class="submit">';
391
- echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . $this->client->__trans( 'Allow' ) . '</a>';
392
- echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . $this->client->__trans( 'No thanks' ) . '</a>';
393
- echo '</p></div>';
394
-
395
- echo "<script type='text/javascript'>jQuery('." . $this->client->slug . "-insights-data-we-collect').on('click', function(e) {
396
- e.preventDefault();
397
- jQuery(this).parents('.updated').find('p.description').slideToggle('fast');
398
- });
399
- </script>
400
- ";
401
- }
402
-
403
- /**
404
- * handle the optin/optout
405
- *
406
- * @return void
407
- */
408
- public function handle_optin_optout() {
409
-
410
- if ( isset( $_GET[ $this->client->slug . '_tracker_optin' ] ) && $_GET[ $this->client->slug . '_tracker_optin' ] == 'true' ) {
411
- $this->optin();
412
-
413
- wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optin' ) );
414
- exit;
415
- }
416
-
417
- if ( isset( $_GET[ $this->client->slug . '_tracker_optout' ] ) && $_GET[ $this->client->slug . '_tracker_optout' ] == 'true' ) {
418
- $this->optout();
419
-
420
- wp_redirect( remove_query_arg( $this->client->slug . '_tracker_optout' ) );
421
- exit;
422
- }
423
- }
424
-
425
- /**
426
- * Tracking optin
427
- *
428
- * @return void
429
- */
430
- public function optin() {
431
- update_option( $this->client->slug . '_allow_tracking', 'yes' );
432
- update_option( $this->client->slug . '_tracking_notice', 'hide' );
433
-
434
- $this->clear_schedule_event();
435
- $this->schedule_event();
436
- $this->send_tracking_data();
437
- }
438
-
439
- /**
440
- * Optout from tracking
441
- *
442
- * @return void
443
- */
444
- public function optout() {
445
- update_option( $this->client->slug . '_allow_tracking', 'no' );
446
- update_option( $this->client->slug . '_tracking_notice', 'hide' );
447
-
448
- $this->send_tracking_skipped_request();
449
-
450
- $this->clear_schedule_event();
451
- }
452
-
453
- /**
454
- * Get the number of post counts
455
- *
456
- * @param string $post_type
457
- *
458
- * @return integer
459
- */
460
- public function get_post_count( $post_type ) {
461
- global $wpdb;
462
-
463
- return (int) $wpdb->get_var( "SELECT count(ID) FROM $wpdb->posts WHERE post_type = '$post_type' and post_status = 'publish'");
464
- }
465
-
466
- /**
467
- * Get server related info.
468
- *
469
- * @return array
470
- */
471
- private static function get_server_info() {
472
- global $wpdb;
473
-
474
- $server_data = array();
475
-
476
- if ( isset( $_SERVER['SERVER_SOFTWARE'] ) && ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) {
477
- $server_data['software'] = $_SERVER['SERVER_SOFTWARE'];
478
- }
479
-
480
- if ( function_exists( 'phpversion' ) ) {
481
- $server_data['php_version'] = phpversion();
482
- }
483
-
484
- $server_data['mysql_version'] = $wpdb->db_version();
485
-
486
- $server_data['php_max_upload_size'] = size_format( wp_max_upload_size() );
487
- $server_data['php_default_timezone'] = date_default_timezone_get();
488
- $server_data['php_soap'] = class_exists( 'SoapClient' ) ? 'Yes' : 'No';
489
- $server_data['php_fsockopen'] = function_exists( 'fsockopen' ) ? 'Yes' : 'No';
490
- $server_data['php_curl'] = function_exists( 'curl_init' ) ? 'Yes' : 'No';
491
-
492
- return $server_data;
493
- }
494
-
495
- /**
496
- * Get WordPress related data.
497
- *
498
- * @return array
499
- */
500
- private function get_wp_info() {
501
- $wp_data = array();
502
-
503
- $wp_data['memory_limit'] = WP_MEMORY_LIMIT;
504
- $wp_data['debug_mode'] = ( defined('WP_DEBUG') && WP_DEBUG ) ? 'Yes' : 'No';
505
- $wp_data['locale'] = get_locale();
506
- $wp_data['version'] = get_bloginfo( 'version' );
507
- $wp_data['multisite'] = is_multisite() ? 'Yes' : 'No';
508
- $wp_data['theme_slug'] = get_stylesheet();
509
-
510
- $theme = wp_get_theme( $wp_data['theme_slug'] );
511
-
512
- $wp_data['theme_name'] = $theme->get( 'Name' );
513
- $wp_data['theme_version'] = $theme->get( 'Version' );
514
- $wp_data['theme_uri'] = $theme->get( 'ThemeURI' );
515
- $wp_data['theme_author'] = $theme->get( 'Author' );
516
-
517
- return $wp_data;
518
- }
519
-
520
- /**
521
- * Get the list of active and inactive plugins
522
- *
523
- * @return array
524
- */
525
- private function get_all_plugins() {
526
- // Ensure get_plugins function is loaded
527
- if ( ! function_exists( 'get_plugins' ) ) {
528
- include ABSPATH . '/wp-admin/includes/plugin.php';
529
- }
530
-
531
- $plugins = get_plugins();
532
- $active_plugins_keys = get_option( 'active_plugins', array() );
533
- $active_plugins = array();
534
-
535
- foreach ( $plugins as $k => $v ) {
536
- // Take care of formatting the data how we want it.
537
- $formatted = array();
538
- $formatted['name'] = strip_tags( $v['Name'] );
539
-
540
- if ( isset( $v['Version'] ) ) {
541
- $formatted['version'] = strip_tags( $v['Version'] );
542
- }
543
-
544
- if ( isset( $v['Author'] ) ) {
545
- $formatted['author'] = strip_tags( $v['Author'] );
546
- }
547
-
548
- if ( isset( $v['Network'] ) ) {
549
- $formatted['network'] = strip_tags( $v['Network'] );
550
- }
551
-
552
- if ( isset( $v['PluginURI'] ) ) {
553
- $formatted['plugin_uri'] = strip_tags( $v['PluginURI'] );
554
- }
555
-
556
- if ( in_array( $k, $active_plugins_keys ) ) {
557
- // Remove active plugins from list so we can show active and inactive separately
558
- unset( $plugins[$k] );
559
- $active_plugins[$k] = $formatted;
560
- } else {
561
- $plugins[$k] = $formatted;
562
- }
563
- }
564
-
565
- return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins );
566
- }
567
-
568
- /**
569
- * Get user totals based on user role.
570
- *
571
- * @return array
572
- */
573
- public function get_user_counts() {
574
- $user_count = array();
575
- $user_count_data = count_users();
576
- $user_count['total'] = $user_count_data['total_users'];
577
-
578
- // Get user count based on user role
579
- foreach ( $user_count_data['avail_roles'] as $role => $count ) {
580
- if ( ! $count ) {
581
- continue;
582
- }
583
-
584
- $user_count[ $role ] = $count;
585
- }
586
-
587
- return $user_count;
588
- }
589
-
590
- /**
591
- * Add weekly cron schedule
592
- *
593
- * @param array $schedules
594
- *
595
- * @return array
596
- */
597
- public function add_weekly_schedule( $schedules ) {
598
-
599
- $schedules['weekly'] = array(
600
- 'interval' => DAY_IN_SECONDS * 7,
601
- 'display' => 'Once Weekly',
602
- );
603
-
604
- return $schedules;
605
- }
606
-
607
- /**
608
- * Plugin activation hook
609
- *
610
- * @return void
611
- */
612
- public function activate_plugin() {
613
- $allowed = get_option( $this->client->slug . '_allow_tracking', 'no' );
614
-
615
- // if it wasn't allowed before, do nothing
616
- if ( 'yes' !== $allowed ) {
617
- return;
618
- }
619
-
620
- // re-schedule and delete the last sent time so we could force send again
621
- $hook_name = $this->client->slug . '_tracker_send_event';
622
- if ( ! wp_next_scheduled( $hook_name ) ) {
623
- wp_schedule_event( time(), 'weekly', $hook_name );
624
- }
625
-
626
- delete_option( $this->client->slug . '_tracking_last_send' );
627
-
628
- $this->send_tracking_data( true );
629
- }
630
-
631
- /**
632
- * Clear our options upon deactivation
633
- *
634
- * @return void
635
- */
636
- public function deactivation_cleanup() {
637
- $this->clear_schedule_event();
638
-
639
- if ( 'theme' == $this->client->type ) {
640
- delete_option( $this->client->slug . '_tracking_last_send' );
641
- delete_option( $this->client->slug . '_allow_tracking' );
642
- }
643
-
644
- delete_option( $this->client->slug . '_tracking_notice' );
645
- }
646
-
647
- /**
648
- * Hook into action links and modify the deactivate link
649
- *
650
- * @param array $links
651
- *
652
- * @return array
653
- */
654
- public function plugin_action_links( $links ) {
655
-
656
- if ( array_key_exists( 'deactivate', $links ) ) {
657
- $links['deactivate'] = str_replace( '<a', '<a class="' . $this->client->slug . '-deactivate-link"', $links['deactivate'] );
658
- }
659
-
660
- return $links;
661
- }
662
-
663
- /**
664
- * Plugin uninstall reasons
665
- *
666
- * @return array
667
- */
668
- private function get_uninstall_reasons() {
669
- $reasons = array(
670
- array(
671
- 'id' => 'could-not-understand',
672
- 'text' => $this->client->__trans( "Couldn't understand" ),
673
- 'placeholder' => $this->client->__trans( 'Would you like us to assist you?' ),
674
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23"><g fill="none"><g fill="#3B86FF"><path d="M11.5 0C17.9 0 23 5.1 23 11.5 23 17.9 17.9 23 11.5 23 10.6 23 9.6 22.9 8.8 22.7L8.8 22.6C9.3 22.5 9.7 22.3 10 21.9 10.3 21.6 10.4 21.3 10.4 20.9 10.8 21 11.1 21 11.5 21 16.7 21 21 16.7 21 11.5 21 6.3 16.7 2 11.5 2 6.3 2 2 6.3 2 11.5 2 13 2.3 14.3 2.9 15.6 2.7 16 2.4 16.3 2.2 16.8L2.1 17.1 2.1 17.3C2 17.5 2 17.7 2 18 0.7 16.1 0 13.9 0 11.5 0 5.1 5.1 0 11.5 0ZM6 13.6C6 13.7 6.1 13.8 6.1 13.9 6.3 14.5 6.2 15.7 6.1 16.4 6.1 16.6 6 16.9 6 17.1 6 17.1 6.1 17.1 6.1 17.1 7.1 16.9 8.2 16 9.3 15.5 9.8 15.2 10.4 15 10.9 15 11.2 15 11.4 15 11.6 15.2 11.9 15.4 12.1 16 11.6 16.4 11.5 16.5 11.3 16.6 11.1 16.7 10.5 17 9.9 17.4 9.3 17.7 9 17.9 9 18.1 9.1 18.5 9.2 18.9 9.3 19.4 9.3 19.8 9.4 20.3 9.3 20.8 9 21.2 8.8 21.5 8.5 21.6 8.1 21.7 7.9 21.8 7.6 21.9 7.3 21.9L6.5 22C6.3 22 6 21.9 5.8 21.9 5 21.8 4.4 21.5 3.9 20.9 3.3 20.4 3.1 19.6 3 18.8L3 18.5C3 18.2 3 17.9 3.1 17.7L3.1 17.6C3.2 17.1 3.5 16.7 3.7 16.3 4 15.9 4.2 15.4 4.3 15 4.4 14.6 4.4 14.5 4.6 14.2 4.6 13.9 4.7 13.7 4.9 13.6 5.2 13.2 5.7 13.2 6 13.6ZM11.7 11.2C13.1 11.2 14.3 11.7 15.2 12.9 15.3 13 15.4 13.1 15.4 13.2 15.4 13.4 15.3 13.8 15.2 13.8 15 13.9 14.9 13.8 14.8 13.7 14.6 13.5 14.4 13.2 14.1 13.1 13.5 12.6 12.8 12.3 12 12.2 10.7 12.1 9.5 12.3 8.4 12.8 8.3 12.8 8.2 12.8 8.1 12.8 7.9 12.8 7.8 12.4 7.8 12.2 7.7 12.1 7.8 11.9 8 11.8 8.4 11.7 8.8 11.5 9.2 11.4 10 11.2 10.9 11.1 11.7 11.2ZM16.3 5.9C17.3 5.9 18 6.6 18 7.6 18 8.5 17.3 9.3 16.3 9.3 15.4 9.3 14.7 8.5 14.7 7.6 14.7 6.6 15.4 5.9 16.3 5.9ZM8.3 5C9.2 5 9.9 5.8 9.9 6.7 9.9 7.7 9.2 8.4 8.2 8.4 7.3 8.4 6.6 7.7 6.6 6.7 6.6 5.8 7.3 5 8.3 5Z"/></g></g></svg>'
675
- ),
676
- array(
677
- 'id' => 'found-better-plugin',
678
- 'text' => $this->client->__trans( 'Found a better plugin' ),
679
- 'placeholder' => $this->client->__trans( 'Which plugin?' ),
680
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23"><g fill="none"><g fill="#3B86FF"><path d="M17.1 14L22.4 19.3C23.2 20.2 23.2 21.5 22.4 22.4 21.5 23.2 20.2 23.2 19.3 22.4L19.3 22.4 14 17.1C15.3 16.3 16.3 15.3 17.1 14L17.1 14ZM8.6 0C13.4 0 17.3 3.9 17.3 8.6 17.3 13.4 13.4 17.2 8.6 17.2 3.9 17.2 0 13.4 0 8.6 0 3.9 3.9 0 8.6 0ZM8.6 2.2C5.1 2.2 2.2 5.1 2.2 8.6 2.2 12.2 5.1 15.1 8.6 15.1 12.2 15.1 15.1 12.2 15.1 8.6 15.1 5.1 12.2 2.2 8.6 2.2ZM8.6 3.6L8.6 5C6.6 5 5 6.6 5 8.6L5 8.6 3.6 8.6C3.6 5.9 5.9 3.6 8.6 3.6L8.6 3.6Z"/></g></g></svg>',
681
- ),
682
- array(
683
- 'id' => 'not-have-that-feature',
684
- 'text' => $this->client->__trans( "Missing a specific feature" ),
685
- 'placeholder' => $this->client->__trans( 'Could you tell us more about that feature?' ),
686
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="17" viewBox="0 0 24 17"><g fill="none"><g fill="#3B86FF"><path d="M19.4 0C19.7 0.6 19.8 1.3 19.8 2 19.8 3.2 19.4 4.4 18.5 5.3 17.6 6.2 16.5 6.7 15.2 6.7 15.2 6.7 15.2 6.7 15.2 6.7 14 6.7 12.9 6.2 12 5.3 11.2 4.4 10.7 3.3 10.7 2 10.7 1.3 10.8 0.6 11.1 0L7.6 0 7 0 6.5 0 6.5 5.7C6.3 5.6 5.9 5.3 5.6 5.1 5 4.6 4.3 4.3 3.5 4.3 3.5 4.3 3.5 4.3 3.4 4.3 1.6 4.4 0 5.9 0 7.9 0 8.6 0.2 9.2 0.5 9.7 1.1 10.8 2.2 11.5 3.5 11.5 4.3 11.5 5 11.2 5.6 10.8 6 10.5 6.3 10.3 6.5 10.2L6.5 10.2 6.5 17 6.5 17 7 17 7.6 17 22.5 17C23.3 17 24 16.3 24 15.5L24 0 19.4 0Z"/></g></g></svg>',
687
- ),
688
- array(
689
- 'id' => 'is-not-working',
690
- 'text' => $this->client->__trans( 'Not working' ),
691
- 'placeholder' => $this->client->__trans( 'Could you tell us a bit more whats not working?' ),
692
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23"><g fill="none"><g fill="#3B86FF"><path d="M11.5 0C17.9 0 23 5.1 23 11.5 23 17.9 17.9 23 11.5 23 5.1 23 0 17.9 0 11.5 0 5.1 5.1 0 11.5 0ZM11.8 14.4C11.2 14.4 10.7 14.8 10.7 15.4 10.7 16 11.2 16.4 11.8 16.4 12.4 16.4 12.8 16 12.8 15.4 12.8 14.8 12.4 14.4 11.8 14.4ZM12 7C10.1 7 9.1 8.1 9 9.6L10.5 9.6C10.5 8.8 11.1 8.3 11.9 8.3 12.7 8.3 13.2 8.8 13.2 9.5 13.2 10.1 13 10.4 12.2 10.9 11.3 11.4 10.9 12 11 12.9L11 13.4 12.5 13.4 12.5 13C12.5 12.4 12.7 12.1 13.5 11.6 14.4 11.1 14.9 10.4 14.9 9.4 14.9 8 13.7 7 12 7Z"/></g></g></svg>',
693
- ),
694
- array(
695
- 'id' => 'looking-for-other',
696
- 'text' => $this->client->__trans( "Not what I was looking" ),
697
- 'placeholder' => $this->client->__trans( 'Could you tell us a bit more?' ),
698
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="17" viewBox="0 0 24 17"><g fill="none"><g fill="#3B86FF"><path d="M23.5 9C23.5 9 23.5 8.9 23.5 8.9 23.5 8.9 23.5 8.9 23.5 8.9 23.4 8.6 23.2 8.3 23 8 22.2 6.5 20.6 3.7 19.8 2.6 18.8 1.3 17.7 0 16.1 0 15.7 0 15.3 0.1 14.9 0.2 13.8 0.6 12.6 1.2 12.3 2.7L11.7 2.7C11.4 1.2 10.2 0.6 9.1 0.2 8.7 0.1 8.3 0 7.9 0 6.3 0 5.2 1.3 4.2 2.6 3.4 3.7 1.8 6.5 1 8 0.8 8.3 0.6 8.6 0.5 8.9 0.5 8.9 0.5 8.9 0.5 8.9 0.5 8.9 0.5 9 0.5 9 0.2 9.7 0 10.5 0 11.3 0 14.4 2.5 17 5.5 17 7.3 17 8.8 16.1 9.8 14.8L14.2 14.8C15.2 16.1 16.7 17 18.5 17 21.5 17 24 14.4 24 11.3 24 10.5 23.8 9.7 23.5 9ZM5.5 15C3.6 15 2 13.2 2 11 2 8.8 3.6 7 5.5 7 7.4 7 9 8.8 9 11 9 13.2 7.4 15 5.5 15ZM18.5 15C16.6 15 15 13.2 15 11 15 8.8 16.6 7 18.5 7 20.4 7 22 8.8 22 11 22 13.2 20.4 15 18.5 15Z"/></g></g></svg>',
699
- ),
700
- array(
701
- 'id' => 'did-not-work-as-expected',
702
- 'text' => $this->client->__trans( "Didn't work as expected" ),
703
- 'placeholder' => $this->client->__trans( 'What did you expect?' ),
704
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 23 23"><g fill="none"><g fill="#3B86FF"><path d="M11.5 0C17.9 0 23 5.1 23 11.5 23 17.9 17.9 23 11.5 23 5.1 23 0 17.9 0 11.5 0 5.1 5.1 0 11.5 0ZM11.5 2C6.3 2 2 6.3 2 11.5 2 16.7 6.3 21 11.5 21 16.7 21 21 16.7 21 11.5 21 6.3 16.7 2 11.5 2ZM12.5 12.9L12.7 5 10.2 5 10.5 12.9 12.5 12.9ZM11.5 17.4C12.4 17.4 13 16.8 13 15.9 13 15 12.4 14.4 11.5 14.4 10.6 14.4 10 15 10 15.9 10 16.8 10.6 17.4 11.5 17.4Z"/></g></g></svg>',
705
- ),
706
- array(
707
- 'id' => 'other',
708
- 'text' => $this->client->__trans( 'Others' ),
709
- 'placeholder' => $this->client->__trans( 'Could you tell us a bit more?' ),
710
- 'icon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="23" viewBox="0 0 24 6"><g fill="none"><g fill="#3B86FF"><path d="M3 0C4.7 0 6 1.3 6 3 6 4.7 4.7 6 3 6 1.3 6 0 4.7 0 3 0 1.3 1.3 0 3 0ZM12 0C13.7 0 15 1.3 15 3 15 4.7 13.7 6 12 6 10.3 6 9 4.7 9 3 9 1.3 10.3 0 12 0ZM21 0C22.7 0 24 1.3 24 3 24 4.7 22.7 6 21 6 19.3 6 18 4.7 18 3 18 1.3 19.3 0 21 0Z"/></g></g></svg>',
711
- ),
712
- );
713
-
714
- return $reasons;
715
- }
716
-
717
- /**
718
- * Plugin deactivation uninstall reason submission
719
- *
720
- * @return void
721
- */
722
- public function uninstall_reason_submission() {
723
-
724
- if ( ! isset( $_POST['reason_id'] ) ) {
725
- wp_send_json_error();
726
- }
727
-
728
- $data = $this->get_tracking_data();
729
- $data['reason_id'] = sanitize_text_field( $_POST['reason_id'] );
730
- $data['reason_info'] = isset( $_REQUEST['reason_info'] ) ? trim( stripslashes( $_REQUEST['reason_info'] ) ) : '';
731
-
732
- $this->client->send_request( $data, 'deactivate' );
733
-
734
- wp_send_json_success();
735
- }
736
-
737
- /**
738
- * Handle the plugin deactivation feedback
739
- *
740
- * @return void
741
- */
742
- public function deactivate_scripts() {
743
- global $pagenow;
744
-
745
- if ( 'plugins.php' != $pagenow ) {
746
- return;
747
- }
748
-
749
- $this->deactivation_modal_styles();
750
- $reasons = $this->get_uninstall_reasons();
751
- $custom_reasons = apply_filters( 'appsero_custom_deactivation_reasons', array() );
752
- ?>
753
-
754
- <div class="wd-dr-modal" id="<?php echo $this->client->slug; ?>-wd-dr-modal">
755
- <div class="wd-dr-modal-wrap">
756
- <div class="wd-dr-modal-header">
757
- <h3><?php $this->client->_etrans( 'Goodbyes are always hard. If you have a moment, please let us know how we can improve.' ); ?></h3>
758
- </div>
759
-
760
- <div class="wd-dr-modal-body">
761
- <ul class="wd-de-reasons">
762
- <?php foreach ( $reasons as $reason ) { ?>
763
- <li data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>">
764
- <label>
765
- <input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>">
766
- <div class="wd-de-reason-icon"><?php echo $reason['icon']; ?></div>
767
- <div class="wd-de-reason-text"><?php echo $reason['text']; ?></div>
768
- </label>
769
- </li>
770
- <?php } ?>
771
- </ul>
772
- <?php if ( $custom_reasons && is_array( $custom_reasons ) ) : ?>
773
- <ul class="wd-de-reasons wd-de-others-reasons">
774
- <?php foreach ( $custom_reasons as $reason ) { ?>
775
- <li data-placeholder="<?php echo esc_attr( $reason['placeholder'] ); ?>" data-customreason="true">
776
- <label>
777
- <input type="radio" name="selected-reason" value="<?php echo $reason['id']; ?>">
778
- <div class="wd-de-reason-icon"><?php echo $reason['icon']; ?></div>
779
- <div class="wd-de-reason-text"><?php echo $reason['text']; ?></div>
780
- </label>
781
- </li>
782
- <?php } ?>
783
- </ul>
784
- <?php endif; ?>
785
- <div class="wd-dr-modal-reason-input"><textarea></textarea></div>
786
- <p class="wd-dr-modal-reasons-bottom">
787
- <?php
788
- echo sprintf(
789
- $this->client->__trans( 'We share your data with <a href="%1$s" target="_blank">Appsero</a> to troubleshoot problems &amp; make product improvements. <a href="%2$s" target="_blank">Learn more</a> about how Appsero handles your data.'),
790
- esc_url( 'https://appsero.com/' ),
791
- esc_url( 'https://appsero.com/privacy-policy' )
792
- );
793
- ?>
794
- </p>
795
- </div>
796
-
797
- <div class="wd-dr-modal-footer">
798
- <a href="#" class="dont-bother-me wd-dr-button-secondary"><?php $this->client->_etrans( "Skip & Deactivate" ); ?></a>
799
- <button class="wd-dr-button-secondary wd-dr-cancel-modal"><?php $this->client->_etrans( 'Cancel' ); ?></button>
800
- <button class="wd-dr-submit-modal"><?php $this->client->_etrans( 'Submit & Deactivate' ); ?></button>
801
- </div>
802
- </div>
803
- </div>
804
-
805
- <script type="text/javascript">
806
- (function($) {
807
- $(function() {
808
- var modal = $( '#<?php echo $this->client->slug; ?>-wd-dr-modal' );
809
- var deactivateLink = '';
810
-
811
- // Open modal
812
- $( '#the-list' ).on('click', 'a.<?php echo $this->client->slug; ?>-deactivate-link', function(e) {
813
- e.preventDefault();
814
-
815
- modal.addClass('modal-active');
816
- deactivateLink = $(this).attr('href');
817
- modal.find('a.dont-bother-me').attr('href', deactivateLink).css('float', 'left');
818
- });
819
-
820
- // Close modal; Cancel
821
- modal.on('click', 'button.wd-dr-cancel-modal', function(e) {
822
- e.preventDefault();
823
- modal.removeClass('modal-active');
824
- });
825
-
826
- // Reason change
827
- modal.on('click', 'input[type="radio"]', function () {
828
- var parent = $(this).parents('li');
829
- var isCustomReason = parent.data('customreason');
830
- var inputValue = $(this).val();
831
-
832
- if ( isCustomReason ) {
833
- $('ul.wd-de-reasons.wd-de-others-reasons li').removeClass('wd-de-reason-selected');
834
- } else {
835
- $('ul.wd-de-reasons li').removeClass('wd-de-reason-selected');
836
-
837
- if ( "other" != inputValue ) {
838
- $('ul.wd-de-reasons.wd-de-others-reasons').css('display', 'none');
839
- }
840
- }
841
-
842
- // Show if has custom reasons
843
- if ( "other" == inputValue ) {
844
- $('ul.wd-de-reasons.wd-de-others-reasons').css('display', 'flex');
845
- }
846
-
847
- parent.addClass('wd-de-reason-selected');
848
- $('.wd-dr-modal-reason-input').show();
849
-
850
- $('.wd-dr-modal-reason-input textarea').attr('placeholder', parent.data('placeholder')).focus();
851
- });
852
-
853
- // Submit response
854
- modal.on('click', 'button.wd-dr-submit-modal', function(e) {
855
- e.preventDefault();
856
-
857
- var button = $(this);
858
-
859
- if ( button.hasClass('disabled') ) {
860
- return;
861
- }
862
-
863
- var $radio = $( 'input[type="radio"]:checked', modal );
864
- var $input = $('.wd-dr-modal-reason-input textarea');
865
-
866
- $.ajax({
867
- url: ajaxurl,
868
- type: 'POST',
869
- data: {
870
- action: '<?php echo $this->client->slug; ?>_submit-uninstall-reason',
871
- reason_id: ( 0 === $radio.length ) ? 'none' : $radio.val(),
872
- reason_info: ( 0 !== $input.length ) ? $input.val().trim() : ''
873
- },
874
- beforeSend: function() {
875
- button.addClass('disabled');
876
- button.text('Processing...');
877
- },
878
- complete: function() {
879
- window.location.href = deactivateLink;
880
- }
881
- });
882
- });
883
- });
884
- }(jQuery));
885
- </script>
886
-
887
- <?php
888
- }
889
-
890
- /**
891
- * Run after theme deactivated
892
- * @param string $new_name
893
- * @param object $new_theme
894
- * @param object $old_theme
895
- * @return void
896
- */
897
- public function theme_deactivated( $new_name, $new_theme, $old_theme ) {
898
- // Make sure this is appsero theme
899
- if ( $old_theme->get_template() == $this->client->slug ) {
900
- $this->client->send_request( $this->get_tracking_data(), 'deactivate' );
901
- }
902
- }
903
-
904
- /**
905
- * Get user IP Address
906
- */
907
- private function get_user_ip_address() {
908
- $response = wp_remote_get( 'https://icanhazip.com/' );
909
-
910
- if ( is_wp_error( $response ) ) {
911
- return '';
912
- }
913
-
914
- $ip = trim( wp_remote_retrieve_body( $response ) );
915
-
916
- if ( ! filter_var( $ip, FILTER_VALIDATE_IP ) ) {
917
- return '';
918
- }
919
-
920
- return $ip;
921
- }
922
-
923
- /**
924
- * Get site name
925
- */
926
- private function get_site_name() {
927
- $site_name = get_bloginfo( 'name' );
928
-
929
- if ( empty( $site_name ) ) {
930
- $site_name = get_bloginfo( 'description' );
931
- $site_name = wp_trim_words( $site_name, 3, '' );
932
- }
933
-
934
- if ( empty( $site_name ) ) {
935
- $site_name = esc_url( home_url() );
936
- }
937
-
938
- return $site_name;
939
- }
940
-
941
- /**
942
- * Send request to appsero if user skip to send tracking data
943
- */
944
- private function send_tracking_skipped_request() {
945
- $skipped = get_option( $this->client->slug . '_tracking_skipped' );
946
-
947
- $data = array(
948
- 'hash' => $this->client->hash,
949
- 'previously_skipped' => false,
950
- );
951
-
952
- if ( $skipped === 'yes' ) {
953
- $data['previously_skipped'] = true;
954
- } else {
955
- update_option( $this->client->slug . '_tracking_skipped', 'yes' );
956
- }
957
-
958
- $this->client->send_request( $data, 'tracking-skipped' );
959
- }
960
-
961
- /**
962
- * Deactivation modal styles
963
- */
964
- private function deactivation_modal_styles() {
965
- ?>
966
- <style type="text/css">
967
- .wd-dr-modal {
968
- position: fixed;
969
- z-index: 99999;
970
- top: 0;
971
- right: 0;
972
- bottom: 0;
973
- left: 0;
974
- background: rgba(0,0,0,0.5);
975
- display: none;
976
- box-sizing: border-box;
977
- overflow: scroll;
978
- }
979
- .wd-dr-modal * {
980
- box-sizing: border-box;
981
- }
982
- .wd-dr-modal.modal-active {
983
- display: block;
984
- }
985
- .wd-dr-modal-wrap {
986
- max-width: 870px;
987
- width: 100%;
988
- position: relative;
989
- margin: 10% auto;
990
- background: #fff;
991
- }
992
- .wd-dr-modal-header {
993
- border-bottom: 1px solid #E8E8E8;
994
- padding: 20px 20px 18px 20px;
995
- }
996
- .wd-dr-modal-header h3 {
997
- line-height: 1.8;
998
- margin: 0;
999
- color: #4A5568;
1000
- }
1001
- .wd-dr-modal-body {
1002
- padding: 5px 20px 20px 20px;
1003
- }
1004
- .wd-dr-modal-body .reason-input {
1005
- margin-top: 5px;
1006
- margin-left: 20px;
1007
- }
1008
- .wd-dr-modal-footer {
1009
- border-top: 1px solid #E8E8E8;
1010
- padding: 20px;
1011
- text-align: right;
1012
- }
1013
- .wd-dr-modal-reasons-bottom {
1014
- margin: 0;
1015
- }
1016
- ul.wd-de-reasons {
1017
- display: flex;
1018
- margin: 0 -5px 0 -5px;
1019
- padding: 15px 0 20px 0;
1020
- }
1021
- ul.wd-de-reasons.wd-de-others-reasons {
1022
- padding-top: 0;
1023
- display: none;
1024
- }
1025
- ul.wd-de-reasons li {
1026
- padding: 0 5px;
1027
- margin: 0;
1028
- width: 14.26%;
1029
- }
1030
- ul.wd-de-reasons label {
1031
- position: relative;
1032
- border: 1px solid #E8E8E8;
1033
- border-radius: 4px;
1034
- display: block;
1035
- text-align: center;
1036
- height: 100%;
1037
- padding: 15px 3px 8px 3px;
1038
- }
1039
- ul.wd-de-reasons label:after {
1040
- width: 0;
1041
- height: 0;
1042
- border-left: 8px solid transparent;
1043
- border-right: 8px solid transparent;
1044
- border-top: 10px solid #3B86FF;
1045
- position: absolute;
1046
- left: 50%;
1047
- top: 100%;
1048
- margin-left: -8px;
1049
- }
1050
- ul.wd-de-reasons label input[type="radio"] {
1051
- position: absolute;
1052
- left: 0;
1053
- right: 0;
1054
- visibility: hidden;
1055
- }
1056
- .wd-de-reason-text {
1057
- color: #4A5568;
1058
- font-size: 13px;
1059
- }
1060
- .wd-de-reason-icon {
1061
- margin-bottom: 7px;
1062
- }
1063
- ul.wd-de-reasons li.wd-de-reason-selected label {
1064
- background-color: #3B86FF;
1065
- border-color: #3B86FF;
1066
- }
1067
- li.wd-de-reason-selected .wd-de-reason-icon svg,
1068
- li.wd-de-reason-selected .wd-de-reason-icon svg g {
1069
- fill: #fff;
1070
- }
1071
- li.wd-de-reason-selected .wd-de-reason-text {
1072
- color: #fff;
1073
- }
1074
- ul.wd-de-reasons li.wd-de-reason-selected label:after {
1075
- content: "";
1076
- }
1077
- .wd-dr-modal-reason-input {
1078
- margin-bottom: 15px;
1079
- display: none;
1080
- }
1081
- .wd-dr-modal-reason-input textarea {
1082
- background: #FAFAFA;
1083
- border: 1px solid #287EB8;
1084
- border-radius: 4px;
1085
- width: 100%;
1086
- height: 100px;
1087
- color: #524242;
1088
- font-size: 13px;
1089
- line-height: 1.4;
1090
- padding: 11px 15px;
1091
- resize: none;
1092
- }
1093
- .wd-dr-modal-reason-input textarea:focus {
1094
- outline: 0 none;
1095
- box-shadow: 0 0 0;
1096
- }
1097
- .wd-dr-button-secondary, .wd-dr-button-secondary:hover {
1098
- border: 1px solid #EBEBEB;
1099
- border-radius: 3px;
1100
- font-size: 13px;
1101
- line-height: 1.5;
1102
- color: #718096;
1103
- padding: 5px 12px;
1104
- cursor: pointer;
1105
- background-color: transparent;
1106
- text-decoration: none;
1107
- }
1108
- .wd-dr-submit-modal, .wd-dr-submit-modal:hover {
1109
- border: 1px solid #3B86FF;
1110
- background-color: #3B86FF;
1111
- border-radius: 3px;
1112
- font-size: 13px;
1113
- line-height: 1.5;
1114
- color: #fff;
1115
- padding: 5px 12px;
1116
- cursor: pointer;
1117
- margin-left: 4px;
1118
- }
1119
- </style>
1120
- <?php
1121
- }
1122
-
1123
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
appsero/src/License.php DELETED
@@ -1,809 +0,0 @@
1
- <?php
2
-
3
- namespace Appsero;
4
-
5
- /**
6
- * Appsero License Checker
7
- *
8
- * This class will check, active and deactive license
9
- */
10
- class License {
11
-
12
- /**
13
- * AppSero\Client
14
- *
15
- * @var object
16
- */
17
- protected $client;
18
-
19
- /**
20
- * Arguments of create menu
21
- *
22
- * @var array
23
- */
24
- protected $menu_args;
25
-
26
- /**
27
- * `option_name` of `wp_options` table
28
- *
29
- * @var string
30
- */
31
- protected $option_key;
32
-
33
- /**
34
- * Error message of HTTP request
35
- *
36
- * @var string
37
- */
38
- public $error;
39
-
40
- /**
41
- * Success message on form submit
42
- *
43
- * @var string
44
- */
45
- public $success;
46
-
47
- /**
48
- * Corn schedule hook name
49
- *
50
- * @var string
51
- */
52
- protected $schedule_hook;
53
-
54
- /**
55
- * Set value for valid licnese
56
- *
57
- * @var bool
58
- */
59
- private $is_valid_licnese = null;
60
-
61
- /**
62
- * Initialize the class
63
- *
64
- * @param Appsero\Client
65
- */
66
- public function __construct( Client $client ) {
67
- $this->client = $client;
68
-
69
- $this->option_key = 'appsero_' . md5( $this->client->slug ) . '_manage_license';
70
-
71
- $this->schedule_hook = $this->client->slug . '_license_check_event';
72
-
73
- // Creating WP Ajax Endpoint to refresh license remotely
74
- add_action( "wp_ajax_appsero_refresh_license_" . $this->client->hash, array( $this, 'refresh_license_api' ) );
75
-
76
- // Run hook to check license status daily
77
- add_action( $this->schedule_hook, array( $this, 'check_license_status' ) );
78
-
79
- // Active/Deactive corn schedule
80
- $this->run_schedule();
81
- }
82
-
83
- /**
84
- * Set the license option key.
85
- *
86
- * If someone wants to override the default generated key.
87
- *
88
- * @param string $key
89
- *
90
- * @since 1.3.0
91
- *
92
- * @return License
93
- */
94
- public function set_option_key( $key ) {
95
- $this->option_key = $key;
96
-
97
- return $this;
98
- }
99
-
100
- /**
101
- * Get the license key
102
- *
103
- * @since 1.3.0
104
- *
105
- * @return string|null
106
- */
107
- public function get_license() {
108
- return get_option( $this->option_key, null );
109
- }
110
-
111
- /**
112
- * Check license
113
- *
114
- * @return bool
115
- */
116
- public function check( $license_key ) {
117
- $route = 'public/license/' . $this->client->hash . '/check';
118
-
119
- return $this->send_request( $license_key, $route );
120
- }
121
-
122
- /**
123
- * Active a license
124
- *
125
- * @return bool
126
- */
127
- public function activate( $license_key ) {
128
- $route = 'public/license/' . $this->client->hash . '/activate';
129
-
130
- return $this->send_request( $license_key, $route );
131
- }
132
-
133
- /**
134
- * Deactivate a license
135
- *
136
- * @return bool
137
- */
138
- public function deactivate( $license_key ) {
139
- $route = 'public/license/' . $this->client->hash . '/deactivate';
140
-
141
- return $this->send_request( $license_key, $route );
142
- }
143
-
144
- /**
145
- * Send common request
146
- *
147
- * @param $license_key
148
- * @param $route
149
- *
150
- * @return array
151
- */
152
- protected function send_request( $license_key, $route ) {
153
- $params = array(
154
- 'license_key' => $license_key,
155
- 'url' => esc_url( home_url() ),
156
- 'is_local' => $this->client->is_local_server(),
157
- );
158
-
159
- $response = $this->client->send_request( $params, $route, true );
160
-
161
- if ( is_wp_error( $response ) ) {
162
- return array(
163
- 'success' => false,
164
- 'error' => $response->get_error_message()
165
- );
166
- }
167
-
168
- $response = json_decode( wp_remote_retrieve_body( $response ), true );
169
-
170
- if ( empty( $response ) || isset( $response['exception'] )) {
171
- return array(
172
- 'success' => false,
173
- 'error' => $this->client->__trans( 'Unknown error occurred, Please try again.' ),
174
- );
175
- }
176
-
177
- if ( isset( $response['errors'] ) && isset( $response['errors']['license_key'] ) ) {
178
- $response = array(
179
- 'success' => false,
180
- 'error' => $response['errors']['license_key'][0]
181
- );
182
- }
183
-
184
- return $response;
185
- }
186
-
187
- /**
188
- * License Refresh Endpoint
189
- */
190
- public function refresh_license_api() {
191
- $this->check_license_status();
192
-
193
- return wp_send_json(
194
- array(
195
- 'message' => 'License refreshed successfully.'
196
- ),
197
- 200
198
- );
199
- }
200
-
201
- /**
202
- * Add settings page for license
203
- *
204
- * @param array $args
205
- *
206
- * @return void
207
- */
208
- public function add_settings_page( $args = array() ) {
209
- $defaults = array(
210
- 'type' => 'menu', // Can be: menu, options, submenu
211
- 'page_title' => 'Manage License',
212
- 'menu_title' => 'Manage License',
213
- 'capability' => 'manage_options',
214
- 'menu_slug' => $this->client->slug . '-manage-license',
215
- 'icon_url' => '',
216
- 'position' => null,
217
- 'parent_slug' => '',
218
- );
219
-
220
- $this->menu_args = wp_parse_args( $args, $defaults );
221
-
222
- add_action( 'admin_menu', array( $this, 'admin_menu' ), 99 );
223
- }
224
-
225
- /**
226
- * Admin Menu hook
227
- *
228
- * @return void
229
- */
230
- public function admin_menu() {
231
- switch ( $this->menu_args['type'] ) {
232
- case 'menu':
233
- $this->create_menu_page();
234
- break;
235
-
236
- case 'submenu':
237
- $this->create_submenu_page();
238
- break;
239
-
240
- case 'options':
241
- $this->create_options_page();
242
- break;
243
- }
244
- }
245
-
246
- /**
247
- * License menu output
248
- */
249
- public function menu_output() {
250
- if ( isset( $_POST['submit'] ) ) {
251
- $this->license_form_submit( $_POST );
252
- }
253
-
254
- $license = $this->get_license();
255
- $action = ( $license && isset( $license['status'] ) && 'activate' == $license['status'] ) ? 'deactive' : 'active';
256
- $this->licenses_style();
257
- ?>
258
-
259
- <div class="wrap appsero-license-settings-wrapper">
260
- <h1>License Settings</h1>
261
-
262
- <?php
263
- $this->show_license_page_notices();
264
- do_action( 'before_appsero_license_section' );
265
- ?>
266
-
267
- <div class="appsero-license-settings appsero-license-section">
268
- <?php $this->show_license_page_card_header( $license ); ?>
269
-
270
- <div class="appsero-license-details">
271
- <p>
272
- <?php printf( $this->client->__trans( 'Activate <strong>%s</strong> by your license key to get professional support and automatic update from your WordPress dashboard.' ), $this->client->name ); ?>
273
- </p>
274
- <form method="post" action="<?php $this->form_action_url(); ?>" novalidate="novalidate" spellcheck="false">
275
- <input type="hidden" name="_action" value="<?php echo $action; ?>">
276
- <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( $this->client->name ); ?>">
277
- <div class="license-input-fields">
278
- <div class="license-input-key">
279
- <svg enable-background="new 0 0 512 512" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
280
- <path d="m463.75 48.251c-64.336-64.336-169.01-64.335-233.35 1e-3 -43.945 43.945-59.209 108.71-40.181 167.46l-185.82 185.82c-2.813 2.813-4.395 6.621-4.395 10.606v84.858c0 8.291 6.709 15 15 15h84.858c3.984 0 7.793-1.582 10.605-4.395l21.211-21.226c3.237-3.237 4.819-7.778 4.292-12.334l-2.637-22.793 31.582-2.974c7.178-0.674 12.847-6.343 13.521-13.521l2.974-31.582 22.793 2.651c4.233 0.571 8.496-0.85 11.704-3.691 3.193-2.856 5.024-6.929 5.024-11.206v-27.929h27.422c3.984 0 7.793-1.582 10.605-4.395l38.467-37.958c58.74 19.043 122.38 4.929 166.33-39.046 64.336-64.335 64.336-169.01 0-233.35zm-42.435 106.07c-17.549 17.549-46.084 17.549-63.633 0s-17.549-46.084 0-63.633 46.084-17.549 63.633 0 17.548 46.084 0 63.633z"/>
281
- </svg>
282
- <input type="text" value="<?php echo $this->get_input_license_value( $action, $license ); ?>"
283
- placeholder="<?php echo esc_attr( $this->client->__trans( 'Enter your license key to activate' ) ); ?>" name="license_key"
284
- <?php echo ( 'deactive' == $action ) ? 'readonly="readonly"' : ''; ?>
285
- />
286
- </div>
287
- <button type="submit" name="submit" class="<?php echo 'deactive' == $action ? 'deactive-button' : ''; ?>">
288
- <?php echo $action == 'active' ? $this->client->__trans( 'Activate License' ) : $this->client->__trans( 'Deactivate License' ); ?>
289
- </button>
290
- </div>
291
- </form>
292
-
293
- <?php
294
- if ( 'deactive' == $action && isset( $license['remaining'] ) ) {
295
- $this->show_active_license_info( $license );
296
- } ?>
297
- </div>
298
- </div> <!-- /.appsero-license-settings -->
299
-
300
- <?php do_action( 'after_appsero_license_section' ); ?>
301
- </div>
302
- <?php
303
- }
304
-
305
- /**
306
- * License form submit
307
- */
308
- public function license_form_submit( $form ) {
309
- if ( ! isset( $form['_nonce'], $form['_action'] ) ) {
310
- $this->error = $this->client->__trans( 'Please add all information' );
311
-
312
- return;
313
- }
314
-
315
- if ( ! wp_verify_nonce( $form['_nonce'], $this->client->name ) ) {
316
- $this->error = $this->client->__trans( "You don't have permission to manage license." );
317
-
318
- return;
319
- }
320
-
321
- switch ( $form['_action'] ) {
322
- case 'active':
323
- $this->active_client_license( $form );
324
- break;
325
-
326
- case 'deactive':
327
- $this->deactive_client_license( $form );
328
- break;
329
-
330
- case 'refresh':
331
- $this->refresh_client_license( $form );
332
- break;
333
- }
334
- }
335
-
336
- /**
337
- * Check license status on schedule
338
- */
339
- public function check_license_status() {
340
- $license = $this->get_license();
341
-
342
- if ( isset( $license['key'] ) && ! empty( $license['key'] ) ) {
343
- $response = $this->check( $license['key'] );
344
-
345
- if ( isset( $response['success'] ) && $response['success'] ) {
346
- $license['status'] = 'activate';
347
- $license['remaining'] = $response['remaining'];
348
- $license['activation_limit'] = $response['activation_limit'];
349
- $license['expiry_days'] = $response['expiry_days'];
350
- $license['title'] = $response['title'];
351
- $license['source_id'] = $response['source_identifier'];
352
- $license['recurring'] = $response['recurring'];
353
- } else {
354
- $license['status'] = 'deactivate';
355
- $license['expiry_days'] = 0;
356
- }
357
-
358
- update_option( $this->option_key, $license, false );
359
- }
360
- }
361
-
362
- /**
363
- * Check this is a valid license
364
- */
365
- public function is_valid() {
366
- if ( null !== $this->is_valid_licnese ) {
367
- return $this->is_valid_licnese;
368
- }
369
-
370
- $license = $this->get_license();
371
-
372
- if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
373
- $this->is_valid_licnese = true;
374
- } else {
375
- $this->is_valid_licnese = false;
376
- }
377
-
378
- return $this->is_valid_licnese;
379
- }
380
-
381
- /**
382
- * Check this is a valid license
383
- */
384
- public function is_valid_by( $option, $value ) {
385
- $license = $this->get_license();
386
-
387
- if ( ! empty( $license['key'] ) && isset( $license['status'] ) && $license['status'] == 'activate' ) {
388
- if ( isset( $license[ $option ] ) && $license[ $option ] == $value ) {
389
- return true;
390
- }
391
- }
392
-
393
- return false;
394
- }
395
-
396
- /**
397
- * Styles for licenses page
398
- */
399
- private function licenses_style() {
400
- ?>
401
- <style type="text/css">
402
- .appsero-license-section {
403
- width: 100%;
404
- max-width: 1100px;
405
- min-height: 1px;
406
- box-sizing: border-box;
407
- }
408
- .appsero-license-settings {
409
- background-color: #fff;
410
- box-shadow: 0px 3px 10px rgba(16, 16, 16, 0.05);
411
- }
412
- .appsero-license-settings * {
413
- box-sizing: border-box;
414
- }
415
- .appsero-license-title {
416
- background-color: #F8FAFB;
417
- border-bottom: 2px solid #EAEAEA;
418
- display: flex;
419
- align-items: center;
420
- padding: 10px 20px;
421
- }
422
- .appsero-license-title svg {
423
- width: 30px;
424
- height: 30px;
425
- fill: #0082BF;
426
- }
427
- .appsero-license-title span {
428
- font-size: 17px;
429
- color: #444444;
430
- margin-left: 10px;
431
- }
432
- .appsero-license-details {
433
- padding: 20px;
434
- }
435
- .appsero-license-details p {
436
- font-size: 15px;
437
- margin: 0 0 20px 0;
438
- }
439
- .license-input-key {
440
- position: relative;
441
- flex: 0 0 72%;
442
- max-width: 72%;
443
- }
444
- .license-input-key input {
445
- background-color: #F9F9F9;
446
- padding: 10px 15px 10px 48px;
447
- border: 1px solid #E8E5E5;
448
- border-radius: 3px;
449
- height: 45px;
450
- font-size: 16px;
451
- color: #71777D;
452
- width: 100%;
453
- box-shadow: 0 0 0 transparent;
454
- }
455
- .license-input-key input:focus {
456
- outline: 0 none;
457
- border: 1px solid #E8E5E5;
458
- box-shadow: 0 0 0 transparent;
459
- }
460
- .license-input-key svg {
461
- width: 22px;
462
- height: 22px;
463
- fill: #0082BF;
464
- position: absolute;
465
- left: 14px;
466
- top: 13px;
467
- }
468
- .license-input-fields {
469
- display: flex;
470
- justify-content: space-between;
471
- margin-bottom: 30px;
472
- max-width: 850px;
473
- width: 100%;
474
- }
475
- .license-input-fields button {
476
- color: #fff;
477
- font-size: 17px;
478
- padding: 8px;
479
- height: 46px;
480
- background-color: #0082BF;
481
- border-radius: 3px;
482
- cursor: pointer;
483
- flex: 0 0 25%;
484
- max-width: 25%;
485
- border: 1px solid #0082BF;
486
- }
487
- .license-input-fields button.deactive-button {
488
- background-color: #E40055;
489
- border-color: #E40055;
490
- }
491
- .license-input-fields button:focus {
492
- outline: 0 none;
493
- }
494
- .active-license-info {
495
- display: flex;
496
- }
497
- .single-license-info {
498
- min-width: 220px;
499
- flex: 0 0 30%;
500
- }
501
- .single-license-info h3 {
502
- font-size: 18px;
503
- margin: 0 0 12px 0;
504
- }
505
- .single-license-info p {
506
- margin: 0;
507
- color: #00C000;
508
- }
509
- .single-license-info p.occupied {
510
- color: #E40055;
511
- }
512
- .appsero-license-right-form {
513
- margin-left: auto;
514
- }
515
- .appsero-license-refresh-button {
516
- padding: 6px 10px 4px 10px;
517
- border: 1px solid #0082BF;
518
- border-radius: 3px;
519
- margin-left: auto;
520
- background-color: #0082BF;
521
- color: #fff;
522
- cursor: pointer;
523
- }
524
- .appsero-license-refresh-button .dashicons {
525
- color: #fff;
526
- margin-left: 0;
527
- }
528
- </style>
529
- <?php
530
- }
531
-
532
- /**
533
- * Show active license information
534
- */
535
- private function show_active_license_info( $license ) {
536
- ?>
537
- <div class="active-license-info">
538
- <div class="single-license-info">
539
- <h3><?php $this->client->_etrans( 'Activations Remaining' ); ?></h3>
540
- <?php if ( empty( $license['activation_limit'] ) ) { ?>
541
- <p><?php $this->client->_etrans( 'Unlimited' ); ?></p>
542
- <?php } else { ?>
543
- <p class="<?php echo $license['remaining'] ? '' : 'occupied'; ?>">
544
- <?php printf( $this->client->__trans( '%1$d out of %2$d' ), $license['remaining'], $license['activation_limit'] ); ?>
545
- </p>
546
- <?php } ?>
547
- </div>
548
- <div class="single-license-info">
549
- <h3><?php $this->client->_etrans( 'Expires in' ); ?></h3>
550
- <?php
551
- if ( false !== $license['expiry_days'] ) {
552
- $occupied = $license['expiry_days'] > 21 ? '' : 'occupied';
553
- echo '<p class="' . $occupied . '">' . $license['expiry_days'] . ' days</p>';
554
- } else {
555
- echo '<p>' . $this->client->__trans( 'Never' ) . '</p>';
556
- } ?>
557
- </div>
558
- </div>
559
- <?php
560
- }
561
-
562
- /**
563
- * Show license settings page notices
564
- */
565
- private function show_license_page_notices() {
566
- if ( ! empty( $this->error ) ) {
567
- ?>
568
- <div class="notice notice-error is-dismissible appsero-license-section">
569
- <p><?php echo $this->error; ?></p>
570
- </div>
571
- <?php
572
- }
573
-
574
- if ( ! empty( $this->success ) ) {
575
- ?>
576
- <div class="notice notice-success is-dismissible appsero-license-section">
577
- <p><?php echo $this->success; ?></p>
578
- </div>
579
- <?php
580
- }
581
- echo '<br />';
582
- }
583
-
584
- /**
585
- * Card header
586
- */
587
- private function show_license_page_card_header( $license ) {
588
- ?>
589
- <div class="appsero-license-title">
590
- <svg enable-background="new 0 0 299.995 299.995" version="1.1" viewBox="0 0 300 300" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
591
- <path d="m150 161.48c-8.613 0-15.598 6.982-15.598 15.598 0 5.776 3.149 10.807 7.817 13.505v17.341h15.562v-17.341c4.668-2.697 7.817-7.729 7.817-13.505 0-8.616-6.984-15.598-15.598-15.598z"/>
592
- <path d="m150 85.849c-13.111 0-23.775 10.665-23.775 23.775v25.319h47.548v-25.319c-1e-3 -13.108-10.665-23.775-23.773-23.775z"/>
593
- <path d="m150 1e-3c-82.839 0-150 67.158-150 150 0 82.837 67.156 150 150 150s150-67.161 150-150c0-82.839-67.161-150-150-150zm46.09 227.12h-92.173c-9.734 0-17.626-7.892-17.626-17.629v-56.919c0-8.491 6.007-15.582 14.003-17.25v-25.697c0-27.409 22.3-49.711 49.711-49.711 27.409 0 49.709 22.3 49.709 49.711v25.697c7.993 1.673 14 8.759 14 17.25v56.919h2e-3c0 9.736-7.892 17.629-17.626 17.629z"/>
594
- </svg>
595
- <span><?php echo $this->client->__trans( 'Activate License' ); ?></span>
596
-
597
- <?php if ( $license && $license['key'] ) : ?>
598
- <form method="post" class="appsero-license-right-form" action="<?php $this->form_action_url(); ?>" novalidate="novalidate" spellcheck="false">
599
- <input type="hidden" name="_action" value="refresh">
600
- <input type="hidden" name="_nonce" value="<?php echo wp_create_nonce( $this->client->name ); ?>">
601
- <button type="submit" name="submit" class="appsero-license-refresh-button">
602
- <span class="dashicons dashicons-update"></span>
603
- <?php echo $this->client->__trans( 'Refresh License' ); ?>
604
- </button>
605
- </form>
606
- <?php endif; ?>
607
-
608
- </div>
609
- <?php
610
- }
611
-
612
- /**
613
- * Active client license
614
- */
615
- private function active_client_license( $form ) {
616
- if ( empty( $form['license_key'] ) ) {
617
- $this->error = $this->client->__trans( 'The license key field is required.' );
618
-
619
- return;
620
- }
621
-
622
- $license_key = sanitize_text_field( $form['license_key'] );
623
- $response = $this->activate( $license_key );
624
-
625
- if ( ! $response['success'] ) {
626
- $this->error = $response['error'] ? $response['error'] : $this->client->__trans( 'Unknown error occurred.' );
627
-
628
- return;
629
- }
630
-
631
- $data = array(
632
- 'key' => $license_key,
633
- 'status' => 'activate',
634
- 'remaining' => $response['remaining'],
635
- 'activation_limit' => $response['activation_limit'],
636
- 'expiry_days' => $response['expiry_days'],
637
- 'title' => $response['title'],
638
- 'source_id' => $response['source_identifier'],
639
- 'recurring' => $response['recurring'],
640
- );
641
-
642
- update_option( $this->option_key, $data, false );
643
-
644
- $this->success = $this->client->__trans( 'License activated successfully.' );
645
- }
646
-
647
- /**
648
- * Deactive client license
649
- */
650
- private function deactive_client_license( $form ) {
651
- $license = $this->get_license();
652
-
653
- if ( empty( $license['key'] ) ) {
654
- $this->error = $this->client->__trans( 'License key not found.' );
655
-
656
- return;
657
- }
658
-
659
- $response = $this->deactivate( $license['key'] );
660
-
661
- $data = array(
662
- 'key' => '',
663
- 'status' => 'deactivate',
664
- );
665
-
666
- update_option( $this->option_key, $data, false );
667
-
668
- if ( ! $response['success'] ) {
669
- $this->error = $response['error'] ? $response['error'] : $this->client->__trans( 'Unknown error occurred.' );
670
-
671
- return;
672
- }
673
-
674
- $this->success = $this->client->__trans( 'License deactivated successfully.' );
675
- }
676
-
677
- /**
678
- * Refresh Client License
679
- */
680
- private function refresh_client_license( $form = null ) {
681
- $license = $this->get_license();
682
-
683
- if( !$license || ! isset( $license['key'] ) || empty( $license['key'] ) ) {
684
- $this->error = $this->client->__trans( "License key not found" );
685
- return;
686
- }
687
-
688
- $this->check_license_status();
689
-
690
- $this->success = $this->client->__trans( 'License refreshed successfully.' );
691
- }
692
-
693
- /**
694
- * Add license menu page
695
- */
696
- private function create_menu_page() {
697
- call_user_func(
698
- 'add_' . 'menu' . '_page',
699
- $this->menu_args['page_title'],
700
- $this->menu_args['menu_title'],
701
- $this->menu_args['capability'],
702
- $this->menu_args['menu_slug'],
703
- array( $this, 'menu_output' ),
704
- $this->menu_args['icon_url'],
705
- $this->menu_args['position']
706
- );
707
- }
708
-
709
- /**
710
- * Add submenu page
711
- */
712
- private function create_submenu_page() {
713
- call_user_func(
714
- 'add_' . 'submenu' . '_page',
715
- $this->menu_args['parent_slug'],
716
- $this->menu_args['page_title'],
717
- $this->menu_args['menu_title'],
718
- $this->menu_args['capability'],
719
- $this->menu_args['menu_slug'],
720
- array( $this, 'menu_output' ),
721
- $this->menu_args['position']
722
- );
723
- }
724
-
725
- /**
726
- * Add submenu page
727
- */
728
- private function create_options_page() {
729
- call_user_func(
730
- 'add_' . 'options' . '_page',
731
- $this->menu_args['page_title'],
732
- $this->menu_args['menu_title'],
733
- $this->menu_args['capability'],
734
- $this->menu_args['menu_slug'],
735
- array( $this, 'menu_output' ),
736
- $this->menu_args['position']
737
- );
738
- }
739
-
740
- /**
741
- * Schedule daily sicense checker event
742
- */
743
- public function schedule_cron_event() {
744
- if ( ! wp_next_scheduled( $this->schedule_hook ) ) {
745
- wp_schedule_event( time(), 'daily', $this->schedule_hook );
746
-
747
- wp_schedule_single_event( time() + 20, $this->schedule_hook );
748
- }
749
- }
750
-
751
- /**
752
- * Clear any scheduled hook
753
- */
754
- public function clear_scheduler() {
755
- wp_clear_scheduled_hook( $this->schedule_hook );
756
- }
757
-
758
- /**
759
- * Enable/Disable schedule
760
- */
761
- private function run_schedule() {
762
- switch ( $this->client->type ) {
763
- case 'plugin':
764
- register_activation_hook( $this->client->file, array( $this, 'schedule_cron_event' ) );
765
- register_deactivation_hook( $this->client->file, array( $this, 'clear_scheduler' ) );
766
- break;
767
-
768
- case 'theme':
769
- add_action( 'after_switch_theme', array( $this, 'schedule_cron_event' ) );
770
- add_action( 'switch_theme', array( $this, 'clear_scheduler' ) );
771
- break;
772
- }
773
- }
774
-
775
- /**
776
- * Form action URL
777
- */
778
- private function form_action_url() {
779
- $url = add_query_arg(
780
- $_GET,
781
- admin_url( basename( $_SERVER['SCRIPT_NAME'] ) )
782
- );
783
-
784
- echo apply_filters( 'appsero_client_license_form_action', $url );
785
- }
786
-
787
- /**
788
- * Get input license key
789
- *
790
- * @param $action
791
- *
792
- * @return $license
793
- */
794
- private function get_input_license_value( $action, $license ) {
795
- if ( 'active' == $action ) {
796
- return isset( $license['key'] ) ? $license['key'] : '';
797
- }
798
-
799
- if ( 'deactive' == $action ) {
800
- $key_length = strlen( $license['key'] );
801
-
802
- return str_pad(
803
- substr( $license['key'], 0, $key_length / 2 ), $key_length, '*'
804
- );
805
- }
806
-
807
- return '';
808
- }
809
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
appsero/src/Updater.php DELETED
@@ -1,258 +0,0 @@
1
- <?php
2
- namespace Appsero;
3
-
4
- /**
5
- * Appsero Updater
6
- *
7
- * This class will show new updates project
8
- */
9
- class Updater {
10
-
11
- /**
12
- * Appsero\Client
13
- *
14
- * @var object
15
- */
16
- protected $client;
17
-
18
- /**
19
- * Initialize the class
20
- *
21
- * @param Appsero\Client
22
- */
23
- public function __construct( Client $client ) {
24
-
25
- $this->client = $client;
26
- $this->cache_key = 'appsero_' . md5( $this->client->slug ) . '_version_info';
27
-
28
- // Run hooks.
29
- if ( $this->client->type == 'plugin' ) {
30
- $this->run_plugin_hooks();
31
- } elseif ( $this->client->type == 'theme' ) {
32
- $this->run_theme_hooks();
33
- }
34
- }
35
-
36
- /**
37
- * Set up WordPress filter to hooks to get update.
38
- *
39
- * @return void
40
- */
41
- public function run_plugin_hooks() {
42
- add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_plugin_update' ) );
43
- add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
44
- }
45
-
46
- /**
47
- * Set up WordPress filter to hooks to get update.
48
- *
49
- * @return void
50
- */
51
- public function run_theme_hooks() {
52
- add_filter( 'pre_set_site_transient_update_themes', array( $this, 'check_theme_update' ) );
53
- }
54
-
55
- /**
56
- * Check for Update for this specific project
57
- */
58
- public function check_plugin_update( $transient_data ) {
59
- global $pagenow;
60
-
61
- if ( ! is_object( $transient_data ) ) {
62
- $transient_data = new \stdClass;
63
- }
64
-
65
- if ( 'plugins.php' == $pagenow && is_multisite() ) {
66
- return $transient_data;
67
- }
68
-
69
- if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->basename ] ) ) {
70
- return $transient_data;
71
- }
72
-
73
- $version_info = $this->get_version_info();
74
-
75
- if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
76
-
77
- unset( $version_info->sections );
78
-
79
- // If new version available then set to `response`
80
- if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
81
- $transient_data->response[ $this->client->basename ] = $version_info;
82
- } else {
83
- // If new version is not available then set to `no_update`
84
- $transient_data->no_update[ $this->client->basename ] = $version_info;
85
- }
86
-
87
- $transient_data->last_checked = time();
88
- $transient_data->checked[ $this->client->basename ] = $this->client->project_version;
89
- }
90
-
91
- return $transient_data;
92
- }
93
-
94
- /**
95
- * Get version info from database
96
- *
97
- * @return Object or Boolean
98
- */
99
- private function get_cached_version_info() {
100
- global $pagenow;
101
-
102
- // If updater page then fetch from API now
103
- if ( 'update-core.php' == $pagenow ) {
104
- return false; // Force to fetch data
105
- }
106
-
107
- $value = get_transient( $this->cache_key );
108
-
109
- if( ! $value && ! isset( $value->name ) ) {
110
- return false; // Cache is expired
111
- }
112
-
113
- // We need to turn the icons into an array
114
- if ( isset( $value->icons ) ) {
115
- $value->icons = (array) $value->icons;
116
- }
117
-
118
- // We need to turn the banners into an array
119
- if ( isset( $value->banners ) ) {
120
- $value->banners = (array) $value->banners;
121
- }
122
-
123
- if ( isset( $value->sections ) ) {
124
- $value->sections = (array) $value->sections;
125
- }
126
-
127
- return $value;
128
- }
129
-
130
- /**
131
- * Set version info to database
132
- */
133
- private function set_cached_version_info( $value ) {
134
- if ( ! $value ) {
135
- return;
136
- }
137
-
138
- set_transient( $this->cache_key, $value, 3 * HOUR_IN_SECONDS );
139
- }
140
-
141
- /**
142
- * Get plugin info from Appsero
143
- */
144
- private function get_project_latest_version() {
145
-
146
- $license = $this->client->license()->get_license();
147
-
148
- $params = array(
149
- 'version' => $this->client->project_version,
150
- 'name' => $this->client->name,
151
- 'slug' => $this->client->slug,
152
- 'basename' => $this->client->basename,
153
- 'license_key' => ! empty( $license ) && isset( $license['key'] ) ? $license['key'] : '',
154
- );
155
-
156
- $route = 'update/' . $this->client->hash . '/check';
157
-
158
- $response = $this->client->send_request( $params, $route, true );
159
-
160
- if ( is_wp_error( $response ) ) {
161
- return false;
162
- }
163
-
164
- $response = json_decode( wp_remote_retrieve_body( $response ) );
165
-
166
- if ( ! isset( $response->slug ) ) {
167
- return false;
168
- }
169
-
170
- if ( isset( $response->icons ) ) {
171
- $response->icons = (array) $response->icons;
172
- }
173
-
174
- if ( isset( $response->banners ) ) {
175
- $response->banners = (array) $response->banners;
176
- }
177
-
178
- if ( isset( $response->sections ) ) {
179
- $response->sections = (array) $response->sections;
180
- }
181
-
182
- return $response;
183
- }
184
-
185
- /**
186
- * Updates information on the "View version x.x details" page with custom data.
187
- *
188
- * @param mixed $data
189
- * @param string $action
190
- * @param object $args
191
- *
192
- * @return object $data
193
- */
194
- public function plugins_api_filter( $data, $action = '', $args = null ) {
195
-
196
- if ( $action != 'plugin_information' ) {
197
- return $data;
198
- }
199
-
200
- if ( ! isset( $args->slug ) || ( $args->slug != $this->client->slug ) ) {
201
- return $data;
202
- }
203
-
204
- return $this->get_version_info();
205
- }
206
-
207
- /**
208
- * Check theme upate
209
- */
210
- public function check_theme_update( $transient_data ) {
211
- global $pagenow;
212
-
213
- if ( ! is_object( $transient_data ) ) {
214
- $transient_data = new \stdClass;
215
- }
216
-
217
- if ( 'themes.php' == $pagenow && is_multisite() ) {
218
- return $transient_data;
219
- }
220
-
221
- if ( ! empty( $transient_data->response ) && ! empty( $transient_data->response[ $this->client->slug ] ) ) {
222
- return $transient_data;
223
- }
224
-
225
- $version_info = $this->get_version_info();
226
-
227
- if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
228
-
229
- // If new version available then set to `response`
230
- if ( version_compare( $this->client->project_version, $version_info->new_version, '<' ) ) {
231
- $transient_data->response[ $this->client->slug ] = (array) $version_info;
232
- } else {
233
- // If new version is not available then set to `no_update`
234
- $transient_data->no_update[ $this->client->slug ] = (array) $version_info;
235
- }
236
-
237
- $transient_data->last_checked = time();
238
- $transient_data->checked[ $this->client->slug ] = $this->client->project_version;
239
- }
240
-
241
- return $transient_data;
242
- }
243
-
244
- /**
245
- * Get version information
246
- */
247
- private function get_version_info() {
248
- $version_info = $this->get_cached_version_info();
249
-
250
- if ( false === $version_info ) {
251
- $version_info = $this->get_project_latest_version();
252
- $this->set_cached_version_info( $version_info );
253
- }
254
-
255
- return $version_info;
256
- }
257
-
258
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
autoload.php CHANGED
@@ -1,29 +1,31 @@
1
  <?php
2
 
3
- spl_autoload_register(function ($class) {
4
- // project-specific namespace prefix
5
- $prefix = 'WGMSRM\\';
 
6
 
7
- // base directory for the namespace prefix
8
- $base_dir = WGM_PLUGIN_PATH . 'includes/';
9
 
10
- // does the class use the namespace prefix?
11
- $len = strlen($prefix);
12
- if (strncmp($prefix, $class, $len) !== 0) {
13
- // no, move to the next registered autoloader
14
- return;
15
- }
16
 
17
- // get the relative class name
18
- $relative_class = substr($class, $len);
19
 
20
- // replace the namespace prefix with the base directory, replace namespace
21
- // separators with directory separators in the relative class name, append
22
- // with .php
23
- $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
24
 
25
- // if the file exists, require it
26
- if (file_exists($file)) {
27
- require $file;
28
- }
29
- });
 
1
  <?php
2
 
3
+ spl_autoload_register(
4
+ function ( $class ) {
5
+ // project-specific namespace prefix
6
+ $prefix = 'WGMSRM\\';
7
 
8
+ // base directory for the namespace prefix
9
+ $base_dir = WGM_PLUGIN_PATH . 'includes/';
10
 
11
+ // does the class use the namespace prefix?
12
+ $len = strlen( $prefix );
13
+ if ( strncmp( $prefix, $class, $len ) !== 0 ) {
14
+ // no, move to the next registered autoloader
15
+ return;
16
+ }
17
 
18
+ // get the relative class name
19
+ $relative_class = substr( $class, $len );
20
 
21
+ // replace the namespace prefix with the base directory, replace namespace
22
+ // separators with directory separators in the relative class name, append
23
+ // with .php
24
+ $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
25
 
26
+ // if the file exists, require it
27
+ if ( file_exists( $file ) ) {
28
+ require $file;
29
+ }
30
+ }
31
+ );
gmap-embed.pot CHANGED
@@ -128,7 +128,7 @@ msgstr ""
128
  #. Plugin URI of the plugin/theme
129
  #. #-#-#-#-# plugin.pot (Google Map Embed 1.1.0) #-#-#-#-#
130
  #. Author URI of the plugin/theme
131
- msgid "https://www.srmilon.info"
132
  msgstr ""
133
 
134
  #. Description of the plugin/theme
@@ -138,5 +138,5 @@ msgid ""
138
  msgstr ""
139
 
140
  #. Author of the plugin/theme
141
- msgid "srmilon.info"
142
  msgstr ""
128
  #. Plugin URI of the plugin/theme
129
  #. #-#-#-#-# plugin.pot (Google Map Embed 1.1.0) #-#-#-#-#
130
  #. Author URI of the plugin/theme
131
+ msgid "https://www.wpgooglemap.com"
132
  msgstr ""
133
 
134
  #. Description of the plugin/theme
138
  msgstr ""
139
 
140
  #. Author of the plugin/theme
141
+ msgid "wpgooglemap.com"
142
  msgstr ""
includes/Classes/Bootstrap.php CHANGED
@@ -18,91 +18,92 @@ use WGMSRM\Traits\PluginsLoadedActions;
18
  use WGMSRM\Traits\Settings;
19
  use WGMSRM\Traits\SetupWizard;
20
 
21
- if (!defined('ABSPATH')) exit;
22
-
23
- class Bootstrap
24
- {
25
- use Settings, MapCRUD, Notice, Menu, AssetHandler, CommonFunctions, ActionLinks, PluginsLoadedActions, ActivationHooks, InitActions, SetupWizard, Filters, MarkerCRUD, AdminInitActions, MediaButtons;
26
-
27
- private static $instance = null;
28
- private $plugin_name = 'WP Google Map';
29
- private $plugin_slug = 'gmap-embed';
30
- public $wpgmap_api_key = 'AIzaSyD79uz_fsapIldhWBl0NqYHHGBWkxlabro';
31
-
32
- public function __construct()
33
- {
34
- $this->wpgmap_api_key = get_option('wpgmap_api_key');
35
- $this->registerHooks();
36
- $this->load_dependencies();
37
-
38
- }
39
-
40
- public static function instance()
41
- {
42
- if (self::$instance == null) {
43
- self::$instance = new self;
44
- }
45
-
46
- return self::$instance;
47
- }
48
-
49
- /**
50
- * Register all hooks
51
- */
52
- private function registerHooks()
53
- {
54
- add_action('init', array($this, 'do_init_actions'));
55
- add_action('plugins_loaded', array($this, 'wpgmap_do_after_plugins_loaded'));
56
- add_action('widgets_init', array($this, 'register_widget'));
57
- add_action('activated_plugin', array($this, 'wpgmap_do_after_activation'), 10, 2);
58
- add_action('wp_enqueue_scripts', array($this, 'gmap_front_enqueue_scripts'));
59
- add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_gmap_scripts'));
60
- add_action('admin_menu', array($this, 'gmap_create_menu'));
61
- add_action('admin_init', array($this, 'do_admin_init_actions'));
62
- add_action('admin_init', array($this, 'gmapsrm_settings'));
63
- add_action('admin_notices', array($this, 'gmap_embed_notice_generate'));
64
- add_filter('plugin_action_links_gmap-embed/srm_gmap_embed.php', array($this, 'gmap_srm_settings_link'), 10, 4);
65
- add_action('media_buttons', array($this, 'add_wp_google_map_media_button'));
66
- add_action('admin_footer', array($this, 'wp_google_map_media_button_content'));
67
- $this->ajaxHooks();
68
-
69
- /** To prevent others plugin loading Google Map API(with checking user consent) */
70
- if (get_option('_wgm_prevent_other_plugin_theme_api_load') == 'Y') {
71
- add_filter('script_loader_tag', array($this, 'doPreventOthersGoogleMapsTag'), 10000000, 3);
72
- }
73
- }
74
-
75
- private function ajaxHooks()
76
- {
77
- add_action('wp_ajax_wpgmapembed_save_map_data', array($this, 'save_wpgmapembed_data'));
78
- add_action('wp_ajax_wpgmapembed_load_map_data', array($this, 'load_wpgmapembed_list'));
79
- add_action('wp_ajax_wpgmapembed_popup_load_map_data', array($this, 'load_popup_wpgmapembed_list'));
80
- add_action('wp_ajax_wpgmapembed_get_wpgmap_data', array($this, 'get_wpgmapembed_data'));
81
- add_action('wp_ajax_wpgmapembed_remove_wpgmap', array($this, 'remove_wpgmapembed_data'));
82
- add_action('wp_ajax_wpgmapembed_save_setup_wizard', array($this, 'wpgmap_save_setup_wizard'));
83
- add_action('wp_ajax_wgm_get_all_maps', array($this, 'wgm_get_all_maps'));
84
-
85
- // Marker related
86
- add_action('wp_ajax_wpgmapembed_save_map_markers', array($this, 'save_map_marker'));
87
- add_action('wp_ajax_wpgmapembed_update_map_markers', array($this, 'update_map_marker'));
88
- add_action('wp_ajax_wpgmapembed_get_marker_icons', array($this, 'get_marker_icons'));
89
- add_action('wp_ajax_wpgmapembed_save_marker_icon', array($this, 'save_marker_icon'));
90
- add_action('wp_ajax_wpgmapembed_get_markers_by_map_id', array($this, 'get_markers_by_map_id'));
91
- add_action('wp_ajax_wpgmapembed_p_get_markers_by_map_id', array($this, 'p_get_markers_by_map_id'));
92
- add_action('wp_ajax_nopriv_wpgmapembed_p_get_markers_by_map_id', array($this, 'p_get_markers_by_map_id'));
93
- add_action('wp_ajax_wgm_get_markers_by_map_id', array($this, 'wgm_get_markers_by_map_id_for_dt'));
94
- add_action('wp_ajax_wpgmapembed_delete_marker', array($this, 'delete_marker'));
95
- add_action('wp_ajax_wpgmapembed_get_marker_data_by_marker_id', array($this, 'get_marker_data_by_marker_id'));
96
- }
97
-
98
- public function load_dependencies()
99
- {
100
- // Define Shortcode
101
- require_once WGM_PLUGIN_PATH . '/public/includes/shortcodes.php';
102
- }
103
-
104
- public function register_widget()
105
- {
106
- register_widget('WGMSRM\\Classes\\srmgmap_widget');
107
- }
108
- }
 
18
  use WGMSRM\Traits\Settings;
19
  use WGMSRM\Traits\SetupWizard;
20
 
21
+ if ( ! defined( 'ABSPATH' ) ) {
22
+ exit;
23
+ }
24
+
25
+ class Bootstrap {
26
+
27
+ use Settings, MapCRUD, Notice, Menu, AssetHandler, CommonFunctions, ActionLinks, PluginsLoadedActions, ActivationHooks, InitActions, SetupWizard, Filters, MarkerCRUD, AdminInitActions, MediaButtons;
28
+
29
+ private static $instance = null;
30
+ private $plugin_name = 'WP Google Map';
31
+ private $plugin_slug = 'gmap-embed';
32
+ public $wpgmap_api_key = 'AIzaSyD79uz_fsapIldhWBl0NqYHHGBWkxlabro';
33
+
34
+ public function __construct() {
35
+ $this->wpgmap_api_key = esc_html( get_option( 'wpgmap_api_key' ) );
36
+ $this->register_hooks();
37
+ $this->load_dependencies();
38
+
39
+ }
40
+
41
+ /**
42
+ * Generating instance
43
+ *
44
+ * @return Bootstrap|null
45
+ */
46
+ public static function instance() {
47
+ if ( self::$instance === null ) {
48
+ self::$instance = new self();
49
+ }
50
+
51
+ return self::$instance;
52
+ }
53
+
54
+ /**
55
+ * Register all hooks
56
+ */
57
+ private function register_hooks() {
58
+ add_action( 'init', array( $this, 'do_init_actions' ) );
59
+ add_action( 'plugins_loaded', array( $this, 'wpgmap_do_after_plugins_loaded' ) );
60
+ add_action( 'widgets_init', array( $this, 'register_widget' ) );
61
+ add_action( 'activated_plugin', array( $this, 'wpgmap_do_after_activation' ), 10, 2 );
62
+ add_action( 'wp_enqueue_scripts', array( $this, 'gmap_front_enqueue_scripts' ) );
63
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_gmap_scripts' ) );
64
+ add_action( 'admin_menu', array( $this, 'gmap_create_menu' ) );
65
+ add_action( 'admin_init', array( $this, 'do_admin_init_actions' ) );
66
+ add_action( 'admin_init', array( $this, 'gmapsrm_settings' ) );
67
+ add_action( 'admin_notices', array( $this, 'gmap_embed_notice_generate' ) );
68
+ add_filter( 'plugin_action_links_gmap-embed/srm_gmap_embed.php', array( $this, 'gmap_srm_settings_link' ), 10, 4 );
69
+ add_action( 'media_buttons', array( $this, 'add_wp_google_map_media_button' ) );
70
+ add_action( 'admin_footer', array( $this, 'wp_google_map_media_button_content' ) );
71
+ $this->ajax_hooks();
72
+
73
+ /** To prevent others plugin loading Google Map API(with checking user consent) */
74
+ if ( get_option( '_wgm_prevent_other_plugin_theme_api_load' ) === 'Y' ) {
75
+ add_filter( 'script_loader_tag', array( $this, 'do_prevent_others_google_maps_tag' ), 10000000, 3 );
76
+ }
77
+ }
78
+
79
+ private function ajax_hooks() {
80
+ add_action( 'wp_ajax_wpgmapembed_save_map_data', array( $this, 'save_wpgmapembed_data' ) );
81
+ add_action( 'wp_ajax_wpgmapembed_load_map_data', array( $this, 'load_wpgmapembed_list' ) );
82
+ add_action( 'wp_ajax_wpgmapembed_popup_load_map_data', array( $this, 'load_popup_wpgmapembed_list' ) );
83
+ add_action( 'wp_ajax_wpgmapembed_get_wpgmap_data', array( $this, 'get_wpgmapembed_data' ) );
84
+ add_action( 'wp_ajax_wpgmapembed_remove_wpgmap', array( $this, 'remove_wpgmapembed_data' ) );
85
+ add_action( 'wp_ajax_wpgmapembed_save_setup_wizard', array( $this, 'wpgmap_save_setup_wizard' ) );
86
+ add_action( 'wp_ajax_wgm_get_all_maps', array( $this, 'wgm_get_all_maps' ) );
87
+
88
+ // Marker related.
89
+ add_action( 'wp_ajax_wpgmapembed_save_map_markers', array( $this, 'save_map_marker' ) );
90
+ add_action( 'wp_ajax_wpgmapembed_update_map_markers', array( $this, 'update_map_marker' ) );
91
+ add_action( 'wp_ajax_wpgmapembed_get_marker_icons', array( $this, 'get_marker_icons' ) );
92
+ add_action( 'wp_ajax_wpgmapembed_save_marker_icon', array( $this, 'save_marker_icon' ) );
93
+ add_action( 'wp_ajax_wpgmapembed_get_markers_by_map_id', array( $this, 'get_markers_by_map_id' ) );
94
+ add_action( 'wp_ajax_wpgmapembed_p_get_markers_by_map_id', array( $this, 'p_get_markers_by_map_id' ) );
95
+ add_action( 'wp_ajax_nopriv_wpgmapembed_p_get_markers_by_map_id', array( $this, 'p_get_markers_by_map_id' ) );
96
+ add_action( 'wp_ajax_wgm_get_markers_by_map_id', array( $this, 'wgm_get_markers_by_map_id_for_dt' ) );
97
+ add_action( 'wp_ajax_wpgmapembed_delete_marker', array( $this, 'delete_marker' ) );
98
+ add_action( 'wp_ajax_wpgmapembed_get_marker_data_by_marker_id', array( $this, 'get_marker_data_by_marker_id' ) );
99
+ }
100
+
101
+ public function load_dependencies() {
102
+ // Define Shortcode.
103
+ require_once WGM_PLUGIN_PATH . '/public/includes/shortcodes.php';
104
+ }
105
+
106
+ public function register_widget() {
107
+ register_widget( 'WGMSRM\\Classes\\srmgmap_widget' );
108
+ }
109
+ }
includes/Classes/Database.php CHANGED
@@ -1,35 +1,31 @@
1
  <?php
2
 
3
  namespace WGMSRM\Classes;
4
- class Database
5
- {
6
- private $_version = '1.0';
7
 
8
- public function __construct()
9
- {
10
- $existing_db_version = get_option('_wgm_db_version', 'none');
11
- if ($existing_db_version == 'none') {
12
- $this->install();
13
- } else {
14
- // do code for update or modify table or db structure
15
- }
16
- }
17
 
18
- public function install()
19
- {
20
- $this->createMarkersTable();
21
- $this->createMarkersIconTable();
22
- update_option('_wgm_db_version', $this->_version);
23
- }
24
 
25
- public function createMarkersTable()
26
- {
27
- global $wpdb;
28
- $charset_collate = $wpdb->get_charset_collate();
29
- if (!function_exists('dbDelta')) {
30
- require_once ABSPATH . 'wp-admin/includes/upgrade.php';
31
- }
32
- $schema = "CREATE TABLE `{$wpdb->prefix}wgm_markers` (
 
 
 
 
 
 
 
 
 
 
 
 
33
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
34
  `map_id` int(11) NOT NULL,
35
  `marker_name` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
@@ -47,18 +43,16 @@ class Database
47
  `updated_by` bigint(20) unsigned NOT NULL,
48
  PRIMARY KEY (`id`)
49
  ) $charset_collate";
50
- //\dbDelta($schema);
51
- maybe_create_table($wpdb->prefix.'wgm_markers',$schema);
52
- }
53
 
54
- public function createMarkersIconTable()
55
- {
56
- global $wpdb;
57
- $charset_collate = $wpdb->get_charset_collate();
58
- if (!function_exists('dbDelta')) {
59
- require_once ABSPATH . 'wp-admin/includes/upgrade.php';
60
- }
61
- $schema = "CREATE TABLE `{$wpdb->prefix}wgm_icons` (
62
  `id` int(11) NOT NULL AUTO_INCREMENT,
63
  `type` varchar(100) DEFAULT NULL,
64
  `title` varchar(500) DEFAULT NULL,
@@ -66,7 +60,6 @@ class Database
66
  `file_name` varchar(500) DEFAULT NULL,
67
  PRIMARY KEY (`id`)
68
  ) $charset_collate";
69
- // \dbDelta($schema);
70
- maybe_create_table($wpdb->prefix.'wgm_icons',$schema);
71
- }
72
- }
1
  <?php
2
 
3
  namespace WGMSRM\Classes;
 
 
 
4
 
5
+ class Database {
 
 
 
 
 
 
 
 
6
 
7
+ private $_version = '1.0';
 
 
 
 
 
8
 
9
+ public function __construct() {
10
+ $existing_db_version = esc_html( get_option( '_wgm_db_version', 'none' ) );
11
+ if ( $existing_db_version === 'none' ) {
12
+ $this->install();
13
+ }
14
+ }
15
+
16
+ public function install() {
17
+ $this->createMarkersTable();
18
+ $this->createMarkersIconTable();
19
+ update_option( '_wgm_db_version', $this->_version );
20
+ }
21
+
22
+ public function createMarkersTable() {
23
+ global $wpdb;
24
+ $charset_collate = $wpdb->get_charset_collate();
25
+ if ( ! function_exists( 'dbDelta' ) ) {
26
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
27
+ }
28
+ $schema = "CREATE TABLE `{$wpdb->prefix}wgm_markers` (
29
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
30
  `map_id` int(11) NOT NULL,
31
  `marker_name` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
43
  `updated_by` bigint(20) unsigned NOT NULL,
44
  PRIMARY KEY (`id`)
45
  ) $charset_collate";
46
+ maybe_create_table( $wpdb->prefix . 'wgm_markers', $schema );
47
+ }
 
48
 
49
+ public function createMarkersIconTable() {
50
+ global $wpdb;
51
+ $charset_collate = $wpdb->get_charset_collate();
52
+ if ( ! function_exists( 'dbDelta' ) ) {
53
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
54
+ }
55
+ $schema = "CREATE TABLE `{$wpdb->prefix}wgm_icons` (
 
56
  `id` int(11) NOT NULL AUTO_INCREMENT,
57
  `type` varchar(100) DEFAULT NULL,
58
  `title` varchar(500) DEFAULT NULL,
60
  `file_name` varchar(500) DEFAULT NULL,
61
  PRIMARY KEY (`id`)
62
  ) $charset_collate";
63
+ maybe_create_table( $wpdb->prefix . 'wgm_icons', $schema );
64
+ }
65
+ }
 
includes/Classes/Migration.php CHANGED
@@ -4,130 +4,125 @@ namespace WGMSRM\Classes;
4
 
5
  use WP_Query;
6
 
7
- class Migration
8
- {
9
- private $_multiple_marker_migration;
10
- private $_p_v_m;
11
 
12
- public function __construct()
13
- {
14
- $this->_multiple_marker_migration = get_option('_wgm_migration_multiple_marker');
15
- $this->_p_v_m = get_option('_wgm_p_v_migration');
16
- $this->runMigration();
17
- }
18
 
19
- public function runMigration()
20
- {
21
- /*Multiple marker migration*/
22
- if ($this->_multiple_marker_migration !== 'Y') {
23
- $this->doMultipleMarkerMigration();
24
- update_option('_wgm_migration_multiple_marker', 'Y');
25
- }
26
- if ($this->_p_v_m !== 'Y') {
27
- $this->doPVM();
28
- update_option('_wgm_p_v_migration', 'Y');
29
- }
30
- }
31
 
32
- public function doMultipleMarkerMigration()
33
- {
34
- global $wpdb;
35
- $args = array(
36
- 'post_type' => 'wpgmapembed',
37
- 'posts_per_page' => -1,
38
- 'post_status' => 'draft'
39
- );
 
 
 
40
 
41
- $mapsList = new WP_Query($args);
42
- while ($mapsList->have_posts()) {
43
- $mapsList->the_post();
44
- $map_id = get_the_ID();
45
- $map_marker_data = array(
46
- 'map_id' => $map_id,
47
- 'marker_desc' => get_post_meta(get_the_ID(), 'wpgmap_map_address', true),
48
- 'icon' => strlen(trim(get_post_meta(get_the_ID(), 'wpgmap_marker_icon', true))) > 0 ? get_post_meta(get_the_ID(), 'wpgmap_marker_icon', true) : 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png',
49
- 'address' => strip_tags(html_entity_decode(get_post_meta(get_the_ID(), 'wpgmap_map_address', true))),
50
- 'lat_lng' => get_post_meta(get_the_ID(), 'wpgmap_latlng', true),
51
- 'show_desc_by_default' => get_post_meta(get_the_ID(), 'wpgmap_show_infowindow', true)
52
- );
53
 
54
- $defaults = [
55
- 'map_id' => 0,
56
- 'marker_name' => null,
57
- 'marker_desc' => null,
58
- 'icon' => null,
59
- 'address' => null,
60
- 'lat_lng' => null,
61
- 'have_marker_link' => 0,
62
- 'marker_link' => null,
63
- 'marker_link_new_tab' => 0,
64
- 'show_desc_by_default' => 0,
65
- 'created_at' => current_time('mysql'),
66
- 'created_by' => get_current_user_id(),
67
- 'updated_at' => current_time('mysql'),
68
- 'updated_by' => get_current_user_id()
69
- ];
70
- $wp_gmap_marker_data = wp_parse_args($map_marker_data, $defaults);
71
- $is_marker_already_exist = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'",$map_id));
72
- if ($is_marker_already_exist == 0) {
73
- $wpdb->insert(
74
- $wpdb->prefix . 'wgm_markers',
75
- $wp_gmap_marker_data,
76
- [
77
- '%d',
78
- '%s',
79
- '%s',
80
- '%s',
81
- '%s',
82
- '%s',
83
- '%d',
84
- '%s',
85
- '%d',
86
- '%d',
87
- '%s',
88
- '%d',
89
- '%s',
90
- '%d'
91
- ]
92
- );
93
- }
94
 
95
- // Migrate corresponding marker icons
96
- $map_icon_data = array(
97
- 'file_name' => $map_marker_data['icon']
98
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
- $is_marker_icon_already_exist = $wpdb->get_var($wpdb->prepare("SELECT COUNT(id) FROM {$wpdb->prefix}wgm_icons WHERE file_name='%s'",$map_marker_data['icon']));
101
- if ($is_marker_icon_already_exist == 0) {
102
- $defaults = array(
103
- 'type' => 'uploaded_marker_icon',
104
- 'title' => '',
105
- 'desc' => '',
106
- 'file_name' => ''
107
- );
108
- $wp_gmap_marker_icon = wp_parse_args($map_icon_data, $defaults);
109
- $wpdb->insert(
110
- $wpdb->prefix . 'wgm_icons',
111
- $wp_gmap_marker_icon,
112
- array(
113
- '%s',
114
- '%s',
115
- '%s',
116
- '%s'
117
- )
118
- );
119
- }
120
- }
121
- }
122
 
123
- public function doPVM()
124
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
 
126
- $status = (gmap_embed_no_of_post() > 1 or strlen(trim(get_option('wpgmapembed_license'))) == 32);
127
- if ($status) {
128
- update_option('_wgm_is_p_v', 'Y');
129
- } else {
130
- update_option('_wgm_is_p_v', 'N');
131
- }
132
- }
133
- }
 
4
 
5
  use WP_Query;
6
 
7
+ class Migration {
 
 
 
8
 
9
+ private $_multiple_marker_migration;
10
+ private $_p_v_m;
 
 
 
 
11
 
12
+ public function __construct() {
13
+ $this->_multiple_marker_migration = esc_html( get_option( '_wgm_migration_multiple_marker' ) );
14
+ $this->_p_v_m = esc_html( get_option( '_wgm_p_v_migration' ) );
15
+ $this->run_migration();
16
+ }
 
 
 
 
 
 
 
17
 
18
+ public function run_migration() {
19
+ /*Multiple marker migration*/
20
+ if ( $this->_multiple_marker_migration !== 'Y' ) {
21
+ $this->do_multiple_marker_migration();
22
+ update_option( '_wgm_migration_multiple_marker', 'Y' );
23
+ }
24
+ if ( $this->_p_v_m !== 'Y' ) {
25
+ $this->do_p_v_m();
26
+ update_option( '_wgm_p_v_migration', 'Y' );
27
+ }
28
+ }
29
 
30
+ public function do_multiple_marker_migration() {
31
+ global $wpdb;
32
+ $args = array(
33
+ 'post_type' => 'wpgmapembed',
34
+ 'posts_per_page' => -1,
35
+ 'post_status' => 'draft',
36
+ );
 
 
 
 
 
37
 
38
+ $maps_list = new WP_Query( $args );
39
+ while ( $maps_list->have_posts() ) {
40
+ $maps_list->the_post();
41
+ $map_id = intval( get_the_ID() );
42
+ $map_marker_data = array(
43
+ 'map_id' => $map_id,
44
+ 'marker_desc' => get_post_meta( $map_id, 'wpgmap_map_address', true ),
45
+ 'icon' => strlen( trim( get_post_meta( $map_id, 'wpgmap_marker_icon', true ) ) ) > 0 ? get_post_meta( $map_id, 'wpgmap_marker_icon', true ) : esc_url( 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png' ),
46
+ 'address' => wp_strip_all_tags( html_entity_decode( get_post_meta( $map_id, 'wpgmap_map_address', true ) ) ),
47
+ 'lat_lng' => get_post_meta( $map_id, 'wpgmap_latlng', true ),
48
+ 'show_desc_by_default' => get_post_meta( $map_id, 'wpgmap_show_infowindow', true ),
49
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
+ $defaults = array(
52
+ 'map_id' => 0,
53
+ 'marker_name' => null,
54
+ 'marker_desc' => null,
55
+ 'icon' => null,
56
+ 'address' => null,
57
+ 'lat_lng' => null,
58
+ 'have_marker_link' => 0,
59
+ 'marker_link' => null,
60
+ 'marker_link_new_tab' => 0,
61
+ 'show_desc_by_default' => 0,
62
+ 'created_at' => current_time( 'mysql' ),
63
+ 'created_by' => get_current_user_id(),
64
+ 'updated_at' => current_time( 'mysql' ),
65
+ 'updated_by' => get_current_user_id(),
66
+ );
67
+ $wp_gmap_marker_data = wp_parse_args( $map_marker_data, $defaults );
68
+ $is_marker_already_exist = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", intval( $map_id ) ) );
69
+ if ( $is_marker_already_exist == 0 ) {
70
+ $wpdb->insert(
71
+ $wpdb->prefix . 'wgm_markers',
72
+ $wp_gmap_marker_data,
73
+ array(
74
+ '%d',
75
+ '%s',
76
+ '%s',
77
+ '%s',
78
+ '%s',
79
+ '%s',
80
+ '%d',
81
+ '%s',
82
+ '%d',
83
+ '%d',
84
+ '%s',
85
+ '%d',
86
+ '%s',
87
+ '%d',
88
+ )
89
+ );
90
+ }
91
 
92
+ // Migrate corresponding marker icons
93
+ $map_icon_data = array(
94
+ 'file_name' => esc_url( $map_marker_data['icon'] ),
95
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ $is_marker_icon_already_exist = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$wpdb->prefix}wgm_icons WHERE file_name='%s'", esc_url( $map_marker_data['icon'] ) ) );
98
+ if ( $is_marker_icon_already_exist == 0 ) {
99
+ $defaults = array(
100
+ 'type' => 'uploaded_marker_icon',
101
+ 'title' => '',
102
+ 'desc' => '',
103
+ 'file_name' => '',
104
+ );
105
+ $wp_gmap_marker_icon = wp_parse_args( $map_icon_data, $defaults );
106
+ $wpdb->insert(
107
+ $wpdb->prefix . 'wgm_icons',
108
+ $wp_gmap_marker_icon,
109
+ array(
110
+ '%s',
111
+ '%s',
112
+ '%s',
113
+ '%s',
114
+ )
115
+ );
116
+ }
117
+ }
118
+ }
119
 
120
+ public function do_p_v_m() {
121
+ $status = ( gmap_embed_no_of_post() > 1 || strlen( trim( esc_html( get_option( 'wpgmapembed_license' ) ) ) ) === 32 );
122
+ if ( $status ) {
123
+ update_option( '_wgm_is_p_v', 'Y' );
124
+ } else {
125
+ update_option( '_wgm_is_p_v', 'N' );
126
+ }
127
+ }
128
+ }
includes/Classes/srmgmap_widget.php CHANGED
@@ -1,110 +1,136 @@
1
  <?php
2
 
3
  namespace WGMSRM\Classes;
 
4
  use WP_Query;
5
  use WP_Widget;
6
 
7
- if (!defined('ABSPATH')) exit;
 
 
8
 
9
  /**
10
  * Creating widget for WP Google Map
11
  */
12
- class srmgmap_widget extends WP_Widget
13
- {
14
-
15
- public $base_id = 'srmgmap_widget'; //widget id
16
- public $widget_name = 'WP Google Map'; //widget name
17
- public $widget_options = array(
18
- 'description' => 'Embed Google Map for your website' //widget description
19
- );
20
-
21
- public function __construct()
22
- {
23
- parent::__construct(
24
- $this->base_id,
25
- $this->widget_name,
26
- $this->widget_options
27
- );
28
-
29
- add_action('widgets_init', function () {
30
- register_widget('WGMSRM\\Classes\\srmgmap_widget');
31
- });
32
- }
33
-
34
- // Map display in front
35
- public function widget($args, $instance)
36
- {
37
- $title = apply_filters('widget_title', $instance['title']);
38
-
39
- extract($args);
40
- extract($instance);
41
- echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities($before_widget))));
42
- if (!empty($title)) {
43
- echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities($before_title . $title . $after_title))));
44
- }
45
- echo do_shortcode($instance['srmgmap_shortcode']);
46
- echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities($after_widget))));
47
- }
48
-
49
- /**
50
- * Google Map Widget
51
- * @return String $instance
52
- */
53
- public function form($instance)
54
- {
55
- $title = !empty($instance['title']) ? wp_unslash(html_entity_decode(sanitize_text_field(htmlentities(__($instance['title']))))) : wp_unslash(html_entity_decode(sanitize_text_field(htmlentities(__('', 'text_domain')))));
56
- $map_shortcodes_list = '';
57
- $args = array(
58
- 'post_type' => 'wpgmapembed',
59
- 'posts_per_page' => -1,
60
- 'post_status' => 'draft'
61
- );
62
- $mapsList = new WP_Query($args);
63
-
64
- if ($mapsList->have_posts()) {
65
- while ($mapsList->have_posts()) {
66
- $mapsList->the_post();
67
- $gmap_title = get_post_meta(get_the_ID(), 'wpgmap_title', true);
68
- if ($gmap_title == '') {
69
- $gmap_title = 'No title';
70
- }
71
- $option_value = esc_attr('[gmap-embed id=&quot;' . get_the_ID() . '&quot;]');
72
- $selected = '';
73
- if (isset($instance['srmgmap_shortcode']) and $instance['srmgmap_shortcode'] == html_entity_decode($option_value)) {
74
- $selected = 'selected';
75
- }
76
- $map_shortcodes_list .= '<option value="' . $option_value . '" ' . $selected . '>' . $gmap_title . ' ' . esc_attr('[gmap-embed id=&quot;' . get_the_ID() . '&quot;]') . '</option>';
77
- }
78
- }
79
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  <p>
81
- <label for="<?php echo esc_attr($this->get_field_id('title')); ?>">Title: </label>
82
  </p>
83
  <p>
84
- <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>"
85
- name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text"
86
- value="<?php echo esc_attr($title); ?>"/>
87
  </p>
88
  <p>
89
- <label for="<?php echo esc_attr($this->get_field_id('srmgmap_shortcode')); ?>"> Select Google Map
90
  Shortcode:</label><br/>
91
  </p>
92
  <p>
93
- <select id="<?php echo esc_attr($this->get_field_id('srmgmap_shortcode')); ?>"
94
- name="<?php echo esc_attr($this->get_field_name('srmgmap_shortcode')); ?>" class="widefat">
95
- <?php echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities($map_shortcodes_list)))); ?>
 
 
 
 
 
 
96
  </select>
97
  </p>
98
 
99
- <?php
100
- }
 
 
 
 
 
101
 
102
- public function update($new_instance, $old_instance)
103
- {
104
- $instance = array();
105
- $instance['title'] = (!empty($new_instance['title'])) ? esc_html(strip_tags($new_instance['title'])): '';
106
- $instance['srmgmap_shortcode'] = (!empty($new_instance['srmgmap_shortcode'])) ? $new_instance['srmgmap_shortcode'] : '';
107
- return $instance;
108
- }
109
 
110
  }
1
  <?php
2
 
3
  namespace WGMSRM\Classes;
4
+
5
  use WP_Query;
6
  use WP_Widget;
7
 
8
+ if ( ! defined( 'ABSPATH' ) ) {
9
+ exit;
10
+ }
11
 
12
  /**
13
  * Creating widget for WP Google Map
14
  */
15
+ class srmgmap_widget extends WP_Widget {
16
+
17
+
18
+ public $base_id = 'srmgmap_widget';
19
+ public $widget_name = 'WP Google Map';
20
+ public $widget_options = array(
21
+ 'description' => 'Embed Google Map for your website', // widget description
22
+ );
23
+
24
+ public function __construct() {
25
+ parent::__construct(
26
+ $this->base_id,
27
+ $this->widget_name,
28
+ $this->widget_options
29
+ );
30
+
31
+ add_action(
32
+ 'widgets_init',
33
+ function () {
34
+ register_widget( 'WGMSRM\\Classes\\srmgmap_widget' );
35
+ }
36
+ );
37
+ }
38
+
39
+ // Map display in front
40
+ public function widget( $args, $instance ) {
41
+ $title = apply_filters( 'widget_title', $instance['title'] );
42
+
43
+ extract( $args );
44
+ extract( $instance );
45
+ $allowed_html = [
46
+ 'div' => [
47
+ 'class' => [],
48
+ 'id'=>[]
49
+ ],
50
+ 'section'=>[
51
+ 'class' => [],
52
+ 'id'=>[]
53
+ ],
54
+ 'h1' => [
55
+ 'class' => []
56
+ ],
57
+ 'h4' => [
58
+ 'class' => []
59
+ ],
60
+ ];
61
+ echo wp_kses( wp_unslash( $before_widget),$allowed_html);
62
+ if ( ! empty( $title ) ) {
63
+ echo wp_kses( wp_unslash($before_title . esc_html( $title ) . $after_title), $allowed_html );
64
+ }
65
+ echo do_shortcode( $instance['srmgmap_shortcode'] );
66
+ echo wp_kses( wp_unslash( $after_widget ), $allowed_html );
67
+ }
68
+
69
+ /**
70
+ * Google Map Widget
71
+ *
72
+ * @return String $instance
73
+ */
74
+ public function form( $instance ) {
75
+ $title = ! empty( $instance['title'] ) ? esc_html( $instance['title'] ) : '';
76
+ $map_shortcodes_list = '';
77
+ $args = array(
78
+ 'post_type' => 'wpgmapembed',
79
+ 'posts_per_page' => - 1,
80
+ 'post_status' => 'draft',
81
+ );
82
+ $maps_list = new WP_Query( $args );
83
+
84
+ if ( $maps_list->have_posts() ) {
85
+ while ( $maps_list->have_posts() ) {
86
+ $maps_list->the_post();
87
+ $gmap_title = get_post_meta( get_the_ID(), 'wpgmap_title', true );
88
+ if ( $gmap_title === '' ) {
89
+ $gmap_title = 'No title';
90
+ }
91
+ $option_value = '[gmap-embed id=&quot;' . get_the_ID() . '&quot;]';
92
+ $selected = '';
93
+ if ( isset( $instance['srmgmap_shortcode'] ) && $instance['srmgmap_shortcode'] == html_entity_decode( $option_value ) ) {
94
+ $selected = 'selected';
95
+ }
96
+ $map_shortcodes_list .= '<option value="' . esc_attr( $option_value ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $gmap_title ) . ' ' . '[gmap-embed id=&quot;' . get_the_ID() . '&quot;]' . '</option>';
97
+ }
98
+ }
99
+ ?>
100
  <p>
101
+ <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">Title: </label>
102
  </p>
103
  <p>
104
+ <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
105
+ name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text"
106
+ value="<?php echo esc_attr( $title ); ?>"/>
107
  </p>
108
  <p>
109
+ <label for="<?php echo esc_attr( $this->get_field_id( 'srmgmap_shortcode' ) ); ?>"> Select Google Map
110
  Shortcode:</label><br/>
111
  </p>
112
  <p>
113
+ <select id="<?php echo esc_attr( $this->get_field_id( 'srmgmap_shortcode' ) ); ?>"
114
+ name="<?php echo esc_attr( $this->get_field_name( 'srmgmap_shortcode' ) ); ?>" class="widefat">
115
+ <?php
116
+ $allowed_html = [
117
+ 'option' => [
118
+ 'value' => []
119
+ ],
120
+ ];
121
+ echo wp_kses(wp_unslash($map_shortcodes_list),$allowed_html); ?>
122
  </select>
123
  </p>
124
 
125
+ <?php
126
+ }
127
+
128
+ public function update( $new_instance, $old_instance ) {
129
+ $instance = array();
130
+ $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? esc_html( $new_instance['title'] ) : '';
131
+ $instance['srmgmap_shortcode'] = ( ! empty( $new_instance['srmgmap_shortcode'] ) ) ? $new_instance['srmgmap_shortcode'] : '';
132
 
133
+ return $instance;
134
+ }
 
 
 
 
 
135
 
136
  }
includes/Traits/ActionLinks.php DELETED
@@ -1,29 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait ActionLinks: for plugins list action links viewing
8
- */
9
- trait ActionLinks
10
- {
11
- /**
12
- * Adding Upgrade to pro, rate us and support link
13
- * @param $actions
14
- * @return mixed
15
- */
16
- function gmap_srm_settings_link($actions)
17
- {
18
- $links = array();
19
- if (!_wgm_is_premium()) {
20
- $links['upgrade-to-pro'] = '<a target="_blank" style="color: #11967A;font-weight:bold;" href="' . esc_url('https://srmilon.info/pricing?utm_source=admin_plugins&utm_medium=admin_link&utm_campaign=plugin_action_link') . '">' . __('Upgrade To Pro ($10 only)') . '</a>';
21
- }
22
- $links['rate-us'] = '<a target="_blank" href="' . esc_url('https://wordpress.org/support/plugin/gmap-embed/reviews/#new-post') . '">' . __('Rate Us') . '</a>';
23
- $links['support'] = '<a target="_blank" href="' . esc_url('https://wordpress.org/support/plugin/gmap-embed/#new-topic-0') . '">' . __('Support') . '</a>';
24
- $links['settings'] = '<a href="' .
25
- admin_url('admin.php?page=wpgmapembed-settings') .
26
- '">' . __('Settings') . '</a>';
27
- return array_merge($links, $actions);
28
- }
29
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/ActivationHooks.php DELETED
@@ -1,28 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait ActivationHooks: Do something on plugin activation
8
- */
9
- trait ActivationHooks
10
- {
11
- /**
12
- * Do after activation
13
- * @param $plugin
14
- * @param $network_activation
15
- */
16
- function wpgmap_do_after_activation($plugin, $network_activation)
17
- {
18
- // In case of existing installation
19
- if (get_option('gmap_embed_activation_time', false) == false) {
20
- update_option('gmap_embed_activation_time', time());
21
- }
22
-
23
- if ($plugin == 'gmap-embed/srm_gmap_embed.php') {
24
- wp_redirect(admin_url('admin.php?page=wgm_setup_wizard'));
25
- exit;
26
- }
27
- }
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/AdminInitActions.php DELETED
@@ -1,18 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
-
5
- use WGMSRM\Classes\Migration;
6
-
7
- if (!defined('ABSPATH')) exit;
8
-
9
- /**
10
- * Trait InitActions: Init action hooks defined here
11
- */
12
- trait AdminInitActions
13
- {
14
- public function do_admin_init_actions()
15
- {
16
- //new Migration();
17
- }
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/AssetHandler.php DELETED
@@ -1,193 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait AssetHandler: enqueue, dequeue assets
8
- */
9
- trait AssetHandler
10
- {
11
-
12
- /**
13
- * @return array
14
- */
15
- public function getLocalizedScripts()
16
- {
17
- // Setup wizard validation data
18
- $wpgmap_setup_validation_data = array(
19
- 'apikey' => __('Please enter a valid API key', 'gmap-embed'),
20
- 'language' => __('Please select a language', 'gmap-embed'),
21
- 'regionalarea' => __('Please select a regional area', 'gmap-embed'),
22
- 'licencekey' => __('Invalid license key', 'gmap-embed'),
23
- 'success' => __('Successfully installed.', 'gmap-embed'),
24
- 'failed_to_finish' => __('Something went wrong, please reload and try again', 'gmap-embed')
25
- );
26
-
27
- // Setup wizard get api key modal content
28
- $wpgmap_setup_api_key_modal_data = array(
29
- 'faq_title' => __('Help Manual', 'gmap-embed'),
30
- 'faq_item_title' => __(' Click here to see Help Manual on how to get API key', 'gmap-embed'),
31
- 'faq_item_url' => esc_url('https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=setup_wizard'),
32
- 'video_title' => __('Video Tutorial', 'gmap-embed'),
33
- 'video_url' => esc_url('//www.youtube.com/embed/m-jAsxG0zuk'),
34
- 'api_key_title' => __('Get API Key', 'gmap-embed'),
35
- 'api_key_url' => esc_url('//console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend,directions_backend&keyType=CLIENT_SIDE&reusekey=true'),
36
- );
37
-
38
- //what we collect modal content
39
- $wgm_wwc_msg = array(
40
- 'title' => __('What we collect?', 'gmap-embed'),
41
- 'desc' => __('We collect non-sensitive diagnostic data and plugin usage information. Your site URL, WordPress & PHP version, plugins & themes and email address to send you the discount coupon. This data lets us make sure this plugin always stays compatible with the most popular plugins and themes. No spam, we promise.', 'gmap-embed')
42
- );
43
- $locales = array(
44
- 'dt' => array(
45
- 'no_map_created' => __('No map created yet, please click on Add New to create your map.', 'gmap-embed'),
46
- 'no_marker_created' => __('No marker created yet.', 'gmap-embed'),
47
- ),
48
- 'sweet_alert' => array(
49
- 'oops' => __('Opps...', 'gmap-embed'),
50
- 'notice_unlimited_maps' => sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to create <b>Unlimited Maps</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_crud&utm_medium=admin_link&utm_campaign=add_new_map')),
51
- 'notice_unlimited_marker' => sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to create <b>Unlimited Markers</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_crud&utm_medium=admin_link&utm_campaign=add_new_marker')),
52
- 'notice_to_use_feature' => sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to use <b>this feature</b>.', 'gmap-embed'), esc_url('https://srmilon.info/pricing?utm_source=admin_map_crud&utm_medium=admin_link&utm_campaign=new_feature_popup')),
53
- )
54
- );
55
-
56
- $wgm_localized = array(
57
- // Common data
58
- 'is_premium_user' => _wgm_is_premium(),
59
- 'get_p_v_url' => esc_url('https://srmilon.info/pricing?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=get_license'),
60
- 'site_url' => site_url(),
61
- 'setup_wizard' => array(
62
- 'setup_validation_msg' => $wpgmap_setup_validation_data,
63
- 'setup_api_key_modal' => $wpgmap_setup_api_key_modal_data,
64
- 'wgm_wwc_msg' => $wgm_wwc_msg
65
- ),
66
- 'locales' => $locales,
67
- 'ajax_nonce' => wp_create_nonce('ajax_nonce'),
68
- 'c_s_nonce' => wp_create_nonce('c_s_nonce'),
69
- );
70
-
71
- if (isset($_GET['tag']) and sanitize_text_field(esc_html($_GET['tag'])) == 'edit') {
72
-
73
- $map_id = isset($_GET['id']) ? intval(sanitize_text_field(esc_html($_GET['id']))) : 0;
74
- $current_map_marker_lat_lng = explode(',', get_post_meta($map_id, 'wpgmap_latlng', true));
75
- $current_map_marker_lat = isset($current_map_marker_lat_lng[0]) ? $current_map_marker_lat_lng[0] : 40.73359922990751;
76
- $current_map_marker_lng = isset($current_map_marker_lat_lng[1]) ? $current_map_marker_lat_lng[1] : -74.02791395625002;
77
- $wgm_object = array(
78
- 'current_map_marker_lat' => $current_map_marker_lat,
79
- 'current_map_marker_lng' => $current_map_marker_lng,
80
- 'map_id' => $map_id
81
- );
82
- $wgm_localized['wgm_object'] = $wgm_object;
83
- }
84
- return $wgm_localized;
85
- }
86
-
87
- public function getPluginStatus()
88
- {
89
- // API status variable ->debugging purpose
90
- return json_encode(array(
91
- 'l_api' => get_option('_wgm_load_map_api_condition', 'always'),
92
- 'p_api' => get_option('_wgm_prevent_other_plugin_theme_api_load', 'N'),
93
- 'i_p' => _wgm_is_premium(),
94
- 'd_f_s_c' => get_option('_wgm_disable_full_screen_control', 'N'),
95
- 'd_s_v' => get_option('_wgm_disable_street_view', 'N'),
96
- 'd_z_c' => get_option('_wgm_disable_zoom_control', 'N'),
97
- 'd_p_c' => get_option('_wgm_disable_pan_control', 'N'),
98
- 'd_m_t_c' => get_option('_wgm_disable_map_type_control', 'N'),
99
- 'd_m_w_z' => get_option('_wgm_disable_mouse_wheel_zoom', 'N'),
100
- 'd_m_d' => get_option('_wgm_disable_mouse_dragging', 'N'),
101
- 'd_m_d_c_z' => get_option('_wgm_disable_mouse_double_click_zooming', 'N'),
102
- ));
103
- }
104
-
105
- /**
106
- * Register common scripts
107
- */
108
- private function registerCommonScripts()
109
- {
110
- $srm_gmap_lng = get_option('srm_gmap_lng', 'en');
111
- $srm_gmap_region = get_option('srm_gmap_region', 'US');
112
- wp_register_script('wp-gmap-api', 'https://maps.google.com/maps/api/js?key=' . $this->wpgmap_api_key . '&libraries=places&language=' . $srm_gmap_lng . '&region=' . $srm_gmap_region, array('jquery'));
113
- }
114
-
115
- /**
116
- * To enqueue CSS & JS for frontend
117
- */
118
- public function gmap_front_enqueue_scripts()
119
- {
120
- # Register common scripts (includes: google maps api)
121
- $this->registerCommonScripts();
122
-
123
- # Based on user defined condition, enqueue Google Map API script
124
- if (in_array(get_option('_wgm_load_map_api_condition', 'always'), ['where-required', 'always', 'only-front-end'])) {
125
- wp_enqueue_script('wp-gmap-api');
126
- }
127
-
128
- # Custom JS script and Plugin status including
129
- $wgm_settings_status = $this->getPluginStatus();
130
- $custom_js_scripts = get_option('wpgmap_s_custom_js');
131
- $custom_js_scripts .= "\nvar wgm_status = $wgm_settings_status;";
132
- wp_add_inline_script('wp-gmap-api', $custom_js_scripts);
133
-
134
- # Custom CSS style including
135
- wp_enqueue_style('wp-gmap-embed-front-css', WGM_PLUGIN_URL . 'public/assets/css/front_custom_style.css', array(), filemtime(WGM_PLUGIN_PATH . 'public/assets/css/front_custom_style.css'));
136
- $custom_css_styles = get_option('wpgmap_s_custom_css');
137
- if (strlen($custom_css_styles) != 0) {
138
- wp_add_inline_style('wp-gmap-embed-front-css', "$custom_css_styles");
139
- }
140
- }
141
-
142
- /**
143
- * To enqueue scripts for admin-panel
144
- */
145
- function enqueue_admin_gmap_scripts()
146
- {
147
- $page = isset($_GET['page']) ? sanitize_text_field(esc_html($_GET['page'])) : '';
148
- global $pagenow;
149
- if ($pagenow == 'post.php' || $pagenow == 'post-new.php' || ($page == 'wpgmapembed' or $page == 'wpgmapembed-settings' or $page == 'wpgmapembed-new' or $page == 'wgm_setup_wizard' or $page == 'wpgmapembed-support')) {
150
-
151
- // Registering common scripts (Included: Google API)
152
- $this->registerCommonScripts();
153
-
154
- // Including Google Map API for only New Map and Edit Map page
155
- if (in_array(get_option('_wgm_load_map_api_condition', 'always'), ['where-required', 'always', 'only-backend-end']) && ($page == 'wpgmapembed' or $page == 'wpgmapembed-new')) {
156
- wp_enqueue_script('wp-gmap-api');
157
- }
158
-
159
- /** Common assets */
160
- wp_enqueue_script('wp-gmap-common-js', WGM_PLUGIN_URL . 'admin/assets/js/common.js', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/js/common.js'), false);
161
- $wgm_localized = $this->getLocalizedScripts();
162
- wp_localize_script('wp-gmap-common-js', 'wgm_l', $wgm_localized);
163
- wp_enqueue_style('wp-gmap-embed-css', WGM_PLUGIN_URL . 'admin/assets/css/wp-gmap-style.css', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/css/wp-gmap-style.css'));
164
- # Font awesome
165
- wp_enqueue_style('wp-gmap-fontawasome-css', WGM_PLUGIN_URL . 'admin/assets/third-party/font-awesome/5/css/font-awesome.css', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/third-party/font-awesome/5/css/font-awesome.css'));
166
- # Sweet alert related
167
- wp_enqueue_style('wp-gmap-sweetalert2-css', WGM_PLUGIN_URL . 'admin/assets/third-party/sweetalert2/css/sweetalert2.min.css', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/third-party/sweetalert2/css/sweetalert2.min.css'));
168
- wp_enqueue_script('wp-gmap-sweetalert2-js', WGM_PLUGIN_URL . 'admin/assets/third-party/sweetalert2/js/sweetalert2.min.js', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/third-party/sweetalert2/js/sweetalert2.min.js'), true);
169
- # Media upload
170
- wp_enqueue_script('media-upload');
171
- wp_enqueue_script('thickbox');
172
- wp_enqueue_script('wpgmap-media-upload');
173
- wp_enqueue_media();
174
- wp_enqueue_style('thickbox');
175
-
176
-
177
- /** Edit and Add Map page */
178
- if ($pagenow == 'post.php' || $pagenow == 'post-new.php' || ($page == 'wpgmapembed' or $page == 'wpgmapembed-new')) {
179
- wp_enqueue_script('wgm-map-curd-js', WGM_PLUGIN_URL . 'admin/assets/js/wgm_map_crud.js', array('wp-gmap-common-js'), filemtime(WGM_PLUGIN_PATH . 'admin/assets/js/wgm_map_crud.js'), true);
180
- wp_enqueue_script('wp-gmap-markers-js', WGM_PLUGIN_URL . 'admin/assets/js/wgm_marker_crud.js', array('wp-gmap-common-js'), filemtime(WGM_PLUGIN_PATH . 'admin/assets/js/wgm_marker_crud.js'), true);
181
- # Datatable
182
- wp_enqueue_style('wgm-datatable-css', WGM_PLUGIN_URL . 'admin/assets/third-party/datatables/css/jquery.dataTables.min.css', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/third-party/datatables/css/jquery.dataTables.min.css'));
183
- wp_enqueue_script('wgm-datatable-js', WGM_PLUGIN_URL . 'admin/assets/third-party/datatables/js/jquery.dataTables.min.js', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/third-party/datatables/js/jquery.dataTables.min.js'), true);
184
- }
185
-
186
- /** Setup Wizard */
187
- if ($page == 'wgm_setup_wizard') {
188
- wp_enqueue_style('wp-gmap-setup-wizard-css', WGM_PLUGIN_URL . 'admin/assets/css/setup_wizard.css', array(), filemtime(WGM_PLUGIN_PATH . '/admin/assets/css/setup_wizard.css'));
189
- wp_enqueue_script('wp-gmap-setup-wizard-js', WGM_PLUGIN_URL . 'admin/assets/js/setup_wizard.js', array(), filemtime(WGM_PLUGIN_PATH . 'admin/assets/js/setup_wizard.js'), true);
190
- }
191
- }
192
- }
193
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/CommonFunctions.php DELETED
@@ -1,23 +0,0 @@
1
- <?php
2
- namespace WGMSRM\Traits;
3
- if ( ! defined( 'ABSPATH' ) ) exit;
4
- /**
5
- * Trait CommonFunctions
6
- */
7
- trait CommonFunctions
8
- {
9
- /**
10
- * Update post meta
11
- * @param $post_id
12
- * @param $field_name
13
- * @param string $value
14
- */
15
- public function __update_post_meta($post_id, $field_name, $value = '')
16
- {
17
- if (!get_post_meta($post_id, $field_name)) {
18
- add_post_meta($post_id, $field_name, $value);
19
- } else {
20
- update_post_meta($post_id, $field_name, $value);
21
- }
22
- }
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/Filters.php DELETED
@@ -1,27 +0,0 @@
1
- <?php
2
- namespace WGMSRM\Traits;
3
- if (!defined('ABSPATH')) exit;
4
-
5
- /**
6
- * Filters related to the plugin will be listed here
7
- */
8
- trait Filters
9
- {
10
- /**
11
- * In case of Google Map API loaded by other plugins or themes, it will prevent and load a blank script (Only removes by user consent)
12
- * @param $tag
13
- * @param $handle
14
- * @param $src
15
- * @return mixed|string
16
- * @since 1.7.5
17
- */
18
- public function doPreventOthersGoogleMapsTag($tag, $handle, $src)
19
- {
20
- if (preg_match('/maps\.google/i', $src)) {
21
- if ($handle !== 'wp-gmap-api') {
22
- return '';
23
- }
24
- }
25
- return $tag;
26
- }
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/InitActions.php DELETED
@@ -1,77 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- use WGMSRM\Classes\Migration;
5
-
6
- if (!defined('ABSPATH')) exit;
7
-
8
- /**
9
- * Trait InitActions: Init action hooks defined here
10
- */
11
- trait InitActions
12
- {
13
- /**
14
- * Loading text-domain
15
- *
16
- * @since 3.0.0
17
- */
18
- public function i18n()
19
- {
20
- load_plugin_textdomain('gmap-embed', false, dirname(plugin_basename(__FILE__)) . '/languages');
21
- }
22
-
23
- /**
24
- * Review system action link hooks
25
- * @since 1.7.1
26
- */
27
- public function reviewSystemHooks()
28
- {
29
- // Review system hooks
30
- add_action('gmap_embed_review_already_did', array($this, 'review_already_did'));
31
- add_action('gmap_embed_review_later', array($this, 'review_later'));
32
- if (isset($_GET['plugin'])) {
33
- $plugin = sanitize_text_field(esc_html($_GET['plugin']));
34
- if ($plugin === $this->plugin_slug) {
35
- if (isset($_GET['dismiss']) and sanitize_text_field(esc_html($_GET['dismiss'])) == 1) {
36
- do_action('gmap_embed_review_already_did');
37
- }
38
- if (isset($_GET['later']) and sanitize_text_field(esc_html($_GET['later'])) == 1) {
39
- do_action('gmap_embed_review_later');
40
- }
41
- wp_safe_redirect($this->redirect_to());
42
- exit;
43
- }
44
- }
45
- }
46
-
47
- /**
48
- * Doing some code in init hook
49
- * @since 1.7.1
50
- */
51
- public function do_init_actions()
52
- {
53
- $this->i18n();
54
- $this->reviewSystemHooks();
55
- $this->registerPostType();
56
- new Migration();
57
- }
58
-
59
- /**
60
- * Registering wpgmapembed post type
61
- * @since 1.7.1
62
- */
63
- public function registerPostType()
64
- {
65
- // Register Post Types
66
- register_post_type('wpgmapembed',
67
- array(
68
- 'labels' => array(
69
- 'name' => __('Google Maps'),
70
- 'singular_name' => __('Map'),
71
- ),
72
- 'public' => false,
73
- 'has_archive' => false,
74
- )
75
- );
76
- }
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/MapCRUD.php DELETED
@@ -1,269 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
-
5
- use WP_Query;
6
-
7
- if (!defined('ABSPATH')) exit;
8
-
9
- /**
10
- * Trait MapCRUD: Map CRUD operation doing here
11
- */
12
- trait MapCRUD
13
- {
14
- /**
15
- * Get all maps for datatable ajax request
16
- * @since 1.7.5
17
- */
18
- public function wgm_get_all_maps()
19
- {
20
- if (!current_user_can('administrator')) {
21
- echo json_encode(array(
22
- 'responseCode' => 0,
23
- 'message' => 'Unauthorized access tried.'
24
- ));
25
- wp_die();
26
- }
27
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_GET['ajax_nonce'])), 'ajax_nonce')) {
28
- die ('Busted!');
29
- }
30
- $args = array(
31
- 'post_type' => 'wpgmapembed',
32
- 'posts_per_page' => -1,
33
- 'post_status' => 'draft'
34
- );
35
-
36
- $return_json = array();
37
- $mapsList = new WP_Query($args);
38
- while ($mapsList->have_posts()) {
39
- $mapsList->the_post();
40
- $title = get_post_meta(get_the_ID(), 'wpgmap_title', true);
41
- $type = get_post_meta(get_the_ID(), 'wpgmap_map_type', true);
42
- $width = get_post_meta(get_the_ID(), 'wpgmap_map_width', true);
43
- $height = get_post_meta(get_the_ID(), 'wpgmap_map_height', true);
44
- $shortcode = '<input class="wpgmap-shortcode regular-text" style="width:100%!important;" type="text" value="' . esc_attr('[gmap-embed id=&quot;' . get_the_ID() . '&quot;]') . '"
45
- onclick="this.select()"/>';
46
- $action = '<a href="?page=wpgmapembed&tag=edit&id=' . get_the_ID() . '" class="button media-button button-primary button-large wpgmap-edit" data-id="' . get_the_ID() . '"><i class="fas fa-edit"></i>
47
- ' . __('Edit', 'gmap-embed') . '
48
- </a>&nbsp;<span type="button"
49
- class="button media-button button-danger wgm_wpgmap_delete" data-id="' . get_the_ID() . '" style="background-color: #aa2828;color: white;opacity:0.7;"><i class="fas fa-trash"></i> Delete
50
- </span>';
51
- $row = array(
52
- 'id' => get_the_ID(),
53
- 'title' => $title,
54
- 'map_type' => $type,
55
- 'width' => $width,
56
- 'height' => $height,
57
- 'shortcode' => $shortcode,
58
- 'action' => $action
59
- );
60
- $return_json[] = $row;
61
- }
62
-
63
- //return the result to the ajax request and die
64
- echo json_encode(array('data' => $return_json));
65
- wp_die();
66
- }
67
-
68
- /**
69
- * To save New Map Data
70
- */
71
- public function save_wpgmapembed_data()
72
- {
73
- if (!current_user_can('administrator')) {
74
- echo json_encode(array(
75
- 'responseCode' => 0,
76
- 'message' => 'Unauthorized access tried.'
77
- ));
78
- wp_die();
79
- }
80
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['c_s_nonce'])), 'c_s_nonce')) {
81
- die ('Busted!');
82
- }
83
- $error = '';
84
- // Getting ajax fileds value
85
- $meta_data = array(
86
- 'wpgmap_title' => sanitize_text_field(esc_html(strip_tags($_POST['map_data']['wpgmap_title']))),
87
- 'wpgmap_heading_class' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_heading_class'])),
88
- 'wpgmap_show_heading' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_show_heading'])),
89
- // current marker lat lng
90
- 'wpgmap_latlng' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_latlng'])),
91
- 'wpgmap_map_zoom' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_map_zoom'])),
92
- 'wpgmap_disable_zoom_scroll' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_disable_zoom_scroll'])),
93
- 'wpgmap_map_width' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_map_width'])),
94
- 'wpgmap_map_height' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_map_height'])),
95
- 'wpgmap_map_type' => sanitize_text_field(esc_html($_POST['map_data']['wpgmap_map_type'])),
96
- 'wpgmap_show_infowindow' => sanitize_text_field($_POST['map_data']['wpgmap_show_infowindow']),
97
- 'wpgmap_enable_direction' => sanitize_text_field($_POST['map_data']['wpgmap_enable_direction']),
98
- // map center lat lng
99
- 'wpgmap_center_lat_lng' => sanitize_text_field($_POST['map_data']['wpgmap_center_lat_lng'])
100
- );
101
- $action_type = sanitize_text_field(esc_html($_POST['map_data']['action_type']));
102
- if ($meta_data['wpgmap_latlng'] == '') {
103
- $error = "Please input Latitude and Longitude";
104
- }
105
- if (strlen($error) > 0) {
106
- echo json_encode(array(
107
- 'responseCode' => 0,
108
- 'message' => $error
109
- ));
110
- wp_die();
111
- }
112
-
113
- if ($action_type == 'save') {
114
- // Saving post array
115
- $post_array = array(
116
- 'post_type' => 'wpgmapembed'
117
- );
118
- $post_id = wp_insert_post($post_array);
119
- } elseif ($action_type == 'update') {
120
- $post_id = intval(sanitize_text_field(esc_html($_POST['map_data']['post_id'])));
121
- }
122
-
123
- // Updating post meta
124
- foreach ($meta_data as $key => $value) {
125
- $this->__update_post_meta($post_id, $key, $value);
126
- }
127
- $returnArray = array(
128
- 'responseCode' => 1,
129
- 'post_id' => $post_id
130
- );
131
- if ($action_type == 'save') {
132
- global $wpdb;
133
- $wpdb->update(
134
- $wpdb->prefix . 'wgm_markers',
135
- array('map_id' => $post_id),
136
- array('map_id' => 0),
137
- array('%d'),
138
- array('%d')
139
- );
140
- $returnArray['message'] = 'Map created Successfully.';
141
- } elseif ($action_type == 'update') {
142
- $returnArray['message'] = 'Map updated Successfully.';
143
- }
144
- echo json_encode($returnArray);
145
- wp_die();
146
- }
147
-
148
- /**
149
- * Classic editor: Loading popup content on WP Google Map click
150
- */
151
- public function load_popup_wpgmapembed_list()
152
- {
153
- if (!current_user_can('administrator')) {
154
- echo json_encode(array(
155
- 'responseCode' => 0,
156
- 'message' => 'Unauthorized access tried.'
157
- ));
158
- wp_die();
159
- }
160
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['c_s_nonce'])), 'c_s_nonce')) {
161
- die ('Busted!');
162
- }
163
- $content = '';
164
- $args = array(
165
- 'post_type' => 'wpgmapembed',
166
- 'posts_per_page' => -1,
167
- 'post_status' => 'draft'
168
- );
169
- $mapsList = new WP_Query($args);
170
-
171
- while ($mapsList->have_posts()) {
172
- $mapsList->the_post();
173
- $title = get_post_meta(get_the_ID(), 'wpgmap_title', true);
174
- $content .= '<div class="wp-gmap-single">
175
- <div class="wp-gmap-single-left">
176
- <div class="wp-gmap-single-title">
177
- ' . $title . '
178
- </div>
179
- <div class="wp-gmap-single-shortcode">
180
- <input class="wpgmap-shortcode regular-text" type="text" value="[gmap-embed id=&quot;' . get_the_ID() . '&quot;]"
181
- onclick="this.select()"/>
182
- </div>
183
- </div>
184
- <div class="wp-gmap-single-action">
185
- <button type="button"
186
- class="button media-button button-primary button-large wpgmap-insert-shortcode">
187
- Insert
188
- </button>
189
- </div>
190
- </div>';
191
- }
192
- echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities($content))));
193
- wp_die();
194
- }
195
-
196
- /**
197
- * Get map data by mnap id
198
- * @param string $gmap_id
199
- * @return false|string
200
- */
201
- public function get_wpgmapembed_data($gmap_id = '')
202
- {
203
- if ($gmap_id == '') {
204
- $gmap_id = intval(sanitize_text_field(esc_html($_POST['wpgmap_id'])));
205
- }
206
-
207
- $gmap_data = array(
208
- 'wpgmap_id' => $gmap_id,
209
- 'wpgmap_title' => get_post_meta($gmap_id, 'wpgmap_title', true),
210
- 'wpgmap_heading_class' => get_post_meta($gmap_id, 'wpgmap_heading_class', true),
211
- 'wpgmap_show_heading' => get_post_meta($gmap_id, 'wpgmap_show_heading', true),
212
- 'wpgmap_latlng' => get_post_meta($gmap_id, 'wpgmap_latlng', true),
213
- 'wpgmap_map_zoom' => get_post_meta($gmap_id, 'wpgmap_map_zoom', true),
214
- 'wpgmap_disable_zoom_scroll' => get_post_meta($gmap_id, 'wpgmap_disable_zoom_scroll', true),
215
- 'wpgmap_map_width' => get_post_meta($gmap_id, 'wpgmap_map_width', true),
216
- 'wpgmap_map_height' => get_post_meta($gmap_id, 'wpgmap_map_height', true),
217
- 'wpgmap_map_type' => get_post_meta($gmap_id, 'wpgmap_map_type', true),
218
- 'wpgmap_show_infowindow' => get_post_meta($gmap_id, 'wpgmap_show_infowindow', true),
219
- 'wpgmap_enable_direction' => get_post_meta($gmap_id, 'wpgmap_enable_direction', true),
220
- 'wpgmap_center_lat_lng' => get_center_lat_lng_by_map_id($gmap_id)
221
- );
222
-
223
- return json_encode($gmap_data);
224
- }
225
-
226
- /**
227
- * Remove map including post meta by map id
228
- */
229
- public function remove_wpgmapembed_data()
230
- {
231
-
232
- if (!current_user_can('administrator')) {
233
- $returnArray = array(
234
- 'responseCode' => 0,
235
- 'message' => "Unauthorized access tried."
236
- );
237
- echo json_encode($returnArray);
238
- wp_die();
239
- }
240
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['c_s_nonce'])), 'c_s_nonce')) {
241
- die ('Busted!');
242
- }
243
- $meta_data = array(
244
- 'wpgmap_title',
245
- 'wpgmap_heading_class',
246
- 'wpgmap_show_heading',
247
- 'wpgmap_latlng',
248
- 'wpgmap_map_zoom',
249
- 'wpgmap_disable_zoom_scroll',
250
- 'wpgmap_map_width',
251
- 'wpgmap_map_height',
252
- 'wpgmap_map_type',
253
- 'wpgmap_show_infowindow',
254
- 'wpgmap_enable_direction'
255
- );
256
-
257
- $post_id = intval(sanitize_text_field(esc_html($_POST['post_id'])));
258
- wp_delete_post($post_id);
259
- foreach ($meta_data as $field_name => $value) {
260
- delete_post_meta($post_id, $field_name, $value);
261
- }
262
- $returnArray = array(
263
- 'responseCode' => 1,
264
- 'message' => "Deleted Successfully."
265
- );
266
- echo json_encode($returnArray);
267
- wp_die();
268
- }
269
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/MarkerCRUD.php DELETED
@@ -1,453 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait MarkerCRUD: Map CRUD operation doing here
8
- */
9
- trait MarkerCRUD
10
- {
11
-
12
- /**
13
- * Get Marker default values
14
- * @return array
15
- */
16
- public function get_marker_default_values()
17
- {
18
- return [
19
- 'map_id' => 0,
20
- 'marker_name' => null,
21
- 'marker_desc' => null,
22
- 'icon' => null,
23
- 'address' => null,
24
- 'lat_lng' => null,
25
- 'have_marker_link' => 0,
26
- 'marker_link' => null,
27
- 'marker_link_new_tab' => 0,
28
- 'show_desc_by_default' => 0,
29
- 'created_at' => current_time('mysql'),
30
- 'created_by' => get_current_user_id(),
31
- 'updated_at' => current_time('mysql'),
32
- 'updated_by' => get_current_user_id()
33
- ];
34
- }
35
-
36
- /**
37
- * To save new map marker
38
- */
39
- public function save_map_marker()
40
- {
41
- if (!current_user_can('administrator')) {
42
- $returnArray = array(
43
- 'responseCode' => 0,
44
- 'message' => "Unauthorized access tried."
45
- );
46
- echo json_encode($returnArray);
47
- wp_die();
48
- }
49
-
50
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['ajax_nonce'])), 'ajax_nonce')) {
51
- die ('Busted!');
52
- }
53
-
54
- global $wpdb;
55
-
56
- $map_id = intval(sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_map_id'])));
57
- $error = '';
58
- // Getting ajax fields value
59
- $map_marker_data = array(
60
- 'map_id' => $map_id,
61
- 'marker_name' => strlen(sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_name']))) == 0 ? null : sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_name'])),
62
- 'marker_desc' => sanitize_text_field(htmlentities($_POST['map_markers_data']['wpgmap_marker_desc'])),
63
- 'icon' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_icon'])),
64
- 'address' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_address'])),
65
- 'lat_lng' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_lat_lng'])),
66
- 'have_marker_link' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_have_marker_link'])),
67
- 'marker_link' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_link'])),
68
- 'marker_link_new_tab' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_link_new_tab'])),
69
- 'show_desc_by_default' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_infowindow_show'])),
70
- );
71
- if ($map_marker_data['lat_lng'] == '') {
72
- $error = __("Please input Latitude and Longitude", 'gmap-embed');
73
- }
74
- if (strlen($error) > 0) {
75
- echo json_encode(array(
76
- 'responseCode' => 0,
77
- 'message' => $error
78
- ));
79
- wp_die();
80
- }
81
-
82
- if (!_wgm_is_premium()) {
83
- $no_of_marker_already_have = $this->get_no_of_markers_by_map_id($map_id);
84
- if ($no_of_marker_already_have > 0) {
85
- echo json_encode(array(
86
- 'responseCode' => 0,
87
- 'message' => __("Please upgrade to premium version to create unlimited markers", 'gmap-embed')
88
- ));
89
- wp_die();
90
- }
91
- }
92
-
93
- $defaults = $this->get_marker_default_values();
94
- $wp_gmap_marker_data = wp_parse_args($map_marker_data, $defaults);
95
- $wpdb->insert(
96
- $wpdb->prefix . 'wgm_markers',
97
- $wp_gmap_marker_data,
98
- array(
99
- '%d',
100
- '%s',
101
- '%s',
102
- '%s',
103
- '%s',
104
- '%s',
105
- '%d',
106
- '%s',
107
- '%d',
108
- '%d',
109
- '%s',
110
- '%d',
111
- '%s',
112
- '%d'
113
- ));
114
-
115
- $returnArray = array(
116
- 'responseCode' => 1,
117
- 'marker_id' => $wpdb->insert_id
118
- );
119
- $returnArray['message'] = 'Marker Saved Successfully.';
120
- echo json_encode($returnArray);
121
- wp_die();
122
- }
123
-
124
- /**
125
- * To update existing marker information
126
- */
127
-
128
- public function update_map_marker()
129
- {
130
- if (!current_user_can('administrator')) {
131
- $returnArray = array(
132
- 'responseCode' => 0,
133
- 'message' => "Unauthorized access tried."
134
- );
135
- echo json_encode($returnArray);
136
- wp_die();
137
- }
138
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['ajax_nonce'])), 'ajax_nonce')) {
139
- die ('Busted!');
140
- }
141
-
142
- global $wpdb;
143
- $error = '';
144
- $marker_id = intval(sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_id'])));
145
- $map_id = intval(sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_map_id'])));
146
- // Getting ajax fields value
147
- $map_marker_data = array(
148
- 'map_id' => $map_id,
149
- 'marker_name' => strlen(sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_name']))) == 0 ? null : sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_name'])),
150
- 'marker_desc' => sanitize_text_field(htmlentities($_POST['map_markers_data']['wpgmap_marker_desc'])),
151
- 'icon' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_icon'])),
152
- 'address' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_address'])),
153
- 'lat_lng' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_lat_lng'])),
154
- 'have_marker_link' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_have_marker_link'])),
155
- 'marker_link' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_link'])),
156
- 'marker_link_new_tab' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_link_new_tab'])),
157
- 'show_desc_by_default' => sanitize_text_field(esc_html($_POST['map_markers_data']['wpgmap_marker_infowindow_show'])),
158
- );
159
- if ($map_marker_data['lat_lng'] == '') {
160
- $error = __("Please input Latitude and Longitude", 'gmap-embed');
161
- }
162
- if (strlen($error) > 0) {
163
- echo json_encode(array(
164
- 'responseCode' => 0,
165
- 'message' => $error
166
- ));
167
- wp_die();
168
- }
169
-
170
- $defaults = $this->get_marker_default_values();
171
- $wp_gmap_marker_data = wp_parse_args($map_marker_data, $defaults);
172
-
173
- $wpdb->update(
174
- $wpdb->prefix . 'wgm_markers',
175
- $wp_gmap_marker_data,
176
- array('id' => $marker_id),
177
- [
178
- '%d',
179
- '%s',
180
- '%s',
181
- '%s',
182
- '%s',
183
- '%s',
184
- '%d',
185
- '%s',
186
- '%d',
187
- '%d',
188
- '%s',
189
- '%d',
190
- '%s',
191
- '%d'
192
- ],
193
- array('%d')
194
- );
195
-
196
- $returnArray = array(
197
- 'responseCode' => 1,
198
- 'marker_id' => $marker_id
199
- );
200
- $returnArray['message'] = 'Updated Successfully.';
201
- echo json_encode($returnArray);
202
- wp_die();
203
- }
204
-
205
- /**
206
- * Get all marker icons/pins
207
- */
208
- public function get_marker_icons()
209
- {
210
- if (!current_user_can('administrator')) {
211
- $returnArray = array(
212
- 'responseCode' => 0,
213
- 'message' => "Unauthorized access tried."
214
- );
215
- echo json_encode($returnArray);
216
- wp_die();
217
- }
218
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_GET['ajax_nonce'])), 'ajax_nonce')) {
219
- die ('Busted!');
220
- }
221
- ob_start();
222
- require_once WGM_PLUGIN_PATH . 'admin/includes/markers-icons.php';
223
- echo ob_get_clean();
224
- wp_die();
225
- }
226
-
227
- /**
228
- * Save Marker Icon
229
- */
230
- public function save_marker_icon()
231
- {
232
- if (!current_user_can('administrator')) {
233
- $returnArray = array(
234
- 'responseCode' => 0,
235
- 'message' => "Unauthorized access tried."
236
- );
237
- echo json_encode($returnArray);
238
- wp_die();
239
- }
240
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
241
- die ('Busted!');
242
- }
243
-
244
- global $wpdb;
245
- $error = '';
246
- $icon_url = sanitize_text_field(esc_html($_POST['data']['icon_url']));
247
- // Getting ajax fields value
248
- $map_icon_data = array(
249
- 'type' => 'uploaded_marker_icon',
250
- 'title' => '',
251
- 'desc' => '',
252
- 'file_name' => $icon_url
253
- );
254
-
255
- $is_marker_icon_already_exist = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}wgm_icons WHERE file_name='%s'", $icon_url));
256
- if ($is_marker_icon_already_exist == 0) {
257
- $defaults = array(
258
- 'file_name' => ''
259
- );
260
- $wp_gmap_marker_icon = wp_parse_args($map_icon_data, $defaults);
261
- $wpdb->insert(
262
- $wpdb->prefix . 'wgm_icons',
263
- $wp_gmap_marker_icon,
264
- array(
265
- '%s',
266
- '%s',
267
- '%s',
268
- '%s'
269
- )
270
- );
271
- }
272
-
273
- $returnArray = array(
274
- 'responseCode' => 1,
275
- 'icon_url' => $icon_url
276
- );
277
- $returnArray['message'] = 'Updated Successfully.';
278
- echo json_encode($returnArray);
279
- wp_die();
280
- }
281
-
282
- /**
283
- * Get no of markers by map id
284
- * @param $map_id int
285
- * @retun int
286
- */
287
- public function get_no_of_markers_by_map_id($map_id = 0)
288
- {
289
- global $wpdb;
290
- $map_id = intval(sanitize_text_field(esc_html($map_id)));
291
- return $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", $map_id));
292
- }
293
-
294
- /**
295
- * Get all markers by map id
296
- */
297
- public function get_markers_by_map_id()
298
- {
299
- if (!current_user_can('administrator')) {
300
- echo json_encode(array(
301
- 'responseCode' => 0,
302
- 'message' => 'Unauthorized access tried.'
303
- ));
304
- wp_die();
305
- }
306
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
307
- die ('Busted!');
308
- }
309
-
310
- global $wpdb;
311
- $map_id = intval(sanitize_text_field(esc_html($_POST['data']['map_id'])));
312
- $filtered_map_markers = [];
313
- $map_markers = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", $map_id));
314
- if (count($map_markers) > 0) {
315
- foreach ($map_markers as $key => $map_marker) {
316
- $map_marker->marker_desc = wp_unslash(html_entity_decode($map_marker->marker_desc));
317
- $filtered_map_markers[$key] = $map_marker;
318
- }
319
-
320
- }
321
- $returnArray = array(
322
- 'responseCode' => 1,
323
- 'markers' => $filtered_map_markers
324
- );
325
- $returnArray['message'] = 'Markers fetched successfully.';
326
- echo json_encode($returnArray);
327
- wp_die();
328
- }
329
-
330
- /**
331
- * Public Get all markers by map id
332
- */
333
- public function p_get_markers_by_map_id()
334
- {
335
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
336
- die ('Busted!');
337
- }
338
-
339
- global $wpdb;
340
- $map_id = intval(sanitize_text_field(esc_html($_POST['data']['map_id'])));
341
- $filtered_map_markers = [];
342
- $map_markers = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", $map_id));
343
- if (count($map_markers) > 0) {
344
- foreach ($map_markers as $key => $map_marker) {
345
- $map_marker->marker_desc = wp_unslash(html_entity_decode($map_marker->marker_desc));
346
- $filtered_map_markers[$key] = $map_marker;
347
- }
348
-
349
- }
350
- $returnArray = array(
351
- 'responseCode' => 1,
352
- 'markers' => $filtered_map_markers
353
- );
354
- $returnArray['message'] = 'Markers fetched successfully.';
355
- echo json_encode($returnArray);
356
- wp_die();
357
- }
358
-
359
- /**
360
- * Get markers by map id for datatable
361
- */
362
- public function wgm_get_markers_by_map_id_for_dt()
363
- {
364
- if (!current_user_can('administrator')) {
365
- echo json_encode(array(
366
- 'responseCode' => 0,
367
- 'message' => 'Unauthorized access tried.'
368
- ));
369
- wp_die();
370
- }
371
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_GET['ajax_nonce'])), 'ajax_nonce')) {
372
- die ('Busted!');
373
- }
374
- $return_json = array();
375
- global $wpdb;
376
- $map_id = intval(sanitize_text_field(esc_html($_GET['map_id'])));
377
- $wpgmap_markers = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", $map_id));
378
- if (count($wpgmap_markers) > 0) {
379
- foreach ($wpgmap_markers as $marker_key => $wpgmap_marker) {
380
- $action = '<a href="" class="wpgmap_marker_edit button button-small"
381
- map_marker_id="' . $wpgmap_marker->id . '"><i class="fas fa-edit"></i></a>
382
- <a href="" class="wpgmap_marker_view button button-small"
383
- map_marker_id="' . $wpgmap_marker->id . '"><i class="fas fa-eye"></i></a>
384
- <a href="" class="wpgmap_marker_trash button button-small"
385
- map_marker_id="' . $wpgmap_marker->id . '"><i class="fas fa-trash"></i></a>';
386
- $row = array(
387
- 'id' => $wpgmap_marker->id,
388
- 'marker_name' => $wpgmap_marker->marker_name,
389
- 'icon' => '<img src="' . $wpgmap_marker->icon . '" width="20">',
390
- 'action' => $action
391
- );
392
- $return_json[] = $row;
393
- }
394
- }
395
- //return the result to the ajax request and die
396
- echo json_encode(array('data' => $return_json));
397
- wp_die();
398
- }
399
-
400
- /**
401
- * Delete single marker
402
- */
403
- public function delete_marker()
404
- {
405
- if (!current_user_can('administrator')) {
406
- $returnArray = array(
407
- 'responseCode' => 0,
408
- 'message' => "Unauthorized access tried."
409
- );
410
- echo json_encode($returnArray);
411
- wp_die();
412
- }
413
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
414
- die ('Busted!');
415
- }
416
-
417
- $marker_id = sanitize_text_field(esc_html($_POST['data']['marker_id']));
418
- global $wpdb;
419
- $wpdb->delete(
420
- $wpdb->prefix . 'wgm_markers',
421
- array(
422
- 'id' => $marker_id,
423
- ),
424
- array(
425
- '%d'
426
- )
427
- );
428
- }
429
-
430
- /**
431
- * Get marker single data by marker ID
432
- */
433
- public function get_marker_data_by_marker_id()
434
- {
435
- if (!current_user_can('administrator')) {
436
- $returnArray = array(
437
- 'responseCode' => 0,
438
- 'message' => "Unauthorized access tried."
439
- );
440
- echo json_encode($returnArray);
441
- wp_die();
442
- }
443
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['data']['ajax_nonce'])), 'ajax_nonce')) {
444
- die ('Busted!');
445
- }
446
- global $wpdb;
447
- $marker_id = intval(sanitize_text_field(esc_html($_POST['data']['marker_id'])));
448
- $result = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}wgm_markers WHERE id='%d'", $marker_id), OBJECT);
449
- $result->marker_desc = wp_unslash(html_entity_decode($result->marker_desc));
450
- echo json_encode($result);
451
- wp_die();
452
- }
453
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/MediaButtons.php DELETED
@@ -1,56 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait MediaButtons: for plugins media buttons including
8
- */
9
- trait MediaButtons
10
- {
11
- public function add_wp_google_map_media_button()
12
- {
13
-
14
- //path to my icon
15
- $img = WGM_PLUGIN_URL . 'gmap_icon_18.png';
16
-
17
- //the id of the container I want to show in the popup
18
- $container_id = 'wp_gmap_popup_container';
19
-
20
- //our popup's title
21
- $title = 'Select your desired map to insert into post';
22
-
23
- //append the icon
24
- $context = "<a class='button thickbox' title='{$title}'
25
- href='#TB_inline?width=700&height=450&inlineId={$container_id}'>
26
- " . '<span class="wp-media-buttons-icon" style="background: url(' . $img . '); background-repeat: no-repeat; background-position: left bottom;"></span>' . "WP Google Map</a>";
27
-
28
- echo wp_unslash(html_entity_decode(sanitize_text_field(htmlentities($context))));
29
- }
30
-
31
- public function wp_google_map_media_button_content()
32
- {
33
- ?>
34
- <div id="wp_gmap_popup_container" style="display:none;">
35
- <!--modal contents-->
36
- <div id="wgm_all_maps">
37
- <!---------------------------new map tab-------------->
38
- <div class="wp-gmap-tab-content active" id="wp-gmap-all">
39
- <span class="wpgmap_msg_error" style="width:80%;">
40
-
41
- </span>
42
- <!--all map tab-->
43
- <div class="wp-gmap-list">
44
- <a href="<?php echo esc_url(admin_url() . 'admin.php?page=wpgmapembed&amp;tag=new'); ?>"
45
- data-id="wp-gmap-new" class="media-menu-item" style="float:right;">Create New
46
- Map</a>
47
- <span class="spinner is-active"
48
- style="margin: 0px !important;float:left;"></span>
49
- <div id="wpgmapembed_list"></div>
50
- </div>
51
- </div>
52
- </div>
53
- </div>
54
- <?php
55
- }
56
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/Menu.php DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait Menu
8
- */
9
- trait Menu
10
- {
11
- /**
12
- * To create menu in admin panel
13
- */
14
- public function gmap_create_menu()
15
- {
16
-
17
- //create new top-level menu
18
- add_menu_page($this->plugin_name, $this->plugin_name, 'administrator', 'wpgmapembed', array(
19
- $this,
20
- 'srm_gmap_main'
21
- ), 'dashicons-location', 11);
22
-
23
- add_submenu_page('wpgmapembed', __('All Maps', 'gmap-embed'), __('All Maps', 'gmap-embed'), 'administrator', 'wpgmapembed', array(
24
- $this,
25
- 'srm_gmap_main'
26
- ), 0);
27
-
28
- //to create sub menu
29
- if (_wgm_can_add_new_map()) {
30
- add_submenu_page('wpgmapembed', __("Add new Map", "gmap-embed"), __("Add New", "gmap-embed"), 'administrator', 'wpgmapembed-new', array(
31
- $this,
32
- 'srm_gmap_new'
33
- ), 1);
34
- }
35
-
36
- //setup wizard menu
37
- add_submenu_page('wpgmapembed', __("Quick Setup", "gmap-embed"), __("Quick Setup", "gmap-embed"), 'administrator', 'wgm_setup_wizard', array(
38
- $this,
39
- 'wpgmap_setup_wizard'
40
- ), 2);
41
-
42
-
43
- add_submenu_page('wpgmapembed', __("Support", "gmap-embed"), __("Support", "gmap-embed"), 'administrator', 'wpgmapembed-support', array(
44
- $this,
45
- 'wgm_support'
46
- ), 3);
47
-
48
- add_submenu_page('wpgmapembed', __("Settings", "gmap-embed"), __("Settings", "gmap-embed"), 'administrator', 'wpgmapembed-settings', array(
49
- $this,
50
- 'wgm_settings'
51
- ), 4);
52
- if (!_wgm_is_premium()) {
53
- add_submenu_page('wpgmapembed', __('<img draggable="false" role="img" class="emoji" alt="⭐" src="https://s.w.org/images/core/emoji/13.0.1/svg/2b50.svg"> Upgrade to Pro', "gmap-embed"), __('<span style="color:yellow"><img draggable="false" role="img" class="emoji" alt="⭐" src="https://s.w.org/images/core/emoji/13.0.1/svg/2b50.svg"> Upgrade to Pro</span>', "gmap-embed"), 'administrator', 'https://srmilon.info/pricing?utm_source=admin_menu&utm_medium=admin_link&utm_campaign=menu_get_license', false, 5);
54
- }
55
- }
56
-
57
- public function wgm_support()
58
- {
59
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_support.php';
60
- }
61
-
62
-
63
- /**
64
- * Google Map Embed Mail Page
65
- */
66
- public function srm_gmap_main()
67
- {
68
- if (isset($_GET['tag']) and sanitize_text_field(esc_html($_GET['tag'] == 'edit'))) {
69
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_edit.php';
70
- } else {
71
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_list.php';
72
- }
73
- }
74
-
75
- /**
76
- * Google Map Embed Mail Page
77
- */
78
- public function srm_gmap_new()
79
- {
80
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_create.php';
81
- }
82
-
83
- public function wgm_settings()
84
- {
85
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_settings.php';
86
- }
87
-
88
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/Notice.php DELETED
@@ -1,149 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- if (!defined('ABSPATH')) exit;
5
-
6
- /**
7
- * Trait Notice
8
- */
9
- trait Notice
10
- {
11
- /**
12
- * Generate Different types of notices
13
- */
14
- function gmap_embed_notice_generate()
15
- {
16
- // Review admin notice
17
- $this->gmap_embed_generate_admin_review_notice();
18
-
19
- // No API key admin notice
20
- $this->wgm_no_api_key_added_notice();
21
- }
22
-
23
-
24
-
25
- public function wgm_no_api_key_added_notice()
26
- {
27
- if (get_option('wpgmap_api_key', 'none') == 'none') {
28
- ?>
29
- <div class="notice notice-info is-dismissible" style="border: 2px #db1c1c solid;">
30
- <p>
31
- <?php echo sprintf(__('You must generate your own <b>API Key</b> to use Google Map, Please go to <a href="%s" style="font-weight: bold;text-decoration: none;">WP Google Map</a><i class="dashicons dashicons-arrow-right-alt2"></i><a href="%s" style="text-decoration: none;font-weight: bold;">Quick Setup</a> to get your API key. <a href="%s" target="_blank" style="text-decoration: none;font-weight: bold;"><i class="dashicons dashicons-external"></i>Video Tutorial</a>, <i class="dashicons dashicons-external"></i><a href="%s" target="_blank" style="text-decoration: none;font-weight: bold;">Documentation</a>', 'gmap-embed'),
32
- esc_url(admin_url('admin.php?page=wpgmapembed')),
33
- esc_url(admin_url('admin.php?page=wgm_setup_wizard')),
34
- esc_url('https://youtu.be/9KZOUJ9Gdv8?t=22'),
35
- esc_url('https://srmilon.info/docs-category/installation?utm_source=wp_admin&utm_medium=admin_link&utm_campaign=header_notice')
36
- ); ?>
37
- </p>
38
- </div>
39
- <?php
40
- }
41
- }
42
-
43
- /**
44
- * Do something on review already button click
45
- */
46
- public function review_already_did()
47
- {
48
- update_option('gmap_embed_is_review_done', true);
49
- }
50
-
51
- /**
52
- * Do something on review later button click
53
- */
54
- public function review_later()
55
- {
56
- update_option('gmap_embed_is_review_snoozed', true);
57
- update_option('gmap_embed_review_snoozed_at', time());
58
- }
59
-
60
- /**
61
- * Redirect to URL generate
62
- * @return string
63
- */
64
- public function redirect_to()
65
- {
66
- $request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
67
- $query_string = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY);
68
- parse_str($query_string, $current_url);
69
- $unset_array = array('dismiss', 'plugin', '_wpnonce', 'later');
70
-
71
- foreach ($unset_array as $value) {
72
- if (isset($current_url[$value])) {
73
- unset($current_url[$value]);
74
- }
75
- }
76
-
77
- $current_url = http_build_query($current_url);
78
- $redirect_url = $request_uri . '?' . $current_url;
79
- return $redirect_url;
80
- }
81
-
82
- /**
83
- * Generate admin panel review notice for WP Google Map plugin
84
- */
85
- public function gmap_embed_generate_admin_review_notice()
86
- {
87
- $activation_time = get_option('gmap_embed_activation_time', false);
88
- $is_review_snoozed = get_option('gmap_embed_is_review_snoozed');
89
- $snoozed_time = get_option('gmap_embed_review_snoozed_at');
90
-
91
- //How may day's passed after activation
92
- $seconds_diff = time() - $activation_time;
93
- $passed_days = ($seconds_diff / 3600) / 24;
94
-
95
- //Snoozed how many day's before
96
- $seconds_diff = time() - $snoozed_time;
97
- $snoozed_before = ($seconds_diff / 3600) / 24;
98
- $is_review_done = get_option('gmap_embed_is_review_done');
99
-
100
- /**
101
- *
102
- * Review section will shows based on following cases
103
- * Case 1: Passed three(3) days and not snoozed
104
- * Case 2: Snoozed before 7 day's
105
- */
106
- if ($is_review_done == false and (($passed_days >= 3 and $is_review_snoozed == false) or ($is_review_snoozed == true and $snoozed_before >= 7))) {
107
- $scheme = (parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY)) ? '&' : '?';
108
- $url = $_SERVER['REQUEST_URI'] . $scheme;
109
- $dismiss_link = add_query_arg([
110
- 'plugin' => 'gmap-embed',
111
- 'dismiss' => true,
112
- '_wpnonce' => wp_create_nonce()
113
- ], $url);
114
- $later_link = add_query_arg([
115
- 'plugin' => 'gmap-embed',
116
- 'later' => true,
117
- '_wpnonce' => wp_create_nonce()
118
- ], $url);
119
- ?>
120
- <div class="gmap_embed_review_section notice notice-success">
121
- <img src="<?php echo esc_url(WGM_PLUGIN_URL . 'admin/assets/images/gmap_embed_logo.jpg'); ?>"
122
- width="60" style="float: left;margin: 9px 9px 0 5px !important"/>
123
- <p><?php _e("<span style='color:green;'>We hope you're" . ' enjoying of using <b style="color:#007cba">WP Google Map</b> plugin.
124
- Could you please give us a BIG favour and give it a 5-star rating on Wordpress to help us spread the word and boost our motivation!</span>
125
- ', 'gmap-embed'); ?></p>
126
- <ul>
127
- <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
128
- href="<?php echo esc_url('https://www.srmilon.info/wp-review-forum?utm_source=wp_admin&utm_medium=admin_link&utm_campaign=review_notice'); ?>"
129
- target="_blank"><span
130
- class="dashicons dashicons-external"></span> Ok, you deserve it!</a></li>
131
- <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
132
- href="<?php echo esc_url($dismiss_link); ?>"><span
133
- class="dashicons dashicons-smiley"></span> I already did</a></li>
134
- <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
135
- href="<?php echo esc_url($later_link); ?>"><span
136
- class="dashicons dashicons-calendar-alt"></span> Maybe Later</a></li>
137
- <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
138
- href="<?php echo esc_url('https://www.srmilon.info/wp-support-forum?utm_source=wp_admin&utm_medium=admin_link&utm_campaign=review_notice'); ?>"
139
- target="_blank"><span
140
- class="dashicons dashicons-external"></span> I need help</a></li>
141
- <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
142
- href="<?php echo esc_url($dismiss_link); ?>"><span
143
- class="dashicons dashicons-dismiss"></span> Never show again</a></li>
144
- </ul>
145
- </div>
146
- <?php
147
- }
148
- }
149
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/PluginsLoadedActions.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
-
5
- use WGMSRM\Classes\Database;
6
-
7
- if (!defined('ABSPATH')) exit;
8
-
9
- /**
10
- * Trait PluginsLoadedActions
11
- */
12
- trait PluginsLoadedActions
13
- {
14
- /**
15
- * Fires after plugins loaded
16
- */
17
- function wpgmap_do_after_plugins_loaded()
18
- {
19
- new Database();
20
- }
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/Settings.php DELETED
@@ -1,302 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
-
5
- use WGMSRM\Classes\Migration;
6
-
7
- if (!defined('ABSPATH')) exit;
8
-
9
- /**
10
- * Trait Settings
11
- */
12
- trait Settings
13
- {
14
- /**
15
- * Settings section callback code(BLANK NOW)
16
- */
17
- function gmap_embed_settings_section_callback()
18
- {
19
- // code...
20
- }
21
-
22
- /**
23
- * Custom CSS part markup
24
- */
25
- function gmap_embed_s_custom_css_markup()
26
- {
27
- ?>
28
- <textarea rows="10" cols="100" name="wpgmap_s_custom_css"
29
- id="wpgmap_custom_css"><?php echo esc_html(get_option('wpgmap_s_custom_css')); ?></textarea>
30
- <p class="description" id="tagline-description" style="font-style: italic;">
31
- <?php _e('Add your custom CSS code if needed.', 'gmap-embed'); ?>
32
- </p>
33
- <?php
34
- }
35
-
36
- /**
37
- * Custom JS part markup
38
- */
39
- function wpgmap_s_custom_js_markup()
40
- {
41
- ?>
42
- <textarea rows="10" cols="100" name="wpgmap_s_custom_js"
43
- id="wpgmap_custom_js"><?php echo esc_html(get_option('wpgmap_s_custom_js')); ?></textarea>
44
- <p class="description" id="tagline-description" style="font-style: italic;">
45
- <?php _e('Add your custom JS code if needed.', 'gmap-embed'); ?>
46
- </p>
47
- <?php
48
- }
49
-
50
- /**
51
- * Where Map API engine should be -> Markup
52
- * @since 1.7.5
53
- */
54
- function wgm_load_api_condition_markup()
55
- {
56
- ?>
57
- <select name="_wgm_load_map_api_condition" id="_wgm_load_map_api_condition">
58
- <option value="where-required" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'where-required' ? 'selected' : ''); ?>>
59
- Where required
60
- </option>
61
- <option value="always" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'always' ? 'selected' : ''); ?>>
62
- Always
63
- </option>
64
- <option value="only-front-end" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'only-front-end' ? 'selected' : ''); ?>>
65
- Only Front End
66
- </option>
67
- <option value="only-back-end" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'only-back-end' ? 'selected' : ''); ?>>
68
- Only Back End
69
- </option>
70
- <option value="never" <?php echo esc_attr(get_option('_wgm_load_map_api_condition') == 'never' ? 'selected' : ''); ?>>
71
- Never
72
- </option>
73
- </select>
74
- <?php
75
- }
76
-
77
- /**
78
- * Prevent API load by other plugin or theme markup
79
- * @since 1.7.5
80
- */
81
- function wgm_prevent_api_load_markup()
82
- {
83
- ?>
84
- <input type="checkbox" name="_wgm_prevent_other_plugin_theme_api_load"
85
- id="_wgm_prevent_other_plugin_theme_api_load"
86
- value="Y" <?php echo esc_attr(get_option('_wgm_prevent_other_plugin_theme_api_load') == 'Y' ? 'checked="checked"' : ''); ?>> Check this option if your want to prevent other plugin or theme loading map api, in case of you are getting api key error, included multiple api key error.
87
- <br/>
88
- <?php
89
- }
90
-
91
- /**
92
- * General Map Settings under General Settings
93
- * @since 1.7.5
94
- */
95
- function wgm_general_map_settings_markup()
96
- {
97
- ?>
98
- <input type="checkbox" name="_wgm_disable_full_screen_control" id="_wgm_disable_full_screen_control"
99
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_full_screen_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Full Screen Control
100
- <br/>
101
- <input type="checkbox" name="_wgm_disable_street_view" id="_wgm_disable_street_view"
102
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_street_view') == 'Y' ? 'checked="checked"' : ''); ?>> Disable StreetView
103
- <br/>
104
- <input type="checkbox" name="_wgm_disable_zoom_control" id="_wgm_disable_zoom_control"
105
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_zoom_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Zoom Controls
106
- <br/>
107
- <input type="checkbox" name="_wgm_disable_pan_control" id="_wgm_disable_pan_control"
108
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_pan_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Pan Controls
109
- <br/>
110
- <input type="checkbox" name="_wgm_disable_map_type_control" id="_wgm_disable_map_type_control"
111
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_map_type_control') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Map Type Controls
112
- <br/>
113
- <input type="checkbox" name="_wgm_disable_mouse_wheel_zoom" id="_wgm_disable_mouse_wheel_zoom"
114
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_mouse_wheel_zoom') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Mouse Wheel Zoom
115
- <br/>
116
- <input type="checkbox" name="_wgm_disable_mouse_dragging" id="_wgm_disable_mouse_dragging"
117
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_mouse_dragging') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Mouse Dragging
118
- <br/>
119
- <input type="checkbox" name="_wgm_disable_mouse_double_click_zooming"
120
- id="_wgm_disable_mouse_double_click_zooming"
121
- value="Y" <?php echo esc_attr(get_option('_wgm_disable_mouse_double_click_zooming') == 'Y' ? 'checked="checked"' : ''); ?>> Disable Mouse Double Click Zooming
122
- <br/>
123
- <?php
124
- }
125
-
126
- /**
127
- * Language selection part markup
128
- */
129
- function gmap_embed_s_map_language_markup()
130
- {
131
- ?>
132
- <select id="srm_gmap_lng" name="srm_gmap_lng" class="regular-text" style="width: 100%;max-width:100%;">
133
- <?php
134
- $wpgmap_languages = gmap_embed_get_languages();
135
- if (count($wpgmap_languages) > 0) {
136
- foreach ($wpgmap_languages as $lng_key => $language) {
137
- $selected = '';
138
- if (get_option('srm_gmap_lng', 'en') == $lng_key) {
139
- $selected = 'selected';
140
- }
141
- echo "<option value='" . esc_attr($lng_key) . "' $selected>" . esc_html($language) . "</option>";
142
- }
143
- }
144
- ?>
145
- </select>
146
- <p class="description" id="tagline-description" style="font-style: italic;">
147
- <?php _e('Chose your desired map language', 'gmap-embed'); ?>
148
- </p>
149
- <?php
150
- }
151
-
152
- /**
153
- * Region selection part markup
154
- */
155
- function gmap_embed_s_map_region_markup()
156
- {
157
- ?>
158
- <select id="region" name="srm_gmap_region" class="regular-text" style="width: 100%;max-width: 100%;">
159
- <?php
160
- $wpgmap_regions = gmap_embed_get_regions();
161
- if (count($wpgmap_regions) > 0) {
162
- foreach ($wpgmap_regions as $region_key => $region) {
163
- $selected = '';
164
- if (get_option('srm_gmap_region', 'US') == $region_key) {
165
- $selected = 'selected';
166
- }
167
- echo "<option value='" . esc_attr($region_key) . "' $selected>" . esc_html($region) . "</option>";
168
- }
169
- }
170
- ?>
171
-
172
- </select>
173
- <p class="description" id="tagline-description" style="font-style: italic;">
174
- <?php _e('Chose your regional area', 'gmap-embed'); ?>
175
- </p>
176
- <?php
177
- }
178
-
179
- /**
180
- * Settings section, fields register
181
- */
182
- public function gmapsrm_settings()
183
- {
184
- // Language settings section and fields
185
- add_settings_section(
186
- 'gmap_embed_language_settings_section',
187
- __('Map Language and Regional Settings<hr/>', 'gmap-embed'),
188
- array($this, 'gmap_embed_settings_section_callback'),
189
- 'gmap-embed-settings-page-ls'
190
- );
191
-
192
- add_settings_field(
193
- 'srm_gmap_lng',
194
- __('Map Language:', 'gmap-embed'),
195
- array($this, 'gmap_embed_s_map_language_markup'),
196
- 'gmap-embed-settings-page-ls',
197
- 'gmap_embed_language_settings_section'
198
- );
199
-
200
- add_settings_field(
201
- 'srm_gmap_region',
202
- __('Map Region:', 'gmap-embed'),
203
- array($this, 'gmap_embed_s_map_region_markup'),
204
- 'gmap-embed-settings-page-ls',
205
- 'gmap_embed_language_settings_section'
206
- );
207
-
208
- // Custom Scripts section and fields
209
- add_settings_section(
210
- 'gmap_embed_custom_scripts_section',
211
- __('Custom Scripts<hr/>', 'gmap-embed'),
212
- array($this, 'gmap_embed_settings_section_callback'),
213
- 'gmap-embed-settings-page-cs'
214
- );
215
-
216
- add_settings_field(
217
- 'wpgmap_s_custom_css',
218
- __('Custom CSS:', 'gmap-embed'),
219
- array($this, 'gmap_embed_s_custom_css_markup'),
220
- 'gmap-embed-settings-page-cs',
221
- 'gmap_embed_custom_scripts_section'
222
- );
223
-
224
- add_settings_field(
225
- 'wpgmap_s_custom_js',
226
- __('Custom JS:', 'gmap-embed'),
227
- array($this, 'wpgmap_s_custom_js_markup'),
228
- 'gmap-embed-settings-page-cs',
229
- 'gmap_embed_custom_scripts_section'
230
- );
231
-
232
- /**
233
- * General map settings section and fields
234
- * @since 1.7.5
235
- **/
236
- add_settings_section(
237
- 'gmap_embed_general_map_settings_section',
238
- __('', 'gmap-embed'),
239
- array($this, 'gmap_embed_settings_section_callback'),
240
- 'gmap-embed-general-settings'
241
- );
242
-
243
- // General map settings related all fields are included
244
- add_settings_field(
245
- 'wpgm_disable_full_screen_control',
246
- __('Map Control Options:', 'gmap-embed'),
247
- array($this, 'wgm_general_map_settings_markup'),
248
- 'gmap-embed-general-settings',
249
- 'gmap_embed_general_map_settings_section'
250
- );
251
-
252
- /**
253
- * Advance settings section and fields
254
- * @since 1.7.5
255
- **/
256
- add_settings_section(
257
- 'wgm_advance_settings_section',
258
- __('', 'gmap-embed'),
259
- array($this, 'gmap_embed_settings_section_callback'),
260
- 'wgm_advance_settings-page'
261
- );
262
-
263
- add_settings_field(
264
- '_wgm_load_map_api_condition',
265
- __('Load Map API:', 'gmap-embed'),
266
- array($this, 'wgm_load_api_condition_markup'),
267
- 'wgm_advance_settings-page',
268
- 'wgm_advance_settings_section'
269
- );
270
-
271
- add_settings_field(
272
- '_wgm_prevent_other_plugin_theme_api_load',
273
- __('Prevent Map API loading for other plugin and themes:', 'gmap-embed'),
274
- array($this, 'wgm_prevent_api_load_markup'),
275
- 'wgm_advance_settings-page',
276
- 'wgm_advance_settings_section'
277
- );
278
-
279
- register_setting('wpgmap_general_settings', 'srm_gmap_lng');
280
- register_setting('wpgmap_general_settings', 'srm_gmap_region');
281
- register_setting('wpgmap_general_settings', 'wpgmap_s_custom_css');
282
- register_setting('wpgmap_general_settings', 'wpgmap_s_custom_js');
283
- /**
284
- * Map General Settings
285
- * @since 1.7.5
286
- **/
287
- register_setting('wpgmap_general_settings', '_wgm_disable_full_screen_control');
288
- register_setting('wpgmap_general_settings', '_wgm_disable_street_view');
289
- register_setting('wpgmap_general_settings', '_wgm_disable_zoom_control');
290
- register_setting('wpgmap_general_settings', '_wgm_disable_pan_control');
291
- register_setting('wpgmap_general_settings', '_wgm_disable_map_type_control');
292
- register_setting('wpgmap_general_settings', '_wgm_disable_mouse_wheel_zoom');
293
- register_setting('wpgmap_general_settings', '_wgm_disable_mouse_dragging');
294
- register_setting('wpgmap_general_settings', '_wgm_disable_mouse_double_click_zooming');
295
- /**
296
- * Advance Settings
297
- * @since 1.7.5
298
- **/
299
- register_setting('wgm_advance_settings', '_wgm_load_map_api_condition');
300
- register_setting('wgm_advance_settings', '_wgm_prevent_other_plugin_theme_api_load');
301
- }
302
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/Traits/SetupWizard.php DELETED
@@ -1,59 +0,0 @@
1
- <?php
2
-
3
- namespace WGMSRM\Traits;
4
- /**
5
- * Trait SetupWizard
6
- */
7
- trait SetupWizard
8
- {
9
- /**
10
- * Setup Wizard view
11
- * @since 1.7.5
12
- */
13
- public function wpgmap_setup_wizard()
14
- {
15
- require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_setup_wizard.php';
16
- }
17
-
18
- /**
19
- * Save setup wizard information
20
- * @since 1.7.5
21
- */
22
- public function wpgmap_save_setup_wizard()
23
- {
24
- if (!current_user_can('administrator')) {
25
- echo json_encode(array(
26
- 'responseCode' => 403,
27
- ));
28
- wp_die();
29
- }
30
- if (!wp_verify_nonce(sanitize_text_field(esc_html($_POST['ajax_nonce'])), 'ajax_nonce')) {
31
- die ('Busted!');
32
- }
33
- $api_key = isset($_POST['wgm_api_key']) ? sanitize_text_field(esc_html($_POST['wgm_api_key'])) : '';
34
- $language = isset($_POST['wgm_language']) ? sanitize_text_field(esc_html($_POST['wgm_language'])) : '';
35
- $regional_area = isset($_POST['wgm_regional_area']) ? sanitize_text_field(esc_html($_POST['wgm_regional_area'])) : '';
36
- if (empty($api_key)) {
37
- $response = array('responseCode' => 101);
38
- echo json_encode($response);
39
- die();
40
- }
41
- if (empty($language)) {
42
- $response = array('responseCode' => 102);
43
- echo json_encode($response);
44
- die();
45
- }
46
- if (empty($regional_area)) {
47
- $response = array('responseCode' => 103);
48
- echo json_encode($response);
49
- die();
50
- }
51
- update_option('wpgmap_api_key', $api_key, 'yes');
52
- update_option('srm_gmap_lng', $language, 'yes');
53
- update_option('srm_gmap_region', $regional_area, 'yes');
54
- update_option('wgm_is_quick_setup_done', 'Y', 'yes');
55
- $response = array('responseCode' => 200);
56
- echo json_encode($response);
57
- die();
58
- }
59
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/helper.php CHANGED
@@ -1,416 +1,418 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
 
 
3
 
4
- if (!function_exists('gmap_embed_no_of_post')) {
5
- /**
6
- * To count number of total post for type wpgmapembed
7
- * @return int
8
- * @since 1.7.0
9
- */
10
- function gmap_embed_no_of_post()
11
- {
12
- $count_posts = wp_count_posts('wpgmapembed');
13
 
14
- return isset($count_posts->draft) ? $count_posts->draft : 0;
15
 
16
- }
17
  }
18
 
19
- if (!function_exists('_wgm_can_add_new_map')) {
20
- /**
21
- * Is using premium version or not
22
- * @return bool
23
- * @since 1.5.0
24
- */
25
- function _wgm_can_add_new_map()
26
- {
27
- return (gmap_embed_no_of_post() === 0 or get_option('_wgm_is_p_v', 'N') === 'Y');
28
- }
29
  }
30
 
31
- if (!function_exists('_wgm_is_premium')) {
32
- /**
33
- * Is using premium version or not
34
- * @return bool
35
- * @since 1.5.0
36
- */
37
- function _wgm_is_premium()
38
- {
39
- return get_option('_wgm_is_p_v', 'N') == 'Y';
40
- }
41
  }
42
 
43
- if (!function_exists('get_center_lat_lng_by_map_id')) {
44
- /**
45
- * Getting center lat lng by map id
46
- * @param int $map_id
47
- * @return string
48
- * @since 1.7.0
49
- */
50
- function get_center_lat_lng_by_map_id($map_id = 0)
51
- {
52
- $wpgmap_center_lat_lng = get_post_meta($map_id, 'wpgmap_center_lat_lng', true);
53
- $wpgmap_latlng = get_post_meta($map_id, 'wpgmap_latlng', true);
54
- if ($wpgmap_center_lat_lng == '' or $wpgmap_center_lat_lng == null or strlen($wpgmap_center_lat_lng) == 0) {
55
- update_post_meta($map_id, 'wpgmap_center_lat_lng', $wpgmap_latlng);
56
- $wpgmap_center_lat_lng = $wpgmap_latlng;
57
- }
58
- return $wpgmap_center_lat_lng;
59
- }
60
  }
61
 
62
- if (!function_exists('gmap_embed_get_languages')) {
63
- /**
64
- * Getting supported google map languages
65
- * @return array
66
- * @since 1.7.0
67
- */
68
- function gmap_embed_get_languages()
69
- {
70
- return array(
71
- "af" => "AFRIKAANS",
72
- "sq" => "ALBANIAN",
73
- "am" => "AMHARIC",
74
- "ar" => "ARABIC",
75
- "hy" => "ARMENIAN",
76
- "az" => "AZERBAIJANI",
77
- "eu" => "BASQUE",
78
- "be" => "BELARUSIAN",
79
- "bn" => "BENGALI",
80
- "bs" => "BOSNIAN",
81
- "bg" => "BULGARIAN",
82
- "my" => "BURMESE",
83
- "ca" => "CATALAN",
84
- "zh" => "CHINESE",
85
- "zh-CN" => "CHINESE (SIMPLIFIED)",
86
- "zh-HK" => "CHINESE (HONG KONG)",
87
- "zh-TW" => "CHINESE (TRADITIONAL)",
88
- "hr" => "CROATIAN",
89
- "cs" => "CZECH",
90
- "da" => "DANISH",
91
- "nl" => "DUTCH",
92
- "en" => "ENGLISH",
93
- "en-AU" => "ENGLISH (AUSTRALIAN)",
94
- "en-GB" => "ENGLISH (GREAT BRITAIN)",
95
- "et" => "ESTONIAN",
96
- "fa" => "FARSI",
97
- "fi" => "FINNISH",
98
- "fil" => "FILIPINO",
99
- "fr" => "FRENCH",
100
- "fr-CA" => "FRENCH (CANADA)",
101
- "gl" => "GALICIAN",
102
- "ka" => "GEORGIAN",
103
- "de" => "GERMAN",
104
- "el" => "GREEK",
105
- "gu" => "GUJARATI",
106
- "iw" => "HEBREW",
107
- "hi" => "HINDI",
108
- "hu" => "HUNGARIAN",
109
- "is" => "ICELANDIC",
110
- "id" => "INDONESIAN",
111
- "it" => "ITALIAN",
112
- "ja" => "JAPANESE",
113
- "kn" => "KANNADA",
114
- "kk" => "KAZAKH",
115
- "km" => "KHMER",
116
- "ko" => "KOREAN",
117
- "ky" => "KYRGYZ",
118
- "lo" => "LAO",
119
- "lv" => "LATVIAN",
120
- "lt" => "LITHUANIAN",
121
- "mk" => "MACEDONIAN",
122
- "ms" => "MALAY",
123
- "ml" => "MALAYALAM",
124
- "mr" => "MARATHI",
125
- "mn" => "MONGOLIAN",
126
- "ne" => "NEPALI",
127
- "no" => "NORWEGIAN",
128
- "pl" => "POLISH",
129
- "pt" => "PORTUGUESE",
130
- "pt-BR" => "PORTUGUESE (BRAZIL)",
131
- "pt-PT" => "PORTUGUESE (PORTUGAL)",
132
- "pa" => "PUNJABI",
133
- "ro" => "ROMANIAN",
134
- "ru" => "RUSSIAN",
135
- "sr" => "SERBIAN",
136
- "si" => "SINHALESE",
137
- "sk" => "SLOVAK",
138
- "sl" => "SLOVENIAN",
139
- "es" => "SPANISH",
140
- "es-419" => "SPANISH (LATIN AMERICA)",
141
- "sw" => "SWAHILI",
142
- "sv" => "SWEDISH",
143
- "ta" => "TAMIL",
144
- "te" => "TELUGU",
145
- "th" => "THAI",
146
- "tr" => "TURKISH",
147
- "uk" => "UKRAINIAN",
148
- "ur" => "URDU",
149
- "uz" => "UZBEK",
150
- "vi" => "VIETNAMESE",
151
- "zu" => "ZULU"
152
- );
153
- }
154
  }
155
 
156
- if (!function_exists('gmap_embed_get_regions')) {
157
- /**
158
- * Getting supported google map regions
159
- * @return array
160
- * @since 1.7.0
161
- */
162
- function gmap_embed_get_regions()
163
- {
164
- return array(
165
- "AF" => "Afghanistan",
166
- "AX" => "Åland Islands",
167
- "AL" => "Albania",
168
- "DZ" => "Algeria",
169
- "AS" => "American Samoa",
170
- "AD" => "Andorra",
171
- "AO" => "Angola",
172
- "AI" => "Anguilla",
173
- "AQ" => "Antarctica",
174
- "AG" => "Antigua and Barbuda",
175
- "AR" => "Argentina",
176
- "AM" => "Armenia",
177
- "AW" => "Aruba",
178
- "AU" => "Australia",
179
- "AT" => "Austria",
180
- "AZ" => "Azerbaijan",
181
- "BS" => "Bahamas",
182
- "BH" => "Bahrain",
183
- "BD" => "Bangladesh",
184
- "BB" => "Barbados",
185
- "BY" => "Belarus",
186
- "BE" => "Belgium",
187
- "BZ" => "Belize",
188
- "BJ" => "Benin",
189
- "BM" => "Bermuda",
190
- "BT" => "Bhutan",
191
- "BO" => "Bolivia, Plurinational State of",
192
- "BQ" => "Bonaire, Sint Eustatius and Saba",
193
- "BA" => "Bosnia and Herzegovina",
194
- "BW" => "Botswana",
195
- "BV" => "Bouvet Island",
196
- "BR" => "Brazil",
197
- "IO" => "British Indian Ocean Territory",
198
- "BN" => "Brunei Darussalam",
199
- "BG" => "Bulgaria",
200
- "BF" => "Burkina Faso",
201
- "BI" => "Burundi",
202
- "KH" => "Cambodia",
203
- "CM" => "Cameroon",
204
- "CA" => "Canada",
205
- "CV" => "Cape Verde",
206
- "KY" => "Cayman Islands",
207
- "CF" => "Central African Republic",
208
- "TD" => "Chad",
209
- "CL" => "Chile",
210
- "CN" => "China",
211
- "CX" => "Christmas Island",
212
- "CC" => "Cocos (Keeling) Islands",
213
- "CO" => "Colombia",
214
- "KM" => "Comoros",
215
- "CG" => "Congo",
216
- "CD" => "Congo, the Democratic Republic of the",
217
- "CK" => "Cook Islands",
218
- "CR" => "Costa Rica",
219
- "CI" => "Côte d'Ivoire",
220
- "HR" => "Croatia",
221
- "CU" => "Cuba",
222
- "CW" => "Curaçao",
223
- "CY" => "Cyprus",
224
- "CZ" => "Czech Republic",
225
- "DK" => "Denmark",
226
- "DJ" => "Djibouti",
227
- "DM" => "Dominica",
228
- "DO" => "Dominican Republic",
229
- "EC" => "Ecuador",
230
- "EG" => "Egypt",
231
- "SV" => "El Salvador",
232
- "GQ" => "Equatorial Guinea",
233
- "ER" => "Eritrea",
234
- "EE" => "Estonia",
235
- "ET" => "Ethiopia",
236
- "FK" => "Falkland Islands (Malvinas)",
237
- "FO" => "Faroe Islands",
238
- "FJ" => "Fiji",
239
- "FI" => "Finland",
240
- "FR" => "France",
241
- "GF" => "French Guiana",
242
- "PF" => "French Polynesia",
243
- "TF" => "French Southern Territories",
244
- "GA" => "Gabon",
245
- "GM" => "Gambia",
246
- "GE" => "Georgia",
247
- "DE" => "Germany",
248
- "GH" => "Ghana",
249
- "GI" => "Gibraltar",
250
- "GR" => "Greece",
251
- "GL" => "Greenland",
252
- "GD" => "Grenada",
253
- "GP" => "Guadeloupe",
254
- "GU" => "Guam",
255
- "GT" => "Guatemala",
256
- "GG" => "Guernsey",
257
- "GN" => "Guinea",
258
- "GW" => "Guinea-Bissau",
259
- "GY" => "Guyana",
260
- "HT" => "Haiti",
261
- "HM" => "Heard Island and McDonald Mcdonald Islands",
262
- "VA" => "Holy See (Vatican City State)",
263
- "HN" => "Honduras",
264
- "HK" => "Hong Kong",
265
- "HU" => "Hungary",
266
- "IS" => "Iceland",
267
- "IN" => "India",
268
- "ID" => "Indonesia",
269
- "IR" => "Iran, Islamic Republic of",
270
- "IQ" => "Iraq",
271
- "IE" => "Ireland",
272
- "IM" => "Isle of Man",
273
- "IL" => "Israel",
274
- "IT" => "Italy",
275
- "JM" => "Jamaica",
276
- "JP" => "Japan",
277
- "JE" => "Jersey",
278
- "JO" => "Jordan",
279
- "KZ" => "Kazakhstan",
280
- "KE" => "Kenya",
281
- "KI" => "Kiribati",
282
- "KP" => "Korea, Democratic People's Republic of",
283
- "KR" => "Korea, Republic of",
284
- "KW" => "Kuwait",
285
- "KG" => "Kyrgyzstan",
286
- "LA" => "Lao People's Democratic Republic",
287
- "LV" => "Latvia",
288
- "LB" => "Lebanon",
289
- "LS" => "Lesotho",
290
- "LR" => "Liberia",
291
- "LY" => "Libya",
292
- "LI" => "Liechtenstein",
293
- "LT" => "Lithuania",
294
- "LU" => "Luxembourg",
295
- "MO" => "Macao",
296
- "MK" => "Macedonia, the Former Yugoslav Republic of",
297
- "MG" => "Madagascar",
298
- "MW" => "Malawi",
299
- "MY" => "Malaysia",
300
- "MV" => "Maldives",
301
- "ML" => "Mali",
302
- "MT" => "Malta",
303
- "MH" => "Marshall Islands",
304
- "MQ" => "Martinique",
305
- "MR" => "Mauritania",
306
- "MU" => "Mauritius",
307
- "YT" => "Mayotte",
308
- "MX" => "Mexico",
309
- "FM" => "Micronesia, Federated States of",
310
- "MD" => "Moldova, Republic of",
311
- "MC" => "Monaco",
312
- "MN" => "Mongolia",
313
- "ME" => "Montenegro",
314
- "MS" => "Montserrat",
315
- "MA" => "Morocco",
316
- "MZ" => "Mozambique",
317
- "MM" => "Myanmar",
318
- "NA" => "Namibia",
319
- "NR" => "Nauru",
320
- "NP" => "Nepal",
321
- "NL" => "Netherlands",
322
- "NC" => "New Caledonia",
323
- "NZ" => "New Zealand",
324
- "NI" => "Nicaragua",
325
- "NE" => "Niger",
326
- "NG" => "Nigeria",
327
- "NU" => "Niue",
328
- "NF" => "Norfolk Island",
329
- "MP" => "Northern Mariana Islands",
330
- "NO" => "Norway",
331
- "OM" => "Oman",
332
- "PK" => "Pakistan",
333
- "PW" => "Palau",
334
- "PS" => "Palestine, State of",
335
- "PA" => "Panama",
336
- "PG" => "Papua New Guinea",
337
- "PY" => "Paraguay",
338
- "PE" => "Peru",
339
- "PH" => "Philippines",
340
- "PN" => "Pitcairn",
341
- "PL" => "Poland",
342
- "PT" => "Portugal",
343
- "PR" => "Puerto Rico",
344
- "QA" => "Qatar",
345
- "RE" => "Réunion",
346
- "RO" => "Romania",
347
- "RU" => "Russian Federation",
348
- "RW" => "Rwanda",
349
- "BL" => "Saint Barthélemy",
350
- "SH" => "Saint Helena, Ascension and Tristan da Cunha",
351
- "KN" => "Saint Kitts and Nevis",
352
- "LC" => "Saint Lucia",
353
- "MF" => "Saint Martin (French part)",
354
- "PM" => "Saint Pierre and Miquelon",
355
- "VC" => "Saint Vincent and the Grenadines",
356
- "WS" => "Samoa",
357
- "SM" => "San Marino",
358
- "ST" => "Sao Tome and Principe",
359
- "SA" => "Saudi Arabia",
360
- "SN" => "Senegal",
361
- "RS" => "Serbia",
362
- "SC" => "Seychelles",
363
- "SL" => "Sierra Leone",
364
- "SG" => "Singapore",
365
- "SX" => "Sint Maarten (Dutch part)",
366
- "SK" => "Slovakia",
367
- "SI" => "Slovenia",
368
- "SB" => "Solomon Islands",
369
- "SO" => "Somalia",
370
- "ZA" => "South Africa",
371
- "GS" => "South Georgia and the South Sandwich Islands",
372
- "SS" => "South Sudan",
373
- "ES" => "Spain",
374
- "LK" => "Sri Lanka",
375
- "SD" => "Sudan",
376
- "SR" => "Suriname",
377
- "SJ" => "Svalbard and Jan Mayen",
378
- "SZ" => "Swaziland",
379
- "SE" => "Sweden",
380
- "CH" => "Switzerland",
381
- "SY" => "Syrian Arab Republic",
382
- "TW" => "Taiwan",
383
- "TJ" => "Tajikistan",
384
- "TZ" => "Tanzania, United Republic of",
385
- "TH" => "Thailand",
386
- "TL" => "Timor-Leste",
387
- "TG" => "Togo",
388
- "TK" => "Tokelau",
389
- "TO" => "Tonga",
390
- "TT" => "Trinidad and Tobago",
391
- "TN" => "Tunisia",
392
- "TR" => "Turkey",
393
- "TM" => "Turkmenistan",
394
- "TC" => "Turks and Caicos Islands",
395
- "TV" => "Tuvalu",
396
- "UG" => "Uganda",
397
- "UA" => "Ukraine",
398
- "AE" => "United Arab Emirates",
399
- "GB" => "United Kingdom",
400
- "US" => "United States",
401
- "UM" => "United States Minor Outlying Islands",
402
- "UY" => "Uruguay",
403
- "UZ" => "Uzbekistan",
404
- "VU" => "Vanuatu",
405
- "VE" => "Venezuela, Bolivarian Republic of",
406
- "VN" => "Vietnam",
407
- "VG" => "Virgin Islands, British",
408
- "VI" => "Virgin Islands, U.S.",
409
- "WF" => "Wallis and Futuna",
410
- "EH" => "Western Sahara",
411
- "YE" => "Yemen",
412
- "ZM" => "Zambia",
413
- "ZW" => "Zimbabwe"
414
- );
415
- }
416
  }
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
 
6
+ if ( ! function_exists( 'gmap_embed_no_of_post' ) ) {
7
+ /**
8
+ * To count number of total post for type wpgmapembed
9
+ *
10
+ * @return int
11
+ * @since 1.7.0
12
+ */
13
+ function gmap_embed_no_of_post() {
14
+ $count_posts = wp_count_posts( 'wpgmapembed' );
15
 
16
+ return isset( $count_posts->draft ) ? $count_posts->draft : 0;
17
 
18
+ }
19
  }
20
 
21
+ if ( ! function_exists( '_wgm_can_add_new_map' ) ) {
22
+ /**
23
+ * Is using premium version or not
24
+ *
25
+ * @return bool
26
+ * @since 1.5.0
27
+ */
28
+ function _wgm_can_add_new_map() {
29
+ return ( gmap_embed_no_of_post() == 0 || get_option( '_wgm_is_p_v', 'N' ) == 'Y' );
30
+ }
31
  }
32
 
33
+ if ( ! function_exists( '_wgm_is_premium' ) ) {
34
+ /**
35
+ * Is using premium version or not
36
+ *
37
+ * @return bool
38
+ * @since 1.5.0
39
+ */
40
+ function _wgm_is_premium() {
41
+ return get_option( '_wgm_is_p_v', 'N' ) == 'Y';
42
+ }
43
  }
44
 
45
+ if ( ! function_exists( 'get_center_lat_lng_by_map_id' ) ) {
46
+ /**
47
+ * Getting center lat lng by map id
48
+ *
49
+ * @param int $map_id
50
+ * @return string
51
+ * @since 1.7.0
52
+ */
53
+ function get_center_lat_lng_by_map_id( $map_id = 0 ) {
54
+ $wpgmap_center_lat_lng = get_post_meta( intval( $map_id ), 'wpgmap_center_lat_lng', true );
55
+ $wpgmap_latlng = get_post_meta( intval( $map_id ), 'wpgmap_latlng', true );
56
+ if ( $wpgmap_center_lat_lng == '' || $wpgmap_center_lat_lng == null || strlen( $wpgmap_center_lat_lng ) == 0 ) {
57
+ update_post_meta( intval( $map_id ), 'wpgmap_center_lat_lng', $wpgmap_latlng );
58
+ $wpgmap_center_lat_lng = $wpgmap_latlng;
59
+ }
60
+ return $wpgmap_center_lat_lng;
61
+ }
62
  }
63
 
64
+ if ( ! function_exists( 'gmap_embed_get_languages' ) ) {
65
+ /**
66
+ * Getting supported google map languages
67
+ *
68
+ * @return array
69
+ * @since 1.7.0
70
+ */
71
+ function gmap_embed_get_languages() {
72
+ return array(
73
+ 'af' => 'AFRIKAANS',
74
+ 'sq' => 'ALBANIAN',
75
+ 'am' => 'AMHARIC',
76
+ 'ar' => 'ARABIC',
77
+ 'hy' => 'ARMENIAN',
78
+ 'az' => 'AZERBAIJANI',
79
+ 'eu' => 'BASQUE',
80
+ 'be' => 'BELARUSIAN',
81
+ 'bn' => 'BENGALI',
82
+ 'bs' => 'BOSNIAN',
83
+ 'bg' => 'BULGARIAN',
84
+ 'my' => 'BURMESE',
85
+ 'ca' => 'CATALAN',
86
+ 'zh' => 'CHINESE',
87
+ 'zh-CN' => 'CHINESE (SIMPLIFIED)',
88
+ 'zh-HK' => 'CHINESE (HONG KONG)',
89
+ 'zh-TW' => 'CHINESE (TRADITIONAL)',
90
+ 'hr' => 'CROATIAN',
91
+ 'cs' => 'CZECH',
92
+ 'da' => 'DANISH',
93
+ 'nl' => 'DUTCH',
94
+ 'en' => 'ENGLISH',
95
+ 'en-AU' => 'ENGLISH (AUSTRALIAN)',
96
+ 'en-GB' => 'ENGLISH (GREAT BRITAIN)',
97
+ 'et' => 'ESTONIAN',
98
+ 'fa' => 'FARSI',
99
+ 'fi' => 'FINNISH',
100
+ 'fil' => 'FILIPINO',
101
+ 'fr' => 'FRENCH',
102
+ 'fr-CA' => 'FRENCH (CANADA)',
103
+ 'gl' => 'GALICIAN',
104
+ 'ka' => 'GEORGIAN',
105
+ 'de' => 'GERMAN',
106
+ 'el' => 'GREEK',
107
+ 'gu' => 'GUJARATI',
108
+ 'iw' => 'HEBREW',
109
+ 'hi' => 'HINDI',
110
+ 'hu' => 'HUNGARIAN',
111
+ 'is' => 'ICELANDIC',
112
+ 'id' => 'INDONESIAN',
113
+ 'it' => 'ITALIAN',
114
+ 'ja' => 'JAPANESE',
115
+ 'kn' => 'KANNADA',
116
+ 'kk' => 'KAZAKH',
117
+ 'km' => 'KHMER',
118
+ 'ko' => 'KOREAN',
119
+ 'ky' => 'KYRGYZ',
120
+ 'lo' => 'LAO',
121
+ 'lv' => 'LATVIAN',
122
+ 'lt' => 'LITHUANIAN',
123
+ 'mk' => 'MACEDONIAN',
124
+ 'ms' => 'MALAY',
125
+ 'ml' => 'MALAYALAM',
126
+ 'mr' => 'MARATHI',
127
+ 'mn' => 'MONGOLIAN',
128
+ 'ne' => 'NEPALI',
129
+ 'no' => 'NORWEGIAN',
130
+ 'pl' => 'POLISH',
131
+ 'pt' => 'PORTUGUESE',
132
+ 'pt-BR' => 'PORTUGUESE (BRAZIL)',
133
+ 'pt-PT' => 'PORTUGUESE (PORTUGAL)',
134
+ 'pa' => 'PUNJABI',
135
+ 'ro' => 'ROMANIAN',
136
+ 'ru' => 'RUSSIAN',
137
+ 'sr' => 'SERBIAN',
138
+ 'si' => 'SINHALESE',
139
+ 'sk' => 'SLOVAK',
140
+ 'sl' => 'SLOVENIAN',
141
+ 'es' => 'SPANISH',
142
+ 'es-419' => 'SPANISH (LATIN AMERICA)',
143
+ 'sw' => 'SWAHILI',
144
+ 'sv' => 'SWEDISH',
145
+ 'ta' => 'TAMIL',
146
+ 'te' => 'TELUGU',
147
+ 'th' => 'THAI',
148
+ 'tr' => 'TURKISH',
149
+ 'uk' => 'UKRAINIAN',
150
+ 'ur' => 'URDU',
151
+ 'uz' => 'UZBEK',
152
+ 'vi' => 'VIETNAMESE',
153
+ 'zu' => 'ZULU',
154
+ );
155
+ }
156
  }
157
 
158
+ if ( ! function_exists( 'gmap_embed_get_regions' ) ) {
159
+ /**
160
+ * Getting supported google map regions
161
+ *
162
+ * @return array
163
+ * @since 1.7.0
164
+ */
165
+ function gmap_embed_get_regions() {
166
+ return array(
167
+ 'AF' => 'Afghanistan',
168
+ 'AX' => 'Åland Islands',
169
+ 'AL' => 'Albania',
170
+ 'DZ' => 'Algeria',
171
+ 'AS' => 'American Samoa',
172
+ 'AD' => 'Andorra',
173
+ 'AO' => 'Angola',
174
+ 'AI' => 'Anguilla',
175
+ 'AQ' => 'Antarctica',
176
+ 'AG' => 'Antigua and Barbuda',
177
+ 'AR' => 'Argentina',
178
+ 'AM' => 'Armenia',
179
+ 'AW' => 'Aruba',
180
+ 'AU' => 'Australia',
181
+ 'AT' => 'Austria',
182
+ 'AZ' => 'Azerbaijan',
183
+ 'BS' => 'Bahamas',
184
+ 'BH' => 'Bahrain',
185
+ 'BD' => 'Bangladesh',
186
+ 'BB' => 'Barbados',
187
+ 'BY' => 'Belarus',
188
+ 'BE' => 'Belgium',
189
+ 'BZ' => 'Belize',
190
+ 'BJ' => 'Benin',
191
+ 'BM' => 'Bermuda',
192
+ 'BT' => 'Bhutan',
193
+ 'BO' => 'Bolivia, Plurinational State of',
194
+ 'BQ' => 'Bonaire, Sint Eustatius and Saba',
195
+ 'BA' => 'Bosnia and Herzegovina',
196
+ 'BW' => 'Botswana',
197
+ 'BV' => 'Bouvet Island',
198
+ 'BR' => 'Brazil',
199
+ 'IO' => 'British Indian Ocean Territory',
200
+ 'BN' => 'Brunei Darussalam',
201
+ 'BG' => 'Bulgaria',
202
+ 'BF' => 'Burkina Faso',
203
+ 'BI' => 'Burundi',
204
+ 'KH' => 'Cambodia',
205
+ 'CM' => 'Cameroon',
206
+ 'CA' => 'Canada',
207
+ 'CV' => 'Cape Verde',
208
+ 'KY' => 'Cayman Islands',
209
+ 'CF' => 'Central African Republic',
210
+ 'TD' => 'Chad',
211
+ 'CL' => 'Chile',
212
+ 'CN' => 'China',
213
+ 'CX' => 'Christmas Island',
214
+ 'CC' => 'Cocos (Keeling) Islands',
215
+ 'CO' => 'Colombia',
216
+ 'KM' => 'Comoros',
217
+ 'CG' => 'Congo',
218
+ 'CD' => 'Congo, the Democratic Republic of the',
219
+ 'CK' => 'Cook Islands',
220
+ 'CR' => 'Costa Rica',
221
+ 'CI' => "Côte d'Ivoire",
222
+ 'HR' => 'Croatia',
223
+ 'CU' => 'Cuba',
224
+ 'CW' => 'Curaçao',
225
+ 'CY' => 'Cyprus',
226
+ 'CZ' => 'Czech Republic',
227
+ 'DK' => 'Denmark',
228
+ 'DJ' => 'Djibouti',
229
+ 'DM' => 'Dominica',
230
+ 'DO' => 'Dominican Republic',
231
+ 'EC' => 'Ecuador',
232
+ 'EG' => 'Egypt',
233
+ 'SV' => 'El Salvador',
234
+ 'GQ' => 'Equatorial Guinea',
235
+ 'ER' => 'Eritrea',
236
+ 'EE' => 'Estonia',
237
+ 'ET' => 'Ethiopia',
238
+ 'FK' => 'Falkland Islands (Malvinas)',
239
+ 'FO' => 'Faroe Islands',
240
+ 'FJ' => 'Fiji',
241
+ 'FI' => 'Finland',
242
+ 'FR' => 'France',
243
+ 'GF' => 'French Guiana',
244
+ 'PF' => 'French Polynesia',
245
+ 'TF' => 'French Southern Territories',
246
+ 'GA' => 'Gabon',
247
+ 'GM' => 'Gambia',
248
+ 'GE' => 'Georgia',
249
+ 'DE' => 'Germany',
250
+ 'GH' => 'Ghana',
251
+ 'GI' => 'Gibraltar',
252
+ 'GR' => 'Greece',
253
+ 'GL' => 'Greenland',
254
+ 'GD' => 'Grenada',
255
+ 'GP' => 'Guadeloupe',
256
+ 'GU' => 'Guam',
257
+ 'GT' => 'Guatemala',
258
+ 'GG' => 'Guernsey',
259
+ 'GN' => 'Guinea',
260
+ 'GW' => 'Guinea-Bissau',
261
+ 'GY' => 'Guyana',
262
+ 'HT' => 'Haiti',
263
+ 'HM' => 'Heard Island and McDonald Mcdonald Islands',
264
+ 'VA' => 'Holy See (Vatican City State)',
265
+ 'HN' => 'Honduras',
266
+ 'HK' => 'Hong Kong',
267
+ 'HU' => 'Hungary',
268
+ 'IS' => 'Iceland',
269
+ 'IN' => 'India',
270
+ 'ID' => 'Indonesia',
271
+ 'IR' => 'Iran, Islamic Republic of',
272
+ 'IQ' => 'Iraq',
273
+ 'IE' => 'Ireland',
274
+ 'IM' => 'Isle of Man',
275
+ 'IL' => 'Israel',
276
+ 'IT' => 'Italy',
277
+ 'JM' => 'Jamaica',
278
+ 'JP' => 'Japan',
279
+ 'JE' => 'Jersey',
280
+ 'JO' => 'Jordan',
281
+ 'KZ' => 'Kazakhstan',
282
+ 'KE' => 'Kenya',
283
+ 'KI' => 'Kiribati',
284
+ 'KP' => "Korea, Democratic People's Republic of",
285
+ 'KR' => 'Korea, Republic of',
286
+ 'KW' => 'Kuwait',
287
+ 'KG' => 'Kyrgyzstan',
288
+ 'LA' => "Lao People's Democratic Republic",
289
+ 'LV' => 'Latvia',
290
+ 'LB' => 'Lebanon',
291
+ 'LS' => 'Lesotho',
292
+ 'LR' => 'Liberia',
293
+ 'LY' => 'Libya',
294
+ 'LI' => 'Liechtenstein',
295
+ 'LT' => 'Lithuania',
296
+ 'LU' => 'Luxembourg',
297
+ 'MO' => 'Macao',
298
+ 'MK' => 'Macedonia, the Former Yugoslav Republic of',
299
+ 'MG' => 'Madagascar',
300
+ 'MW' => 'Malawi',
301
+ 'MY' => 'Malaysia',
302
+ 'MV' => 'Maldives',
303
+ 'ML' => 'Mali',
304
+ 'MT' => 'Malta',
305
+ 'MH' => 'Marshall Islands',
306
+ 'MQ' => 'Martinique',
307
+ 'MR' => 'Mauritania',
308
+ 'MU' => 'Mauritius',
309
+ 'YT' => 'Mayotte',
310
+ 'MX' => 'Mexico',
311
+ 'FM' => 'Micronesia, Federated States of',
312
+ 'MD' => 'Moldova, Republic of',
313
+ 'MC' => 'Monaco',
314
+ 'MN' => 'Mongolia',
315
+ 'ME' => 'Montenegro',
316
+ 'MS' => 'Montserrat',
317
+ 'MA' => 'Morocco',
318
+ 'MZ' => 'Mozambique',
319
+ 'MM' => 'Myanmar',
320
+ 'NA' => 'Namibia',
321
+ 'NR' => 'Nauru',
322
+ 'NP' => 'Nepal',
323
+ 'NL' => 'Netherlands',
324
+ 'NC' => 'New Caledonia',
325
+ 'NZ' => 'New Zealand',
326
+ 'NI' => 'Nicaragua',
327
+ 'NE' => 'Niger',
328
+ 'NG' => 'Nigeria',
329
+ 'NU' => 'Niue',
330
+ 'NF' => 'Norfolk Island',
331
+ 'MP' => 'Northern Mariana Islands',
332
+ 'NO' => 'Norway',
333
+ 'OM' => 'Oman',
334
+ 'PK' => 'Pakistan',
335
+ 'PW' => 'Palau',
336
+ 'PS' => 'Palestine, State of',
337
+ 'PA' => 'Panama',
338
+ 'PG' => 'Papua New Guinea',
339
+ 'PY' => 'Paraguay',
340
+ 'PE' => 'Peru',
341
+ 'PH' => 'Philippines',
342
+ 'PN' => 'Pitcairn',
343
+ 'PL' => 'Poland',
344
+ 'PT' => 'Portugal',
345
+ 'PR' => 'Puerto Rico',
346
+ 'QA' => 'Qatar',
347
+ 'RE' => 'Réunion',
348
+ 'RO' => 'Romania',
349
+ 'RU' => 'Russian Federation',
350
+ 'RW' => 'Rwanda',
351
+ 'BL' => 'Saint Barthélemy',
352
+ 'SH' => 'Saint Helena, Ascension and Tristan da Cunha',
353
+ 'KN' => 'Saint Kitts and Nevis',
354
+ 'LC' => 'Saint Lucia',
355
+ 'MF' => 'Saint Martin (French part)',
356
+ 'PM' => 'Saint Pierre and Miquelon',
357
+ 'VC' => 'Saint Vincent and the Grenadines',
358
+ 'WS' => 'Samoa',
359
+ 'SM' => 'San Marino',
360
+ 'ST' => 'Sao Tome and Principe',
361
+ 'SA' => 'Saudi Arabia',
362
+ 'SN' => 'Senegal',
363
+ 'RS' => 'Serbia',
364
+ 'SC' => 'Seychelles',
365
+ 'SL' => 'Sierra Leone',
366
+ 'SG' => 'Singapore',
367
+ 'SX' => 'Sint Maarten (Dutch part)',
368
+ 'SK' => 'Slovakia',
369
+ 'SI' => 'Slovenia',
370
+ 'SB' => 'Solomon Islands',
371
+ 'SO' => 'Somalia',
372
+ 'ZA' => 'South Africa',
373
+ 'GS' => 'South Georgia and the South Sandwich Islands',
374
+ 'SS' => 'South Sudan',
375
+ 'ES' => 'Spain',
376
+ 'LK' => 'Sri Lanka',
377
+ 'SD' => 'Sudan',
378
+ 'SR' => 'Suriname',
379
+ 'SJ' => 'Svalbard and Jan Mayen',
380
+ 'SZ' => 'Swaziland',
381
+ 'SE' => 'Sweden',
382
+ 'CH' => 'Switzerland',
383
+ 'SY' => 'Syrian Arab Republic',
384
+ 'TW' => 'Taiwan',
385
+ 'TJ' => 'Tajikistan',
386
+ 'TZ' => 'Tanzania, United Republic of',
387
+ 'TH' => 'Thailand',
388
+ 'TL' => 'Timor-Leste',
389
+ 'TG' => 'Togo',
390
+ 'TK' => 'Tokelau',
391
+ 'TO' => 'Tonga',
392
+ 'TT' => 'Trinidad and Tobago',
393
+ 'TN' => 'Tunisia',
394
+ 'TR' => 'Turkey',
395
+ 'TM' => 'Turkmenistan',
396
+ 'TC' => 'Turks and Caicos Islands',
397
+ 'TV' => 'Tuvalu',
398
+ 'UG' => 'Uganda',
399
+ 'UA' => 'Ukraine',
400
+ 'AE' => 'United Arab Emirates',
401
+ 'GB' => 'United Kingdom',
402
+ 'US' => 'United States',
403
+ 'UM' => 'United States Minor Outlying Islands',
404
+ 'UY' => 'Uruguay',
405
+ 'UZ' => 'Uzbekistan',
406
+ 'VU' => 'Vanuatu',
407
+ 'VE' => 'Venezuela, Bolivarian Republic of',
408
+ 'VN' => 'Vietnam',
409
+ 'VG' => 'Virgin Islands, British',
410
+ 'VI' => 'Virgin Islands, U.S.',
411
+ 'WF' => 'Wallis and Futuna',
412
+ 'EH' => 'Western Sahara',
413
+ 'YE' => 'Yemen',
414
+ 'ZM' => 'Zambia',
415
+ 'ZW' => 'Zimbabwe',
416
+ );
417
+ }
418
  }
includes/traits/ActionLinks.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait ActionLinks: for plugins list action links viewing
11
+ */
12
+ trait ActionLinks {
13
+
14
+ /**
15
+ * Adding Upgrade to pro, rate us and support link
16
+ *
17
+ * @param $actions
18
+ * @return mixed
19
+ */
20
+ public function gmap_srm_settings_link( $actions ) {
21
+ $links = array();
22
+ if ( ! _wgm_is_premium() ) {
23
+ $links['upgrade-to-pro'] = '<a target="_blank" style="color: #11967A;font-weight:bold;" href="' . esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_plugins&utm_medium=admin_link&utm_campaign=plugin_action_link' ) . '">' . __( 'Upgrade To Pro ($10 only)' ) . '</a>';
24
+ }
25
+ $links['rate-us'] = '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/gmap-embed/reviews/#new-post' ) . '">' . __( 'Rate Us' ) . '</a>';
26
+ $links['support'] = '<a target="_blank" href="' . esc_url( 'https://wordpress.org/support/plugin/gmap-embed/#new-topic-0' ) . '">' . __( 'Support' ) . '</a>';
27
+ $links['settings'] = '<a href="' .
28
+ esc_url( admin_url( 'admin.php?page=wpgmapembed-settings' ) ) .
29
+ '">' . __( 'Settings' ) . '</a>';
30
+ return array_merge( $links, $actions );
31
+ }
32
+ }
includes/traits/ActivationHooks.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait ActivationHooks: Do something on plugin activation
11
+ */
12
+ trait ActivationHooks {
13
+
14
+ /**
15
+ * Do after activation
16
+ *
17
+ * @param $plugin
18
+ * @param $network_activation
19
+ */
20
+ public function wpgmap_do_after_activation( $plugin, $network_activation ) {
21
+ // In case of existing installation
22
+ if ( get_option( 'gmap_embed_activation_time', false ) == false ) {
23
+ update_option( 'gmap_embed_activation_time', time() );
24
+ }
25
+
26
+ if ( $plugin === 'gmap-embed/srm_gmap_embed.php' ) {
27
+ wp_redirect( admin_url( 'admin.php?page=wgm_setup_wizard' ) );
28
+ exit;
29
+ }
30
+ }
31
+ }
includes/traits/AdminInitActions.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ use WGMSRM\Classes\Migration;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Trait InitActions: Init action hooks defined here
13
+ */
14
+ trait AdminInitActions {
15
+
16
+ public function do_admin_init_actions() {
17
+ }
18
+ }
includes/traits/AssetHandler.php ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait AssetHandler: enqueue, dequeue assets
11
+ */
12
+ trait AssetHandler {
13
+
14
+
15
+ /**
16
+ * @return array
17
+ */
18
+ public function getLocalizedScripts() {
19
+ // Setup wizard validation data
20
+ $wpgmap_setup_validation_data = array(
21
+ 'apikey' => __( 'Please enter a valid API key', 'gmap-embed' ),
22
+ 'language' => __( 'Please select a language', 'gmap-embed' ),
23
+ 'regionalarea' => __( 'Please select a regional area', 'gmap-embed' ),
24
+ 'licencekey' => __( 'Invalid license key', 'gmap-embed' ),
25
+ 'success' => __( 'Successfully installed.', 'gmap-embed' ),
26
+ 'failed_to_finish' => __( 'Something went wrong, please reload and try again', 'gmap-embed' ),
27
+ );
28
+
29
+ // Setup wizard get api key modal content
30
+ $wpgmap_setup_api_key_modal_data = array(
31
+ 'faq_title' => __( 'Help Manual', 'gmap-embed' ),
32
+ 'faq_item_title' => __( ' Click here to see Help Manual on how to get API key', 'gmap-embed' ),
33
+ 'faq_item_url' => esc_url( 'https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=setup_wizard' ),
34
+ 'video_title' => __( 'Video Tutorial', 'gmap-embed' ),
35
+ 'video_url' => esc_url( '//www.youtube.com/embed/m-jAsxG0zuk' ),
36
+ 'api_key_title' => __( 'Get API Key', 'gmap-embed' ),
37
+ 'api_key_url' => esc_url( '//console.developers.google.com/flows/enableapi?apiid=maps_backend,places_backend,geolocation,geocoding_backend,directions_backend&keyType=CLIENT_SIDE&reusekey=true' ),
38
+ );
39
+
40
+ // what we collect modal content
41
+ $wgm_wwc_msg = array(
42
+ 'title' => __( 'What we collect?', 'gmap-embed' ),
43
+ 'desc' => __( 'We collect non-sensitive diagnostic data and plugin usage information. Your site URL, WordPress & PHP version, plugins & themes and email address to send you the discount coupon. This data lets us make sure this plugin always stays compatible with the most popular plugins and themes. No spam, we promise.', 'gmap-embed' ),
44
+ );
45
+ $locales = array(
46
+ 'dt' => array(
47
+ 'no_map_created' => __( 'No map created yet, please click on Add New to create your map.', 'gmap-embed' ),
48
+ 'no_marker_created' => __( 'No marker created yet.', 'gmap-embed' ),
49
+ ),
50
+ 'sweet_alert' => array(
51
+ 'oops' => __( 'Opps...', 'gmap-embed' ),
52
+ 'notice_unlimited_maps' => sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to create <b>Unlimited Maps</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_crud&utm_medium=admin_link&utm_campaign=add_new_map' ) ),
53
+ 'notice_unlimited_marker' => sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to create <b>Unlimited Markers</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_crud&utm_medium=admin_link&utm_campaign=add_new_marker' ) ),
54
+ 'notice_to_use_feature' => sprintf( __( 'You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to use <b>this feature</b>.', 'gmap-embed' ), esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_map_crud&utm_medium=admin_link&utm_campaign=new_feature_popup' ) ),
55
+ ),
56
+ );
57
+
58
+ $wgm_localized = array(
59
+ // Common data
60
+ 'is_premium_user' => _wgm_is_premium(),
61
+ 'get_p_v_url' => esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_setup_wizard&utm_medium=admin_link&utm_campaign=get_license' ),
62
+ 'site_url' => site_url(),
63
+ 'setup_wizard' => array(
64
+ 'setup_validation_msg' => $wpgmap_setup_validation_data,
65
+ 'setup_api_key_modal' => $wpgmap_setup_api_key_modal_data,
66
+ 'wgm_wwc_msg' => $wgm_wwc_msg,
67
+ ),
68
+ 'locales' => $locales,
69
+ 'ajax_nonce' => wp_create_nonce( 'ajax_nonce' ),
70
+ 'c_s_nonce' => wp_create_nonce( 'c_s_nonce' ),
71
+ );
72
+
73
+ if ( isset( $_GET['tag'] ) and sanitize_text_field( wp_unslash( $_GET['tag'] ) ) == 'edit' ) {
74
+
75
+ $map_id = isset( $_GET['id'] ) ? intval( sanitize_text_field( wp_unslash( $_GET['id'] ) ) ) : 0;
76
+ $current_map_marker_lat_lng = explode( ',', get_post_meta( $map_id, 'wpgmap_latlng', true ) );
77
+ $current_map_marker_lat = isset( $current_map_marker_lat_lng[0] ) ? $current_map_marker_lat_lng[0] : 40.73359922990751;
78
+ $current_map_marker_lng = isset( $current_map_marker_lat_lng[1] ) ? $current_map_marker_lat_lng[1] : -74.02791395625002;
79
+ $wgm_object = array(
80
+ 'current_map_marker_lat' => esc_html( $current_map_marker_lat ),
81
+ 'current_map_marker_lng' => esc_html( $current_map_marker_lng ),
82
+ 'map_id' => intval( $map_id ),
83
+ );
84
+ $wgm_localized['wgm_object'] = $wgm_object;
85
+ }
86
+ return $wgm_localized;
87
+ }
88
+
89
+ public function getPluginStatus() {
90
+ // API status variable ->debugging purpose
91
+ return wp_json_encode(
92
+ array(
93
+ 'l_api' => esc_html( get_option( '_wgm_load_map_api_condition', 'always' ) ),
94
+ 'p_api' => esc_html( get_option( '_wgm_prevent_other_plugin_theme_api_load', 'N' ) ),
95
+ 'i_p' => _wgm_is_premium(),
96
+ 'd_f_s_c' => esc_html( get_option( '_wgm_disable_full_screen_control', 'N' ) ),
97
+ 'd_s_v' => esc_html( get_option( '_wgm_disable_street_view', 'N' ) ),
98
+ 'd_z_c' => esc_html( get_option( '_wgm_disable_zoom_control', 'N' ) ),
99
+ 'd_p_c' => esc_html( get_option( '_wgm_disable_pan_control', 'N' ) ),
100
+ 'd_m_t_c' => esc_html( get_option( '_wgm_disable_map_type_control', 'N' ) ),
101
+ 'd_m_w_z' => esc_html( get_option( '_wgm_disable_mouse_wheel_zoom', 'N' ) ),
102
+ 'd_m_d' => esc_html( get_option( '_wgm_disable_mouse_dragging', 'N' ) ),
103
+ 'd_m_d_c_z' => esc_html( get_option( '_wgm_disable_mouse_double_click_zooming', 'N' ) ),
104
+ )
105
+ );
106
+ }
107
+
108
+ /**
109
+ * Register common scripts
110
+ */
111
+ private function registerCommonScripts() {
112
+ $srm_gmap_lng = esc_html( get_option( 'srm_gmap_lng', 'en' ) );
113
+ $srm_gmap_region = esc_html( get_option( 'srm_gmap_region', 'US' ) );
114
+ wp_register_script( 'wp-gmap-api', 'https://maps.google.com/maps/api/js?key=' . $this->wpgmap_api_key . '&libraries=places&language=' . $srm_gmap_lng . '&region=' . $srm_gmap_region, array( 'jquery' ) );
115
+ }
116
+
117
+ /**
118
+ * To enqueue CSS & JS for frontend
119
+ */
120
+ public function gmap_front_enqueue_scripts() {
121
+ // Register common scripts (includes: google maps api)
122
+ $this->registerCommonScripts();
123
+
124
+ // Based on user defined condition, enqueue Google Map API script
125
+ if ( in_array( esc_html( get_option( '_wgm_load_map_api_condition', 'always' ) ), array( 'where-required', 'always', 'only-front-end' ) ) ) {
126
+ wp_enqueue_script( 'wp-gmap-api' );
127
+ }
128
+
129
+ // Custom JS script and Plugin status including
130
+ $wgm_settings_status = $this->getPluginStatus();
131
+ $custom_js_scripts = get_option( 'wpgmap_s_custom_js' );
132
+ $custom_js_scripts .= "\nvar wgm_status = $wgm_settings_status;";
133
+ wp_add_inline_script( 'wp-gmap-api', $custom_js_scripts );
134
+
135
+ // Custom CSS style including
136
+ wp_enqueue_style( 'wp-gmap-embed-front-css', WGM_PLUGIN_URL . 'public/assets/css/front_custom_style.css', array(), filemtime( WGM_PLUGIN_PATH . 'public/assets/css/front_custom_style.css' ) );
137
+ $custom_css_styles = get_option( 'wpgmap_s_custom_css' );
138
+ if ( strlen( $custom_css_styles ) !== 0 ) {
139
+ wp_add_inline_style( 'wp-gmap-embed-front-css', "$custom_css_styles" );
140
+ }
141
+ }
142
+
143
+ /**
144
+ * To enqueue scripts for admin-panel
145
+ */
146
+ function enqueue_admin_gmap_scripts() {
147
+ $page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
148
+ global $pagenow;
149
+ if ( $pagenow === 'post.php' || $pagenow === 'post-new.php' || ( $page == 'wpgmapembed' || $page === 'wpgmapembed-settings' || $page === 'wpgmapembed-new' || $page === 'wgm_setup_wizard' || $page === 'wpgmapembed-support' ) ) {
150
+
151
+ // Registering common scripts (Included: Google API)
152
+ $this->registerCommonScripts();
153
+
154
+ // Including Google Map API for only New Map and Edit Map page
155
+ if ( in_array( esc_html( get_option( '_wgm_load_map_api_condition', 'always' ) ), array( 'where-required', 'always', 'only-backend-end' ) ) && ( $page === 'wpgmapembed' or $page === 'wpgmapembed-new' ) ) {
156
+ wp_enqueue_script( 'wp-gmap-api' );
157
+ }
158
+
159
+ /** Common assets */
160
+ wp_enqueue_script( 'wp-gmap-common-js', WGM_PLUGIN_URL . 'admin/assets/js/common.js', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/js/common.js' ), false );
161
+ $wgm_localized = $this->getLocalizedScripts();
162
+ wp_localize_script( 'wp-gmap-common-js', 'wgm_l', $wgm_localized );
163
+ wp_enqueue_style( 'wp-gmap-embed-css', WGM_PLUGIN_URL . 'admin/assets/css/wp-gmap-style.css', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/css/wp-gmap-style.css' ) );
164
+ // Font awesome
165
+ wp_enqueue_style( 'wp-gmap-fontawasome-css', WGM_PLUGIN_URL . 'admin/assets/third-party/font-awesome/5/css/font-awesome.css', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/third-party/font-awesome/5/css/font-awesome.css' ) );
166
+ // Sweet alert related
167
+ wp_enqueue_style( 'wp-gmap-sweetalert2-css', WGM_PLUGIN_URL . 'admin/assets/third-party/sweetalert2/css/sweetalert2.min.css', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/third-party/sweetalert2/css/sweetalert2.min.css' ) );
168
+ wp_enqueue_script( 'wp-gmap-sweetalert2-js', WGM_PLUGIN_URL . 'admin/assets/third-party/sweetalert2/js/sweetalert2.min.js', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/third-party/sweetalert2/js/sweetalert2.min.js' ), true );
169
+ // Media upload
170
+ wp_enqueue_script( 'media-upload' );
171
+ wp_enqueue_script( 'thickbox' );
172
+ wp_enqueue_script( 'wpgmap-media-upload' );
173
+ wp_enqueue_media();
174
+ wp_enqueue_style( 'thickbox' );
175
+
176
+ /** Edit and Add Map page */
177
+ if ( $pagenow === 'post.php' || $pagenow === 'post-new.php' || ( $page === 'wpgmapembed' or $page === 'wpgmapembed-new' ) ) {
178
+ wp_enqueue_script( 'wgm-map-curd-js', WGM_PLUGIN_URL . 'admin/assets/js/wgm_map_crud.js', array( 'wp-gmap-common-js' ), filemtime( WGM_PLUGIN_PATH . 'admin/assets/js/wgm_map_crud.js' ), true );
179
+ wp_enqueue_script( 'wp-gmap-markers-js', WGM_PLUGIN_URL . 'admin/assets/js/wgm_marker_crud.js', array( 'wp-gmap-common-js' ), filemtime( WGM_PLUGIN_PATH . 'admin/assets/js/wgm_marker_crud.js' ), true );
180
+ // Datatable
181
+ wp_enqueue_style( 'wgm-datatable-css', WGM_PLUGIN_URL . 'admin/assets/third-party/datatables/css/jquery.dataTables.min.css', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/third-party/datatables/css/jquery.dataTables.min.css' ) );
182
+ wp_enqueue_script( 'wgm-datatable-js', WGM_PLUGIN_URL . 'admin/assets/third-party/datatables/js/jquery.dataTables.min.js', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/third-party/datatables/js/jquery.dataTables.min.js' ), true );
183
+ }
184
+
185
+ /** Setup Wizard */
186
+ if ( $page === 'wgm_setup_wizard' ) {
187
+ wp_enqueue_style( 'wp-gmap-setup-wizard-css', WGM_PLUGIN_URL . 'admin/assets/css/setup_wizard.css', array(), filemtime( WGM_PLUGIN_PATH . '/admin/assets/css/setup_wizard.css' ) );
188
+ wp_enqueue_script( 'wp-gmap-setup-wizard-js', WGM_PLUGIN_URL . 'admin/assets/js/setup_wizard.js', array(), filemtime( WGM_PLUGIN_PATH . 'admin/assets/js/setup_wizard.js' ), true );
189
+ }
190
+ }
191
+ }
192
+ }
includes/traits/CommonFunctions.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace WGMSRM\Traits;
3
+
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+ /**
8
+ * Trait CommonFunctions
9
+ */
10
+ trait CommonFunctions {
11
+
12
+ /**
13
+ * Update post meta
14
+ *
15
+ * @param $post_id
16
+ * @param $field_name
17
+ * @param string $value
18
+ */
19
+ public function wgm_update_post_meta( $post_id, $field_name, $value = '' ) {
20
+ if ( ! get_post_meta( $post_id, $field_name ) ) {
21
+ add_post_meta( $post_id, $field_name, $value );
22
+ } else {
23
+ update_post_meta( $post_id, $field_name, $value );
24
+ }
25
+ }
26
+ }
includes/traits/Filters.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace WGMSRM\Traits;
3
+
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+
8
+ /**
9
+ * Filters related to the plugin will be listed here
10
+ */
11
+ trait Filters {
12
+
13
+ /**
14
+ * In case of Google Map API loaded by other plugins or themes, it will prevent and load a blank script (Only removes by user consent)
15
+ *
16
+ * @param $tag
17
+ * @param $handle
18
+ * @param $src
19
+ * @return mixed|string
20
+ * @since 1.7.5
21
+ */
22
+ public function do_prevent_others_google_maps_tag( $tag, $handle, $src ) {
23
+ if ( preg_match( '/maps\.google/i', $src ) ) {
24
+ if ( $handle !== 'wp-gmap-api' ) {
25
+ return '';
26
+ }
27
+ }
28
+ return $tag;
29
+ }
30
+ }
includes/traits/InitActions.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ use WGMSRM\Classes\Migration;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Trait InitActions: Init action hooks defined here
13
+ */
14
+ trait InitActions {
15
+
16
+ /**
17
+ * Loading text-domain
18
+ *
19
+ * @since 3.0.0
20
+ */
21
+ public function i18n() {
22
+ load_plugin_textdomain( 'gmap-embed', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
23
+ }
24
+
25
+ /**
26
+ * Review system action link hooks
27
+ *
28
+ * @since 1.7.1
29
+ */
30
+ public function review_system_hooks() {
31
+ // Review system hooks.
32
+ add_action( 'gmap_embed_review_already_did', array( $this, 'review_already_did' ) );
33
+ add_action( 'gmap_embed_review_later', array( $this, 'review_later' ) );
34
+ if ( isset( $_GET['plugin'] ) ) {
35
+ $plugin = sanitize_text_field( wp_unslash( $_GET['plugin'] ) );
36
+ if ( $plugin === $this->plugin_slug ) {
37
+ if ( isset( $_GET['dismiss'] ) && sanitize_text_field( wp_unslash( $_GET['dismiss'] ) ) == 1 ) {
38
+ do_action( 'gmap_embed_review_already_did' );
39
+ }
40
+ if ( isset( $_GET['later'] ) && sanitize_text_field( wp_unslash( $_GET['later'] ) ) == 1 ) {
41
+ do_action( 'gmap_embed_review_later' );
42
+ }
43
+ wp_safe_redirect( $this->redirect_to() );
44
+ exit;
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Doing some code in init hook
51
+ *
52
+ * @since 1.7.1
53
+ */
54
+ public function do_init_actions() {
55
+ $this->i18n();
56
+ $this->review_system_hooks();
57
+ $this->register_post_type();
58
+ new Migration();
59
+ }
60
+
61
+ /**
62
+ * Registering wpgmapembed post type
63
+ *
64
+ * @since 1.7.1
65
+ */
66
+ public function register_post_type() {
67
+ // Register Post Types.
68
+ register_post_type(
69
+ 'wpgmapembed',
70
+ array(
71
+ 'labels' => array(
72
+ 'name' => __( 'Google Maps' ),
73
+ 'singular_name' => __( 'Map' ),
74
+ ),
75
+ 'public' => false,
76
+ 'has_archive' => false,
77
+ )
78
+ );
79
+ }
80
+ }
includes/traits/MapCRUD.php ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ use WP_Query;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Trait MapCRUD: Map CRUD operation doing here
13
+ */
14
+ trait MapCRUD {
15
+
16
+ /**
17
+ * Get all maps for datatable ajax request
18
+ *
19
+ * @since 1.7.5
20
+ */
21
+ public function wgm_get_all_maps() {
22
+ if ( ! current_user_can( 'administrator' ) ) {
23
+ echo wp_json_encode(
24
+ array(
25
+ 'responseCode' => 0,
26
+ 'message' => 'Unauthorized access tried.',
27
+ )
28
+ );
29
+ wp_die();
30
+ }
31
+ if ( ! isset( $_GET['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
32
+ die( 'Busted!' );
33
+ }
34
+ $args = array(
35
+ 'post_type' => 'wpgmapembed',
36
+ 'posts_per_page' => - 1,
37
+ 'post_status' => 'draft',
38
+ );
39
+
40
+ $return_json = array();
41
+ $maps_list = new WP_Query( $args );
42
+ while ( $maps_list->have_posts() ) {
43
+ $maps_list->the_post();
44
+ $title = esc_html( get_post_meta( get_the_ID(), 'wpgmap_title', true ) );
45
+ $type = esc_html( get_post_meta( get_the_ID(), 'wpgmap_map_type', true ) );
46
+ $width = esc_html( get_post_meta( get_the_ID(), 'wpgmap_map_width', true ) );
47
+ $height = esc_html( get_post_meta( get_the_ID(), 'wpgmap_map_height', true ) );
48
+ $shortcode = '<input class="wpgmap-shortcode regular-text" style="width:100%!important;" type="text" value="' . esc_attr( '[gmap-embed id=&quot;' . get_the_ID() . '&quot;]' ) . '"
49
+ onclick="this.select()"/>';
50
+ $action = '<a href="?page=wpgmapembed&tag=edit&id=' . get_the_ID() . '" class="button media-button button-primary button-large wpgmap-edit" data-id="' . get_the_ID() . '"><i class="fas fa-edit"></i>
51
+ ' . __( 'Edit', 'gmap-embed' ) . '
52
+ </a>&nbsp;<span type="button"
53
+ class="button media-button button-danger wgm_wpgmap_delete" data-id="' . get_the_ID() . '" style="background-color: #aa2828;color: white;opacity:0.7;"><i class="fas fa-trash"></i> Delete
54
+ </span>';
55
+ $row = array(
56
+ 'id' => get_the_ID(),
57
+ 'title' => $title,
58
+ 'map_type' => $type,
59
+ 'width' => $width,
60
+ 'height' => $height,
61
+ 'shortcode' => $shortcode,
62
+ 'action' => $action,
63
+ );
64
+ $return_json[] = $row;
65
+ }
66
+
67
+ echo wp_json_encode( array( 'data' => $return_json ) );
68
+ wp_die();
69
+ }
70
+
71
+ /**
72
+ * To save New Map Data
73
+ */
74
+ public function save_wpgmapembed_data() {
75
+ if ( ! current_user_can( 'administrator' ) ) {
76
+ echo wp_json_encode(
77
+ array(
78
+ 'responseCode' => 0,
79
+ 'message' => 'Unauthorized access tried.',
80
+ )
81
+ );
82
+ wp_die();
83
+ }
84
+ if ( ! isset( $_POST['c_s_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['c_s_nonce'] ) ), 'c_s_nonce' ) ) {
85
+ die( 'Busted!' );
86
+ }
87
+ $error = '';
88
+ // Getting ajax fileds value
89
+ $meta_data = array(
90
+ 'wpgmap_title' => sanitize_text_field( wp_strip_all_tags( wp_unslash( $_POST['map_data']['wpgmap_title'] ) ) ),
91
+ 'wpgmap_heading_class' => sanitize_html_class( wp_unslash( $_POST['map_data']['wpgmap_heading_class'] ) ),
92
+ 'wpgmap_show_heading' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_show_heading'] ) ),
93
+ // current marker lat lng
94
+ 'wpgmap_latlng' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_latlng'] ) ),
95
+ 'wpgmap_map_zoom' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_map_zoom'] ) ),
96
+ 'wpgmap_disable_zoom_scroll' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_disable_zoom_scroll'] ) ),
97
+ 'wpgmap_map_width' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_map_width'] ) ),
98
+ 'wpgmap_map_height' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_map_height'] ) ),
99
+ 'wpgmap_map_type' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_map_type'] ) ),
100
+ 'wpgmap_show_infowindow' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_show_infowindow'] ) ),
101
+ 'wpgmap_enable_direction' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_enable_direction'] ) ),
102
+ // map center lat lng
103
+ 'wpgmap_center_lat_lng' => sanitize_text_field( wp_unslash( $_POST['map_data']['wpgmap_center_lat_lng'] ) ),
104
+ 'wgm_theme_json' => sanitize_textarea_field( wp_unslash( $_POST['map_data']['wgm_theme_json'] ) )
105
+ );
106
+ $meta_data['wgm_theme_json'] = json_encode(json_decode(sanitize_textarea_field( wp_unslash($meta_data['wgm_theme_json']))));
107
+ $action_type = sanitize_text_field( wp_unslash( $_POST['map_data']['action_type'] ) );
108
+ if ( $meta_data['wpgmap_latlng'] === '' ) {
109
+ $error = 'Please input Latitude and Longitude';
110
+ }
111
+ if ( strlen( $error ) > 0 ) {
112
+ echo wp_json_encode(
113
+ array(
114
+ 'responseCode' => 0,
115
+ 'message' => $error,
116
+ )
117
+ );
118
+ wp_die();
119
+ }
120
+
121
+ $post_id = 0;
122
+ if ( $action_type === 'save' ) {
123
+ // Saving post array
124
+ $post_array = array(
125
+ 'post_type' => 'wpgmapembed',
126
+ );
127
+ $post_id = wp_insert_post( $post_array );
128
+ } elseif ( $action_type === 'update' ) {
129
+ $post_id = intval( sanitize_text_field( wp_unslash( $_POST['map_data']['post_id'] ) ) );
130
+ }
131
+
132
+ // Updating post meta
133
+ foreach ( $meta_data as $key => $value ) {
134
+ $this->wgm_update_post_meta( $post_id, $key, $value );
135
+ }
136
+ $return_array = array(
137
+ 'responseCode' => 1,
138
+ 'post_id' => intval( $post_id ),
139
+ );
140
+ if ( $action_type === 'save' ) {
141
+ global $wpdb;
142
+ $wpdb->update(
143
+ $wpdb->prefix . 'wgm_markers',
144
+ array( 'map_id' => intval( $post_id ) ),
145
+ array( 'map_id' => 0 ),
146
+ array( '%d' ),
147
+ array( '%d' )
148
+ );
149
+ $return_array['message'] = 'Map created Successfully.';
150
+ } elseif ( $action_type === 'update' ) {
151
+ $return_array['message'] = 'Map updated Successfully.';
152
+ }
153
+ echo wp_json_encode( $return_array );
154
+ wp_die();
155
+ }
156
+
157
+ /**
158
+ * Classic editor: Loading popup content on WP Google Map click
159
+ */
160
+ public function load_popup_wpgmapembed_list() {
161
+ if ( ! current_user_can( 'administrator' ) ) {
162
+ echo wp_json_encode(
163
+ array(
164
+ 'responseCode' => 0,
165
+ 'message' => 'Unauthorized access tried.',
166
+ )
167
+ );
168
+ wp_die();
169
+ }
170
+ if ( ! isset( $_POST['data']['c_s_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['data']['c_s_nonce'] ) ), 'c_s_nonce' ) ) {
171
+ die( 'Busted!' );
172
+ }
173
+ $content = '';
174
+ $args = array(
175
+ 'post_type' => 'wpgmapembed',
176
+ 'posts_per_page' => - 1,
177
+ 'post_status' => 'draft',
178
+ );
179
+ $maps_list = new WP_Query( $args );
180
+
181
+ while ( $maps_list->have_posts() ) {
182
+ $maps_list->the_post();
183
+ $title = get_post_meta( get_the_ID(), 'wpgmap_title', true );
184
+ $content .= '<div class="wp-gmap-single">
185
+ <div class="wp-gmap-single-left">
186
+ <div class="wp-gmap-single-title">
187
+ ' . esc_html( $title ) . '
188
+ </div>
189
+ <div class="wp-gmap-single-shortcode">
190
+ <input class="wpgmap-shortcode regular-text" type="text" value="[gmap-embed id=&quot;' . get_the_ID() . '&quot;]"
191
+ onclick="this.select()"/>
192
+ </div>
193
+ </div>
194
+ <div class="wp-gmap-single-action">
195
+ <button type="button"
196
+ class="button media-button button-primary button-large wpgmap-insert-shortcode">
197
+ Insert
198
+ </button>
199
+ </div>
200
+ </div>';
201
+ }
202
+ $allowed_html = [
203
+ 'a' => [],
204
+ 'br' => [],
205
+ 'em' => [],
206
+ 'strong' => [],
207
+ 'div' => [
208
+ 'class' => []
209
+ ],
210
+ 'button' => [
211
+ 'type' => [],
212
+ 'class' => []
213
+ ],
214
+ 'input' => [
215
+ 'class' => [],
216
+ 'value' => [],
217
+ 'name' => [],
218
+ 'onclick' => [],
219
+ ],
220
+ ];
221
+ echo wp_kses( wp_unslash( $content ), $allowed_html );
222
+ wp_die();
223
+ }
224
+
225
+ /**
226
+ * Get map data by mnap id
227
+ *
228
+ * @param string $gmap_id
229
+ *
230
+ * @return false|string
231
+ */
232
+ public function get_wpgmapembed_data( $gmap_id = 0 ) {
233
+ if ( $gmap_id == 0 ) {
234
+ $gmap_id = intval( sanitize_text_field( wp_unslash( $_POST['wpgmap_id'] ) ) );
235
+ }
236
+
237
+ $gmap_data = array(
238
+ 'wpgmap_id' => intval( $gmap_id ),
239
+ 'wpgmap_title' => esc_html( get_post_meta( $gmap_id, 'wpgmap_title', true ) ),
240
+ 'wpgmap_heading_class' => esc_html( get_post_meta( $gmap_id, 'wpgmap_heading_class', true ) ),
241
+ 'wpgmap_show_heading' => esc_html( get_post_meta( $gmap_id, 'wpgmap_show_heading', true ) ),
242
+ 'wpgmap_latlng' => esc_html( get_post_meta( $gmap_id, 'wpgmap_latlng', true ) ),
243
+ 'wpgmap_map_zoom' => esc_html( get_post_meta( $gmap_id, 'wpgmap_map_zoom', true ) ),
244
+ 'wpgmap_disable_zoom_scroll' => esc_html( get_post_meta( $gmap_id, 'wpgmap_disable_zoom_scroll', true ) ),
245
+ 'wpgmap_map_width' => esc_html( get_post_meta( $gmap_id, 'wpgmap_map_width', true ) ),
246
+ 'wpgmap_map_height' => esc_html( get_post_meta( $gmap_id, 'wpgmap_map_height', true ) ),
247
+ 'wpgmap_map_type' => esc_html( get_post_meta( $gmap_id, 'wpgmap_map_type', true ) ),
248
+ 'wpgmap_show_infowindow' => esc_html( get_post_meta( $gmap_id, 'wpgmap_show_infowindow', true ) ),
249
+ 'wpgmap_enable_direction' => esc_html( get_post_meta( $gmap_id, 'wpgmap_enable_direction', true ) ),
250
+ 'wgm_theme_json' => wp_kses_data( get_post_meta( $gmap_id, 'wgm_theme_json', true ) ),
251
+ 'wpgmap_center_lat_lng' => esc_html( get_center_lat_lng_by_map_id( $gmap_id ) ),
252
+ );
253
+ $gmap_data['wgm_theme_json'] = strlen($gmap_data['wgm_theme_json'])==0?'[]':wp_kses_data($gmap_data['wgm_theme_json']);
254
+ return wp_json_encode( $gmap_data );
255
+ }
256
+
257
+ /**
258
+ * Remove map including post meta by map id
259
+ */
260
+ public function remove_wpgmapembed_data() {
261
+ if ( ! current_user_can( 'administrator' ) ) {
262
+ $return_array = array(
263
+ 'responseCode' => 0,
264
+ 'message' => 'Unauthorized access tried.',
265
+ );
266
+ echo wp_json_encode( $return_array );
267
+ wp_die();
268
+ }
269
+ if ( ! isset( $_POST['c_s_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['c_s_nonce'] ) ), 'c_s_nonce' ) ) {
270
+ die( 'Busted!' );
271
+ }
272
+ $meta_data = array(
273
+ 'wpgmap_title',
274
+ 'wpgmap_heading_class',
275
+ 'wpgmap_show_heading',
276
+ 'wpgmap_latlng',
277
+ 'wpgmap_map_zoom',
278
+ 'wpgmap_disable_zoom_scroll',
279
+ 'wpgmap_map_width',
280
+ 'wpgmap_map_height',
281
+ 'wpgmap_map_type',
282
+ 'wpgmap_show_infowindow',
283
+ 'wpgmap_enable_direction',
284
+ );
285
+
286
+ $post_id = intval( sanitize_text_field( wp_unslash( $_POST['post_id'] ) ) );
287
+ wp_delete_post( $post_id );
288
+ foreach ( $meta_data as $field_name => $value ) {
289
+ delete_post_meta( $post_id, $field_name, $value );
290
+ }
291
+ $return_array = array(
292
+ 'responseCode' => 1,
293
+ 'message' => 'Deleted Successfully.',
294
+ );
295
+ echo wp_json_encode( $return_array );
296
+ wp_die();
297
+ }
298
+ }
includes/traits/MarkerCRUD.php ADDED
@@ -0,0 +1,458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait MarkerCRUD: Map CRUD operation doing here
11
+ */
12
+ trait MarkerCRUD {
13
+
14
+
15
+ /**
16
+ * Get Marker default values
17
+ *
18
+ * @return array
19
+ */
20
+ public function get_marker_default_values() {
21
+ return array(
22
+ 'map_id' => 0,
23
+ 'marker_name' => null,
24
+ 'marker_desc' => null,
25
+ 'icon' => null,
26
+ 'address' => null,
27
+ 'lat_lng' => null,
28
+ 'have_marker_link' => 0,
29
+ 'marker_link' => null,
30
+ 'marker_link_new_tab' => 0,
31
+ 'show_desc_by_default' => 0,
32
+ 'created_at' => current_time( 'mysql' ),
33
+ 'created_by' => get_current_user_id(),
34
+ 'updated_at' => current_time( 'mysql' ),
35
+ 'updated_by' => get_current_user_id(),
36
+ );
37
+ }
38
+
39
+ /**
40
+ * To save new map marker
41
+ */
42
+ public function save_map_marker() {
43
+ if ( ! current_user_can( 'administrator' ) ) {
44
+ $return_array = array(
45
+ 'responseCode' => 0,
46
+ 'message' => 'Unauthorized access tried.',
47
+ );
48
+ echo wp_json_encode( $return_array );
49
+ wp_die();
50
+ }
51
+
52
+ if ( ! isset( $_POST['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
53
+ die( 'Busted!' );
54
+ }
55
+
56
+ global $wpdb;
57
+
58
+ $map_id = intval( sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_map_id'] ) ) );
59
+ $error = '';
60
+ // Getting ajax fields value
61
+ $map_marker_data = array(
62
+ 'map_id' => $map_id,
63
+ 'marker_name' => strlen( sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_name'] ) ) ) === 0 ? null : sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_name'] ) ),
64
+ 'marker_desc' => wp_kses_post( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_desc'] ) ),
65
+ 'icon' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_icon'] ) ),
66
+ 'address' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_address'] ) ),
67
+ 'lat_lng' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_lat_lng'] ) ),
68
+ 'have_marker_link' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_have_marker_link'] ) ),
69
+ 'marker_link' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_link'] ) ),
70
+ 'marker_link_new_tab' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_link_new_tab'] ) ),
71
+ 'show_desc_by_default' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_infowindow_show'] ) ),
72
+ );
73
+ if ( $map_marker_data['lat_lng'] === '' ) {
74
+ $error = __( 'Please input Latitude and Longitude', 'gmap-embed' );
75
+ }
76
+ if ( strlen( $error ) > 0 ) {
77
+ echo wp_json_encode(
78
+ array(
79
+ 'responseCode' => 0,
80
+ 'message' => $error,
81
+ )
82
+ );
83
+ wp_die();
84
+ }
85
+
86
+ if ( ! _wgm_is_premium() ) {
87
+ $no_of_marker_already_have = $this->get_no_of_markers_by_map_id( intval( $map_id ) );
88
+ if ( $no_of_marker_already_have > 0 ) {
89
+ echo wp_json_encode(
90
+ array(
91
+ 'responseCode' => 0,
92
+ 'message' => __( 'Please upgrade to premium version to create unlimited markers', 'gmap-embed' ),
93
+ )
94
+ );
95
+ wp_die();
96
+ }
97
+ }
98
+
99
+ $defaults = $this->get_marker_default_values();
100
+ $wp_gmap_marker_data = wp_parse_args( $map_marker_data, $defaults );
101
+ $wpdb->insert(
102
+ $wpdb->prefix . 'wgm_markers',
103
+ $wp_gmap_marker_data,
104
+ array(
105
+ '%d',
106
+ '%s',
107
+ '%s',
108
+ '%s',
109
+ '%s',
110
+ '%s',
111
+ '%d',
112
+ '%s',
113
+ '%d',
114
+ '%d',
115
+ '%s',
116
+ '%d',
117
+ '%s',
118
+ '%d',
119
+ )
120
+ );
121
+
122
+ $return_array = array(
123
+ 'responseCode' => 1,
124
+ 'marker_id' => intval( $wpdb->insert_id ),
125
+ );
126
+ $return_array['message'] = 'Marker Saved Successfully.';
127
+ echo wp_json_encode( $return_array );
128
+ wp_die();
129
+ }
130
+
131
+ /**
132
+ * To update existing marker information
133
+ */
134
+
135
+ public function update_map_marker() {
136
+ if ( ! current_user_can( 'administrator' ) ) {
137
+ $return_array = array(
138
+ 'responseCode' => 0,
139
+ 'message' => 'Unauthorized access tried.',
140
+ );
141
+ echo wp_json_encode( $return_array );
142
+ wp_die();
143
+ }
144
+ if ( ! isset( $_POST['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
145
+ die( 'Busted!' );
146
+ }
147
+
148
+ global $wpdb;
149
+ $error = '';
150
+ $marker_id = intval( sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_id'] ) ) );
151
+ $map_id = intval( sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_map_id'] ) ) );
152
+ // Getting ajax fields value
153
+ $map_marker_data = array(
154
+ 'map_id' => $map_id,
155
+ 'marker_name' => strlen( sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_name'] ) ) ) === 0 ? null : sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_name'] ) ),
156
+ 'marker_desc' => wp_kses_post( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_desc'] ) ),
157
+ 'icon' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_icon'] ) ),
158
+ 'address' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_address'] ) ),
159
+ 'lat_lng' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_lat_lng'] ) ),
160
+ 'have_marker_link' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_have_marker_link'] ) ),
161
+ 'marker_link' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_link'] ) ),
162
+ 'marker_link_new_tab' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_link_new_tab'] ) ),
163
+ 'show_desc_by_default' => sanitize_text_field( wp_unslash( $_POST['map_markers_data']['wpgmap_marker_infowindow_show'] ) ),
164
+ );
165
+ if ( $map_marker_data['lat_lng'] === '' ) {
166
+ $error = __( 'Please input Latitude and Longitude', 'gmap-embed' );
167
+ }
168
+ if ( strlen( $error ) > 0 ) {
169
+ echo wp_json_encode(
170
+ array(
171
+ 'responseCode' => 0,
172
+ 'message' => $error,
173
+ )
174
+ );
175
+ wp_die();
176
+ }
177
+
178
+ $defaults = $this->get_marker_default_values();
179
+ $wp_gmap_marker_data = wp_parse_args( $map_marker_data, $defaults );
180
+
181
+ $wpdb->update(
182
+ $wpdb->prefix . 'wgm_markers',
183
+ $wp_gmap_marker_data,
184
+ array( 'id' => intval( $marker_id ) ),
185
+ array(
186
+ '%d',
187
+ '%s',
188
+ '%s',
189
+ '%s',
190
+ '%s',
191
+ '%s',
192
+ '%d',
193
+ '%s',
194
+ '%d',
195
+ '%d',
196
+ '%s',
197
+ '%d',
198
+ '%s',
199
+ '%d',
200
+ ),
201
+ array( '%d' )
202
+ );
203
+
204
+ $return_array = array(
205
+ 'responseCode' => 1,
206
+ 'marker_id' => intval( $marker_id ),
207
+ );
208
+ $return_array['message'] = 'Updated Successfully.';
209
+ echo wp_json_encode( $return_array );
210
+ wp_die();
211
+ }
212
+
213
+ /**
214
+ * Get all marker icons/pins
215
+ */
216
+ public function get_marker_icons() {
217
+ if ( ! current_user_can( 'administrator' ) ) {
218
+ $return_array = array(
219
+ 'responseCode' => 0,
220
+ 'message' => 'Unauthorized access tried.',
221
+ );
222
+ echo wp_json_encode( $return_array );
223
+ wp_die();
224
+ }
225
+ if ( ! isset( $_GET['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
226
+ die( 'Busted!' );
227
+ }
228
+ ob_start();
229
+ require_once WGM_PLUGIN_PATH . 'admin/includes/markers-icons.php';
230
+ echo ob_get_clean();
231
+ wp_die();
232
+ }
233
+
234
+ /**
235
+ * Save Marker Icon
236
+ */
237
+ public function save_marker_icon() {
238
+ if ( ! current_user_can( 'administrator' ) ) {
239
+ $return_array = array(
240
+ 'responseCode' => 0,
241
+ 'message' => 'Unauthorized access tried.',
242
+ );
243
+ echo wp_json_encode( $return_array );
244
+ wp_die();
245
+ }
246
+ if ( ! isset( $_POST['data']['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['data']['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
247
+ die( 'Busted!' );
248
+ }
249
+
250
+ global $wpdb;
251
+ $error = '';
252
+ $icon_url = sanitize_text_field( $_POST['data']['icon_url'] );
253
+ // Getting ajax fields value
254
+ $map_icon_data = array(
255
+ 'type' => 'uploaded_marker_icon',
256
+ 'title' => '',
257
+ 'desc' => '',
258
+ 'file_name' => esc_url( $icon_url ),
259
+ );
260
+
261
+ $is_marker_icon_already_exist = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wgm_icons WHERE file_name='%s'", esc_url( $icon_url ) ) );
262
+ if ( $is_marker_icon_already_exist == 0 ) {
263
+ $defaults = array(
264
+ 'file_name' => '',
265
+ );
266
+ $wp_gmap_marker_icon = wp_parse_args( $map_icon_data, $defaults );
267
+ $wpdb->insert(
268
+ $wpdb->prefix . 'wgm_icons',
269
+ $wp_gmap_marker_icon,
270
+ array(
271
+ '%s',
272
+ '%s',
273
+ '%s',
274
+ '%s',
275
+ )
276
+ );
277
+ }
278
+
279
+ $return_array = array(
280
+ 'responseCode' => 1,
281
+ 'icon_url' => esc_url( $icon_url ),
282
+ );
283
+ $return_array['message'] = 'Updated Successfully.';
284
+ echo wp_json_encode( $return_array );
285
+ wp_die();
286
+ }
287
+
288
+ /**
289
+ * Get no of markers by map id
290
+ *
291
+ * @param $map_id int
292
+ *
293
+ * @retun int
294
+ */
295
+ public function get_no_of_markers_by_map_id( $map_id = 0 ) {
296
+ global $wpdb;
297
+ $map_id = intval( sanitize_text_field( wp_unslash( $map_id ) ) );
298
+
299
+ return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", intval( $map_id ) ) );
300
+ }
301
+
302
+ /**
303
+ * Get all markers by map id
304
+ */
305
+ public function get_markers_by_map_id() {
306
+ if ( ! current_user_can( 'administrator' ) ) {
307
+ echo wp_json_encode(
308
+ array(
309
+ 'responseCode' => 0,
310
+ 'message' => 'Unauthorized access tried.',
311
+ )
312
+ );
313
+ wp_die();
314
+ }
315
+ if ( ! isset( $_POST['data']['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['data']['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
316
+ die( 'Busted!' );
317
+ }
318
+
319
+ global $wpdb;
320
+ $map_id = intval( sanitize_text_field( wp_unslash( $_POST['data']['map_id'] ) ) );
321
+ $filtered_map_markers = array();
322
+ $map_markers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", intval( $map_id ) ) );
323
+ if ( count( $map_markers ) > 0 ) {
324
+ foreach ( $map_markers as $key => $map_marker ) {
325
+ $map_marker->marker_desc = wp_unslash( html_entity_decode( $map_marker->marker_desc ) );
326
+ $filtered_map_markers[ $key ] = $map_marker;
327
+ }
328
+ }
329
+ $return_array = array(
330
+ 'responseCode' => 1,
331
+ 'markers' => $filtered_map_markers,
332
+ );
333
+ $return_array['message'] = 'Markers fetched successfully.';
334
+ echo wp_json_encode( $return_array );
335
+ wp_die();
336
+ }
337
+
338
+ /**
339
+ * Public Get all markers by map id
340
+ */
341
+ public function p_get_markers_by_map_id() {
342
+ if ( ! isset( $_POST['data']['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['data']['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
343
+ die( 'Busted!' );
344
+ }
345
+
346
+ global $wpdb;
347
+ $map_id = intval( sanitize_text_field( wp_unslash( $_POST['data']['map_id'] ) ) );
348
+ $filtered_map_markers = array();
349
+ $map_markers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", intval( $map_id ) ) );
350
+ if ( count( $map_markers ) > 0 ) {
351
+ foreach ( $map_markers as $key => $map_marker ) {
352
+ $map_marker->marker_desc = wp_unslash( html_entity_decode( $map_marker->marker_desc ) );
353
+ $filtered_map_markers[ $key ] = $map_marker;
354
+ }
355
+ }
356
+ $return_array = array(
357
+ 'responseCode' => 1,
358
+ 'markers' => $filtered_map_markers,
359
+ );
360
+ $return_array['message'] = 'Markers fetched successfully.';
361
+ echo wp_json_encode( $return_array );
362
+ wp_die();
363
+ }
364
+
365
+ /**
366
+ * Get markers by map id for datatable
367
+ */
368
+ public function wgm_get_markers_by_map_id_for_dt() {
369
+ if ( ! current_user_can( 'administrator' ) ) {
370
+ echo wp_json_encode(
371
+ array(
372
+ 'responseCode' => 0,
373
+ 'message' => 'Unauthorized access tried.',
374
+ )
375
+ );
376
+ wp_die();
377
+ }
378
+ if ( ! isset( $_GET['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
379
+ die( 'Busted!' );
380
+ }
381
+ $return_json = array();
382
+ global $wpdb;
383
+ $map_id = intval( sanitize_text_field( wp_unslash( $_GET['map_id'] ) ) );
384
+ $wpgmap_markers = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wgm_markers WHERE map_id='%d'", intval( $map_id ) ) );
385
+ if ( count( $wpgmap_markers ) > 0 ) {
386
+ foreach ( $wpgmap_markers as $marker_key => $wpgmap_marker ) {
387
+ $action = '<a href="" class="wpgmap_marker_edit button button-small"
388
+ map_marker_id="' . esc_attr( $wpgmap_marker->id ) . '"><i class="fas fa-edit"></i></a>
389
+ <a href="" class="wpgmap_marker_view button button-small"
390
+ map_marker_id="' . esc_attr( $wpgmap_marker->id ) . '"><i class="fas fa-eye"></i></a>
391
+ <a href="" class="wpgmap_marker_trash button button-small"
392
+ map_marker_id="' . esc_attr( $wpgmap_marker->id ) . '"><i class="fas fa-trash"></i></a>';
393
+ $row = array(
394
+ 'id' => intval( esc_html( $wpgmap_marker->id ) ),
395
+ 'marker_name' => esc_html( $wpgmap_marker->marker_name ),
396
+ 'icon' => '<img src="' . esc_url( $wpgmap_marker->icon ) . '" width="20">',
397
+ 'action' => $action,
398
+ );
399
+ $return_json[] = $row;
400
+ }
401
+ }
402
+ // return the result to the ajax request and die
403
+ echo wp_json_encode( array( 'data' => $return_json ) );
404
+ wp_die();
405
+ }
406
+
407
+ /**
408
+ * Delete single marker
409
+ */
410
+ public function delete_marker() {
411
+ if ( ! current_user_can( 'administrator' ) ) {
412
+ $return_array = array(
413
+ 'responseCode' => 0,
414
+ 'message' => 'Unauthorized access tried.',
415
+ );
416
+ echo wp_json_encode( $return_array );
417
+ wp_die();
418
+ }
419
+ if ( ! isset( $_POST['data']['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['data']['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
420
+ die( 'Busted!' );
421
+ }
422
+
423
+ $marker_id = intval( sanitize_text_field( wp_unslash( $_POST['data']['marker_id'] ) ) );
424
+ global $wpdb;
425
+ $wpdb->delete(
426
+ $wpdb->prefix . 'wgm_markers',
427
+ array(
428
+ 'id' => $marker_id,
429
+ ),
430
+ array(
431
+ '%d',
432
+ )
433
+ );
434
+ }
435
+
436
+ /**
437
+ * Get marker single data by marker ID
438
+ */
439
+ public function get_marker_data_by_marker_id() {
440
+ if ( ! current_user_can( 'administrator' ) ) {
441
+ $return_array = array(
442
+ 'responseCode' => 0,
443
+ 'message' => 'Unauthorized access tried.',
444
+ );
445
+ echo wp_json_encode( $return_array );
446
+ wp_die();
447
+ }
448
+ if ( ! isset( $_POST['data']['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['data']['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
449
+ die( 'Busted!' );
450
+ }
451
+ global $wpdb;
452
+ $marker_id = intval( sanitize_text_field( wp_unslash( $_POST['data']['marker_id'] ) ) );
453
+ $result = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wgm_markers WHERE id='%d'", intval( $marker_id ) ), OBJECT );
454
+ $result->marker_desc = wp_unslash( html_entity_decode( $result->marker_desc ) );
455
+ echo wp_json_encode( $result );
456
+ wp_die();
457
+ }
458
+ }
includes/traits/MediaButtons.php ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait MediaButtons: for plugins media buttons including
11
+ */
12
+ trait MediaButtons {
13
+
14
+ public function add_wp_google_map_media_button() {
15
+ // path to my icon
16
+ $img = WGM_PLUGIN_URL . 'gmap_icon_18.png';
17
+
18
+ // the id of the container I want to show in the popup
19
+ $container_id = 'wp_gmap_popup_container';
20
+
21
+ // our popup's title
22
+ $title = 'Select your desired map to insert into post';
23
+
24
+ // append the icon
25
+ $context = "<a class='button thickbox' title='" . esc_attr( $title ) . "'
26
+ href='#TB_inline?width=700&height=450&inlineId=" . esc_attr( $container_id ) . "'>
27
+ " . '<span class="wp-media-buttons-icon" style="background: url(' . esc_url( $img ) . ') no-repeat; background-position: left bottom;"></span>' . 'WP Google Map</a>';
28
+
29
+ $allowed_html = [
30
+ 'a' => [
31
+ 'class' => [],
32
+ 'id' => [],
33
+ 'title' => [],
34
+ 'href' => [],
35
+ ],
36
+ 'span' => [
37
+ 'class' => [],
38
+ 'style' => []
39
+ ],
40
+
41
+ ];
42
+ echo wp_kses( $context, $allowed_html);
43
+ }
44
+
45
+ public function wp_google_map_media_button_content() { ?>
46
+ <div id="wp_gmap_popup_container" style="display:none;">
47
+ <!--modal contents-->
48
+ <div id="wgm_all_maps">
49
+ <!---------------------------new map tab-------------->
50
+ <div class="wp-gmap-tab-content active" id="wp-gmap-all">
51
+ <span class="wpgmap_msg_error" style="width:80%;">
52
+
53
+ </span>
54
+ <!--all map tab-->
55
+ <div class="wp-gmap-list">
56
+ <a href="<?php echo esc_url( admin_url() . 'admin.php?page=wpgmapembed&amp;tag=new' ); ?>"
57
+ data-id="wp-gmap-new" class="media-menu-item" style="float:right;">Create New
58
+ Map</a>
59
+ <span class="spinner is-active"
60
+ style="margin: 0px !important;float:left;"></span>
61
+ <div id="wpgmapembed_list"></div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </div>
66
+ <?php
67
+ }
68
+ }
includes/traits/Menu.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait Menu
11
+ */
12
+ trait Menu {
13
+
14
+ /**
15
+ * To create menu in admin panel
16
+ */
17
+ public function gmap_create_menu() {
18
+ // create new top-level menu
19
+ add_menu_page(
20
+ $this->plugin_name,
21
+ $this->plugin_name,
22
+ 'administrator',
23
+ 'wpgmapembed',
24
+ array(
25
+ $this,
26
+ 'srm_gmap_main',
27
+ ),
28
+ 'dashicons-location',
29
+ 11
30
+ );
31
+
32
+ add_submenu_page(
33
+ 'wpgmapembed',
34
+ __( 'All Maps', 'gmap-embed' ),
35
+ __( 'All Maps', 'gmap-embed' ),
36
+ 'administrator',
37
+ 'wpgmapembed',
38
+ array(
39
+ $this,
40
+ 'srm_gmap_main',
41
+ ),
42
+ 0
43
+ );
44
+
45
+ // to create sub menu
46
+ if ( _wgm_can_add_new_map() ) {
47
+ add_submenu_page(
48
+ 'wpgmapembed',
49
+ __( 'Add new Map', 'gmap-embed' ),
50
+ __( 'Add New', 'gmap-embed' ),
51
+ 'administrator',
52
+ 'wpgmapembed-new',
53
+ array(
54
+ $this,
55
+ 'srm_gmap_new',
56
+ ),
57
+ 1
58
+ );
59
+ }
60
+
61
+ // setup wizard menu
62
+ add_submenu_page(
63
+ 'wpgmapembed',
64
+ __( 'Quick Setup', 'gmap-embed' ),
65
+ __( 'Quick Setup', 'gmap-embed' ),
66
+ 'administrator',
67
+ 'wgm_setup_wizard',
68
+ array(
69
+ $this,
70
+ 'wpgmap_setup_wizard',
71
+ ),
72
+ 2
73
+ );
74
+
75
+ add_submenu_page(
76
+ 'wpgmapembed',
77
+ __( 'Support', 'gmap-embed' ),
78
+ __( 'Support', 'gmap-embed' ),
79
+ 'administrator',
80
+ 'wpgmapembed-support',
81
+ array(
82
+ $this,
83
+ 'wgm_support',
84
+ ),
85
+ 3
86
+ );
87
+
88
+ add_submenu_page(
89
+ 'wpgmapembed',
90
+ __( 'Settings', 'gmap-embed' ),
91
+ __( 'Settings', 'gmap-embed' ),
92
+ 'administrator',
93
+ 'wpgmapembed-settings',
94
+ array(
95
+ $this,
96
+ 'wgm_settings',
97
+ ),
98
+ 4
99
+ );
100
+ if ( ! _wgm_is_premium() ) {
101
+ add_submenu_page( 'wpgmapembed', __( '<img draggable="false" role="img" class="emoji" alt="⭐" src="' . esc_url( 'https://s.w.org/images/core/emoji/13.0.1/svg/2b50.svg' ) . '"> Upgrade to Pro', 'gmap-embed' ), __( '<span style="color:yellow"><img draggable="false" role="img" class="emoji" alt="⭐" src="' . esc_url( 'https://s.w.org/images/core/emoji/13.0.1/svg/2b50.svg' ) . '"> Upgrade to Pro</span>', 'gmap-embed' ), 'administrator', esc_url( 'https://wpgooglemap.com/pricing?utm_source=admin_menu&utm_medium=admin_link&utm_campaign=menu_get_license' ), false, 5 );
102
+ }
103
+ }
104
+
105
+ public function wgm_support() {
106
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_support.php';
107
+ }
108
+
109
+
110
+ /**
111
+ * Google Map Embed Mail Page
112
+ */
113
+ public function srm_gmap_main() {
114
+ if ( isset( $_GET['tag'] ) && sanitize_text_field( wp_unslash( $_GET['tag'] ) ) === 'edit' ) {
115
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_edit.php';
116
+ } else {
117
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_list.php';
118
+ }
119
+ }
120
+
121
+ /**
122
+ * Google Map Embed Mail Page
123
+ */
124
+ public function srm_gmap_new() {
125
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_create.php';
126
+ }
127
+
128
+ public function wgm_settings() {
129
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_settings.php';
130
+ }
131
+
132
+ }
includes/traits/Notice.php ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ if ( ! defined( 'ABSPATH' ) ) {
6
+ exit;
7
+ }
8
+
9
+ /**
10
+ * Trait Notice
11
+ */
12
+ trait Notice {
13
+
14
+ /**
15
+ * Generate Different types of notices
16
+ */
17
+ public function gmap_embed_notice_generate() {
18
+ // Review admin notice
19
+ $this->gmap_embed_generate_admin_review_notice();
20
+
21
+ // No API key admin notice
22
+ $this->wgm_no_api_key_added_notice();
23
+ }
24
+
25
+
26
+ public function wgm_no_api_key_added_notice() {
27
+ if ( get_option( 'wpgmap_api_key', 'none' ) === 'none' ) {
28
+ ?>
29
+ <div class="notice notice-info is-dismissible" style="border: 2px #db1c1c solid;">
30
+ <p>
31
+ <?php
32
+ echo sprintf(
33
+ __( 'You must generate your own <b>API Key</b> to use Google Map, Please go to <a href="%1$s" style="font-weight: bold;text-decoration: none;">WP Google Map</a><i class="dashicons dashicons-arrow-right-alt2"></i><a href="%2$s" style="text-decoration: none;font-weight: bold;">Quick Setup</a> to get your API key. <a href="%3$s" target="_blank" style="text-decoration: none;font-weight: bold;"><i class="dashicons dashicons-external"></i>Video Tutorial</a>, <i class="dashicons dashicons-external"></i><a href="%4$s" target="_blank" style="text-decoration: none;font-weight: bold;">Documentation</a>', 'gmap-embed' ),
34
+ esc_url( admin_url( 'admin.php?page=wpgmapembed' ) ),
35
+ esc_url( admin_url( 'admin.php?page=wgm_setup_wizard' ) ),
36
+ esc_url( 'https://youtu.be/9KZOUJ9Gdv8?t=22' ),
37
+ esc_url( 'https://wpgooglemap.com/docs-category/installation?utm_source=wp_admin&utm_medium=admin_link&utm_campaign=header_notice' )
38
+ );
39
+ ?>
40
+ </p>
41
+ </div>
42
+ <?php
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Do something on review already button click
48
+ */
49
+ public function review_already_did() {
50
+ update_option( 'gmap_embed_is_review_done', true );
51
+ }
52
+
53
+ /**
54
+ * Do something on review later button click
55
+ */
56
+ public function review_later() {
57
+ update_option( 'gmap_embed_is_review_snoozed', true );
58
+ update_option( 'gmap_embed_review_snoozed_at', time() );
59
+ }
60
+
61
+ /**
62
+ * Redirect to URL generate
63
+ *
64
+ * @return string
65
+ */
66
+ public function redirect_to() {
67
+ $request_uri = wp_parse_url( sanitize_text_field( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH );
68
+ $query_string = wp_parse_url( sanitize_text_field( $_SERVER['REQUEST_URI'] ), PHP_URL_QUERY );
69
+ parse_str( $query_string, $current_url );
70
+ $unset_array = array( 'dismiss', 'plugin', '_wpnonce', 'later' );
71
+
72
+ foreach ( $unset_array as $value ) {
73
+ if ( isset( $current_url[ $value ] ) ) {
74
+ unset( $current_url[ $value ] );
75
+ }
76
+ }
77
+
78
+ $current_url = http_build_query( $current_url );
79
+ $redirect_url = $request_uri . '?' . $current_url;
80
+ return esc_url( $redirect_url );
81
+ }
82
+
83
+ /**
84
+ * Generate admin panel review notice for WP Google Map plugin
85
+ */
86
+ public function gmap_embed_generate_admin_review_notice() {
87
+ $activation_time = get_option( 'gmap_embed_activation_time', false );
88
+ $is_review_snoozed = get_option( 'gmap_embed_is_review_snoozed' );
89
+ $snoozed_time = get_option( 'gmap_embed_review_snoozed_at' );
90
+
91
+ // How may day's passed after activation
92
+ $seconds_diff = time() - $activation_time;
93
+ $passed_days = ( $seconds_diff / 3600 ) / 24;
94
+
95
+ // Snoozed how many day's before
96
+ $seconds_diff = time() - $snoozed_time;
97
+ $snoozed_before = ( $seconds_diff / 3600 ) / 24;
98
+ $is_review_done = get_option( 'gmap_embed_is_review_done' );
99
+
100
+ /**
101
+ *
102
+ * Review section will shows based on following cases
103
+ * Case 1: Passed three(3) days and not snoozed
104
+ * Case 2: Snoozed before 7 day's
105
+ */
106
+ if ( $is_review_done == false && ( ( $passed_days >= 3 && $is_review_snoozed == false ) || ( $is_review_snoozed == true && $snoozed_before >= 7 ) ) ) {
107
+ $scheme = ( wp_parse_url( sanitize_text_field( $_SERVER['REQUEST_URI'] ), PHP_URL_QUERY ) ) ? '&' : '?';
108
+ $url = esc_url( $_SERVER['REQUEST_URI'] . $scheme );
109
+ $dismiss_link = add_query_arg(
110
+ array(
111
+ 'plugin' => 'gmap-embed',
112
+ 'dismiss' => true,
113
+ '_wpnonce' => wp_create_nonce(),
114
+ ),
115
+ $url
116
+ );
117
+ $later_link = add_query_arg(
118
+ array(
119
+ 'plugin' => 'gmap-embed',
120
+ 'later' => true,
121
+ '_wpnonce' => wp_create_nonce(),
122
+ ),
123
+ $url
124
+ );
125
+ ?>
126
+ <div class="gmap_embed_review_section notice notice-success">
127
+ <img src="<?php echo esc_url( WGM_PLUGIN_URL . 'admin/assets/images/gmap_embed_logo.jpg' ); ?>"
128
+ width="60" style="float: left;margin: 9px 9px 0 5px !important"/>
129
+ <p>
130
+ <?php
131
+ _e(
132
+ "<span style='color:green;'>We hope you're" . ' enjoying of using <b style="color:#007cba">WP Google Map</b> plugin.
133
+ Could you please give us a BIG favour and give it a 5-star rating on WordPress to help us spread the word and boost our motivation!</span>
134
+ ',
135
+ 'gmap-embed'
136
+ );
137
+ ?>
138
+ </p>
139
+ <ul>
140
+ <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
141
+ href="<?php echo esc_url( 'https://wpgooglemap.com/wp-review-forum?utm_source=wp_admin&utm_medium=admin_link&utm_campaign=review_notice' ); ?>"
142
+ target="_blank"><span
143
+ class="dashicons dashicons-external"></span> Ok, you deserve it!</a></li>
144
+ <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
145
+ href="<?php echo esc_url( $dismiss_link ); ?>"><span
146
+ class="dashicons dashicons-smiley"></span> I already did</a></li>
147
+ <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
148
+ href="<?php echo esc_url( $later_link ); ?>"><span
149
+ class="dashicons dashicons-calendar-alt"></span> Maybe Later</a></li>
150
+ <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
151
+ href="<?php echo esc_url( 'https://wpgooglemap.com/wp-support-forum?utm_source=wp_admin&utm_medium=admin_link&utm_campaign=review_notice' ); ?>"
152
+ target="_blank"><span
153
+ class="dashicons dashicons-external"></span> I need help</a></li>
154
+ <li style="display: inline;margin-right:15px;"><a style="text-decoration: none"
155
+ href="<?php echo esc_url( $dismiss_link ); ?>"><span
156
+ class="dashicons dashicons-dismiss"></span> Never show again</a></li>
157
+ </ul>
158
+ </div>
159
+ <?php
160
+ }
161
+ }
162
+ }
includes/traits/PluginsLoadedActions.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ use WGMSRM\Classes\Database;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Trait PluginsLoadedActions
13
+ */
14
+ trait PluginsLoadedActions {
15
+
16
+ /**
17
+ * Fires after plugins loaded
18
+ */
19
+ public function wpgmap_do_after_plugins_loaded() {
20
+ new Database();
21
+ }
22
+ }
includes/traits/Settings.php ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ use WGMSRM\Classes\Migration;
6
+
7
+ if ( ! defined( 'ABSPATH' ) ) {
8
+ exit;
9
+ }
10
+
11
+ /**
12
+ * Trait Settings
13
+ */
14
+ trait Settings {
15
+
16
+ /**
17
+ * Settings section callback code(BLANK NOW)
18
+ */
19
+ public function gmap_embed_settings_section_callback() {
20
+ // code...
21
+ }
22
+
23
+ /**
24
+ * Custom CSS part markup
25
+ */
26
+ public function gmap_embed_s_custom_css_markup() { ?>
27
+ <textarea rows="10" cols="100" name="wpgmap_s_custom_css"
28
+ id="wpgmap_custom_css"><?php echo esc_html( get_option( 'wpgmap_s_custom_css' ) ); ?></textarea>
29
+ <p class="description" id="tagline-description" style="font-style: italic;">
30
+ <?php esc_html_e( 'Add your custom CSS code if needed.', 'gmap-embed' ); ?>
31
+ </p>
32
+ <?php
33
+ }
34
+
35
+ /**
36
+ * Custom JS part markup
37
+ */
38
+ public function wpgmap_s_custom_js_markup() {
39
+ ?>
40
+ <textarea rows="10" cols="100" name="wpgmap_s_custom_js"
41
+ id="wpgmap_custom_js"><?php echo esc_html( get_option( 'wpgmap_s_custom_js' ) ); ?></textarea>
42
+ <p class="description" id="tagline-description" style="font-style: italic;">
43
+ <?php esc_html_e( 'Add your custom JS code if needed.', 'gmap-embed' ); ?>
44
+ </p>
45
+ <?php
46
+ }
47
+
48
+ /**
49
+ * Where Map API engine should be -> Markup
50
+ *
51
+ * @since 1.7.5
52
+ */
53
+ public function wgm_load_api_condition_markup() {
54
+ ?>
55
+ <select name="_wgm_load_map_api_condition" id="_wgm_load_map_api_condition">
56
+ <option value="where-required" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'where-required' ? 'selected' : '' ); ?>>
57
+ Where required
58
+ </option>
59
+ <option value="always" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'always' ? 'selected' : '' ); ?>>
60
+ Always
61
+ </option>
62
+ <option value="only-front-end" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'only-front-end' ? 'selected' : '' ); ?>>
63
+ Only Front End
64
+ </option>
65
+ <option value="only-back-end" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'only-back-end' ? 'selected' : '' ); ?>>
66
+ Only Back End
67
+ </option>
68
+ <option value="never" <?php echo esc_attr( get_option( '_wgm_load_map_api_condition' ) == 'never' ? 'selected' : '' ); ?>>
69
+ Never
70
+ </option>
71
+ </select>
72
+ <?php
73
+ }
74
+
75
+ /**
76
+ * Prevent API load by other plugin or theme markup
77
+ *
78
+ * @since 1.7.5
79
+ */
80
+ public function wgm_prevent_api_load_markup() {
81
+ ?>
82
+ <input type="checkbox" name="_wgm_prevent_other_plugin_theme_api_load"
83
+ id="_wgm_prevent_other_plugin_theme_api_load"
84
+ value="Y" <?php echo esc_attr( get_option( '_wgm_prevent_other_plugin_theme_api_load' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Check this option if your want to prevent other plugin or theme loading map api, in case of you are getting api key error, included multiple api key error.
85
+ <br/>
86
+ <?php
87
+ }
88
+
89
+ /**
90
+ * General Map Settings under General Settings
91
+ *
92
+ * @since 1.7.5
93
+ */
94
+ public function wgm_general_map_settings_markup() {
95
+ ?>
96
+ <input type="checkbox" name="_wgm_disable_full_screen_control" id="_wgm_disable_full_screen_control"
97
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_full_screen_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Full Screen Control
98
+ <br/>
99
+ <input type="checkbox" name="_wgm_disable_street_view" id="_wgm_disable_street_view"
100
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_street_view' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable StreetView
101
+ <br/>
102
+ <input type="checkbox" name="_wgm_disable_zoom_control" id="_wgm_disable_zoom_control"
103
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_zoom_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Zoom Controls
104
+ <br/>
105
+ <input type="checkbox" name="_wgm_disable_pan_control" id="_wgm_disable_pan_control"
106
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_pan_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Pan Controls
107
+ <br/>
108
+ <input type="checkbox" name="_wgm_disable_map_type_control" id="_wgm_disable_map_type_control"
109
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_map_type_control' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Map Type Controls
110
+ <br/>
111
+ <input type="checkbox" name="_wgm_disable_mouse_wheel_zoom" id="_wgm_disable_mouse_wheel_zoom"
112
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_mouse_wheel_zoom' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Mouse Wheel Zoom
113
+ <br/>
114
+ <input type="checkbox" name="_wgm_disable_mouse_dragging" id="_wgm_disable_mouse_dragging"
115
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_mouse_dragging' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Mouse Dragging
116
+ <br/>
117
+ <input type="checkbox" name="_wgm_disable_mouse_double_click_zooming"
118
+ id="_wgm_disable_mouse_double_click_zooming"
119
+ value="Y" <?php echo esc_attr( get_option( '_wgm_disable_mouse_double_click_zooming' ) == 'Y' ? 'checked="checked"' : '' ); ?>> Disable Mouse Double Click Zooming
120
+ <br/>
121
+ <?php
122
+ }
123
+
124
+ /**
125
+ * Language selection part markup
126
+ */
127
+ public function gmap_embed_s_map_language_markup() {
128
+ ?>
129
+ <select id="srm_gmap_lng" name="srm_gmap_lng" class="regular-text" style="width: 100%;max-width:100%;">
130
+ <?php
131
+ $wpgmap_languages = gmap_embed_get_languages();
132
+ if ( count( $wpgmap_languages ) > 0 ) {
133
+ foreach ( $wpgmap_languages as $lng_key => $language ) {
134
+ $selected = '';
135
+ if ( get_option( 'srm_gmap_lng', 'en' ) == $lng_key ) {
136
+ $selected = 'selected';
137
+ }
138
+ echo "<option value='" . esc_attr( $lng_key ) . "' " . esc_attr( $selected ) . '>' . esc_html( $language ) . '</option>';
139
+ }
140
+ }
141
+ ?>
142
+ </select>
143
+ <p class="description" id="tagline-description" style="font-style: italic;">
144
+ <?php esc_html_e( 'Chose your desired map language', 'gmap-embed' ); ?>
145
+ </p>
146
+ <?php
147
+ }
148
+
149
+ /**
150
+ * Region selection part markup
151
+ */
152
+ public function gmap_embed_s_map_region_markup() {
153
+ ?>
154
+ <select id="region" name="srm_gmap_region" class="regular-text" style="width: 100%;max-width: 100%;">
155
+ <?php
156
+ $wpgmap_regions = gmap_embed_get_regions();
157
+ if ( count( $wpgmap_regions ) > 0 ) {
158
+ foreach ( $wpgmap_regions as $region_key => $region ) {
159
+ $selected = '';
160
+ if ( get_option( 'srm_gmap_region', 'US' ) == $region_key ) {
161
+ $selected = 'selected';
162
+ }
163
+ echo "<option value='" . esc_attr( $region_key ) . "' " . esc_attr( $selected ) . '>' . esc_html( $region ) . '</option>';
164
+ }
165
+ }
166
+ ?>
167
+
168
+ </select>
169
+ <p class="description" id="tagline-description" style="font-style: italic;">
170
+ <?php esc_html_e( 'Chose your regional area', 'gmap-embed' ); ?>
171
+ </p>
172
+ <?php
173
+ }
174
+
175
+ /**
176
+ * Settings section, fields register
177
+ */
178
+ public function gmapsrm_settings() {
179
+ // Language settings section and fields
180
+ add_settings_section(
181
+ 'gmap_embed_language_settings_section',
182
+ __( 'Map Language and Regional Settings<hr/>', 'gmap-embed' ),
183
+ array( $this, 'gmap_embed_settings_section_callback' ),
184
+ 'gmap-embed-settings-page-ls'
185
+ );
186
+
187
+ add_settings_field(
188
+ 'srm_gmap_lng',
189
+ __( 'Map Language:', 'gmap-embed' ),
190
+ array( $this, 'gmap_embed_s_map_language_markup' ),
191
+ 'gmap-embed-settings-page-ls',
192
+ 'gmap_embed_language_settings_section'
193
+ );
194
+
195
+ add_settings_field(
196
+ 'srm_gmap_region',
197
+ __( 'Map Region:', 'gmap-embed' ),
198
+ array( $this, 'gmap_embed_s_map_region_markup' ),
199
+ 'gmap-embed-settings-page-ls',
200
+ 'gmap_embed_language_settings_section'
201
+ );
202
+
203
+ // Custom Scripts section and fields
204
+ add_settings_section(
205
+ 'gmap_embed_custom_scripts_section',
206
+ __( 'Custom Scripts<hr/>', 'gmap-embed' ),
207
+ array( $this, 'gmap_embed_settings_section_callback' ),
208
+ 'gmap-embed-settings-page-cs'
209
+ );
210
+
211
+ add_settings_field(
212
+ 'wpgmap_s_custom_css',
213
+ __( 'Custom CSS:', 'gmap-embed' ),
214
+ array( $this, 'gmap_embed_s_custom_css_markup' ),
215
+ 'gmap-embed-settings-page-cs',
216
+ 'gmap_embed_custom_scripts_section'
217
+ );
218
+
219
+ add_settings_field(
220
+ 'wpgmap_s_custom_js',
221
+ __( 'Custom JS:', 'gmap-embed' ),
222
+ array( $this, 'wpgmap_s_custom_js_markup' ),
223
+ 'gmap-embed-settings-page-cs',
224
+ 'gmap_embed_custom_scripts_section'
225
+ );
226
+
227
+ /**
228
+ * General map settings section and fields
229
+ *
230
+ * @since 1.7.5
231
+ */
232
+ add_settings_section(
233
+ 'gmap_embed_general_map_settings_section',
234
+ __( '', 'gmap-embed' ),
235
+ array( $this, 'gmap_embed_settings_section_callback' ),
236
+ 'gmap-embed-general-settings'
237
+ );
238
+
239
+ // General map settings related all fields are included
240
+ add_settings_field(
241
+ 'wpgm_disable_full_screen_control',
242
+ __( 'Map Control Options:', 'gmap-embed' ),
243
+ array( $this, 'wgm_general_map_settings_markup' ),
244
+ 'gmap-embed-general-settings',
245
+ 'gmap_embed_general_map_settings_section'
246
+ );
247
+
248
+ /**
249
+ * Advance settings section and fields
250
+ *
251
+ * @since 1.7.5
252
+ */
253
+ add_settings_section(
254
+ 'wgm_advance_settings_section',
255
+ __( '', 'gmap-embed' ),
256
+ array( $this, 'gmap_embed_settings_section_callback' ),
257
+ 'wgm_advance_settings-page'
258
+ );
259
+
260
+ add_settings_field(
261
+ '_wgm_load_map_api_condition',
262
+ __( 'Load Map API:', 'gmap-embed' ),
263
+ array( $this, 'wgm_load_api_condition_markup' ),
264
+ 'wgm_advance_settings-page',
265
+ 'wgm_advance_settings_section'
266
+ );
267
+
268
+ add_settings_field(
269
+ '_wgm_prevent_other_plugin_theme_api_load',
270
+ __( 'Prevent Map API loading for other plugin and themes:', 'gmap-embed' ),
271
+ array( $this, 'wgm_prevent_api_load_markup' ),
272
+ 'wgm_advance_settings-page',
273
+ 'wgm_advance_settings_section'
274
+ );
275
+
276
+ register_setting( 'wpgmap_general_settings', 'srm_gmap_lng' );
277
+ register_setting( 'wpgmap_general_settings', 'srm_gmap_region' );
278
+ register_setting( 'wpgmap_general_settings', 'wpgmap_s_custom_css' );
279
+ register_setting( 'wpgmap_general_settings', 'wpgmap_s_custom_js' );
280
+ /**
281
+ * Map General Settings
282
+ *
283
+ * @since 1.7.5
284
+ */
285
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_full_screen_control' );
286
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_street_view' );
287
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_zoom_control' );
288
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_pan_control' );
289
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_map_type_control' );
290
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_mouse_wheel_zoom' );
291
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_mouse_dragging' );
292
+ register_setting( 'wpgmap_general_settings', '_wgm_disable_mouse_double_click_zooming' );
293
+ /**
294
+ * Advance Settings
295
+ *
296
+ * @since 1.7.5
297
+ */
298
+ register_setting( 'wgm_advance_settings', '_wgm_load_map_api_condition' );
299
+ register_setting( 'wgm_advance_settings', '_wgm_prevent_other_plugin_theme_api_load' );
300
+ }
301
+ }
includes/traits/SetupWizard.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WGMSRM\Traits;
4
+
5
+ /**
6
+ * Trait SetupWizard
7
+ */
8
+ trait SetupWizard {
9
+
10
+ /**
11
+ * Setup Wizard view
12
+ *
13
+ * @since 1.7.5
14
+ */
15
+ public function wpgmap_setup_wizard() {
16
+ require WGM_PLUGIN_PATH . 'admin/includes/wpgmap_setup_wizard.php';
17
+ }
18
+
19
+ /**
20
+ * Save setup wizard information
21
+ *
22
+ * @since 1.7.5
23
+ */
24
+ public function wpgmap_save_setup_wizard() {
25
+ if ( ! current_user_can( 'administrator' ) ) {
26
+ echo wp_json_encode(
27
+ array(
28
+ 'responseCode' => 403,
29
+ )
30
+ );
31
+ wp_die();
32
+ }
33
+ if ( ! isset( $_POST['ajax_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['ajax_nonce'] ) ), 'ajax_nonce' ) ) {
34
+ die( 'Busted!' );
35
+ }
36
+ $api_key = isset( $_POST['wgm_api_key'] ) ? sanitize_text_field( wp_unslash( $_POST['wgm_api_key'] ) ) : '';
37
+ $language = isset( $_POST['wgm_language'] ) ? sanitize_text_field( wp_unslash( $_POST['wgm_language'] ) ) : '';
38
+ $regional_area = isset( $_POST['wgm_regional_area'] ) ? sanitize_text_field( wp_unslash( $_POST['wgm_regional_area'] ) ) : '';
39
+ if ( empty( $api_key ) ) {
40
+ $response = array( 'responseCode' => 101 );
41
+ echo wp_json_encode( $response );
42
+ die();
43
+ }
44
+ if ( empty( $language ) ) {
45
+ $response = array( 'responseCode' => 102 );
46
+ echo wp_json_encode( $response );
47
+ die();
48
+ }
49
+ if ( empty( $regional_area ) ) {
50
+ $response = array( 'responseCode' => 103 );
51
+ echo wp_json_encode( $response );
52
+ die();
53
+ }
54
+ update_option( 'wpgmap_api_key', $api_key, 'yes' );
55
+ update_option( 'srm_gmap_lng', $language, 'yes' );
56
+ update_option( 'srm_gmap_region', $regional_area, 'yes' );
57
+ update_option( 'wgm_is_quick_setup_done', 'Y', 'yes' );
58
+ $response = array( 'responseCode' => 200 );
59
+ echo wp_json_encode( $response );
60
+ die();
61
+ }
62
+ }
index.php CHANGED
@@ -1,2 +1,2 @@
1
  <?php
2
- //Silence is golden
1
  <?php
2
+ // Silence is golden
languages/gmap-embed-da_DK.po CHANGED
@@ -80,8 +80,8 @@ msgid "Disable zoom on mouse scroll"
80
  msgstr "Deaktiver zoom med musen"
81
 
82
  #. Author of the plugin/theme
83
- msgid "srmilon.info"
84
- msgstr "srmilon.info"
85
 
86
  #. Description of the plugin/theme
87
  msgid ""
@@ -95,8 +95,8 @@ msgstr ""
95
  #. Plugin URI of the plugin/theme
96
  #. #-#-#-#-# gmap-embed-code.pot (Google Map Embed 1.3.0) #-#-#-#-#
97
  #. Author URI of the plugin/theme
98
- msgid "https://www.srmilon.info"
99
- msgstr "https://www.srmilon.info"
100
 
101
  #. Plugin Name of the plugin/theme
102
  msgid "Google Map Embed"
80
  msgstr "Deaktiver zoom med musen"
81
 
82
  #. Author of the plugin/theme
83
+ msgid "wpgooglemap.com"
84
+ msgstr "wpgooglemap.com"
85
 
86
  #. Description of the plugin/theme
87
  msgid ""
95
  #. Plugin URI of the plugin/theme
96
  #. #-#-#-#-# gmap-embed-code.pot (Google Map Embed 1.3.0) #-#-#-#-#
97
  #. Author URI of the plugin/theme
98
+ msgid "https://www.wpgooglemap.com"
99
+ msgstr "https://www.wpgooglemap.com"
100
 
101
  #. Plugin Name of the plugin/theme
102
  msgid "Google Map Embed"
languages/gmap-embed-de_DE.po CHANGED
@@ -80,8 +80,8 @@ msgid "The plugin will help to google map Embed in post and pages also in sideba
80
  msgstr "Dieses Plugin hilft dabei Google Maps in Beiträgen und Seiten, sowie als Widget in der Seitenleiste, einzubinden."
81
 
82
  #. Author of the plugin/theme
83
- msgid "srmilon.info"
84
- msgstr "srmilon.info"
85
 
86
  #: includes/wpgmap_create.php:92 includes/wpgmap_edit.php:108
87
  msgid "Show in marker infowindow"
@@ -135,8 +135,8 @@ msgstr "Breitengrad, Längengrad"
135
  #. Plugin URI of the plugin/theme
136
  #. #-#-#-#-# gmap-embed-code.pot (Google Map Embed 1.2.5) #-#-#-#-#
137
  #. Author URI of the plugin/theme
138
- msgid "https://www.srmilon.info"
139
- msgstr "https://www.srmilon.info"
140
 
141
  #: includes/wpgmap_create.php:63 includes/wpgmap_edit.php:73
142
  msgid "Height (px)"
80
  msgstr "Dieses Plugin hilft dabei Google Maps in Beiträgen und Seiten, sowie als Widget in der Seitenleiste, einzubinden."
81
 
82
  #. Author of the plugin/theme
83
+ msgid "wpgooglemap.com"
84
+ msgstr "wpgooglemap.com"
85
 
86
  #: includes/wpgmap_create.php:92 includes/wpgmap_edit.php:108
87
  msgid "Show in marker infowindow"
135
  #. Plugin URI of the plugin/theme
136
  #. #-#-#-#-# gmap-embed-code.pot (Google Map Embed 1.2.5) #-#-#-#-#
137
  #. Author URI of the plugin/theme
138
+ msgid "https://www.wpgooglemap.com"
139
+ msgstr "https://www.wpgooglemap.com"
140
 
141
  #: includes/wpgmap_create.php:63 includes/wpgmap_edit.php:73
142
  msgid "Height (px)"
languages/gmap-embed-de_DE_formal.po CHANGED
@@ -72,8 +72,8 @@ msgid "Zoom"
72
  msgstr "Zoom"
73
 
74
  #. Author of the plugin/theme
75
- msgid "srmilon.info"
76
- msgstr "srmilon.info"
77
 
78
  #: includes/wpgmap_create.php:71 includes/wpgmap_edit.php:82
79
  msgid "Map Type"
@@ -95,8 +95,8 @@ msgstr "Einstellungen"
95
  #. Plugin URI of the plugin/theme
96
  #. #-#-#-#-# gmap-embed-code.pot (Google Map Embed 1.2.5) #-#-#-#-#
97
  #. Author URI of the plugin/theme
98
- msgid "https://www.srmilon.info"
99
- msgstr "https://www.srmilon.info"
100
 
101
  #: includes/wpgmap_create.php:63 includes/wpgmap_edit.php:73
102
  msgid "Height (px)"
72
  msgstr "Zoom"
73
 
74
  #. Author of the plugin/theme
75
+ msgid "wpgooglemap.com"
76
+ msgstr "wpgooglemap.com"
77
 
78
  #: includes/wpgmap_create.php:71 includes/wpgmap_edit.php:82
79
  msgid "Map Type"
95
  #. Plugin URI of the plugin/theme
96
  #. #-#-#-#-# gmap-embed-code.pot (Google Map Embed 1.2.5) #-#-#-#-#
97
  #. Author URI of the plugin/theme
98
+ msgid "https://www.wpgooglemap.com"
99
+ msgstr "https://www.wpgooglemap.com"
100
 
101
  #: includes/wpgmap_create.php:63 includes/wpgmap_edit.php:73
102
  msgid "Height (px)"
languages/gmap-embed-es_ES.po CHANGED
@@ -72,8 +72,8 @@ msgid "Disable zoom on mouse scroll"
72
  msgstr "Desactivar el zoom para el scroll del ratón."
73
 
74
  #. Author of the plugin/theme
75
- msgid "srmilon.info"
76
- msgstr "srmilon.info"
77
 
78
  #. Description of the plugin/theme
79
  msgid "The plugin will help to embed Google Map in post and pages also in sidebar as widget."
72
  msgstr "Desactivar el zoom para el scroll del ratón."
73
 
74
  #. Author of the plugin/theme
75
+ msgid "wpgooglemap.com"
76
+ msgstr "wpgooglemap.com"
77
 
78
  #. Description of the plugin/theme
79
  msgid "The plugin will help to embed Google Map in post and pages also in sidebar as widget."
public/assets/css/front_custom_style.css CHANGED
@@ -1 +1 @@
1
- /*Silence is golden*/
1
+ /*Silence is golden*/
public/includes/shortcodes.php CHANGED
@@ -1,142 +1,144 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
 
 
3
  // ************* WP Google Map Shortcode ***************
4
- if (!function_exists('srm_gmap_embed_shortcode')) {
5
-
6
- /**
7
- * Generate map based on shortcode input
8
- * @param $atts
9
- * @param $content
10
- * @return string
11
- * @since 1.0.0
12
- */
13
- function srm_gmap_embed_shortcode($atts, $content)
14
- {
15
- static $count;
16
- if (!$count) {
17
- $count = 0;
18
- }
19
- $count++;
20
- $wgm_map_id = intval(esc_html($atts['id']));
21
- $wpgmap_title = esc_html(get_post_meta($wgm_map_id, 'wpgmap_title', true));
22
- $wpgmap_show_heading = esc_html(get_post_meta($wgm_map_id, 'wpgmap_show_heading', true));
23
- $wpgmap_heading_class = esc_html(get_post_meta($wgm_map_id, 'wpgmap_heading_class', true));
24
- //$wpgmap_latlng = esc_html(get_post_meta($wgm_map_id, 'wpgmap_latlng', true));
25
- //$wpgmap_disable_zoom_scroll = esc_html(get_post_meta($wgm_map_id, 'wpgmap_disable_zoom_scroll', true));
26
- $wpgmap_map_zoom = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_zoom', true));
27
- $wpgmap_map_width = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_width', true));
28
- $wpgmap_map_height = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_height', true));
29
- $wpgmap_map_type = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_type', true));
30
- //$wpgmap_map_address = esc_html(get_post_meta($wgm_map_id, 'wpgmap_map_address', true));
31
- //$wpgmap_show_infowindow = get_post_meta($wgm_map_id, 'wpgmap_show_infowindow', true);
32
- $wpgmap_enable_direction = get_post_meta($wgm_map_id, 'wpgmap_enable_direction', true);
33
- $wpgmap_center_lat_lng = get_center_lat_lng_by_map_id($wgm_map_id);
34
-
35
- ob_start();
36
- if ($wpgmap_center_lat_lng != '') {
37
- if ($wpgmap_show_heading == '1') {
38
- echo "<h1 class='srm_gmap_heading_$count " . esc_attr($wpgmap_heading_class) . "'>" . esc_html(strip_tags($wpgmap_title)) . "</h1>";
39
- }
40
- ?>
41
  <script type="text/javascript">
42
  jQuery(document).ready(function ($) {
43
- var wgm_map = new google.maps.Map(document.getElementById("srm_gmp_embed_<?php echo $count; ?>"), {
44
- center: new google.maps.LatLng(<?php echo $wpgmap_center_lat_lng;?>),
45
- zoom:<?php echo $wpgmap_map_zoom;?>,
46
- mapTypeId: google.maps.MapTypeId.<?php echo $wpgmap_map_type;?>,
47
- scrollwheel: <?php echo get_option('_wgm_disable_mouse_wheel_zoom') === 'Y' ? 0 : 1; ?>,
48
- zoomControl: <?php echo get_option('_wgm_disable_zoom_control') === 'Y' ? 0 : 1; ?>,
49
- mapTypeControl: <?php echo get_option('_wgm_disable_map_type_control') === 'Y' ? 0 : 1; ?>,
50
- streetViewControl: <?php echo get_option('_wgm_disable_street_view') === 'Y' ? 0 : 1; ?>,
51
- fullscreenControl: <?php echo get_option('_wgm_disable_full_screen_control') === 'Y' ? 0 : 1; ?>,
52
- draggable: <?php echo get_option('_wgm_disable_mouse_dragging') === 'Y' ? 0 : 1; ?>,
53
- disableDoubleClickZoom: <?php echo get_option('_wgm_disable_mouse_double_click_zooming') === 'Y' ? 1 : 0; ?>,
54
- panControl: <?php echo get_option('_wgm_disable_pan_control') === 'Y' ? 0 : 1; ?>
55
-
56
  });
 
 
 
 
57
  // To view directions form and data
58
- <?php if($wpgmap_enable_direction and _wgm_is_premium() ){ ?>
59
- var wgm_directionsDisplay_<?php echo $count;?> = new google.maps.DirectionsRenderer();
60
-
61
- wgm_directionsDisplay_<?php echo $count;?>.setMap(wgm_map);
62
- wgm_directionsDisplay_<?php echo $count;?>.setPanel(document.getElementById("wp_gmap_directions_<?php echo $count; ?>"));
63
-
64
- var wgm_get_direction_btn_<?php echo $count;?> = document.getElementById('wp_gmap_submit_<?php echo $count; ?>');
65
- wgm_get_direction_btn_<?php echo $count;?>.addEventListener('click', function () {
66
- var wgm_selectedMode_<?php echo $count;?> = document.getElementById("srm_gmap_mode_<?php echo $count; ?>").value,
67
- wgm_dirction_start_<?php echo $count;?> = document.getElementById("srm_gmap_from_<?php echo $count; ?>").value,
68
- wgm_direction_end_<?php echo $count;?> = document.getElementById("srm_gmap_to_<?php echo $count; ?>").value;
69
- if (wgm_dirction_start_<?php echo $count;?> === '' || wgm_direction_end_<?php echo $count;?> === '') {
70
  // cannot calculate route
71
- document.getElementById("wp_gmap_results_<?php echo $count; ?>").style.display = 'none';
72
  return false;
73
  } else {
74
 
75
 
76
- document.getElementById('wp_gmap_loading_<?php echo $count; ?>').style.display = 'block';
77
 
78
- var wgm_direction_request_<?php echo $count;?> = {
79
- origin: wgm_dirction_start_<?php echo $count;?>,
80
- destination: wgm_direction_end_<?php echo $count;?>,
81
- travelMode: google.maps.DirectionsTravelMode[wgm_selectedMode_<?php echo $count;?>]
82
  };
83
- var wgm_directionsService_<?php echo $count;?> = new google.maps.DirectionsService();
84
- wgm_directionsService_<?php echo $count;?>.route(wgm_direction_request_<?php echo $count;?>, function (response, status) {
85
- document.getElementById('wp_gmap_loading_<?php echo $count; ?>').style.display = 'none';
86
  if (status === google.maps.DirectionsStatus.OK) {
87
- wgm_directionsDisplay_<?php echo $count;?>.setDirections(response);
88
- document.getElementById("wp_gmap_results_<?php echo $count; ?>").style.display = 'block';
89
  } else {
90
- document.getElementById("wp_gmap_results_<?php echo $count; ?>").style.display = 'none';
91
  }
92
  });
93
 
94
  }
95
  });
96
- <?php }?>
97
- var wgm_data_<?php echo $count;?> = {
98
  'action': 'wpgmapembed_p_get_markers_by_map_id',
99
  'data': {
100
- map_id: '<?php echo $wgm_map_id;?>',
101
- ajax_nonce: '<?php echo wp_create_nonce('ajax_nonce'); ?>'
102
  }
103
  };
104
- var wgm_ajaxurl_<?php echo $count;?> = '<?php echo esc_url(admin_url('admin-ajax.php'));?>'
105
- jQuery.post(wgm_ajaxurl_<?php echo $count;?>, wgm_data_<?php echo $count;?>, function (response) {
106
  response = JSON.parse(response);
107
  if (response.markers.length === 1) {
108
- var wgm_marker_to_<?php echo $count;?> = response.markers[0].marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
109
- jQuery('#srm_gmap_to_<?php echo $count; ?>').val(wgm_marker_to_<?php echo $count;?>.replace(/(<([^>]+)>)/gi, ""));
110
  }
111
- var wgm_default_marker_icon_<?php echo $count;?> = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
112
  if (response.markers.length > 0) {
113
  var custom_markers = [];
114
  var custom_marker_infowindows = [];
115
  response.markers.forEach(function (wgm_marker, i) {
116
- var wgm_marker_lat_lng_<?php echo $count;?> = wgm_marker.lat_lng.split(',');
117
- wgm_custom_marker_<?php echo $count;?> = new google.maps.Marker({
118
- position: new google.maps.LatLng(wgm_marker_lat_lng_<?php echo $count;?>[0], wgm_marker_lat_lng_<?php echo $count;?>[1]),
119
  title: wgm_marker.marker_name,
120
  animation: google.maps.Animation.DROP,
121
- icon: (wgm_marker.icon === '') ? wgm_default_marker_icon_<?php echo $count;?> : wgm_marker.icon
122
  });
123
- custom_markers[i] = wgm_custom_marker_<?php echo $count;?>;
124
- wgm_custom_marker_<?php echo $count;?>.setMap(wgm_map);
125
- var wgm_marker_name_<?php echo $count;?> = (wgm_marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
126
  + wgm_marker.marker_name +
127
  '</span><br/>') : '';
128
  wgm_marker.marker_desc = wgm_marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
129
  custom_marker_infowindow = new google.maps.InfoWindow({
130
- content: wgm_marker_name_<?php echo $count;?> + wgm_marker.marker_desc
131
  });
132
  custom_marker_infowindows[i] = custom_marker_infowindow;
133
  if (wgm_marker.show_desc_by_default === '1') {
134
  custom_marker_infowindow.open({
135
- anchor: wgm_custom_marker_<?php echo $count;?>,
136
  shouldFocus: false
137
  });
138
- }else{
139
- google.maps.event.addListener(wgm_custom_marker_<?php echo $count;?>, 'click', function () {
140
  custom_marker_infowindows[i].open({
141
  anchor: custom_markers[i],
142
  shouldFocus: false
@@ -144,7 +146,7 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
144
  });
145
  }
146
  if (wgm_marker.have_marker_link === '1') {
147
- google.maps.event.addListener(wgm_custom_marker_<?php echo $count;?>, 'click', function () {
148
  var wgm_target = '_self';
149
  if (wgm_marker.marker_link_new_tab === '1') {
150
  wgm_target = '_blank';
@@ -159,12 +161,13 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
159
 
160
  </script>
161
 
162
- <div id="srm_gmp_embed_<?php echo $count; ?>"
163
- style="width:<?php echo esc_attr($wpgmap_map_width) . ' !important'; ?>;height:<?php echo esc_attr($wpgmap_map_height); ?> !important; ">
164
  </div>
165
- <?php
166
 
167
- if ($wpgmap_enable_direction == '1' and _wgm_is_premium()) { ?>
 
168
  <style type="text/css">
169
  .wp_gmap_direction_box {
170
  width: 100%;
@@ -194,53 +197,54 @@ if (!function_exists('srm_gmap_embed_shortcode')) {
194
  <div class="wp_gmap_direction_box">
195
  <div class="ui-bar-c ui-corner-all ui-shadow">
196
  <div data-role="fieldcontain" class="fieldcontain">
197
- <label for="srm_gmap_from_<?php echo $count; ?>"><?php _e('From', 'gmap-embed') ?></label>
198
- <input type="text" id="srm_gmap_from_<?php echo $count; ?>" value="" style="width: 100%;"/>
 
199
  </div>
200
  <div data-role="fieldcontain" class="fieldcontain">
201
- <label for="srm_gmap_to_<?php echo $count; ?>"><?php _e('To', 'gmap-embed') ?></label>
202
- <input type="text" id="srm_gmap_to_<?php echo $count; ?>"
203
  value=""
204
  style="width: 100%"/>
205
  </div>
206
  <div data-role="fieldcontain" class="fieldcontain">
207
- <label for="srm_gmap_mode_<?php echo $count; ?>"
208
- class="select"><?php _e('Transportation method', 'gmap-embed') ?>:</label>
209
- <select name="select_choice_<?php echo $count; ?>" id="srm_gmap_mode_<?php echo $count; ?>"
 
210
  style="padding: 5px;width: 100%;">
211
- <option value="DRIVING"><?php _e('Driving', 'gmap-embed') ?></option>
212
- <option value="WALKING"><?php _e('Walking', 'gmap-embed') ?></option>
213
- <option value="BICYCLING"><?php _e('Bicycling', 'gmap-embed') ?></option>
214
- <option value="TRANSIT"><?php _e('Transit', 'gmap-embed') ?></option>
215
  </select>
216
  </div>
217
  <button type="button" data-icon="search" data-role="button" href="#" style="padding:8px;"
218
- id="wp_gmap_submit_<?php echo $count; ?>"><?php _e('Get Directions', 'gmap-embed') ?>
219
  </button>
220
- <span id="wp_gmap_loading_<?php echo $count; ?>"
221
- style="display: none;"><?php _e('Loading', 'gmap-embed') ?>...</span>
222
  </div>
223
 
224
  <!-- Directions will be listed here-->
225
- <div id="wp_gmap_results_<?php echo $count; ?>"
226
  style="display:none;max-height: 300px;overflow-y: scroll;">
227
- <div id="wp_gmap_directions_<?php echo $count; ?>"></div>
228
  </div>
229
 
230
  </div>
231
- <?php
232
- }
233
- } else {
234
- if (is_user_logged_in() and current_user_can('administrator')) {
235
- echo "<span style='color:darkred;'>Shortcode not defined, please check WP Google Map plugin in wordpress admin panel(sidebar). This message only visible to Administrator</span>";
236
- }
237
- }
238
- ?>
239
- <?php
240
- return ob_get_clean();
241
- }
242
-
243
  }
244
 
245
- //******* Defining Shortcode for WP Google Map
246
- add_shortcode('gmap-embed', 'srm_gmap_embed_shortcode');
1
  <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
  // ************* WP Google Map Shortcode ***************
6
+ if ( ! function_exists( 'srm_gmap_embed_shortcode' ) ) {
7
+
8
+ /**
9
+ * Generate map based on shortcode input
10
+ *
11
+ * @param $atts
12
+ * @param $content
13
+ *
14
+ * @return string
15
+ * @since 1.0.0
16
+ */
17
+ function srm_gmap_embed_shortcode( $atts, $content ) {
18
+ static $count;
19
+ if ( ! $count ) {
20
+ $count = 0;
21
+ }
22
+ $count ++;
23
+ $wgm_map_id = intval( esc_html( $atts['id'] ) );
24
+ $wpgmap_title = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_title', true ) );
25
+ $wpgmap_show_heading = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_show_heading', true ) );
26
+ $wpgmap_heading_class = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_heading_class', true ) );
27
+ $wpgmap_map_zoom = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_zoom', true ) );
28
+ $wpgmap_map_width = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_width', true ) );
29
+ $wpgmap_map_height = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_height', true ) );
30
+ $wpgmap_map_type = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_map_type', true ) );
31
+ $wpgmap_enable_direction = esc_html( get_post_meta( $wgm_map_id, 'wpgmap_enable_direction', true ) );
32
+ $wpgmap_center_lat_lng = esc_html( get_center_lat_lng_by_map_id( $wgm_map_id ) );
33
+ $wgm_theme_json = wp_kses_data( get_post_meta( $wgm_map_id, 'wgm_theme_json', true ) );
34
+ ob_start();
35
+ if ( '' !== $wpgmap_center_lat_lng ) {
36
+ if ( '1' === $wpgmap_show_heading ) {
37
+ echo "<h1 class='srm_gmap_heading_$count " . esc_attr( $wpgmap_heading_class ) . "'>" . esc_html( wp_strip_all_tags( $wpgmap_title ) ) . '</h1>';
38
+ }
39
+ ?>
 
 
 
40
  <script type="text/javascript">
41
  jQuery(document).ready(function ($) {
42
+ var wgm_map = new google.maps.Map(document.getElementById("srm_gmp_embed_<?php echo esc_html( $count ); ?>"), {
43
+ center: new google.maps.LatLng(<?php echo esc_html( $wpgmap_center_lat_lng ); ?>),
44
+ zoom:<?php echo esc_html( $wpgmap_map_zoom ); ?>,
45
+ mapTypeId: google.maps.MapTypeId.<?php echo esc_html( $wpgmap_map_type ); ?>,
46
+ scrollwheel: <?php echo esc_html( get_option( '_wgm_disable_mouse_wheel_zoom' ) ) === 'Y' ? 0 : 1; ?>,
47
+ zoomControl: <?php echo esc_html( get_option( '_wgm_disable_zoom_control' ) ) === 'Y' ? 0 : 1; ?>,
48
+ mapTypeControl: <?php echo esc_html( get_option( '_wgm_disable_map_type_control' ) ) === 'Y' ? 0 : 1; ?>,
49
+ streetViewControl: <?php echo esc_html( get_option( '_wgm_disable_street_view' ) ) === 'Y' ? 0 : 1; ?>,
50
+ fullscreenControl: <?php echo esc_html( get_option( '_wgm_disable_full_screen_control' ) ) === 'Y' ? 0 : 1; ?>,
51
+ draggable: <?php echo esc_html( get_option( '_wgm_disable_mouse_dragging' ) ) === 'Y' ? 0 : 1; ?>,
52
+ disableDoubleClickZoom: <?php echo esc_html( get_option( '_wgm_disable_mouse_double_click_zooming' ) ) === 'Y' ? 1 : 0; ?>,
53
+ panControl: <?php echo esc_html( get_option( '_wgm_disable_pan_control' ) ) === 'Y' ? 0 : 1; ?>
 
54
  });
55
+ var wgm_theme_json = '<?php echo wp_kses_data($wgm_theme_json); ?>';
56
+ if (wgm_theme_json.length > 0) {
57
+ wgm_map.setOptions({styles: JSON.parse(wgm_theme_json)});
58
+ }
59
  // To view directions form and data
60
+ <?php if ( $wpgmap_enable_direction && _wgm_is_premium() ) { ?>
61
+ var wgm_directionsDisplay_<?php echo esc_html( $count ); ?> = new google.maps.DirectionsRenderer();
62
+
63
+ wgm_directionsDisplay_<?php echo esc_html( $count ); ?>.setMap(wgm_map);
64
+ wgm_directionsDisplay_<?php echo esc_html( $count ); ?>.setPanel(document.getElementById("wp_gmap_directions_<?php echo esc_html( $count ); ?>"));
65
+
66
+ var wgm_get_direction_btn_<?php echo esc_html( $count ); ?> = document.getElementById('wp_gmap_submit_<?php echo esc_html( $count ); ?>');
67
+ wgm_get_direction_btn_<?php echo esc_html( $count ); ?>.addEventListener('click', function () {
68
+ var wgm_selectedMode_<?php echo esc_html( $count ); ?> = document.getElementById("srm_gmap_mode_<?php echo esc_html( $count ); ?>").value,
69
+ wgm_dirction_start_<?php echo esc_html( $count ); ?> = document.getElementById("srm_gmap_from_<?php echo esc_html( $count ); ?>").value,
70
+ wgm_direction_end_<?php echo esc_html( $count ); ?> = document.getElementById("srm_gmap_to_<?php echo esc_html( $count ); ?>").value;
71
+ if (wgm_dirction_start_<?php echo esc_html( $count ); ?> === '' || wgm_direction_end_<?php echo esc_html( $count ); ?> === '') {
72
  // cannot calculate route
73
+ document.getElementById("wp_gmap_results_<?php echo esc_html( $count ); ?>").style.display = 'none';
74
  return false;
75
  } else {
76
 
77
 
78
+ document.getElementById('wp_gmap_loading_<?php echo esc_html( $count ); ?>').style.display = 'block';
79
 
80
+ var wgm_direction_request_<?php echo esc_html( $count ); ?> = {
81
+ origin: wgm_dirction_start_<?php echo esc_html( $count ); ?>,
82
+ destination: wgm_direction_end_<?php echo esc_html( $count ); ?>,
83
+ travelMode: google.maps.DirectionsTravelMode[wgm_selectedMode_<?php echo esc_html( $count ); ?>]
84
  };
85
+ var wgm_directionsService_<?php echo esc_html( $count ); ?> = new google.maps.DirectionsService();
86
+ wgm_directionsService_<?php echo esc_html( $count ); ?>.route(wgm_direction_request_<?php echo esc_html( $count ); ?>, function (response, status) {
87
+ document.getElementById('wp_gmap_loading_<?php echo esc_html( $count ); ?>').style.display = 'none';
88
  if (status === google.maps.DirectionsStatus.OK) {
89
+ wgm_directionsDisplay_<?php echo esc_html( $count ); ?>.setDirections(response);
90
+ document.getElementById("wp_gmap_results_<?php echo esc_html( $count ); ?>").style.display = 'block';
91
  } else {
92
+ document.getElementById("wp_gmap_results_<?php echo esc_html( $count ); ?>").style.display = 'none';
93
  }
94
  });
95
 
96
  }
97
  });
98
+ <?php } ?>
99
+ var wgm_data_<?php echo esc_html( $count ); ?> = {
100
  'action': 'wpgmapembed_p_get_markers_by_map_id',
101
  'data': {
102
+ map_id: '<?php echo intval( esc_html( $wgm_map_id ) ); ?>',
103
+ ajax_nonce: '<?php echo wp_create_nonce( 'ajax_nonce' ); ?>'
104
  }
105
  };
106
+ var wgm_ajaxurl_<?php echo esc_html( $count ); ?> = '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>'
107
+ jQuery.post(wgm_ajaxurl_<?php echo esc_html( $count ); ?>, wgm_data_<?php echo esc_html( $count ); ?>, function (response) {
108
  response = JSON.parse(response);
109
  if (response.markers.length === 1) {
110
+ var wgm_marker_to_<?php echo esc_html( $count ); ?> = response.markers[0].marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
111
+ jQuery('#srm_gmap_to_<?php echo esc_html( $count ); ?>').val(wgm_marker_to_<?php echo esc_html( $count ); ?>.replace(/(<([^>]+)>)/gi, ""));
112
  }
113
+ var wgm_default_marker_icon_<?php echo esc_html( $count ); ?> = 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png';
114
  if (response.markers.length > 0) {
115
  var custom_markers = [];
116
  var custom_marker_infowindows = [];
117
  response.markers.forEach(function (wgm_marker, i) {
118
+ var wgm_marker_lat_lng_<?php echo esc_html( $count ); ?> = wgm_marker.lat_lng.split(',');
119
+ wgm_custom_marker_<?php echo esc_html( $count ); ?> = new google.maps.Marker({
120
+ position: new google.maps.LatLng(wgm_marker_lat_lng_<?php echo esc_html( $count ); ?>[0], wgm_marker_lat_lng_<?php echo esc_html( $count ); ?>[1]),
121
  title: wgm_marker.marker_name,
122
  animation: google.maps.Animation.DROP,
123
+ icon: (wgm_marker.icon === '') ? wgm_default_marker_icon_<?php echo esc_html( $count ); ?> : wgm_marker.icon
124
  });
125
+ custom_markers[i] = wgm_custom_marker_<?php echo esc_html( $count ); ?>;
126
+ wgm_custom_marker_<?php echo esc_html( $count ); ?>.setMap(wgm_map);
127
+ var wgm_marker_name_<?php echo esc_html( $count ); ?> = (wgm_marker.marker_name !== null) ? ('<span class="info_content_title" style="font-size:18px;font-weight: bold;font-family: Arial;">'
128
  + wgm_marker.marker_name +
129
  '</span><br/>') : '';
130
  wgm_marker.marker_desc = wgm_marker.marker_desc.replace(/&gt;/g, '>').replace(/&lt;/g, '<');
131
  custom_marker_infowindow = new google.maps.InfoWindow({
132
+ content: wgm_marker_name_<?php echo esc_html( $count ); ?> + wgm_marker.marker_desc
133
  });
134
  custom_marker_infowindows[i] = custom_marker_infowindow;
135
  if (wgm_marker.show_desc_by_default === '1') {
136
  custom_marker_infowindow.open({
137
+ anchor: wgm_custom_marker_<?php echo esc_html( $count ); ?>,
138
  shouldFocus: false
139
  });
140
+ } else {
141
+ google.maps.event.addListener(wgm_custom_marker_<?php echo esc_html( $count ); ?>, 'click', function () {
142
  custom_marker_infowindows[i].open({
143
  anchor: custom_markers[i],
144
  shouldFocus: false
146
  });
147
  }
148
  if (wgm_marker.have_marker_link === '1') {
149
+ google.maps.event.addListener(wgm_custom_marker_<?php echo esc_html( $count ); ?>, 'click', function () {
150
  var wgm_target = '_self';
151
  if (wgm_marker.marker_link_new_tab === '1') {
152
  wgm_target = '_blank';
161
 
162
  </script>
163
 
164
+ <div id="srm_gmp_embed_<?php echo esc_html( $count ); ?>"
165
+ style="width:<?php echo esc_attr( $wpgmap_map_width ) . ' !important'; ?>;height:<?php echo esc_attr( $wpgmap_map_height ); ?> !important; ">
166
  </div>
167
+ <?php
168
 
169
+ if ( $wpgmap_enable_direction === '1' and _wgm_is_premium() ) {
170
+ ?>
171
  <style type="text/css">
172
  .wp_gmap_direction_box {
173
  width: 100%;
197
  <div class="wp_gmap_direction_box">
198
  <div class="ui-bar-c ui-corner-all ui-shadow">
199
  <div data-role="fieldcontain" class="fieldcontain">
200
+ <label for="srm_gmap_from_<?php echo esc_html( $count ); ?>"><?php esc_html_e( 'From', 'gmap-embed' ); ?></label>
201
+ <input type="text" id="srm_gmap_from_<?php echo esc_html( $count ); ?>" value=""
202
+ style="width: 100%;"/>
203
  </div>
204
  <div data-role="fieldcontain" class="fieldcontain">
205
+ <label for="srm_gmap_to_<?php echo esc_html( $count ); ?>"><?php esc_html_e( 'To', 'gmap-embed' ); ?></label>
206
+ <input type="text" id="srm_gmap_to_<?php echo esc_html( $count ); ?>"
207
  value=""
208
  style="width: 100%"/>
209
  </div>
210
  <div data-role="fieldcontain" class="fieldcontain">
211
+ <label for="srm_gmap_mode_<?php echo esc_html( $count ); ?>"
212
+ class="select"><?php esc_html_e( 'Transportation method', 'gmap-embed' ); ?>:</label>
213
+ <select name="select_choice_<?php echo esc_html( $count ); ?>"
214
+ id="srm_gmap_mode_<?php echo esc_html( $count ); ?>"
215
  style="padding: 5px;width: 100%;">
216
+ <option value="DRIVING"><?php esc_html_e( 'Driving', 'gmap-embed' ); ?></option>
217
+ <option value="WALKING"><?php esc_html_e( 'Walking', 'gmap-embed' ); ?></option>
218
+ <option value="BICYCLING"><?php esc_html_e( 'Bicycling', 'gmap-embed' ); ?></option>
219
+ <option value="TRANSIT"><?php esc_html_e( 'Transit', 'gmap-embed' ); ?></option>
220
  </select>
221
  </div>
222
  <button type="button" data-icon="search" data-role="button" href="#" style="padding:8px;"
223
+ id="wp_gmap_submit_<?php echo esc_html( $count ); ?>"><?php esc_html_e( 'Get Directions', 'gmap-embed' ); ?>
224
  </button>
225
+ <span id="wp_gmap_loading_<?php echo esc_html( $count ); ?>"
226
+ style="display: none;"><?php esc_html_e( 'Loading', 'gmap-embed' ); ?>...</span>
227
  </div>
228
 
229
  <!-- Directions will be listed here-->
230
+ <div id="wp_gmap_results_<?php echo esc_html( $count ); ?>"
231
  style="display:none;max-height: 300px;overflow-y: scroll;">
232
+ <div id="wp_gmap_directions_<?php echo esc_html( $count ); ?>"></div>
233
  </div>
234
 
235
  </div>
236
+ <?php
237
+ }
238
+ } else {
239
+ if ( is_user_logged_in() && current_user_can( 'administrator' ) ) {
240
+ echo "<span style='color:darkred;'>Shortcode not defined, please check WP Google Map plugin in WordPress admin panel(sidebar). This message only visible to Administrator</span>";
241
+ }
242
+ }
243
+ ?>
244
+ <?php
245
+ return ob_get_clean();
246
+ }
 
247
  }
248
 
249
+ // ******* Defining Shortcode for WP Google Map
250
+ add_shortcode( 'gmap-embed', 'srm_gmap_embed_shortcode' );
readme.txt CHANGED
@@ -4,8 +4,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: google map, map, maps, google maps, map markers, google map plugin, google map embed, google maps plugin, wp google map, map plugin, map embed, best google maps, store locator, map direction, map widget, street view
5
  Requires at least: 2.9
6
  Tested up to: 5.9
7
- Version: 1.8.5
8
- Stable tag: 1.8.5
9
  Requires PHP: 5.3
10
  Text Domain: gmap-embed
11
  License: GPLv2 or later
@@ -16,16 +16,16 @@ Google Map plugin for WordPress is very Simple, light-weight and Easy to use Goo
16
  == Description ==
17
 
18
  = Google Maps for Wordpress =
19
- * [Google Maps for Wordpress Help Manual](https://srmilon.info/documentation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_heading_list)
20
- * [How to use Google Maps in Wordpress Website](https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_heading_list)
21
 
22
  WP Google Map is an awesome plugin to use when adding a custom Google map to your website. It is fully customizable and can be used as shortcode.
23
 
24
- **[Get WP Google Map pro version](https://srmilon.info/pricing?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_get_pro)**
25
 
26
  ### DEMOS
27
 
28
- * **[See all Google Map Demos](https://srmilon.info/demos?utm_source=wp_repo&utm_medium=admin_link&utm_campaign=readme_demos_list)**
29
 
30
  ### VIDEO TUTORIALS
31
 
@@ -34,20 +34,20 @@ WP Google Map is an awesome plugin to use when adding a custom Google map to you
34
 
35
  ### DOCUMENTATION
36
 
37
- * **[Complete Installation Guide](https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
38
- * **[How to get your Lifetime License key?](https://srmilon.info/documentation/how-to-get-your-license-key?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
39
- * **[How to get your own API key](https://srmilon.info/documentation/how-to-get-google-map-api-key?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
40
- * **[Add Google Map in wordpress page](https://srmilon.info/documentation/how-to-add-google-map-in-your-wordpress-pageblock-editor?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
41
- * **[Add Google Map in wordpress post](https://srmilon.info/documentation/how-to-add-google-map-in-your-wordpress-post-copy?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
42
- * **[Add Google Map in Sidebar as widget](https://srmilon.info/documentation/how-to-add-google-map-in-sidebar-as-widget-new-widget-editor-from-wordpress-5-8?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
43
- * **[Customize Map Language and Regional Area Settings](https://srmilon.info/documentation/how-to-customize-map-language-and-regional-area-settings?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
44
 
45
  ### TROUBLESHOOTING
46
 
47
- * **[How to identify and fix the Map loading problems?](https://srmilon.info/documentation/how-to-debug-or-identify-the-map-loading-problems-in-admin-panel?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
48
- * **[Do you see “the page can't load the map correctly?](https://srmilon.info/documentation/can-not-load-the-map-correctly?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
49
- * **[How to fix Multiple Google Map API loading??](https://srmilon.info/documentation/how-to-fix-multiple-google-map-api-loading?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
50
- * **[Don’t see "Embed Google Map" button in new Editor?](https://srmilon.info/documentation/dont-see-embed-google-map-button-in-new-editor?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
51
 
52
  **Note:** According to [Google Documentation](https://cloud.google.com/maps-platform/pricing), You can use Google Map upto **200 USD** for free each month
53
 
@@ -55,31 +55,31 @@ WP Google Map is an awesome plugin to use when adding a custom Google map to you
55
 
56
  Get a free **License Key** of the WP Google Map Pro version in exchange for translating our plugin!
57
 
58
- * **[English (Australia)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_au) - (en_AU)**
59
- * **[English (Canada)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_ca) - (en_CA)**
60
- * **[English (UK)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_gb) - (en_GB)**
61
- * **[English (New Zealand)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_nz) - (en_NZ)**
62
- * **[English (South Africa)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_za) - (en_ZA)**
63
- * **[Bengali (Bangladesh)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_bn_bd) - (bn_BD)**
64
- * **[Spanish (Spain)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_es) - (es_ES)**
65
- * **[Spanish (Venezuela)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_ve) - (es_VE)**
66
- * **[German](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_de) - (de_DE)**
67
- * **[German (Formal)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_de_formal) - (de_DE_formal)**
68
- * **[Turkish](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_tr_tr) - (tr_TR)**
69
- * **[French (France)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_fr_fr) - (fr_FR)**
70
- * **[Danish](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_da_dk) - (da_DK)**
71
- * **[German (Switzerland)](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_de_ch) - (de_CH)**
72
- * **[Arabic](https://www.srmilon.info/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_ar) - (ar)**
73
 
74
  ### SUPPORT AND CONTRIBUTION
75
- * **[Report an issue](https://www.srmilon.info/report-issue?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
76
- * **[Support Forum](https://www.srmilon.info/wp-support-forum?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
77
- * **[Post review Wordpress](https://www.srmilon.info/wp-review-forum?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)** :)
78
- * **[Contact Us](https://srmilon.info/contact-us?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
79
- * **[Facebook Page Community](https://www.srmilon.info/fb-page?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
80
- * **[Facebook Group Community](https://www.srmilon.info/fb-group?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
81
- * **[Twitter Community](https://www.srmilon.info/twitter?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
82
- * **[LIVE CHAT](https://www.srmilon.info/live-chat?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
83
 
84
  To have continued the update, please donate for the WP Google Map plugin. **You will get Lifetime License Key by donating minimum 10 USD**
85
  **[Click here to donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZBERRKARGNEYA)**
@@ -143,16 +143,16 @@ Skype: **milon305021**
143
 
144
  ### It's simple:
145
 
146
- 1. [Download](https://srmilon.info/download-wp-google-map?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_install_tab) the WP Google Map Plugin.
147
  2. Upload the zip folder plugins directory "wp-content/plugins"
148
  3. Activate the WP Google Map Plugin from the Admin panel.
149
  4. Add the WP Google Map widget to your sidebar using Shortcode.
150
  5. Add the WP Google Map in posts/pages using the shortcode.
151
- 6. Here you can see [Complete Installation Guide](https://srmilon.info/documentation/wp-google-map-quick-installation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_install_tab)
152
 
153
  == Upgrade Notice ==
154
 
155
- Upgrade WP Google Map Plugin from [here](https://srmilon.info/download-wp-google-map?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_upgrade_notice) to get updated features.
156
 
157
  == Frequently Asked Questions ==
158
 
@@ -162,29 +162,19 @@ Our WP Google Map plugin is user-friendly, but you can read some frequently aske
162
  See the [Video](https://youtu.be/9KZOUJ9Gdv8?t=23) ,hope you will get idea.
163
 
164
  = How to Troubleshoot or Debug Map Loading Issue? =
165
- See the [Documentation](https://srmilon.info/docs-category/troubleshooting?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq), hope you will find best solution.
166
 
167
  = How can I create a new Google Map? =
168
  After installing the plugin, Click on WP Google Map in the left sidebar. Then click on **Add New** . [See Video Tutorial](https://youtu.be/9KZOUJ9Gdv8?t=141)
169
 
170
  = How do I enable Directions on my Google Map? =
171
- You will see an option named "**Enable Direction in Map**" under each map other setting. Also, you can set the option in creating a new map page. [See Documentation](https://srmilon.info/documentation/how-to-enable-the-direction-option-in-google-map?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq)
172
 
173
  = How do I add a Google Map to my Page/Post? =
174
- It's Easy! Go to **Posts**=-> **Add New** . Now please [See the documentation](https://srmilon.info/documentation/how-to-add-google-map-in-your-wordpress-pageblock-editor?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq)
175
 
176
  = How do I add a Google Map as a widget? =
177
- Go to **Appearance** =-> **Widget** . Now please [See the documentation](https://srmilon.info/documentation/how-to-add-google-map-in-sidebar-as-widget-new-widget-editor-from-wordpress-5-8?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq)
178
-
179
-
180
- ## Privacy Policy
181
- Maps Plugin using Google Maps for WordPress - WP Google Map uses [Appsero](https://appsero.com) SDK to collect some telemetry data upon user's confirmation. This helps us to troubleshoot problems faster & make product improvements.
182
-
183
- Appsero SDK **does not gather any data by default.** The SDK only starts gathering basic telemetry data **when a user allows it via the admin notice**. We collect the data to ensure a great user experience for all our users.
184
-
185
- Integrating Appsero SDK **DOES NOT IMMEDIATELY** start gathering data, **without confirmation from users in any case.**
186
-
187
- Learn more about how [Appsero collects and uses this data](https://appsero.com/privacy-policy/).
188
 
189
  == Screenshots ==
190
 
@@ -199,6 +189,15 @@ Learn more about how [Appsero collects and uses this data](https://appsero.com/p
199
 
200
  == Changelog ==
201
 
 
 
 
 
 
 
 
 
 
202
  = 1.8.5 =
203
  * Code Optimization
204
  * Security enhancement
4
  Tags: google map, map, maps, google maps, map markers, google map plugin, google map embed, google maps plugin, wp google map, map plugin, map embed, best google maps, store locator, map direction, map widget, street view
5
  Requires at least: 2.9
6
  Tested up to: 5.9
7
+ Version: 1.8.7
8
+ Stable tag: 1.8.7
9
  Requires PHP: 5.3
10
  Text Domain: gmap-embed
11
  License: GPLv2 or later
16
  == Description ==
17
 
18
  = Google Maps for Wordpress =
19
+ * [Google Maps for Wordpress Help Manual](https://wpgooglemap.com/documentation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_heading_list)
20
+ * [How to use Google Maps in Wordpress Website](https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_heading_list)
21
 
22
  WP Google Map is an awesome plugin to use when adding a custom Google map to your website. It is fully customizable and can be used as shortcode.
23
 
24
+ **[Get WP Google Map pro version](https://wpgooglemap.com/pricing?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_get_pro)**
25
 
26
  ### DEMOS
27
 
28
+ * **[See all Google Map Demos](https://wpgooglemap.com/demos?utm_source=wp_repo&utm_medium=admin_link&utm_campaign=readme_demos_list)**
29
 
30
  ### VIDEO TUTORIALS
31
 
34
 
35
  ### DOCUMENTATION
36
 
37
+ * **[Complete Installation Guide](https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
38
+ * **[How to get your Lifetime License key?](https://wpgooglemap.com/documentation/how-to-get-your-license-key?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
39
+ * **[How to get your own API key](https://wpgooglemap.com/documentation/how-to-get-google-map-api-key?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
40
+ * **[Add Google Map in wordpress page](https://wpgooglemap.com/documentation/how-to-add-google-map-in-your-wordpress-pageblock-editor?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
41
+ * **[Add Google Map in wordpress post](https://wpgooglemap.com/documentation/how-to-add-google-map-in-your-wordpress-post-copy?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
42
+ * **[Add Google Map in Sidebar as widget](https://wpgooglemap.com/documentation/how-to-add-google-map-in-sidebar-as-widget-new-widget-editor-from-wordpress-5-8?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
43
+ * **[Customize Map Language and Regional Area Settings](https://wpgooglemap.com/documentation/how-to-customize-map-language-and-regional-area-settings?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_doc_list)**
44
 
45
  ### TROUBLESHOOTING
46
 
47
+ * **[How to identify and fix the Map loading problems?](https://wpgooglemap.com/documentation/how-to-debug-or-identify-the-map-loading-problems-in-admin-panel?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
48
+ * **[Do you see “the page can't load the map correctly?](https://wpgooglemap.com/documentation/can-not-load-the-map-correctly?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
49
+ * **[How to fix Multiple Google Map API loading??](https://wpgooglemap.com/documentation/how-to-fix-multiple-google-map-api-loading?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
50
+ * **[Don’t see "Embed Google Map" button in new Editor?](https://wpgooglemap.com/documentation/dont-see-embed-google-map-button-in-new-editor?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_troubleshoot_list)**
51
 
52
  **Note:** According to [Google Documentation](https://cloud.google.com/maps-platform/pricing), You can use Google Map upto **200 USD** for free each month
53
 
55
 
56
  Get a free **License Key** of the WP Google Map Pro version in exchange for translating our plugin!
57
 
58
+ * **[English (Australia)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_au) - (en_AU)**
59
+ * **[English (Canada)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_ca) - (en_CA)**
60
+ * **[English (UK)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_gb) - (en_GB)**
61
+ * **[English (New Zealand)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_nz) - (en_NZ)**
62
+ * **[English (South Africa)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_en_za) - (en_ZA)**
63
+ * **[Bengali (Bangladesh)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_bn_bd) - (bn_BD)**
64
+ * **[Spanish (Spain)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_es) - (es_ES)**
65
+ * **[Spanish (Venezuela)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_ve) - (es_VE)**
66
+ * **[German](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_de) - (de_DE)**
67
+ * **[German (Formal)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_es_de_formal) - (de_DE_formal)**
68
+ * **[Turkish](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_tr_tr) - (tr_TR)**
69
+ * **[French (France)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_fr_fr) - (fr_FR)**
70
+ * **[Danish](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_da_dk) - (da_DK)**
71
+ * **[German (Switzerland)](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_de_ch) - (de_CH)**
72
+ * **[Arabic](https://wpgooglemap.com/translation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_translation_ar) - (ar)**
73
 
74
  ### SUPPORT AND CONTRIBUTION
75
+ * **[Report an issue](https://wpgooglemap.com/report-issue?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
76
+ * **[Support Forum](https://wpgooglemap.com/wp-support-forum?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
77
+ * **[Post review Wordpress](https://wpgooglemap.com/wp-review-forum?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)** :)
78
+ * **[Contact Us](https://wpgooglemap.com/contact-us?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
79
+ * **[Facebook Page Community](https://wpgooglemap.com/fb-page?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
80
+ * **[Facebook Group Community](https://wpgooglemap.com/fb-group?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
81
+ * **[Twitter Community](https://wpgooglemap.com/twitter?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
82
+ * **[LIVE CHAT](https://wpgooglemap.com/live-chat?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=read_support_cont)**
83
 
84
  To have continued the update, please donate for the WP Google Map plugin. **You will get Lifetime License Key by donating minimum 10 USD**
85
  **[Click here to donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZBERRKARGNEYA)**
143
 
144
  ### It's simple:
145
 
146
+ 1. [Download](https://wpgooglemap.com/download-wp-google-map?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_install_tab) the WP Google Map Plugin.
147
  2. Upload the zip folder plugins directory "wp-content/plugins"
148
  3. Activate the WP Google Map Plugin from the Admin panel.
149
  4. Add the WP Google Map widget to your sidebar using Shortcode.
150
  5. Add the WP Google Map in posts/pages using the shortcode.
151
+ 6. Here you can see [Complete Installation Guide](https://wpgooglemap.com/documentation/wp-google-map-quick-installation?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_install_tab)
152
 
153
  == Upgrade Notice ==
154
 
155
+ Upgrade WP Google Map Plugin from [here](https://wpgooglemap.com/download-wp-google-map?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_upgrade_notice) to get updated features.
156
 
157
  == Frequently Asked Questions ==
158
 
162
  See the [Video](https://youtu.be/9KZOUJ9Gdv8?t=23) ,hope you will get idea.
163
 
164
  = How to Troubleshoot or Debug Map Loading Issue? =
165
+ See the [Documentation](https://wpgooglemap.com/docs-category/troubleshooting?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq), hope you will find best solution.
166
 
167
  = How can I create a new Google Map? =
168
  After installing the plugin, Click on WP Google Map in the left sidebar. Then click on **Add New** . [See Video Tutorial](https://youtu.be/9KZOUJ9Gdv8?t=141)
169
 
170
  = How do I enable Directions on my Google Map? =
171
+ You will see an option named "**Enable Direction in Map**" under each map other setting. Also, you can set the option in creating a new map page. [See Documentation](https://wpgooglemap.com/documentation/how-to-enable-the-direction-option-in-google-map?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq)
172
 
173
  = How do I add a Google Map to my Page/Post? =
174
+ It's Easy! Go to **Posts**=-> **Add New** . Now please [See the documentation](https://wpgooglemap.com/documentation/how-to-add-google-map-in-your-wordpress-pageblock-editor?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq)
175
 
176
  = How do I add a Google Map as a widget? =
177
+ Go to **Appearance** =-> **Widget** . Now please [See the documentation](https://wpgooglemap.com/documentation/how-to-add-google-map-in-sidebar-as-widget-new-widget-editor-from-wordpress-5-8?utm_source=wp_repo&utm_medium=readme_link&utm_campaign=readme_faq)
 
 
 
 
 
 
 
 
 
 
178
 
179
  == Screenshots ==
180
 
189
 
190
  == Changelog ==
191
 
192
+
193
+ = 1.8.7 =
194
+ * Map Theme option introduced including custom theme JSON.
195
+
196
+ = 1.8.6 =
197
+ * Marker content update issue fixing
198
+ * Code optimized with WordPress Standard
199
+ * Ajax Datatable js error fixing
200
+
201
  = 1.8.5 =
202
  * Code Optimization
203
  * Security enhancement
srm_gmap_embed.php CHANGED
@@ -1,75 +1,63 @@
1
  <?php
2
  /*
3
  Plugin Name: WP Google Map
4
- Plugin URI: https://www.srmilon.info?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
5
  Description: WP Google Map plugin allows creating Google Map with marker or location with a responsive interface. Marker supports text, images, links, videos, and custom icons. Simply, Just put the shortcode on the page, post, or widget to display the map anywhere.
6
  Author: WP Google Map
7
  Text Domain: gmap-embed
8
  Domain Path: /languages
9
- Author URI: https://www.srmilon.info?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
10
- Version: 1.8.5
11
  */
12
 
13
  use WGMSRM\Classes\Database;
14
 
15
- if (!defined('ABSPATH')) {
16
- exit;
17
  }
18
 
19
- define('WGM_PLUGIN_VERSION', '1.8.5');
20
- define('WGM_PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__)));
21
- define('WGM_PLUGIN_URL', trailingslashit(plugins_url('/', __FILE__)));
22
 
23
  require_once WGM_PLUGIN_PATH . 'autoload.php';
24
- //Required helper functions
25
  require_once WGM_PLUGIN_PATH . '/includes/helper.php';
26
 
27
  /**
28
  * Tinymce plugin initialization
29
  */
30
- function tinymce_init()
31
- {
32
- add_filter('mce_external_plugins', 'tinymce_plugin');
33
- }
34
-
35
- add_filter('init', 'tinymce_init');
36
- function tinymce_plugin($init)
37
- {
38
- $init['keyup_event'] = WGM_PLUGIN_URL . 'admin/assets/js/tinymce_keyup_event.js';
39
-
40
- return $init;
41
  }
42
 
 
43
  /**
44
- * Initialize the plugin tracker
45
  *
46
- * @return void
 
 
47
  */
48
- function appsero_init_tracker_gmap_embed()
49
- {
50
-
51
- if (!class_exists('Appsero\Client')) {
52
- require_once __DIR__ . '/appsero/src/Client.php';
53
- }
54
-
55
- $client = new Appsero\Client('8aa8c415-a0e1-41a2-9f05-1b385c09e90b', 'WP Google Map', __FILE__);
56
-
57
- // Active insights
58
- $client->insights()->init();
59
 
 
60
  }
61
 
62
- appsero_init_tracker_gmap_embed();
63
-
64
- function wgm_run()
65
- {
66
- new \WGMSRM\Classes\Bootstrap();
67
  }
68
 
69
- function wgm_install_plugin()
70
- {
71
- new Database();
 
 
72
  }
73
 
74
- register_activation_hook(__FILE__, 'wgm_install_plugin');
75
  wgm_run();
1
  <?php
2
  /*
3
  Plugin Name: WP Google Map
4
+ Plugin URI: https://www.wpgooglemap.com?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
5
  Description: WP Google Map plugin allows creating Google Map with marker or location with a responsive interface. Marker supports text, images, links, videos, and custom icons. Simply, Just put the shortcode on the page, post, or widget to display the map anywhere.
6
  Author: WP Google Map
7
  Text Domain: gmap-embed
8
  Domain Path: /languages
9
+ Author URI: https://www.wpgooglemap.com?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
10
+ Version: 1.8.7
11
  */
12
 
13
  use WGMSRM\Classes\Database;
14
 
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit;
17
  }
18
 
19
+ define( 'WGM_PLUGIN_VERSION', '1.8.7' );
20
+ define( 'WGM_PLUGIN_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) );
21
+ define( 'WGM_PLUGIN_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
22
 
23
  require_once WGM_PLUGIN_PATH . 'autoload.php';
24
+ // Required helper functions.
25
  require_once WGM_PLUGIN_PATH . '/includes/helper.php';
26
 
27
  /**
28
  * Tinymce plugin initialization
29
  */
30
+ function tinymce_init() {
31
+ add_filter( 'mce_external_plugins', 'tinymce_plugin' );
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
+ add_filter( 'init', 'tinymce_init' );
35
  /**
36
+ * Added function for tinymce initialization
37
  *
38
+ * @param $init
39
+ *
40
+ * @return mixed
41
  */
42
+ function tinymce_plugin( $init ) {
43
+ $init['keyup_event'] = WGM_PLUGIN_URL . 'admin/assets/js/tinymce_keyup_event.js';
 
 
 
 
 
 
 
 
 
44
 
45
+ return $init;
46
  }
47
 
48
+ /**
49
+ * Run plugin initially
50
+ */
51
+ function wgm_run() {
52
+ new \WGMSRM\Classes\Bootstrap();
53
  }
54
 
55
+ /**
56
+ * Install plugin db structures
57
+ */
58
+ function wgm_install_plugin() {
59
+ new Database();
60
  }
61
 
62
+ register_activation_hook( __FILE__, 'wgm_install_plugin' );
63
  wgm_run();
uninstall.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
- // If uninstall not called from WordPress, then exit.
3
- if (!defined('WP_UNINSTALL_PLUGIN')) {
4
- exit;
5
- }
 
 
1
  <?php
2
+ /**
3
+ * If uninstall not called from WordPress, then exit.
4
+ */
5
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
6
+ exit;
7
+ }