PHP Cross Reference of WordPress Subversion HEAD |
| [ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ('admin.php'); 3 4 if ( isset($_GET['action']) ) { 5 check_admin_referer('switch-theme_' . $_GET['template']); 6 7 if ('activate' == $_GET['action']) { 8 switch_theme($_GET['template'], $_GET['stylesheet']); 9 wp_redirect('themes.php?activated=true'); 10 exit; 11 } 12 } 13 14 $title = __('Manage Themes'); 15 $parent_file = 'themes.php'; 16 require_once ('admin-header.php'); 17 ?> 18 19 <?php if ( ! validate_current_theme() ) : ?> 20 <div id="message1" class="updated fade"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div> 21 <?php elseif ( isset($_GET['activated']) ) : ?> 22 <div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site »</a>'), get_bloginfo('url') . '/'); ?></p></div> 23 <?php endif; ?> 24 25 <?php 26 $themes = get_themes(); 27 $ct = current_theme_info(); 28 ?> 29 30 <div class="wrap"> 31 <h2><?php _e('Current Theme'); ?></h2> 32 <div id="currenttheme"> 33 <?php if ( $ct->screenshot ) : ?> 34 <img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> 35 <?php endif; ?> 36 <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> 38 <?php if ($ct->parent_theme) { ?> 39 <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> 40 <?php } else { ?> 41 <p><?php printf(__('All of this theme’s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p> 42 <?php } ?> 43 </div> 44 45 <h2><?php _e('Available Themes'); ?></h2> 46 <?php if ( 1 < count($themes) ) { ?> 47 48 <?php 49 $style = ''; 50 51 $theme_names = array_keys($themes); 52 natcasesort($theme_names); 53 54 foreach ($theme_names as $theme_name) { 55 if ( $theme_name == $ct->name ) 56 continue; 57 $template = $themes[$theme_name]['Template']; 58 $stylesheet = $themes[$theme_name]['Stylesheet']; 59 $title = $themes[$theme_name]['Title']; 60 $version = $themes[$theme_name]['Version']; 61 $description = $themes[$theme_name]['Description']; 62 $author = $themes[$theme_name]['Author']; 63 $screenshot = $themes[$theme_name]['Screenshot']; 64 $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; 65 $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); 66 ?> 67 <div class="available-theme"> 68 <h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3> 69 70 <a href="<?php echo $activate_link; ?>" class="screenshot"> 71 <?php if ( $screenshot ) : ?> 72 <img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> 73 <?php endif; ?> 74 </a> 75 76 <p><?php echo $description; ?></p> 77 </div> 78 <?php } // end foreach theme_names ?> 79 80 <?php } ?> 81 82 <?php 83 // List broken themes, if any. 84 $broken_themes = get_broken_themes(); 85 if ( count($broken_themes) ) { 86 ?> 87 88 <h2><?php _e('Broken Themes'); ?></h2> 89 <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p> 90 91 <table width="100%" cellpadding="3" cellspacing="3"> 92 <tr> 93 <th><?php _e('Name'); ?></th> 94 <th><?php _e('Description'); ?></th> 95 </tr> 96 <?php 97 $theme = ''; 98 99 $theme_names = array_keys($broken_themes); 100 natcasesort($theme_names); 101 102 foreach ($theme_names as $theme_name) { 103 $title = $broken_themes[$theme_name]['Title']; 104 $description = $broken_themes[$theme_name]['Description']; 105 106 $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"'; 107 echo " 108 <tr $theme> 109 <td>$title</td> 110 <td>$description</td> 111 </tr>"; 112 } 113 ?> 114 </table> 115 <?php 116 } 117 ?> 118 119 <h2><?php _e('Get More Themes'); ?></h2> 120 <p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p> 121 122 </div> 123 124 <?php require ('admin-footer.php'); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated Thu Dec 6 06:47:08 2007 for RedAlt XRefs | Cross-referenced by PHPXref 0.6 and RedAlt |