-<h2><?php echo esc_html( $title ); ?></h2>
-
-<?php
-
-$all_plugins = get_plugins();
-$search_plugins = array();
-$active_plugins = array();
-$inactive_plugins = array();
-$recent_plugins = array();
-$recently_activated = get_option('recently_activated', array());
-$upgrade_plugins = array();
-
-set_transient( 'plugin_slugs', array_keys($all_plugins), 86400 );
-
-// Clean out any plugins which were deactivated over a week ago.
-foreach ( $recently_activated as $key => $time )
- if ( $time + (7*24*60*60) < time() ) //1 week
- unset($recently_activated[ $key ]);
-if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
- update_option('recently_activated', $recently_activated);
-$current = get_transient( 'update_plugins' );
-
-foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
-
- //Translate, Apply Markup, Sanitize HTML
- $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true);
- $all_plugins[ $plugin_file ] = $plugin_data;
-
- //Filter into individual sections
- if ( is_plugin_active($plugin_file) ) {
- $active_plugins[ $plugin_file ] = $plugin_data;
- } else {
- if ( isset( $recently_activated[ $plugin_file ] ) ) // Was the plugin recently activated?
- $recent_plugins[ $plugin_file ] = $plugin_data;
- $inactive_plugins[ $plugin_file ] = $plugin_data;
- }
-
- if ( isset( $current->response[ $plugin_file ] ) )
- $upgrade_plugins[ $plugin_file ] = $plugin_data;
-}
-
-$total_all_plugins = count($all_plugins);
-$total_inactive_plugins = count($inactive_plugins);
-$total_active_plugins = count($active_plugins);
-$total_recent_plugins = count($recent_plugins);
-$total_upgrade_plugins = count($upgrade_plugins);
-
-//Searching.
-if ( isset($_GET['s']) ) {
- function _search_plugins_filter_callback($plugin) {
- static $term;
- if ( is_null($term) )
- $term = stripslashes($_GET['s']);
- if ( stripos($plugin['Name'], $term) !== false ||
- stripos($plugin['Description'], $term) !== false ||
- stripos($plugin['Author'], $term) !== false ||
- stripos($plugin['PluginURI'], $term) !== false ||
- stripos($plugin['AuthorURI'], $term) !== false ||
- stripos($plugin['Version'], $term) !== false )
- return true;
- else
- return false;
- }
- $status = 'search';
- $search_plugins = array_filter($all_plugins, '_search_plugins_filter_callback');
- $total_search_plugins = count($search_plugins);
-}
-
-$plugin_array_name = "${status}_plugins";
-if ( empty($$plugin_array_name) && $status != 'all' ) {
- $status = 'all';
- $plugin_array_name = "${status}_plugins";
-}
-
-$plugins = &$$plugin_array_name;
-
-//Paging.
-$total_this_page = "total_{$status}_plugins";
-$total_this_page = $$total_this_page;
-$plugins_per_page = get_user_option('plugins_per_page');
-if ( empty($plugins_per_page) )
- $plugins_per_page = 999;
-$plugins_per_page = apply_filters('plugins_per_page', $plugins_per_page);
-
-$start = ($page - 1) * $plugins_per_page;
-
-$page_links = paginate_links( array(
- 'base' => add_query_arg( 'paged', '%#%' ),
- 'format' => '',
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'total' => ceil($total_this_page / $plugins_per_page),
- 'current' => $page
-));
-$page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s',
- number_format_i18n( $start + 1 ),
- number_format_i18n( min( $page * $plugins_per_page, $total_this_page ) ),
- '<span class="total-type-count">' . number_format_i18n( $total_this_page ) . '</span>',
- $page_links
-);
-
-/**
- * @ignore
- *
- * @param array $plugins
- * @param string $context
- */
-function print_plugins_table($plugins, $context = '') {
- global $page;
-?>
-<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
- <thead>
- <tr>
- <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
- <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
- <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
- </tr>
- </thead>
-
- <tfoot>
- <tr>
- <th scope="col" class="manage-column check-column"><input type="checkbox" /></th>
- <th scope="col" class="manage-column"><?php _e('Plugin'); ?></th>
- <th scope="col" class="manage-column"><?php _e('Description'); ?></th>
- </tr>
- </tfoot>
-
- <tbody class="plugins">
-<?php
-
- if ( empty($plugins) ) {
- echo '<tr>
- <td colspan="3">' . __('No plugins to show') . '</td>
- </tr>';
- }
- foreach ( (array)$plugins as $plugin_file => $plugin_data) {
- $actions = array();
- $is_active = is_plugin_active($plugin_file);
-
- if ( $is_active )
- $actions[] = '<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
- $actions[] = '<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 ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )
- $actions[] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . __('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>';
-
- if ( ! $is_active && current_user_can('delete_plugins') )
- $actions[] = '<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>';
-
- $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
- $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
- $action_count = count($actions);
- $class = $is_active ? 'active' : 'inactive';
- echo "
- <tr class='$class'>
- <th scope='row' class='check-column'><input type='checkbox' name='checked[]' value='" . esc_attr($plugin_file) . "' /></th>
- <td class='plugin-title'><strong>{$plugin_data['Name']}</strong></td>
- <td class='desc'><p>{$plugin_data['Description']}</p></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>';