Ticket #24886: 24886.1.diff
| File 24886.1.diff, 13.5 KB (added by , 13 years ago) |
|---|
-
wp-includes/load.php
34 34 /** 35 35 * Fix $_SERVER variables for various setups. 36 36 * 37 * @global string $PHP_SELF The filename of the currently executing script, relative to the document root 37 38 * @access private 38 39 * @since 3.0.0 39 40 */ … … 92 93 } 93 94 94 95 /** 95 * Check for the required PHP version, and the MySQL extension or a database drop-in .96 * Check for the required PHP version, and the MySQL extension or a database drop-in 96 97 * 97 98 * Dies if requirements are not met. 98 99 * 100 * @global string $required_php_version The required PHP version string 101 * @global string $wp_version The WordPress version string 102 * @uses wp_load_translations_early() 99 103 * @access private 100 104 * @since 3.0.0 101 105 */ … … 114 118 } 115 119 116 120 /** 117 * Don't load all of WordPress when handling a favicon.ico request. 121 * Don't load all of WordPress when handling a favicon.ico request 122 * 118 123 * Instead, send the headers for a zero-length favicon and bail. 119 124 * 120 125 * @since 3.0.0 … … 128 133 } 129 134 130 135 /** 131 * Dies with a maintenance message when conditions are met .136 * Dies with a maintenance message when conditions are met 132 137 * 133 138 * Checks for a file in the WordPress root directory named ".maintenance". 134 139 * This file will contain the variable $upgrading, set to the time the file … … 138 143 * The default message can be replaced by using a drop-in (maintenance.php in 139 144 * the wp-content directory). 140 145 * 146 * @global int $upgrading the unix timestamp marking when upgrading WordPress began 147 * @uses wp_load_translations_early() 148 * @uses _e for string translations 149 * @uses is_rtl() to specify text direction in the template output 150 * 141 151 * @access private 142 152 * @since 3.0.0 143 153 */ … … 182 192 } 183 193 184 194 /** 185 * PHP 5 standard microtime start capture.195 * Starts the WordPress microtimer 186 196 * 197 * @global float $timestart Unix timestamp set at the beginning of the page load 187 198 * @access private 199 * @see timer_stop() 188 200 * @since 0.71 189 * @global float $timestart Seconds from when function is called.201 * 190 202 * @return bool Always returns true. 191 203 */ 192 204 function timer_start() { … … 196 208 } 197 209 198 210 /** 199 * Return and/or display the time from the page start to when function is called .211 * Return and/or display the time from the page start to when function is called 200 212 * 201 * You can get the results and print them by doing: 202 * <code> 203 * $nTimePageTookToExecute = timer_stop(); 204 * echo $nTimePageTookToExecute; 205 * </code> 206 * 207 * Or instead, you can do: 208 * <code> 209 * timer_stop(1); 210 * </code> 211 * which will do what the above does. If you need the result, you can assign it to a variable, but 212 * in most cases, you only need to echo it. 213 * 213 * @global float $timestart Unix timestamp set at the beginning of the page load 214 * @global float $timestart Unix timestamp set at the current point of the page load 215 * @uses number_format_i18n() to translate the number format based on the locale 214 216 * @since 0.71 215 * @global float $timestart Seconds from when timer_start() is called216 * @global float $timeend Seconds from when function is called217 217 * 218 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time218 * @param int $display Whether to output the time; truthy values will output, falsy values will not. Default is 0. 219 219 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3. 220 * @return floatThe "second.microsecond" finished time calculation220 * @return string The "second.microsecond" finished time calculation 221 221 */ 222 function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal222 function timer_stop( $display = 0, $precision = 3 ) { 223 223 global $timestart, $timeend; 224 224 $timeend = microtime( true ); 225 225 $timetotal = $timeend - $timestart; … … 230 230 } 231 231 232 232 /** 233 * Sets PHP error handling and handles WordPress debug mode.233 * Sets PHP error reporting based on WordPress debug settings 234 234 * 235 235 * Uses three constants: WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG. All three can be 236 * defined in wp-config.php . Example: <code> define( 'WP_DEBUG', true ); </code>236 * defined in wp-config.php, and by default are set to false. 237 237 * 238 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.239 * WP_DEBUG defaults to false.240 *241 238 * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display 242 * notices, including onewhen a deprecated WordPress function, function argument,239 * internal notices: when a deprecated WordPress function, function argument, 243 240 * or file is used. Deprecated code may be removed from a later version. 244 241 * 245 242 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their 246 243 * development environments. 247 244 * 245 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. 246 * 248 247 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed. 249 248 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from 250 249 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false 251 250 * will force errors to be hidden. 252 251 * 253 * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log.254 * WP_DEBUG_LOG defaults to false.252 * When WP_DEBUG_LOG is true, errors will be logged to debug.log in 253 * the content directory. 255 254 * 256 255 * Errors are never displayed for XML-RPC requests. 257 256 * … … 279 278 } 280 279 281 280 /** 282 * Sets the location of the language directory .281 * Sets the location of the language directory 283 282 * 284 * To set directory manually, define <code>WP_LANG_DIR</code>in wp-config.php.283 * To set directory manually, define the WP_LANG_DIR constant in wp-config.php. 285 284 * 286 * If the language directory exists within WP_CONTENT_DIR, that is used. 287 * Otherwise if the language directory exists within WPINC, that's used. 288 * Finally, if neither of the preceding directories are found, 289 * WP_CONTENT_DIR/languages is used. 285 * If the language directory exists within WP_CONTENT_DIR, it is used. 286 * Otherwise the language directory is assumed to live in WPINC. 290 287 * 291 * The WP_LANG_DIR constant was introduced in 2.1.0.292 *293 288 * @access private 294 289 * @since 3.0.0 295 290 */ 296 291 function wp_set_lang_dir() { 297 292 if ( !defined( 'WP_LANG_DIR' ) ) { 298 293 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) { 294 /** 295 * Server path of the language directory 296 * 297 * @since 2.1.0 298 */ 299 299 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 300 300 if ( !defined( 'LANGDIR' ) ) { 301 301 // Old static relative path maintained for limited backwards compatibility - won't work in some cases 302 302 define( 'LANGDIR', 'wp-content/languages' ); 303 303 } 304 304 } else { 305 /** 306 * Server path of the language directory 307 * 308 * @since 2.1.0 309 */ 305 310 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 306 311 if ( !defined( 'LANGDIR' ) ) { 307 312 // Old relative path maintained for backwards compatibility … … 312 317 } 313 318 314 319 /** 315 * Load the correct database class file.320 * Load the database class file and instantiate the $wpdb global 316 321 * 317 * This function is used to load the database class file either at runtime or by 318 * wp-admin/setup-config.php. We must globalize $wpdb to ensure that it is 319 * defined globally by the inline code in wp-db.php. 320 * 322 * @global mixed $wpdb The WordPress database class 321 323 * @since 2.5.0 322 * @global $wpdb WordPress Database Object323 324 */ 324 325 function require_wp_db() { 325 326 global $wpdb; … … 335 336 } 336 337 337 338 /** 338 * Sets the database table prefix and the format specifiers for database table columns .339 * Sets the database table prefix and the format specifiers for database table columns 339 340 * 340 341 * Columns not listed here default to %s. 341 342 * 343 * @global mixed $wpdb The WordPress database class 344 * @global string $table_prefix the database table prefix 345 * @uses dead_db() to output a DB error screen if necessary 346 * @uses is_wp_error() to detect errors 347 * @uses wp_load_translations_early() for string translations 348 * @uses wp_die() for failures if necessary 342 349 * @see wpdb::$field_types Since 2.8.0 343 350 * @see wpdb::prepare() 344 351 * @see wpdb::insert() … … 370 377 } 371 378 372 379 /** 373 * Starts the WordPress object cache .380 * Starts the WordPress object cache 374 381 * 375 382 * If an object-cache.php file exists in the wp-content directory, 376 383 * it uses that drop-in as an external object cache. 377 384 * 385 * @global bool $_wp_using_ext_object_cache 386 * @global int $blog_id the blog ID 387 * @uses wp_cache_switch_to_blog() 388 * @uses wp_cache_init() 389 * @uses wp_cache_add_global_groups() 390 * @uses wp_cache_add_non_persistent_groups() 378 391 * @access private 379 392 * @since 3.0.0 380 393 */ … … 413 426 } 414 427 415 428 /** 416 * Redirect s to the installer if WordPress is not installed.429 * Redirect to the installer if WordPress is not installed 417 430 * 418 431 * Dies with an error message when multisite is enabled. 419 432 * 433 * @uses is_multisite() 434 * @uses wp_die() 435 * @uses wp_guess_url() 436 * @uses wp_redirect() 437 * 420 438 * @access private 421 439 * @since 3.0.0 422 440 */ … … 437 455 } 438 456 439 457 /** 440 * Returns array of must-use plugin files to be included in global scope.458 * Returns array of must-use plugin files 441 459 * 442 460 * The default directory is wp-content/mu-plugins. To change the default directory 443 461 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code> … … 464 482 } 465 483 466 484 /** 467 * Returns array of plugin files to be included in global scope.485 * Returns array of active and valid plugin files 468 486 * 487 * While upgrading or installing WordPress, no plugins are returned. 488 * 469 489 * The default directory is wp-content/plugins. To change the default directory 470 490 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code> 471 491 * in wp-config.php. 472 492 * 473 493 * @access private 474 494 * @since 3.0.0 475 * @return array Files to include495 * @return array Files 476 496 */ 477 497 function wp_get_active_and_valid_plugins() { 478 498 $plugins = array(); … … 502 522 } 503 523 504 524 /** 505 * Sets internal encoding using mb_internal_encoding().525 * Sets internal encoding 506 526 * 507 527 * In most cases the default internal encoding is latin1, which is of no use, 508 528 * since we want to use the mb_ functions for utf-8 strings. … … 519 539 } 520 540 521 541 /** 522 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER .542 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER 523 543 * 524 544 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, 525 545 * or $_ENV are needed, use those superglobals directly. … … 572 592 } 573 593 574 594 /** 575 * Whether the current request is for a network or blog adminpage595 * Whether the current request is for an administrative interface page 576 596 * 577 * Does not inform on whether the user is an admin! Use capability checks to578 * tell if the user should be accessing a section or not.597 * Does not check if the user is an administrator; @see current_user_can() 598 * for checking roles and capabilities. 579 599 * 580 600 * @since 1.5.1 581 601 * 582 * @return bool True if inside WordPress administration pages.602 * @return bool True if inside WordPress administration interface, false otherwise 583 603 */ 584 604 function is_admin() { 585 605 if ( isset( $GLOBALS['current_screen'] ) ) … … 591 611 } 592 612 593 613 /** 594 * Whether the current request is for a blog admin screen /wp-admin/614 * Whether the current request is for a site's admininstrative interface 595 615 * 596 * Does not inform on whether the user is a blog admin! Use capability checks to 597 * tell if the user should be accessing a section or not. 616 * e.g. /wp-admin/ 598 617 * 618 * Does not check if the user is an administrator; @see current_user_can() 619 * for checking roles and capabilities. 620 * 599 621 * @since 3.1.0 600 622 * 601 * @return bool True if inside WordPress networkadministration pages.623 * @return bool True if inside WordPress blog administration pages. 602 624 */ 603 625 function is_blog_admin() { 604 626 if ( isset( $GLOBALS['current_screen'] ) ) … … 610 632 } 611 633 612 634 /** 613 * Whether the current request is for a network admin screen /wp-admin/network/635 * Whether the current request is for the network administrative iterface 614 636 * 615 * Does not inform on whether the user is a network admin! Use capability checks to 616 * tell if the user should be accessing a section or not. 637 * e.g. /wp-admin/network/ 617 638 * 639 * Does not check if the user is an administrator; @see current_user_can() 640 * for checking roles and capabilities. 641 * 618 642 * @since 3.1.0 619 643 * 620 644 * @return bool True if inside WordPress network administration pages. … … 629 653 } 630 654 631 655 /** 632 * Whether the current request is for a user admin screen /wp-admin/user/656 * Whether the current request is for a user admin screen 633 657 * 658 * e.g. /wp-admin/user/ 659 * 634 660 * Does not inform on whether the user is an admin! Use capability checks to 635 661 * tell if the user should be accessing a section or not. 636 662 * … … 648 674 } 649 675 650 676 /** 651 * Whether Multisite supportis enabled677 * If multisite is enabled 652 678 * 653 679 * @since 3.0.0 654 680 * … … 667 693 /** 668 694 * Retrieve the current blog id 669 695 * 696 * @global int $blog_id 670 697 * @since 3.1.0 671 698 * 672 699 * @return int Blog id … … 685 712 * Designed for unusual load sequences (like setup-config.php) or for when the script will then 686 713 * terminate with an error, otherwise there is a risk that a file can be double-included. 687 714 * 715 * @global $wp_locale the WordPress date and time locale object 688 716 * @since 3.4.0 689 717 * @access private 690 718 */ 691 719 function wp_load_translations_early() { 692 global $ text_direction, $wp_locale;720 global $wp_locale; 693 721 694 722 static $loaded = false; 695 723 if ( $loaded )