Make WordPress Core

Ticket #24886: 24886.diff

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

     
    9292}
    9393
    9494/**
    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
    9696 *
    9797 * Dies if requirements are not met.
    9898 *
     99 * @uses wp_load_translations_early()
    99100 * @access private
    100101 * @since 3.0.0
    101102 */
     
    114115}
    115116
    116117/**
    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 *
    118120 * Instead, send the headers for a zero-length favicon and bail.
    119121 *
    120122 * @since 3.0.0
     
    128130}
    129131
    130132/**
    131  * Dies with a maintenance message when conditions are met.
     133 * Dies with a maintenance message when conditions are met
    132134 *
    133135 * Checks for a file in the WordPress root directory named ".maintenance".
    134136 * This file will contain the variable $upgrading, set to the time the file
     
    138140 * The default message can be replaced by using a drop-in (maintenance.php in
    139141 * the wp-content directory).
    140142 *
     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 *
    141147 * @access private
    142148 * @since 3.0.0
    143149 */
     
    182188}
    183189
    184190/**
    185  * PHP 5 standard microtime start capture.
     191 * Starts the WordPress microtimer
    186192 *
    187193 * @access private
     194 * @see timer_stop()
    188195 * @since 0.71
    189  * @global float $timestart Seconds from when function is called.
     196 *
    190197 * @return bool Always returns true.
    191198 */
    192199function timer_start() {
     
    196203}
    197204
    198205/**
    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
    200207 *
    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
    214209 * @since 0.71
    215  * @global float $timestart Seconds from when timer_start() is called
    216  * @global float $timeend Seconds from when function is called
    217210 *
    218  * @param int $display Use '0' or null to not echo anything and 1 to echo the total time
     211 * @param int $display Whether to output the time; truthy values will output, falsy values will not. Default is 0.
    219212 * @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
     213 * @return string The "second.microsecond" finished time calculation
    221214 */
    222 function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_stop(1), will echo $timetotal
     215function timer_stop( $display = 0, $precision = 3 ) {
    223216        global $timestart, $timeend;
    224217        $timeend = microtime( true );
    225218        $timetotal = $timeend - $timestart;
     
    230223}
    231224
    232225/**
    233  * Sets PHP error handling and handles WordPress debug mode.
     226 * Sets PHP error reporting based on WordPress debug settings
    234227 *
    235228 * 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.
    237230 *
    238  * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.
    239  * WP_DEBUG defaults to false.
    240  *
    241231 * 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,
     232 * internal notices: when a deprecated WordPress function, function argument,
    243233 * or file is used. Deprecated code may be removed from a later version.
    244234 *
    245235 * It is strongly recommended that plugin and theme developers use WP_DEBUG in their
    246236 * development environments.
    247237 *
     238 * WP_DEBUG_DISPLAY and WP_DEBUG_LOG perform no function unless WP_DEBUG is true.
     239 *
    248240 * When WP_DEBUG_DISPLAY is true, WordPress will force errors to be displayed.
    249241 * WP_DEBUG_DISPLAY defaults to true. Defining it as null prevents WordPress from
    250242 * changing the global configuration setting. Defining WP_DEBUG_DISPLAY as false
    251243 * will force errors to be hidden.
    252244 *
    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.
    255247 *
    256248 * Errors are never displayed for XML-RPC requests.
    257249 *
     
    279271}
    280272
    281273/**
    282  * Sets the location of the language directory.
     274 * Sets the location of the language directory
    283275 *
    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.
    285277 *
    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.
    290280 *
    291  * The WP_LANG_DIR constant was introduced in 2.1.0.
    292  *
    293281 * @access private
    294282 * @since 3.0.0
    295283 */
    296284function wp_set_lang_dir() {
    297285        if ( !defined( 'WP_LANG_DIR' ) ) {
    298286                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                         */
    299292                        define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
    300293                        if ( !defined( 'LANGDIR' ) ) {
    301294                                // Old static relative path maintained for limited backwards compatibility - won't work in some cases
    302295                                define( 'LANGDIR', 'wp-content/languages' );
    303296                        }
    304297                } else {
     298                        /**
     299                         * Server path of the language directory
     300                         *
     301                         * @since 2.1.0
     302                         */
    305303                        define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); // no leading slash, no trailing slash, full path, not relative to ABSPATH
    306304                        if ( !defined( 'LANGDIR' ) ) {
    307305                                // Old relative path maintained for backwards compatibility
     
    312310}
    313311
    314312/**
    315  * Load the correct database class file.
     313 * Load the database class file and instantiate the $wpdb global
    316314 *
    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  *
    321315 * @since 2.5.0
    322  * @global $wpdb WordPress Database Object
    323316 */
    324317function require_wp_db() {
    325318        global $wpdb;
     
    335328}
    336329
    337330/**
    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
    339332 *
    340333 * Columns not listed here default to %s.
    341334 *
     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
    342339 * @see wpdb::$field_types Since 2.8.0
    343340 * @see wpdb::prepare()
    344341 * @see wpdb::insert()
     
    370367}
    371368
    372369/**
    373  * Starts the WordPress object cache.
     370 * Starts the WordPress object cache
    374371 *
    375372 * If an object-cache.php file exists in the wp-content directory,
    376373 * it uses that drop-in as an external object cache.
    377374 *
     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()
    378379 * @access private
    379380 * @since 3.0.0
    380381 */
     
    413414}
    414415
    415416/**
    416  * Redirects to the installer if WordPress is not installed.
     417 * Redirect to the installer if WordPress is not installed
    417418 *
    418419 * Dies with an error message when multisite is enabled.
    419420 *
     421 * @uses is_multisite()
     422 * @uses wp_die()
     423 * @uses wp_guess_url()
     424 * @uses wp_redirect()
     425 *
    420426 * @access private
    421427 * @since 3.0.0
    422428 */
     
    437443}
    438444
    439445/**
    440  * Returns array of must-use plugin files to be included in global scope.
     446 * Returns array of must-use plugin files
    441447 *
    442448 * The default directory is wp-content/mu-plugins. To change the default directory
    443449 * manually, define <code>WPMU_PLUGIN_DIR</code> and <code>WPMU_PLUGIN_URL</code>
     
    464470}
    465471
    466472/**
    467  * Returns array of plugin files to be included in global scope.
     473 * Returns array of active and valid plugin files
    468474 *
     475 * While upgrading or installing WordPress, no plugins are returned.
     476 *
    469477 * The default directory is wp-content/plugins. To change the default directory
    470478 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code>
    471479 * in wp-config.php.
    472480 *
    473481 * @access private
    474482 * @since 3.0.0
    475  * @return array Files to include
     483 * @return array Files
    476484 */
    477485function wp_get_active_and_valid_plugins() {
    478486        $plugins = array();
     
    502510}
    503511
    504512/**
    505  * Sets internal encoding using mb_internal_encoding().
     513 * Sets internal encoding
    506514 *
    507515 * In most cases the default internal encoding is latin1, which is of no use,
    508516 * since we want to use the mb_ functions for utf-8 strings.
     
    519527}
    520528
    521529/**
    522  * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER.
     530 * Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER
    523531 *
    524532 * Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE,
    525533 * or $_ENV are needed, use those superglobals directly.
     
    572580}
    573581
    574582/**
    575  * Whether the current request is for a network or blog admin page
     583 * Whether the current request is for an administrative interface page
    576584 *
    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.
     585 * Does not check if the user is an administrator; @see current_user_can()
     586 * for checking roles and capabilities.
    579587 *
    580588 * @since 1.5.1
    581589 *
    582  * @return bool True if inside WordPress administration pages.
     590 * @return bool True if inside WordPress administration interface, false otherwise
    583591 */
    584592function is_admin() {
    585593        if ( isset( $GLOBALS['current_screen'] ) )
     
    591599}
    592600
    593601/**
    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
    595603 *
    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/
    598605 *
     606 * Does not check if the user is an administrator; @see current_user_can()
     607 * for checking roles and capabilities.
     608 *
    599609 * @since 3.1.0
    600610 *
    601  * @return bool True if inside WordPress network administration pages.
     611 * @return bool True if inside WordPress blog administration pages.
    602612 */
    603613function is_blog_admin() {
    604614        if ( isset( $GLOBALS['current_screen'] ) )
     
    610620}
    611621
    612622/**
    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
    614624 *
    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/
    617626 *
     627 * Does not check if the user is an administrator; @see current_user_can()
     628 * for checking roles and capabilities.
     629 *
    618630 * @since 3.1.0
    619631 *
    620632 * @return bool True if inside WordPress network administration pages.
     
    629641}
    630642
    631643/**
    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
    633645 *
     646 * e.g. /wp-admin/user/
     647 *
    634648 * Does not inform on whether the user is an admin! Use capability checks to
    635649 * tell if the user should be accessing a section or not.
    636650 *
     
    648662}
    649663
    650664/**
    651  * Whether Multisite support is enabled
     665 * If multisite is enabled
    652666 *
    653667 * @since 3.0.0
    654668 *