From de44d6b375de3e69bc0a77649584ecddf0002d14 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 11 Nov 2015 20:54:20 +0000 Subject: [PATCH] Remove non-translatable HTML code from the first post content in `populate_network()` and `wp_install_defaults()`. Add translator comment. Props ramiy. Fixes #34619. git-svn-id: https://develop.svn.wordpress.org/trunk@35614 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/schema.php | 3 ++- src/wp-admin/includes/upgrade.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 0dc3df913b..9b8baa47f1 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -983,7 +983,8 @@ We hope you enjoy your new site. Thanks! 'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ), 'wpmu_upgrade_site' => $wp_db_version, 'welcome_email' => $welcome_email, - 'first_post' => __( 'Welcome to SITE_NAME. This is your first post. Edit or delete it, then start blogging!' ), + /* translators: %s: site link */ + 'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start blogging!' ), // @todo - network admins should have a method of editing the network siteurl (used for cookie hash) 'siteurl' => get_option( 'siteurl' ) . '/', 'add_new_users' => '0', diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index be948639fc..521f492bfd 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -155,11 +155,18 @@ function wp_install_defaults( $user_id ) { if ( is_multisite() ) { $first_post = get_site_option( 'first_post' ); - if ( empty($first_post) ) - $first_post = __( 'Welcome to SITE_NAME. This is your first post. Edit or delete it, then start writing!' ); + if ( ! $first_post ) { + /* translators: %s: site link */ + $first_post = __( 'Welcome to %s. This is your first post. Edit or delete it, then start blogging!' ); + } - $first_post = str_replace( "SITE_URL", esc_url( network_home_url() ), $first_post ); - $first_post = str_replace( "SITE_NAME", get_current_site()->site_name, $first_post ); + $first_post = sprintf( $first_post, + sprintf( '%s', esc_url( network_home_url() ), get_current_site()->site_name ) + ); + + // Back-compat for pre-4.4 + $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post ); + $first_post = str_replace( 'SITE_NAME', get_current_site()->site_name, $first_post ); } else { $first_post = __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ); }