本文整理汇总了PHP中phutil_render_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_render_tag函数的具体用法?PHP phutil_render_tag怎么用?PHP phutil_render_tag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_render_tag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest()
{
$items = id(new PhabricatorDirectoryItem())->loadAll();
$items = msort($items, 'getSortKey');
$categories = id(new PhabricatorDirectoryCategory())->loadAll();
$categories = msort($categories, 'getSequence');
$category_map = mpull($categories, 'getName', 'getID');
$category_map[0] = 'Free Radicals';
$items = mgroup($items, 'getCategoryID');
require_celerity_resource('phabricator-directory-css');
$content = array();
foreach ($category_map as $id => $category_name) {
$category_items = idx($items, $id);
if (!$category_items) {
continue;
}
$item_markup = array();
foreach ($category_items as $item) {
$item_markup[] = '<div>' . '<h2>' . phutil_render_tag('a', array('href' => $item->getHref()), phutil_escape_html($item->getName())) . '</h2>' . '<p>' . phutil_escape_html($item->getDescription()) . '</p>' . '</div>';
}
$content[] = '<div class="aphront-directory-category">' . '<h1>' . phutil_escape_html($category_name) . '</h1>' . '<div class="aphront-directory-group">' . implode("\n", $item_markup) . '</div>' . '</div>';
}
$content = '<div class="aphront-directory-list">' . implode("\n", $content) . '</div>';
return $this->buildStandardPageResponse($content, array('title' => 'Directory', 'tab' => 'directory'));
}
示例2: render
public function render()
{
$drequest = $this->getDiffusionRequest();
$current_branch = $drequest->getBranch();
$rows = array();
$rowc = array();
foreach ($this->branches as $branch) {
$commit = idx($this->commits, $branch->getHeadCommitIdentifier());
if ($commit) {
$details = $commit->getCommitData()->getCommitMessage();
$details = idx(explode("\n", $details), 0);
$details = substr($details, 0, 80);
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
} else {
$datetime = null;
$details = null;
}
$rows[] = array(phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'history', 'branch' => $branch->getName()))), 'History'), phutil_render_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'branch' => $branch->getName()))), phutil_escape_html($branch->getName())), self::linkCommit($drequest->getRepository(), $branch->getHeadCommitIdentifier()), $datetime, AphrontTableView::renderSingleDisplayLine(phutil_escape_html($details)));
if ($branch->getName() == $current_branch) {
$rowc[] = 'highlighted';
} else {
$rowc[] = null;
}
}
$view = new AphrontTableView($rows);
$view->setHeaders(array('History', 'Branch', 'Head', 'Modified', 'Details'));
$view->setColumnClasses(array('', 'pri', '', '', 'wide'));
$view->setRowClasses($rowc);
return $view->render();
}
示例3: processRequest
public function processRequest()
{
$request = $this->getRequest();
$user = $request->getUser();
$timer = id(new PhabricatorTimer())->load($this->id);
if (!$timer) {
return new Aphront404Response();
}
require_celerity_resource('phabricator-countdown-css');
$chrome_visible = $request->getBool('chrome', true);
$chrome_new = $chrome_visible ? false : null;
$chrome_link = phutil_render_tag('a', array('href' => $request->getRequestURI()->alter('chrome', $chrome_new), 'class' => 'phabricator-timer-chrome-link'), $chrome_visible ? 'Disable Chrome' : 'Enable Chrome');
$content = '<div class="phabricator-timer">
<h1 class="phabricator-timer-header">' . phutil_escape_html($timer->getTitle()) . ' · ' . phabricator_datetime($timer->getDatePoint(), $user) . '</h1>
<div class="phabricator-timer-pane">
<table class="phabricator-timer-table">
<tr>
<th>Days</th>
<th>Hours</th>
<th>Minutes</th>
<th>Seconds</th>
</tr>
<tr>
<td id="phabricator-timer-days"></td>
<td id="phabricator-timer-hours"></td>
<td id="phabricator-timer-minutes"></td>
<td id="phabricator-timer-seconds"></td>
</table>
</div>' . $chrome_link . '</div>';
Javelin::initBehavior('countdown-timer', array('timestamp' => $timer->getDatepoint()));
$panel = $content;
return $this->buildStandardPageResponse($panel, array('title' => 'Countdown: ' . $timer->getTitle(), 'chrome' => $chrome_visible));
}
示例4: render
public final function render()
{
require_celerity_resource('aphront-error-view-css');
$errors = $this->errors;
if ($errors) {
$list = array();
foreach ($errors as $error) {
$list[] = phutil_render_tag('li', array(), phutil_escape_html($error));
}
$list = '<ul>' . implode("\n", $list) . '</ul>';
} else {
$list = null;
}
$title = $this->title;
if (strlen($title)) {
$title = '<h1>' . phutil_escape_html($title) . '</h1>';
} else {
$title = null;
}
$this->severity = nonempty($this->severity, self::SEVERITY_ERROR);
$this->width = nonempty($this->width, self::WIDTH_DEFAULT);
$more_classes = array();
$more_classes[] = 'aphront-error-severity-' . $this->severity;
$more_classes[] = 'aphront-error-width-' . $this->width;
$more_classes = implode(' ', $more_classes);
return phutil_render_tag('div', array('id' => $this->id, 'class' => 'aphront-error-view ' . $more_classes), $title . $this->renderChildren() . $list);
}
示例5: processRequest
public function processRequest()
{
$request = $this->getRequest();
$phids = $request->getStrList('phids');
if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
foreach ($handles as $handle) {
if ($handle->getURI()) {
$link = phutil_render_tag('a', array('href' => $handle->getURI()), phutil_escape_html($handle->getURI()));
} else {
$link = null;
}
$rows[] = array(phutil_escape_html($handle->getPHID()), phutil_escape_html($handle->getType()), phutil_escape_html($handle->getName()), $link);
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('PHID', 'Type', 'Name', 'URI'));
$table->setColumnClasses(array(null, null, null, 'wide'));
$panel = new AphrontPanelView();
$panel->setHeader('PHID Handles');
$panel->appendChild($table);
return $this->buildStandardPageResponse($panel, array('title' => 'PHID Lookup Results'));
}
$lookup_form = new AphrontFormView();
$lookup_form->setUser($request->getUser());
$lookup_form->setAction('/phid/')->appendChild(id(new AphrontFormTextAreaControl())->setName('phids')->setCaption('Enter PHIDs separated by spaces or commas.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Lookup PHIDs'));
$lookup_panel = new AphrontPanelView();
$lookup_panel->setHeader('Lookup PHIDs');
$lookup_panel->appendChild($lookup_form);
$lookup_panel->setWidth(AphrontPanelView::WIDTH_WIDE);
return $this->buildStandardPageResponse(array($lookup_panel), array('title' => 'PHID Lookup'));
}
示例6: processRequest
public function processRequest()
{
$title = 'OAuth Clients';
$request = $this->getRequest();
$current_user = $request->getUser();
$offset = $request->getInt('offset', 0);
$page_size = 100;
$pager = new AphrontPagerView();
$request_uri = $request->getRequestURI();
$pager->setURI($request_uri, 'offset');
$pager->setPageSize($page_size);
$pager->setOffset($offset);
$query = new PhabricatorOAuthServerClientQuery();
$query->withCreatorPHIDs(array($current_user->getPHID()));
$clients = $query->executeWithPager($pager);
$rows = array();
$rowc = array();
$highlight = $this->getHighlightPHIDs();
foreach ($clients as $client) {
$row = array(phutil_render_tag('a', array('href' => $client->getViewURI()), phutil_escape_html($client->getName())), $client->getPHID(), $client->getSecret(), phutil_render_tag('a', array('href' => $client->getRedirectURI()), phutil_escape_html($client->getRedirectURI())), phutil_render_tag('a', array('class' => 'small button grey', 'href' => $client->getEditURI()), 'Edit'));
$rows[] = $row;
if (isset($highlight[$client->getPHID()])) {
$rowc[] = 'highlighted';
} else {
$rowc[] = '';
}
}
$panel = $this->buildClientList($rows, $rowc, $title);
return $this->buildStandardPageResponse(array($this->getNoticeView(), $panel->appendChild($pager)), array('title' => $title));
}
示例7: renderValueForRevisionView
public function renderValueForRevisionView()
{
$diff = $this->getDiff();
$path_changesets = mpull($diff->loadChangesets(), 'getId', 'getFilename');
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
$ldata = $this->getDiffProperty('arc:lint');
$ltail = null;
if ($ldata) {
$ldata = igroup($ldata, 'path');
$lint_messages = array();
foreach ($ldata as $path => $messages) {
$message_markup = array();
foreach ($messages as $message) {
$path = idx($message, 'path');
$line = idx($message, 'line');
$code = idx($message, 'code');
$severity = idx($message, 'severity');
$name = idx($message, 'name');
$description = idx($message, 'description');
$line_link = phutil_escape_html($line);
if (isset($path_changesets[$path])) {
// TODO: Create standalone links for large diffs. Logic is in
// DifferentialDiffTableOfContentsView::renderChangesetLink().
$line_link = phutil_render_tag('a', array('href' => '#C' . $path_changesets[$path] . 'NL' . $line), $line_link);
}
$message_markup[] = hsprintf('<li>' . '<span class="lint-severity-%s">%s</span> (%s) %s ' . 'at line ' . $line_link . '<p>%s</p>' . '</li>', $severity, ucwords($severity), $code, $name, $description);
}
$lint_messages[] = '<li class="lint-file-block">' . 'Lint for <strong>' . phutil_escape_html($path) . '</strong>' . '<ul>' . implode("\n", $message_markup) . '</ul>' . '</li>';
}
$lexcuse = $this->getLintExcuse();
$ltail = '<div class="differential-lint-block">' . $lexcuse . '<ul>' . implode("\n", $lint_messages) . '</ul>' . '</div>';
}
return $lstar . ' ' . $lmsg . $ltail;
}
示例8: markupDocumentLink
public function markupDocumentLink($matches)
{
$slug = trim($matches[1]);
$name = trim(idx($matches, 2, $slug));
// If whatever is being linked to begins with "/" or has "://", treat it
// as a URI instead of a wiki page.
$is_uri = preg_match('@(^/)|(://)@', $slug);
if ($is_uri) {
$protocols = $this->getEngine()->getConfig('uri.allowed-protocols', array());
$protocol = id(new PhutilURI($slug))->getProtocol();
if (!idx($protocols, $protocol)) {
// Don't treat this as a URI if it's not an allowed protocol.
$is_uri = false;
}
}
if ($is_uri) {
$uri = $slug;
// Leave the name unchanged, i.e. link the whole URI if there's no
// explicit name.
} else {
$name = explode('/', trim($name, '/'));
$name = end($name);
$slug = PhrictionDocument::normalizeSlug($slug);
$uri = PhrictionDocument::getSlugURI($slug);
}
return $this->getEngine()->storeText(phutil_render_tag('a', array('href' => $uri, 'class' => $is_uri ? null : 'phriction-link'), phutil_escape_html($name)));
}
示例9: processRequest
public function processRequest()
{
$drequest = $this->diffusionRequest;
$request = $this->getRequest();
$page_size = $request->getInt('pagesize', 100);
$offset = $request->getInt('page', 0);
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest($drequest);
$history_query->setOffset($offset);
$history_query->setLimit($page_size + 1);
if (!$request->getBool('copies')) {
$history_query->needDirectChanges(true);
$history_query->needChildChanges(true);
}
$history = $history_query->loadHistory();
$phids = array();
foreach ($history as $item) {
$data = $item->getCommitData();
if ($data) {
if ($data->getCommitDetail('authorPHID')) {
$phids[$data->getCommitDetail('authorPHID')] = true;
}
}
}
$phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
$pager->setOffset($offset);
if (count($history) == $page_size + 1) {
array_pop($history);
$pager->setHasMorePages(true);
} else {
$pager->setHasMorePages(false);
}
$pager->setURI($request->getRequestURI(), 'page');
$content = array();
$content[] = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'history'));
if ($request->getBool('copies')) {
$button_title = 'Hide Copies/Branches';
} else {
$button_title = 'Show Copies/Branches';
}
$button_uri = $request->getRequestURI()->alter('copies', !$request->getBool('copies'));
$button = phutil_render_tag('a', array('class' => 'button small grey', 'href' => $button_uri), phutil_escape_html($button_title));
$history_table = new DiffusionHistoryTableView();
$history_table->setDiffusionRequest($drequest);
$history_table->setHandles($handles);
$history_table->setHistory($history);
$history_panel = new AphrontPanelView();
$history_panel->setHeader('History');
$history_panel->addButton($button);
$history_panel->appendChild($history_table);
$history_panel->appendChild($pager);
$content[] = $history_panel;
// TODO: Sometimes we do have a change view, we need to look at the most
// recent history entry to figure it out.
$nav = $this->buildSideNav('history', false);
$nav->appendChild($content);
return $this->buildStandardPageResponse($nav, array('title' => 'history'));
}
示例10: render
public function render()
{
$rows = array();
$rowc = array();
// TODO: Experiment with path stack rendering.
// TODO: Copy Away and Move Away are rendered junkily still.
foreach ($this->pathChanges as $change) {
$path = $change->getPath();
$hash = substr(md5($path), 0, 8);
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
$path .= '/';
}
$path_column = phutil_render_tag('a', array('href' => '#' . $hash), phutil_escape_html($path));
$rows[] = array($this->linkHistory($change->getPath()), $this->linkBrowse($change->getPath()), $this->linkChange($change->getChangeType(), $change->getFileType(), $change->getPath()), $path_column);
$row_class = null;
foreach ($this->ownersPaths as $owners_path) {
$owners_path = $owners_path->getPath();
if (strncmp('/' . $path, $owners_path, strlen($owners_path)) == 0) {
$row_class = 'highlighted';
break;
}
}
$rowc[] = $row_class;
}
$view = new AphrontTableView($rows);
$view->setHeaders(array('History', 'Browse', 'Change', 'Path'));
$view->setColumnClasses(array('', '', '', 'wide'));
$view->setRowClasses($rowc);
$view->setNoDataString('This change has not been fully parsed yet.');
return $view->render();
}
示例11: render
public function render()
{
$application = $this->application;
require_celerity_resource('phabricator-application-launch-view-css');
$content = array();
$content[] = phutil_render_tag('span', array('class' => 'phabricator-application-launch-name'), phutil_escape_html($application->getName()));
$content[] = phutil_render_tag('span', array('class' => 'phabricator-application-launch-description'), phutil_escape_html($application->getShortDescription()));
$count = 0;
if ($this->status) {
$content[] = '<span class="phabricator-application-status-block">';
foreach ($this->status as $status) {
$count += $status->getCount();
$content[] = $status;
}
$content[] = '</span>';
}
if ($count) {
$content[] = phutil_render_tag('span', array('class' => 'phabricator-application-launch-attention'), phutil_escape_html($count));
}
$classes = array();
$classes[] = 'phabricator-application-launch-icon';
$styles = array();
if ($application->getIconURI()) {
$styles[] = 'background-image: url(' . $application->getIconURI() . ')';
} else {
$autosprite = $application->getAutospriteName();
$classes[] = 'autosprite';
$classes[] = 'app-' . $autosprite . '-full';
}
$icon = phutil_render_tag('span', array('class' => implode(' ', $classes), 'style' => nonempty(implode('; ', $styles), null)), '');
return phutil_render_tag('a', array('class' => 'phabricator-application-launch-container', 'href' => $application->getBaseURI()), $icon . $this->renderSingleView($content));
}
示例12: processRequest
public function processRequest()
{
$request = $this->getRequest();
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$pastes = id(new PhabricatorPaste())->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$pastes = $pager->sliceResults($pastes);
$pager->setURI($request->getRequestURI(), 'page');
$phids = mpull($pastes, 'getAuthorPHID');
$handles = array();
if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
}
$rows = array();
foreach ($pastes as $paste) {
$handle = $handles[$paste->getAuthorPHID()];
$rows[] = array(phutil_escape_html('P' . $paste->getID()), phutil_render_tag('a', array('href' => '/p/' . $handle->getName() . '/'), phutil_escape_html($handle->getName())), phutil_escape_html($paste->getLanguage()), phutil_render_tag('a', array('href' => '/P' . $paste->getID()), phutil_escape_html(nonempty($paste->getTitle(), 'Untitled Masterwork P' . $paste->getID()))), phutil_render_tag('a', array('href' => PhabricatorFileURI::getViewURIForPHID($paste->getFilePHID())), phutil_escape_html($paste->getFilePHID())));
}
$table = new AphrontTableView($rows);
$table->setHeaders(array('Paste ID', 'Author', 'Language', 'Title', 'File'));
$table->setColumnClasses(array(null, null, null, 'wide pri', null));
$panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
$panel->setHeader("Paste");
$panel->setCreateButton('Paste Something', '/paste/');
$panel->appendChild($table);
$panel->appendChild($pager);
return $this->buildStandardPageResponse($panel, array('title' => 'Paste List', 'tab' => 'list'));
}
示例13: buildView
public function buildView()
{
if (!$this->user) {
throw new Exception('Call setUser() before buildView()!');
}
$user = $this->user;
$stories = $this->stories;
$handles = array();
if ($stories) {
$handle_phids = array_mergev(mpull($stories, 'getRequiredHandlePHIDs'));
$object_phids = array_mergev(mpull($stories, 'getRequiredObjectPHIDs'));
$handles = id(new PhabricatorObjectHandleData($handle_phids))->loadHandles();
}
$null_view = new AphrontNullView();
require_celerity_resource('phabricator-feed-css');
$last_date = null;
foreach ($stories as $story) {
$story->setHandles($handles);
$story->setFramed($this->framed);
$date = ucfirst(phabricator_relative_date($story->getEpoch(), $user));
if ($date !== $last_date) {
if ($last_date !== null) {
$null_view->appendChild('<div class="phabricator-feed-story-date-separator"></div>');
}
$last_date = $date;
$null_view->appendChild(phutil_render_tag('div', array('class' => 'phabricator-feed-story-date'), phutil_escape_html($date)));
}
$view = $story->renderView();
$view->setViewer($user);
$null_view->appendChild($view);
}
return id(new AphrontNullView())->appendChild('<div class="phabricator-feed-frame">' . $null_view->render() . '</div>');
}
示例14: processRequest
public function processRequest()
{
$request = $this->getRequest();
$nav = new AphrontSideNavView();
$links = array('calls' => 'All Calls');
if (empty($links[$this->view])) {
$this->view = key($links);
}
foreach ($links as $slug => $name) {
$nav->addNavItem(phutil_render_tag('a', array('href' => '/conduit/log/view/' . $slug . '/', 'class' => $slug == $this->view ? 'aphront-side-nav-selected' : null), phutil_escape_html($name)));
}
$conn_table = new PhabricatorConduitConnectionLog();
$call_table = new PhabricatorConduitMethodCallLog();
$conn_r = $call_table->establishConnection('r');
$pager = new AphrontPagerView();
$pager->setOffset($request->getInt('page'));
$calls = $call_table->loadAllWhere('1 = 1 ORDER BY id DESC LIMIT %d, %d', $pager->getOffset(), $pager->getPageSize() + 1);
$calls = $pager->sliceResults($calls);
$pager->setURI(new PhutilURI('/conduit/log/view/' . $this->view . '/'), 'page');
$pager->setEnableKeyboardShortcuts(true);
$min = $pager->getOffset() + 1;
$max = $min + count($calls) - 1;
$conn_ids = array_filter(mpull($calls, 'getConnectionID'));
$conns = array();
if ($conn_ids) {
$conns = $conn_table->loadAllWhere('id IN (%Ld)', $conn_ids);
}
$table = $this->renderCallTable($calls, $conns);
$panel = new AphrontPanelView();
$panel->setHeader('Conduit Method Calls (' . $min . '-' . $max . ')');
$panel->appendChild($table);
$panel->appendChild($pager);
$nav->appendChild($panel);
return $this->buildStandardPageResponse($nav, array('title' => 'Conduit Logs', 'tab' => 'logs'));
}
示例15: render
public final function render()
{
require_celerity_resource('aphront-error-view-css');
$errors = $this->errors;
if ($errors) {
$list = array();
foreach ($errors as $error) {
$list[] = phutil_render_tag('li', array(), phutil_escape_html($error));
}
$list = phutil_render_tag('ul', array('class' => 'aphront-error-view-list'), implode("\n", $list));
} else {
$list = null;
}
$title = $this->title;
if (strlen($title)) {
$title = phutil_render_tag('h1', array('class' => 'aphront-error-view-head'), phutil_escape_html($title));
} else {
$title = null;
}
$this->severity = nonempty($this->severity, self::SEVERITY_ERROR);
$more_classes = array();
$more_classes[] = 'aphront-error-severity-' . $this->severity;
$more_classes = implode(' ', $more_classes);
return phutil_render_tag('div', array('id' => $this->id, 'class' => 'aphront-error-view ' . $more_classes), $title . phutil_render_tag('div', array('class' => 'aphront-error-view-body'), $this->renderChildren() . $list));
}