<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[21877] trunk/wp-admin: Admin menu: add phpdoc/inline comments describing the usage of the param $icon_url in add_menu_page(), add string 'none' to be used when a menu icon is added from CSS, switch core items in the admin menu to use 'none', fixes #21349</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21877">21877</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2012-09-16 22:51:44 +0000 (Sun, 16 Sep 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Admin menu: add phpdoc/inline comments describing the usage of the param $icon_url in add_menu_page(), add string 'none' to be used when a menu icon is added from CSS, switch core items in the admin menu to use 'none', fixes <a href="http://core.trac.wordpress.org/ticket/21349">#21349</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludespluginphp">trunk/wp-admin/includes/plugin.php</a></li>
<li><a href="#trunkwpadminmenuheaderphp">trunk/wp-admin/menu-header.php</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludespluginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin.php (21876 => 21877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin.php        2012-09-16 22:33:24 UTC (rev 21876)
+++ trunk/wp-admin/includes/plugin.php        2012-09-16 22:51:44 UTC (rev 21877)
</span><span class="lines">@@ -884,7 +884,8 @@
</span><span class="cx"> * @param string $capability The capability required for this menu to be displayed to the user.
</span><span class="cx"> * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
</span><span class="cx"> * @param callback $function The function to be called to output the content for this page.
</span><del>- * @param string $icon_url The url to the icon to be used for this menu
</del><ins>+ * @param string $icon_url The url to the icon to be used for this menu. Using 'none' would leave div.wp-menu-image empty
+ * so an icon can be added as background with CSS.
</ins><span class="cx"> * @param int $position The position in the menu order this one should appear
</span><span class="cx"> *
</span><span class="cx"> * @return string The resulting page's hook_suffix
</span></span></pre></div>
<a id="trunkwpadminmenuheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu-header.php (21876 => 21877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu-header.php        2012-09-16 22:33:24 UTC (rev 21876)
+++ trunk/wp-admin/menu-header.php        2012-09-16 22:51:44 UTC (rev 21877)
</span><span class="lines">@@ -68,8 +68,10 @@
</span><span class="cx">                 $class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
</span><span class="cx">                 $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
</span><span class="cx">                 $img = '';
</span><ins>+                // if the string 'none' (previously 'div') is passed instead of an URL, don't output the default menu image
+                // so an icon can be added to div.wp-menu-image as background with CSS.
</ins><span class="cx">                 if ( ! empty( $item[6] ) )
</span><del>-                        $img = ( 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
</del><ins>+                        $img = ( 'none' === $item[6] || 'div' === $item[6] ) ? '<br />' : '<img src="' . $item[6] . '" alt="" />';
</ins><span class="cx">                 $arrow = '<div class="wp-menu-arrow"><div></div></div>';
</span><span class="cx">
</span><span class="cx">                 $title = wptexturize( $item[0] );
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (21876 => 21877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2012-09-16 22:33:24 UTC (rev 21876)
+++ trunk/wp-admin/menu.php        2012-09-16 22:51:44 UTC (rev 21877)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> * @var array
</span><span class="cx"> */
</span><span class="cx">
</span><del>-$menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'div' );
</del><ins>+$menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'none' );
</ins><span class="cx">
</span><span class="cx"> $submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' );
</span><span class="cx">
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx">
</span><span class="cx"> $menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
</span><span class="cx">
</span><del>-$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' );
</del><ins>+$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'none' );
</ins><span class="cx">         $submenu['edit.php'][5] = array( __('All Posts'), 'edit_posts', 'edit.php' );
</span><span class="cx">         /* translators: add new post */
</span><span class="cx">         $submenu['edit.php'][10] = array( _x('Add New', 'post'), 'edit_posts', 'post-new.php' );
</span><span class="lines">@@ -60,18 +60,18 @@
</span><span class="cx">         }
</span><span class="cx">         unset($tax);
</span><span class="cx">
</span><del>-$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'div' );
</del><ins>+$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'none' );
</ins><span class="cx">         $submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
</span><span class="cx">         /* translators: add new file */
</span><span class="cx">         $submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
</span><span class="cx">
</span><del>-$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'div' );
</del><ins>+$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'none' );
</ins><span class="cx">         $submenu['link-manager.php'][5] = array( _x('All Links', 'admin menu'), 'manage_links', 'link-manager.php' );
</span><span class="cx">         /* translators: add new links */
</span><span class="cx">         $submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' );
</span><span class="cx">         $submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
</span><span class="cx">
</span><del>-$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'div' );
</del><ins>+$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'none' );
</ins><span class="cx">         $submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
</span><span class="cx">         /* translators: add new page */
</span><span class="cx">         $submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );
</span><span class="lines">@@ -86,7 +86,7 @@
</span><span class="cx">
</span><span class="cx"> $awaiting_mod = wp_count_comments();
</span><span class="cx"> $awaiting_mod = $awaiting_mod->moderated;
</span><del>-$menu[25] = array( sprintf( __('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'div' );
</del><ins>+$menu[25] = array( sprintf( __('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'none' );
</ins><span class="cx"> unset($awaiting_mod);
</span><span class="cx">
</span><span class="cx"> $submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">                 $menu_icon = esc_url( $ptype_obj->menu_icon );
</span><span class="cx">                 $ptype_class = $ptype_for_id;
</span><span class="cx">         } else {
</span><del>-                $menu_icon = 'div';
</del><ins>+                $menu_icon = 'none';
</ins><span class="cx">                 $ptype_class = 'post';
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -130,12 +130,12 @@
</span><span class="cx"> $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
</span><span class="cx">
</span><span class="cx"> if ( current_user_can( 'switch_themes') ) {
</span><del>-        $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
</del><ins>+        $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
</ins><span class="cx">                 $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
</span><span class="cx">                 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
</span><span class="cx">                         $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
</span><span class="cx"> } else {
</span><del>-        $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
</del><ins>+        $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
</ins><span class="cx">                 $submenu['themes.php'][5] = array(__('Themes'), 'edit_theme_options', 'themes.php');
</span><span class="cx">                 if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
</span><span class="cx">                         $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
</span><span class="lines">@@ -156,7 +156,7 @@
</span><span class="cx">         $count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-$menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'div' );
</del><ins>+$menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'none' );
</ins><span class="cx">
</span><span class="cx"> $submenu['plugins.php'][5] = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );
</span><span class="cx">
</span><span class="lines">@@ -169,9 +169,9 @@
</span><span class="cx"> unset( $update_data );
</span><span class="cx">
</span><span class="cx"> if ( current_user_can('list_users') )
</span><del>-        $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
</del><ins>+        $menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'none' );
</ins><span class="cx"> else
</span><del>-        $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );
</del><ins>+        $menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'none' );
</ins><span class="cx">
</span><span class="cx"> if ( current_user_can('list_users') ) {
</span><span class="cx">         $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
</span><span class="lines">@@ -191,7 +191,7 @@
</span><span class="cx">                 $submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php');
</span><span class="cx"> }
</span><span class="cx">
</span><del>-$menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'div' );
</del><ins>+$menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'none' );
</ins><span class="cx">         $submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );
</span><span class="cx">         $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
</span><span class="cx">         $submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
</span><span class="lines">@@ -200,7 +200,7 @@
</span><span class="cx">         if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
</span><span class="cx">                 $submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
</span><span class="cx">
</span><del>-$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'div' );
</del><ins>+$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'none' );
</ins><span class="cx">         $submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
</span><span class="cx">         $submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
</span><span class="cx">         $submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
</span></span></pre>
</div>
</div>
</body>
</html>