2003-06-13 00:44:37 +02:00
|
|
|
<?php
|
2007-12-20 21:44:52 +01:00
|
|
|
/**
|
2010-03-17 05:39:50 +01:00
|
|
|
* Used to set up and fix common variables and include
|
2007-12-20 21:44:52 +01:00
|
|
|
* the WordPress procedural and class library.
|
|
|
|
*
|
2010-01-15 23:03:41 +01:00
|
|
|
* Allows for some configuration in wp-config.php (see default-constants.php)
|
2007-12-20 21:44:52 +01:00
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
*/
|
|
|
|
|
2010-01-10 19:10:51 +01:00
|
|
|
/**
|
2010-01-15 23:03:41 +01:00
|
|
|
* Stores the location of the WordPress directory of functions, classes, and core content.
|
2010-01-10 19:10:51 +01:00
|
|
|
*
|
2010-01-15 23:03:41 +01:00
|
|
|
* @since 1.0.0
|
2010-01-10 19:10:51 +01:00
|
|
|
*/
|
2010-01-19 18:27:03 +01:00
|
|
|
define( 'WPINC', 'wp-includes' );
|
2010-01-10 19:10:51 +01:00
|
|
|
|
2010-01-19 18:27:03 +01: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 18:25:45 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
|
2010-02-12 08:56:28 +01:00
|
|
|
wp_initial_constants( );
|
2008-01-29 18:25:45 +01:00
|
|
|
|
2010-01-19 18:27:03 +01: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 22:05:23 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Set default timezone in PHP 5.
|
|
|
|
if ( function_exists( 'date_default_timezone_set' ) )
|
|
|
|
date_default_timezone_set( 'UTC' );
|
2009-12-02 18:50:07 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Turn register_globals off.
|
2007-09-04 01:32:58 +02:00
|
|
|
wp_unregister_GLOBALS();
|
2007-06-12 23:59:22 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Ensure these global variables do not exist so they do not interfere with WordPress.
|
2008-01-09 18:48:00 +01:00
|
|
|
unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
|
2005-08-10 00:38:32 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Standardize $_SERVER variables across setups.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_fix_server_vars();
|
2005-11-11 00:57:45 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Check for the required PHP version and for the MySQL extension or a database drop-in.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_check_php_mysql_versions();
|
2005-11-14 09:56:40 +01:00
|
|
|
|
2010-02-21 01:03:42 +01:00
|
|
|
// Check if we have recieved a request due to missing favicon.ico
|
2010-02-19 00:41:50 +01:00
|
|
|
wp_favicon_request();
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Check if we're in maintenance mode.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_maintenance();
|
2006-09-08 01:26:52 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Start loading timer.
|
2004-10-04 10:03:52 +02:00
|
|
|
timer_start();
|
2004-08-11 00:02:26 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Check if we're in WP_DEBUG mode.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_debug_mode();
|
2004-01-03 00:55:40 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
|
2010-01-15 23:03:41 +01:00
|
|
|
if ( WP_CACHE )
|
2010-02-20 13:50:09 +01:00
|
|
|
@include( WP_CONTENT_DIR . '/advanced-cache.php' );
|
2005-02-15 01:46:58 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Define WP_LANG_DIR if not set.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_set_lang_dir();
|
2008-08-06 01:56:52 +02:00
|
|
|
|
2010-02-14 00:09:54 +01:00
|
|
|
// Load early WordPress files.
|
2010-01-19 18:27:03 +01:00
|
|
|
require( ABSPATH . WPINC . '/compat.php' );
|
|
|
|
require( ABSPATH . WPINC . '/functions.php' );
|
|
|
|
require( ABSPATH . WPINC . '/classes.php' );
|
2007-09-13 08:23:23 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Include the wpdb class, or a db.php database drop-in if present.
|
2009-04-10 23:56:30 +02:00
|
|
|
require_wp_db();
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Set the database table prefix and the format specifiers for database table columns.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_set_wpdb_vars();
|
2009-04-15 21:14:43 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Start the WordPress object cache, or an external object cache if the drop-in is present.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_start_object_cache();
|
2009-12-14 01:38:05 +01:00
|
|
|
|
2010-02-14 00:09:54 +01:00
|
|
|
// Load early WordPress files.
|
|
|
|
require( ABSPATH . WPINC . '/plugin.php' );
|
|
|
|
require( ABSPATH . WPINC . '/default-filters.php' );
|
2010-02-20 13:50:09 +01:00
|
|
|
require( ABSPATH . WPINC . '/pomo/mo.php' );
|
2010-02-14 00:09:54 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Initialize multisite if enabled.
|
2010-02-13 23:35:11 +01:00
|
|
|
if ( is_multisite() ) {
|
2010-02-15 02:08:23 +01:00
|
|
|
require( ABSPATH . WPINC . '/ms-blogs.php' );
|
2010-01-28 17:09:52 +01:00
|
|
|
require( ABSPATH . WPINC . '/ms-settings.php' );
|
2010-04-05 02:00:13 +02:00
|
|
|
} elseif ( ! defined( 'MULTISITE' ) ) {
|
|
|
|
define( 'MULTISITE', false );
|
2010-02-13 23:35:11 +01:00
|
|
|
}
|
2010-01-10 19:10:51 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Stop most of WordPress from being loaded if we just want the basics.
|
|
|
|
if ( SHORTINIT )
|
2010-01-10 19:10:51 +01:00
|
|
|
return false;
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Load the l18n library.
|
2010-02-20 13:50:09 +01:00
|
|
|
require( ABSPATH . WPINC . '/l10n.php' );
|
2004-12-19 08:26:43 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Run the installer if WordPress is not installed.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_not_installed();
|
2004-12-19 08:26:43 +01:00
|
|
|
|
2010-01-19 18:27:03 +01: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' );
|
2010-02-24 09:06:36 +01:00
|
|
|
require( ABSPATH . WPINC . '/nav-menu.php' );
|
|
|
|
require( ABSPATH . WPINC . '/nav-menu-template.php' );
|
2010-01-19 18:27:03 +01:00
|
|
|
|
|
|
|
// Load multisite-specific files.
|
2010-01-06 21:19:35 +01:00
|
|
|
if ( is_multisite() ) {
|
2010-02-20 13:50:09 +01:00
|
|
|
require( ABSPATH . WPINC . '/ms-functions.php' );
|
|
|
|
require( ABSPATH . WPINC . '/ms-default-filters.php' );
|
|
|
|
require( ABSPATH . WPINC . '/ms-deprecated.php' );
|
2010-01-06 21:19:35 +01:00
|
|
|
}
|
|
|
|
|
2010-01-19 18:27:03 +01: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 08:56:28 +01:00
|
|
|
wp_plugin_directory_constants( );
|
2010-01-15 23:03:41 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Load must-use plugins.
|
2010-02-12 08:59:11 +01:00
|
|
|
foreach ( wp_get_mu_plugins() as $mu_plugin ) {
|
2010-01-19 18:27:03 +01:00
|
|
|
include_once( $mu_plugin );
|
|
|
|
}
|
2010-02-02 22:41:17 +01:00
|
|
|
unset( $mu_plugin );
|
2010-01-10 19:10:51 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
do_action( 'muplugins_loaded' );
|
2009-03-07 01:03:40 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Check site status if multisite.
|
2010-01-15 23:25:40 +01:00
|
|
|
if ( is_multisite() ) {
|
2010-01-19 18:27:03 +01:00
|
|
|
if ( true !== ( $file = ms_site_check() ) ) {
|
2010-02-20 13:50:09 +01:00
|
|
|
require( $file );
|
2010-01-19 18:27:03 +01:00
|
|
|
die();
|
|
|
|
}
|
2010-01-26 19:20:27 +01:00
|
|
|
unset($file);
|
2010-02-12 09:22:34 +01:00
|
|
|
|
|
|
|
ms_cookie_constants( );
|
2010-01-10 19:10:51 +01:00
|
|
|
}
|
2008-05-27 19:46:01 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
|
2010-02-12 08:56:28 +01:00
|
|
|
wp_cookie_constants( );
|
|
|
|
|
|
|
|
// Define and enforce our SSL constants
|
|
|
|
wp_ssl_constants( );
|
2005-07-18 21:55:24 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Create common globals.
|
|
|
|
require( ABSPATH . WPINC . '/vars.php' );
|
2004-01-01 00:51:41 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Make taxonomies available to plugins and themes.
|
|
|
|
// @plugin authors: warning: this gets registered again on the init hook.
|
2009-06-15 23:53:51 +02:00
|
|
|
create_initial_taxonomies();
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Load active plugins.
|
2010-02-12 08:59:11 +01:00
|
|
|
foreach ( wp_get_active_and_valid_plugins() as $plugin )
|
2010-01-19 18:27:03 +01:00
|
|
|
include_once( $plugin );
|
|
|
|
unset( $plugin );
|
2004-04-19 07:19:45 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Load pluggable functions.
|
|
|
|
require( ABSPATH . WPINC . '/pluggable.php' );
|
2010-02-19 00:17:06 +01:00
|
|
|
require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
|
2005-04-05 01:25:51 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Set internal encoding.
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_set_internal_encoding();
|
2008-03-03 22:05:23 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Run wp_cache_postload() if object cache is enabled and the function exists.
|
|
|
|
if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
|
2005-02-15 01:46:58 +01:00
|
|
|
wp_cache_postload();
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
do_action( 'plugins_loaded' );
|
2005-02-15 01:46:58 +01:00
|
|
|
|
2010-02-12 08:56:28 +01:00
|
|
|
// Define constants which affect functionality if not already defined.
|
|
|
|
wp_functionality_constants( );
|
2005-07-05 22:47:22 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
|
2010-01-15 23:03:41 +01:00
|
|
|
wp_magic_quotes();
|
2009-08-01 00:22:54 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
do_action( 'sanitize_comment_cookies' );
|
2006-06-22 22:52:12 +02:00
|
|
|
|
2007-12-20 21:44:52 +01:00
|
|
|
/**
|
|
|
|
* WordPress Query object
|
|
|
|
* @global object $wp_the_query
|
2008-01-09 18:48:00 +01:00
|
|
|
* @since 2.0.0
|
2007-12-20 21:44:52 +01:00
|
|
|
*/
|
2006-11-09 07:50:58 +01:00
|
|
|
$wp_the_query =& new WP_Query();
|
2007-12-20 21:44:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the reference to @see $wp_the_query
|
|
|
|
* Use this global for WordPress queries
|
|
|
|
* @global object $wp_query
|
2008-01-09 18:48:00 +01:00
|
|
|
* @since 1.5.0
|
2007-12-20 21:44:52 +01:00
|
|
|
*/
|
2010-01-19 18:27:03 +01:00
|
|
|
$wp_query =& $wp_the_query;
|
2007-12-20 21:44:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Holds the WordPress Rewrite object for creating pretty URLs
|
|
|
|
* @global object $wp_rewrite
|
2008-01-09 18:48:00 +01:00
|
|
|
* @since 1.5.0
|
2007-12-20 21:44:52 +01:00
|
|
|
*/
|
2010-01-19 18:27:03 +01:00
|
|
|
$wp_rewrite =& new WP_Rewrite();
|
2007-12-20 21:44:52 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress Object
|
|
|
|
* @global object $wp
|
2008-01-09 18:48:00 +01:00
|
|
|
* @since 2.0.0
|
2007-12-20 21:44:52 +01:00
|
|
|
*/
|
2010-01-19 18:27:03 +01:00
|
|
|
$wp =& new WP();
|
2005-06-11 01:15:13 +02:00
|
|
|
|
2009-03-18 00:44:36 +01:00
|
|
|
/**
|
|
|
|
* WordPress Widget Factory Object
|
|
|
|
* @global object $wp_widget_factory
|
|
|
|
* @since 2.8.0
|
|
|
|
*/
|
|
|
|
$wp_widget_factory =& new WP_Widget_Factory();
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
do_action( 'setup_theme' );
|
2007-12-20 21:44:52 +01:00
|
|
|
|
2010-02-12 08:56:28 +01:00
|
|
|
// Define the template related constants.
|
|
|
|
wp_templating_constants( );
|
2005-07-13 21:29:18 +02:00
|
|
|
|
|
|
|
// Load the default text localization domain.
|
|
|
|
load_default_textdomain();
|
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Find the blog locale.
|
|
|
|
$locale = get_locale();
|
|
|
|
$locale_file = WP_LANG_DIR . "/$locale.php";
|
|
|
|
if ( is_readable( $locale_file ) )
|
2010-02-20 13:50:09 +01:00
|
|
|
require( $locale_file );
|
2010-01-26 19:20:27 +01:00
|
|
|
unset($locale_file);
|
2010-01-19 18:27:03 +01:00
|
|
|
|
|
|
|
// Pull in locale data after loading text domain.
|
2010-02-20 13:50:09 +01:00
|
|
|
require( ABSPATH . WPINC . '/locale.php' );
|
2005-07-13 21:29:18 +02:00
|
|
|
|
2007-12-20 21:44:52 +01:00
|
|
|
/**
|
|
|
|
* WordPress Locale object for loading locale domain date and various strings.
|
|
|
|
* @global object $wp_locale
|
2008-01-09 18:48:00 +01:00
|
|
|
* @since 2.1.0
|
2007-12-20 21:44:52 +01:00
|
|
|
*/
|
2006-11-19 01:12:57 +01:00
|
|
|
$wp_locale =& new WP_Locale();
|
2006-04-02 02:20:11 +02:00
|
|
|
|
2010-01-19 18:27:03 +01: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 11:00:00 +01:00
|
|
|
do_action( 'after_setup_theme' );
|
2010-02-14 22:27:55 +01:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Load any template functions the theme supports.
|
|
|
|
require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );
|
2005-08-30 01:40:32 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
register_shutdown_function( 'shutdown_action_hook' );
|
2005-07-13 21:29:18 +02:00
|
|
|
|
2010-01-19 18:27:03 +01:00
|
|
|
// Set up current user.
|
|
|
|
$wp->init();
|
2008-01-09 21:08:59 +01:00
|
|
|
|
2010-02-28 04:08:16 +01: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 18:27:03 +01:00
|
|
|
do_action( 'init' );
|
2005-11-11 02:37:25 +01:00
|
|
|
|
2010-02-28 04:08:16 +01:00
|
|
|
/**
|
2010-02-28 20:25:53 +01:00
|
|
|
* This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
|
2010-02-28 04:08:16 +01:00
|
|
|
*
|
2010-03-26 20:44:43 +01: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 20:25:53 +01:00
|
|
|
*
|
|
|
|
* @since 3.0.0
|
2010-02-28 04:08:16 +01:00
|
|
|
*/
|
|
|
|
do_action('wp_loaded');
|
2010-02-02 03:17:33 +01:00
|
|
|
?>
|