Changeset 1809668 for leaflet-map
- Timestamp:
- 01/25/2018 10:29:34 PM (8 years ago)
- Location:
- leaflet-map
- Files:
-
- 4 added
- 1 deleted
- 10 edited
- 27 copied
-
tags/2.10.0 (copied) (copied from leaflet-map/trunk)
-
tags/2.10.0/CODE_OF_CONDUCT.md (copied) (copied from leaflet-map/trunk/CODE_OF_CONDUCT.md)
-
tags/2.10.0/CONTRIBUTING.md (copied) (copied from leaflet-map/trunk/CONTRIBUTING.md)
-
tags/2.10.0/LICENSE (copied) (copied from leaflet-map/trunk/LICENSE)
-
tags/2.10.0/README.md (copied) (copied from leaflet-map/trunk/README.md)
-
tags/2.10.0/class.admin.php (copied) (copied from leaflet-map/trunk/class.admin.php)
-
tags/2.10.0/class.geocoder.php (copied) (copied from leaflet-map/trunk/class.geocoder.php)
-
tags/2.10.0/class.leaflet-map.php (copied) (copied from leaflet-map/trunk/class.leaflet-map.php) (6 diffs)
-
tags/2.10.0/class.plugin-option.php (copied) (copied from leaflet-map/trunk/class.plugin-option.php) (1 diff)
-
tags/2.10.0/class.plugin-settings.php (copied) (copied from leaflet-map/trunk/class.plugin-settings.php) (2 diffs)
-
tags/2.10.0/images (copied) (copied from leaflet-map/trunk/images)
-
tags/2.10.0/index.php (copied) (copied from leaflet-map/trunk/index.php)
-
tags/2.10.0/languages (added)
-
tags/2.10.0/languages/leaflet-map.pot (added)
-
tags/2.10.0/leaflet-map.php (copied) (copied from leaflet-map/trunk/leaflet-map.php) (1 diff)
-
tags/2.10.0/readme.txt (copied) (copied from leaflet-map/trunk/readme.txt) (3 diffs)
-
tags/2.10.0/scripts (copied) (copied from leaflet-map/trunk/scripts)
-
tags/2.10.0/scripts/construct-leaflet-map.min.js (copied) (copied from leaflet-map/trunk/scripts/construct-leaflet-map.min.js)
-
tags/2.10.0/scripts/get-shortcode.min.js (copied) (copied from leaflet-map/trunk/scripts/get-shortcode.min.js)
-
tags/2.10.0/scripts/init-leaflet-map.js (deleted)
-
tags/2.10.0/scripts/leaflet-ajax-geojson.min.js (copied) (copied from leaflet-map/trunk/scripts/leaflet-ajax-geojson.min.js)
-
tags/2.10.0/shortcodes (copied) (copied from leaflet-map/trunk/shortcodes)
-
tags/2.10.0/shortcodes/class.geojson-shortcode.php (copied) (copied from leaflet-map/trunk/shortcodes/class.geojson-shortcode.php) (1 diff)
-
tags/2.10.0/shortcodes/class.image-shortcode.php (copied) (copied from leaflet-map/trunk/shortcodes/class.image-shortcode.php)
-
tags/2.10.0/shortcodes/class.line-shortcode.php (copied) (copied from leaflet-map/trunk/shortcodes/class.line-shortcode.php)
-
tags/2.10.0/shortcodes/class.map-shortcode.php (copied) (copied from leaflet-map/trunk/shortcodes/class.map-shortcode.php)
-
tags/2.10.0/shortcodes/class.marker-shortcode.php (copied) (copied from leaflet-map/trunk/shortcodes/class.marker-shortcode.php)
-
tags/2.10.0/shortcodes/class.shortcode.php (copied) (copied from leaflet-map/trunk/shortcodes/class.shortcode.php)
-
tags/2.10.0/style.css (copied) (copied from leaflet-map/trunk/style.css)
-
tags/2.10.0/templates (copied) (copied from leaflet-map/trunk/templates)
-
tags/2.10.0/templates/settings.php (modified) (8 diffs)
-
tags/2.10.0/templates/shortcode-helper.php (modified) (2 diffs)
-
trunk/class.leaflet-map.php (modified) (6 diffs)
-
trunk/class.plugin-option.php (modified) (1 diff)
-
trunk/class.plugin-settings.php (modified) (2 diffs)
-
trunk/languages (added)
-
trunk/languages/leaflet-map.pot (added)
-
trunk/leaflet-map.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/shortcodes/class.geojson-shortcode.php (modified) (1 diff)
-
trunk/templates/settings.php (modified) (8 diffs)
-
trunk/templates/shortcode-helper.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
leaflet-map/tags/2.10.0/class.leaflet-map.php
r1797863 r1809668 14 14 * @var string major minor patch version 15 15 */ 16 public static $version = '2. 9.1';16 public static $version = '2.10.0'; 17 17 18 18 /** … … 20 20 * @var string major minor patch version 21 21 */ 22 public static $leaflet_version = '1. 2.0';22 public static $leaflet_version = '1.3.1'; 23 23 24 24 /** … … 84 84 */ 85 85 private function __construct() { 86 $this->includes();87 86 $this->init_hooks(); 88 87 $this->add_shortcodes(); … … 94 93 /** 95 94 * 96 * include classes 97 * 98 */ 99 private function includes() { 100 // Leaflet_Map_Plugin_Settings 101 include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php'); 95 * add actions and filters 96 * 97 */ 98 private function init_hooks() { 102 99 // Leaflet_Map_Admin 103 100 include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.admin.php'); 104 }105 106 /**107 *108 * add actions and filters109 *110 */111 private function init_hooks() {112 101 113 102 // init admin 114 103 Leaflet_Map_Admin::init(); 104 105 add_action( 'plugins_loaded', array('Leaflet_Map', 'load_text_domain' )); 115 106 116 107 add_action( 'wp_enqueue_scripts', array('Leaflet_Map', 'enqueue_and_register') ); … … 156 147 157 148 /** 149 * Loads Translations 150 * 151 */ 152 public static function load_text_domain() { 153 load_plugin_textdomain( 'leaflet-map', false, dirname( plugin_basename( LEAFLET_MAP__PLUGIN_FILE ) ) . '/languages/' ); 154 } 155 156 /** 158 157 * Enqueue and register styles and scripts (called in __construct) 159 158 * … … 162 161 public static function enqueue_and_register () { 163 162 /* defaults from db */ 163 // Leaflet_Map_Plugin_Settings 164 include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php'); 164 165 $settings = Leaflet_Map_Plugin_Settings::init(); 165 166 -
leaflet-map/tags/2.10.0/class.plugin-option.php
r1797861 r1809668 37 37 38 38 $option_filter = array( 39 'default' => null, 40 'type' => FILTER_SANITIZE_STRING, 41 'options' => array( 42 'filter' => FILTER_SANITIZE_STRING, 43 'flags' => FILTER_FORCE_ARRAY 44 ), 45 'helptext' => FILTER_SANITIZE_STRING 39 'display_name' => FILTER_SANITIZE_STRING, 40 'default' => null, 41 'type' => FILTER_SANITIZE_STRING, 42 'options' => array( 43 'filter' => FILTER_SANITIZE_STRING, 44 'flags' => FILTER_FORCE_ARRAY 45 ), 46 'helptext' => FILTER_SANITIZE_STRING 46 47 ); 47 48 -
leaflet-map/tags/2.10.0/class.plugin-settings.php
r1797861 r1809668 28 28 29 29 /** 30 * Default values and admin form information 30 * Default values and admin form information 31 * Needs to be created within __construct 32 * in order to use a function such as __() 31 33 * @var array $options 32 34 */ 33 public $options = array( 34 'default_lat' => array( 35 'default'=>'44.67', 36 'type' => 'text', 37 'helptext' => 'Default latitude for maps or adjust for each map like so: <br /> <code>[leaflet-map lng="44.67"]</code>' 38 ), 39 'default_lng' => array( 40 'default'=>'-63.61', 41 'type' => 'text', 42 'helptext' => 'Default longitude for maps or adjust for each map like so: <br /> <code>[leaflet-map lng="-63.61"]</code>' 43 ), 44 'default_zoom' => array( 45 'default'=>'12', 46 'type' => 'text', 47 'helptext' => 'Can set per map in shortcode or adjust for all maps here; e.g. <br /> <code>[leaflet-map zoom="5"]</code>' 48 ), 49 'default_height' => array( 50 'default'=>'250', 51 'type' => 'text', 52 'helptext' => 'Can set per map in shortcode or adjust for all maps here. Values can include "px" but it is not necessary. Can also be %; e.g. <br/> <code>[leaflet-map height="250"]</code>' 53 ), 54 'default_width' => array( 55 'default'=>'100%', 56 'type' => 'text', 57 'helptext' => 'Can set per map in shortcode or adjust for all maps here. Values can include "px" but it is not necessary. Can also be %; e.g. <br/> <code>[leaflet-map width="100%"]</code>' 58 ), 59 'fit_markers' => array( 60 'default' => '0', 61 'type' => 'checkbox', 62 'helptext' => 'If enabled, all markers on each map will alter the view of the map; i.e. the map will fit to the bounds of all of the markers on the map. You can also change this per map in the shortcode: e.g. <br /> <code>[leaflet-map fit_markers="1"]</code>' 63 ), 64 'show_zoom_controls' => array( 65 'default' => '0', 66 'type' => 'checkbox', 67 'helptext' => 'The zoom buttons can be large and annoying. Enabled or disable per map in shortcode: <br/> <code>[leaflet-map zoomcontrol="0"]</code>' 68 ), 69 'scroll_wheel_zoom' => array( 70 'default' => '0', 71 'type' => 'checkbox', 72 'helptext' => 'Disable zoom with mouse scroll wheel. Sometimes someone wants to scroll down the page, and not zoom the map. Enable or disable per map in shortcode: <br/> <code>[leaflet-map scrollwheel="0"]</code>' 73 ), 74 'double_click_zoom' => array( 75 'default' => '0', 76 'type' => 'checkbox', 77 'helptext' => 'If enabled, your maps will zoom with a double click. By default it is disabled: If we\'re going to remove zoom controls and have scroll wheel zoom off by default, we might as well stick to our guns and not zoom the map. Enable or disable per map in shortcode: <br/> <code>[leaflet-map doubleClickZoom=false]</code>' 78 ), 79 'default_min_zoom' => array( 80 'default' => '0', 81 'type' => 'text', 82 'helptext' => 'Restrict the viewer from zooming in past the minimum zoom. Can set per map in shortcode or adjust for all maps here; e.g. <br /> <code>[leaflet-map min_zoom="1"]</code>' 83 ), 84 'default_max_zoom' => array( 85 'default' => '20', 86 'type' => 'text', 87 'helptext' => 'Restrict the viewer from zooming out past the maximum zoom. Can set per map in shortcode or adjust for all maps here; e.g. <br /> <code>[leaflet-map max_zoom="10"]</code>' 88 ), 89 'default_tiling_service' => array( 90 'default' => 'other', 91 'type' => 'select', 92 'options' => array( 93 'other' => 'I will provide my own map tile URL', 94 'mapquest' => 'MapQuest (I have an app key)', 95 ), 96 'helptext' => 'Choose a tiling service or provide your own.' 97 ), 98 'mapquest_appkey' => array( 99 'default' => 'supply-an-app-key-if-you-choose-mapquest', 100 'type' => 'text', 101 'noreset' => true, 102 'helptext' => 'If you choose MapQuest, you must provide an app key. <a href="https://developer.mapquest.com/plan_purchase/steps/business_edition/business_edition_free/register" target="_blank">Sign up</a>, then <a href="https://developer.mapquest.com/user/me/apps" target="_blank">Create a new app</a> then supply the "Consumer Key" here.' 103 ), 104 'map_tile_url' => array( 105 'default'=>'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 106 'type' => 'text', 107 'helptext' => 'See more tile servers here: <a href="http://wiki.openstreetmap.org/wiki/Tile_servers" target="_blank">here</a>. Please note(!): free tiles from MapQuest have been discontinued without use of an app key (free accounts available) (see <a href="http://devblog.mapquest.com/2016/06/15/modernization-of-mapquest-results-in-changes-to-open-tile-access/" target="_blank">blog post</a>). Can be set per map with the shortcode <br/> <code>[leaflet-map tileurl=http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg subdomains=abcd]</code>' 108 ), 109 'map_tile_url_subdomains' => array( 110 'default'=>'abc', 111 'type' => 'text', 112 'helptext' => 'Some maps get tiles from multiple servers with subdomains such as a,b,c,d or 1,2,3,4; can be set per map with the shortcode <br/> <code>[leaflet-map subdomains="1234"]</code>', 113 ), 114 'js_url' => array( 115 'default'=>'https://unpkg.com/leaflet@%s/dist/leaflet.js', 116 'type' => 'text', 117 'helptext' => 'If you host your own Leaflet files, specify the URL here.' 118 ), 119 'css_url' => array( 120 'default'=>'https://unpkg.com/leaflet@%s/dist/leaflet.css', 121 'type' => 'text', 122 'helptext' => 'Same as above.' 123 ), 124 'default_attribution' => array( 125 'default' => "<a href=\"http://leafletjs.com\" title=\"A JS library for interactive maps\">Leaflet</a>; \r\n© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors", 126 'type' => 'textarea', 127 'helptext' => 'Attribution to a custom tile url. Use semi-colons (;) to separate multiple.' 128 ), 129 'geocoder' => array( 130 'default' => 'google', 131 'type' => 'select', 132 'options' => array( 133 'google' => 'Google Maps', 134 'osm' => 'OpenStreetMap Nominatim', 135 'dawa' => 'Danmarks Adressers' 136 ), 137 'helptext' => 'Select the Geocoding provider to use to retrieve addresses defined in shortcode.' 138 ) 139 ); 35 public $options = array(); 140 36 141 37 /** … … 156 52 $leaflet_version = Leaflet_Map::$leaflet_version; 157 53 158 $this->options['js_url']['default'] = sprintf($this->options['js_url']['default'], $leaflet_version); 159 $this->options['css_url']['default'] = sprintf($this->options['css_url']['default'], $leaflet_version); 160 161 foreach ($this->options as $name => $details) { 54 $foreachmap = __('You can also change this for each map'); 55 56 /* 57 * initiate options using internationalization! 58 */ 59 $this->options = array( 60 'default_lat' => array( 61 'display_name'=>__('Default Latitude', 'leaflet-map'), 62 'default'=>'44.67', 63 'type' => 'text', 64 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map lat="44.67"]</code>', 65 __('Default latitude for maps.', 'leaflet-map'), 66 $foreachmap 67 ) 68 ), 69 'default_lng' => array( 70 'display_name'=>__('Default Longitude', 'leaflet-map'), 71 'default'=>'-63.61', 72 'type' => 'text', 73 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map lng="-63.61"]</code>', 74 __('Default longitude for maps.', 'leaflet-map'), 75 $foreachmap 76 ) 77 ), 78 'default_zoom' => array( 79 'display_name'=>__('Default Zoom', 'leaflet-map'), 80 'default'=>'12', 81 'type' => 'text', 82 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map zoom="5"]</code>', 83 __('Default zoom for maps.', 'leaflet-map'), 84 $foreachmap 85 ) 86 ), 87 'default_height' => array( 88 'display_name'=>__('Default Height', 'leaflet-map'), 89 'default'=>'250', 90 'type' => 'text', 91 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map height="250"]</code>', 92 __('Default height for maps. Values can include "px" but it is not necessary. Can also be "%". ', 'leaflet-map'), 93 $foreachmap 94 ) 95 ), 96 'default_width' => array( 97 'display_name'=>__('Default Width', 'leaflet-map'), 98 'default'=>'100%', 99 'type' => 'text', 100 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map width="100%"]</code>', 101 __('Default width for maps. Values can include "px" but it is not necessary. Can also be "%".', 'leaflet-map'), 102 $foreachmap 103 ) 104 ), 105 'fit_markers' => array( 106 'display_name'=>__('Fit Markers', 'leaflet-map'), 107 'default' => '0', 108 'type' => 'checkbox', 109 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map fit_markers="1"]</code>', 110 __('If enabled, all markers on each map will alter the view of the map; i.e. the map will fit to the bounds of all of the markers on the map.', 'leaflet-map'), 111 $foreachmap 112 ) 113 ), 114 'show_zoom_controls' => array( 115 'display_name'=>__('Show Zoom Controls', 'leaflet-map'), 116 'default' => '0', 117 'type' => 'checkbox', 118 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map zoomcontrol="0"]</code>', 119 __('The zoom buttons can be large and annoying.', 'leaflet-map'), 120 $foreachmap 121 ) 122 ), 123 'scroll_wheel_zoom' => array( 124 'display_name'=>__('Scroll Wheel Zoom', 'leaflet-map'), 125 'default' => '0', 126 'type' => 'checkbox', 127 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map scrollwheel="0"]</code>', 128 __('Disable zoom with mouse scroll wheel. Sometimes someone wants to scroll down the page, and not zoom the map.', 'leaflet-map'), 129 $foreachmap 130 ) 131 ), 132 'double_click_zoom' => array( 133 'display_name'=>__('Double Click Zoom', 'leaflet-map'), 134 'default' => '0', 135 'type' => 'checkbox', 136 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map doubleClickZoom=false]</code>', 137 __('If enabled, your maps will zoom with a double click. By default it is disabled: If we\'re going to remove zoom controls and have scroll wheel zoom off by default, we might as well stick to our guns and not zoom the map.', 'leaflet-map'), 138 $foreachmap 139 ) 140 ), 141 'default_min_zoom' => array( 142 'display_name'=>__('Default Min Zoom', 'leaflet-map'), 143 'default' => '0', 144 'type' => 'text', 145 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map min_zoom="1"]</code>', 146 __('Restrict the viewer from zooming in past the minimum zoom. Can set per map in shortcode or adjust for all maps here.', 'leaflet-map'), 147 $foreachmap 148 ) 149 ), 150 'default_max_zoom' => array( 151 'display_name'=>__('Default Max Zoom', 'leaflet-map'), 152 'default' => '20', 153 'type' => 'text', 154 'helptext' => sprintf('%1$s %2%s <br /> <code>%3$s</code>', 155 __('Restrict the viewer from zooming out past the maximum zoom. Can set per map in shortcode or adjust for all maps here', 'leaflet-map'), 156 $foreachmap, 157 '[leaflet-map max_zoom="10"]' 158 ) 159 ), 160 'default_tiling_service' => array( 161 'display_name'=>__('Default Tiling Service', 'leaflet-map'), 162 'default' => 'other', 163 'type' => 'select', 164 'options' => array( 165 'other' => __('I will provide my own map tile URL', 'leaflet-map'), 166 'mapquest' => __('MapQuest (I have an app key)', 'leaflet-map'), 167 ), 168 'helptext' => __('Choose a tiling service or provide your own.', 'leaflet-map') 169 ), 170 'mapquest_appkey' => array( 171 'display_name'=>__('MapQuest App Key', 'leaflet-map'), 172 'default' => __('Supply an app key if you choose MapQuest', 'leaflet-map'), 173 'type' => 'text', 174 'noreset' => true, 175 'helptext' => sprintf('%1$s <a href="https://developer.mapquest.com/plan_purchase/steps/business_edition/business_edition_free/register" target="_blank"> %2$s </a>, %3$s <a href="https://developer.mapquest.com/user/me/apps" target="_blank"> %4$s </a> %5$s', 176 __('If you choose MapQuest, you must provide an app key.', 'leaflet-map'), 177 __('Sign up', 'leaflet-map'), 178 __('then', 'leaflet-map'), 179 __('Create a new app', 'leaflet-map'), 180 __('then supply the "Consumer Key" here.', 'leaflet-map') 181 ) 182 ), 183 'map_tile_url' => array( 184 'display_name'=>__('Map Tile URL', 'leaflet-map'), 185 'default'=>'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 186 'type' => 'text', 187 'helptext' => sprintf('%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>', 188 __('See more tile servers', 'leaflet-map'), 189 __('here', 'leaflet-map'), 190 __('Please note: free tiles from MapQuest have been discontinued without use of an app key', 'leaflet-map'), 191 __('blog post', 'leaflet-map'), 192 $foreachmap 193 ) 194 ), 195 'map_tile_url_subdomains' => array( 196 'display_name'=>__('Map Tile URL Subdomains', 'leaflet-map'), 197 'default'=>'abc', 198 'type' => 'text', 199 'helptext' => sprintf('%1$s %2$s <br/> <code>[leaflet-map subdomains="1234"]</code>', 200 __('Some maps get tiles from multiple servers with subdomains such as a,b,c,d or 1,2,3,4', 'leaflet-map'), 201 $foreachmap 202 ) 203 ), 204 'js_url' => array( 205 'display_name'=>__('JavaScript URL', 'leaflet-map'), 206 'default' => sprintf('https://unpkg.com/leaflet@%s/dist/leaflet.js', $leaflet_version), 207 'type' => 'text', 208 'helptext' => __('If you host your own Leaflet files, then paste the URL here.', 'leaflet-map') 209 ), 210 'css_url' => array( 211 'display_name'=>__('CSS URL', 'leaflet-map'), 212 'default' => sprintf('https://unpkg.com/leaflet@%s/dist/leaflet.css', $leaflet_version), 213 'type' => 'text', 214 'helptext' => __('Same as above.', 'leaflet-map') 215 ), 216 'default_attribution' => array( 217 'display_name'=>__('Default Attribution', 'leaflet-map'), 218 'default' => sprintf('<a href="http://leafletjs.com" title="%1$s">Leaflet</a>; \r\n© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> %2$s', 219 __("A JS library for interactive maps", 'leaflet-map'), 220 __("contributors", 'leaflet-map') 221 ), 222 'type' => 'textarea', 223 'helptext' => __('Attribution to a custom tile url. Use semi-colons (;) to separate multiple.', 'leaflet-map') 224 ), 225 'geocoder' => array( 226 'display_name'=>__('Geocoder', 'leaflet-map'), 227 'default' => 'google', 228 'type' => 'select', 229 'options' => array( 230 'google' => __('Google Maps', 'leaflet-map'), 231 'osm' => __('OpenStreetMap Nominatim', 'leaflet-map'), 232 'dawa' => __('Denmark Addresses', 'leaflet-map') 233 ), 234 'helptext' => __('Select the Geocoding provider to use to retrieve addresses defined in shortcode.', 'leaflet-map') 235 ) 236 ); 237 238 foreach ($this->options as $name => $details) { 162 239 $this->options[ $name ] = new Leaflet_Map_Plugin_Option( $details ); 163 240 } -
leaflet-map/tags/2.10.0/leaflet-map.php
r1797863 r1809668 6 6 Author: bozdoz 7 7 Author URI: https://twitter.com/bozdoz/ 8 Version: 2.9.1 8 Text Domain: leaflet-map 9 Domain Path: /languages/ 10 Version: 2.10.0 9 11 License: GPL2 10 12 -
leaflet-map/tags/2.10.0/readme.txt
r1797863 r1809668 3 3 Author URI: https://www.twitter.com/bozdoz/ 4 4 Plugin URI: https://wordpress.org/plugins/leaflet-map/ 5 Contributors: bozdoz, Remigr, nielsalstrup, jeromelebleu 5 Contributors: bozdoz, Remigr, nielsalstrup, jeromelebleu, gerital 6 6 Donate link: https://www.paypal.me/bozdoz 7 7 Tags: leaflet, map, mobile, javascript, openstreetmap, mapquest, interactive 8 8 Requires at least: 3.0.1 9 9 Tested up to: 4.9 10 Version: 2. 9.111 Stable tag: 2. 9.110 Version: 2.10.0 11 Stable tag: 2.10.0 12 12 License: GPLv2 13 13 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 78 78 = Can I add geojson? = 79 79 80 Yes, just give it a source URL: `[leaflet-geojson src="https://example.com/path/to.geojson"]` It will also support leaflet geojson styles or geojson.io styles. Add a popup message with `[leaflet-geojson popup_text="hello!"]`, or add HTML by adding it to the content of the shortcode: `[leaflet-geojson]<a href="#">Link here </a>[/leaflet-geojson]` or identify a geojson property with `popup_property`, and each shape will use its own popup text if available.80 Yes, just give it a source URL: `[leaflet-geojson src="https://example.com/path/to.geojson"]` It will also support leaflet geojson styles or geojson.io styles. Add a popup message with `[leaflet-geojson popup_text="hello!"]`, or add HTML by adding it to the content of the shortcode: `[leaflet-geojson]<a href="#">Link here, or use text from a feature property, like {title}</a>[/leaflet-geojson]` or identify a geojson property with `popup_property`, and each shape will use its own popup text if available. 81 81 82 82 = Can I add kml/gpx? = … … 121 121 == Changelog == 122 122 123 = 2.10.0 = 124 * Added functions for translating text 125 * Added string interpolation for GeoJSON popups to use feature properties (thanks to [@geraldo](https://github.com/geraldo)) 126 123 127 = 2.9.1 = 124 128 * Fixes for PHP 7.2: made all method arguments identical -
leaflet-map/tags/2.10.0/shortcodes/class.geojson-shortcode.php
r1797863 r1809668 107 107 function onEachFeature (feature, layer) { 108 108 var props = feature.properties || {}, 109 text = popup_property && props[ popup_property ] || popup_text;109 text = popup_property && props[ popup_property ] || template(popup_text, feature.properties); 110 110 if (text) { 111 111 layer.bindPopup( text ); 112 112 } 113 } 113 } 114 var templateRe = /\{ *([\w_-]+) *\}/g; 115 function template(str, data) { 116 return str.replace(templateRe, function (match, key) { 117 var value = data[key]; 118 if (value === undefined) { 119 return match; 120 } 121 return value; 122 }); 123 } 114 124 }); 115 125 </script> -
leaflet-map/tags/2.10.0/templates/settings.php
r1709928 r1809668 1 1 <?php 2 2 $title = $plugin_data['Name']; 3 $description = $plugin_data['Description'];3 $description = __('A plugin for creating a Leaflet JS map with a shortcode. Boasts two free map tile services and three free geocoders.', 'leaflet-map'); 4 4 $version = $plugin_data['Version']; 5 6 function option_label ($opt) {7 $opt = explode('_', $opt);8 9 foreach($opt as &$v) {10 $v = ucfirst($v);11 }12 echo implode(' ', $opt);13 }14 5 ?> 15 6 <div class="wrap"> … … 33 24 ?> 34 25 <div class="notice notice-success is-dismissible"> 35 <p> Options Updated!</p>26 <p><?php _e('Options Updated!', 'leaflet-map'); ?></p> 36 27 </div> 37 28 <?php … … 40 31 ?> 41 32 <div class="notice notice-success is-dismissible"> 42 <p> Options have been reset to default values!</p>33 <p><?php _e('Options have been reset to default values!', 'leaflet-map'); ?></p> 43 34 </div> 44 35 <?php … … 48 39 ?> 49 40 <div class="notice notice-success is-dismissible"> 50 <p> Location caches have been cleared!</p>41 <p><?php _e('Location caches have been cleared!', 'leaflet-map'); ?></p> 51 42 </div> 52 43 <?php … … 57 48 <form method="post"> 58 49 <div class="container"> 59 <h2> Settings</h2>50 <h2><?php _e('Settings', 'leaflet-map'); ?></h2> 60 51 <hr> 61 52 </div> … … 66 57 <div class="container"> 67 58 <label> 68 <span class="label"><?php option_label($name); ?></span>59 <span class="label"><?php echo $option->display_name; ?></span> 69 60 <span class="input-group"> 70 61 <?php … … 78 69 ?> 79 70 <div class="helptext"> 80 <p class="description"><?php 81 echo $option->helptext; 82 ?></p> 71 <p class="description"><?php echo $option->helptext; ?></p> 83 72 </div> 84 73 <?php … … 90 79 ?> 91 80 <div class="submit"> 92 <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"> 93 <input type="submit" name="reset" id="reset" class="button button-secondary" value="Reset to Defaults"> 81 <input type="submit" 82 name="submit" 83 id="submit" 84 class="button button-primary" 85 value="<?php _e('Save Changes', 'leaflet-map'); ?>"> 86 <input type="submit" 87 name="reset" 88 id="reset" 89 class="button button-secondary" 90 value="<?php _e('Reset to Defaults', 'leaflet-map'); ?>"> 94 91 <input type="submit" 95 92 name="clear-geocoder-cache" 96 93 id="clear-geocoder-cache" 97 94 class="button button-secondary" 98 value=" Clear Geocoder Cache">95 value="<?php _e('Clear Geocoder Cache', 'leaflet-map'); ?>"> 99 96 </div> 100 97 -
leaflet-map/tags/2.10.0/templates/shortcode-helper.php
r1720896 r1809668 15 15 <div class="wrap"> 16 16 <?php 17 $drag = __('Drag Me', 'leaflet-map'); 18 17 19 echo do_shortcode('[leaflet-map zoom=2 zoomcontrol=1 doubleClickZoom=1 height=300 scrollwheel=1]'); 18 echo do_shortcode('[leaflet-marker draggable=1 message="Drag me!" visible="true"]'); 20 echo do_shortcode(sprintf('[leaflet-marker draggable=1 visible="true"] %s [/leaflet-marker]', 21 $drag 22 )); 19 23 ?> 20 24 <div class="wrap"> 21 25 <hr> 22 <h2> Interactive Shortcodes:</h2>23 <p class="description"> Move the map and the marker to generate shortcodes below:</p>24 <div class="flex"><label class="h3" for="map-shortcode"> Map Shortcode</label> <input type="text" id="map-shortcode" readonly="readonly" /></div>25 <div class="flex"><label class="h3" for="marker-shortcode"> Marker Shortcode</label> <input type="text" id="marker-shortcode" readonly="readonly" /></div>26 <h2><?php _e('Interactive Shortcodes:', 'leaflet-map'); ?></h2> 27 <p class="description"><?php _e('Move the map and the marker to generate shortcodes below:', 'leaflet-map'); ?></p> 28 <div class="flex"><label class="h3" for="map-shortcode"><?php _e('Map Shortcode', 'leaflet-map'); ?></label> <input type="text" id="map-shortcode" readonly="readonly" /></div> 29 <div class="flex"><label class="h3" for="marker-shortcode"><?php _e('Marker Shortcode', 'leaflet-map'); ?></label> <input type="text" id="marker-shortcode" readonly="readonly" /></div> 26 30 <hr> 27 <h2> Examples:</h2>31 <h2><?php _e('Examples', 'leaflet-map'); ?>:</h2> 28 32 <div class="examples"> 29 33 <?php 30 34 $examples = array( 31 "Standard"=> array(35 __("Standard", 'leaflet-map') => array( 32 36 '[leaflet-map zoom=12 lat=51.05 lng=-114.06]', 33 37 ), 34 "Many Markers!"=> array(38 __("Many Markers!", 'leaflet-map') => array( 35 39 '[leaflet-map zoom=10 lat=43.65 lng=-79.385]', 36 40 '[leaflet-marker]', … … 38 42 '[leaflet-marker lat=43.67 lng=-79.4]', 39 43 ), 40 "Draggable Marker"=> array(44 __("Draggable Marker", 'leaflet-map') => array( 41 45 '[leaflet-map zoom=8 lat=-33.85 lng=151.21 scrollwheel=1]', 42 46 '[leaflet-marker draggable=1]', 43 47 ), 44 "Marker Icon"=> array(48 __("Marker Icon", 'leaflet-map') => array( 45 49 '[leaflet-map zoom=10 address="cochrane, Ontario" scrollwheel=1]', 46 50 '[leaflet-marker iconUrl="https://i.imgur.com/Q54ueuO.png" iconSize="80,50" iconAnchor="40,60"]' 47 51 ), 48 "Zoom Buttons"=> array(52 __("Zoom Buttons", 'leaflet-map') => array( 49 53 '[leaflet-map zoom=9 lat=48.855 lng=2.35 zoomcontrol=1]', 50 54 ), 51 "Alternate Map Tiles w/scrollwheel"=> array(55 __("Alternate Map Tiles w/scrollwheel", 'leaflet-map') => array( 52 56 '[leaflet-map zoom=2 scrollwheel=1 lat=-2.507 lng=32.902 tileurl=https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg subdomains=abcd attribution="Map tiles by Stamen Design, under CC BY 3.0."]', 53 57 ), 54 "Marker Popup Messages (on click)"=> array(58 __("Marker Popup Messages (on click)", 'leaflet-map') => array( 55 59 '[leaflet-map lat=59.913 lng=10.739 zoom=12]', 56 60 '[leaflet-marker]OSLO![/leaflet-marker]', 57 61 ), 58 "Links In Marker Messages (visible)"=> array(62 __("Links In Marker Messages (visible)", 'leaflet-map') => array( 59 63 '[leaflet-map lat=28.41 lng=-81.58 zoom=15]', 60 64 '[leaflet-marker visible="true"] Disney World! <a href="https://disneyworld.disney.go.com">Link</a> [/leaflet-marker]', 61 65 ), 62 "Basic Lines w/Scrollwheel"=> array(66 __("Basic Lines w/Scrollwheel", 'leaflet-map') => array( 63 67 '[leaflet-map lat=41 lng=29 scrollwheel=1 zoom=6]', 64 68 '[leaflet-line latlngs="41, 29; 44, 18;"]' 65 69 ), 66 "Fitted Colored Line on Addresses"=> array(70 __("Fitted Colored Line on Addresses", 'leaflet-map') => array( 67 71 '[leaflet-map]', 68 72 '[leaflet-line color="purple" addresses="Sayulita; Puerto Vallarta;" fitline=1]' 69 73 ), 70 "More Crazy Line Attributes"=> array(74 __("More Crazy Line Attributes", 'leaflet-map') => array( 71 75 '[leaflet-map]', 72 '[leaflet-line color="red" weight=10 dasharray="2,15" addresses="Halifax, NS; Tanzania" classname=marching-ants fitbounds=1] CSS makes me march![/leaflet-line]'76 '[leaflet-line color="red" weight=10 dasharray="2,15" addresses="Halifax, NS; Tanzania" classname=marching-ants fitbounds=1]' 73 77 ), 74 "Disable all Interaction"=> array(78 __("Disable all Interaction", 'leaflet-map') => array( 75 79 '[leaflet-map address="las vegas" boxZoom=false doubleClickZoom=false dragging=false keyboard=false scrollwheel=0 attribution=0]', 76 80 ), 77 "Add GeoJSON by URL (with popups)"=> array(81 __("Add GeoJSON by URL (with popups)", 'leaflet-map') => array( 78 82 '[leaflet-map doubleClickZoom=true scrollwheel=true]', 79 83 '[leaflet-geojson src=https://cdn.rawgit.com/bozdoz/064a7101b95a324e8852fe9381ab9a18/raw/03f4f54b13a3a7e256732760a8b679818d9d36fc/map.geojson fitbounds=1 popup_property="popup-text"]' 80 84 ), 81 "Test Image Map"=> array(85 __("Test Image Map", 'leaflet-map') => array( 82 86 '[leaflet-image zoom=1 zoomcontrol=1 scrollwheelzoom=1 attribution=0]', 83 87 '[leaflet-marker]' -
leaflet-map/trunk/class.leaflet-map.php
r1797863 r1809668 14 14 * @var string major minor patch version 15 15 */ 16 public static $version = '2. 9.1';16 public static $version = '2.10.0'; 17 17 18 18 /** … … 20 20 * @var string major minor patch version 21 21 */ 22 public static $leaflet_version = '1. 2.0';22 public static $leaflet_version = '1.3.1'; 23 23 24 24 /** … … 84 84 */ 85 85 private function __construct() { 86 $this->includes();87 86 $this->init_hooks(); 88 87 $this->add_shortcodes(); … … 94 93 /** 95 94 * 96 * include classes 97 * 98 */ 99 private function includes() { 100 // Leaflet_Map_Plugin_Settings 101 include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php'); 95 * add actions and filters 96 * 97 */ 98 private function init_hooks() { 102 99 // Leaflet_Map_Admin 103 100 include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.admin.php'); 104 }105 106 /**107 *108 * add actions and filters109 *110 */111 private function init_hooks() {112 101 113 102 // init admin 114 103 Leaflet_Map_Admin::init(); 104 105 add_action( 'plugins_loaded', array('Leaflet_Map', 'load_text_domain' )); 115 106 116 107 add_action( 'wp_enqueue_scripts', array('Leaflet_Map', 'enqueue_and_register') ); … … 156 147 157 148 /** 149 * Loads Translations 150 * 151 */ 152 public static function load_text_domain() { 153 load_plugin_textdomain( 'leaflet-map', false, dirname( plugin_basename( LEAFLET_MAP__PLUGIN_FILE ) ) . '/languages/' ); 154 } 155 156 /** 158 157 * Enqueue and register styles and scripts (called in __construct) 159 158 * … … 162 161 public static function enqueue_and_register () { 163 162 /* defaults from db */ 163 // Leaflet_Map_Plugin_Settings 164 include_once(LEAFLET_MAP__PLUGIN_DIR . 'class.plugin-settings.php'); 164 165 $settings = Leaflet_Map_Plugin_Settings::init(); 165 166 -
leaflet-map/trunk/class.plugin-option.php
r1720896 r1809668 37 37 38 38 $option_filter = array( 39 'default' => null, 40 'type' => FILTER_SANITIZE_STRING, 41 'options' => array( 42 'filter' => FILTER_SANITIZE_STRING, 43 'flags' => FILTER_FORCE_ARRAY 44 ), 45 'helptext' => FILTER_SANITIZE_STRING 39 'display_name' => FILTER_SANITIZE_STRING, 40 'default' => null, 41 'type' => FILTER_SANITIZE_STRING, 42 'options' => array( 43 'filter' => FILTER_SANITIZE_STRING, 44 'flags' => FILTER_FORCE_ARRAY 45 ), 46 'helptext' => FILTER_SANITIZE_STRING 46 47 ); 47 48 -
leaflet-map/trunk/class.plugin-settings.php
r1720896 r1809668 28 28 29 29 /** 30 * Default values and admin form information 30 * Default values and admin form information 31 * Needs to be created within __construct 32 * in order to use a function such as __() 31 33 * @var array $options 32 34 */ 33 public $options = array( 34 'default_lat' => array( 35 'default'=>'44.67', 36 'type' => 'text', 37 'helptext' => 'Default latitude for maps or adjust for each map like so: <br /> <code>[leaflet-map lng="44.67"]</code>' 38 ), 39 'default_lng' => array( 40 'default'=>'-63.61', 41 'type' => 'text', 42 'helptext' => 'Default longitude for maps or adjust for each map like so: <br /> <code>[leaflet-map lng="-63.61"]</code>' 43 ), 44 'default_zoom' => array( 45 'default'=>'12', 46 'type' => 'text', 47 'helptext' => 'Can set per map in shortcode or adjust for all maps here; e.g. <br /> <code>[leaflet-map zoom="5"]</code>' 48 ), 49 'default_height' => array( 50 'default'=>'250', 51 'type' => 'text', 52 'helptext' => 'Can set per map in shortcode or adjust for all maps here. Values can include "px" but it is not necessary. Can also be %; e.g. <br/> <code>[leaflet-map height="250"]</code>' 53 ), 54 'default_width' => array( 55 'default'=>'100%', 56 'type' => 'text', 57 'helptext' => 'Can set per map in shortcode or adjust for all maps here. Values can include "px" but it is not necessary. Can also be %; e.g. <br/> <code>[leaflet-map width="100%"]</code>' 58 ), 59 'fit_markers' => array( 60 'default' => '0', 61 'type' => 'checkbox', 62 'helptext' => 'If enabled, all markers on each map will alter the view of the map; i.e. the map will fit to the bounds of all of the markers on the map. You can also change this per map in the shortcode: e.g. <br /> <code>[leaflet-map fit_markers="1"]</code>' 63 ), 64 'show_zoom_controls' => array( 65 'default' => '0', 66 'type' => 'checkbox', 67 'helptext' => 'The zoom buttons can be large and annoying. Enabled or disable per map in shortcode: <br/> <code>[leaflet-map zoomcontrol="0"]</code>' 68 ), 69 'scroll_wheel_zoom' => array( 70 'default' => '0', 71 'type' => 'checkbox', 72 'helptext' => 'Disable zoom with mouse scroll wheel. Sometimes someone wants to scroll down the page, and not zoom the map. Enable or disable per map in shortcode: <br/> <code>[leaflet-map scrollwheel="0"]</code>' 73 ), 74 'double_click_zoom' => array( 75 'default' => '0', 76 'type' => 'checkbox', 77 'helptext' => 'If enabled, your maps will zoom with a double click. By default it is disabled: If we\'re going to remove zoom controls and have scroll wheel zoom off by default, we might as well stick to our guns and not zoom the map. Enable or disable per map in shortcode: <br/> <code>[leaflet-map doubleClickZoom=false]</code>' 78 ), 79 'default_min_zoom' => array( 80 'default' => '0', 81 'type' => 'text', 82 'helptext' => 'Restrict the viewer from zooming in past the minimum zoom. Can set per map in shortcode or adjust for all maps here; e.g. <br /> <code>[leaflet-map min_zoom="1"]</code>' 83 ), 84 'default_max_zoom' => array( 85 'default' => '20', 86 'type' => 'text', 87 'helptext' => 'Restrict the viewer from zooming out past the maximum zoom. Can set per map in shortcode or adjust for all maps here; e.g. <br /> <code>[leaflet-map max_zoom="10"]</code>' 88 ), 89 'default_tiling_service' => array( 90 'default' => 'other', 91 'type' => 'select', 92 'options' => array( 93 'other' => 'I will provide my own map tile URL', 94 'mapquest' => 'MapQuest (I have an app key)', 95 ), 96 'helptext' => 'Choose a tiling service or provide your own.' 97 ), 98 'mapquest_appkey' => array( 99 'default' => 'supply-an-app-key-if-you-choose-mapquest', 100 'type' => 'text', 101 'noreset' => true, 102 'helptext' => 'If you choose MapQuest, you must provide an app key. <a href="https://developer.mapquest.com/plan_purchase/steps/business_edition/business_edition_free/register" target="_blank">Sign up</a>, then <a href="https://developer.mapquest.com/user/me/apps" target="_blank">Create a new app</a> then supply the "Consumer Key" here.' 103 ), 104 'map_tile_url' => array( 105 'default'=>'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 106 'type' => 'text', 107 'helptext' => 'See more tile servers here: <a href="http://wiki.openstreetmap.org/wiki/Tile_servers" target="_blank">here</a>. Please note(!): free tiles from MapQuest have been discontinued without use of an app key (free accounts available) (see <a href="http://devblog.mapquest.com/2016/06/15/modernization-of-mapquest-results-in-changes-to-open-tile-access/" target="_blank">blog post</a>). Can be set per map with the shortcode <br/> <code>[leaflet-map tileurl=http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg subdomains=abcd]</code>' 108 ), 109 'map_tile_url_subdomains' => array( 110 'default'=>'abc', 111 'type' => 'text', 112 'helptext' => 'Some maps get tiles from multiple servers with subdomains such as a,b,c,d or 1,2,3,4; can be set per map with the shortcode <br/> <code>[leaflet-map subdomains="1234"]</code>', 113 ), 114 'js_url' => array( 115 'default'=>'https://unpkg.com/leaflet@%s/dist/leaflet.js', 116 'type' => 'text', 117 'helptext' => 'If you host your own Leaflet files, specify the URL here.' 118 ), 119 'css_url' => array( 120 'default'=>'https://unpkg.com/leaflet@%s/dist/leaflet.css', 121 'type' => 'text', 122 'helptext' => 'Same as above.' 123 ), 124 'default_attribution' => array( 125 'default' => "<a href=\"http://leafletjs.com\" title=\"A JS library for interactive maps\">Leaflet</a>; \r\n© <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors", 126 'type' => 'textarea', 127 'helptext' => 'Attribution to a custom tile url. Use semi-colons (;) to separate multiple.' 128 ), 129 'geocoder' => array( 130 'default' => 'google', 131 'type' => 'select', 132 'options' => array( 133 'google' => 'Google Maps', 134 'osm' => 'OpenStreetMap Nominatim', 135 'dawa' => 'Danmarks Adressers' 136 ), 137 'helptext' => 'Select the Geocoding provider to use to retrieve addresses defined in shortcode.' 138 ) 139 ); 35 public $options = array(); 140 36 141 37 /** … … 156 52 $leaflet_version = Leaflet_Map::$leaflet_version; 157 53 158 $this->options['js_url']['default'] = sprintf($this->options['js_url']['default'], $leaflet_version); 159 $this->options['css_url']['default'] = sprintf($this->options['css_url']['default'], $leaflet_version); 160 161 foreach ($this->options as $name => $details) { 54 $foreachmap = __('You can also change this for each map'); 55 56 /* 57 * initiate options using internationalization! 58 */ 59 $this->options = array( 60 'default_lat' => array( 61 'display_name'=>__('Default Latitude', 'leaflet-map'), 62 'default'=>'44.67', 63 'type' => 'text', 64 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map lat="44.67"]</code>', 65 __('Default latitude for maps.', 'leaflet-map'), 66 $foreachmap 67 ) 68 ), 69 'default_lng' => array( 70 'display_name'=>__('Default Longitude', 'leaflet-map'), 71 'default'=>'-63.61', 72 'type' => 'text', 73 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map lng="-63.61"]</code>', 74 __('Default longitude for maps.', 'leaflet-map'), 75 $foreachmap 76 ) 77 ), 78 'default_zoom' => array( 79 'display_name'=>__('Default Zoom', 'leaflet-map'), 80 'default'=>'12', 81 'type' => 'text', 82 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map zoom="5"]</code>', 83 __('Default zoom for maps.', 'leaflet-map'), 84 $foreachmap 85 ) 86 ), 87 'default_height' => array( 88 'display_name'=>__('Default Height', 'leaflet-map'), 89 'default'=>'250', 90 'type' => 'text', 91 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map height="250"]</code>', 92 __('Default height for maps. Values can include "px" but it is not necessary. Can also be "%". ', 'leaflet-map'), 93 $foreachmap 94 ) 95 ), 96 'default_width' => array( 97 'display_name'=>__('Default Width', 'leaflet-map'), 98 'default'=>'100%', 99 'type' => 'text', 100 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map width="100%"]</code>', 101 __('Default width for maps. Values can include "px" but it is not necessary. Can also be "%".', 'leaflet-map'), 102 $foreachmap 103 ) 104 ), 105 'fit_markers' => array( 106 'display_name'=>__('Fit Markers', 'leaflet-map'), 107 'default' => '0', 108 'type' => 'checkbox', 109 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map fit_markers="1"]</code>', 110 __('If enabled, all markers on each map will alter the view of the map; i.e. the map will fit to the bounds of all of the markers on the map.', 'leaflet-map'), 111 $foreachmap 112 ) 113 ), 114 'show_zoom_controls' => array( 115 'display_name'=>__('Show Zoom Controls', 'leaflet-map'), 116 'default' => '0', 117 'type' => 'checkbox', 118 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map zoomcontrol="0"]</code>', 119 __('The zoom buttons can be large and annoying.', 'leaflet-map'), 120 $foreachmap 121 ) 122 ), 123 'scroll_wheel_zoom' => array( 124 'display_name'=>__('Scroll Wheel Zoom', 'leaflet-map'), 125 'default' => '0', 126 'type' => 'checkbox', 127 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map scrollwheel="0"]</code>', 128 __('Disable zoom with mouse scroll wheel. Sometimes someone wants to scroll down the page, and not zoom the map.', 'leaflet-map'), 129 $foreachmap 130 ) 131 ), 132 'double_click_zoom' => array( 133 'display_name'=>__('Double Click Zoom', 'leaflet-map'), 134 'default' => '0', 135 'type' => 'checkbox', 136 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map doubleClickZoom=false]</code>', 137 __('If enabled, your maps will zoom with a double click. By default it is disabled: If we\'re going to remove zoom controls and have scroll wheel zoom off by default, we might as well stick to our guns and not zoom the map.', 'leaflet-map'), 138 $foreachmap 139 ) 140 ), 141 'default_min_zoom' => array( 142 'display_name'=>__('Default Min Zoom', 'leaflet-map'), 143 'default' => '0', 144 'type' => 'text', 145 'helptext' => sprintf('%1$s %2$s <br /> <code>[leaflet-map min_zoom="1"]</code>', 146 __('Restrict the viewer from zooming in past the minimum zoom. Can set per map in shortcode or adjust for all maps here.', 'leaflet-map'), 147 $foreachmap 148 ) 149 ), 150 'default_max_zoom' => array( 151 'display_name'=>__('Default Max Zoom', 'leaflet-map'), 152 'default' => '20', 153 'type' => 'text', 154 'helptext' => sprintf('%1$s %2%s <br /> <code>%3$s</code>', 155 __('Restrict the viewer from zooming out past the maximum zoom. Can set per map in shortcode or adjust for all maps here', 'leaflet-map'), 156 $foreachmap, 157 '[leaflet-map max_zoom="10"]' 158 ) 159 ), 160 'default_tiling_service' => array( 161 'display_name'=>__('Default Tiling Service', 'leaflet-map'), 162 'default' => 'other', 163 'type' => 'select', 164 'options' => array( 165 'other' => __('I will provide my own map tile URL', 'leaflet-map'), 166 'mapquest' => __('MapQuest (I have an app key)', 'leaflet-map'), 167 ), 168 'helptext' => __('Choose a tiling service or provide your own.', 'leaflet-map') 169 ), 170 'mapquest_appkey' => array( 171 'display_name'=>__('MapQuest App Key', 'leaflet-map'), 172 'default' => __('Supply an app key if you choose MapQuest', 'leaflet-map'), 173 'type' => 'text', 174 'noreset' => true, 175 'helptext' => sprintf('%1$s <a href="https://developer.mapquest.com/plan_purchase/steps/business_edition/business_edition_free/register" target="_blank"> %2$s </a>, %3$s <a href="https://developer.mapquest.com/user/me/apps" target="_blank"> %4$s </a> %5$s', 176 __('If you choose MapQuest, you must provide an app key.', 'leaflet-map'), 177 __('Sign up', 'leaflet-map'), 178 __('then', 'leaflet-map'), 179 __('Create a new app', 'leaflet-map'), 180 __('then supply the "Consumer Key" here.', 'leaflet-map') 181 ) 182 ), 183 'map_tile_url' => array( 184 'display_name'=>__('Map Tile URL', 'leaflet-map'), 185 'default'=>'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 186 'type' => 'text', 187 'helptext' => sprintf('%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>', 188 __('See more tile servers', 'leaflet-map'), 189 __('here', 'leaflet-map'), 190 __('Please note: free tiles from MapQuest have been discontinued without use of an app key', 'leaflet-map'), 191 __('blog post', 'leaflet-map'), 192 $foreachmap 193 ) 194 ), 195 'map_tile_url_subdomains' => array( 196 'display_name'=>__('Map Tile URL Subdomains', 'leaflet-map'), 197 'default'=>'abc', 198 'type' => 'text', 199 'helptext' => sprintf('%1$s %2$s <br/> <code>[leaflet-map subdomains="1234"]</code>', 200 __('Some maps get tiles from multiple servers with subdomains such as a,b,c,d or 1,2,3,4', 'leaflet-map'), 201 $foreachmap 202 ) 203 ), 204 'js_url' => array( 205 'display_name'=>__('JavaScript URL', 'leaflet-map'), 206 'default' => sprintf('https://unpkg.com/leaflet@%s/dist/leaflet.js', $leaflet_version), 207 'type' => 'text', 208 'helptext' => __('If you host your own Leaflet files, then paste the URL here.', 'leaflet-map') 209 ), 210 'css_url' => array( 211 'display_name'=>__('CSS URL', 'leaflet-map'), 212 'default' => sprintf('https://unpkg.com/leaflet@%s/dist/leaflet.css', $leaflet_version), 213 'type' => 'text', 214 'helptext' => __('Same as above.', 'leaflet-map') 215 ), 216 'default_attribution' => array( 217 'display_name'=>__('Default Attribution', 'leaflet-map'), 218 'default' => sprintf('<a href="http://leafletjs.com" title="%1$s">Leaflet</a>; \r\n© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> %2$s', 219 __("A JS library for interactive maps", 'leaflet-map'), 220 __("contributors", 'leaflet-map') 221 ), 222 'type' => 'textarea', 223 'helptext' => __('Attribution to a custom tile url. Use semi-colons (;) to separate multiple.', 'leaflet-map') 224 ), 225 'geocoder' => array( 226 'display_name'=>__('Geocoder', 'leaflet-map'), 227 'default' => 'google', 228 'type' => 'select', 229 'options' => array( 230 'google' => __('Google Maps', 'leaflet-map'), 231 'osm' => __('OpenStreetMap Nominatim', 'leaflet-map'), 232 'dawa' => __('Denmark Addresses', 'leaflet-map') 233 ), 234 'helptext' => __('Select the Geocoding provider to use to retrieve addresses defined in shortcode.', 'leaflet-map') 235 ) 236 ); 237 238 foreach ($this->options as $name => $details) { 162 239 $this->options[ $name ] = new Leaflet_Map_Plugin_Option( $details ); 163 240 } -
leaflet-map/trunk/leaflet-map.php
r1797863 r1809668 6 6 Author: bozdoz 7 7 Author URI: https://twitter.com/bozdoz/ 8 Version: 2.9.1 8 Text Domain: leaflet-map 9 Domain Path: /languages/ 10 Version: 2.10.0 9 11 License: GPL2 10 12 -
leaflet-map/trunk/readme.txt
r1797863 r1809668 3 3 Author URI: https://www.twitter.com/bozdoz/ 4 4 Plugin URI: https://wordpress.org/plugins/leaflet-map/ 5 Contributors: bozdoz, Remigr, nielsalstrup, jeromelebleu 5 Contributors: bozdoz, Remigr, nielsalstrup, jeromelebleu, gerital 6 6 Donate link: https://www.paypal.me/bozdoz 7 7 Tags: leaflet, map, mobile, javascript, openstreetmap, mapquest, interactive 8 8 Requires at least: 3.0.1 9 9 Tested up to: 4.9 10 Version: 2. 9.111 Stable tag: 2. 9.110 Version: 2.10.0 11 Stable tag: 2.10.0 12 12 License: GPLv2 13 13 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 78 78 = Can I add geojson? = 79 79 80 Yes, just give it a source URL: `[leaflet-geojson src="https://example.com/path/to.geojson"]` It will also support leaflet geojson styles or geojson.io styles. Add a popup message with `[leaflet-geojson popup_text="hello!"]`, or add HTML by adding it to the content of the shortcode: `[leaflet-geojson]<a href="#">Link here </a>[/leaflet-geojson]` or identify a geojson property with `popup_property`, and each shape will use its own popup text if available.80 Yes, just give it a source URL: `[leaflet-geojson src="https://example.com/path/to.geojson"]` It will also support leaflet geojson styles or geojson.io styles. Add a popup message with `[leaflet-geojson popup_text="hello!"]`, or add HTML by adding it to the content of the shortcode: `[leaflet-geojson]<a href="#">Link here, or use text from a feature property, like {title}</a>[/leaflet-geojson]` or identify a geojson property with `popup_property`, and each shape will use its own popup text if available. 81 81 82 82 = Can I add kml/gpx? = … … 121 121 == Changelog == 122 122 123 = 2.10.0 = 124 * Added functions for translating text 125 * Added string interpolation for GeoJSON popups to use feature properties (thanks to [@geraldo](https://github.com/geraldo)) 126 123 127 = 2.9.1 = 124 128 * Fixes for PHP 7.2: made all method arguments identical -
leaflet-map/trunk/shortcodes/class.geojson-shortcode.php
r1797863 r1809668 107 107 function onEachFeature (feature, layer) { 108 108 var props = feature.properties || {}, 109 text = popup_property && props[ popup_property ] || popup_text;109 text = popup_property && props[ popup_property ] || template(popup_text, feature.properties); 110 110 if (text) { 111 111 layer.bindPopup( text ); 112 112 } 113 } 113 } 114 var templateRe = /\{ *([\w_-]+) *\}/g; 115 function template(str, data) { 116 return str.replace(templateRe, function (match, key) { 117 var value = data[key]; 118 if (value === undefined) { 119 return match; 120 } 121 return value; 122 }); 123 } 114 124 }); 115 125 </script> -
leaflet-map/trunk/templates/settings.php
r1709928 r1809668 1 1 <?php 2 2 $title = $plugin_data['Name']; 3 $description = $plugin_data['Description'];3 $description = __('A plugin for creating a Leaflet JS map with a shortcode. Boasts two free map tile services and three free geocoders.', 'leaflet-map'); 4 4 $version = $plugin_data['Version']; 5 6 function option_label ($opt) {7 $opt = explode('_', $opt);8 9 foreach($opt as &$v) {10 $v = ucfirst($v);11 }12 echo implode(' ', $opt);13 }14 5 ?> 15 6 <div class="wrap"> … … 33 24 ?> 34 25 <div class="notice notice-success is-dismissible"> 35 <p> Options Updated!</p>26 <p><?php _e('Options Updated!', 'leaflet-map'); ?></p> 36 27 </div> 37 28 <?php … … 40 31 ?> 41 32 <div class="notice notice-success is-dismissible"> 42 <p> Options have been reset to default values!</p>33 <p><?php _e('Options have been reset to default values!', 'leaflet-map'); ?></p> 43 34 </div> 44 35 <?php … … 48 39 ?> 49 40 <div class="notice notice-success is-dismissible"> 50 <p> Location caches have been cleared!</p>41 <p><?php _e('Location caches have been cleared!', 'leaflet-map'); ?></p> 51 42 </div> 52 43 <?php … … 57 48 <form method="post"> 58 49 <div class="container"> 59 <h2> Settings</h2>50 <h2><?php _e('Settings', 'leaflet-map'); ?></h2> 60 51 <hr> 61 52 </div> … … 66 57 <div class="container"> 67 58 <label> 68 <span class="label"><?php option_label($name); ?></span>59 <span class="label"><?php echo $option->display_name; ?></span> 69 60 <span class="input-group"> 70 61 <?php … … 78 69 ?> 79 70 <div class="helptext"> 80 <p class="description"><?php 81 echo $option->helptext; 82 ?></p> 71 <p class="description"><?php echo $option->helptext; ?></p> 83 72 </div> 84 73 <?php … … 90 79 ?> 91 80 <div class="submit"> 92 <input type="submit" name="submit" id="submit" class="button button-primary" value="Save Changes"> 93 <input type="submit" name="reset" id="reset" class="button button-secondary" value="Reset to Defaults"> 81 <input type="submit" 82 name="submit" 83 id="submit" 84 class="button button-primary" 85 value="<?php _e('Save Changes', 'leaflet-map'); ?>"> 86 <input type="submit" 87 name="reset" 88 id="reset" 89 class="button button-secondary" 90 value="<?php _e('Reset to Defaults', 'leaflet-map'); ?>"> 94 91 <input type="submit" 95 92 name="clear-geocoder-cache" 96 93 id="clear-geocoder-cache" 97 94 class="button button-secondary" 98 value=" Clear Geocoder Cache">95 value="<?php _e('Clear Geocoder Cache', 'leaflet-map'); ?>"> 99 96 </div> 100 97 -
leaflet-map/trunk/templates/shortcode-helper.php
r1720896 r1809668 15 15 <div class="wrap"> 16 16 <?php 17 $drag = __('Drag Me', 'leaflet-map'); 18 17 19 echo do_shortcode('[leaflet-map zoom=2 zoomcontrol=1 doubleClickZoom=1 height=300 scrollwheel=1]'); 18 echo do_shortcode('[leaflet-marker draggable=1 message="Drag me!" visible="true"]'); 20 echo do_shortcode(sprintf('[leaflet-marker draggable=1 visible="true"] %s [/leaflet-marker]', 21 $drag 22 )); 19 23 ?> 20 24 <div class="wrap"> 21 25 <hr> 22 <h2> Interactive Shortcodes:</h2>23 <p class="description"> Move the map and the marker to generate shortcodes below:</p>24 <div class="flex"><label class="h3" for="map-shortcode"> Map Shortcode</label> <input type="text" id="map-shortcode" readonly="readonly" /></div>25 <div class="flex"><label class="h3" for="marker-shortcode"> Marker Shortcode</label> <input type="text" id="marker-shortcode" readonly="readonly" /></div>26 <h2><?php _e('Interactive Shortcodes:', 'leaflet-map'); ?></h2> 27 <p class="description"><?php _e('Move the map and the marker to generate shortcodes below:', 'leaflet-map'); ?></p> 28 <div class="flex"><label class="h3" for="map-shortcode"><?php _e('Map Shortcode', 'leaflet-map'); ?></label> <input type="text" id="map-shortcode" readonly="readonly" /></div> 29 <div class="flex"><label class="h3" for="marker-shortcode"><?php _e('Marker Shortcode', 'leaflet-map'); ?></label> <input type="text" id="marker-shortcode" readonly="readonly" /></div> 26 30 <hr> 27 <h2> Examples:</h2>31 <h2><?php _e('Examples', 'leaflet-map'); ?>:</h2> 28 32 <div class="examples"> 29 33 <?php 30 34 $examples = array( 31 "Standard"=> array(35 __("Standard", 'leaflet-map') => array( 32 36 '[leaflet-map zoom=12 lat=51.05 lng=-114.06]', 33 37 ), 34 "Many Markers!"=> array(38 __("Many Markers!", 'leaflet-map') => array( 35 39 '[leaflet-map zoom=10 lat=43.65 lng=-79.385]', 36 40 '[leaflet-marker]', … … 38 42 '[leaflet-marker lat=43.67 lng=-79.4]', 39 43 ), 40 "Draggable Marker"=> array(44 __("Draggable Marker", 'leaflet-map') => array( 41 45 '[leaflet-map zoom=8 lat=-33.85 lng=151.21 scrollwheel=1]', 42 46 '[leaflet-marker draggable=1]', 43 47 ), 44 "Marker Icon"=> array(48 __("Marker Icon", 'leaflet-map') => array( 45 49 '[leaflet-map zoom=10 address="cochrane, Ontario" scrollwheel=1]', 46 50 '[leaflet-marker iconUrl="https://i.imgur.com/Q54ueuO.png" iconSize="80,50" iconAnchor="40,60"]' 47 51 ), 48 "Zoom Buttons"=> array(52 __("Zoom Buttons", 'leaflet-map') => array( 49 53 '[leaflet-map zoom=9 lat=48.855 lng=2.35 zoomcontrol=1]', 50 54 ), 51 "Alternate Map Tiles w/scrollwheel"=> array(55 __("Alternate Map Tiles w/scrollwheel", 'leaflet-map') => array( 52 56 '[leaflet-map zoom=2 scrollwheel=1 lat=-2.507 lng=32.902 tileurl=https://stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg subdomains=abcd attribution="Map tiles by Stamen Design, under CC BY 3.0."]', 53 57 ), 54 "Marker Popup Messages (on click)"=> array(58 __("Marker Popup Messages (on click)", 'leaflet-map') => array( 55 59 '[leaflet-map lat=59.913 lng=10.739 zoom=12]', 56 60 '[leaflet-marker]OSLO![/leaflet-marker]', 57 61 ), 58 "Links In Marker Messages (visible)"=> array(62 __("Links In Marker Messages (visible)", 'leaflet-map') => array( 59 63 '[leaflet-map lat=28.41 lng=-81.58 zoom=15]', 60 64 '[leaflet-marker visible="true"] Disney World! <a href="https://disneyworld.disney.go.com">Link</a> [/leaflet-marker]', 61 65 ), 62 "Basic Lines w/Scrollwheel"=> array(66 __("Basic Lines w/Scrollwheel", 'leaflet-map') => array( 63 67 '[leaflet-map lat=41 lng=29 scrollwheel=1 zoom=6]', 64 68 '[leaflet-line latlngs="41, 29; 44, 18;"]' 65 69 ), 66 "Fitted Colored Line on Addresses"=> array(70 __("Fitted Colored Line on Addresses", 'leaflet-map') => array( 67 71 '[leaflet-map]', 68 72 '[leaflet-line color="purple" addresses="Sayulita; Puerto Vallarta;" fitline=1]' 69 73 ), 70 "More Crazy Line Attributes"=> array(74 __("More Crazy Line Attributes", 'leaflet-map') => array( 71 75 '[leaflet-map]', 72 '[leaflet-line color="red" weight=10 dasharray="2,15" addresses="Halifax, NS; Tanzania" classname=marching-ants fitbounds=1] CSS makes me march![/leaflet-line]'76 '[leaflet-line color="red" weight=10 dasharray="2,15" addresses="Halifax, NS; Tanzania" classname=marching-ants fitbounds=1]' 73 77 ), 74 "Disable all Interaction"=> array(78 __("Disable all Interaction", 'leaflet-map') => array( 75 79 '[leaflet-map address="las vegas" boxZoom=false doubleClickZoom=false dragging=false keyboard=false scrollwheel=0 attribution=0]', 76 80 ), 77 "Add GeoJSON by URL (with popups)"=> array(81 __("Add GeoJSON by URL (with popups)", 'leaflet-map') => array( 78 82 '[leaflet-map doubleClickZoom=true scrollwheel=true]', 79 83 '[leaflet-geojson src=https://cdn.rawgit.com/bozdoz/064a7101b95a324e8852fe9381ab9a18/raw/03f4f54b13a3a7e256732760a8b679818d9d36fc/map.geojson fitbounds=1 popup_property="popup-text"]' 80 84 ), 81 "Test Image Map"=> array(85 __("Test Image Map", 'leaflet-map') => array( 82 86 '[leaflet-image zoom=1 zoomcontrol=1 scrollwheelzoom=1 attribution=0]', 83 87 '[leaflet-marker]'
Note: See TracChangeset
for help on using the changeset viewer.