From a25ce4e3c73d36c2eb561c0dceb0168ffb54ec88 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 22 Jul 2008 14:19:56 +0000 Subject: Introducing the Friendable interface git-svn-id: https://code.elgg.org/elgg/trunk@1490 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'engine/lib/elgglib.php') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 3854dd8dc..698ea339c 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1622,6 +1622,91 @@ return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI']; } + /** + * An interface for objects that behave as elements within a social network that have a profile. + * + */ + interface Friendable { + + /** + * Adds a user as a friend + * + * @param int $friend_guid The GUID of the user to add + */ + public function addFriend($friend_guid); + + /** + * Removes a user as a friend + * + * @param int $friend_guid The GUID of the user to remove + */ + public function removeFriend($friend_guid); + + /** + * Determines whether or not the current user is a friend of this entity + * + */ + public function isFriend(); + + /** + * Determines whether or not this entity is friends with a particular entity + * + * @param int $user_guid The GUID of the entity this entity may or may not be friends with + */ + public function isFriendsWith($user_guid); + + /** + * Determines whether or not a foreign entity has made this one a friend + * + * @param int $user_guid The GUID of the foreign entity + */ + public function isFriendOf($user_guid); + + /** + * Returns this entity's friends + * + * @param string $subtype The subtype of entity to return + * @param int $limit The number of entities to return + * @param int $offset Indexing offset + */ + public function getFriends($subtype = "", $limit = 10, $offset = 0); + + /** + * Returns entities that have made this entity a friend + * + * @param string $subtype The subtype of entity to return + * @param int $limit The number of entities to return + * @param int $offset Indexing offset + */ + public function getFriendsOf($subtype = "", $limit = 10, $offset = 0); + + /** + * Returns objects in this entity's container + * + * @param string $subtype The subtype of entity to return + * @param int $limit The number of entities to return + * @param int $offset Indexing offset + */ + public function getObjects($subtype="", $limit = 10, $offset = 0); + + /** + * Returns objects in the containers of this entity's friends + * + * @param string $subtype The subtype of entity to return + * @param int $limit The number of entities to return + * @param int $offset Indexing offset + */ + public function getFriendsObjects($subtype = "", $limit = 10, $offset = 0); + + /** + * Returns the number of object entities in this entity's container + * + * @param string $subtype The subtype of entity to count + */ + public function countObjects($subtype = ""); + + } + function elgg_init() { // Important actions register_action('comments/add'); -- cgit v1.2.3