diff --git src/wp-admin/includes/plugin.php src/wp-admin/includes/plugin.php
index e4018d7..84944e9 100644
|
|
function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func |
1132 | 1132 | * @param string $capability The capability required for this menu to be displayed to the user. |
1133 | 1133 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1134 | 1134 | * @param callable $function The function to be called to output the content for this page. |
| 1135 | * @param int $position The position in the menu order this one should appear. |
| 1136 | * |
1135 | 1137 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1136 | 1138 | */ |
1137 | | function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
| 1139 | function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
1138 | 1140 | global $submenu, $menu, $_wp_real_parent_file, $_wp_submenu_nopriv, |
1139 | 1141 | $_registered_pages, $_parent_pages; |
1140 | 1142 | |
… |
… |
function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, |
1162 | 1164 | } |
1163 | 1165 | } |
1164 | 1166 | |
1165 | | $submenu[$parent_slug][] = array ( $menu_title, $capability, $menu_slug, $page_title ); |
| 1167 | $new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title ); |
| 1168 | if ( null === $position ) { |
| 1169 | $submenu[ $parent_slug ][] = $new_sub_menu; |
| 1170 | } elseif ( isset( $submenu[ $parent_slug ][ "$position" ] ) ) { |
| 1171 | $position = $position + substr( base_convert( md5( $menu_slug . $menu_title ), 16, 10 ) , -5 ) * 0.00001; |
| 1172 | $submenu[ $parent_slug ][ "$position" ] = $new_sub_menu; |
| 1173 | } else { |
| 1174 | $submenu[ $parent_slug ][ $position ] = $new_sub_menu; |
| 1175 | } |
| 1176 | ksort( $submenu[ $parent_slug ] ); |
1166 | 1177 | |
1167 | 1178 | $hookname = get_plugin_page_hookname( $menu_slug, $parent_slug); |
1168 | 1179 | if (!empty ( $function ) && !empty ( $hookname )) |
… |
… |
function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, |
1197 | 1208 | * @param string $capability The capability required for this menu to be displayed to the user. |
1198 | 1209 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1199 | 1210 | * @param callable $function The function to be called to output the content for this page. |
| 1211 | * @param int $position The position in the menu order this one should appear. |
1200 | 1212 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1201 | 1213 | */ |
1202 | | function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1203 | | return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1214 | function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1215 | return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1204 | 1216 | } |
1205 | 1217 | |
1206 | 1218 | /** |
… |
… |
function add_management_page( $page_title, $menu_title, $capability, $menu_slug, |
1217 | 1229 | * @param string $capability The capability required for this menu to be displayed to the user. |
1218 | 1230 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1219 | 1231 | * @param callable $function The function to be called to output the content for this page. |
| 1232 | * @param int $position The position in the menu order this one should appear. |
1220 | 1233 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1221 | 1234 | */ |
1222 | | function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1223 | | return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1235 | function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1236 | return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1224 | 1237 | } |
1225 | 1238 | |
1226 | 1239 | /** |
… |
… |
function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f |
1237 | 1250 | * @param string $capability The capability required for this menu to be displayed to the user. |
1238 | 1251 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1239 | 1252 | * @param callable $function The function to be called to output the content for this page. |
| 1253 | * @param int $position The position in the menu order this one should appear. |
1240 | 1254 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1241 | 1255 | */ |
1242 | | function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1243 | | return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1256 | function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1257 | return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1244 | 1258 | } |
1245 | 1259 | |
1246 | 1260 | /** |
… |
… |
function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun |
1257 | 1271 | * @param string $capability The capability required for this menu to be displayed to the user. |
1258 | 1272 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1259 | 1273 | * @param callable $function The function to be called to output the content for this page. |
| 1274 | * @param int $position The position in the menu order this one should appear. |
1260 | 1275 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1261 | 1276 | */ |
1262 | | function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1263 | | return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1277 | function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1278 | return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1264 | 1279 | } |
1265 | 1280 | |
1266 | 1281 | /** |
… |
… |
function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f |
1277 | 1292 | * @param string $capability The capability required for this menu to be displayed to the user. |
1278 | 1293 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1279 | 1294 | * @param callable $function The function to be called to output the content for this page. |
| 1295 | * @param int $position The position in the menu order this one should appear. |
1280 | 1296 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1281 | 1297 | */ |
1282 | | function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
| 1298 | function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
1283 | 1299 | if ( current_user_can('edit_users') ) |
1284 | 1300 | $parent = 'users.php'; |
1285 | 1301 | else |
1286 | 1302 | $parent = 'profile.php'; |
1287 | | return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1303 | return add_submenu_page( $parent, $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1288 | 1304 | } |
1289 | 1305 | /** |
1290 | 1306 | * Add submenu page to the Dashboard main menu. |
… |
… |
function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun |
1300 | 1316 | * @param string $capability The capability required for this menu to be displayed to the user. |
1301 | 1317 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1302 | 1318 | * @param callable $function The function to be called to output the content for this page. |
| 1319 | * @param int $position The position in the menu order this one should appear. |
1303 | 1320 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1304 | 1321 | */ |
1305 | | function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1306 | | return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1322 | function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1323 | return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1307 | 1324 | } |
1308 | 1325 | |
1309 | 1326 | /** |
… |
… |
function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, |
1320 | 1337 | * @param string $capability The capability required for this menu to be displayed to the user. |
1321 | 1338 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1322 | 1339 | * @param callable $function The function to be called to output the content for this page. |
| 1340 | * @param int $position The position in the menu order this one should appear. |
1323 | 1341 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1324 | 1342 | */ |
1325 | | function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1326 | | return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1343 | function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1344 | return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1327 | 1345 | } |
1328 | 1346 | |
1329 | 1347 | /** |
… |
… |
function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun |
1340 | 1358 | * @param string $capability The capability required for this menu to be displayed to the user. |
1341 | 1359 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1342 | 1360 | * @param callable $function The function to be called to output the content for this page. |
| 1361 | * @param int $position The position in the menu order this one should appear. |
1343 | 1362 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1344 | 1363 | */ |
1345 | | function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1346 | | return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1364 | function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1365 | return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1347 | 1366 | } |
1348 | 1367 | |
1349 | 1368 | /** |
… |
… |
function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun |
1360 | 1379 | * @param string $capability The capability required for this menu to be displayed to the user. |
1361 | 1380 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1362 | 1381 | * @param callable $function The function to be called to output the content for this page. |
| 1382 | * @param int $position The position in the menu order this one should appear. |
1363 | 1383 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1364 | 1384 | */ |
1365 | | function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1366 | | return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1385 | function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1386 | return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1367 | 1387 | } |
1368 | 1388 | |
1369 | 1389 | /** |
… |
… |
function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun |
1380 | 1400 | * @param string $capability The capability required for this menu to be displayed to the user. |
1381 | 1401 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1382 | 1402 | * @param callable $function The function to be called to output the content for this page. |
| 1403 | * @param int $position The position in the menu order this one should appear. |
1383 | 1404 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1384 | 1405 | */ |
1385 | | function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1386 | | return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1406 | function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1407 | return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function, $position); |
1387 | 1408 | } |
1388 | 1409 | |
1389 | 1410 | /** |
… |
… |
function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $fun |
1400 | 1421 | * @param string $capability The capability required for this menu to be displayed to the user. |
1401 | 1422 | * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu). |
1402 | 1423 | * @param callable $function The function to be called to output the content for this page. |
| 1424 | * @param int $position The position in the menu order this one should appear. |
1403 | 1425 | * @return false|string The resulting page's hook_suffix, or false if the user does not have the capability required. |
1404 | 1426 | */ |
1405 | | function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) { |
1406 | | return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function ); |
| 1427 | function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $position = null ) { |
| 1428 | return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function, $position ); |
1407 | 1429 | } |
1408 | 1430 | |
1409 | 1431 | /** |