Changeset 11856
- Timestamp:
- 08/20/2009 09:00:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/plugin.php
r11717 r11856 585 585 // 586 586 587 function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' ) {587 function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '', $position = NULL ) { 588 588 global $menu, $admin_page_hooks, $_registered_pages; 589 589 … … 596 596 add_action( $hookname, $function ); 597 597 598 if ( empty($icon_url) ) 598 if ( empty($icon_url) ) { 599 599 $icon_url = 'images/generic.png'; 600 elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') )600 } elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) { 601 601 $icon_url = 'https://' . substr($icon_url, 7); 602 603 $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 604 602 } 603 604 $new_menu = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 605 606 if ( NULL === $position ) { 607 $menu[] = $new_menu; 608 } else { 609 $menu[$position] = $new_menu; 610 } 611 605 612 $_registered_pages[$hookname] = true; 606 613 … … 609 616 610 617 function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') { 611 global $menu, $admin_page_hooks, $_wp_last_object_menu, $_registered_pages; 612 613 $file = plugin_basename( $file ); 614 615 $admin_page_hooks[$file] = sanitize_title( $menu_title ); 616 617 $hookname = get_plugin_page_hookname( $file, '' ); 618 if (!empty ( $function ) && !empty ( $hookname )) 619 add_action( $hookname, $function ); 620 621 if ( empty($icon_url) ) 622 $icon_url = 'images/generic.png'; 623 elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) 624 $icon_url = 'https://' . substr($icon_url, 7); 625 618 global $_wp_last_object_menu; 619 626 620 $_wp_last_object_menu++; 627 628 $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 629 630 $_registered_pages[$hookname] = true; 631 632 return $hookname; 621 622 return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_object_menu); 633 623 } 634 624 635 625 function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') { 636 global $menu, $admin_page_hooks, $_wp_last_utility_menu, $_registered_pages; 637 638 $file = plugin_basename( $file ); 639 640 $admin_page_hooks[$file] = sanitize_title( $menu_title ); 641 642 $hookname = get_plugin_page_hookname( $file, '' ); 643 if (!empty ( $function ) && !empty ( $hookname )) 644 add_action( $hookname, $function ); 645 646 if ( empty($icon_url) ) 647 $icon_url = 'images/generic.png'; 648 elseif ( is_ssl() && 0 === strpos($icon_url, 'http://') ) 649 $icon_url = 'https://' . substr($icon_url, 7); 650 626 global $_wp_last_utility_menu; 627 651 628 $_wp_last_utility_menu++; 652 653 $menu[$_wp_last_utility_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url ); 654 655 $_registered_pages[$hookname] = true; 656 657 return $hookname; 629 630 return add_menu_page($page_title, $menu_title, $access_level, $file, $function, $icon_url, $_wp_last_utility_menu); 658 631 } 659 632
Note: See TracChangeset
for help on using the changeset viewer.