Ticket #5660: 5660.2.diff
| File 5660.2.diff, 3.8 KB (added by , 18 years ago) |
|---|
-
wp-admin/plugins.php
70 70 <p><?php _e('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.'); ?></p> 71 71 <?php 72 72 73 if ( get_option('active_plugins') )74 $current_plugins = get_option('active_plugins');75 76 73 $plugins = get_plugins(); 77 74 78 75 if (empty($plugins)) { … … 114 111 </thead> 115 112 <tbody id="plugins"> 116 113 <?php 117 $style = '';118 119 114 foreach($plugins as $plugin_file => $plugin_data) { 120 $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate'; 115 $action_links = array(); 116 117 $style = ''; 121 118 122 if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) { 123 $toggle = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>"; 124 $plugin_data['Title'] = "<strong>{$plugin_data['Title']}</strong>"; 125 $style .= $style == 'alternate' ? ' active' : 'active'; 119 if( is_plugin_active($plugin_file) ) { 120 $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=deactivate&plugin=$plugin_file", 'deactivate-plugin_' . $plugin_file) . "' title='".__('Deactivate this plugin')."' class='delete'>".__('Deactivate')."</a>"; 121 $style = 'active'; 126 122 } else { 127 $ toggle= "<a href='" . wp_nonce_url("plugins.php?action=activate&plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>";123 $action_links[] = "<a href='" . wp_nonce_url("plugins.php?action=activate&plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>"; 128 124 } 125 if ( current_user_can('edit_plugins') && is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) ) 126 $action_links[] = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>"; 129 127 130 128 $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); 131 129 … … 134 132 $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags); 135 133 $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags); 136 134 $plugin_data['Author'] = wp_kses($plugin_data['Author'], $plugins_allowedtags); 135 $author = ( empty($plugin_data['Author']) ) ? '' : ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>'; 137 136 138 137 if ( $style != '' ) 139 $style = 'class="' . $style . '"'; 140 if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) ) 141 $edit = " | <a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>"; 142 else 143 $edit = ''; 138 $style = ' class="' . $style . '"'; 144 139 145 $a uthor = ( empty($plugin_data['Author']) ) ? '' : ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';140 $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_info); 146 141 147 142 echo " 148 <tr $style>143 <tr$style> 149 144 <td class='name'>{$plugin_data['Title']}</td> 150 145 <td class='vers'>{$plugin_data['Version']}</td> 151 146 <td class='desc'><p>{$plugin_data['Description']}$author</p></td> 152 147 <td class='togl action-links'>$toggle"; 153 if ( current_user_can('edit_plugins') ) echo $edit; 148 if ( !empty($action_links) ) 149 echo implode(' | ', $action_links); 154 150 echo "</td> 155 151 </tr>"; 156 152 do_action( 'after_plugin_row', $plugin_file );