Fix Pings/Trackback comment table filter. Props greuben. Fixes #15885
git-svn-id: http://svn.automattic.com/wordpress/trunk@17052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9d139a36c5
commit
e442dd64f0
|
@ -305,10 +305,13 @@ class WP_Comment_Query {
|
|||
$where .= $wpdb->prepare( ' AND comment_author_email = %s', $author_email );
|
||||
if ( '' !== $karma )
|
||||
$where .= $wpdb->prepare( ' AND comment_karma = %d', $karma );
|
||||
if ( 'comment' == $type )
|
||||
if ( 'comment' == $type ) {
|
||||
$where .= " AND comment_type = ''";
|
||||
elseif ( ! empty( $type ) )
|
||||
} elseif( 'pings' == $type ) {
|
||||
$where .= ' AND comment_type IN ("pingback", "trackback")';
|
||||
} elseif ( ! empty( $type ) ) {
|
||||
$where .= $wpdb->prepare( ' AND comment_type = %s', $type );
|
||||
}
|
||||
if ( '' !== $parent )
|
||||
$where .= $wpdb->prepare( ' AND comment_parent = %d', $parent );
|
||||
if ( '' !== $user_id )
|
||||
|
@ -1759,7 +1762,7 @@ function pingback($content, $post_ID) {
|
|||
$post_links = array();
|
||||
|
||||
$pung = get_pung($post_ID);
|
||||
|
||||
var_Dump(compact('pung'));
|
||||
// Variables
|
||||
$ltrs = '\w';
|
||||
$gunk = '/#~:.?+=&%@!\-';
|
||||
|
@ -1782,7 +1785,7 @@ function pingback($content, $post_ID) {
|
|||
// We don't wanna ping first and second types, even if they have a valid <link/>
|
||||
|
||||
foreach ( (array) $post_links_temp[0] as $link_test ) :
|
||||
if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
|
||||
if ( !in_array($link_test, $pung) && !in_array($link_test, $post_links) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
|
||||
&& !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
|
||||
if ( $test = @parse_url($link_test) ) {
|
||||
if ( isset($test['query']) )
|
||||
|
@ -1792,11 +1795,12 @@ function pingback($content, $post_ID) {
|
|||
}
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
var_dump(compact('post_links', 'post_links_temp'));
|
||||
do_action_ref_array('pre_ping', array(&$post_links, &$pung));
|
||||
|
||||
foreach ( (array) $post_links as $pagelinkedto ) {
|
||||
$pingback_server_url = discover_pingback_server_uri( $pagelinkedto );
|
||||
var_dump(compact('pagelinkedto', 'pingback_server_url'));
|
||||
|
||||
if ( $pingback_server_url ) {
|
||||
@ set_time_limit( 60 );
|
||||
|
@ -1805,13 +1809,15 @@ function pingback($content, $post_ID) {
|
|||
|
||||
// using a timeout of 3 seconds should be enough to cover slow servers
|
||||
$client = new WP_HTTP_IXR_Client($pingback_server_url);
|
||||
$client->timeout = 3;
|
||||
$client->timeout = 5;
|
||||
$client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . $wp_version, $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom);
|
||||
// when set to true, this outputs debug messages by itself
|
||||
$client->debug = false;
|
||||
$client->debug = true;
|
||||
|
||||
if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered
|
||||
add_ping( $post_ID, $pagelinkedto );
|
||||
var_Dump($client);
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue