Пример #1
0
 function Author($params)
 {
     // Allow creationg of empty Author to allow
     // other services to override it.
     if (!array_key_exists('xid', $params) && !array_key_exists('json', $params) && !array_key_exists('username', $params)) {
         return;
     }
     $identifier = array();
     // otherwise, remember the unique identifier for this user.
     if (array_key_exists('xid', $params)) {
         $identifier['value'] = $params['xid'];
         $identifier['source'] = 'xid';
     } else {
         if (array_key_exists('json', $params)) {
             $identfier['value'] = $params['json']->urlId;
             $identifier['source'] = 'json';
         } else {
             $identifier['value'] = $params['username'];
             $identifier['source'] = 'username';
         }
     }
     if (!array_key_exists('json', $params)) {
         $params['json'] = pull_json(get_author_api_url($identifier['value']));
     }
     // in case the API request couldn't find that user, return.
     if (!$params['json']) {
         debug("[Author::Author] The user identified by " . $identifier['source'] . "'" . $identifier['value'] . "' was not found.");
         return;
     }
     // At this point, we should have valid JSON.
     $this->xid = $params['json']->urlId;
     $this->display_name = $params['json']->displayName;
     $this->profile_url = $params['json']->profilePageUrl;
     $this->username = $params['json']->preferredUsername;
     $this->avatar = get_resized_avatar($params['json'], 35);
 }
Пример #2
0
 function Author($params)
 {
     // Allow creationg of empty Author to allow
     // other services to override it.
     /*   if (!$xid) {
               return;
            }
     
            if (!$author_json) {
               $author_json = pull_json(get_author_api_url($xid));
            }*/
     if (array_key_exists('json', $params)) {
         $this->display_name = $params['json']->displayName;
         $this->profile_url = $params['json']->profilePageUrl;
         $this->avatar = get_resized_avatar($params['json'], 35);
     }
     // otherwise, use the param keys to insert the author data.
     $keys = array('display_name', 'profile_url', 'avatar');
     foreach ($keys as $key) {
         if (array_key_exists($key, $params)) {
             $this->{$key} = $params[$key];
         }
     }
 }
Пример #3
0
*/
   width: 600px;
   height: 50px;
}

img.connected {
   display: none !important;
}

</style>

<h1>Recently on <a href="http://nataliepo.typepad.com/hobbitted">Hobbitted</a>...</h1>

<?php 
$freebie_url = 'http://api.typepad.com/blogs/6a00e5539faa3b88330120a7aa0fdb970b/post-assets.json?max-results=5';
$handle = fopen($freebie_url, "rb");
$doc = stream_get_contents($handle);
/*$doc = str_replace('callback(','',$doc);
$doc = substr($doc,0,-1);*/
$events = json_decode($doc);
foreach ($events->{'entries'} as $entry) {
    echo "<div class='wallkit_frame clearfix'>\n    <div class='wallkit_post'>\n        <div class='wallkit_profilepic'>\n            <img src='" . get_resized_avatar($entry->author, 35) . "' />\n        </div>\n        \n        <div class='wallkit_postcontent clearfix'>\n        \n            <h4><span><a href='" . $entry->author->profilePageUrl . "'>" . $entry->author->displayName . "</a></span></h4>\n            <div class='braided_entry_outer'>";
    $thumbnail = get_first_thumbnail($entry->embeddedImageLinks);
    echo "\n               <div class='braided_thumbnail_outer'>\n            ";
    if ($thumbnail) {
        echo "\n                  <img class='braided_thumbnail' src='" . get_first_thumbnail($entry->embeddedImageLinks) . "' />\n               ";
    }
    //        $date =  new DateTime($entry->published);
    //        $timestamp = print_timestamp($date);
    echo "\n               </div>\n        \n               <div class='braided_entry'>\n                  <a href='" . $entry->permalinkUrl . "'>" . get_title($entry) . "</a>\n                  <p>" . chop_str($entry->content, 200) . "</p>\n               </div>\n            </div>\n            \n            <div class='commentable_item'>\n               <fb:comments xid='braided_comments-" . $entry->urlId . "' can_post='true' candelete='false'>" . "              </fb:comments>\n            </div>\n         </div>\n    </div>\n</div>";
}