Rename Install to More Information, Add an Install Now action link to the Plugin Installer search results. See #11050
git-svn-id: http://svn.automattic.com/wordpress/trunk@13920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57c201fb3a
commit
f7b83bd893
|
@ -1 +1 @@
|
|||
div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.action-links{font-weight:normal;margin:6px 0 0;}div.star{height:100%;position:absolute;top:0;left:0;background-color:transparent;letter-spacing:1ex;border:none;}.star1{width:20%;}.star2{width:40%;}.star3{width:60%;}.star4{width:80%;}.star5{width:100%;}.star img,div.star a,div.star a:hover,div.star a:visited{display:block;position:absolute;right:0;border:none;text-decoration:none;}div.star img{width:19px;height:19px;border-left:1px solid #fff;border-right:1px solid #fff;}#plugin-information-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}#plugin-information ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}#plugin-information p.action-button{width:100%;padding-bottom:0;margin-bottom:0;margin-top:10px;-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}#plugin-information .action-button a{text-align:center;font-weight:bold;text-decoration:none;display:block;line-height:2em;}#plugin-information h2{clear:none!important;margin-right:200px;}#plugin-information .fyi{margin:0 10px 50px;width:210px;}#plugin-information .fyi h2{font-size:.9em;margin-bottom:0;margin-right:0;}#plugin-information .fyi h2.mainheader{padding:5px;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;}#plugin-information .fyi ul{padding:10px 5px 10px 7px;margin:0;list-style:none;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}#plugin-information .fyi li{margin-right:0;}#plugin-information #section-holder{padding:10px;}#plugin-information .section ul,#plugin-information .section ol{margin-left:16px;list-style-type:square;list-style-image:none;}#plugin-information #section-screenshots li img{vertical-align:text-top;}#plugin-information #section-screenshots li p{font-style:italic;padding-left:20px;padding-bottom:2em;}#plugin-information .updated,#plugin-information pre{margin-right:215px;}#plugin-information pre{padding:7px;}
|
||||
div.star-holder{position:relative;height:19px;width:100px;font-size:19px;}div.action-links{font-weight:normal;margin:6px 0 0;}div.star{height:100%;position:absolute;top:0;left:0;background-color:transparent;letter-spacing:1ex;border:none;}.star1{width:20%;}.star2{width:40%;}.star3{width:60%;}.star4{width:80%;}.star5{width:100%;}.star img,div.star a,div.star a:hover,div.star a:visited{display:block;position:absolute;right:0;border:none;text-decoration:none;}div.star img{width:19px;height:19px;border-left:1px solid #fff;border-right:1px solid #fff;}table#install-plugins th.num{white-space:nowrap;}#plugin-information-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;height:2.5em;}#plugin-information ul#sidemenu{font-weight:normal;margin:0 5px;position:absolute;left:0;bottom:-1px;}#plugin-information p.action-button{width:100%;padding-bottom:0;margin-bottom:0;margin-top:10px;-moz-border-radius:3px 0 0 3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}#plugin-information .action-button a{text-align:center;font-weight:bold;text-decoration:none;display:block;line-height:2em;}#plugin-information h2{clear:none!important;margin-right:200px;}#plugin-information .fyi{margin:0 10px 50px;width:210px;}#plugin-information .fyi h2{font-size:.9em;margin-bottom:0;margin-right:0;}#plugin-information .fyi h2.mainheader{padding:5px;-moz-border-radius-topleft:3px;-webkit-border-top-left-radius:3px;-khtml-border-top-left-radius:3px;border-top-left-radius:3px;}#plugin-information .fyi ul{padding:10px 5px 10px 7px;margin:0;list-style:none;-moz-border-radius-bottomleft:3px;-webkit-border-bottom-left-radius:3px;-khtml-border-bottom-left-radius:3px;border-bottom-left-radius:3px;}#plugin-information .fyi li{margin-right:0;}#plugin-information #section-holder{padding:10px;}#plugin-information .section ul,#plugin-information .section ol{margin-left:16px;list-style-type:square;list-style-image:none;}#plugin-information #section-screenshots li img{vertical-align:text-top;}#plugin-information #section-screenshots li p{font-style:italic;padding-left:20px;padding-bottom:2em;}#plugin-information .updated,#plugin-information pre{margin-right:215px;}#plugin-information pre{padding:7px;}
|
|
@ -42,7 +42,11 @@ div.star img {
|
|||
border-right: 1px solid #fff;
|
||||
}
|
||||
|
||||
/* Start custom CSS */
|
||||
/* Table layout CSS */
|
||||
table#install-plugins th.num {
|
||||
white-space: nowrap; /* Prevents long plugin titles from causing the version column to wrap */
|
||||
}
|
||||
|
||||
/* Header on thickbox */
|
||||
#plugin-information-header {
|
||||
margin: 0;
|
||||
|
|
|
@ -354,8 +354,27 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
|
|||
|
||||
$action_links = array();
|
||||
$action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] .
|
||||
'&TB_iframe=true&width=600&height=550') . '" class="thickbox onclick" title="' .
|
||||
esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __('Install') . '</a>';
|
||||
'&TB_iframe=true&width=600&height=550') . '" class="thickbox" title="' .
|
||||
esc_attr( sprintf( __( 'Information about %s' ), $name ) ) . '">' . __('More Information') . '</a>';
|
||||
|
||||
if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) {
|
||||
$status = install_plugin_install_status($plugin);
|
||||
|
||||
switch ( $status['status'] ) {
|
||||
case 'install':
|
||||
if ( $url )
|
||||
$action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __('Install Now') . '</a>';
|
||||
break;
|
||||
case 'update_available':
|
||||
if ( $url )
|
||||
$action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to %s' ), $status['version'] ) ) . '">' . sprintf(__('Update to version %s'), $status['version']) . '</a>';
|
||||
break;
|
||||
case 'latest_installed':
|
||||
case 'newer_installed':
|
||||
$action_links[] = '<span>' . __('This plugin is already installed') . '</span>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
|
||||
?>
|
||||
|
@ -393,6 +412,67 @@ function display_plugins_table($plugins, $page = 1, $totalpages = 1){
|
|||
|
||||
add_action('install_plugins_pre_plugin-information', 'install_plugin_information');
|
||||
|
||||
/**
|
||||
* Determine the status we can perform on a plugin.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function install_plugin_install_status($api, $loop = false) {
|
||||
// this function is called recursivly, $loop prevents futhur loops.
|
||||
if ( is_array($api) )
|
||||
$api = (object) $api;
|
||||
|
||||
//Default to a "new" plugin
|
||||
$status = 'install';
|
||||
$url = false;
|
||||
|
||||
//Check to see if this plugin is known to be installed, and has an update awaiting it.
|
||||
$update_plugins = get_site_transient('update_plugins');
|
||||
if ( is_object( $update_plugins ) ) {
|
||||
foreach ( (array)$update_plugins->response as $file => $plugin ) {
|
||||
if ( $plugin->slug === $api->slug ) {
|
||||
$status = 'update_available';
|
||||
$update_file = $file;
|
||||
$version = $plugin->new_version;
|
||||
if ( current_user_can('update_plugins') )
|
||||
$url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'install' == $status ) {
|
||||
if ( is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
|
||||
$installed_plugin = get_plugins('/' . $api->slug);
|
||||
if ( empty($installed_plugin) ) {
|
||||
if ( current_user_can('install_plugins') )
|
||||
$url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
|
||||
} else {
|
||||
$key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
|
||||
if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
|
||||
$status = 'latest_installed';
|
||||
} elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
|
||||
$status = 'newer_installed';
|
||||
$version = $installed_plugin[ $key ]['Version'];
|
||||
} else {
|
||||
//If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
|
||||
if ( ! $loop ) {
|
||||
delete_site_transient('update_plugins');
|
||||
wp_update_plugins();
|
||||
return install_plugin_install_status($api, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// "install" & no directory with that slug
|
||||
if ( current_user_can('install_plugins') )
|
||||
$url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
|
||||
}
|
||||
}
|
||||
|
||||
return compact('status', 'url', 'version');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display plugin information in dialog box form.
|
||||
*
|
||||
|
@ -440,63 +520,27 @@ function install_plugin_information() {
|
|||
echo "</div>\n";
|
||||
?>
|
||||
<div class="alignright fyi">
|
||||
<?php if ( ! empty($api->download_link) ) : ?>
|
||||
<?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?>
|
||||
<p class="action-button">
|
||||
<?php
|
||||
//Default to a "new" plugin
|
||||
$type = 'install';
|
||||
//Check to see if this plugin is known to be installed, and has an update awaiting it.
|
||||
$update_plugins = get_site_transient('update_plugins');
|
||||
if ( is_object( $update_plugins ) ) {
|
||||
foreach ( (array)$update_plugins->response as $file => $plugin ) {
|
||||
if ( $plugin->slug === $api->slug ) {
|
||||
$type = 'update_available';
|
||||
$update_file = $file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( 'install' == $type && is_dir( WP_PLUGIN_DIR . '/' . $api->slug ) ) {
|
||||
$installed_plugin = get_plugins('/' . $api->slug);
|
||||
if ( ! empty($installed_plugin) ) {
|
||||
$key = array_shift( $key = array_keys($installed_plugin) ); //Use the first plugin regardless of the name, Could have issues for multiple-plugins in one directory if they share different version numbers
|
||||
if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
|
||||
$type = 'latest_installed';
|
||||
} elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
|
||||
$type = 'newer_installed';
|
||||
$newer_version = $installed_plugin[ $key ]['Version'];
|
||||
} else {
|
||||
//If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
|
||||
delete_site_transient('update_plugins');
|
||||
$update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names
|
||||
$type = 'update_available';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $type ) :
|
||||
default:
|
||||
case 'install':
|
||||
if ( current_user_can('install_plugins') ) :
|
||||
?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>" target="_parent"><?php _e('Install Now') ?></a><?php
|
||||
endif;
|
||||
$status = install_plugin_install_status($api);
|
||||
switch ( $status['status'] ) {
|
||||
case 'install':
|
||||
if ( $url )
|
||||
echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
|
||||
break;
|
||||
case 'update_available':
|
||||
if ( current_user_can('update_plugins') ) :
|
||||
?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file) ?>" target="_parent"><?php _e('Install Update Now') ?></a><?php
|
||||
endif;
|
||||
case 'update_available':
|
||||
if ( $url )
|
||||
echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
|
||||
break;
|
||||
case 'newer_installed':
|
||||
if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
|
||||
?><a><?php printf(__('Newer Version (%s) Installed'), $newer_version) ?></a><?php
|
||||
endif;
|
||||
case 'newer_installed':
|
||||
echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
|
||||
break;
|
||||
case 'latest_installed':
|
||||
if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
|
||||
?><a><?php _e('Latest Version Installed') ?></a><?php
|
||||
endif;
|
||||
case 'latest_installed':
|
||||
echo '<a>' . __('Latest Version Installed') . '</a>';
|
||||
break;
|
||||
endswitch; ?>
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<h2 class="mainheader"><?php /* translators: For Your Information */ _e('FYI') ?></h2>
|
||||
|
|
|
@ -472,7 +472,7 @@ function wp_default_styles( &$styles ) {
|
|||
$styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array(), '20091022' );
|
||||
$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
|
||||
$styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20100326' );
|
||||
$styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100228' );
|
||||
$styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100402' );
|
||||
$styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20090610' );
|
||||
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
|
||||
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
|
||||
|
|
Loading…
Reference in New Issue