Make WordPress Core

Changeset 9537


Ignore:
Timestamp:
11/05/2008 10:46:58 PM (17 years ago)
Author:
ryan
Message:

add_object_page()

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin.php

    r9411 r9537  
    558558}
    559559
     560function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
     561    global $menu, $admin_page_hooks, $_wp_last_object_menu;
     562
     563    $file = plugin_basename( $file );
     564
     565    $admin_page_hooks[$file] = sanitize_title( $menu_title );
     566
     567    $hookname = get_plugin_page_hookname( $file, '' );
     568    if (!empty ( $function ) && !empty ( $hookname ))
     569        add_action( $hookname, $function );
     570
     571    if ( empty($icon_url) )
     572        $icon_url = 'images/menu/generic.png';
     573
     574    $menu[$_wp_last_object_menu][4] = ''; // Remove menu-top-last
     575
     576    $_wp_last_object_menu++;
     577
     578    $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top-last ' . $hookname, $hookname, $icon_url );
     579
     580    return $hookname;
     581}
     582
    560583function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function = '' ) {
    561584    global $submenu;
  • trunk/wp-admin/menu.php

    r9474 r9537  
    5454$menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top-last', 'menu-comments', 'images/menu/comments.png' );
    5555    $submenu['edit-comments.php'][15] = array( __('Comments'), 'edit_posts', 'edit-comments.php' );
     56
     57$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
    5658
    5759$menu[29] = array( '', 'read', '', '', 'wp-menu-separator' );
Note: See TracChangeset for help on using the changeset viewer.