Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 305 lines (250 sloc) 10.834 kb
0bc8613 b2config.php replaced with wp-config.sample.php
mikelittle authored
1 <?php
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
2 // Turn register globals off
3 function wp_unregister_GLOBALS() {
4 if ( !ini_get('register_globals') )
5 return;
dce5220 Typos and more secure unsetting. Hat tip: Stefen Esser
matt authored
6
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
7 if ( isset($_REQUEST['GLOBALS']) )
8 die('GLOBALS overwrite attempt detected');
9
10 // Variables that shouldn't be unset
11 $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
12
13 $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
321c310 Remove trailing whitespace
ryan authored
14 foreach ( $input as $k => $v )
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
15 if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
9323d39 Zend hash del key or index fix. PRops MarkJaquith.
ryan authored
16 $GLOBALS[$k] = NULL;
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
17 unset($GLOBALS[$k]);
9323d39 Zend hash del key or index fix. PRops MarkJaquith.
ryan authored
18 }
2919fe2 That last thing didn't work at all.
matt authored
19 }
877e6a7 Turn register globals off. Hat tip: Christian Schmidt
matt authored
20
321c310 Remove trailing whitespace
ryan authored
21 wp_unregister_GLOBALS();
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
22
dce5220 Typos and more secure unsetting. Hat tip: Stefen Esser
matt authored
23 unset( $wp_filter, $cache_userdata, $cache_lastcommentmodified, $cache_lastpostdate, $cache_settings, $category_cache, $cache_categories );
376ec4d Tweak
matt authored
24
d4f95b7 Accidental commit. Props Nazgul. fixes #4437
rob1n authored
25 if ( ! isset($blog_id) )
85723b8 Object caching, round one.
ryan authored
26 $blog_id = 1;
27
a18a23e Work around IIS' lack of REQUEST_URI
saxmatt authored
28 // Fix for IIS, which doesn't set REQUEST_URI
40a7d9d Fixes #1488
matt authored
29 if ( empty( $_SERVER['REQUEST_URI'] ) ) {
dd202ce Death to trailing tabs. Props Mark J. fixes #2405
ryan authored
30
54639a3 Set REQUEST_URI for IIS in more situations. props snakefoot. fixes #35...
markjaquith authored
31 // IIS Mod-Rewrite
32 if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
33 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
34 }
35 // IIS Isapi_Rewrite
36 else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
37 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
38 }
39 else {
40 // If root then simulate that no script-name was specified
41 if (empty($_SERVER['PATH_INFO']))
42 $_SERVER['REQUEST_URI'] = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')) . '/';
6a1c63e Correctly set REQUEST_URI for IIS setups that put that info into SCRIPT_...
markjaquith authored
43 elseif ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
44 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
45 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
54639a3 Set REQUEST_URI for IIS in more situations. props snakefoot. fixes #35...
markjaquith authored
46 else
47 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
87c4f3a Strip lines that contain only whitespace down to newlines.
ryan authored
48
54639a3 Set REQUEST_URI for IIS in more situations. props snakefoot. fixes #35...
markjaquith authored
49 // Append the query string if it exists and isn't null
50 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
51 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
52 }
720316d Do not touch REQUEST_URI if it is already set by the server.
rboren authored
53 }
12b4069 Fix REQUEST_URI construction for IIS. Bug 389. Patch from Dennis Willi...
rboren authored
54 }
a18a23e Work around IIS' lack of REQUEST_URI
saxmatt authored
55
c50e7da Fixes #1591 (again)
matt authored
56 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests
c1ed565 Check if SCRIPT_FILENAME is set to avoid warnings. fixes #2227
ryan authored
57 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )
c50e7da Fixes #1591 (again)
matt authored
58 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
59
885ee8f This should fix permalinks, but may break the PHP as CGI funkiness again
matt authored
60 // Fix for Dreamhost and other PHP as CGI hosts
3320dd1 Use strpos instead of strstr where ever possible, for speed. Props rob1...
markjaquith authored
61 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)
c50e7da Fixes #1591 (again)
matt authored
62 unset($_SERVER['PATH_INFO']);
63
38f4fca Move PHP_SELF setup to wp-settings.php. #2153
ryan authored
64 // Fix empty PHP_SELF
65 $PHP_SELF = $_SERVER['PHP_SELF'];
66 if ( empty($PHP_SELF) )
67 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
885ee8f This should fix permalinks, but may break the PHP as CGI funkiness again
matt authored
68
629dde8 Actually check for PHP 4.2. Props nbachiyski. fixes #4336
rob1n authored
69 if ( version_compare( '4.2', phpversion(), '>' ) ) {
70 die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.2.' );
71 }
da4a0d9 Fix for empty plugin strings, class include moved for timing.
saxmatt authored
72
172bfb8 Don't enforce presence of mysql system if custom DB class is being used....
ryan authored
73 if ( !extension_loaded('mysql') && !file_exists(ABSPATH . 'wp-content/db.php') )
fa1ec4e Don't wp_die() before functions.php is loaded.
ryan authored
74 die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
0d040b3 Sanity check mysql.
saxmatt authored
75
551e52f Code cleanup and some fixes from the WP Japan folks.
saxmatt authored
76 function timer_start() {
77 global $timestart;
78 $mtime = explode(' ', microtime() );
79 $mtime = $mtime[1] + $mtime[0];
80 $timestart = $mtime;
81 return true;
82 }
0f7bb42 timer_stop() wanted to be near timer_start().
ryan authored
83
84 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
85 global $timestart, $timeend;
86 $mtime = microtime();
87 $mtime = explode(' ',$mtime);
88 $mtime = $mtime[1] + $mtime[0];
89 $timeend = $mtime;
90 $timetotal = $timeend-$timestart;
4f6b825 Make sure number_format_i18n() is available before calling it in timer_s...
markjaquith authored
91 $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);
0f7bb42 timer_stop() wanted to be near timer_start().
ryan authored
92 if ( $display )
a9d23d4 allow timer_stop() to use number_format() when returning. Props mdawaff...
markjaquith authored
93 echo $r;
94 return $r;
0f7bb42 timer_stop() wanted to be near timer_start().
ryan authored
95 }
551e52f Code cleanup and some fixes from the WP Japan folks.
saxmatt authored
96 timer_start();
da4a0d9 Fix for empty plugin strings, class include moved for timing.
saxmatt authored
97
9b09572 Turn down error reporting.
saxmatt authored
98 // Change to E_ALL for development/debugging
99 error_reporting(E_ALL ^ E_NOTICE);
100
70a449d Allow for plugins to kick in before everything if define in wp-config
saxmatt authored
101 // For an advanced caching plugin to use, static because you would only want one
102 if ( defined('WP_CACHE') )
a45c3a3 Don't fail when the user don't set WP-Cache up correctly. Props Denis de...
rob1n authored
103 @include ABSPATH . 'wp-content/advanced-cache.php';
70a449d Allow for plugins to kick in before everything if define in wp-config
saxmatt authored
104
edc7d7c Installation cleanup.
saxmatt authored
105 define('WPINC', 'wp-includes');
54d7ccb make /languages/ directory default to /wp-content/languages/ with fallba...
markjaquith authored
106
107 if ( !defined('LANGDIR') ) {
108 if ( file_exists(ABSPATH . 'wp-content/languages') && @is_dir(ABSPATH . 'wp-content/languages') )
109 define('LANGDIR', 'wp-content/languages'); // no leading slash, no trailing slash
110 else
111 define('LANGDIR', WPINC . '/languages'); // no leading slash, no trailing slash
112 }
113
7a03234 Turn hard-coded paths to defines. Pull gettext includes int wp-settings....
ryan authored
114 if ( !defined('PLUGINDIR') )
115 define('PLUGINDIR', 'wp-content/plugins'); // no leading slash, no trailing slash
b36471d Use wp_die() for WPDB bails. Send 500 response and no-cache headers so ...
markjaquith authored
116
117 require (ABSPATH . WPINC . '/compat.php');
118 require (ABSPATH . WPINC . '/functions.php');
119
c84524f db.php instead of wp-db.php for pluggable DB load. #2721
ryan authored
120 if ( file_exists(ABSPATH . 'wp-content/db.php') )
36851be Switch to require_once for wp-includes/db.php when it exists. Fixes #459...
westi authored
121 require_once (ABSPATH . 'wp-content/db.php');
c01753a Allow pluggable wp-db. #2721
ryan authored
122 else
123 require_once (ABSPATH . WPINC . '/wp-db.php');
edc7d7c Installation cleanup.
saxmatt authored
124
2734f1c Custom DB error page. fixes #5500 for 2.3
ryan authored
125 if ( !empty($wpdb->error) )
126 dead_db();
127
71a2674 Use $wpdb->prefix when defining table names
markjaquith authored
128 // $table_prefix is deprecated as of 2.1
129 $wpdb->prefix = $table_prefix;
130
cde68f9 Exit gracefully with a warning if the table_prefix uses disallowed chars...
markjaquith authored
131 if ( preg_match('|[^a-z0-9_]|i', $wpdb->prefix) && !file_exists(ABSPATH . 'wp-content/db.php') )
b36471d Use wp_die() for WPDB bails. Send 500 response and no-cache headers so ...
markjaquith authored
132 wp_die("<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores.");
cde68f9 Exit gracefully with a warning if the table_prefix uses disallowed chars...
markjaquith authored
133
25ae03e Giant commit, sorry mailing list people. Move all table names to new $wp...
saxmatt authored
134 // Table names
71a2674 Use $wpdb->prefix when defining table names
markjaquith authored
135 $wpdb->posts = $wpdb->prefix . 'posts';
136 $wpdb->users = $wpdb->prefix . 'users';
137 $wpdb->categories = $wpdb->prefix . 'categories';
138 $wpdb->post2cat = $wpdb->prefix . 'post2cat';
139 $wpdb->comments = $wpdb->prefix . 'comments';
140 $wpdb->link2cat = $wpdb->prefix . 'link2cat';
141 $wpdb->links = $wpdb->prefix . 'links';
142 $wpdb->options = $wpdb->prefix . 'options';
143 $wpdb->postmeta = $wpdb->prefix . 'postmeta';
144 $wpdb->usermeta = $wpdb->prefix . 'usermeta';
634a33c Very rough initial commit of taxonomy for everyone's hacking pleasure. ...
ryan authored
145 $wpdb->terms = $wpdb->prefix . 'terms';
146 $wpdb->term_taxonomy = $wpdb->prefix . 'term_taxonomy';
147 $wpdb->term_relationships = $wpdb->prefix . 'term_relationships';
233afca Drafts clean up.
matt authored
148
2765f58 Allow for custom user table. If rewriting user functions need to include...
saxmatt authored
149 if ( defined('CUSTOM_USER_TABLE') )
150 $wpdb->users = CUSTOM_USER_TABLE;
de9cc8b More user updates
matt authored
151 if ( defined('CUSTOM_USER_META_TABLE') )
152 $wpdb->usermeta = CUSTOM_USER_META_TABLE;
85723b8 Object caching, round one.
ryan authored
153
154 if ( file_exists(ABSPATH . 'wp-content/object-cache.php') )
b3d3d73 Require once only. Props masquerade. fixes #4192
rob1n authored
155 require_once (ABSPATH . 'wp-content/object-cache.php');
85723b8 Object caching, round one.
ryan authored
156 else
b3d3d73 Require once only. Props masquerade. fixes #4192
rob1n authored
157 require_once (ABSPATH . WPINC . '/cache.php');
85723b8 Object caching, round one.
ryan authored
158
159 wp_cache_init();
160
ec1d1f1 Include classes.php earlier so we can make use of WP_Error.
ryan authored
161 require (ABSPATH . WPINC . '/classes.php');
6d7717e Move plugin API to plugin.php. #2525
ryan authored
162 require (ABSPATH . WPINC . '/plugin.php');
81e7d92 Some filter action and cleanup
saxmatt authored
163 require (ABSPATH . WPINC . '/default-filters.php');
acc5602 Always load gettext.
ryan authored
164 include_once(ABSPATH . WPINC . '/streams.php');
165 include_once(ABSPATH . WPINC . '/gettext.php');
62927ab Remove wp- prefix from wp-l10n.php
ryan authored
166 require_once (ABSPATH . WPINC . '/l10n.php');
1bd4057 Bug fixes
saxmatt authored
167
3320dd1 Use strpos instead of strstr where ever possible, for speed. Props rob1...
markjaquith authored
168 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
25abcd1 More streamlined install process. Obeys WP_SITEURL if defined. fixes #4...
markjaquith authored
169 if ( defined('WP_SITEURL') )
321c310 Remove trailing whitespace
ryan authored
170 $link = WP_SITEURL . '/wp-admin/install.php';
25abcd1 More streamlined install process. Obeys WP_SITEURL if defined. fixes #4...
markjaquith authored
171 elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false)
172 $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
ca2815f If we're already in wp-admin don't recursive link
saxmatt authored
173 else
25abcd1 More streamlined install process. Obeys WP_SITEURL if defined. fixes #4...
markjaquith authored
174 $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php';
175 require_once(ABSPATH . WPINC . '/kses.php');
176 require_once(ABSPATH . WPINC . '/pluggable.php');
177 wp_redirect($link);
178 die(); // have to die here ~ Mark
ca2815f If we're already in wp-admin don't recursive link
saxmatt authored
179 }
1bd4057 Bug fixes
saxmatt authored
180
c93efa8 Include file renames. #2525
ryan authored
181 require (ABSPATH . WPINC . '/formatting.php');
a6ade4a Role/capability system. Round one. Props: Owen Winkler
ryan authored
182 require (ABSPATH . WPINC . '/capabilities.php');
9303053 Move WP_Query and its wrapper functions to query.php. #2525
ryan authored
183 require (ABSPATH . WPINC . '/query.php');
40b2e61 Move theme functions to theme.php. #2525
ryan authored
184 require (ABSPATH . WPINC . '/theme.php');
c56e62f Move user functions to user.php. Relocate more post functions to post.p...
ryan authored
185 require (ABSPATH . WPINC . '/user.php');
c93efa8 Include file renames. #2525
ryan authored
186 require (ABSPATH . WPINC . '/general-template.php');
187 require (ABSPATH . WPINC . '/link-template.php');
c56e62f Move user functions to user.php. Relocate more post functions to post.p...
ryan authored
188 require (ABSPATH . WPINC . '/author-template.php');
3c8ed76 Reworg post/page/attachment functions. #2525
ryan authored
189 require (ABSPATH . WPINC . '/post.php');
190 require (ABSPATH . WPINC . '/post-template.php');
0f5dc0f Reorg category functions. #2525
ryan authored
191 require (ABSPATH . WPINC . '/category.php');
192 require (ABSPATH . WPINC . '/category-template.php');
6027cfa Reorg comment functions. #2525
ryan authored
193 require (ABSPATH . WPINC . '/comment.php');
194 require (ABSPATH . WPINC . '/comment-template.php');
6970a75 Rewrite API additions and improvements from David House. #2433
ryan authored
195 require (ABSPATH . WPINC . '/rewrite.php');
c93efa8 Include file renames. #2525
ryan authored
196 require (ABSPATH . WPINC . '/feed.php');
19ea5fb Reorg bookmark functions. #2525
ryan authored
197 require (ABSPATH . WPINC . '/bookmark.php');
198 require (ABSPATH . WPINC . '/bookmark-template.php');
9dc65ab Cleaning up some includes.
saxmatt authored
199 require (ABSPATH . WPINC . '/kses.php');
fb1e531 Cron improvements from masquerade. #2425
ryan authored
200 require (ABSPATH . WPINC . '/cron.php');
2520d8e Include cleanups
saxmatt authored
201 require (ABSPATH . WPINC . '/version.php');
ca92bb4 Move deprecated functions to deprecated.php. #2520
ryan authored
202 require (ABSPATH . WPINC . '/deprecated.php');
4d49e98 Script loader from mdawaffe. #2701
ryan authored
203 require (ABSPATH . WPINC . '/script-loader.php');
634a33c Very rough initial commit of taxonomy for everyone's hacking pleasure. ...
ryan authored
204 require (ABSPATH . WPINC . '/taxonomy.php');
7c2dbb9 First pass at upgrade notification for core, see #1476. Also includes so...
matt authored
205 require (ABSPATH . WPINC . '/update.php');
6fc031d Canonical URLs, first swing. Props to Scott Yang, Ryan and Matt. see #...
markjaquith authored
206 require (ABSPATH . WPINC . '/canonical.php');
da4a0d9 Fix for empty plugin strings, class include moved for timing.
saxmatt authored
207
3320dd1 Use strpos instead of strstr where ever possible, for speed. Props rob1...
markjaquith authored
208 if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
a2342f1 Define COOKIEHASH and new get_profile function. TODO: re-org function so...
saxmatt authored
209 // Used to guarantee unique hash cookies
911d3a1 Remove comment. fixes #3210
ryan authored
210 $cookiehash = md5(get_option('siteurl'));
321c310 Remove trailing whitespace
ryan authored
211 define('COOKIEHASH', $cookiehash);
3320dd1 Use strpos instead of strstr where ever possible, for speed. Props rob1...
markjaquith authored
212 }
5c97b54 Smilie fix from Jaykul, changed fool's siteurl fix to use faster preg_re...
saxmatt authored
213
41afea2 Let advanced users override cookies.
matt authored
214 if ( !defined('USER_COOKIE') )
215 define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH);
216 if ( !defined('PASS_COOKIE') )
217 define('PASS_COOKIE', 'wordpresspass_'. COOKIEHASH);
2662be2 Inform the user when cookies are disabled and login fails. Fixed #2039 p...
westi authored
218 if ( !defined('TEST_COOKIE') )
219 define('TEST_COOKIE', 'wordpress_test_cookie');
41afea2 Let advanced users override cookies.
matt authored
220 if ( !defined('COOKIEPATH') )
849a0d2 Use get_option instead of get_settings. Just 'cause.
ryan authored
221 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
41afea2 Let advanced users override cookies.
matt authored
222 if ( !defined('SITECOOKIEPATH') )
849a0d2 Use get_option instead of get_settings. Just 'cause.
ryan authored
223 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
41afea2 Let advanced users override cookies.
matt authored
224 if ( !defined('COOKIE_DOMAIN') )
225 define('COOKIE_DOMAIN', false);
226
9dc65ab Cleaning up some includes.
saxmatt authored
227 require (ABSPATH . WPINC . '/vars.php');
edc7d7c Installation cleanup.
saxmatt authored
228
c26991b Move hack file include.
saxmatt authored
229 // Check for hacks file if the option is enabled
849a0d2 Use get_option instead of get_settings. Just 'cause.
ryan authored
230 if (get_option('hack_file')) {
764f50b ABSPATH already has a trailing slash. Props Nazgul. fixes #4607
markjaquith authored
231 if (file_exists(ABSPATH . 'my-hacks.php'))
232 require(ABSPATH . 'my-hacks.php');
c26991b Move hack file include.
saxmatt authored
233 }
234
849a0d2 Use get_option instead of get_settings. Just 'cause.
ryan authored
235 if ( get_option('active_plugins') ) {
236 $current_plugins = get_option('active_plugins');
11f5bb3 Add a precautionary is_array() check around the plugin loading loop. ht...
ryan authored
237 if ( is_array($current_plugins) ) {
238 foreach ($current_plugins as $plugin) {
8311272 Use PLUGINDIR. Props z720 and Nazgul. fixes #3909
ryan authored
239 if ('' != $plugin && file_exists(ABSPATH . PLUGINDIR . '/' . $plugin))
240 include_once(ABSPATH . PLUGINDIR . '/' . $plugin);
11f5bb3 Add a precautionary is_array() check around the plugin loading loop. ht...
ryan authored
241 }
e733249 Functional plugin implementation.
saxmatt authored
242 }
243 }
1127059 shutdown action hook.
saxmatt authored
244
c93efa8 Include file renames. #2525
ryan authored
245 require (ABSPATH . WPINC . '/pluggable.php');
08b02d9 Move plugin replacebale functions to pluggable-functions.php. http://mo...
ryan authored
246
70a449d Allow for plugins to kick in before everything if define in wp-config
saxmatt authored
247 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') )
248 wp_cache_postload();
249
250 do_action('plugins_loaded');
251
91efba1 Use wpdb->escape instead of addslashes to prepare DB bound data.
ryan authored
252 // If already slashed, strip.
253 if ( get_magic_quotes_gpc() ) {
6cbb6fe Stripslashes doesn't work on arrays. Add stripslashes_deep(). Props: ...
ryan authored
254 $_GET = stripslashes_deep($_GET );
255 $_POST = stripslashes_deep($_POST );
256 $_COOKIE = stripslashes_deep($_COOKIE);
65bbec7 Comments refactoring and cleanup
saxmatt authored
257 }
258
91efba1 Use wpdb->escape instead of addslashes to prepare DB bound data.
ryan authored
259 // Escape with wpdb.
260 $_GET = add_magic_quotes($_GET );
261 $_POST = add_magic_quotes($_POST );
262 $_COOKIE = add_magic_quotes($_COOKIE);
263 $_SERVER = add_magic_quotes($_SERVER);
264
1034767 wp_get_current_commenter()
ryan authored
265 do_action('sanitize_comment_cookies');
266
22bee1c Preserve the original query object as wp_the_query so that it's not stom...
ryan authored
267 $wp_the_query =& new WP_Query();
268 $wp_query =& $wp_the_query;
269 $wp_rewrite =& new WP_Rewrite();
270 $wp =& new WP();
1baf503 Break blog header up into functional chunks. Stick it all in a WP class...
ryan authored
271
978fc18 Tweak theme validation.
ryan authored
272 validate_current_theme();
98aa7f5 Rearrange load order. Init classes before loading the text domain and s...
ryan authored
273 define('TEMPLATEPATH', get_template_directory());
b55b6aa Allow stylesheet only themes to provide functions.php. Props skeltoac. ...
ryan authored
274 define('STYLESHEETPATH', get_stylesheet_directory());
98aa7f5 Rearrange load order. Init classes before loading the text domain and s...
ryan authored
275
276 // Load the default text localization domain.
277 load_default_textdomain();
278
3e26469 Load locale specific php code in global context. fixes #3488
ryan authored
279 $locale = get_locale();
280 $locale_file = ABSPATH . LANGDIR . "/$locale.php";
281 if ( is_readable($locale_file) )
282 require_once($locale_file);
283
98aa7f5 Rearrange load order. Init classes before loading the text domain and s...
ryan authored
284 // Pull in locale data after loading text domain.
285 require_once(ABSPATH . WPINC . '/locale.php');
286
92421de Ref more singletons.
ryan authored
287 $wp_locale =& new WP_Locale();
3d2347a WP_Locale. Props Sewar. fixes #2568
ryan authored
288
c369310 Better support for theme plugins. add_theme_page() and active theme fun...
ryan authored
289 // Load functions for active theme.
b55b6aa Allow stylesheet only themes to provide functions.php. Props skeltoac. ...
ryan authored
290 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') )
291 include(STYLESHEETPATH . '/functions.php');
292 if ( file_exists(TEMPLATEPATH . '/functions.php') )
293 include(TEMPLATEPATH . '/functions.php');
c369310 Better support for theme plugins. add_theme_page() and active theme fun...
ryan authored
294
98aa7f5 Rearrange load order. Init classes before loading the text domain and s...
ryan authored
295 function shutdown_action_hook() {
296 do_action('shutdown');
84da5fc Save cache after the shutdown hook runs. fixes #2232
ryan authored
297 wp_cache_close();
98aa7f5 Rearrange load order. Init classes before loading the text domain and s...
ryan authored
298 }
299 register_shutdown_function('shutdown_action_hook');
300
1baf503 Break blog header up into functional chunks. Stick it all in a WP class...
ryan authored
301 // Everything is loaded and initialized.
9838608 Allow multiple args to be passed to apply_filters and do_action. Move s...
rboren authored
302 do_action('init');
06a0fc3 Formatting
matt authored
303
629dde8 Actually check for PHP 4.2. Props nbachiyski. fixes #4336
rob1n authored
304 ?>
Something went wrong with that request. Please try again.