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.admin.php +19 -5 2.11.23.4.5 View file →
@@ -66,17 +66,24 @@
66 66 * Add admin menu page when user in admin area
67 67 */
68 68 public function admin_menu()
69 69 {
70 - if (current_user_can('manage_options')) {
70 + $leaf = 'data:image/svg+xml;base64,PHN2ZyBhcmlhLWhpZGRlbj0idHJ1ZSIgZm9jdXNhYmxlPSJmYWxzZSIgZGF0YS1wcmVmaXg9ImZhcyIgZGF0YS1pY29uPSJsZWFmIiBjbGFzcz0ic3ZnLWlubGluZS0tZmEgZmEtbGVhZiBmYS13LTE4IiByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDU3NiA1MTIiPjxwYXRoIGZpbGw9ImN1cnJlbnRDb2xvciIgZD0iTTU0Ni4yIDkuN2MtNS42LTEyLjUtMjEuNi0xMy0yOC4zLTEuMkM0ODYuOSA2Mi40IDQzMS40IDk2IDM2OCA5NmgtODBDMTgyIDk2IDk2IDE4MiA5NiAyODhjMCA3IC44IDEzLjcgMS41IDIwLjVDMTYxLjMgMjYyLjggMjUzLjQgMjI0IDM4NCAyMjRjOC44IDAgMTYgNy4yIDE2IDE2cy03LjIgMTYtMTYgMTZDMTMyLjYgMjU2IDI2IDQxMC4xIDIuNCA0NjhjLTYuNiAxNi4zIDEuMiAzNC45IDE3LjUgNDEuNiAxNi40IDYuOCAzNS0xLjEgNDEuOC0xNy4zIDEuNS0zLjYgMjAuOS00Ny45IDcxLjktOTAuNiAzMi40IDQzLjkgOTQgODUuOCAxNzQuOSA3Ny4yQzQ2NS41IDQ2Ny41IDU3NiAzMjYuNyA1NzYgMTU0LjNjMC01MC4yLTEwLjgtMTAyLjItMjkuOC0xNDQuNnoiLz48L3N2Zz4=';
71 +
72 + $admin = "manage_options";
73 + $author = "edit_posts";
74 +
75 + if (current_user_can($admin)) {
71 76 $main_link = 'leaflet-map';
77 + $main_page = array($this, "settings_page");
72 78 } else {
73 79 $main_link = 'leaflet-shortcode-helper';
80 + $main_page = array($this, "shortcode_page");
74 81 }
75 82
76 - add_menu_page("Leaflet Map", "Leaflet Map", 'manage_options', $main_link, array($this, "settings_page"), plugins_url('images/leaf.png', LEAFLET_MAP__PLUGIN_FILE));
77 - add_submenu_page("leaflet-map", "Default Values", "Default Values", 'manage_options', "leaflet-map", array($this, "settings_page"));
78 - add_submenu_page("leaflet-map", "Shortcode Helper", "Shortcode Helper", 'edit_posts', "leaflet-shortcode-helper", array($this, "shortcode_page"));
83 + add_menu_page("Leaflet Map", "Leaflet Map", $author, $main_link, $main_page, $leaf);
84 + add_submenu_page("leaflet-map", __('Settings', 'leaflet-map'), __('Settings', 'leaflet-map'), $admin, "leaflet-map", array($this, "settings_page"));
85 + add_submenu_page("leaflet-map", __('Shortcode helper', 'leaflet-map'), __('Shortcode helper', 'leaflet-map'), $author, "leaflet-shortcode-helper", array($this, "shortcode_page"));
79 86 }
80 87
81 88 /**
82 89 * Main settings page includes form inputs
@@ -95,9 +102,16 @@
95 102 */
96 103 public function shortcode_page()
97 104 {
98 105 wp_enqueue_style('leaflet_admin_stylesheet');
99 - wp_enqueue_script('custom_plugin_js', plugins_url('scripts/shortcode-helper.min.js', LEAFLET_MAP__PLUGIN_FILE), Array('leaflet_js'), false);
106 +
107 + if (defined('WP_DEBUG') && WP_DEBUG) {
108 + $minified = '';
109 + } else {
110 + $minified = '.min';
111 + }
112 +
113 + wp_enqueue_script('custom_plugin_js', plugins_url(sprintf('scripts/shortcode-helper%s.js', $minified), LEAFLET_MAP__PLUGIN_FILE), Array('leaflet_js'), false);
100 114
101 115 include 'templates/shortcode-helper.php';
102 116 }
103 117