Deprecate favorite_actions(). see #18785.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2011-10-24 06:10:36 +00:00
parent c62a9fe508
commit a4a58839d0
2 changed files with 10 additions and 112 deletions

View File

@ -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();

View File

@ -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 '<div id="favorite-actions">';
echo '<div id="favorite-first"><a href="' . $first . '">' . $allowed_actions[$first] . '</a></div><div id="favorite-toggle"><br /></div>';
echo '<div id="favorite-inside">';
array_shift($allowed_actions);
foreach ( $allowed_actions as $action => $label) {
echo "<div class='favorite-action'><a href='$action'>";
echo $label;
echo "</a></div>\n";
}
echo "</div></div>\n";
}
/**
* Convert a screen string to a screen object
*