Ticket #24886: 24886.2.diff
| File 24886.2.diff, 15.5 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/load.php
34 34 /** 35 35 * Fix $_SERVER variables for various setups. 36 36 * 37 * @since 3.0.0 37 38 * @access private 38 * @since 3.0.0 39 * 40 * @global string $PHP_SELF The filename of the currently executing script, 41 * relative to the document root. 39 42 */ 40 43 function wp_fix_server_vars() { 41 44 global $PHP_SELF; … … 92 95 } 93 96 94 97 /** 95 * Check for the required PHP version, and the MySQL extension or a database drop-in. 98 * Check for the required PHP version, and the MySQL extension or 99 * a database drop-in. 96 100 * 97 101 * Dies if requirements are not met. 98 102 * 103 * @since 3.0.0 99 104 * @access private 100 * @since 3.0.0 105 * 106 * @global string $required_php_version The required PHP version string. 107 * @global string $wp_version The WordPress version string. 101 108 */ 102 109 function wp_check_php_mysql_versions() { 103 110 global $required_php_version, $wp_version; 104 111 $php_version = phpversion(); 112 105 113 if ( version_compare( $required_php_version, $php_version, '>' ) ) { 106 114 wp_load_translations_early(); 107 115 header( 'Content-Type: text/html; charset=utf-8' ); … … 117 125 118 126 /** 119 127 * Don't load all of WordPress when handling a favicon.ico request. 128 * 120 129 * Instead, send the headers for a zero-length favicon and bail. 121 130 * 122 131 * @since 3.0.0 … … 130 139 } 131 140 132 141 /** 133 * Die swith a maintenance message when conditions are met.142 * Die with a maintenance message when conditions are met. 134 143 * 135 144 * Checks for a file in the WordPress root directory named ".maintenance". 136 145 * This file will contain the variable $upgrading, set to the time the file … … 140 149 * The default message can be replaced by using a drop-in (maintenance.php in 141 150 * the wp-content directory). 142 151 * 152 * @since 3.0.0 143 153 * @access private 144 * @since 3.0.0 154 * 155 * @global int $upgrading the unix timestamp marking when upgrading WordPress began 145 156 */ 146 157 function wp_maintenance() { 147 158 if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) ) … … 184 195 } 185 196 186 197 /** 187 * PHP 5 standard microtime start capture.198 * Start the WordPress microtimer. 188 199 * 200 * @since 0.71 189 201 * @access private 190 * @since 0.71 191 * @global float $timestart Seconds from when function is called. 202 * 203 * @global float $timestart Unix timestamp set at the beginning of the page load. 204 * @see timer_stop() 205 * 192 206 * @return bool Always returns true. 193 207 */ 194 208 function timer_start() { … … 223 237 } 224 238 225 239 /** 226 * Set s PHP error handling and handles WordPress debug mode.240 * Set PHP error reporting based on WordPress debug settings. 227 241 * 228 * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be229 * defined in wp-config.php. Example: <code> define( 'WP_DEBUG', true ); </code>242 * Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`. 243 * All three can be defined in wp-config.php, and by default are set to false. 230 244 * 231 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. 232 * WP_DEBUG defaults to false. 245 * When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also 246 * display internal notices: when a deprecated WordPress function, function 247 * argument, or file is used. Deprecated code may be removed from a later 248 * version. 233 249 * 234 * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display 235 * notices, including one when a deprecated WordPress function, function argument, 236 * or file is used. Deprecated code may be removed from a later version. 250 * It is strongly recommended that plugin and theme developers use `WP_DEBUG` 251 * in their development environments. 237 252 * 238 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their239 * development environments.253 * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG` 254 * is true. 240 255 * 241 * When WP_DEBUG_DISPLAYis true, WordPress will force errors to be displayed.242 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from243 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false244 * will force errors to be hidden.256 * When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed. 257 * `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress 258 * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY` 259 * as false will force errors to be hidden. 245 260 * 246 * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log.247 * WP_DEBUG_LOG defaults to false.261 * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content 262 * directory. 248 263 * 249 264 * Errors are never displayed for XML-RPC requests. 250 265 * 266 * @since 3.0.0 251 267 * @access private 252 * @since 3.0.0253 268 */ 254 269 function wp_debug_mode() { 255 270 if ( WP_DEBUG ) { … … 272 287 } 273 288 274 289 /** 275 * Set sthe location of the language directory.290 * Set the location of the language directory. 276 291 * 277 * To set directory manually, define <code>WP_LANG_DIR</code> in wp-config.php. 292 * To set directory manually, define the `WP_LANG_DIR` constant 293 * in wp-config.php. 278 294 * 279 * If the language directory exists within WP_CONTENT_DIR, that is used. 280 * Otherwise if the language directory exists within WPINC, that's used. 281 * Finally, if neither of the preceding directories are found, 282 * WP_CONTENT_DIR/languages is used. 295 * If the language directory exists within WP_CONTENT_DIR, it 296 * is used. Otherwise the language directory is assumed to live 297 * in WPINC. 283 298 * 284 * The WP_LANG_DIR constant was introduced in 2.1.0. 285 * 299 * @since 3.0.0 286 300 * @access private 287 * @since 3.0.0288 301 */ 289 302 function wp_set_lang_dir() { 290 303 if ( !defined( 'WP_LANG_DIR' ) ) { 291 304 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) { 305 /** 306 * Server path of the language directory. 307 * 308 * @since 2.1.0 309 */ 292 310 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 293 311 if ( !defined( 'LANGDIR' ) ) { 294 312 // Old static relative path maintained for limited backwards compatibility - won't work in some cases 295 313 define( 'LANGDIR', 'wp-content/languages' ); 296 314 } 297 315 } else { 316 /** 317 * Server path of the language directory. 318 * 319 * @since 2.1.0 320 */ 298 321 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 299 322 if ( !defined( 'LANGDIR' ) ) { 300 323 // Old relative path maintained for backwards compatibility … … 305 328 } 306 329 307 330 /** 308 * Load the correct database class file.331 * Load the database class file and instantiate the `$wpdb` global. 309 332 * 310 * This function is used to load the database class file either at runtime or by 311 * wp-admin/setup-config.php. We must globalize $wpdb to ensure that it is 312 * defined globally by the inline code in wp-db.php. 333 * @since 2.5.0 313 334 * 314 * @since 2.5.0 315 * @global $wpdb WordPress Database Object 335 * @global wpdb $wpdb The WordPress database class. 316 336 */ 317 337 function require_wp_db() { 318 338 global $wpdb; … … 328 348 } 329 349 330 350 /** 331 * Set sthe database table prefix and the format specifiers for database table columns.351 * Set the database table prefix and the format specifiers for database table columns. 332 352 * 333 353 * Columns not listed here default to %s. 334 354 * 335 * @see wpdb::$field_types Since 2.8.0 336 * @see wpdb::prepare() 337 * @see wpdb::insert() 338 * @see wpdb::update() 339 * @see wpdb::set_prefix() 355 * @since 3.0.0 356 * @access private 340 357 * 341 * @access private 342 * @since 3.0.0 358 * @see wpdb 359 * @global mixed $wpdb The WordPress database class 360 * @global string $table_prefix the database table prefix 343 361 */ 344 362 function wp_set_wpdb_vars() { 345 363 global $wpdb, $table_prefix; … … 381 399 } 382 400 383 401 /** 384 * Start sthe WordPress object cache.402 * Start the WordPress object cache. 385 403 * 386 404 * If an object-cache.php file exists in the wp-content directory, 387 405 * it uses that drop-in as an external object cache. 388 406 * 407 * @since 3.0.0 389 408 * @access private 390 * @since 3.0.0 409 * 410 * @global bool $_wp_using_ext_object_cache 411 * @global int $blog_id the blog ID 391 412 */ 392 413 function wp_start_object_cache() { 393 414 global $blog_id; … … 426 447 } 427 448 428 449 /** 429 * Redirect sto the installer if WordPress is not installed.450 * Redirect to the installer if WordPress is not installed. 430 451 * 431 452 * Dies with an error message when multisite is enabled. 432 453 * 454 * @since 3.0.0 433 455 * @access private 434 * @since 3.0.0435 456 */ 436 457 function wp_not_installed() { 437 458 if ( is_multisite() ) { … … 450 471 } 451 472 452 473 /** 453 * Ret urns array of must-use plugin files to be included in global scope.474 * Retrieve an array of must-use plugin files. 454 475 * 455 * The default directory is wp-content/mu-plugins. To change the default directory456 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code>476 * The default directory is wp-content/mu-plugins. To change the default 477 * directory manually, define `WPMU_PLUGIN_DIR` and `WPMU_PLUGIN_URL` 457 478 * in wp-config.php. 458 479 * 480 * @since 3.0.0 459 481 * @access private 460 * @since 3.0.0461 * @return array Files to include 482 * 483 * @return array Files to include. 462 484 */ 463 485 function wp_get_mu_plugins() { 464 486 $mu_plugins = array(); … … 477 499 } 478 500 479 501 /** 480 * Ret urns array of plugin files to be included in global scope.502 * Retrieve an array of active and valid plugin files. 481 503 * 482 * The default directory is wp-content/plugins. To change the default directory 483 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code> 504 * While upgrading or installing WordPress, no plugins are returned. 505 * 506 * The default directory is wp-content/plugins. To change the default 507 * directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` 484 508 * in wp-config.php. 485 509 * 510 * @since 3.0.0 486 511 * @access private 487 * @since 3.0.0488 * @return array Files to include512 * 513 * @return array Files. 489 514 */ 490 515 function wp_get_active_and_valid_plugins() { 491 516 $plugins = array(); … … 515 540 } 516 541 517 542 /** 518 * Set s internal encoding using mb_internal_encoding().543 * Set internal encoding. 519 544 * 520 * In most cases the default internal encoding is latin1, which is of no use,521 * since we want to use the mb_ functions for utf-8 strings.545 * In most cases the default internal encoding is latin1, which is 546 * of no use, since we want to use the mb_ functions for utf-8 strings. 522 547 * 548 * @since 3.0.0 523 549 * @access private 524 * @since 3.0.0525 550 */ 526 551 function wp_set_internal_encoding() { 527 552 if ( function_exists( 'mb_internal_encoding' ) ) { … … 532 557 } 533 558 534 559 /** 535 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.560 * Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`. 536 561 * 537 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,538 * or $_ENVare needed, use those superglobals directly.562 * Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`, 563 * `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly. 539 564 * 565 * @since 3.0.0 540 566 * @access private 541 * @since 3.0.0542 567 */ 543 568 function wp_magic_quotes() { 544 569 // If already slashed, strip. … … 561 586 /** 562 587 * Runs just before PHP shuts down execution. 563 588 * 589 * @since 1.2.0 564 590 * @access private 565 * @since 1.2.0566 591 */ 567 592 function shutdown_action_hook() { 568 593 /** … … 571 596 * @since 1.2.0 572 597 */ 573 598 do_action( 'shutdown' ); 599 574 600 wp_cache_close(); 575 601 } 576 602 … … 578 604 * Copy an object. 579 605 * 580 606 * @since 2.7.0 581 * @deprecated 3.2 607 * @deprecated 3.2.0 582 608 * 583 * @param object $object The object to clone 584 * @return object The cloned object 609 * @param object $object The object to clone. 610 * @return object The cloned object. 585 611 */ 586 587 612 function wp_clone( $object ) { 588 613 // Use parens for clone to accommodate PHP 4. See #17880 589 614 return clone( $object ); 590 615 } 591 616 592 617 /** 593 * Whether the current request is for a network or blog admin page618 * Whether the current request is for an administrative interface page. 594 619 * 595 * Does not inform on whether the user is an admin! Use capability checks to596 * tell if the user should be accessing a section or not.620 * Does not check if the user is an administrator; {@see current_user_can()} 621 * for checking roles and capabilities. 597 622 * 598 623 * @since 1.5.1 599 624 * 600 * @return bool True if inside WordPress administration pages.625 * @return bool True if inside WordPress administration interface, false otherwise. 601 626 */ 602 627 function is_admin() { 603 628 if ( isset( $GLOBALS['current_screen'] ) ) … … 609 634 } 610 635 611 636 /** 612 * Whether the current request is for a blog admin screen /wp-admin/637 * Whether the current request is for a site's admininstrative interface. 613 638 * 614 * Does not inform on whether the user is a blog admin! Use capability checks to 615 * tell if the user should be accessing a section or not. 639 * e.g. /wp-admin/ 616 640 * 641 * Does not check if the user is an administrator; {@see current_user_can()} 642 * for checking roles and capabilities. 643 * 617 644 * @since 3.1.0 618 645 * 619 * @return bool True if inside WordPress networkadministration pages.646 * @return bool True if inside WordPress blog administration pages. 620 647 */ 621 648 function is_blog_admin() { 622 649 if ( isset( $GLOBALS['current_screen'] ) ) … … 628 655 } 629 656 630 657 /** 631 * Whether the current request is for a network admin screen /wp-admin/network/658 * Whether the current request is for the network administrative interface. 632 659 * 633 * Does not inform on whether the user is a network admin! Use capability checks to 634 * tell if the user should be accessing a section or not. 660 * e.g. /wp-admin/network/ 635 661 * 662 * Does not check if the user is an administrator; {@see current_user_can()} 663 * for checking roles and capabilities. 664 * 636 665 * @since 3.1.0 637 666 * 638 667 * @return bool True if inside WordPress network administration pages. … … 647 676 } 648 677 649 678 /** 650 * Whether the current request is for a user admin screen /wp-admin/user/679 * Whether the current request is for a user admin screen. 651 680 * 652 * Does not inform on whether the user is an admin! Use capability checks to 653 * tell if the user should be accessing a section or not. 681 * e.g. /wp-admin/user/ 654 682 * 683 * Does not inform on whether the user is an admin! Use capability 684 * checks to tell if the user should be accessing a section or not 685 * {@see current_user_can()}. 686 * 655 687 * @since 3.1.0 656 688 * 657 689 * @return bool True if inside WordPress user administration pages. … … 666 698 } 667 699 668 700 /** 669 * Whether Multisite support is enabled701 * If Multisite is enabled. 670 702 * 671 703 * @since 3.0.0 672 704 * 673 * @return bool True if multisite is enabled, false otherwise.705 * @return bool True if Multisite is enabled, false otherwise. 674 706 */ 675 707 function is_multisite() { 676 708 if ( defined( 'MULTISITE' ) ) … … 683 715 } 684 716 685 717 /** 686 * Retrieve the current blog id718 * Retrieve the current blog ID. 687 719 * 688 720 * @since 3.1.0 689 721 * … … 695 727 } 696 728 697 729 /** 698 * Attempt san early load of translations.730 * Attempt an early load of translations. 699 731 * 700 * Used for errors encountered during the initial loading process, before the locale has been701 * properly detected and loaded.732 * Used for errors encountered during the initial loading process, before 733 * the locale has been properly detected and loaded. 702 734 * 703 * Designed for unusual load sequences (like setup-config.php) or for when the script will then 704 * terminate with an error, otherwise there is a risk that a file can be double-included. 735 * Designed for unusual load sequences (like setup-config.php) or for when 736 * the script will then terminate with an error, otherwise there is a risk 737 * that a file can be double-included. 705 738 * 706 739 * @since 3.4.0 707 740 * @access private 741 * 742 * @global $wp_locale The WordPress date and time locale object. 708 743 */ 709 744 function wp_load_translations_early() { 710 745 global $text_direction, $wp_locale;