Esempio n. 1
0
 function Comment($params)
 {
     // this is a POST request.
     if (array_key_exists('post_xid', $params) && array_key_exists('content', $params)) {
         if (array_key_exists('session', $params)) {
             $this->post_authenticated_comment($params);
             return;
         } else {
             // Anonymous comment posts require the 'name' and 'href' AND EMAIL AND BLOG_XID parameters.
             if (array_key_exists('name', $params) && array_key_exists('href', $params) && array_key_exists('email', $params) && array_key_exists('blog_xid', $params)) {
                 $this->post_anonymous_comment($params);
             } else {
                 debug("[Comment::Comment] Anonymous comments require 'name', 'href', 'email', and 'blog_xid parameters.");
                 return;
             }
         }
         return;
     }
     // Allow creation of a Comment shell to allow other Commenting Services
     // to take on its form.
     if (!array_key_exists('xid', $params) && !array_key_exists('json', $params)) {
         return;
     }
     if (!array_key_exists('json', $params)) {
         $params['json'] = pull_json(get_entry_api_url($params['xid']));
     }
     $this->author = new Author(array('xid' => $params['json']->author->urlId, 'json' => $params['json']->author));
     $this->content = $params['json']->content;
     $this->xid = $params['json']->urlId;
     /*          $datetime =  new DateTime($comment_json->published);
               debug ("Timestamp would have been: " . $datetime->format('F d, Y g:ia'));
     */
     // FOR PHP 5.1.6 COMPATIBILITY.
     $this->timestamp = new TPDate($params['json']->published);
 }
Esempio n. 2
0
 function Entry($params)
 {
     if (!array_key_exists('xid', $params)) {
         debug("[Entry::Entry] The entry XID is required in the constructor...");
         return;
     }
     if (!array_key_exists('json', $params)) {
         $params['json'] = pull_json(get_entry_api_url($params['xid']));
     }
     // otherwise, ($type == 'json'), format is ready to parse.
     $this->title = get_entry_title($params['json']);
     $this->body = $params['json']->content;
     $this->permalink = $params['json']->permalinkUrl;
     $this->thumbnail = get_first_thumbnail($params['json']->embeddedImageLinks);
     $this->xid = $params['json']->urlId;
     $this->author = new Author(array('xid' => $params['json']->author->urlId, 'json' => $params['json']->author));
     // GETTING RID OF DateTime for PHP 5.1.6 compatibility
     //       $date =  new DateTime($entry_json->published);
     //       $this->timestamp = print_timestamp($date);
     $this->timestamp = new TPDate($params['json']->published);
 }