Ticket #15067: 15067.2.diff
| File 15067.2.diff, 8.6 KB (added by , 15 years ago) |
|---|
-
wp-admin/includes/plugin.php
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) … … 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 869 875 $menu_slug = plugin_basename( $menu_slug ); 870 876 871 877 $admin_page_hooks[$menu_slug] = sanitize_title( $menu_title ); … … 913 919 * 914 920 * @return string The resulting page's hook_suffix 915 921 */ 916 function add_object_page( $page_title, $menu_title , $capability, $menu_slug, $function = '', $icon_url = '') {922 function add_object_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '') { 917 923 global $_wp_last_object_menu; 918 924 919 925 $_wp_last_object_menu++; … … 939 945 * 940 946 * @return string The resulting page's hook_suffix 941 947 */ 942 function add_utility_page( $page_title, $menu_title , $capability, $menu_slug, $function = '', $icon_url = '') {948 function add_utility_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '') { 943 949 global $_wp_last_utility_menu; 944 950 945 951 $_wp_last_utility_menu++; … … 956 962 * The function which is hooked in to handle the output of the page must check 957 963 * that the user has the required capability as well. 958 964 * 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 965 * @param string $parent_slug The slug name for the parent menu (or the file name of a standard WordPress admin page), 966 * @param mixed $page_title_or_params The text to be displayed in the title tags of the page when the menu is selected 967 * OR, an array of this and all subsequent parameters. 961 968 * @param string $menu_title The text to be used for the menu 962 969 * @param string $capability The capability required for this menu to be displayed to the user. 963 970 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu) … … 965 972 * 966 973 * @return string The resulting page's hook_suffix 967 974 */ 968 function add_submenu_page( $parent_slug, $page_title , $menu_title, $capability, $menu_slug, $function = '' ) {975 function add_submenu_page( $parent_slug, $page_title_or_params, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 969 976 global $submenu; 970 977 global $menu; 971 978 global $_wp_real_parent_file; … … 973 980 global $_registered_pages; 974 981 global $_parent_pages; 975 982 983 if ( is_array( $page_title_or_params ) ) 984 extract( shortcode_atts( array( 'page_title' => NULL, 'menu_title' => NULL, 'capability' => NULL, 'menu_slug' => NULL, 'function' => '' ), $page_title_or_params ) ); 985 else 986 $page_title = $page_title_or_params; 987 976 988 $menu_slug = plugin_basename( $menu_slug ); 977 989 $parent_slug = plugin_basename( $parent_slug); 978 990 … … 1029 1041 * 1030 1042 * @return string The resulting page's hook_suffix 1031 1043 */ 1032 function add_management_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1044 function add_management_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1033 1045 return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1034 1046 } 1035 1047 … … 1050 1062 * 1051 1063 * @return string The resulting page's hook_suffix 1052 1064 */ 1053 function add_options_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1065 function add_options_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1054 1066 return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1055 1067 } 1056 1068 … … 1071 1083 * 1072 1084 * @return string The resulting page's hook_suffix 1073 1085 */ 1074 function add_theme_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1086 function add_theme_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1075 1087 return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1076 1088 } 1077 1089 … … 1092 1104 * 1093 1105 * @return string The resulting page's hook_suffix 1094 1106 */ 1095 function add_plugins_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1107 function add_plugins_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1096 1108 return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1097 1109 } 1098 1110 … … 1113 1125 * 1114 1126 * @return string The resulting page's hook_suffix 1115 1127 */ 1116 function add_users_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1128 function add_users_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1117 1129 if ( current_user_can('edit_users') ) 1118 1130 $parent = 'users.php'; 1119 1131 else … … 1137 1149 * 1138 1150 * @return string The resulting page's hook_suffix 1139 1151 */ 1140 function add_dashboard_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1152 function add_dashboard_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1141 1153 return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1142 1154 } 1143 1155 … … 1158 1170 * 1159 1171 * @return string The resulting page's hook_suffix 1160 1172 */ 1161 function add_posts_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1173 function add_posts_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1162 1174 return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1163 1175 } 1164 1176 … … 1179 1191 * 1180 1192 * @return string The resulting page's hook_suffix 1181 1193 */ 1182 function add_media_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1194 function add_media_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1183 1195 return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1184 1196 } 1185 1197 … … 1200 1212 * 1201 1213 * @return string The resulting page's hook_suffix 1202 1214 */ 1203 function add_links_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1215 function add_links_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1204 1216 return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1205 1217 } 1206 1218 … … 1221 1233 * 1222 1234 * @return string The resulting page's hook_suffix 1223 1235 */ 1224 function add_pages_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1236 function add_pages_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1225 1237 return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function ); 1226 1238 } 1227 1239 … … 1242 1254 * 1243 1255 * @return string The resulting page's hook_suffix 1244 1256 */ 1245 function add_comments_page( $page_title, $menu_title , $capability, $menu_slug, $function = '' ) {1257 function add_comments_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) { 1246 1258 return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function ); 1247 1259 } 1248 1260