PluginProbe
Maps Plugin using Google Maps for WordPress – WP Google Map / trunk
Maps Plugin using Google Maps for WordPress – WP Google Map vtrunk
1.9.7 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 All 96 releases
gmap-embed / admin / includes / markers-settings.php

markers-settings.php in Maps Plugin using Google Maps for WordPress – WP Google Map trunk, at admin/includes/markers-settings.php

308 lines 15.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3 if (
4 isset($_GET['tag']) && $_GET['tag'] === 'edit'
5 ) {
6 if (
7 !isset($_GET['wgm_map_create_nonce']) ||
8 !wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['wgm_map_create_nonce'])), 'wgm_create_map')
9 ) {
10 wp_die(esc_html__('Invalid request. Nonce verification failed.', 'gmap-embed'));
11 }
12 }
13 $wpgmap_map_id = isset($_GET['id']) ? intval(sanitize_text_field(wp_unslash($_GET['id']))) : 0;
14 ?>
15 <div style="text-align: right;margin-top:10px;" class="add_new_marker_btn_area">
16 <button type="button" value="New Marker" class="button button-primary add_new_marker"
17 style="margin-bottom: 10px;"><i class="dashicons dashicons-plus" style="margin: 5px 0 0 0;"></i>
18 <?php esc_html_e('New Marker', 'gmap-embed'); ?>
19 </button>
20 <?php
21 if (!_wgm_is_premium()) {
22 ?>
23 <sup class="wgm-pro-label" style="top: -4px; display: none;"><?php esc_html_e('Pro', 'gmap-embed'); ?></sup>
24 <?php
25 }
26 ?>
27 </div>
28
29 <div class="wgm_gmap_marker_list" style="display: block" map_id="<?php echo esc_attr($wpgmap_map_id); ?>">
30 <table id="wgm_gmap_marker_list" class="display" style="width:100%">
31 <thead>
32 <tr>
33 <th><?php esc_html_e('ID', 'gmap-embed'); ?></th>
34 <th><?php esc_html_e('Marker Name', 'gmap-embed'); ?></th>
35 <th><?php esc_html_e('Icon', 'gmap-embed'); ?></th>
36 <th><?php esc_html_e('Action', 'gmap-embed'); ?></th>
37 </tr>
38 </thead>
39 <tbody>
40 </tbody>
41 </table>
42 <div class="wgm_marker_quick_guide">
43 <div class="wgm_guide_header">
44 <span class="dashicons dashicons-editor-help"></span>
45 <h3><?php esc_html_e('How to Create a Marker', 'gmap-embed'); ?></h3>
46 </div>
47 <div class="wgm_guide_steps">
48 <div class="wgm_guide_step">
49 <div class="wgm_step_icon"><span class="dashicons dashicons-location"></span></div>
50 <div class="wgm_step_text">
51 <strong><?php esc_html_e('1. Add Location', 'gmap-embed'); ?></strong>
52 <p><?php esc_html_e('Use Address Search or input Lat/Lng or Right-Click on the Map to place a marker pin.', 'gmap-embed'); ?></p>
53 </div>
54 </div>
55 <div class="wgm_guide_step">
56 <div class="wgm_step_icon"><span class="dashicons dashicons-edit"></span></div>
57 <div class="wgm_step_text">
58 <strong><?php esc_html_e('2. Customize', 'gmap-embed'); ?></strong>
59 <p><?php esc_html_e('Fill in the Title, Description, select an Icon, etc.', 'gmap-embed'); ?></p>
60 </div>
61 </div>
62 <div class="wgm_guide_step">
63 <div class="wgm_step_icon"><span class="dashicons dashicons-cloud-saved"></span></div>
64 <div class="wgm_step_text">
65 <strong><?php esc_html_e('3. Save', 'gmap-embed'); ?></strong>
66 <p><?php
67 /* translators: 1: Save Marker text, 2: Save Map text */
68 echo sprintf(esc_html__('Click %1$s to add it to your list, then %2$s.', 'gmap-embed'), '<b>' . esc_html__('Save Marker', 'gmap-embed') . '</b>', '<b>' . esc_html__('Save Map', 'gmap-embed') . '</b>');
69 ?></p>
70 </div>
71 </div>
72 </div>
73 </div>
74 </div>
75
76 <table class="wgm_gmap_properties add_new_marker_form" style="display: none;width:100%">
77
78 <tr>
79 <td>
80 <label for="wpgmap_marker_name"><b><?php esc_html_e('Title', 'gmap-embed'); ?>
81 </b></label><br />
82 <input id="wpgmap_marker_name" name="wpgmap_marker_name" type="text" class="regular-text">
83 </td>
84 </tr>
85
86 <tr>
87 <td>
88 <label for="wpgmap_marker_desc"><b><?php esc_html_e('Description', 'gmap-embed'); ?></b></label><br />
89 <?php
90 echo (_wgm_is_premium() === false) ? '<button type="button" class="button wgm_enable_premium" style="opacity: .7;" data-notice="' .
91 // translators: %s: Premium version URL.
92 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=gmap-embed&utm_medium=wordpress-plugin&utm_campaign=upgrade-to-pro&utm_content=markers-add-media-lock'))) .
93 '"><span class="dashicons dashicons-admin-media" style="line-height: 1.5;"></span> ' . esc_html__('Add Media', 'gmap-embed') . ' </button><sup class="wgm-pro-label" style="top: -45px;display: block;width: 23px;left: 107px;">' . esc_html__('Pro', 'gmap-embed') . '</sup>' : '';
94 wp_editor(
95 '',
96 'wpgmap_marker_desc',
97 [
98 'textarea_name' => 'wpgmap_marker_desc',
99 'textarea_rows' => '3',
100 'media_buttons' => _wgm_is_premium() === true,
101 'quicktags' => _wgm_is_premium() === true,
102 ]
103 );
104 ?>
105 </td>
106 </tr>
107
108 <tr style="padding-top: 10px;">
109 <td>
110 <span style="float: left;">
111 <b><?php esc_html_e('Marker Icon', 'gmap-embed'); ?></b> &nbsp;
112 </span>
113 <?php //phpscs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage ?>
114 <img src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/markers/default.png'); ?>"
115 id="wpgmap_marker_icon_preview" style="float: left;max-width: 20px;">
116 <?php
117 $gmap_embed_ajax_url = add_query_arg(
118 [
119 'action' => 'wpgmapembed_get_marker_icons',
120 'from' => 'create',
121 '_wpnonce' => wp_create_nonce('wpgmapembed_get_marker_icons'),
122 'type' => 'image',
123 'TB_iframe' => false,
124 'width' => 650,
125 'height' => 500
126 ],
127 admin_url('admin-ajax.php')
128 );
129 ?>
130 <button style="float: left;margin: 0 9px;" class="button"
131 onclick="tb_show('<?php esc_html_e('Choose marker icon', 'gmap-embed'); ?>', '<?php echo esc_url($gmap_embed_ajax_url); ?>')">
132 <?php esc_html_e('Choose Icon', 'gmap-embed'); ?>
133 </button>
134 <button style="float: left" class="button"
135 id="wpgmap_upload_marker_icon"><?php esc_html_e('Upload Icon', 'gmap-embed'); ?></button>
136 <input type="hidden" name="wpgmap_marker_icon" id="wpgmap_marker_icon"
137 value="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/markers/default.png'); ?>" />
138 <div style="clear: both;"></div>
139 </td>
140 </tr>
141
142 <tr>
143 <td style="padding-top: 20px;">
144 <span style="float: left;">
145 <b><?php esc_html_e('Marker Image', 'gmap-embed'); ?></b> &nbsp;
146 </span>
147 <?php
148 if (!_wgm_is_premium()) {
149 ?>
150 <sup class="wgm-pro-label" style="top: -4px;"><?php esc_html_e('Pro', 'gmap-embed'); ?></sup>
151 <?php
152 }
153 ?>
154 <div style="float:left; margin-right: 10px;">
155 <img src="" id="wpgmap_marker_image_preview" style="max-width: 50px; display: none;">
156 </div>
157 <?php
158 $gmap_embed_marker_image_btn_class = 'button';
159 $gmap_embed_marker_image_btn_style = 'float: left';
160 $gmap_embed_marker_image_data_notice = '';
161 if (!_wgm_is_premium()) {
162 $gmap_embed_marker_image_btn_class .= ' wgm_enable_premium';
163 $gmap_embed_marker_image_btn_style .= '; opacity: .7';
164 // translators: %s: Premium version URL.
165 $gmap_embed_marker_image_data_notice = ' data-notice="' . esc_attr(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to add <b>Marker Images</b>.', 'gmap-embed'), esc_url('https://wpgooglemap.com/pricing?utm_source=gmap-embed&utm_medium=wordpress-plugin&utm_campaign=upgrade-to-pro&utm_content=settings-license-error-msg'))) . '"';
166 }
167 ?>
168 <button style="<?php echo esc_attr($gmap_embed_marker_image_btn_style); ?>" class="<?php echo esc_attr($gmap_embed_marker_image_btn_class); ?>"
169 id="wpgmap_upload_marker_image" <?php echo esc_attr($gmap_embed_marker_image_data_notice); ?>><?php esc_html_e('Upload Image', 'gmap-embed'); ?></button>
170 <button style="float: left; margin-left: 5px; display: none; color: #a00;" class="button"
171 id="wpgmap_remove_marker_image"><?php esc_html_e('Remove', 'gmap-embed'); ?></button>
172 <input type="hidden" name="wpgmap_marker_image" id="wpgmap_marker_image" value="" />
173 </td>
174 </tr>
175
176 <tr>
177 <td>
178 <label for="wpgmap_marker_address"><b><?php esc_html_e('Address', 'gmap-embed'); ?></b></label><br />
179 <input id="wpgmap_marker_address" name="wpgmap_marker_address" type="text" class="regular-text">
180 </td>
181 </tr>
182
183 <tr>
184 <td>
185 <label for="wpgmap_marker_lat_lng"><b>
186 <?php esc_html_e('Latitude,Longitude', 'gmap-embed'); ?><span
187 class="required-star">*</span></b></label><br />
188 <input id="wpgmap_marker_lat_lng" name="wpgmap_marker_lat_lng" type="text" class="regular-text">
189 </td>
190 </tr>
191
192 <tr>
193 <td>
194 <label for="wpgmap_marker_animation"><b><?php esc_html_e('Animation', 'gmap-embed'); ?></b></label><br />
195 <select name="wpgmap_marker_animation" id="wpgmap_marker_animation" class="regular-text">
196 <option value=""><?php esc_html_e('None', 'gmap-embed'); ?></option>
197 <option value="BOUNCE"><?php esc_html_e('BOUNCE', 'gmap-embed'); ?></option>
198 <option value="DROP"><?php esc_html_e('DROP', 'gmap-embed'); ?></option>
199 </select>
200 </td>
201 </tr>
202
203 <tr>
204 <td style="padding: 10px 0;">
205 <label for="wpgmap_marker_category"><b><?php esc_html_e('Category', 'gmap-embed'); ?></b>
206 <?php
207 if (!_wgm_is_premium()) {
208 ?>
209 &nbsp;<sup class="wgm-pro-label"><?php esc_html_e('Pro', 'gmap-embed'); ?></sup>
210 <?php
211 }
212 ?>
213 </label>
214 <br />
215 <?php
216 $gmap_embed_category_select_class = 'regular-text wgm-select2';
217 $gmap_embed_category_select_disabled = '';
218 $gmap_embed_category_wrapper_class = '';
219 $gmap_embed_category_data_notice = '';
220
221 if (!_wgm_is_premium()) {
222 $gmap_embed_category_select_class .= ' wgm_enable_premium';
223 $gmap_embed_category_select_disabled = ' disabled="disabled"';
224 $gmap_embed_category_wrapper_class = ' wgm-locked-feature';
225 // translators: %s: Premium version URL.
226 $gmap_embed_category_data_notice = ' data-notice="' . esc_attr(sprintf(__('You need to upgrade to the <a target="_blank" href="%s">Premium</a> Version to <b>assign Categories to markers</b>.', 'gmap-embed'), esc_url('https://wpgooglemap.com/pricing?utm_source=gmap-embed&utm_medium=wordpress-plugin&utm_campaign=upgrade-to-pro&utm_content=settings-license-error-msg'))) . '"';
227 }
228 ?>
229 <div class="<?php echo esc_attr($gmap_embed_category_wrapper_class); ?>" <?php echo esc_attr($gmap_embed_category_data_notice); ?>>
230 <select name="wpgmap_marker_category[]" id="wpgmap_marker_category" class="<?php echo esc_attr($gmap_embed_category_select_class); ?>" multiple="multiple" <?php echo esc_attr($gmap_embed_category_select_disabled); ?>>
231 <?php
232 global $wpdb;
233 $gmap_embed_admin_categories = wp_cache_get('gmap_embed_categories', 'gmap_embed');
234 if (false === $gmap_embed_admin_categories) {
235 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
236 $gmap_embed_admin_categories = $wpdb->get_results("SELECT id, name FROM {$wpdb->prefix}wgm_categories ORDER BY name ASC");
237 wp_cache_set('gmap_embed_categories', $gmap_embed_admin_categories, 'gmap_embed');
238 }
239 if ($gmap_embed_admin_categories) {
240 foreach ($gmap_embed_admin_categories as $gmap_embed_cat) {
241 echo '<option value="' . esc_attr($gmap_embed_cat->id) . '">' . esc_html($gmap_embed_cat->name) . '</option>';
242 }
243 }
244 ?>
245 </select>
246 </div>
247 </td>
248 </tr>
249
250 <tr>
251 <td>
252 <label for="wpgmap_have_marker_link"><?php esc_html_e('Link', 'gmap-embed'); ?></label>&nbsp;
253 <select name="wpgmap_have_marker_link" id="wpgmap_have_marker_link">
254 <option value="1"><?php esc_html_e('Yes', 'gmap-embed'); ?></option>
255 <option value="0" selected="selected"><?php esc_html_e('No', 'gmap-embed'); ?></option>
256 </select>
257 <br />
258 <div id="wpgmap_marker_link_area" style="display: none;">
259 <input id="wpgmap_marker_link" name="wpgmap_marker_link"
260 placeholder="<?php esc_attr_e('Enter link here', 'gmap-embed'); ?>" type="text"
261 class="regular-text" style="margin: 5px 0;">
262 <br />
263 <label>
264 <input type="checkbox" id="wpgmap_marker_link_new_tab" name="wpgmap_marker_link_new_tab"
265 class="alignleft" style="margin: 2px 5px 0px 0px;" />
266 <span class="alignleft"><?php esc_html_e('Open link in new tab', 'gmap-embed'); ?></span>
267 </label>
268 </div>
269 </td>
270 </tr>
271 <tr>
272 <td>
273
274 <label>
275 <span
276 class="alignleft"><?php esc_html_e('Open marker description by default', 'gmap-embed'); ?></span>&nbsp;
277 <select name="wpgmap_marker_infowindow_show" id="wpgmap_marker_infowindow_show">
278 <option value="1"><?php esc_html_e('Yes', 'gmap-embed'); ?></option>
279 <option value="0" selected="selected">
280 <?php esc_html_e('No, Open description on click', 'gmap-embed'); ?>
281 </option>
282 </select>
283 </label>
284 </td>
285 </tr>
286
287
288 <?php $wpgmap_map_id = (isset($_GET['tag']) && sanitize_text_field(wp_unslash($_GET['tag'])) === 'edit') ? intval(sanitize_text_field(wp_unslash($_GET['id']))) : $wpgmap_map_id; ?>
289 <tr>
290 <td>
291 <button class=" button button-primary button-large wgm_marker_cancel" type="button">
292 <i class="dashicons dashicons-no-alt" style="line-height: 1.6;"></i>
293 <b><?php esc_html_e('Cancel', 'gmap-embed'); ?></b>
294 </button>
295 <button class=" button button-primary button-large wpgmap_marker_add" type="button" markerid="0"
296 mapid="<?php echo esc_attr($wpgmap_map_id); ?>">
297 <i class="dashicons dashicons-location" style="line-height: 1.6;"></i>
298 <b><?php esc_html_e('Save Marker', 'gmap-embed'); ?></b>
299 </button>
300 <span class="spinner alignleft"></span>
301 </td>
302 </tr>
303 </table>
304
305 <div class="gmap_embed_message_area alignleft wgm-col-full">
306 <div id="marker_errors" style="color: red;"></div>
307 <div id="marker_success" style="color: green;font-weight: bold;"></div>
308 </div>