Make WordPress Core

Ticket #24886: 24886.2.diff

File 24886.2.diff, 15.5 KB (added by DrewAPicture, 12 years ago)
  • src/wp-includes/load.php

     
    3434/**
    3535 * Fix $_SERVER variables for various setups.
    3636 *
     37 * @since 3.0.0
    3738 * @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.
    3942 */
    4043function wp_fix_server_vars() {
    4144        global $PHP_SELF;
     
    9295}
    9396
    9497/**
    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.
    96100 *
    97101 * Dies if requirements are not met.
    98102 *
     103 * @since 3.0.0
    99104 * @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.
    101108 */
    102109function wp_check_php_mysql_versions() {
    103110        global $required_php_version, $wp_version;
    104111        $php_version = phpversion();
     112
    105113        if ( version_compare( $required_php_version, $php_version, '>' ) ) {
    106114                wp_load_translations_early();
    107115                header( 'Content-Type: text/html; charset=utf-8' );
     
    117125
    118126/**
    119127 * Don't load all of WordPress when handling a favicon.ico request.
     128 *
    120129 * Instead, send the headers for a zero-length favicon and bail.
    121130 *
    122131 * @since 3.0.0
     
    130139}
    131140
    132141/**
    133  * Dies with a maintenance message when conditions are met.
     142 * Die with a maintenance message when conditions are met.
    134143 *
    135144 * Checks for a file in the WordPress root directory named ".maintenance".
    136145 * This file will contain the variable $upgrading, set to the time the file
     
    140149 * The default message can be replaced by using a drop-in (maintenance.php in
    141150 * the wp-content directory).
    142151 *
     152 * @since 3.0.0
    143153 * @access private
    144  * @since 3.0.0
     154 *
     155 * @global int $upgrading the unix timestamp marking when upgrading WordPress began
    145156 */
    146157function wp_maintenance() {
    147158        if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
     
    184195}
    185196
    186197/**
    187  * PHP 5 standard microtime start capture.
     198 * Start the WordPress microtimer.
    188199 *
     200 * @since 0.71
    189201 * @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 *
    192206 * @return bool Always returns true.
    193207 */
    194208function timer_start() {
     
    223237}
    224238
    225239/**
    226  * Sets PHP error handling and handles WordPress debug mode.
     240 * Set PHP error reporting based on WordPress debug settings.
    227241 *
    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>
     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.
    230244 *
    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.
    233249 *
    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.
    237252 *
    238  * It is strongly recommended that plugin and theme developers use WP_DEBUG in their
    239  * development environments.
     253 * `WP_DEBUG_DISPLAY` and `WP_DEBUG_LOG` perform no function unless `WP_DEBUG`
     254 * is true.
    240255 *
    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.
     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.
    245260 *
    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.
    248263 *
    249264 * Errors are never displayed for XML-RPC requests.
    250265 *
     266 * @since 3.0.0
    251267 * @access private
    252  * @since 3.0.0
    253268 */
    254269function wp_debug_mode() {
    255270        if ( WP_DEBUG ) {
     
    272287}
    273288
    274289/**
    275  * Sets the location of the language directory.
     290 * Set the location of the language directory.
    276291 *
    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.
    278294 *
    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.
    283298 *
    284  * The WP_LANG_DIR constant was introduced in 2.1.0.
    285  *
     299 * @since 3.0.0
    286300 * @access private
    287  * @since 3.0.0
    288301 */
    289302function wp_set_lang_dir() {
    290303        if ( !defined( 'WP_LANG_DIR' ) ) {
    291304                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                         */
    292310                        define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
    293311                        if ( !defined( 'LANGDIR' ) ) {
    294312                                // Old static relative path maintained for limited backwards compatibility - won't work in some cases
    295313                                define( 'LANGDIR', 'wp-content/languages' );
    296314                        }
    297315                } else {
     316                        /**
     317                         * Server path of the language directory.
     318                         *
     319                         * @since 2.1.0
     320                         */
    298321                        define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
    299322                        if ( !defined( 'LANGDIR' ) ) {
    300323                                // Old relative path maintained for backwards compatibility
     
    305328}
    306329
    307330/**
    308  * Load the correct database class file.
     331 * Load the database class file and instantiate the `$wpdb` global.
    309332 *
    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
    313334 *
    314  * @since 2.5.0
    315  * @global $wpdb WordPress Database Object
     335 * @global wpdb $wpdb The WordPress database class.
    316336 */
    317337function require_wp_db() {
    318338        global $wpdb;
     
    328348}
    329349
    330350/**
    331  * Sets the 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.
    332352 *
    333353 * Columns not listed here default to %s.
    334354 *
    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
    340357 *
    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
    343361 */
    344362function wp_set_wpdb_vars() {
    345363        global $wpdb, $table_prefix;
     
    381399}
    382400
    383401/**
    384  * Starts the WordPress object cache.
     402 * Start the WordPress object cache.
    385403 *
    386404 * If an object-cache.php file exists in the wp-content directory,
    387405 * it uses that drop-in as an external object cache.
    388406 *
     407 * @since 3.0.0
    389408 * @access private
    390  * @since 3.0.0
     409 *
     410 * @global bool $_wp_using_ext_object_cache
     411 * @global int $blog_id the blog ID
    391412 */
    392413function wp_start_object_cache() {
    393414        global $blog_id;
     
    426447}
    427448
    428449/**
    429  * Redirects to the installer if WordPress is not installed.
     450 * Redirect to the installer if WordPress is not installed.
    430451 *
    431452 * Dies with an error message when multisite is enabled.
    432453 *
     454 * @since 3.0.0
    433455 * @access private
    434  * @since 3.0.0
    435456 */
    436457function wp_not_installed() {
    437458        if ( is_multisite() ) {
     
    450471}
    451472
    452473/**
    453  * Returns array of must-use plugin files to be included in global scope.
     474 * Retrieve an array of must-use plugin files.
    454475 *
    455  * The default directory is wp-content/mu-plugins. To change the default directory
    456  * 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`
    457478 * in wp-config.php.
    458479 *
     480 * @since 3.0.0
    459481 * @access private
    460  * @since 3.0.0
    461  * @return array Files to include
     482 *
     483 * @return array Files to include.
    462484 */
    463485function wp_get_mu_plugins() {
    464486        $mu_plugins = array();
     
    477499}
    478500
    479501/**
    480  * Returns array of plugin files to be included in global scope.
     502 * Retrieve an array of active and valid plugin files.
    481503 *
    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`
    484508 * in wp-config.php.
    485509 *
     510 * @since 3.0.0
    486511 * @access private
    487  * @since 3.0.0
    488  * @return array Files to include
     512 *
     513 * @return array Files.
    489514 */
    490515function wp_get_active_and_valid_plugins() {
    491516        $plugins = array();
     
    515540}
    516541
    517542/**
    518  * Sets internal encoding using mb_internal_encoding().
     543 * Set internal encoding.
    519544 *
    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.
    522547 *
     548 * @since 3.0.0
    523549 * @access private
    524  * @since 3.0.0
    525550 */
    526551function wp_set_internal_encoding() {
    527552        if ( function_exists( 'mb_internal_encoding' ) ) {
     
    532557}
    533558
    534559/**
    535  * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
     560 * Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`.
    536561 *
    537  * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
    538  * or $_ENV are 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.
    539564 *
     565 * @since 3.0.0
    540566 * @access private
    541  * @since 3.0.0
    542567 */
    543568function wp_magic_quotes() {
    544569        // If already slashed, strip.
     
    561586/**
    562587 * Runs just before PHP shuts down execution.
    563588 *
     589 * @since 1.2.0
    564590 * @access private
    565  * @since 1.2.0
    566591 */
    567592function shutdown_action_hook() {
    568593        /**
     
    571596         * @since 1.2.0
    572597         */
    573598        do_action( 'shutdown' );
     599
    574600        wp_cache_close();
    575601}
    576602
     
    578604 * Copy an object.
    579605 *
    580606 * @since 2.7.0
    581  * @deprecated 3.2
     607 * @deprecated 3.2.0
    582608 *
    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.
    585611 */
    586 
    587612function wp_clone( $object ) {
    588613        // Use parens for clone to accommodate PHP 4. See #17880
    589614        return clone( $object );
    590615}
    591616
    592617/**
    593  * Whether the current request is for a network or blog admin page
     618 * Whether the current request is for an administrative interface page.
    594619 *
    595  * Does not inform on whether the user is an admin! Use capability checks to
    596  * 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.
    597622 *
    598623 * @since 1.5.1
    599624 *
    600  * @return bool True if inside WordPress administration pages.
     625 * @return bool True if inside WordPress administration interface, false otherwise.
    601626 */
    602627function is_admin() {
    603628        if ( isset( $GLOBALS['current_screen'] ) )
     
    609634}
    610635
    611636/**
    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.
    613638 *
    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/
    616640 *
     641 * Does not check if the user is an administrator; {@see current_user_can()}
     642 * for checking roles and capabilities.
     643 *
    617644 * @since 3.1.0
    618645 *
    619  * @return bool True if inside WordPress network administration pages.
     646 * @return bool True if inside WordPress blog administration pages.
    620647 */
    621648function is_blog_admin() {
    622649        if ( isset( $GLOBALS['current_screen'] ) )
     
    628655}
    629656
    630657/**
    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.
    632659 *
    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/
    635661 *
     662 * Does not check if the user is an administrator; {@see current_user_can()}
     663 * for checking roles and capabilities.
     664 *
    636665 * @since 3.1.0
    637666 *
    638667 * @return bool True if inside WordPress network administration pages.
     
    647676}
    648677
    649678/**
    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.
    651680 *
    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/
    654682 *
     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 *
    655687 * @since 3.1.0
    656688 *
    657689 * @return bool True if inside WordPress user administration pages.
     
    666698}
    667699
    668700/**
    669  * Whether Multisite support is enabled
     701 * If Multisite is enabled.
    670702 *
    671703 * @since 3.0.0
    672704 *
    673  * @return bool True if multisite is enabled, false otherwise.
     705 * @return bool True if Multisite is enabled, false otherwise.
    674706 */
    675707function is_multisite() {
    676708        if ( defined( 'MULTISITE' ) )
     
    683715}
    684716
    685717/**
    686  * Retrieve the current blog id
     718 * Retrieve the current blog ID.
    687719 *
    688720 * @since 3.1.0
    689721 *
     
    695727}
    696728
    697729/**
    698  * Attempts an early load of translations.
     730 * Attempt an early load of translations.
    699731 *
    700  * Used for errors encountered during the initial loading process, before the locale has been
    701  * properly detected and loaded.
     732 * Used for errors encountered during the initial loading process, before
     733 * the locale has been properly detected and loaded.
    702734 *
    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.
    705738 *
    706739 * @since 3.4.0
    707740 * @access private
     741 *
     742 * @global $wp_locale The WordPress date and time locale object.
    708743 */
    709744function wp_load_translations_early() {
    710745        global $text_direction, $wp_locale;