Changeset 7961 for trunk/wp-admin/themes.php
- Timestamp:
- 05/20/2008 05:19:33 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/themes.php
r7522 r7961 14 14 $title = __('Manage Themes'); 15 15 $parent_file = 'themes.php'; 16 17 add_thickbox(); 18 wp_enqueue_script( 'theme-preview' ); 19 16 20 require_once('admin-header.php'); 17 21 ?> … … 30 34 <div class="wrap"> 31 35 <h2><?php _e('Current Theme'); ?></h2> 32 <div id="current theme">36 <div id="current-theme"> 33 37 <?php if ( $ct->screenshot ) : ?> 34 38 <img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> 35 39 <?php endif; ?> 36 40 <h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3> 37 <p ><?php echo $ct->description; ?></p>41 <p class="description"><?php echo $ct->description; ?></p> 38 42 <?php if ($ct->parent_theme) { ?> 39 43 <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.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p> … … 48 52 <h2><?php _e('Available Themes'); ?></h2> 49 53 <?php if ( 1 < count($themes) ) { ?> 50 54 <table id="availablethemes" cellspacing="0" cellpadding="0"> 51 55 <?php 52 56 $style = ''; … … 55 59 natcasesort($theme_names); 56 60 57 foreach ($theme_names as $theme_name) { 58 if ( $theme_name == $ct->name ) 59 continue; 61 $rows = ceil(count($theme_names) / 3); 62 for ( $row = 1; $row <= $rows; $row++ ) 63 for ( $col = 1; $col <= 3; $col++ ) 64 $table[$row][$col] = array_shift($theme_names); 65 66 foreach ( $table as $row => $cols ) { 67 ?> 68 <tr> 69 <?php 70 foreach ( $cols as $col => $theme_name ) { 71 $class = array('available-theme'); 72 if ( $row == 1 ) $class[] = 'top'; 73 if ( $col == 1 ) $class[] = 'left'; 74 if ( $row == $rows ) $class[] = 'bottom'; 75 if ( $col == 3 ) $class[] = 'right'; 76 ?> 77 <td class="<?php echo join(' ', $class); ?>"> 78 <?php if ( !empty($theme_name) ) : 60 79 $template = $themes[$theme_name]['Template']; 61 80 $stylesheet = $themes[$theme_name]['Stylesheet']; … … 66 85 $screenshot = $themes[$theme_name]['Screenshot']; 67 86 $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; 87 $preview_link = clean_url( get_option('home') . '/'); 88 $preview_link = add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link ); 89 $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) ); 68 90 $tags = $themes[$theme_name]['Tags']; 91 $thickbox_class = 'thickbox'; 69 92 $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); 93 $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) ); 70 94 ?> 71 <div class="available-theme"> 72 <h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3> 73 74 <a href="<?php echo $activate_link; ?>" class="screenshot"> 95 <a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot"> 75 96 <?php if ( $screenshot ) : ?> 76 <img src="<?php echoget_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />97 <img src="<?php echo ( $tpage == 'stage' ) ? $screenshot : get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> 77 98 <?php endif; ?> 78 </a>79 80 <p><?php echo $description; ?></p>99 </a> 100 <h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3> 101 <p><?php echo $description; ?></p> 81 102 <?php if ( $tags ) : ?> 82 <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p> 103 <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p> 104 <noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript> 83 105 <?php endif; ?> 84 </div> 85 <?php } // end foreach theme_names ?> 86 106 <div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div> 107 <?php endif; // end if not empty theme_name ?> 108 </td> 109 <?php } // end foreach $cols ?> 110 </tr> 111 <?php } // end foreach $table ?> 112 </table> 87 113 <?php } ?> 88 114
Note: See TracChangeset
for help on using the changeset viewer.