Changeset 29763
- Timestamp:
- 09/23/2014 06:48:31 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r29762 r29763 40 40 global $wpdb; 41 41 42 // If manual moderation is enabled, skip all checks and return false. 42 43 if ( 1 == get_option('comment_moderation') ) 43 return false; // If moderation is set to manual44 return false; 44 45 45 46 /** This filter is documented in wp-includes/comment-template.php */ 46 47 $comment = apply_filters( 'comment_text', $comment ); 47 48 48 // Check # of external links49 // Check for the number of external links if a max allowed number is set. 49 50 if ( $max_links = get_option( 'comment_max_links' ) ) { 50 51 $num_links = preg_match_all( '/<a [^>]*href/i', $comment, $out ); 52 51 53 /** 52 54 * Filter the maximum number of links allowed in a comment. … … 58 60 */ 59 61 $num_links = apply_filters( 'comment_max_links_url', $num_links, $url ); 62 63 /* 64 * If the number of links in the comment exceeds the allowed amount, 65 * fail the check by returning false. 66 */ 60 67 if ( $num_links >= $max_links ) 61 68 return false; … … 63 70 64 71 $mod_keys = trim(get_option('moderation_keys')); 72 73 // If moderation 'keys' (keywords) are set, process them. 65 74 if ( !empty($mod_keys) ) { 66 75 $words = explode("\n", $mod_keys ); … … 69 78 $word = trim($word); 70 79 71 // Skip empty lines 80 // Skip empty lines. 72 81 if ( empty($word) ) 73 82 continue; 74 83 75 // Do some escaping magic so that '#' chars in the 76 // spam words don't break things: 84 /* 85 * Do some escaping magic so that '#' (number of) characters in the spam 86 * words don't break things: 87 */ 77 88 $word = preg_quote($word, '#'); 78 89 90 /* 91 * Check the comment fields for moderation keywords. If any are found, 92 * fail the check for the given field by returning false. 93 */ 79 94 $pattern = "#$word#i"; 80 95 if ( preg_match($pattern, $author) ) return false; … … 87 102 } 88 103 89 // Comment whitelisting: 104 /* 105 * Check if the option to approve comments by previously-approved authors is enabled. 106 * 107 * If it is enabled, check whether the comment author has a previously-approved comment, 108 * as well as whether there are any moderation keywords (if set) present in the author 109 * email address. If both checks pass, return true. Otherwise, return false. 110 */ 90 111 if ( 1 == get_option('comment_whitelist')) { 91 112 if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) {
Note: See TracChangeset
for help on using the changeset viewer.