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