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


PHP PhabricatorMarkupEngine::newPhameMarkupEngine方法代码示例

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


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

示例1: render

 public function render()
 {
     require_celerity_resource('phabricator-remarkup-css');
     $user = $this->getUser();
     $blogger = $this->getBlogger();
     $post = $this->getPost();
     $engine = PhabricatorMarkupEngine::newPhameMarkupEngine();
     $body = $engine->markupText($post->getBody());
     if ($post->isDraft()) {
         $uri = '/phame/draft/';
         $label = 'Back to Your Drafts';
     } else {
         $uri = '/phame/posts/' . $blogger->getUsername() . '/';
         $label = 'More Posts by ' . phutil_escape_html($blogger->getUsername());
     }
     $button = phutil_render_tag('a', array('href' => $uri, 'class' => 'grey button'), $label);
     $publish_date = $post->getDatePublished();
     if ($publish_date) {
         $caption = 'Published ' . phabricator_datetime($publish_date, $user);
     } else {
         $caption = 'Last edited ' . phabricator_datetime($post->getDateModified(), $user);
     }
     $caption .= ' by ' . phutil_render_tag('a', array('href' => new PhutilURI('/p/' . $blogger->getUsername() . '/')), phutil_escape_html($blogger->getUsername())) . '.';
     if ($this->isPreview()) {
         $width = AphrontPanelView::WIDTH_FULL;
     } else {
         $width = AphrontPanelView::WIDTH_WIDE;
     }
     $panel = id(new AphrontPanelView())->setHeader(phutil_escape_html($post->getTitle()))->appendChild('<div class="phabricator-remarkup">' . $body . '</div>')->setWidth($width)->addButton($button)->setCaption($caption);
     if ($user->getPHID() == $post->getBloggerPHID()) {
         if ($post->isDraft()) {
             $label = 'Edit Draft';
         } else {
             $label = 'Edit Post';
         }
         $button = phutil_render_tag('a', array('href' => $post->getEditURI(), 'class' => 'grey button'), $label);
         $panel->addButton($button);
     }
     switch ($post->getCommentsWidget()) {
         case 'facebook':
             $comments = $this->renderFacebookComments();
             break;
         case 'disqus':
             $comments = $this->renderDisqusComments();
             break;
         case 'none':
         default:
             $comments = null;
             break;
     }
     $panel->appendChild($comments);
     return $panel->render();
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:53,代码来源:PhamePostDetailView.php

示例2: newMarkupEngine

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

示例3: render

 public function render()
 {
     $user = $this->getUser();
     $posts = $this->getPosts();
     $bloggers = $this->getBloggers();
     $noun = $this->getPostNoun();
     if (empty($posts)) {
         $panel = id(new AphrontPanelView())->setHeader(sprintf('No %ss... Yet!', $noun))->setCaption('Will you answer the call to phame?')->setCreateButton(sprintf('New %s', $noun), sprintf('/phame/%s/new', strtolower($noun)));
         return $panel->render();
     }
     require_celerity_resource('phabricator-remarkup-css');
     $engine = PhabricatorMarkupEngine::newPhameMarkupEngine();
     $html = array();
     $actions = $this->getActions();
     foreach ($posts as $post) {
         $blogger_phid = $post->getBloggerPHID();
         $blogger = $bloggers[$blogger_phid];
         $updated = phabricator_datetime($post->getDateModified(), $user);
         $body = $engine->markupText($post->getBody());
         $panel = id(new AphrontPanelView())->setHeader(phutil_escape_html($post->getTitle()))->setCaption('Last updated ' . $updated)->appendChild('<div class="phabricator-remarkup">' . $body . '</div>');
         foreach ($actions as $action) {
             switch ($action) {
                 case 'view':
                     $uri = $post->getViewURI($blogger->getUsername());
                     $label = 'View ' . $noun;
                     break;
                 case 'edit':
                     $uri = $post->getEditURI();
                     $label = 'Edit ' . $noun;
                     break;
                 default:
                     break;
             }
             $button = phutil_render_tag('a', array('href' => $uri, 'class' => 'grey button'), $label);
             $panel->addButton($button);
         }
         $html[] = $panel->render();
     }
     return implode('', $html);
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:40,代码来源:PhamePostListView.php


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