Advertisement
samuelaguilera

adminmenu.css.php

Sep 28th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 13.09 KB | None | 0 0
  1. <?php
  2. /*
  3. Part of Plugin: Ozh' Admin Drop Down Menu
  4. http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/
  5. Fixed for working Minimal Mode in WordPress 3.5-beta-1
  6. */
  7.  
  8. function make_link_relative( $link ) {
  9.     return preg_replace('|https?://[^/]+(/.*)|i', '$1', $link );
  10. }
  11.  
  12. function wp_ozh_adminmenu_sanitize_id($url) {
  13.     $url = preg_replace('/(&|&amp;|&#038;)?_wpnonce=([^&]+)/', '', $url);
  14.     return str_replace(array('.php','.','/','?','='),array('','_','_','_','_'),$url);
  15. }
  16.  
  17. function wp_ozh_adminmenu_color($col) {
  18.     return '#'.str_replace('#', '', urldecode($col)); // Make sure there's always a # prefixing color code
  19. }
  20.  
  21. function wp_ozh_adminmenu_true_if_set( $param ) {
  22.     return ( ( isset( $_GET[ $param ] ) && $_GET[ $param ] == 1 ) ? true : false );
  23. }
  24.  
  25. // Get vars & needed links, make them relative to be sure no one will be leeching icons or anything from somewhere else
  26. $plugin      = isset( $_GET['p'] ) ? make_link_relative( $_GET['p'] ) : '';
  27. $admin       = isset( $_GET['a'] ) ? make_link_relative( $_GET['a'] ) : '';
  28. $icons       = wp_ozh_adminmenu_true_if_set( 'i' );
  29. $wpicons     = wp_ozh_adminmenu_true_if_set( 'w' );
  30. $compact     = wp_ozh_adminmenu_true_if_set( 'c' );
  31. $minimode    = wp_ozh_adminmenu_true_if_set( 'm' );
  32. $hidebubble  = wp_ozh_adminmenu_true_if_set( 'h' );
  33. $display_fav = wp_ozh_adminmenu_true_if_set( 'f' );
  34. $nograd      = wp_ozh_adminmenu_true_if_set( 'n' );
  35. $dir         = ( isset( $_GET['d'] ) && $_GET['d'] == 'right' ) ? 'right' : 'left' ; // text direction
  36. $opdir       = ( isset( $_GET['r'] ) && $_GET['r'] == 'right' ) ? 'left' : 'right' ; // OPposite DIRection
  37. $grad        = ( isset( $_GET['g'] ) ) ? wp_ozh_adminmenu_color($_GET['g']) : '#676768' ;
  38.  
  39. header('Content-type:text/css');
  40.  
  41. ?>
  42.  
  43. /* Style for Ozh's Admin Drop Down Menu */
  44. /* Restyle or hide original items */
  45. #adminmenu                  {display:none;}
  46. #wpbody, div.folded #wpbody {margin-<?php echo $dir; ?>:0px}
  47.  
  48. #wpbody-content .wrap {margin-<?php echo $dir; ?>:15px}
  49.  
  50. #media-upload-header #sidemenu li {
  51.     display:auto;
  52. }
  53. #screen-meta {
  54.     display:none; /* hidden in case we have no JS to move it */
  55. }
  56. /* added for WP 3.2 */
  57. #adminmenuback, #adminmenuwrap, #adminmenu,
  58. .folded #adminmenu .wp-submenu.sub-open, .folded #adminmenu .wp-submenu-wrap,
  59. .folded #adminmenuback, .folded #adminmenuwrap, .folded #adminmenu, .folded #adminmenu li.menu-top,
  60. .js.folded #adminmenuback, .js.folded #adminmenuwrap, .js.folded #adminmenu, .js.folded #adminmenu li.menu-top {
  61.     width: 0;
  62. }
  63. #wpcontent, #footer, .folded #wpcontent, .folded #footer, .js.folded #wpcontent, .js.folded #footer {
  64.     margin-left: 0px;
  65.     margin-right:0px;
  66. }
  67. #wphead {
  68.     background:#D1E5EE;
  69.     margin-right:0px;
  70.     margin-left:0px;
  71.     padding-right:15px;
  72.     padding-left:18px;
  73. }
  74. #footer-left, #footer-ozh-oam {
  75.     padding-left:15px;
  76. }
  77. #footer-upgrade {
  78.     padding-right:15px;
  79. }
  80. /* Styles for our new menu */
  81. #ozhmenu_wrap {
  82.     z-index:43000;
  83.     overflow:hidden;
  84.     width:100%;
  85.     clear:both;
  86. }
  87. #ozhmenu { /* our new ul */
  88.     font-size:12px;
  89.     <?php echo $dir; ?>:0px;
  90.     list-style-image:none;
  91.     list-style-position:outside;
  92.     list-style-type:none;
  93.     margin:0pt;
  94.     margin-bottom:1px;
  95.     padding-<?php echo $dir; ?>:8px;
  96.     top:0px;
  97.     width:100%; /* width required for -wtf?- dropping li elements to be 100% wide in their containing ul */
  98.     overflow:hidden;
  99.     z-index:1000;
  100.     background:<?php echo $grad; ?> <?php if (!$nograd) { ?>url(<?php echo $plugin; ?>images/grad-trans.png) repeat-x <?php echo $dir; ?> top<?php } ?>;
  101. }
  102. #ozhmenu li { /* all list items */
  103.     display:inline;
  104.     line-height:200% !important;
  105.     list-style-image:none;
  106.     list-style-position:outside;
  107.     list-style-type:none;
  108.     margin:0 3px;
  109.     padding:0;
  110.     white-space:nowrap;
  111.     float: <?php echo $dir; ?>;
  112.     width: 1*; /* maybe needed for some Opera ? */
  113. }
  114. #ozhmenu a { /* all links */
  115.     text-decoration:none;
  116.     color:#bbb;
  117.     line-height:220%;
  118.     padding:0px 10px;
  119.     display:block;
  120.     width:1*;  /* maybe needed for some Opera ? */
  121. }
  122. #ozhmenu li:hover,
  123. #ozhmenu li.ozhmenu_over,
  124. #ozhmenu li .wp-has-current-submenu {
  125.     -moz-border-radius: 11px;
  126.     -webkit-border-radius: 11px;
  127.     color: #ffe;
  128.     background: <?php echo $grad; ?> <?php if (!$nograd) { ?>url(<?php echo $plugin; ?>images/grad-trans.png) repeat-x <?php echo $dir; ?> -5px<?php } ?>;
  129. }
  130.  
  131. #ozhmenu li:hover {
  132.     -moz-border-radius: 0px;
  133.     -webkit-border-radius: 0px;
  134. }
  135. #ozhmenu .ozhmenu_sublevel { line-height: 100%; margin: 0; } /* IE8 fix. Die, IE8 */
  136. #ozhmenu .ozhmenu_sublevel a:hover,
  137. #ozhmenu .ozhmenu_sublevel a.current,
  138. #ozhmenu .ozhmenu_sublevel a.current:hover {
  139.     background-color: #e4f2fd;
  140.     -moz-border-radius-topleft: 0px;
  141.     -moz-border-radius-topright: 0px;
  142.     -webkit-border-top-left-radius:0;
  143.     -webkit-border-top-right-radius:0;
  144.     border-top-left-radius:0;
  145.     border-top-right-radius:0;
  146.     color: #555;
  147. }
  148. #ozhmenu li ul { /* drop down lists */
  149.     padding: 0 0 5px 0px;
  150.     margin: 0;
  151.     list-style: none;
  152.     position: absolute;
  153.     background: white;
  154.     opacity:0.95;
  155.     filter:alpha(opacity=95);
  156.     border-left:1px solid #ccc ;
  157.     border-right:1px solid #ccc ;
  158.     border-bottom:1px solid #c6d9e9 ;
  159.     -moz-border-radius-bottomleft:5px;
  160.     -moz-border-radius-bottomright:5px;
  161.     -webkit-border-bottom-left-radius:5px;
  162.     -webkit-border-bottom-right-radius:5px;
  163.     border-bottom-left-radius:5px;
  164.     border-bottom-right-radius:5px;
  165.     width: 1*;  /* maybe needed for some Opera ? */
  166.     zmin-width:10em;
  167.     <?php echo $dir; ?>: -999em; /* using left instead of display to hide menus because display: none isn't read by screen readers */
  168.     list-style-position:auto;
  169.     list-style-type:auto;
  170.     z-index:1001;
  171. }
  172. #ozhmenu li ul li { /* dropped down lists item */
  173.     background:transparent !important;
  174.     float:none;
  175.     text-align:<?php echo $dir; ?>;
  176.     overflow:hidden;
  177. }
  178. #ozhmenu li ul li a { /* links in dropped down list items*/
  179.     margin:0px;
  180.     color:#666;
  181. }
  182. #ozhmenu li:hover ul, #ozhmenu li.ozhmenu_over ul { /* lists dropped down under hovered list items */
  183.     <?php echo $dir; ?>: auto;
  184.     z-index:999999;
  185. }
  186. #ozhmenu li a #awaiting-mod, #ozhmenu li a .update-plugins {
  187.     position: absolute;
  188.     margin-<?php echo $dir; ?>: 0.1em;
  189.     font-size: 0.8em;
  190.     background-image: url(<?php echo $plugin; ?>images/comment-stalk-<?php echo ($dir == 'left' ? 'fresh' : 'rtl'); ?>.gif);
  191.     background-repeat: no-repeat;
  192.     background-position: <?php echo ($dir == 'left' ? '-243' : '-67'); ?>px bottom;
  193.     height: 1.7em;
  194.     width: 1em;
  195. }
  196. #ozhmenu li.ozhmenu_over a #awaiting-mod, #ozhmenu li a:hover #awaiting-mod, #ozhmenu li.ozhmenu_over a .update-plugins, #ozhmenu li a:hover .update-plugins {
  197.     background-position: <?php echo ($dir == 'left' ? '-2' : '-307'); ?>px bottom;
  198. }
  199. #ozhmenu li a #awaiting-mod span, #ozhmenu li a .update-plugins span {
  200.     color: #444;
  201.     top: -0.4em;
  202.     <?php echo $opdir; ?>: -0.5em;
  203.     position: absolute;
  204.     display: block;
  205.     height: 1.3em;
  206.     line-height: 1.4em;
  207.     padding: 0 0.8em;
  208.     background-color: #bbb;#2583AD;
  209.     -moz-border-radius: 4px;
  210.     -khtml-border-radius: 4px;
  211.     -webkit-border-radius: 4px;
  212.     border-radius: 4px;
  213. }
  214. #ozhmenu li.ozhmenu_over a #awaiting-mod span, #ozhmenu li a:hover #awaiting-mod span, #ozhmenu li.ozhmenu_over a .update-plugins span, #ozhmenu li a:hover .update-plugins span {
  215.     background-color:#D54E21;
  216. }
  217. #ozhmenu .current {
  218.     border:0px; /* MSIE insists on having this */
  219. }
  220. #ozhmenu li ul li a.current:before {
  221.     content: "\00BB \0020";
  222.     color:#d54e21;
  223. }
  224.  
  225. /* Top level icons */
  226. .ozhmenu_toplevel div.wp-menu-image {
  227.     float:<?php echo $dir; ?>;
  228.     height:24px;
  229.     width:24px;
  230. }
  231. <?php if ($wpicons) { ?>
  232. #ozhmenu .ozhmenu_toplevel a.menu-top {
  233.     padding:<?php echo ($dir == 'left' ? '0 5px 0 1px' : '0 1px 0 5px'); ?>; /* override #ozhmenu a's padding:0 10 */
  234. }
  235. <?php } ?>
  236.  
  237. #ozhmenu li.ozhmenu_toplevel ul li.toplevel_label, #ozhmenu li.ozhmenu_toplevel ul li.toplevel_label:hover {
  238.     color:#444;
  239.     background: #e4f2fd !important;
  240.     padding:0px 10px;
  241.     margin:0px;
  242.     display:block;
  243.     border-bottom:1px solid #c6d9e9;
  244.     width:1*;  /* maybe needed for some Opera ? */
  245.     cursor:default;
  246.     <?php if (!$compact) { ?>
  247.     display:none;
  248.     <?php } ?>
  249. }
  250. #ozhmenu li.ozhmenu_toplevel ul li.toplevel_label span.update-plugins,
  251. #ozhmenu li.ozhmenu_toplevel ul li.toplevel_label span.pending-count {display:none;}
  252.  
  253. #oam_menu-site div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -363px -35px no-repeat;}
  254. #oam_menu-site:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -363px -3px no-repeat;}
  255. #oam_menu-dashboard div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -61px -35px no-repeat;}
  256. #oam_menu-dashboard:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -61px -3px no-repeat;}
  257. #oam_menu-posts div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -272px -35px no-repeat;}
  258. #oam_menu-posts:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -272px -3px no-repeat;}
  259. #oam_menu-media div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -121px -35px no-repeat;}
  260. #oam_menu-media:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -121px -3px no-repeat;}
  261. #oam_menu-links div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -91px -35px no-repeat;}
  262. #oam_menu-links:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -91px -3px no-repeat;}
  263. #oam_menu-pages div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -151px -35px no-repeat;}
  264. #oam_menu-pages:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -151px -3px no-repeat;}
  265. #oam_menu-comments div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -31px -35px no-repeat;}
  266. #oam_menu-comments:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -31px -3px no-repeat;}
  267. #oam_menu-appearance div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -1px -35px no-repeat;}
  268. #oam_menu-appearance:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -1px -3px no-repeat;}
  269. #oam_menu-plugins div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -181px -35px no-repeat;}
  270. #oam_menu-plugins:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -181px -3px no-repeat;}
  271. #oam_menu-users div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -301px -35px no-repeat;}
  272. #oam_menu-users:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -301px -3px no-repeat;}
  273. #oam_menu-tools div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -211px -35px no-repeat;}
  274. #oam_menu-tools:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -211px -3px no-repeat;}
  275. #oam_menu-update div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -211px -35px no-repeat;}
  276. #oam_menu-update:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -211px -3px no-repeat;}
  277. #oam_menu-settings div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -241px -35px no-repeat;}
  278. #oam_menu-settings:hover div.wp-menu-image {background:transparent url(<?php echo $admin; ?>images/menu.png) -241px -3px no-repeat;}
  279. #ozhmenu img.wp-menu-image {float:<?php echo $dir; ?>;opacity:0.6;padding:5px 1px 0;filter:alpha(opacity=60);}
  280. #ozhmenu .ozhmenu_toplevel:hover img.wp-menu-image {opacity:1;filter:alpha(opacity=100);}
  281.  
  282. /* Mu Specific */
  283. #ozhmumenu_head {
  284.     color:#bbb;
  285.     font-weight:bolder;
  286. }
  287. #ozhmumenu_head #all-my-blogs {
  288.     position:relative;
  289.     top:0px;
  290.     background:#ffa;
  291.     color:#000;
  292. }
  293. #ozhmenu #oam_bloglink a {
  294.     font-weight:bolder;
  295.     color:#fff;
  296. }
  297. /* Just for IE7 */
  298. #wphead {
  299.     #border-top-width: 31px;
  300. }
  301. #media-upload-header #sidemenu { display: block; }
  302.  
  303.  
  304. <?php if (!$display_fav) { ?>
  305. /* Hide favorite actions */
  306. #favorite-actions {display:none;}
  307. <?php } ?>
  308.  
  309. <?php if ($minimode) { ?>
  310. /* Hide all header */
  311. #wpadminbar {display:none;}
  312. html.wp-toolbar{padding-top: 0px}
  313. <?php } ?>
  314.  
  315. <?php if ($hidebubble) { ?>
  316. /* Hide "0" bubbles */
  317. span.count-0 {display:none;}
  318. <?php } ?>
  319.  
  320. <?php if ($icons) {
  321.     require(dirname(__FILE__).'/icons.php');
  322. ?>
  323. /* Icons */
  324. #ozhmenu .ozhmenu_sublevel a {
  325.     padding-<?php echo $dir; ?>:22px;
  326.     background-repeat:no-repeat;
  327.     background-position:<?php echo ($dir == 'left' ? '3px' : '97%'); ?> center;
  328. }
  329. .oam_plugin a {
  330.     background-image:url(<?php echo $plugin; ?>images/cog.png);
  331. }
  332. #ozhmumenu .ozhmenu_sublevel a {background-image:url(<?php echo $plugin; ?>images/world_link.png);}
  333. <?php
  334.     foreach($wp_ozh_adminmenu['icon_names'] as $link=>$icon) {
  335.         $link = wp_ozh_adminmenu_sanitize_id($link);
  336.         $link = str_replace(array('.php','.','/'),array('','_','_'),$link);
  337.         echo "#oamsub_$link a {background-image:url($plugin/images/$icon.png);}\n";
  338.     }
  339.  
  340. } else { ?>
  341. #ozhmenu .ozhmenu_sublevel a {padding-<?php echo $dir; ?>:5px;}
  342. <?php } ?>
  343.  
  344.  
  345. /**/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement