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


PHP PhabricatorMarkupEngine::renderOneObject方法代码示例

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


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

示例1: renderProperties

 private function renderProperties(PhameBlog $blog, PhabricatorUser $viewer, PhabricatorActionListView $actions)
 {
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips');
     $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($blog)->setActionList($actions);
     $skin = $blog->getSkin();
     if (!$skin) {
         $skin = pht('(No external skin)');
     }
     $domain = $blog->getDomain();
     if (!$domain) {
         $domain = pht('(No external domain)');
     }
     $properties->addProperty(pht('Skin'), $skin);
     $properties->addProperty(pht('Domain'), $domain);
     $feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
     $properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
     $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $blog);
     $properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
     $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
     $properties->invokeWillRenderEvent();
     if (strlen($blog->getDescription())) {
         $description = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($blog->getDescription()), 'default', $viewer);
         $properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
         $properties->addTextContent($description);
     }
     return $properties;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:28,代码来源:PhameBlogManageController.php

示例2: renderItemCommonProperties

 private function renderItemCommonProperties(PhabricatorUser $viewer, NuanceItem $item, PHUIPropertyListView $view)
 {
     $complaint = $item->getNuanceProperty('complaint');
     $complaint = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($complaint), 'default', $viewer);
     $view->addSectionHeader(pht('Complaint'), 'fa-exclamation-circle');
     $view->addTextContent($complaint);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:NuancePhabricatorFormSourceDefinition.php

示例3: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $books = id(new DivinerBookQuery())->setViewer($viewer)->execute();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->setBorder(true);
     $crumbs->addTextCrumb(pht('Books'));
     $query_button = id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI('query/'))->setText(pht('Advanced Search'))->setIcon('fa-search');
     $header = id(new PHUIHeaderView())->setHeader(pht('Documentation Books'))->addActionLink($query_button);
     $document = new PHUIDocumentViewPro();
     $document->setHeader($header);
     $document->addClass('diviner-view');
     if ($books) {
         $books = msort($books, 'getTitle');
         $list = array();
         foreach ($books as $book) {
             $item = id(new DivinerBookItemView())->setTitle($book->getTitle())->setHref('/book/' . $book->getName() . '/')->setSubtitle($book->getPreface());
             $list[] = $item;
         }
         $list = id(new PHUIBoxView())->addPadding(PHUI::PADDING_MEDIUM_TOP)->appendChild($list);
         $document->appendChild($list);
     } else {
         $text = pht("(NOTE) **Looking for Phabricator documentation?** " . "If you're looking for help and information about Phabricator, " . "you can [[https://secure.phabricator.com/diviner/ | " . "browse the public Phabricator documentation]] on the live site.\n\n" . "Diviner is the documentation generator used to build the " . "Phabricator documentation.\n\n" . "You haven't generated any Diviner documentation books yet, so " . "there's nothing to show here. If you'd like to generate your own " . "local copy of the Phabricator documentation and have it appear " . "here, run this command:\n\n" . "  %s\n\n", 'phabricator/ $ ./bin/diviner generate');
         $text = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($text), 'default', $viewer);
         $document->appendChild($text);
     }
     return $this->buildApplicationPage(array($crumbs, $document), array('title' => pht('Documentation Books')));
 }
开发者ID:truSense,项目名称:phabricator,代码行数:28,代码来源:DivinerMainController.php

示例4: renderPropertyViewValue

 public function renderPropertyViewValue(array $handles)
 {
     if (!strlen($this->getValue())) {
         return null;
     }
     return PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setPreserveLinebreaks(true)->setContent($this->getValue()), 'default', $this->getViewer());
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:DifferentialRevertPlanField.php

示例5: appendRemarkupInstructions

 public function appendRemarkupInstructions($remarkup)
 {
     if ($this->getUser() === null) {
         throw new Exception('Call `setUser` before appending Remarkup to PHUIFormLayoutView.');
     }
     return $this->appendInstructions(PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($remarkup), 'default', $this->getUser()));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:7,代码来源:PHUIFormLayoutView.php

示例6: renderExample

    public function renderExample()
    {
        $viewer = $this->getRequest()->getUser();
        $content = pht(<<<EOCONTENT
This is some **remarkup text** using ~~exactly one style~~ //various styles//.

  - Fruit
    - Apple
    - Banana
    - Cherry
  - Vegetables
    1. Carrot
    2. Celery

NOTE: This is a note.

(NOTE) This is also a note.

WARNING: This is a warning.

(WARNING) This is also a warning.

IMPORTANT: This is not really important.

(IMPORTANT) This isn't important either.

EOCONTENT
);
        $remarkup = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($content), 'default', $viewer);
        $frame = id(new PHUIBoxView())->addPadding(PHUI::PADDING_LARGE)->appendChild($remarkup);
        return id(new PHUIObjectBoxView())->setHeaderText(pht('Remarkup Example'))->appendChild($frame);
    }
开发者ID:denghp,项目名称:phabricator,代码行数:32,代码来源:PhabricatorRemarkupExample.php

示例7: getTagContent

 protected function getTagContent()
 {
     require_celerity_resource('ponder-view-css');
     $answer = $this->answer;
     $viewer = $this->getUser();
     $author_phid = $answer->getAuthorPHID();
     $actions = $this->buildAnswerActions();
     $action_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Actions'))->setHref('#')->setIconFont('fa-bars')->setDropdownMenu($actions);
     $header = id(new PHUIHeaderView())->setUser($viewer)->setEpoch($answer->getDateCreated())->setHeader($viewer->renderHandle($author_phid))->addActionLink($action_button);
     $content = phutil_tag('div', array('class' => 'phabricator-remarkup mlt mlb msr msl'), PhabricatorMarkupEngine::renderOneObject($answer, $answer->getMarkupField(), $viewer));
     $id = $answer->getID();
     $anchor = id(new PhabricatorAnchorView())->setAnchorName("A{$id}");
     $content_id = celerity_generate_unique_node_id();
     $footer = id(new PonderFooterView())->setContentID($content_id)->setCount(count($this->transactions));
     $votes = $answer->getVoteCount();
     if ($votes) {
         $icon = id(new PHUIIconView())->setIconFont('fa-thumbs-up');
         $helpful = phutil_tag('span', array('class' => 'ponder-footer-action'), array($votes, $icon));
         $footer->addAction($helpful);
     }
     $answer_view = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($anchor)->appendChild($content)->appendChild($footer);
     $transaction_view = id(new PhabricatorApplicationTransactionView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setTransactions($this->transactions)->setMarkupEngine($this->engine);
     $comment_view = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setShowPreview(false)->setHeaderText(pht('Answer Comment'))->setAction("/ponder/answer/comment/{$id}/")->setSubmitButtonName(pht('Comment'));
     $hidden_view = phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), array($transaction_view, $comment_view));
     return array($answer_view, $hidden_view);
 }
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:26,代码来源:PonderAnswerView.php

示例8: appendRemarkupInstructions

 public function appendRemarkupInstructions($remarkup)
 {
     if ($this->getUser() === null) {
         throw new PhutilInvalidStateException('setUser');
     }
     return $this->appendInstructions(PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($remarkup), 'default', $this->getUser()));
 }
开发者ID:pugong,项目名称:phabricator,代码行数:7,代码来源:PHUIFormLayoutView.php

示例9: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $books = id(new DivinerBookQuery())->setViewer($viewer)->execute();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Books'));
     $search_icon = id(new PHUIIconView())->setIconFont('fa-search');
     $query_button = id(new PHUIButtonView())->setTag('a')->setHref($this->getApplicationURI('query/'))->setText(pht('Advanced Search'))->setIcon($search_icon);
     $header = id(new PHUIHeaderView())->setHeader(pht('Documentation Books'))->addActionLink($query_button);
     $document = new PHUIDocumentView();
     $document->setHeader($header);
     $document->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS);
     $document->addClass('diviner-view');
     if ($books) {
         $books = msort($books, 'getTitle');
         $list = array();
         foreach ($books as $book) {
             $item = id(new DivinerBookItemView())->setTitle($book->getTitle())->setHref('/book/' . $book->getName() . '/')->setSubtitle($book->getPreface());
             $list[] = $item;
         }
         $list = id(new PHUIBoxView())->addPadding(PHUI::PADDING_LARGE_LEFT)->addPadding(PHUI::PADDING_LARGE_RIGHT)->addPadding(PHUI::PADDING_SMALL_TOP)->addPadding(PHUI::PADDING_SMALL_BOTTOM)->appendChild($list);
         $document->appendChild($list);
     } else {
         $text = pht("(NOTE) **Looking for Phabricator documentation?** If you're looking " . "for help and information about Phabricator, you can " . "[[ https://secure.phabricator.com/diviner/ | browse the public " . "Phabricator documentation ]] on the live site.\n\n" . "Diviner is the documentation generator used to build the Phabricator " . "documentation.\n\n" . "You haven't generated any Diviner documentation books yet, so " . "there's nothing to show here. If you'd like to generate your own " . "local copy of the Phabricator documentation and have it appear " . "here, run this command:\n\n" . "  phabricator/ \$ ./bin/diviner generate\n\n" . "Right now, Diviner isn't very useful for generating documentation " . "for projects other than Phabricator. If you're interested in using " . "it in your own projects, leave feedback for us on " . "[[ https://secure.phabricator.com/T4558 | T4558 ]].");
         $text = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($text), 'default', $viewer);
         $document->appendChild($text);
     }
     return $this->buildApplicationPage(array($crumbs, $document), array('title' => pht('Documentation Books'), 'fonts' => true));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:30,代码来源:DivinerMainController.php

示例10: buildPropertyView

 private function buildPropertyView(PhabricatorApplication $application, PhabricatorActionListView $actions)
 {
     $viewer = $this->getRequest()->getUser();
     $properties = id(new PHUIPropertyListView());
     $properties->setActionList($actions);
     $properties->addProperty(pht('Description'), $application->getShortDescription());
     if ($application->getFlavorText()) {
         $properties->addProperty(null, phutil_tag('em', array(), $application->getFlavorText()));
     }
     if ($application->isPrototype()) {
         $proto_href = PhabricatorEnv::getDoclink('User Guide: Prototype Applications');
         $learn_more = phutil_tag('a', array('href' => $proto_href, 'target' => '_blank'), pht('Learn More'));
         $properties->addProperty(pht('Prototype'), pht('This application is a prototype. %s', $learn_more));
     }
     $overview = $application->getOverview();
     if ($overview) {
         $properties->addSectionHeader(pht('Overview'), PHUIPropertyListView::ICON_SUMMARY);
         $properties->addTextContent(PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($overview), 'default', $viewer));
     }
     $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $application);
     $properties->addSectionHeader(pht('Policies'), 'fa-lock');
     foreach ($application->getCapabilities() as $capability) {
         $properties->addProperty($application->getCapabilityLabel($capability), idx($descriptions, $capability));
     }
     return $properties;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:26,代码来源:PhabricatorApplicationDetailViewController.php

示例11: getTagContent

 protected function getTagContent()
 {
     require_celerity_resource('ponder-view-css');
     $answer = $this->answer;
     $viewer = $this->getUser();
     $status = $answer->getStatus();
     $author_phid = $answer->getAuthorPHID();
     $actions = $this->buildAnswerActions();
     $handle = $this->handle;
     $id = $answer->getID();
     if ($status == PonderAnswerStatus::ANSWER_STATUS_HIDDEN) {
         $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $answer, PhabricatorPolicyCapability::CAN_EDIT);
         $message = array();
         $message[] = phutil_tag('em', array(), pht('This answer has been hidden.'));
         if ($can_edit) {
             $message[] = phutil_tag('a', array('href' => "/ponder/answer/edit/{$id}/"), pht('Edit Answer'));
         }
         $message = phutil_implode_html(' ', $message);
         return id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($message);
     }
     $action_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Actions'))->setHref('#')->setIcon('fa-bars')->setDropdownMenu($actions);
     $header_name = phutil_tag('a', array('href' => $handle->getURI()), $handle->getName());
     $header = id(new PHUIHeaderView())->setUser($viewer)->setEpoch($answer->getDateModified())->setHeader($header_name)->addActionLink($action_button)->setImage($handle->getImageURI())->setImageURL($handle->getURI());
     $content = phutil_tag('div', array('class' => 'phabricator-remarkup'), PhabricatorMarkupEngine::renderOneObject($answer, $answer->getMarkupField(), $viewer));
     $anchor = id(new PhabricatorAnchorView())->setAnchorName("A{$id}");
     $content_id = celerity_generate_unique_node_id();
     $footer = id(new PonderFooterView())->setContentID($content_id)->setCount(count($this->transactions));
     $content = phutil_tag_div('ponder-answer-content', array($anchor, $content, $footer));
     $answer_view = id(new PHUIObjectBoxView())->setHeader($header)->setBackground(PHUIObjectBoxView::GREY)->addClass('ponder-answer')->appendChild($content);
     $comment_view = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setShowPreview(false)->setHeaderText(pht('Answer Comment'))->setAction("/ponder/answer/comment/{$id}/")->setSubmitButtonName(pht('Comment'));
     $hidden_view = phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), array($this->timeline, $comment_view));
     return array($answer_view, $hidden_view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:33,代码来源:PonderAnswerView.php

示例12: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $class = $request->getURIData('class');
     $sources = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorTypeaheadDatasource')->loadObjects();
     if (!isset($sources[$class])) {
         return new Aphront404Response();
     }
     $source = $sources[$class];
     $application_class = $source->getDatasourceApplicationClass();
     if ($application_class) {
         $result = id(new PhabricatorApplicationQuery())->setViewer($this->getViewer())->withClasses(array($application_class))->execute();
         if (!$result) {
             return new Aphront404Response();
         }
     }
     $source->setViewer($viewer);
     $title = pht('Typeahead Function Help');
     $functions = $source->getAllDatasourceFunctions();
     ksort($functions);
     $content = array();
     $content[] = '= ' . pht('Overview');
     $content[] = pht('Typeahead functions are an advanced feature which allow you to build ' . 'more powerful queries. This document explains functions available ' . 'for the selected control.' . "\n\n" . 'For general help with search, see the [[ %s | Search User Guide ]] in ' . 'the documentation.' . "\n\n" . 'Note that different controls support //different// functions ' . '(depending on what the control is doing), so these specific functions ' . 'may not work everywhere. You can always check the help for a control ' . 'to review which functions are available for that control.', PhabricatorEnv::getDoclink('Search User Guide'));
     $table = array();
     $table_header = array(pht('Function'), pht('Token Name'), pht('Summary'));
     $table[] = '| ' . implode(' | ', $table_header) . ' |';
     $table[] = '|---|---|---|';
     foreach ($functions as $function => $spec) {
         $spec = $spec + array('summary' => null, 'arguments' => null);
         if (idx($spec, 'arguments')) {
             $signature = '**' . $function . '(**//' . $spec['arguments'] . '//**)**';
         } else {
             $signature = '**' . $function . '()**';
         }
         $name = idx($spec, 'name', '');
         $summary = idx($spec, 'summary', '');
         $table[] = '| ' . $signature . ' | ' . $name . ' | ' . $summary . ' |';
     }
     $table = implode("\n", $table);
     $content[] = '= ' . pht('Function Quick Reference');
     $content[] = pht('This table briefly describes available functions for this control. ' . 'For details on a particular function, see the corresponding section ' . 'below.');
     $content[] = $table;
     $content[] = '= ' . pht('Using Typeahead Functions');
     $content[] = pht("In addition to typing user and project names to build queries, you can " . "also type the names of special functions which give you more options " . "and the ability to express more complex queries.\n\n" . "Functions have an internal name (like `%s`) and a human-readable name, " . "like `Current Viewer`. In general, you can type either one to select " . "the function. You can also click the {nav icon=search} button on any " . "typeahead control to browse available functions and find this " . "documentation.\n\n" . "This documentation uses the internal names to make it clear where " . "tokens begin and end. Specifically, you will find queries written " . "out like this in the documentation:\n\n%s\n\n" . "When this query is actually shown in the control, it will look more " . "like this:\n\n%s", 'viewer()', '> viewer(), alincoln', '> {nav Current Viewer} {nav alincoln (Abraham Lincoln)}');
     $middot = "·";
     foreach ($functions as $function => $spec) {
         $arguments = idx($spec, 'arguments', '');
         $name = idx($spec, 'name');
         $content[] = '= ' . $function . '(' . $arguments . ') ' . $middot . ' ' . $name;
         $content[] = $spec['description'];
     }
     $content = implode("\n\n", $content);
     $content_box = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($content), 'default', $viewer);
     $header = id(new PHUIHeaderView())->setHeader($title);
     $document = id(new PHUIDocumentView())->setHeader($header)->appendChild($content_box);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Function Help'));
     return $this->buildApplicationPage(array($crumbs, $document), array('title' => $title));
 }
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:59,代码来源:PhabricatorTypeaheadFunctionHelpController.php

示例13: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $text = $request->getStr('text');
     $output = PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setPreserveLinebreaks(true)->setContent($text), 'default', $viewer);
     return id(new AphrontAjaxResponse())->setContent($output);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:8,代码来源:PhabricatorMarkupPreviewController.php

示例14: renderPropertyViewValue

 public function renderPropertyViewValue(array $handles)
 {
     $blurb = $this->getObject()->loadUserProfile()->getBlurb();
     if (!strlen($blurb)) {
         return null;
     }
     return PhabricatorMarkupEngine::renderOneObject(id(new PhabricatorMarkupOneOff())->setContent($blurb), 'default', $this->getViewer());
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:8,代码来源:PhabricatorUserBlurbField.php

示例15: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $body = $request->getStr('body');
     $post = id(new PhamePost())->setBody($body);
     $content = PhabricatorMarkupEngine::renderOneObject($post, PhamePost::MARKUP_FIELD_BODY, $viewer);
     $content = phutil_tag_div('phabricator-remarkup', $content);
     return id(new AphrontAjaxResponse())->setContent($content);
 }
开发者ID:hamilyjing,项目名称:phabricator,代码行数:9,代码来源:PhamePostPreviewController.php


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