| The Red Project

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Pages
Functions
items.php File Reference

## Functions
| collect_recipients ($item, &$private)
| red_zrl_callback ($matches)
| post_activity_item ($arr)
| get_public_feed ($channel, $params)
| get_feed_for (&$a, $dfrn_id, $owner_nick, $last_update, $direction=0)
| construct_verb ($item)
| construct_activity_object ($item)
| construct_activity_target ($item)
| limit_body_size ($body)
| title_is_body ($title, $body)
| get_item_elements ($x)
| import_author_xchan ($x)
| encode_item ($item)
| map_scope ($scope)
| encode_item_xchan ($xchan)
| encode_item_terms ($terms)
| termtype ($t)
| decode_tags ($t)
| activity_sanitise ($arr)
| array_sanitise ($arr)
| encode_item_flags ($item)
| encode_mail ($item)
| get_mail_elements ($x)
| get_profile_elements ($x)
| get_atom_elements ($feed, $item)
| encode_rel_links ($links)
| item_store ($arr, $force_parent=false)
| item_store_update ($arr, $force_parent=false)
| send_status_notifications ($post_id, $item)
| get_item_contact ($item, $contacts)
| tag_deliver ($uid, $item_id)
| tgroup_check ($uid, $item)
| mail_store ($arr)
| dfrn_deliver ($owner, $contact, $atom, $dissolve=false)
| consume_feed ($xml, $importer, &$contact, &$hub, $datedir=0, $pass=0)
| local_delivery ($importer, $data)
| new_follower ($importer, $contact, $datarray, $item, $sharing=false)
| lose_follower ($importer, $contact, $datarray, $item)
| lose_sharer ($importer, $contact, $datarray, $item)
| atom_author ($tag, $name, $uri, $h, $w, $photo)
| atom_entry ($item, $type, $author, $owner, $comment=false, $cid=0)
| fix_private_photos ($s, $uid, $item=null, $cid=0)
| has_permissions ($obj)
| compare_permissions ($obj1, $obj2)
| enumerate_permissions ($obj)
| item_getfeedtags ($item)
| item_getfeedattach ($item)
| item_expire ($uid, $days)
| drop_items ($items)
| drop_item ($id, $interactive=true)
| delete_item_lowlevel ($item)
| first_post_date ($uid, $wall=false)
| posted_dates ($uid, $wall)
| posted_date_widget ($url, $uid, $wall)
| fetch_post_tags ($items, $link=false)
| zot_feed ($uid, $observer_xchan, $mindate)

## Function Documentation

activity_sanitise | ( |  | $arr | ) |

Referenced by get_item_elements(), item_store(), and item_store_update().

array_sanitise | ( |  | $arr | ) |

Referenced by get_profile_elements().

atom_author | ( |  | $tag,
|  |  | $name,
|  |  | $uri,
|  |  | $h,
|  |  | $w,
|  |  | $photo
| ) |  |

Referenced by atom_entry().

atom_entry | ( |  | $item,
|  |  | $type,
|  |  | $author,
|  |  | $owner,
|  |  | $comment = `false`,
|  |  | $cid = `0`
| ) |  |

Referenced by get_feed_for().

collect_recipients | ( |  | $item,
|  | & | $private
| ) |  |

Referenced by notifier_run().

compare_permissions | ( |  | $obj1,
|  |  | $obj2
| ) |  |

Referenced by fix_private_photos().

construct_activity_object | ( |  | $item | ) |

Referenced by atom_entry().

construct_activity_target | ( |  | $item | ) |

Referenced by atom_entry().

construct_verb | ( |  | $item | ) |

Referenced by atom_entry().

consume_feed | ( |  | $xml,
|  |  | $importer,
|  | & | $contact,
|  | & | $hub,
|  |  | $datedir = `0`,
|  |  | $pass = `0`
| ) |  |

consume_feed - process atom feed and update anything/everything we might need to update

$xml = the (atom) feed to consume - RSS isn't as fully supported but may work for simple feeds.

$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. $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. $hub = should we find a hub declation in the feed, pass it back to our calling process, who might (or might not) try and subscribe to it. $datedir sorts in reverse order $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. With $pass = 1, we only pull parent items out of the stream. With $pass = 2, we only pull children (comments/likes).

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.

Add new birthday event for this person

$bdtext is just a readable placeholder in case the event is shared with others. We will replace it during presentation to our $importer to contain a sparkle link and perhaps a photo.

decode_tags | ( |  | $t | ) |

Referenced by get_item_elements().

delete_item_lowlevel | ( |  | $item | ) |

Referenced by drop_item().

dfrn_deliver | ( |  | $owner,
|  |  | $contact,
|  |  | $atom,
|  |  | $dissolve = `false`
| ) |  |

Referenced by terminate_friendship().

drop_item | ( |  | $id,
|  |  | $interactive = `true`
| ) |  |

Referenced by api_statuses_destroy(), delete_imported_item(), drop_items(), item_content(), item_expire(), photos_post(), and remove_all_xchan_resources().

drop_items | ( |  | $items | ) |

Referenced by item_post().

encode_item | ( |  | $item | ) |

Referenced by notifier_run(), and zot_feed().

encode_item_flags | ( |  | $item | ) |

Referenced by encode_item().

encode_item_terms | ( |  | $terms | ) |

Referenced by encode_item().

encode_item_xchan | ( |  | $xchan | ) |

Referenced by encode_item(), and encode_mail().

encode_mail | ( |  | $item | ) |

Referenced by notifier_run().

encode_rel_links | ( |  | $links | ) |

Referenced by get_atom_elements().

enumerate_permissions | ( |  | $obj | ) |

Referenced by compare_permissions(), and fix_private_photos().

fetch_post_tags | ( |  | $items,
|  |  | $link = `false`
| ) |  |

Referenced by channel_content(), display_content(), events_content(), get_feed_for(), network_content(), notifier_run(), page_content(), search_content(), tag_deliver(), and zot_feed().

first_post_date | ( |  | $uid,
|  |  | $wall = `false`
| ) |  |

Referenced by posted_dates().

fix_private_photos | ( |  | $s,
|  |  | $uid,
|  |  | $item = `null`,
|  |  | $cid = `0`
| ) |  |

Referenced by atom_entry().

get_atom_elements | ( |  | $feed,
|  |  | $item
| ) |  |

If there's a copy of the body content which is guaranteed to have survived mangling in transit, use it.

Referenced by consume_feed(), and local_delivery().

get_feed_for | ( | & | $a,
|  |  | $dfrn_id,
|  |  | $owner_nick,
|  |  | $last_update,
|  |  | $direction = `0`
| ) |  |

get_item_contact | ( |  | $item,
|  |  | $contacts
| ) |  |

get_item_elements | ( |  | $x | ) |

Referenced by zot_import().

get_mail_elements | ( |  | $x | ) |

Referenced by zot_import().

get_profile_elements | ( |  | $x | ) |

Referenced by zot_import().

get_public_feed | ( |  | $channel,
|  |  | $params
| ) |  |

Referenced by feed_init().

has_permissions | ( |  | $obj | ) |

Referenced by fix_private_photos().

import_author_xchan | ( |  | $x | ) |

Referenced by get_item_elements(), get_mail_elements(), and get_profile_elements().

item_expire | ( |  | $uid,
|  |  | $days
| ) |  |

Referenced by expire_run().

item_getfeedattach | ( |  | $item | ) |

Referenced by atom_entry().

item_getfeedtags | ( |  | $item | ) |

Referenced by atom_entry().

item_store | ( |  | $arr,
|  |  | $force_parent = `false`
| ) |  |

Referenced by consume_feed(), event_store(), item_post(), like_content(), local_delivery(), mood_init(), photo_upload(), photos_create_item(), photos_post(), post_activity_item(), process_delivery(), profile_activity(), subthread_content(), and tagger_content().

item_store_update | ( |  | $arr,
|  |  | $force_parent = `false`
| ) |  |

Referenced by update_imported_item().

limit_body_size | ( |  | $body | ) |

Referenced by get_atom_elements().

local_delivery | ( |  | $importer,
|  |  | $data
| ) |  |

lose_follower | ( |  | $importer,
|  |  | $contact,
|  |  | $datarray,
|  |  | $item
| ) |  |

Referenced by consume_feed().

lose_sharer | ( |  | $importer,
|  |  | $contact,
|  |  | $datarray,
|  |  | $item
| ) |  |

Referenced by consume_feed().

mail_store | ( |  | $arr | ) |

Referenced by process_mail_delivery().

map_scope | ( |  | $scope | ) |

Referenced by encode_item().

new_follower | ( |  | $importer,
|  |  | $contact,
|  |  | $datarray,
|  |  | $item,
|  |  | $sharing = `false`
| ) |  |

Referenced by consume_feed().

post_activity_item | ( |  | $arr | ) |

post_activity_item($arr)

    post an activity

Parameters

  array | $arr | In its simplest form one needs only to set $arr['body'] to post a note to the logged in channel's wall. Much more complex activities can be created. Permissions are checked. No filtering, tag expansion or other processing is performed.

Returns
  array 'success' => true or false 'activity' => the resulting activity if successful

Referenced by poke_init().

posted_date_widget | ( |  | $url,
|  |  | $uid,
|  |  | $wall
| ) |  |

Referenced by channel_aside(), and network_init().

posted_dates | ( |  | $uid,
|  |  | $wall
| ) |  |

Referenced by posted_date_widget().

red_zrl_callback | ( |  | $matches | ) |

red_zrl_callback preg_match function when fixing 'naked' links in mod item.php Check if we've got a hubloc for the site and use a zrl if we do, a url if we don't.

send_status_notifications | ( |  | $post_id,
|  |  | $item
| ) |  |

Referenced by item_store(), and item_store_update().

tag_deliver | ( |  | $uid,
|  |  | $item_id
| ) |  |

Referenced by item_store(), and item_store_update().

termtype | ( |  | $t | ) |

Referenced by encode_item_terms().

tgroup_check | ( |  | $uid,
|  |  | $item
| ) |  |

Referenced by consume_feed(), and local_delivery().

title_is_body | ( |  | $title,
|  |  | $body
| ) |  |

Referenced by get_atom_elements().

zot_feed | ( |  | $uid,
|  |  | $observer_xchan,
|  |  | $mindate
| ) |  |

Referenced by zotfeed_init().