]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/theme.php
Wordpress 2.5.1
[autoinstalls/wordpress.git] / wp-admin / includes / theme.php
1 <?php
2
3 function current_theme_info() {
4         $themes = get_themes();
5         $current_theme = get_current_theme();
6         $ct->name = $current_theme;
7         $ct->title = $themes[$current_theme]['Title'];
8         $ct->version = $themes[$current_theme]['Version'];
9         $ct->parent_theme = $themes[$current_theme]['Parent Theme'];
10         $ct->template_dir = $themes[$current_theme]['Template Dir'];
11         $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
12         $ct->template = $themes[$current_theme]['Template'];
13         $ct->stylesheet = $themes[$current_theme]['Stylesheet'];
14         $ct->screenshot = $themes[$current_theme]['Screenshot'];
15         $ct->description = $themes[$current_theme]['Description'];
16         $ct->author = $themes[$current_theme]['Author'];
17         $ct->tags = $themes[$current_theme]['Tags'];
18         return $ct;
19 }
20
21 function get_broken_themes() {
22         global $wp_broken_themes;
23
24         get_themes();
25         return $wp_broken_themes;
26 }
27
28 function get_page_templates() {
29         $themes = get_themes();
30         $theme = get_current_theme();
31         $templates = $themes[$theme]['Template Files'];
32         $page_templates = array ();
33
34         if ( is_array( $templates ) ) {
35                 foreach ( $templates as $template ) {
36                         $template_data = implode( '', file( ABSPATH.$template ));
37
38                         preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
39                         preg_match( '|Description:(.*)$|mi', $template_data, $description );
40
41                         $name = $name[1];
42                         $description = $description[1];
43
44                         if ( !empty( $name ) ) {
45                                 $page_templates[trim( $name )] = basename( $template );
46                         }
47                 }
48         }
49
50         return $page_templates;
51 }
52
53 ?>