Ticket #3491: 3491.diff

File 3491.diff, 1.6 KB (added by sorich87, 3 years ago)
Line 
1Index: xmlrpc.php
2===================================================================
3--- xmlrpc.php  (revision 15559)
4+++ xmlrpc.php  (working copy)
5@@ -3236,9 +3236,13 @@
6                $p = explode( "\n\n", $linea );
7 
8                $preg_target = preg_quote($pagelinkedto, '|');
9+               
10+               $extended_data = array();
11 
12                foreach ( $p as $para ) {
13                        if ( strpos($para, $pagelinkedto) !== false ) { // it exists, but is it a link?
14+                               $extended_data = apply_filters('pingback_extend_comment', $para, $args[0], $args[1]);
15+                               
16                                preg_match("|<a[^>]+?".$preg_target."[^>]*>([^>]+?)</a>|", $para, $context);
17 
18                                // If the URL isn't in a link context, keep looking
19@@ -3281,6 +3285,8 @@
20                $comment_type = 'pingback';
21 
22                $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_content', 'comment_type');
23+               
24+               $commentdata = array_merge($commentdata, $extended_data);
25 
26                $comment_ID = wp_new_comment($commentdata);
27                do_action('pingback_post', $comment_ID);
28Index: wp-trackback.php
29===================================================================
30--- wp-trackback.php    (revision 15559)
31+++ wp-trackback.php    (working copy)
32@@ -102,10 +102,12 @@
33                trackback_response(1, 'We already have a ping from that URL for this post.');
34 
35        $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type');
36+       
37+       $commentdata = apply_filters('trackback_extend_comment', $commentdata, $_POST);
38 
39        wp_new_comment($commentdata);
40 
41        do_action('trackback_post', $wpdb->insert_id);
42        trackback_response(0);
43 }
44-?>
45\ No newline at end of file
46+?>