id = $data['id']; } public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); $blog = id(new PhameBlogQuery()) ->setViewer($user) ->withIDs(array($this->id)) ->executeOne(); if (!$blog) { return new Aphront404Response(); } $posts = id(new PhamePostQuery()) ->setViewer($user) ->withBlogPHIDs(array($blog->getPHID())) ->withVisibility(PhamePost::VISIBILITY_PUBLISHED) ->withPublishedAfter(strtotime('-1 month')) ->execute(); $content = array(); $content[] = ''; $content[] = ''.phutil_escape_html($blog->getName()).''; $content[] = ''.phutil_escape_html(PhabricatorEnv::getProductionURI( '/phame/blog/view/'.$blog->getID().'/')).''; $updated = $blog->getDateModified(); if ($posts) { $updated = max($updated, max(mpull($posts, 'getDateModified'))); } $content[] = ''.date('c', $updated).''; $description = $blog->getDescription(); if ($description != '') { $content[] = ''.phutil_escape_html($description).''; } $engine = id(new PhabricatorMarkupEngine())->setViewer($user); foreach ($posts as $post) { $engine->addObject($post, PhamePost::MARKUP_FIELD_BODY); } $engine->process(); $bloggers = mpull($posts, 'getBloggerPHID'); $bloggers = id(new PhabricatorObjectHandleData($bloggers)) ->setViewer($user) ->loadHandles(); foreach ($posts as $post) { $content[] = ''; $content[] = ''.phutil_escape_html($post->getTitle()).''; $content[] = ''; $content[] = ''.phutil_escape_html(PhabricatorEnv::getProductionURI( '/phame/post/view/'.$post->getID().'/')).''; $content[] = ''. ''. phutil_escape_html($bloggers[$post->getBloggerPHID()]->getFullName()). ''. ''; $content[] = ''.date('c', $post->getDateModified()).''; $content[] = ''. '
'. $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY). '
'. '
'; $content[] = '
'; } $content[] = '
'; return id(new AphrontFileResponse()) ->setMimeType('application/xml') ->setContent(implode('', $content)); } }