Make WordPress Core

Ticket #59818: kitchin59818.alt.diff

File kitchin59818.alt.diff, 4.3 KB (added by kitchin, 2 years ago)

Alternate patch, not tested.

  • src/wp-admin/includes/dashboard.php

     
    371371
    372372        // Check if search engines are asked not to index this site.
    373373        if ( ! is_network_admin() && ! is_user_admin()
    374                 && current_user_can( 'manage_options' ) && ! get_option( 'blog_public' )
     374                && current_user_can( 'manage_options' ) && 1 !== get_option( 'blog_public' )
    375375        ) {
    376376
    377377                /**
  • src/wp-admin/options.php

     
    179179        $allowed_options['general'][] = 'default_role';
    180180
    181181        $allowed_options['writing']   = array_merge( $allowed_options['writing'], $mail_options );
    182         $allowed_options['writing'][] = 'ping_sites';
    183182
     183        if ( '1' === get_option( 'blog_public' ) ) {
     184                $allowed_options['writing'][] = 'ping_sites';
     185        }
     186
    184187        $allowed_options['media'][] = 'uploads_use_yearmonth_folders';
    185188
    186189        /*
  • src/wp-includes/comment.php

     
    31553155 * @return mixed Empty string if blog is not public, returns $sites, if site is public.
    31563156 */
    31573157function privacy_ping_filter( $sites ) {
    3158         if ( '0' != get_option( 'blog_public' ) ) {
     3158        if ( '1' === get_option( 'blog_public' ) ) {
    31593159                return $sites;
    31603160        } else {
    31613161                return '';
  • src/wp-includes/deprecated.php

     
    41454145        _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' );
    41464146
    41474147        // If the blog is not public, tell robots to go away.
    4148         if ( '0' == get_option( 'blog_public' ) ) {
     4148        if ( '1' !== get_option( 'blog_public' ) ) {
    41494149                wp_no_robots();
    41504150        }
    41514151}
     
    41664166function wp_no_robots() {
    41674167        _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' );
    41684168
    4169         if ( get_option( 'blog_public' ) ) {
     4169        if ( '1' === get_option( 'blog_public' ) ) {
    41704170                echo "<meta name='robots' content='noindex,follow' />\n";
    41714171                return;
    41724172        }
  • src/wp-includes/functions.php

     
    17071707        do_action( 'do_robotstxt' );
    17081708
    17091709        $output = "User-agent: *\n";
    1710         $public = get_option( 'blog_public' );
     1710        $public = (bool) get_option( 'blog_public' );
    17111711
    17121712        $site_url = parse_url( site_url() );
    17131713        $path     = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : '';
  • src/wp-includes/robots-template.php

     
    6868 * @return array Filtered robots directives.
    6969 */
    7070function wp_robots_noindex( array $robots ) {
    71         if ( ! get_option( 'blog_public' ) ) {
     71        if ( '1' !== get_option( 'blog_public' ) ) {
    7272                return wp_robots_no_robots( $robots );
    7373        }
    7474
     
    140140function wp_robots_no_robots( array $robots ) {
    141141        $robots['noindex'] = true;
    142142
    143         if ( get_option( 'blog_public' ) ) {
     143        if ( '1' === get_option( 'blog_public' ) ) {
    144144                $robots['follow'] = true;
    145145        } else {
    146146                $robots['nofollow'] = true;
     
    186186 * @return array Filtered robots directives.
    187187 */
    188188function wp_robots_max_image_preview_large( array $robots ) {
    189         if ( get_option( 'blog_public' ) ) {
     189        if ( '1' === get_option( 'blog_public' ) ) {
    190190                $robots['max-image-preview'] = 'large';
    191191        }
    192192        return $robots;
  • src/wp-signup.php

     
    199199
    200200                $blog_public_on_checked  = '';
    201201                $blog_public_off_checked = '';
    202         if ( isset( $_POST['blog_public'] ) && '0' === $_POST['blog_public'] ) {
     202        if ( isset( $_POST['blog_public'] ) && '1' !== $_POST['blog_public'] ) {
    203203                $blog_public_off_checked = 'checked="checked"';
    204204        } else {
    205205                $blog_public_on_checked = 'checked="checked"';