From: Michael J. Rubinsky Date: Wed, 25 Feb 2009 21:27:37 +0000 (-0500) Subject: Add support for Feeds. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a867d0ffd5002061b87ef8b9659cb01cf7a77bd6;p=horde.git Add support for Feeds. --- diff --git a/framework/Service_Facebook/lib/Horde/Service/Facebook/Feeds.php b/framework/Service_Facebook/lib/Horde/Service/Facebook/Feeds.php new file mode 100644 index 000000000..f9b126f32 --- /dev/null +++ b/framework/Service_Facebook/lib/Horde/Service/Facebook/Feeds.php @@ -0,0 +1,137 @@ +_facebook->call_method('facebook.feed.registerTemplateBundle', + array('one_line_story_templates' => $oneLineStory, + 'short_story_templates' => $shortStory, + 'full_story_template' => $fullStory, + 'action_links' => $actionLinks)); + } + + /** + * Retrieves the full list of active template bundles registered by the + * requesting application. + * + * @return array An array of template bundles + */ + public function &getRegisteredTemplateBundles() + { + return $this->_facebook->call_method('facebook.feed.getRegisteredTemplateBundles'); + } + + /** + * Retrieves information about a specified template bundle previously + * registered by the requesting application. + * + * @param string $id The template bundle id + * + * @return array Template bundle + */ + public function &getRegisteredTemplateBundleByID($id) + { + return $this->_facebook->call_method('facebook.feed.getRegisteredTemplateBundleByID', + array('template_bundle_id' => $id)); + } + + /** + * Deactivates a previously registered template bundle. + * + * @param string $template_bundle_id The template bundle id + * + * @return bool true on success + */ + public function &deactivateTemplateBundleByID($id) + { + return $this->_facebook->call_method('facebook.feed.deactivateTemplateBundleByID', + array('template_bundle_id' => $id)); + } + + /** + * Publishes a story on behalf of the user owning the session, using the + * specified template bundle. This method requires an active session key in + * order to be called. + * + * The parameters to this method ($templata_data in particular) are somewhat + * involved. It's recommended you visit the wiki for details: + * + * http://wiki.developers.facebook.com/index.php/Feed.publishUserAction + * + * @param int $bundleId A template bundle id previously registered + * @param array $data See wiki article for syntax + * @param array $targetIds (Optional) An array of friend uids of the user + * who shared in this action. + * @param string $body (Optional) Additional markup that extends + * the body of a short story. + * @param int $size (Optional) A story size (see above) + * + * @return bool true on success + */ + public function &publishUserAction($bundleId, $data, $targetIds = '', + $body = '', $size = self::STORY_SIZE_ONE_LINE) + { + // Pass in JSON or an assoc that we JSON for them + if (is_array($data)) { + $data = json_encode($data); + } + if (is_array($targetIds)) { + $targetIds = json_encode($targetIds); + // No brackets + $targetIds = trim($targetIds, "[]"); + } + + return $this->_facebook->call_method('facebook.feed.publishUserAction', + array('template_bundle_id' => $bundleId, + 'template_data' => $data, + 'target_ids' => $targetIds, + 'body_general' => $body, + 'story_size' => $size)); + } + + /** + * For the current user, retrieves stories generated by the user's friends + * while using this application. This can be used to easily create a + * "News Feed" like experience. + * + * @return array An array of feed story objects. + */ + public function &feed_getAppFriendStories() + { + return $this->_facebook->call_method('facebook.feed.getAppFriendStories'); + } + +} \ No newline at end of file diff --git a/framework/Service_Facebook/package.xml b/framework/Service_Facebook/package.xml index eb5ddb215..4596bc9c3 100644 --- a/framework/Service_Facebook/package.xml +++ b/framework/Service_Facebook/package.xml @@ -41,6 +41,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> + @@ -74,6 +75,7 @@ http://pear.php.net/dtd/package-2.0.xsd"> +