Skip to content

Instantly share code, notes, and snippets.

@optikalefx
Created September 11, 2012 22:05
Show Gist options
  • Save optikalefx/3702461 to your computer and use it in GitHub Desktop.
Save optikalefx/3702461 to your computer and use it in GitHub Desktop.
function post() {
$post = $this->_safeMysql();
// shorten the description to 256 char
$desc = stripslashes(substr(implode(" ",$post['body']),0,256));
$title = stripslashes(stripslashes($post['title']));
$attachment = array(
'message' => $title,
'name' => 'NewsUp',
'caption' => 'Checkout this NewsUp article I just read.',
'link' => 'http://www.changeup.net',
'description' => $desc,
'picture' => $post['image'],
'actions' => array(
array(
'name' => 'What is NewsUp?',
'link' => 'http://changeup.dev/article/' . $post['id']
)
)
);
$result = $this->fb->api('/me/feed/', 'post', $attachment);
$this->json($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment