Make WordPress Core

Ticket #11850: plugins.diff

File plugins.diff, 2.3 KB (added by cyberhobo, 15 years ago)

Patch freshened for r13230.

  • wp-admin/plugins.php

     
    224224                                        foreach ( (array) $plugins as $plugin ) {
    225225                                                if ( '.' == dirname($plugin) ) {
    226226                                                        $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
    227                                                         if ( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
     227                                                        if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) ) {
    228228                                                                $plugin_info[ $plugin ] = $data;
     229                                                                $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
     230                                                        }
    229231                                                } else {
    230232                                                        //Locate all the files in that folder:
    231233                                                        $files = list_files( WP_PLUGIN_DIR . '/' . dirname($plugin) );
     
    233235                                                                $files_to_delete = array_merge($files_to_delete, $files);
    234236                                                        }
    235237                                                        //Get plugins list from that folder
    236                                                         if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) )
    237                                                                 $plugin_info = array_merge($plugin_info, $folder_plugins);
     238                                                        if ( $folder_plugins = get_plugins( '/' . dirname($plugin)) ) {
     239                                                                foreach( $folder_plugins as $plugin_file => $data ) {
     240                                                                        $plugin_info[ $plugin_file ] = $data;
     241                                                                        $plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
     242                                                                }
     243                                                        }
    238244                                                }
    239245                                        }
    240246                                ?>
    241247                                <p><?php _e('Deleting the selected plugins will remove the following plugin(s) and their files:'); ?></p>
    242248                                        <ul class="ul-disc">
    243249                                                <?php
    244                                                 foreach ( $plugin_info as $plugin )
    245                                                         /* translators: 1: plugin name, 2: plugin author */
    246                                                         echo '<li>', sprintf(__('<strong>%1$s</strong> by <em>%2$s</em>'), $plugin['Name'], $plugin['Author']), '</li>';
     250                                                foreach ( $plugin_info as $plugin ) {
     251                                                        if ( $plugin['is_uninstallable'] )
     252                                                                /* translators: 1: plugin name, 2: plugin author */
     253                                                                echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em> (will also <strong>delete its data</strong>)'), $plugin['Name'], $plugin['Author']), '</li>';
     254                                                        else
     255                                                                /* translators: 1: plugin name, 2: plugin author */
     256                                                                echo '<li>', sprintf(__('<strong>%s</strong> by <em>%s</em>'), $plugin['Name'], $plugin['Author']), '</li>';
     257                                                }
    247258                                                ?>
    248259                                        </ul>
    249260                                <p><?php _e('Are you sure you wish to delete these files?') ?></p>