当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorApplicationTransaction::getToken方法代码示例

本文整理汇总了PHP中PhabricatorApplicationTransaction::getToken方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorApplicationTransaction::getToken方法的具体用法?PHP PhabricatorApplicationTransaction::getToken怎么用?PHP PhabricatorApplicationTransaction::getToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorApplicationTransaction的用法示例。


在下文中一共展示了PhabricatorApplicationTransaction::getToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderEvent

 private function renderEvent(PhabricatorApplicationTransaction $xaction, array $group)
 {
     $viewer = $this->getUser();
     $event = id(new PHUITimelineEventView())->setUser($viewer)->setAuthorPHID($xaction->getAuthorPHID())->setTransactionPHID($xaction->getPHID())->setUserHandle($xaction->getHandle($xaction->getAuthorPHID()))->setIcon($xaction->getIcon())->setColor($xaction->getColor())->setHideCommentOptions($this->getHideCommentOptions());
     list($token, $token_removed) = $xaction->getToken();
     if ($token) {
         $event->setToken($token, $token_removed);
     }
     if (!$this->shouldSuppressTitle($xaction, $group)) {
         if ($this->renderAsFeed) {
             $title = $xaction->getTitleForFeed();
         } else {
             $title = $xaction->getTitle();
         }
         if ($xaction->hasChangeDetails()) {
             if (!$this->isPreview) {
                 $details = $this->buildChangeDetailsLink($xaction);
                 $title = array($title, ' ', $details);
             }
         }
         if (!$this->isPreview) {
             $more = $this->buildExtraInformationLink($xaction);
             if ($more) {
                 $title = array($title, ' ', $more);
             }
         }
         $event->setTitle($title);
     }
     if ($this->isPreview) {
         $event->setIsPreview(true);
     } else {
         $event->setDateCreated($xaction->getDateCreated())->setContentSource($xaction->getContentSource())->setAnchor($xaction->getID());
     }
     $transaction_type = $xaction->getTransactionType();
     $comment_type = PhabricatorTransactions::TYPE_COMMENT;
     $is_normal_comment = $transaction_type == $comment_type;
     if ($this->getShowEditActions() && !$this->isPreview && $is_normal_comment) {
         $has_deleted_comment = $xaction->getComment() && $xaction->getComment()->getIsDeleted();
         $has_removed_comment = $xaction->getComment() && $xaction->getComment()->getIsRemoved();
         if ($xaction->getCommentVersion() > 1 && !$has_removed_comment) {
             $event->setIsEdited(true);
         }
         if (!$has_removed_comment) {
             $event->setIsNormalComment(true);
         }
         // If we have a place for quoted text to go and this is a quotable
         // comment, pass the quote target ID to the event view.
         if ($this->getQuoteTargetID()) {
             if ($xaction->hasComment()) {
                 if (!$has_removed_comment && !$has_deleted_comment) {
                     $event->setQuoteTargetID($this->getQuoteTargetID());
                     $event->setQuoteRef($this->getQuoteRef());
                 }
             }
         }
         $can_edit = PhabricatorPolicyCapability::CAN_EDIT;
         if ($xaction->hasComment() || $has_deleted_comment) {
             $has_edit_capability = PhabricatorPolicyFilter::hasCapability($viewer, $xaction, $can_edit);
             if ($has_edit_capability && !$has_removed_comment) {
                 $event->setIsEditable(true);
             }
             if ($has_edit_capability || $viewer->getIsAdmin()) {
                 if (!$has_removed_comment) {
                     $event->setIsRemovable(true);
                 }
             }
         }
     }
     $comment = $this->renderTransactionContent($xaction);
     if ($comment) {
         $event->appendChild($comment);
     }
     return $event;
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:74,代码来源:PhabricatorApplicationTransactionView.php


注:本文中的PhabricatorApplicationTransaction::getToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。