Ticket #5625: wp-admin_plugins.php.diff
File wp-admin_plugins.php.diff, 2.9 KB (added by , 17 years ago) |
---|
-
plugins.php
27 27 check_admin_referer('reactivate-all'); 28 28 reactivate_all_plugins('plugins.php?errors=true'); 29 29 wp_redirect('plugins.php?reactivate-all=true'); // overrides the ?error=true one above 30 } elseif ( 'uninstall' == $_GET['action'] ) { 31 check_admin_referer('uninstall-plugin_' . $_GET['plugin']); 32 $current = get_option('active_plugins'); 33 $plugin = trim($_GET['plugin']); 34 if ( validate_file($plugin) ) 35 wp_die(__('Invalid plugin.')); 36 if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) ) 37 wp_die(__('Plugin file does not exist.')); 38 if ( !in_array($plugin, $current ) && is_plugin_uninstallable( $plugin ) ) { 39 $plugin_assets = get_plugin_assets( $plugin ); 40 //check for a callback function 41 if ( $plugin_assets['callback'] != NULL ) { 42 //include the plugin file 43 include_once( ABSPATH . PLUGINDIR . '/' . $plugin ); 44 //create and call the action 45 add_action( 'uninstall_plugin_' . $plugin , $plugin_assets['callback'] ); 46 do_action( 'uninstall_plugin_' . $plugin ); 47 } 48 if ( !delete_plugin_assets( $plugin ) ) { 49 wp_redirect('plugins.php?uninstalled=false'); 50 } 51 } 52 wp_redirect('plugins.php?uninstalled=true'); 30 53 } 31 54 32 55 exit; … … 59 82 <div id="message" class="updated fade"><p><?php _e('All plugins <strong>deactivated</strong>.'); ?></p></div> 60 83 <?php elseif (isset($_GET['reactivate-all'])) : ?> 61 84 <div id="message" class="updated fade"><p><?php _e('All plugins <strong>reactivated</strong>.'); ?></p></div> 85 <?php elseif (isset($_GET['uninstalled']) && $_GET['uninstalled'] == 'true') : ?> 86 <div id="message" class="updated fade"><p><?php _e('Plugin <strong>uninstalled</strong>.'); ?></p></div> 87 <?php elseif (isset($_GET['uninstalled']) && $_GET['uninstalled'] != 'true') : ?> 88 <div id="message" class="updated fade"> 89 <p><?php _e('The plugin could not be completely uninstalled. Some database tables, options or files may still exist.'); ?></p> 90 </div> 62 91 <?php endif; ?> 63 92 64 93 <div class="wrap"> … … 128 157 <td>$edit</td>"; 129 158 echo" 130 159 </tr>"; 160 161 if ( is_plugin_uninstallable( $plugin_file ) && (empty( $current_plugins ) || !in_array($plugin_file, $current_plugins) ) ) { 162 $plugin_data = get_plugin_data( ABSPATH . PLUGINDIR . '/' . $plugin_file ); 163 $toggle = "<a href='" . wp_nonce_url("plugins.php?action=uninstall&plugin=$plugin_file", 'uninstall-plugin_' . $plugin_file) . "' title='".__('Uninstall this plugin')."' class='delete'><strong>".__("Uninstall all the options and settings (including database tables ) relating to ").$plugin_data['Name']."</strong></a>"; 164 ?> 165 <tr> 166 <td colspan="5" style="border-top:1px solid #ccc; border-bottom:1px solid #ccc; background-color:#F9B7E0"><?php echo $toggle; ?></td> 167 </tr> 168 <?php 169 } 170 171 172 131 173 do_action( 'after_plugin_row', $plugin_file ); 132 174 } 133 175 ?>