Changeset 28656 for trunk/src/wp-includes/load.php
- Timestamp:
- 06/04/2014 04:11:21 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/load.php (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/load.php
r27836 r28656 11 11 * Turn register globals off. 12 12 * 13 * @access private14 13 * @since 2.1.0 15 * @return null Will return null if register_globals PHP directive was disabled 14 * @access private 15 * 16 * @return null Will return null if register_globals PHP directive was disabled. 16 17 */ 17 18 function wp_unregister_GLOBALS() { … … 33 34 34 35 /** 35 * Fix $_SERVER variables for various setups. 36 * 37 * @access private 38 * @since 3.0.0 36 * Fix `$_SERVER` variables for various setups. 37 * 38 * @since 3.0.0 39 * @access private 40 * 41 * @global string $PHP_SELF The filename of the currently executing script, 42 * relative to the document root. 39 43 */ 40 44 function wp_fix_server_vars() { … … 93 97 94 98 /** 95 * Check for the required PHP version, and the MySQL extension or a database drop-in. 99 * Check for the required PHP version, and the MySQL extension or 100 * a database drop-in. 96 101 * 97 102 * Dies if requirements are not met. 98 103 * 99 * @access private 100 * @since 3.0.0 104 * @since 3.0.0 105 * @access private 106 * 107 * @global string $required_php_version The required PHP version string. 108 * @global string $wp_version The WordPress version string. 101 109 */ 102 110 function wp_check_php_mysql_versions() { 103 111 global $required_php_version, $wp_version; 104 112 $php_version = phpversion(); 113 105 114 if ( version_compare( $required_php_version, $php_version, '>' ) ) { 106 115 wp_load_translations_early(); … … 118 127 /** 119 128 * Don't load all of WordPress when handling a favicon.ico request. 129 * 120 130 * Instead, send the headers for a zero-length favicon and bail. 121 131 * … … 131 141 132 142 /** 133 * Die swith a maintenance message when conditions are met.143 * Die with a maintenance message when conditions are met. 134 144 * 135 145 * Checks for a file in the WordPress root directory named ".maintenance". … … 141 151 * the wp-content directory). 142 152 * 143 * @access private 144 * @since 3.0.0 153 * @since 3.0.0 154 * @access private 155 * 156 * @global int $upgrading the unix timestamp marking when upgrading WordPress began. 145 157 */ 146 158 function wp_maintenance() { … … 185 197 186 198 /** 187 * PHP 5 standard microtime start capture. 188 * 189 * @access private 199 * Start the WordPress micro-timer. 200 * 190 201 * @since 0.71 191 * @global float $timestart Seconds from when function is called. 202 * @access private 203 * 204 * @global float $timestart Unix timestamp set at the beginning of the page load. 205 * @see timer_stop() 206 * 192 207 * @return bool Always returns true. 193 208 */ … … 224 239 225 240 /** 226 * Sets PHP error handling and handles WordPress debug mode. 227 * 228 * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be 229 * defined in wp-config.php. Example: <code> define( 'WP_DEBUG', true ); </code> 230 * 231 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. 232 * WP_DEBUG defaults to false. 233 * 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. 237 * 238 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their 239 * development environments. 240 * 241 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed. 242 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from 243 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false 244 * will force errors to be hidden. 245 * 246 * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log. 247 * WP_DEBUG_LOG defaults to false. 241 * Set PHP error reporting based on WordPress debug settings. 242 * 243 * Uses three constants: `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`. 244 * All three can be defined in wp-config.php, and by default are set to false. 245 * 246 * When `WP_DEBUG` is true, all PHP notices are reported. WordPress will also 247 * display internal notices: when a deprecated WordPress function, function 248 * argument, or file is used. Deprecated code may be removed from a later 249 * version. 250 * 251 * It is strongly recommended that plugin and theme developers use `WP_DEBUG` 252 * in their development environments. 253 * 254 * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG` 255 * is true. 256 * 257 * When `WP_DEBUG_DISPLAY` is true, WordPress will force errors to be displayed. 258 * `WP_DEBUG_DISPLAY` defaults to true. Defining it as null prevents WordPress 259 * from changing the global configuration setting. Defining `WP_DEBUG_DISPLAY` 260 * as false will force errors to be hidden. 261 * 262 * When `WP_DEBUG_LOG` is true, errors will be logged to debug.log in the content 263 * directory. 248 264 * 249 265 * Errors are never displayed for XML-RPC requests. 250 266 * 251 * @ access private252 * @ since 3.0.0267 * @since 3.0.0 268 * @access private 253 269 */ 254 270 function wp_debug_mode() { … … 273 289 274 290 /** 275 * Sets the location of the language directory. 276 * 277 * To set directory manually, define <code>WP_LANG_DIR</code> in wp-config.php. 278 * 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. 283 * 284 * The WP_LANG_DIR constant was introduced in 2.1.0. 285 * 286 * @access private 287 * @since 3.0.0 291 * Set the location of the language directory. 292 * 293 * To set directory manually, define the `WP_LANG_DIR` constant 294 * in wp-config.php. 295 * 296 * If the language directory exists within `WP_CONTENT_DIR`, it 297 * is used. Otherwise the language directory is assumed to live 298 * in `WPINC`. 299 * 300 * @since 3.0.0 301 * @access private 288 302 */ 289 303 function wp_set_lang_dir() { 290 304 if ( !defined( 'WP_LANG_DIR' ) ) { 291 305 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) { 292 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 306 /** 307 * Server path of the language directory. 308 * 309 * No leading slash, no trailing slash, full path, not relative to ABSPATH 310 * 311 * @since 2.1.0 312 */ 313 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); 293 314 if ( !defined( 'LANGDIR' ) ) { 294 315 // Old static relative path maintained for limited backwards compatibility - won't work in some cases … … 296 317 } 297 318 } else { 298 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 319 /** 320 * Server path of the language directory. 321 * 322 * No leading slash, no trailing slash, full path, not relative to `ABSPATH`. 323 * 324 * @since 2.1.0 325 */ 326 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); 299 327 if ( !defined( 'LANGDIR' ) ) { 300 328 // Old relative path maintained for backwards compatibility … … 306 334 307 335 /** 308 * Load the correct database class file. 309 * 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. 336 * Load the database class file and instantiate the `$wpdb` global. 313 337 * 314 338 * @since 2.5.0 315 * @global $wpdb WordPress Database Object 339 * 340 * @global wpdb $wpdb The WordPress database class. 316 341 */ 317 342 function require_wp_db() { … … 329 354 330 355 /** 331 * Sets the database table prefix and the format specifiers for database table columns. 332 * 333 * Columns not listed here default to %s. 334 * 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() 340 * 341 * @access private 342 * @since 3.0.0 356 * Set the database table prefix and the format specifiers for database 357 * table columns. 358 * 359 * Columns not listed here default to `%s`. 360 * 361 * @since 3.0.0 362 * @access private 363 * 364 * @global wpdb $wpdb The WordPress database class. 365 * @global string $table_prefix The database table prefix. 343 366 */ 344 367 function wp_set_wpdb_vars() { … … 364 387 365 388 /** 366 * Access/Modify private global variable $_wp_using_ext_object_cache 367 * 368 * Toggle $_wp_using_ext_object_cache on and off without directly touching global 389 * Access/Modify private global variable `$_wp_using_ext_object_cache`. 390 * 391 * Toggle `$_wp_using_ext_object_cache` on and off without directly 392 * touching global. 369 393 * 370 394 * @since 3.7.0 371 395 * 372 * @param bool $using Whether external object cache is being used 373 * @return bool The current 'using' setting 396 * @param bool $using Whether external object cache is being used. 397 * @return bool The current 'using' setting. 374 398 */ 375 399 function wp_using_ext_object_cache( $using = null ) { … … 382 406 383 407 /** 384 * Start sthe WordPress object cache.408 * Start the WordPress object cache. 385 409 * 386 410 * If an object-cache.php file exists in the wp-content directory, 387 411 * it uses that drop-in as an external object cache. 388 412 * 389 * @access private 390 * @since 3.0.0 413 * @since 3.0.0 414 * @access private 415 * 416 * @global int $blog_id Blog ID. 391 417 */ 392 418 function wp_start_object_cache() { … … 403 429 $first_init = true; 404 430 } else if ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 405 // Sometimes advanced-cache.php can load object-cache.php before it is loaded here. 406 // This breaks the function_exists check above and can result in $_wp_using_ext_object_cache 407 // being set incorrectly. Double check if an external cache exists. 431 /* 432 * Sometimes advanced-cache.php can load object-cache.php before 433 * it is loaded here. This breaks the function_exists check above 434 * and can result in `$_wp_using_ext_object_cache` being set 435 * incorrectly. Double check if an external cache exists. 436 */ 408 437 wp_using_ext_object_cache( true ); 409 438 } … … 412 441 require_once ( ABSPATH . WPINC . '/cache.php' ); 413 442 414 // If cache supports reset, reset instead of init if already initialized. 415 // Reset signals to the cache that global IDs have changed and it may need to update keys 416 // and cleanup caches. 443 /* 444 * If cache supports reset, reset instead of init if already 445 * initialized. Reset signals to the cache that global IDs 446 * have changed and it may need to update keys and cleanup caches. 447 */ 417 448 if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) 418 449 wp_cache_switch_to_blog( $blog_id ); … … 427 458 428 459 /** 429 * Redirect sto the installer if WordPress is not installed.430 * 431 * Dies with an error message when multisite is enabled.432 * 433 * @ access private434 * @ since 3.0.0460 * Redirect to the installer if WordPress is not installed. 461 * 462 * Dies with an error message when Multisite is enabled. 463 * 464 * @since 3.0.0 465 * @access private 435 466 */ 436 467 function wp_not_installed() { … … 451 482 452 483 /** 453 * Ret urns array of must-use plugin files to be included in global scope.454 * 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>484 * Retrieve an array of must-use plugin files. 485 * 486 * The default directory is wp-content/mu-plugins. To change the default 487 * directory manually, define `WPMU_PLUGIN_DIR` and `WPMU_PLUGIN_URL` 457 488 * in wp-config.php. 458 489 * 459 * @access private 460 * @since 3.0.0 461 * @return array Files to include 490 * @since 3.0.0 491 * @access private 492 * 493 * @return array Files to include. 462 494 */ 463 495 function wp_get_mu_plugins() { … … 478 510 479 511 /** 480 * Returns array of plugin files to be included in global scope. 481 * 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> 512 * Retrieve an array of active and valid plugin files. 513 * 514 * While upgrading or installing WordPress, no plugins are returned. 515 * 516 * The default directory is wp-content/plugins. To change the default 517 * directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` 484 518 * in wp-config.php. 485 519 * 486 * @access private 487 * @since 3.0.0 488 * @return array Files to include 520 * @since 3.0.0 521 * @access private 522 * 523 * @return array Files. 489 524 */ 490 525 function wp_get_active_and_valid_plugins() { … … 516 551 517 552 /** 518 * Set s internal encoding using mb_internal_encoding().519 * 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-8strings.522 * 523 * @ access private524 * @ since 3.0.0553 * Set internal encoding. 554 * 555 * In most cases the default internal encoding is latin1, which is 556 * of no use, since we want to use the `mb_` functions for `utf-8` strings. 557 * 558 * @since 3.0.0 559 * @access private 525 560 */ 526 561 function wp_set_internal_encoding() { … … 533 568 534 569 /** 535 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.536 * 537 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,538 * or $_ENVare needed, use those superglobals directly.539 * 540 * @ access private541 * @ since 3.0.0570 * Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`. 571 * 572 * Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`, 573 * `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly. 574 * 575 * @since 3.0.0 576 * @access private 542 577 */ 543 578 function wp_magic_quotes() { … … 562 597 * Runs just before PHP shuts down execution. 563 598 * 564 * @access private565 599 * @since 1.2.0 600 * @access private 566 601 */ 567 602 function shutdown_action_hook() { … … 572 607 */ 573 608 do_action( 'shutdown' ); 609 574 610 wp_cache_close(); 575 611 } … … 579 615 * 580 616 * @since 2.7.0 581 * @deprecated 3.2 582 * 583 * @param object $object The object to clone 584 * @return object The cloned object 585 */ 586 617 * @deprecated 3.2.0 618 * 619 * @param object $object The object to clone. 620 * @return object The cloned object. 621 */ 587 622 function wp_clone( $object ) { 588 623 // Use parens for clone to accommodate PHP 4. See #17880 … … 591 626 592 627 /** 593 * Whether the current request is for a network or blog admin page594 * 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.628 * Whether the current request is for an administrative interface page. 629 * 630 * Does not check if the user is an administrator; {@see current_user_can()} 631 * for checking roles and capabilities. 597 632 * 598 633 * @since 1.5.1 599 634 * 600 * @return bool True if inside WordPress administration pages.635 * @return bool True if inside WordPress administration interface, false otherwise. 601 636 */ 602 637 function is_admin() { … … 610 645 611 646 /** 612 * Whether the current request is for a blog admin screen /wp-admin/ 613 * 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. 647 * Whether the current request is for a site's admininstrative interface. 648 * 649 * e.g. `/wp-admin/` 650 * 651 * Does not check if the user is an administrator; {@see current_user_can()} 652 * for checking roles and capabilities. 616 653 * 617 654 * @since 3.1.0 618 655 * 619 * @return bool True if inside WordPress networkadministration pages.656 * @return bool True if inside WordPress blog administration pages. 620 657 */ 621 658 function is_blog_admin() { … … 629 666 630 667 /** 631 * Whether the current request is for a network admin screen /wp-admin/network/ 632 * 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. 668 * Whether the current request is for the network administrative interface. 669 * 670 * e.g. `/wp-admin/network/` 671 * 672 * Does not check if the user is an administrator; {@see current_user_can()} 673 * for checking roles and capabilities. 635 674 * 636 675 * @since 3.1.0 … … 648 687 649 688 /** 650 * Whether the current request is for a user admin screen /wp-admin/user/ 651 * 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. 689 * Whether the current request is for a user admin screen. 690 * 691 * e.g. `/wp-admin/user/` 692 * 693 * Does not inform on whether the user is an admin! Use capability 694 * checks to tell if the user should be accessing a section or not 695 * {@see current_user_can()}. 654 696 * 655 697 * @since 3.1.0 … … 667 709 668 710 /** 669 * Whether Multisite support is enabled670 * 671 * @since 3.0.0 672 * 673 * @return bool True if multisite is enabled, false otherwise.711 * If Multisite is enabled. 712 * 713 * @since 3.0.0 714 * 715 * @return bool True if Multisite is enabled, false otherwise. 674 716 */ 675 717 function is_multisite() { … … 684 726 685 727 /** 686 * Retrieve the current blog id728 * Retrieve the current blog ID. 687 729 * 688 730 * @since 3.1.0 … … 696 738 697 739 /** 698 * Attempts an early load of translations. 699 * 700 * Used for errors encountered during the initial loading process, before the locale has been 701 * properly detected and loaded. 702 * 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. 740 * Attempt an early load of translations. 741 * 742 * Used for errors encountered during the initial loading process, before 743 * the locale has been properly detected and loaded. 744 * 745 * Designed for unusual load sequences (like setup-config.php) or for when 746 * the script will then terminate with an error, otherwise there is a risk 747 * that a file can be double-included. 705 748 * 706 749 * @since 3.4.0 707 750 * @access private 751 * 752 * @global $wp_locale The WordPress date and time locale object. 708 753 */ 709 754 function wp_load_translations_early() {
Note: See TracChangeset
for help on using the changeset viewer.