Ticket #34141: 34141.3.diff
File 34141.3.diff, 3.4 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-wp-xmlrpc-server.php
6234 6234 'X-Pingback-Forwarded-For' => $remote_ip, 6235 6235 ), 6236 6236 ); 6237 6237 6238 $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args ); 6238 $ linea= wp_remote_retrieve_body( $request );6239 $remote_source = wp_remote_retrieve_body( $request ); 6239 6240 6240 if ( ! $linea )6241 if ( ! $remote_source ) { 6241 6242 return $this->pingback_error( 16, __( 'The source URL does not exist.' ) ); 6243 } 6242 6244 6243 6245 /** 6244 6246 * Filter the pingback remote source. … … 6245 6247 * 6246 6248 * @since 2.5.0 6247 6249 * 6248 * @param string $ linea Response objectfor the page linked from.6249 * @param string $pagelinkedto URL of the page linked to.6250 * @param string $remote_source Response source for the page linked from. 6251 * @param string $pagelinkedto URL of the page linked to. 6250 6252 */ 6251 $ linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );6253 $remote_source = apply_filters( 'pre_remote_source', $remote_source, $pagelinkedto ); 6252 6254 6253 6255 // Work around bug in strip_tags(): 6254 $ linea = str_replace('<!DOC', '<DOC', $linea);6255 $ linea = preg_replace( '/[\r\n\t ]+/', ' ', $linea); // normalize spaces6256 $ linea = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea);6256 $remote_source = str_replace( '<!DOC', '<DOC', $remote_source ); 6257 $remote_source = preg_replace( '/[\r\n\t ]+/', ' ', $remote_source ); // normalize spaces 6258 $remote_source = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $remote_source ); 6257 6259 6258 preg_match( '|<title>([^<]*?)</title>|is', $linea, $matchtitle);6260 preg_match( '|<title>([^<]*?)</title>|is', $remote_source, $matchtitle ); 6259 6261 $title = $matchtitle[1]; 6260 6262 if ( empty( $title ) ) 6261 6263 return $this->pingback_error( 32, __('We cannot find a title on that page.' ) ); 6262 6264 6263 $ linea = strip_tags( $linea, '<a>' ); // just keep the tag we need6265 $remote_source = strip_tags( $remote_source, '<a>' ); // just keep the tag we need 6264 6266 6265 $p = explode( "\n\n", $ linea);6267 $p = explode( "\n\n", $remote_source ); 6266 6268 6267 6269 $preg_target = preg_quote($pagelinkedto, '|'); 6268 6270 … … 6310 6312 $this->escape($comment_content); 6311 6313 $comment_type = 'pingback'; 6312 6314 6313 $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');6315 $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type', 'remote_source' ); 6314 6316 6315 6317 $comment_ID = wp_new_comment($commentdata); 6316 6318 -
src/wp-includes/comment-functions.php
1740 1740 * 1741 1741 * @param int $comment_ID The comment ID. 1742 1742 * @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam. 1743 * @param array $commentdata Comment data. 1743 1744 */ 1744 do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] );1745 do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata ); 1745 1746 1746 1747 return $comment_ID; 1747 1748 }