~katiekitty/+junk/wordpress-byet

« back to all changes in this revision

Viewing changes to wp-includes/comment.php

  • Committer: kserver
  • Date: 2010-05-15 01:16:36 UTC
  • Revision ID: kserver@kserver-desktop-20100515011636-mnr1j7t637suptdq
Wordpress 2.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
 */
133
133
function &get_comment(&$comment, $output = OBJECT) {
134
134
        global $wpdb;
 
135
        $null = null;
135
136
 
136
137
        if ( empty($comment) ) {
137
138
                if ( isset($GLOBALS['comment']) )
146
147
                        $_comment = & $GLOBALS['comment'];
147
148
                } elseif ( ! $_comment = wp_cache_get($comment, 'comment') ) {
148
149
                        $_comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment));
 
150
                        if ( ! $_comment )
 
151
                                return $null;
149
152
                        wp_cache_add($_comment->comment_ID, $_comment, 'comment');
150
153
                }
151
154
        }
208
211
                $approved = "comment_approved = '1'";
209
212
        elseif ( 'spam' == $status )
210
213
                $approved = "comment_approved = 'spam'";
 
214
        elseif ( 'trash' == $status )
 
215
                $approved = "comment_approved = 'trash'";
211
216
        else
212
217
                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
213
218
 
359
364
        return $comment_count;
360
365
}
361
366
 
 
367
//
 
368
// Comment meta functions
 
369
//
 
370
 
 
371
/**
 
372
 * Add meta data field to a comment.
 
373
 *
 
374
 * @since 2.9
 
375
 * @uses add_metadata
 
376
 * @link http://codex.wordpress.org/Function_Reference/add_comment_meta
 
377
 *
 
378
 * @param int $comment_id Comment ID.
 
379
 * @param string $key Metadata name.
 
380
 * @param mixed $value Metadata value.
 
381
 * @param bool $unique Optional, default is false. Whether the same key should not be added.
 
382
 * @return bool False for failure. True for success.
 
383
 */
 
384
function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
 
385
        return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
 
386
}
 
387
 
 
388
/**
 
389
 * Remove metadata matching criteria from a comment.
 
390
 *
 
391
 * You can match based on the key, or key and value. Removing based on key and
 
392
 * value, will keep from removing duplicate metadata with the same key. It also
 
393
 * allows removing all metadata matching key, if needed.
 
394
 *
 
395
 * @since 2.9
 
396
 * @uses delete_metadata
 
397
 * @link http://codex.wordpress.org/Function_Reference/delete_comment_meta
 
398
 *
 
399
 * @param int $comment_id comment ID
 
400
 * @param string $meta_key Metadata name.
 
401
 * @param mixed $meta_value Optional. Metadata value.
 
402
 * @return bool False for failure. True for success.
 
403
 */
 
404
function delete_comment_meta($comment_id, $meta_key, $meta_value = '') {
 
405
        return delete_metadata('comment', $comment_id, $meta_key, $meta_value);
 
406
}
 
407
 
 
408
/**
 
409
 * Retrieve comment meta field for a comment.
 
410
 *
 
411
 * @since 2.9
 
412
 * @uses get_metadata
 
413
 * @link http://codex.wordpress.org/Function_Reference/get_comment_meta
 
414
 *
 
415
 * @param int $comment_id Comment ID.
 
416
 * @param string $key The meta key to retrieve.
 
417
 * @param bool $single Whether to return a single value.
 
418
 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
 
419
 *  is true.
 
420
 */
 
421
function get_comment_meta($comment_id, $key, $single = false) {
 
422
        return get_metadata('comment', $comment_id, $key, $single);
 
423
}
 
424
 
 
425
/**
 
426
 * Update comment meta field based on comment ID.
 
427
 *
 
428
 * Use the $prev_value parameter to differentiate between meta fields with the
 
429
 * same key and comment ID.
 
430
 *
 
431
 * If the meta field for the comment does not exist, it will be added.
 
432
 *
 
433
 * @since 2.9
 
434
 * @uses update_metadata
 
435
 * @link http://codex.wordpress.org/Function_Reference/update_comment_meta
 
436
 *
 
437
 * @param int $comment_id Comment ID.
 
438
 * @param string $key Metadata key.
 
439
 * @param mixed $value Metadata value.
 
440
 * @param mixed $prev_value Optional. Previous value to check before removing.
 
441
 * @return bool False on failure, true if success.
 
442
 */
 
443
function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') {
 
444
        return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value);
 
445
}
 
446
 
362
447
/**
363
448
 * Sanitizes the cookies sent to the user already.
364
449
 *
406
491
 
407
492
        // Simple duplicate check
408
493
        // expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
409
 
        $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$comment_author' ";
 
494
        $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved != 'trash' AND ( comment_author = '$comment_author' ";
410
495
        if ( $comment_author_email )
411
496
                $dupe .= "OR comment_author_email = '$comment_author_email' ";
412
497
        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
419
504
 
420
505
        do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
421
506
 
422
 
        if ( $user_id ) {
 
507
        if ( isset($user_id) && $user_id) {
423
508
                $userdata = get_userdata($user_id);
424
509
                $user = new WP_User($user_id);
425
510
                $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
463
548
        global $wpdb;
464
549
        if ( current_user_can( 'manage_options' ) )
465
550
                return; // don't throttle admins
466
 
        if ( $lasttime = $wpdb->get_var( $wpdb->prepare("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = %s OR comment_author_email = %s ORDER BY comment_date DESC LIMIT 1", $ip, $email) ) ) {
 
551
        $hour_ago = gmdate( 'Y-m-d H:i:s', time() - 3600 );
 
552
        if ( $lasttime = $wpdb->get_var( $wpdb->prepare( "SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( `comment_author_IP` = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1", $hour_ago, $ip, $email ) ) ) {
467
553
                $time_lastcomment = mysql2date('U', $lasttime, false);
468
554
                $time_newcomment  = mysql2date('U', $date, false);
469
555
                $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
623
709
function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {
624
710
        do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);
625
711
 
626
 
        if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) {
627
 
                foreach ( (array) $chars[1] as $char ) {
628
 
                        // If it's an encoded char in the normal ASCII set, reject
629
 
                        if ( 38 == $char )
630
 
                                continue; // Unless it's &
631
 
                        if ( $char < 128 )
632
 
                                return true;
633
 
                }
634
 
        }
635
 
 
636
712
        $mod_keys = trim( get_option('blacklist_keys') );
637
713
        if ( '' == $mod_keys )
638
714
                return false; // If moderation keys are empty
693
769
                return $count;
694
770
 
695
771
        $where = '';
696
 
        if( $post_id > 0 )
 
772
        if ( $post_id > 0 )
697
773
                $where = $wpdb->prepare( "WHERE comment_post_ID = %d", $post_id );
698
774
 
699
775
        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
700
776
 
701
777
        $total = 0;
702
 
        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
 
778
        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
703
779
        $known_types = array_keys( $approved );
704
780
        foreach( (array) $count as $row_num => $row ) {
705
 
                $total += $row['num_comments'];
 
781
                // Don't count post-trashed toward totals
 
782
                if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
 
783
                        $total += $row['num_comments'];
706
784
                if ( in_array( $row['comment_approved'], $known_types ) )
707
785
                        $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
708
786
        }
728
806
 * @since 2.0.0
729
807
 * @uses $wpdb
730
808
 * @uses do_action() Calls 'delete_comment' hook on comment ID
 
809
 * @uses do_action() Calls 'deleted_comment' hook on comment ID after deletion, on success
731
810
 * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter
732
811
 * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
733
812
 *
736
815
 */
737
816
function wp_delete_comment($comment_id) {
738
817
        global $wpdb;
 
818
        if (!$comment = get_comment($comment_id))
 
819
                return false;
 
820
 
 
821
        if (wp_get_comment_status($comment_id) != 'trash' && wp_get_comment_status($comment_id) != 'spam' && EMPTY_TRASH_DAYS > 0)
 
822
                return wp_trash_comment($comment_id);
 
823
 
739
824
        do_action('delete_comment', $comment_id);
740
825
 
741
 
        $comment = get_comment($comment_id);
742
 
 
743
 
        if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
744
 
                return false;
745
 
 
746
826
        // Move children up a level.
747
827
        $children = $wpdb->get_col( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment_id) );
748
828
        if ( !empty($children) ) {
750
830
                clean_comment_cache($children);
751
831
        }
752
832
 
 
833
        // Delete metadata
 
834
        $meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d ", $comment_id ) );
 
835
        if ( !empty($meta_ids) ) {
 
836
                do_action( 'delete_commentmeta', $meta_ids );
 
837
                $in_meta_ids = "'" . implode("', '", $meta_ids) . "'";
 
838
                $wpdb->query( "DELETE FROM $wpdb->commentmeta WHERE meta_id IN ($in_meta_ids)" );
 
839
                do_action( 'deleted_commentmeta', $meta_ids );
 
840
        }
 
841
 
 
842
        if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
 
843
                return false;
 
844
        do_action('deleted_comment', $comment_id);
 
845
 
753
846
        $post_id = $comment->comment_post_ID;
754
847
        if ( $post_id && $comment->comment_approved == 1 )
755
848
                wp_update_comment_count($post_id);
762
855
}
763
856
 
764
857
/**
 
858
 * Moves a comment to the Trash
 
859
 *
 
860
 * @since 2.9.0
 
861
 * @uses do_action() on 'trash_comment' before trashing
 
862
 * @uses do_action() on 'trashed_comment' after trashing
 
863
 *
 
864
 * @param int $comment_id Comment ID.
 
865
 * @return mixed False on failure
 
866
 */
 
867
function wp_trash_comment($comment_id) {
 
868
        if ( EMPTY_TRASH_DAYS == 0 )
 
869
                return wp_delete_comment($comment_id);
 
870
 
 
871
        if ( !$comment = get_comment($comment_id) )
 
872
                return false;
 
873
 
 
874
        do_action('trash_comment', $comment_id);
 
875
 
 
876
        if ( wp_set_comment_status($comment_id, 'trash') ) {
 
877
                add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);
 
878
                add_comment_meta($comment_id, '_wp_trash_meta_time', time() );
 
879
                do_action('trashed_comment', $comment_id);
 
880
                return true;
 
881
        }
 
882
 
 
883
        return false;
 
884
}
 
885
 
 
886
/**
 
887
 * Removes a comment from the Trash
 
888
 *
 
889
 * @since 2.9.0
 
890
 * @uses do_action() on 'untrash_comment' before untrashing
 
891
 * @uses do_action() on 'untrashed_comment' after untrashing
 
892
 *
 
893
 * @param int $comment_id Comment ID.
 
894
 * @return mixed False on failure
 
895
 */
 
896
function wp_untrash_comment($comment_id) {
 
897
        if ( ! (int)$comment_id )
 
898
                return false;
 
899
 
 
900
        do_action('untrash_comment', $comment_id);
 
901
 
 
902
        $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true);
 
903
        if ( empty($status) )
 
904
                $status = '0';
 
905
 
 
906
        if ( wp_set_comment_status($comment_id, $status) ) {
 
907
                delete_comment_meta($comment_id, '_wp_trash_meta_time');
 
908
                delete_comment_meta($comment_id, '_wp_trash_meta_status');
 
909
                do_action('untrashed_comment', $comment_id);
 
910
                return true;
 
911
        }
 
912
 
 
913
        return false;
 
914
}
 
915
 
 
916
/**
 
917
 * Marks a comment as Spam
 
918
 *
 
919
 * @since 2.9.0
 
920
 * @uses do_action() on 'spam_comment' before spamming
 
921
 * @uses do_action() on 'spammed_comment' after spamming
 
922
 *
 
923
 * @param int $comment_id Comment ID.
 
924
 * @return mixed False on failure
 
925
 */
 
926
function wp_spam_comment($comment_id) {
 
927
        if ( !$comment = get_comment($comment_id) )
 
928
                return false;
 
929
 
 
930
        do_action('spam_comment', $comment_id);
 
931
 
 
932
        if ( wp_set_comment_status($comment_id, 'spam') ) {
 
933
                add_comment_meta($comment_id, '_wp_trash_meta_status', $comment->comment_approved);
 
934
                do_action('spammed_comment', $comment_id);
 
935
                return true;
 
936
        }
 
937
 
 
938
        return false;
 
939
}
 
940
 
 
941
/**
 
942
 * Removes a comment from the Spam
 
943
 *
 
944
 * @since 2.9.0
 
945
 * @uses do_action() on 'unspam_comment' before unspamming
 
946
 * @uses do_action() on 'unspammed_comment' after unspamming
 
947
 *
 
948
 * @param int $comment_id Comment ID.
 
949
 * @return mixed False on failure
 
950
 */
 
951
function wp_unspam_comment($comment_id) {
 
952
        if ( ! (int)$comment_id )
 
953
                return false;
 
954
 
 
955
        do_action('unspam_comment', $comment_id);
 
956
 
 
957
        $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true);
 
958
        if ( empty($status) )
 
959
                $status = '0';
 
960
 
 
961
        if ( wp_set_comment_status($comment_id, $status) ) {
 
962
                delete_comment_meta($comment_id, '_wp_trash_meta_status');
 
963
                do_action('unspammed_comment', $comment_id);
 
964
                return true;
 
965
        }
 
966
 
 
967
        return false;
 
968
}
 
969
 
 
970
/**
765
971
 * The status of a comment by ID.
766
972
 *
767
973
 * @since 1.0.0
768
974
 *
769
975
 * @param int $comment_id Comment ID
770
 
 * @return string|bool Status might be 'deleted', 'approved', 'unapproved', 'spam'. False on failure.
 
976
 * @return string|bool Status might be 'trash', 'approved', 'unapproved', 'spam'. False on failure.
771
977
 */
772
978
function wp_get_comment_status($comment_id) {
773
979
        $comment = get_comment($comment_id);
777
983
        $approved = $comment->comment_approved;
778
984
 
779
985
        if ( $approved == NULL )
780
 
                return 'deleted';
 
986
                return false;
781
987
        elseif ( $approved == '1' )
782
988
                return 'approved';
783
989
        elseif ( $approved == '0' )
784
990
                return 'unapproved';
785
991
        elseif ( $approved == 'spam' )
786
992
                return 'spam';
 
993
        elseif ( $approved == 'trash' )
 
994
                return 'trash';
787
995
        else
788
996
                return false;
789
997
}
925
1133
 * @return array Parsed comment information.
926
1134
 */
927
1135
function wp_filter_comment($commentdata) {
928
 
        $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
 
1136
        if ( isset($commentdata['user_ID']) )
 
1137
                $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
 
1138
        elseif ( isset($commentdata['user_id']) )
 
1139
                $commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']);
929
1140
        $commentdata['comment_agent']        = apply_filters('pre_comment_user_agent', $commentdata['comment_agent']);
930
1141
        $commentdata['comment_author']       = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
931
1142
        $commentdata['comment_content']      = apply_filters('pre_comment_content', $commentdata['comment_content']);
976
1187
        $commentdata = apply_filters('preprocess_comment', $commentdata);
977
1188
 
978
1189
        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
979
 
        $commentdata['user_ID']         = (int) $commentdata['user_ID'];
 
1190
        if ( isset($commentdata['user_ID']) )
 
1191
                $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
 
1192
        elseif ( isset($commentdata['user_id']) )
 
1193
                $commentdata['user_id'] = (int) $commentdata['user_id'];
980
1194
 
981
 
        $commentdata['comment_parent'] = absint($commentdata['comment_parent']);
 
1195
        $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
982
1196
        $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
983
1197
        $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
984
1198
 
985
1199
        $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
986
 
        $commentdata['comment_agent']     = $_SERVER['HTTP_USER_AGENT'];
 
1200
        $commentdata['comment_agent']     = substr($_SERVER['HTTP_USER_AGENT'], 0, 254);
987
1201
 
988
1202
        $commentdata['comment_date']     = current_time('mysql');
989
1203
        $commentdata['comment_date_gmt'] = current_time('mysql', 1);
1002
1216
 
1003
1217
                $post = &get_post($commentdata['comment_post_ID']); // Don't notify if it's your own comment
1004
1218
 
1005
 
                if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_ID'] )
 
1219
                if ( get_option('comments_notify') && $commentdata['comment_approved'] && $post->post_author != $commentdata['user_id'] )
1006
1220
                        wp_notify_postauthor($comment_ID, $commentdata['comment_type']);
1007
1221
        }
1008
1222
 
1032
1246
        $status = '0';
1033
1247
        switch ( $comment_status ) {
1034
1248
                case 'hold':
 
1249
                case '0':
1035
1250
                        $status = '0';
1036
1251
                        break;
1037
1252
                case 'approve':
 
1253
                case '1':
1038
1254
                        $status = '1';
1039
1255
                        if ( get_option('comments_notify') ) {
1040
1256
                                $comment = get_comment($comment_id);
1044
1260
                case 'spam':
1045
1261
                        $status = 'spam';
1046
1262
                        break;
1047
 
                case 'delete':
1048
 
                        return wp_delete_comment($comment_id);
 
1263
                case 'trash':
 
1264
                        $status = 'trash';
1049
1265
                        break;
1050
1266
                default:
1051
1267
                        return false;
1052
1268
        }
1053
1269
 
 
1270
        $comment_old = wp_clone(get_comment($comment_id));
 
1271
 
1054
1272
        if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) {
1055
1273
                if ( $wp_error )
1056
1274
                        return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
1063
1281
        $comment = get_comment($comment_id);
1064
1282
 
1065
1283
        do_action('wp_set_comment_status', $comment_id, $comment_status);
1066
 
        wp_transition_comment_status($comment_status, $comment->comment_approved, $comment);
 
1284
        wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
1067
1285
 
1068
1286
        wp_update_comment_count($comment->comment_post_ID);
1069
1287
 
1089
1307
        $comment = get_comment($commentarr['comment_ID'], ARRAY_A);
1090
1308
 
1091
1309
        // Escape data pulled from DB.
1092
 
        $comment = $wpdb->escape($comment);
 
1310
        $comment = esc_sql($comment);
1093
1311
 
1094
1312
        $old_status = $comment['comment_approved'];
1095
1313
 
1309
1527
 
1310
1528
        // Do pingbacks
1311
1529
        while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
1312
 
                $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
 
1530
                $mid = $wpdb->get_var( "SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme' LIMIT 1");
 
1531
                do_action( 'delete_postmeta', $mid );
 
1532
                $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_id = %d", $mid ) );
 
1533
                do_action( 'deleted_postmeta', $mid );
1313
1534
                pingback($ping->post_content, $ping->ID);
1314
1535
        }
1315
1536
 
1316
1537
        // Do Enclosures
1317
1538
        while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
1318
 
                $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_encloseme';", $enclosure->ID) );
 
1539
                $mid = $wpdb->get_var( $wpdb->prepare("SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_encloseme'", $enclosure->ID) );
 
1540
                do_action( 'delete_postmeta', $mid );
 
1541
                $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE meta_id =  %d", $mid) );
 
1542
                do_action( 'deleted_postmeta', $mid );
1319
1543
                do_enclose($enclosure->post_content, $enclosure->ID);
1320
1544
        }
1321
1545
 
1457
1681
                        // using a timeout of 3 seconds should be enough to cover slow servers
1458
1682
                        $client = new IXR_Client($pingback_server_url);
1459
1683
                        $client->timeout = 3;
1460
 
                        $client->useragent .= ' -- WordPress/' . $wp_version;
1461
 
 
 
1684
                        $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom);
1462
1685
                        // when set to true, this outputs debug messages by itself
1463
1686
                        $client->debug = false;
1464
1687