PluginProbe
Leaflet Map / 2.16.2
Leaflet Map v2.16.2
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
leaflet-map / templates / settings.php

settings.php in Leaflet Map 2.16.2, at templates/settings.php

117 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Settings View
4 *
5 * PHP Version 5.5
6 *
7 * @category Admin
8 * @author Benjamin J DeLong <ben@bozdoz.com>
9 */
10
11 $title = $plugin_data['Name'];
12 $description = __('A plugin for creating a Leaflet JS map with a shortcode. Boasts two free map tile services and three free geocoders.', 'leaflet-map');
13 $version = $plugin_data['Version'];
14 ?>
15 <div class="wrap">
16 <h1><?php echo $title; ?> <small>version: <?php echo $version; ?></small></h1>
17 <p><?php echo $description; ?></p>
18 <?php
19 if (isset($_POST['submit'])) {
20 /* copy and overwrite $post for checkboxes */
21 $form = $_POST;
22
23 foreach ($settings->options as $name => $option) {
24 if (!$option->type) continue;
25
26 /* checkboxes don't get sent if not checked */
27 if ($option->type === 'checkbox') {
28 $form[$name] = isset($_POST[ $name ]) ? 1 : 0;
29 }
30
31 $value = trim( stripslashes( $form[$name]) );
32
33 $settings->set($name, $value);
34 }
35 ?>
36 <div class="notice notice-success is-dismissible">
37 <p><?php _e('Options Updated!', 'leaflet-map'); ?></p>
38 </div>
39 <?php
40 } elseif (isset($_POST['reset'])) {
41 $settings->reset();
42 ?>
43 <div class="notice notice-success is-dismissible">
44 <p><?php _e('Options have been reset to default values!', 'leaflet-map'); ?></p>
45 </div>
46 <?php
47 } elseif (isset($_POST['clear-geocoder-cache'])) {
48 include_once LEAFLET_MAP__PLUGIN_DIR . 'class.geocoder.php';
49 Leaflet_Geocoder::remove_caches();
50 ?>
51 <div class="notice notice-success is-dismissible">
52 <p><?php _e('Location caches have been cleared!', 'leaflet-map'); ?></p>
53 </div>
54 <?php
55 }
56 ?>
57 <div class="wrap">
58 <div class="wrap">
59 <form method="post">
60 <div class="container">
61 <h2><?php _e('Settings', 'leaflet-map'); ?></h2>
62 <hr>
63 </div>
64 <?php
65 foreach ($settings->options as $name => $option) {
66 if (!$option->type) continue;
67 ?>
68 <div class="container">
69 <label>
70 <span class="label"><?php echo $option->display_name; ?></span>
71 <span class="input-group">
72 <?php
73 $option->widget($name, $settings->get($name));
74 ?>
75 </span>
76 </label>
77
78 <?php
79 if ($option->helptext) {
80 ?>
81 <div class="helptext">
82 <p class="description"><?php echo $option->helptext; ?></p>
83 </div>
84 <?php
85 }
86 ?>
87 </div>
88 <?php
89 }
90 ?>
91 <div class="submit">
92 <input type="submit"
93 name="submit"
94 id="submit"
95 class="button button-primary"
96 value="<?php _e('Save Changes', 'leaflet-map'); ?>">
97 <input type="submit"
98 name="reset"
99 id="reset"
100 class="button button-secondary"
101 value="<?php _e('Reset to Defaults', 'leaflet-map'); ?>">
102 <input type="submit"
103 name="clear-geocoder-cache"
104 id="clear-geocoder-cache"
105 class="button button-secondary"
106 value="<?php _e('Clear Geocoder Cache', 'leaflet-map'); ?>">
107 </div>
108
109 </form>
110
111 <div>
112 <p>Leaf icon provided by <a href="https://fontawesome.com/" target="_blank">Font Awesome</a>, under their free license.</p>
113 </div>
114
115 </div>
116 </div>
117