From 38440b5e9a50e70c032fd08a071021384596a5e5 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 24 Oct 2011 06:10:36 +0000 Subject: [PATCH] Deprecate favorite_actions(). see #18785. git-svn-id: https://develop.svn.wordpress.org/trunk@19050 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/deprecated.php | 10 +++ wp-admin/includes/screen.php | 112 ------------------------------- 2 files changed, 10 insertions(+), 112 deletions(-) diff --git a/wp-admin/includes/deprecated.php b/wp-admin/includes/deprecated.php index a433ebd0c8..daaaef52de 100644 --- a/wp-admin/includes/deprecated.php +++ b/wp-admin/includes/deprecated.php @@ -805,6 +805,16 @@ function screen_meta( $screen ) { $current_screen->render_screen_meta(); } +/** + * Favorite actions were deprecated in version 3.2. Use the admin bar instead. + * + * @since 2.7.0 + * @deprecated 3.2.0 + */ +function favorite_actions() { + _deprecated_function( __FUNCTION__, '3.2', 'WP_Admin_Bar' ); +} + function media_upload_image() { __deprecated_function( __FUNCTION__, '3.3', 'wp_media_upload_handler()' ); return wp_media_upload_handler(); diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index f408871e1d..39ba1f81bd 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -107,118 +107,6 @@ function get_hidden_meta_boxes( $screen ) { return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults ); } -/** - * {@internal Missing Short Description}} - * - * @since 2.7.0 - */ -function favorite_actions( $screen = null ) { - $default_action = false; - - if ( is_string($screen) ) - $screen = convert_to_screen($screen); - - if ( $screen->is_user ) - return; - - if ( isset($screen->post_type) ) { - $post_type_object = get_post_type_object($screen->post_type); - if ( 'add' != $screen->action ) - $default_action = array('post-new.php?post_type=' . $post_type_object->name => array($post_type_object->labels->new_item, $post_type_object->cap->edit_posts)); - else - $default_action = array('edit.php?post_type=' . $post_type_object->name => array($post_type_object->labels->name, $post_type_object->cap->edit_posts)); - } - - if ( !$default_action ) { - if ( $screen->is_network ) { - $default_action = array('sites.php' => array( __('Sites'), 'manage_sites')); - } else { - switch ( $screen->id ) { - case 'upload': - $default_action = array('media-new.php' => array(__('New Media'), 'upload_files')); - break; - case 'media': - $default_action = array('upload.php' => array(__('Edit Media'), 'upload_files')); - break; - case 'link-manager': - case 'link': - if ( 'add' != $screen->action ) - $default_action = array('link-add.php' => array(__('New Link'), 'manage_links')); - else - $default_action = array('link-manager.php' => array(__('Edit Links'), 'manage_links')); - break; - case 'users': - $default_action = array('user-new.php' => array(__('New User'), 'create_users')); - break; - case 'user': - $default_action = array('users.php' => array(__('Edit Users'), 'edit_users')); - break; - case 'plugins': - $default_action = array('plugin-install.php' => array(__('Install Plugins'), 'install_plugins')); - break; - case 'plugin-install': - $default_action = array('plugins.php' => array(__('Manage Plugins'), 'activate_plugins')); - break; - case 'themes': - $default_action = array('theme-install.php' => array(__('Install Themes'), 'install_themes')); - break; - case 'theme-install': - $default_action = array('themes.php' => array(__('Manage Themes'), 'switch_themes')); - break; - default: - $default_action = array('post-new.php' => array(__('New Post'), 'edit_posts')); - break; - } - } - } - - if ( !$screen->is_network ) { - $actions = array( - 'post-new.php' => array(__('New Post'), 'edit_posts'), - 'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'), - 'post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'), - 'media-new.php' => array(__('Upload'), 'upload_files'), - 'edit-comments.php' => array(__('Comments'), 'moderate_comments') - ); - } else { - $actions = array( - 'sites.php' => array( __('Sites'), 'manage_sites'), - 'users.php' => array( __('Users'), 'manage_network_users') - ); - } - - $default_key = array_keys($default_action); - $default_key = $default_key[0]; - if ( isset($actions[$default_key]) ) - unset($actions[$default_key]); - $actions = array_merge($default_action, $actions); - $actions = apply_filters( 'favorite_actions', $actions, $screen ); - - $allowed_actions = array(); - foreach ( $actions as $action => $data ) { - if ( current_user_can($data[1]) ) - $allowed_actions[$action] = $data[0]; - } - - if ( empty($allowed_actions) ) - return; - - $first = array_keys($allowed_actions); - $first = $first[0]; - echo '
'; - echo '

'; - echo '
'; - - array_shift($allowed_actions); - - foreach ( $allowed_actions as $action => $label) { - echo "\n"; - } - echo "
\n"; -} - /** * Convert a screen string to a screen object *