10 class WP_Themes_List_Table extends WP_List_Table { |
10 class WP_Themes_List_Table extends WP_List_Table { |
11 |
11 |
12 protected $search_terms = array(); |
12 protected $search_terms = array(); |
13 var $features = array(); |
13 var $features = array(); |
14 |
14 |
15 function __construct() { |
15 function __construct( $args = array() ) { |
16 parent::__construct( array( |
16 parent::__construct( array( |
17 'ajax' => true, |
17 'ajax' => true, |
|
18 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
18 ) ); |
19 ) ); |
19 } |
20 } |
20 |
21 |
21 function ajax_user_can() { |
22 function ajax_user_can() { |
22 // Do not check edit_theme_options here. AJAX calls for available themes require switch_themes. |
23 // Do not check edit_theme_options here. AJAX calls for available themes require switch_themes. |
40 } |
41 } |
41 |
42 |
42 unset( $themes[ get_option( 'stylesheet' ) ] ); |
43 unset( $themes[ get_option( 'stylesheet' ) ] ); |
43 WP_Theme::sort_by_name( $themes ); |
44 WP_Theme::sort_by_name( $themes ); |
44 |
45 |
45 $per_page = 999; |
46 $per_page = 36; |
46 $page = $this->get_pagenum(); |
47 $page = $this->get_pagenum(); |
47 |
48 |
48 $start = ( $page - 1 ) * $per_page; |
49 $start = ( $page - 1 ) * $per_page; |
49 |
50 |
50 $this->items = array_slice( $themes, $start, $per_page, true ); |
51 $this->items = array_slice( $themes, $start, $per_page, true ); |
141 if ( current_user_can( 'edit_theme_options' ) ) |
142 if ( current_user_can( 'edit_theme_options' ) ) |
142 $actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">' |
143 $actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">' |
143 . __( 'Live Preview' ) . '</a>'; |
144 . __( 'Live Preview' ) . '</a>'; |
144 |
145 |
145 if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) |
146 if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) |
146 $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( "themes.php?action=delete&stylesheet=$stylesheet", 'delete-theme_' . $stylesheet ) |
147 $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet ) |
147 . '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) ) |
148 . '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete." ), $title ) ) |
148 . "' );" . '">' . __( 'Delete' ) . '</a>'; |
149 . "' );" . '">' . __( 'Delete' ) . '</a>'; |
149 |
150 |
150 $actions = apply_filters( 'theme_action_links', $actions, $theme ); |
151 $actions = apply_filters( 'theme_action_links', $actions, $theme ); |
151 $delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : ''; |
152 $delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : ''; |
169 <div class="action-links"> |
170 <div class="action-links"> |
170 <ul> |
171 <ul> |
171 <?php foreach ( $actions as $action ): ?> |
172 <?php foreach ( $actions as $action ): ?> |
172 <li><?php echo $action; ?></li> |
173 <li><?php echo $action; ?></li> |
173 <?php endforeach; ?> |
174 <?php endforeach; ?> |
174 <li class="hide-if-no-js"><a href="#" class="theme-detail" tabindex='4'><?php _e('Details') ?></a></li> |
175 <li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details') ?></a></li> |
175 </ul> |
176 </ul> |
176 <?php echo $delete_action; ?> |
177 <?php echo $delete_action; ?> |
177 |
178 |
178 <?php theme_update_available( $theme ); ?> |
179 <?php theme_update_available( $theme ); ?> |
179 </div> |
180 </div> |
180 |
181 |
181 <div class="themedetaildiv hide-if-js"> |
182 <div class="themedetaildiv hide-if-js"> |
182 <p><strong><?php _e('Version: '); ?></strong><?php echo $version; ?></p> |
183 <p><strong><?php _e('Version: '); ?></strong><?php echo $version; ?></p> |
183 <p><?php echo $theme->display('Description'); ?></p> |
184 <p><?php echo $theme->display('Description'); ?></p> |
184 <?php if ( current_user_can( 'edit_themes' ) && $theme->parent() ) : |
185 <?php if ( $theme->parent() ) { |
185 /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?> |
186 printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>', |
186 <p><?php printf( __( 'The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.' ), |
187 __( 'http://codex.wordpress.org/Child_Themes' ), |
187 $title, str_replace( WP_CONTENT_DIR, '', $theme->get_template_directory() ), str_replace( WP_CONTENT_DIR, '', $theme->get_stylesheet_directory() ), $title, $theme->parent()->display('Name') ); ?></p> |
188 $theme->parent()->display( 'Name' ) ); |
188 <?php else : |
189 } ?> |
189 /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir */ ?> |
|
190 <p><?php printf( __( 'All of this theme’s files are located in <code>%2$s</code>.' ), |
|
191 $title, str_replace( WP_CONTENT_DIR, '', $theme->get_template_directory() ), str_replace( WP_CONTENT_DIR, '', $theme->get_stylesheet_directory() ) ); ?></p> |
|
192 <?php endif; ?> |
|
193 </div> |
190 </div> |
194 |
191 |
195 </div> |
192 </div> |
196 <?php |
193 <?php |
197 endforeach; |
194 endforeach; |