Changeset 15491 for trunk/wp-admin/themes.php
- Timestamp:
- 08/11/2010 09:54:51 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/themes.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/themes.php
r15135 r15491 28 28 } 29 29 } 30 31 require_once( './includes/default-list-tables.php' ); 32 33 $table = new WP_Themes_Table; 30 34 31 35 $title = __('Manage Themes'); … … 66 70 <div id="message3" class="updated"><p><?php _e('Theme deleted.') ?></p></div> 67 71 <?php endif; ?> 68 <?php69 $themes = get_allowed_themes();70 $ct = current_theme_info();71 unset($themes[$ct->name]);72 73 uksort( $themes, "strnatcasecmp" );74 $theme_total = count( $themes );75 $per_page = 15;76 77 if ( isset( $_GET['pagenum'] ) )78 $page = absint( $_GET['pagenum'] );79 80 if ( empty($page) )81 $page = 1;82 83 $start = $offset = ( $page - 1 ) * $per_page;84 85 $page_links = paginate_links( array(86 'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',87 'format' => '',88 'prev_text' => __('«'),89 'next_text' => __('»'),90 'total' => ceil($theme_total / $per_page),91 'current' => $page92 ));93 94 $themes = array_slice( $themes, $start, $per_page );95 ?>96 72 97 73 <div class="wrap"> … … 120 96 </div> 121 97 122 < div class="clear"></div>98 <br class="clear"> 123 99 <?php 124 100 if ( ! current_user_can( 'switch_themes' ) ) { … … 129 105 ?> 130 106 <h3><?php _e('Available Themes'); ?></h3> 131 <div class="clear"></div>132 107 133 <?php if ( $theme_total ) { ?> 134 135 <?php if ( $page_links ) : ?> 136 <div class="tablenav"> 137 <div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 138 number_format_i18n( $start + 1 ), 139 number_format_i18n( min( $page * $per_page, $theme_total ) ), 140 number_format_i18n( $theme_total ), 141 $page_links 142 ); echo $page_links_text; ?></div> 143 </div> 144 <?php endif; ?> 145 146 <table id="availablethemes" cellspacing="0" cellpadding="0"> 147 <?php 148 $style = ''; 149 150 $theme_names = array_keys($themes); 151 natcasesort($theme_names); 152 153 $table = array(); 154 $rows = ceil(count($theme_names) / 3); 155 for ( $row = 1; $row <= $rows; $row++ ) 156 for ( $col = 1; $col <= 3; $col++ ) 157 $table[$row][$col] = array_shift($theme_names); 158 159 foreach ( $table as $row => $cols ) { 160 ?> 161 <tr> 162 <?php 163 foreach ( $cols as $col => $theme_name ) { 164 $class = array('available-theme'); 165 if ( $row == 1 ) $class[] = 'top'; 166 if ( $col == 1 ) $class[] = 'left'; 167 if ( $row == $rows ) $class[] = 'bottom'; 168 if ( $col == 3 ) $class[] = 'right'; 169 ?> 170 <td class="<?php echo join(' ', $class); ?>"> 171 <?php if ( !empty($theme_name) ) : 172 $template = $themes[$theme_name]['Template']; 173 $stylesheet = $themes[$theme_name]['Stylesheet']; 174 $title = $themes[$theme_name]['Title']; 175 $version = $themes[$theme_name]['Version']; 176 $description = $themes[$theme_name]['Description']; 177 $author = $themes[$theme_name]['Author']; 178 $screenshot = $themes[$theme_name]['Screenshot']; 179 $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; 180 $template_dir = $themes[$theme_name]['Template Dir']; 181 $parent_theme = $themes[$theme_name]['Parent Theme']; 182 $theme_root = $themes[$theme_name]['Theme Root']; 183 $theme_root_uri = $themes[$theme_name]['Theme Root URI']; 184 $preview_link = esc_url(get_option('home') . '/'); 185 if ( is_ssl() ) 186 $preview_link = str_replace( 'http://', 'https://', $preview_link ); 187 $preview_link = htmlspecialchars( add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true' ), $preview_link ) ); 188 $preview_text = esc_attr( sprintf( __('Preview of “%s”'), $title ) ); 189 $tags = $themes[$theme_name]['Tags']; 190 $thickbox_class = 'thickbox thickbox-preview'; 191 $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); 192 $activate_text = esc_attr( sprintf( __('Activate “%s”'), $title ) ); 193 $actions = array(); 194 $actions[] = '<a href="' . $activate_link . '" class="activatelink" title="' . $activate_text . '">' . __('Activate') . '</a>'; 195 $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview" title="' . esc_attr(sprintf(__('Preview “%s”'), $theme_name)) . '">' . __('Preview') . '</a>'; 196 if ( current_user_can('delete_themes') ) 197 $actions[] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "return confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n 'Cancel' to stop, 'OK' to delete."), $theme_name )) . "');" . '">' . __('Delete') . '</a>'; 198 $actions = apply_filters('theme_action_links', $actions, $themes[$theme_name]); 199 200 $actions = implode ( ' | ', $actions ); 201 ?> 202 <a href="<?php echo $preview_link; ?>" class="<?php echo $thickbox_class; ?> screenshot"> 203 <?php if ( $screenshot ) : ?> 204 <img src="<?php echo $theme_root_uri . '/' . $stylesheet . '/' . $screenshot; ?>" alt="" /> 205 <?php endif; ?> 206 </a> 207 <h3><?php 208 /* translators: 1: theme title, 2: theme version, 3: theme author */ 209 printf(__('%1$s %2$s by %3$s'), $title, $version, $author) ; ?></h3> 210 <p class="description"><?php echo $description; ?></p> 211 <span class='action-links'><?php echo $actions ?></span> 212 <?php if ( current_user_can('edit_themes') && $parent_theme ) { 213 /* translators: 1: theme title, 2: template dir, 3: stylesheet_dir, 4: theme title, 5: parent_theme */ ?> 214 <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.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ), $title, $parent_theme); ?></p> 215 <?php } else { ?> 216 <p><?php printf(__('All of this theme’s files are located in <code>%2$s</code>.'), $title, str_replace( WP_CONTENT_DIR, '', $template_dir ), str_replace( WP_CONTENT_DIR, '', $stylesheet_dir ) ); ?></p> 217 <?php } ?> 218 <?php if ( $tags ) : ?> 219 <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p> 220 <?php endif; ?> 221 <?php theme_update_available( $themes[$theme_name] ); ?> 222 <?php endif; // end if not empty theme_name ?> 223 </td> 224 <?php } // end foreach $cols ?> 225 </tr> 226 <?php } // end foreach $table ?> 227 </table> 228 <?php } else { ?> 229 <p><?php 230 if ( current_user_can('install_themes') ) 231 printf(__('You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress.org Theme Directory at any time: just click on the <em><a href="%s">Install Themes</a></em> tab above.'), 'theme-install.php'); 232 else 233 printf(__('Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.'), get_site_option('site_name')); 234 ?></p> 235 <?php } // end if $theme_total?> 236 <br class="clear" /> 237 238 <?php if ( $page_links ) : ?> 239 <div class="tablenav"> 240 <?php echo "<div class='tablenav-pages'>$page_links_text</div>"; ?> 241 <br class="clear" /> 242 </div> 243 <?php endif; ?> 108 <?php $table->display(); ?> 244 109 245 110 <br class="clear" />
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)