1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +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 '. 'invalid or out of date. Make sure you are copy-and-pasting the '.
'entire link into your browser. You can try again, or request '. 'entire link into your browser. You can try again, or request '.
'a new email.'))); 'a new email.')));
$view->appendChild(hsprintf( $view->appendChild(phutil_tag_div(
'<div class="aphront-failure-continue">'. 'aphront-failure-continue',
'<a class="button" href="/login/email/">%s</a>'. phutil_tag(
'</div>', 'a',
pht('Send Another Email'))); array('class' => 'button', 'href' => '/login/email/'),
pht('Send Another Email'))));
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$view, $view,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -423,7 +423,10 @@ final class PhabricatorConduitAPIController
$value = $json->encodeFormatted($value); $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; return $value;
} }

View file

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

View file

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

View file

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

View file

@ -43,7 +43,7 @@ final class PhabricatorCountdownDeleteController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($request->getUser()); $dialog->setUser($request->getUser());
$dialog->setTitle(pht('Really delete this countdown?')); $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->addSubmitButton(pht('Delete'));
$dialog->addCancelButton('/countdown/'); $dialog->addCancelButton('/countdown/');
$dialog->setSubmitURI($request->getPath()); $dialog->setSubmitURI($request->getPath());

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -222,7 +222,7 @@ final class DifferentialChangesetTwoUpRenderer
$cov_class = $coverage[$n_num - 1]; $cov_class = $coverage[$n_num - 1];
} }
$cov_class = 'cov-'.$cov_class; $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--; $n_colspan--;
} }
@ -240,7 +240,7 @@ final class DifferentialChangesetTwoUpRenderer
$n_classes = $n_class; $n_classes = $n_class;
if ($new_lines[$ii]['type'] == '\\' || !isset($copy_lines[$n_num])) { 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 { } else {
list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num]; list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num];
$title = ($orig_type == '-' ? 'Moved' : 'Copied').' from '; $title = ($orig_type == '-' ? 'Moved' : 'Copied').' from ';
@ -283,29 +283,25 @@ final class DifferentialChangesetTwoUpRenderer
$n_id = null; $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 // NOTE: The Javascript is sensitive to whitespace changes in this
// block! // block!
$html[] = hsprintf( $html[] = phutil_tag('tr', array(), array(
'<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>',
phutil_tag('th', array('id' => $o_id), $o_num), 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), phutil_tag('th', array('id' => $n_id), $n_num),
$n_copy, $n_copy,
$n_classes, $n_colspan, $n_text, phutil_tag(
$n_cov); 'td',
array('class' => $n_classes, 'colspan' => $n_colspan),
array($zero_space, $n_text)),
$n_cov,
));
if ($context_not_available && ($ii == $rows - 1)) { if ($context_not_available && ($ii == $rows - 1)) {
$html[] = $context_not_available; $html[] = $context_not_available;
@ -328,29 +324,27 @@ final class DifferentialChangesetTwoUpRenderer
} }
} }
} }
$html[] = hsprintf( $html[] = phutil_tag('tr', array('class' => 'inline'), array(
'<tr class="inline">'. phutil_tag('th', array()),
'<th />'. phutil_tag('td', array('class' => 'left'), $comment_html),
'<td class="left">%s</td>'. phutil_tag('th', array()),
'<th />'. phutil_tag('td', array('colspan' => 3, 'class' => 'right3'), $new),
'<td colspan="3" class="right3">%s</td>'. ));
'</tr>',
$comment_html,
$new);
} }
} }
if ($n_num && isset($new_comments[$n_num])) { if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $comment) { foreach ($new_comments[$n_num] as $comment) {
$comment_html = $this->renderInlineComment($comment, $comment_html = $this->renderInlineComment($comment,
$on_right = true); $on_right = true);
$html[] = hsprintf( $html[] = phutil_tag('tr', array('class' => 'inline'), array(
'<tr class="inline">'. phutil_tag('th', array()),
'<th />'. phutil_tag('td', array('class' => 'left')),
'<td class="left" />'. phutil_tag('th', array()),
'<th />'. phutil_tag(
'<td colspan="3" class="right3">%s</td>'. 'td',
'</tr>', array('colspan' => 3, 'class' => 'right3'),
$comment_html); $comment_html),
));
} }
} }
} }
@ -395,40 +389,39 @@ final class DifferentialChangesetTwoUpRenderer
foreach ($this->getOldComments() as $on_line => $comment_group) { foreach ($this->getOldComments() as $on_line => $comment_group) {
foreach ($comment_group as $comment) { foreach ($comment_group as $comment) {
$comment_html = $this->renderInlineComment($comment, $on_right = false); $comment_html = $this->renderInlineComment($comment, $on_right = false);
$html_old[] = hsprintf( $html_old[] = phutil_tag('tr', array('class' => 'inline'), array(
'<tr class="inline">'. phutil_tag('th', array()),
'<th />'. phutil_tag('td', array('class' => 'left'), $comment_html),
'<td class="left">%s</td>'. phutil_tag('th', array()),
'<th />'. phutil_tag('td', array('colspan' => 3, 'class' => 'right3')),
'<td class="right3" colspan="3" />'. ));
'</tr>',
$comment_html);
} }
} }
foreach ($this->getNewComments() as $lin_line => $comment_group) { foreach ($this->getNewComments() as $lin_line => $comment_group) {
foreach ($comment_group as $comment) { foreach ($comment_group as $comment) {
$comment_html = $this->renderInlineComment($comment, $on_right = true); $comment_html = $this->renderInlineComment($comment, $on_right = true);
$html_new[] = hsprintf( $html_new[] = phutil_tag('tr', array('class' => 'inline'), array(
'<tr class="inline">'. phutil_tag('th', array()),
'<th />'. phutil_tag('td', array('class' => 'left')),
'<td class="left" />'. phutil_tag('th', array()),
'<th />'. phutil_tag(
'<td class="right3" colspan="3">%s</td>'. 'td',
'</tr>', array('colspan' => 3, 'class' => 'right3'),
$comment_html); $comment_html),
));
} }
} }
if (!$old) { if (!$old) {
$th_old = hsprintf('<th></th>'); $th_old = phutil_tag('th', array());
} else { } else {
$th_old = hsprintf('<th id="C%sOL1">1</th>', $vs); $th_old = phutil_tag('th', array('id' => "C{$vs}OL1"), 1);
} }
if (!$new) { if (!$new) {
$th_new = hsprintf('<th></th>'); $th_new = phutil_tag('th', array());
} else { } else {
$th_new = hsprintf('<th id="C%sNL1">1</th>', $id); $th_new = phutil_tag('th', array('id' => "C{$id}OL1"), 1);
} }
$output = hsprintf( $output = hsprintf(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -133,7 +133,7 @@ final class HeraldTranscriptController extends HeraldController {
$value = implode(', ', $value); $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() { private function buildSideNav() {
@ -306,13 +306,15 @@ final class HeraldTranscriptController extends HeraldController {
} }
if ($apply_xscript->getApplied()) { if ($apply_xscript->getApplied()) {
$success = pht('SUCCESS'); $outcome = phutil_tag(
$outcome = 'span',
hsprintf('<span class="outcome-success">%s</span>', $success); array('class' => 'outcome-success'),
pht('SUCCESS'));
} else { } else {
$failure = pht('FAILURE'); $outcome = phutil_tag(
$outcome = 'span',
hsprintf('<span class="outcome-failure">%s</span>', $failure); array('class' => 'outcome-failure'),
pht('FAILURE'));
} }
$rows[] = array( $rows[] = array(
@ -366,23 +368,21 @@ final class HeraldTranscriptController extends HeraldController {
$cond_markup = array(); $cond_markup = array();
foreach ($xscript->getConditionTranscriptsForRule($rule_id) as $cond) { foreach ($xscript->getConditionTranscriptsForRule($rule_id) as $cond) {
if ($cond->getNote()) { if ($cond->getNote()) {
$note = hsprintf( $note = phutil_tag_div('herald-condition-note', $cond->getNote());
'<div class="herald-condition-note">%s</div>',
$cond->getNote());
} else { } else {
$note = null; $note = null;
} }
if ($cond->getResult()) { if ($cond->getResult()) {
$result = hsprintf( $result = phutil_tag(
'<span class="herald-outcome condition-pass">'. 'span',
"\xE2\x9C\x93". array('class' => 'herald-outcome condition-pass'),
'</span>'); "\xE2\x9C\x93");
} else { } else {
$result = hsprintf( $result = phutil_tag(
'<span class="herald-outcome condition-fail">'. 'span',
"\xE2\x9C\x98". array('class' => 'herald-outcome condition-fail'),
'</span>'); "\xE2\x9C\x98");
} }
$cond_markup[] = phutil_tag( $cond_markup[] = phutil_tag(
@ -398,18 +398,23 @@ final class HeraldTranscriptController extends HeraldController {
} }
if ($rule->getResult()) { if ($rule->getResult()) {
$pass = pht('PASS'); $result = phutil_tag(
$result = hsprintf( 'span',
'<span class="herald-outcome rule-pass">%s</span>', $pass); array('class' => 'herald-outcome rule-pass'),
pht('PASS'));
$class = 'herald-rule-pass'; $class = 'herald-rule-pass';
} else { } else {
$fail = pht('FAIL'); $result = phutil_tag(
$result = hsprintf( 'span',
'<span class="herald-outcome rule-fail">%s</span>', $fail); array('class' => 'herald-outcome rule-fail'),
pht('FAIL'));
$class = 'herald-rule-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(); $user_phid = $this->getRequest()->getUser()->getPHID();
$name = $rule->getRuleName(); $name = $rule->getRuleName();
@ -420,11 +425,11 @@ final class HeraldTranscriptController extends HeraldController {
array( array(
'class' => $class, 'class' => $class,
), ),
hsprintf( phutil_tag_div('rule-name', array(
'<div class="rule-name"><strong>%s</strong> %s</div>%s', phutil_tag('strong', array(), $name),
$name, ' ',
$handles[$rule->getRuleOwner()]->getName(), phutil_tag('ul', array(), $cond_markup),
phutil_tag('ul', array(), $cond_markup))); )));
} }
$panel = ''; $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 ". "of this project in the past but no longer is, it is not ".
"counted at all."); "counted at all.");
$header = pht("Task Burn Rate for Project %s", $handle->renderLink()); $header = pht("Task Burn Rate for Project %s", $handle->renderLink());
$caption = hsprintf("<p>%s</p>", $inst); $caption = phutil_tag('p', array(), $inst);
} else { } else {
$header = pht("Task Burn Rate for All Tasks"); $header = pht("Task Burn Rate for All Tasks");
$caption = null; $caption = null;
@ -362,9 +362,9 @@ final class ManiphestReportController extends ManiphestController {
$fmt = number_format($delta); $fmt = number_format($delta);
if ($delta > 0) { if ($delta > 0) {
$fmt = '+'.$fmt; $fmt = '+'.$fmt;
$fmt = hsprintf('<span class="red">%s</span>', $fmt); $fmt = phutil_tag('span', array('class' => 'red'), $fmt);
} else { } else {
$fmt = hsprintf('<span class="green">%s</span>', $fmt); $fmt = phutil_tag('span', array('class' => 'green'), $fmt);
} }
return array( return array(

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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