root/tags/1.5.1.3/wp-settings.php

Revision 2516, 5.0 kB (checked in by ryan, 3 years ago)

Move plugin replacebale functions to pluggable-functions.php. http://mosquito.wordpress.org/view.php?id=1211

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 $HTTP_HOST = getenv('HTTP_HOST');  /* domain name */
3 $REMOTE_ADDR = getenv('REMOTE_ADDR'); /* visitor's IP */
4 $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); /* visitor's browser */
5
6 // Fix for IIS, which doesn't set REQUEST_URI
7 if (! isset($_SERVER['REQUEST_URI'])) {
8     $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
9     
10     // Append the query string if it exists and isn't null
11     if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
12         $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
13     }
14 }
15
16 if ( !(phpversion() >= '4.1') )
17     die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
18
19 if ( !extension_loaded('mysql') )
20     die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
21
22 function timer_start() {
23     global $timestart;
24     $mtime = explode(' ', microtime() );
25     $mtime = $mtime[1] + $mtime[0];
26     $timestart = $mtime;
27     return true;
28 }
29 timer_start();
30
31 // Change to E_ALL for development/debugging
32 error_reporting(E_ALL ^ E_NOTICE);
33
34 // For an advanced caching plugin to use, static because you would only want one
35 if ( defined('WP_CACHE') )
36     require (ABSPATH . 'wp-content/advanced-cache.php');
37
38 define('WPINC', 'wp-includes');
39 require_once (ABSPATH . WPINC . '/wp-db.php');
40
41 // Table names
42 $wpdb->posts            = $table_prefix . 'posts';
43 $wpdb->users            = $table_prefix . 'users';
44 $wpdb->categories       = $table_prefix . 'categories';
45 $wpdb->post2cat         = $table_prefix . 'post2cat';
46 $wpdb->comments         = $table_prefix . 'comments';
47 $wpdb->links            = $table_prefix . 'links';
48 $wpdb->linkcategories   = $table_prefix . 'linkcategories';
49 $wpdb->options          = $table_prefix . 'options';
50 $wpdb->postmeta         = $table_prefix . 'postmeta';
51
52 if ( defined('CUSTOM_USER_TABLE') )
53     $wpdb->users = CUSTOM_USER_TABLE;
54
55 // We're going to need to keep this around for a few months even though we're not using it internally
56
57 $tableposts = $wpdb->posts;
58 $tableusers = $wpdb->users;
59 $tablecategories = $wpdb->categories;
60 $tablepost2cat = $wpdb->post2cat;
61 $tablecomments = $wpdb->comments;
62 $tablelinks = $wpdb->links;
63 $tablelinkcategories = $wpdb->linkcategories;
64 $tableoptions = $wpdb->options;
65 $tablepostmeta = $wpdb->postmeta;
66
67 require (ABSPATH . WPINC . '/functions.php');
68 require (ABSPATH . WPINC . '/default-filters.php');
69 require_once (ABSPATH . WPINC . '/wp-l10n.php');
70
71 $wpdb->hide_errors();
72 if ( !update_user_cache() && (!strstr($_SERVER['PHP_SELF'], 'install.php') && !defined('WP_INSTALLING')) ) {
73     if ( strstr($_SERVER['PHP_SELF'], 'wp-admin') )
74         $link = 'install.php';
75     else
76         $link = 'wp-admin/install.php';
77     die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link));
78 }
79 $wpdb->show_errors();
80
81 require (ABSPATH . WPINC . '/functions-formatting.php');
82 require (ABSPATH . WPINC . '/functions-post.php');
83 require (ABSPATH . WPINC . '/classes.php');
84 require (ABSPATH . WPINC . '/template-functions-general.php');
85 require (ABSPATH . WPINC . '/template-functions-links.php');
86 require (ABSPATH . WPINC . '/template-functions-author.php');
87 require (ABSPATH . WPINC . '/template-functions-post.php');
88 require (ABSPATH . WPINC . '/template-functions-category.php');
89 require (ABSPATH . WPINC . '/comment-functions.php');
90 require (ABSPATH . WPINC . '/feed-functions.php');
91 require (ABSPATH . WPINC . '/links.php');
92 require (ABSPATH . WPINC . '/kses.php');
93 require (ABSPATH . WPINC . '/version.php');
94
95 if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'], 'wp-admin/import')) :
96     // Used to guarantee unique hash cookies
97     $cookiehash = md5(get_settings('siteurl')); // Remove in 1.4
98     define('COOKIEHASH', $cookiehash);
99 endif;
100
101 require (ABSPATH . WPINC . '/vars.php');
102
103 do_action('core_files_loaded');
104
105 // Check for hacks file if the option is enabled
106 if (get_settings('hack_file')) {
107     if (file_exists(ABSPATH . '/my-hacks.php'))
108         require(ABSPATH . '/my-hacks.php');
109 }
110
111 if ( get_settings('active_plugins') ) {
112     $current_plugins = get_settings('active_plugins');
113     if ( is_array($current_plugins) ) {
114         foreach ($current_plugins as $plugin) {
115             if ('' != $plugin && file_exists(ABSPATH . 'wp-content/plugins/' . $plugin))
116                 include_once(ABSPATH . 'wp-content/plugins/' . $plugin);
117         }
118     }
119 }
120
121 require (ABSPATH . WPINC . '/pluggable-functions.php');
122
123 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
124     wp_cache_postload();
125
126 do_action('plugins_loaded');
127
128 define('TEMPLATEPATH', get_template_directory());
129
130 // Load the default text localization domain.
131 load_default_textdomain();
132
133 // Pull in locale data after loading text domain.
134 require_once(ABSPATH . WPINC . '/locale.php');
135
136 if ( !get_magic_quotes_gpc() ) {
137     $_GET    = add_magic_quotes($_GET   );
138     $_POST   = add_magic_quotes($_POST  );
139     $_COOKIE = add_magic_quotes($_COOKIE);
140     $_SERVER = add_magic_quotes($_SERVER);
141 }
142
143 function shutdown_action_hook() {
144     do_action('shutdown');
145 }
146 register_shutdown_function('shutdown_action_hook');
147
148 // Everything is loaded.
149 do_action('init');
150 ?>
151
Note: See TracBrowser for help on using the browser.