Make WordPress Core

Changeset 35874


Ignore:
Timestamp:
12/11/2015 10:11:03 PM (9 years ago)
Author:
swissspidy
Message:

Admin Menu: Deprecate add_object_page() and add_utility_page().

These functions are not used in core and are just wrappers for add_menu_page().

Fixes #23108.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/deprecated.php

    r34822 r35874  
    13061306    _deprecated_function( __FUNCTION__, '3.9' );
    13071307}
     1308
     1309/**
     1310 * Add a top-level menu page in the 'objects' section.
     1311 *
     1312 * This function takes a capability which will be used to determine whether
     1313 * or not a page is included in the menu.
     1314 *
     1315 * The function which is hooked in to handle the output of the page must check
     1316 * that the user has the required capability as well.
     1317 *
     1318 * @since 2.7.0
     1319 *
     1320 * @deprecated 4.5.0 Use add_menu_page()
     1321 * @see add_menu_page()
     1322 * @global int $_wp_last_object_menu
     1323 *
     1324 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1325 * @param string   $menu_title The text to be used for the menu.
     1326 * @param string   $capability The capability required for this menu to be displayed to the user.
     1327 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1328 * @param callable $function   The function to be called to output the content for this page.
     1329 * @param string   $icon_url   The url to the icon to be used for this menu.
     1330 * @return string The resulting page's hook_suffix.
     1331 */
     1332function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
     1333    _deprecated_function( __FUNCTION__, '4.5', 'add_menu_page()' );
     1334
     1335    global $_wp_last_object_menu;
     1336
     1337    $_wp_last_object_menu++;
     1338
     1339    return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
     1340}
     1341
     1342/**
     1343 * Add a top-level menu page in the 'utility' section.
     1344 *
     1345 * This function takes a capability which will be used to determine whether
     1346 * or not a page is included in the menu.
     1347 *
     1348 * The function which is hooked in to handle the output of the page must check
     1349 * that the user has the required capability as well.
     1350 *
     1351 * @since 2.7.0
     1352 *
     1353 * @deprecated 4.5.0 Use add_menu_page()
     1354 * @see add_menu_page()
     1355 * @global int $_wp_last_utility_menu
     1356 *
     1357 * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
     1358 * @param string   $menu_title The text to be used for the menu.
     1359 * @param string   $capability The capability required for this menu to be displayed to the user.
     1360 * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
     1361 * @param callable $function   The function to be called to output the content for this page.
     1362 * @param string   $icon_url   The url to the icon to be used for this menu.
     1363 * @return string The resulting page's hook_suffix.
     1364 */
     1365function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
     1366    _deprecated_function( __FUNCTION__, '4.5', 'add_menu_page()' );
     1367
     1368    global $_wp_last_utility_menu;
     1369
     1370    $_wp_last_utility_menu++;
     1371
     1372    return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
     1373}
  • trunk/src/wp-admin/includes/plugin.php

    r35731 r35874  
    10811081
    10821082/**
    1083  * Add a top-level menu page in the 'objects' section.
    1084  *
    1085  * This function takes a capability which will be used to determine whether
    1086  * or not a page is included in the menu.
    1087  *
    1088  * The function which is hooked in to handle the output of the page must check
    1089  * that the user has the required capability as well.
    1090  *
    1091  * @global int $_wp_last_object_menu
    1092  *
    1093  * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
    1094  * @param string   $menu_title The text to be used for the menu.
    1095  * @param string   $capability The capability required for this menu to be displayed to the user.
    1096  * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
    1097  * @param callable $function   The function to be called to output the content for this page.
    1098  * @param string   $icon_url   The url to the icon to be used for this menu.
    1099  * @return string The resulting page's hook_suffix.
    1100  */
    1101 function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
    1102     global $_wp_last_object_menu;
    1103 
    1104     $_wp_last_object_menu++;
    1105 
    1106     return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_object_menu);
    1107 }
    1108 
    1109 /**
    1110  * Add a top-level menu page in the 'utility' section.
    1111  *
    1112  * This function takes a capability which will be used to determine whether
    1113  * or not a page is included in the menu.
    1114  *
    1115  * The function which is hooked in to handle the output of the page must check
    1116  * that the user has the required capability as well.
    1117  *
    1118  * @global int $_wp_last_utility_menu
    1119  *
    1120  * @param string   $page_title The text to be displayed in the title tags of the page when the menu is selected.
    1121  * @param string   $menu_title The text to be used for the menu.
    1122  * @param string   $capability The capability required for this menu to be displayed to the user.
    1123  * @param string   $menu_slug  The slug name to refer to this menu by (should be unique for this menu).
    1124  * @param callable $function   The function to be called to output the content for this page.
    1125  * @param string   $icon_url   The url to the icon to be used for this menu.
    1126  * @return string The resulting page's hook_suffix.
    1127  */
    1128 function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
    1129     global $_wp_last_utility_menu;
    1130 
    1131     $_wp_last_utility_menu++;
    1132 
    1133     return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $_wp_last_utility_menu);
    1134 }
    1135 
    1136 /**
    11371083 * Add a submenu page.
    11381084 *
Note: See TracChangeset for help on using the changeset viewer.