-function display_themes($themes, $page = 1, $totalpages = 1) {
- $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
- $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
- ?>
-<div class="tablenav">
-<div class="alignleft actions"><?php do_action('install_themes_table_header'); ?></div>
- <?php
- $url = esc_url($_SERVER['REQUEST_URI']);
- if ( ! empty($term) )
- $url = add_query_arg('s', $term, $url);
- if ( ! empty($type) )
- $url = add_query_arg('type', $type, $url);
-
- $page_links = paginate_links( array(
- 'base' => add_query_arg('paged', '%#%', $url),
- 'format' => '',
- 'prev_text' => __('«'),
- 'next_text' => __('»'),
- 'total' => $totalpages,
- 'current' => $page
- ));
-
- if ( $page_links )
- echo "\t\t<div class='tablenav-pages'>$page_links</div>";
- ?>
-</div>
-<br class="clear" />
-<?php
- if ( empty($themes) ) {
- _e('No themes found');
- return;
- }
-?>
-<table id="availablethemes" cellspacing="0" cellpadding="0">
-<?php
- $rows = ceil(count($themes) / 3);
- $table = array();
- $theme_keys = array_keys($themes);
- for ( $row = 1; $row <= $rows; $row++ )
- for ( $col = 1; $col <= 3; $col++ )
- $table[$row][$col] = array_shift($theme_keys);
-
- foreach ( $table as $row => $cols ) {
- ?>
- <tr>
- <?php
-
- foreach ( $cols as $col => $theme_index ) {
- $class = array('available-theme');
- if ( $row == 1 ) $class[] = 'top';
- if ( $col == 1 ) $class[] = 'left';
- if ( $row == $rows ) $class[] = 'bottom';
- if ( $col == 3 ) $class[] = 'right';
- ?>
- <td class="<?php echo join(' ', $class); ?>"><?php
- if ( isset($themes[$theme_index]) )
- display_theme($themes[$theme_index]);
- ?></td>
- <?php } // end foreach $cols ?>
- </tr>
- <?php } // end foreach $table ?>
-</table>
-
-<div class="tablenav"><?php if ( $page_links )
-echo "\t\t<div class='tablenav-pages'>$page_links</div>"; ?> <br
- class="clear" />
-</div>