Changes in trunk/wp-admin/includes/plugin.php [15235:15017]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/plugin.php
r15235 r15017 818 818 */ 819 819 function 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; 821 821 822 822 $menu_slug = plugin_basename( $menu_slug ); … … 842 842 843 843 $_registered_pages[$hookname] = true; 844 845 // No parent as top level846 $_parent_pages[$menu_slug] = false;847 844 848 845 return $hookname; … … 919 916 global $_wp_submenu_nopriv; 920 917 global $_registered_pages; 921 global $_parent_pages;922 918 923 919 $menu_slug = plugin_basename( $menu_slug ); … … 954 950 $_registered_pages[get_plugin_page_hookname( $menu_slug, 'edit.php')] = true; 955 951 956 // No parent as top level957 $_parent_pages[$menu_slug] = $parent_slug;958 959 952 return $hookname; 960 953 } … … 1170 1163 function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { 1171 1164 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 returned1178 *1179 * @since 3.01180 *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 true1183 * @return string the url1184 */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;1204 1165 } 1205 1166
Note: See TracChangeset
for help on using the changeset viewer.