| 1 |
<?php |
| 2 |
/** |
| 3 |
* Shortcode Helper Page |
| 4 |
* |
| 5 |
* PHP Version 5.5 |
| 6 |
* |
| 7 |
* @category Admin |
| 8 |
* @author Benjamin J DeLong <ben@bozdoz.com> |
| 9 |
*/ |
| 10 |
?> |
| 11 |
<style> |
| 12 |
.marching-ants { |
| 13 |
animation: dash 35s infinite linear; |
| 14 |
} |
| 15 |
|
| 16 |
@keyframes dash { |
| 17 |
to { |
| 18 |
stroke-dashoffset: -1000; |
| 19 |
} |
| 20 |
} |
| 21 |
</style> |
| 22 |
|
| 23 |
<div class="wrap"> |
| 24 |
<h2>Shortcode Helper</h2> |
| 25 |
<div class="wrap"> |
| 26 |
<?php |
| 27 |
$drag = __('Drag Me', 'leaflet-map'); |
| 28 |
|
| 29 |
echo do_shortcode('[leaflet-map zoom=2 zoomcontrol doubleClickZoom height=300 scrollwheel]'); |
| 30 |
echo do_shortcode(sprintf('[leaflet-marker draggable visible] %s [/leaflet-marker]', |
| 31 |
$drag |
| 32 |
)); |
| 33 |
?> |
| 34 |
<div class="wrap"> |
| 35 |
<hr> |
| 36 |
<h2><?php _e('Interactive Shortcodes:', 'leaflet-map'); ?></h2> |
| 37 |
<p class="description"><?php _e('Move the map and the marker to generate shortcodes below:', 'leaflet-map'); ?></p> |
| 38 |
<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> |
| 39 |
<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> |
| 40 |
<hr> |
| 41 |
<h2><?php _e('Examples', 'leaflet-map'); ?>:</h2> |
| 42 |
<div class="examples"> |
| 43 |
<?php |
| 44 |
$examples = array( |
| 45 |
__("Standard", 'leaflet-map') => array( |
| 46 |
'[leaflet-map zoom=12 lat=51.05 lng=-114.06]', |
| 47 |
), |
| 48 |
__("Many Markers!", 'leaflet-map') => array( |
| 49 |
'[leaflet-map zoom=10 lat=43.65 lng=-79.385]', |
| 50 |
'[leaflet-marker]', |
| 51 |
'[leaflet-marker lat=43.68 lng=-79.275]', |
| 52 |
'[leaflet-marker lat=43.67 lng=-79.4]', |
| 53 |
), |
| 54 |
__("Draggable Marker", 'leaflet-map') => array( |
| 55 |
'[leaflet-map zoom=8 lat=-33.85 lng=151.21 scrollwheel]', |
| 56 |
'[leaflet-marker draggable]', |
| 57 |
), |
| 58 |
__("Marker Icon", 'leaflet-map') => array( |
| 59 |
'[leaflet-map zoom=14 address="Ha Ling, canmore" scrollwheel]', |
| 60 |
'[leaflet-marker iconUrl="https://i.imgur.com/Q54ueuO.png" iconSize="80,50" iconAnchor="40,60"]' |
| 61 |
), |
| 62 |
__("SVG Marker Icon", 'leaflet-map') => array( |
| 63 |
'[leaflet-map address="twilight lane, nova scotia" scrollwheel]', |
| 64 |
'[leaflet-marker svg background="#777" iconClass="dashicons dashicons-star-filled" color="gold"]My Favorite Place in the World[/leaflet-marker]' |
| 65 |
), |
| 66 |
__("Zoom Buttons", 'leaflet-map') => array( |
| 67 |
'[leaflet-map zoom=9 lat=48.855 lng=2.35 zoomcontrol]', |
| 68 |
), |
| 69 |
__("Alternate Map Tiles w/scrollwheel", 'leaflet-map') => array( |
| 70 |
'[leaflet-map zoom=2 scrollwheel 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."]', |
| 71 |
), |
| 72 |
__("Marker Popup Messages (on click)", 'leaflet-map') => array( |
| 73 |
'[leaflet-map lat=59.913 lng=10.739 zoom=12]', |
| 74 |
'[leaflet-marker]OSLO![/leaflet-marker]', |
| 75 |
), |
| 76 |
__("Links In Marker Messages (visible)", 'leaflet-map') => array( |
| 77 |
'[leaflet-map lat=28.41 lng=-81.58 zoom=15]', |
| 78 |
'[leaflet-marker visible] Disney World! <a href="https://disneyworld.disney.go.com">Link</a> [/leaflet-marker]', |
| 79 |
), |
| 80 |
__("Basic Lines w/Scrollwheel", 'leaflet-map') => array( |
| 81 |
'[leaflet-map lat=41 lng=29 scrollwheel zoom=6]', |
| 82 |
'[leaflet-line latlngs="41, 29; 44, 18;"]' |
| 83 |
), |
| 84 |
__("Basic Polygon", 'leaflet-map') => array( |
| 85 |
'[leaflet-map fitbounds]', |
| 86 |
'[leaflet-polygon addresses="Miami; San Juan; Bermuda" color="green" fillColor="yellow"]<a href="https://en.wikipedia.org/wiki/Bermuda_Triangle" target="_blank">Bermuda Triangle</a>[/leaflet-polygon]' |
| 87 |
), |
| 88 |
__("Basic Circle", 'leaflet-map') => array( |
| 89 |
'[leaflet-map lat=52 lng=5 zoom=9]', |
| 90 |
'[leaflet-circle lat=52 lng=5 radius=17500]' |
| 91 |
), |
| 92 |
__("Fitted Colored Line on Addresses", 'leaflet-map') => array( |
| 93 |
'[leaflet-map fitbounds]', |
| 94 |
'[leaflet-line color="purple" addresses="Sayulita; Puerto Vallarta;"]' |
| 95 |
), |
| 96 |
__("More Crazy Line Attributes", 'leaflet-map') => array( |
| 97 |
'[leaflet-map fitbounds]', |
| 98 |
'[leaflet-line color="red" weight=10 dasharray="2,15" addresses="Halifax, Nova Scotia; Tanzania" classname=marching-ants]' |
| 99 |
), |
| 100 |
__("Disable all Interaction", 'leaflet-map') => array( |
| 101 |
'[leaflet-map address="las vegas" !boxZoom !doubleClickZoom !dragging !keyboard !scrollwheel !attribution !touchZoom]', |
| 102 |
), |
| 103 |
__("Add GeoJSON by URL", 'leaflet-map') => array( |
| 104 |
'[leaflet-map fitbounds scrollwheel]', |
| 105 |
'[leaflet-geojson src=https://gist.githubusercontent.com/bozdoz/064a7101b95a324e8852fe9381ab9a18/raw/ee100561f5a0a8cf55430e9f2157e4a1e2560a2e/map.geojson]' |
| 106 |
), |
| 107 |
__("Add GeoJSON with circle markers and popups", 'leaflet-map') => array( |
| 108 |
'[leaflet-map fitbounds scrollwheel]', |
| 109 |
'[leaflet-geojson circleMarker radius=10 src=https://gist.githubusercontent.com/bozdoz/064a7101b95a324e8852fe9381ab9a18/raw/ee100561f5a0a8cf55430e9f2157e4a1e2560a2e/map.geojson]{popup-text}[/leaflet-geojson]' |
| 110 |
), |
| 111 |
__("Add KML by URL", 'leaflet-map') => array( |
| 112 |
'[leaflet-map fitbounds]', |
| 113 |
'[leaflet-kml src=https://cdn.jsdelivr.net/gh/mapbox/togeojson@master/test/data/polygon.kml fillColor=red color=white]' |
| 114 |
), |
| 115 |
__("Add GPX by URL", 'leaflet-map') => array( |
| 116 |
'[leaflet-map fitbounds]', |
| 117 |
'[leaflet-gpx src=https://cdn.jsdelivr.net/gh/mapbox/togeojson@master/test/data/run.gpx color=black]' |
| 118 |
), |
| 119 |
__("Keep them in Newfoundland", 'leaflet-map') => array( |
| 120 |
'[leaflet-map maxbounds="46.22545288226939, -59.61181640625;51.72702815704774, -52.36083984375" zoom=5 zoomcontrol]', |
| 121 |
), |
| 122 |
__("Image Map", 'leaflet-map') => array( |
| 123 |
'[leaflet-image zoom=1 zoomcontrol scrollwheel !attribution]', |
| 124 |
'[leaflet-marker draggable]' |
| 125 |
), |
| 126 |
); |
| 127 |
|
| 128 |
foreach ($examples as $title => $collection) { |
| 129 |
echo '<div class="list-item">'; |
| 130 |
echo "<h3>$title</h3>"; |
| 131 |
foreach ($collection as $shortcode) { |
| 132 |
echo do_shortcode($shortcode); |
| 133 |
echo "<p>$shortcode</p>"; |
| 134 |
} |
| 135 |
echo '</div>'; |
| 136 |
} |
| 137 |
?> |
| 138 |
</div> |
| 139 |
</div> |
| 140 |
</div> |
| 141 |
</div> |
| 142 |
|