aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-08-14 18:13:52 -0700
committerFriendika <info@friendika.com>2011-08-14 18:13:52 -0700
commit79529612226dc89b90df33ba066a530d0e716a69 (patch)
tree7da0af3bf3bb5459aa0f5bf81f86cece0ebbe682 /include
parent3a0727d4961aa5743e1f9365c8a3848cfb24a66b (diff)
downloadvolse-hubzilla-79529612226dc89b90df33ba066a530d0e716a69.tar.gz
volse-hubzilla-79529612226dc89b90df33ba066a530d0e716a69.tar.bz2
volse-hubzilla-79529612226dc89b90df33ba066a530d0e716a69.zip
diaspora probe/scrape changes
Diffstat (limited to 'include')
-rw-r--r--include/Scrape.php35
1 files changed, 23 insertions, 12 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index c4882243d..b32d7283e 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -468,13 +468,6 @@ function probe_url($url) {
logger('probe_url: scrape_vcard: ' . print_r($vcard,true), LOGGER_DATA);
}
- if(! $profile) {
- if($diaspora)
- $profile = $hcard;
- else
- $profile = $url;
- }
-
if($twitter) {
logger('twitter: setup');
$tid = basename($url);
@@ -490,8 +483,16 @@ function probe_url($url) {
if(x($vcard,'nick'))
$vcard['fn'] = $vcard['nick'];
-
- if(((! isset($vcard)) && (! $poll) && (! $at_addr)) || ($twitter)) {
+ $check_feed = false;
+
+ if($twitter || ! $poll)
+ $check_feed = true;
+ if((! isset($vcard)) || (! $profile))
+ $check_feed = true;
+ if(($at_addr) && (! count($links)))
+ $check_feed = false;
+
+ if($check_feed) {
$feedret = scrape_feed($url);
logger('probe_url: scrape_feed returns: ' . print_r($feedret,true), LOGGER_DATA);
@@ -527,6 +528,8 @@ function probe_url($url) {
if(strpos($vcard['fn'],'@') !== false)
$vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
$email = unxmlify($author->get_email());
+ if(! $profile && $author->get_link())
+ $profile = trim(unxmlify($author->get_link()));
if(! $vcard['photo']) {
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
if($rawtags) {
@@ -547,6 +550,8 @@ function probe_url($url) {
if(strpos($vcard['fn'],'@') !== false)
$vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
$email = unxmlify($author->get_email());
+ if(! $profile && $author->get_link())
+ $profile = trim(unxmlify($author->get_link()));
}
if(! $vcard['photo']) {
$rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
@@ -584,8 +589,10 @@ function probe_url($url) {
if(strpos($vcard['nick'],' '))
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
}
- $network = 'feed';
- $priority = 2;
+ if(! $network)
+ $network = 'feed';
+ if(! $priority)
+ $priority = 2;
}
}
@@ -593,8 +600,12 @@ function probe_url($url) {
$a = get_app();
$vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ;
}
+
+ if(! $profile)
+ $profile = $url;
+
$vcard['fn'] = notags($vcard['fn']);
- $vcard['nick'] = notags($vcard['nick']);
+ $vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
$result['name'] = $vcard['fn'];