PageRenderTime 114ms CodeModel.GetById 40ms app.highlight 12ms RepoModel.GetById 59ms app.codeStats 0ms

/wp-settings.php

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