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


PHP PhabricatorMarkupEngine::summarize方法代码示例

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


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

示例1: getAtomSummary

 public function getAtomSummary(DivinerAtom $atom)
 {
     if ($atom->getDocblockMetaValue('summary')) {
         return $atom->getDocblockMetaValue('summary');
     }
     $text = $this->getAtomDescription($atom);
     return PhabricatorMarkupEngine::summarize($text);
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:DivinerDefaultRenderer.php

示例2: getTagContent

 protected function getTagContent()
 {
     $viewer = $this->viewer;
     $posts = $this->posts;
     $nodata = $this->nodata;
     $handle_phids = array();
     foreach ($posts as $post) {
         $handle_phids[] = $post->getBloggerPHID();
         if ($post->getBlog()) {
             $handle_phids[] = $post->getBlog()->getPHID();
         }
     }
     $handles = $viewer->loadHandles($handle_phids);
     $list = array();
     foreach ($posts as $post) {
         $blogger = $handles[$post->getBloggerPHID()]->renderLink();
         $blogger_uri = $handles[$post->getBloggerPHID()]->getURI();
         $blogger_image = $handles[$post->getBloggerPHID()]->getImageURI();
         $phame_post = null;
         if ($post->getBody()) {
             $phame_post = PhabricatorMarkupEngine::summarize($post->getBody());
             $phame_post = new PHUIRemarkupView($viewer, $phame_post);
         } else {
             $phame_post = phutil_tag('em', array(), pht('(Empty Post)'));
         }
         $blogger = phutil_tag('strong', array(), $blogger);
         $date = phabricator_datetime($post->getDatePublished(), $viewer);
         $blog = null;
         if ($post->getBlog()) {
             $blog = phutil_tag('a', array('href' => '/phame/blog/view/' . $post->getBlog()->getID() . '/'), $post->getBlog()->getName());
         }
         if ($this->showBlog && $blog) {
             if ($post->isDraft()) {
                 $subtitle = pht('Unpublished draft by %s in %s.', $blogger, $blog);
             } else {
                 $subtitle = pht('By %s on %s in %s.', $blogger, $date, $blog);
             }
         } else {
             if ($post->isDraft()) {
                 $subtitle = pht('Unpublished draft by %s.', $blogger);
             } else {
                 $subtitle = pht('Written by %s on %s.', $blogger, $date);
             }
         }
         $item = id(new PHUIDocumentSummaryView())->setTitle($post->getTitle())->setHref($post->getViewURI())->setSubtitle($subtitle)->setImage($blogger_image)->setImageHref($blogger_uri)->setSummary($phame_post)->setDraft($post->isDraft());
         $list[] = $item;
     }
     if (empty($list)) {
         $list = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($nodata);
     }
     return $list;
 }
开发者ID:fuding,项目名称:phabricator,代码行数:52,代码来源:PhamePostListView.php

示例3: renderPostList

 protected function renderPostList(array $posts, PhabricatorUser $viewer, $nodata)
 {
     assert_instances_of($posts, 'PhamePost');
     $handle_phids = array();
     foreach ($posts as $post) {
         $handle_phids[] = $post->getBloggerPHID();
         if ($post->getBlog()) {
             $handle_phids[] = $post->getBlog()->getPHID();
         }
     }
     $handles = $viewer->loadHandles($handle_phids);
     $stories = array();
     foreach ($posts as $post) {
         $blogger = $handles[$post->getBloggerPHID()]->renderLink();
         $blogger_uri = $handles[$post->getBloggerPHID()]->getURI();
         $blogger_image = $handles[$post->getBloggerPHID()]->getImageURI();
         $blog = null;
         if ($post->getBlog()) {
             $blog = $handles[$post->getBlog()->getPHID()]->renderLink();
         }
         $phame_post = '';
         if ($post->getBody()) {
             $phame_post = PhabricatorMarkupEngine::summarize($post->getBody());
         }
         $blog_view = $post->getViewURI();
         $phame_title = phutil_tag('a', array('href' => $blog_view), $post->getTitle());
         $blogger = phutil_tag('strong', array(), $blogger);
         if ($post->isDraft()) {
             $title = pht('%s drafted a blog post on %s.', $blogger, $blog);
             $title = phutil_tag('em', array(), $title);
         } else {
             $title = pht('%s wrote a blog post on %s.', $blogger, $blog);
         }
         $item = id(new PHUIObjectItemView())->setObject($post)->setHeader($post->getTitle())->setHref($this->getApplicationURI('post/view/' . $post->getID() . '/'));
         $story = id(new PHUIFeedStoryView())->setTitle($title)->setImage($blogger_image)->setImageHref($blogger_uri)->setAppIcon('fa-star')->setUser($viewer)->setPontification($phame_post, $phame_title);
         if (PhabricatorPolicyFilter::hasCapability($viewer, $post, PhabricatorPolicyCapability::CAN_EDIT)) {
             $story->addAction(id(new PHUIIconView())->setHref($this->getApplicationURI('post/edit/' . $post->getID() . '/'))->setIconFont('fa-pencil'));
         }
         if ($post->getDatePublished()) {
             $story->setEpoch($post->getDatePublished());
         }
         $stories[] = $story;
     }
     if (empty($stories)) {
         return id(new PHUIBoxView())->appendChild($nodata)->addClass('mlt mlb msr msl');
     }
     return $stories;
 }
开发者ID:fengshao0907,项目名称:phabricator,代码行数:48,代码来源:PhameController.php

示例4: getBodyForFeed

 public function getBodyForFeed(PhabricatorFeedStory $story)
 {
     $remarkup = $this->getRemarkupBodyForFeed($story);
     if ($remarkup !== null) {
         $remarkup = PhabricatorMarkupEngine::summarize($remarkup);
         return new PHUIRemarkupView($this->viewer, $remarkup);
     }
     $old = $this->getOldValue();
     $new = $this->getNewValue();
     $body = null;
     switch ($this->getTransactionType()) {
         case PhabricatorTransactions::TYPE_COMMENT:
             $text = $this->getComment()->getContent();
             if (strlen($text)) {
                 $body = $story->getMarkupFieldOutput('comment/' . $this->getID());
             }
             break;
     }
     return $body;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:20,代码来源:PhabricatorApplicationTransaction.php

示例5: getMarkupTextForFeed

 public function getMarkupTextForFeed(PhabricatorFeedStory $story, $field)
 {
     switch ($this->getTransactionType()) {
         case PhabricatorTransactions::TYPE_COMMENT:
             $text = $this->getComment()->getContent();
             return PhabricatorMarkupEngine::summarize($text);
     }
     return null;
 }
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:9,代码来源:PhabricatorApplicationTransaction.php

示例6: getMarkupText

 public function getMarkupText($field)
 {
     switch ($field) {
         case self::MARKUP_FIELD_BODY:
             return $this->getBody();
         case self::MARKUP_FIELD_SUMMARY:
             return PhabricatorMarkupEngine::summarize($this->getBody());
     }
 }
开发者ID:AbhishekGhosh,项目名称:phabricator,代码行数:9,代码来源:PhamePost.php

示例7: loadResults

 public function loadResults()
 {
     $viewer = $this->getViewer();
     $raw_query = $this->getRawQuery();
     // Allow users to type "#qa" or "qa" to find "Quality Assurance".
     $raw_query = ltrim($raw_query, '#');
     $tokens = self::tokenizeString($raw_query);
     $query = id(new PhabricatorProjectQuery())->needImages(true)->needSlugs(true);
     if ($tokens) {
         $query->withNameTokens($tokens);
     }
     // If this is for policy selection, prevent users from using milestones.
     $for_policy = $this->getParameter('policy');
     if ($for_policy) {
         $query->withIsMilestone(false);
     }
     $for_autocomplete = $this->getParameter('autocomplete');
     $projs = $this->executeQuery($query);
     $projs = mpull($projs, null, 'getPHID');
     $must_have_cols = $this->getParameter('mustHaveColumns', false);
     if ($must_have_cols) {
         $columns = id(new PhabricatorProjectColumnQuery())->setViewer($viewer)->withProjectPHIDs(array_keys($projs))->execute();
         $has_cols = mgroup($columns, 'getProjectPHID');
     } else {
         $has_cols = array_fill_keys(array_keys($projs), true);
     }
     $is_browse = $this->getIsBrowse();
     if ($is_browse && $projs) {
         // TODO: This is a little ad-hoc, but we don't currently have
         // infrastructure for bulk querying custom fields efficiently.
         $table = new PhabricatorProjectCustomFieldStorage();
         $descriptions = $table->loadAllWhere('objectPHID IN (%Ls) AND fieldIndex = %s', array_keys($projs), PhabricatorHash::digestForIndex('std:project:internal:description'));
         $descriptions = mpull($descriptions, 'getFieldValue', 'getObjectPHID');
     } else {
         $descriptions = array();
     }
     $results = array();
     foreach ($projs as $proj) {
         $phid = $proj->getPHID();
         if (!isset($has_cols[$phid])) {
             continue;
         }
         $slug = $proj->getPrimarySlug();
         if (!strlen($slug)) {
             foreach ($proj->getSlugs() as $slug_object) {
                 $slug = $slug_object->getSlug();
                 if (strlen($slug)) {
                     break;
                 }
             }
         }
         // If we're building results for the autocompleter and this project
         // doesn't have any usable slugs, don't return it as a result.
         if ($for_autocomplete && !strlen($slug)) {
             continue;
         }
         $closed = null;
         if ($proj->isArchived()) {
             $closed = pht('Archived');
         }
         $all_strings = array();
         $all_strings[] = $proj->getDisplayName();
         // Add an extra space after the name so that the original project
         // sorts ahead of milestones. This is kind of a hack but ehh?
         $all_strings[] = null;
         foreach ($proj->getSlugs() as $project_slug) {
             $all_strings[] = $project_slug->getSlug();
         }
         $all_strings = implode(' ', $all_strings);
         $proj_result = id(new PhabricatorTypeaheadResult())->setName($all_strings)->setDisplayName($proj->getDisplayName())->setDisplayType($proj->getDisplayIconName())->setURI($proj->getURI())->setPHID($phid)->setIcon($proj->getDisplayIconIcon())->setColor($proj->getColor())->setPriorityType('proj')->setClosed($closed);
         if (strlen($slug)) {
             $proj_result->setAutocomplete('#' . $slug);
         }
         $proj_result->setImageURI($proj->getProfileImageURI());
         if ($is_browse) {
             $proj_result->addAttribute($proj->getDisplayIconName());
             $description = idx($descriptions, $phid);
             if (strlen($description)) {
                 $summary = PhabricatorMarkupEngine::summarize($description);
                 $proj_result->addAttribute($summary);
             }
         }
         $results[] = $proj_result;
     }
     return $results;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:86,代码来源:PhabricatorProjectDatasource.php

示例8: getTagContent

 protected function getTagContent()
 {
     $viewer = $this->getViewer();
     $posts = $this->posts;
     $nodata = $this->nodata;
     $handle_phids = array();
     foreach ($posts as $post) {
         $handle_phids[] = $post->getBloggerPHID();
         if ($post->getBlog()) {
             $handle_phids[] = $post->getBlog()->getPHID();
         }
     }
     $handles = $viewer->loadHandles($handle_phids);
     $list = array();
     foreach ($posts as $post) {
         $blogger_name = $handles[$post->getBloggerPHID()]->getName();
         $blogger_uri = $handles[$post->getBloggerPHID()]->getURI();
         $blogger_uri = PhabricatorEnv::getURI($blogger_uri);
         // Render a link manually to make sure we point at the correct domain.
         $blogger = phutil_tag('a', array('href' => $blogger_uri), $blogger_name);
         $blogger = phutil_tag('strong', array(), $blogger);
         $blogger_image = $handles[$post->getBloggerPHID()]->getImageURI();
         $phame_post = null;
         if ($post->getBody()) {
             $phame_post = PhabricatorMarkupEngine::summarize($post->getBody());
             $phame_post = new PHUIRemarkupView($viewer, $phame_post);
         } else {
             $phame_post = phutil_tag('em', array(), pht('(Empty Post)'));
         }
         $date = phabricator_datetime($post->getDatePublished(), $viewer);
         $blog = $post->getBlog();
         if ($this->getIsLive()) {
             if ($this->getIsExternal()) {
                 $blog_uri = $blog->getExternalLiveURI();
                 $post_uri = $post->getExternalLiveURI();
             } else {
                 $blog_uri = $blog->getInternalLiveURI();
                 $post_uri = $post->getInternalLiveURI();
             }
         } else {
             $blog_uri = $blog->getViewURI();
             $post_uri = $post->getViewURI();
         }
         $blog_link = phutil_tag('a', array('href' => $blog_uri), $blog->getName());
         if ($this->showBlog) {
             if ($post->isDraft()) {
                 $subtitle = pht('Unpublished draft by %s in %s.', $blogger, $blog_link);
             } else {
                 $subtitle = pht('Written by %s on %s in %s.', $blogger, $date, $blog_link);
             }
         } else {
             if ($post->isDraft()) {
                 $subtitle = pht('Unpublished draft by %s.', $blogger);
             } else {
                 $subtitle = pht('Written by %s on %s.', $blogger, $date);
             }
         }
         $item = id(new PHUIDocumentSummaryView())->setTitle($post->getTitle())->setHref($post_uri)->setSubtitle($subtitle)->setImage($blogger_image)->setImageHref($blogger_uri)->setSummary($phame_post)->setDraft($post->isDraft());
         $list[] = $item;
     }
     if (empty($list)) {
         $list = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($nodata);
     }
     return $list;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:65,代码来源:PhamePostListView.php


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