WordPress.org

Make WordPress Core

Ticket #37319: comment.php.14.patch

File comment.php.14.patch, 1.4 KB (added by pbearne, 4 years ago)

comment and new filter that is usefull

  • src/wp-includes/comment.php

     
    5151                $num_links = preg_match_all( '/<a [^>]*href/i', $comment, $out );
    5252
    5353                /**
    54                  * Filters the maximum number of links allowed in a comment.
     54                 * Filters the number of links found in the comment.
    5555                 *
    5656                 * @since 3.0.0
    5757                 *
    58                  * @param int    $num_links The number of links allowed.
     58                 * @param int    $num_links The number of links found in the comment.
    5959                 * @param string $url       Comment author's URL. Included in allowed links total.
    6060                 */
    6161                $num_links = apply_filters( 'comment_max_links_url', $num_links, $url );
    6262
     63                /**
     64                 * Filters the number of links found in the comment.
     65                 *
     66                 * @since 4.7.0
     67                 *
     68                 * @param int    $num_links         The number of links found in the comment.
     69                 * @param string $comment           Comment author's URL. Included in allowed links total.
     70                 * @param array  $function_args     All the args passed to the function ( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type )
     71                 */
     72                $num_links = apply_filters( 'links_found_in_comment', $num_links, $comment, func_get_args() );
     73
     74
    6375                /*
    6476                 * If the number of links in the comment exceeds the allowed amount,
    6577                 * fail the check by returning false.