2003-06-12 18:44:37 -04:00
|
|
|
<?php
|
2007-12-20 15:44:52 -05:00
|
|
|
/**
|
2010-03-17 00:39:50 -04:00
|
|
|
* Used to set up and fix common variables and include
|
2007-12-20 15:44:52 -05:00
|
|
|
* 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.
|
2010-02-12 02:56:28 -05:00
|
|
|
wp_initial_constants( );
|
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-02-20 19:03:42 -05:00
|
|
|
// Check if we have recieved a request due to missing favicon.ico
|
2010-02-18 18:41:50 -05:00
|
|
|
wp_favicon_request();
|
|
|
|
|
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 )
|
2010-05-02 18:18:36 -04:00
|
|
|
WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @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-02-13 18:09:54 -05:00
|
|
|
// Load early WordPress files.
|
2010-01-19 12:27:03 -05:00
|
|
|
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-02-13 18:09:54 -05:00
|
|
|
// Load early WordPress files.
|
|
|
|
require( ABSPATH . WPINC . '/plugin.php' );
|
|
|
|
require( ABSPATH . WPINC . '/default-filters.php' );
|
2010-02-20 07:50:09 -05:00
|
|
|
require( ABSPATH . WPINC . '/pomo/mo.php' );
|
2010-02-13 18:09:54 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Initialize multisite if enabled.
|
2010-02-13 17:35:11 -05:00
|
|
|
if ( is_multisite() ) {
|
2010-02-14 20:08:23 -05:00
|
|
|
require( ABSPATH . WPINC . '/ms-blogs.php' );
|
2010-01-28 11:09:52 -05:00
|
|
|
require( ABSPATH . WPINC . '/ms-settings.php' );
|
2010-04-04 20:00:13 -04:00
|
|
|
} elseif ( ! defined( 'MULTISITE' ) ) {
|
|
|
|
define( 'MULTISITE', false );
|
2010-02-13 17:35:11 -05:00
|
|
|
}
|
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.
|
2010-02-20 07:50:09 -05:00
|
|
|
require( 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' );
|
2010-04-13 17:45:57 -04:00
|
|
|
require( ABSPATH . WPINC . '/class-http.php' );
|
2010-01-19 12:27:03 -05:00
|
|
|
require( ABSPATH . WPINC . '/widgets.php' );
|
2010-02-24 03:06:36 -05:00
|
|
|
require( ABSPATH . WPINC . '/nav-menu.php' );
|
|
|
|
require( ABSPATH . WPINC . '/nav-menu-template.php' );
|
2010-01-19 12:27:03 -05:00
|
|
|
|
|
|
|
// Load multisite-specific files.
|
2010-01-06 15:19:35 -05:00
|
|
|
if ( is_multisite() ) {
|
2010-02-20 07:50:09 -05:00
|
|
|
require( ABSPATH . WPINC . '/ms-functions.php' );
|
|
|
|
require( ABSPATH . WPINC . '/ms-default-filters.php' );
|
|
|
|
require( 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-12 02:56:28 -05:00
|
|
|
wp_plugin_directory_constants( );
|
2010-01-15 17:03:41 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load must-use plugins.
|
2010-02-12 02:59:11 -05:00
|
|
|
foreach ( wp_get_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-04-23 12:18:33 -04:00
|
|
|
if ( is_multisite() )
|
2010-02-12 03:22:34 -05:00
|
|
|
ms_cookie_constants( );
|
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().
|
2010-02-12 02:56:28 -05:00
|
|
|
wp_cookie_constants( );
|
|
|
|
|
|
|
|
// Define and enforce our SSL constants
|
|
|
|
wp_ssl_constants( );
|
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-04-08 12:45:18 -04:00
|
|
|
// Make taxonomies and posts available to plugins and themes.
|
|
|
|
// @plugin authors: warning: these get registered again on the init hook.
|
2009-06-15 17:53:51 -04:00
|
|
|
create_initial_taxonomies();
|
2010-04-08 12:45:18 -04:00
|
|
|
create_initial_post_types();
|
2009-06-15 17:53:51 -04:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// Load active plugins.
|
2010-02-12 02:59:11 -05:00
|
|
|
foreach ( wp_get_active_and_valid_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' );
|
2010-02-18 18:17:06 -05:00
|
|
|
require( ABSPATH . WPINC . '/pluggable-deprecated.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-02-12 02:56:28 -05:00
|
|
|
// Define constants which affect functionality if not already defined.
|
|
|
|
wp_functionality_constants( );
|
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-02-12 02:56:28 -05:00
|
|
|
// Define the template related constants.
|
|
|
|
wp_templating_constants( );
|
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 ) )
|
2010-02-20 07:50:09 -05:00
|
|
|
require( $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.
|
2010-02-20 07:50:09 -05:00
|
|
|
require( 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' );
|
|
|
|
|
2010-02-19 05:00:00 -05:00
|
|
|
do_action( 'after_setup_theme' );
|
2010-02-14 16:27:55 -05:00
|
|
|
|
2010-01-19 12:27:03 -05:00
|
|
|
// 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
|
|
|
|
2010-02-27 22:08:16 -05:00
|
|
|
/**
|
|
|
|
* Most of WP is loaded at this stage, and the user is authenticated. WP continues
|
|
|
|
* to load on the init hook that follows (e.g. widgets), and many plugins instantiate
|
|
|
|
* themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
|
|
|
|
*
|
|
|
|
* If you wish to plug an action once WP is loaded, use the wp_loaded hook below.
|
|
|
|
*/
|
2010-01-19 12:27:03 -05:00
|
|
|
do_action( 'init' );
|
2005-11-10 20:37:25 -05:00
|
|
|
|
2010-04-23 12:18:33 -04:00
|
|
|
// Check site status
|
|
|
|
if ( is_multisite() ) {
|
|
|
|
if ( true !== ( $file = ms_site_check() ) ) {
|
|
|
|
require( $file );
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
unset($file);
|
|
|
|
}
|
|
|
|
|
2010-02-27 22:08:16 -05:00
|
|
|
/**
|
2010-02-28 14:25:53 -05:00
|
|
|
* This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
|
2010-02-27 22:08:16 -05:00
|
|
|
*
|
2010-03-26 15:44:43 -04:00
|
|
|
* AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
|
|
|
|
* users not logged in.
|
|
|
|
*
|
|
|
|
* @link http://codex.wordpress.org/AJAX_in_Plugins
|
2010-02-28 14:25:53 -05:00
|
|
|
*
|
|
|
|
* @since 3.0.0
|
2010-02-27 22:08:16 -05:00
|
|
|
*/
|
|
|
|
do_action('wp_loaded');
|
2010-02-01 21:17:33 -05:00
|
|
|
?>
|