Break blog header up into functional chunks. Stick it all in a WP class for now. Make wp() the front door. Move template/theme loader code into template-loader.php. Clean up feed file loadup. Modularize.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1f7552af25
commit
1baf503d64
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
|
||||
if (empty($feed)) {
|
||||
$blog = 1;
|
||||
$feed = 'atom';
|
||||
$doing_rss = 1;
|
||||
require('wp-blog-header.php');
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
wp('feed=atom');
|
||||
}
|
||||
|
||||
header('Content-type: application/atom+xml; charset=' . get_settings('blog_charset'), true);
|
||||
|
|
|
@ -11,239 +11,10 @@ $wp_did_header = true;
|
|||
|
||||
require_once( dirname(__FILE__) . '/wp-config.php');
|
||||
|
||||
$query_vars = array();
|
||||
wp();
|
||||
gzip_compression();
|
||||
|
||||
// Process PATH_INFO and 404.
|
||||
if ((isset($_GET['error']) && $_GET['error'] == '404') ||
|
||||
((! empty($_SERVER['PATH_INFO'])) &&
|
||||
('/' != $_SERVER['PATH_INFO']) &&
|
||||
(false === strpos($_SERVER['PATH_INFO'], '.php'))
|
||||
)) {
|
||||
|
||||
// If we match a rewrite rule, this will be cleared.
|
||||
$error = '404';
|
||||
|
||||
// Fetch the rewrite rules.
|
||||
$rewrite = $wp_rewrite->wp_rewrite_rules();
|
||||
|
||||
if (! empty($rewrite)) {
|
||||
$pathinfo = $_SERVER['PATH_INFO'];
|
||||
$req_uri = $_SERVER['REQUEST_URI'];
|
||||
$home_path = parse_url(get_settings('home'));
|
||||
$home_path = $home_path['path'];
|
||||
|
||||
// Trim path info from the end and the leading home path from the
|
||||
// front. For path info requests, this leaves us with the requesting
|
||||
// filename, if any. For 404 requests, this leaves us with the
|
||||
// requested permalink.
|
||||
$req_uri = str_replace($pathinfo, '', $req_uri);
|
||||
$req_uri = str_replace($home_path, '', $req_uri);
|
||||
$req_uri = trim($req_uri, '/');
|
||||
$pathinfo = trim($pathinfo, '/');
|
||||
|
||||
// The requested permalink is in $pathinfo for path info requests and
|
||||
// $req_uri for other requests.
|
||||
if (! empty($pathinfo)) {
|
||||
$request = $pathinfo;
|
||||
} else {
|
||||
$request = $req_uri;
|
||||
}
|
||||
|
||||
// Look for matches.
|
||||
$request_match = $request;
|
||||
foreach ($rewrite as $match => $query) {
|
||||
// If the requesting file is the anchor of the match, prepend it
|
||||
// to the path info.
|
||||
if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0)) {
|
||||
$request_match = $req_uri . '/' . $request;
|
||||
}
|
||||
|
||||
if (preg_match("!^$match!", $request_match, $matches)) {
|
||||
// Got a match.
|
||||
// Trim the query of everything up to the '?'.
|
||||
$query = preg_replace("!^.+\?!", '', $query);
|
||||
|
||||
// Substitute the substring matches into the query.
|
||||
eval("\$query = \"$query\";");
|
||||
|
||||
// Parse the query.
|
||||
parse_str($query, $query_vars);
|
||||
|
||||
// If we're processing a 404 request, clear the error var
|
||||
// since we found something.
|
||||
if (isset($_GET['error'])) {
|
||||
unset($_GET['error']);
|
||||
}
|
||||
|
||||
if (isset($error)) {
|
||||
unset($error);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');
|
||||
|
||||
$wpvarstoreset = apply_filters('query_vars', $wpvarstoreset);
|
||||
|
||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
$wpvar = $wpvarstoreset[$i];
|
||||
if (!isset($$wpvar)) {
|
||||
if (empty($_POST[$wpvar])) {
|
||||
if (empty($_GET[$wpvar]) && empty($query_vars[$wpvar])) {
|
||||
$$wpvar = '';
|
||||
} elseif (!empty($_GET[$wpvar])) {
|
||||
$$wpvar = $_GET[$wpvar];
|
||||
} else {
|
||||
$$wpvar = $query_vars[$wpvar];
|
||||
}
|
||||
} else {
|
||||
$$wpvar = $_POST[$wpvar];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sending HTTP headers
|
||||
@header('X-Pingback: '. get_bloginfo('pingback_url'));
|
||||
|
||||
if ( !empty($error) && '404' == $error ) {
|
||||
status_header( 404 );
|
||||
} else if ( empty($feed) ) {
|
||||
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
} else {
|
||||
// We're showing a feed, so WP is indeed the only thing that last changed
|
||||
if ( $withcomments )
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
|
||||
else
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
|
||||
$wp_etag = '"' . md5($wp_last_modified) . '"';
|
||||
@header("Last-Modified: $wp_last_modified");
|
||||
@header("ETag: $wp_etag");
|
||||
|
||||
// Support for Conditional GET
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
|
||||
else $client_etag = false;
|
||||
|
||||
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||
// If string is empty, return 0. If not, attempt to parse into a timestamp
|
||||
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
|
||||
|
||||
// Make a timestamp for our most recent modification...
|
||||
$wp_modified_timestamp = strtotime($wp_last_modified);
|
||||
|
||||
if ( ($client_last_modified && $client_etag) ?
|
||||
(($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
|
||||
(($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
|
||||
status_header( 304 );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$use_gzipcompression = get_settings('gzipcompression');
|
||||
|
||||
$more_wpvars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging');
|
||||
|
||||
// Construct the query string.
|
||||
$query_string = '';
|
||||
foreach (array_merge($wpvarstoreset, $more_wpvars) as $wpvar) {
|
||||
if ($$wpvar != '') {
|
||||
$query_string .= (strlen($query_string) < 1) ? '' : '&';
|
||||
$query_string .= $wpvar . '=' . rawurlencode($$wpvar);
|
||||
}
|
||||
}
|
||||
|
||||
$query_string = apply_filters('query_string', $query_string);
|
||||
|
||||
update_category_cache();
|
||||
get_currentuserinfo();
|
||||
|
||||
// Call query posts to do the work.
|
||||
$posts = & query_posts($query_string);
|
||||
|
||||
// Extract updated query vars back into global namespace.
|
||||
extract($wp_query->query_vars);
|
||||
|
||||
if ( is_single() || is_page() ) {
|
||||
$more = 1;
|
||||
$single = 1;
|
||||
}
|
||||
|
||||
// Issue a 404 if a permalink request doesn't match any posts. Don't issue a
|
||||
// 404 if one was already issued, if the request was a search, or if the
|
||||
// request was a regular query string request rather than a permalink request.
|
||||
if ( (0 == count($posts)) && !is_404() && !is_search()
|
||||
&& ( isset($rewrite) || (!empty($_SERVER['QUERY_STRING']) &&
|
||||
(false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
|
||||
$wp_query->is_404 = true;
|
||||
status_header( 404 );
|
||||
} else {
|
||||
status_header( 200 );
|
||||
}
|
||||
|
||||
if ($pagenow != 'post.php' && $pagenow != 'edit.php') {
|
||||
if ( get_settings('gzipcompression') )
|
||||
gzip_compression();
|
||||
}
|
||||
|
||||
// Template redirection
|
||||
if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
|
||||
do_action('template_redirect');
|
||||
if ( is_feed() && empty($doing_rss) ) {
|
||||
include(ABSPATH . '/wp-feed.php');
|
||||
exit;
|
||||
} else if ( is_trackback() && empty($doing_trackback) ) {
|
||||
include(ABSPATH . '/wp-trackback.php');
|
||||
exit;
|
||||
} else if ( is_404() && get_404_template() ) {
|
||||
include(get_404_template());
|
||||
exit;
|
||||
} else if ( is_search() && get_search_template() ) {
|
||||
include(get_search_template());
|
||||
exit;
|
||||
} else if ( is_home() && get_home_template() ) {
|
||||
include(get_home_template());
|
||||
exit;
|
||||
} else if ( is_single() && get_single_template() ) {
|
||||
include(get_single_template());
|
||||
exit;
|
||||
} else if ( is_page() && get_page_template() ) {
|
||||
include(get_page_template());
|
||||
exit;
|
||||
} else if ( is_category() && get_category_template()) {
|
||||
include(get_category_template());
|
||||
exit;
|
||||
} else if ( is_author() && get_author_template() ) {
|
||||
include(get_author_template());
|
||||
exit;
|
||||
} else if ( is_date() && get_date_template() ) {
|
||||
include(get_date_template());
|
||||
exit;
|
||||
} else if ( is_archive() && get_archive_template() ) {
|
||||
include(get_archive_template());
|
||||
exit;
|
||||
} else if ( is_comments_popup() && get_comments_popup_template() ) {
|
||||
include(get_comments_popup_template());
|
||||
exit;
|
||||
} else if ( is_paged() && get_paged_template() ) {
|
||||
include(get_paged_template());
|
||||
exit;
|
||||
} else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
|
||||
include(TEMPLATEPATH . "/index.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
// Process feeds and trackbacks even if not using themes.
|
||||
if ( is_feed() && empty($doing_rss) ) {
|
||||
include(ABSPATH . '/wp-feed.php');
|
||||
exit;
|
||||
} else if ( is_trackback() && empty($doing_trackback) ) {
|
||||
include(ABSPATH . '/wp-trackback.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
require_once(ABSPATH . WPINC . '/template-loader.php');
|
||||
|
||||
endif;
|
||||
?>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?php
|
||||
if ( empty($feed) ) {
|
||||
$feed = 'rss2';
|
||||
$withcomments = 1;
|
||||
$doing_rss = 1;
|
||||
require('wp-blog-header.php');
|
||||
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
wp('feed=rss2&withcomments=1');
|
||||
}
|
||||
|
||||
header('Content-type: text/xml;charset=' . get_settings('blog_charset'), true);
|
||||
|
|
|
@ -663,11 +663,6 @@ class WP_Query {
|
|||
}
|
||||
}
|
||||
|
||||
// Make a global instance.
|
||||
if (! isset($wp_query)) {
|
||||
$wp_query = new WP_Query();
|
||||
}
|
||||
|
||||
class retrospam_mgr {
|
||||
var $spam_words;
|
||||
var $comments_list;
|
||||
|
@ -1291,9 +1286,227 @@ class WP_Rewrite {
|
|||
}
|
||||
}
|
||||
|
||||
// Make a global instance.
|
||||
if (! isset($wp_rewrite)) {
|
||||
$wp_rewrite = new WP_Rewrite();
|
||||
class WP {
|
||||
var $public_query_vars = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');
|
||||
|
||||
var $private_query_vars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging');
|
||||
|
||||
var $query_vars;
|
||||
var $query_string;
|
||||
var $did_permalink = false;
|
||||
|
||||
function parse_request($extra_query_vars = '') {
|
||||
global $wp_rewrite;
|
||||
|
||||
$this->query_vars = array();
|
||||
|
||||
if (! empty($extra_query_vars))
|
||||
parse_str($extra_query_vars, $extra_query_vars);
|
||||
|
||||
// Process PATH_INFO and 404.
|
||||
if ((isset($_GET['error']) && $_GET['error'] == '404') ||
|
||||
((! empty($_SERVER['PATH_INFO'])) &&
|
||||
('/' != $_SERVER['PATH_INFO']) &&
|
||||
(false === strpos($_SERVER['PATH_INFO'], '.php'))
|
||||
)) {
|
||||
|
||||
$this->did_permalink = true;
|
||||
|
||||
// If we match a rewrite rule, this will be cleared.
|
||||
$error = '404';
|
||||
|
||||
// Fetch the rewrite rules.
|
||||
$rewrite = $wp_rewrite->wp_rewrite_rules();
|
||||
|
||||
if (! empty($rewrite)) {
|
||||
$pathinfo = $_SERVER['PATH_INFO'];
|
||||
$req_uri = $_SERVER['REQUEST_URI'];
|
||||
$home_path = parse_url(get_settings('home'));
|
||||
$home_path = $home_path['path'];
|
||||
|
||||
// Trim path info from the end and the leading home path from the
|
||||
// front. For path info requests, this leaves us with the requesting
|
||||
// filename, if any. For 404 requests, this leaves us with the
|
||||
// requested permalink.
|
||||
$req_uri = str_replace($pathinfo, '', $req_uri);
|
||||
$req_uri = str_replace($home_path, '', $req_uri);
|
||||
$req_uri = trim($req_uri, '/');
|
||||
$pathinfo = trim($pathinfo, '/');
|
||||
|
||||
// The requested permalink is in $pathinfo for path info requests and
|
||||
// $req_uri for other requests.
|
||||
if (! empty($pathinfo)) {
|
||||
$request = $pathinfo;
|
||||
} else {
|
||||
$request = $req_uri;
|
||||
}
|
||||
|
||||
// Look for matches.
|
||||
$request_match = $request;
|
||||
foreach ($rewrite as $match => $query) {
|
||||
// If the requesting file is the anchor of the match, prepend it
|
||||
// to the path info.
|
||||
if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0)) {
|
||||
$request_match = $req_uri . '/' . $request;
|
||||
}
|
||||
|
||||
if (preg_match("!^$match!", $request_match, $matches)) {
|
||||
// Got a match.
|
||||
// Trim the query of everything up to the '?'.
|
||||
$query = preg_replace("!^.+\?!", '', $query);
|
||||
|
||||
// Substitute the substring matches into the query.
|
||||
eval("\$query = \"$query\";");
|
||||
|
||||
// Parse the query.
|
||||
parse_str($query, $query_vars);
|
||||
|
||||
// If we're processing a 404 request, clear the error var
|
||||
// since we found something.
|
||||
if (isset($_GET['error'])) {
|
||||
unset($_GET['error']);
|
||||
}
|
||||
|
||||
if (isset($error)) {
|
||||
unset($error);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
|
||||
|
||||
for ($i=0; $i<count($this->public_query_vars); $i += 1) {
|
||||
$wpvar = $this->public_query_vars[$i];
|
||||
if (isset($extra_query_vars[$wpvar]))
|
||||
$this->query_vars[$wpvar] = $extra_query_vars[$wpvar];
|
||||
elseif (isset($GLOBALS[$wpvar]))
|
||||
$this->query_vars[$wpvar] = $GLOBALS[$wpvar];
|
||||
elseif (!empty($_POST[$wpvar]))
|
||||
$this->query_vars[$wpvar] = $_POST[$wpvar];
|
||||
elseif (!empty($_GET[$wpvar]))
|
||||
$this->query_vars[$wpvar] = $_GET[$wpvar];
|
||||
elseif (!empty($query_vars[$wpvar]))
|
||||
$this->query_vars[$wpvar] = $query_vars[$wpvar];
|
||||
else
|
||||
$this->query_vars[$wpvar] = '';
|
||||
}
|
||||
}
|
||||
|
||||
function send_headers() {
|
||||
@header('X-Pingback: '. get_bloginfo('pingback_url'));
|
||||
if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
|
||||
status_header( 404 );
|
||||
} else if ( empty($this->query_vars['feed']) ) {
|
||||
@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
|
||||
} else {
|
||||
// We're showing a feed, so WP is indeed the only thing that last changed
|
||||
if ( $this->query_vars['withcomments'] )
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
|
||||
else
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
|
||||
$wp_etag = '"' . md5($wp_last_modified) . '"';
|
||||
@header("Last-Modified: $wp_last_modified");
|
||||
@header("ETag: $wp_etag");
|
||||
|
||||
// Support for Conditional GET
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
|
||||
else $client_etag = false;
|
||||
|
||||
$client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
|
||||
// If string is empty, return 0. If not, attempt to parse into a timestamp
|
||||
$client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
|
||||
|
||||
// Make a timestamp for our most recent modification...
|
||||
$wp_modified_timestamp = strtotime($wp_last_modified);
|
||||
|
||||
if ( ($client_last_modified && $client_etag) ?
|
||||
(($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
|
||||
(($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
|
||||
status_header( 304 );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function build_query_string() {
|
||||
$this->query_string = '';
|
||||
|
||||
foreach ($this->public_query_vars as $wpvar) {
|
||||
if (isset($this->query_vars[$wpvar]) && '' != $this->query_vars[$wpvar]) {
|
||||
$this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
|
||||
$this->query_string .= $wpvar . '=' . rawurlencode($this->query_vars[$wpvar]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->private_query_vars as $wpvar) {
|
||||
if (isset($GLOBALS[$wpvar]) && '' != $GLOBALS[$wpvar]) {
|
||||
$this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
|
||||
$this->query_string .= $wpvar . '=' . rawurlencode($GLOBALS[$wpvar]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->query_string = apply_filters('query_string', $this->query_string);
|
||||
}
|
||||
|
||||
function register_globals() {
|
||||
global $wp_query;
|
||||
// Extract updated query vars back into global namespace.
|
||||
foreach ($wp_query->query_vars as $key => $value) {
|
||||
$GLOBALS[$key] = $value;
|
||||
}
|
||||
|
||||
$GLOBALS['query_string'] = & $this->query_string;
|
||||
$GLOBALS['posts'] = & $wp_query->posts;
|
||||
$GLOBALS['post'] = & $wp_query->post;
|
||||
|
||||
if ( is_single() || is_page() ) {
|
||||
$GLOBALS['more'] = 1;
|
||||
$GLOBALS['single'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
function prime_caches() {
|
||||
update_category_cache();
|
||||
get_currentuserinfo();
|
||||
}
|
||||
|
||||
function query_posts() {
|
||||
$this->build_query_string();
|
||||
query_posts($this->query_string);
|
||||
}
|
||||
|
||||
function handle_404() {
|
||||
global $wp_query;
|
||||
// Issue a 404 if a permalink request doesn't match any posts. Don't
|
||||
// issue a 404 if one was already issued, if the request was a search,
|
||||
// or if the request was a regular query string request rather than a
|
||||
// permalink request.
|
||||
if ( (0 == count($wp_query->posts)) && !is_404() && !is_search()
|
||||
&& ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) &&
|
||||
(false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
|
||||
$wp_query->is_404 = true;
|
||||
status_header( 404 );
|
||||
} else {
|
||||
status_header( 200 );
|
||||
}
|
||||
}
|
||||
|
||||
function main($query_args = '') {
|
||||
$this->parse_request($query_args);
|
||||
$this->send_headers();
|
||||
$this->prime_caches();
|
||||
$this->query_posts();
|
||||
$this->handle_404();
|
||||
$this->register_globals();
|
||||
}
|
||||
|
||||
function WP() {
|
||||
// Empty.
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1849,6 +1849,11 @@ function wp_remote_fopen( $uri ) {
|
|||
}
|
||||
}
|
||||
|
||||
function wp($query_vars = '') {
|
||||
global $wp;
|
||||
$wp->main($query_vars);
|
||||
}
|
||||
|
||||
function status_header( $header ) {
|
||||
if ( 200 == $header ) {
|
||||
$text = 'OK';
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
|
||||
do_action('template_redirect');
|
||||
if ( is_feed() ) {
|
||||
include(ABSPATH . '/wp-feed.php');
|
||||
exit;
|
||||
} else if ( is_trackback() ) {
|
||||
include(ABSPATH . '/wp-trackback.php');
|
||||
exit;
|
||||
} else if ( is_404() && get_404_template() ) {
|
||||
include(get_404_template());
|
||||
exit;
|
||||
} else if ( is_search() && get_search_template() ) {
|
||||
include(get_search_template());
|
||||
exit;
|
||||
} else if ( is_home() && get_home_template() ) {
|
||||
include(get_home_template());
|
||||
exit;
|
||||
} else if ( is_single() && get_single_template() ) {
|
||||
include(get_single_template());
|
||||
exit;
|
||||
} else if ( is_page() && get_page_template() ) {
|
||||
include(get_page_template());
|
||||
exit;
|
||||
} else if ( is_category() && get_category_template()) {
|
||||
include(get_category_template());
|
||||
exit;
|
||||
} else if ( is_author() && get_author_template() ) {
|
||||
include(get_author_template());
|
||||
exit;
|
||||
} else if ( is_date() && get_date_template() ) {
|
||||
include(get_date_template());
|
||||
exit;
|
||||
} else if ( is_archive() && get_archive_template() ) {
|
||||
include(get_archive_template());
|
||||
exit;
|
||||
} else if ( is_comments_popup() && get_comments_popup_template() ) {
|
||||
include(get_comments_popup_template());
|
||||
exit;
|
||||
} else if ( is_paged() && get_paged_template() ) {
|
||||
include(get_paged_template());
|
||||
exit;
|
||||
} else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
|
||||
include(TEMPLATEPATH . "/index.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
// Process feeds and trackbacks even if not using themes.
|
||||
if ( is_feed() ) {
|
||||
include(ABSPATH . '/wp-feed.php');
|
||||
exit;
|
||||
} else if ( is_trackback() ) {
|
||||
include(ABSPATH . '/wp-trackback.php');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,10 +1,8 @@
|
|||
<?php /* RDF 1.0 generator, original version by garym@teledyn.com */
|
||||
|
||||
if (empty($feed)) {
|
||||
$blog = 1; // enter your blog's ID
|
||||
$feed = 'rdf';
|
||||
$doing_rss = 1;
|
||||
require('wp-blog-header.php');
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
wp('feed=rdf');
|
||||
}
|
||||
|
||||
header('Content-type: application/rdf+xml; charset=' . get_settings('blog_charset'), true);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
|
||||
if (empty($feed)) {
|
||||
$blog = 1;
|
||||
$feed = 'rss';
|
||||
$doing_rss = 1;
|
||||
require('wp-blog-header.php');
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
wp('feed=rss');
|
||||
}
|
||||
|
||||
header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
|
||||
if (empty($feed)) {
|
||||
$blog = 1;
|
||||
$feed = 'rss2';
|
||||
$doing_rss = 1;
|
||||
require('wp-blog-header.php');
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
wp('feed=rss2');
|
||||
}
|
||||
|
||||
header('Content-type: text/xml; charset=' . get_settings('blog_charset'), true);
|
||||
|
|
|
@ -145,6 +145,10 @@ function shutdown_action_hook() {
|
|||
}
|
||||
register_shutdown_function('shutdown_action_hook');
|
||||
|
||||
// Everything is loaded.
|
||||
$wp_query = new WP_Query();
|
||||
$wp_rewrite = new WP_Rewrite();
|
||||
$wp = new WP();
|
||||
|
||||
// Everything is loaded and initialized.
|
||||
do_action('init');
|
||||
?>
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
require_once( dirname(__FILE__) . '/wp-config.php' );
|
||||
|
||||
if ( empty($doing_trackback) ) {
|
||||
$doing_trackback = true;
|
||||
$tb = true;
|
||||
require_once('wp-blog-header.php');
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
wp('tb=1');
|
||||
}
|
||||
|
||||
function trackback_response($error = 0, $error_message = '') {
|
||||
|
|
Loading…
Reference in New Issue