Make WordPress Core

Ticket #24886: 24886.1.diff

File 24886.1.diff, 13.5 KB (added by ericlewis, 13 years ago)
  • wp-includes/load.php

     
    3434/**
    3535 * Fix $_SERVER variables for various setups.
    3636 *
     37 * @global string $PHP_SELF The filename of the currently executing script, relative to the document root
    3738 * @access private
    3839 * @since 3.0.0
    3940 */
     
    9293}
    9394
    9495/**
    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
    9697 *
    9798 * Dies if requirements are not met.
    9899 *
     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()
    99103 * @access private
    100104 * @since 3.0.0
    101105 */
     
    114118}
    115119
    116120/**
    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 *
    118123 * Instead, send the headers for a zero-length favicon and bail.
    119124 *
    120125 * @since 3.0.0
     
    128133}
    129134
    130135/**
    131  * Dies with a maintenance message when conditions are met.
     136 * Dies with a maintenance message when conditions are met
    132137 *
    133138 * Checks for a file in the WordPress root directory named ".maintenance".
    134139 * This file will contain the variable $upgrading, set to the time the file
     
    138143 * The default message can be replaced by using a drop-in (maintenance.php in
    139144 * the wp-content directory).
    140145 *
     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 *
    141151 * @access private
    142152 * @since 3.0.0
    143153 */
     
    182192}
    183193
    184194/**
    185  * PHP 5 standard microtime start capture.
     195 * Starts the WordPress microtimer
    186196 *
     197 * @global float $timestart Unix timestamp set at the beginning of the page load
    187198 * @access private
     199 * @see timer_stop()
    188200 * @since 0.71
    189  * @global float $timestart Seconds from when function is called.
     201 *
    190202 * @return bool Always returns true.
    191203 */
    192204function timer_start() {
     
    196208}
    197209
    198210/**
    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
    200212 *
    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
    214216 * @since 0.71
    215  * @global float $timestart Seconds from when timer_start() is called
    216  * @global float $timeend Seconds from when function is called
    217217 *
    218  * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
     218 * @param int $display Whether to output the time; truthy values will output, falsy values will not. Default is 0.
    219219 * @param int $precision The amount of digits from the right of the decimal to display. Default is 3.
    220  * @return float The "second.microsecond" finished time calculation
     220 * @return string The "second.microsecond" finished time calculation
    221221 */
    222 function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal
     222function timer_stop( $display = 0, $precision = 3 ) {
    223223        global $timestart, $timeend;
    224224        $timeend = microtime( true );
    225225        $timetotal = $timeend - $timestart;
     
    230230}
    231231
    232232/**
    233  * Sets PHP error handling and handles WordPress debug mode.
     233 * Sets PHP error reporting based on WordPress debug settings
    234234 *
    235235 * 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.
    237237 *
    238  * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.
    239  * WP_DEBUG defaults to false.
    240  *
    241238 * When WP_DEBUG is true, all PHP notices are reported. WordPress will also display
    242  * notices, including one when a deprecated WordPress function, function argument,
     239 * internal notices: when a deprecated WordPress function, function argument,
    243240 * or file is used. Deprecated code may be removed from a later version.
    244241 *
    245242 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their
    246243 * development environments.
    247244 *
     245 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.
     246 *
    248247 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed.
    249248 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from
    250249 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false
    251250 * will force errors to be hidden.
    252251 *
    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.
    255254 *
    256255 * Errors are never displayed for XML-RPC requests.
    257256 *
     
    279278}
    280279
    281280/**
    282  * Sets the location of the language directory.
     281 * Sets the location of the language directory
    283282 *
    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.
    285284 *
    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.
    290287 *
    291  * The WP_LANG_DIR constant was introduced in 2.1.0.
    292  *
    293288 * @access private
    294289 * @since 3.0.0
    295290 */
    296291function wp_set_lang_dir() {
    297292        if ( !defined( 'WP_LANG_DIR' ) ) {
    298293                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                         */
    299299                        define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
    300300                        if ( !defined( 'LANGDIR' ) ) {
    301301                                // Old static relative path maintained for limited backwards compatibility - won't work in some cases
    302302                                define( 'LANGDIR', 'wp-content/languages' );
    303303                        }
    304304                } else {
     305                        /**
     306                         * Server path of the language directory
     307                         *
     308                         * @since 2.1.0
     309                         */
    305310                        define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
    306311                        if ( !defined( 'LANGDIR' ) ) {
    307312                                // Old relative path maintained for backwards compatibility
     
    312317}
    313318
    314319/**
    315  * Load the correct database class file.
     320 * Load the database class file and instantiate the $wpdb global
    316321 *
    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
    321323 * @since 2.5.0
    322  * @global $wpdb WordPress Database Object
    323324 */
    324325function require_wp_db() {
    325326        global $wpdb;
     
    335336}
    336337
    337338/**
    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
    339340 *
    340341 * Columns not listed here default to %s.
    341342 *
     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
    342349 * @see wpdb::$field_types Since 2.8.0
    343350 * @see wpdb::prepare()
    344351 * @see wpdb::insert()
     
    370377}
    371378
    372379/**
    373  * Starts the WordPress object cache.
     380 * Starts the WordPress object cache
    374381 *
    375382 * If an object-cache.php file exists in the wp-content directory,
    376383 * it uses that drop-in as an external object cache.
    377384 *
     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()
    378391 * @access private
    379392 * @since 3.0.0
    380393 */
     
    413426}
    414427
    415428/**
    416  * Redirects to the installer if WordPress is not installed.
     429 * Redirect to the installer if WordPress is not installed
    417430 *
    418431 * Dies with an error message when multisite is enabled.
    419432 *
     433 * @uses is_multisite()
     434 * @uses wp_die()
     435 * @uses wp_guess_url()
     436 * @uses wp_redirect()
     437 *
    420438 * @access private
    421439 * @since 3.0.0
    422440 */
     
    437455}
    438456
    439457/**
    440  * Returns array of must-use plugin files to be included in global scope.
     458 * Returns array of must-use plugin files
    441459 *
    442460 * The default directory is wp-content/mu-plugins. To change the default directory
    443461 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code>
     
    464482}
    465483
    466484/**
    467  * Returns array of plugin files to be included in global scope.
     485 * Returns array of active and valid plugin files
    468486 *
     487 * While upgrading or installing WordPress, no plugins are returned.
     488 *
    469489 * The default directory is wp-content/plugins. To change the default directory
    470490 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code>
    471491 * in wp-config.php.
    472492 *
    473493 * @access private
    474494 * @since 3.0.0
    475  * @return array Files to include
     495 * @return array Files
    476496 */
    477497function wp_get_active_and_valid_plugins() {
    478498        $plugins = array();
     
    502522}
    503523
    504524/**
    505  * Sets internal encoding using mb_internal_encoding().
     525 * Sets internal encoding
    506526 *
    507527 * In most cases the default internal encoding is latin1, which is of no use,
    508528 * since we want to use the mb_ functions for utf-8 strings.
     
    519539}
    520540
    521541/**
    522  * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
     542 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER
    523543 *
    524544 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
    525545 * or $_ENV are needed, use those superglobals directly.
     
    572592}
    573593
    574594/**
    575  * Whether the current request is for a network or blog admin page
     595 * Whether the current request is for an administrative interface page
    576596 *
    577  * Does not inform on whether the user is an admin! Use capability checks to
    578  * 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.
    579599 *
    580600 * @since 1.5.1
    581601 *
    582  * @return bool True if inside WordPress administration pages.
     602 * @return bool True if inside WordPress administration interface, false otherwise
    583603 */
    584604function is_admin() {
    585605        if ( isset( $GLOBALS['current_screen'] ) )
     
    591611}
    592612
    593613/**
    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
    595615 *
    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/
    598617 *
     618 * Does not check if the user is an administrator; @see current_user_can()
     619 * for checking roles and capabilities.
     620 *
    599621 * @since 3.1.0
    600622 *
    601  * @return bool True if inside WordPress network administration pages.
     623 * @return bool True if inside WordPress blog administration pages.
    602624 */
    603625function is_blog_admin() {
    604626        if ( isset( $GLOBALS['current_screen'] ) )
     
    610632}
    611633
    612634/**
    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
    614636 *
    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/
    617638 *
     639 * Does not check if the user is an administrator; @see current_user_can()
     640 * for checking roles and capabilities.
     641 *
    618642 * @since 3.1.0
    619643 *
    620644 * @return bool True if inside WordPress network administration pages.
     
    629653}
    630654
    631655/**
    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
    633657 *
     658 * e.g. /wp-admin/user/
     659 *
    634660 * Does not inform on whether the user is an admin! Use capability checks to
    635661 * tell if the user should be accessing a section or not.
    636662 *
     
    648674}
    649675
    650676/**
    651  * Whether Multisite support is enabled
     677 * If multisite is enabled
    652678 *
    653679 * @since 3.0.0
    654680 *
     
    667693/**
    668694 * Retrieve the current blog id
    669695 *
     696 * @global int $blog_id
    670697 * @since 3.1.0
    671698 *
    672699 * @return int Blog id
     
    685712 * Designed for unusual load sequences (like setup-config.php) or for when the script will then
    686713 * terminate with an error, otherwise there is a risk that a file can be double-included.
    687714 *
     715 * @global $wp_locale the WordPress date and time locale object
    688716 * @since 3.4.0
    689717 * @access private
    690718 */
    691719function wp_load_translations_early() {
    692         global $text_direction, $wp_locale;
     720        global $wp_locale;
    693721
    694722        static $loaded = false;
    695723        if ( $loaded )