function Post($params) { // otherwise, use the param keys to insert the author data. $keys = array('xid', 'blog_xid', 'fb_id', 'permalink', 'content', 'site_id'); foreach ($keys as $key) { if (array_key_exists($key, $params)) { $this->{$key} = $params[$key]; } else { $this->{$key} = 0; } } if ($this->blog_xid and $this->permalink) { $json = '{"permalinkUrl":"' . $this->permalink . '"}'; $post_url = get_tpconnect_external_assets_api_url($this->blog_xid); $events = post_json($post_url, $json); $this->xid = $events->asset->urlId; debug("[Post::Post] this XID = " . $this->xid); } $this->comment_listing = array(); if ($this->content) { $this->content = urldecode($this->content); } if (!array_key_exists('READ_ONLY', $params)) { if (array_key_exists('fb_prefix', $params) && array_key_exists('xid', $params)) { $this->fb_id = $params['fb_prefix'] . $params['xid']; } $this->update_post_content(); // IF we have a parent site, we should start a FB session. if ($this->site_id) { $this->facebook = start_fb_session(get_fb_api_key($this->site_id), get_fb_api_secret($this->site_id)); } } }
<html> <head> <title>TypePad Comment Testing.</title> <link rel="stylesheet" href="debug_styles.css" type="text/css" /> <?php require_once 'rousseau-includes/rousseau-utilities.php'; //start_db_connection(); $facebook = start_fb_session(); $url = ""; $post = ""; $xid = '6a00e5539faa3b88330120a7b004e2970b'; $url = 'http://www.typepad.com'; if ($_SERVER['REQUEST_METHOD'] == 'GET') { $xid = $_GET['xid']; $url = $_GET['url']; } else { if ($_SERVER['REQUEST_METHOD'] == 'POST') { $xid = $_POST['xid']; $url = $_POST['url']; $fb_prefix = $_POST['fb_prefix']; } } $params = array(); $params['xid'] = $xid; $params['permalink'] = $url; if (array_key_exists('fb_prefix', $_GET)) { } $entry = new Post($_GET);
<?php require_once 'rousseau-includes/rousseau-utilities.php'; //include_local_css(); ?> <h1>Recent Posts</h1> <?php $site_id = $_GET['rousseau_id']; if (!$site_id) { $site_id = $_POST['rousseau_id']; } $url = 'http://dev3.apperceptive.com/rousseau/posts.php?rousseau_id=' . $site_id; $handle = fopen($url, "rb"); $doc = stream_get_contents($handle); $events = json_decode($doc); if ($events) { start_fb_session($events->{'api_key'}, $events->{'api_secret'}); foreach ($events->{'entries'} as $entry) { echo "\n <div class='wallkit_frame clearfix'>\n <div class='wallkit_post'>\n <div class='wallkit_postcontent clearfix'>" . $entry->content . "\n \n <div class='commentable_item'>\n <fb:comments xid='" . $entry->xid . "' can_post='true' candelete='false'>\n </fb:comments>\n </div>\n\n </div>\n </div>\n </div>"; } } else { echo "<p>There aren't any posts yet.</p>"; }