Version Description
Download this release
Release Info
Developer | ozh |
Plugin | Ozh' Admin Drop Down Menu |
Version | 1.3.1 |
Comparing to | |
See all releases |
Version 1.3.1
- readme.txt +25 -0
- wp_ozh_adminmenu_wp23.php +328 -0
readme.txt
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Ozh' Admin Drop Down Menu ===
|
2 |
+
Donate link: http://planetozh.com/exit/donate
|
3 |
+
Tags: ozh, menu, menus, dashboard, admin, dropdown, drop down, productivity, css
|
4 |
+
Requires at least: 1.5
|
5 |
+
Tested up to: 2.3.3
|
6 |
+
Stable tag: trunk
|
7 |
+
Contributors: ozh
|
8 |
+
|
9 |
+
All admin links available in a neat drop down menu. Go to any admin page from any admin page in 1 click.
|
10 |
+
|
11 |
+
== Description ==
|
12 |
+
|
13 |
+
The lazy and the productive will love it : all admin links available in a neat CSS driven drop down menu. No need to click on "Manage" then "Pages" to edit pages, go to *any admin page* from *any admin page*.
|
14 |
+
|
15 |
+
For documentation, examples, screenshot and a live demo, please refer to the official plugin page for [Admin Drop Down Menu](http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/ "Admin Drop Down Menu"). There is also an API for plugin coders (give your plugin its own special icon!).
|
16 |
+
|
17 |
+
This version is for WordPress 1.5 to 2.3.3 only.
|
18 |
+
|
19 |
+
== Installation ==
|
20 |
+
|
21 |
+
Installation is, as usual :
|
22 |
+
|
23 |
+
1. Upload files to your `/wp-content/plugins/` directory (preserve sub-directory structure if applicable)
|
24 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
25 |
+
1. Refer to the official plugin page for documentation, usage and tips
|
wp_ozh_adminmenu_wp23.php
ADDED
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Admin Drop Down Menu
|
4 |
+
Plugin URI: http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/
|
5 |
+
Description: Replaces admin menu and submenu with a 2 level horizontal CSS dropdown menu bar. Saves lots of clicks !
|
6 |
+
Version: 1.3.1
|
7 |
+
Author: Ozh
|
8 |
+
Author URI: http://planetOzh.com/
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Release History :
|
12 |
+
* 1.0 : initial release
|
13 |
+
* 1.1 : Tiger Admin compatibility !
|
14 |
+
* 1.2 : Multiple Page Plugin (ex: Akismet) compatibility and minor CSS improvements
|
15 |
+
* 1.3 : Fix for plugins with subfolders on Windows WP installs
|
16 |
+
* 1.3.1 : Minor CSS tweak
|
17 |
+
*/
|
18 |
+
|
19 |
+
/* Main function : creates the new set of intricated <ul> and <li> */
|
20 |
+
function wp_ozh_adminmenu() {
|
21 |
+
global $is_winIE;
|
22 |
+
|
23 |
+
if (function_exists('wp_admin_tiger_css') and !$is_winIE) {
|
24 |
+
$tiger = true;
|
25 |
+
} else {
|
26 |
+
$tiger = false;
|
27 |
+
}
|
28 |
+
|
29 |
+
$menu = wp_ozh_adminmenu_build ();
|
30 |
+
|
31 |
+
$ozh_menu = '';
|
32 |
+
$printsub = 1;
|
33 |
+
|
34 |
+
foreach ($menu as $k=>$v) {
|
35 |
+
$url = $v['url'];
|
36 |
+
$name = $k;
|
37 |
+
$anchor = $v['name'];
|
38 |
+
$class = $v['class'];
|
39 |
+
|
40 |
+
if ($is_winIE)
|
41 |
+
$ie_code = " onmouseover='this.className=\\\"msieFix\\\"' onmouseout='this.className=\\\"\\\"'";
|
42 |
+
$ozh_menu .= '<li'.$ie_code."><a href='$url'$class>$anchor</a>";
|
43 |
+
if (is_array($v['sub'])) {
|
44 |
+
|
45 |
+
$ulclass='';
|
46 |
+
if ($class) {
|
47 |
+
$ulclass = " class='ulcurrent'";
|
48 |
+
} else {
|
49 |
+
$ulclass = " class='ulnotcurrent'";
|
50 |
+
}
|
51 |
+
$ozh_menu .= "<ul$ulclass>";
|
52 |
+
|
53 |
+
foreach ($v['sub'] as $subk=>$subv) {
|
54 |
+
$suburl = $subv['url'];
|
55 |
+
$subanchor = $subv['name'];
|
56 |
+
$subclass='';
|
57 |
+
if (array_key_exists('class',$subv)) $subclass=$subv['class'];
|
58 |
+
$ozh_menu .= "<li><a href='$suburl'$subclass>$subanchor</a></li>";
|
59 |
+
}
|
60 |
+
$ozh_menu .= "</ul>";
|
61 |
+
} else {
|
62 |
+
if (!$tiger) {
|
63 |
+
$ozh_menu .= "<ul><li class='altmenu_empty' title='This menu has no sub menu'><small>…</small></li><li> </li><li> </li><li> </li></ul>";
|
64 |
+
if ($class) $printsub = 0;
|
65 |
+
}
|
66 |
+
}
|
67 |
+
$ozh_menu .="</li> ";
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
if (!$tiger) {
|
72 |
+
wp_ozh_adminmenu_css($printsub);
|
73 |
+
} else {
|
74 |
+
wp_ozh_adminmenu_css_tiger($printsub);
|
75 |
+
}
|
76 |
+
|
77 |
+
wp_ozh_adminmenu_old_printjs($ozh_menu, $printsub, $tiger);
|
78 |
+
}
|
79 |
+
|
80 |
+
/* Core stuff : builds an array populated with all the infos needed for menu and submenu */
|
81 |
+
function wp_ozh_adminmenu_build () {
|
82 |
+
global $menu, $submenu, $plugin_page, $pagenow;
|
83 |
+
|
84 |
+
/* Most of the following garbage are bits from admin-header.php,
|
85 |
+
* modified to populate an array of all links to display in the menu
|
86 |
+
*/
|
87 |
+
|
88 |
+
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
|
89 |
+
$self = preg_replace('|^.*/plugins/|i', '', $self);
|
90 |
+
|
91 |
+
get_admin_page_parent();
|
92 |
+
|
93 |
+
$altmenu = array();
|
94 |
+
|
95 |
+
/* Step 1 : populate first level menu as per user rights */
|
96 |
+
foreach ($menu as $item) {
|
97 |
+
// 0 = name, 1 = capability, 2 = file
|
98 |
+
if ( current_user_can($item[1]) ) {
|
99 |
+
if ( file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") )
|
100 |
+
$altmenu[$item[2]]['url'] = get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}";
|
101 |
+
else
|
102 |
+
$altmenu[$item[2]]['url'] = get_settings('siteurl') . "/wp-admin/{$item[2]}";
|
103 |
+
|
104 |
+
if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)))
|
105 |
+
$altmenu[$item[2]]['class'] = " class='current'";
|
106 |
+
|
107 |
+
$altmenu[$item[2]]['name'] = $item[0];
|
108 |
+
|
109 |
+
/* Windows installs may have backslashes instead of slashes in some paths, fix this */
|
110 |
+
$altmenu[$item[2]]['name'] = str_replace(chr(92),chr(92).chr(92),$altmenu[$item[2]]['name']);
|
111 |
+
}
|
112 |
+
}
|
113 |
+
|
114 |
+
/* Step 2 : populate second level menu */
|
115 |
+
foreach ($submenu as $k=>$v) {
|
116 |
+
foreach ($v as $item) {
|
117 |
+
if (array_key_exists($k,$altmenu) and current_user_can($item[1])) {
|
118 |
+
|
119 |
+
// What's the link ?
|
120 |
+
$menu_hook = get_plugin_page_hook($item[2], $k);
|
121 |
+
if (file_exists(ABSPATH . "wp-content/plugins/{$item[2]}") || ! empty($menu_hook)) {
|
122 |
+
if ( 'admin.php' == $pagenow )
|
123 |
+
$link = get_settings('siteurl') . "/wp-admin/admin.php?page={$item[2]}";
|
124 |
+
else
|
125 |
+
$link = get_settings('siteurl') . "/wp-admin/{$k}?page={$item[2]}";
|
126 |
+
} else {
|
127 |
+
$link = get_settings('siteurl') . "/wp-admin/{$item[2]}";
|
128 |
+
}
|
129 |
+
/* Windows installs may have backslashes instead of slashes in some paths, fix this */
|
130 |
+
$link = str_replace(chr(92),chr(92).chr(92),$link);
|
131 |
+
|
132 |
+
$altmenu[$k]['sub'][$item[2]]['url'] = $link;
|
133 |
+
|
134 |
+
// Is it current page ?
|
135 |
+
$class = '';
|
136 |
+
if ( (isset($plugin_page) && $plugin_page == $item[2] && $pagenow == $k) || (!isset($plugin_page) && $self == $item[2] ) ) $class=" class='current'";
|
137 |
+
if ($class) {
|
138 |
+
$altmenu[$k]['sub'][$item[2]]['class'] = $class;
|
139 |
+
$altmenu[$k]['class'] = $class;
|
140 |
+
}
|
141 |
+
|
142 |
+
// What's its name again ?
|
143 |
+
$altmenu[$k]['sub'][$item[2]]['name'] = $item[0];
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
// Uncomment to see how neat it is now !
|
150 |
+
print "<pre>Our Oh-So-Beautiful-4-Levels-";
|
151 |
+
print_r($altmenu);
|
152 |
+
/**/
|
153 |
+
|
154 |
+
return ($altmenu);
|
155 |
+
}
|
156 |
+
|
157 |
+
/* The javascript bits that replace the existing menu by our new one */
|
158 |
+
function wp_ozh_adminmenu_old_printjs ($admin = '', $sub = 1, $tiger=false) {
|
159 |
+
print "<script>
|
160 |
+
document.getElementById('adminmenu').innerHTML=\"$admin\";";
|
161 |
+
if ($sub and !$tiger) print "document.getElementById('submenu').innerHTML=\"<li> </li>\"";
|
162 |
+
print "</script>";
|
163 |
+
}
|
164 |
+
|
165 |
+
/* Print the CSS stuff. Modify with care if you want to customize colors ! */
|
166 |
+
function wp_ozh_adminmenu_css_tiger($sub = 1) {
|
167 |
+
$id = '#adminmenu';
|
168 |
+
|
169 |
+
if ($sub == 0) {
|
170 |
+
$sub_opacity="$id li ul {
|
171 |
+
opacity: 0.8;
|
172 |
+
-moz-opacity: 0.8;
|
173 |
+
filter: alpha(opacity=80);
|
174 |
+
}
|
175 |
+
";
|
176 |
+
} else {$sub_opacity='';}
|
177 |
+
|
178 |
+
print <<<CSS
|
179 |
+
<style>
|
180 |
+
#adminmenu li ul {
|
181 |
+
position:absolute;
|
182 |
+
left:-9000px;
|
183 |
+
}
|
184 |
+
#adminmenu li:hover {
|
185 |
+
background:#DDD;
|
186 |
+
}
|
187 |
+
#adminmenu li:hover ul {
|
188 |
+
left:140px;
|
189 |
+
z-index:90;
|
190 |
+
width:160px !important;
|
191 |
+
padding:0;
|
192 |
+
-moz-opacity:0.90;
|
193 |
+
}
|
194 |
+
#adminmenu li:hover ul li {
|
195 |
+
position:relative;
|
196 |
+
top:0;
|
197 |
+
background: #555;
|
198 |
+
padding:0;
|
199 |
+
margin:0;
|
200 |
+
}
|
201 |
+
#adminmenu li:hover ul li a, #adminmenu li:hover ul li a.current {
|
202 |
+
position:relative;
|
203 |
+
top:-3px;
|
204 |
+
left:-3px;
|
205 |
+
width:170px;
|
206 |
+
background:#DDD !important;
|
207 |
+
color:#222;
|
208 |
+
}
|
209 |
+
#zadminmenu li:hover ul li a.current {
|
210 |
+
background:none !important;
|
211 |
+
}
|
212 |
+
|
213 |
+
#adminmenu li:hover ul li a:hover {
|
214 |
+
background:transparent url(../wp-content/plugins/wp-admin-tiger/wp-admin-tiger_files/ol_admin_images/bg_menu_on.jpg) !important;
|
215 |
+
}
|
216 |
+
$sub_opacity
|
217 |
+
</style>
|
218 |
+
|
219 |
+
CSS;
|
220 |
+
}
|
221 |
+
|
222 |
+
function wp_ozh_adminmenu_css($sub = 1) {
|
223 |
+
$id = '#adminmenu';
|
224 |
+
|
225 |
+
if ($sub == 0) {
|
226 |
+
$sub_opacity="$id li ul {
|
227 |
+
opacity: 0.8;
|
228 |
+
-moz-opacity: 0.8;
|
229 |
+
filter: alpha(opacity=80);
|
230 |
+
}
|
231 |
+
";
|
232 |
+
} else {$sub_opacity='';}
|
233 |
+
|
234 |
+
print <<<CSS
|
235 |
+
<style>
|
236 |
+
#submenu {
|
237 |
+
left:0px;
|
238 |
+
margin:0;
|
239 |
+
height:2em;
|
240 |
+
}
|
241 |
+
/* all lists */
|
242 |
+
$id {
|
243 |
+
height:2em;
|
244 |
+
margin-bottom:1em;
|
245 |
+
}
|
246 |
+
$id li {
|
247 |
+
padding:0 0.3em;
|
248 |
+
}
|
249 |
+
$id li ul li {
|
250 |
+
background: #0d324f;
|
251 |
+
border-bottom: none;
|
252 |
+
line-height:160%;
|
253 |
+
}
|
254 |
+
$id li ul li a,$id li ul li a:link,$id li ul li a:visited {
|
255 |
+
color: #9090EE;
|
256 |
+
font-size: 12px;
|
257 |
+
border-bottom: none;
|
258 |
+
}
|
259 |
+
$id li ul li a:hover {
|
260 |
+
background: #ddeaf4;
|
261 |
+
color: #393939;
|
262 |
+
}
|
263 |
+
$id,$id ul {
|
264 |
+
padding:0;
|
265 |
+
}
|
266 |
+
/* Nested ULs */
|
267 |
+
$id li ul {
|
268 |
+
position:absolute;
|
269 |
+
left:-900px;
|
270 |
+
}
|
271 |
+
/* All LIs */
|
272 |
+
$id li {
|
273 |
+
float:left;
|
274 |
+
list-style-type:none;
|
275 |
+
}
|
276 |
+
$id li ul {
|
277 |
+
background: #0d324f;
|
278 |
+
padding: 3px 2em 0 2.9em;
|
279 |
+
}
|
280 |
+
$id li:hover ul.ulnotcurrent,$id li.msieFix ul.ulnotcurrent {
|
281 |
+
left:0px;
|
282 |
+
z-index:90;
|
283 |
+
right:0px;
|
284 |
+
border-bottom:2.2em solid #f9fCfe;
|
285 |
+
}
|
286 |
+
|
287 |
+
$id li .ulcurrent {
|
288 |
+
left:0px;
|
289 |
+
right:0px;
|
290 |
+
z-index:89;
|
291 |
+
width:auto;
|
292 |
+
zbackground:red;
|
293 |
+
zborder-bottom:1em solid green;
|
294 |
+
}
|
295 |
+
$id ul li a.current {
|
296 |
+
background: #f9fcfe;
|
297 |
+
}
|
298 |
+
.altmenu_empty {
|
299 |
+
color:#6da6d1;
|
300 |
+
height:1.5em;
|
301 |
+
}
|
302 |
+
$sub_opacity
|
303 |
+
/* Stuff for MSIE */
|
304 |
+
* html $id li .ulcurrent {width:200%;}
|
305 |
+
* html $id li a {
|
306 |
+
border-top:2px solid #6da6d1;
|
307 |
+
}
|
308 |
+
* html $id li ul li a {
|
309 |
+
border:none;
|
310 |
+
}
|
311 |
+
* html $id li.msieFix ul, {
|
312 |
+
margin:2em 0;
|
313 |
+
width:300%;
|
314 |
+
left:0;
|
315 |
+
}
|
316 |
+
* html $id li ul {
|
317 |
+
margin:2em 0;
|
318 |
+
}
|
319 |
+
/**/
|
320 |
+
</style>
|
321 |
+
|
322 |
+
CSS;
|
323 |
+
}
|
324 |
+
|
325 |
+
|
326 |
+
add_action('admin_footer', 'wp_ozh_adminmenu');
|
327 |
+
|
328 |
+
?>
|