Make WordPress Core

Ticket #45151: 45151.6.diff

File 45151.6.diff, 6.4 KB (added by dd32, 7 years ago)
  • wp-admin/includes/upgrade.php

    function wp_install_defaults( $user_id ) 
    147147        }
    148148
    149149        $wpdb->insert( $wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
    150150        $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
    151151        $cat_tt_id = $wpdb->insert_id;
    152152
    153153        // First post
    154154        $now = current_time( 'mysql' );
    155155        $now_gmt = current_time( 'mysql', 1 );
    156156        $first_post_guid = get_option( 'home' ) . '/?p=1';
    157157
    158158        if ( is_multisite() ) {
    159159                $first_post = get_site_option( 'first_post' );
    160160
    161161                if ( ! $first_post ) {
    162                         /* translators: %s: site link */
    163                         $first_post = __( '<!-- wp:paragraph -->
    164 <p>Welcome to %s. This is your first post. Edit or delete it, then start writing!</p>
    165 <!-- /wp:paragraph -->' );
     162                        $first_post = "<!-- wp:paragraph -->\n<p>" .
     163                                /* translators: %s: site link */
     164                                __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) .
     165                                "</p>\n<!-- /wp:paragraph -->";
    166166                }
    167167
    168168                $first_post = sprintf( $first_post,
    169169                        sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_network()->site_name )
    170170                );
    171171
    172172                // Back-compat for pre-4.4
    173173                $first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post );
    174174                $first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post );
    175175        } else {
    176                 $first_post = __( '<!-- wp:paragraph -->
    177 <p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!</p>
    178 <!-- /wp:paragraph -->' );
     176                $first_post = "<!-- wp:paragraph -->\n<p>" .
     177                        __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) .
     178                        "</p>\n<!-- /wp:paragraph -->";
    179179        }
    180180
    181181        $wpdb->insert( $wpdb->posts, array(
    182182                'post_author' => $user_id,
    183183                'post_date' => $now,
    184184                'post_date_gmt' => $now_gmt,
    185185                'post_content' => $first_post,
    186186                'post_excerpt' => '',
    187187                'post_title' => __('Hello world!'),
    188188                /* translators: Default post slug */
    189189                'post_name' => sanitize_title( _x('hello-world', 'Default post slug') ),
    190190                'post_modified' => $now,
    191191                'post_modified_gmt' => $now_gmt,
    192192                'guid' => $first_post_guid,
    193193                'comment_count' => 1,
    To get started with moderating, editing, 
    213213Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.' );
    214214        $wpdb->insert( $wpdb->comments, array(
    215215                'comment_post_ID' => 1,
    216216                'comment_author' => $first_comment_author,
    217217                'comment_author_email' => $first_comment_email,
    218218                'comment_author_url' => $first_comment_url,
    219219                'comment_date' => $now,
    220220                'comment_date_gmt' => $now_gmt,
    221221                'comment_content' => $first_comment
    222222        ));
    223223
    224224        // First Page
    225225        if ( is_multisite() )
    226226                $first_page = get_site_option( 'first_page' );
    227227
    228         $first_page = ! empty( $first_page ) ? $first_page : sprintf( __( "<!-- wp:paragraph -->
    229 <p>This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:</p>
    230 <!-- /wp:paragraph -->
    231 
    232 <!-- wp:quote -->
    233 <blockquote class=\"wp-block-quote\"><p>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like pi&#241;a coladas. (And gettin' caught in the rain.)</p></blockquote>
    234 <!-- /wp:quote -->
    235 
    236 <!-- wp:paragraph -->
    237 <p>...or something like this:</p>
    238 <!-- /wp:paragraph -->
    239 
    240 <!-- wp:quote -->
    241 <blockquote class=\"wp-block-quote\"><p>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.</p></blockquote>
    242 <!-- /wp:quote -->
    243 
    244 <!-- wp:paragraph -->
    245 <p>As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to delete this page and create new pages for your content. Have fun!</p>
    246 <!-- /wp:paragraph -->" ), admin_url() );
     228        if ( empty( $first_page ) ) {
     229                $first_page = "<!-- wp:paragraph -->\n<p>";
     230                $first_page .= __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:" );
     231                $first_page .= "</p>\n<!-- /wp:paragraph -->\n\n";
     232
     233                $first_page .= "<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>";
     234                $first_page .= __( "Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like pi&#241;a coladas. (And gettin' caught in the rain.)" );
     235                $first_page .= "</p></blockquote>\n<!-- /wp:quote -->\n\n";
     236
     237                $first_page .= "<!-- wp:paragraph -->\n<p>";
     238                $first_page .= __( '...or something like this:' );
     239                $first_page .= "</p>\n<!-- /wp:paragraph -->\n\n";
     240
     241                $first_page .= "<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>";
     242                $first_page .= __( 'The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.' );
     243                $first_page .= "</p></blockquote>\n<!-- /wp:quote -->\n\n";
     244
     245                $first_page .= "<!-- wp:paragraph -->\n<p>";
     246                $first_page .= sprintf(
     247                        /* translators: %s:  Site admin URL */
     248                        __( 'As a new WordPress user, you should go to <a href="%s">your dashboard</a> to delete this page and create new pages for your content. Have fun!' ),
     249                        admin_url()
     250                );
     251                $first_page .= "</p>\n<!-- /wp:paragraph -->";
     252        }
    247253
    248254        $first_post_guid = get_option('home') . '/?page_id=2';
    249255        $wpdb->insert( $wpdb->posts, array(
    250256                'post_author' => $user_id,
    251257                'post_date' => $now,
    252258                'post_date_gmt' => $now_gmt,
    253259                'post_content' => $first_page,
    254260                'post_excerpt' => '',
    255261                'comment_status' => 'closed',
    256262                'post_title' => __( 'Sample Page' ),
    257263                /* translators: Default page slug */
    258264                'post_name' => __( 'sample-page' ),
    259265                'post_modified' => $now,
    260266                'post_modified_gmt' => $now_gmt,
    261267                'guid' => $first_post_guid,