Wordpress 2.7.1
[autoinstalls/wordpress.git] / wp-admin / includes / theme.php
1 <?php
2 /**
3  * WordPress Theme Administration API
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 /**
10  * {@internal Missing Short Description}}
11  *
12  * @since unknown
13  *
14  * @return unknown
15  */
16 function current_theme_info() {
17         $themes = get_themes();
18         $current_theme = get_current_theme();
19         $ct->name = $current_theme;
20         $ct->title = $themes[$current_theme]['Title'];
21         $ct->version = $themes[$current_theme]['Version'];
22         $ct->parent_theme = $themes[$current_theme]['Parent Theme'];
23         $ct->template_dir = $themes[$current_theme]['Template Dir'];
24         $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir'];
25         $ct->template = $themes[$current_theme]['Template'];
26         $ct->stylesheet = $themes[$current_theme]['Stylesheet'];
27         $ct->screenshot = $themes[$current_theme]['Screenshot'];
28         $ct->description = $themes[$current_theme]['Description'];
29         $ct->author = $themes[$current_theme]['Author'];
30         $ct->tags = $themes[$current_theme]['Tags'];
31         return $ct;
32 }
33
34 /**
35  * {@internal Missing Short Description}}
36  *
37  * @since unknown
38  *
39  * @return unknown
40  */
41 function get_broken_themes() {
42         global $wp_broken_themes;
43
44         get_themes();
45         return $wp_broken_themes;
46 }
47
48 /**
49  * {@internal Missing Short Description}}
50  *
51  * @since unknown
52  *
53  * @return unknown
54  */
55 function get_page_templates() {
56         $themes = get_themes();
57         $theme = get_current_theme();
58         $templates = $themes[$theme]['Template Files'];
59         $page_templates = array ();
60
61         if ( is_array( $templates ) ) {
62                 foreach ( $templates as $template ) {
63                         $template_data = implode( '', file( WP_CONTENT_DIR.$template ));
64
65                         $name = '';
66                         if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) )
67                                 $name = $name[1];
68
69                         $description = '';
70                         if( preg_match( '|Description:(.*)$|mi', $template_data, $description ) )
71                                 $description = $description[1];
72
73                         if ( !empty( $name ) ) {
74                                 $page_templates[trim( $name )] = basename( $template );
75                         }
76                 }
77         }
78
79         return $page_templates;
80 }
81
82 ?>