Ticket #15067: 15067.diff
| File 15067.diff, 10.0 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/plugin.php
function uninstall_plugin($plugin) { 853 853 * The function which is hooked in to handle the output of the page must check 854 854 * that the user has the required capability as well. 855 855 * 856 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 856 * @param mixed $page_title_or_params The text to be displayed in the title tags of the page when the menu is selected 857 * OR, an array of this and all subsequent parameters. 857 858 * @param string $menu_title The text to be used for the menu 858 859 * @param string $capability The capability required for this menu to be displayed to the user. 859 860 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) … … function uninstall_plugin($plugin) { 863 864 * 864 865 * @return string The resulting page's hook_suffix 865 866 */ 866 function add_menu_page( $page_title , $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = NULL ) {867 function add_menu_page( $page_title_or_params, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '', $position = NULL ) { 867 868 global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages; 868 869 870 if ( is_array( $page_title_or_params ) ) { 871 extract( shortcode_atts( array( 'page_title' => NULL, 'menu_title' => NULL, 'capability' => NULL, 'menu_slug' => NULL, 'function' => '', 'icon_url' => '', 'position' => NULL ), $page_title_or_params ) ); 872 } else { 873 $page_title = $page_title_or_params; 874 } 875 869 876 $menu_slug = plugin_basename( $menu_slug ); 870 877 871 878 $admin_page_hooks[$menu_slug] = sanitize_title( $menu_title ); … … function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func 913 920 * 914 921 * @return string The resulting page's hook_suffix 915 922 */ 916 function add_object_page( $page_title, $menu_title , $capability, $menu_slug, $function = '', $icon_url = '') {923 function add_object_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '') { 917 924 global $_wp_last_object_menu; 918 925 919 926 $_wp_last_object_menu++; … … function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $fu 939 946 * 940 947 * @return string The resulting page's hook_suffix 941 948 */ 942 function add_utility_page( $page_title, $menu_title , $capability, $menu_slug, $function = '', $icon_url = '') {949 function add_utility_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '') { 943 950 global $_wp_last_utility_menu; 944 951 945 952 $_wp_last_utility_menu++; … … function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $f 956 963 * The function which is hooked in to handle the output of the page must check 957 964 * that the user has the required capability as well. 958 965 * 959 * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page) 960 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected 966 * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page), 967 * @param mixed $page_title_or_params The text to be displayed in the title tags of the page when the menu is selected 968 * OR, an array of this and all subsequent parameters. 961 969 * @param string $menu_title The text to be used for the menu 962 970 * @param string $capability The capability required for this menu to be displayed to the user. 963 971 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) … … function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $f 965 973 * 966 974 * @return string The resulting page's hook_suffix 967 975 */ 968 function add_submenu_page( $parent_slug, $page_title , $menu_title, $capability, $menu_slug, $function = '' ) {976 function add_submenu_page( $parent_slug, $page_title_or_params, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 969 977 global $submenu; 970 978 global $menu; 971 979 global $_wp_real_parent_file; … … function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, 973 981 global $_registered_pages; 974 982 global $_parent_pages; 975 983 984 if ( is_array( $page_title_or_params ) ) { 985 extract( shortcode_atts( array( 'page_title' => NULL, 'menu_title' => NULL, 'capability' => NULL, 'menu_slug' => NULL, 'function' => '' ), $page_title_or_params ) ); 986 } else { 987 $page_title = $page_title_or_params; 988 } 989 976 990 $menu_slug = plugin_basename( $menu_slug ); 977 991 $parent_slug = plugin_basename( $parent_slug); 978 992 … … function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, 1029 1043 * 1030 1044 * @return string The resulting page's hook_suffix 1031 1045 */ 1032 function add_management_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1046 function add_management_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1033 1047 return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1034 1048 } 1035 1049 … … function add_management_page( $page_title, $menu_title, $capability, $menu_slug, 1050 1064 * 1051 1065 * @return string The resulting page's hook_suffix 1052 1066 */ 1053 function add_options_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1067 function add_options_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1054 1068 return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1055 1069 } 1056 1070 … … function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f 1071 1085 * 1072 1086 * @return string The resulting page's hook_suffix 1073 1087 */ 1074 function add_theme_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1088 function add_theme_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1075 1089 return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1076 1090 } 1077 1091 … … function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun 1092 1106 * 1093 1107 * @return string The resulting page's hook_suffix 1094 1108 */ 1095 function add_plugins_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1109 function add_plugins_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1096 1110 return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1097 1111 } 1098 1112 … … function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f 1113 1127 * 1114 1128 * @return string The resulting page's hook_suffix 1115 1129 */ 1116 function add_users_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1130 function add_users_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1117 1131 if ( current_user_can('edit_users') ) 1118 1132 $parent = 'users.php'; 1119 1133 else … … function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun 1137 1151 * 1138 1152 * @return string The resulting page's hook_suffix 1139 1153 */ 1140 function add_dashboard_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1154 function add_dashboard_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1141 1155 return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1142 1156 } 1143 1157 … … function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, 1158 1172 * 1159 1173 * @return string The resulting page's hook_suffix 1160 1174 */ 1161 function add_posts_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1175 function add_posts_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1162 1176 return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1163 1177 } 1164 1178 … … function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun 1179 1193 * 1180 1194 * @return string The resulting page's hook_suffix 1181 1195 */ 1182 function add_media_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1196 function add_media_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1183 1197 return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1184 1198 } 1185 1199 … … function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun 1200 1214 * 1201 1215 * @return string The resulting page's hook_suffix 1202 1216 */ 1203 function add_links_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1217 function add_links_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1204 1218 return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1205 1219 } 1206 1220 … … function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun 1221 1235 * 1222 1236 * @return string The resulting page's hook_suffix 1223 1237 */ 1224 function add_pages_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1238 function add_pages_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1225 1239 return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function ); 1226 1240 } 1227 1241 … … function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $fun 1242 1256 * 1243 1257 * @return string The resulting page's hook_suffix 1244 1258 */ 1245 function add_comments_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1259 function add_comments_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1246 1260 return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1247 1261 } 1248 1262