// Check if the page linked to is on our site.
$pos1 =
strpos( $pagelinkedto,
str_replace( array
( 'http://www.', 'http://', 'https://www.', 'https://'
), '',
get_option( 'home'
) ) );
if ( !
$pos1 ) { return $this->
pingback_error( 0,
__( 'Is there no link to us?'
) );
} /*
* Let's find which post is linked to.
* FIXME: Does url_to_postid() cover all these cases already?
* If so, then let's use it and drop the old code.
*/
$urltest =
parse_url( $pagelinkedto );
$post_id =
url_to_postid( $pagelinkedto );
if ( $post_id ) { // $way
} elseif ( isset( $urltest['path'
] ) &&
preg_match( '#p/[0-9]{1,}#',
$urltest['path'
],
$match ) ) { // The path defines the post_ID (archives/p/XXXX).
$blah =
explode( '/',
$match[0
] );
$post_id =
(int) $blah[1
];
} elseif ( isset( $urltest['query'
] ) &&
preg_match( '#p=[0-9]{1,}#',
$urltest['query'
],
$match ) ) { // The query string defines the post_ID (?p=XXXX).
$blah =
explode( '=',
$match[0
] );
$post_id =
(int) $blah[1
];
}