![]()  | 
  
    The Hubzilla
    
   | 
 
Some functions to work with XML feeds. More...
Functions | |
| get_public_feed ($channel, $params) | |
| Return an Atom feed for channel.  More... | |
| get_feed_for ($channel, $observer_hash, $params) | |
| Create an atom feed for $channel from template.  More... | |
| construct_verb ($item) | |
| Return the verb for an item, or fall back to ACTIVITY_POST.  More... | |
| construct_activity_object ($item) | |
| construct_activity_target ($item) | |
| get_atom_elements ($feed, $item, &$author) | |
| Return an array with a parsed atom item.  More... | |
| feed_get_reshare (&$res, $item) | |
| encode_rel_links ($links) | |
| Encodes SimplePie_Item link arrays.  More... | |
| process_feed_tombstones ($feed, $importer, $contact, $pass) | |
| consume_feed ($xml, $importer, &$contact, $pass=0) | |
| Process atom feed and update anything/everything we might need to update.  More... | |
| feed_conversation_fetch ($importer, $contact, $parent_link) | |
| normalise_id ($id) | |
| Normalise an id.  More... | |
| process_salmon_feed ($xml, $importer) | |
| Process atom feed and return the first post and structure.  More... | |
| feed_meta ($xml) | |
| Given an xml (atom) feed, find author and hub links.  More... | |
| update_feed_item ($uid, $datarray) | |
| Not yet implemented function to update feed item.  More... | |
| handle_feed ($uid, $abook_id, $url) | |
| Fetch the content of a feed and further consume it.  More... | |
| atom_author ($tag, $nick, $name, $uri, $h, $w, $type, $photo) | |
| Return a XML tag with author information.  More... | |
| atom_render_author ($tag, $xchan) | |
| Return an atom tag with author information from an xchan.  More... | |
| compat_photos_list ($s) | |
| atom_entry ($item, $type, $author, $owner, $comment=false, $cid=0, $compat=false) | |
| Create an item for the Atom feed.  More... | |
Some functions to work with XML feeds.
| atom_author | ( | $tag, | |
| $nick, | |||
| $name, | |||
| $uri, | |||
| $h, | |||
| $w, | |||
| $type, | |||
| $photo | |||
| ) | 
Return a XML tag with author information.
| string | $tag | The XML tag to create | 
| string | $nick | preferred username | 
| string | $name | displayed name of the author | 
| string | $uri | |
| int | $h | image height | 
| int | $w | image width | 
| string | $type | profile photo mime type | 
| string | $photo | Fully qualified URL to a profile/avator photo | 
| atom_entry | ( | $item, | |
| $type, | |||
| $author, | |||
| $owner, | |||
$comment = false,  | 
        |||
$cid = 0,  | 
        |||
$compat = false  | 
        |||
| ) | 
Create an item for the Atom feed.
| array | $item | |
| string | $type | |
| array | $author | |
| array | $owner | |
| string | $comment | default false | 
| number | $cid | default 0 | 
| boolean | $compat | default false | 
Referenced by Zotlabs\Module\Display\get(), and get_feed_for().
| atom_render_author | ( | $tag, | |
| $xchan | |||
| ) | 
Return an atom tag with author information from an xchan.
| string | $tag | |
| array | $xchan | 
Referenced by atom_entry(), and get_feed_for().
| compat_photos_list | ( | $s | ) | 
Referenced by atom_entry().
| construct_activity_object | ( | $item | ) | 
Referenced by atom_entry().
| construct_activity_target | ( | $item | ) | 
Referenced by atom_entry().
| construct_verb | ( | $item | ) | 
Return the verb for an item, or fall back to ACTIVITY_POST.
| array | $item | an associative array with
  | 
Referenced by atom_entry().
| consume_feed | ( | $xml, | |
| $importer, | |||
| & | $contact, | ||
$pass = 0  | 
        |||
| ) | 
Process atom feed and update anything/everything we might need to update.
| string | $xml | The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds. | |
| array | $importer | The contact_record (joined to user_record) of the local user who owns this relationship. It is this person's stuff that is going to be updated. | |
| [in,out] | array | $contact | The person who is sending us stuff. If not set, we MAY be processing a "follow" activity from an external network and MAY create an appropriate contact record. Otherwise, we MUST have a contact record. | 
| int | $pass | by default ($pass = 0) we cannot guarantee that a parent item has been imported prior to its children being seen in the stream unless we are certain of how the feed is arranged/ordered.
  | 
So running this twice, first with pass 1 and then with pass 2 will do the right thing regardless of feed ordering. This won't be adequate in a fully-threaded model where comments can have sub-threads. That would require some massive sorting to get all the feed items into a mostly linear ordering, and might still require recursion.
Referenced by feed_conversation_fetch(), and handle_feed().
| encode_rel_links | ( | $links | ) | 
Encodes SimplePie_Item link arrays.
| array | $links | Array with SimplePie_Item link tags | 
Referenced by feed_get_reshare(), and get_atom_elements().
| feed_conversation_fetch | ( | $importer, | |
| $contact, | |||
| $parent_link | |||
| ) | 
Referenced by consume_feed().
| feed_get_reshare | ( | & | $res, | 
| $item | |||
| ) | 
Referenced by get_atom_elements().
| feed_meta | ( | $xml | ) | 
Given an xml (atom) feed, find author and hub links.
| string | $xml | 
| get_atom_elements | ( | $feed, | |
| $item, | |||
| & | $author | ||
| ) | 
Return an array with a parsed atom item.
| SimplePie | $feed | ||
| array | $item | ||
| [out] | array | $author | 
Referenced by consume_feed(), and process_salmon_feed().
| get_feed_for | ( | $channel, | |
| $observer_hash, | |||
| $params | |||
| ) | 
Create an atom feed for $channel from template.
| array | $channel | |
| string | $observer_hash | xchan_hash from observer | 
| array | $params | 
Referenced by get_public_feed().
| get_public_feed | ( | $channel, | |
| $params | |||
| ) | 
Return an Atom feed for channel.
| array | $channel | |
| array | $params | associative array which configures the feed | 
Referenced by Zotlabs\Module\Feed\init(), and Zotlabs\Module\Ofeed\init().
| handle_feed | ( | $uid, | |
| $abook_id, | |||
| $url | |||
| ) | 
Fetch the content of a feed and further consume it.
It will first process parent items and in a second run child items.
| int | $uid | |
| int | $abook_id | |
| string | $url | URL of the feed | 
Referenced by Zotlabs\Daemon\Onepoll\run().
| normalise_id | ( | $id | ) | 
Normalise an id.
Strip "X-ZOT:" from $id.
| string | $id | 
Referenced by consume_feed(), get_atom_elements(), process_feed_tombstones(), and process_salmon_feed().
| process_feed_tombstones | ( | $feed, | |
| $importer, | |||
| $contact, | |||
| $pass | |||
| ) | 
Referenced by consume_feed().
| process_salmon_feed | ( | $xml, | |
| $importer | |||
| ) | 
Process atom feed and return the first post and structure.
| string | $xml | The (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds. | 
| array | $importer | (unused) The contact_record (joined to user_record) of the local user who owns this relationship. It is this person's stuff that is going to be updated. | 
| update_feed_item | ( | $uid, | |
| $datarray | |||
| ) | 
Not yet implemented function to update feed item.
| int | $uid | |
| array | $datarray | 
Referenced by consume_feed().