[ Index ]
 

Code source de WordPress 2.1.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wp-admin/ -> themes.php (source)

   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          if ( isset($_GET['template']) )
   9              update_option('template', $_GET['template']);
  10  
  11          if ( isset($_GET['stylesheet']) )
  12              update_option('stylesheet', $_GET['stylesheet']);
  13  
  14          do_action('switch_theme', get_current_theme());
  15  
  16          wp_redirect('themes.php?activated=true');
  17          exit;
  18      }
  19  }
  20  
  21  $title = __('Manage Themes');
  22  $parent_file = 'themes.php';
  23  require_once ('admin-header.php');
  24  ?>
  25  
  26  <?php if ( ! validate_current_theme() ) : ?>
  27  <div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div>
  28  <?php elseif ( isset($_GET['activated']) ) : ?>
  29  <div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('home') . '/'); ?></p></div>
  30  <?php endif; ?>
  31  
  32  <?php
  33  $themes = get_themes();
  34  $ct = current_theme_info();
  35  ?>
  36  
  37  <div class="wrap">
  38  <h2><?php _e('Current Theme'); ?></h2>
  39  <div id="currenttheme">
  40  <?php if ( $ct->screenshot ) : ?>
  41  <img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
  42  <?php endif; ?>
  43  <h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3>
  44  <p><?php echo $ct->description; ?></p>
  45  <?php if ($ct->parent_theme) { ?>
  46      <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>
  47  <?php } else { ?>
  48      <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p>
  49  <?php } ?>
  50  </div>
  51  
  52  <h2><?php _e('Available Themes'); ?></h2>
  53  <?php if ( 1 < count($themes) ) { ?>
  54  
  55  <?php
  56  $style = '';
  57  
  58  $theme_names = array_keys($themes);
  59  natcasesort($theme_names);
  60  
  61  foreach ($theme_names as $theme_name) {
  62      if ( $theme_name == $ct->name )
  63          continue;
  64      $template = $themes[$theme_name]['Template'];
  65      $stylesheet = $themes[$theme_name]['Stylesheet'];
  66      $title = $themes[$theme_name]['Title'];
  67      $version = $themes[$theme_name]['Version'];
  68      $description = $themes[$theme_name]['Description'];
  69      $author = $themes[$theme_name]['Author'];
  70      $screenshot = $themes[$theme_name]['Screenshot'];
  71      $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
  72      $activate_link = wp_nonce_url("themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet", 'switch-theme_' . $template);
  73  ?>
  74  <div class="available-theme">
  75  <h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3>
  76  
  77  <a href="<?php echo $activate_link; ?>" class="screenshot">
  78  <?php if ( $screenshot ) : ?>
  79  <img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
  80  <?php endif; ?>
  81  </a>
  82  
  83  <p><?php echo $description; ?></p>
  84  </div>
  85  <?php } // end foreach theme_names ?>
  86  
  87  <?php } ?>
  88  
  89  <?php
  90  // List broken themes, if any.
  91  $broken_themes = get_broken_themes();
  92  if ( count($broken_themes) ) {
  93  ?>
  94  
  95  <h2><?php _e('Broken Themes'); ?></h2>
  96  <p><?php _e('The following themes are installed but incomplete.  Themes must have a stylesheet and a template.'); ?></p>
  97  
  98  <table width="100%" cellpadding="3" cellspacing="3">
  99      <tr>
 100          <th><?php _e('Name'); ?></th>
 101          <th><?php _e('Description'); ?></th>
 102      </tr>
 103  <?php
 104      $theme = '';
 105  
 106      $theme_names = array_keys($broken_themes);
 107      natcasesort($theme_names);
 108  
 109      foreach ($theme_names as $theme_name) {
 110          $title = $broken_themes[$theme_name]['Title'];
 111          $description = $broken_themes[$theme_name]['Description'];
 112  
 113          $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
 114          echo "
 115          <tr $theme>
 116               <td>$title</td>
 117               <td>$description</td>
 118          </tr>";
 119      }
 120  ?>
 121  </table>
 122  <?php
 123  }
 124  ?>
 125  
 126  <h2><?php _e('Get More Themes'); ?></h2>
 127  <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>
 128  
 129  </div>
 130  
 131  <?php require ('admin-footer.php'); ?>


Généré le : Fri Mar 30 19:41:27 2007 par Balluche grâce à PHPXref 0.7