function linkback_get_source($source, $target) {
// Check if we are pinging ourselves and ignore
$localprefix = common_config('site', 'server') . '/' . common_config('site', 'path');
- if(linkback_lenient_target_match($source, $localprefix)) {
+ if(linkback_lenient_target_match($source, $localprefix) === 0) {
common_debug('Ignoring self ping from ' . $source . ' to ' . $target);
return NULL;
}
$body = htmlspecialchars_decode($response->getBody());
// We're slightly more lenient in our link detection than the spec requires
- if(!linkback_lenient_target_match($body, $target)) {
+ if(linkback_lenient_target_match($body, $target) === FALSE) {
return NULL;
}
}
if(!$user) {
preg_match('/\/([^\/\?#]+)(?:#.*)?$/', $response->getEffectiveUrl(), $match);
- if(linkback_lenient_target_match(common_profile_url($match[1]), $response->getEffectiveUrl())) {
+ if(linkback_lenient_target_match(common_profile_url($match[1]), $response->getEffectiveUrl()) !== FALSE) {
$user = User::getKV('nickname', $match[1]);
}
}
function linkback_is_contained_in($entry, $target) {
foreach ((array)$entry['properties'] as $key => $values) {
- if(count(array_filter($values, function($x) use ($target) { return linkback_lenient_target_match($x, $target); })) > 0) {
+ if(count(array_filter($values, function($x) use ($target) { return linkback_lenient_target_match($x, $target) !== FALSE; })) > 0) {
return $entry['properties'];
}
if(isset($obj['type']) && array_intersect(array('h-cite', 'h-entry'), $obj['type']) &&
isset($obj['properties']) && isset($obj['properties']['url']) &&
count(array_filter($obj['properties']['url'],
- function($x) use ($target) { return linkback_lenient_target_match($x, $target); })) > 0
+ function($x) use ($target) { return linkback_lenient_target_match($x, $target) !== FALSE; })) > 0
) {
return $entry['properties'];
}
if($mf2['rels'] && $mf2['rels']['in-reply-to']) {
foreach($mf2['rels']['in-reply-to'] as $url) {
- if(linkback_lenient_target_match($url, $target)) {
+ if(linkback_lenient_target_match($url, $target) !== FALSE) {
return 'reply';
}
}
);
foreach((array)$entry as $key => $values) {
- if(count(array_filter($values, function($x) use ($target) { return linkback_lenient_target_match($x, $target); })) > 0) {
+ if(count(array_filter($values, function($x) use ($target) { return linkback_lenient_target_match($x, $target) != FALSE; })) > 0) {
if($classes[$key]) { return $classes[$key]; }
}
if(isset($obj['type']) && array_intersect(array('h-cite', 'h-entry'), $obj['type']) &&
isset($obj['properties']) && isset($obj['properties']['url']) &&
count(array_filter($obj['properties']['url'],
- function($x) use ($target) { return linkback_lenient_target_match($x, $target); })) > 0
+ function($x) use ($target) { return linkback_lenient_target_match($x, $target) != FALSE; })) > 0
) {
if($classes[$key]) { return $classes[$key]; }
}