WordPress.org

Make WordPress Core

Ticket #15067: 15067.diff

File 15067.diff, 10.0 KB (added by markjaquith, 8 years ago)

First swing. No no params added yet.

  • wp-admin/includes/plugin.php

    function uninstall_plugin($plugin) { 
    853853 * The function which is hooked in to handle the output of the page must check
    854854 * that the user has the required capability as well.
    855855 *
    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.
    857858 * @param string $menu_title The text to be used for the menu
    858859 * @param string $capability The capability required for this menu to be displayed to the user.
    859860 * @param string $menu_slug The slug name to refer to this menu by (should be unique for this menu)
    function uninstall_plugin($plugin) { 
    863864 *
    864865 * @return string The resulting page's hook_suffix
    865866 */
    866 function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '', $position = NULL ) {
     867function add_menu_page( $page_title_or_params, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '', $position = NULL ) {
    867868        global $menu, $admin_page_hooks, $_registered_pages, $_parent_pages;
    868869
     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
    869876        $menu_slug = plugin_basename( $menu_slug );
    870877
    871878        $admin_page_hooks[$menu_slug] = sanitize_title( $menu_title );
    function add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $func 
    913920 *
    914921 * @return string The resulting page's hook_suffix
    915922 */
    916 function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
     923function add_object_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '') {
    917924        global $_wp_last_object_menu;
    918925
    919926        $_wp_last_object_menu++;
    function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $fu 
    939946 *
    940947 * @return string The resulting page's hook_suffix
    941948 */
    942 function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function = '', $icon_url = '') {
     949function add_utility_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '', $icon_url = '') {
    943950        global $_wp_last_utility_menu;
    944951
    945952        $_wp_last_utility_menu++;
    function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $f 
    956963 * The function which is hooked in to handle the output of the page must check
    957964 * that the user has the required capability as well.
    958965 *
    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.
    961969 * @param string $menu_title The text to be used for the menu
    962970 * @param string $capability The capability required for this menu to be displayed to the user.
    963971 * @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 
    965973 *
    966974 * @return string The resulting page's hook_suffix
    967975 */
    968 function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     976function add_submenu_page( $parent_slug, $page_title_or_params, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    969977        global $submenu;
    970978        global $menu;
    971979        global $_wp_real_parent_file;
    function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, 
    973981        global $_registered_pages;
    974982        global $_parent_pages;
    975983
     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
    976990        $menu_slug = plugin_basename( $menu_slug );
    977991        $parent_slug = plugin_basename( $parent_slug);
    978992
    function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, 
    10291043 *
    10301044 * @return string The resulting page's hook_suffix
    10311045 */
    1032 function add_management_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1046function add_management_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    10331047        return add_submenu_page( 'tools.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    10341048}
    10351049
    function add_management_page( $page_title, $menu_title, $capability, $menu_slug, 
    10501064 *
    10511065 * @return string The resulting page's hook_suffix
    10521066 */
    1053 function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1067function add_options_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    10541068        return add_submenu_page( 'options-general.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    10551069}
    10561070
    function add_options_page( $page_title, $menu_title, $capability, $menu_slug, $f 
    10711085 *
    10721086 * @return string The resulting page's hook_suffix
    10731087 */
    1074 function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1088function add_theme_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    10751089        return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    10761090}
    10771091
    function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $fun 
    10921106 *
    10931107 * @return string The resulting page's hook_suffix
    10941108 */
    1095 function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1109function add_plugins_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    10961110        return add_submenu_page( 'plugins.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    10971111}
    10981112
    function add_plugins_page( $page_title, $menu_title, $capability, $menu_slug, $f 
    11131127 *
    11141128 * @return string The resulting page's hook_suffix
    11151129 */
    1116 function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1130function add_users_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    11171131        if ( current_user_can('edit_users') )
    11181132                $parent = 'users.php';
    11191133        else
    function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $fun 
    11371151 *
    11381152 * @return string The resulting page's hook_suffix
    11391153 */
    1140 function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1154function add_dashboard_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    11411155        return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    11421156}
    11431157
    function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, 
    11581172 *
    11591173 * @return string The resulting page's hook_suffix
    11601174 */
    1161 function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1175function add_posts_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    11621176        return add_submenu_page( 'edit.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    11631177}
    11641178
    function add_posts_page( $page_title, $menu_title, $capability, $menu_slug, $fun 
    11791193 *
    11801194 * @return string The resulting page's hook_suffix
    11811195 */
    1182 function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1196function add_media_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    11831197        return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    11841198}
    11851199
    function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $fun 
    12001214 *
    12011215 * @return string The resulting page's hook_suffix
    12021216 */
    1203 function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1217function add_links_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    12041218        return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    12051219}
    12061220
    function add_links_page( $page_title, $menu_title, $capability, $menu_slug, $fun 
    12211235 *
    12221236 * @return string The resulting page's hook_suffix
    12231237*/
    1224 function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1238function add_pages_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    12251239        return add_submenu_page( 'edit.php?post_type=page', $page_title, $menu_title, $capability, $menu_slug, $function );
    12261240}
    12271241
    function add_pages_page( $page_title, $menu_title, $capability, $menu_slug, $fun 
    12421256 *
    12431257 * @return string The resulting page's hook_suffix
    12441258*/
    1245 function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
     1259function add_comments_page( $page_title, $menu_title = NULL, $capability = NULL, $menu_slug = NULL, $function = '' ) {
    12461260        return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $function );
    12471261}
    12481262