Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r15235 r15017  
    818818 */
    819819function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = NULL ) {
    820     global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
     820    global $menu, $admin_page_hooks, $_registered_pages;
    821821
    822822    $menu_slug = plugin_basename( $menu_slug );
     
    842842
    843843    $_registered_pages[$hookname] = true;
    844 
    845     // No parent as top level
    846     $_parent_pages[$menu_slug] = false;
    847844
    848845    return $hookname;
     
    919916    global $_wp_submenu_nopriv;
    920917    global $_registered_pages;
    921     global $_parent_pages;
    922918
    923919    $menu_slug = plugin_basename( $menu_slug );
     
    954950        $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true;
    955951
    956     // No parent as top level
    957     $_parent_pages[$menu_slug] = $parent_slug;
    958 
    959952    return $hookname;
    960953}
     
    11701163function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
    11711164    return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    1172 }
    1173 
    1174 /**
    1175  * Get the url to access a particular menu page based on the slug it was registered with.
    1176  *
    1177  * If the slug hasn't been registered properly no url will be returned
    1178  *
    1179  * @since 3.0
    1180  *
    1181  * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    1182  * @param bool $echo Whether or not to echo the url - default is true
    1183  * @return string the url
    1184  */
    1185 function menu_page_url($menu_slug, $echo = true) {
    1186     global $_parent_pages;
    1187 
    1188     if ( isset( $_parent_pages[$menu_slug] ) ) {
    1189         if ( $_parent_pages[$menu_slug] ) {
    1190             $url = admin_url($_parent_pages[$menu_slug] . '?page=' . $menu_slug);
    1191         } else {
    1192             $url = admin_url('admin.php?page=' . $menu_slug);
    1193         }
    1194     } else {
    1195         $url = '';
    1196     }
    1197 
    1198     $url = esc_url($url);
    1199 
    1200     if ( $echo )
    1201         echo $url;
    1202 
    1203     return $url;
    12041165}
    12051166
Note: See TracChangeset for help on using the changeset viewer.