Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 325 lines (261 sloc) 9.839 kb
6adf2da @michelled FLUID-4565: Clean install of Wordpress 3.2.1
michelled authored
1 <?php
2 /**
3 * Used to set up and fix common variables and include
4 * the WordPress procedural and class library.
5 *
6 * Allows for some configuration in wp-config.php (see default-constants.php)
7 *
8 * @internal This file must be parsable by PHP4.
9 *
10 * @package WordPress
11 */
12
13 /**
14 * Stores the location of the WordPress directory of functions, classes, and core content.
15 *
16 * @since 1.0.0
17 */
18 define( 'WPINC', 'wp-includes' );
19
20 // Include files required for initialization.
21 require( ABSPATH . WPINC . '/load.php' );
22 require( ABSPATH . WPINC . '/default-constants.php' );
23 require( ABSPATH . WPINC . '/version.php' );
24
25 // Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
26 wp_initial_constants( );
27
28 // Check for the required PHP version and for the MySQL extension or a database drop-in.
29 wp_check_php_mysql_versions();
30
31 // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
32 set_magic_quotes_runtime( 0 );
33 @ini_set( 'magic_quotes_sybase', 0 );
34
35 // Set default timezone in PHP 5.
36 if ( function_exists( 'date_default_timezone_set' ) )
37 date_default_timezone_set( 'UTC' );
38
39 // Turn register_globals off.
40 wp_unregister_GLOBALS();
41
42 // Ensure these global variables do not exist so they do not interfere with WordPress.
43 unset( $wp_filter, $cache_lastcommentmodified );
44
45 // Standardize $_SERVER variables across setups.
46 wp_fix_server_vars();
47
48 // Check if we have received a request due to missing favicon.ico
49 wp_favicon_request();
50
51 // Check if we're in maintenance mode.
52 wp_maintenance();
53
54 // Start loading timer.
55 timer_start();
56
57 // Check if we're in WP_DEBUG mode.
58 wp_debug_mode();
59
60 // For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
61 if ( WP_CACHE )
62 WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );
63
64 // Define WP_LANG_DIR if not set.
65 wp_set_lang_dir();
66
67 // Load early WordPress files.
68 require( ABSPATH . WPINC . '/compat.php' );
69 require( ABSPATH . WPINC . '/functions.php' );
70 require( ABSPATH . WPINC . '/class-wp.php' );
71 require( ABSPATH . WPINC . '/class-wp-error.php' );
72 require( ABSPATH . WPINC . '/plugin.php' );
73
74 // Include the wpdb class and, if present, a db.php database drop-in.
75 require_wp_db();
76
77 // Set the database table prefix and the format specifiers for database table columns.
78 wp_set_wpdb_vars();
79
80 // Start the WordPress object cache, or an external object cache if the drop-in is present.
81 wp_start_object_cache();
82
83 // Load early WordPress files.
84 require( ABSPATH . WPINC . '/default-filters.php' );
85 require( ABSPATH . WPINC . '/pomo/mo.php' );
86
87 // Initialize multisite if enabled.
88 if ( is_multisite() ) {
89 require( ABSPATH . WPINC . '/ms-blogs.php' );
90 require( ABSPATH . WPINC . '/ms-settings.php' );
91 } elseif ( ! defined( 'MULTISITE' ) ) {
92 define( 'MULTISITE', false );
93 }
94
95 // Stop most of WordPress from being loaded if we just want the basics.
96 if ( SHORTINIT )
97 return false;
98
99 // Load the l18n library.
100 require( ABSPATH . WPINC . '/l10n.php' );
101
102 // Run the installer if WordPress is not installed.
103 wp_not_installed();
104
105 // Load most of WordPress.
106 require( ABSPATH . WPINC . '/class-wp-walker.php' );
107 require( ABSPATH . WPINC . '/class-wp-ajax-response.php' );
108 require( ABSPATH . WPINC . '/formatting.php' );
109 require( ABSPATH . WPINC . '/capabilities.php' );
110 require( ABSPATH . WPINC . '/query.php' );
111 require( ABSPATH . WPINC . '/theme.php' );
112 require( ABSPATH . WPINC . '/user.php' );
113 require( ABSPATH . WPINC . '/meta.php' );
114 require( ABSPATH . WPINC . '/general-template.php' );
115 require( ABSPATH . WPINC . '/link-template.php' );
116 require( ABSPATH . WPINC . '/author-template.php' );
117 require( ABSPATH . WPINC . '/post.php' );
118 require( ABSPATH . WPINC . '/post-template.php' );
119 require( ABSPATH . WPINC . '/category.php' );
120 require( ABSPATH . WPINC . '/category-template.php' );
121 require( ABSPATH . WPINC . '/comment.php' );
122 require( ABSPATH . WPINC . '/comment-template.php' );
123 require( ABSPATH . WPINC . '/rewrite.php' );
124 require( ABSPATH . WPINC . '/feed.php' );
125 require( ABSPATH . WPINC . '/bookmark.php' );
126 require( ABSPATH . WPINC . '/bookmark-template.php' );
127 require( ABSPATH . WPINC . '/kses.php' );
128 require( ABSPATH . WPINC . '/cron.php' );
129 require( ABSPATH . WPINC . '/deprecated.php' );
130 require( ABSPATH . WPINC . '/script-loader.php' );
131 require( ABSPATH . WPINC . '/taxonomy.php' );
132 require( ABSPATH . WPINC . '/update.php' );
133 require( ABSPATH . WPINC . '/canonical.php' );
134 require( ABSPATH . WPINC . '/shortcodes.php' );
135 require( ABSPATH . WPINC . '/media.php' );
136 require( ABSPATH . WPINC . '/http.php' );
137 require( ABSPATH . WPINC . '/class-http.php' );
138 require( ABSPATH . WPINC . '/widgets.php' );
139 require( ABSPATH . WPINC . '/nav-menu.php' );
140 require( ABSPATH . WPINC . '/nav-menu-template.php' );
141 require( ABSPATH . WPINC . '/admin-bar.php' );
142
143 // Load multisite-specific files.
144 if ( is_multisite() ) {
145 require( ABSPATH . WPINC . '/ms-functions.php' );
146 require( ABSPATH . WPINC . '/ms-default-filters.php' );
147 require( ABSPATH . WPINC . '/ms-deprecated.php' );
148 }
149
150 // Define constants that rely on the API to obtain the default value.
151 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
152 wp_plugin_directory_constants( );
153
154 // Load must-use plugins.
155 foreach ( wp_get_mu_plugins() as $mu_plugin ) {
156 include_once( $mu_plugin );
157 }
158 unset( $mu_plugin );
159
160 // Load network activated plugins.
161 if ( is_multisite() ) {
162 foreach( wp_get_active_network_plugins() as $network_plugin ) {
163 include_once( $network_plugin );
164 }
165 unset( $network_plugin );
166 }
167
168 do_action( 'muplugins_loaded' );
169
170 if ( is_multisite() )
171 ms_cookie_constants( );
172
173 // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
174 wp_cookie_constants( );
175
176 // Define and enforce our SSL constants
177 wp_ssl_constants( );
178
179 // Create common globals.
180 require( ABSPATH . WPINC . '/vars.php' );
181
182 // Make taxonomies and posts available to plugins and themes.
183 // @plugin authors: warning: these get registered again on the init hook.
184 create_initial_taxonomies();
185 create_initial_post_types();
186
187 // Register the default theme directory root
188 register_theme_directory( get_theme_root() );
189
190 // Load active plugins.
191 foreach ( wp_get_active_and_valid_plugins() as $plugin )
192 include_once( $plugin );
193 unset( $plugin );
194
195 // Load pluggable functions.
196 require( ABSPATH . WPINC . '/pluggable.php' );
197 require( ABSPATH . WPINC . '/pluggable-deprecated.php' );
198
199 // Set internal encoding.
200 wp_set_internal_encoding();
201
202 // Run wp_cache_postload() if object cache is enabled and the function exists.
203 if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
204 wp_cache_postload();
205
206 do_action( 'plugins_loaded' );
207
208 // Define constants which affect functionality if not already defined.
209 wp_functionality_constants( );
210
211 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
212 wp_magic_quotes();
213
214 do_action( 'sanitize_comment_cookies' );
215
216 /**
217 * WordPress Query object
218 * @global object $wp_the_query
219 * @since 2.0.0
220 */
221 $wp_the_query = new WP_Query();
222
223 /**
224 * Holds the reference to @see $wp_the_query
225 * Use this global for WordPress queries
226 * @global object $wp_query
227 * @since 1.5.0
228 */
229 $wp_query =& $wp_the_query;
230
231 /**
232 * Holds the WordPress Rewrite object for creating pretty URLs
233 * @global object $wp_rewrite
234 * @since 1.5.0
235 */
236 $wp_rewrite = new WP_Rewrite();
237
238 /**
239 * WordPress Object
240 * @global object $wp
241 * @since 2.0.0
242 */
243 $wp = new WP();
244
245 /**
246 * WordPress Widget Factory Object
247 * @global object $wp_widget_factory
248 * @since 2.8.0
249 */
250 $wp_widget_factory = new WP_Widget_Factory();
251
252 do_action( 'setup_theme' );
253
254 // Define the template related constants.
255 wp_templating_constants( );
256
257 // Load the default text localization domain.
258 load_default_textdomain();
259
260 // Find the blog locale.
261 $locale = get_locale();
262 $locale_file = WP_LANG_DIR . "/$locale.php";
263 if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) )
264 require( $locale_file );
265 unset($locale_file);
266
267 // Pull in locale data after loading text domain.
268 require( ABSPATH . WPINC . '/locale.php' );
269
270 /**
271 * WordPress Locale object for loading locale domain date and various strings.
272 * @global object $wp_locale
273 * @since 2.1.0
274 */
275 $wp_locale = new WP_Locale();
276
277 // Load the functions for the active theme, for both parent and child theme if applicable.
278 if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
279 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
280 include( STYLESHEETPATH . '/functions.php' );
281 if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
282 include( TEMPLATEPATH . '/functions.php' );
283 }
284
285 do_action( 'after_setup_theme' );
286
287 // Load any template functions the theme supports.
288 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );
289
290 register_shutdown_function( 'shutdown_action_hook' );
291
292 // Set up current user.
293 $wp->init();
294
295 /**
296 * Most of WP is loaded at this stage, and the user is authenticated. WP continues
297 * to load on the init hook that follows (e.g. widgets), and many plugins instantiate
298 * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.).
299 *
300 * If you wish to plug an action once WP is loaded, use the wp_loaded hook below.
301 */
302 do_action( 'init' );
303
304 // Check site status
305 if ( is_multisite() ) {
306 if ( true !== ( $file = ms_site_check() ) ) {
307 require( $file );
308 die();
309 }
310 unset($file);
311 }
312
313 /**
314 * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated.
315 *
316 * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for
317 * users not logged in.
318 *
319 * @link http://codex.wordpress.org/AJAX_in_Plugins
320 *
321 * @since 3.0.0
322 */
323 do_action('wp_loaded');
324 ?>
Something went wrong with that request. Please try again.