From 232e019cc6dfc90f156a1e8f9e044e61d14b41f5 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Thu, 30 Dec 2004 10:58:06 +0000 Subject: [PATCH] Moving default template stuff into wp-includes, uncluttering root git-svn-id: http://svn.automattic.com/wordpress/trunk@2009 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- index.php | 6 ++--- wp-admin/upgrade-schema.php | 2 +- wp-includes/classes.php | 8 +++--- wp-includes/comment-functions.php | 26 +++++++----------- wp-includes/functions.php | 13 ++++----- wp-includes/template-functions-general.php | 27 ++++++++++++++++++- .../wp-comments-popup.php | 0 .../wp-comments.php | 0 wp-footer.php => wp-includes/wp-footer.php | 18 +++---------- wp-header.php => wp-includes/wp-header.php | 9 +------ wp-layout.css => wp-includes/wp-layout.css | 0 wp-sidebar.php => wp-includes/wp-sidebar.php | 16 +++-------- 12 files changed, 56 insertions(+), 69 deletions(-) rename wp-comments-popup.php => wp-includes/wp-comments-popup.php (100%) rename wp-comments.php => wp-includes/wp-comments.php (100%) rename wp-footer.php => wp-includes/wp-footer.php (52%) rename wp-header.php => wp-includes/wp-header.php (83%) rename wp-layout.css => wp-includes/wp-layout.css (100%) rename wp-sidebar.php => wp-includes/wp-sidebar.php (80%) diff --git a/index.php b/index.php index b49ee0a1df..a0ef54bdd7 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ @@ -27,7 +27,7 @@ include(ABSPATH . '/wp-header.php'); - +

@@ -35,4 +35,4 @@ include(ABSPATH . '/wp-header.php'); - \ No newline at end of file + \ No newline at end of file diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index 0a261a392a..c4f9b864fd 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -210,7 +210,7 @@ function populate_options() { add_option('use_linksupdate', 0); add_option('template', 'default'); add_option('stylesheet', 'default'); - add_option('comment_whitelist', 0); + add_option('comment_whitelist', 1); add_option('page_uris'); // Delete unused options diff --git a/wp-includes/classes.php b/wp-includes/classes.php index ad7ec0fd44..db829769fd 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -65,16 +65,16 @@ class WP_Query { if ('' != $qv['name']) { $this->is_single = true; - } else if (($qv['p'] != '') && ($qv['p'] != 'all') && (intval($q['p']) != 0)) { + } elseif ( intval( $q['p'] ) != 0 && $qv['p'] != 'all' ) { $this->is_single = true; - } else if (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) { + } elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) { // If year, month, day, hour, minute, and second are set, a single // post is being queried. $this->is_single = true; - } else if ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) { + } elseif ('' != $qv['static'] || '' != $qv['pagename'] || '' != $qv['page_id']) { $this->is_page = true; $this->is_single = false; - } else if (!empty($qv['s'])) { + } elseif (!empty($qv['s'])) { $this->is_search = true; } else { // Look for archive queries. Dates, categories, authors. diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index 46f9e66402..0a21469bdc 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -2,8 +2,8 @@ // Template functions -function comments_template() { - global $withcomments, $post, $wpdb, $id, $comment; +function comments_template( $show ) { + global $wp_query, $withcomments, $post, $wpdb, $id, $comment; if ( is_single() || is_page() || $withcomments ) : $req = get_settings('require_name_email'); @@ -12,14 +12,10 @@ function comments_template() { $comment_author_url = isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_url_'.COOKIEHASH])) : ''; $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date"); - $template = get_template_directory(); - $template .= "/comments.php"; - - if (file_exists($template)) { - include($template); - } else { - include(ABSPATH . 'wp-comments.php'); - } + if ( file_exists( TEMPLATEPATH . '/comments.php') ) + require( TEMPLATEPATH . '/comments.php'); + else + require( ABSPATH . 'wp-includes/wp-comments.php'); endif; } @@ -72,12 +68,10 @@ function comments_popup_script($width=400, $height=400, $file='') { global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript; if (empty ($file)) { - $template = TEMPLATEPATH . '/comments-popup.php'; - if (file_exists($template)) { - $wpcommentspopupfile = str_replace(ABSPATH, '', $template); - } else { - $wpcommentspopupfile = 'wp-comments-popup.php'; - } + if ( file_exists( TEMPLATEPATH . '/comments-popup.php') ) + require( TEMPLATEPATH . '/comments-popup.php'); + else + require( ABSPATH . 'wp-includes/wp-comments-popup.php'); } else { $wpcommentspopupfile = $file; } diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 58e1fe93df..42735a7fe6 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1058,23 +1058,20 @@ function wp_head() { function is_single ($post = '') { global $wp_query; - if (! $wp_query->is_single) { + if ( !$wp_query->is_single ) return false; - } - if (empty($post)) { + if ( empty( $post) ) return true; - } $post_obj = $wp_query->get_queried_object(); - if ($post == $post_obj->ID) { + if ( $post == $post_obj->ID ) return true; - } else if ($post == $post_obj->post_title) { + elseif ( $post == $post_obj->post_title ) return true; - } else if ($post == $post_obj->post_name) { + elseif ( $post == $post_obj->post_name ) return true; - } return false; } diff --git a/wp-includes/template-functions-general.php b/wp-includes/template-functions-general.php index a26057c030..bc5884d7f2 100644 --- a/wp-includes/template-functions-general.php +++ b/wp-includes/template-functions-general.php @@ -2,6 +2,31 @@ /* Note: these tags go anywhere in the template */ +function get_header() { + global $wpdb, $wp_query; + if ( file_exists( TEMPLATEPATH . '/header.php') ) + require_once( TEMPLATEPATH . '/header.php'); + else + require_once( ABSPATH . 'wp-includes/wp-header.php'); +} + +function get_footer() { + global $wpdb, $wp_query; + if ( file_exists( TEMPLATEPATH . '/footer.php') ) + require_once( TEMPLATEPATH . '/footer.php'); + else + require_once( ABSPATH . 'wp-includes/wp-footer.php'); +} + +function get_sidebar() { + global $wpdb, $wp_query; + if ( file_exists( TEMPLATEPATH . '/sidebar.php') ) + require_once( TEMPLATEPATH . '/sidebar.php'); + else + require_once( ABSPATH . 'wp-includes/wp-sidebar.php'); +} + + function wp_loginout() { global $user_level; get_currentuserinfo(); @@ -84,7 +109,7 @@ function get_bloginfo($show='') { case 'stylesheet_url': $output = get_stylesheet(); if (empty($output) || $output == 'default') { - $output = get_settings('siteurl') . "/wp-layout.css"; + $output = get_settings('siteurl') . "/wp-includes/wp-layout.css"; } else { $output = get_settings('siteurl') . "/wp-content/themes/$output/style.css"; } diff --git a/wp-comments-popup.php b/wp-includes/wp-comments-popup.php similarity index 100% rename from wp-comments-popup.php rename to wp-includes/wp-comments-popup.php diff --git a/wp-comments.php b/wp-includes/wp-comments.php similarity index 100% rename from wp-comments.php rename to wp-includes/wp-comments.php diff --git a/wp-footer.php b/wp-includes/wp-footer.php similarity index 52% rename from wp-footer.php rename to wp-includes/wp-footer.php index 7419d297e3..35c6bdc6fd 100644 --- a/wp-footer.php +++ b/wp-includes/wp-footer.php @@ -1,18 +1,7 @@ - + - - - + @@ -20,5 +9,4 @@ include(ABSPATH . '/wp-sidebar.php'); - - \ No newline at end of file + \ No newline at end of file diff --git a/wp-header.php b/wp-includes/wp-header.php similarity index 83% rename from wp-header.php rename to wp-includes/wp-header.php index 6366c7ce8b..0ee2badddb 100644 --- a/wp-header.php +++ b/wp-includes/wp-header.php @@ -1,10 +1,3 @@ - @@ -33,4 +26,4 @@ else :

- \ No newline at end of file + \ No newline at end of file diff --git a/wp-layout.css b/wp-includes/wp-layout.css similarity index 100% rename from wp-layout.css rename to wp-includes/wp-layout.css diff --git a/wp-sidebar.php b/wp-includes/wp-sidebar.php similarity index 80% rename from wp-sidebar.php rename to wp-includes/wp-sidebar.php index 735dec9a6d..840e7b817d 100644 --- a/wp-sidebar.php +++ b/wp-includes/wp-sidebar.php @@ -1,11 +1,5 @@ - + - - \ No newline at end of file +