Make WordPress Core

Ticket #32823: plugin.php.patch

File plugin.php.patch, 1.5 KB (added by GregRoss, 11 years ago)
  • plugin.php

     
    10591059}
    10601060
    10611061/**
     1062 * Add a separator to the top level menu
     1063 *
     1064 * This function takes a capability which will be used to determine whether
     1065 * or not a page is included in the menu.
     1066 *
     1067 * The function which is hooked in to handle the output of the page must check
     1068 * that the user has the required capability as well.
     1069 *
     1070 * @global array $menu
     1071 * @global array $_registered_pages
     1072 * @global array $_parent_pages
     1073 *
     1074 * @param string $capability The capability required for this menu to be displayed to the user.
     1075 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
     1076 * @param int $position The position in the menu order this one should appear
     1077 *
     1078 * @return bool Always returns true
     1079 */
     1080function add_menu_page_separator( $capability, $menu_slug, $position = null ) {
     1081        global $menu, $_registered_pages, $_parent_pages;
     1082
     1083        $menu_slug = plugin_basename( $menu_slug );
     1084       
     1085        $new_menu = array( '', $capability, $menu_slug, '', 'wp-not-current-submenu wp-menu-separator' );
     1086
     1087        if ( null === $position )
     1088                $menu[] = $new_menu;
     1089        else
     1090                $menu[$position] = $new_menu;
     1091
     1092        $_registered_pages[$hookname] = true;
     1093
     1094        // No parent as top level
     1095        $_parent_pages[$menu_slug] = false;
     1096
     1097        return true;
     1098}
     1099
     1100/**
    10621101 * Add a top level menu page in the 'objects' section
    10631102 *
    10641103 * This function takes a capability which will be used to determine whether