]> scripts.mit.edu Git - autoinstallsdev/wordpress.git/blob - wp-settings.php
Wordpress 2.7.1-scripts
[autoinstallsdev/wordpress.git] / wp-settings.php
1 <?php
2 /**
3  * Used to setup and fix common variables and include
4  * the WordPress procedural and class library.
5  *
6  * You should not have to change this file and allows
7  * for some configuration in wp-config.php.
8  *
9  * @package WordPress
10  */
11
12 if ( !defined('WP_MEMORY_LIMIT') )
13         define('WP_MEMORY_LIMIT', '32M');
14
15 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
16         @ini_set('memory_limit', WP_MEMORY_LIMIT);
17
18 set_magic_quotes_runtime(0);
19 @ini_set('magic_quotes_sybase', 0);
20
21 /**
22  * Turn register globals off.
23  *
24  * @access private
25  * @since 2.1.0
26  * @return null Will return null if register_globals PHP directive was disabled
27  */
28 function wp_unregister_GLOBALS() {
29         if ( !ini_get('register_globals') )
30                 return;
31
32         if ( isset($_REQUEST['GLOBALS']) )
33                 die('GLOBALS overwrite attempt detected');
34
35         // Variables that shouldn't be unset
36         $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
37
38         $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
39         foreach ( $input as $k => $v )
40                 if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
41                         $GLOBALS[$k] = NULL;
42                         unset($GLOBALS[$k]);
43                 }
44 }
45
46 wp_unregister_GLOBALS();
47
48 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate );
49
50 /**
51  * The $blog_id global, which you can change in the config allows you to create a simple
52  * multiple blog installation using just one WordPress and changing $blog_id around.
53  *
54  * @global int $blog_id
55  * @since 2.0.0
56  */
57 if ( ! isset($blog_id) )
58         $blog_id = 1;
59
60 // Fix for IIS, which doesn't set REQUEST_URI
61 if ( empty( $_SERVER['REQUEST_URI'] ) ) {
62
63         // IIS Mod-Rewrite
64         if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
65                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
66         }
67         // IIS Isapi_Rewrite
68         else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
69                 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
70         }
71         else
72         {
73                 // Use ORIG_PATH_INFO if there is no PATH_INFO
74                 if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) )
75                         $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO'];
76
77                 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
78                 if ( isset($_SERVER['PATH_INFO']) ) {
79                         if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
80                                 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
81                         else
82                                 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
83                 }
84
85                 // Append the query string if it exists and isn't null
86                 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
87                         $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
88                 }
89         }
90 }
91
92 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
93 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
94         $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
95
96 // Fix for Dreamhost and other PHP as CGI hosts
97 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
98         unset($_SERVER['PATH_INFO']);
99
100 // Fix empty PHP_SELF
101 $PHP_SELF = $_SERVER['PHP_SELF'];
102 if ( empty($PHP_SELF) )
103         $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
104
105 if ( version_compare( '4.3', phpversion(), '>' ) ) {
106         die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) );
107 }
108
109 if ( !defined('WP_CONTENT_DIR') )
110         define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
111
112 if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {
113         include(ABSPATH . '.maintenance');
114         // If the $upgrading timestamp is older than 10 minutes, don't die.
115         if ( ( time() - $upgrading ) < 600 ) {
116                 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
117                         require_once( WP_CONTENT_DIR . '/maintenance.php' );
118                         die();
119                 }
120
121                 $protocol = $_SERVER["SERVER_PROTOCOL"];
122                 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
123                         $protocol = 'HTTP/1.0';
124                 header( "$protocol 503 Service Unavailable", true, 503 );
125                 header( 'Content-Type: text/html; charset=utf-8' );
126 ?>
127 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
128 <html xmlns="http://www.w3.org/1999/xhtml">
129 <head>
130 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
131         <title>Maintenance</title>
132
133 </head>
134 <body>
135         <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
136 </body>
137 </html>
138 <?php
139                 die();
140         }
141 }
142
143 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
144         die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
145
146 /**
147  * PHP 4 standard microtime start capture.
148  *
149  * @access private
150  * @since 0.71
151  * @global int $timestart Seconds and Microseconds added together from when function is called.
152  * @return bool Always returns true.
153  */
154 function timer_start() {
155         global $timestart;
156         $mtime = explode(' ', microtime() );
157         $mtime = $mtime[1] + $mtime[0];
158         $timestart = $mtime;
159         return true;
160 }
161
162 /**
163  * Return and/or display the time from the page start to when function is called.
164  *
165  * You can get the results and print them by doing:
166  * <code>
167  * $nTimePageTookToExecute = timer_stop();
168  * echo $nTimePageTookToExecute;
169  * </code>
170  *
171  * Or instead, you can do:
172  * <code>
173  * timer_stop(1);
174  * </code>
175  * which will do what the above does. If you need the result, you can assign it to a variable, but
176  * most cases, you only need to echo it.
177  *
178  * @since 0.71
179  * @global int $timestart Seconds and Microseconds added together from when timer_start() is called
180  * @global int $timeend  Seconds and Microseconds added together from when function is called
181  *
182  * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
183  * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
184  * @return float The "second.microsecond" finished time calculation
185  */
186 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
187         global $timestart, $timeend;
188         $mtime = microtime();
189         $mtime = explode(' ',$mtime);
190         $mtime = $mtime[1] + $mtime[0];
191         $timeend = $mtime;
192         $timetotal = $timeend-$timestart;
193         $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
194         if ( $display )
195                 echo $r;
196         return $r;
197 }
198 timer_start();
199
200 // Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development.
201 if (defined('WP_DEBUG') and WP_DEBUG == true) {
202         error_reporting(E_ALL);
203 } else {
204         // Unicode Extension is in PHP 6.0 only or do version check when this changes.
205         if ( function_exists('unicode_decode') ) 
206                 error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE ^ E_STRICT );
207         else if ( defined( 'E_DEPRECATED' ) ) // Introduced in PHP 5.3
208                 error_reporting( E_ALL ^ E_DEPRECATED ^ E_NOTICE ^ E_USER_NOTICE );
209         else
210                 error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
211 }
212
213 // For an advanced caching plugin to use, static because you would only want one
214 if ( defined('WP_CACHE') )
215         @include WP_CONTENT_DIR . '/advanced-cache.php';
216
217 /**
218  * Stores the location of the WordPress directory of functions, classes, and core content.
219  *
220  * @since 1.0.0
221  */
222 define('WPINC', 'wp-includes');
223
224 if ( !defined('WP_LANG_DIR') ) {
225         /**
226          * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR
227          * and uses that folder if it exists. Or it uses the "languages" folder in WPINC.
228          *
229          * @since 2.1.0
230          */
231         if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {
232                 define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
233                 if (!defined('LANGDIR')) {
234                         // Old static relative path maintained for limited backwards compatibility - won't work in some cases
235                         define('LANGDIR', 'wp-content/languages');
236                 }
237         } else {
238                 define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH
239                 if (!defined('LANGDIR')) {
240                         // Old relative path maintained for backwards compatibility
241                         define('LANGDIR', WPINC . '/languages');
242                 }
243         }
244 }
245
246 require (ABSPATH . WPINC . '/compat.php');
247 require (ABSPATH . WPINC . '/functions.php');
248 require (ABSPATH . WPINC . '/classes.php');
249
250 require_wp_db();
251
252 if ( !empty($wpdb->error) )
253         dead_db();
254
255 $prefix = $wpdb->set_prefix($table_prefix);
256
257 if ( is_wp_error($prefix) )
258         wp_die(/*WP_I18N_BAD_PREFIX*/'<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.'/*/WP_I18N_BAD_PREFIX*/);
259
260 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') )
261         require_once (WP_CONTENT_DIR . '/object-cache.php');
262 else
263         require_once (ABSPATH . WPINC . '/cache.php');
264
265 wp_cache_init();
266 if ( function_exists('wp_cache_add_global_groups') ) {
267         wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta'));
268         wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' ));
269 }
270
271 require (ABSPATH . WPINC . '/plugin.php');
272 require (ABSPATH . WPINC . '/default-filters.php');
273 include_once(ABSPATH . WPINC . '/streams.php');
274 include_once(ABSPATH . WPINC . '/gettext.php');
275 require_once (ABSPATH . WPINC . '/l10n.php');
276
277 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
278         if ( defined('WP_SITEURL') )
279                 $link = WP_SITEURL . '/wp-admin/install.php';
280         elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
281                 $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
282         else
283                 $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
284         require_once(ABSPATH . WPINC . '/kses.php');
285         require_once(ABSPATH . WPINC . '/pluggable.php');
286         wp_redirect($link);
287         die(); // have to die here ~ Mark
288 }
289
290 require (ABSPATH . WPINC . '/formatting.php');
291 require (ABSPATH . WPINC . '/capabilities.php');
292 require (ABSPATH . WPINC . '/query.php');
293 require (ABSPATH . WPINC . '/theme.php');
294 require (ABSPATH . WPINC . '/user.php');
295 require (ABSPATH . WPINC . '/general-template.php');
296 require (ABSPATH . WPINC . '/link-template.php');
297 require (ABSPATH . WPINC . '/author-template.php');
298 require (ABSPATH . WPINC . '/post.php');
299 require (ABSPATH . WPINC . '/post-template.php');
300 require (ABSPATH . WPINC . '/category.php');
301 require (ABSPATH . WPINC . '/category-template.php');
302 require (ABSPATH . WPINC . '/comment.php');
303 require (ABSPATH . WPINC . '/comment-template.php');
304 require (ABSPATH . WPINC . '/rewrite.php');
305 require (ABSPATH . WPINC . '/feed.php');
306 require (ABSPATH . WPINC . '/bookmark.php');
307 require (ABSPATH . WPINC . '/bookmark-template.php');
308 require (ABSPATH . WPINC . '/kses.php');
309 require (ABSPATH . WPINC . '/cron.php');
310 require (ABSPATH . WPINC . '/version.php');
311 require (ABSPATH . WPINC . '/deprecated.php');
312 require (ABSPATH . WPINC . '/script-loader.php');
313 require (ABSPATH . WPINC . '/taxonomy.php');
314 require (ABSPATH . WPINC . '/update.php');
315 require (ABSPATH . WPINC . '/canonical.php');
316 require (ABSPATH . WPINC . '/shortcodes.php');
317 require (ABSPATH . WPINC . '/media.php');
318 require (ABSPATH . WPINC . '/http.php');
319
320 if ( !defined('WP_CONTENT_URL') )
321         define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up
322
323 /**
324  * Allows for the plugins directory to be moved from the default location.
325  *
326  * @since 2.6.0
327  */
328 if ( !defined('WP_PLUGIN_DIR') )
329         define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
330
331 /**
332  * Allows for the plugins directory to be moved from the default location.
333  *
334  * @since 2.6.0
335  */
336 if ( !defined('WP_PLUGIN_URL') )
337         define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
338
339 /**
340  * Allows for the plugins directory to be moved from the default location.
341  *
342  * @since 2.1.0
343  */
344 if ( !defined('PLUGINDIR') )
345         define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH.  For back compat.
346
347 /**
348  * Used to guarantee unique hash cookies
349  * @since 1.5
350  */
351 define('COOKIEHASH', md5(get_option('siteurl')));
352
353 /**
354  * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
355  * @since 2.5.0
356  */
357 $wp_default_secret_key = 'put your unique phrase here';
358
359 /**
360  * It is possible to define this in wp-config.php
361  * @since 2.0.0
362  */
363 if ( !defined('USER_COOKIE') )
364         define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);
365
366 /**
367  * It is possible to define this in wp-config.php
368  * @since 2.0.0
369  */
370 if ( !defined('PASS_COOKIE') )
371         define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);
372
373 /**
374  * It is possible to define this in wp-config.php
375  * @since 2.5.0
376  */
377 if ( !defined('AUTH_COOKIE') )
378         define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
379
380 /**
381  * It is possible to define this in wp-config.php
382  * @since 2.6.0
383  */
384 if ( !defined('SECURE_AUTH_COOKIE') )
385         define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
386
387 /**
388  * It is possible to define this in wp-config.php
389  * @since 2.6.0
390  */
391 if ( !defined('LOGGED_IN_COOKIE') )
392         define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
393
394 /**
395  * It is possible to define this in wp-config.php
396  * @since 2.3.0
397  */
398 if ( !defined('TEST_COOKIE') )
399         define('TEST_COOKIE', 'wordpress_test_cookie');
400
401 /**
402  * It is possible to define this in wp-config.php
403  * @since 1.2.0
404  */
405 if ( !defined('COOKIEPATH') )
406         define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
407
408 /**
409  * It is possible to define this in wp-config.php
410  * @since 1.5.0
411  */
412 if ( !defined('SITECOOKIEPATH') )
413         define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
414
415 /**
416  * It is possible to define this in wp-config.php
417  * @since 2.6.0
418  */
419 if ( !defined('ADMIN_COOKIE_PATH') )
420         define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
421
422 /**
423  * It is possible to define this in wp-config.php
424  * @since 2.6.0
425  */
426 if ( !defined('PLUGINS_COOKIE_PATH') )
427         define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
428
429 /**
430  * It is possible to define this in wp-config.php
431  * @since 2.0.0
432  */
433 if ( !defined('COOKIE_DOMAIN') )
434         define('COOKIE_DOMAIN', false);
435
436 /**
437  * It is possible to define this in wp-config.php
438  * @since 2.6.0
439  */
440 if ( !defined('FORCE_SSL_ADMIN') )
441         define('FORCE_SSL_ADMIN', false);
442 force_ssl_admin(FORCE_SSL_ADMIN);
443
444 /**
445  * It is possible to define this in wp-config.php
446  * @since 2.6.0
447  */
448 if ( !defined('FORCE_SSL_LOGIN') )
449         define('FORCE_SSL_LOGIN', false);
450 force_ssl_login(FORCE_SSL_LOGIN);
451
452 /**
453  * It is possible to define this in wp-config.php
454  * @since 2.5.0
455  */
456 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
457         define( 'AUTOSAVE_INTERVAL', 60 );
458
459
460 require (ABSPATH . WPINC . '/vars.php');
461
462 // Check for hacks file if the option is enabled
463 if (get_option('hack_file')) {
464         if (file_exists(ABSPATH . 'my-hacks.php'))
465                 require(ABSPATH . 'my-hacks.php');
466 }
467
468 if ( get_option('active_plugins') && !defined('WP_INSTALLING') ) {
469         $current_plugins = get_option('active_plugins');
470         if ( is_array($current_plugins) ) {
471                 foreach ($current_plugins as $plugin) {
472                         if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
473                                 include_once(WP_PLUGIN_DIR . '/' . $plugin);
474                 }
475         }
476 }
477
478 require (ABSPATH . WPINC . '/pluggable.php');
479
480 /*
481  * In most cases the default internal encoding is latin1, which is of no use,
482  * since we want to use the mb_ functions for utf-8 strings
483  */
484 if (function_exists('mb_internal_encoding')) {
485         if (!@mb_internal_encoding(get_option('blog_charset')))
486                 mb_internal_encoding('UTF-8');
487 }
488
489
490 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
491         wp_cache_postload();
492
493 do_action('plugins_loaded');
494
495 $default_constants = array( 'WP_POST_REVISIONS' => true );
496 foreach ( $default_constants as $c => $v )
497         @define( $c, $v ); // will fail if the constant is already defined
498 unset($default_constants, $c, $v);
499
500 // If already slashed, strip.
501 if ( get_magic_quotes_gpc() ) {
502         $_GET    = stripslashes_deep($_GET   );
503         $_POST   = stripslashes_deep($_POST  );
504         $_COOKIE = stripslashes_deep($_COOKIE);
505 }
506
507 // Escape with wpdb.
508 $_GET    = add_magic_quotes($_GET   );
509 $_POST   = add_magic_quotes($_POST  );
510 $_COOKIE = add_magic_quotes($_COOKIE);
511 $_SERVER = add_magic_quotes($_SERVER);
512
513 do_action('sanitize_comment_cookies');
514
515 /**
516  * WordPress Query object
517  * @global object $wp_the_query
518  * @since 2.0.0
519  */
520 $wp_the_query =& new WP_Query();
521
522 /**
523  * Holds the reference to @see $wp_the_query
524  * Use this global for WordPress queries
525  * @global object $wp_query
526  * @since 1.5.0
527  */
528 $wp_query     =& $wp_the_query;
529
530 /**
531  * Holds the WordPress Rewrite object for creating pretty URLs
532  * @global object $wp_rewrite
533  * @since 1.5.0
534  */
535 $wp_rewrite   =& new WP_Rewrite();
536
537 /**
538  * WordPress Object
539  * @global object $wp
540  * @since 2.0.0
541  */
542 $wp           =& new WP();
543
544 do_action('setup_theme');
545
546 /**
547  * Web Path to the current active template directory
548  * @since 1.5.0
549  */
550 define('TEMPLATEPATH', get_template_directory());
551
552 /**
553  * Web Path to the current active template stylesheet directory
554  * @since 2.1.0
555  */
556 define('STYLESHEETPATH', get_stylesheet_directory());
557
558 // Load the default text localization domain.
559 load_default_textdomain();
560
561 /**
562  * The locale of the blog
563  * @since 1.5.0
564  */
565 $locale = get_locale();
566 $locale_file = WP_LANG_DIR . "/$locale.php";
567 if ( is_readable($locale_file) )
568         require_once($locale_file);
569
570 // Pull in locale data after loading text domain.
571 require_once(ABSPATH . WPINC . '/locale.php');
572
573 /**
574  * WordPress Locale object for loading locale domain date and various strings.
575  * @global object $wp_locale
576  * @since 2.1.0
577  */
578 $wp_locale =& new WP_Locale();
579
580 // Load functions for active theme.
581 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
582         include(STYLESHEETPATH . '/functions.php');
583 if ( file_exists(TEMPLATEPATH . '/functions.php') )
584         include(TEMPLATEPATH . '/functions.php');
585
586 /**
587  * Runs just before PHP shuts down execution.
588  *
589  * @access private
590  * @since 1.2.0
591  */
592 function shutdown_action_hook() {
593         do_action('shutdown');
594         wp_cache_close();
595 }
596 register_shutdown_function('shutdown_action_hook');
597
598 $wp->init();  // Sets up current user.
599
600 // Everything is loaded and initialized.
601 do_action('init');
602
603 ?>