Make WordPress Core

Ticket #11684: comment-moderation.3.patch

File comment-moderation.3.patch, 904 bytes (added by scribu, 15 years ago)

Use the 'i' (case-insensitive) regex modifier

  • comment.php

     
    4545        if ( 1 == get_option('comment_moderation') )
    4646                return false; // If moderation is set to manual
    4747
    48         if ( get_option('comment_max_links') && preg_match_all("/<[Aa][^>]*[Hh][Rr][Ee][Ff]=['\"]([^\"'>]+)[^>]*>/", apply_filters('comment_text',$comment), $out) >= get_option('comment_max_links') )
    49                 return false; // Check # of external links
     48        // Check # of external links
     49        if ( get_option('comment_max_links') ) {
     50                $links = preg_match_all("/<a[^>]+href=['\"]([^\"'>]+)[^>]*>/i", apply_filters('comment_text',$comment), $out);
     51                if ( 0 != strlen($url) )
     52                        $links += 1;
     53                if ( $links >= get_option('comment_max_links') )
     54                        return false;
     55        }
    5056
    5157        $mod_keys = trim(get_option('moderation_keys'));
    5258        if ( !empty($mod_keys) ) {