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.



git-svn-id: http://core.svn.wordpress.org/branches/3.4@21739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-09-04 20:31:14 +00:00
parent 88e30886f2
commit 2e7ff32b82
4 changed files with 25 additions and 16 deletions

View File

@ -2,6 +2,8 @@
/**
* Dashboard Administration Screen
*
* @internal This file should be parseable by PHP4.
*
* @package WordPress
* @subpackage Administration
*/
@ -32,7 +34,10 @@ else
$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>';
get_current_screen()->add_help_tab( array(
// Not using chaining here, so as to be parseable by PHP4.
$screen = get_current_screen();
$screen->add_help_tab( array(
'id' => 'overview',
'title' => __( 'Overview' ),
'content' => $help,
@ -43,7 +48,7 @@ get_current_screen()->add_help_tab( array(
$help = '<p>' . __('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>';
$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>';
get_current_screen()->add_help_tab( array(
$screen->add_help_tab( array(
'id' => 'help-navigation',
'title' => __('Navigation'),
'content' => $help,
@ -54,7 +59,7 @@ $help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options ta
$help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
$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>';
get_current_screen()->add_help_tab( array(
$screen->add_help_tab( array(
'id' => 'help-layout',
'title' => __('Layout'),
'content' => $help,
@ -78,7 +83,7 @@ if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
if ( current_user_can( 'edit_theme_options' ) )
$help .= '<p>' . __('<strong>Welcome</strong> - Shows links for some of the most common tasks when setting up a new site.') . '</p>';
get_current_screen()->add_help_tab( array(
$screen->add_help_tab( array(
'id' => 'help-content',
'title' => __('Content'),
'content' => $help,
@ -86,7 +91,7 @@ get_current_screen()->add_help_tab( array(
unset( $help );
get_current_screen()->set_help_sidebar(
$screen->set_help_sidebar(
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
'<p>' . __( '<a href="http://codex.wordpress.org/Dashboard_Screen" target="_blank">Documentation on Dashboard</a>' ) . '</p>' .
'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'

View File

@ -44,12 +44,14 @@ define('WP_DEBUG', false);
require(ABSPATH . WPINC . '/load.php');
require(ABSPATH . WPINC . '/version.php');
// Also loads functions.php, plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
wp_load_translations_early();
// Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions();
require_once(ABSPATH . WPINC . '/functions.php');
// Also loads plugin.php, l10n.php, pomo/mo.php (all required by setup-config.php)
wp_load_translations_early();
// Turn register_globals off.
wp_unregister_GLOBALS();
@ -217,9 +219,10 @@ switch($step) {
}
$key = 0;
foreach ( $config_file as &$line ) {
// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
foreach ( $config_file as $line_num => $line ) {
if ( '$table_prefix =' == substr( $line, 0, 16 ) ) {
$line = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
$config_file[ $line_num ] = '$table_prefix = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
continue;
}
@ -234,7 +237,7 @@ switch($step) {
case 'DB_USER' :
case 'DB_PASSWORD' :
case 'DB_HOST' :
$line = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
break;
case 'AUTH_KEY' :
case 'SECURE_AUTH_KEY' :
@ -244,7 +247,7 @@ switch($step) {
case 'SECURE_AUTH_SALT' :
case 'LOGGED_IN_SALT' :
case 'NONCE_SALT' :
$line = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
break;
}
}

View File

@ -105,12 +105,12 @@ function wp_check_php_mysql_versions() {
$php_version = phpversion();
if ( version_compare( $required_php_version, $php_version, '>' ) ) {
wp_load_translations_early();
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 ) );
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 ) );
}
if ( ! extension_loaded( 'mysql' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) {
wp_load_translations_early();
wp_die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) );
}
}
@ -685,7 +685,6 @@ function wp_load_translations_early() {
require_once ABSPATH . WPINC . '/locale.php';
// General libraries
require_once ABSPATH . WPINC . '/functions.php';
require_once ABSPATH . WPINC . '/plugin.php';
$locales = $locations = array();

View File

@ -48,8 +48,10 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) {
require_once( ABSPATH . WPINC . '/load.php' );
require_once( ABSPATH . WPINC . '/version.php' );
wp_load_translations_early();
wp_check_php_mysql_versions();
wp_load_translations_early();
require_once( ABSPATH . WPINC . '/functions.php' );
// Die with an error message
$die = __( "There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started." ) . '</p>';