本文整理汇总了PHP中PhabricatorMarkupEngine::newProfileMarkupEngine方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorMarkupEngine::newProfileMarkupEngine方法的具体用法?PHP PhabricatorMarkupEngine::newProfileMarkupEngine怎么用?PHP PhabricatorMarkupEngine::newProfileMarkupEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorMarkupEngine
的用法示例。
在下文中一共展示了PhabricatorMarkupEngine::newProfileMarkupEngine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderBasicInformation
private function renderBasicInformation($user, $profile)
{
$blurb = nonempty($profile->getBlurb(), '//Nothing is known about this rare specimen.//');
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
$blurb = $engine->markupText($blurb);
$content = '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Basic Information</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>PHID</th>
<td>' . phutil_escape_html($user->getPHID()) . '</td>
</tr>
<tr>
<th>User Since</th>
<td>' . phabricator_format_timestamp($user->getDateCreated()) . '</td>
</tr>
</table>
</div>
</div>';
$content .= '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Flavor Text</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>Blurb</th>
<td>' . $blurb . '</td>
</tr>
</table>
</div>
</div>';
return $content;
}
示例2: renderBasicInformation
private function renderBasicInformation($project, $profile)
{
$blurb = nonempty($profile->getBlurb(), '//Nothing is known about this elusive project.//');
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
$blurb = $engine->markupText($blurb);
$affiliations = $project->loadAffiliations();
$phids = array_merge(array($project->getAuthorPHID()), $project->getSubprojectPHIDs(), mpull($affiliations, 'getUserPHID'));
$phids = array_unique($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$affiliated = array();
foreach ($affiliations as $affiliation) {
$user = $handles[$affiliation->getUserPHID()]->renderLink();
$role = phutil_escape_html($affiliation->getRole());
$status = null;
if ($affiliation->getStatus() == 'former') {
$role = '<em>Former ' . $role . '</em>';
}
$affiliated[] = '<li>' . $user . ' — ' . $role . $status . '</li>';
}
if ($affiliated) {
$affiliated = '<ul>' . implode("\n", $affiliated) . '</ul>';
} else {
$affiliated = '<p><em>No one is affiliated with this project.</em></p>';
}
if ($project->getSubprojectPHIDs()) {
$table = $this->renderSubprojectTable($handles, $project->getSubprojectPHIDs());
$subproject_list = $table->render();
} else {
$subproject_list = '<p><em>There are no projects attached for such specie.</em></p>';
}
$timestamp = phabricator_format_timestamp($project->getDateCreated());
$status = PhabricatorProjectStatus::getNameForStatus($project->getStatus());
$content = '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Basic Information</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>Creator</th>
<td>' . $handles[$project->getAuthorPHID()]->renderLink() . '</td>
</tr>
<tr>
<th>Status</th>
<td><strong>' . phutil_escape_html($status) . '</strong></td>
</tr>
<tr>
<th>Created</th>
<td>' . $timestamp . '</td>
</tr>
<tr>
<th>PHID</th>
<td>' . phutil_escape_html($project->getPHID()) . '</td>
</tr>
<tr>
<th>Blurb</th>
<td>' . $blurb . '</td>
</tr>
</table>
</div>
</div>';
$content .= '<div class="phabricator-profile-info-group">' . '<h1 class="phabricator-profile-info-header">Resources</h1>' . '<div class="phabricator-profile-info-pane">' . $affiliated . '</div>' . '</div>';
$content .= '<div class="phabricator-profile-info-group">' . '<h1 class="phabricator-profile-info-header">Subprojects</h1>' . '<div class="phabricator-profile-info-pane">' . $subproject_list . '</div>' . '</div>';
$query = id(new ManiphestTaskQuery())->withProjects(array($project->getPHID()))->withStatus(ManiphestTaskQuery::STATUS_OPEN)->setOrderBy(ManiphestTaskQuery::ORDER_PRIORITY)->setLimit(10)->setCalculateRows(true);
$tasks = $query->execute();
$count = $query->getRowCount();
$phids = mpull($tasks, 'getOwnerPHID');
$phids = array_filter($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$task_views = array();
foreach ($tasks as $task) {
$view = id(new ManiphestTaskSummaryView())->setTask($task)->setHandles($handles)->setUser($this->getRequest()->getUser());
$task_views[] = $view->render();
}
if (empty($tasks)) {
$task_views = '<em>No open tasks.</em>';
} else {
$task_views = implode('', $task_views);
}
$open = number_format($count);
$more_link = phutil_render_tag('a', array('href' => '/maniphest/view/all/?projects=' . $project->getPHID()), "View All Open Tasks »");
$content .= '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">' . "Open Tasks ({$open})" . '</h1>' . '<div class="phabricator-profile-info-pane">' . $task_views . '<div class="phabricator-profile-info-pane-more-link">' . $more_link . '</div>' . '</div>
</div>';
return $content;
}
示例3: renderBasicInformation
private function renderBasicInformation($user, $profile)
{
$blurb = nonempty($profile->getBlurb(), '//Nothing is known about this rare specimen.//');
$engine = PhabricatorMarkupEngine::newProfileMarkupEngine();
$blurb = $engine->markupText($blurb);
$commit_list = phutil_render_tag('a', array('href' => '/diffusion/author/' . phutil_escape_uri($user->getUsername())), 'Recent Commits');
$content = '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Basic Information</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>PHID</th>
<td>' . phutil_escape_html($user->getPHID()) . '</td>
</tr>
<tr>
<th>User Since</th>
<td>' . phabricator_format_timestamp($user->getDateCreated()) . '</td>
</tr>
</table>
</div>
</div>';
$content .= '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Flavor Text</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>Blurb</th>
<td>' . $blurb . '</td>
</tr>
</table>
</div>
</div>';
$content .= '<div class="phabricator-profile-info-group">
<h1 class="phabricator-profile-info-header">Recent Activities</h1>
<div class="phabricator-profile-info-pane">
<table class="phabricator-profile-info-table">
<tr>
<th>Commits</th>
<td>' . $commit_list . '</td>
</tr>
</table>
</div>
</div>';
return $content;
}