diff options
author | zotlabs <mike@macgirvin.com> | 2017-04-30 16:50:10 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-04-30 16:50:10 -0700 |
commit | d71a53f24ee464fba5d4373397a3a797e8f0c6a3 (patch) | |
tree | 0c9be1e6d47c7e28efd8e538350aa0a00a0b8a0e | |
parent | c845d20352300e2b8a6133bbf3fe270807ba0856 (diff) | |
parent | 635b8ff73aca5d1a8ba6ea5bb575f3f2838d41a0 (diff) | |
download | volse-hubzilla-d71a53f24ee464fba5d4373397a3a797e8f0c6a3.tar.gz volse-hubzilla-d71a53f24ee464fba5d4373397a3a797e8f0c6a3.tar.bz2 volse-hubzilla-d71a53f24ee464fba5d4373397a3a797e8f0c6a3.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
-rw-r--r-- | doc/developer/api_zot.bb | 2 | ||||
-rw-r--r-- | include/feedutils.php | 24 | ||||
-rw-r--r-- | tests/unit/includes/FeedutilsText.php | 9 |
3 files changed, 23 insertions, 12 deletions
diff --git a/doc/developer/api_zot.bb b/doc/developer/api_zot.bb index 1314f90b5..ddca65b4d 100644 --- a/doc/developer/api_zot.bb +++ b/doc/developer/api_zot.bb @@ -28,7 +28,7 @@ GET /api/z/1.0/files Options: - - hash + - filehash return only entries matching hash (exactly) - filename diff --git a/include/feedutils.php b/include/feedutils.php index 36ab75287..9d0cf8cd6 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -79,7 +79,7 @@ function get_feed_for($channel, $observer_hash, $params) { $feed_author = ''; if(intval($params['compat']) === 1) { - $feed_author = atom_author('author',$channel['channel_address'],$channel['xchan_url'],300,300,$channel['xchan_photo_mimetype'],$channel['xchan_photo_l']); + $feed_author = atom_author('author',$channel['channel_address'],$channel['channel_name'],$channel['xchan_url'],300,300,$channel['xchan_photo_mimetype'],$channel['xchan_photo_l']); } $atom .= replace_macros($feed_template, array( @@ -1241,11 +1241,12 @@ function handle_feed($uid, $abook_id, $url) { * @param string $photo Fully qualified URL to a profile/avator photo * @return string */ -function atom_author($tag, $name, $uri, $h, $w, $type, $photo) { +function atom_author($tag, $nick, $name, $uri, $h, $w, $type, $photo) { $o = ''; if(! $tag) return $o; + $nick = xmlify($nick); $name = xmlify($name); $uri = xmlify($uri); $h = intval($h); @@ -1254,10 +1255,12 @@ function atom_author($tag, $name, $uri, $h, $w, $type, $photo) { $o .= "<$tag>\r\n"; $o .= " <id>$uri</id>\r\n"; - $o .= " <name>$name</name>\r\n"; + $o .= " <name>$nick</name>\r\n"; $o .= " <uri>$uri</uri>\r\n"; $o .= ' <link rel="photo" type="' . $type . '" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n"; $o .= ' <link rel="avatar" type="' . $type . '" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n"; + $o .= ' <poco:preferredUsername>' . $nick . '</poco:preferredUsername>' . "\r\n"; + $o .= ' <poco:displayName>' . $name . '</poco:displayName>' . "\r\n"; call_hooks('atom_author', $o); @@ -1296,12 +1299,17 @@ function atom_entry($item, $type, $author, $owner, $comment = false, $cid = 0) { $o = "\r\n\r\n<entry>\r\n"; - if(is_array($author)) - $o .= atom_author('author',$author['xchan_name'],$author['xchan_url'],80,80,$author['xchan_photo_mimetype'],$author['xchan_photo_m']); - else - $o .= atom_author('author',$item['author']['xchan_name'],$item['author']['xchan_url'],80,80,$item['author']['xchan_photo_mimetype'], $item['author']['xchan_photo_m']); + if(is_array($author)) { + $reddress = substr($author['xchan_addr'],0,strpos($author['xchan_addr'],'@')); + $o .= atom_author('author',$reddress,$author['xchan_name'],$author['xchan_url'],80,80,$author['xchan_photo_mimetype'],$author['xchan_photo_m']); + } + else { + $reddress = substr($item['author']['xchan_addr'],0,strpos($item['author']['xchan_addr'],'@')); + $o .= atom_author('author',$reddress,$item['author']['xchan_name'],$item['author']['xchan_url'],80,80,$item['author']['xchan_photo_mimetype'], $item['author']['xchan_photo_m']); + } - $o .= atom_author('zot:owner',$item['owner']['xchan_name'],$item['owner']['xchan_url'],80,80,$item['owner']['xchan_photo_mimetype'],$item['owner']['xchan_photo_m']); + $reddress = substr($item['owner']['xchan_addr'],0,strpos($item['owner']['xchan_addr'],'@')); + $o .= atom_author('zot:owner',$reddress,$item['owner']['xchan_name'],$item['owner']['xchan_url'],80,80,$item['owner']['xchan_photo_mimetype'],$item['owner']['xchan_photo_m']); if(($item['parent'] != $item['id']) || ($item['parent_mid'] !== $item['mid']) || (($item['thr_parent'] !== '') && ($item['thr_parent'] !== $item['mid']))) { $parent_item = (($item['thr_parent']) ? $item['thr_parent'] : $item['parent_mid']); diff --git a/tests/unit/includes/FeedutilsText.php b/tests/unit/includes/FeedutilsText.php index e3eaa91a7..932a1b3a1 100644 --- a/tests/unit/includes/FeedutilsText.php +++ b/tests/unit/includes/FeedutilsText.php @@ -38,15 +38,18 @@ class FeedutilsTest extends UnitTestCase { }*/ public function test_atom_author() { - $this->assertEquals('', atom_author('', 'name', 'uri', 72, 72, 'png', 'photourl')); + $this->assertEquals('', atom_author('', 'nick', 'name', 'uri', 72, 72, 'png', 'photourl')); $a = '<tag> - <name>name</name> + <id>uri</id> + <name>nick</name> <uri>uri</uri> <link rel="photo" type="png" media:width="72" media:height="72" href="http://photourl" /> <link rel="avatar" type="png" media:width="72" media:height="72" href="http://photourl" /> + <poco:preferredUsername>nick</poco:preferredUsername> + <poco:displayName>name<poco:displayName> </tag>'; - $this->assertXmlStringEqualsXmlString($a, atom_author('tag', 'name', 'uri', 72, 72, 'png', 'http://photourl')); + $this->assertXmlStringEqualsXmlString($a, atom_author('tag', 'nick', 'name', 'uri', 72, 72, 'png', 'http://photourl')); } } |