Make WordPress Core

Changeset 14986


Ignore:
Timestamp:
05/27/2010 11:23:07 AM (14 years ago)
Author:
dd32
Message:

Change Install link to Activate link in Importer if plugin appears to be already installed. See #13566

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import.php

    r14985 r14986  
    9595    foreach ($importers as $id => $data) {
    9696        $style = ('class="alternate"' == $style || 'class="alternate active"' == $style) ? '' : 'alternate';
     97        $action = '';
    9798        if ( 'install' == $data[2] ) {
    9899            $plugin_slug = $id . '-importer';
    99             $action = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin_slug .
    100                                     '&amp;from=import&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' .
    101                                     esc_attr__('Install importer') . '">' . $data[0] . '</a>';
     100            if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
     101                // Looks like Importer is installed, But not active
     102                $plugins = get_plugins( '/' . $plugin_slug );
     103                if ( !empty($plugins) ) {
     104                    $keys = array_keys($plugins);
     105                    $plugin_file = $plugin_slug . '/' . $keys[0];
     106                    $action = '<a href="' . wp_nonce_url(admin_url('plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;from=import'), 'activate-plugin_' . $plugin_file) .
     107                                            '"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>';
     108                }
     109            }
     110            if ( empty($action) )
     111                $action = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin_slug .
     112                                        '&amp;from=import&amp;TB_iframe=true&amp;width=600&amp;height=550') . '" class="thickbox" title="' .
     113                                        esc_attr__('Install importer') . '">' . $data[0] . '</a>';
    102114        } else {
    103115            $action = "<a href='" . esc_url("admin.php?import=$id") . "' title='" . esc_attr( wptexturize(strip_tags($data[1])) ) ."'>{$data[0]}</a>";
Note: See TracChangeset for help on using the changeset viewer.