diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index f579e95..a78d4bc 100644
|
|
|
function wp_allow_comment( $commentdata ) { |
| 645 | 645 | * Allows checking for comment flooding. |
| 646 | 646 | * |
| 647 | 647 | * @since 2.3.0 |
| | 648 | * @since 4.6.0 $commentdata was added |
| 648 | 649 | * |
| 649 | 650 | * @param string $comment_author_IP Comment author's IP address. |
| 650 | 651 | * @param string $comment_author_email Comment author's email. |
| 651 | 652 | * @param string $comment_date_gmt GMT date the comment was posted. |
| | 653 | * @param array $commentdata Comment Data. |
| 652 | 654 | */ |
| 653 | 655 | do_action( |
| 654 | 656 | 'check_comment_flood', |
| 655 | 657 | $commentdata['comment_author_IP'], |
| 656 | 658 | $commentdata['comment_author_email'], |
| 657 | | $commentdata['comment_date_gmt'] |
| | 659 | $commentdata['comment_date_gmt'], |
| | 660 | $commentdata |
| 658 | 661 | ); |
| 659 | 662 | |
| 660 | 663 | if ( ! empty( $commentdata['user_id'] ) ) { |
| … |
… |
function wp_allow_comment( $commentdata ) { |
| 715 | 718 | * administrators. |
| 716 | 719 | * |
| 717 | 720 | * @since 2.3.0 |
| | 721 | * @since 4.6.0 $commentdata parameter added |
| 718 | 722 | * |
| 719 | 723 | * @global wpdb $wpdb WordPress database abstraction object. |
| 720 | 724 | * |
| 721 | 725 | * @param string $ip Comment IP. |
| 722 | 726 | * @param string $email Comment author email address. |
| 723 | 727 | * @param string $date MySQL time string. |
| | 728 | * @param array $commentdata Full Comment Data. |
| 724 | 729 | */ |
| 725 | | function check_comment_flood_db( $ip, $email, $date ) { |
| | 730 | function check_comment_flood_db( $ip, $email, $date, $commentdata ) { |
| 726 | 731 | global $wpdb; |
| | 732 | $comment_type = ! isset( $commentdata['comment_type'] ) ? '' : $commentdata['comment_type']; |
| | 733 | |
| 727 | 734 | // don't throttle admins or moderators |
| 728 | 735 | if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) { |
| 729 | 736 | return; |
| … |
… |
function check_comment_flood_db( $ip, $email, $date ) { |
| 752 | 759 | * Filter the comment flood status. |
| 753 | 760 | * |
| 754 | 761 | * @since 2.1.0 |
| | 762 | * @since 4.6.0 Add $comment_type. |
| 755 | 763 | * |
| 756 | 764 | * @param bool $bool Whether a comment flood is occurring. Default false. |
| 757 | 765 | * @param int $time_lastcomment Timestamp of when the last comment was posted. |
| 758 | 766 | * @param int $time_newcomment Timestamp of when the new comment was posted. |
| | 767 | * @param string $comment_type Comment Type. |
| 759 | 768 | */ |
| 760 | | $flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment ); |
| | 769 | $flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment, $comment_type ); |
| 761 | 770 | if ( $flood_die ) { |
| 762 | 771 | /** |
| 763 | 772 | * Fires before the comment flood message is triggered. |
| … |
… |
function wp_filter_comment($commentdata) { |
| 1683 | 1692 | * Whether a comment should be blocked because of comment flood. |
| 1684 | 1693 | * |
| 1685 | 1694 | * @since 2.1.0 |
| | 1695 | * @since 4.6.0 Add Comment Type. |
| 1686 | 1696 | * |
| 1687 | 1697 | * @param bool $block Whether plugin has already blocked comment. |
| 1688 | 1698 | * @param int $time_lastcomment Timestamp for last comment. |
| 1689 | 1699 | * @param int $time_newcomment Timestamp for new comment. |
| | 1700 | * @param string $comment_type Type of Comment. |
| 1690 | 1701 | * @return bool Whether comment should be blocked. |
| 1691 | 1702 | */ |
| 1692 | | function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) { |
| | 1703 | function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment, $comment_type) { |
| 1693 | 1704 | if ( $block ) // a plugin has already blocked... we'll let that decision stand |
| 1694 | 1705 | return $block; |
| 1695 | 1706 | if ( ($time_newcomment - $time_lastcomment) < 15 ) |
diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
index f7bfeb5..df79298 100644
|
|
|
add_filter( 'tiny_mce_before_init', '_mce_set_direction' ); |
| 190 | 190 | add_filter( 'teeny_mce_before_init', '_mce_set_direction' ); |
| 191 | 191 | add_filter( 'pre_kses', 'wp_pre_kses_less_than' ); |
| 192 | 192 | add_filter( 'sanitize_title', 'sanitize_title_with_dashes', 10, 3 ); |
| 193 | | add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 3 ); |
| 194 | | add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 3 ); |
| | 193 | add_action( 'check_comment_flood', 'check_comment_flood_db', 10, 4 ); |
| | 194 | add_filter( 'comment_flood_filter', 'wp_throttle_comment_flood', 10, 4 ); |
| 195 | 195 | add_filter( 'pre_comment_content', 'wp_rel_nofollow', 15 ); |
| 196 | 196 | add_filter( 'comment_email', 'antispambot' ); |
| 197 | 197 | add_filter( 'option_tag_base', '_wp_filter_taxonomy_base' ); |