Make WordPress Core

Ticket #19251: 19251.diff

File 19251.diff, 1.7 KB (added by ryan, 13 years ago)
  • wp-includes/default-filters.php

     
    218218add_action( 'init',                'check_theme_switched',            99    );
    219219add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
    220220
    221 if ( isset( $_GET['replytocom'] ) )
    222     add_filter( 'pre_option_blog_public', '__return_zero' );
     221add_filter( 'option_blog_public', '_maybe_disallow_crawling' );
    223222
    224223// Login actions
    225224add_action( 'login_head',          'wp_print_head_scripts',         9     );
  • wp-includes/functions.php

     
    46334633        return $protocols;
    46344634}
    46354635
     4636/**
     4637 * Disallow crawling of particular pages for certain conditions.
     4638 *
     4639 * This function runs as a filter on option_blog_public. When the disallow_crawling
     4640 * filter returns true, the blog_public option will be set to 0 for the duration of the
     4641 * active request. blog_public is set to 0 only if it is currently set to 1. This avoids
     4642 * stomping custom values used by plugins.
     4643 *
     4644 * @param int $blog_public The current value of the blog_public option
     4645 * @return int The new blog_public value.
     4646 */
     4647function _maybe_disallow_crawling( $blog_public ) {
     4648        // By default, disallow crawling of replytocom requests.
     4649        $disallow = isset( $_GET['replytocom'] ) ? true : false;
     4650
     4651        $disallow = apply_filters( 'disallow_crawling', $disallow );
     4652
     4653        if ( ! $disallow )
     4654                return $blog_public;
     4655
     4656        return ( 1 !== (int) $blog_public ) ? $blog_public : 0;
     4657}
     4658
    46364659?>