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


PHP PhabricatorMarkupEngine::newMarkupEngine方法代码示例

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


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

示例1: addRemarkupSection

 public function addRemarkupSection($header, $text)
 {
     try {
         $engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $engine->setConfig('viewer', $this->getViewer());
         $engine->setMode(PhutilRemarkupEngine::MODE_TEXT);
         $styled_text = $engine->markupText($text);
         $this->addPlaintextSection($header, $styled_text);
     } catch (Exception $ex) {
         phlog($ex);
         $this->addTextSection($header, $text);
     }
     try {
         $mail_engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $mail_engine->setConfig('viewer', $this->getViewer());
         $mail_engine->setMode(PhutilRemarkupEngine::MODE_HTML_MAIL);
         $mail_engine->setConfig('uri.base', PhabricatorEnv::getProductionURI('/'));
         $html = $mail_engine->markupText($text);
         $this->addHTMLSection($header, $html);
     } catch (Exception $ex) {
         phlog($ex);
         $this->addHTMLSection($header, $text);
     }
     return $this;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:25,代码来源:PhabricatorMetaMTAMailBody.php

示例2: addRemarkupSection

 public function addRemarkupSection($text)
 {
     try {
         $engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $engine->setConfig('viewer', $this->getViewer());
         $engine->setMode(PhutilRemarkupEngine::MODE_TEXT);
         $styled_text = $engine->markupText($text);
         $this->sections[] = $styled_text;
     } catch (Exception $ex) {
         phlog($ex);
         $this->sections[] = $text;
     }
     try {
         $mail_engine = PhabricatorMarkupEngine::newMarkupEngine(array());
         $mail_engine->setConfig('viewer', $this->getViewer());
         $mail_engine->setMode(PhutilRemarkupEngine::MODE_HTML_MAIL);
         $mail_engine->setConfig('uri.base', PhabricatorEnv::getProductionURI('/'));
         $html = $mail_engine->markupText($text);
         $this->htmlSections[] = $html;
     } catch (Exception $ex) {
         phlog($ex);
         $this->htmlSections[] = phutil_escape_html_newlines(phutil_tag('div', array(), $text));
     }
     return $this;
 }
开发者ID:hrb518,项目名称:phabricator,代码行数:25,代码来源:PhabricatorMetaMTAMailBody.php

示例3: getEngine

 private function getEngine()
 {
     $options = $this->options;
     $viewer = $this->getViewer();
     $viewer_key = $viewer->getCacheFragment();
     ksort($options);
     $engine_key = serialize($options);
     $engine_key = PhabricatorHash::digestForIndex($engine_key);
     $cache = PhabricatorCaches::getRequestCache();
     $cache_key = "remarkup.engine({$viewer_key}, {$engine_key})";
     $engine = $cache->getKey($cache_key);
     if (!$engine) {
         $engine = PhabricatorMarkupEngine::newMarkupEngine($options);
         $cache->setKey($cache_key, $engine);
     }
     return $engine;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:17,代码来源:PHUIRemarkupView.php

示例4: renderForAsanaBridge

 public function renderForAsanaBridge($implied_context = false)
 {
     $data = $this->getStoryData();
     $comment = $data->getValue('content');
     $author_name = $this->getHandle($this->getAuthorPHID())->getName();
     $action = $this->getValue('action');
     $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action);
     $commit_phid = $this->getPrimaryObjectPHID();
     $commit_name = $this->getHandle($commit_phid)->getFullName();
     if ($implied_context) {
         $title = "{$author_name} {$verb} this commit.";
     } else {
         $title = "{$author_name} {$verb} commit {$commit_name}.";
     }
     if (strlen($comment)) {
         $engine = PhabricatorMarkupEngine::newMarkupEngine(array())->setConfig('viewer', new PhabricatorUser())->setMode(PhutilRemarkupEngine::MODE_TEXT);
         $comment = $engine->markupText($comment);
         $title .= "\n\n";
         $title .= $comment;
     }
     return $title;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:22,代码来源:PhabricatorFeedStoryAudit.php

示例5: newMarkupEngine

 public function newMarkupEngine($field)
 {
     return PhabricatorMarkupEngine::newMarkupEngine(array());
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:4,代码来源:PhabricatorRepository.php

示例6: renderForAsanaBridge

 public function renderForAsanaBridge($implied_context = false)
 {
     $data = $this->getStoryData();
     $comment = $data->getValue('feedback_content');
     $author_name = $this->getHandle($this->getAuthorPHID())->getName();
     $action = $this->getValue('action');
     $engine = PhabricatorMarkupEngine::newMarkupEngine(array())->setConfig('viewer', new PhabricatorUser())->setMode(PhutilRemarkupEngine::MODE_TEXT);
     $revision_phid = $this->getPrimaryObjectPHID();
     $revision_name = $this->getHandle($revision_phid)->getFullName();
     if ($implied_context) {
         $title = DifferentialAction::getBasicStoryText($action, $author_name);
     } else {
         switch ($action) {
             case DifferentialAction::ACTION_COMMENT:
                 $title = pht('%s commented on revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ACCEPT:
                 $title = pht('%s accepted revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_REJECT:
                 $title = pht('%s requested changes to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_RETHINK:
                 $title = pht('%s planned changes to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ABANDON:
                 $title = pht('%s abandoned revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_CLOSE:
                 $title = pht('%s closed revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_REQUEST:
                 $title = pht('%s requested a review of revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_RECLAIM:
                 $title = pht('%s reclaimed revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_UPDATE:
                 $title = pht('%s updated revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_RESIGN:
                 $title = pht('%s resigned from revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_SUMMARIZE:
                 $title = pht('%s summarized revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_TESTPLAN:
                 $title = pht('%s explained the test plan for revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_CREATE:
                 $title = pht('%s created revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ADDREVIEWERS:
                 $title = pht('%s added reviewers to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_ADDCCS:
                 $title = pht('%s added CCs to revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_CLAIM:
                 $title = pht('%s commandeered revision %s', $author_name, $revision_name);
                 break;
             case DifferentialAction::ACTION_REOPEN:
                 $title = pht('%s reopened revision %s', $author_name, $revision_name);
                 break;
             case DifferentialTransaction::TYPE_INLINE:
                 $title = pht('%s added inline comments to %s', $author_name, $revision_name);
                 break;
             default:
                 $title = pht('%s edited revision %s', $author_name, $revision_name);
                 break;
         }
     }
     if (strlen($comment)) {
         $comment = $engine->markupText($comment);
         $title .= "\n\n";
         $title .= $comment;
     }
     // Roughly render inlines into the comment.
     $xaction_phids = $data->getValue('temporaryTransactionPHIDs');
     if ($xaction_phids) {
         $inlines = id(new DifferentialTransactionQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withPHIDs($xaction_phids)->needComments(true)->withTransactionTypes(array(DifferentialTransaction::TYPE_INLINE))->execute();
         if ($inlines) {
             $title .= "\n\n";
             $title .= pht('Inline Comments');
             $title .= "\n";
             $changeset_ids = array();
             foreach ($inlines as $inline) {
                 $changeset_ids[] = $inline->getComment()->getChangesetID();
             }
             $changesets = id(new DifferentialChangeset())->loadAllWhere('id IN (%Ld)', $changeset_ids);
             foreach ($inlines as $inline) {
                 $comment = $inline->getComment();
                 $changeset = idx($changesets, $comment->getChangesetID());
                 if (!$changeset) {
                     continue;
                 }
                 $filename = $changeset->getDisplayFilename();
                 $linenumber = $comment->getLineNumber();
                 $inline_text = $engine->markupText($comment->getContent());
                 $inline_text = rtrim($inline_text);
//.........这里部分代码省略.........
开发者ID:denghp,项目名称:phabricator,代码行数:101,代码来源:PhabricatorFeedStoryDifferential.php

示例7: renderAsTextForDoorkeeper

 public function renderAsTextForDoorkeeper(DoorkeeperFeedStoryPublisher $publisher, PhabricatorFeedStory $story, array $xactions)
 {
     $body = parent::renderAsTextForDoorkeeper($publisher, $story, $xactions);
     $inlines = array();
     foreach ($xactions as $xaction) {
         if ($xaction->getTransactionType() == self::TYPE_INLINE) {
             $inlines[] = $xaction;
         }
     }
     // TODO: This is a bit gross, but far less bad than it used to be. It
     // could be further cleaned up at some point.
     if ($inlines) {
         $engine = PhabricatorMarkupEngine::newMarkupEngine(array())->setConfig('viewer', new PhabricatorUser())->setMode(PhutilRemarkupEngine::MODE_TEXT);
         $body .= "\n\n";
         $body .= pht('Inline Comments');
         $body .= "\n";
         $changeset_ids = array();
         foreach ($inlines as $inline) {
             $changeset_ids[] = $inline->getComment()->getChangesetID();
         }
         $changesets = id(new DifferentialChangeset())->loadAllWhere('id IN (%Ld)', $changeset_ids);
         foreach ($inlines as $inline) {
             $comment = $inline->getComment();
             $changeset = idx($changesets, $comment->getChangesetID());
             if (!$changeset) {
                 continue;
             }
             $filename = $changeset->getDisplayFilename();
             $linenumber = $comment->getLineNumber();
             $inline_text = $engine->markupText($comment->getContent());
             $inline_text = rtrim($inline_text);
             $body .= "{$filename}:{$linenumber} {$inline_text}\n";
         }
     }
     return $body;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:36,代码来源:DifferentialTransaction.php

示例8: getBlockMarkupEngine

 protected function getBlockMarkupEngine()
 {
     $engine = PhabricatorMarkupEngine::newMarkupEngine(array());
     $engine->setConfig('preserve-linebreaks', false);
     $engine->setConfig('viewer', new PhabricatorUser());
     $engine->setConfig('diviner.renderer', $this);
     $engine->setConfig('header.generate-toc', true);
     return $engine;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:9,代码来源:DivinerDefaultRenderer.php

示例9: renderRemarkupContent

 private function renderRemarkupContent($content, $is_html)
 {
     $viewer = $this->getViewer();
     $production_uri = PhabricatorEnv::getProductionURI('/');
     if ($is_html) {
         $mode = PhutilRemarkupEngine::MODE_HTML_MAIL;
     } else {
         $mode = PhutilRemarkupEngine::MODE_TEXT;
     }
     $attributes = array('style' => 'padding: 0; margin: 8px;');
     $engine = PhabricatorMarkupEngine::newMarkupEngine(array())->setConfig('viewer', $viewer)->setConfig('uri.base', $production_uri)->setConfig('default.p.attributes', $attributes)->setMode($mode);
     try {
         return $engine->markupText($content);
     } catch (Exception $ex) {
         return $content;
     }
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:17,代码来源:DifferentialInlineCommentMailView.php


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