Services_Facebook
[ class tree: Services_Facebook ] [ index: Services_Facebook ] [ all elements ]

Class: Services_Facebook_Feed

Source Location: /Services_Facebook-0.2.14/Services/Facebook/Feed.php

Class Overview

Services_Facebook_Common
   |
   --Services_Facebook_Feed

Facebook Feed Interface


Author(s):

Version:

  • Release: 0.2.14

Methods


Inherited Variables

Inherited Methods


Class Details

[line 35]
Facebook Feed Interface


[ Top ]


Method Detail

deactivateTemplateBundleByID   [line 375]

boolean deactivateTemplateBundleByID( int $id)

Deactivates a previously registered template bundle. Once a template

bundle has been deactivated, it can no longer be used to publish stories via feed.publishUserAction. Stories published agaisnt the template bundle prior to its deactivation are still valid and will show up in the Mini-Feed and News Feed. The response is true if and only if the template bundle, identified by $id, is an active template bundle owned by the requesting application, and is false otherwise.


Parameters:

int   $id   —  ID of template bundle to deactivate

[ Top ]

getRegisteredTemplateBundleByID   [line 354]

SimpleXMLElement getRegisteredTemplateBundleByID( int $id)

Returns information about a specified template bundle previously registered by the requesting application. The result is returned as a SimpleXMLElement.

Parameters:

int   $id   —  ID of template bundle

[ Top ]

getRegisteredTemplateBundles   [line 338]

SimpleXMLElement getRegisteredTemplateBundles( )

Retrieves the full list of all template bundles registered by the requesting application. This does not include any template bundles previously deactivated via calls to feed.deactivateTemplateBundle

[ Top ]

publishActionOfUser   [line 134]

boolean publishActionOfUser( string $title, [string $body = ''], [array $images = array()])

Publish an action to a user's feed

An action differs from a story in that a user's action is sent to all of that user's friends as well.

The $images array should be a numerically indexed array of arrays, where each image has two keys: src and href. The src is the full URI of the image and the href is the link of that image.

  1.  <?php
  2.  $images = array(
  3.      array('src'  => 'http://example.com/images1.jpg',
  4.            'href' => 'http://example.com/images.php?image=1'),
  5.      array('src'  => 'http://example.com/images2.jpg',
  6.            'href' => 'http://example.com/images.php?image=2'),
  7.      array('src'  => 'http://example.com/images3.jpg',
  8.            'href' => 'http://example.com/images.php?image=3')
  9.  );
  10.  ?>


Parameters:

string   $title   —  FBML to post as story title
string   $body   —  FBML to post as story body
array   $images   —  Images to post to story entry

[ Top ]

publishStoryToUser   [line 66]

boolean publishStoryToUser( string $title, [string $body = ''], [array $images = array()])

Publish a story to a user's feed

The $images array should be a numerically indexed array of arrays, where each image has two keys: src and href. The src is the full URI of the image and the href is the link of that image.

  1.  <?php
  2.  $images = array(
  3.      array('src'  => 'http://example.com/images1.jpg',
  4.            'href' => 'http://example.com/images.php?image=1'),
  5.      array('src'  => 'http://example.com/images2.jpg',
  6.            'href' => 'http://example.com/images.php?image=2'),
  7.      array('src'  => 'http://example.com/images3.jpg',
  8.            'href' => 'http://example.com/images.php?image=3')
  9.  );
  10.  ?>


Parameters:

string   $title   —  FBML to post as story title
string   $body   —  FBML to post as story body
array   $images   —  Images to post to story entry

[ Top ]

publishTemplatizedAction   [line 209]

boolean publishTemplatizedAction( string $titleTemplate, [array $feedData = array()], [array $images = array()])

Publish a templatized action to a user's feed

An action differs from a story in that a user's action is sent to all of that user's friends as well.

An templatized story publishes News Feed stories to the friends of that user. These stories or more likely to appear to the friends of that user depending upon a variety of factors, such as the closeness of the relationship between the users, the interaction data facebook has about that particular story type, and the quality of the content in the story/on the linked page. http://wiki.developers.facebook.com/index.php/FeedRankingFAQ

The $images array should be a numerically indexed array of arrays, where each image has two keys: src and href. The src is the full URI of the image and the href is the link of that image.

  1.  <?php
  2.  $images = array(
  3.      array('src'  => 'http://example.com/images1.jpg',
  4.            'href' => 'http://example.com/images.php?image=1'),
  5.      array('src'  => 'http://example.com/images2.jpg',
  6.            'href' => 'http://example.com/images.php?image=2'),
  7.      array('src'  => 'http://example.com/images3.jpg',
  8.            'href' => 'http://example.com/images.php?image=3')
  9.  );
  10.  ?>


Parameters:

string   $titleTemplate   —  FBML to post as the title, must contain {actor}
array   $feedData   —  Array containing optional Feed template, data, and/or actor id
array   $images   —  Images to post to story entry

[ Top ]

publishUserAction   [line 427]

boolean publishUserAction( int $templateBundleID, [array $templateData = array()], [array $targetIDs = array()], [string $bodyGeneral = ''])

Publishes a story on behald of the user owning the session, using the

specified template bundle. This method requires an active session key in order to be called. This method returns true if all succeeds, and false of the user never authorized the application to publish to his or her Mini-Feed.

This method should be passed a template bundle ID to use, and an array of template data whose keys are the tokens to replace, and values are the desired replacement. 'actor' and 'target' are special tokens and should not be included in this array. If one or more of the templates include tokens other than 'actor' and 'targets', then this array is required. This array can also include exactly one of the following keys: 'images', 'flash', 'mp3', or 'video'.

If 'images' is passed, it should map to an array of up to four images, and each array should contain a key 'src', and optionally 'href'

If 'flash' is passed, it should map to an array containing two required keys: 'swfsrc', which is the URL of the flash object to be rendered, and 'imgsrc', which is the URL of an image to be displayed until the users clicks the flash object. Optionally, the 'flash' array can contain 'width' and 'height'. The height must be an integer between 30 and 100 (inclusive), and the width must be either 100, 110, or 130.

If 'mp3' is passed, it must contain a single required field, 'src', and can optionally contain 'title', 'artist', and 'album'

If 'video' is passed, it must contain two required fields: 'video_src' and 'preview_img'. The video array can also contain the following optional fields: 'video_title', 'video_link', and 'video_type'.

If the template in questions contains a 'target' token, the userIDs of the target should be passed as an array, $targetIDs.


Parameters:

int   $templateBundleID   —  ID of template bundle to use
array   $templateData   —  array of template data
array   $targetIDs   —  array of target IDs
string   $bodyGeneral   —  additional markup that extends the body of a short story

[ Top ]

registerTemplateBundle   [line 298]

string registerTemplateBundle( array $oneLineStoryTpls, [array $shortStoryTpls = array()], [array $fullStoryTpl = array()], [array $actionLinks = array()], array $fullStoryTemplate)

Builds a template bundle around the specified templates, registers them on Facebook, and responds with a template bundle ID that can be used to identify your template bundle to other Feed-related API calls.

A template bundle consists of:

  • an array of one line story templates
  • an array of short story templates
  • a single full story template
Each array consists of one or more templates, and each template consists of one or more tokens (for the story actor, friends, items, and so forth), some static text, and some FBML. Tokens must be wrapped in curly braces and asterisks, as in {*actor*}. The {*actor*} token must appear at the beginning of all one line templates and at the beginning of short and full template story titles.

The order of templates in an array is very important. In general, the most flexible template should be first in the array. The most flexible template has the most tokens in it. The first template will always be used for feed stories. The last one-line template in the array must be the least flexible of all the template in the bundle. Thus, it should include only tokens that are a strict subset of all other tokens.

When considering these templates, the first template makes for the best story, but the last template has the highest aggregation potential. When you publish a story using feed.publishUserAction, you're posting the first version of the story to a user's Mini-Feed, and you're posting one of three different stories to that users friends' News Feeds.

Short story each consist of two parts, a template title and a template body. Short stories should be passed as an array of short stories, with each element being an array containing the keys 'template_title' and 'template_body'

Full story templates should be passed as an array containing keys 'template_title' and 'template_body'

Action links @see http://wiki.developers.facebook.com/index.php/Action_Links


Parameters:

array   $oneLineStoryTpls   —  array of one-line story templates
array   $shortStoryTpls   —  optional array of short story templates
array   $fullStoryTemplate   —  optional full story template
array   $actionLinks   —  optional array of actoin link records
array   $fullStoryTpl   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:36:58 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.