1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-26 15:30:58 +01:00

Replace some hsprintf() by phutil_tag()

Test Plan: Looked at a diff with inline comment.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7549
This commit is contained in:
Jakub Vrana 2013-11-11 09:23:23 -08:00
parent 7ec42dbbea
commit a29b5b070f
62 changed files with 517 additions and 519 deletions

View file

@ -51,11 +51,12 @@ final class PhabricatorEmailTokenController
'invalid or out of date. Make sure you are copy-and-pasting the '.
'entire link into your browser. You can try again, or request '.
'a new email.')));
$view->appendChild(hsprintf(
'<div class="aphront-failure-continue">'.
'<a class="button" href="/login/email/">%s</a>'.
'</div>',
pht('Send Another Email')));
$view->appendChild(phutil_tag_div(
'aphront-failure-continue',
phutil_tag(
'a',
array('class' => 'button', 'href' => '/login/email/'),
pht('Send Another Email'))));
return $this->buildStandardPageResponse(
$view,

View file

@ -48,8 +48,8 @@ final class PhabricatorMustVerifyEmailController
$error_view->appendChild(phutil_tag('p', array(), pht(
'If you did not receive an email, you can click the button below '.
'to try sending another one.')));
$error_view->appendChild(hsprintf(
'<div class="aphront-failure-continue">%s</div>',
$error_view->appendChild(phutil_tag_div(
'aphront-failure-continue',
phabricator_form(
$user,
array(

View file

@ -254,18 +254,18 @@ final class PhabricatorAuthProviderLDAP
$captions = array(
self::KEY_HOSTNAME =>
pht('Example: %s',
hsprintf('<tt>%s</tt>', pht('ldap.example.com'))),
phutil_tag('tt', array(), pht('ldap.example.com'))),
self::KEY_DISTINGUISHED_NAME =>
pht('Example: %s',
hsprintf('<tt>%s</tt>', pht('ou=People, dc=example, dc=com'))),
phutil_tag('tt', array(), pht('ou=People, dc=example, dc=com'))),
self::KEY_SEARCH_ATTRIBUTE =>
pht('Example: %s',
hsprintf('<tt>%s</tt>', pht('sn'))),
phutil_tag('tt', array(), pht('sn'))),
self::KEY_USERNAME_ATTRIBUTE =>
pht('Optional, if different from search attribute.'),
self::KEY_REALNAME_ATTRIBUTES =>
pht('Optional. Example: %s',
hsprintf('<tt>%s</tt>', pht('firstname, lastname'))),
phutil_tag('tt', array(), pht('firstname, lastname'))),
self::KEY_REFERRALS =>
pht('Follow referrals. Disable this for Windows AD 2003.'),
self::KEY_START_TLS =>

View file

@ -84,9 +84,7 @@ final class PhabricatorAuthProviderOAuthFacebook
"improves security by preventing an attacker from capturing ".
"an insecure Facebook session and escalating it into a ".
"Phabricator session. Enabling it is recommended.",
hsprintf(
'<strong>%s</strong>',
pht('Require Secure Browsing:')))));
phutil_tag('strong', array(), pht('Require Secure Browsing:')))));
}
public function renderConfigPropertyTransactionTitle(

View file

@ -246,8 +246,9 @@ abstract class PhabricatorController extends AphrontController {
$view = new PhabricatorStandardPageView();
$view->setRequest($request);
$view->setController($this);
$view->appendChild(hsprintf(
'<div style="padding: 2em 0;">%s</div>',
$view->appendChild(phutil_tag(
'div',
array('style' => 'padding: 2em 0;'),
$response->buildResponseString()));
$page_response = new AphrontWebpageResponse();
$page_response->setContent($view->render());

View file

@ -61,7 +61,7 @@ final class PhabricatorCalendarBrowseController
$nav->appendChild(
array(
$this->getNoticeView(),
hsprintf('<div style="padding: 20px;">%s</div>', $month_view),
phutil_tag('div', array('style' => 'padding: 20px;'), $month_view),
));
return $this->buildApplicationPage(

View file

@ -87,10 +87,9 @@ final class AphrontCalendarMonthView extends AphrontView {
} else {
$show_events = array_fill_keys(
array_keys($show_events),
hsprintf(
'<div class="aphront-calendar-event aphront-calendar-event-empty">'.
'&nbsp;'.
'</div>'));
phutil_tag_div(
'aphront-calendar-event aphront-calendar-event-empty',
"\xC2\xA0")); // &nbsp;
}
foreach ($events as $event) {
@ -119,45 +118,49 @@ final class AphrontCalendarMonthView extends AphrontView {
$name);
}
$markup[] = hsprintf(
'<div class="%s">'.
'<div class="aphront-calendar-date-number">%s</div>'.
'%s%s'.
'</div>',
$markup[] = phutil_tag_div(
$class,
$day_number,
$holiday_markup,
phutil_implode_html("\n", $show_events));
array(
phutil_tag_div('aphront-calendar-date-number', $day_number),
$holiday_markup,
phutil_implode_html("\n", $show_events),
));
}
$table = array();
$rows = array_chunk($markup, 7);
foreach ($rows as $row) {
$table[] = hsprintf('<tr>');
$cells = array();
while (count($row) < 7) {
$row[] = $empty_box;
}
foreach ($row as $cell) {
$table[] = phutil_tag('td', array(), $cell);
$cells[] = phutil_tag('td', array(), $cell);
}
$table[] = hsprintf('</tr>');
$table[] = phutil_tag('tr', array(), $cells);
}
$table = hsprintf(
'<table class="aphront-calendar-view">'.
'%s'.
'<tr class="aphront-calendar-day-of-week-header">'.
'<th>Sun</th>'.
'<th>Mon</th>'.
'<th>Tue</th>'.
'<th>Wed</th>'.
'<th>Thu</th>'.
'<th>Fri</th>'.
'<th>Sat</th>'.
'</tr>'.
'%s'.
'</table>',
$this->renderCalendarHeader($first),
phutil_implode_html("\n", $table));
$header = phutil_tag(
'tr',
array('class' => 'aphront-calendar-day-of-week-header'),
array(
phutil_tag('th', array(), pht('Sun')),
phutil_tag('th', array(), pht('Mon')),
phutil_tag('th', array(), pht('Tue')),
phutil_tag('th', array(), pht('Wed')),
phutil_tag('th', array(), pht('Thu')),
phutil_tag('th', array(), pht('Fri')),
phutil_tag('th', array(), pht('Sat')),
));
$table = phutil_tag(
'table',
array('class' => 'aphront-calendar-view'),
array(
$this->renderCalendarHeader($first),
$header,
phutil_implode_html("\n", $table),
));
return $table;
}
@ -190,11 +193,14 @@ final class AphrontCalendarMonthView extends AphrontView {
$right_th = phutil_tag('th', array(), $next_link);
}
return hsprintf(
'<tr class="aphront-calendar-month-year-header">%s%s%s</tr>',
$left_th,
phutil_tag('th', array('colspan' => $colspan), $date->format('F Y')),
$right_th);
return phutil_tag(
'tr',
array('class' => 'aphront-calendar-month-year-header'),
array(
$left_th,
phutil_tag('th', array('colspan' => $colspan), $date->format('F Y')),
$right_th,
));
}
private function getNextYearAndMonth() {

View file

@ -423,7 +423,10 @@ final class PhabricatorConduitAPIController
$value = $json->encodeFormatted($value);
}
$value = hsprintf('<pre style="white-space: pre-wrap;">%s</pre>', $value);
$value = phutil_tag(
'pre',
array('style' => 'white-space: pre-wrap;'),
$value);
return $value;
}

View file

@ -61,8 +61,9 @@ final class PhabricatorConduitSearchEngine
->setLabel('Applications')
->setName('applicationNames')
->setValue(implode(', ', $names))
->setCaption(
pht('Example: %s', hsprintf('<tt>differential, paste</tt>'))));
->setCaption(pht(
'Example: %s',
phutil_tag('tt', array(), 'differential, paste'))));
$is_stable = $saved->getParameter('isStable');
$is_unstable = $saved->getParameter('isUnstable');

View file

@ -473,10 +473,10 @@ final class PhabricatorConfigEditController
}
$table = array();
$table[] = hsprintf(
'<tr class="column-labels"><th>%s</th><th>%s</th></tr>',
pht('Example'),
pht('Value'));
$table[] = phutil_tag('tr', array('class' => 'column-labels'), array(
phutil_tag('th', array(), pht('Example')),
phutil_tag('th', array(), pht('Value')),
));
foreach ($examples as $example) {
list($value, $description) = $example;
@ -488,10 +488,10 @@ final class PhabricatorConfigEditController
}
}
$table[] = hsprintf(
'<tr><th>%s</th><td>%s</td></tr>',
$description,
$value);
$table[] = phutil_tag('tr', array(), array(
phutil_tag('th', array(), $description),
phutil_tag('th', array(), $value),
));
}
require_celerity_resource('config-options-css');
@ -509,10 +509,10 @@ final class PhabricatorConfigEditController
$stack = $stack->getStack();
$table = array();
$table[] = hsprintf(
'<tr class="column-labels"><th>%s</th><th>%s</th></tr>',
pht('Source'),
pht('Value'));
$table[] = phutil_tag('tr', array('class' => 'column-labels'), array(
phutil_tag('th', array(), pht('Source')),
phutil_tag('th', array(), pht('Value')),
));
foreach ($stack as $key => $source) {
$value = $source->getKeys(
array(
@ -526,10 +526,10 @@ final class PhabricatorConfigEditController
$value[$option->getKey()]);
}
$table[] = hsprintf(
'<tr><th>%s</th><td>%s</td></tr>',
$source->getName(),
$value);
$table[] = phutil_tag('tr', array('class' => 'column-labels'), array(
phutil_tag('th', array(), $source->getName()),
phutil_tag('td', array(), $value),
));
}
require_celerity_resource('config-options-css');

View file

@ -72,8 +72,8 @@ final class ConpherenceNotificationPanelController
}
$content = $view->render();
} else {
$content = hsprintf(
'<div class="phabricator-notification no-notifications">%s</div>',
$content = phutil_tag_div(
'phabricator-notification no-notifications',
pht('You have no messages.'));
}

View file

@ -43,7 +43,7 @@ final class PhabricatorCountdownDeleteController
$dialog = new AphrontDialogView();
$dialog->setUser($request->getUser());
$dialog->setTitle(pht('Really delete this countdown?'));
$dialog->appendChild(hsprintf('<p>%s</p>', $inst));
$dialog->appendChild(phutil_tag('p', array(), $inst));
$dialog->addSubmitButton(pht('Delete'));
$dialog->addCancelButton('/countdown/');
$dialog->setSubmitURI($request->getPath());

View file

@ -42,30 +42,31 @@ final class PhabricatorCountdownView extends AphrontTagView {
}
$container = celerity_generate_unique_node_id();
$content = hsprintf(
'<div class="phabricator-timer" id="%s">
%s
<table class="phabricator-timer-table">
<tr>
<th>%s</th>
<th>%s</th>
<th>%s</th>
<th>%s</th>
</tr>
<tr>%s%s%s%s</tr>
</table>
</div>',
$container,
$header,
pht('Days'),
pht('Hours'),
pht('Minutes'),
pht('Seconds'),
$ths = array(
phutil_tag('th', array(), pht('Days')),
phutil_tag('th', array(), pht('Hours')),
phutil_tag('th', array(), pht('Minutes')),
phutil_tag('th', array(), pht('Seconds')),
);
$dashes = array(
javelin_tag('td', array('sigil' => 'phabricator-timer-days'), '-'),
javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), '-'),
javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), '-'),
javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), '-'));
javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), '-'),
);
$container = celerity_generate_unique_node_id();
$content = phutil_tag(
'div',
array('class' => 'phabricator-timer', 'id' => $container),
array(
$header,
phutil_tag('table', array('class' => 'phabricator-timer-table'), array(
phutil_tag('tr', array(), $ths),
phutil_tag('tr', array(), $dashes),
)),
));
Javelin::initBehavior('countdown-timer', array(
'timestamp' => $countdown->getEpoch(),

View file

@ -36,8 +36,9 @@ final class DifferentialDiffViewController extends DifferentialController {
// TODO: implement optgroup support in AphrontFormSelectControl?
$select = array();
$select[] = hsprintf('<optgroup label="%s">', pht('Create New Revision'));
$select[] = hsprintf(
'<option value="">%s</option>',
$select[] = phutil_tag(
'option',
array('value' => ''),
pht('Create a new Revision...'));
$select[] = hsprintf('</optgroup>');

View file

@ -49,7 +49,7 @@ final class DifferentialRevisionLandController extends DifferentialController {
$ex->getMessage(),
$ex->getPreviousException()->getMessage());
} else {
$text = hsprintf('<pre>%s</pre>', $ex->getMessage());
$text = phutil_tag('pre', array(), $ex->getMessage());
}
$text = id(new AphrontErrorView())
->appendChild($text);

View file

@ -250,9 +250,7 @@ abstract class DifferentialChangesetHTMLRenderer
}
}
return hsprintf(
'<div class="differential-meta-notice">%s</div>',
$message);
return phutil_tag_div('differential-meta-notice', $message);
}
protected function renderPropertyChangeHeader() {
@ -281,27 +279,21 @@ abstract class DifferentialChangesetHTMLRenderer
$nval = phutil_escape_html_newlines($nval);
}
$rows[] = hsprintf(
'<tr>'.
'<th>%s</th>'.
'<td class="oval">%s</td>'.
'<td class="nval">%s</td>'.
'</tr>',
$key,
$oval,
$nval);
$rows[] = phutil_tag('tr', array(), array(
phutil_tag('th', array(), $key),
phutil_tag('td', array('class' => 'oval'), $oval),
phutil_tag('td', array('class' => 'nval'), $nval),
));
}
}
array_unshift($rows, hsprintf(
'<tr class="property-table-header">'.
'<th>%s</th>'.
'<td class="oval">%s</td>'.
'<td class="nval">%s</td>'.
'</tr>',
pht('Property Changes'),
pht('Old Value'),
pht('New Value')));
array_unshift(
$rows,
phutil_tag('tr', array('class' => 'property-table-header'), array(
phutil_tag('th', array(), pht('Property Changes')),
phutil_tag('td', array('class' => 'oval'), pht('Old Value')),
phutil_tag('td', array('class' => 'nval'), pht('New Value')),
)));
return phutil_tag(
'table',

View file

@ -27,19 +27,19 @@ final class DifferentialChangesetOneUpRenderer
} else {
$class = 'left';
}
$out[] = hsprintf('<th>%s</th>', $p['line']);
$out[] = hsprintf('<th></th>');
$out[] = hsprintf('<td class="%s">%s</td>', $class, $p['render']);
$out[] = phutil_tag('th', array(), $p['line']);
$out[] = phutil_tag('th', array());
$out[] = phutil_tag('td', array('class' => $class), $p['render']);
} else if ($type == 'new') {
if ($p['htype']) {
$class = 'right new';
$out[] = hsprintf('<th />');
$out[] = phutil_tag('th', array());
} else {
$class = 'right';
$out[] = hsprintf('<th>%s</th>', $p['oline']);
$out[] = phutil_tag('th', array(), $p['oline']);
}
$out[] = hsprintf('<th>%s</th>', $p['line']);
$out[] = hsprintf('<td class="%s">%s</td>', $class, $p['render']);
$out[] = phutil_tag('th', array(), $p['line']);
$out[] = phutil_tag('td', array('class' => $class), $p['render']);
}
$out[] = hsprintf('</tr>');
break;

View file

@ -222,7 +222,7 @@ final class DifferentialChangesetTwoUpRenderer
$cov_class = $coverage[$n_num - 1];
}
$cov_class = 'cov-'.$cov_class;
$n_cov = hsprintf('<td class="cov %s"></td>', $cov_class);
$n_cov = phutil_tag('td', array('class' => "cov {$cov_class}"));
$n_colspan--;
}
@ -240,7 +240,7 @@ final class DifferentialChangesetTwoUpRenderer
$n_classes = $n_class;
if ($new_lines[$ii]['type'] == '\\' || !isset($copy_lines[$n_num])) {
$n_copy = hsprintf('<td class="copy %s"></td>', $n_class);
$n_copy = phutil_tag('td', array('class' => "copy {$n_class}"));
} else {
list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num];
$title = ($orig_type == '-' ? 'Moved' : 'Copied').' from ';
@ -283,29 +283,25 @@ final class DifferentialChangesetTwoUpRenderer
$n_id = null;
}
// NOTE: This is a unicode zero-width space, which we use as a hint
// when intercepting 'copy' events to make sure sensible text ends
// up on the clipboard. See the 'phabricator-oncopy' behavior.
$zero_space = "\xE2\x80\x8B";
// NOTE: The Javascript is sensitive to whitespace changes in this
// block!
$html[] = hsprintf(
'<tr>'.
'%s'.
'<td class="%s">%s</td>'.
'%s'.
'%s'.
// NOTE: This is a unicode zero-width space, which we use as a hint
// when intercepting 'copy' events to make sure sensible text ends
// up on the clipboard. See the 'phabricator-oncopy' behavior.
'<td class="%s" colspan="%s">'.
"\xE2\x80\x8B%s".
'</td>'.
'%s'.
'</tr>',
$html[] = phutil_tag('tr', array(), array(
phutil_tag('th', array('id' => $o_id), $o_num),
$o_classes, $o_text,
phutil_tag('td', array('class' => $o_classes), $o_text),
phutil_tag('th', array('id' => $n_id), $n_num),
$n_copy,
$n_classes, $n_colspan, $n_text,
$n_cov);
phutil_tag(
'td',
array('class' => $n_classes, 'colspan' => $n_colspan),
array($zero_space, $n_text)),
$n_cov,
));
if ($context_not_available && ($ii == $rows - 1)) {
$html[] = $context_not_available;
@ -328,29 +324,27 @@ final class DifferentialChangesetTwoUpRenderer
}
}
}
$html[] = hsprintf(
'<tr class="inline">'.
'<th />'.
'<td class="left">%s</td>'.
'<th />'.
'<td colspan="3" class="right3">%s</td>'.
'</tr>',
$comment_html,
$new);
$html[] = phutil_tag('tr', array('class' => 'inline'), array(
phutil_tag('th', array()),
phutil_tag('td', array('class' => 'left'), $comment_html),
phutil_tag('th', array()),
phutil_tag('td', array('colspan' => 3, 'class' => 'right3'), $new),
));
}
}
if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $comment) {
$comment_html = $this->renderInlineComment($comment,
$on_right = true);
$html[] = hsprintf(
'<tr class="inline">'.
'<th />'.
'<td class="left" />'.
'<th />'.
'<td colspan="3" class="right3">%s</td>'.
'</tr>',
$comment_html);
$html[] = phutil_tag('tr', array('class' => 'inline'), array(
phutil_tag('th', array()),
phutil_tag('td', array('class' => 'left')),
phutil_tag('th', array()),
phutil_tag(
'td',
array('colspan' => 3, 'class' => 'right3'),
$comment_html),
));
}
}
}
@ -395,40 +389,39 @@ final class DifferentialChangesetTwoUpRenderer
foreach ($this->getOldComments() as $on_line => $comment_group) {
foreach ($comment_group as $comment) {
$comment_html = $this->renderInlineComment($comment, $on_right = false);
$html_old[] = hsprintf(
'<tr class="inline">'.
'<th />'.
'<td class="left">%s</td>'.
'<th />'.
'<td class="right3" colspan="3" />'.
'</tr>',
$comment_html);
$html_old[] = phutil_tag('tr', array('class' => 'inline'), array(
phutil_tag('th', array()),
phutil_tag('td', array('class' => 'left'), $comment_html),
phutil_tag('th', array()),
phutil_tag('td', array('colspan' => 3, 'class' => 'right3')),
));
}
}
foreach ($this->getNewComments() as $lin_line => $comment_group) {
foreach ($comment_group as $comment) {
$comment_html = $this->renderInlineComment($comment, $on_right = true);
$html_new[] = hsprintf(
'<tr class="inline">'.
'<th />'.
'<td class="left" />'.
'<th />'.
'<td class="right3" colspan="3">%s</td>'.
'</tr>',
$comment_html);
$html_new[] = phutil_tag('tr', array('class' => 'inline'), array(
phutil_tag('th', array()),
phutil_tag('td', array('class' => 'left')),
phutil_tag('th', array()),
phutil_tag(
'td',
array('colspan' => 3, 'class' => 'right3'),
$comment_html),
));
}
}
if (!$old) {
$th_old = hsprintf('<th></th>');
$th_old = phutil_tag('th', array());
} else {
$th_old = hsprintf('<th id="C%sOL1">1</th>', $vs);
$th_old = phutil_tag('th', array('id' => "C{$vs}OL1"), 1);
}
if (!$new) {
$th_new = hsprintf('<th></th>');
$th_new = phutil_tag('th', array());
} else {
$th_new = hsprintf('<th id="C%sNL1">1</th>', $id);
$th_new = phutil_tag('th', array('id' => "C{$id}OL1"), 1);
}
$output = hsprintf(

View file

@ -181,16 +181,17 @@ final class DifferentialAddCommentView extends AphrontView {
$warn = phutil_tag('div', array('id' => 'warnings'), $warning_container);
$preview = hsprintf(
'<div class="aphront-panel-preview aphront-panel-flush">'.
'<div id="comment-preview">'.
'<span class="aphront-panel-preview-loading-text">%s</span>'.
'</div>'.
'<div id="inline-comment-preview">'.
'</div>'.
'</div>',
$loading = phutil_tag(
'span',
array('class' => 'aphront-panel-preview-loading-text'),
pht('Loading comment preview...'));
$preview = phutil_tag_div(
'aphront-panel-preview aphront-panel-flush',
array(
phutil_tag('div', array('id' => 'comment-preview'), $loading),
phutil_tag('div', array('id' => 'inline-comment-preview')),
));
$comment_box = id(new PHUIObjectBoxView())

View file

@ -246,19 +246,21 @@ final class DifferentialChangesetListView extends AphrontView {
array('Changes discarded. ', $link));
return array(
'l' => hsprintf(
'<table><tr>'.
'<th></th><td>%s</td>'.
'<th></th><td colspan="3"></td>'.
'</tr></table>',
$div),
'l' => phutil_tag('table', array(),
phutil_tag('tr', array(), array(
phutil_tag('th', array()),
phutil_tag('td', array(), $div),
phutil_tag('th', array()),
phutil_tag('td', array('colspan' => 3)),
))),
'r' => hsprintf(
'<table><tr>'.
'<th></th><td></td>'.
'<th></th><td colspan="3">%s</td>'.
'</tr></table>',
$div),
'r' => phutil_tag('table', array(),
phutil_tag('tr', array(), array(
phutil_tag('th', array()),
phutil_tag('td', array()),
phutil_tag('th', array()),
phutil_tag('td', array('colspan' => 3), $div),
))),
);
}

View file

@ -136,7 +136,8 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$pchar =
($changeset->getOldProperties() === $changeset->getNewProperties())
? null
: hsprintf('<span title="%s">M</span>', pht('Properties Changed'));
: phutil_tag('span', array('title' => pht('Properties Changed')), 'M')
;
$fname = $changeset->getFilename();
$cov = $this->renderCoverage($coverage, $fname);
@ -152,28 +153,25 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
(isset($this->visibleChangesets[$id]) ? 'Loading...' : '?'));
}
$rows[] = hsprintf(
'<tr>'.
'<td class="differential-toc-char" title="%s">%s</td>'.
'<td class="differential-toc-prop">%s</td>'.
'<td class="differential-toc-ftype">%s</td>'.
'<td class="differential-toc-file">%s%s</td>'.
'<td class="differential-toc-cov">%s</td>'.
'<td class="differential-toc-mcov">%s</td>'.
'</tr>',
$chartitle, $char,
$pchar,
$desc,
$link, $lines,
$cov,
$mcov);
$rows[] = phutil_tag('tr', array(), array(
phutil_tag(
'td',
array('class' => 'differential-toc-char', 'title' => $chartitle),
$char),
phutil_tag('td', array('class' => 'differential-toc-prop'), $pchar),
phutil_tag('td', array('class' => 'differential-toc-ftype'), $desc),
phutil_tag(
'td',
array('class' => 'differential-toc-file'),
array($link, $lines)),
phutil_tag('td', array('class' => 'differential-toc-cov'), $cov),
phutil_tag('td', array('class' => 'differential-toc-mcov'), $mcov),
));
if ($meta) {
$rows[] = hsprintf(
'<tr>'.
'<td colspan="3"></td>'.
'<td class="differential-toc-meta">%s</td>'.
'</tr>',
$meta);
$rows[] = phutil_tag('tr', array(), array(
phutil_tag('td', array('colspan' => 3)),
phutil_tag('td', array('class' => 'differential-toc-meta'), $meta),
));
}
if ($this->diff && $this->repository) {
$paths[] =
@ -208,10 +206,9 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
),
pht('Show All Context'));
$buttons = hsprintf(
'<tr><td colspan="7">%s%s</td></tr>',
$editor_link,
$reveal_link);
$buttons = phutil_tag('tr', array(),
phutil_tag('td', array('colspan' => 7),
array($editor_link, $reveal_link)));
$content = hsprintf(
'%s'.

View file

@ -60,17 +60,21 @@ final class DifferentialInlineCommentEditView extends AphrontView {
$this->renderBody(),
));
return hsprintf(
'<table>'.
'<tr class="inline-comment-splint">'.
'<th></th>'.
'<td class="left">%s</td>'.
'<th></th>'.
'<td colspan="3" class="right3">%s</td>'.
'</tr>'.
'</table>',
$this->onRight ? null : $content,
$this->onRight ? $content : null);
return phutil_tag('table', array(), phutil_tag(
'tr',
array('class' => 'inline-comment-splint'),
array(
phutil_tag('th', array()),
phutil_tag(
'td',
array('class' => 'left'),
$this->onRight ? null : $content),
phutil_tag('th', array()),
phutil_tag(
'td',
array('colspan' => 3, 'class' => 'right3'),
$this->onRight ? $content : null),
)));
}
private function renderInputs() {

View file

@ -217,6 +217,11 @@ final class DifferentialInlineCommentView extends AphrontView {
$author = $handles[$inline->getAuthorPHID()]->getName();
}
$line = phutil_tag(
'span',
array('class' => 'differential-inline-comment-line'),
$line);
$markup = javelin_tag(
'div',
array(
@ -224,18 +229,19 @@ final class DifferentialInlineCommentView extends AphrontView {
'sigil' => $sigil,
'meta' => $metadata,
),
hsprintf(
'<div class="differential-inline-comment-head">'.
'%s%s <span class="differential-inline-comment-line">%s</span> %s'.
'</div>'.
'<div class="differential-inline-comment-content">'.
'<div class="phabricator-remarkup">%s</div>'.
'</div>',
$anchor,
$links,
$line,
$author,
$content));
array(
phutil_tag_div('differential-inline-comment-head', array(
$anchor,
$links,
' ',
$line,
' ',
$author,
)),
phutil_tag_div(
'differential-inline-comment-content',
phutil_tag_div('phabricator-remarkup', $content)),
));
return $this->scaffoldMarkup($markup);
}
@ -248,17 +254,16 @@ final class DifferentialInlineCommentView extends AphrontView {
$left_markup = !$this->onRight ? $markup : '';
$right_markup = $this->onRight ? $markup : '';
return hsprintf(
'<table>'.
'<tr class="inline">'.
'<th></th>'.
'<td class="left">%s</td>'.
'<th></th>'.
'<td class="right3" colspan="3">%s</td>'.
'</tr>'.
'</table>',
$left_markup,
$right_markup);
return phutil_tag('table', array(),
phutil_tag('tr', array(), array(
phutil_tag('th', array()),
phutil_tag('td', array('class' => 'left'), $left_markup),
phutil_tag('th', array()),
phutil_tag(
'td',
array('colspan' => 3, 'class' => 'right3'),
$right_markup),
)));
}
}

View file

@ -128,12 +128,10 @@ final class DifferentialLocalCommitsView extends AphrontView {
$headers = phutil_tag('tr', array(), $headers);
$content = hsprintf(
'<div class="differential-panel">'.
'<table class="differential-local-commits-table">%s%s</table>'.
'</div>',
$headers,
phutil_implode_html("\n", $rows));
$content = phutil_tag_div('differential-panel', phutil_tag(
'table',
array('class' => 'differential-local-commits-table'),
array($headers, phutil_implode_html("\n", $rows))));
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Local Commits'))

View file

@ -87,9 +87,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
$comment,
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
$content = hsprintf(
'<div class="phabricator-remarkup">%s</div>',
$content);
$content = phutil_tag_div('phabricator-remarkup', $content);
}
$inline_render = $this->renderInlineComments();
@ -207,10 +205,9 @@ final class DifferentialRevisionCommentView extends AphrontView {
}
if (!$hide_comments) {
$xaction_view->appendChild(hsprintf(
'<div class="differential-comment-core">%s%s</div>',
$content,
$inline_render));
$xaction_view->appendChild(phutil_tag_div(
'differential-comment-core',
array($content, $inline_render)));
}
return $xaction_view->render();

View file

@ -200,23 +200,25 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
phutil_tag('th', array(), pht('Unit')),
)));
$content = hsprintf(
'<div class="differential-revision-history differential-panel">'.
'<form action="#toc">'.
'<table class="differential-revision-history-table">'.
'%s'.
'<tr>'.
'<td colspan="9" class="diff-differ-submit">'.
'<label>%s</label>'.
'<button>%s</button>'.
'</td>'.
'</tr>'.
'</table>'.
'</form>'.
'</div>',
phutil_implode_html("\n", $rows),
pht('Whitespace Changes: %s', $select),
pht('Show Diff'));
$label = pht('Whitespace Changes: %s', $select);
$content = phutil_tag_div(
'differential-revision-history differential-panel',
phutil_tag(
'form',
array('action' => '#toc'),
phutil_tag(
'table',
array('class' => 'differential-revision-history-table'), array(
phutil_implode_html("\n", $rows),
phutil_tag('tr', array(), phutil_tag(
'td',
array('colspan' => 9, 'class' => 'diff-differ-submit'),
array(
phutil_tag('label', array(), $label),
phutil_tag('button', array(), pht('Show Diff')),
)))
))));
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Revision Update History'))

View file

@ -744,21 +744,26 @@ final class DiffusionCommitController extends DiffusionController {
'inlineuri' => '/diffusion/inline/preview/'.$commit->getPHID().'/',
));
$preview_panel = hsprintf(
'<div class="aphront-panel-preview aphront-panel-flush">
<div id="audit-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
</div>
</div>
<div id="inline-comment-preview">
</div>
</div>');
$loading = phutil_tag_div(
'aphront-panel-preview-loading-text',
pht('Loading preview...'));
$preview_panel = phutil_tag_div(
'aphront-panel-preview aphront-panel-flush',
array(
phutil_tag('div', array('id' => 'audit-preview'), $loading),
phutil_tag('div', array('id' => 'inline-comment-preview'))
));
// TODO: This is pretty awkward, unify the CSS between Diffusion and
// Differential better.
require_celerity_resource('differential-core-view-css');
$anchor = id(new PhabricatorAnchorView())
->setAnchorName('comment')
->setNavigationMarker(true)
->render();
$comment_box = id(new PHUIObjectBoxView())
->setHeader($header)
->appendChild($form);
@ -768,14 +773,9 @@ final class DiffusionCommitController extends DiffusionController {
array(
'id' => $pane_id,
),
hsprintf(
'<div class="differential-add-comment-panel">%s%s%s</div>',
id(new PhabricatorAnchorView())
->setAnchorName('comment')
->setNavigationMarker(true)
->render(),
$comment_box,
$preview_panel));
phutil_tag_div(
'differential-add-comment-panel',
array($anchor, $comment_box, $preview_panel)));
}
/**

View file

@ -69,25 +69,20 @@ final class DiffusionLintController extends DiffusionController {
$total += $code['n'];
$href_lint = $drequest->generateURI(array(
'action' => 'lint',
'lint' => $code['code'],
));
$href_browse = $drequest->generateURI(array(
'action' => 'browse',
'lint' => $code['code'],
));
$href_repo = $drequest->generateURI(array('action' => 'lint'));
$rows[] = array(
hsprintf(
'<a href="%s">%s</a>',
$drequest->generateURI(array(
'action' => 'lint',
'lint' => $code['code'],
)),
$code['n']),
hsprintf(
'<a href="%s">%s</a>',
$drequest->generateURI(array(
'action' => 'browse',
'lint' => $code['code'],
)),
$code['files']),
hsprintf(
'<a href="%s">%s</a>',
$drequest->generateURI(array('action' => 'lint')),
$drequest->getCallsign()),
phutil_tag('a', array('href' => $href_lint), $code['n']),
phutil_tag('a', array('href' => $href_browse), $code['files']),
phutil_tag('a', array('href' => $href_repo), $drequest->getCallsign()),
ArcanistLintSeverity::getStringForSeverity($code['maxSeverity']),
$code['code'],
$code['maxName'],

View file

@ -15,22 +15,22 @@ final class DiffusionLintDetailsController extends DiffusionController {
$rows = array();
foreach ($messages as $message) {
$path = hsprintf(
'<a href="%s">%s</a>',
$drequest->generateURI(array(
$path = phutil_tag(
'a',
array('href' => $drequest->generateURI(array(
'action' => 'lint',
'path' => $message['path'],
)),
))),
substr($message['path'], strlen($drequest->getPath()) + 1));
$line = hsprintf(
'<a href="%s">%s</a>',
$drequest->generateURI(array(
$line = phutil_tag(
'a',
array('href' => $drequest->generateURI(array(
'action' => 'browse',
'path' => $message['path'],
'line' => $message['line'],
'commit' => $branch->getLintCommit(),
)),
))),
$message['line']);
$author = $message['authorPHID'];

View file

@ -74,12 +74,12 @@ final class DiffusionBrowseTableView extends DiffusionView {
$lint = self::loadLintMessagesCount($drequest);
if ($lint !== null) {
$return['lint'] = hsprintf(
'<a href="%s">%s</a>',
$drequest->generateURI(array(
$return['lint'] = phutil_tag(
'a',
array('href' => $drequest->generateURI(array(
'action' => 'lint',
'lint' => null,
)),
))),
number_format($lint));
}

View file

@ -139,12 +139,12 @@ final class DiffusionCommentView extends AphrontView {
if (!strlen($comment->getContent()) && empty($this->inlineComments)) {
return null;
} else {
return hsprintf(
'<div class="phabricator-remarkup">%s%s</div>',
return phutil_tag_div('phabricator-remarkup', array(
$engine->getOutput(
$comment,
PhabricatorAuditComment::MARKUP_FIELD_BODY),
$this->renderInlines());
$this->renderInlines(),
));
}
}

View file

@ -47,8 +47,8 @@ final class PhabricatorFeedBuilder {
if ($date !== $last_date) {
if ($last_date !== null) {
$null_view->appendChild(hsprintf(
'<div class="phabricator-feed-story-date-separator"></div>'));
$null_view->appendChild(
phutil_tag_div('phabricator-feed-story-date-separator'));
}
$last_date = $date;
$header = new PhabricatorActionHeaderView();

View file

@ -27,9 +27,7 @@ final class PhabricatorFeedDetailController extends PhabricatorFeedController {
$title = pht('Story');
$feed_view = hsprintf(
'<div class="phabricator-feed-frame">%s</div>',
$feed_view);
$feed_view = phutil_tag_div('phabricator-feed-frame', $feed_view);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(

View file

@ -32,9 +32,7 @@ final class PhabricatorFeedListController extends PhabricatorFeedController
$builder->setUser($this->getRequest()->getUser());
$view = $builder->buildView();
return hsprintf(
'<div class="phabricator-feed-frame">%s</div>',
$view);
return phutil_tag_div('phabricator-feed-frame', $view);
}
}

View file

@ -25,7 +25,8 @@ final class PhabricatorFeedPublicStreamController
->setFramed(true)
->setUser($viewer);
$view = hsprintf('<div class="phabricator-public-feed-frame">%s</div>',
$view = phutil_tag_div(
'phabricator-public-feed-frame',
$builder->buildView());
return $this->buildStandardPageResponse(

View file

@ -37,13 +37,13 @@ final class PhabricatorFeedStoryCommit extends PhabricatorFeedStory {
}
if ($author) {
$title = hsprintf(
$title = pht(
"%s committed %s (authored by %s)",
$committer,
$commit,
$author);
} else {
$title = hsprintf(
$title = pht(
"%s committed %s",
$committer,
$commit);

View file

@ -61,15 +61,23 @@ final class ShellLogView extends AphrontView {
// TODO: Provide nice links.
$th = phutil_tag(
'th',
array(
'class' => 'phabricator-source-line',
'style' => 'background-color: #fff;',
),
$content_number);
$td = phutil_tag(
'td',
array('class' => 'phabricator-source-code'),
$content_line);
$rows[] = phutil_tag(
'tr',
$row_attributes,
hsprintf(
'<th class="phabricator-source-line" '.
'style="background-color: #fff;">%s</th>'.
'<td class="phabricator-source-code">%s</td>',
$content_number,
$content_line));
array($th, $td));
if ($hit_limit) {
break;

View file

@ -94,8 +94,8 @@ final class HeraldTestConsoleController extends HeraldController {
$form = id(new AphrontFormView())
->setUser($user)
->appendChild(hsprintf(
'<p class="aphront-form-instructions">%s</p>', $text))
->appendChild(
phutil_tag('p', array('class' => 'aphront-form-instructions'), $text))
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Object Name'))

View file

@ -133,7 +133,7 @@ final class HeraldTranscriptController extends HeraldController {
$value = implode(', ', $value);
}
return hsprintf('<span class="condition-test-value">%s</span>', $value);
return phutil_tag('span', array('class' => 'condition-test-value'), $value);
}
private function buildSideNav() {
@ -306,13 +306,15 @@ final class HeraldTranscriptController extends HeraldController {
}
if ($apply_xscript->getApplied()) {
$success = pht('SUCCESS');
$outcome =
hsprintf('<span class="outcome-success">%s</span>', $success);
$outcome = phutil_tag(
'span',
array('class' => 'outcome-success'),
pht('SUCCESS'));
} else {
$failure = pht('FAILURE');
$outcome =
hsprintf('<span class="outcome-failure">%s</span>', $failure);
$outcome = phutil_tag(
'span',
array('class' => 'outcome-failure'),
pht('FAILURE'));
}
$rows[] = array(
@ -366,23 +368,21 @@ final class HeraldTranscriptController extends HeraldController {
$cond_markup = array();
foreach ($xscript->getConditionTranscriptsForRule($rule_id) as $cond) {
if ($cond->getNote()) {
$note = hsprintf(
'<div class="herald-condition-note">%s</div>',
$cond->getNote());
$note = phutil_tag_div('herald-condition-note', $cond->getNote());
} else {
$note = null;
}
if ($cond->getResult()) {
$result = hsprintf(
'<span class="herald-outcome condition-pass">'.
"\xE2\x9C\x93".
'</span>');
$result = phutil_tag(
'span',
array('class' => 'herald-outcome condition-pass'),
"\xE2\x9C\x93");
} else {
$result = hsprintf(
'<span class="herald-outcome condition-fail">'.
"\xE2\x9C\x98".
'</span>');
$result = phutil_tag(
'span',
array('class' => 'herald-outcome condition-fail'),
"\xE2\x9C\x98");
}
$cond_markup[] = phutil_tag(
@ -398,18 +398,23 @@ final class HeraldTranscriptController extends HeraldController {
}
if ($rule->getResult()) {
$pass = pht('PASS');
$result = hsprintf(
'<span class="herald-outcome rule-pass">%s</span>', $pass);
$result = phutil_tag(
'span',
array('class' => 'herald-outcome rule-pass'),
pht('PASS'));
$class = 'herald-rule-pass';
} else {
$fail = pht('FAIL');
$result = hsprintf(
'<span class="herald-outcome rule-fail">%s</span>', $fail);
$result = phutil_tag(
'span',
array('class' => 'herald-outcome rule-fail'),
pht('FAIL'));
$class = 'herald-rule-fail';
}
$cond_markup[] = hsprintf('<li>%s %s</li>', $result, $rule->getReason());
$cond_markup[] = phutil_tag(
'li',
array(),
array($result, $rule->getReason()));
$user_phid = $this->getRequest()->getUser()->getPHID();
$name = $rule->getRuleName();
@ -420,11 +425,11 @@ final class HeraldTranscriptController extends HeraldController {
array(
'class' => $class,
),
hsprintf(
'<div class="rule-name"><strong>%s</strong> %s</div>%s',
$name,
$handles[$rule->getRuleOwner()]->getName(),
phutil_tag('ul', array(), $cond_markup)));
phutil_tag_div('rule-name', array(
phutil_tag('strong', array(), $name),
' ',
phutil_tag('ul', array(), $cond_markup),
)));
}
$panel = '';

View file

@ -252,7 +252,7 @@ final class ManiphestReportController extends ManiphestController {
"of this project in the past but no longer is, it is not ".
"counted at all.");
$header = pht("Task Burn Rate for Project %s", $handle->renderLink());
$caption = hsprintf("<p>%s</p>", $inst);
$caption = phutil_tag('p', array(), $inst);
} else {
$header = pht("Task Burn Rate for All Tasks");
$caption = null;
@ -362,9 +362,9 @@ final class ManiphestReportController extends ManiphestController {
$fmt = number_format($delta);
if ($delta > 0) {
$fmt = '+'.$fmt;
$fmt = hsprintf('<span class="red">%s</span>', $fmt);
$fmt = phutil_tag('span', array('class' => 'red'), $fmt);
} else {
$fmt = hsprintf('<span class="green">%s</span>', $fmt);
$fmt = phutil_tag('span', array('class' => 'green'), $fmt);
}
return array(

View file

@ -18,9 +18,7 @@ final class ManiphestTaskDescriptionPreviewController
ManiphestTask::MARKUP_FIELD_DESCRIPTION,
$request->getUser());
$content = hsprintf(
'<div class="phabricator-remarkup">%s</div>',
$output);
$content = phutil_tag_div('phabricator-remarkup', $output);
return id(new AphrontAjaxResponse())
->setContent($content);

View file

@ -348,13 +348,14 @@ final class ManiphestTaskDetailController extends ManiphestController {
$comment_header = id(new PHUIHeaderView())
->setHeader($is_serious ? pht('Add Comment') : pht('Weigh In'));
$preview_panel = hsprintf(
'<div class="aphront-panel-preview">
<div id="transaction-preview">
<div class="aphront-panel-preview-loading-text">%s</div>
</div>
</div>',
pht('Loading preview...'));
$preview_panel = phutil_tag_div(
'aphront-panel-preview',
phutil_tag(
'div',
array('id' => 'transaction-preview'),
phutil_tag_div(
'aphront-panel-preview-loading-text',
pht('Loading preview...'))));
$timeline = id(new PhabricatorApplicationTransactionView())
->setUser($user)

View file

@ -45,14 +45,12 @@ final class PhabricatorNotificationListController
$builder = new PhabricatorNotificationBuilder($notifications);
$view = $builder->buildView()->render();
} else {
$view = hsprintf(
'<div class="phabricator-notification no-notifications">%s</div>',
$view = phutil_tag_div(
'phabricator-notification no-notifications',
$no_data);
}
$view = hsprintf(
'<div class="phabricator-notification-list">%s</div>',
$view);
$view = phutil_tag_div('phabricator-notification-list', $view);
$panel = new AphrontPanelView();
$panel->setHeader($header);

View file

@ -20,8 +20,8 @@ final class PhabricatorNotificationPanelController
$notifications_view = $builder->buildView();
$content = $notifications_view->render();
} else {
$content = hsprintf(
'<div class="phabricator-notification no-notifications">%s</div>',
$content = phutil_tag_div(
'phabricator-notification no-notifications',
pht('You have no notifications.'));
}

View file

@ -29,9 +29,7 @@ final class PhabricatorOwnersDeleteController
$dialog = id(new AphrontDialogView())
->setUser($user)
->setTitle('Really delete this package?')
->appendChild(hsprintf(
'<p>%s</p>',
$text))
->appendChild(phutil_tag('p', array(), $text))
->addSubmitButton(pht('Delete'))
->addCancelButton('/owners/package/'.$package->getID().'/')
->setSubmitURI($request->getRequestURI());

View file

@ -414,8 +414,8 @@ final class PhabricatorPeopleEditController
if ($is_self) {
$inst = pht('NOTE: You can not edit your own role.');
$form->appendChild(hsprintf(
'<p class="aphront-form-instructions">%s</p>', $inst));
$form->appendChild(
phutil_tag('p', array('class' => 'aphront-form-instructions'), $inst));
}
$form
@ -473,8 +473,8 @@ final class PhabricatorPeopleEditController
$form
->setUser($admin)
->setAction($request->getRequestURI())
->appendChild(hsprintf(
'<p class="aphront-form-instructions">%s</p>', $inst));
->appendChild(
phutil_tag('p', array('class' => 'aphront-form-instructions'), $inst));
if ($user->getIsSystemAgent()) {
$form
@ -703,11 +703,10 @@ final class PhabricatorPeopleEditController
),
pht('User Guide: Account Roles'));
$inst = pht('For a detailed explanation of account roles, see %s.',
$roles_link);
return hsprintf(
'<p class="aphront-form-instructions">%s</p>',
$inst);
return phutil_tag(
'p',
array('class' => 'aphront-form-instructions'),
pht('For a detailed explanation of account roles, see %s.', $roles_link));
}
private function processSetAccountPicture(PhabricatorUser $user) {

View file

@ -127,10 +127,8 @@ final class PhabricatorPeopleProfileController
$builder->setShowHovercards(true);
$view = $builder->buildView();
return hsprintf(
'<div class="profile-feed profile-wrap-responsive">
%s
</div>',
return phutil_tag_div(
'profile-feed profile-wrap-responsive',
$view->render());
}
}

View file

@ -143,17 +143,14 @@ final class PhamePostEditController
->addCancelButton($cancel_uri)
->setValue($submit_button));
$preview_panel = hsprintf(
'<div class="aphront-panel-preview">
<div class="phame-post-preview-header">
Post Preview
</div>
<div id="post-preview">
<div class="aphront-panel-preview-loading-text">
Loading preview...
</div>
</div>
</div>');
$loading = phutil_tag_div(
'aphront-panel-preview-loading-text',
pht('Loading preview...'));
$preview_panel = phutil_tag_div('aphront-panel-preview', array(
phutil_tag_div('phame-post-preview-header', pht('Post Preview')),
phutil_tag('div', array('id' => 'post-preview'), $loading),
));
require_celerity_resource('phame-css');
Javelin::initBehavior(

View file

@ -23,7 +23,7 @@ extends PhameController {
PhamePost::MARKUP_FIELD_BODY,
$user);
$content = hsprintf('<div class="phabricator-remarkup">%s</div>', $content);
$content = phutil_tag_div('phabricator-remarkup', $content);
return id(new AphrontAjaxResponse())->setContent($content);
}

View file

@ -123,7 +123,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin {
}
protected function render404Page() {
return hsprintf('<h2>404 Not Found</h2>');
return phutil_tag('h2', array(), pht('404 Not Found'));
}
final public function getResourceURI($resource) {

View file

@ -14,15 +14,14 @@ final class PhabricatorXHPASTViewFramesetController
$response = new AphrontWebpageResponse();
$response->setFrameable(true);
$response->setContent(hsprintf(
'<frameset cols="33%%, 34%%, 33%%">'.
'<frame src="/xhpast/input/%s/" />'.
'<frame src="/xhpast/tree/%s/" />'.
'<frame src="/xhpast/stream/%s/" />'.
'</frameset>',
$id,
$id,
$id));
$response->setContent(phutil_tag(
'frameset',
array('cols' => '33%, 34%, 33%'),
array(
phutil_tag('frame', array('src' => "/xhpast/input/{$id}/")),
phutil_tag('frame', array('src' => "/xhpast/tree/{$id}/")),
phutil_tag('frame', array('src' => "/xhpast/stream/{$id}/")),
)));
return $response;
}

View file

@ -174,15 +174,13 @@ final class PhrictionDiffController
pht('Most Recent Change'));
}
$navigation_table = hsprintf(
'<table class="phriction-history-nav-table">
<tr>
<td class="nav-prev">%s</td>
<td class="nav-next">%s</td>
</tr>
</table>',
$link_l,
$link_r);
$navigation_table = phutil_tag(
'table',
array('class' => 'phriction-history-nav-table'),
phutil_tag('tr', array(), array(
phutil_tag('td', array('class' => 'nav-prev'), $link_l),
phutil_tag('td', array('class' => 'nav-next'), $link_r),
)));
}

View file

@ -26,7 +26,7 @@ final class PhrictionNewController extends PhrictionController {
->setUser($user)
->appendChild(pht(
'The document %s already exists. Do you want to edit it instead?',
hsprintf('<tt>%s</tt>', $slug)))
phutil_tag('tt', array(), $slug)))
->addHiddenInput('slug', $slug)
->addHiddenInput('prompt', 'yes')
->addCancelButton('/w/')

View file

@ -75,19 +75,15 @@ final class PhrictionContent extends PhrictionDAO
$engine);
if ($toc) {
$toc = hsprintf(
'<div class="phabricator-remarkup-toc">'.
'<div class="phabricator-remarkup-toc-header">%s</div>'.
'%s'.
'</div>',
pht('Table of Contents'),
$toc);
$toc = phutil_tag_div('phabricator-remarkup-toc', array(
phutil_tag_div(
'phabricator-remarkup-toc-header',
pht('Table of Contents')),
$toc,
));
}
return hsprintf(
'<div class="phabricator-remarkup">%s%s</div>',
$toc,
$output);
return phutil_tag_div('phabricator-remarkup', array($toc, $output));
}

View file

@ -52,10 +52,9 @@ final class PhabricatorProjectProfileController
->addColumn($feed)
->setFluidLayout(true);
$content = hsprintf(
'<div class="phabricator-project-layout">%s%s</div>',
$tasks,
$content);
$content = phutil_tag_div(
'phabricator-project-layout',
array($tasks, $content));
$header = id(new PHUIHeaderView())
->setHeader($project->getName())
@ -109,17 +108,20 @@ final class PhabricatorProjectProfileController
if ($affiliated) {
$affiliated = phutil_tag('ul', array(), $affiliated);
} else {
$affiliated = hsprintf('<p><em>%s</em></p>', pht(
'No one is affiliated with this project.'));
$affiliated = phutil_tag('p', array(),
phutil_tag('em', array(),
pht('No one is affiliated with this project.')));
}
return hsprintf(
'<div class="phabricator-profile-info-group profile-wrap-responsive">'.
'<h1 class="phabricator-profile-info-header">%s</h1>'.
'<div class="phabricator-profile-info-pane">%s</div>'.
'</div>',
pht('People'),
$affiliated);
return phutil_tag_div(
'phabricator-profile-info-group profile-wrap-responsive',
array(
phutil_tag(
'h1',
array('class' => 'phabricator-profile-info-header'),
pht('People')),
phutil_tag_div('phabricator-profile-info-pane', $affiliated),
));
}
private function renderFeedPage(
@ -147,10 +149,8 @@ final class PhabricatorProjectProfileController
$builder->setShowHovercards(true);
$view = $builder->buildView();
return hsprintf(
'<div class="profile-feed profile-wrap-responsive">'.
'%s'.
'</div>',
return phutil_tag_div(
'profile-feed profile-wrap-responsive',
$view->render());
}

View file

@ -87,8 +87,9 @@ final class PhabricatorRepositoryArcanistProjectEditController
id(new AphrontFormTextControl())
->setLabel('Indexed Languages')
->setName('symbolIndexLanguages')
->setCaption(
hsprintf('Separate with commas, for example: <tt>php, py</tt>'))
->setCaption(pht(
'Separate with commas, for example: %s',
phutil_tag('tt', array(), 'php, py')))
->setValue($langs))
->appendChild(
id(new AphrontFormTokenizerControl())

View file

@ -252,18 +252,17 @@ final class PhabricatorSearchController
$results[] = $view->render();
}
$results = hsprintf(
'<div class="phabricator-search-result-list">'.
'%s'.
'<div class="search-results-pager">%s</div>'.
'</div>',
$results = phutil_tag_div('phabricator-search-result-list', array(
phutil_implode_html("\n", $results),
$pager->render());
phutil_tag_div('search-results-pager', $pager->render()),
));
} else {
$results = hsprintf(
'<div class="phabricator-search-result-list">'.
'<p class="phabricator-search-no-results">No search results.</p>'.
'</div>');
$results = phutil_tag_div(
'phabricator-search-result-list',
phutil_tag(
'p',
array('class' => 'phabricator-search-no-results'),
pht('No search results.')));
}
$results = id(new PHUIBoxView())
->addMargin(PHUI::MARGIN_LARGE)

View file

@ -67,11 +67,12 @@ final class PhabricatorSettingsPanelConduit
$cert_form = new AphrontFormView();
$cert_form
->setUser($user)
->appendChild(hsprintf(
'<p class="aphront-form-instructions">%s</p>',
->appendChild(phutil_tag(
'p',
array('class' => 'aphront-form-instructions'),
pht('This certificate allows you to authenticate over Conduit, '.
'the Phabricator API. Normally, you just run %s to install it.',
hsprintf('<tt>%s</tt>', 'arc install-certificate'))))
phutil_tag('tt', array(), 'arc install-certificate'))))
->appendChild(
id(new AphrontFormTextAreaControl())
->setLabel(pht('Certificate'))
@ -90,8 +91,10 @@ final class PhabricatorSettingsPanelConduit
->setUser($user)
->setAction($this->getPanelURI())
->setWorkflow(true)
->appendChild(hsprintf(
'<p class="aphront-form-instructions">%s</p>', $regen_instruction))
->appendChild(phutil_tag(
'p',
array('class' => 'aphront-form-instructions'),
$regen_instruction))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Regenerate Certificate')));

View file

@ -73,7 +73,7 @@ EXAMPLE;
$editor_instructions = pht('Link to edit files in external editor. '.
'%%f is replaced by filename, %%l by line number, %%r by repository '.
'callsign, %%%% by literal %%. For documentation, see: %s',
hsprintf('%s', $editor_doc_link));
$editor_doc_link);
$form = id(new AphrontFormView())
->setUser($user)

View file

@ -301,9 +301,9 @@ final class PhabricatorSettingsPanelEmailAddresses
->setUser($user)
->addHiddenInput('verify', $email_id)
->setTitle(pht("Send Another Verification Email?"))
->appendChild(hsprintf(
'<p>%s</p>',
pht('Send another copy of the verification email to %s?', $address)))
->appendChild(phutil_tag('p', array(), pht(
'Send another copy of the verification email to %s?',
$address)))
->addSubmitButton(pht('Send Email'))
->addCancelButton($uri);
@ -342,10 +342,10 @@ final class PhabricatorSettingsPanelEmailAddresses
->setUser($user)
->addHiddenInput('primary', $email_id)
->setTitle(pht("Change primary email address?"))
->appendChild(hsprintf(
'<p>If you change your primary address, Phabricator will send'.
' all email to %s.</p>',
$address))
->appendChild(phutil_tag('p', array(), pht(
'If you change your primary address, Phabricator will send'.
' all email to %s.',
$address)))
->addSubmitButton(pht('Change Primary Address'))
->addCancelButton($uri);

View file

@ -28,7 +28,7 @@ final class PhabricatorDebugController extends PhabricatorController {
$out = ob_get_clean();
$response = new AphrontWebpageResponse();
$response->setContent(hsprintf('<pre>%s</pre>', $out));
$response->setContent(phutil_tag('pre', array(), $out));
return $response;
}

View file

@ -99,10 +99,15 @@ try {
phlog($unexpected_output);
if ($response instanceof AphrontWebpageResponse) {
echo hsprintf(
'<div style="background: #eeddff; white-space: pre-wrap;
z-index: 200000; position: relative; padding: 8px;
font-family: monospace;">%s</div>',
echo phutil_tag(
'div',
array('style' =>
'background: #eeddff;'.
'white-space: pre-wrap;'.
'z-index: 200000;'.
'position: relative;'.
'padding: 8px;'.
'font-family: monospace'),
$unexpected_output);
}
}