| 1 | Index: wp-includes/load.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/load.php (revision 12736) |
|---|
| 4 | +++ wp-includes/load.php (working copy) |
|---|
| 5 | @@ -14,44 +14,50 @@ |
|---|
| 6 | * @return null Will return null if register_globals PHP directive was disabled |
|---|
| 7 | */ |
|---|
| 8 | function wp_unregister_GLOBALS() { |
|---|
| 9 | - if ( !ini_get('register_globals') ) |
|---|
| 10 | + if ( !ini_get( 'register_globals' ) ) |
|---|
| 11 | return; |
|---|
| 12 | |
|---|
| 13 | - if ( isset($_REQUEST['GLOBALS']) ) |
|---|
| 14 | - die('GLOBALS overwrite attempt detected'); |
|---|
| 15 | + if ( isset( $_REQUEST['GLOBALS'] ) ) |
|---|
| 16 | + die( 'GLOBALS overwrite attempt detected' ); |
|---|
| 17 | |
|---|
| 18 | // Variables that shouldn't be unset |
|---|
| 19 | - $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); |
|---|
| 20 | + $noUnset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' ); |
|---|
| 21 | |
|---|
| 22 | - $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array()); |
|---|
| 23 | + $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() ); |
|---|
| 24 | foreach ( $input as $k => $v ) |
|---|
| 25 | - if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) { |
|---|
| 26 | + if ( !in_array( $k, $noUnset ) && isset( $GLOBALS[$k] ) ) { |
|---|
| 27 | $GLOBALS[$k] = NULL; |
|---|
| 28 | - unset($GLOBALS[$k]); |
|---|
| 29 | + unset( $GLOBALS[$k] ); |
|---|
| 30 | } |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | +/** |
|---|
| 34 | + * Fix $_SERVER variables for various setups. |
|---|
| 35 | + * |
|---|
| 36 | + * @access private |
|---|
| 37 | + * @since 3.0.0 |
|---|
| 38 | + */ |
|---|
| 39 | function wp_fix_server_vars() { |
|---|
| 40 | global $PHP_SELF; |
|---|
| 41 | // Fix for IIS when running with PHP ISAPI |
|---|
| 42 | if ( empty( $_SERVER['REQUEST_URI'] ) || ( php_sapi_name() != 'cgi-fcgi' && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) { |
|---|
| 43 | |
|---|
| 44 | // IIS Mod-Rewrite |
|---|
| 45 | - if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) { |
|---|
| 46 | + if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) { |
|---|
| 47 | $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL']; |
|---|
| 48 | } |
|---|
| 49 | // IIS Isapi_Rewrite |
|---|
| 50 | - else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { |
|---|
| 51 | + else if ( isset( $_SERVER['HTTP_X_REWRITE_URL'] ) ) { |
|---|
| 52 | $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL']; |
|---|
| 53 | } |
|---|
| 54 | else |
|---|
| 55 | { |
|---|
| 56 | // Use ORIG_PATH_INFO if there is no PATH_INFO |
|---|
| 57 | - if ( !isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO']) ) |
|---|
| 58 | + if ( !isset( $_SERVER['PATH_INFO'] ) && isset( $_SERVER['ORIG_PATH_INFO'] ) ) |
|---|
| 59 | $_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']; |
|---|
| 60 | |
|---|
| 61 | // Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice) |
|---|
| 62 | - if ( isset($_SERVER['PATH_INFO']) ) { |
|---|
| 63 | + if ( isset( $_SERVER['PATH_INFO'] ) ) { |
|---|
| 64 | if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] ) |
|---|
| 65 | $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']; |
|---|
| 66 | else |
|---|
| 67 | @@ -59,26 +65,34 @@ |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | // Append the query string if it exists and isn't null |
|---|
| 71 | - if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { |
|---|
| 72 | + if ( isset( $_SERVER['QUERY_STRING'] ) && !empty( $_SERVER['QUERY_STRING'] ) ) { |
|---|
| 73 | $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|---|
| 74 | } |
|---|
| 75 | } |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests |
|---|
| 79 | - if ( isset($_SERVER['SCRIPT_FILENAME']) && ( strpos($_SERVER['SCRIPT_FILENAME'], 'php.cgi') == strlen($_SERVER['SCRIPT_FILENAME']) - 7 ) ) |
|---|
| 80 | + if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) |
|---|
| 81 | $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED']; |
|---|
| 82 | |
|---|
| 83 | // Fix for Dreamhost and other PHP as CGI hosts |
|---|
| 84 | - if (strpos($_SERVER['SCRIPT_NAME'], 'php.cgi') !== false) |
|---|
| 85 | - unset($_SERVER['PATH_INFO']); |
|---|
| 86 | + if ( strpos( $_SERVER['SCRIPT_NAME'], 'php.cgi' ) !== false ) |
|---|
| 87 | + unset( $_SERVER['PATH_INFO'] ); |
|---|
| 88 | |
|---|
| 89 | // Fix empty PHP_SELF |
|---|
| 90 | $PHP_SELF = $_SERVER['PHP_SELF']; |
|---|
| 91 | - if ( empty($PHP_SELF) ) |
|---|
| 92 | - $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); |
|---|
| 93 | + if ( empty( $PHP_SELF ) ) |
|---|
| 94 | + $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( "/(\?.*)?$/",'',$_SERVER["REQUEST_URI"] ); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | +/** |
|---|
| 98 | + * Check for the required PHP version, and the MySQL extension or a database drop-in. |
|---|
| 99 | + * |
|---|
| 100 | + * Dies if requirements are not met. |
|---|
| 101 | + * |
|---|
| 102 | + * @access private |
|---|
| 103 | + * @since 3.0.0 |
|---|
| 104 | + */ |
|---|
| 105 | function wp_check_php_mysql_versions() { |
|---|
| 106 | // we can probably extend this function to check if wp_die() exists then use translated strings, and then use it in install.php etc. |
|---|
| 107 | |
|---|
| 108 | @@ -87,27 +101,45 @@ |
|---|
| 109 | if ( version_compare( $required_php_version, $php_version, '>' ) ) |
|---|
| 110 | 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 ) ); |
|---|
| 111 | |
|---|
| 112 | - if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') ) |
|---|
| 113 | + if ( !extension_loaded( 'mysql' ) && !file_exists( WP_CONTENT_DIR . '/db.php' ) ) |
|---|
| 114 | die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ ); |
|---|
| 115 | } |
|---|
| 116 | |
|---|
| 117 | +/** |
|---|
| 118 | + * Dies with a maintenance message when conditions are met. |
|---|
| 119 | + * |
|---|
| 120 | + * Checks for a file in the WordPress root directory named ".maintenance". |
|---|
| 121 | + * This file will contain the variable $upgrading, set to the time the file |
|---|
| 122 | + * was created. If the file was created less than 10 minutes ago, WordPress |
|---|
| 123 | + * enters maintenance mode and displays a message. |
|---|
| 124 | + * |
|---|
| 125 | + * The default message can be replaced by using a drop-in (maintenance.php in |
|---|
| 126 | + * the wp-content directory). |
|---|
| 127 | + * |
|---|
| 128 | + * @access private |
|---|
| 129 | + * @since 3.0.0 |
|---|
| 130 | + */ |
|---|
| 131 | function wp_maintenance() { |
|---|
| 132 | - if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) { |
|---|
| 133 | - include(ABSPATH . '.maintenance'); |
|---|
| 134 | - // If the $upgrading timestamp is older than 10 minutes, don't die. |
|---|
| 135 | - if ( ( time() - $upgrading ) < 600 ) { |
|---|
| 136 | - if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { |
|---|
| 137 | - require_once( WP_CONTENT_DIR . '/maintenance.php' ); |
|---|
| 138 | - die(); |
|---|
| 139 | - } |
|---|
| 140 | + if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) ) |
|---|
| 141 | + return; |
|---|
| 142 | |
|---|
| 143 | - $protocol = $_SERVER["SERVER_PROTOCOL"]; |
|---|
| 144 | - if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) |
|---|
| 145 | - $protocol = 'HTTP/1.0'; |
|---|
| 146 | - header( "$protocol 503 Service Unavailable", true, 503 ); |
|---|
| 147 | - header( 'Content-Type: text/html; charset=utf-8' ); |
|---|
| 148 | - header( 'Retry-After: 600' ); |
|---|
| 149 | - ?> |
|---|
| 150 | + include( ABSPATH . '.maintenance' ); |
|---|
| 151 | + // If the $upgrading timestamp is older than 10 minutes, don't die. |
|---|
| 152 | + if ( ( time() - $upgrading ) >= 600 ) |
|---|
| 153 | + return; |
|---|
| 154 | + |
|---|
| 155 | + if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { |
|---|
| 156 | + require_once( WP_CONTENT_DIR . '/maintenance.php' ); |
|---|
| 157 | + die(); |
|---|
| 158 | + } |
|---|
| 159 | + |
|---|
| 160 | + $protocol = $_SERVER["SERVER_PROTOCOL"]; |
|---|
| 161 | + if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) |
|---|
| 162 | + $protocol = 'HTTP/1.0'; |
|---|
| 163 | + header( "$protocol 503 Service Unavailable", true, 503 ); |
|---|
| 164 | + header( 'Content-Type: text/html; charset=utf-8' ); |
|---|
| 165 | + header( 'Retry-After: 600' ); |
|---|
| 166 | +?> |
|---|
| 167 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 168 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 169 | <head> |
|---|
| 170 | @@ -119,10 +151,8 @@ |
|---|
| 171 | <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1> |
|---|
| 172 | </body> |
|---|
| 173 | </html> |
|---|
| 174 | - <?php |
|---|
| 175 | - die(); |
|---|
| 176 | - } |
|---|
| 177 | - } |
|---|
| 178 | +<?php |
|---|
| 179 | + die(); |
|---|
| 180 | } |
|---|
| 181 | |
|---|
| 182 | /** |
|---|
| 183 | @@ -135,7 +165,7 @@ |
|---|
| 184 | */ |
|---|
| 185 | function timer_start() { |
|---|
| 186 | global $timestart; |
|---|
| 187 | - $mtime = explode(' ', microtime() ); |
|---|
| 188 | + $mtime = explode( ' ', microtime() ); |
|---|
| 189 | $mtime = $mtime[1] + $mtime[0]; |
|---|
| 190 | $timestart = $mtime; |
|---|
| 191 | return true; |
|---|
| 192 | @@ -165,226 +195,275 @@ |
|---|
| 193 | * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. |
|---|
| 194 | * @return float The "second.microsecond" finished time calculation |
|---|
| 195 | */ |
|---|
| 196 | -function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal |
|---|
| 197 | +function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal |
|---|
| 198 | global $timestart, $timeend; |
|---|
| 199 | $mtime = microtime(); |
|---|
| 200 | - $mtime = explode(' ',$mtime); |
|---|
| 201 | + $mtime = explode( ' ',$mtime ); |
|---|
| 202 | $mtime = $mtime[1] + $mtime[0]; |
|---|
| 203 | $timeend = $mtime; |
|---|
| 204 | $timetotal = $timeend-$timestart; |
|---|
| 205 | - $r = ( function_exists('number_format_i18n') ) ? number_format_i18n($timetotal, $precision) : number_format($timetotal, $precision); |
|---|
| 206 | + $r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision ); |
|---|
| 207 | if ( $display ) |
|---|
| 208 | echo $r; |
|---|
| 209 | return $r; |
|---|
| 210 | } |
|---|
| 211 | |
|---|
| 212 | +/** |
|---|
| 213 | + * Sets PHP error handling. |
|---|
| 214 | + * |
|---|
| 215 | + * Add <code>define('WP_DEBUG', true);</code> to wp-config.php to enable |
|---|
| 216 | + * the reporting of notices during development. |
|---|
| 217 | + * |
|---|
| 218 | + * Add <code>define('WP_DEBUG_DISPLAY', false);</code> to wp-config.php to |
|---|
| 219 | + * disable the display of errors. |
|---|
| 220 | + * |
|---|
| 221 | + * Add <code>define('WP_DEBUG_LOG', true);</code> to wp-config.php to log |
|---|
| 222 | + * eerrors to debug.log in the wp-content directory. |
|---|
| 223 | + * |
|---|
| 224 | + * @access private |
|---|
| 225 | + * @since 3.0.0 |
|---|
| 226 | + */ |
|---|
| 227 | function wp_debug_mode() { |
|---|
| 228 | if ( WP_DEBUG ) { |
|---|
| 229 | - if ( defined('E_DEPRECATED') ) |
|---|
| 230 | - error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); |
|---|
| 231 | + if ( defined( 'E_DEPRECATED' ) ) |
|---|
| 232 | + error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); |
|---|
| 233 | else |
|---|
| 234 | - error_reporting(E_ALL); |
|---|
| 235 | + error_reporting( E_ALL ); |
|---|
| 236 | |
|---|
| 237 | if ( WP_DEBUG_DISPLAY ) |
|---|
| 238 | - ini_set('display_errors', 1); |
|---|
| 239 | + ini_set( 'display_errors', 1 ); |
|---|
| 240 | |
|---|
| 241 | if ( WP_DEBUG_LOG ) { |
|---|
| 242 | - ini_set('log_errors', 1); |
|---|
| 243 | - ini_set('error_log', WP_CONTENT_DIR . '/debug.log'); |
|---|
| 244 | + ini_set( 'log_errors', 1 ); |
|---|
| 245 | + ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' ); |
|---|
| 246 | } |
|---|
| 247 | } else { |
|---|
| 248 | - if ( defined('E_RECOVERABLE_ERROR') ) |
|---|
| 249 | - error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR); |
|---|
| 250 | + if ( defined( 'E_RECOVERABLE_ERROR' ) ) |
|---|
| 251 | + error_reporting( E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR ); |
|---|
| 252 | else |
|---|
| 253 | - error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING); |
|---|
| 254 | + error_reporting( E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING ); |
|---|
| 255 | } |
|---|
| 256 | } |
|---|
| 257 | |
|---|
| 258 | +/** |
|---|
| 259 | + * Sets the location of the language directory. |
|---|
| 260 | + * |
|---|
| 261 | + * To set directory manually, define <code>WP_LANG_DIR</code> in wp-config.php. |
|---|
| 262 | + * |
|---|
| 263 | + * First looks for language folder in WP_CONTENT_DIR and uses that folder if it |
|---|
| 264 | + * exists. Or it uses the "languages" folder in WPINC. |
|---|
| 265 | + * |
|---|
| 266 | + * The WP_LANG_DIR constant was introduced in 2.1.0. |
|---|
| 267 | + * |
|---|
| 268 | + * @access private |
|---|
| 269 | + * @since 3.0.0 |
|---|
| 270 | + */ |
|---|
| 271 | function wp_set_lang_dir() { |
|---|
| 272 | - if ( !defined('WP_LANG_DIR') ) { |
|---|
| 273 | - /** |
|---|
| 274 | - * Stores the location of the language directory. First looks for language folder in WP_CONTENT_DIR |
|---|
| 275 | - * and uses that folder if it exists. Or it uses the "languages" folder in WPINC. |
|---|
| 276 | - * |
|---|
| 277 | - * @since 2.1.0 |
|---|
| 278 | - */ |
|---|
| 279 | - if ( file_exists(WP_CONTENT_DIR . '/languages') && @is_dir(WP_CONTENT_DIR . '/languages') ) { |
|---|
| 280 | - define('WP_LANG_DIR', WP_CONTENT_DIR . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH |
|---|
| 281 | - if (!defined('LANGDIR')) { |
|---|
| 282 | + if ( !defined( 'WP_LANG_DIR' ) ) { |
|---|
| 283 | + if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) ) { |
|---|
| 284 | + define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH |
|---|
| 285 | + if ( !defined( 'LANGDIR' ) ) { |
|---|
| 286 | // Old static relative path maintained for limited backwards compatibility - won't work in some cases |
|---|
| 287 | - define('LANGDIR', 'wp-content/languages'); |
|---|
| 288 | + define( 'LANGDIR', 'wp-content/languages' ); |
|---|
| 289 | } |
|---|
| 290 | } else { |
|---|
| 291 | - define('WP_LANG_DIR', ABSPATH . WPINC . '/languages'); // no leading slash, no trailing slash, full path, not relative to ABSPATH |
|---|
| 292 | - if (!defined('LANGDIR')) { |
|---|
| 293 | + define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH |
|---|
| 294 | + if ( !defined( 'LANGDIR' ) ) { |
|---|
| 295 | // Old relative path maintained for backwards compatibility |
|---|
| 296 | - define('LANGDIR', WPINC . '/languages'); |
|---|
| 297 | + define( 'LANGDIR', WPINC . '/languages' ); |
|---|
| 298 | } |
|---|
| 299 | } |
|---|
| 300 | } |
|---|
| 301 | } |
|---|
| 302 | |
|---|
| 303 | +/** |
|---|
| 304 | + * Sets the database table prefix and the format specifiers for database table columns. |
|---|
| 305 | + * |
|---|
| 306 | + * Columns not listed here default to %s. |
|---|
| 307 | + * |
|---|
| 308 | + * @see wpdb::$field_types Since 2.8.0 |
|---|
| 309 | + * @see wpdb::prepare() |
|---|
| 310 | + * @see wpdb::insert() |
|---|
| 311 | + * @see wpdb::update() |
|---|
| 312 | + * @see wpdb::set_prefix() |
|---|
| 313 | + * |
|---|
| 314 | + * @access private |
|---|
| 315 | + * @since 3.0.0 |
|---|
| 316 | + */ |
|---|
| 317 | function wp_set_wpdb_vars() { |
|---|
| 318 | global $wpdb, $table_prefix; |
|---|
| 319 | - if ( !empty($wpdb->error) ) |
|---|
| 320 | + if ( !empty( $wpdb->error ) ) |
|---|
| 321 | dead_db(); |
|---|
| 322 | |
|---|
| 323 | - /** |
|---|
| 324 | - * Format specifiers for DB columns. Columns not listed here default to %s. |
|---|
| 325 | - * @since 2.8.0 |
|---|
| 326 | - * @see wpdb:$field_types |
|---|
| 327 | - * @see wpdb:prepare() |
|---|
| 328 | - * @see wpdb:insert() |
|---|
| 329 | - * @see wpdb:update() |
|---|
| 330 | - */ |
|---|
| 331 | $wpdb->field_types = array( 'post_author' => '%d', 'post_parent' => '%d', 'menu_order' => '%d', 'term_id' => '%d', 'term_group' => '%d', 'term_taxonomy_id' => '%d', |
|---|
| 332 | 'parent' => '%d', 'count' => '%d','object_id' => '%d', 'term_order' => '%d', 'ID' => '%d', 'commment_ID' => '%d', 'comment_post_ID' => '%d', 'comment_parent' => '%d', |
|---|
| 333 | 'user_id' => '%d', 'link_id' => '%d', 'link_owner' => '%d', 'link_rating' => '%d', 'option_id' => '%d', 'blog_id' => '%d', 'meta_id' => '%d', 'post_id' => '%d', |
|---|
| 334 | - 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d'); |
|---|
| 335 | + 'user_status' => '%d', 'umeta_id' => '%d', 'comment_karma' => '%d', 'comment_count' => '%d' ); |
|---|
| 336 | |
|---|
| 337 | - $prefix = $wpdb->set_prefix($table_prefix); |
|---|
| 338 | + $prefix = $wpdb->set_prefix( $table_prefix ); |
|---|
| 339 | |
|---|
| 340 | - if ( is_wp_error($prefix) ) |
|---|
| 341 | - 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*/); |
|---|
| 342 | - |
|---|
| 343 | + if ( is_wp_error( $prefix ) ) |
|---|
| 344 | + 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*/ ); |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | +/** |
|---|
| 348 | + * Starts the WordPress object cache. |
|---|
| 349 | + * |
|---|
| 350 | + * If an object-cache.php file exists in the wp-content directory, |
|---|
| 351 | + * it uses that drop-in as an external object cache. |
|---|
| 352 | + * |
|---|
| 353 | + * @access private |
|---|
| 354 | + * @since 3.0.0 |
|---|
| 355 | + */ |
|---|
| 356 | function wp_start_object_cache() { |
|---|
| 357 | global $_wp_using_ext_object_cache; |
|---|
| 358 | - if ( file_exists(WP_CONTENT_DIR . '/object-cache.php') ) { |
|---|
| 359 | - require_once (WP_CONTENT_DIR . '/object-cache.php'); |
|---|
| 360 | + if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { |
|---|
| 361 | + require_once ( WP_CONTENT_DIR . '/object-cache.php' ); |
|---|
| 362 | $_wp_using_ext_object_cache = true; |
|---|
| 363 | } else { |
|---|
| 364 | - require_once (ABSPATH . WPINC . '/cache.php'); |
|---|
| 365 | + require_once ( ABSPATH . WPINC . '/cache.php' ); |
|---|
| 366 | $_wp_using_ext_object_cache = false; |
|---|
| 367 | } |
|---|
| 368 | |
|---|
| 369 | wp_cache_init(); |
|---|
| 370 | - if ( function_exists('wp_cache_add_global_groups') ) { |
|---|
| 371 | + if ( function_exists( 'wp_cache_add_global_groups' ) ) { |
|---|
| 372 | if( is_multisite() ) { |
|---|
| 373 | - wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss')); |
|---|
| 374 | + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-transient', 'site-options', 'site-lookup', 'blog-lookup', 'blog-details', 'rss' ) ); |
|---|
| 375 | } else { |
|---|
| 376 | - wp_cache_add_global_groups(array ('users', 'userlogins', 'usermeta', 'site-transient')); |
|---|
| 377 | + wp_cache_add_global_groups( array( 'users', 'userlogins', 'usermeta', 'site-transient' ) ); |
|---|
| 378 | } |
|---|
| 379 | - wp_cache_add_non_persistent_groups(array( 'comment', 'counts', 'plugins' )); |
|---|
| 380 | + wp_cache_add_non_persistent_groups( array( 'comment', 'counts', 'plugins' ) ); |
|---|
| 381 | } |
|---|
| 382 | } |
|---|
| 383 | |
|---|
| 384 | +/** |
|---|
| 385 | + * Redirects to the installer if WordPress is not installed. |
|---|
| 386 | + * |
|---|
| 387 | + * Dies with an error message when multisite is enabled. |
|---|
| 388 | + * |
|---|
| 389 | + * @access private |
|---|
| 390 | + * @since 3.0.0 |
|---|
| 391 | + */ |
|---|
| 392 | function wp_not_installed() { |
|---|
| 393 | if ( is_multisite() ) { |
|---|
| 394 | - if ( !is_blog_installed() && !defined('WP_INSTALLING') ) |
|---|
| 395 | - die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); // have to die here ~ Mark |
|---|
| 396 | - } elseif ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) { |
|---|
| 397 | - if ( defined('WP_SITEURL') ) |
|---|
| 398 | + if ( !is_blog_installed() && !defined( 'WP_INSTALLING' ) ) |
|---|
| 399 | + wp_die( __( 'The blog you have requested is not installed properly. Please contact the system administrator.' ) ); |
|---|
| 400 | + } elseif ( !is_blog_installed() && ( strpos( $_SERVER['PHP_SELF'], 'install.php' ) === false && !defined( 'WP_INSTALLING' ) ) ) { |
|---|
| 401 | + if ( defined( 'WP_SITEURL' ) ) |
|---|
| 402 | $link = WP_SITEURL . '/wp-admin/install.php'; |
|---|
| 403 | - elseif (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) |
|---|
| 404 | - $link = preg_replace('|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; |
|---|
| 405 | + elseif ( strpos( $_SERVER['PHP_SELF'], 'wp-admin' ) !== false ) |
|---|
| 406 | + $link = preg_replace( '|/wp-admin/?.*?$|', '/', $_SERVER['PHP_SELF'] ) . 'wp-admin/install.php'; |
|---|
| 407 | else |
|---|
| 408 | - $link = preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']) . 'wp-admin/install.php'; |
|---|
| 409 | - require_once(ABSPATH . WPINC . '/kses.php'); |
|---|
| 410 | - require_once(ABSPATH . WPINC . '/pluggable.php'); |
|---|
| 411 | - require_once(ABSPATH . WPINC . '/formatting.php'); |
|---|
| 412 | - wp_redirect($link); |
|---|
| 413 | + $link = preg_replace( '|/[^/]+?$|', '/', $_SERVER['PHP_SELF'] ) . 'wp-admin/install.php'; |
|---|
| 414 | + require_once( ABSPATH . WPINC . '/kses.php' ); |
|---|
| 415 | + require_once( ABSPATH . WPINC . '/pluggable.php' ); |
|---|
| 416 | + require_once( ABSPATH . WPINC . '/formatting.php' ); |
|---|
| 417 | + wp_redirect( $link ); |
|---|
| 418 | die(); |
|---|
| 419 | } |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | -function wp_load_mu_plugins() { |
|---|
| 423 | - if ( is_dir( WPMU_PLUGIN_DIR ) ) { |
|---|
| 424 | - if ( $dh = opendir( WPMU_PLUGIN_DIR ) ) { |
|---|
| 425 | - $mu_plugins = array (); |
|---|
| 426 | - while ( ( $plugin = readdir( $dh ) ) !== false ) |
|---|
| 427 | - if ( substr( $plugin, -4 ) == '.php' ) |
|---|
| 428 | - $mu_plugins[] = $plugin; |
|---|
| 429 | - closedir( $dh ); |
|---|
| 430 | - if( is_multisite() ) |
|---|
| 431 | - sort( $mu_plugins ); |
|---|
| 432 | - foreach( $mu_plugins as $mu_plugin ) |
|---|
| 433 | - include_once( WPMU_PLUGIN_DIR . '/' . $mu_plugin ); |
|---|
| 434 | - } |
|---|
| 435 | - } |
|---|
| 436 | +/** |
|---|
| 437 | + * Returns array of must-use plugin files to be included in global scope. |
|---|
| 438 | + * |
|---|
| 439 | + * The default directory is wp-content/mu-plugins. To change the default directory |
|---|
| 440 | + * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code> |
|---|
| 441 | + * in wp-config.php. |
|---|
| 442 | + * |
|---|
| 443 | + * @access private |
|---|
| 444 | + * @since 3.0.0 |
|---|
| 445 | + * @return array Files to include |
|---|
| 446 | + */ |
|---|
| 447 | +function wp_muplugins_to_load() { |
|---|
| 448 | + $mu_plugins = array(); |
|---|
| 449 | + if ( !is_dir( WPMU_PLUGIN_DIR ) ) |
|---|
| 450 | + return $mu_plugins; |
|---|
| 451 | + if ( ! $dh = opendir( WPMU_PLUGIN_DIR ) ) |
|---|
| 452 | + return $mu_plugins; |
|---|
| 453 | + while ( ( $plugin = readdir( $dh ) ) !== false ) |
|---|
| 454 | + if ( substr( $plugin, -4 ) == '.php' ) |
|---|
| 455 | + $mu_plugins[] = WPMU_PLUGIN_DIR . '/' . $plugin; |
|---|
| 456 | + closedir( $dh ); |
|---|
| 457 | + if( is_multisite() ) |
|---|
| 458 | + sort( $mu_plugins ); |
|---|
| 459 | + return $mu_plugins; |
|---|
| 460 | } |
|---|
| 461 | |
|---|
| 462 | -function wp_load_plugins() { |
|---|
| 463 | +/** |
|---|
| 464 | + * Returns array of plugin files to be included in global scope. |
|---|
| 465 | + * |
|---|
| 466 | + * The default directory is wp-content/plugins. To change the default directory |
|---|
| 467 | + * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code> |
|---|
| 468 | + * in wp-config.php. |
|---|
| 469 | + * |
|---|
| 470 | + * @access private |
|---|
| 471 | + * @since 3.0.0 |
|---|
| 472 | + * @return array Files to include |
|---|
| 473 | + */ |
|---|
| 474 | +function wp_plugins_to_load() { |
|---|
| 475 | + $plugins = array(); |
|---|
| 476 | + |
|---|
| 477 | // Check for hacks file if the option is enabled |
|---|
| 478 | - if ( get_option('hack_file') ) { |
|---|
| 479 | - if ( file_exists(ABSPATH . 'my-hacks.php') ) |
|---|
| 480 | - require(ABSPATH . 'my-hacks.php'); |
|---|
| 481 | - } |
|---|
| 482 | + if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) |
|---|
| 483 | + $plugins[] = ABSPATH . 'my-hacks.php'; |
|---|
| 484 | |
|---|
| 485 | - $current_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
|---|
| 486 | - if ( is_array($current_plugins) && !defined('WP_INSTALLING') ) { |
|---|
| 487 | - foreach ( $current_plugins as $plugin ) { |
|---|
| 488 | - // check the $plugin filename |
|---|
| 489 | - // Validate plugin filename |
|---|
| 490 | - if ( validate_file($plugin) // $plugin must validate as file |
|---|
| 491 | - || '.php' != substr($plugin, -4) // $plugin must end with '.php' |
|---|
| 492 | - || !file_exists(WP_PLUGIN_DIR . '/' . $plugin) // $plugin must exist |
|---|
| 493 | - ) |
|---|
| 494 | - continue; |
|---|
| 495 | - |
|---|
| 496 | - include_once(WP_PLUGIN_DIR . '/' . $plugin); |
|---|
| 497 | - } |
|---|
| 498 | - unset($plugin); |
|---|
| 499 | + $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); |
|---|
| 500 | + if ( !is_array( $active_plugins ) || defined( 'WP_INSTALLING' ) ) |
|---|
| 501 | + return $plugins; |
|---|
| 502 | + foreach ( $active_plugins as $plugin ) { |
|---|
| 503 | + if ( validate_file( $plugin ) // $plugin must validate as file |
|---|
| 504 | + || '.php' != substr( $plugin, -4 ) // $plugin must end with '.php' |
|---|
| 505 | + || !file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist |
|---|
| 506 | + ) |
|---|
| 507 | + continue; |
|---|
| 508 | + $plugins[] = WP_PLUGIN_DIR . '/' . $plugin; |
|---|
| 509 | } |
|---|
| 510 | - unset($current_plugins); |
|---|
| 511 | + return $plugins; |
|---|
| 512 | } |
|---|
| 513 | |
|---|
| 514 | +/** |
|---|
| 515 | + * Sets internal encoding using mb_internal_encoding(). |
|---|
| 516 | + * |
|---|
| 517 | + * In most cases the default internal encoding is latin1, which is of no use, |
|---|
| 518 | + * since we want to use the mb_ functions for utf-8 strings. |
|---|
| 519 | + * |
|---|
| 520 | + * @access private |
|---|
| 521 | + * @since 3.0.0 |
|---|
| 522 | + */ |
|---|
| 523 | function wp_set_internal_encoding() { |
|---|
| 524 | - /* |
|---|
| 525 | - * In most cases the default internal encoding is latin1, which is of no use, |
|---|
| 526 | - * since we want to use the mb_ functions for utf-8 strings |
|---|
| 527 | - */ |
|---|
| 528 | - if (function_exists('mb_internal_encoding')) { |
|---|
| 529 | - if (!@mb_internal_encoding(get_option('blog_charset'))) |
|---|
| 530 | - mb_internal_encoding('UTF-8'); |
|---|
| 531 | + if ( function_exists( 'mb_internal_encoding' ) ) { |
|---|
| 532 | + if ( !@mb_internal_encoding( get_option( 'blog_charset' ) ) ) |
|---|
| 533 | + mb_internal_encoding( 'UTF-8' ); |
|---|
| 534 | } |
|---|
| 535 | } |
|---|
| 536 | |
|---|
| 537 | +/** |
|---|
| 538 | + * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER. |
|---|
| 539 | + * |
|---|
| 540 | + * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, |
|---|
| 541 | + * or $_ENV are needed, use those superglobals directly. |
|---|
| 542 | + * |
|---|
| 543 | + * @access private |
|---|
| 544 | + * @since 3.0.0 |
|---|
| 545 | + */ |
|---|
| 546 | function wp_magic_quotes() { |
|---|
| 547 | // If already slashed, strip. |
|---|
| 548 | if ( get_magic_quotes_gpc() ) { |
|---|
| 549 | - $_GET = stripslashes_deep($_GET ); |
|---|
| 550 | - $_POST = stripslashes_deep($_POST ); |
|---|
| 551 | - $_COOKIE = stripslashes_deep($_COOKIE); |
|---|
| 552 | + $_GET = stripslashes_deep( $_GET ); |
|---|
| 553 | + $_POST = stripslashes_deep( $_POST ); |
|---|
| 554 | + $_COOKIE = stripslashes_deep( $_COOKIE ); |
|---|
| 555 | } |
|---|
| 556 | |
|---|
| 557 | // Escape with wpdb. |
|---|
| 558 | - $_GET = add_magic_quotes($_GET ); |
|---|
| 559 | - $_POST = add_magic_quotes($_POST ); |
|---|
| 560 | - $_COOKIE = add_magic_quotes($_COOKIE); |
|---|
| 561 | - $_SERVER = add_magic_quotes($_SERVER); |
|---|
| 562 | + $_GET = add_magic_quotes( $_GET ); |
|---|
| 563 | + $_POST = add_magic_quotes( $_POST ); |
|---|
| 564 | + $_COOKIE = add_magic_quotes( $_COOKIE ); |
|---|
| 565 | + $_SERVER = add_magic_quotes( $_SERVER ); |
|---|
| 566 | |
|---|
| 567 | - // Force REQUEST to be GET + POST. If SERVER, COOKIE, or ENV are needed, use those superglobals directly. |
|---|
| 568 | - $_REQUEST = array_merge($_GET, $_POST); |
|---|
| 569 | + // Force REQUEST to be GET + POST. |
|---|
| 570 | + $_REQUEST = array_merge( $_GET, $_POST ); |
|---|
| 571 | } |
|---|
| 572 | |
|---|
| 573 | -function wp_find_locale() { |
|---|
| 574 | - global $locale, $locale_file; |
|---|
| 575 | - /** |
|---|
| 576 | - * The locale of the blog |
|---|
| 577 | - * @since 1.5.0 |
|---|
| 578 | - */ |
|---|
| 579 | - $locale = get_locale(); |
|---|
| 580 | - $locale_file = WP_LANG_DIR . "/$locale.php"; |
|---|
| 581 | - if ( is_readable($locale_file) ) |
|---|
| 582 | - require_once($locale_file); |
|---|
| 583 | - |
|---|
| 584 | - // Pull in locale data after loading text domain. |
|---|
| 585 | - require_once(ABSPATH . WPINC . '/locale.php'); |
|---|
| 586 | -} |
|---|
| 587 | - |
|---|
| 588 | -function wp_load_theme_functions() { |
|---|
| 589 | - // Load functions for active theme. |
|---|
| 590 | - if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists(STYLESHEETPATH . '/functions.php') ) |
|---|
| 591 | - include(STYLESHEETPATH . '/functions.php'); |
|---|
| 592 | - if ( file_exists(TEMPLATEPATH . '/functions.php') ) |
|---|
| 593 | - include(TEMPLATEPATH . '/functions.php'); |
|---|
| 594 | - |
|---|
| 595 | - // Load in support for template functions which the theme supports |
|---|
| 596 | - require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); |
|---|
| 597 | -} |
|---|
| 598 | - |
|---|
| 599 | /** |
|---|
| 600 | * Runs just before PHP shuts down execution. |
|---|
| 601 | * |
|---|
| 602 | @@ -392,7 +471,7 @@ |
|---|
| 603 | * @since 1.2.0 |
|---|
| 604 | */ |
|---|
| 605 | function shutdown_action_hook() { |
|---|
| 606 | - do_action('shutdown'); |
|---|
| 607 | + do_action( 'shutdown' ); |
|---|
| 608 | wp_cache_close(); |
|---|
| 609 | } |
|---|
| 610 | |
|---|
| 611 | @@ -425,7 +504,7 @@ |
|---|
| 612 | * @return bool True if inside WordPress administration pages. |
|---|
| 613 | */ |
|---|
| 614 | function is_admin() { |
|---|
| 615 | - if ( defined('WP_ADMIN') ) |
|---|
| 616 | + if ( defined( 'WP_ADMIN' ) ) |
|---|
| 617 | return WP_ADMIN; |
|---|
| 618 | return false; |
|---|
| 619 | } |
|---|
| 620 | @@ -438,7 +517,7 @@ |
|---|
| 621 | * @return bool True if multisite is enabled, false otherwise. |
|---|
| 622 | */ |
|---|
| 623 | function is_multisite() { |
|---|
| 624 | - if ( ( defined('MULTISITE') && MULTISITE ) || defined('VHOST') || defined('SUNRISE') ) |
|---|
| 625 | + if ( ( defined( 'MULTISITE' ) && MULTISITE ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) ) |
|---|
| 626 | return true; |
|---|
| 627 | |
|---|
| 628 | return false; |
|---|
| 629 | Index: wp-settings.php |
|---|
| 630 | =================================================================== |
|---|
| 631 | --- wp-settings.php (revision 12736) |
|---|
| 632 | +++ wp-settings.php (working copy) |
|---|
| 633 | @@ -13,152 +13,185 @@ |
|---|
| 634 | * |
|---|
| 635 | * @since 1.0.0 |
|---|
| 636 | */ |
|---|
| 637 | -define('WPINC', 'wp-includes'); |
|---|
| 638 | +define( 'WPINC', 'wp-includes' ); |
|---|
| 639 | |
|---|
| 640 | -require (ABSPATH . WPINC . '/load.php'); |
|---|
| 641 | -require (ABSPATH . WPINC . '/default-constants.php'); |
|---|
| 642 | -require (ABSPATH . WPINC . '/version.php'); |
|---|
| 643 | +// Include files required for initialization. |
|---|
| 644 | +require( ABSPATH . WPINC . '/load.php' ); |
|---|
| 645 | +require( ABSPATH . WPINC . '/default-constants.php' ); |
|---|
| 646 | +require( ABSPATH . WPINC . '/version.php' ); |
|---|
| 647 | |
|---|
| 648 | -wp_default_constants('init'); |
|---|
| 649 | +// Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE. |
|---|
| 650 | +wp_default_constants( 'init' ); |
|---|
| 651 | |
|---|
| 652 | -set_magic_quotes_runtime(0); |
|---|
| 653 | -@ini_set('magic_quotes_sybase', 0); |
|---|
| 654 | +// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php. |
|---|
| 655 | +set_magic_quotes_runtime( 0 ); |
|---|
| 656 | +@ini_set( 'magic_quotes_sybase', 0 ); |
|---|
| 657 | |
|---|
| 658 | -if ( function_exists('date_default_timezone_set') ) |
|---|
| 659 | - date_default_timezone_set('UTC'); |
|---|
| 660 | +// Set default timezone in PHP 5. |
|---|
| 661 | +if ( function_exists( 'date_default_timezone_set' ) ) |
|---|
| 662 | + date_default_timezone_set( 'UTC' ); |
|---|
| 663 | |
|---|
| 664 | +// Turn register_globals off. |
|---|
| 665 | wp_unregister_GLOBALS(); |
|---|
| 666 | |
|---|
| 667 | +// Ensure these global variables do not exist so they do not interfere with WordPress. |
|---|
| 668 | unset( $wp_filter, $cache_lastcommentmodified, $cache_lastpostdate ); |
|---|
| 669 | |
|---|
| 670 | +// Standardize $_SERVER variables across setups. |
|---|
| 671 | wp_fix_server_vars(); |
|---|
| 672 | |
|---|
| 673 | +// Check for the required PHP version and for the MySQL extension or a database drop-in. |
|---|
| 674 | wp_check_php_mysql_versions(); |
|---|
| 675 | |
|---|
| 676 | +// Check if we're in maintenance mode. |
|---|
| 677 | wp_maintenance(); |
|---|
| 678 | |
|---|
| 679 | +// Start loading timer. |
|---|
| 680 | timer_start(); |
|---|
| 681 | |
|---|
| 682 | +// Check if we're in WP_DEBUG mode. |
|---|
| 683 | wp_debug_mode(); |
|---|
| 684 | |
|---|
| 685 | -// For an advanced caching plugin to use, static because you would only want one |
|---|
| 686 | +// For an advanced caching plugin to use. Uses a static drop-in because you would only want one. |
|---|
| 687 | if ( WP_CACHE ) |
|---|
| 688 | @include WP_CONTENT_DIR . '/advanced-cache.php'; |
|---|
| 689 | |
|---|
| 690 | +// Define WP_LANG_DIR if not set. |
|---|
| 691 | wp_set_lang_dir(); |
|---|
| 692 | |
|---|
| 693 | -require (ABSPATH . WPINC . '/compat.php'); |
|---|
| 694 | -require (ABSPATH . WPINC . '/functions.php'); |
|---|
| 695 | -require (ABSPATH . WPINC . '/classes.php'); |
|---|
| 696 | +// Include early WordPress files. |
|---|
| 697 | +require( ABSPATH . WPINC . '/compat.php' ); |
|---|
| 698 | +require( ABSPATH . WPINC . '/functions.php' ); |
|---|
| 699 | +require( ABSPATH . WPINC . '/classes.php' ); |
|---|
| 700 | |
|---|
| 701 | +// Include the wpdb class, or a db.php database drop-in if present. |
|---|
| 702 | require_wp_db(); |
|---|
| 703 | |
|---|
| 704 | +// Set the database table prefix and the format specifiers for database table columns. |
|---|
| 705 | wp_set_wpdb_vars(); |
|---|
| 706 | |
|---|
| 707 | +// Start the WordPress object cache, or an external object cache if the drop-in is present. |
|---|
| 708 | wp_start_object_cache(); |
|---|
| 709 | |
|---|
| 710 | +// Initialize multisite if enabled. |
|---|
| 711 | if ( is_multisite() ) |
|---|
| 712 | - require (ABSPATH . WPINC . '/ms-load.php'); |
|---|
| 713 | + require( ABSPATH . WPINC . '/ms-load.php' ); |
|---|
| 714 | |
|---|
| 715 | -require (ABSPATH . WPINC . '/plugin.php'); |
|---|
| 716 | -require (ABSPATH . WPINC . '/default-filters.php'); |
|---|
| 717 | -include_once(ABSPATH . WPINC . '/pomo/mo.php'); |
|---|
| 718 | +// Load early WordPress files. |
|---|
| 719 | +require( ABSPATH . WPINC . '/plugin.php' ); |
|---|
| 720 | +require( ABSPATH . WPINC . '/default-filters.php' ); |
|---|
| 721 | +include_once( ABSPATH . WPINC . '/pomo/mo.php' ); |
|---|
| 722 | |
|---|
| 723 | -if ( SHORTINIT ) // stop most of WP being loaded, we just want the basics |
|---|
| 724 | +// Stop most of WordPress from being loaded if we just want the basics. |
|---|
| 725 | +if ( SHORTINIT ) |
|---|
| 726 | return false; |
|---|
| 727 | |
|---|
| 728 | -require_once (ABSPATH . WPINC . '/l10n.php'); |
|---|
| 729 | +// Load the l18n library. |
|---|
| 730 | +require_once ( ABSPATH . WPINC . '/l10n.php' ); |
|---|
| 731 | |
|---|
| 732 | +// Run the installer if WordPress is not installed. |
|---|
| 733 | wp_not_installed(); |
|---|
| 734 | |
|---|
| 735 | -require (ABSPATH . WPINC . '/formatting.php'); |
|---|
| 736 | -require (ABSPATH . WPINC . '/capabilities.php'); |
|---|
| 737 | -require (ABSPATH . WPINC . '/query.php'); |
|---|
| 738 | -require (ABSPATH . WPINC . '/theme.php'); |
|---|
| 739 | -require (ABSPATH . WPINC . '/user.php'); |
|---|
| 740 | -require (ABSPATH . WPINC . '/meta.php'); |
|---|
| 741 | -require (ABSPATH . WPINC . '/general-template.php'); |
|---|
| 742 | -require (ABSPATH . WPINC . '/link-template.php'); |
|---|
| 743 | -require (ABSPATH . WPINC . '/author-template.php'); |
|---|
| 744 | -require (ABSPATH . WPINC . '/post.php'); |
|---|
| 745 | -require (ABSPATH . WPINC . '/post-template.php'); |
|---|
| 746 | -require (ABSPATH . WPINC . '/category.php'); |
|---|
| 747 | -require (ABSPATH . WPINC . '/category-template.php'); |
|---|
| 748 | -require (ABSPATH . WPINC . '/comment.php'); |
|---|
| 749 | -require (ABSPATH . WPINC . '/comment-template.php'); |
|---|
| 750 | -require (ABSPATH . WPINC . '/rewrite.php'); |
|---|
| 751 | -require (ABSPATH . WPINC . '/feed.php'); |
|---|
| 752 | -require (ABSPATH . WPINC . '/bookmark.php'); |
|---|
| 753 | -require (ABSPATH . WPINC . '/bookmark-template.php'); |
|---|
| 754 | -require (ABSPATH . WPINC . '/kses.php'); |
|---|
| 755 | -require (ABSPATH . WPINC . '/cron.php'); |
|---|
| 756 | -require (ABSPATH . WPINC . '/deprecated.php'); |
|---|
| 757 | -require (ABSPATH . WPINC . '/script-loader.php'); |
|---|
| 758 | -require (ABSPATH . WPINC . '/taxonomy.php'); |
|---|
| 759 | -require (ABSPATH . WPINC . '/update.php'); |
|---|
| 760 | -require (ABSPATH . WPINC . '/canonical.php'); |
|---|
| 761 | -require (ABSPATH . WPINC . '/shortcodes.php'); |
|---|
| 762 | -require (ABSPATH . WPINC . '/media.php'); |
|---|
| 763 | -require (ABSPATH . WPINC . '/http.php'); |
|---|
| 764 | -require (ABSPATH . WPINC . '/widgets.php'); |
|---|
| 765 | +// Load most of WordPress. |
|---|
| 766 | +require( ABSPATH . WPINC . '/formatting.php' ); |
|---|
| 767 | +require( ABSPATH . WPINC . '/capabilities.php' ); |
|---|
| 768 | +require( ABSPATH . WPINC . '/query.php' ); |
|---|
| 769 | +require( ABSPATH . WPINC . '/theme.php' ); |
|---|
| 770 | +require( ABSPATH . WPINC . '/user.php' ); |
|---|
| 771 | +require( ABSPATH . WPINC . '/meta.php' ); |
|---|
| 772 | +require( ABSPATH . WPINC . '/general-template.php' ); |
|---|
| 773 | +require( ABSPATH . WPINC . '/link-template.php' ); |
|---|
| 774 | +require( ABSPATH . WPINC . '/author-template.php' ); |
|---|
| 775 | +require( ABSPATH . WPINC . '/post.php' ); |
|---|
| 776 | +require( ABSPATH . WPINC . '/post-template.php' ); |
|---|
| 777 | +require( ABSPATH . WPINC . '/category.php' ); |
|---|
| 778 | +require( ABSPATH . WPINC . '/category-template.php' ); |
|---|
| 779 | +require( ABSPATH . WPINC . '/comment.php' ); |
|---|
| 780 | +require( ABSPATH . WPINC . '/comment-template.php' ); |
|---|
| 781 | +require( ABSPATH . WPINC . '/rewrite.php' ); |
|---|
| 782 | +require( ABSPATH . WPINC . '/feed.php' ); |
|---|
| 783 | +require( ABSPATH . WPINC . '/bookmark.php' ); |
|---|
| 784 | +require( ABSPATH . WPINC . '/bookmark-template.php' ); |
|---|
| 785 | +require( ABSPATH . WPINC . '/kses.php' ); |
|---|
| 786 | +require( ABSPATH . WPINC . '/cron.php' ); |
|---|
| 787 | +require( ABSPATH . WPINC . '/deprecated.php' ); |
|---|
| 788 | +require( ABSPATH . WPINC . '/script-loader.php' ); |
|---|
| 789 | +require( ABSPATH . WPINC . '/taxonomy.php' ); |
|---|
| 790 | +require( ABSPATH . WPINC . '/update.php' ); |
|---|
| 791 | +require( ABSPATH . WPINC . '/canonical.php' ); |
|---|
| 792 | +require( ABSPATH . WPINC . '/shortcodes.php' ); |
|---|
| 793 | +require( ABSPATH . WPINC . '/media.php' ); |
|---|
| 794 | +require( ABSPATH . WPINC . '/http.php' ); |
|---|
| 795 | +require( ABSPATH . WPINC . '/widgets.php' ); |
|---|
| 796 | |
|---|
| 797 | +// Load multisite-specific files. |
|---|
| 798 | if ( is_multisite() ) { |
|---|
| 799 | require_once( ABSPATH . WPINC . '/ms-functions.php' ); |
|---|
| 800 | require_once( ABSPATH . WPINC . '/ms-default-filters.php' ); |
|---|
| 801 | require_once( ABSPATH . WPINC . '/ms-deprecated.php' ); |
|---|
| 802 | } |
|---|
| 803 | |
|---|
| 804 | -wp_default_constants('wp_included'); |
|---|
| 805 | +// Define constants that rely on the API to obtain the default value. |
|---|
| 806 | +wp_default_constants( 'wp_included' ); |
|---|
| 807 | |
|---|
| 808 | +// Set up multisite if enabled. |
|---|
| 809 | if ( is_multisite() ) |
|---|
| 810 | - ms_network_settings(); |
|---|
| 811 | + ms_network_settings(); |
|---|
| 812 | |
|---|
| 813 | -wp_default_constants('ms_network_settings_loaded'); |
|---|
| 814 | +// Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. |
|---|
| 815 | +wp_default_constants( 'ms_network_settings_loaded' ); |
|---|
| 816 | |
|---|
| 817 | -wp_load_mu_plugins(); |
|---|
| 818 | +// Load must-use plugins. |
|---|
| 819 | +foreach( wp_muplugins_to_load() as $mu_plugin ) |
|---|
| 820 | + include_once( $mu_plugin ); |
|---|
| 821 | +unset( $mu_plugin ); |
|---|
| 822 | |
|---|
| 823 | -/** |
|---|
| 824 | - * Used to load network wide plugins |
|---|
| 825 | - * @since 3.0 |
|---|
| 826 | - */ |
|---|
| 827 | +// Load network-wide plugins if multisite. |
|---|
| 828 | if ( is_multisite() ) |
|---|
| 829 | ms_network_plugins(); |
|---|
| 830 | |
|---|
| 831 | -do_action('muplugins_loaded'); |
|---|
| 832 | +do_action( 'muplugins_loaded' ); |
|---|
| 833 | |
|---|
| 834 | -/** |
|---|
| 835 | - * Used to check site status |
|---|
| 836 | - * @since 3.0 |
|---|
| 837 | - */ |
|---|
| 838 | +// Check site status if multisite. |
|---|
| 839 | if ( is_multisite() ) { |
|---|
| 840 | ms_site_check(); |
|---|
| 841 | ms_network_cookies(); |
|---|
| 842 | } |
|---|
| 843 | |
|---|
| 844 | -wp_default_constants('ms_loaded'); |
|---|
| 845 | +// Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). |
|---|
| 846 | +wp_default_constants( 'ms_loaded' ); |
|---|
| 847 | |
|---|
| 848 | -require (ABSPATH . WPINC . '/vars.php'); |
|---|
| 849 | +// Create common globals. |
|---|
| 850 | +require( ABSPATH . WPINC . '/vars.php' ); |
|---|
| 851 | |
|---|
| 852 | -// make taxonomies available to plugins and themes |
|---|
| 853 | -// @plugin authors: warning: this gets registered again on the init hook |
|---|
| 854 | +// Make taxonomies available to plugins and themes. |
|---|
| 855 | +// @plugin authors: warning: this gets registered again on the init hook. |
|---|
| 856 | create_initial_taxonomies(); |
|---|
| 857 | |
|---|
| 858 | -wp_load_plugins(); |
|---|
| 859 | +// Load active plugins. |
|---|
| 860 | +foreach( wp_plugins_to_load() as $plugin ) |
|---|
| 861 | + include_once( $plugin ); |
|---|
| 862 | +unset( $plugin ); |
|---|
| 863 | |
|---|
| 864 | -require (ABSPATH . WPINC . '/pluggable.php'); |
|---|
| 865 | +// Load pluggable functions. |
|---|
| 866 | +require( ABSPATH . WPINC . '/pluggable.php' ); |
|---|
| 867 | |
|---|
| 868 | +// Set internal encoding. |
|---|
| 869 | wp_set_internal_encoding(); |
|---|
| 870 | |
|---|
| 871 | -if ( WP_CACHE && function_exists('wp_cache_postload') ) |
|---|
| 872 | +// Run wp_cache_postload() if object cache is enabled and the function exists. |
|---|
| 873 | +if ( WP_CACHE && function_exists( 'wp_cache_postload' ) ) |
|---|
| 874 | wp_cache_postload(); |
|---|
| 875 | |
|---|
| 876 | -do_action('plugins_loaded'); |
|---|
| 877 | +do_action( 'plugins_loaded' ); |
|---|
| 878 | |
|---|
| 879 | -wp_default_constants('plugins_loaded'); |
|---|
| 880 | +// Define WP_POST_REVISIONS if not already defined. |
|---|
| 881 | +wp_default_constants( 'plugins_loaded' ); |
|---|
| 882 | |
|---|
| 883 | +// Add magic quotes and set up $_REQUEST ( $_GET + $_POST ) |
|---|
| 884 | wp_magic_quotes(); |
|---|
| 885 | |
|---|
| 886 | -do_action('sanitize_comment_cookies'); |
|---|
| 887 | +do_action( 'sanitize_comment_cookies' ); |
|---|
| 888 | |
|---|
| 889 | /** |
|---|
| 890 | * WordPress Query object |
|---|
| 891 | @@ -173,21 +206,21 @@ |
|---|
| 892 | * @global object $wp_query |
|---|
| 893 | * @since 1.5.0 |
|---|
| 894 | */ |
|---|
| 895 | -$wp_query =& $wp_the_query; |
|---|
| 896 | +$wp_query =& $wp_the_query; |
|---|
| 897 | |
|---|
| 898 | /** |
|---|
| 899 | * Holds the WordPress Rewrite object for creating pretty URLs |
|---|
| 900 | * @global object $wp_rewrite |
|---|
| 901 | * @since 1.5.0 |
|---|
| 902 | */ |
|---|
| 903 | -$wp_rewrite =& new WP_Rewrite(); |
|---|
| 904 | +$wp_rewrite =& new WP_Rewrite(); |
|---|
| 905 | |
|---|
| 906 | /** |
|---|
| 907 | * WordPress Object |
|---|
| 908 | * @global object $wp |
|---|
| 909 | * @since 2.0.0 |
|---|
| 910 | */ |
|---|
| 911 | -$wp =& new WP(); |
|---|
| 912 | +$wp =& new WP(); |
|---|
| 913 | |
|---|
| 914 | /** |
|---|
| 915 | * WordPress Widget Factory Object |
|---|
| 916 | @@ -196,15 +229,23 @@ |
|---|
| 917 | */ |
|---|
| 918 | $wp_widget_factory =& new WP_Widget_Factory(); |
|---|
| 919 | |
|---|
| 920 | -do_action('setup_theme'); |
|---|
| 921 | +do_action( 'setup_theme' ); |
|---|
| 922 | |
|---|
| 923 | -wp_default_constants('setup_theme'); |
|---|
| 924 | +// Define the TEMPLATEPATH and STYLESHEETPATH constants. |
|---|
| 925 | +wp_default_constants( 'setup_theme' ); |
|---|
| 926 | |
|---|
| 927 | // Load the default text localization domain. |
|---|
| 928 | load_default_textdomain(); |
|---|
| 929 | |
|---|
| 930 | -wp_find_locale(); |
|---|
| 931 | +// Find the blog locale. |
|---|
| 932 | +$locale = get_locale(); |
|---|
| 933 | +$locale_file = WP_LANG_DIR . "/$locale.php"; |
|---|
| 934 | +if ( is_readable( $locale_file ) ) |
|---|
| 935 | + require_once( $locale_file ); |
|---|
| 936 | |
|---|
| 937 | +// Pull in locale data after loading text domain. |
|---|
| 938 | +require_once( ABSPATH . WPINC . '/locale.php' ); |
|---|
| 939 | + |
|---|
| 940 | /** |
|---|
| 941 | * WordPress Locale object for loading locale domain date and various strings. |
|---|
| 942 | * @global object $wp_locale |
|---|
| 943 | @@ -212,13 +253,21 @@ |
|---|
| 944 | */ |
|---|
| 945 | $wp_locale =& new WP_Locale(); |
|---|
| 946 | |
|---|
| 947 | -wp_load_theme_functions(); |
|---|
| 948 | +// Load the functions for the active theme, for both parent and child theme if applicable. |
|---|
| 949 | +if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) |
|---|
| 950 | + include( STYLESHEETPATH . '/functions.php' ); |
|---|
| 951 | +if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) |
|---|
| 952 | + include( TEMPLATEPATH . '/functions.php' ); |
|---|
| 953 | |
|---|
| 954 | -register_shutdown_function('shutdown_action_hook'); |
|---|
| 955 | +// Load any template functions the theme supports. |
|---|
| 956 | +require_if_theme_supports( 'post-thumbnails', ABSPATH . WPINC . '/post-thumbnail-template.php' ); |
|---|
| 957 | |
|---|
| 958 | -$wp->init(); // Sets up current user. |
|---|
| 959 | +register_shutdown_function( 'shutdown_action_hook' ); |
|---|
| 960 | |
|---|
| 961 | +// Set up current user. |
|---|
| 962 | +$wp->init(); |
|---|
| 963 | + |
|---|
| 964 | // Everything is loaded and initialized. |
|---|
| 965 | -do_action('init'); |
|---|
| 966 | +do_action( 'init' ); |
|---|
| 967 | |
|---|
| 968 | ?> |
|---|
| 969 | \ No newline at end of file |
|---|