protected function buildComment(XML_Atom_Feed $feed, BlorgComment $comment)
 {
     $post = $comment->post;
     $path = $this->getBlorgBaseHref() . 'archive';
     $date = clone $post->publish_date;
     $date->convertTZ($this->app->default_time_zone);
     $year = $date->getYear();
     $month_name = BlorgPageFactory::$month_names[$date->getMonth()];
     $post_uri = sprintf('%s/%s/%s/%s', $path, $year, $month_name, $post->shortname);
     $comment_uri = $post_uri . '#comment' . $comment->id;
     if ($comment->author !== null) {
         $author_name = $comment->author->name;
         if ($comment->author->visible) {
             $author_uri = $this->getBlorgBaseHref() . 'author/' . $comment->author->shortname;
             $author_email = $comment->author->email;
         } else {
             $author_uri = '';
             $author_email = '';
         }
     } else {
         $author_name = $comment->fullname;
         $author_uri = $comment->link;
         // don't show anonymous author email
         $author_email = '';
     }
     $entry = new XML_Atom_Entry($comment_uri, sprintf(Blorg::_('%s on ā€œ%sā€'), $author_name, $post->getTitle()), $comment->createdate);
     $entry->setContent(SiteCommentFilter::toXhtml($comment->bodytext), 'html');
     $entry->addAuthor($author_name, $author_uri, $author_email);
     $entry->addLink($comment_uri, 'alternate', 'text/html');
     $feed->addEntry($entry);
 }
Example #2
0
    protected function buildInternal()
    {
        parent::buildInternal();
        $item_list = $this->getItemList('integer');
        $instance_id = $this->app->getInstanceId();
        $dep = new AdminListDependency();
        $dep->setTitle(Blorg::_('comment'), Blorg::_('comments'));
        $sql = sprintf('select BlorgComment.id, BlorgComment.bodytext from BlorgComment
				inner join BlorgPost on BlorgPost.id = BlorgComment.post
			where instance %s %s and BlorgComment.id in (%s)
			order by BlorgComment.createdate desc, BlorgComment.id', SwatDB::equalityOperator($instance_id), $this->app->db->quote($instance_id, 'integer'), $item_list);
        $comments = SwatDB::query($this->app->db, $sql);
        $entries = array();
        foreach ($comments as $comment) {
            $entry = new AdminDependencyEntry();
            $entry->id = $comment->id;
            $entry->title = SwatString::ellipsizeRight(SwatString::condense(SiteCommentFilter::toXhtml($comment->bodytext)), 100);
            $entry->status_level = AdminDependency::DELETE;
            $entry->parent = null;
            $entries[] = $entry;
        }
        $dep->entries = $entries;
        $message = $this->ui->getWidget('confirmation_message');
        $message->content = $dep->getMessage();
        $message->content_type = 'text/xml';
        if ($dep->getStatusLevelCount(AdminDependency::DELETE) == 0) {
            $this->switchToCancelButton();
        }
    }
Example #3
0
 protected function buildComment(XML_Atom_Feed $feed, BlorgComment $comment)
 {
     $comment_uri = $this->getPostUri($this->post) . '#comment' . $comment->id;
     if ($comment->author !== null) {
         $author_name = $comment->author->name;
         if ($comment->author->visible) {
             $author_uri = $this->getBlorgBaseHref() . 'author/' . $this->post->author->shortname;
             $author_email = $this->post->author->email;
         } else {
             $author_uri = '';
             $author_email = '';
         }
     } else {
         $author_name = $comment->fullname;
         $author_uri = $comment->link;
         // don't show anonymous author email
         $author_email = '';
     }
     $entry = new XML_Atom_Entry($comment_uri, sprintf(Blorg::_('By: %s'), $author_name), $comment->createdate);
     $entry->setContent(SiteCommentFilter::toXhtml($comment->bodytext), 'html');
     $entry->addAuthor($author_name, $author_uri, $author_email);
     $entry->addLink($comment_uri, 'alternate', 'text/html');
     $feed->addEntry($entry);
 }
 protected function getEntry(PinholeComment $comment)
 {
     $photo_uri = $this->getPinholeBaseHref();
     $photo_uri .= 'photo/' . $comment->photo->id;
     $comment_uri = $photo_uri . '#comment' . $comment->id;
     if ($comment->photographer !== null) {
         $author_name = $comment->photographer->fullname;
         $author_uri = '';
         $author_email = '';
     } else {
         $author_name = $comment->fullname;
         $author_uri = $comment->link;
         $author_email = '';
     }
     $entry = new XML_Atom_Entry($comment_uri, sprintf(Pinhole::_('%s on ā€œ%sā€'), $author_name, $comment->photo->getTitle()), $comment->createdate);
     ob_start();
     $img_tag = $comment->photo->getImgTag('thumb');
     $a_tag = new SwatHtmlTag('a');
     $a_tag->href = $this->getPinholeBaseHref() . 'photo/' . $comment->photo->id;
     $a_tag->style = sprintf('display: block; position: absolute; ' . 'width: %dpx;', $img_tag->width);
     $a_tag->open();
     echo $img_tag;
     $a_tag->close();
     printf('<div style="margin-left: %dpx;">', $img_tag->width + 20);
     echo SiteCommentFilter::toXhtml($comment->bodytext);
     echo '</div>';
     $entry->setContent(ob_get_clean(), 'html');
     $entry->addAuthor($author_name, $author_uri, $author_email);
     $entry->addLink($comment_uri, 'alternate', 'text/html');
     return $entry;
 }