2003-06-12 18:44:37 -04:00
|
|
|
<?php
|
2007-12-20 15:44:52 -05:00
|
|
|
/**
|
|
|
|
* Used to setup and fix common variables and include
|
|
|
|
* the WordPress procedural and class library.
|
|
|
|
*
|
2010-01-15 17:03:41 -05:00
|
|
|
* Allows for some configuration in wp-config.php (see default-constants.php)
|
2007-12-20 15:44:52 -05:00
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
|
|
|
|
2010-01-10 13:10:51 -05:00
|
|
|
/**
|
2010-01-15 17:03:41 -05:00
|
|
|
* Stores the location of the WordPress directory of functions, classes, and core content.
|
2010-01-10 13:10:51 -05:00
|
|
|
*
|
2010-01-15 17:03:41 -05:00
|
|
|
* @since 1.0.0
|
2010-01-10 13:10:51 -05:00
|
|
|
*/
|
2010-01-19 12:27:03 -05:00
|
|
|
define( 'WPINC', 'wp-includes' );
|
2010-01-10 13:10:51 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Include files required for initialization.
|
|
|
|
require( ABSPATH . WPINC . '/load.php' );
|
|
|
|
require( ABSPATH . WPINC . '/default-constants.php' );
|
|
|
|
require( ABSPATH . WPINC . '/version.php' );
|
2008-01-29 12:25:45 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
|
|
|
|
wp_default_constants( 'init' );
|
2008-01-29 12:25:45 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
|
|
|
|
set_magic_quotes_runtime( 0 );
|
|
|
|
@ini_set( 'magic_quotes_sybase', 0 );
|
2008-03-03 16:05:23 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Set default timezone in PHP 5.
|
|
|
|
if ( function_exists( 'date_default_timezone_set' ) )
|
|
|
|
date_default_timezone_set( 'UTC' );
|
2009-12-02 12:50:07 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Turn register_globals off.
|
2007-09-03 19:32:58 -04:00
|
|
|
wp_unregister_GLOBALS();
|
2007-06-12 17:59:22 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Ensure these global variables do not exist so they do not interfere with WordPress.
|
2008-01-09 12:48:00 -05:00
|
|
|
unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
|
2005-08-09 18:38:32 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Standardize $_SERVER variables across setups.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_fix_server_vars();
|
2005-11-10 18:57:45 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Check for the required PHP version and for the MySQL extension or a database drop-in.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_check_php_mysql_versions();
|
2005-11-14 03:56:40 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Check if we're in maintenance mode.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_maintenance();
|
2006-09-07 19:26:52 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Start loading timer.
|
2004-10-04 04:03:52 -04:00
|
|
|
timer_start();
|
2004-08-10 18:02:26 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Check if we're in WP_DEBUG mode.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_debug_mode();
|
2004-01-02 18:55:40 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
|
2010-01-15 17:03:41 -05:00
|
|
|
if ( WP_CACHE )
|
2008-05-27 13:55:24 -04:00
|
|
|
@include WP_CONTENT_DIR . '/advanced-cache.php';
|
2005-02-14 19:46:58 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Define WP_LANG_DIR if not set.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_set_lang_dir();
|
2008-08-05 19:56:52 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Include early WordPress files.
|
|
|
|
require( ABSPATH . WPINC . '/compat.php' );
|
|
|
|
require( ABSPATH . WPINC . '/functions.php' );
|
|
|
|
require( ABSPATH . WPINC . '/classes.php' );
|
2007-09-13 02:23:23 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Include the wpdb class, or a db.php database drop-in if present.
|
2009-04-10 17:56:30 -04:00
|
|
|
require_wp_db();
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Set the database table prefix and the format specifiers for database table columns.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_set_wpdb_vars();
|
2009-04-15 15:14:43 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Start the WordPress object cache, or an external object cache if the drop-in is present.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_start_object_cache();
|
2009-12-13 19:38:05 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Initialize multisite if enabled.
|
2010-01-15 18:40:29 -05:00
|
|
|
if ( is_multisite() )
|
2010-01-28 11:09:52 -05:00
|
|
|
require( ABSPATH . WPINC . '/ms-settings.php' );
|
2010-01-10 13:10:51 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load early WordPress files.
|
|
|
|
require( ABSPATH . WPINC . '/plugin.php' );
|
|
|
|
require( ABSPATH . WPINC . '/default-filters.php' );
|
|
|
|
include_once( ABSPATH . WPINC . '/pomo/mo.php' );
|
2010-01-10 13:10:51 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Stop most of WordPress from being loaded if we just want the basics.
|
|
|
|
if ( SHORTINIT )
|
2010-01-10 13:10:51 -05:00
|
|
|
return false;
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load the l18n library.
|
|
|
|
require_once ( ABSPATH . WPINC . '/l10n.php' );
|
2004-12-19 02:26:43 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Run the installer if WordPress is not installed.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_not_installed();
|
2004-12-19 02:26:43 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load most of WordPress.
|
|
|
|
require( ABSPATH . WPINC . '/formatting.php' );
|
|
|
|
require( ABSPATH . WPINC . '/capabilities.php' );
|
|
|
|
require( ABSPATH . WPINC . '/query.php' );
|
|
|
|
require( ABSPATH . WPINC . '/theme.php' );
|
|
|
|
require( ABSPATH . WPINC . '/user.php' );
|
|
|
|
require( ABSPATH . WPINC . '/meta.php' );
|
|
|
|
require( ABSPATH . WPINC . '/general-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/link-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/author-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/post.php' );
|
|
|
|
require( ABSPATH . WPINC . '/post-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/category.php' );
|
|
|
|
require( ABSPATH . WPINC . '/category-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/comment.php' );
|
|
|
|
require( ABSPATH . WPINC . '/comment-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/rewrite.php' );
|
|
|
|
require( ABSPATH . WPINC . '/feed.php' );
|
|
|
|
require( ABSPATH . WPINC . '/bookmark.php' );
|
|
|
|
require( ABSPATH . WPINC . '/bookmark-template.php' );
|
|
|
|
require( ABSPATH . WPINC . '/kses.php' );
|
|
|
|
require( ABSPATH . WPINC . '/cron.php' );
|
|
|
|
require( ABSPATH . WPINC . '/deprecated.php' );
|
|
|
|
require( ABSPATH . WPINC . '/script-loader.php' );
|
|
|
|
require( ABSPATH . WPINC . '/taxonomy.php' );
|
|
|
|
require( ABSPATH . WPINC . '/update.php' );
|
|
|
|
require( ABSPATH . WPINC . '/canonical.php' );
|
|
|
|
require( ABSPATH . WPINC . '/shortcodes.php' );
|
|
|
|
require( ABSPATH . WPINC . '/media.php' );
|
|
|
|
require( ABSPATH . WPINC . '/http.php' );
|
|
|
|
require( ABSPATH . WPINC . '/widgets.php' );
|
|
|
|
|
|
|
|
// Load multisite-specific files.
|
2010-01-06 15:19:35 -05:00
|
|
|
if ( is_multisite() ) {
|
|
|
|
require_once( ABSPATH . WPINC . '/ms-functions.php' );
|
|
|
|
require_once( ABSPATH . WPINC . '/ms-default-filters.php' );
|
2010-01-06 21:22:51 -05:00
|
|
|
require_once( ABSPATH . WPINC . '/ms-deprecated.php' );
|
2010-01-06 15:19:35 -05:00
|
|
|
}
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Define constants that rely on the API to obtain the default value.
|
|
|
|
// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
|
2010-02-01 15:26:08 -05:00
|
|
|
wp_default_constants( 'wp_included' );
|
2010-01-15 17:03:41 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load must-use plugins.
|
2010-02-02 16:41:17 -05:00
|
|
|
foreach ( wp_load_mu_plugins() as $mu_plugin ) {
|
2010-01-19 12:27:03 -05:00
|
|
|
include_once( $mu_plugin );
|
|
|
|
}
|
2010-02-02 16:41:17 -05:00
|
|
|
unset( $mu_plugin );
|
2010-01-10 13:10:51 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
do_action( 'muplugins_loaded' );
|
2009-03-06 19:03:40 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Check site status if multisite.
|
2010-01-15 17:25:40 -05:00
|
|
|
if ( is_multisite() ) {
|
2010-01-19 12:27:03 -05:00
|
|
|
if ( true !== ( $file = ms_site_check() ) ) {
|
|
|
|
require_once( $file );
|
|
|
|
die();
|
|
|
|
}
|
2010-01-26 13:20:27 -05:00
|
|
|
unset($file);
|
2010-01-28 11:09:52 -05:00
|
|
|
ms_default_constants( 'cookies' );
|
2010-01-10 13:10:51 -05:00
|
|
|
}
|
2008-05-27 13:46:01 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
|
|
|
|
wp_default_constants( 'ms_loaded' );
|
2005-07-18 15:55:24 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Create common globals.
|
|
|
|
require( ABSPATH . WPINC . '/vars.php' );
|
2003-12-31 18:51:41 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Make taxonomies available to plugins and themes.
|
|
|
|
// @plugin authors: warning: this gets registered again on the init hook.
|
2009-06-15 17:53:51 -04:00
|
|
|
create_initial_taxonomies();
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load active plugins.
|
2010-02-02 16:41:17 -05:00
|
|
|
foreach ( wp_load_plugins() as $plugin )
|
2010-01-19 12:27:03 -05:00
|
|
|
include_once( $plugin );
|
|
|
|
unset( $plugin );
|
2004-04-19 01:19:45 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load pluggable functions.
|
|
|
|
require( ABSPATH . WPINC . '/pluggable.php' );
|
2005-04-04 19:25:51 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Set internal encoding.
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_set_internal_encoding();
|
2008-03-03 16:05:23 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Run wp_cache_postload() if object cache is enabled and the function exists.
|
|
|
|
if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
|
2005-02-14 19:46:58 -05:00
|
|
|
wp_cache_postload();
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
do_action( 'plugins_loaded' );
|
2005-02-14 19:46:58 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Define WP_POST_REVISIONS if not already defined.
|
|
|
|
wp_default_constants( 'plugins_loaded' );
|
2005-07-05 16:47:22 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
|
2010-01-15 17:03:41 -05:00
|
|
|
wp_magic_quotes();
|
2009-07-31 18:22:54 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
do_action( 'sanitize_comment_cookies' );
|
2006-06-22 16:52:12 -04:00
|
|
|
|
2007-12-20 15:44:52 -05:00
|
|
|
/**
|
|
|
|
* WordPress Query object
|
|
|
|
* @global object $wp_the_query
|
2008-01-09 12:48:00 -05:00
|
|
|
* @since 2.0.0
|
2007-12-20 15:44:52 -05:00
|
|
|
*/
|
2006-11-09 01:50:58 -05:00
|
|
|
$wp_the_query =& new WP_Query();
|
2007-12-20 15:44:52 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the reference to @see $wp_the_query
|
|
|
|
* Use this global for WordPress queries
|
|
|
|
* @global object $wp_query
|
2008-01-09 12:48:00 -05:00
|
|
|
* @since 1.5.0
|
2007-12-20 15:44:52 -05:00
|
|
|
*/
|
2010-01-19 12:27:03 -05:00
|
|
|
$wp_query =& $wp_the_query;
|
2007-12-20 15:44:52 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the WordPress Rewrite object for creating pretty URLs
|
|
|
|
* @global object $wp_rewrite
|
2008-01-09 12:48:00 -05:00
|
|
|
* @since 1.5.0
|
2007-12-20 15:44:52 -05:00
|
|
|
*/
|
2010-01-19 12:27:03 -05:00
|
|
|
$wp_rewrite =& new WP_Rewrite();
|
2007-12-20 15:44:52 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress Object
|
|
|
|
* @global object $wp
|
2008-01-09 12:48:00 -05:00
|
|
|
* @since 2.0.0
|
2007-12-20 15:44:52 -05:00
|
|
|
*/
|
2010-01-19 12:27:03 -05:00
|
|
|
$wp =& new WP();
|
2005-06-10 19:15:13 -04:00
|
|
|
|
2009-03-17 19:44:36 -04:00
|
|
|
/**
|
|
|
|
* WordPress Widget Factory Object
|
|
|
|
* @global object $wp_widget_factory
|
|
|
|
* @since 2.8.0
|
|
|
|
*/
|
|
|
|
$wp_widget_factory =& new WP_Widget_Factory();
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
do_action( 'setup_theme' );
|
2007-12-20 15:44:52 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Define the TEMPLATEPATH and STYLESHEETPATH constants.
|
|
|
|
wp_default_constants( 'setup_theme' );
|
2005-07-13 15:29:18 -04:00
|
|
|
|
|
|
|
// Load the default text localization domain.
|
|
|
|
load_default_textdomain();
|
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Find the blog locale.
|
|
|
|
$locale = get_locale();
|
|
|
|
$locale_file = WP_LANG_DIR . "/$locale.php";
|
|
|
|
if ( is_readable( $locale_file ) )
|
|
|
|
require_once( $locale_file );
|
2010-01-26 13:20:27 -05:00
|
|
|
unset($locale_file);
|
2010-01-19 12:27:03 -05:00
|
|
|
|
|
|
|
// Pull in locale data after loading text domain.
|
|
|
|
require_once( ABSPATH . WPINC . '/locale.php' );
|
2005-07-13 15:29:18 -04:00
|
|
|
|
2007-12-20 15:44:52 -05:00
|
|
|
/**
|
|
|
|
* WordPress Locale object for loading locale domain date and various strings.
|
|
|
|
* @global object $wp_locale
|
2008-01-09 12:48:00 -05:00
|
|
|
* @since 2.1.0
|
2007-12-20 15:44:52 -05:00
|
|
|
*/
|
2006-11-18 19:12:57 -05:00
|
|
|
$wp_locale =& new WP_Locale();
|
2006-04-01 19:20:11 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load the functions for the active theme, for both parent and child theme if applicable.
|
|
|
|
if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
|
|
|
|
include( STYLESHEETPATH . '/functions.php' );
|
|
|
|
if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
|
|
|
|
include( TEMPLATEPATH . '/functions.php' );
|
|
|
|
|
|
|
|
// Load any template functions the theme supports.
|
|
|
|
require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );
|
2005-08-29 19:40:32 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
register_shutdown_function( 'shutdown_action_hook' );
|
2005-07-13 15:29:18 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Set up current user.
|
|
|
|
$wp->init();
|
2008-01-09 15:08:59 -05:00
|
|
|
|
2005-06-10 19:15:13 -04:00
|
|
|
// Everything is loaded and initialized.
|
2010-01-19 12:27:03 -05:00
|
|
|
do_action( 'init' );
|
2005-11-10 20:37:25 -05:00
|
|
|
|
2010-02-01 21:17:33 -05:00
|
|
|
?>
|