Ticket #24886: 24886.diff
| File 24886.diff, 12.0 KB (added by , 13 years ago) |
|---|
-
wp-includes/load.php
92 92 } 93 93 94 94 /** 95 * Check for the required PHP version, and the MySQL extension or a database drop-in .95 * Check for the required PHP version, and the MySQL extension or a database drop-in 96 96 * 97 97 * Dies if requirements are not met. 98 98 * 99 * @uses wp_load_translations_early() 99 100 * @access private 100 101 * @since 3.0.0 101 102 */ … … 114 115 } 115 116 116 117 /** 117 * Don't load all of WordPress when handling a favicon.ico request. 118 * Don't load all of WordPress when handling a favicon.ico request 119 * 118 120 * Instead, send the headers for a zero-length favicon and bail. 119 121 * 120 122 * @since 3.0.0 … … 128 130 } 129 131 130 132 /** 131 * Dies with a maintenance message when conditions are met .133 * Dies with a maintenance message when conditions are met 132 134 * 133 135 * Checks for a file in the WordPress root directory named ".maintenance". 134 136 * This file will contain the variable $upgrading, set to the time the file … … 138 140 * The default message can be replaced by using a drop-in (maintenance.php in 139 141 * the wp-content directory). 140 142 * 143 * @uses wp_load_translations_early() 144 * @uses _e for string translations 145 * @uses is_rtl() to specify text direction in the template output 146 * 141 147 * @access private 142 148 * @since 3.0.0 143 149 */ … … 182 188 } 183 189 184 190 /** 185 * PHP 5 standard microtime start capture.191 * Starts the WordPress microtimer 186 192 * 187 193 * @access private 194 * @see timer_stop() 188 195 * @since 0.71 189 * @global float $timestart Seconds from when function is called.196 * 190 197 * @return bool Always returns true. 191 198 */ 192 199 function timer_start() { … … 196 203 } 197 204 198 205 /** 199 * Return and/or display the time from the page start to when function is called .206 * Return and/or display the time from the page start to when function is called 200 207 * 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 * 208 * @uses number_format_i18n() to translate the number format based on the locale 214 209 * @since 0.71 215 * @global float $timestart Seconds from when timer_start() is called216 * @global float $timeend Seconds from when function is called217 210 * 218 * @param int $display Use '0' or null to not echo anything and 1 to echo the total time211 * @param int $display Whether to output the time; truthy values will output, falsy values will not. Default is 0. 219 212 * @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 calculation213 * @return string The "second.microsecond" finished time calculation 221 214 */ 222 function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal215 function timer_stop( $display = 0, $precision = 3 ) { 223 216 global $timestart, $timeend; 224 217 $timeend = microtime( true ); 225 218 $timetotal = $timeend - $timestart; … … 230 223 } 231 224 232 225 /** 233 * Sets PHP error handling and handles WordPress debug mode.226 * Sets PHP error reporting based on WordPress debug settings 234 227 * 235 228 * 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>229 * defined in wp-config.php, and by default are set to false. 237 230 * 238 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.239 * WP_DEBUG defaults to false.240 *241 231 * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display 242 * notices, including onewhen a deprecated WordPress function, function argument,232 * internal notices: when a deprecated WordPress function, function argument, 243 233 * or file is used. Deprecated code may be removed from a later version. 244 234 * 245 235 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their 246 236 * development environments. 247 237 * 238 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true. 239 * 248 240 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed. 249 241 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from 250 242 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false 251 243 * will force errors to be hidden. 252 244 * 253 * When WP_DEBUG_LOG is true, errors will be logged to wp-content/debug.log.254 * WP_DEBUG_LOG defaults to false.245 * When WP_DEBUG_LOG is true, errors will be logged to debug.log in 246 * the content directory. 255 247 * 256 248 * Errors are never displayed for XML-RPC requests. 257 249 * … … 279 271 } 280 272 281 273 /** 282 * Sets the location of the language directory .274 * Sets the location of the language directory 283 275 * 284 * To set directory manually, define <code>WP_LANG_DIR</code>in wp-config.php.276 * To set directory manually, define the WP_LANG_DIR constant in wp-config.php. 285 277 * 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. 278 * If the language directory exists within WP_CONTENT_DIR, it is used. 279 * Otherwise the language directory is assumed to live in WPINC. 290 280 * 291 * The WP_LANG_DIR constant was introduced in 2.1.0.292 *293 281 * @access private 294 282 * @since 3.0.0 295 283 */ 296 284 function wp_set_lang_dir() { 297 285 if ( !defined( 'WP_LANG_DIR' ) ) { 298 286 if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) { 287 /** 288 * Server path of the language directory 289 * 290 * @since 2.1.0 291 */ 299 292 define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 300 293 if ( !defined( 'LANGDIR' ) ) { 301 294 // Old static relative path maintained for limited backwards compatibility - won't work in some cases 302 295 define( 'LANGDIR', 'wp-content/languages' ); 303 296 } 304 297 } else { 298 /** 299 * Server path of the language directory 300 * 301 * @since 2.1.0 302 */ 305 303 define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH 306 304 if ( !defined( 'LANGDIR' ) ) { 307 305 // Old relative path maintained for backwards compatibility … … 312 310 } 313 311 314 312 /** 315 * Load the correct database class file.313 * Load the database class file and instantiate the $wpdb global 316 314 * 317 * This function is used to load the database class file either at runtime or by318 * wp-admin/setup-config.php. We must globalize $wpdb to ensure that it is319 * defined globally by the inline code in wp-db.php.320 *321 315 * @since 2.5.0 322 * @global $wpdb WordPress Database Object323 316 */ 324 317 function require_wp_db() { 325 318 global $wpdb; … … 335 328 } 336 329 337 330 /** 338 * Sets the database table prefix and the format specifiers for database table columns .331 * Sets the database table prefix and the format specifiers for database table columns 339 332 * 340 333 * Columns not listed here default to %s. 341 334 * 335 * @uses dead_db() to output a DB error screen if necessary 336 * @uses is_wp_error() to detect errors 337 * @uses wp_load_translations_early() for string translations 338 * @uses wp_die() for failures if necessary 342 339 * @see wpdb::$field_types Since 2.8.0 343 340 * @see wpdb::prepare() 344 341 * @see wpdb::insert() … … 370 367 } 371 368 372 369 /** 373 * Starts the WordPress object cache .370 * Starts the WordPress object cache 374 371 * 375 372 * If an object-cache.php file exists in the wp-content directory, 376 373 * it uses that drop-in as an external object cache. 377 374 * 375 * @uses wp_cache_switch_to_blog() 376 * @uses wp_cache_init() 377 * @uses wp_cache_add_global_groups() 378 * @uses wp_cache_add_non_persistent_groups() 378 379 * @access private 379 380 * @since 3.0.0 380 381 */ … … 413 414 } 414 415 415 416 /** 416 * Redirect s to the installer if WordPress is not installed.417 * Redirect to the installer if WordPress is not installed 417 418 * 418 419 * Dies with an error message when multisite is enabled. 419 420 * 421 * @uses is_multisite() 422 * @uses wp_die() 423 * @uses wp_guess_url() 424 * @uses wp_redirect() 425 * 420 426 * @access private 421 427 * @since 3.0.0 422 428 */ … … 437 443 } 438 444 439 445 /** 440 * Returns array of must-use plugin files to be included in global scope.446 * Returns array of must-use plugin files 441 447 * 442 448 * The default directory is wp-content/mu-plugins. To change the default directory 443 449 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code> … … 464 470 } 465 471 466 472 /** 467 * Returns array of plugin files to be included in global scope.473 * Returns array of active and valid plugin files 468 474 * 475 * While upgrading or installing WordPress, no plugins are returned. 476 * 469 477 * The default directory is wp-content/plugins. To change the default directory 470 478 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code> 471 479 * in wp-config.php. 472 480 * 473 481 * @access private 474 482 * @since 3.0.0 475 * @return array Files to include483 * @return array Files 476 484 */ 477 485 function wp_get_active_and_valid_plugins() { 478 486 $plugins = array(); … … 502 510 } 503 511 504 512 /** 505 * Sets internal encoding using mb_internal_encoding().513 * Sets internal encoding 506 514 * 507 515 * In most cases the default internal encoding is latin1, which is of no use, 508 516 * since we want to use the mb_ functions for utf-8 strings. … … 519 527 } 520 528 521 529 /** 522 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER .530 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER 523 531 * 524 532 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, 525 533 * or $_ENV are needed, use those superglobals directly. … … 572 580 } 573 581 574 582 /** 575 * Whether the current request is for a network or blog adminpage583 * Whether the current request is for an administrative interface page 576 584 * 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.585 * Does not check if the user is an administrator; @see current_user_can() 586 * for checking roles and capabilities. 579 587 * 580 588 * @since 1.5.1 581 589 * 582 * @return bool True if inside WordPress administration pages.590 * @return bool True if inside WordPress administration interface, false otherwise 583 591 */ 584 592 function is_admin() { 585 593 if ( isset( $GLOBALS['current_screen'] ) ) … … 591 599 } 592 600 593 601 /** 594 * Whether the current request is for a blog admin screen /wp-admin/602 * Whether the current request is for a site's admininstrative interface 595 603 * 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. 604 * e.g. /wp-admin/ 598 605 * 606 * Does not check if the user is an administrator; @see current_user_can() 607 * for checking roles and capabilities. 608 * 599 609 * @since 3.1.0 600 610 * 601 * @return bool True if inside WordPress networkadministration pages.611 * @return bool True if inside WordPress blog administration pages. 602 612 */ 603 613 function is_blog_admin() { 604 614 if ( isset( $GLOBALS['current_screen'] ) ) … … 610 620 } 611 621 612 622 /** 613 * Whether the current request is for a network admin screen /wp-admin/network/623 * Whether the current request is for the network administrative iterface 614 624 * 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. 625 * e.g. /wp-admin/network/ 617 626 * 627 * Does not check if the user is an administrator; @see current_user_can() 628 * for checking roles and capabilities. 629 * 618 630 * @since 3.1.0 619 631 * 620 632 * @return bool True if inside WordPress network administration pages. … … 629 641 } 630 642 631 643 /** 632 * Whether the current request is for a user admin screen /wp-admin/user/644 * Whether the current request is for a user admin screen 633 645 * 646 * e.g. /wp-admin/user/ 647 * 634 648 * Does not inform on whether the user is an admin! Use capability checks to 635 649 * tell if the user should be accessing a section or not. 636 650 * … … 648 662 } 649 663 650 664 /** 651 * Whether Multisite supportis enabled665 * If multisite is enabled 652 666 * 653 667 * @since 3.0.0 654 668 *