- if ( empty($plugins) ) {
- echo '<tr>
- <td colspan="3">' . __('No plugins to show') . '</td>
- </tr>';
- }
- foreach ( (array)$plugins as $plugin_file => $plugin_data) {
- // preorder
- $actions = array(
- 'network_deactivate' => '', 'deactivate' => '',
- 'network_only' => '', 'activate' => '',
- 'network_activate' => '',
- 'edit' => '',
- 'delete' => '',
- );
-
- if ( 'mustuse' == $context ) {
- $is_active = true;
- } elseif ( 'dropins' == $context ) {
- $dropins = _get_dropins();
- $plugin_name = $plugin_file;
- if ( $plugin_file != $plugin_data['Name'] )
- $plugin_name .= '<br/>' . $plugin_data['Name'];
- if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant
- $is_active = true;
- $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
- } elseif ( constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true
- $is_active = true;
- $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>';
- } else {
- $is_active = false;
- $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>';
- }
- if ( $plugin_data['Description'] )
- $description .= '<p>' . $plugin_data['Description'] . '</p>';
- } else {
- $is_active_for_network = is_plugin_active_for_network($plugin_file);
- $is_active = $is_active_for_network || is_plugin_active( $plugin_file );
- if ( $is_active_for_network && !is_super_admin() )
- continue;
-
- if ( $is_active ) {
- if ( $is_active_for_network ) {
- if ( is_super_admin() )
- $actions['network_deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&networkwide=1&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>';
- } else {
- $actions['deactivate'] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '">' . __('Deactivate') . '</a>';
- }
- } else {
- if ( is_multisite() && is_network_only_plugin( $plugin_file ) )
- $actions['network_only'] = '<span title="' . __('This plugin can only be activated for all sites in a network') . '">' . __('Network Only') . '</span>';
- else
- $actions['activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>';
-
- if ( is_multisite() && current_user_can( 'manage_network_plugins' ) )
- $actions['network_activate'] = '<a href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>';
-
- if ( current_user_can('delete_plugins') )
- $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page, 'bulk-manage-plugins') . '" title="' . __('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>';
- } // end if $is_active
-
- if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
- $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
- } // end if $context
-
- $actions = apply_filters( 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
- $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
-
- $class = $is_active ? 'active' : 'inactive';
- $checkbox = in_array( $context, array( 'mustuse', 'dropins' ) ) ? '' : "<input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' />";
- if ( 'dropins' != $context ) {
- $description = '<p>' . $plugin_data['Description'] . '</p>';
- $plugin_name = $plugin_data['Name'];
- }
- echo "
- <tr class='$class'>
- <th scope='row' class='check-column'>$checkbox</th>
- <td class='plugin-title'><strong>$plugin_name</strong></td>
- <td class='desc'>$description</td>
- </tr>
- <tr class='$class second'>
- <td></td>
- <td class='plugin-title'>";
- echo '<div class="row-actions-visible">';
- foreach ( $actions as $action => $link ) {
- $sep = end($actions) == $link ? '' : ' | ';
- echo "<span class='$action'>$link$sep</span>";
- }
- echo "</div></td>
- <td class='desc'>";
- $plugin_meta = array();
- if ( !empty($plugin_data['Version']) )
- $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']);
- if ( !empty($plugin_data['Author']) ) {
- $author = $plugin_data['Author'];
- if ( !empty($plugin_data['AuthorURI']) )
- $author = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
- $plugin_meta[] = sprintf( __('By %s'), $author );
- }
- if ( ! empty($plugin_data['PluginURI']) )
- $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __('Visit plugin site') . '</a>';
-
- $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context);
- echo implode(' | ', $plugin_meta);
- echo "</td>
- </tr>\n";
-
- do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
- do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
- }
-?>
- </tbody>
-</table>
-<?php
-} //End print_plugins_table()
-
-/**
- * @ignore
- *
- * @param string $context
- */
-function print_plugin_actions($context, $field_name = 'action' ) {
- if ( in_array( $context, array( 'mustuse', 'dropins' ) ) )
- return;
-?>
- <div class="alignleft actions">
- <select name="<?php echo $field_name; ?>">
- <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
- <?php if ( 'active' != $context ) : ?>
- <option value="activate-selected"><?php _e('Activate'); ?></option>
- <?php endif; ?>
- <?php if ( is_multisite() && 'network' != $context ) : ?>
- <option value="network-activate-selected"><?php _e('Network Activate'); ?></option>
- <?php endif; ?>
- <?php if ( 'inactive' != $context && 'recent' != $context ) : ?>
- <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
- <?php endif; ?>
- <?php if ( current_user_can( 'update_plugins' ) ) : ?>
- <option value="update-selected"><?php _e( 'Upgrade' ); ?></option>
- <?php endif; ?>
- <?php if ( current_user_can('delete_plugins') && ( 'active' != $context ) ) : ?>
- <option value="delete-selected"><?php _e('Delete'); ?></option>
- <?php endif; ?>
- </select>
- <input type="submit" name="doaction_active" value="<?php esc_attr_e('Apply'); ?>" class="button-secondary action" />
- <?php if ( 'recent' == $context ) : ?>
- <input type="submit" name="clear-recent-list" value="<?php esc_attr_e('Clear List') ?>" class="button-secondary" />
- <?php endif; ?>
- </div>
-<?php
-}
-?>