Ticket #11881: 11881.5.diff
File 11881.5.diff, 49.0 KB (added by , 15 years ago) |
---|
-
wp-admin/setup-config.php
31 31 define('ABSPATH', dirname(dirname(__FILE__)).'/'); 32 32 define('WPINC', 'wp-includes'); 33 33 define('WP_CONTENT_DIR', ABSPATH . 'wp-content'); 34 define('WP_DEBUG', false); 34 35 /**#@-*/ 35 36 37 require_once(ABSPATH . WPINC . '/load.php'); 36 38 require_once(ABSPATH . WPINC . '/compat.php'); 37 39 require_once(ABSPATH . WPINC . '/functions.php'); 38 40 require_once(ABSPATH . WPINC . '/classes.php'); -
wp-includes/default-constants.php
1 <?php 2 3 /** 4 * Defines constants and global variables that can be overridden, generally in wp-config.php. 5 * 6 * @package WordPress 7 */ 8 9 /** 10 * Defines WordPress default constants. 11 * 12 * @since 3.0.0 13 * @param $context 14 */ 15 function wp_default_constants( $context ) { 16 17 switch( $context ) { 18 19 case 'init' : 20 21 // set memory limits 22 if ( !defined('WP_MEMORY_LIMIT') ) { 23 if( is_multisite() ) { 24 define('WP_MEMORY_LIMIT', '64M'); 25 } else { 26 define('WP_MEMORY_LIMIT', '32M'); 27 } 28 } 29 30 /** 31 * The $blog_id global, which you can change in the config allows you to create a simple 32 * multiple blog installation using just one WordPress and changing $blog_id around. 33 * 34 * @global int $blog_id 35 * @since 2.0.0 36 */ 37 if ( ! isset($blog_id) ) 38 $blog_id = 1; 39 40 // set memory limits. 41 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) 42 @ini_set('memory_limit', WP_MEMORY_LIMIT); 43 44 if ( !defined('WP_CONTENT_DIR') ) 45 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down 46 47 // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development. 48 if ( !defined('WP_DEBUG') ) 49 define( 'WP_DEBUG', false ); 50 51 // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php to use the globally configured setting for display_errors and not force it to On 52 if ( !defined('WP_DEBUG_DISPLAY') ) 53 define( 'WP_DEBUG_DISPLAY', true ); 54 55 // Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log 56 if ( !defined('WP_DEBUG_LOG') ) 57 define('WP_DEBUG_LOG', false); 58 59 if ( !defined('WP_CACHE') ) 60 define('WP_CACHE', false); 61 62 /** 63 * Private 64 */ 65 if ( !defined('MEDIA_TRASH') ) 66 define('MEDIA_TRASH', false); 67 68 if ( !defined('SHORTINIT') ) 69 define('SHORTINIT', false); 70 break; 71 72 case 'wp_included': 73 74 if ( !defined('WP_CONTENT_URL') ) 75 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up 76 77 /** 78 * Allows for the plugins directory to be moved from the default location. 79 * 80 * @since 2.6.0 81 */ 82 if ( !defined('WP_PLUGIN_DIR') ) 83 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash 84 85 /** 86 * Allows for the plugins directory to be moved from the default location. 87 * 88 * @since 2.6.0 89 */ 90 if ( !defined('WP_PLUGIN_URL') ) 91 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash 92 93 /** 94 * Allows for the plugins directory to be moved from the default location. 95 * 96 * @since 2.1.0 97 */ 98 if ( !defined('PLUGINDIR') ) 99 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. 100 break; 101 102 case 'ms_network_settings_loaded': 103 104 /** 105 * Allows for the mu-plugins directory to be moved from the default location. 106 * 107 * @since 2.8.0 108 */ 109 if ( !defined('WPMU_PLUGIN_DIR') ) 110 define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash 111 112 /** 113 * Allows for the mu-plugins directory to be moved from the default location. 114 * 115 * @since 2.8.0 116 */ 117 if ( !defined('WPMU_PLUGIN_URL') ) 118 define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash 119 120 /** 121 * Allows for the mu-plugins directory to be moved from the default location. 122 * 123 * @since 2.8.0 124 */ 125 if ( !defined( 'MUPLUGINDIR' ) ) 126 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 127 break; 128 129 case 'ms_loaded'; 130 131 global $wp_default_secret_key; 132 133 /** 134 * Used to guarantee unique hash cookies 135 * @since 1.5 136 */ 137 if( !defined('COOKIEHASH') ) 138 define('COOKIEHASH', md5(get_option('siteurl'))); 139 140 /** 141 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php 142 * @since 2.5.0 143 */ 144 $wp_default_secret_key = 'put your unique phrase here'; 145 146 /** 147 * It is possible to define this in wp-config.php 148 * @since 2.0.0 149 */ 150 if ( !defined('USER_COOKIE') ) 151 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); 152 153 /** 154 * It is possible to define this in wp-config.php 155 * @since 2.0.0 156 */ 157 if ( !defined('PASS_COOKIE') ) 158 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); 159 160 /** 161 * It is possible to define this in wp-config.php 162 * @since 2.5.0 163 */ 164 if ( !defined('AUTH_COOKIE') ) 165 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); 166 167 /** 168 * It is possible to define this in wp-config.php 169 * @since 2.6.0 170 */ 171 if ( !defined('SECURE_AUTH_COOKIE') ) 172 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); 173 174 /** 175 * It is possible to define this in wp-config.php 176 * @since 2.6.0 177 */ 178 if ( !defined('LOGGED_IN_COOKIE') ) 179 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); 180 181 /** 182 * It is possible to define this in wp-config.php 183 * @since 2.3.0 184 */ 185 if ( !defined('TEST_COOKIE') ) 186 define('TEST_COOKIE', 'wordpress_test_cookie'); 187 188 /** 189 * It is possible to define this in wp-config.php 190 * @since 1.2.0 191 */ 192 if ( !defined('COOKIEPATH') ) 193 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); 194 195 /** 196 * It is possible to define this in wp-config.php 197 * @since 1.5.0 198 */ 199 if ( !defined('SITECOOKIEPATH') ) 200 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); 201 202 /** 203 * It is possible to define this in wp-config.php 204 * @since 2.6.0 205 */ 206 if ( !defined('ADMIN_COOKIE_PATH') ) 207 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); 208 209 /** 210 * It is possible to define this in wp-config.php 211 * @since 2.6.0 212 */ 213 if ( !defined('PLUGINS_COOKIE_PATH') ) 214 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); 215 216 /** 217 * It is possible to define this in wp-config.php 218 * @since 2.0.0 219 */ 220 if ( !defined('COOKIE_DOMAIN') ) 221 define('COOKIE_DOMAIN', false); 222 223 /** 224 * It is possible to define this in wp-config.php 225 * @since 2.6.0 226 */ 227 if ( !defined('FORCE_SSL_ADMIN') ) 228 define('FORCE_SSL_ADMIN', false); 229 force_ssl_admin(FORCE_SSL_ADMIN); 230 231 /** 232 * It is possible to define this in wp-config.php 233 * @since 2.6.0 234 */ 235 if ( !defined('FORCE_SSL_LOGIN') ) 236 define('FORCE_SSL_LOGIN', false); 237 force_ssl_login(FORCE_SSL_LOGIN); 238 239 /** 240 * It is possible to define this in wp-config.php 241 * @since 2.5.0 242 */ 243 if ( !defined( 'AUTOSAVE_INTERVAL' ) ) 244 define( 'AUTOSAVE_INTERVAL', 60 ); 245 246 /** 247 * It is possible to define this in wp-config.php 248 * @since 2.9.0 249 */ 250 if ( !defined( 'EMPTY_TRASH_DAYS' ) ) 251 define( 'EMPTY_TRASH_DAYS', 30 ); 252 break; 253 254 case 'plugins_loaded': 255 256 if ( !defined('WP_POST_REVISIONS') ) 257 define('WP_POST_REVISIONS', true); 258 break; 259 260 case 'setup_theme': 261 262 /** 263 * Web Path to the current active template directory 264 * @since 1.5.0 265 */ 266 define('TEMPLATEPATH', get_template_directory()); 267 268 /** 269 * Web Path to the current active template stylesheet directory 270 * @since 2.1.0 271 */ 272 define('STYLESHEETPATH', get_stylesheet_directory()); 273 break; 274 275 } 276 277 } 278 279 ?> 280 No newline at end of file -
wp-includes/load.php
1 <?php 2 3 /** 4 * These functions are needed to load WordPress. 5 * 6 * @package WordPress 7 */ 8 9 /** 10 * Turn register globals off. 11 * 12 * @access private 13 * @since 2.1.0 14 * @return null Will return null if register_globals PHP directive was disabled 15 */ 16 function wp_unregister_GLOBALS() { 17 if ( !ini_get('register_globals') ) 18 return; 19 20 if ( isset($_REQUEST['GLOBALS']) ) 21 die('GLOBALS overwrite attempt detected'); 22 23 // Variables that shouldn't be unset 24 $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); 25 26 $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); 27 foreach ( $input as $k => $v ) 28 if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) { 29 $GLOBALS[$k] = NULL; 30 unset($GLOBALS[$k]); 31 } 32 } 33 34 function wp_fix_server_vars() { 35 global $PHP_SELF; 36 // Fix for IIS when running with PHP ISAPI 37 if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 38 39 // IIS Mod-Rewrite 40 if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 41 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 42 } 43 // IIS Isapi_Rewrite 44 else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 45 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 46 } 47 else 48 { 49 // Use ORIG_PATH_INFO if there is no PATH_INFO 50 if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) 51 $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 52 53 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) 54 if ( isset($_SERVER['PATH_INFO']) ) { 55 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) 56 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; 57 else 58 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']; 59 } 60 61 // Append the query string if it exists and isn't null 62 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { 63 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; 64 } 65 } 66 } 67 68 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests 69 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) 70 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; 71 72 // Fix for Dreamhost and other PHP as CGI hosts 73 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) 74 unset($_SERVER['PATH_INFO']); 75 76 // Fix empty PHP_SELF 77 $PHP_SELF = $_SERVER['PHP_SELF']; 78 if ( empty($PHP_SELF) ) 79 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 80 } 81 82 function wp_check_php_mysql_versions() { 83 // we can probably extend this function to check if wp_die() exists then use translated strings, and then use it in install.php etc. 84 85 global $required_php_version, $wp_version; 86 $php_version = phpversion(); 87 if ( version_compare( $required_php_version, $php_version, '>' ) ) 88 die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %1$s but WordPress %2%s requires at least %2%s.'/*/WP_I18N_OLD_PHP*/, $php_version, $wp_version, $required_php_version ) ); 89 90 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) 91 die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); 92 } 93 94 function wp_maintenance() { 95 if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) { 96 include(ABSPATH . '.maintenance'); 97 // If the $upgrading timestamp is older than 10 minutes, don't die. 98 if ( ( time() - $upgrading ) < 600 ) { 99 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { 100 require_once( WP_CONTENT_DIR . '/maintenance.php' ); 101 die(); 102 } 103 104 $protocol = $_SERVER["SERVER_PROTOCOL"]; 105 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 106 $protocol = 'HTTP/1.0'; 107 header( "$protocol 503 Service Unavailable", true, 503 ); 108 header( 'Content-Type: text/html; charset=utf-8' ); 109 header( 'Retry-After: 600' ); 110 ?> 111 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 112 <html xmlns="http://www.w3.org/1999/xhtml"> 113 <head> 114 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 115 <title>Maintenance</title> 116 117 </head> 118 <body> 119 <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1> 120 </body> 121 </html> 122 <?php 123 die(); 124 } 125 } 126 } 127 128 /** 129 * PHP 4 standard microtime start capture. 130 * 131 * @access private 132 * @since 0.71 133 * @global int $timestart Seconds and Microseconds added together from when function is called. 134 * @return bool Always returns true. 135 */ 136 function timer_start() { 137 global $timestart; 138 $mtime = explode(' ', microtime() ); 139 $mtime = $mtime[1] + $mtime[0]; 140 $timestart = $mtime; 141 return true; 142 } 143 144 /** 145 * Return and/or display the time from the page start to when function is called. 146 * 147 * You can get the results and print them by doing: 148 * <code> 149 * $nTimePageTookToExecute = timer_stop(); 150 * echo $nTimePageTookToExecute; 151 * </code> 152 * 153 * Or instead, you can do: 154 * <code> 155 * timer_stop(1); 156 * </code> 157 * which will do what the above does. If you need the result, you can assign it to a variable, but 158 * most cases, you only need to echo it. 159 * 160 * @since 0.71 161 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called 162 * @global int $timeend Seconds and Microseconds added together from when function is called 163 * 164 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time 165 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 166 * @return float The "second.microsecond" finished time calculation 167 */ 168 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal 169 global $timestart, $timeend; 170 $mtime = microtime(); 171 $mtime = explode(' ',$mtime); 172 $mtime = $mtime[1] + $mtime[0]; 173 $timeend = $mtime; 174 $timetotal = $timeend-$timestart; 175 $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision); 176 if ( $display ) 177 echo $r; 178 return $r; 179 } 180 181 function wp_debug_mode() { 182 if ( WP_DEBUG ) { 183 if ( defined('E_DEPRECATED') ) 184 error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); 185 else 186 error_reporting(E_ALL); 187 188 if ( WP_DEBUG_DISPLAY ) 189 ini_set('display_errors', 1); 190 191 if ( WP_DEBUG_LOG ) { 192 ini_set('log_errors', 1); 193 ini_set('error_log', WP_CONTENT_DIR . '/debug.log'); 194 } 195 } else { 196 if ( defined('E_RECOVERABLE_ERROR') ) 197 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); 198 else 199 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING); 200 } 201 } 202 203 function wp_set_lang_dir() { 204 if ( !defined('WP_LANG_DIR') ) { 205 /** 206 * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR 207 * and uses that folder if it exists. Or it uses the "languages" folder in WPINC. 208 * 209 * @since 2.1.0 210 */ 211 if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) { 212 define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH 213 if (!defined('LANGDIR')) { 214 // Old static relative path maintained for limited backwards compatibility - won't work in some cases 215 define('LANGDIR', 'wp-content/languages'); 216 } 217 } else { 218 define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH 219 if (!defined('LANGDIR')) { 220 // Old relative path maintained for backwards compatibility 221 define('LANGDIR', WPINC . '/languages'); 222 } 223 } 224 } 225 } 226 227 function wp_set_wpdb_vars() { 228 global $wpdb, $table_prefix; 229 if ( !empty($wpdb->error) ) 230 dead_db(); 231 232 /** 233 * Format specifiers for DB columns. Columns not listed here default to %s. 234 * @since 2.8.0 235 * @see wpdb:$field_types 236 * @see wpdb:prepare() 237 * @see wpdb:insert() 238 * @see wpdb:update() 239 */ 240 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 241 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 242 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 243 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d'); 244 245 $prefix = $wpdb->set_prefix($table_prefix); 246 247 if ( is_wp_error($prefix) ) 248 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*/); 249 250 } 251 252 function wp_start_object_cache() { 253 global $_wp_using_ext_object_cache; 254 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) { 255 require_once (WP_CONTENT_DIR . '/object-cache.php'); 256 $_wp_using_ext_object_cache = true; 257 } else { 258 require_once (ABSPATH . WPINC . '/cache.php'); 259 $_wp_using_ext_object_cache = false; 260 } 261 262 wp_cache_init(); 263 if ( function_exists('wp_cache_add_global_groups') ) { 264 if( is_multisite() ) { 265 wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss')); 266 } else { 267 wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient')); 268 } 269 wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); 270 } 271 } 272 273 function wp_not_installed() { 274 if( is_multisite() ) { 275 if ( !is_blog_installed() && !defined('WP_INSTALLING') ) { 276 die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark 277 } 278 } elseif ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) { 279 if ( defined('WP_SITEURL') ) 280 $link = WP_SITEURL . '/wp-admin/install.php'; 281 elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) 282 $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; 283 else 284 $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; 285 require_once(ABSPATH . WPINC . '/kses.php'); 286 require_once(ABSPATH . WPINC . '/pluggable.php'); 287 require_once(ABSPATH . WPINC . '/formatting.php'); 288 wp_redirect($link); 289 die(); 290 } 291 } 292 293 function wp_load_mu_plugins() { 294 if ( is_dir( WPMU_PLUGIN_DIR ) ) { 295 if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) { 296 $mu_plugins = array (); 297 while ( ( $plugin = readdir( $dh ) ) !== false ) 298 if ( substr( $plugin, -4 ) == '.php' ) 299 $mu_plugins[] = $plugin; 300 closedir( $dh ); 301 if( is_multisite() ) 302 sort( $mu_plugins ); 303 foreach( $mu_plugins as $mu_plugin ) 304 include_once( WPMU_PLUGIN_DIR . '/' . $mu_plugin ); 305 } 306 } 307 } 308 309 function wp_load_plugins() { 310 // Check for hacks file if the option is enabled 311 if ( get_option('hack_file') ) { 312 if ( file_exists(ABSPATH . 'my-hacks.php') ) 313 require(ABSPATH . 'my-hacks.php'); 314 } 315 316 $current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); 317 if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) { 318 foreach ( $current_plugins as $plugin ) { 319 // check the $plugin filename 320 // Validate plugin filename 321 if ( validate_file($plugin) // $plugin must validate as file 322 || '.php' != substr($plugin, -4) // $plugin must end with '.php' 323 || !file_exists(WP_PLUGIN_DIR . '/' . $plugin) // $plugin must exist 324 ) 325 continue; 326 327 include_once(WP_PLUGIN_DIR . '/' . $plugin); 328 } 329 unset($plugin); 330 } 331 unset($current_plugins); 332 333 } 334 335 function wp_set_internal_encoding() { 336 /* 337 * In most cases the default internal encoding is latin1, which is of no use, 338 * since we want to use the mb_ functions for utf-8 strings 339 */ 340 if (function_exists('mb_internal_encoding')) { 341 if (!@mb_internal_encoding(get_option('blog_charset'))) 342 mb_internal_encoding('UTF-8'); 343 } 344 } 345 346 function wp_magic_quotes() { 347 // If already slashed, strip. 348 if ( get_magic_quotes_gpc() ) { 349 $_GET = stripslashes_deep($_GET ); 350 $_POST = stripslashes_deep($_POST ); 351 $_COOKIE = stripslashes_deep($_COOKIE); 352 } 353 354 // Escape with wpdb. 355 $_GET = add_magic_quotes($_GET ); 356 $_POST = add_magic_quotes($_POST ); 357 $_COOKIE = add_magic_quotes($_COOKIE); 358 $_SERVER = add_magic_quotes($_SERVER); 359 360 // Force REQUEST to be GET + POST. If SERVER, COOKIE, or ENV are needed, use those superglobals directly. 361 $_REQUEST = array_merge($_GET, $_POST); 362 } 363 364 function wp_find_locale() { 365 global $locale, $locale_file; 366 /** 367 * The locale of the blog 368 * @since 1.5.0 369 */ 370 $locale = get_locale(); 371 $locale_file = WP_LANG_DIR . "/$locale.php"; 372 if ( is_readable($locale_file) ) 373 require_once($locale_file); 374 375 // Pull in locale data after loading text domain. 376 require_once(ABSPATH . WPINC . '/locale.php'); 377 } 378 379 function wp_load_theme_functions() { 380 // Load functions for active theme. 381 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) 382 include(STYLESHEETPATH . '/functions.php'); 383 if ( file_exists(TEMPLATEPATH . '/functions.php') ) 384 include(TEMPLATEPATH . '/functions.php'); 385 386 // Load in support for template functions which the theme supports 387 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); 388 } 389 390 /** 391 * Runs just before PHP shuts down execution. 392 * 393 * @access private 394 * @since 1.2.0 395 */ 396 function shutdown_action_hook() { 397 do_action('shutdown'); 398 wp_cache_close(); 399 } 400 401 /** 402 * Copy an object. 403 * 404 * Returns a cloned copy of an object. 405 * 406 * @since 2.7.0 407 * 408 * @param object $object The object to clone 409 * @return object The cloned object 410 */ 411 function wp_clone( $object ) { 412 static $can_clone; 413 if ( !isset( $can_clone ) ) { 414 $can_clone = version_compare( phpversion(), '5.0', '>=' ); 415 } 416 return $can_clone ? clone( $object ) : $object; 417 } 418 419 /** 420 * Whether the current request is in WordPress admin Panel 421 * 422 * Does not inform on whether the user is an admin! Use capability checks to 423 * tell if the user should be accessing a section or not. 424 * 425 * @since 1.5.1 426 * 427 * @return bool True if inside WordPress administration pages. 428 */ 429 function is_admin() { 430 if ( defined('WP_ADMIN') ) 431 return WP_ADMIN; 432 return false; 433 } 434 435 /** 436 * Whether Multisite support is enabled 437 * 438 * @since 3.0 439 * 440 * @return bool True if multisite is enabled, false otherwise. 441 */ 442 function is_multisite() { 443 if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') ) 444 return true; 445 446 return false; 447 } 448 449 ?> 450 No newline at end of file -
wp-settings.php
3 3 * Used to setup 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) 8 7 * 9 8 * @package WordPress 10 9 */ 11 10 12 13 11 /** 14 * Whether Multisite support is enabled12 * Stores the location of the WordPress directory of functions, classes, and core content. 15 13 * 16 * @since 3.0 17 * 18 * @return bool True if multisite is enabled, false otherwise. 14 * @since 1.0.0 19 15 */ 20 function is_multisite() { 21 if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') ) 22 return true; 16 define('WPINC', 'wp-includes'); 23 17 24 return false; 25 } 18 require (ABSPATH . WPINC . '/load.php'); 19 require (ABSPATH . WPINC . '/default-constants.php'); 20 require (ABSPATH . WPINC . '/version.php'); 26 21 27 if ( !defined('WP_MEMORY_LIMIT') ) { 28 if( is_multisite() ) { 29 define('WP_MEMORY_LIMIT', '64M'); 30 } else { 31 define('WP_MEMORY_LIMIT', '32M'); 32 } 33 } 22 wp_default_constants('init'); 34 23 35 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )36 @ini_set('memory_limit', WP_MEMORY_LIMIT);37 38 24 set_magic_quotes_runtime(0); 39 25 @ini_set('magic_quotes_sybase', 0); 40 26 41 27 if ( function_exists('date_default_timezone_set') ) 42 28 date_default_timezone_set('UTC'); 43 29 44 /**45 * Turn register globals off.46 *47 * @access private48 * @since 2.1.049 * @return null Will return null if register_globals PHP directive was disabled50 */51 function wp_unregister_GLOBALS() {52 if ( !ini_get('register_globals') )53 return;54 55 if ( isset($_REQUEST['GLOBALS']) )56 die('GLOBALS overwrite attempt detected');57 58 // Variables that shouldn't be unset59 $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');60 61 $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());62 foreach ( $input as $k => $v )63 if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {64 $GLOBALS[$k] = NULL;65 unset($GLOBALS[$k]);66 }67 }68 69 30 wp_unregister_GLOBALS(); 70 31 71 32 unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate ); 72 33 73 /** 74 * The $blog_id global, which you can change in the config allows you to create a simple 75 * multiple blog installation using just one WordPress and changing $blog_id around. 76 * 77 * @global int $blog_id 78 * @since 2.0.0 79 */ 80 if ( ! isset($blog_id) ) 81 $blog_id = 1; 34 wp_fix_server_vars(); 82 35 83 // Fix for IIS when running with PHP ISAPI 84 if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { 36 wp_check_php_mysql_versions(); 85 37 86 // IIS Mod-Rewrite 87 if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { 88 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; 89 } 90 // IIS Isapi_Rewrite 91 else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { 92 $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; 93 } 94 else 95 { 96 // Use ORIG_PATH_INFO if there is no PATH_INFO 97 if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) 98 $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; 38 wp_maintenance(); 99 39 100 // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)101 if ( isset($_SERVER['PATH_INFO']) ) {102 if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )103 $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];104 else105 $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];106 }107 108 // Append the query string if it exists and isn't null109 if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {110 $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];111 }112 }113 }114 115 // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests116 if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) )117 $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];118 119 // Fix for Dreamhost and other PHP as CGI hosts120 if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false)121 unset($_SERVER['PATH_INFO']);122 123 // Fix empty PHP_SELF124 $PHP_SELF = $_SERVER['PHP_SELF'];125 if ( empty($PHP_SELF) )126 $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);127 128 if ( version_compare( '4.3', phpversion(), '>' ) ) {129 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() ) );130 }131 132 if ( !defined('WP_CONTENT_DIR') )133 define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down134 135 if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {136 include(ABSPATH . '.maintenance');137 // If the $upgrading timestamp is older than 10 minutes, don't die.138 if ( ( time() - $upgrading ) < 600 ) {139 if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {140 require_once( WP_CONTENT_DIR . '/maintenance.php' );141 die();142 }143 144 $protocol = $_SERVER["SERVER_PROTOCOL"];145 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )146 $protocol = 'HTTP/1.0';147 header( "$protocol 503 Service Unavailable", true, 503 );148 header( 'Content-Type: text/html; charset=utf-8' );149 header( 'Retry-After: 600' );150 ?>151 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">152 <html xmlns="http://www.w3.org/1999/xhtml">153 <head>154 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />155 <title>Maintenance</title>156 157 </head>158 <body>159 <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>160 </body>161 </html>162 <?php163 die();164 }165 }166 167 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )168 die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );169 170 /**171 * PHP 4 standard microtime start capture.172 *173 * @access private174 * @since 0.71175 * @global int $timestart Seconds and Microseconds added together from when function is called.176 * @return bool Always returns true.177 */178 function timer_start() {179 global $timestart;180 $mtime = explode(' ', microtime() );181 $mtime = $mtime[1] + $mtime[0];182 $timestart = $mtime;183 return true;184 }185 186 /**187 * Return and/or display the time from the page start to when function is called.188 *189 * You can get the results and print them by doing:190 * <code>191 * $nTimePageTookToExecute = timer_stop();192 * echo $nTimePageTookToExecute;193 * </code>194 *195 * Or instead, you can do:196 * <code>197 * timer_stop(1);198 * </code>199 * which will do what the above does. If you need the result, you can assign it to a variable, but200 * most cases, you only need to echo it.201 *202 * @since 0.71203 * @global int $timestart Seconds and Microseconds added together from when timer_start() is called204 * @global int $timeend Seconds and Microseconds added together from when function is called205 *206 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time207 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.208 * @return float The "second.microsecond" finished time calculation209 */210 function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal211 global $timestart, $timeend;212 $mtime = microtime();213 $mtime = explode(' ',$mtime);214 $mtime = $mtime[1] + $mtime[0];215 $timeend = $mtime;216 $timetotal = $timeend-$timestart;217 $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision);218 if ( $display )219 echo $r;220 return $r;221 }222 40 timer_start(); 223 41 224 // Add define('WP_DEBUG', true); to wp-config.php to enable display of notices during development. 225 if ( !defined('WP_DEBUG') ) 226 define( 'WP_DEBUG', false ); 42 wp_debug_mode(); 227 43 228 if ( WP_DEBUG ) {229 if ( defined('E_DEPRECATED') )230 error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);231 else232 error_reporting(E_ALL);233 // Add define('WP_DEBUG_DISPLAY', false); to wp-config.php to use the globally configured setting for display_errors and not force it to On234 if ( ! defined('WP_DEBUG_DISPLAY') || WP_DEBUG_DISPLAY )235 ini_set('display_errors', 1);236 // Add define('WP_DEBUG_LOG', true); to enable php debug logging to WP_CONTENT_DIR/debug.log237 if ( defined('WP_DEBUG_LOG') && WP_DEBUG_LOG ) {238 ini_set('log_errors', 1);239 ini_set('error_log', WP_CONTENT_DIR . '/debug.log');240 }241 } else {242 if ( defined('E_RECOVERABLE_ERROR') )243 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);244 else245 error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING);246 }247 248 44 // For an advanced caching plugin to use, static because you would only want one 249 if ( defined('WP_CACHE') &&WP_CACHE )45 if ( WP_CACHE ) 250 46 @include WP_CONTENT_DIR . '/advanced-cache.php'; 251 47 252 /** 253 * Private 254 */ 255 if ( !defined('MEDIA_TRASH') ) 256 define('MEDIA_TRASH', false); 48 wp_set_lang_dir(); 257 49 258 /**259 * Stores the location of the WordPress directory of functions, classes, and core content.260 *261 * @since 1.0.0262 */263 define('WPINC', 'wp-includes');264 265 if ( !defined('WP_LANG_DIR') ) {266 /**267 * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR268 * and uses that folder if it exists. Or it uses the "languages" folder in WPINC.269 *270 * @since 2.1.0271 */272 if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) {273 define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH274 if (!defined('LANGDIR')) {275 // Old static relative path maintained for limited backwards compatibility - won't work in some cases276 define('LANGDIR', 'wp-content/languages');277 }278 } else {279 define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH280 if (!defined('LANGDIR')) {281 // Old relative path maintained for backwards compatibility282 define('LANGDIR', WPINC . '/languages');283 }284 }285 }286 287 50 require (ABSPATH . WPINC . '/compat.php'); 288 51 require (ABSPATH . WPINC . '/functions.php'); 289 52 require (ABSPATH . WPINC . '/classes.php'); 290 53 291 54 require_wp_db(); 292 55 293 if ( !empty($wpdb->error) ) 294 dead_db(); 56 wp_set_wpdb_vars(); 295 57 296 /** 297 * Format specifiers for DB columns. Columns not listed here default to %s. 298 * @since 2.8.0 299 * @see wpdb:$field_types 300 * @see wpdb:prepare() 301 * @see wpdb:insert() 302 * @see wpdb:update() 303 */ 304 $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', 305 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', 306 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', 307 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d'); 58 wp_start_object_cache(); 308 59 309 $prefix = $wpdb->set_prefix($table_prefix); 310 311 if ( is_wp_error($prefix) ) 312 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*/); 313 314 /** 315 * Copy an object. 316 * 317 * Returns a cloned copy of an object. 318 * 319 * @since 2.7.0 320 * 321 * @param object $object The object to clone 322 * @return object The cloned object 323 */ 324 function wp_clone( $object ) { 325 static $can_clone; 326 if ( !isset( $can_clone ) ) { 327 $can_clone = version_compare( phpversion(), '5.0', '>=' ); 328 } 329 return $can_clone ? clone( $object ) : $object; 330 } 331 332 /** 333 * Whether the current request is in WordPress admin Panel 334 * 335 * Does not inform on whether the user is an admin! Use capability checks to 336 * tell if the user should be accessing a section or not. 337 * 338 * @since 1.5.1 339 * 340 * @return bool True if inside WordPress administration pages. 341 */ 342 function is_admin() { 343 if ( defined('WP_ADMIN') ) 344 return WP_ADMIN; 345 return false; 346 } 347 348 if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) { 349 require_once (WP_CONTENT_DIR . '/object-cache.php'); 350 $_wp_using_ext_object_cache = true; 351 } else { 352 require_once (ABSPATH . WPINC . '/cache.php'); 353 $_wp_using_ext_object_cache = false; 354 } 355 356 wp_cache_init(); 357 if ( function_exists('wp_cache_add_global_groups') ) { 358 if( is_multisite() ) { 359 wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss')); 360 } else { 361 wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient')); 362 } 363 wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); 364 } 365 366 if( is_multisite() ) { 60 if( is_multisite() ) 367 61 require (ABSPATH . WPINC . '/ms-load.php'); 368 }369 62 370 63 require (ABSPATH . WPINC . '/plugin.php'); 371 64 require (ABSPATH . WPINC . '/default-filters.php'); 372 65 include_once(ABSPATH . WPINC . '/pomo/mo.php'); 373 66 374 if( is_multisite() && defined( "SHORTINIT" ) &&SHORTINIT ) // stop most of WP being loaded, we just want the basics67 if( is_multisite() && SHORTINIT ) // stop most of WP being loaded, we just want the basics 375 68 return false; 376 69 377 70 require_once (ABSPATH . WPINC . '/l10n.php'); 378 71 379 if( is_multisite() ) { 380 if ( !is_blog_installed() && !defined('WP_INSTALLING') ) { 381 die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark 382 } 383 } elseif ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) { 384 if ( defined('WP_SITEURL') ) 385 $link = WP_SITEURL . '/wp-admin/install.php'; 386 elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) 387 $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; 388 else 389 $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; 390 require_once(ABSPATH . WPINC . '/kses.php'); 391 require_once(ABSPATH . WPINC . '/pluggable.php'); 392 require_once(ABSPATH . WPINC . '/formatting.php'); 393 wp_redirect($link); 394 die(); // have to die here ~ Mark 395 } 72 wp_not_installed(); 396 73 397 74 require (ABSPATH . WPINC . '/formatting.php'); 398 75 require (ABSPATH . WPINC . '/capabilities.php'); … … 415 92 require (ABSPATH . WPINC . '/bookmark-template.php'); 416 93 require (ABSPATH . WPINC . '/kses.php'); 417 94 require (ABSPATH . WPINC . '/cron.php'); 418 require (ABSPATH . WPINC . '/version.php');419 95 require (ABSPATH . WPINC . '/deprecated.php'); 420 96 require (ABSPATH . WPINC . '/script-loader.php'); 421 97 require (ABSPATH . WPINC . '/taxonomy.php'); … … 432 108 require_once( ABSPATH . WPINC . '/ms-deprecated.php' ); 433 109 } 434 110 435 if ( !defined('WP_CONTENT_URL') ) 436 define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); // full url - WP_CONTENT_DIR is defined further up 111 wp_default_constants('wp_included'); 437 112 438 /**439 * Allows for the plugins directory to be moved from the default location.440 *441 * @since 2.6.0442 */443 if ( !defined('WP_PLUGIN_DIR') )444 define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash445 446 /**447 * Allows for the plugins directory to be moved from the default location.448 *449 * @since 2.6.0450 */451 if ( !defined('WP_PLUGIN_URL') )452 define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash453 454 /**455 * Allows for the plugins directory to be moved from the default location.456 *457 * @since 2.1.0458 */459 if ( !defined('PLUGINDIR') )460 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.461 462 113 if( is_multisite() ) 463 114 ms_network_settings(); 464 /**465 * Allows for the mu-plugins directory to be moved from the default location.466 *467 * @since 2.8.0468 */469 if ( !defined('WPMU_PLUGIN_DIR') )470 define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // full path, no trailing slash471 115 472 /** 473 * Allows for the mu-plugins directory to be moved from the default location. 474 * 475 * @since 2.8.0 476 */ 477 if ( !defined('WPMU_PLUGIN_URL') ) 478 define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // full url, no trailing slash 116 wp_default_constants('ms_network_settings_loaded'); 479 117 480 /** 481 * Allows for the mu-plugins directory to be moved from the default location. 482 * 483 * @since 2.8.0 484 */ 485 if ( !defined( 'MUPLUGINDIR' ) ) 486 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. 118 wp_load_mu_plugins(); 487 119 488 if ( is_dir( WPMU_PLUGIN_DIR ) ) {489 if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) {490 $mu_plugins = array ();491 while ( ( $plugin = readdir( $dh ) ) !== false ) {492 if ( substr( $plugin, -4 ) == '.php' ) {493 $mu_plugins[] = $plugin;494 }495 }496 497 closedir( $dh );498 499 if( is_multisite() )500 sort( $mu_plugins );501 502 foreach( $mu_plugins as $mu_plugin ) {503 include_once( WPMU_PLUGIN_DIR . '/' . $mu_plugin );504 }505 }506 }507 120 /** 508 121 * Used to load network wide plugins 509 122 * @since 3.0 510 123 */ 511 if( is_multisite() ) {124 if( is_multisite() ) 512 125 ms_network_plugins(); 513 }514 126 515 127 do_action('muplugins_loaded'); 516 128 … … 522 134 ms_site_check(); 523 135 ms_network_cookies(); 524 136 } 525 /**526 * Used to guarantee unique hash cookies527 * @since 1.5528 */529 if( !defined('COOKIEHASH') )530 define('COOKIEHASH', md5(get_option('siteurl')));531 137 532 /** 533 * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php 534 * @since 2.5.0 535 */ 536 $wp_default_secret_key = 'put your unique phrase here'; 138 wp_default_constants('ms_loaded'); 537 139 538 /**539 * It is possible to define this in wp-config.php540 * @since 2.0.0541 */542 if ( !defined('USER_COOKIE') )543 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH);544 545 /**546 * It is possible to define this in wp-config.php547 * @since 2.0.0548 */549 if ( !defined('PASS_COOKIE') )550 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH);551 552 /**553 * It is possible to define this in wp-config.php554 * @since 2.5.0555 */556 if ( !defined('AUTH_COOKIE') )557 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);558 559 /**560 * It is possible to define this in wp-config.php561 * @since 2.6.0562 */563 if ( !defined('SECURE_AUTH_COOKIE') )564 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);565 566 /**567 * It is possible to define this in wp-config.php568 * @since 2.6.0569 */570 if ( !defined('LOGGED_IN_COOKIE') )571 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);572 573 /**574 * It is possible to define this in wp-config.php575 * @since 2.3.0576 */577 if ( !defined('TEST_COOKIE') )578 define('TEST_COOKIE', 'wordpress_test_cookie');579 580 /**581 * It is possible to define this in wp-config.php582 * @since 1.2.0583 */584 if ( !defined('COOKIEPATH') )585 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );586 587 /**588 * It is possible to define this in wp-config.php589 * @since 1.5.0590 */591 if ( !defined('SITECOOKIEPATH') )592 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );593 594 /**595 * It is possible to define this in wp-config.php596 * @since 2.6.0597 */598 if ( !defined('ADMIN_COOKIE_PATH') )599 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );600 601 /**602 * It is possible to define this in wp-config.php603 * @since 2.6.0604 */605 if ( !defined('PLUGINS_COOKIE_PATH') )606 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) );607 608 /**609 * It is possible to define this in wp-config.php610 * @since 2.0.0611 */612 if ( !defined('COOKIE_DOMAIN') )613 define('COOKIE_DOMAIN', false);614 615 /**616 * It is possible to define this in wp-config.php617 * @since 2.6.0618 */619 if ( !defined('FORCE_SSL_ADMIN') )620 define('FORCE_SSL_ADMIN', false);621 force_ssl_admin(FORCE_SSL_ADMIN);622 623 /**624 * It is possible to define this in wp-config.php625 * @since 2.6.0626 */627 if ( !defined('FORCE_SSL_LOGIN') )628 define('FORCE_SSL_LOGIN', false);629 force_ssl_login(FORCE_SSL_LOGIN);630 631 /**632 * It is possible to define this in wp-config.php633 * @since 2.5.0634 */635 if ( !defined( 'AUTOSAVE_INTERVAL' ) )636 define( 'AUTOSAVE_INTERVAL', 60 );637 638 /**639 * It is possible to define this in wp-config.php640 * @since 2.9.0641 */642 if ( !defined( 'EMPTY_TRASH_DAYS' ) )643 define( 'EMPTY_TRASH_DAYS', 30 );644 645 140 require (ABSPATH . WPINC . '/vars.php'); 646 141 647 142 // make taxonomies available to plugins and themes 648 143 // @plugin authors: warning: this gets registered again on the init hook 649 144 create_initial_taxonomies(); 650 145 651 // Check for hacks file if the option is enabled 652 if ( get_option('hack_file') ) { 653 if ( file_exists(ABSPATH . 'my-hacks.php') ) 654 require(ABSPATH . 'my-hacks.php'); 655 } 146 wp_load_plugins(); 656 147 657 $current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );658 if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) {659 foreach ( $current_plugins as $plugin ) {660 // check the $plugin filename661 // Validate plugin filename662 if ( validate_file($plugin) // $plugin must validate as file663 || '.php' != substr($plugin, -4) // $plugin must end with '.php'664 || !file_exists(WP_PLUGIN_DIR . '/' . $plugin) // $plugin must exist665 )666 continue;667 668 include_once(WP_PLUGIN_DIR . '/' . $plugin);669 }670 unset($plugin);671 }672 unset($current_plugins);673 674 148 require (ABSPATH . WPINC . '/pluggable.php'); 675 149 676 /* 677 * In most cases the default internal encoding is latin1, which is of no use, 678 * since we want to use the mb_ functions for utf-8 strings 679 */ 680 if (function_exists('mb_internal_encoding')) { 681 if (!@mb_internal_encoding(get_option('blog_charset'))) 682 mb_internal_encoding('UTF-8'); 683 } 150 wp_set_internal_encoding(); 684 151 685 686 if ( defined('WP_CACHE') && function_exists('wp_cache_postload') ) 152 if ( WP_CACHE && function_exists('wp_cache_postload') ) 687 153 wp_cache_postload(); 688 154 689 155 do_action('plugins_loaded'); 690 156 691 $default_constants = array( 'WP_POST_REVISIONS' => true ); 692 foreach ( $default_constants as $c => $v ) 693 @define( $c, $v ); // will fail if the constant is already defined 694 unset($default_constants, $c, $v); 157 wp_default_constants('plugins_loaded'); 695 158 696 // If already slashed, strip. 697 if ( get_magic_quotes_gpc() ) { 698 $_GET = stripslashes_deep($_GET ); 699 $_POST = stripslashes_deep($_POST ); 700 $_COOKIE = stripslashes_deep($_COOKIE); 701 } 159 wp_magic_quotes(); 702 160 703 // Escape with wpdb.704 $_GET = add_magic_quotes($_GET );705 $_POST = add_magic_quotes($_POST );706 $_COOKIE = add_magic_quotes($_COOKIE);707 $_SERVER = add_magic_quotes($_SERVER);708 709 // Force REQUEST to be GET + POST. If SERVER, COOKIE, or ENV are needed, use those superglobals directly.710 $_REQUEST = array_merge($_GET, $_POST);711 712 161 do_action('sanitize_comment_cookies'); 713 162 714 163 /** … … 749 198 750 199 do_action('setup_theme'); 751 200 752 /** 753 * Web Path to the current active template directory 754 * @since 1.5.0 755 */ 756 define('TEMPLATEPATH', get_template_directory()); 201 wp_default_constants('setup_theme'); 757 202 758 /**759 * Web Path to the current active template stylesheet directory760 * @since 2.1.0761 */762 define('STYLESHEETPATH', get_stylesheet_directory());763 764 203 // Load the default text localization domain. 765 204 load_default_textdomain(); 766 205 767 /** 768 * The locale of the blog 769 * @since 1.5.0 770 */ 771 $locale = get_locale(); 772 $locale_file = WP_LANG_DIR . "/$locale.php"; 773 if ( is_readable($locale_file) ) 774 require_once($locale_file); 206 wp_find_locale(); 775 207 776 // Pull in locale data after loading text domain.777 require_once(ABSPATH . WPINC . '/locale.php');778 779 208 /** 780 209 * WordPress Locale object for loading locale domain date and various strings. 781 210 * @global object $wp_locale … … 783 212 */ 784 213 $wp_locale =& new WP_Locale(); 785 214 786 // Load functions for active theme. 787 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) 788 include(STYLESHEETPATH . '/functions.php'); 789 if ( file_exists(TEMPLATEPATH . '/functions.php') ) 790 include(TEMPLATEPATH . '/functions.php'); 215 wp_load_theme_functions(); 791 216 792 // Load in support for template functions which the theme supports793 require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' );794 795 /**796 * Runs just before PHP shuts down execution.797 *798 * @access private799 * @since 1.2.0800 */801 function shutdown_action_hook() {802 do_action('shutdown');803 wp_cache_close();804 }805 217 register_shutdown_function('shutdown_action_hook'); 806 218 807 219 $wp->init(); // Sets up current user. … … 809 221 // Everything is loaded and initialized. 810 222 do_action('init'); 811 223 812 ?> 224 ?> 225 No newline at end of file