- public static function text_add_link_callback( $m ) {
- // bare link?
- if ( $m[4] == $m[2] )
- return '<a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a>';
- else
- return '<span title="'.$m[2].'" class="comment-link"><a '.$m[1].' href="'.$m[2].'" '.$m[3].' class="comment-link">'.$m[4].'</a></span>';
- }
-
- public static function text_add_link_class( $comment_text ) {
- return preg_replace_callback( '#<a ([^>]*)href="([^"]+)"([^>]*)>(.*?)</a>#i', array( 'Akismet_Admin', 'text_add_link_callback' ), $comment_text );
- }
-
- public static function submit_spam_comment( $comment_id ) {
- global $wpdb, $current_user, $current_site;
-
- $comment_id = (int) $comment_id;
-
- $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ) );
-
- if ( !$comment ) // it was deleted
- return;
-
- if ( 'spam' != $comment->comment_approved )
- return;
-
- // use the original version stored in comment_meta if available
- $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true);
-
- if ( $as_submitted && is_array( $as_submitted ) && isset( $as_submitted['comment_content'] ) )
- $comment = (object) array_merge( (array)$comment, $as_submitted );
-
- $comment->blog = get_bloginfo('url');
- $comment->blog_lang = get_locale();
- $comment->blog_charset = get_option('blog_charset');
- $comment->permalink = get_permalink($comment->comment_post_ID);
-
- if ( is_object($current_user) )
- $comment->reporter = $current_user->user_login;
-
- if ( is_object($current_site) )
- $comment->site_domain = $current_site->domain;
-
- $comment->user_role = '';
- if ( isset( $comment->user_ID ) )
- $comment->user_role = Akismet::get_user_roles( $comment->user_ID );
-
- if ( Akismet::is_test_mode() )
- $comment->is_test = 'true';
-
- $post = get_post( $comment->comment_post_ID );
- $comment->comment_post_modified_gmt = $post->post_modified_gmt;
-
- $response = Akismet::http_post( http_build_query( $comment ), 'submit-spam' );
- if ( $comment->reporter ) {
- Akismet::update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam', 'akismet'), $comment->reporter ), 'report-spam' );
- update_comment_meta( $comment_id, 'akismet_user_result', 'true' );
- update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
- }
-
- do_action('akismet_submit_spam_comment', $comment_id, $response[1]);
- }
-
- public static function submit_nonspam_comment( $comment_id ) {
- global $wpdb, $current_user, $current_site;
-
- $comment_id = (int) $comment_id;
-
- $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $comment_id ) );
- if ( !$comment ) // it was deleted
- return;
-
- // use the original version stored in comment_meta if available
- $as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true);
-
- if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) )
- $comment = (object) array_merge( (array)$comment, $as_submitted );
-
- $comment->blog = get_bloginfo('url');
- $comment->blog_lang = get_locale();
- $comment->blog_charset = get_option('blog_charset');
- $comment->permalink = get_permalink( $comment->comment_post_ID );
- $comment->user_role = '';
-
- if ( is_object($current_user) )
- $comment->reporter = $current_user->user_login;
-
- if ( is_object($current_site) )
- $comment->site_domain = $current_site->domain;
-
- if ( isset( $comment->user_ID ) )
- $comment->user_role = Akismet::get_user_roles($comment->user_ID);
-
- if ( Akismet::is_test_mode() )
- $comment->is_test = 'true';
-
- $post = get_post( $comment->comment_post_ID );
- $comment->comment_post_modified_gmt = $post->post_modified_gmt;
-
- $response = Akismet::http_post( http_build_query( $comment ), 'submit-ham' );
- if ( $comment->reporter ) {
- Akismet::update_comment_history( $comment_id, sprintf( __('%s reported this comment as not spam', 'akismet'), $comment->reporter ), 'report-ham' );
- update_comment_meta( $comment_id, 'akismet_user_result', 'false' );
- update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );
- }
-
- do_action('akismet_submit_nonspam_comment', $comment_id, $response[1]);
- }
-