Skip to content
Newer
Older
100644 278 lines (217 sloc) 7.91 KB
0bc8613 b2config.php replaced with wp-config.sample.php
mikelittle authored
1 <?php
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
2 /**
3 * Used to setup and fix common variables and include
4 * the WordPress procedural and class library.
5 *
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
6 * Allows for some configuration in wp-config.php (see default-constants.php)
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
7 *
8 * @package WordPress
9 */
10
dbd2459 multi-site startup, See #11644
wpmuguru authored
11 /**
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
12 * Stores the location of the WordPress directory of functions, classes, and core content.
dbd2459 multi-site startup, See #11644
wpmuguru authored
13 *
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
14 * @since 1.0.0
dbd2459 multi-site startup, See #11644
wpmuguru authored
15 */
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
16 define( 'WPINC', 'wp-includes' );
dbd2459 multi-site startup, See #11644
wpmuguru authored
17
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
18 // Include files required for initialization.
19 require( ABSPATH . WPINC . '/load.php' );
20 require( ABSPATH . WPINC . '/default-constants.php' );
21 require( ABSPATH . WPINC . '/version.php' );
5c2f29c Increase memory limit. Props darkdragon. see #3141
ryan authored
22
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
23 // Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
60dc67e Improve the implementation of the default constant defining functions…
westi authored
24 wp_initial_constants( );
5c2f29c Increase memory limit. Props darkdragon. see #3141
ryan authored
25
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
26 // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
27 set_magic_quotes_runtime( 0 );
28 @ini_set( 'magic_quotes_sybase', 0 );
6e181bb Multi-byte character safe excerpting from nbachiyski. fixes #6077
ryan authored
29
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
30 // Set default timezone in PHP 5.
31 if ( function_exists( 'date_default_timezone_set' ) )
32 date_default_timezone_set( 'UTC' );
2371043 Set default timezone. Props Denis-de-Bernardy. fixes #10940
ryan authored
33
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
34 // Turn register_globals off.
321c310 Remove trailing whitespace
ryan authored
35 wp_unregister_GLOBALS();
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
36
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
37 // Ensure these global variables do not exist so they do not interfere with WordPress.
479fc2e phpdoc tuneup from darkdragon. see #5611
ryan authored
38 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
376ec4d Tweak
matt authored
39
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
40 // Standardize $_SERVER variables across setups.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
41 wp_fix_server_vars();
c50e7da Fixes #1591 (again)
matt authored
42
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
43 // Check for the required PHP version and for the MySQL extension or a database drop-in.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
44 wp_check_php_mysql_versions();
885ee8f This should fix permalinks, but may break the PHP as CGI funkiness again
matt authored
45
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
46 // Check if we're in maintenance mode.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
47 wp_maintenance();
0f7bb42 timer_stop() wanted to be near timer_start().
ryan authored
48
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
49 // Start loading timer.
551e52f Code cleanup and some fixes from the WP Japan folks.
saxmatt authored
50 timer_start();
da4a0d9 Fix for empty plugin strings, class include moved for timing.
saxmatt authored
51
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
52 // Check if we're in WP_DEBUG mode.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
53 wp_debug_mode();
9b09572 Turn down error reporting.
saxmatt authored
54
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
55 // For an advanced caching plugin to use. Uses a static drop-in because you would only want one.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
56 if ( WP_CACHE )
6c8d35d Allow wp-content to exist outside of webroot. Props sambauers. see #6938
ryan authored
57 @include WP_CONTENT_DIR . '/advanced-cache.php';
70a449d Allow for plugins to kick in before everything if define in wp-config
saxmatt authored
58
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
59 // Define WP_LANG_DIR if not set.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
60 wp_set_lang_dir();
0c6394a Stop fatal error in post revisions when setting the include path is d…
azaozz authored
61
98e8daa Add ability to query by domain and/or path to get_blog_details(). Imp…
ryan authored
62 // Load early WordPress files.
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
63 require( ABSPATH . WPINC . '/compat.php' );
64 require( ABSPATH . WPINC . '/functions.php' );
65 require( ABSPATH . WPINC . '/classes.php' );
b36471d Use wp_die() for WPDB bails. Send 500 response and no-cache headers s…
markjaquith authored
66
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
67 // Include the wpdb class, or a db.php database drop-in if present.
658d22d Store field types in wpdb object. Props mdawaffe. see #7171
ryan authored
68 require_wp_db();
69
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
70 // Set the database table prefix and the format specifiers for database table columns.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
71 wp_set_wpdb_vars();
d2110af Define wp_clone() before loading the cache.
ryan authored
72
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
73 // Start the WordPress object cache, or an external object cache if the drop-in is present.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
74 wp_start_object_cache();
1c55a42 Move is_admin() to wp-settings.php so it's available when query.php i…
azaozz authored
75
98e8daa Add ability to query by domain and/or path to get_blog_details(). Imp…
ryan authored
76 // Load early WordPress files.
77 require( ABSPATH . WPINC . '/plugin.php' );
78 require( ABSPATH . WPINC . '/default-filters.php' );
79 include_once( ABSPATH . WPINC . '/pomo/mo.php' );
80
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
81 // Initialize multisite if enabled.
731eada Move blogs table related functions to blogs.php. Include it before ms…
ryan authored
82 if ( is_multisite() ) {
83 require( ABSPATH . WPINC . '/blogs.php' );
493a307 rearrage multisite initialization, remove deprecated $wpmuBaseTablePr…
wpmuguru authored
84 require( ABSPATH . WPINC . '/ms-settings.php' );
731eada Move blogs table related functions to blogs.php. Include it before ms…
ryan authored
85 }
dbd2459 multi-site startup, See #11644
wpmuguru authored
86
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
87 // Stop most of WordPress from being loaded if we just want the basics.
88 if ( SHORTINIT )
dbd2459 multi-site startup, See #11644
wpmuguru authored
89 return false;
90
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
91 // Load the l18n library.
92 require_once ( ABSPATH . WPINC . '/l10n.php' );
1bd4057 Bug fixes
saxmatt authored
93
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
94 // Run the installer if WordPress is not installed.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
95 wp_not_installed();
1bd4057 Bug fixes
saxmatt authored
96
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
97 // Load most of WordPress.
98 require( ABSPATH . WPINC . '/formatting.php' );
99 require( ABSPATH . WPINC . '/capabilities.php' );
100 require( ABSPATH . WPINC . '/query.php' );
101 require( ABSPATH . WPINC . '/theme.php' );
102 require( ABSPATH . WPINC . '/user.php' );
103 require( ABSPATH . WPINC . '/meta.php' );
104 require( ABSPATH . WPINC . '/general-template.php' );
105 require( ABSPATH . WPINC . '/link-template.php' );
106 require( ABSPATH . WPINC . '/author-template.php' );
107 require( ABSPATH . WPINC . '/post.php' );
108 require( ABSPATH . WPINC . '/post-template.php' );
109 require( ABSPATH . WPINC . '/category.php' );
110 require( ABSPATH . WPINC . '/category-template.php' );
111 require( ABSPATH . WPINC . '/comment.php' );
112 require( ABSPATH . WPINC . '/comment-template.php' );
113 require( ABSPATH . WPINC . '/rewrite.php' );
114 require( ABSPATH . WPINC . '/feed.php' );
115 require( ABSPATH . WPINC . '/bookmark.php' );
116 require( ABSPATH . WPINC . '/bookmark-template.php' );
117 require( ABSPATH . WPINC . '/kses.php' );
118 require( ABSPATH . WPINC . '/cron.php' );
119 require( ABSPATH . WPINC . '/deprecated.php' );
120 require( ABSPATH . WPINC . '/script-loader.php' );
121 require( ABSPATH . WPINC . '/taxonomy.php' );
122 require( ABSPATH . WPINC . '/update.php' );
123 require( ABSPATH . WPINC . '/canonical.php' );
124 require( ABSPATH . WPINC . '/shortcodes.php' );
125 require( ABSPATH . WPINC . '/media.php' );
126 require( ABSPATH . WPINC . '/http.php' );
127 require( ABSPATH . WPINC . '/widgets.php' );
128
129 // Load multisite-specific files.
f5e1226 Introduce is_multisite(). see #11644
ryan authored
130 if ( is_multisite() ) {
131 require_once( ABSPATH . WPINC . '/ms-functions.php' );
132 require_once( ABSPATH . WPINC . '/ms-default-filters.php' );
ce33a91 Deprecate generate_random_password(). fixes #11746
ryan authored
133 require_once( ABSPATH . WPINC . '/ms-deprecated.php' );
f5e1226 Introduce is_multisite(). see #11644
ryan authored
134 }
135
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
136 // Define constants that rely on the API to obtain the default value.
137 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.
60dc67e Improve the implementation of the default constant defining functions…
westi authored
138 wp_plugin_directory_constants( );
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
139
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
140 // Load must-use plugins.
0206ffe Improve function naming for plugin file discovery functions.
westi authored
141 foreach ( wp_get_mu_plugins() as $mu_plugin ) {
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
142 include_once( $mu_plugin );
143 }
1592ca9 Cleanup network plugin loading. Props nacin. see #11644
ryan authored
144 unset( $mu_plugin );
dbd2459 multi-site startup, See #11644
wpmuguru authored
145
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
146 do_action( 'muplugins_loaded' );
3bf4ed1 Support mu-plugins for 'Must Use' autoload plugins
ryan authored
147
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
148 // Check site status if multisite.
f9a92c2 Coding style cleanups
ryan authored
149 if ( is_multisite() ) {
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
150 if ( true !== ( $file = ms_site_check() ) ) {
151 require_once( $file );
152 die();
153 }
3ffb57a unset temp vars so they don't pollute the global namespace.
ryan authored
154 unset($file);
b20c3c4 Improve the implementation of the default constant defining functions…
westi authored
155
156 ms_cookie_constants( );
dbd2459 multi-site startup, See #11644
wpmuguru authored
157 }
9771ec5 First cut and better admin SSL support. see #7001
ryan authored
158
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
159 // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
60dc67e Improve the implementation of the default constant defining functions…
westi authored
160 wp_cookie_constants( );
161
162 // Define and enforce our SSL constants
163 wp_ssl_constants( );
41afea2 Let advanced users override cookies.
matt authored
164
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
165 // Create common globals.
166 require( ABSPATH . WPINC . '/vars.php' );
edc7d7c Installation cleanup.
saxmatt authored
167
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
168 // Make taxonomies available to plugins and themes.
169 // @plugin authors: warning: this gets registered again on the init hook.
ae5848d Register default taxonomies before theme functions are loaded to sati…
ryan authored
170 create_initial_taxonomies();
171
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
172 // Load active plugins.
0206ffe Improve function naming for plugin file discovery functions.
westi authored
173 foreach ( wp_get_active_and_valid_plugins() as $plugin )
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
174 include_once( $plugin );
175 unset( $plugin );
1127059 shutdown action hook.
saxmatt authored
176
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
177 // Load pluggable functions.
178 require( ABSPATH . WPINC . '/pluggable.php' );
08b02d9 Move plugin replacebale functions to pluggable-functions.php. http://…
ryan authored
179
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
180 // Set internal encoding.
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
181 wp_set_internal_encoding();
6e181bb Multi-byte character safe excerpting from nbachiyski. fixes #6077
ryan authored
182
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
183 // Run wp_cache_postload() if object cache is enabled and the function exists.
184 if ( WP_CACHE && function_exists( 'wp_cache_postload' ) )
70a449d Allow for plugins to kick in before everything if define in wp-config
saxmatt authored
185 wp_cache_postload();
186
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
187 do_action( 'plugins_loaded' );
70a449d Allow for plugins to kick in before everything if define in wp-config
saxmatt authored
188
60dc67e Improve the implementation of the default constant defining functions…
westi authored
189 // Define constants which affect functionality if not already defined.
190 wp_functionality_constants( );
91efba1 Use wpdb->escape instead of addslashes to prepare DB bound data.
ryan authored
191
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
192 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST )
439d50d Cleanup wp-settings. Move functions needed at startup into load.php. …
ryan authored
193 wp_magic_quotes();
a431376 Be consistent about slashing _REQUEST superglobal. props dd32. fixes …
markjaquith authored
194
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
195 do_action( 'sanitize_comment_cookies' );
1034767 wp_get_current_commenter()
ryan authored
196
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
197 /**
198 * WordPress Query object
199 * @global object $wp_the_query
479fc2e phpdoc tuneup from darkdragon. see #5611
ryan authored
200 * @since 2.0.0
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
201 */
22bee1c Preserve the original query object as wp_the_query so that it's not s…
ryan authored
202 $wp_the_query =& new WP_Query();
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
203
204 /**
205 * Holds the reference to @see $wp_the_query
206 * Use this global for WordPress queries
207 * @global object $wp_query
479fc2e phpdoc tuneup from darkdragon. see #5611
ryan authored
208 * @since 1.5.0
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
209 */
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
210 $wp_query =& $wp_the_query;
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
211
212 /**
213 * Holds the WordPress Rewrite object for creating pretty URLs
214 * @global object $wp_rewrite
479fc2e phpdoc tuneup from darkdragon. see #5611
ryan authored
215 * @since 1.5.0
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
216 */
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
217 $wp_rewrite =& new WP_Rewrite();
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
218
219 /**
220 * WordPress Object
221 * @global object $wp
479fc2e phpdoc tuneup from darkdragon. see #5611
ryan authored
222 * @since 2.0.0
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
223 */
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
224 $wp =& new WP();
1baf503 Break blog header up into functional chunks. Stick it all in a WP cla…
ryan authored
225
1eab8fc Introduce singleton widget factory
ryan authored
226 /**
227 * WordPress Widget Factory Object
228 * @global object $wp_widget_factory
229 * @since 2.8.0
230 */
231 $wp_widget_factory =& new WP_Widget_Factory();
232
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
233 do_action( 'setup_theme' );
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
234
60dc67e Improve the implementation of the default constant defining functions…
westi authored
235 // Define the template related constants.
236 wp_templating_constants( );
98aa7f5 Rearrange load order. Init classes before loading the text domain and…
ryan authored
237
238 // Load the default text localization domain.
239 load_default_textdomain();
240
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
241 // Find the blog locale.
242 $locale = get_locale();
243 $locale_file = WP_LANG_DIR . "/$locale.php";
244 if ( is_readable( $locale_file ) )
245 require_once( $locale_file );
3ffb57a unset temp vars so they don't pollute the global namespace.
ryan authored
246 unset($locale_file);
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
247
248 // Pull in locale data after loading text domain.
249 require_once( ABSPATH . WPINC . '/locale.php' );
98aa7f5 Rearrange load order. Init classes before loading the text domain and…
ryan authored
250
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
251 /**
252 * WordPress Locale object for loading locale domain date and various strings.
253 * @global object $wp_locale
479fc2e phpdoc tuneup from darkdragon. see #5611
ryan authored
254 * @since 2.1.0
75dc778 phpdoc for wp-settings.php. Fixes #5211 props darkdragon.
westi authored
255 */
92421de Ref more singletons.
ryan authored
256 $wp_locale =& new WP_Locale();
3d2347a WP_Locale. Props Sewar. fixes #2568
ryan authored
257
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
258 // Load the functions for the active theme, for both parent and child theme if applicable.
259 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
260 include( STYLESHEETPATH . '/functions.php' );
261 if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
262 include( TEMPLATEPATH . '/functions.php' );
263
dce728d Add 'themes_loaded' hook to run after parent/child themes have been i…
dd32 authored
264 do_action( 'themes_loaded' );
265
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
266 // Load any template functions the theme supports.
267 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );
c369310 Better support for theme plugins. add_theme_page() and active theme f…
ryan authored
268
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
269 register_shutdown_function( 'shutdown_action_hook' );
98aa7f5 Rearrange load order. Init classes before loading the text domain and…
ryan authored
270
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
271 // Set up current user.
272 $wp->init();
251ad30 Call WP::init() just before kicking the init action so that the curre…
ryan authored
273
1baf503 Break blog header up into functional chunks. Stick it all in a WP cla…
ryan authored
274 // Everything is loaded and initialized.
506c22b phpdoc for load.php, return some includes to global scope. Props naci…
ryan authored
275 do_action( 'init' );
06a0fc3 Formatting
matt authored
276
44e5115 internalize uploaded media rewrite rule, see #11742
wpmuguru authored
277 ?>
Something went wrong with that request. Please try again.