Relocate default theme to themes/default. Remove special casing of default theme. Do not look directly in wp-content/ for default theme files. Simplify, simplify.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2005-01-02 02:47:45 +00:00
parent 064976d3e0
commit ab6ff7fee4
10 changed files with 66 additions and 116 deletions

View File

@ -1,38 +1,4 @@
<?php <?php
/* Don't remove this line. */ /* Don't remove this line. */
require('./wp-blog-header.php'); require('./wp-blog-header.php');
get_header(); ?>
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<h2>','</h2>'); ?>
<div class="post">
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
<div class="storycontent">
<?php the_content(__('(more...)')); ?>
</div>
<div class="feedback">
<?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
</div>
<!--
<?php trackback_rdf(); ?>
-->
</div>
<?php comments_template( is_single() ); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php posts_nav_link(' &#8212; ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
<?php get_footer(); ?>

View File

@ -0,0 +1,36 @@
<?php
get_header();
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_date('','<h2>','</h2>'); ?>
<div class="post">
<h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
<div class="storycontent">
<?php the_content(__('(more...)')); ?>
</div>
<div class="feedback">
<?php wp_link_pages(); ?>
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
</div>
<!--
<?php trackback_rdf(); ?>
-->
</div>
<?php comments_template( is_single() ); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php posts_nav_link(' &#8212; ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
<?php get_footer(); ?>

View File

@ -1,7 +1,14 @@
/* Default WordPress by Dave Shea || http://mezzoblue.com /*
Modifications by Matthew Mullenweg || http://photomatt.net Theme Name: Default
This is just a basic layout, with only the bare minimum defined. Theme URI: http://wordpress.org/
Please tweak this and make it your own. :) Description: The default theme included with WordPress.
Version: 1.5
Author: Dave Shea
Default WordPress by Dave Shea || http://mezzoblue.com
Modifications by Matthew Mullenweg || http://photomatt.net
This is just a basic layout, with only the bare minimum defined.
Please tweak this and make it your own. :)
*/ */
a { a {

View File

@ -1253,11 +1253,7 @@ function get_template() {
function get_template_directory() { function get_template_directory() {
$template = get_template(); $template = get_template();
if (empty($template) || $template == 'default') { $template = ABSPATH . "wp-content/themes/$template";
$template = ABSPATH . "wp-content";
} else {
$template = ABSPATH . "wp-content/themes/$template";
}
return $template; return $template;
} }
@ -1330,41 +1326,6 @@ function get_themes() {
} }
} }
$default_files = array('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();
{
// Find the index.
if (file_exists(ABSPATH .'wp-content/index.php')) {
$default_template_files[] = 'wp-content/index.php';
} else {
$default_template_files[] = 'index.php';
}
$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' => 'WordPress Default', 'Description' => 'The default theme included with WordPress.', 'Author' => 'Dave Shea', 'Version' => '1.3', 'Template' => 'default', 'Stylesheet' => 'default', 'Template Files' => $default_template_files, 'Stylesheet Files' => $default_stylesheet_files, 'Template Dir' => '/', 'Stylesheet Dir' => '/', 'Parent Theme' => '');
if (!$themes_dir || !$theme_files) { if (!$themes_dir || !$theme_files) {
return $themes; return $themes;
} }
@ -1397,35 +1358,27 @@ function get_themes() {
$template = trim($template); $template = trim($template);
if (($template != 'default') && (! file_exists("$theme_root/$template/index.php"))) { if (! file_exists("$theme_root/$template/index.php")) {
$wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.')); $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'));
continue; continue;
} }
$stylesheet_files = array(); $stylesheet_files = array();
if ($stylesheet != 'default') { $stylesheet_dir = @ dir("$theme_root/$stylesheet");
$stylesheet_dir = @ dir("$theme_root/$stylesheet"); if ($stylesheet_dir) {
if ($stylesheet_dir) { while(($file = $stylesheet_dir->read()) !== false) {
while(($file = $stylesheet_dir->read()) !== false) { if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) )
if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) ) $stylesheet_files[] = "$theme_loc/$stylesheet/$file";
$stylesheet_files[] = "$theme_loc/$stylesheet/$file";
}
} }
} else {
$stylesheet_files = $default_stylesheet_files;
} }
$template_files = array(); $template_files = array();
if ($template != 'default') { $template_dir = @ dir("$theme_root/$template");
$template_dir = @ dir("$theme_root/$template"); if ($template_dir) {
if ($template_dir) { while(($file = $template_dir->read()) !== false) {
while(($file = $template_dir->read()) !== false) { if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) )
if ( !preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file) ) $template_files[] = "$theme_loc/$template/$file";
$template_files[] = "$theme_loc/$template/$file";
}
} }
} else {
$template_files = $default_template_files;
} }
$template_dir = dirname($template_files[0]); $template_dir = dirname($template_files[0]);

View File

@ -6,21 +6,21 @@ function get_header() {
if ( file_exists( TEMPLATEPATH . '/header.php') ) if ( file_exists( TEMPLATEPATH . '/header.php') )
load_template( TEMPLATEPATH . '/header.php'); load_template( TEMPLATEPATH . '/header.php');
else else
load_template( ABSPATH . 'wp-includes/wp-header.php'); load_template( ABSPATH . 'wp-content/themes/default/header.php');
} }
function get_footer() { function get_footer() {
if ( file_exists( TEMPLATEPATH . '/footer.php') ) if ( file_exists( TEMPLATEPATH . '/footer.php') )
load_template( TEMPLATEPATH . '/footer.php'); load_template( TEMPLATEPATH . '/footer.php');
else else
load_template( ABSPATH . 'wp-includes/wp-footer.php'); load_template( ABSPATH . 'wp-content/themes/default/footer.php');
} }
function get_sidebar() { function get_sidebar() {
if ( file_exists( TEMPLATEPATH . '/sidebar.php') ) if ( file_exists( TEMPLATEPATH . '/sidebar.php') )
load_template( TEMPLATEPATH . '/sidebar.php'); load_template( TEMPLATEPATH . '/sidebar.php');
else else
load_template( ABSPATH . 'wp-includes/wp-sidebar.php'); load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
} }
@ -105,28 +105,16 @@ function get_bloginfo($show='') {
break; break;
case 'stylesheet_url': case 'stylesheet_url':
$output = get_stylesheet(); $output = get_stylesheet();
if (empty($output) || $output == 'default') { $output = get_settings('siteurl') . "/wp-content/themes/$output/style.css";
$output = get_settings('siteurl') . "/wp-includes/wp-layout.css";
} else {
$output = get_settings('siteurl') . "/wp-content/themes/$output/style.css";
}
break; break;
case 'stylesheet_directory': case 'stylesheet_directory':
$output = get_stylesheet(); $output = get_stylesheet();
if (empty($output) || $output == 'default') { $output = get_settings('siteurl') . "/wp-content/themes/$output";
$output = get_settings('siteurl');
} else {
$output = get_settings('siteurl') . "/wp-content/themes/$output";
}
break; break;
case 'template_directory': case 'template_directory':
case 'template_url': case 'template_url':
$output = get_template(); $output = get_template();
if (empty($output) || $output == 'default') { $output = get_settings('siteurl') . "/wp-content/themes/$output";
$output = get_settings('siteurl');
} else {
$output = get_settings('siteurl') . "/wp-content/themes/$output";
}
break; break;
case 'admin_email': case 'admin_email':
$output = get_settings('admin_email'); $output = get_settings('admin_email');