Make WordPress Core

Ticket #18198: 18198.class-wp-theme-install-list-table.diff

File 18198.class-wp-theme-install-list-table.diff, 5.1 KB (added by helenyhou, 15 years ago)

Modifications to the two list-table classes for theme screens

Line 
1Index: class-wp-theme-install-list-table.php
2===================================================================
3--- class-wp-theme-install-list-table.php (revision 18670)
4+++ class-wp-theme-install-list-table.php (working copy)
5@@ -22,7 +22,7 @@
6
7 $paged = $this->get_pagenum();
8
9- $per_page = 30;
10+ $per_page = 24;
11
12 // These are the tabs which are shown on the page,
13 $tabs = array();
14@@ -130,7 +130,7 @@
15
16 // wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
17 ?>
18- <div class="tablenav top">
19+ <div class="tablenav top themes">
20 <div class="alignleft actions">
21 <?php do_action( 'install_themes_table_header' ); ?>
22 </div>
23@@ -139,13 +139,11 @@
24 <br class="clear" />
25 </div>
26
27- <table id="availablethemes" cellspacing="0" cellpadding="0">
28- <tbody id="the-list" class="list:themes">
29- <?php $this->display_rows_or_placeholder(); ?>
30- </tbody>
31- </table>
32+ <div id="availablethemes">
33+ <?php $this->display_rows_or_placeholder(); ?>
34+ </div>
35
36- <div class="tablenav bottom">
37+ <div class="tablenav bottom themes">
38 <?php $this->pagination( 'bottom' ); ?>
39 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
40 <br class="clear" />
41@@ -155,30 +153,19 @@
42
43 function display_rows() {
44 $themes = $this->items;
45-
46- $rows = ceil( count( $themes ) / 3 );
47- $table = array();
48 $theme_keys = array_keys( $themes );
49- for ( $row = 1; $row <= $rows; $row++ )
50- for ( $col = 1; $col <= 3; $col++ )
51- $table[$row][$col] = array_shift( $theme_keys );
52
53- foreach ( $table as $row => $cols ) {
54- echo "\t<tr>\n";
55- foreach ( $cols as $col => $theme_index ) {
56+ foreach ( $theme_keys as $theme_key ) {
57 $class = array( 'available-theme' );
58- if ( $row == 1 ) $class[] = 'top';
59- if ( $col == 1 ) $class[] = 'left';
60- if ( $row == $rows ) $class[] = 'bottom';
61- if ( $col == 3 ) $class[] = 'right';
62 ?>
63- <td class="<?php echo join( ' ', $class ); ?>"><?php
64- if ( isset( $themes[$theme_index] ) )
65- display_theme( $themes[$theme_index] );
66- ?></td>
67- <?php } // end foreach $cols
68- echo "\t</tr>\n";
69- } // end foreach $table
70+ <div class="<?php echo join( ' ', $class ); ?>"><?php
71+ if ( isset( $themes[$theme_key] ) )
72+ display_theme( $themes[$theme_key] );
73+ ?></div>
74+ <?php } // end foreach $theme_keys
75+?>
76+ <br class="clear" />
77+<?php
78 }
79 }
80Index: class-wp-themes-list-table.php
81===================================================================
82--- class-wp-themes-list-table.php (revision 18670)
83+++ class-wp-themes-list-table.php (working copy)
84@@ -47,7 +47,7 @@
85 unset( $themes[$ct->name] );
86 uksort( $themes, "strnatcasecmp" );
87
88- $per_page = 15;
89+ $per_page = 24;
90 $page = $this->get_pagenum();
91
92 $start = ( $page - 1 ) * $per_page;
93@@ -92,7 +92,7 @@
94 if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
95 return;
96 ?>
97- <div class="tablenav <?php echo $which; ?>">
98+ <div class="tablenav themes <?php echo $which; ?>">
99 <?php $this->pagination( $which ); ?>
100 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
101 <br class="clear" />
102@@ -105,11 +105,9 @@
103 ?>
104 <?php $this->tablenav( 'top' ); ?>
105
106- <table id="availablethemes" cellspacing="0" cellpadding="0">
107- <tbody id="the-list" class="list:themes">
108- <?php $this->display_rows_or_placeholder(); ?>
109- </tbody>
110- </table>
111+ <div id="availablethemes">
112+ <?php $this->display_rows_or_placeholder(); ?>
113+ </div>
114
115 <?php $this->tablenav( 'bottom' ); ?>
116 <?php
117@@ -120,29 +118,15 @@
118 }
119
120 function display_rows() {
121- $themes = $this->items;
122+ $themes = $this->items;
123 $theme_names = array_keys( $themes );
124 natcasesort( $theme_names );
125
126- $table = array();
127- $rows = ceil( count( $theme_names ) / 3 );
128- for ( $row = 1; $row <= $rows; $row++ )
129- for ( $col = 1; $col <= 3; $col++ )
130- $table[$row][$col] = array_shift( $theme_names );
131-
132- foreach ( $table as $row => $cols ) {
133-?>
134-<tr>
135-<?php
136-foreach ( $cols as $col => $theme_name ) {
137- $class = array( 'available-theme' );
138- if ( $row == 1 ) $class[] = 'top';
139- if ( $col == 1 ) $class[] = 'left';
140- if ( $row == $rows ) $class[] = 'bottom';
141- if ( $col == 3 ) $class[] = 'right';
142-?>
143- <td class="<?php echo join( ' ', $class ); ?>">
144-<?php if ( !empty( $theme_name ) ) :
145+ foreach ( $theme_names as $theme_name ) {
146+ $class = array( 'available-theme' );
147+ ?>
148+ <div class="<?php echo join( ' ', $class ); ?>">
149+ <?php if ( !empty( $theme_name ) ) :
150 $template = $themes[$theme_name]['Template'];
151 $stylesheet = $themes[$theme_name]['Stylesheet'];
152 $title = $themes[$theme_name]['Title'];
153@@ -194,10 +178,10 @@
154 <?php endif; ?>
155 <?php theme_update_available( $themes[$theme_name] ); ?>
156 <?php endif; // end if not empty theme_name ?>
157- </td>
158-<?php } // end foreach $cols ?>
159-</tr>
160-<?php } // end foreach $table
161+ </div>
162+<?php } // end foreach $theme_names ?>
163+<br class="clear" />
164+<?php
165 }
166
167 function search_theme( $theme ) {
168@@ -237,4 +221,4 @@
169 }
170 }
171
172-?>
173+?>
174\ No newline at end of file