Ticket #14666: 14666.diff
File 14666.diff, 9.9 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/plugin.php
852 852 /** 853 853 * Add a top level menu page in the 'objects' section 854 854 * 855 * This function takes a capability which will be used to determine whether856 * or not a page is included in the menu.857 *858 * The function which is hooked in to handle the output of the page must check859 * that the user has the required capability as well.860 *861 855 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 862 856 * @param string $menu_title The text to be used for the menu 863 857 * @param string $capability The capability required for this menu to be displayed to the user. … … 876 870 /** 877 871 * Add a top level menu page in the 'utility' section 878 872 * 879 * This function takes a capability which will be used to determine whether880 * or not a page is included in the menu.881 *882 * The function which is hooked in to handle the output of the page must check883 * that the user has the required capability as well.884 *885 873 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 886 874 * @param string $menu_title The text to be used for the menu 887 875 * @param string $capability The capability required for this menu to be displayed to the user. … … 900 888 /** 901 889 * Add a sub menu page 902 890 * 903 * This function takes a capability which will be used to determine whether904 * or not a page is included in the menu.905 *906 * The function which is hooked in to handle the output of the page must check907 * that the user has the required capability as well.908 *909 891 * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page) 910 892 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 911 893 * @param string $menu_title The text to be used for the menu … … 962 944 963 945 /** 964 946 * Add sub menu page to the tools main menu. 965 *966 * This function takes a capability which will be used to determine whether967 * or not a page is included in the menu.968 947 * 969 * The function which is hooked in to handle the output of the page must check970 * that the user has the required capability as well.971 *972 948 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 973 949 * @param string $menu_title The text to be used for the menu 974 950 * @param string $capability The capability required for this menu to be displayed to the user. … … 981 957 982 958 /** 983 959 * Add sub menu page to the options main menu. 984 *985 * This function takes a capability which will be used to determine whether986 * or not a page is included in the menu.987 960 * 988 * The function which is hooked in to handle the output of the page must check989 * that the user has the required capability as well.990 *991 961 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 992 962 * @param string $menu_title The text to be used for the menu 993 963 * @param string $capability The capability required for this menu to be displayed to the user. … … 1000 970 1001 971 /** 1002 972 * Add sub menu page to the themes main menu. 1003 *1004 * This function takes a capability which will be used to determine whether1005 * or not a page is included in the menu.1006 973 * 1007 * The function which is hooked in to handle the output of the page must check1008 * that the user has the required capability as well.1009 *1010 974 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1011 975 * @param string $menu_title The text to be used for the menu 1012 976 * @param string $capability The capability required for this menu to be displayed to the user. … … 1019 983 1020 984 /** 1021 985 * Add sub menu page to the plugins main menu. 1022 *1023 * This function takes a capability which will be used to determine whether1024 * or not a page is included in the menu.1025 986 * 1026 * The function which is hooked in to handle the output of the page must check1027 * that the user has the required capability as well.1028 *1029 987 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1030 988 * @param string $menu_title The text to be used for the menu 1031 989 * @param string $capability The capability required for this menu to be displayed to the user. … … 1038 996 1039 997 /** 1040 998 * Add sub menu page to the Users/Profile main menu. 1041 *1042 * This function takes a capability which will be used to determine whether1043 * or not a page is included in the menu.1044 999 * 1045 * The function which is hooked in to handle the output of the page must check1046 * that the user has the required capability as well.1047 *1048 1000 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1049 1001 * @param string $menu_title The text to be used for the menu 1050 1002 * @param string $capability The capability required for this menu to be displayed to the user. … … 1060 1012 } 1061 1013 /** 1062 1014 * Add sub menu page to the Dashboard main menu. 1063 *1064 * This function takes a capability which will be used to determine whether1065 * or not a page is included in the menu.1066 1015 * 1067 * The function which is hooked in to handle the output of the page must check1068 * that the user has the required capability as well.1069 *1070 1016 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1071 1017 * @param string $menu_title The text to be used for the menu 1072 1018 * @param string $capability The capability required for this menu to be displayed to the user. … … 1079 1025 1080 1026 /** 1081 1027 * Add sub menu page to the posts main menu. 1082 *1083 * This function takes a capability which will be used to determine whether1084 * or not a page is included in the menu.1085 1028 * 1086 * The function which is hooked in to handle the output of the page must check1087 * that the user has the required capability as well.1088 *1089 1029 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1090 1030 * @param string $menu_title The text to be used for the menu 1091 1031 * @param string $capability The capability required for this menu to be displayed to the user. … … 1098 1038 1099 1039 /** 1100 1040 * Add sub menu page to the media main menu. 1101 *1102 * This function takes a capability which will be used to determine whether1103 * or not a page is included in the menu.1104 1041 * 1105 * The function which is hooked in to handle the output of the page must check1106 * that the user has the required capability as well.1107 *1108 1042 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1109 1043 * @param string $menu_title The text to be used for the menu 1110 1044 * @param string $capability The capability required for this menu to be displayed to the user. … … 1117 1051 1118 1052 /** 1119 1053 * Add sub menu page to the links main menu. 1120 *1121 * This function takes a capability which will be used to determine whether1122 * or not a page is included in the menu.1123 1054 * 1124 * The function which is hooked in to handle the output of the page must check1125 * that the user has the required capability as well.1126 *1127 1055 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1128 1056 * @param string $menu_title The text to be used for the menu 1129 1057 * @param string $capability The capability required for this menu to be displayed to the user. … … 1136 1064 1137 1065 /** 1138 1066 * Add sub menu page to the pages main menu. 1139 *1140 * This function takes a capability which will be used to determine whether1141 * or not a page is included in the menu.1142 1067 * 1143 * The function which is hooked in to handle the output of the page must check1144 * that the user has the required capability as well.1145 *1146 1068 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1147 1069 * @param string $menu_title The text to be used for the menu 1148 1070 * @param string $capability The capability required for this menu to be displayed to the user. … … 1155 1077 1156 1078 /** 1157 1079 * Add sub menu page to the comments main menu. 1158 *1159 * This function takes a capability which will be used to determine whether1160 * or not a page is included in the menu.1161 1080 * 1162 * The function which is hooked in to handle the output of the page must check1163 * that the user has the required capability as well.1164 *1165 1081 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 1166 1082 * @param string $menu_title The text to be used for the menu 1167 1083 * @param string $capability The capability required for this menu to be displayed to the user. … … 1172 1088 return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1173 1089 } 1174 1090 1091 1175 1092 /** 1093 * Remove a top level menu page 1094 * 1095 * @since 3.1.0 1096 * 1097 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) 1098 * @return array|bool The removed menu item on success, False if not found 1099 */ 1100 function remove_menu_page( $menu_slug ) { 1101 global $menu; 1102 1103 foreach ( $menu as $i => $item ) { 1104 if ( $menu_slug == $item[2] ) { 1105 unset($menu[$i]); 1106 return $item; 1107 } 1108 } 1109 1110 return false; 1111 } 1112 1113 /** 1114 * Remove a top level menu page 1115 * 1116 * @since 3.1.0 1117 * 1118 * @param string $menu_slug The slug name of the parent menu 1119 * @param string $menu_slug The slug name of the submenu 1120 * @return array|bool The removed submenu item on success, False if not found 1121 */ 1122 function remove_submenu_page( $menu_slug, $submenu_slug ) { 1123 global $submenu; 1124 1125 if ( !isset($submenu[$menu_slug]) ) 1126 return false; 1127 1128 foreach ( $submenu[$menu_slug] as $i => $item ) { 1129 if ( $submenu_slug == $item[2] ) { 1130 unset($submenu[$menu_slug][$i]); 1131 return $item; 1132 } 1133 } 1134 1135 return false; 1136 } 1137 1138 /** 1176 1139 * Get the url to access a particular menu page based on the slug it was registered with. 1177 1140 * 1178 1141 * If the slug hasn't been registered properly no url will be returned