Changeset 100209 in webkit
- Timestamp:
- Nov 14, 2011, 4:16:59 PM (15 years ago)
- Location:
- trunk/Websites/webkit.org
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
blog/wp-settings.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/webkit.org/ChangeLog
r100207 r100209 1 2011-11-14 Mark Rowe <mrowe@apple.com> 2 3 Update one file that was missed. 4 5 * blog/wp-settings.php: 6 1 7 2011-11-14 Mark Rowe <mrowe@apple.com> 2 8 -
trunk/Websites/webkit.org/blog/wp-settings.php
r46731 r100209 1 1 <?php 2 2 /** 3 * Used to set up and fix common variables and include3 * Used to set up and fix common variables and include 4 4 * the WordPress procedural and class library. 5 5 * 6 * You should not have to change this file and allows 7 * for some configuration in wp-config.php. 6 * Allows for some configuration in wp-config.php (see default-constants.php) 7 * 8 * @internal This file must be parsable by PHP4. 8 9 * 9 10 * @package WordPress 10 11 */ 11 12 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 13 /** 14 * Stores the location of the WordPress directory of functions, classes, and core content. 15 * 16 * @since 1.0.0 17 */ 18 define( 'WPINC', 'wp-includes' ); 19 20 // Include files required for initialization. 21 require( ABSPATH . WPINC . '/load.php' ); 22 require( ABSPATH . WPINC . '/default-constants.php' ); 23 require( 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. 26 wp_initial_constants( ); 27 28 // Check for the required PHP version and for the MySQL extension or a database drop-in. 29 wp_check_php_mysql_versions(); 30 31 // Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php. 32 set_magic_quotes_runtime( 0 ); 33 @ini_set( 'magic_quotes_sybase', 0 ); 34 35 // Set default timezone in PHP 5. 36 if ( function_exists( 'date_default_timezone_set' ) ) 37 date_default_timezone_set( 'UTC' ); 38 39 // Turn register_globals off. 46 40 wp_unregister_GLOBALS(); 47 41 48 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate ); 49 50 // Force REQUEST to be GET + POST. If SERVER, COOKIE, or ENV are needed, use those superglobals directly. 51 $_REQUEST = array_merge($_GET, $_POST); 52 53 /** 54 * The $blog_id global, which you can change in the config allows you to create a simple 55 * multiple blog installation using just one WordPress and changing $blog_id around. 56 * 57 * @global int $blog_id 58 * @since 2.0.0 59 */ 60 if ( ! isset($blog_id) ) 61 $blog_id = 1; 62 63 // Fix for IIS when running with PHP ISAPI 64 if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 65 66 // IIS Mod-Rewrite 67 if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 68 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 42 // Ensure these global variables do not exist so they do not interfere with WordPress. 43 unset( $wp_filter, $cache_lastcommentmodified ); 44 45 // Standardize $_SERVER variables across setups. 46 wp_fix_server_vars(); 47 48 // Check if we have received a request due to missing favicon.ico 49 wp_favicon_request(); 50 51 // Check if we're in maintenance mode. 52 wp_maintenance(); 53 54 // Start loading timer. 55 timer_start(); 56 57 // Check if we're in WP_DEBUG mode. 58 wp_debug_mode(); 59 60 // For an advanced caching plugin to use. Uses a static drop-in because you would only want one. 61 if ( 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. 65 wp_set_lang_dir(); 66 67 // Load early WordPress files. 68 require( ABSPATH . WPINC . '/compat.php' ); 69 require( ABSPATH . WPINC . '/functions.php' ); 70 require( ABSPATH . WPINC . '/class-wp.php' ); 71 require( ABSPATH . WPINC . '/class-wp-error.php' ); 72 require( ABSPATH . WPINC . '/plugin.php' ); 73 74 // Include the wpdb class and, if present, a db.php database drop-in. 75 require_wp_db(); 76 77 // Set the database table prefix and the format specifiers for database table columns. 78 wp_set_wpdb_vars(); 79 80 // Start the WordPress object cache, or an external object cache if the drop-in is present. 81 wp_start_object_cache(); 82 83 // Load early WordPress files. 84 require( ABSPATH . WPINC . '/default-filters.php' ); 85 require( ABSPATH . WPINC . '/pomo/mo.php' ); 86 87 // Initialize multisite if enabled. 88 if ( is_multisite() ) { 89 require( ABSPATH . WPINC . '/ms-blogs.php' ); 90 require( ABSPATH . WPINC . '/ms-settings.php' ); 91 } elseif ( ! defined( 'MULTISITE' ) ) { 92 define( 'MULTISITE', false ); 93 } 94 95 // Stop most of WordPress from being loaded if we just want the basics. 96 if ( SHORTINIT ) 97 return false; 98 99 // Load the l18n library. 100 require( ABSPATH . WPINC . '/l10n.php' ); 101 102 // Run the installer if WordPress is not installed. 103 wp_not_installed(); 104 105 // Load most of WordPress. 106 require( ABSPATH . WPINC . '/class-wp-walker.php' ); 107 require( ABSPATH . WPINC . '/class-wp-ajax-response.php' ); 108 require( ABSPATH . WPINC . '/formatting.php' ); 109 require( ABSPATH . WPINC . '/capabilities.php' ); 110 require( ABSPATH . WPINC . '/query.php' ); 111 require( ABSPATH . WPINC . '/theme.php' ); 112 require( ABSPATH . WPINC . '/user.php' ); 113 require( ABSPATH . WPINC . '/meta.php' ); 114 require( ABSPATH . WPINC . '/general-template.php' ); 115 require( ABSPATH . WPINC . '/link-template.php' ); 116 require( ABSPATH . WPINC . '/author-template.php' ); 117 require( ABSPATH . WPINC . '/post.php' ); 118 require( ABSPATH . WPINC . '/post-template.php' ); 119 require( ABSPATH . WPINC . '/category.php' ); 120 require( ABSPATH . WPINC . '/category-template.php' ); 121 require( ABSPATH . WPINC . '/comment.php' ); 122 require( ABSPATH . WPINC . '/comment-template.php' ); 123 require( ABSPATH . WPINC . '/rewrite.php' ); 124 require( ABSPATH . WPINC . '/feed.php' ); 125 require( ABSPATH . WPINC . '/bookmark.php' ); 126 require( ABSPATH . WPINC . '/bookmark-template.php' ); 127 require( ABSPATH . WPINC . '/kses.php' ); 128 require( ABSPATH . WPINC . '/cron.php' ); 129 require( ABSPATH . WPINC . '/deprecated.php' ); 130 require( ABSPATH . WPINC . '/script-loader.php' ); 131 require( ABSPATH . WPINC . '/taxonomy.php' ); 132 require( ABSPATH . WPINC . '/update.php' ); 133 require( ABSPATH . WPINC . '/canonical.php' ); 134 require( ABSPATH . WPINC . '/shortcodes.php' ); 135 require( ABSPATH . WPINC . '/media.php' ); 136 require( ABSPATH . WPINC . '/http.php' ); 137 require( ABSPATH . WPINC . '/class-http.php' ); 138 require( ABSPATH . WPINC . '/widgets.php' ); 139 require( ABSPATH . WPINC . '/nav-menu.php' ); 140 require( ABSPATH . WPINC . '/nav-menu-template.php' ); 141 require( ABSPATH . WPINC . '/admin-bar.php' ); 142 143 // Load multisite-specific files. 144 if ( is_multisite() ) { 145 require( ABSPATH . WPINC . '/ms-functions.php' ); 146 require( ABSPATH . WPINC . '/ms-default-filters.php' ); 147 require( ABSPATH . WPINC . '/ms-deprecated.php' ); 148 } 149 150 // Define constants that rely on the API to obtain the default value. 151 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. 152 wp_plugin_directory_constants( ); 153 154 // Load must-use plugins. 155 foreach ( wp_get_mu_plugins() as $mu_plugin ) { 156 include_once( $mu_plugin ); 157 } 158 unset( $mu_plugin ); 159 160 // Load network activated plugins. 161 if ( is_multisite() ) { 162 foreach( wp_get_active_network_plugins() as $network_plugin ) { 163 include_once( $network_plugin ); 69 164 } 70 // IIS Isapi_Rewrite 71 else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 72 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 73 } 74 else 75 { 76 // Use ORIG_PATH_INFO if there is no PATH_INFO 77 if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) 78 $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 79 80 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 81 if ( isset($_SERVER['PATH_INFO']) ) { 82 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 83 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 84 else 85 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 86 } 87 88 // Append the query string if it exists and isn't null 89 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { 90 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 91 } 92 } 93 } 94 95 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 96 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) 97 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 98 99 // Fix for Dreamhost and other PHP as CGI hosts 100 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) 101 unset($_SERVER['PATH_INFO']); 102 103 // Fix empty PHP_SELF 104 $PHP_SELF = $_SERVER['PHP_SELF']; 105 if ( empty($PHP_SELF) ) 106 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 107 108 if ( version_compare( '4.3', phpversion(), '>' ) ) { 109 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() ) ); 110 } 111 112 if ( !defined('WP_CONTENT_DIR') ) 113 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 114 115 if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) { 116 include(ABSPATH . '.maintenance'); 117 // If the $upgrading timestamp is older than 10 minutes, don't die. 118 if ( ( time() - $upgrading ) < 600 ) { 119 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { 120 require_once( WP_CONTENT_DIR . '/maintenance.php' ); 121 die(); 122 } 123 124 $protocol = $_SERVER["SERVER_PROTOCOL"]; 125 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 126 $protocol = 'HTTP/1.0'; 127 header( "$protocol 503 Service Unavailable", true, 503 ); 128 header( 'Content-Type: text/html; charset=utf-8' ); 129 ?> 130 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 131 <html xmlns="http://www.w3.org/1999/xhtml"> 132 <head> 133 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 134 <title>Maintenance</title> 135 136 </head> 137 <body> 138 <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1> 139 </body> 140 </html> 141 <?php 142 die(); 143 } 144 } 145 146 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) 147 die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 148 149 /** 150 * PHP 4 standard microtime start capture. 151 * 152 * @access private 153 * @since 0.71 154 * @global int $timestart Seconds and Microseconds added together from when function is called. 155 * @return bool Always returns true. 156 */ 157 function timer_start() { 158 global $timestart; 159 $mtime = explode(' ', microtime() ); 160 $mtime = $mtime[1] + $mtime[0]; 161 $timestart = $mtime; 162 return true; 163 } 164 165 /** 166 * Return and/or display the time from the page start to when function is called. 167 * 168 * You can get the results and print them by doing: 169 * <code> 170 * $nTimePageTookToExecute = timer_stop(); 171 * echo $nTimePageTookToExecute; 172 * </code> 173 * 174 * Or instead, you can do: 175 * <code> 176 * timer_stop(1); 177 * </code> 178 * which will do what the above does. If you need the result, you can assign it to a variable, but 179 * most cases, you only need to echo it. 180 * 181 * @since 0.71 182 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called 183 * @global int $timeend Seconds and Microseconds added together from when function is called 184 * 185 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time 186 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 187 * @return float The "second.microsecond" finished time calculation 188 */ 189 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal 190 global $timestart, $timeend; 191 $mtime = microtime(); 192 $mtime = explode(' ',$mtime); 193 $mtime = $mtime[1] + $mtime[0]; 194 $timeend = $mtime; 195 $timetotal = $timeend-$timestart; 196 $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision); 197 if ( $display ) 198 echo $r; 199 return $r; 200 } 201 timer_start(); 202 203 // Add define('WP_DEBUG',true); to wp-config.php to enable display of notices during development. 204 if (defined('WP_DEBUG') and WP_DEBUG == true) { 205 error_reporting(E_ALL); 206 } else { 207 if ( defined('E_RECOVERABLE_ERROR') ) 208 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); 209 else 210 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING); 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 /** 256 * Format specifiers for DB columns. Columns not listed here default to %s. 257 * @since 2.8.0 258 * @see wpdb:$field_types 259 * @see wpdb:prepare() 260 * @see wpdb:insert() 261 * @see wpdb:update() 262 */ 263 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 264 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 265 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 266 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d'); 267 268 $prefix = $wpdb->set_prefix($table_prefix); 269 270 if ( is_wp_error($prefix) ) 271 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*/); 272 273 /** 274 * Copy an object. 275 * 276 * Returns a cloned copy of an object. 277 * 278 * @since 2.7.0 279 * 280 * @param object $object The object to clone 281 * @return object The cloned object 282 */ 283 function wp_clone( $object ) { 284 static $can_clone; 285 if ( !isset( $can_clone ) ) { 286 $can_clone = version_compare( phpversion(), '5.0', '>=' ); 287 } 288 return $can_clone ? clone( $object ) : $object; 289 } 290 291 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) { 292 require_once (WP_CONTENT_DIR . '/object-cache.php'); 293 $_wp_using_ext_object_cache = true; 294 } else { 295 require_once (ABSPATH . WPINC . '/cache.php'); 296 $_wp_using_ext_object_cache = false; 297 } 298 299 wp_cache_init(); 300 if ( function_exists('wp_cache_add_global_groups') ) { 301 wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta')); 302 wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); 303 } 304 305 require (ABSPATH . WPINC . '/plugin.php'); 306 require (ABSPATH . WPINC . '/default-filters.php'); 307 include_once(ABSPATH . WPINC . '/pomo/mo.php'); 308 require_once (ABSPATH . WPINC . '/l10n.php'); 309 310 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) { 311 if ( defined('WP_SITEURL') ) 312 $link = WP_SITEURL . '/wp-admin/install.php'; 313 elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) 314 $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; 315 else 316 $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; 317 require_once(ABSPATH . WPINC . '/kses.php'); 318 require_once(ABSPATH . WPINC . '/pluggable.php'); 319 require_once(ABSPATH . WPINC . '/formatting.php'); 320 wp_redirect($link); 321 die(); // have to die here ~ Mark 322 } 323 324 require (ABSPATH . WPINC . '/formatting.php'); 325 require (ABSPATH . WPINC . '/capabilities.php'); 326 require (ABSPATH . WPINC . '/query.php'); 327 require (ABSPATH . WPINC . '/theme.php'); 328 require (ABSPATH . WPINC . '/user.php'); 329 require (ABSPATH . WPINC . '/general-template.php'); 330 require (ABSPATH . WPINC . '/link-template.php'); 331 require (ABSPATH . WPINC . '/author-template.php'); 332 require (ABSPATH . WPINC . '/post.php'); 333 require (ABSPATH . WPINC . '/post-template.php'); 334 require (ABSPATH . WPINC . '/category.php'); 335 require (ABSPATH . WPINC . '/category-template.php'); 336 require (ABSPATH . WPINC . '/comment.php'); 337 require (ABSPATH . WPINC . '/comment-template.php'); 338 require (ABSPATH . WPINC . '/rewrite.php'); 339 require (ABSPATH . WPINC . '/feed.php'); 340 require (ABSPATH . WPINC . '/bookmark.php'); 341 require (ABSPATH . WPINC . '/bookmark-template.php'); 342 require (ABSPATH . WPINC . '/kses.php'); 343 require (ABSPATH . WPINC . '/cron.php'); 344 require (ABSPATH . WPINC . '/version.php'); 345 require (ABSPATH . WPINC . '/deprecated.php'); 346 require (ABSPATH . WPINC . '/script-loader.php'); 347 require (ABSPATH . WPINC . '/taxonomy.php'); 348 require (ABSPATH . WPINC . '/update.php'); 349 require (ABSPATH . WPINC . '/canonical.php'); 350 require (ABSPATH . WPINC . '/shortcodes.php'); 351 require (ABSPATH . WPINC . '/media.php'); 352 require (ABSPATH . WPINC . '/http.php'); 353 require (ABSPATH . WPINC . '/widgets.php'); 354 355 if ( !defined('WP_CONTENT_URL') ) 356 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up 357 358 /** 359 * Allows for the plugins directory to be moved from the default location. 360 * 361 * @since 2.6.0 362 */ 363 if ( !defined('WP_PLUGIN_DIR') ) 364 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash 365 366 /** 367 * Allows for the plugins directory to be moved from the default location. 368 * 369 * @since 2.6.0 370 */ 371 if ( !defined('WP_PLUGIN_URL') ) 372 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash 373 374 /** 375 * Allows for the plugins directory to be moved from the default location. 376 * 377 * @since 2.1.0 378 */ 379 if ( !defined('PLUGINDIR') ) 380 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. 381 382 /** 383 * Allows for the mu-plugins directory to be moved from the default location. 384 * 385 * @since 2.8.0 386 */ 387 if ( !defined('WPMU_PLUGIN_DIR') ) 388 define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash 389 390 /** 391 * Allows for the mu-plugins directory to be moved from the default location. 392 * 393 * @since 2.8.0 394 */ 395 if ( !defined('WPMU_PLUGIN_URL') ) 396 define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash 397 398 /** 399 * Allows for the mu-plugins directory to be moved from the default location. 400 * 401 * @since 2.8.0 402 */ 403 if ( !defined( 'MUPLUGINDIR' ) ) 404 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 405 406 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 407 if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) { 408 while ( ( $plugin = readdir( $dh ) ) !== false ) { 409 if ( substr( $plugin, -4 ) == '.php' ) { 410 include_once( WPMU_PLUGIN_DIR . '/' . $plugin ); 411 } 412 } 413 } 414 } 415 do_action('muplugins_loaded'); 416 417 /** 418 * Used to guarantee unique hash cookies 419 * @since 1.5 420 */ 421 define('COOKIEHASH', md5(get_option('siteurl'))); 422 423 /** 424 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php 425 * @since 2.5.0 426 */ 427 $wp_default_secret_key = 'put your unique phrase here'; 428 429 /** 430 * It is possible to define this in wp-config.php 431 * @since 2.0.0 432 */ 433 if ( !defined('USER_COOKIE') ) 434 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); 435 436 /** 437 * It is possible to define this in wp-config.php 438 * @since 2.0.0 439 */ 440 if ( !defined('PASS_COOKIE') ) 441 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); 442 443 /** 444 * It is possible to define this in wp-config.php 445 * @since 2.5.0 446 */ 447 if ( !defined('AUTH_COOKIE') ) 448 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); 449 450 /** 451 * It is possible to define this in wp-config.php 452 * @since 2.6.0 453 */ 454 if ( !defined('SECURE_AUTH_COOKIE') ) 455 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); 456 457 /** 458 * It is possible to define this in wp-config.php 459 * @since 2.6.0 460 */ 461 if ( !defined('LOGGED_IN_COOKIE') ) 462 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); 463 464 /** 465 * It is possible to define this in wp-config.php 466 * @since 2.3.0 467 */ 468 if ( !defined('TEST_COOKIE') ) 469 define('TEST_COOKIE', 'wordpress_test_cookie'); 470 471 /** 472 * It is possible to define this in wp-config.php 473 * @since 1.2.0 474 */ 475 if ( !defined('COOKIEPATH') ) 476 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); 477 478 /** 479 * It is possible to define this in wp-config.php 480 * @since 1.5.0 481 */ 482 if ( !defined('SITECOOKIEPATH') ) 483 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); 484 485 /** 486 * It is possible to define this in wp-config.php 487 * @since 2.6.0 488 */ 489 if ( !defined('ADMIN_COOKIE_PATH') ) 490 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); 491 492 /** 493 * It is possible to define this in wp-config.php 494 * @since 2.6.0 495 */ 496 if ( !defined('PLUGINS_COOKIE_PATH') ) 497 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); 498 499 /** 500 * It is possible to define this in wp-config.php 501 * @since 2.0.0 502 */ 503 if ( !defined('COOKIE_DOMAIN') ) 504 define('COOKIE_DOMAIN', false); 505 506 /** 507 * It is possible to define this in wp-config.php 508 * @since 2.6.0 509 */ 510 if ( !defined('FORCE_SSL_ADMIN') ) 511 define('FORCE_SSL_ADMIN', false); 512 force_ssl_admin(FORCE_SSL_ADMIN); 513 514 /** 515 * It is possible to define this in wp-config.php 516 * @since 2.6.0 517 */ 518 if ( !defined('FORCE_SSL_LOGIN') ) 519 define('FORCE_SSL_LOGIN', false); 520 force_ssl_login(FORCE_SSL_LOGIN); 521 522 /** 523 * It is possible to define this in wp-config.php 524 * @since 2.5.0 525 */ 526 if ( !defined( 'AUTOSAVE_INTERVAL' ) ) 527 define( 'AUTOSAVE_INTERVAL', 60 ); 528 529 530 require (ABSPATH . WPINC . '/vars.php'); 531 532 // make taxonomies available to plugins and themes 533 // @plugin authors: warning: this gets registered again on the init hook 165 unset( $network_plugin ); 166 } 167 168 do_action( 'muplugins_loaded' ); 169 170 if ( is_multisite() ) 171 ms_cookie_constants( ); 172 173 // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). 174 wp_cookie_constants( ); 175 176 // Define and enforce our SSL constants 177 wp_ssl_constants( ); 178 179 // Create common globals. 180 require( ABSPATH . WPINC . '/vars.php' ); 181 182 // Make taxonomies and posts available to plugins and themes. 183 // @plugin authors: warning: these get registered again on the init hook. 534 184 create_initial_taxonomies(); 535 536 // Check for hacks file if the option is enabled 537 if ( get_option('hack_file') ) { 538 if ( file_exists(ABSPATH . 'my-hacks.php') ) 539 require(ABSPATH . 'my-hacks.php'); 540 } 541 542 $current_plugins = get_option('active_plugins'); 543 if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) { 544 foreach ( $current_plugins as $plugin ) { 545 // check the $plugin filename 546 // Validate plugin filename 547 if ( validate_file($plugin) // $plugin must validate as file 548 || '.php' != substr($plugin, -4) // $plugin must end with '.php' 549 || !file_exists(WP_PLUGIN_DIR . '/' . $plugin) // $plugin must exist 550 ) 551 continue; 552 553 include_once(WP_PLUGIN_DIR . '/' . $plugin); 554 } 555 unset($plugin); 556 } 557 unset($current_plugins); 558 559 require (ABSPATH . WPINC . '/pluggable.php'); 560 561 /* 562 * In most cases the default internal encoding is latin1, which is of no use, 563 * since we want to use the mb_ functions for utf-8 strings 564 */ 565 if (function_exists('mb_internal_encoding')) { 566 if (!@mb_internal_encoding(get_option('blog_charset'))) 567 mb_internal_encoding('UTF-8'); 568 } 569 570 571 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') ) 185 create_initial_post_types(); 186 187 // Register the default theme directory root 188 register_theme_directory( get_theme_root() ); 189 190 // Load active plugins. 191 foreach ( wp_get_active_and_valid_plugins() as $plugin ) 192 include_once( $plugin ); 193 unset( $plugin ); 194 195 // Load pluggable functions. 196 require( ABSPATH . WPINC . '/pluggable.php' ); 197 require( ABSPATH . WPINC . '/pluggable-deprecated.php' ); 198 199 // Set internal encoding. 200 wp_set_internal_encoding(); 201 202 // Run wp_cache_postload() if object cache is enabled and the function exists. 203 if ( WP_CACHE && function_exists( 'wp_cache_postload' ) ) 572 204 wp_cache_postload(); 573 205 574 do_action('plugins_loaded'); 575 576 $default_constants = array( 'WP_POST_REVISIONS' => true ); 577 foreach ( $default_constants as $c => $v ) 578 @define( $c, $v ); // will fail if the constant is already defined 579 unset($default_constants, $c, $v); 580 581 // If already slashed, strip. 582 if ( get_magic_quotes_gpc() ) { 583 $_GET = stripslashes_deep($_GET ); 584 $_POST = stripslashes_deep($_POST ); 585 $_COOKIE = stripslashes_deep($_COOKIE); 586 } 587 588 // Escape with wpdb. 589 $_GET = add_magic_quotes($_GET ); 590 $_POST = add_magic_quotes($_POST ); 591 $_COOKIE = add_magic_quotes($_COOKIE); 592 $_SERVER = add_magic_quotes($_SERVER); 593 594 do_action('sanitize_comment_cookies'); 206 do_action( 'plugins_loaded' ); 207 208 // Define constants which affect functionality if not already defined. 209 wp_functionality_constants( ); 210 211 // Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) 212 wp_magic_quotes(); 213 214 do_action( 'sanitize_comment_cookies' ); 595 215 596 216 /** … … 599 219 * @since 2.0.0 600 220 */ 601 $wp_the_query = &new WP_Query();221 $wp_the_query = new WP_Query(); 602 222 603 223 /** … … 607 227 * @since 1.5.0 608 228 */ 609 $wp_query =& $wp_the_query;229 $wp_query =& $wp_the_query; 610 230 611 231 /** … … 614 234 * @since 1.5.0 615 235 */ 616 $wp_rewrite =&new WP_Rewrite();236 $wp_rewrite = new WP_Rewrite(); 617 237 618 238 /** … … 621 241 * @since 2.0.0 622 242 */ 623 $wp =&new WP();243 $wp = new WP(); 624 244 625 245 /** … … 628 248 * @since 2.8.0 629 249 */ 630 $wp_widget_factory =& new WP_Widget_Factory(); 631 632 do_action('setup_theme'); 633 634 /** 635 * Web Path to the current active template directory 636 * @since 1.5.0 637 */ 638 define('TEMPLATEPATH', get_template_directory()); 639 640 /** 641 * Web Path to the current active template stylesheet directory 642 * @since 2.1.0 643 */ 644 define('STYLESHEETPATH', get_stylesheet_directory()); 250 $wp_widget_factory = new WP_Widget_Factory(); 251 252 do_action( 'setup_theme' ); 253 254 // Define the template related constants. 255 wp_templating_constants( ); 645 256 646 257 // Load the default text localization domain. 647 258 load_default_textdomain(); 648 259 649 /** 650 * The locale of the blog 651 * @since 1.5.0 652 */ 260 // Find the blog locale. 653 261 $locale = get_locale(); 654 262 $locale_file = WP_LANG_DIR . "/$locale.php"; 655 if ( is_readable($locale_file) ) 656 require_once($locale_file); 263 if ( ( 0 === validate_file( $locale ) ) && is_readable( $locale_file ) ) 264 require( $locale_file ); 265 unset($locale_file); 657 266 658 267 // Pull in locale data after loading text domain. 659 require _once(ABSPATH . WPINC . '/locale.php');268 require( ABSPATH . WPINC . '/locale.php' ); 660 269 661 270 /** … … 664 273 * @since 2.1.0 665 274 */ 666 $wp_locale =& new WP_Locale(); 667 668 // Load functions for active theme. 669 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) 670 include(STYLESHEETPATH . '/functions.php'); 671 if ( file_exists(TEMPLATEPATH . '/functions.php') ) 672 include(TEMPLATEPATH . '/functions.php'); 673 674 /** 675 * Runs just before PHP shuts down execution. 676 * 677 * @access private 678 * @since 1.2.0 679 */ 680 function shutdown_action_hook() { 681 do_action('shutdown'); 682 wp_cache_close(); 683 } 684 register_shutdown_function('shutdown_action_hook'); 685 686 $wp->init(); // Sets up current user. 687 688 // Everything is loaded and initialized. 689 do_action('init'); 690 275 $wp_locale = new WP_Locale(); 276 277 // Load the functions for the active theme, for both parent and child theme if applicable. 278 if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) { 279 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) 280 include( STYLESHEETPATH . '/functions.php' ); 281 if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) 282 include( TEMPLATEPATH . '/functions.php' ); 283 } 284 285 do_action( 'after_setup_theme' ); 286 287 // Load any template functions the theme supports. 288 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); 289 290 register_shutdown_function( 'shutdown_action_hook' ); 291 292 // Set up current user. 293 $wp->init(); 294 295 /** 296 * Most of WP is loaded at this stage, and the user is authenticated. WP continues 297 * to load on the init hook that follows (e.g. widgets), and many plugins instantiate 298 * themselves on it for all sorts of reasons (e.g. they need a user, a taxonomy, etc.). 299 * 300 * If you wish to plug an action once WP is loaded, use the wp_loaded hook below. 301 */ 302 do_action( 'init' ); 303 304 // Check site status 305 if ( is_multisite() ) { 306 if ( true !== ( $file = ms_site_check() ) ) { 307 require( $file ); 308 die(); 309 } 310 unset($file); 311 } 312 313 /** 314 * This hook is fired once WP, all plugins, and the theme are fully loaded and instantiated. 315 * 316 * AJAX requests should use wp-admin/admin-ajax.php. admin-ajax.php can handle requests for 317 * users not logged in. 318 * 319 * @link http://codex.wordpress.org/AJAX_in_Plugins 320 * 321 * @since 3.0.0 322 */ 323 do_action('wp_loaded'); 691 324 ?>
Note:
See TracChangeset
for help on using the changeset viewer.