PluginProbe
Leaflet Map / 3.4.5
Leaflet Map v3.4.5
3.4.7 3.4.6 trunk 2.10.0 2.10.1 2.11.0 2.11.1 2.11.2 2.11.3 2.11.4 2.11.5 2.12.0 2.13.0 2.14.0 2.15.0 2.16.0 2.16.1 2.16.2 2.17.0 2.17.1 2.17.2 2.17.3 2.18.0 2.19.0 2.19.1 All 49 releases
← All changes | class.plugin-settings.php +110 -14 2.16.23.4.5 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2 /**
3 3 * Class for getting and setting db/default values
4 4 *
5 - * PHP Version 5.5
6 - *
7 5 * @category Admin
8 6 * @author Benjamin J DeLong <ben@bozdoz.com>
9 7 */
10 8
@@ -14,8 +12,10 @@
14 12 }
15 13
16 14 require_once LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-option.php';
17 15
16 +// TODO: add option to reset just a single field
17 +
18 18 /**
19 19 * Used to get and set values
20 20 *
21 21 * Features:
@@ -70,9 +70,9 @@
70 70
71 71 /* update leaflet version from main class */
72 72 $leaflet_version = Leaflet_Map::$leaflet_version;
73 73
74 - $foreachmap = __('You can also change this for each map');
74 + $foreachmap = __('You can also change this for each map', 'leaflet-map');
75 75
76 76 /*
77 77 * initiate options using internationalization!
78 78 */
@@ -79,9 +79,9 @@
79 79 $this->options = array(
80 80 'default_lat' => array(
81 81 'display_name'=>__('Default Latitude', 'leaflet-map'),
82 82 'default'=>'44.67',
83 - 'type' => 'text',
83 + 'type' => 'number',
84 84 'helptext' => sprintf(
85 85 '%1$s %2$s <br /> <code>[leaflet-map lat="44.67"]</code>',
86 86 __('Default latitude for maps.', 'leaflet-map'),
87 87 $foreachmap
@@ -89,9 +89,9 @@
89 89 ),
90 90 'default_lng' => array(
91 91 'display_name'=>__('Default Longitude', 'leaflet-map'),
92 92 'default'=>'-63.61',
93 - 'type' => 'text',
93 + 'type' => 'number',
94 94 'helptext' => sprintf(
95 95 '%1$s %2$s <br /> <code>[leaflet-map lng="-63.61"]</code>',
96 96 __('Default longitude for maps.', 'leaflet-map'),
97 97 $foreachmap
@@ -99,9 +99,12 @@
99 99 ),
100 100 'default_zoom' => array(
101 101 'display_name'=>__('Default Zoom', 'leaflet-map'),
102 102 'default'=>'12',
103 - 'type' => 'text',
103 + 'type' => 'number',
104 + 'min' => 0,
105 + 'max' => 20,
106 + 'step' => 1,
104 107 'helptext' => sprintf(
105 108 '%1$s %2$s <br /> <code>[leaflet-map zoom="5"]</code>',
106 109 __('Default zoom for maps.', 'leaflet-map'),
107 110 $foreachmap
@@ -127,9 +130,9 @@
127 130 $foreachmap
128 131 )
129 132 ),
130 133 'fit_markers' => array(
131 - 'display_name'=>__('Fit Markers', 'leaflet-map'),
134 + 'display_name'=>__('Fit Bounds', 'leaflet-map'),
132 135 'default' => '0',
133 136 'type' => 'checkbox',
134 137 'helptext' => sprintf(
135 138 '%1$s %2$s <br /> <code>[leaflet-map fitbounds]</code>',
@@ -169,9 +172,12 @@
169 172 ),
170 173 'default_min_zoom' => array(
171 174 'display_name'=>__('Default Min Zoom', 'leaflet-map'),
172 175 'default' => '0',
173 - 'type' => 'text',
176 + 'type' => 'number',
177 + 'min' => 0,
178 + 'max' => 20,
179 + 'step' => 1,
174 180 'helptext' => sprintf(
175 181 '%1$s %2$s <br /> <code>[leaflet-map min_zoom="1"]</code>',
176 182 __('Restrict the viewer from zooming in past the minimum zoom. Can set per map in shortcode or adjust for all maps here.', 'leaflet-map'),
177 183 $foreachmap
@@ -178,10 +184,13 @@
178 184 )
179 185 ),
180 186 'default_max_zoom' => array(
181 187 'display_name'=>__('Default Max Zoom', 'leaflet-map'),
182 - 'default' => '20',
183 - 'type' => 'text',
188 + 'default' => '19',
189 + 'type' => 'number',
190 + 'min' => 0,
191 + 'max' => 20,
192 + 'step' => 1,
184 193 'helptext' => sprintf(
185 194 '%1$s %2%s <br /> <code>%3$s</code>',
186 195 __('Restrict the viewer from zooming out past the maximum zoom. Can set per map in shortcode or adjust for all maps here', 'leaflet-map'),
187 196 $foreachmap,
@@ -213,12 +222,12 @@
213 222 )
214 223 ),
215 224 'map_tile_url' => array(
216 225 'display_name'=>__('Map Tile URL', 'leaflet-map'),
217 - 'default'=>'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
226 + 'default'=>'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
218 227 'type' => 'text',
219 228 'helptext' => sprintf(
220 - '%1$s: <a href="http://wiki.openstreetmap.org/wiki/Tile_servers" target="_blank"> %2$s </a>. %3$s: <a href="http://devblog.mapquest.com/2016/06/15/modernization-of-mapquest-results-in-changes-to-open-tile-access/" target="_blank"> %4$s </a>. %5$s <br/> <code>[leaflet-map tileurl=http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg subdomains=abcd]</code>',
229 + '%1$s: <a href="http://wiki.openstreetmap.org/wiki/Tile_servers" target="_blank"> %2$s </a>. %3$s: <a href="http://devblog.mapquest.com/2016/06/15/modernization-of-mapquest-results-in-changes-to-open-tile-access/" target="_blank"> %4$s </a>. %5$s <br/> <code>[leaflet-map tileurl=http://{s}.example.com/{z}/{x}/{y}.jpg subdomains=abcd]</code>',
221 230 __('See more tile servers', 'leaflet-map'),
222 231 __('here', 'leaflet-map'),
223 232 __('Please note: free tiles from MapQuest have been discontinued without use of an API key', 'leaflet-map'),
224 233 __('blog post', 'leaflet-map'),
@@ -230,12 +239,72 @@
230 239 'default'=>'abc',
231 240 'type' => 'text',
232 241 'helptext' => sprintf(
233 242 '%1$s %2$s <br/> <code>[leaflet-map subdomains="1234"]</code>',
234 - __('Some maps get tiles from multiple servers with subdomains such as a,b,c,d or 1,2,3,4', 'leaflet-map'),
243 + __('Some maps get tiles from multiple servers with subdomains such as a,b,c or 1,2,3 or cache1,cache2; pass a string where each char is its own subdomain, or pass comma-separated string', 'leaflet-map'),
235 244 $foreachmap
236 245 )
237 246 ),
247 + 'detect_retina' => array(
248 + 'display_name' => __('Detect Retina', 'leaflet-map'),
249 + 'default' => '0',
250 + 'type' => 'checkbox',
251 + 'helptext' => sprintf(
252 + '%1$s %2$s <br /> <code>[leaflet-map detect-retina]</code>',
253 + __('Fetch tiles at different zoom levels to appear smoother on retina displays.', 'leaflet-map'),
254 + $foreachmap
255 + )
256 + ),
257 + 'tilesize' => array(
258 + 'display_name' => __('Tile Size', 'leaflet-map'),
259 + 'default' => null,
260 + 'type' => 'text',
261 + 'helptext' => sprintf(
262 + '%1$s %2$s <br /> <code>[leaflet-map tilesize=512]</code>',
263 + __('Width and height of tiles (in pixels) in the grid. Default is 256', 'leaflet-map'),
264 + $foreachmap
265 + )
266 + ),
267 + 'mapid' => array(
268 + 'display_name' => __('Tile Id', 'leaflet-map'),
269 + 'default' => null,
270 + 'type' => 'text',
271 + 'helptext' => sprintf(
272 + '%1$s %2$s <br /> <code>[leaflet-map mapid="mapbox/streets-v11"]</code>',
273 + __('An id that is passed to L.tileLayer; useful for Mapbox', 'leaflet-map'),
274 + $foreachmap
275 + )
276 + ),
277 + 'accesstoken' => array(
278 + 'display_name' => __('Access Token', 'leaflet-map'),
279 + 'default' => null,
280 + 'type' => 'text',
281 + 'helptext' => sprintf(
282 + '%1$s %2$s <br /> <code>[leaflet-map accesstoken="your.mapbox.access.token"]</code>',
283 + __('An access token that is passed to L.tileLayer; useful for Mapbox tiles', 'leaflet-map'),
284 + $foreachmap
285 + )
286 + ),
287 + 'zoomoffset' => array(
288 + 'display_name' => __('Zoom Offset', 'leaflet-map'),
289 + 'default' => null,
290 + 'type' => 'number',
291 + 'helptext' => sprintf(
292 + '%1$s %2$s <br /> <code>[leaflet-map zoomoffset="-1"]</code>',
293 + __('The zoom number used in tile URLs will be offset with this value', 'leaflet-map'),
294 + $foreachmap
295 + )
296 + ),
297 + 'tile_no_wrap' => array(
298 + 'display_name' => __('No Wrap (tiles)', 'leaflet-map'),
299 + 'default' => '0',
300 + 'type' => 'checkbox',
301 + 'helptext' => sprintf(
302 + '%1$s %2$s <br /> <code>[leaflet-map nowrap]</code>',
303 + __('Boolean for whether the layer is wrapped around the antimeridian', 'leaflet-map'),
304 + $foreachmap
305 + )
306 + ),
238 307 'js_url' => array(
239 308 'display_name'=>__('JavaScript URL', 'leaflet-map'),
240 309 'default' => sprintf('https://unpkg.com/leaflet@%s/dist/leaflet.js', $leaflet_version),
241 310 'type' => 'text',
@@ -249,9 +318,9 @@
249 318 ),
250 319 'default_attribution' => array(
251 320 'display_name' => __('Default Attribution', 'leaflet-map'),
252 321 'default' => sprintf(
253 - '<a href="http://leafletjs.com" title="%1$s">Leaflet</a>; \r\n© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> %2$s',
322 + '<a href="http://leafletjs.com" title="%1$s">Leaflet</a>; © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> %2$s',
254 323 __("A JS library for interactive maps", 'leaflet-map'),
255 324 __("contributors", 'leaflet-map')
256 325 ),
257 326 'type' => 'textarea',
@@ -256,8 +325,17 @@
256 325 ),
257 326 'type' => 'textarea',
258 327 'helptext' => __('Attribution to a custom tile url. Use semi-colons (;) to separate multiple.', 'leaflet-map')
259 328 ),
329 + 'show_scale' => array(
330 + 'display_name' => __('Show Scale', 'leaflet-map'),
331 + 'default' => '0',
332 + 'type' => 'checkbox',
333 + 'helptext' => __(
334 + 'Add a scale to each map. Can also be added via shortcode <br /> <code>[leaflet-scale]</code>',
335 + 'leaflet-map'
336 + )
337 + ),
260 338 'geocoder' => array(
261 339 'display_name'=>__('Geocoder', 'leaflet-map'),
262 340 'default' => 'osm',
263 341 'type' => 'select',
@@ -267,8 +345,21 @@
267 345 'dawa' => __('Denmark Addresses', 'leaflet-map')
268 346 ),
269 347 'helptext' => __('Select the Geocoding provider to use to retrieve addresses defined in shortcode.', 'leaflet-map')
270 348 ),
349 + 'nominatim_contact_email' => array(
350 + 'display_name'=>__('Nominatim Contact Email (optional)', 'leaflet-map'),
351 + 'default' => '',
352 + 'type' => 'text',
353 + 'placeholder' => sprintf(
354 + __('defaults to admin email (%s)', 'leaflet-map'),
355 + get_bloginfo('admin_email')
356 + ),
357 + 'helptext' => __(
358 + 'Optional contact email to send with OpenStreetMap Nominatim geocoding requests. If blank, the site admin email will be used.',
359 + 'leaflet-map'
360 + ),
361 + ),
271 362 'google_appkey' => array(
272 363 'display_name'=>__('Google API Key (optional)', 'leaflet-map'),
273 364 'default' => __('Supply a Google API Key', 'leaflet-map'),
274 365 'type' => 'text',
@@ -285,8 +376,13 @@
285 376 'display_name'=>__('KML/GPX JavaScript Converter', 'leaflet-map'),
286 377 'default' => 'https://unpkg.com/@mapbox/togeojson@0.16.0/togeojson.js',
287 378 'type' => 'text',
288 379 'helptext' => __('ToGeoJSON converts KML and GPX files to GeoJSON; if you plan to use [leaflet-kml] or [leaflet-gpx] then this library is loaded. You can change the default if you need.', 'leaflet-map')
380 + ),
381 + 'shortcode_in_excerpt' => array(
382 + 'display_name' => __('Show maps in excerpts', 'leaflet-map'),
383 + 'default' => '0',
384 + 'type' => 'checkbox',
289 385 ),
290 386 );
291 387
292 388 foreach ($this->options as $name => $details) {