Make WordPress Core

Changeset 13920


Ignore:
Timestamp:
04/01/2010 11:17:53 PM (15 years ago)
Author:
dd32
Message:

Rename Install to More Information, Add an Install Now action link to the Plugin Installer search results. See #11050

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/plugin-install.css

    r13520 r13920  
    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;}
     1div.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;}
  • trunk/wp-admin/css/plugin-install.dev.css

    r13520 r13920  
    4343}
    4444
    45 /* Start custom CSS */
     45/* Table layout CSS */
     46table#install-plugins th.num {
     47    white-space: nowrap; /* Prevents long plugin titles from causing the version column to wrap */
     48}
     49
    4650/* Header on thickbox */
    4751#plugin-information-header {
  • trunk/wp-admin/includes/plugin-install.php

    r13522 r13920  
    355355                $action_links = array();
    356356                $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
    357                                     '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox onclick" title="' .
    358                                     esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __('Install') . '</a>';
     357                                    '&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' .
     358                                    esc_attr( sprintf( __( 'Information about %s' ), $name ) ) . '">' . __('More Information') . '</a>';
     359
     360                if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) {
     361                    $status = install_plugin_install_status($plugin);
     362
     363                    switch ( $status['status'] ) {
     364                        case 'install':
     365                            if ( $url )
     366                                $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __('Install Now') . '</a>';
     367                            break;
     368                        case 'update_available':
     369                            if ( $url )
     370                                $action_links[] = '<a href="' . $status['url'] . '" title="' . esc_attr( sprintf( __( 'Update to %s' ), $status['version'] ) ) . '">' . sprintf(__('Update to version %s'), $status['version']) . '</a>';
     371                            break;
     372                        case 'latest_installed':
     373                        case 'newer_installed':
     374                            $action_links[] = '<span>' . __('This plugin is already installed') . '</span>';
     375                            break;
     376                    }
     377                }
    359378
    360379                $action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
     
    395414
    396415/**
     416 * Determine the status we can perform on a plugin.
     417 *
     418 * @since 3.0.0
     419 */
     420function install_plugin_install_status($api, $loop = false) {
     421    // this function is called recursivly, $loop prevents futhur loops.
     422    if ( is_array($api) )
     423        $api = (object) $api;
     424
     425    //Default to a "new" plugin
     426    $status = 'install';
     427    $url = false;
     428
     429    //Check to see if this plugin is known to be installed, and has an update awaiting it.
     430    $update_plugins = get_site_transient('update_plugins');
     431    if ( is_object( $update_plugins ) ) {
     432        foreach ( (array)$update_plugins->response as $file => $plugin ) {
     433            if ( $plugin->slug === $api->slug ) {
     434                $status = 'update_available';
     435                $update_file = $file;
     436                $version = $plugin->new_version;
     437                if ( current_user_can('update_plugins') )
     438                    $url = wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file);
     439                break;
     440            }
     441        }
     442    }
     443
     444    if ( 'install' == $status ) {
     445        if ( is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
     446            $installed_plugin = get_plugins('/' . $api->slug);
     447            if ( empty($installed_plugin) ) {
     448                if ( current_user_can('install_plugins') )
     449                    $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
     450            } else {
     451                $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
     452                if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
     453                    $status = 'latest_installed';
     454                } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
     455                    $status = 'newer_installed';
     456                    $version = $installed_plugin[ $key ]['Version'];
     457                } else {
     458                    //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
     459                    if ( ! $loop ) {
     460                        delete_site_transient('update_plugins');
     461                        wp_update_plugins();
     462                        return install_plugin_install_status($api, true);
     463                    }
     464                }
     465            }
     466        } else {
     467            // "install" & no directory with that slug
     468            if ( current_user_can('install_plugins') )
     469                $url = wp_nonce_url(admin_url('update.php?action=install-plugin&plugin=' . $api->slug), 'install-plugin_' . $api->slug);
     470        }
     471    }
     472
     473    return compact('status', 'url', 'version');
     474}
     475
     476/**
    397477 * Display plugin information in dialog box form.
    398478 *
     
    441521    ?>
    442522    <div class="alignright fyi">
    443         <?php if ( ! empty($api->download_link) ) : ?>
     523        <?php if ( ! empty($api->download_link) && ( current_user_can('install_plugins') || current_user_can('update_plugins') ) ) : ?>
    444524        <p class="action-button">
    445525        <?php
    446             //Default to a "new" plugin
    447             $type = 'install';
    448             //Check to see if this plugin is known to be installed, and has an update awaiting it.
    449             $update_plugins = get_site_transient('update_plugins');
    450             if ( is_object( $update_plugins ) ) {
    451                 foreach ( (array)$update_plugins->response as $file => $plugin ) {
    452                     if ( $plugin->slug === $api->slug ) {
    453                         $type = 'update_available';
    454                         $update_file = $file;
    455                         break;
    456                     }
    457                 }
    458             }
    459             if ( 'install' == $type && is_dir( WP_PLUGIN_DIR  . '/' . $api->slug ) ) {
    460                 $installed_plugin = get_plugins('/' . $api->slug);
    461                 if ( ! empty($installed_plugin) ) {
    462                     $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
    463                     if ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '=') ){
    464                         $type = 'latest_installed';
    465                     } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
    466                         $type = 'newer_installed';
    467                         $newer_version = $installed_plugin[ $key ]['Version'];
    468                     } else {
    469                         //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
    470                         delete_site_transient('update_plugins');
    471                         $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
    472                         $type = 'update_available';
    473                     }
    474                 }
    475             }
    476 
    477             switch ( $type ) :
    478                 default:
    479                 case 'install':
    480                     if ( current_user_can('install_plugins') ) :
    481                 ?><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
    482                     endif;
     526        $status = install_plugin_install_status($api);
     527        switch ( $status['status'] ) {
     528            case 'install':
     529                if ( $url )
     530                    echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Now') . '</a>';
    483531                break;
    484                 case 'update_available':
    485                     if ( current_user_can('update_plugins') ) :
    486                         ?><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
    487                     endif;
     532            case 'update_available':
     533                if ( $url )
     534                    echo '<a href="' . $status['url'] . '" target="_parent">' . __('Install Update Now') .'</a>';
    488535                break;
    489                 case 'newer_installed':
    490                     if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
    491                     ?><a><?php printf(__('Newer Version (%s) Installed'), $newer_version) ?></a><?php
    492                     endif;
     536            case 'newer_installed':
     537                echo '<a>' . sprintf(__('Newer Version (%s) Installed'), $status['version']) . '</a>';
    493538                break;
    494                 case 'latest_installed':
    495                     if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
    496                     ?><a><?php _e('Latest Version Installed') ?></a><?php
    497                     endif;
     539            case 'latest_installed':
     540                echo '<a>' . __('Latest Version Installed') . '</a>';
    498541                break;
    499             endswitch; ?>
     542        }
     543        ?>
    500544        </p>
    501545        <?php endif; ?>
  • trunk/wp-includes/script-loader.php

    r13919 r13920  
    473473    $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20090514' );
    474474    $styles->add( 'login', "/wp-admin/css/login$suffix.css", array(), '20100326' );
    475     $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100228' );
     475    $styles->add( 'plugin-install', "/wp-admin/css/plugin-install$suffix.css", array(), '20100402' );
    476476    $styles->add( 'theme-install', "/wp-admin/css/theme-install$suffix.css", array(), '20090610' );
    477477    $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
Note: See TracChangeset for help on using the changeset viewer.