aboutsummaryrefslogtreecommitdiffstats
path: root/include/Scrape.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-09-04 05:07:25 -0700
committerFriendika <info@friendika.com>2011-09-04 05:07:25 -0700
commit260d652168bae3716f843f445ae696b59edf4db3 (patch)
tree24b2eccf4e4f09665ba26d0289f0fd7920f550ec /include/Scrape.php
parent1d01b3a088aaaaf47844544b76b55f76f7f31182 (diff)
downloadvolse-hubzilla-260d652168bae3716f843f445ae696b59edf4db3.tar.gz
volse-hubzilla-260d652168bae3716f843f445ae696b59edf4db3.tar.bz2
volse-hubzilla-260d652168bae3716f843f445ae696b59edf4db3.zip
scrape_url - use feed url if no name can be found
Diffstat (limited to 'include/Scrape.php')
-rw-r--r--include/Scrape.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index cc46af644..bf64c2243 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -332,10 +332,12 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if(! $url)
return $result;
+ $network = null;
$diaspora = false;
$diaspora_base = '';
$diaspora_guid = '';
$diaspora_key = '';
+ $has_lrdd = false;
$email_conversant = false;
$twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
@@ -352,6 +354,8 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$links = lrdd($url);
if(count($links)) {
+ $has_lrdd = true;
+
logger('probe_url: found lrdd links: ' . print_r($links,true), LOGGER_DATA);
foreach($links as $link) {
if($link['@attributes']['rel'] === NAMESPACE_ZOT)
@@ -493,7 +497,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
if($diaspora)
$network = NETWORK_DIASPORA;
- else
+ elseif($has_lrdd)
$network = NETWORK_OSTATUS;
$priority = 0;
@@ -637,7 +641,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
}
if(! $network)
- $network = 'feed';
+ $network = NETWORK_FEED;
if(! $priority)
$priority = 2;
}
@@ -651,10 +655,14 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if(! $profile)
$profile = $url;
- $vcard['fn'] = notags($vcard['fn']);
- $vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
+ // No human could be associated with this link, use the URL as the contact name
+ if(($network === NETWORK_FEED) && ($poll) && (! x($vcard,'fn')))
+ $vcard['fn'] = $url;
+ $vcard['fn'] = notags($vcard['fn']);
+ $vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
+
$result['name'] = $vcard['fn'];
$result['nick'] = $vcard['nick'];
$result['url'] = $profile;