| 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 |
return $ct; |
|---|
| 18 |
} |
|---|
| 19 |
|
|---|
| 20 |
function get_broken_themes() { |
|---|
| 21 |
global $wp_broken_themes; |
|---|
| 22 |
|
|---|
| 23 |
get_themes(); |
|---|
| 24 |
return $wp_broken_themes; |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
function get_page_templates() { |
|---|
| 28 |
$themes = get_themes(); |
|---|
| 29 |
$theme = get_current_theme(); |
|---|
| 30 |
$templates = $themes[$theme]['Template Files']; |
|---|
| 31 |
$page_templates = array (); |
|---|
| 32 |
|
|---|
| 33 |
if ( is_array( $templates ) ) { |
|---|
| 34 |
foreach ( $templates as $template ) { |
|---|
| 35 |
$template_data = implode( '', file( ABSPATH.$template )); |
|---|
| 36 |
|
|---|
| 37 |
preg_match( '|Template Name:(.*)$|mi', $template_data, $name ); |
|---|
| 38 |
preg_match( '|Description:(.*)$|mi', $template_data, $description ); |
|---|
| 39 |
|
|---|
| 40 |
$name = $name[1]; |
|---|
| 41 |
$description = $description[1]; |
|---|
| 42 |
|
|---|
| 43 |
if ( !empty( $name ) ) { |
|---|
| 44 |
$page_templates[trim( $name )] = basename( $template ); |
|---|
| 45 |
} |
|---|
| 46 |
} |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
return $page_templates; |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
?> |
|---|
| 53 |
|
|---|