git-svn-id: http://svn.automattic.com/wordpress/trunk@1638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-09-11 16:12:40 +00:00
parent aae9dbf02d
commit fec36ee655
7 changed files with 541 additions and 20 deletions

View File

@ -488,4 +488,151 @@ if ( !strstr($_SERVER['HTTP_USER_AGENT'], 'Safari') ) :
endif; endif;
} }
function get_theme_data($theme_file) {
$theme_data = implode('', file($theme_file));
preg_match("|Theme Name:(.*)|i", $theme_data, $theme_name);
preg_match("|Theme URI:(.*)|i", $theme_data, $theme_uri);
preg_match("|Description:(.*)|i", $theme_data, $description);
preg_match("|Author:(.*)|i", $theme_data, $author_name);
preg_match("|Author URI:(.*)|i", $theme_data, $author_uri);
preg_match("|Template:(.*)|i", $theme_data, $template);
if ( preg_match("|Version:(.*)|i", $theme_data, $version) )
$version = $version[1];
else
$version ='';
$description = wptexturize($description[1]);
$name = $theme_name[1];
$name = trim($name);
$theme = $name;
if ('' != $theme_uri && '' != $name) {
$theme = __("<a href='{$theme_uri[1]}' title='Visit theme homepage'>{$theme}</a>");
}
if ('' == $author_uri) {
$author = $author_name[1];
} else {
$author = __("<a href='{$author_uri[1]}' title='Visit author homepage'>{$author_name[1]}</a>");
}
return array('Name' => $name, 'Title' => $theme, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template[1]);
}
function get_themes() {
$themes = array();
$theme_loc = 'wp-content/themes';
$theme_root = ABSPATH . $theme_loc;
// Files in wp-content/themes directory
$themes_dir = @ dir($theme_root);
if ($themes_dir) {
while(($theme_dir = $themes_dir->read()) !== false) {
if (is_dir($theme_root . '/' . $theme_dir)) {
$stylish_dir = @ dir($theme_root . '/' . $theme_dir);
while(($theme_file = $stylish_dir->read()) !== false) {
if ( $theme_file == 'style.css' ) {
$theme_files[] = $theme_dir . '/' . $theme_file;
}
}
}
}
}
$default_files = array(get_settings('blogfilename'), 'wp-comments.php', 'wp-comments-popup.php', 'wp-comments-post.php', 'wp-footer.php', 'wp-header.php', 'wp-sidebar.php', 'footer.php', 'header.php', 'sidebar.php');
// Get the files for the default template.
$default_template_files = array();
{
$dirs = array('', 'wp-content');
foreach ($dirs as $dir) {
$template_dir = @ dir(ABSPATH . $dir);
while(($file = $template_dir->read()) !== false) {
if ( !preg_match('|^\.+$|', $file) && in_array($file, $default_files))
$default_template_files[] = trim("$dir/$file", '/');
}
}
}
// Get the files for the default stylesheet.
$default_stylesheet_files = array();
{
$stylesheet_dir = @ dir(ABSPATH);
while(($file = $stylesheet_dir->read()) !== false) {
if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file))
$default_stylesheet_files[] = "$file";
}
}
// The default theme always exists.
$themes['Default'] = array('Name' => 'Default', 'Title' => 'Default', 'Description' => 'The default theme', 'Author' => '', 'Version' => '1.3', 'Template' => 'default', 'Stylesheet' => 'default', 'Template Files' => $default_template_files, 'Stylesheet Files' => $default_stylesheet_files);
if (!$themes_dir || !$theme_files) {
return $themes;
}
sort($theme_files);
foreach($theme_files as $theme_file) {
$theme_data = get_theme_data("$theme_root/$theme_file");
$name = $theme_data['Name'];
$title = $theme_data['Title'];
$description = wptexturize($theme_data['Description']);
$version = $theme_data['Version'];
$author = $theme_data['Author'];
$template = $theme_data['Template'];
$stylesheet = dirname($theme_file);
if (empty($template)) {
if (file_exists(dirname("$theme_root/$theme_file/index.php"))) {
$template = dirname($theme_file);
} else {
continue;
}
}
$template = trim($template);
if (($template != 'default') && (! file_exists("$theme_root/$template/index.php"))) {
continue;
}
if (empty($name)) {
$name = dirname($theme_file);
$title = $name;
}
$stylesheet_files = array();
if ($stylesheet != 'default') {
$stylesheet_dir = @ dir("$theme_root/$stylesheet");
if ($stylesheet_dir) {
while(($file = $stylesheet_dir->read()) !== false) {
if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) )
$stylesheet_files[] = "$theme_loc/$stylesheet/$file";
}
}
} else {
$stylesheet_files = $default_stylesheet_files;
}
$template_files = array();
if ($template != 'default') {
$template_dir = @ dir("$theme_root/$template");
if ($template_dir) {
while(($file = $template_dir->read()) !== false) {
if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) )
$template_files[] = "$theme_loc/$template/$file";
}
}
} else {
$template_files = $default_template_files;
}
$themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files);
}
return $themes;
}
?> ?>

View File

@ -13,8 +13,9 @@ $menu[20] = array(__('Links'), 5, 'link-manager.php');
$menu[25] = array(__('Users'), 3, 'users.php'); $menu[25] = array(__('Users'), 3, 'users.php');
$menu[30] = array(__('Options'), 6, 'options-general.php'); $menu[30] = array(__('Options'), 6, 'options-general.php');
$menu[35] = array(__('Plugins'), 8, 'plugins.php'); $menu[35] = array(__('Plugins'), 8, 'plugins.php');
$menu[40] = array(__('Templates'), 4, 'templates.php'); $menu[40] = array(__('Presentation'), 8, 'themes.php');
$menu[45] = array(__('Upload'), get_settings('fileupload_minlevel'), 'upload.php'); $menu[45] = array(__('Templates'), 4, 'templates.php');
$menu[50] = array(__('Upload'), get_settings('fileupload_minlevel'), 'upload.php');
ksort($menu); // So other files can plugin ksort($menu); // So other files can plugin
$submenu['edit.php'][5] = array(__('Posts'), 1, 'edit.php'); $submenu['edit.php'][5] = array(__('Posts'), 1, 'edit.php');
@ -39,6 +40,9 @@ $submenu['options-general.php'][20] = array(__('Discussion'), 5, 'options-discus
$submenu['options-general.php'][25] = array(__('Permalinks'), 5, 'options-permalink.php'); $submenu['options-general.php'][25] = array(__('Permalinks'), 5, 'options-permalink.php');
$submenu['options-general.php'][30] = array(__('Miscellaneous'), 5, 'options-misc.php'); $submenu['options-general.php'][30] = array(__('Miscellaneous'), 5, 'options-misc.php');
$submenu['themes.php'][5] = array(__('Themes'), 5, 'themes.php');
$submenu['themes.php'][10] = array(__('Theme Editor'), 5, 'theme-editor.php');
$self = preg_replace('|.*/wp-admin/|i', '', $_SERVER['PHP_SELF']); $self = preg_replace('|.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
if (!isset($parent_file)) $parent_file = ''; if (!isset($parent_file)) $parent_file = '';
foreach ($menu as $item) { foreach ($menu as $item) {

199
wp-admin/theme-editor.php Normal file
View File

@ -0,0 +1,199 @@
<?php
require_once('../wp-includes/wp-l10n.php');
$title = __("Template &amp; file editing");
$parent_file = 'themes.php';
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
if (is_array($v)) {
$array[$k] = add_magic_quotes($v);
} else {
$array[$k] = addslashes($v);
}
}
return $array;
}
function validate_file($file) {
if ('..' == substr($file,0,2))
die (__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
if (':' == substr($file,1,1))
die (__('Sorry, can&#8217;t call files with their real path.'));
if ('/' == substr($file,0,1))
$file = '.' . $file;
$file = stripslashes($file);
$file = str_replace('../', '', $file);
return $file;
}
if (!get_magic_quotes_gpc()) {
$_GET = add_magic_quotes($_GET);
$_POST = add_magic_quotes($_POST);
$_COOKIE = add_magic_quotes($_COOKIE);
}
$wpvarstoreset = array('action','standalone','redirect','profile','error','warning','a','file', 'theme');
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
$wpvar = $wpvarstoreset[$i];
if (!isset($$wpvar)) {
if (empty($_POST["$wpvar"])) {
if (empty($_GET["$wpvar"])) {
$$wpvar = '';
} else {
$$wpvar = $_GET["$wpvar"];
}
} else {
$$wpvar = $_POST["$wpvar"];
}
}
}
switch($action) {
case 'update':
$standalone = 1;
require_once("admin-header.php");
if ($user_level < 5) {
die(__('<p>You have do not have sufficient permissions to edit templates for this blog.</p>'));
}
$newcontent = stripslashes($_POST['newcontent']);
$file = $_POST['file'];
$file = validate_file($file);
$real_file = '../' . $file;
if (is_writeable($real_file)) {
$f = fopen($real_file, 'w+');
fwrite($f, $newcontent);
fclose($f);
header("Location: theme-editor.php?file=$file&a=te");
} else {
header("Location: theme-editor.php?file=$file");
}
exit();
break;
default:
require_once('admin-header.php');
update_option('recently_edited', array(1, 2, 3) );
if ($user_level <= 5) {
die(__('<p>You have do not have sufficient permissions to edit themes for this blog.</p>'));
}
$themes = get_themes();
if (! isset($theme) || empty($theme)) {
$theme = 'Default';
}
$stylesheet_files = $themes[$theme]['Stylesheet Files'];
$template_files = $themes[$theme]['Template Files'];
if ('' == $file) {
$file = $stylesheet_files[0];
}
$home = get_settings('home');
if (($home != '')
&& ($home != get_settings('siteurl')) &&
('index.php' == $file || get_settings('blogfilename') == $file ||
'.htaccess' == $file)) {
$home_root = parse_url($home);
$home_root = $home_root['path'];
$root = str_replace($_SERVER["PHP_SELF"], '', $_SERVER["PATH_TRANSLATED"]);
$home_root = $root . $home_root;
$real_file = $home_root . '/' . $file;
} else {
$file = validate_file($file);
$real_file = '../' . $file;
}
if (!is_file($real_file))
$error = 1;
if (!$error) {
$f = fopen($real_file, 'r');
$content = fread($f, filesize($real_file));
$content = htmlspecialchars($content);
}
?>
<?php if (isset($_GET['a'])) : ?>
<div class="updated"><p><?php _e('File edited successfully.') ?></p></div>
<?php endif; ?>
<div class="wrap">
<form name="theme" action="theme-editor.php" method="post">
<?php _e('Select theme to edit:') ?>
<select name="theme" id="theme">
<?php
foreach ($themes as $a_theme) {
$theme_name = $a_theme['Name'];
if ($theme_name == $theme) $selected = " selected='selected'";
else $selected = '';
echo "\n\t<option value='$theme_name' $selected>$theme_name</option>";
}
?>
</select>
<input type="submit" name="Submit" value="<?php _e('Select') ?> &raquo;" />
</form>
</div>
<div class="wrap">
<?php
echo "<p>" . sprintf(__('Editing <strong>%s</strong>'), $file) . "</p>";
if (!$error) {
?>
<form name="template" action="theme-editor.php" method="post">
<textarea cols="80" rows="21" style="width:95%; margin-right: 10em; font-family: 'Courier New', Courier, monopace; font-size:small;" name="newcontent" tabindex="1"><?php echo $content ?></textarea>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="file" value="<?php echo $file ?>" />
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
<p class="submit">
<?php
if (is_writeable($real_file)) {
echo "<input type='submit' name='submit' value='Update File &raquo;' tabindex='2' />";
} else {
echo "<input type='button' name='oops' value='" . __('(You cannot update that file/template: must make it writable, e.g. CHMOD 666)') ."' tabindex='2' />";
}
?>
</p>
</form>
<?php
} else {
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
}
?>
</div>
<div class="wrap">
<?php
if ($template_files || $stylesheet_files) :
?>
<p><?php printf(__('<strong>%s</strong> theme files:'), $theme) ?></p>
<ul>
<?php foreach($stylesheet_files as $stylesheet_file) : ?>
<li><a href="theme-editor.php?file=<?php echo "$stylesheet_file"; ?>&amp;theme=<?php echo $theme; ?>"><?php echo basename($stylesheet_file); ?></a></li>
<?php endforeach; ?>
<?php foreach($template_files as $template_file) : ?>
<li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo $theme; ?>"><?php echo basename($template_file); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don&#8217;t have access to a text editor or FTP client.') ?></p>
</div>
<?php
break;
}
include("admin-footer.php") ?>

125
wp-admin/themes.php Normal file
View File

@ -0,0 +1,125 @@
<?php
if ( isset($_GET['action']) ) {
$standalone = 1;
require_once('admin-header.php');
check_admin_referer();
if ('activate' == $_GET['action']) {
if (isset($_GET['template'])) {
update_option('template', $_GET['template']);
}
if (isset($_GET['stylesheet'])) {
update_option('stylesheet', $_GET['stylesheet']);
}
header('Location: themes.php?activate=true');
}
}
require_once('../wp-includes/wp-l10n.php');
$title = __('Manage Themes');
$parent_file = 'themes.php';
require_once('admin-header.php');
if ($user_level < 9) // Must be at least level 9
die (__('Sorry, you must be at least a level 8 user to modify themes.'));
?>
<?php
$themes = get_themes();
$theme_names = array_keys($themes);
natcasesort($theme_names);
$current_template = get_settings('template');
$current_stylesheet = get_settings('stylesheet');
$current_theme = 'Default';
$current_parent_theme = '';
$current_template_dir = '/';
$current_stylesheet_dir = '/';
if ($themes) {
foreach ($theme_names as $theme_name) {
if ($themes[$theme_name]['Stylesheet'] == $current_stylesheet &&
$themes[$theme_name]['Template'] == $current_template) {
$current_theme = $themes[$theme_name]['Name'];
if ($current_template != 'default')
$current_template_dir = dirname($themes[$theme_name]['Template Files'][0]);
if ($current_stylesheet != 'default')
$current_stylesheet_dir = dirname($themes[$theme_name]['Stylesheet Files'][0]);
}
if (($current_template != $current_stylesheet) &&
($themes[$theme_name]['Stylesheet'] == $themes[$theme_name]['Template']) &&
($themes[$theme_name]['Template'] == $current_template)) {
$current_parent_theme = $themes[$theme_name]['Name'];
}
}
}
?>
<?php if ($current_parent_theme) { ?>
<div class="updated"><p><?php printf(__('The active theme is <strong>%s</strong>. The template files are located in <code>%s</code>. The stylesheet files are located in <code>%s</code>. <strong>%s</strong> uses templates from <strong>%s</strong>. Changes made to the templates will affect both themes.'), $current_theme, $current_template_dir, $current_stylesheet_dir, $current_theme, $current_parent_theme); ?></p></div>
<?php } else { ?>
<div class="updated"><p><?php printf(__('The active theme is <strong>%s</strong>. The template files are located in <code>%s</code>. The stylesheet files are located in <code>%s</code>.'), $current_theme, $current_template_dir, $current_stylesheet_dir); ?></p></div>
<?php } ?>
<div class="wrap">
<h2><?php _e('Theme Management'); ?></h2>
<p><?php _e('Themes are usually downloaded separately from WordPress. To install a theme you generally just need to put the theme file or files into your <code>wp-content/themes</code> directory. Once a theme is installed, you may select it here.'); ?></p>
<?php
if (empty($themes)) {
_e("<p>Couldn't open themes directory or there are no themes available.</p>"); // TODO: make more helpful
} else {
?>
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th><?php _e('Theme'); ?></th>
<th><?php _e('Version'); ?></th>
<th><?php _e('Author'); ?></th>
<th><?php _e('Description'); ?></th>
<th><?php _e('Select'); ?></th>
</tr>
<?php
$theme = '';
$theme_names = array_keys($themes);
natcasesort($theme_names);
foreach ($theme_names as $theme_name) {
$template = $themes[$theme_name]['Template'];
$stylesheet = $themes[$theme_name]['Stylesheet'];
$title = $themes[$theme_name]['Title'];
$version = $themes[$theme_name]['Version'];
$description = $themes[$theme_name]['Description'];
$author = $themes[$theme_name]['Author'];
if ($template == $current_template && $stylesheet == $current_stylesheet) {
$action = "<a href='themes.php' title='" . __('Active theme') . "' class='edit'>" . __('Active Theme') . '</a>';
} else {
$action = "<a href='themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet' title='" . __('Select this theme') . "' class='edit'>" . __('Select') . '</a>';
}
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
echo "
<tr $theme>
<td>$title</td>
<td>$version</td>
<td>$author</td>
<td>$description</td>
<td>$action</td>
</tr>";
}
?>
</table>
<?php
}
?>
</div>
<?php
include('admin-footer.php');
?>

View File

@ -215,6 +215,8 @@ function populate_options() {
add_option('default_email_category', 1, 'Posts by email go to this category'); add_option('default_email_category', 1, 'Posts by email go to this category');
add_option('recently_edited'); add_option('recently_edited');
add_option('use_linksupdate', 0); add_option('use_linksupdate', 0);
add_option('template', 'default');
add_option('stylesheet', 'default');
// Delete unused options // Delete unused options
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'rss_language', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls'); $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'rss_language', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls');

View File

@ -66,6 +66,10 @@ if ((isset($_GET['error']) && $_GET['error'] == '404') ||
unset($_GET['error']); unset($_GET['error']);
} }
if (isset($error)) {
unset($error);
}
break; break;
} }
} }
@ -101,7 +105,9 @@ if (1 == $tb) {
// Sending HTTP headers // Sending HTTP headers
if ( !isset($doing_rss) || !$doing_rss ) { if (is_404()) {
header("HTTP/1.x 404 Not Found");
} else if ( !isset($doing_rss) || !$doing_rss ) {
@header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php'); @header ('X-Pingback: '. get_settings('siteurl') . '/xmlrpc.php');
} else { } else {
// We're showing a feed, so WP is indeed the only thing that last changed // We're showing a feed, so WP is indeed the only thing that last changed
@ -183,46 +189,63 @@ if (1 == count($posts)) {
$wp_did_header = true; $wp_did_header = true;
endif; endif;
$wp_template = get_settings('template');
if ($wp_template == 'default') {
$wp_template = '';
}
if (! empty($wp_template)) {
$wp_template = "themes/$wp_template/";
}
// Template redirection // Template redirection
if (is_single() && (! isset($wp_did_single)) && if ($pagenow != get_settings('blogfilename')) {
file_exists(ABSPATH . 'wp-content/single.php')) { // Noop.
} else if (is_home() && (! isset($wp_did_home)) &&
file_exists(ABSPATH . "wp-content/${wp_template}index.php")) {
$wp_did_home = true;
include(ABSPATH . "wp-content/${wp_template}index.php");
exit;
} else if (is_single() && (! isset($wp_did_single)) &&
file_exists(ABSPATH . "wp-content/${wp_template}single.php")) {
$wp_did_single = true; $wp_did_single = true;
include(ABSPATH . 'wp-content/single.php'); include(ABSPATH . "wp-content/${wp_template}single.php");
exit; exit;
} else if (is_page() && (! isset($wp_did_page)) && } else if (is_page() && (! isset($wp_did_page)) &&
file_exists(ABSPATH . 'wp-content/page.php')) { file_exists(ABSPATH . "wp-content/${wp_template}page.php")) {
$wp_did_page = true; $wp_did_page = true;
include(ABSPATH . 'wp-content/page.php'); include(ABSPATH . "wp-content/${wp_template}page.php");
exit; exit;
} else if (is_category() && (! isset($wp_did_category)) && } else if (is_category() && (! isset($wp_did_category)) &&
file_exists(ABSPATH . 'wp-content/category.php')) { file_exists(ABSPATH . "wp-content/${wp_template}category.php")) {
$wp_did_category = true; $wp_did_category = true;
include(ABSPATH . 'wp-content/category.php'); include(ABSPATH . "wp-content/${wp_template}category.php");
exit; exit;
} else if (is_author() && (! isset($wp_did_author)) && } else if (is_author() && (! isset($wp_did_author)) &&
file_exists(ABSPATH . 'wp-content/author.php')) { file_exists(ABSPATH . "wp-content/${wp_template}author.php")) {
$wp_did_author = true; $wp_did_author = true;
include(ABSPATH . 'wp-content/author.php'); include(ABSPATH . "wp-content/${wp_template}author.php");
exit; exit;
} else if (is_date() && (! isset($wp_did_date)) && } else if (is_date() && (! isset($wp_did_date)) &&
file_exists(ABSPATH . 'wp-content/date.php')) { file_exists(ABSPATH . "wp-content/${wp_template}date.php")) {
$wp_did_date = true; $wp_did_date = true;
include(ABSPATH . 'wp-content/date.php'); include(ABSPATH . "wp-content/${wp_template}date.php");
exit; exit;
} else if (is_archive() && (! isset($wp_did_archive)) && } else if (is_archive() && (! isset($wp_did_archive)) &&
file_exists(ABSPATH . 'wp-content/archive.php')) { file_exists(ABSPATH . "wp-content/${wp_template}archive.php")) {
$wp_did_archive = true; $wp_did_archive = true;
include(ABSPATH . 'wp-content/archive.php'); include(ABSPATH . "wp-content/${wp_template}archive.php");
exit; exit;
} else if (is_search() && (! isset($wp_did_search)) && } else if (is_search() && (! isset($wp_did_search)) &&
file_exists(ABSPATH . 'wp-content/search.php')) { file_exists(ABSPATH . "wp-content/${wp_template}search.php")) {
$wp_did_search = true; $wp_did_search = true;
include(ABSPATH . 'wp-content/search.php'); include(ABSPATH . "wp-content/${wp_template}search.php");
exit; exit;
} else if (is_404() && (! isset($wp_did_404)) && } else if (is_404() && (! isset($wp_did_404)) &&
file_exists(ABSPATH . 'wp-content/404.php')) { file_exists(ABSPATH . "wp-content/${wp_template}404.php")) {
$wp_did_404 = true; $wp_did_404 = true;
include(ABSPATH . 'wp-content/404.php'); include(ABSPATH . "wp-content/${wp_template}404.php");
exit; exit;
} else if (is_feed() && $pagenow != 'wp-feed.php') { } else if (is_feed() && $pagenow != 'wp-feed.php') {
include(dirname(__FILE__) . '/wp-feed.php'); include(dirname(__FILE__) . '/wp-feed.php');
@ -230,6 +253,11 @@ if (is_single() && (! isset($wp_did_single)) &&
} else if ($pagenow != 'wp-trackback.php' && $tb == 1) { } else if ($pagenow != 'wp-trackback.php' && $tb == 1) {
include(dirname(__FILE__) . '/wp-trackback.php'); include(dirname(__FILE__) . '/wp-trackback.php');
exit; exit;
} else if ((! isset($wp_did_home)) && file_exists(ABSPATH . "wp-content/${wp_template}index.php"))
{
$wp_did_home = true;
include(ABSPATH . "wp-content/${wp_template}index.php");
exit;
} }
if ($pagenow != 'post.php' && $pagenow != 'edit.php') { if ($pagenow != 'post.php' && $pagenow != 'edit.php') {

View File

@ -77,6 +77,22 @@ function get_bloginfo($show='') {
case 'pingback_url': case 'pingback_url':
$output = get_settings('siteurl') .'/xmlrpc.php'; $output = get_settings('siteurl') .'/xmlrpc.php';
break; break;
case 'stylesheet_url':
$output = get_settings('stylesheet');;
if (empty($output) || $output == 'default') {
$output = get_settings('home') . "/wp-layout.css";
} else {
$output = get_settings('home') . "/wp-content/themes/$output/style.css";
}
break;
case 'template_url':
$output = get_settings('template');;
if (empty($output) || $output == 'default') {
$output = get_settings('home');
} else {
$output = get_settings('home') . "/wp-content/themes/$output";
}
break;
case 'admin_email': case 'admin_email':
$output = get_settings('admin_email'); $output = get_settings('admin_email');
break; break;