Skip to content

Commit 7c3debb

Browse files
committed
Moving default template stuff into wp-includes, uncluttering root
git-svn-id: https://develop.svn.wordpress.org/trunk@2009 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7a8c7eb commit 7c3debb

12 files changed

Lines changed: 56 additions & 69 deletions

index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/* Don't remove this line. */
33
require('./wp-blog-header.php');
4-
include(ABSPATH . '/wp-header.php');
4+
get_header();
55
?>
66

77
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
@@ -27,12 +27,12 @@
2727

2828
</div>
2929

30-
<?php comments_template(); // Get wp-comments.php template ?>
30+
<?php comments_template( is_single() ); // Get wp-comments.php template ?>
3131

3232
<?php endwhile; else: ?>
3333
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
3434
<?php endif; ?>
3535

3636
<?php posts_nav_link(' &#8212; ', __('&laquo; Previous Page'), __('Next Page &raquo;')); ?>
3737

38-
<?php include(ABSPATH . '/wp-footer.php'); ?>
38+
<?php get_footer(); ?>

wp-admin/upgrade-schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function populate_options() {
210210
add_option('use_linksupdate', 0);
211211
add_option('template', 'default');
212212
add_option('stylesheet', 'default');
213-
add_option('comment_whitelist', 0);
213+
add_option('comment_whitelist', 1);
214214
add_option('page_uris');
215215

216216
// Delete unused options

wp-includes/classes.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ function parse_query ($query) {
6565

6666
if ('' != $qv['name']) {
6767
$this->is_single = true;
68-
} else if (($qv['p'] != '') && ($qv['p'] != 'all') && (intval($q['p']) != 0)) {
68+
} elseif ( intval( $q['p'] ) != 0 && $qv['p'] != 'all' ) {
6969
$this->is_single = true;
70-
} else if (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
70+
} elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
7171
// If year, month, day, hour, minute, and second are set, a single
7272
// post is being queried.
7373
$this->is_single = true;
74-
} else if ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {
74+
} elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) {
7575
$this->is_page = true;
7676
$this->is_single = false;
77-
} else if (!empty($qv['s'])) {
77+
} elseif (!empty($qv['s'])) {
7878
$this->is_search = true;
7979
} else {
8080
// Look for archive queries. Dates, categories, authors.

wp-includes/comment-functions.php

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
// Template functions
44

5-
function comments_template() {
6-
global $withcomments, $post, $wpdb, $id, $comment;
5+
function comments_template( $show ) {
6+
global $wp_query, $withcomments, $post, $wpdb, $id, $comment;
77

88
if ( is_single() || is_page() || $withcomments ) :
99
$req = get_settings('require_name_email');
@@ -12,14 +12,10 @@ function comments_template() {
1212
$comment_author_url = isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_url_'.COOKIEHASH])) : '';
1313
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
1414

15-
$template = get_template_directory();
16-
$template .= "/comments.php";
17-
18-
if (file_exists($template)) {
19-
include($template);
20-
} else {
21-
include(ABSPATH . 'wp-comments.php');
22-
}
15+
if ( file_exists( TEMPLATEPATH . '/comments.php') )
16+
require( TEMPLATEPATH . '/comments.php');
17+
else
18+
require( ABSPATH . 'wp-includes/wp-comments.php');
2319

2420
endif;
2521
}
@@ -72,12 +68,10 @@ function comments_popup_script($width=400, $height=400, $file='') {
7268
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
7369

7470
if (empty ($file)) {
75-
$template = TEMPLATEPATH . '/comments-popup.php';
76-
if (file_exists($template)) {
77-
$wpcommentspopupfile = str_replace(ABSPATH, '', $template);
78-
} else {
79-
$wpcommentspopupfile = 'wp-comments-popup.php';
80-
}
71+
if ( file_exists( TEMPLATEPATH . '/comments-popup.php') )
72+
require( TEMPLATEPATH . '/comments-popup.php');
73+
else
74+
require( ABSPATH . 'wp-includes/wp-comments-popup.php');
8175
} else {
8276
$wpcommentspopupfile = $file;
8377
}

wp-includes/functions.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,23 +1058,20 @@ function wp_head() {
10581058
function is_single ($post = '') {
10591059
global $wp_query;
10601060

1061-
if (! $wp_query->is_single) {
1061+
if ( !$wp_query->is_single )
10621062
return false;
1063-
}
10641063

1065-
if (empty($post)) {
1064+
if ( empty( $post) )
10661065
return true;
1067-
}
10681066

10691067
$post_obj = $wp_query->get_queried_object();
10701068

1071-
if ($post == $post_obj->ID) {
1069+
if ( $post == $post_obj->ID )
10721070
return true;
1073-
} else if ($post == $post_obj->post_title) {
1071+
elseif ( $post == $post_obj->post_title )
10741072
return true;
1075-
} else if ($post == $post_obj->post_name) {
1073+
elseif ( $post == $post_obj->post_name )
10761074
return true;
1077-
}
10781075

10791076
return false;
10801077
}

wp-includes/template-functions-general.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,31 @@
22

33
/* Note: these tags go anywhere in the template */
44

5+
function get_header() {
6+
global $wpdb, $wp_query;
7+
if ( file_exists( TEMPLATEPATH . '/header.php') )
8+
require_once( TEMPLATEPATH . '/header.php');
9+
else
10+
require_once( ABSPATH . 'wp-includes/wp-header.php');
11+
}
12+
13+
function get_footer() {
14+
global $wpdb, $wp_query;
15+
if ( file_exists( TEMPLATEPATH . '/footer.php') )
16+
require_once( TEMPLATEPATH . '/footer.php');
17+
else
18+
require_once( ABSPATH . 'wp-includes/wp-footer.php');
19+
}
20+
21+
function get_sidebar() {
22+
global $wpdb, $wp_query;
23+
if ( file_exists( TEMPLATEPATH . '/sidebar.php') )
24+
require_once( TEMPLATEPATH . '/sidebar.php');
25+
else
26+
require_once( ABSPATH . 'wp-includes/wp-sidebar.php');
27+
}
28+
29+
530
function wp_loginout() {
631
global $user_level;
732
get_currentuserinfo();
@@ -84,7 +109,7 @@ function get_bloginfo($show='') {
84109
case 'stylesheet_url':
85110
$output = get_stylesheet();
86111
if (empty($output) || $output == 'default') {
87-
$output = get_settings('siteurl') . "/wp-layout.css";
112+
$output = get_settings('siteurl') . "/wp-includes/wp-layout.css";
88113
} else {
89114
$output = get_settings('siteurl') . "/wp-content/themes/$output/style.css";
90115
}
Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,12 @@
1-
<?php
2-
// If a footer.php file exists in the WP root directory we
3-
// use that, otherwise use this default wp-footer.php file.
4-
if ( file_exists(TEMPLATEPATH . '/footer.php') ) :
5-
include_once(TEMPLATEPATH . '/footer.php');
6-
else :
7-
?>
1+
<!-- begin footer -->
82
</div>
93

10-
11-
12-
<?php
13-
// This code pulls in the sidebar:
14-
include(ABSPATH . '/wp-sidebar.php');
15-
?>
4+
<?php get_sidebar(); ?>
165

176
</div>
187

198
<p class="credit"><!--<?php echo $wpdb->num_queries; ?> queries. <?php timer_stop(1); ?> seconds. --> <cite><?php echo sprintf(__("Powered by <a href='http://wordpress.org' title='%s'><strong>WordPress</strong></a>"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></cite></p>
209

2110
<?php do_action('wp_footer', ''); ?>
2211
</body>
23-
</html>
24-
<?php endif; ?>
12+
</html>

wp-header.php renamed to wp-includes/wp-header.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
<?php
2-
// If a header.php file exists in the WP root directory we
3-
// use that, otherwise use this default wp-header.php file.
4-
if ( file_exists(TEMPLATEPATH . '/header.php') ) :
5-
include_once(TEMPLATEPATH . '/header.php');
6-
else :
7-
?>
81
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
92
<html xmlns="http://www.w3.org/1999/xhtml">
103

@@ -33,4 +26,4 @@
3326
<h1 id="header"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
3427

3528
<div id="content">
36-
<?php endif; ?>
29+
<!-- end header -->

0 commit comments

Comments
 (0)