Make WordPress Core

Changeset 21739


Ignore:
Timestamp:
09/04/2012 08:31:14 PM (14 years ago)
Author:
nacin
Message:

Ensure we are parseable by PHP4 until wp_check_php_mysql_versions() has a chance to run.

Merges [21715], [21716] to the 3.4 branch.
props SergeyBiryukov.
fixes #21316.

Location:
branches/3.4
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.4/wp-admin/index.php

    r20715 r21739  
    22/**
    33 * Dashboard Administration Screen
     4 *
     5 * @internal This file should be parseable by PHP4.
    46 *
    57 * @package WordPress
    … …  
    3335$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab in the upper corner.' ) . '</p>';
    3436
    35 get_current_screen()->add_help_tab( array(
     37// Not using chaining here, so as to be parseable by PHP4.
     38$screen = get_current_screen();
     39
     40$screen->add_help_tab( array(
    3641        'id'      => 'overview',
    3742        'title'   => __( 'Overview' ),
    … …  
    4449$help .= '<p>' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '</p>';
    4550
    46 get_current_screen()->add_help_tab( array(
     51$screen->add_help_tab( array(
    4752        'id'      => 'help-navigation',
    4853        'title'   => __('Navigation'),
    … …  
    5560$help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
    5661
    57 get_current_screen()->add_help_tab( array(
     62$screen->add_help_tab( array(
    5863        'id'      => 'help-layout',
    5964        'title'   => __('Layout'),
    … …  
    7984        $help .= '<p>' . __('<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.') . '</p>';
    8085
    81 get_current_screen()->add_help_tab( array(
     86$screen->add_help_tab( array(
    8287        'id'      => 'help-content',
    8388        'title'   => __('Content'),
    … …  
    8792unset( $help );
    8893
    89 get_current_screen()->set_help_sidebar(
     94$screen->set_help_sidebar(
    9095        '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    9196        '<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
  • branches/3.4/wp-admin/setup-config.php

    r20661 r21739  
    4545require(ABSPATH . WPINC . '/version.php');
    4646
    47 // Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
    48 wp_load_translations_early();
    49 
    5047// Check for the required PHP version and for the MySQL extension or a database drop-in.
    5148wp_check_php_mysql_versions();
     49
     50require_once(ABSPATH . WPINC . '/functions.php');
     51
     52// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
     53wp_load_translations_early();
    5254
    5355// Turn register_globals off.
    … …  
    218220
    219221        $key = 0;
    220         foreach ( $config_file as &$line ) {
     222        // Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
     223        foreach ( $config_file as $line_num => $line ) {
    221224                if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
    222                         $line = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
     225                        $config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
    223226                        continue;
    224227                }
    … …  
    235238                        case 'DB_PASSWORD' :
    236239                        case 'DB_HOST'     :
    237                                 $line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
     240                                $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
    238241                                break;
    239242                        case 'AUTH_KEY'         :
    … …  
    245248                        case 'LOGGED_IN_SALT'   :
    246249                        case 'NONCE_SALT'       :
    247                                 $line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
     250                                $config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
    248251                                break;
    249252                }
  • branches/3.4/wp-includes/load.php

    r19862 r21739  
    106106        if ( version_compare( $required_php_version, $php_version, '>' ) ) {
    107107                wp_load_translations_early();
    108                 wp_die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
     108                die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) );
    109109        }
    110110
    111111        if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
    112112                wp_load_translations_early();
    113                 wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
     113                die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
    114114        }
    115115}
    … …  
    686686
    687687        // General libraries
    688         require_once ABSPATH . WPINC . '/functions.php';
    689688        require_once ABSPATH . WPINC . '/plugin.php';
    690689
  • branches/3.4/wp-load.php

    r20561 r21739  
    4949        require_once( ABSPATH . WPINC . '/version.php' );
    5050
     51        wp_check_php_mysql_versions();
    5152        wp_load_translations_early();
    52         wp_check_php_mysql_versions();
     53
     54        require_once( ABSPATH . WPINC . '/functions.php' );
    5355
    5456        // Die with an error message
Note: See TracChangeset for help on using the changeset viewer.