Ticket #5578: comment.phpdoc.diff
| File comment.phpdoc.diff, 6.1 KB (added by , 18 years ago) |
|---|
-
comment.php
8 8 /** 9 9 * check_comment() - Checks whether a comment passes internal checks to be allowed to add 10 10 * 11 * {@internal Missing Long Description}} 11 * If comment moderation is set in the administration, then all comments, regardless 12 * of their type and whitelist will be set to false. 12 13 * 14 * If the number of links exceeds the amount in the administration, then the check 15 * fails. 16 * 17 * If any of the parameter contents match the blacklist of words, then the check 18 * fails. 19 * 20 * If the comment is a trackback and part of the blogroll, then the trackback is 21 * automatically whitelisted. If the comment author was approved before, then the 22 * comment is automatically whitelisted. 23 * 24 * If none of the checks fail, then the failback is to set the check to pass (return 25 * true). 26 * 13 27 * @since 1.2 14 28 * @uses $wpdb 15 29 * 16 * @param string $author {@internal Missing Description }}17 * @param string $email {@internal Missing Description }}18 * @param string $url {@internal Missing Description }}19 * @param string $comment {@internal Missing Description }}20 * @param string $user_ip {@internal Missing Description }}21 * @param string $user_agent {@internal Missing Description }}22 * @param string $comment_type {@internal Missing Description }}23 * @return bool {@internal Missing Description }}30 * @param string $author Comment Author's name 31 * @param string $email Comment Author's email 32 * @param string $url Comment Author's URL 33 * @param string $comment Comment contents 34 * @param string $user_ip Comment Author's IP address 35 * @param string $user_agent Comment Author's User Agent 36 * @param string $comment_type Comment type, either user submitted comment, trackback, or pingback 37 * @return bool Whether the checks passed (true) and the comments should be displayed or set to moderated 24 38 */ 25 39 function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) { 26 40 global $wpdb; … … 170 184 $query .= " AND comment_approved = '1'"; 171 185 $myrow = $wpdb->get_row($query, ARRAY_A); 172 186 } else { 173 $myrow['comment_ID'] = $postc->comment_ID;174 $myrow['comment_post_ID'] = $postc->comment_post_ID;175 $myrow['comment_author'] = $postc->comment_author;176 $myrow['comment_author_email'] = $postc->comment_author_email;177 $myrow['comment_author_url'] = $postc->comment_author_url;178 $myrow['comment_author_IP'] = $postc->comment_author_IP;179 $myrow['comment_date'] = $postc->comment_date;180 $myrow['comment_content'] = $postc->comment_content;181 $myrow['comment_karma'] = $postc->comment_karma;182 $myrow['comment_approved'] = $postc->comment_approved;183 $myrow['comment_type'] = $postc->comment_type;187 $myrow['comment_ID'] = $postc->comment_ID; 188 $myrow['comment_post_ID'] = $postc->comment_post_ID; 189 $myrow['comment_author'] = $postc->comment_author; 190 $myrow['comment_author_email'] = $postc->comment_author_email; 191 $myrow['comment_author_url'] = $postc->comment_author_url; 192 $myrow['comment_author_IP'] = $postc->comment_author_IP; 193 $myrow['comment_date'] = $postc->comment_date; 194 $myrow['comment_content'] = $postc->comment_content; 195 $myrow['comment_karma'] = $postc->comment_karma; 196 $myrow['comment_approved'] = $postc->comment_approved; 197 $myrow['comment_type'] = $postc->comment_type; 184 198 } 185 199 return $myrow; 186 200 } … … 228 242 * @since 2.0.0 229 243 * @uses $wpdb 230 244 * 231 * @param int $post_id Optional. Comment amount in post if > 0, else total com 232 ments blog wide 245 * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide 233 246 * @return array The amount of spam, approved, awaiting moderation, and total 234 247 */ 235 248 function get_comment_count( $post_id = 0 ) { … … 249 262 GROUP BY comment_approved 250 263 ", ARRAY_A); 251 264 252 $comment_count = array( 253 "approved" => 0,254 "awaiting_moderation" => 0,255 "spam" => 0,256 "total_comments" => 0265 $comment_count = array( 266 "approved" => 0, 267 "awaiting_moderation" => 0, 268 "spam" => 0, 269 "total_comments" => 0 257 270 ); 258 271 259 foreach ( $totals as $row ) { 260 switch ( $row['comment_approved'] ) { 261 case 'spam': 262 $comment_count['spam'] = $row['total']; 272 foreach ( $totals as $row ) { 273 switch ( $row['comment_approved'] ) { 274 case 'spam': 275 $comment_count['spam'] = $row['total']; 263 276 $comment_count["total_comments"] += $row['total']; 264 break; 265 case 1: 266 $comment_count['approved'] = $row['total']; 277 break; 278 case 1: 279 $comment_count['approved'] = $row['total']; 267 280 $comment_count['total_comments'] += $row['total']; 268 break; 281 break; 269 282 case 0: 270 283 $comment_count['awaiting_moderation'] = $row['total']; 271 284 $comment_count['total_comments'] += $row['total']; … … 786 799 */ 787 800 function wp_defer_comment_counting($defer=null) { 788 801 static $_defer = false; 789 802 790 803 if ( is_bool($defer) ) { 791 804 $_defer = $defer; 792 805 // flush any deferred counts 793 806 if ( !$defer ) 794 807 wp_update_comment_count( null, true ); 795 808 } 796 809 797 810 return $_defer; 798 811 } 799 812 … … 817 830 */ 818 831 function wp_update_comment_count($post_id, $do_deferred=false) { 819 832 static $_deferred = array(); 820 833 821 834 if ( $do_deferred ) { 822 835 $_deferred = array_unique($_deferred); 823 836 foreach ( $_deferred as $i => $_post_id ) { … … 825 838 unset( $_deferred[$i] ); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */ 826 839 } 827 840 } 828 841 829 842 if ( wp_defer_comment_counting() ) { 830 843 $_deferred[] = $post_id; 831 844 return true; … … 833 846 elseif ( $post_id ) { 834 847 return wp_update_comment_count_now($post_id); 835 848 } 836 849 837 850 } 838 851 839 852 /** … … 1028 1041 $excerpt = str_replace(']]>', ']]>', $excerpt); 1029 1042 $excerpt = strip_tags($excerpt); 1030 1043 if ( function_exists('mb_strcut') ) // For international trackbacks 1031 $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...';1044 $excerpt = mb_strcut($excerpt, 0, 252, get_option('blog_charset')) . '...'; 1032 1045 else 1033 1046 $excerpt = substr($excerpt, 0, 252) . '...'; 1034 1047