1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

Revert "Promote phutil-tag again"

This reverts commit 8fbabdc06d, reversing
changes made to 2dab1c1e42.
This commit is contained in:
epriestley 2013-02-13 14:08:57 -08:00
parent 8fbabdc06d
commit 73cce6e131
264 changed files with 1717 additions and 1691 deletions

View file

@ -9,7 +9,7 @@
final class AphrontRequest { final class AphrontRequest {
// NOTE: These magic request-type parameters are automatically included in // NOTE: These magic request-type parameters are automatically included in
// certain requests (e.g., by phabricator_form(), JX.Request, // certain requests (e.g., by phabricator_render_form(), JX.Request,
// JX.Workflow, and ConduitClient) and help us figure out what sort of // JX.Workflow, and ConduitClient) and help us figure out what sort of
// response the client expects. // response the client expects.

View file

@ -210,7 +210,7 @@ class AphrontDefaultApplicationConfiguration
if ($ex instanceof AphrontUsageException) { if ($ex instanceof AphrontUsageException) {
$error = new AphrontErrorView(); $error = new AphrontErrorView();
$error->setTitle($ex->getTitle()); $error->setTitle(phutil_escape_html($ex->getTitle()));
$error->appendChild($ex->getMessage()); $error->appendChild($ex->getMessage());
$view = new PhabricatorStandardPageView(); $view = new PhabricatorStandardPageView();
@ -227,8 +227,8 @@ class AphrontDefaultApplicationConfiguration
// Always log the unhandled exception. // Always log the unhandled exception.
phlog($ex); phlog($ex);
$class = get_class($ex); $class = phutil_escape_html(get_class($ex));
$message = $ex->getMessage(); $message = phutil_escape_html($ex->getMessage());
if ($ex instanceof AphrontQuerySchemaException) { if ($ex instanceof AphrontQuerySchemaException) {
$message .= $message .=
@ -244,13 +244,11 @@ class AphrontDefaultApplicationConfiguration
$trace = null; $trace = null;
} }
$content = hsprintf( $content =
'<div class="aphront-unhandled-exception">'. '<div class="aphront-unhandled-exception">'.
'<div class="exception-message">%s</div>'. '<div class="exception-message">'.$message.'</div>'.
'%s'. $trace.
'</div>', '</div>';
$message,
$trace);
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog $dialog
@ -350,17 +348,17 @@ class AphrontDefaultApplicationConfiguration
), ),
$relative); $relative);
} }
$file_name = hsprintf('%s : %d', $file_name, $part['line']); $file_name = $file_name.' : '.(int)$part['line'];
} else { } else {
$file_name = phutil_tag('em', array(), '(Internal)'); $file_name = '<em>(Internal)</em>';
} }
$rows[] = array( $rows[] = array(
$depth--, $depth--,
$lib, phutil_escape_html($lib),
$file_name, $file_name,
$where, phutil_escape_html($where),
); );
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
@ -379,12 +377,11 @@ class AphrontDefaultApplicationConfiguration
'wide', 'wide',
)); ));
return hsprintf( return
'<div class="exception-trace">'. '<div class="exception-trace">'.
'<div class="exception-trace-header">Stack Trace</div>'. '<div class="exception-trace-header">Stack Trace</div>'.
'%s', $table->render().
'</div>', '</div>';
$table->render());
} }
} }

View file

@ -36,7 +36,7 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$data = $this->getData(); $data = $this->getData();
$rows = array(); $rows = array();
$details = array(); $details = '';
foreach ($data as $index => $row) { foreach ($data as $index => $row) {
$file = $row['file']; $file = $row['file'];
@ -50,11 +50,11 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$row['str'].' at ['.basename($file).':'.$line.']'); $row['str'].' at ['.basename($file).':'.$line.']');
$rows[] = array($tag); $rows[] = array($tag);
$details[] = hsprintf( $details .=
'<div class="dark-console-panel-error-details" id="row-details-%s">'. '<div class="dark-console-panel-error-details" id="row-details-'.
"%s\nStack trace:\n", $index.'">'.
$index, phutil_escape_html($row['details'])."\n".
$row['details']); 'Stack trace:'."\n";
foreach ($row['trace'] as $key => $entry) { foreach ($row['trace'] as $key => $entry) {
$line = ''; $line = '';
@ -73,16 +73,16 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
} }
} }
$details[] = phutil_tag( $details .= phutil_tag(
'a', 'a',
array( array(
'href' => $href, 'href' => $href,
), ),
$line); $line);
$details[] = "\n"; $details .= "\n";
} }
$details[] = hsprintf('</div>'); $details .= '</div>';
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
@ -90,13 +90,11 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$table->setHeaders(array('Error')); $table->setHeaders(array('Error'));
$table->setNoDataString('No errors.'); $table->setNoDataString('No errors.');
return hsprintf( return '<div>'.
'<div>'. '<div>'.$table->render().'</div>'.
'<div>%s</div>'. '<pre class="PhabricatorMonospaced">'.
'<pre class="PhabricatorMonospaced">%s</pre>'. $details.'</pre>'.
'</div>', '</div>';
$table->render(),
phutil_implode_html('', $details));
} }
} }

View file

@ -42,14 +42,17 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin {
$out = array(); $out = array();
$out[] = hsprintf( $out[] =
'<div class="dark-console-panel-header">'. '<div class="dark-console-panel-header">'.
'<h1>Registered Event Listeners</h1>'. '<h1>Registered Event Listeners</h1>'.
'</div>'); '</div>';
$rows = array(); $rows = array();
foreach ($data['listeners'] as $listener) { foreach ($data['listeners'] as $listener) {
$rows[] = array($listener['id'], $listener['class']); $rows[] = array(
phutil_escape_html($listener['id']),
phutil_escape_html($listener['class']),
);
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
@ -66,15 +69,15 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin {
$out[] = $table->render(); $out[] = $table->render();
$out[] = hsprintf( $out[] =
'<div class="dark-console-panel-header">'. '<div class="dark-console-panel-header">'.
'<h1>Event Log</h1>'. '<h1>Event Log</h1>'.
'</div>'); '</div>';
$rows = array(); $rows = array();
foreach ($data['events'] as $event) { foreach ($data['events'] as $event) {
$rows[] = array( $rows[] = array(
$event['type'], phutil_escape_html($event['type']),
$event['stopped'] ? 'STOPPED' : null, $event['stopped'] ? 'STOPPED' : null,
); );
} }
@ -93,6 +96,6 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin {
$out[] = $table->render(); $out[] = $table->render();
return phutil_implode_html("\n", $out); return implode("\n", $out);
} }
} }

View file

@ -43,8 +43,8 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin {
$rows = array(); $rows = array();
foreach ($map as $key => $value) { foreach ($map as $key => $value) {
$rows[] = array( $rows[] = array(
$key, phutil_escape_html($key),
(is_array($value) ? json_encode($value) : $value), phutil_escape_html(is_array($value) ? json_encode($value) : $value),
); );
} }
@ -62,6 +62,6 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin {
$out[] = $table->render(); $out[] = $table->render();
} }
return phutil_implode_html("\n", $out); return implode("\n", $out);
} }
} }

View file

@ -149,21 +149,20 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
$log = $data['log']; $log = $data['log'];
$results = array(); $results = array();
$results[] = hsprintf( $results[] =
'<div class="dark-console-panel-header">'. '<div class="dark-console-panel-header">'.
'%s'. phutil_tag(
'a',
array(
'href' => $data['analyzeURI'],
'class' => $data['didAnalyze']
? 'disabled button'
: 'green button',
),
'Analyze Query Plans').
'<h1>Calls to External Services</h1>'. '<h1>Calls to External Services</h1>'.
'<div style="clear: both;"></div>'. '<div style="clear: both;"></div>'.
'</div>', '</div>';
phutil_tag(
'a',
array(
'href' => $data['analyzeURI'],
'class' => $data['didAnalyze']
? 'disabled button'
: 'green button',
),
'Analyze Query Plans'));
$page_total = $data['end'] - $data['start']; $page_total = $data['end'] - $data['start'];
$totals = array(); $totals = array();
@ -225,18 +224,23 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
$row['explain']['reason']); $row['explain']['reason']);
} }
$info = phutil_escape_html($info);
break; break;
case 'connect': case 'connect':
$info = $row['host'].':'.$row['database']; $info = $row['host'].':'.$row['database'];
$info = phutil_escape_html($info);
break; break;
case 'exec': case 'exec':
$info = $row['command']; $info = $row['command'];
$info = phutil_escape_html($info);
break; break;
case 'conduit': case 'conduit':
$info = $row['method']; $info = $row['method'];
$info = phutil_escape_html($info);
break; break;
case 'http': case 'http':
$info = $row['uri']; $info = $row['uri'];
$info = phutil_escape_html($info);
break; break;
default: default:
$info = '-'; $info = '-';
@ -244,7 +248,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
} }
$rows[] = array( $rows[] = array(
$row['type'], phutil_escape_html($row['type']),
'+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms', '+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms',
number_format(1000000 * $row['duration']).' us', number_format(1000000 * $row['duration']).' us',
$info, $info,
@ -272,7 +276,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
$results[] = $table->render(); $results[] = $table->render();
return phutil_implode_html("\n", $results); return implode("\n", $results);
} }
} }

View file

@ -51,52 +51,48 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin {
'class' => 'bright-link', 'class' => 'bright-link',
), ),
'Installation Guide'); 'Installation Guide');
return hsprintf( return
'<div class="dark-console-no-content">'. '<div class="dark-console-no-content">'.
'The "xhprof" PHP extension is not available. Install xhprof '. 'The "xhprof" PHP extension is not available. Install xhprof '.
'to enable the XHProf console plugin. You can find instructions in '. 'to enable the XHProf console plugin. You can find instructions in '.
'the %s.'. 'the '.$install_guide.'.'.
'</div>', '</div>';
$install_guide);
} }
$result = array(); $result = array();
$header = hsprintf( $header =
'<div class="dark-console-panel-header">'. '<div class="dark-console-panel-header">'.
'%s'. phutil_tag(
'a',
array(
'href' => $profile_uri,
'class' => $run
? 'disabled button'
: 'green button',
),
'Profile Page').
'<h1>XHProf Profiler</h1>'. '<h1>XHProf Profiler</h1>'.
'</div>', '</div>';
phutil_tag(
'a',
array(
'href' => $profile_uri,
'class' => $run
? 'disabled button'
: 'green button',
),
'Profile Page'));
$result[] = $header; $result[] = $header;
if ($run) { if ($run) {
$result[] = hsprintf( $result[] =
'<a href="/xhprof/profile/%s/" '. '<a href="/xhprof/profile/'.$run.'/" '.
'class="bright-link" '. 'class="bright-link" '.
'style="float: right; margin: 1em 2em 0 0;'. 'style="float: right; margin: 1em 2em 0 0;'.
'font-weight: bold;" '. 'font-weight: bold;" '.
'target="_blank">Profile Permalink</a>'. 'target="_blank">Profile Permalink</a>'.
'<iframe src="/xhprof/profile/%s/?frame=true"></iframe>', '<iframe src="/xhprof/profile/'.$run.'/?frame=true"></iframe>';
$run,
$run);
} else { } else {
$result[] = hsprintf( $result[] =
'<div class="dark-console-no-content">'. '<div class="dark-console-no-content">'.
'Profiling was not enabled for this page. Use the button above '. 'Profiling was not enabled for this page. Use the button above '.
'to enable it.'. 'to enable it.'.
'</div>'); '</div>';
} }
return phutil_implode_html("\n", $result); return implode("\n", $result);
} }

View file

@ -26,7 +26,7 @@ final class Aphront403Response extends AphrontHTMLResponse {
} }
$failure = new AphrontRequestFailureView(); $failure = new AphrontRequestFailureView();
$failure->setHeader('403 Forbidden'); $failure->setHeader('403 Forbidden');
$failure->appendChild(phutil_tag('p', array(), $forbidden_text)); $failure->appendChild('<p>'.$forbidden_text.'</p>');
$view = new PhabricatorStandardPageView(); $view = new PhabricatorStandardPageView();
$view->setTitle('403 Forbidden'); $view->setTitle('403 Forbidden');

View file

@ -12,8 +12,7 @@ final class Aphront404Response extends AphrontHTMLResponse {
public function buildResponseString() { public function buildResponseString() {
$failure = new AphrontRequestFailureView(); $failure = new AphrontRequestFailureView();
$failure->setHeader('404 Not Found'); $failure->setHeader('404 Not Found');
$failure->appendChild(phutil_tag('p', array(), pht( $failure->appendChild('<p>The page you requested was not found.</p>');
'The page you requested was not found.')));
$view = new PhabricatorStandardPageView(); $view = new PhabricatorStandardPageView();
$view->setTitle('404 Not Found'); $view->setTitle('404 Not Found');

View file

@ -13,7 +13,7 @@ final class AphrontWebpageResponse extends AphrontHTMLResponse {
} }
public function buildResponseString() { public function buildResponseString() {
return hsprintf('%s', $this->content); return $this->content;
} }
} }

View file

@ -335,7 +335,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
} }
if ($handle) { if ($handle) {
$handle_name = $handle->getName(); $handle_name = phutil_escape_html($handle->getName());
} else { } else {
$handle_name = null; $handle_name = null;
} }
@ -435,7 +435,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
} }
if ($handle) { if ($handle) {
$handle_name = $handle->getName(); $handle_name = phutil_escape_html($handle->getName());
} else { } else {
$handle_name = null; $handle_name = null;
} }

View file

@ -70,10 +70,10 @@ final class PhabricatorAuditCommitListView extends AphrontView {
$rows[] = array( $rows[] = array(
$commit_name, $commit_name,
$author_name, $author_name,
$commit->getCommitData()->getSummary(), phutil_escape_html($commit->getCommitData()->getSummary()),
PhabricatorAuditCommitStatusConstants::getStatusName( PhabricatorAuditCommitStatusConstants::getStatusName(
$commit->getAuditStatus()), $commit->getAuditStatus()),
phutil_implode_html(', ', $auditors), implode(', ', $auditors),
phabricator_datetime($commit->getEpoch(), $this->user), phabricator_datetime($commit->getEpoch(), $this->user),
); );
} }

View file

@ -129,7 +129,10 @@ final class PhabricatorAuditListView extends AphrontView {
} }
$reasons = $audit->getAuditReasons(); $reasons = $audit->getAuditReasons();
$reasons = phutil_implode_html(phutil_tag('br'), $reasons); foreach ($reasons as $key => $reason) {
$reasons[$key] = phutil_escape_html($reason);
}
$reasons = implode('<br />', $reasons);
$status_code = $audit->getAuditStatus(); $status_code = $audit->getAuditStatus();
$status = PhabricatorAuditStatusConstants::getStatusName($status_code); $status = PhabricatorAuditStatusConstants::getStatusName($status_code);
@ -137,10 +140,10 @@ final class PhabricatorAuditListView extends AphrontView {
$auditor_handle = $this->getHandle($audit->getAuditorPHID()); $auditor_handle = $this->getHandle($audit->getAuditorPHID());
$rows[] = array( $rows[] = array(
$commit_name, $commit_name,
$commit_desc, phutil_escape_html($commit_desc),
$committed, $committed,
$auditor_handle->renderLink(), $auditor_handle->renderLink(),
$status, phutil_escape_html($status),
$reasons, $reasons,
); );

View file

@ -16,8 +16,8 @@ final class PhabricatorDisabledUserController
$failure_view = new AphrontRequestFailureView(); $failure_view = new AphrontRequestFailureView();
$failure_view->setHeader(pht('Account Disabled')); $failure_view->setHeader(pht('Account Disabled'));
$failure_view->appendChild(phutil_tag('p', array(), pht( $failure_view->appendChild(
'Your account has been disabled.'))); '<p>'.pht('Your account has been disabled.').'</p>');
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$failure_view, $failure_view,

View file

@ -98,8 +98,10 @@ EOBODY;
$view = new AphrontRequestFailureView(); $view = new AphrontRequestFailureView();
$view->setHeader(pht('Check Your Email')); $view->setHeader(pht('Check Your Email'));
$view->appendChild(phutil_tag('p', array(), pht( $view->appendChild(
'An email has been sent with a link you can use to login.'))); '<p>'.pht(
'An email has been sent with a link you can use to login.'
).'</p>');
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$view, $view,
array( array(
@ -138,8 +140,8 @@ EOBODY;
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild(phutil_tag('h1', array(), pht( $panel->appendChild('
'Forgot Password / Email Login'))); <h1>'.pht('Forgot Password / Email Login').'</h1>');
$panel->appendChild($email_auth); $panel->appendChild($email_auth);
$panel->setNoBackground(); $panel->setNoBackground();

View file

@ -50,16 +50,17 @@ final class PhabricatorEmailTokenController
$view = new AphrontRequestFailureView(); $view = new AphrontRequestFailureView();
$view->setHeader(pht('Unable to Login')); $view->setHeader(pht('Unable to Login'));
$view->appendChild(phutil_tag('p', array(), pht( $view->appendChild(
'The authentication information in the link you clicked is '. '<p>'.pht('The authentication information in the link you clicked is '.
'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.').'</p>');
$view->appendChild(hsprintf( $view->appendChild(
'<div class="aphront-failure-continue">'. '<div class="aphront-failure-continue">'.
'<a class="button" href="/login/email/">%s</a>'. '<a class="button" href="/login/email/">'.
'</div>', pht('Send Another Email').
pht('Send Another Email'))); '</a>'.
'</div>');
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$view, $view,

View file

@ -43,11 +43,12 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Already Linked to Another Account')); $dialog->setTitle(pht('Already Linked to Another Account'));
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'The LDAP account you just authorized is already '. '<p>'.pht('The LDAP account you just authorized is already '.
'linked toanother Phabricator account. Before you can link it '. 'linked toanother Phabricator account. Before you can link it '.
'to a different LDAP account, you must unlink the old '. 'to a different LDAP account, you must unlink the old '.
'account.'))); 'account.').'</p>'
);
$dialog->addCancelButton('/settings/panel/ldap/'); $dialog->addCancelButton('/settings/panel/ldap/');
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -61,8 +62,10 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Link LDAP Account')); $dialog->setTitle(pht('Link LDAP Account'));
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'Link your LDAP account to your Phabricator account?'))); '<p>'.
pht('Link your LDAP account to your Phabricator account?').
'</p>');
$dialog->addHiddenInput('username', $request->getStr('username')); $dialog->addHiddenInput('username', $request->getStr('username'));
$dialog->addHiddenInput('password', $request->getStr('password')); $dialog->addHiddenInput('password', $request->getStr('password'));
$dialog->addSubmitButton(pht('Link Accounts')); $dialog->addSubmitButton(pht('Link Accounts'));
@ -131,10 +134,9 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild(phutil_tag('h1', array(), pht('LDAP login'))); $panel->appendChild('<h1>'.pht('LDAP login').'</h1>');
$panel->appendChild($ldap_form); $panel->appendChild($ldap_form);
$error_view = null;
if (isset($errors) && count($errors) > 0) { if (isset($errors) && count($errors) > 0) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle(pht('Login Failed')); $error_view->setTitle(pht('Login Failed'));
@ -143,7 +145,7 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController {
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array( array(
$error_view, isset($error_view) ? $error_view : null,
$panel, $panel,
), ),
array( array(

View file

@ -18,9 +18,9 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Really unlink account?')); $dialog->setTitle(pht('Really unlink account?'));
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'You will not be able to login using this account '. '<p>'.pht('You will not be able to login using this account '.
'once you unlink it. Continue?'))); 'once you unlink it. Continue?').'</p>');
$dialog->addSubmitButton(pht('Unlink Account')); $dialog->addSubmitButton(pht('Unlink Account'));
$dialog->addCancelButton('/settings/panel/ldap/'); $dialog->addCancelButton('/settings/panel/ldap/');

View file

@ -29,8 +29,7 @@ final class PhabricatorLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Login Required')); $dialog->setTitle(pht('Login Required'));
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild('<p>'.pht('You must login to continue.').'</p>');
'You must login to continue.')));
$dialog->addSubmitButton(pht('Login')); $dialog->addSubmitButton(pht('Login'));
$dialog->addCancelButton('/', pht('Cancel')); $dialog->addCancelButton('/', pht('Cancel'));
@ -247,7 +246,8 @@ final class PhabricatorLoginController
$title = pht("Login or Register with %s", $provider_name); $title = pht("Login or Register with %s", $provider_name);
$body = pht('Login or register for Phabricator using your %s account.', $body = pht('Login or register for Phabricator using your %s account.',
$provider_name); $provider_name);
$button = pht("Login or Register with %s", $provider_name); $button = pht("Login or Register with %s",
phutil_escape_html($provider_name));
} else { } else {
$title = pht("Login with %s", $provider_name); $title = pht("Login with %s", $provider_name);
$body = hsprintf( $body = hsprintf(
@ -258,7 +258,7 @@ final class PhabricatorLoginController
pht( pht(
'You can not use %s to register a new account.', 'You can not use %s to register a new account.',
$provider_name)); $provider_name));
$button = pht("Log in with %s", $provider_name); $button = pht("Log in with %s", phutil_escape_html($provider_name));
} }
$auth_form = new AphrontFormView(); $auth_form = new AphrontFormView();
@ -299,7 +299,7 @@ final class PhabricatorLoginController
return $this->buildApplicationPage( return $this->buildApplicationPage(
array( array(
$error_view, $error_view,
phutil_safe_html($login_message), $login_message,
$panel, $panel,
), ),
array( array(

View file

@ -49,18 +49,14 @@ final class PhabricatorLoginValidateController
$view = new AphrontRequestFailureView(); $view = new AphrontRequestFailureView();
$view->setHeader(pht('Login Failed')); $view->setHeader(pht('Login Failed'));
$view->appendChild(hsprintf( $view->appendChild(
'<p>%s</p>%s<p>%s</p>', '<p>'.pht('Login failed:').'</p>'.
pht('Login failed:'), $list.
$list, '<p>'.pht('<strong>Clear your cookies</strong> and try again.').'</p>');
pht( $view->appendChild(
'<strong>Clear your cookies</strong> and try again.',
hsprintf(''))));
$view->appendChild(hsprintf(
'<div class="aphront-failure-continue">'. '<div class="aphront-failure-continue">'.
'<a class="button" href="/login/">%s</a>'. '<a class="button" href="/login/">'.pht('Try Again').'</a>'.
'</div>', '</div>');
pht('Try Again')));
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
$view, $view,
array( array(

View file

@ -46,8 +46,7 @@ final class PhabricatorLogoutController
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Log out of Phabricator?')) ->setTitle(pht('Log out of Phabricator?'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild('<p>'.pht('Are you sure you want to log out?').'</p>')
'Are you sure you want to log out?')))
->addSubmitButton(pht('Logout')) ->addSubmitButton(pht('Logout'))
->addCancelButton('/'); ->addCancelButton('/');

View file

@ -41,26 +41,31 @@ final class PhabricatorMustVerifyEmailController
$error_view = new AphrontRequestFailureView(); $error_view = new AphrontRequestFailureView();
$error_view->setHeader(pht('Check Your Email')); $error_view->setHeader(pht('Check Your Email'));
$error_view->appendChild(phutil_tag('p', array(), pht( $error_view->appendChild(
'You must verify your email address to login. You should have a new '. '<p>'.
pht('You must verify your email address to login. You should have a new '.
'email message from Phabricator with verification instructions in your '. 'email message from Phabricator with verification instructions in your '.
'inbox (%s).', phutil_tag('strong', array(), $email_address)))); 'inbox (%s).', phutil_tag('strong', array(), $email_address)).
$error_view->appendChild(phutil_tag('p', array(), pht( '</p>');
'If you did not receive an email, you can click the button below '. $error_view->appendChild(
'to try sending another one.'))); '<p>'.
$error_view->appendChild(hsprintf( pht('If you did not receive an email, you can click the button below '.
'<div class="aphront-failure-continue">%s</div>', 'to try sending another one.').
phabricator_form( '</p>');
$user, $error_view->appendChild(
array( '<div class="aphront-failure-continue">'.
'action' => '/login/mustverify/', phabricator_form(
'method' => 'POST', $user,
),
phutil_tag(
'button',
array( array(
'action' => '/login/mustverify/',
'method' => 'POST',
), ),
pht('Send Another Email'))))); phutil_tag(
'button',
array(
),
pht('Send Another Email'))).
'</div>');
return $this->buildApplicationPage( return $this->buildApplicationPage(

View file

@ -21,11 +21,11 @@ final class PhabricatorOAuthDiagnosticsController
$client_id = $provider->getClientID(); $client_id = $provider->getClientID();
$client_secret = $provider->getClientSecret(); $client_secret = $provider->getClientSecret();
$key = $provider->getProviderKey(); $key = $provider->getProviderKey();
$name = $provider->getProviderName(); $name = phutil_escape_html($provider->getProviderName());
$res_ok = hsprintf('<strong style="color: #00aa00;">OK</strong>'); $res_ok = '<strong style="color: #00aa00;">OK</strong>';
$res_no = hsprintf('<strong style="color: #aa0000;">NO</strong>'); $res_no = '<strong style="color: #aa0000;">NO</strong>';
$res_na = hsprintf('<strong style="color: #999999;">N/A</strong>'); $res_na = '<strong style="color: #999999;">N/A</strong>';
$results = array(); $results = array();
$auth_key = $key . '.auth-enabled'; $auth_key = $key . '.auth-enabled';
@ -159,10 +159,10 @@ final class PhabricatorOAuthDiagnosticsController
$rows = array(); $rows = array();
foreach ($results as $key => $result) { foreach ($results as $key => $result) {
$rows[] = array( $rows[] = array(
$key, phutil_escape_html($key),
$result[0], $result[0],
$result[1], phutil_escape_html($result[1]),
$result[2], phutil_escape_html($result[2]),
); );
} }
@ -186,11 +186,11 @@ final class PhabricatorOAuthDiagnosticsController
$panel_view = new AphrontPanelView(); $panel_view = new AphrontPanelView();
$panel_view->setHeader($title); $panel_view->setHeader($title);
$panel_view->appendChild(hsprintf( $panel_view->appendChild(
'<p class="aphront-panel-instructions">These tests may be able to '. '<p class="aphront-panel-instructions">These tests may be able to '.
'help diagnose the root cause of problems you experience with %s '. 'help diagnose the root cause of problems you experience with '.
'Authentication. Reload the page to run the tests again.</p>', $provider->getProviderName() .
$provider->getProviderName())); ' Authentication. Reload the page to run the tests again.</p>');
$panel_view->appendChild($table_view); $panel_view->appendChild($table_view);
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(

View file

@ -116,9 +116,10 @@ final class PhabricatorOAuthLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Link %s Account', $provider_name)); $dialog->setTitle(pht('Link %s Account', $provider_name));
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'Link your %s account to your Phabricator account?', pht(
$provider_name))); '<p>Link your %s account to your Phabricator account?</p>',
phutil_escape_html($provider_name)));
$dialog->addHiddenInput('confirm_token', $provider->getAccessToken()); $dialog->addHiddenInput('confirm_token', $provider->getAccessToken());
$dialog->addHiddenInput('expires', $oauth_info->getTokenExpires()); $dialog->addHiddenInput('expires', $oauth_info->getTokenExpires());
$dialog->addHiddenInput('state', $this->oauthState); $dialog->addHiddenInput('state', $this->oauthState);

View file

@ -34,9 +34,9 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Really unlink account?')); $dialog->setTitle(pht('Really unlink account?'));
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'You will not be able to login using this account '. '<p>'.pht('You will not be able to login using this account '.
'once you unlink it. Continue?'))); 'once you unlink it. Continue?').'</p>');
$dialog->addSubmitButton(pht('Unlink Account')); $dialog->addSubmitButton(pht('Unlink Account'));
$dialog->addCancelButton($provider->getSettingsPanelURI()); $dialog->addCancelButton($provider->getSettingsPanelURI());

View file

@ -77,12 +77,11 @@ final class PhabricatorOAuthFailureView extends AphrontView {
$provider_name); $provider_name);
} }
$view->appendChild(hsprintf( $view->appendChild(
'<div class="aphront-failure-continue">'. '<div class="aphront-failure-continue">'.
'%s<a href="/login/" class="button">%s</a>'. $diagnose.
'</div>', '<a href="/login/" class="button">'.pht('Continue').'</a>'.
$diagnose, '</div>');
pht('Continue')));
return $view->render(); return $view->render();
} }

View file

@ -203,9 +203,10 @@ 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(
'<div style="padding: 2em 0;">%s</div>', '<div style="padding: 2em 0;">'.
$response->buildResponseString())); $response->buildResponseString().
'</div>');
$response = new AphrontWebpageResponse(); $response = new AphrontWebpageResponse();
$response->setContent($view->render()); $response->setContent($view->render());
return $response; return $response;
@ -276,7 +277,7 @@ abstract class PhabricatorController extends AphrontController {
$items[] = $this->getHandle($phid)->renderLink(); $items[] = $this->getHandle($phid)->renderLink();
} }
return phutil_implode_html($style_map[$style], $items); return array_interleave($style_map[$style], $items);
} }
protected function buildApplicationMenu() { protected function buildApplicationMenu() {

View file

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

View file

@ -94,7 +94,7 @@ final class PhabricatorCalendarViewStatusController
} else { } else {
$no_data = $no_data =
pht('%s does not have any upcoming status events.', pht('%s does not have any upcoming status events.',
$this->getHandle($this->phid)->getName()); phutil_escape_html($this->getHandle($this->phid)->getName()));
} }
return $no_data; return $no_data;
} }
@ -115,7 +115,7 @@ final class PhabricatorCalendarViewStatusController
} else { } else {
$page_title = pht( $page_title = pht(
'Upcoming Statuses for %s', 'Upcoming Statuses for %s',
$this->getHandle($this->phid)->getName() phutil_escape_html($this->getHandle($this->phid)->getName())
); );
} }
return $page_title; return $page_title;

View file

@ -48,10 +48,9 @@ final class AphrontCalendarMonthView extends AphrontView {
$markup = array(); $markup = array();
$empty_box = phutil_tag( $empty_box =
'div', '<div class="aphront-calendar-day aphront-calendar-empty">'.
array('class' => 'aphront-calendar-day aphront-calendar-empty'), '</div>';
'');
for ($ii = 0; $ii < $empty; $ii++) { for ($ii = 0; $ii < $empty; $ii++) {
$markup[] = $empty_box; $markup[] = $empty_box;
@ -80,10 +79,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( '<div class="aphront-calendar-event aphront-calendar-event-empty">'.
'<div class="aphront-calendar-event aphront-calendar-event-empty">'. '&nbsp;'.
'&nbsp;'. '</div>');
'</div>'));
} }
foreach ($events as $event) { foreach ($events as $event) {
@ -102,42 +100,38 @@ final class AphrontCalendarMonthView extends AphrontView {
$holiday_markup = null; $holiday_markup = null;
if ($holiday) { if ($holiday) {
$name = $holiday->getName(); $name = phutil_escape_html($holiday->getName());
$holiday_markup = phutil_tag( $holiday_markup =
'div', '<div class="aphront-calendar-holiday" title="'.$name.'">'.
array( $name.
'class' => 'aphront-calendar-holiday', '</div>';
'title' => $name,
),
$name);
} }
$markup[] = hsprintf( $markup[] =
'<div class="%s">'. '<div class="'.$class.'">'.
'<div class="aphront-calendar-date-number">%s</div>'. '<div class="aphront-calendar-date-number">'.
'%s%s'. $day_number.
'</div>', '</div>'.
$class, $holiday_markup.
$day_number, implode("\n", $show_events).
$holiday_markup, '</div>';
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>'); $table[] = '<tr>';
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('p', array(), $cell); $table[] = '<td>'.$cell.'</td>';
} }
$table[] = hsprintf('</tr>'); $table[] = '</tr>';
} }
$table = hsprintf( $table =
'<table class="aphront-calendar-view">'. '<table class="aphront-calendar-view">'.
'%s'. $this->renderCalendarHeader($first).
'<tr class="aphront-calendar-day-of-week-header">'. '<tr class="aphront-calendar-day-of-week-header">'.
'<th>Sun</th>'. '<th>Sun</th>'.
'<th>Mon</th>'. '<th>Mon</th>'.
@ -147,10 +141,8 @@ final class AphrontCalendarMonthView extends AphrontView {
'<th>Fri</th>'. '<th>Fri</th>'.
'<th>Sat</th>'. '<th>Sat</th>'.
'</tr>'. '</tr>'.
'%s'. implode("\n", $table).
'</table>', '</table>';
$this->renderCalendarHeader($first),
phutil_implode_html("\n", $table));
return $table; return $table;
} }
@ -181,15 +173,16 @@ final class AphrontCalendarMonthView extends AphrontView {
"\xE2\x86\x92" "\xE2\x86\x92"
); );
$left_th = phutil_tag('th', array(), $prev_link); $left_th = '<th>'.$prev_link.'</th>';
$right_th = phutil_tag('th', array(), $next_link); $right_th = '<th>'.$next_link.'</th>';
} }
return hsprintf( return
'<tr class="aphront-calendar-month-year-header">%s%s%s</tr>', '<tr class="aphront-calendar-month-year-header">'.
$left_th, $left_th.
phutil_tag('th', array('colspan' => $colspan), $date->format('F Y')), '<th colspan="'.$colspan.'">'.$date->format('F Y').'</th>'.
$right_th); $right_th.
'</tr>';
} }
private function getNextYearAndMonth() { private function getNextYearAndMonth() {

View file

@ -94,6 +94,7 @@ final class PhabricatorChatLogChannelLogController
require_celerity_resource('phabricator-chatlog-css'); require_celerity_resource('phabricator-chatlog-css');
$out = array(); $out = array();
$out[] = '<table class="phabricator-chat-log">';
foreach ($blocks as $block) { foreach ($blocks as $block) {
$author = $block['author']; $author = $block['author'];
$author = phutil_utf8_shorten($author, 18); $author = phutil_utf8_shorten($author, 18);
@ -121,6 +122,7 @@ final class PhabricatorChatLogChannelLogController
), ),
array($author, $message, $timestamp)); array($author, $message, $timestamp));
} }
$out[] = '</table>';
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user) ->setUser($user)
@ -138,11 +140,12 @@ final class PhabricatorChatLogChannelLogController
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array( array(
hsprintf( '<div class="phabricator-chat-log-panel">',
'<div class="phabricator-chat-log-panel">%s<br />%s%s</div>', $form,
$form, '<br />',
phutil_tag('table', array('class' => 'phabricator-chat-log'), $out), implode("\n", $out),
$pager), $pager,
'</div>',
), ),
array( array(
'title' => 'Channel Log', 'title' => 'Channel Log',

View file

@ -346,7 +346,7 @@ final class PhabricatorConduitAPIController
if ($request) { if ($request) {
foreach ($request->getAllParameters() as $key => $value) { foreach ($request->getAllParameters() as $key => $value) {
$param_rows[] = array( $param_rows[] = array(
$key, phutil_escape_html($key),
$this->renderAPIValue($value), $this->renderAPIValue($value),
); );
} }
@ -362,7 +362,7 @@ final class PhabricatorConduitAPIController
$result_rows = array(); $result_rows = array();
foreach ($result as $key => $value) { foreach ($result as $key => $value) {
$result_rows[] = array( $result_rows[] = array(
$key, phutil_escape_html($key),
$this->renderAPIValue($value), $this->renderAPIValue($value),
); );
} }

View file

@ -109,7 +109,7 @@ final class PhabricatorConduitConsoleController
->setValue('Call Method')); ->setValue('Call Method'));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Conduit API: '.$this->method); $panel->setHeader('Conduit API: '.phutil_escape_html($this->method));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_FULL); $panel->setWidth(AphrontPanelView::WIDTH_FULL);

View file

@ -59,11 +59,11 @@ final class PhabricatorConduitListController
$utils = new AphrontPanelView(); $utils = new AphrontPanelView();
$utils->setHeader('Utilities'); $utils->setHeader('Utilities');
$utils->appendChild(hsprintf( $utils->appendChild(
'<ul>'. '<ul>'.
'<li><a href="/conduit/log/">Log</a> - Conduit Method Calls</li>'. '<li><a href="/conduit/log/">Log</a> - Conduit Method Calls</li>'.
'<li><a href="/conduit/token/">Token</a> - Certificate Install</li>'. '<li><a href="/conduit/token/">Token</a> - Certificate Install</li>'.
'</ul>')); '</ul>');
$utils->setWidth(AphrontPanelView::WIDTH_FULL); $utils->setWidth(AphrontPanelView::WIDTH_FULL);
$this->setShowSideNav(false); $this->setShowSideNav(false);

View file

@ -65,9 +65,9 @@ final class PhabricatorConduitLogController
} }
$rows[] = array( $rows[] = array(
$call->getConnectionID(), $call->getConnectionID(),
$conn->getUserName(), phutil_escape_html($conn->getUserName()),
$call->getMethod(), phutil_escape_html($call->getMethod()),
$call->getError(), phutil_escape_html($call->getError()),
number_format($call->getDuration()).' us', number_format($call->getDuration()).' us',
phabricator_datetime($call->getDateCreated(), $user), phabricator_datetime($call->getDateCreated(), $user),
); );

View file

@ -14,12 +14,13 @@ final class PhabricatorConfigAllController
$key = $option->getKey(); $key = $option->getKey();
if ($option->getMasked()) { if ($option->getMasked()) {
$value = phutil_tag('em', array(), pht('Masked')); $value = '<em>'.pht('Masked').'</em>';
} else if ($option->getHidden()) { } else if ($option->getHidden()) {
$value = phutil_tag('em', array(), pht('Hidden')); $value = '<em>'.pht('Hidden').'</em>';
} else { } else {
$value = PhabricatorEnv::getEnvConfig($key); $value = PhabricatorEnv::getEnvConfig($key);
$value = PhabricatorConfigJSON::prettyPrintJSON($value); $value = PhabricatorConfigJSON::prettyPrintJSON($value);
$value = phutil_escape_html($value);
} }
$rows[] = array( $rows[] = array(

View file

@ -23,18 +23,20 @@ final class PhabricatorConfigResponse extends AphrontHTMLResponse {
$view = $this->view->render(); $view = $this->view->render();
return hsprintf( $template = <<<EOTEMPLATE
'<!DOCTYPE html>'. <!doctype html>
'<html>'. <html>
'<head>'. <head>
'<meta charset="UTF-8" />'. <title>Phabricator Setup</title>
'<title>Phabricator Setup</title>'. {$resources}
'%s'. </head>
'</head>'. <body class="setup-fatal">
'<body class="setup-fatal">%s</body>'. {$view}
'</html>', </body>
$resources, </html>
$view); EOTEMPLATE;
return $template;
} }
private function buildResources() { private function buildResources() {
@ -47,12 +49,11 @@ final class PhabricatorConfigResponse extends AphrontHTMLResponse {
$resources = array(); $resources = array();
foreach ($css as $path) { foreach ($css as $path) {
$resources[] = phutil_tag( $resources[] = '<style type="text/css">';
'style', $resources[] = Filesystem::readFile($webroot.'/rsrc/css/'.$path);
array('type' => 'text/css'), $resources[] = '</style>';
Filesystem::readFile($webroot.'/rsrc/css/'.$path));
} }
return phutil_implode_html("\n", $resources); return implode("\n", $resources);
} }

View file

@ -44,7 +44,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
), ),
array( array(
phutil_tag('p', array(), $run_these), phutil_tag('p', array(), $run_these),
phutil_tag('pre', array(), phutil_implode_html("\n", $commands)), phutil_tag('pre', array(), array_interleave("\n", $commands)),
)); ));
} }
@ -114,7 +114,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
array( array(
'class' => 'setup-issue', 'class' => 'setup-issue',
), ),
$this->renderSingleView( $this->renderHTMLView(
array( array(
$name, $name,
$description, $description,
@ -155,7 +155,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
'<tt>phabricator/ $</tt> ./bin/config set %s <em>value</em>', '<tt>phabricator/ $</tt> ./bin/config set %s <em>value</em>',
$key); $key);
} }
$update = phutil_tag('pre', array(), phutil_implode_html("\n", $update)); $update = phutil_tag('pre', array(), array_interleave("\n", $update));
} else { } else {
$update = array(); $update = array();
foreach ($configs as $config) { foreach ($configs as $config) {
@ -187,7 +187,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
array( array(
'class' => 'setup-issue-config', 'class' => 'setup-issue-config',
), ),
self::renderSingleView( self::renderHTMLView(
array( array(
$table_info, $table_info,
$table, $table,
@ -293,7 +293,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
array( array(
'class' => 'setup-issue-config', 'class' => 'setup-issue-config',
), ),
$this->renderSingleView( $this->renderHTMLView(
array( array(
$table_info, $table_info,
$table, $table,

View file

@ -159,7 +159,8 @@ abstract class ConpherenceController extends PhabricatorController {
$item->addClass('hide-unread-count'); $item->addClass('hide-unread-count');
} }
$nav->addCustomBlock($item->render()); // TODO: [HTML] Clean this up when we clean up HTML stuff in Conpherence.
$nav->addCustomBlock(phutil_safe_html($item->render()));
} }
if (empty($conpherences) || $read) { if (empty($conpherences) || $read) {
$nav->addCustomBlock($this->getNoConpherencesBlock()); $nav->addCustomBlock($this->getNoConpherencesBlock());

View file

@ -149,7 +149,7 @@ final class ConpherenceViewController extends
->setMarkupEngine($engine) ->setMarkupEngine($engine)
->render(); ->render();
} }
$transactions = phutil_implode_html(' ', $rendered_transactions); $transactions = implode(' ', $rendered_transactions);
$form = $form =
id(new AphrontFormView()) id(new AphrontFormView())
@ -283,7 +283,7 @@ final class ConpherenceViewController extends
'src' => $thumb 'src' => $thumb
), ),
''), ''),
$file->getName(), phutil_escape_html($file->getName()),
); );
} }
$header = id(new PhabricatorHeaderView()) $header = id(new PhabricatorHeaderView())
@ -292,7 +292,7 @@ final class ConpherenceViewController extends
->setNoDataString(pht('No files attached to conpherence.')) ->setNoDataString(pht('No files attached to conpherence.'))
->setHeaders(array('', pht('Name'))) ->setHeaders(array('', pht('Name')))
->setColumnClasses(array('', 'wide')); ->setColumnClasses(array('', 'wide'));
return hsprintf('%s%s', $header->render(), $table->render()); return new PhutilSafeHTML($header->render() . $table->render());
} }
private function renderTaskWidgetPaneContent() { private function renderTaskWidgetPaneContent() {
@ -328,7 +328,7 @@ final class ConpherenceViewController extends
->setColumnClasses(array('', 'wide')); ->setColumnClasses(array('', 'wide'));
$content[] = $table->render(); $content[] = $table->render();
} }
return phutil_implode_html('', $content); return new PhutilSafeHTML(implode('', $content));
} }
private function renderCalendarWidgetPaneContent() { private function renderCalendarWidgetPaneContent() {
@ -416,7 +416,7 @@ final class ConpherenceViewController extends
} }
} }
return phutil_implode_html('', $content); return new PhutilSafeHTML(implode('', $content));
} }
private function getCalendarWidgetWeekTimestamps() { private function getCalendarWidgetWeekTimestamps() {

View file

@ -50,18 +50,18 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction {
$title = pht( $title = pht(
'%s renamed this conpherence from "%s" to "%s".', '%s renamed this conpherence from "%s" to "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$old, phutil_escape_html($old),
$new); phutil_escape_html($new));
} else if ($old) { } else if ($old) {
$title = pht( $title = pht(
'%s deleted the conpherence name "%s".', '%s deleted the conpherence name "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$old); phutil_escape_html($old));
} else { } else {
$title = pht( $title = pht(
'%s named this conpherence "%s".', '%s named this conpherence "%s".',
$this->renderHandleLink($author_phid), $this->renderHandleLink($author_phid),
$new); phutil_escape_html($new));
} }
return $title; return $title;
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:

View file

@ -139,7 +139,7 @@ final class ConpherenceMenuItemView extends AphrontTagView {
(int)$this->unreadCount); (int)$this->unreadCount);
} }
return $this->renderSingleView( return $this->renderHTMLView(
array( array(
$image, $image,
$title, $title,

View file

@ -87,7 +87,7 @@ final class ConpherenceTransactionView extends AphrontView {
array( array(
'class' => $content_class 'class' => $content_class
), ),
$this->renderSingleView($content)) $this->renderHTMLView($content))
); );
return $transaction_view->render(); return $transaction_view->render();

View file

@ -46,7 +46,7 @@ final class PhabricatorCountdownListController
'Delete'); 'Delete');
} }
$rows[] = array( $rows[] = array(
$timer->getID(), phutil_escape_html($timer->getID()),
$handles[$timer->getAuthorPHID()]->renderLink(), $handles[$timer->getAuthorPHID()]->renderLink(),
phutil_tag( phutil_tag(
'a', 'a',

View file

@ -30,7 +30,7 @@ final class PhabricatorDaemonConsoleController
$rows = array(); $rows = array();
foreach ($completed_info as $class => $info) { foreach ($completed_info as $class => $info) {
$rows[] = array( $rows[] = array(
$class, phutil_escape_html($class),
number_format($info['n']), number_format($info['n']),
number_format((int)($info['duration'] / $info['n'])).' us', number_format((int)($info['duration'] / $info['n'])).' us',
); );
@ -127,7 +127,7 @@ final class PhabricatorDaemonConsoleController
$rows = array(); $rows = array();
foreach ($queued as $row) { foreach ($queued as $row) {
$rows[] = array( $rows[] = array(
$row['taskClass'], phutil_escape_html($row['taskClass']),
number_format($row['N']), number_format($row['N']),
); );
} }

View file

@ -72,40 +72,41 @@ final class PhabricatorWorkerTaskUpdateController
case 'retry': case 'retry':
if ($can_retry) { if ($can_retry) {
$dialog->setTitle('Really retry task?'); $dialog->setTitle('Really retry task?');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'The task will be put back in the queue and executed again.'))); '<p>The task will be put back in the queue and executed '.
'again.</p>');
$dialog->addSubmitButton('Retry Task'); $dialog->addSubmitButton('Retry Task');
} else { } else {
$dialog->setTitle('Can Not Retry'); $dialog->setTitle('Can Not Retry');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'Only archived, unsuccessful tasks can be retried.'))); '<p>Only archived, unsuccessful tasks can be retried.</p>');
} }
break; break;
case 'cancel': case 'cancel':
if ($can_cancel) { if ($can_cancel) {
$dialog->setTitle('Really cancel task?'); $dialog->setTitle('Really cancel task?');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'The work this task represents will never be performed if you '. '<p>The work this task represents will never be performed if you '.
'cancel it. Are you sure you want to cancel it?'))); 'cancel it. Are you sure you want to cancel it?</p>');
$dialog->addSubmitButton('Cancel Task'); $dialog->addSubmitButton('Cancel Task');
} else { } else {
$dialog->setTitle('Can Not Cancel'); $dialog->setTitle('Can Not Cancel');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'Only active tasks can be cancelled.'))); '<p>Only active tasks can be cancelled.</p>');
} }
break; break;
case 'release': case 'release':
if ($can_release) { if ($can_release) {
$dialog->setTitle('Really free task lease?'); $dialog->setTitle('Really free task lease?');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'If the process which owns the task lease is still doing work '. '<p>If the process which owns the task lease is still doing work '.
'on it, the work may be performed twice. Are you sure you '. 'on it, the work may be performed twice. Are you sure you '.
'want to free the lease?'))); 'want to free the lease?</p>');
$dialog->addSubmitButton('Free Lease'); $dialog->addSubmitButton('Free Lease');
} else { } else {
$dialog->setTitle('Can Not Free Lease'); $dialog->setTitle('Can Not Free Lease');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'Only active, leased tasks may have their leases freed.'))); '<p>Only active, leased tasks may have their leases freed.</p>');
} }
break; break;
default: default:

View file

@ -60,7 +60,7 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
} }
$row = array( $row = array(
$event->getLogType(), phutil_escape_html($event->getLogType()),
phabricator_date($event->getEpoch(), $this->user), phabricator_date($event->getEpoch(), $this->user),
phabricator_time($event->getEpoch(), $this->user), phabricator_time($event->getEpoch(), $this->user),
phutil_escape_html_newlines($message.$more), phutil_escape_html_newlines($message.$more),

View file

@ -76,8 +76,8 @@ final class PhabricatorDaemonLogListView extends AphrontView {
$rows[] = array( $rows[] = array(
$running, $running,
$log->getDaemon(), phutil_escape_html($log->getDaemon()),
$log->getHost(), phutil_escape_html($log->getHost()),
$log->getPID(), $log->getPID(),
phabricator_date($epoch, $this->user), phabricator_date($epoch, $this->user),
phabricator_time($epoch, $this->user), phabricator_time($epoch, $this->user),

View file

@ -60,9 +60,10 @@ final class DifferentialCommentSaveController extends DifferentialController {
if (strlen($comment) || $has_inlines) { if (strlen($comment) || $has_inlines) {
$dialog->addSubmitButton(pht('Post as Comment')); $dialog->addSubmitButton(pht('Post as Comment'));
$dialog->appendChild(phutil_tag('br')); $dialog->appendChild('<br />');
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(
'Do you want to post your feedback anyway, as a normal comment?'))); '<p>'.pht('Do you want to post your feedback anyway, as a normal '.
'comment?').'</p>');
} }
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -25,21 +25,16 @@ final class DifferentialDiffViewController extends DifferentialController {
'href' => PhabricatorEnv::getURI('/D'.$diff->getRevisionID()), 'href' => PhabricatorEnv::getURI('/D'.$diff->getRevisionID()),
), ),
'D'.$diff->getRevisionID()); 'D'.$diff->getRevisionID());
$top_panel->appendChild(phutil_tag( $top_panel->appendChild(
'h1', "<h1>".pht('This diff belongs to revision %s', $link)."</h1>");
array(),
pht('This diff belongs to revision %s', $link)));
} else { } else {
$action_panel = new AphrontPanelView(); $action_panel = new AphrontPanelView();
$action_panel->setHeader('Preview Diff'); $action_panel->setHeader('Preview Diff');
$action_panel->setWidth(AphrontPanelView::WIDTH_WIDE); $action_panel->setWidth(AphrontPanelView::WIDTH_WIDE);
$action_panel->appendChild(hsprintf( $action_panel->appendChild(
'<p class="aphront-panel-instructions">%s</p>', '<p class="aphront-panel-instructions">'.pht('Review the diff for '.
pht( 'correctness. When you are satisfied, either <strong>create a new '.
'Review the diff for correctness. When you are satisfied, either '. 'revision</strong> or <strong>update an existing revision</strong>.'));
'<strong>create a new revision</strong> or <strong>update '.
'an existing revision</strong>.',
hsprintf(''))));
// TODO: implmenent optgroup support in AphrontFormSelectControl? // TODO: implmenent optgroup support in AphrontFormSelectControl?
$select = array(); $select = array();

View file

@ -386,15 +386,14 @@ final class DifferentialRevisionViewController extends DifferentialController {
$page_pane = id(new DifferentialPrimaryPaneView()) $page_pane = id(new DifferentialPrimaryPaneView())
->setID($pane_id) ->setID($pane_id)
->appendChild(array( ->appendChild(
$comment_view->render(), $comment_view->render().
$diff_history->render(), $diff_history->render().
$warning, $warning.
$local_view->render(), $local_view->render().
$toc_view->render(), $toc_view->render().
$other_view, $other_view.
$changeset_view->render(), $changeset_view->render());
));
if ($comment_form) { if ($comment_form) {
$page_pane->appendChild($comment_form->render()); $page_pane->appendChild($comment_form->render());
} }
@ -858,12 +857,13 @@ final class DifferentialRevisionViewController extends DifferentialController {
$handles = $this->loadViewerHandles($phids); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
return hsprintf( return
'%s<div class="differential-panel">%s</div>',
id(new PhabricatorHeaderView()) id(new PhabricatorHeaderView())
->setHeader(pht('Open Revisions Affecting These Files')) ->setHeader(pht('Open Revisions Affecting These Files'))
->render(), ->render().
$view->render()); '<div class="differential-panel">'.
$view->render().
'</div>';
} }
/** /**

View file

@ -43,7 +43,7 @@ final class DifferentialSubscribeController extends DifferentialController {
$dialog $dialog
->setUser($user) ->setUser($user)
->setTitle($title) ->setTitle($title)
->appendChild(phutil_tag('p', array(), $prompt)) ->appendChild('<p>'.$prompt.'</p>')
->setSubmitURI($request->getRequestURI()) ->setSubmitURI($request->getRequestURI())
->addSubmitButton($button) ->addSubmitButton($button)
->addCancelButton('/D'.$revision->getID()); ->addCancelButton('/D'.$revision->getID());

View file

@ -49,7 +49,7 @@ final class DifferentialBlameRevisionFieldSpecification
return null; return null;
} }
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
return $engine->markupText($this->value); return phutil_safe_html($engine->markupText($this->value));
} }
public function shouldAppearOnConduitView() { public function shouldAppearOnConduitView() {

View file

@ -26,7 +26,7 @@ final class DifferentialCommitsFieldSpecification
$links[] = $this->getHandle($commit_phid)->renderLink(); $links[] = $this->getHandle($commit_phid)->renderLink();
} }
return phutil_implode_html(phutil_tag('br'), $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getCommitPHIDs() { private function getCommitPHIDs() {

View file

@ -26,7 +26,7 @@ final class DifferentialDependenciesFieldSpecification
$links[] = $this->getHandle($revision_phids)->renderLink(); $links[] = $this->getHandle($revision_phids)->renderLink();
} }
return phutil_implode_html(phutil_tag('br'), $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getDependentRevisionPHIDs() { private function getDependentRevisionPHIDs() {

View file

@ -26,7 +26,7 @@ final class DifferentialDependsOnFieldSpecification
$links[] = $this->getHandle($revision_phids)->renderLink(); $links[] = $this->getHandle($revision_phids)->renderLink();
} }
return phutil_implode_html(phutil_tag('br'), $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getDependentRevisionPHIDs() { private function getDependentRevisionPHIDs() {

View file

@ -283,7 +283,7 @@ abstract class DifferentialFieldSpecification {
$links[] = $handle->renderLink(); $links[] = $handle->renderLink();
} }
return phutil_implode_html(', ', $links); return array_interleave(', ', $links);
} }

View file

@ -29,7 +29,7 @@ final class DifferentialManiphestTasksFieldSpecification
$links[] = $this->getHandle($task_phid)->renderLink(); $links[] = $this->getHandle($task_phid)->renderLink();
} }
return phutil_implode_html(phutil_tag('br'), $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getManiphestTaskPHIDs() { private function getManiphestTaskPHIDs() {

View file

@ -143,9 +143,10 @@ final class DifferentialReviewersFieldSpecification
if ($other_reviewers) { if ($other_reviewers) {
$names = array(); $names = array();
foreach ($other_reviewers as $reviewer => $_) { foreach ($other_reviewers as $reviewer => $_) {
$names[] = $this->getHandle($reviewer)->getLinkName(); $names[] = phutil_escape_html(
$this->getHandle($reviewer)->getLinkName());
} }
$suffix = javelin_tag( $suffix = ' '.javelin_tag(
'abbr', 'abbr',
array( array(
'sigil' => 'has-tooltip', 'sigil' => 'has-tooltip',
@ -158,12 +159,9 @@ final class DifferentialReviewersFieldSpecification
} else { } else {
$suffix = null; $suffix = null;
} }
return hsprintf( return $this->getHandle($primary_reviewer)->renderLink().$suffix;
'%s %s',
$this->getHandle($primary_reviewer)->renderLink(),
$suffix);
} else { } else {
return phutil_tag('em', array(), 'None'); return '<em>None</em>';
} }
} }

View file

@ -113,7 +113,7 @@ final class DifferentialUnitFieldSpecification
$userdata = idx($test, 'userdata'); $userdata = idx($test, 'userdata');
if ($userdata) { if ($userdata) {
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$userdata = $engine->markupText($userdata); $userdata = phutil_safe_html($engine->markupText($userdata));
$rows[] = array( $rows[] = array(
'style' => 'details', 'style' => 'details',
'value' => $userdata, 'value' => $userdata,

View file

@ -1092,7 +1092,7 @@ final class DifferentialChangesetParser {
* indicator of how well tested a change is. * indicator of how well tested a change is.
*/ */
public function renderModifiedCoverage() { public function renderModifiedCoverage() {
$na = phutil_tag('em', array(), '-'); $na = '<em>-</em>';
$coverage = $this->getCoverage(); $coverage = $this->getCoverage();
if (!$coverage) { if (!$coverage) {

View file

@ -21,34 +21,27 @@ abstract class DifferentialChangesetHTMLRenderer
return null; return null;
} }
} else { } else {
$none = $none;
switch ($change) { switch ($change) {
case DifferentialChangeType::TYPE_ADD: case DifferentialChangeType::TYPE_ADD:
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht('This file was <strong>added</strong>.', $none); $message = pht('This file was <strong>added</strong>.');
break; break;
case DifferentialChangeType::FILE_IMAGE: case DifferentialChangeType::FILE_IMAGE:
$message = pht('This image was <strong>added</strong>.', $none); $message = pht('This image was <strong>added</strong>.');
break; break;
case DifferentialChangeType::FILE_DIRECTORY: case DifferentialChangeType::FILE_DIRECTORY:
$message = pht( $message = pht('This directory was <strong>added</strong>.');
'This directory was <strong>added</strong>.',
$none);
break; break;
case DifferentialChangeType::FILE_BINARY: case DifferentialChangeType::FILE_BINARY:
$message = pht( $message = pht('This binary file was <strong>added</strong>.');
'This binary file was <strong>added</strong>.',
$none);
break; break;
case DifferentialChangeType::FILE_SYMLINK: case DifferentialChangeType::FILE_SYMLINK:
$message = pht('This symlink was <strong>added</strong>.', $none); $message = pht('This symlink was <strong>added</strong>.');
break; break;
case DifferentialChangeType::FILE_SUBMODULE: case DifferentialChangeType::FILE_SUBMODULE:
$message = pht( $message = pht('This submodule was <strong>added</strong>.');
'This submodule was <strong>added</strong>.',
$none);
break; break;
} }
break; break;
@ -56,30 +49,22 @@ abstract class DifferentialChangesetHTMLRenderer
case DifferentialChangeType::TYPE_DELETE: case DifferentialChangeType::TYPE_DELETE:
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht('This file was <strong>deleted</strong>.', $none); $message = pht('This file was <strong>deleted</strong>.');
break; break;
case DifferentialChangeType::FILE_IMAGE: case DifferentialChangeType::FILE_IMAGE:
$message = pht('This image was <strong>deleted</strong>.', $none); $message = pht('This image was <strong>deleted</strong>.');
break; break;
case DifferentialChangeType::FILE_DIRECTORY: case DifferentialChangeType::FILE_DIRECTORY:
$message = pht( $message = pht('This directory was <strong>deleted</strong>.');
'This directory was <strong>deleted</strong>.',
$none);
break; break;
case DifferentialChangeType::FILE_BINARY: case DifferentialChangeType::FILE_BINARY:
$message = pht( $message = pht('This binary file was <strong>deleted</strong>.');
'This binary file was <strong>deleted</strong>.',
$none);
break; break;
case DifferentialChangeType::FILE_SYMLINK: case DifferentialChangeType::FILE_SYMLINK:
$message = pht( $message = pht('This symlink was <strong>deleted</strong>.');
'This symlink was <strong>deleted</strong>.',
$none);
break; break;
case DifferentialChangeType::FILE_SUBMODULE: case DifferentialChangeType::FILE_SUBMODULE:
$message = pht( $message = pht('This submodule was <strong>deleted</strong>.');
'This submodule was <strong>deleted</strong>.',
$none);
break; break;
} }
break; break;
@ -250,9 +235,10 @@ abstract class DifferentialChangesetHTMLRenderer
} }
} }
return hsprintf( return
'<div class="differential-meta-notice">%s</div>', '<div class="differential-meta-notice">'.
$message); $message.
'</div>';
} }
protected function renderPropertyChangeHeader() { protected function renderPropertyChangeHeader() {
@ -293,20 +279,15 @@ abstract class DifferentialChangesetHTMLRenderer
} }
} }
array_unshift($rows, hsprintf( return
'<tr class="property-table-header">'. '<table class="differential-property-table">'.
'<th>%s</th>'. '<tr class="property-table-header">'.
'<td class="oval">%s</td>'. '<th>'.pht('Property Changes').'</th>'.
'<td class="nval">%s</td>'. '<td class="oval">'.pht('Old Value').'</td>'.
'</tr>', '<td class="nval">'.pht('New Value').'</td>'.
pht('Property Changes'), '</tr>'.
pht('Old Value'), implode('', $rows).
pht('New Value'))); '</table>';
return phutil_tag(
'table',
array('class' => 'differential-property-table'),
$rows);
} }
public function renderShield($message, $force = 'default') { public function renderShield($message, $force = 'default') {
@ -371,6 +352,9 @@ abstract class DifferentialChangesetHTMLRenderer
return null; return null;
} }
// TODO: [HTML] After TwoUpRenderer gets refactored, fix this.
$content = phutil_safe_html($content);
return javelin_tag( return javelin_tag(
'table', 'table',
array( array(

View file

@ -20,32 +20,32 @@ final class DifferentialChangesetOneUpRenderer
switch ($type) { switch ($type) {
case 'old': case 'old':
case 'new': case 'new':
$out[] = hsprintf('<tr>'); $out[] = '<tr>';
if ($type == 'old') { if ($type == 'old') {
if ($p['htype']) { if ($p['htype']) {
$class = 'left old'; $class = 'left old';
} else { } else {
$class = 'left'; $class = 'left';
} }
$out[] = hsprintf('<th>%s</th>', $p['line']); $out[] = '<th>'.$p['line'].'</th>';
$out[] = hsprintf('<th></th>'); $out[] = '<th></th>';
$out[] = hsprintf('<td class="%s">%s</td>', $class, $p['render']); $out[] = '<td class="'.$class.'">'.$p['render'].'</td>';
} else if ($type == 'new') { } else if ($type == 'new') {
if ($p['htype']) { if ($p['htype']) {
$class = 'right new'; $class = 'right new';
$out[] = hsprintf('<th />'); $out[] = '<th />';
} else { } else {
$class = 'right'; $class = 'right';
$out[] = hsprintf('<th>%s</th>', $p['oline']); $out[] = '<th>'.$p['oline'].'</th>';
} }
$out[] = hsprintf('<th>%s</th>', $p['line']); $out[] = '<th>'.$p['line'].'</th>';
$out[] = hsprintf('<td class="%s">%s</td>', $class, $p['render']); $out[] = '<td class="'.$class.'">'.$p['render'].'</td>';
} }
$out[] = hsprintf('</tr>'); $out[] = '</tr>';
break; break;
case 'inline': case 'inline':
$out[] = hsprintf('<tr><th /><th />'); $out[] = '<tr><th /><th />';
$out[] = hsprintf('<td>'); $out[] = '<td>';
$inline = $this->buildInlineComment( $inline = $this->buildInlineComment(
$p['comment'], $p['comment'],
@ -53,16 +53,16 @@ final class DifferentialChangesetOneUpRenderer
$inline->setBuildScaffolding(false); $inline->setBuildScaffolding(false);
$out[] = $inline->render(); $out[] = $inline->render();
$out[] = hsprintf('</td></tr>'); $out[] = '</td></tr>';
break; break;
default: default:
$out[] = hsprintf('<tr><th /><th /><td>%s</td></tr>', $type); $out[] = '<tr><th /><th /><td>'.$type.'</td></tr>';
break; break;
} }
} }
if ($out) { if ($out) {
return $this->wrapChangeInTable(phutil_implode_html('', $out)); return $this->wrapChangeInTable(implode('', $out));
} }
return null; return null;
} }

View file

@ -160,7 +160,7 @@ final class DifferentialChangesetTwoUpRenderer
'colspan' => 2, 'colspan' => 2,
'class' => 'show-more', 'class' => 'show-more',
), ),
phutil_implode_html( array_interleave(
" \xE2\x80\xA2 ", // Bullet " \xE2\x80\xA2 ", // Bullet
$contents)), $contents)),
phutil_tag( phutil_tag(
@ -205,7 +205,7 @@ final class DifferentialChangesetTwoUpRenderer
} }
} }
$n_copy = hsprintf('<td class="copy" />'); $n_copy = '<td class="copy" />';
$n_cov = null; $n_cov = null;
$n_colspan = 2; $n_colspan = 2;
$n_classes = ''; $n_classes = '';
@ -224,7 +224,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 = '<td class="cov '.$cov_class.'"></td>';
$n_colspan--; $n_colspan--;
} }
@ -242,7 +242,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 = '<td class="copy '.$n_class.'"></td>';
} 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 ';
@ -274,13 +274,13 @@ final class DifferentialChangesetTwoUpRenderer
} }
if ($o_num && $left_id) { if ($o_num && $left_id) {
$o_id = 'C'.$left_id.$left_char.'L'.$o_num; $o_id = ' id="C'.$left_id.$left_char.'L'.$o_num.'"';
} else { } else {
$o_id = null; $o_id = null;
} }
if ($n_num && $right_id) { if ($n_num && $right_id) {
$n_id = 'C'.$right_id.$right_char.'L'.$n_num; $n_id = ' id="C'.$right_id.$right_char.'L'.$n_num.'"';
} else { } else {
$n_id = null; $n_id = null;
} }
@ -288,26 +288,20 @@ final class DifferentialChangesetTwoUpRenderer
// 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[] =
'<tr>'. '<tr>'.
'%s'. '<th'.$o_id.'>'.$o_num.'</th>'.
'<td class="%s">%s</td>'. '<td class="'.$o_classes.'">'.$o_text.'</td>'.
'%s'. '<th'.$n_id.'>'.$n_num.'</th>'.
'%s'. $n_copy.
// NOTE: This is a unicode zero-width space, which we use as a hint // NOTE: This is a unicode zero-width space, which we use as a hint
// when intercepting 'copy' events to make sure sensible text ends // when intercepting 'copy' events to make sure sensible text ends
// up on the clipboard. See the 'phabricator-oncopy' behavior. // up on the clipboard. See the 'phabricator-oncopy' behavior.
'<td class="%s" colspan="%s">'. '<td class="'.$n_classes.'" colspan="'.$n_colspan.'">'.
"\xE2\x80\x8B%s". "\xE2\x80\x8B".$n_text.
'</td>'. '</td>'.
'%s'. $n_cov.
'</tr>', '</tr>';
phutil_tag('th', array('id' => $o_id), $o_num),
$o_classes, $o_text,
phutil_tag('th', array('id' => $n_id), $n_num),
$n_copy,
$n_classes, $n_colspan, $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;
@ -357,7 +351,7 @@ final class DifferentialChangesetTwoUpRenderer
} }
} }
return $this->wrapChangeInTable(phutil_implode_html('', $html)); return $this->wrapChangeInTable(implode('', $html));
} }
public function renderFileChange($old_file = null, public function renderFileChange($old_file = null,
@ -401,57 +395,51 @@ 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[] =
'<tr class="inline">'. '<tr class="inline">'.
'<th />'. '<th />'.
'<td class="left">%s</td>'. '<td class="left">'.$comment_html.'</td>'.
'<th />'. '<th />'.
'<td class="right3" colspan="3" />'. '<td class="right3" colspan="3" />'.
'</tr>', '</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[] =
'<tr class="inline">'. '<tr class="inline">'.
'<th />'. '<th />'.
'<td class="left" />'. '<td class="left" />'.
'<th />'. '<th />'.
'<td class="right3" colspan="3">%s</td>'. '<td class="right3" colspan="3">'.$comment_html.'</td>'.
'</tr>', '</tr>';
$comment_html);
} }
} }
if (!$old) { if (!$old) {
$th_old = hsprintf('<th></th>'); $th_old = '<th></th>';
} else { } else {
$th_old = hsprintf('<th id="C%sOL1">1</th>', $vs); $th_old = '<th id="C'.$vs.'OL1">1</th>';
} }
if (!$new) { if (!$new) {
$th_new = hsprintf('<th></th>'); $th_new = '<th></th>';
} else { } else {
$th_new = hsprintf('<th id="C%sNL1">1</th>', $id); $th_new = '<th id="C'.$id.'NL1">1</th>';
} }
$output = hsprintf( $output =
'<tr class="differential-image-diff">'. '<tr class="differential-image-diff">'.
'%s'. $th_old.
'<td class="left differential-old-image">%s</td>'. '<td class="left differential-old-image">'.$old.'</td>'.
'%s'. $th_new.
'<td class="right3 differential-new-image" colspan="3">%s</td>'. '<td class="right3 differential-new-image" colspan="3">'.
$new.
'</td>'.
'</tr>'. '</tr>'.
'%s'. implode('', $html_old).
'%s', implode('', $html_new);
$th_old,
$old,
$th_new,
$new,
phutil_implode_html('', $html_old),
phutil_implode_html('', $html_new));
$output = $this->wrapChangeInTable($output); $output = $this->wrapChangeInTable($output);

View file

@ -155,35 +155,35 @@ final class DifferentialAddCommentView extends AphrontView {
'inline' => 'inline-comment-preview', 'inline' => 'inline-comment-preview',
)); ));
$warning_container = array(); $warning_container = '<div id="warnings">';
foreach ($warnings as $warning) { foreach ($warnings as $warning) {
if ($warning) { if ($warning) {
$warning_container[] = $warning->render(); $warning_container .= $warning->render();
} }
} }
$warning_container .= '</div>';
$header = id(new PhabricatorHeaderView()) $header = id(new PhabricatorHeaderView())
->setHeader($is_serious ? pht('Add Comment') : pht('Leap Into Action')); ->setHeader($is_serious ? pht('Add Comment') : pht('Leap Into Action'));
return hsprintf( return
'%s'. id(new PhabricatorAnchorView())
->setAnchorName('comment')
->setNavigationMarker(true)
->render().
'<div class="differential-add-comment-panel">'. '<div class="differential-add-comment-panel">'.
'%s%s%s'. $header->render().
$form->render().
$warning_container.
'<div class="aphront-panel-preview aphront-panel-flush">'. '<div class="aphront-panel-preview aphront-panel-flush">'.
'<div id="comment-preview">'. '<div id="comment-preview">'.
'<span class="aphront-panel-preview-loading-text">%s</span>'. '<span class="aphront-panel-preview-loading-text">'.
pht('Loading comment preview...').
'</span>'.
'</div>'. '</div>'.
'<div id="inline-comment-preview">'. '<div id="inline-comment-preview">'.
'</div>'. '</div>'.
'</div>'. '</div>'.
'</div>', '</div>';
id(new PhabricatorAnchorView())
->setAnchorName('comment')
->setNavigationMarker(true)
->render(),
$header->render(),
$form->render(),
phutil_tag('div', array('id' => 'warnings'), $warning_container),
pht('Loading comment preview...'));
} }
} }

View file

@ -92,7 +92,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
'class' => $class, 'class' => $class,
'id' => $id, 'id' => $id,
), ),
$this->renderSingleView( $this->renderHTMLView(
array( array(
id(new PhabricatorAnchorView()) id(new PhabricatorAnchorView())
->setAnchorName($changeset->getAnchorName()) ->setAnchorName($changeset->getAnchorName())
@ -101,7 +101,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
$buttons, $buttons,
phutil_tag('h1', array(), $display_filename), phutil_tag('h1', array(), $display_filename),
phutil_tag('div', array('style' => 'clear: both'), ''), phutil_tag('div', array('style' => 'clear: both'), ''),
$this->renderChildren(), $this->renderHTMLChildren(),
))); )));
} }

View file

@ -187,7 +187,7 @@ final class DifferentialChangesetListView extends AphrontView {
)); ));
} }
return $this->renderSingleView( return $this->renderHTMLView(
array( array(
id(new PhabricatorHeaderView()) id(new PhabricatorHeaderView())
->setHeader($this->getTitle()) ->setHeader($this->getTitle())
@ -221,20 +221,15 @@ final class DifferentialChangesetListView extends AphrontView {
), ),
array('Changes discarded. ', $link)); array('Changes discarded. ', $link));
return array( $template =
'l' => hsprintf( '<table><tr>'.
'<table><tr>'. '<th></th><td>%s</td>'.
'<th></th><td>%s</td>'. '<th></th><td colspan="3">%s</td>'.
'<th></th><td colspan="3"></td>'. '</tr></table>';
'</tr></table>',
$div),
'r' => hsprintf( return array(
'<table><tr>'. 'l' => sprintf($template, $div, ''),
'<th></th><td></td>'. 'r' => sprintf($template, '', $div),
'<th></th><td colspan="3">%s</td>'.
'</tr></table>',
$div),
); );
} }

View file

@ -94,20 +94,22 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$meta[] = pht('Copied to multiple locations:'); $meta[] = pht('Copied to multiple locations:');
} }
foreach ($away as $path) { foreach ($away as $path) {
$meta[] = $path; $meta[] = phutil_escape_html($path);
} }
$meta = phutil_implode_html(phutil_tag('br'), $meta); $meta = implode('<br />', $meta);
} else { } else {
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) { if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
$meta = pht('Moved to %s', reset($away)); $meta = pht('Moved to %s', phutil_escape_html(reset($away)));
} else { } else {
$meta = pht('Copied to %s', reset($away)); $meta = pht('Copied to %s', phutil_escape_html(reset($away)));
} }
} }
} else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) { } else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) {
$meta = pht('Moved from %s', $changeset->getOldFile()); $meta = pht('Moved from %s',
phutil_escape_html($changeset->getOldFile()));
} else if ($type == DifferentialChangeType::TYPE_COPY_HERE) { } else if ($type == DifferentialChangeType::TYPE_COPY_HERE) {
$meta = pht('Copied from %s', $changeset->getOldFile()); $meta = pht('Copied from %s',
phutil_escape_html($changeset->getOldFile()));
} else { } else {
$meta = null; $meta = null;
} }
@ -128,12 +130,12 @@ 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')); : '<span title="'.pht('Properties Changed').'">M</span>';
$fname = $changeset->getFilename(); $fname = $changeset->getFilename();
$cov = $this->renderCoverage($coverage, $fname); $cov = $this->renderCoverage($coverage, $fname);
if ($cov === null) { if ($cov === null) {
$mcov = $cov = phutil_tag('em', array(), '-'); $mcov = $cov = '<em>-</em>';
} else { } else {
$mcov = phutil_tag( $mcov = phutil_tag(
'div', 'div',
@ -144,28 +146,27 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
(isset($this->visibleChangesets[$id]) ? 'Loading...' : '?')); (isset($this->visibleChangesets[$id]) ? 'Loading...' : '?'));
} }
$rows[] = hsprintf( $rows[] =
'<tr>'. '<tr>'.
'<td class="differential-toc-char" title="%s">%s</td>'. phutil_tag(
'<td class="differential-toc-prop">%s</td>'. 'td',
'<td class="differential-toc-ftype">%s</td>'. array(
'<td class="differential-toc-file">%s%s</td>'. 'class' => 'differential-toc-char',
'<td class="differential-toc-cov">%s</td>'. 'title' => $chartitle,
'<td class="differential-toc-mcov">%s</td>'. ),
'</tr>', $char).
$chartitle, $char, '<td class="differential-toc-prop">'.$pchar.'</td>'.
$pchar, '<td class="differential-toc-ftype">'.$desc.'</td>'.
$desc, '<td class="differential-toc-file">'.$link.$lines.'</td>'.
$link, $lines, '<td class="differential-toc-cov">'.$cov.'</td>'.
$cov, '<td class="differential-toc-mcov">'.$mcov.'</td>'.
$mcov); '</tr>';
if ($meta) { if ($meta) {
$rows[] = hsprintf( $rows[] =
'<tr>'. '<tr>'.
'<td colspan="3"></td>'. '<td colspan="3"></td>'.
'<td class="differential-toc-meta">%s</td>'. '<td class="differential-toc-meta">'.$meta.'</td>'.
'</tr>', '</tr>';
$meta);
} }
if ($this->diff && $this->repository) { if ($this->diff && $this->repository) {
$paths[] = $paths[] =
@ -200,13 +201,19 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
), ),
pht('Show All Context')); pht('Show All Context'));
$buttons = hsprintf( $buttons =
'<tr><td colspan="7">%s%s</td></tr>', '<tr><td colspan="7">'.
$editor_link, $editor_link.$reveal_link.
$reveal_link); '</td></tr>';
return hsprintf( return
'%s%s'. id(new PhabricatorAnchorView())
->setAnchorName('toc')
->setNavigationMarker(true)
->render().
id(new PhabricatorHeaderView())
->setHeader(pht('Table of Contents'))
->render().
'<div class="differential-toc differential-panel">'. '<div class="differential-toc differential-panel">'.
'<table>'. '<table>'.
'<tr>'. '<tr>'.
@ -214,23 +221,17 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
'<th></th>'. '<th></th>'.
'<th></th>'. '<th></th>'.
'<th>Path</th>'. '<th>Path</th>'.
'<th class="differential-toc-cov">%s</th>'. '<th class="differential-toc-cov">'.
'<th class="differential-toc-mcov">%s</th>'. pht('Coverage (All)').
'</th>'.
'<th class="differential-toc-mcov">'.
pht('Coverage (Touched)').
'</th>'.
'</tr>'. '</tr>'.
'%s%s'. implode("\n", $rows).
$buttons.
'</table>'. '</table>'.
'</div>', '</div>';
id(new PhabricatorAnchorView())
->setAnchorName('toc')
->setNavigationMarker(true)
->render(),
id(new PhabricatorHeaderView())
->setHeader(pht('Table of Contents'))
->render(),
pht('Coverage (All)'),
pht('Coverage (Touched)'),
phutil_implode_html("\n", $rows),
$buttons);
} }
private function renderCoverage(array $coverage, $file) { private function renderCoverage(array $coverage, $file) {

View file

@ -55,7 +55,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
'method' => 'POST', 'method' => 'POST',
'sigil' => 'inline-edit-form', 'sigil' => 'inline-edit-form',
), ),
$this->renderSingleView( $this->renderHTMLView(
array( array(
$this->renderInputs(), $this->renderInputs(),
$this->renderBody(), $this->renderBody(),
@ -123,14 +123,14 @@ final class DifferentialInlineCommentEditView extends AphrontView {
array( array(
'class' => 'differential-inline-comment-edit-body', 'class' => 'differential-inline-comment-edit-body',
), ),
$this->renderChildren()); $this->renderHTMLChildren());
$edit = phutil_tag( $edit = phutil_tag(
'edit', 'edit',
array( array(
'class' => 'differential-inline-comment-edit-buttons', 'class' => 'differential-inline-comment-edit-buttons',
), ),
$this->renderSingleView( $this->renderHTMLView(
array( array(
$formatting, $formatting,
$buttons, $buttons,
@ -148,7 +148,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
'length' => $this->length, 'length' => $this->length,
), ),
), ),
$this->renderSingleView( $this->renderHTMLView(
array( array(
$title, $title,
$body, $body,

View file

@ -178,7 +178,7 @@ final class DifferentialInlineCommentView extends AphrontView {
$links = phutil_tag( $links = phutil_tag(
'span', 'span',
array('class' => 'differential-inline-comment-links'), array('class' => 'differential-inline-comment-links'),
phutil_implode_html(" \xC2\xB7 ", $links)); array_interleave(" \xC2\xB7 ", $links));
} else { } else {
$links = null; $links = null;
} }

View file

@ -74,7 +74,7 @@ final class DifferentialLocalCommitsView extends AphrontView {
} }
$parents[$k] = substr($parent, 0, 16); $parents[$k] = substr($parent, 0, 16);
} }
$parents = phutil_implode_html(phutil_tag('br'), $parents); $parents = array_interleave(phutil_tag('br'), $parents);
$row[] = phutil_tag('td', array(), $parents); $row[] = phutil_tag('td', array(), $parents);
$author = nonempty( $author = nonempty(
@ -114,31 +114,29 @@ final class DifferentialLocalCommitsView extends AphrontView {
$headers = array(); $headers = array();
$headers[] = phutil_tag('th', array(), pht('Commit')); $headers[] = '<th>'.pht('Commit').'</th>';
if ($has_tree) { if ($has_tree) {
$headers[] = phutil_tag('th', array(), pht('Tree')); $headers[] = '<th>'.pht('Tree').'</th>';
} }
if ($has_local) { if ($has_local) {
$headers[] = phutil_tag('th', array(), pht('Local')); $headers[] = '<th>'.pht('Local').'</th>';
} }
$headers[] = phutil_tag('th', array(), pht('Parents')); $headers[] = '<th>'.pht('Parents').'</th>';
$headers[] = phutil_tag('th', array(), pht('Author')); $headers[] = '<th>'.pht('Author').'</th>';
$headers[] = phutil_tag('th', array(), pht('Summary')); $headers[] = '<th>'.pht('Summary').'</th>';
$headers[] = phutil_tag('th', array(), pht('Date')); $headers[] = '<th>'.pht('Date').'</th>';
$headers = phutil_tag('tr', array(), $headers); $headers = '<tr>'.implode('', $headers).'</tr>';
$header = id(new PhabricatorHeaderView()) return
->setHeader(pht('Local Commits')) id(new PhabricatorHeaderView())
->render(); ->setHeader(pht('Local Commits'))
->render().
return hsprintf(
'%s'.
'<div class="differential-panel">'. '<div class="differential-panel">'.
'<table class="differential-local-commits-table">%s%s</table>'. '<table class="differential-local-commits-table">'.
'</div>', $headers.
$header, implode("\n", $rows).
$headers, '</table>'.
phutil_implode_html("\n", $rows)); '</div>';
} }
} }

View file

@ -11,7 +11,7 @@ final class DifferentialPrimaryPaneView extends AphrontView {
public function render() { public function render() {
return phutil_tag( return phutil_render_tag(
'div', 'div',
array( array(
'class' => 'differential-primary-pane', 'class' => 'differential-primary-pane',

View file

@ -187,12 +187,14 @@ final class DifferentialRevisionCommentListView extends AphrontView {
$hidden = null; $hidden = null;
} }
return javelin_tag( return javelin_render_tag(
'div', 'div',
array( array(
'class' => 'differential-comment-list', 'class' => 'differential-comment-list',
'id' => $this->getID(), 'id' => $this->getID(),
), ),
array_merge($header, array($hidden), $visible)); implode("\n", $header).
$hidden.
implode("\n", $visible));
} }
} }

View file

@ -87,9 +87,10 @@ final class DifferentialRevisionCommentView extends AphrontView {
$comment, $comment,
PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY); PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY);
$content = hsprintf( $content =
'<div class="phabricator-remarkup">%s</div>', '<div class="phabricator-remarkup">'.
$content); $content.
'</div>';
} }
$inline_render = $this->renderInlineComments(); $inline_render = $this->renderInlineComments();
@ -115,22 +116,19 @@ final class DifferentialRevisionCommentView extends AphrontView {
array()); array());
$verb = DifferentialAction::getActionPastTenseVerb($comment->getAction()); $verb = DifferentialAction::getActionPastTenseVerb($comment->getAction());
$verb = phutil_escape_html($verb);
$actions = array(); $actions = array();
// TODO: i18n // TODO: i18n
switch ($comment->getAction()) { switch ($comment->getAction()) {
case DifferentialAction::ACTION_ADDCCS: case DifferentialAction::ACTION_ADDCCS:
$actions[] = hsprintf( $actions[] = "{$author_link} added CCs: ".
"%s added CCs: %s.", $this->renderHandleList($added_ccs).".";
$author_link,
$this->renderHandleList($added_ccs));
$added_ccs = null; $added_ccs = null;
break; break;
case DifferentialAction::ACTION_ADDREVIEWERS: case DifferentialAction::ACTION_ADDREVIEWERS:
$actions[] = hsprintf( $actions[] = "{$author_link} added reviewers: ".
"%s added reviewers: %s.", $this->renderHandleList($added_reviewers).".";
$author_link,
$this->renderHandleList($added_reviewers));
$added_reviewers = null; $added_reviewers = null;
break; break;
case DifferentialAction::ACTION_UPDATE: case DifferentialAction::ACTION_UPDATE:
@ -142,48 +140,33 @@ final class DifferentialRevisionCommentView extends AphrontView {
'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id, 'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id,
), ),
'Diff #'.$diff_id); 'Diff #'.$diff_id);
$actions[] = hsprintf( $actions[] = "{$author_link} updated this revision to {$diff_link}.";
"%s updated this revision to %s.",
$author_link,
$diff_link);
} else { } else {
$actions[] = hsprintf( $actions[] = "{$author_link} {$verb} this revision.";
"%s %s this revision.",
$author_link,
$verb);
} }
break; break;
default: default:
$actions[] = hsprintf( $actions[] = "{$author_link} {$verb} this revision.";
"%s %s this revision.",
$author_link,
$verb);
break; break;
} }
if ($added_reviewers) { if ($added_reviewers) {
$actions[] = hsprintf( $actions[] = "{$author_link} added reviewers: ".
"%s added reviewers: %s.", $this->renderHandleList($added_reviewers).".";
$author_link,
$this->renderHandleList($added_reviewers));
} }
if ($removed_reviewers) { if ($removed_reviewers) {
$actions[] = hsprintf( $actions[] = "{$author_link} removed reviewers: ".
"%s removed reviewers: %s.", $this->renderHandleList($removed_reviewers).".";
$author_link,
$this->renderHandleList($removed_reviewers));
} }
if ($added_ccs) { if ($added_ccs) {
$actions[] = hsprintf( $actions[] = "{$author_link} added CCs: ".
"%s added CCs: %s.", $this->renderHandleList($added_ccs).".";
$author_link,
$this->renderHandleList($added_ccs));
} }
foreach ($actions as $key => $action) { foreach ($actions as $key => $action) {
$actions[$key] = phutil_tag('div', array(), $action); $actions[$key] = '<div>'.$action.'</div>';
} }
$xaction_view = id(new PhabricatorTransactionView()) $xaction_view = id(new PhabricatorTransactionView())
@ -207,10 +190,11 @@ final class DifferentialRevisionCommentView extends AphrontView {
} }
if (!$hide_comments) { if (!$hide_comments) {
$xaction_view->appendChild(hsprintf( $xaction_view->appendChild(
'<div class="differential-comment-core">%s%s</div>', '<div class="differential-comment-core">'.
$content, $content.
$this->renderSingleView($inline_render))); '</div>'.
$this->renderSingleView($inline_render));
} }
return $xaction_view->render(); return $xaction_view->render();
@ -221,7 +205,7 @@ final class DifferentialRevisionCommentView extends AphrontView {
foreach ($phids as $phid) { foreach ($phids as $phid) {
$result[] = $this->handles[$phid]->renderLink(); $result[] = $this->handles[$phid]->renderLink();
} }
return phutil_implode_html(', ', $result); return implode(', ', $result);
} }
private function renderInlineComments() { private function renderInlineComments() {

View file

@ -87,11 +87,7 @@ final class DifferentialRevisionDetailView extends AphrontView {
} }
$properties->setHasKeyboardShortcuts(true); $properties->setHasKeyboardShortcuts(true);
return hsprintf( return $header->render() . $actions->render() . $properties->render();
'%s%s%s',
$header->render(),
$actions->render(),
$properties->render());
} }
private function renderHeader(DifferentialRevision $revision) { private function renderHeader(DifferentialRevision $revision) {

View file

@ -128,18 +128,18 @@ final class DifferentialRevisionListView extends AphrontView {
} else if (array_key_exists($revision->getID(), $this->drafts)) { } else if (array_key_exists($revision->getID(), $this->drafts)) {
$src = '/rsrc/image/icon/fatcow/page_white_edit.png'; $src = '/rsrc/image/icon/fatcow/page_white_edit.png';
$flag = hsprintf( $flag =
'<a href="%s">%s</a>', '<a href="/D'.$revision->getID().'#comment-preview">'.
'/D'.$revision->getID().'#comment-preview', phutil_tag(
phutil_tag( 'img',
'img', array(
array( 'src' => celerity_get_resource_uri($src),
'src' => celerity_get_resource_uri($src), 'width' => 16,
'width' => 16, 'height' => 16,
'height' => 16, 'alt' => 'Draft',
'alt' => 'Draft', 'title' => pht('Draft Comment'),
'title' => pht('Draft Comment'), )).
))); '</a>';
} }
$row = array($flag); $row = array($flag);

View file

@ -177,8 +177,9 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
DifferentialChangesetParser::WHITESPACE_SHOW_ALL => 'Show All', DifferentialChangesetParser::WHITESPACE_SHOW_ALL => 'Show All',
); );
$select = '<select name="whitespace">';
foreach ($options as $value => $label) { foreach ($options as $value => $label) {
$options[$value] = phutil_tag( $select .= phutil_tag(
'option', 'option',
array( array(
'value' => $value, 'value' => $value,
@ -188,39 +189,34 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
), ),
$label); $label);
} }
$select = phutil_tag('select', array('name' => 'whitespace'), $options); $select .= '</select>';
array_unshift($rows, phutil_tag('tr', array(), array( return
phutil_tag('th', array(), pht('Diff')), id(new PhabricatorHeaderView())
phutil_tag('th', array(), pht('ID')), ->setHeader(pht('Revision Update History'))
phutil_tag('th', array(), pht('Base')), ->render() .
phutil_tag('th', array(), pht('Description')),
phutil_tag('th', array(), pht('Created')),
phutil_tag('th', array(), pht('Lint')),
phutil_tag('th', array(), pht('Unit')),
)));
return hsprintf(
'%s'.
'<div class="differential-revision-history differential-panel">'. '<div class="differential-revision-history differential-panel">'.
'<form action="#toc">'. '<form action="#toc">'.
'<table class="differential-revision-history-table">'. '<table class="differential-revision-history-table">'.
'%s'. '<tr>'.
'<th>'.pht('Diff').'</th>'.
'<th>'.pht('ID').'</th>'.
'<th>'.pht('Base').'</th>'.
'<th>'.pht('Description').'</th>'.
'<th>'.pht('Created').'</th>'.
'<th>'.pht('Lint').'</th>'.
'<th>'.pht('Unit').'</th>'.
'</tr>'.
implode("\n", $rows).
'<tr>'. '<tr>'.
'<td colspan="9" class="diff-differ-submit">'. '<td colspan="9" class="diff-differ-submit">'.
'<label>%s</label>'. '<label>'.pht('Whitespace Changes: %s', $select).'</label>'.
'<button>%s</button>'. '<button>'.pht('Show Diff').'</button>'.
'</td>'. '</td>'.
'</tr>'. '</tr>'.
'</table>'. '</table>'.
'</form>'. '</form>'.
'</div>', '</div>';
id(new PhabricatorHeaderView())
->setHeader(pht('Revision Update History'))
->render(),
phutil_implode_html("\n", $rows),
pht('Whitespace Changes: %s', $select),
pht('Show Diff'));
} }
const STAR_NONE = 'none'; const STAR_NONE = 'none';

View file

@ -21,7 +21,7 @@ final class DiffusionBrowseController extends DiffusionController {
$title = 'Tag: '.$drequest->getSymbolicCommit(); $title = 'Tag: '.$drequest->getSymbolicCommit();
$tag_view = new AphrontPanelView(); $tag_view = new AphrontPanelView();
$tag_view->setHeader($title); $tag_view->setHeader(phutil_escape_html($title));
$tag_view->appendChild( $tag_view->appendChild(
$this->markupText($drequest->getTagContent())); $this->markupText($drequest->getTagContent()));
@ -106,7 +106,7 @@ final class DiffusionBrowseController extends DiffusionController {
private function markupText($text) { private function markupText($text) {
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
$text = $engine->markupText($text); $text = phutil_safe_html($engine->markupText($text));
$text = phutil_tag( $text = phutil_tag(
'div', 'div',

View file

@ -97,7 +97,8 @@ final class DiffusionCommitController extends DiffusionController {
array( array(
'class' => 'diffusion-commit-message phabricator-remarkup', 'class' => 'diffusion-commit-message phabricator-remarkup',
), ),
$engine->markupText($commit_data->getCommitMessage()))); phutil_safe_html(
$engine->markupText($commit_data->getCommitMessage()))));
$content[] = $top_anchor; $content[] = $top_anchor;
$content[] = $headsup_view; $content[] = $headsup_view;
@ -448,7 +449,9 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($parents as $parent) { foreach ($parents as $parent) {
$parent_links[] = $handles[$parent->getPHID()]->renderLink(); $parent_links[] = $handles[$parent->getPHID()]->renderLink();
} }
$props['Parents'] = phutil_implode_html(" \xC2\xB7 ", $parent_links); $props['Parents'] = array_interleave(
" \xC2\xB7 ",
$parent_links);
} }
$request = $this->getDiffusionRequest(); $request = $this->getDiffusionRequest();
@ -485,7 +488,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($task_phids as $phid) { foreach ($task_phids as $phid) {
$task_list[] = $handles[$phid]->renderLink(); $task_list[] = $handles[$phid]->renderLink();
} }
$task_list = phutil_implode_html(phutil_tag('br'), $task_list); $task_list = array_interleave(phutil_tag('br'), $task_list);
$props['Tasks'] = $task_list; $props['Tasks'] = $task_list;
} }
@ -494,7 +497,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($proj_phids as $phid) { foreach ($proj_phids as $phid) {
$proj_list[] = $handles[$phid]->renderLink(); $proj_list[] = $handles[$phid]->renderLink();
} }
$proj_list = phutil_implode_html(phutil_tag('br'), $proj_list); $proj_list = array_interleave(phutil_tag('br'), $proj_list);
$props['Projects'] = $proj_list; $props['Projects'] = $proj_list;
} }
@ -686,7 +689,7 @@ final class DiffusionCommitController extends DiffusionController {
'inlineuri' => '/diffusion/inline/preview/'.$commit->getPHID().'/', 'inlineuri' => '/diffusion/inline/preview/'.$commit->getPHID().'/',
)); ));
$preview_panel = hsprintf( $preview_panel =
'<div class="aphront-panel-preview aphront-panel-flush"> '<div class="aphront-panel-preview aphront-panel-flush">
<div id="audit-preview"> <div id="audit-preview">
<div class="aphront-panel-preview-loading-text"> <div class="aphront-panel-preview-loading-text">
@ -695,24 +698,27 @@ final class DiffusionCommitController extends DiffusionController {
</div> </div>
<div id="inline-comment-preview"> <div id="inline-comment-preview">
</div> </div>
</div>'); </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');
return phutil_tag( return phutil_render_tag(
'div', 'div',
array( array(
'id' => $pane_id, 'id' => $pane_id,
), ),
hsprintf( phutil_render_tag(
'<div class="differential-add-comment-panel">%s%s%s</div>', 'div',
array(
'class' => 'differential-add-comment-panel',
),
id(new PhabricatorAnchorView()) id(new PhabricatorAnchorView())
->setAnchorName('comment') ->setAnchorName('comment')
->setNavigationMarker(true) ->setNavigationMarker(true)
->render(), ->render().
$panel->render(), $panel->render().
$preview_panel)); $preview_panel));
} }
@ -932,7 +938,7 @@ final class DiffusionCommitController extends DiffusionController {
$ref); $ref);
} }
return phutil_implode_html(', ', $ref_links); return array_interleave(', ', $ref_links);
} }
private function buildRawDiffResponse(DiffusionRequest $drequest) { private function buildRawDiffResponse(DiffusionRequest $drequest) {

View file

@ -103,7 +103,7 @@ final class DiffusionExternalController extends DiffusionController {
'href' => $href, 'href' => $href,
), ),
'r'.$repo->getCallsign().$commit->getCommitIdentifier()), 'r'.$repo->getCallsign().$commit->getCommitIdentifier()),
$commit->loadCommitData()->getSummary(), phutil_escape_html($commit->loadCommitData()->getSummary()),
); );
} }

View file

@ -19,7 +19,7 @@ final class DiffusionHomeController extends DiffusionController {
'href' => $shortcut->getHref(), 'href' => $shortcut->getHref(),
), ),
$shortcut->getName()), $shortcut->getName()),
$shortcut->getDescription(), phutil_escape_html($shortcut->getDescription()),
); );
} }
@ -130,7 +130,7 @@ final class DiffusionHomeController extends DiffusionController {
'href' => '/diffusion/'.$repository->getCallsign().'/', 'href' => '/diffusion/'.$repository->getCallsign().'/',
), ),
$repository->getName()), $repository->getName()),
$repository->getDetail('description'), phutil_escape_html($repository->getDetail('description')),
PhabricatorRepositoryType::getNameForRepositoryType( PhabricatorRepositoryType::getNameForRepositoryType(
$repository->getVersionControlSystem()), $repository->getVersionControlSystem()),
$size, $size,

View file

@ -71,10 +71,11 @@ final class DiffusionLintController extends DiffusionController {
'<a href="%s">%s</a>', '<a href="%s">%s</a>',
$drequest->generateURI(array('action' => 'lint')), $drequest->generateURI(array('action' => 'lint')),
$drequest->getCallsign()), $drequest->getCallsign()),
ArcanistLintSeverity::getStringForSeverity($code['maxSeverity']), phutil_escape_html(ArcanistLintSeverity::getStringForSeverity(
$code['code'], $code['maxSeverity'])),
$code['maxName'], phutil_escape_html($code['code']),
$code['maxDescription'], phutil_escape_html($code['maxName']),
phutil_escape_html($code['maxDescription']),
); );
} }

View file

@ -34,9 +34,10 @@ final class DiffusionLintDetailsController extends DiffusionController {
$rows[] = array( $rows[] = array(
$path, $path,
$line, $line,
ArcanistLintSeverity::getStringForSeverity($message['severity']), phutil_escape_html(ArcanistLintSeverity::getStringForSeverity(
$message['name'], $message['severity'])),
$message['description'], phutil_escape_html($message['name']),
phutil_escape_html($message['description']),
); );
} }
@ -70,7 +71,7 @@ final class DiffusionLintDetailsController extends DiffusionController {
$content[] = id(new AphrontPanelView()) $content[] = id(new AphrontPanelView())
->setHeader( ->setHeader(
($lint != '' ? $lint." \xC2\xB7 " : ''). ($lint != '' ? phutil_escape_html($lint)." \xC2\xB7 " : '').
pht('%d Lint Message(s)', count($messages))) pht('%d Lint Message(s)', count($messages)))
->setCaption($link) ->setCaption($link)
->appendChild($table) ->appendChild($table)

View file

@ -68,7 +68,7 @@ final class DiffusionRepositoryController extends DiffusionController {
'View Full Commit History'); 'View Full Commit History');
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader(hsprintf("Recent Commits &middot; %s", $all)); $panel->setHeader("Recent Commits &middot; {$all}");
$panel->appendChild($history_table); $panel->appendChild($history_table);
$panel->setNoBackground(); $panel->setNoBackground();
@ -125,7 +125,9 @@ final class DiffusionRepositoryController extends DiffusionController {
$rows = array(); $rows = array();
foreach ($properties as $key => $value) { foreach ($properties as $key => $value) {
$rows[] = array($key, $value); $rows[] = array(
phutil_escape_html($key),
phutil_escape_html($value));
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);

View file

@ -81,8 +81,8 @@ final class DiffusionSymbolController extends DiffusionController {
$project_name = '-'; $project_name = '-';
} }
$file = $symbol->getPath(); $file = phutil_escape_html($symbol->getPath());
$line = $symbol->getLineNumber(); $line = phutil_escape_html($symbol->getLineNumber());
$repo = $symbol->getRepository(); $repo = $symbol->getRepository();
if ($repo) { if ($repo) {
@ -101,17 +101,17 @@ final class DiffusionSymbolController extends DiffusionController {
), ),
$file.':'.$line); $file.':'.$line);
} else if ($file) { } else if ($file) {
$location = $file.':'.$line; $location = phutil_escape_html($file.':'.$line);
} else { } else {
$location = '?'; $location = '?';
} }
$rows[] = array( $rows[] = array(
$symbol->getSymbolType(), phutil_escape_html($symbol->getSymbolType()),
$symbol->getSymbolContext(), phutil_escape_html($symbol->getSymbolContext()),
$symbol->getSymbolName(), phutil_escape_html($symbol->getSymbolName()),
$symbol->getSymbolLanguage(), phutil_escape_html($symbol->getSymbolLanguage()),
$project_name, phutil_escape_html($project_name),
$location, $location,
); );
} }

View file

@ -119,14 +119,15 @@ abstract class DiffusionBrowseQuery {
$readme_content = $highlighter $readme_content = $highlighter
->getHighlightFuture($readme_content) ->getHighlightFuture($readme_content)
->resolve(); ->resolve();
$readme_content = phutil_escape_html_newlines($readme_content); $readme_content = nl2br($readme_content);
$readme_content = phutil_safe_html($readme_content);
require_celerity_resource('syntax-highlighting-css'); require_celerity_resource('syntax-highlighting-css');
$class = 'remarkup-code'; $class = 'remarkup-code';
} else { } else {
// Markup extensionless files as remarkup so we get links and such. // Markup extensionless files as remarkup so we get links and such.
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
$readme_content = $engine->markupText($readme_content); $readme_content = phutil_safe_html($engine->markupText($readme_content));
$class = 'phabricator-remarkup'; $class = 'phabricator-remarkup';
} }

View file

@ -55,7 +55,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
$committer = self::renderName($committer); $committer = self::renderName($committer);
} }
if ($author != $committer) { if ($author != $committer) {
$author = hsprintf('%s/%s', $author, $committer); $author .= '/'.$committer;
} }
} }
@ -132,17 +132,24 @@ final class DiffusionBrowseTableView extends DiffusionView {
$browse_text = $path->getPath().'/'; $browse_text = $path->getPath().'/';
$dir_slash = '/'; $dir_slash = '/';
$browse_link = phutil_tag('strong', array(), $this->linkBrowse( $browse_link = '<strong>'.$this->linkBrowse(
$base_path.$path->getPath().$dir_slash, $base_path.$path->getPath().$dir_slash,
array( array(
'text' => $this->renderPathIcon('dir', $browse_text), 'text' => $this->renderPathIcon(
))); 'dir',
$browse_text),
)).'</strong>';
} else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) { } else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) {
$browse_text = $path->getPath().'/'; $browse_text = $path->getPath().'/';
$browse_link = phutil_tag('strong', array(), $this->linkExternal( $browse_link =
$path->getHash(), '<strong>'.
$path->getExternalURI(), $this->linkExternal(
$this->renderPathIcon('ext', $browse_text))); $path->getHash(),
$path->getExternalURI(),
$this->renderPathIcon(
'ext',
$browse_text)).
'</strong>';
} else { } else {
if ($file_type == DifferentialChangeType::FILE_SYMLINK) { if ($file_type == DifferentialChangeType::FILE_SYMLINK) {
$type = 'link'; $type = 'link';
@ -183,7 +190,7 @@ final class DiffusionBrowseTableView extends DiffusionView {
$need_pull[$uri] = $dict; $need_pull[$uri] = $dict;
foreach ($dict as $k => $uniq) { foreach ($dict as $k => $uniq) {
$dict[$k] = phutil_tag('span', array('id' => $uniq), ''); $dict[$k] = '<span id="'.$uniq.'"></span>';
} }
} }

View file

@ -87,10 +87,10 @@ final class DiffusionCommentListView extends AphrontView {
++$num; ++$num;
} }
return phutil_tag( return
'div', '<div class="diffusion-comment-list">'.
array('class' => 'diffusion-comment-list'), $this->renderSingleView($comments).
$comments); '</div>';
} }
} }

View file

@ -114,19 +114,17 @@ final class DiffusionCommentView extends AphrontView {
$actions = array(); $actions = array();
if ($action == PhabricatorAuditActionConstants::ADD_CCS) { if ($action == PhabricatorAuditActionConstants::ADD_CCS) {
$rendered_ccs = $this->renderHandleList($added_ccs); $rendered_ccs = $this->renderHandleList($added_ccs);
$actions[] = hsprintf("%s added CCs: %s.", $author_link, $rendered_ccs); $actions[] = "{$author_link} added CCs: {$rendered_ccs}.";
} else if ($action == PhabricatorAuditActionConstants::ADD_AUDITORS) { } else if ($action == PhabricatorAuditActionConstants::ADD_AUDITORS) {
$rendered_auditors = $this->renderHandleList($added_auditors); $rendered_auditors = $this->renderHandleList($added_auditors);
$actions[] = hsprintf( $actions[] = "{$author_link} added auditors: ".
"%s added auditors: %s.", "{$rendered_auditors}.";
$author_link,
$rendered_auditors);
} else { } else {
$actions[] = hsprintf("%s %s this commit.", $author_link, $verb); $actions[] = "{$author_link} ".phutil_escape_html($verb)." this commit.";
} }
foreach ($actions as $key => $action) { foreach ($actions as $key => $action) {
$actions[$key] = phutil_tag('div', array(), $action); $actions[$key] = '<div>'.$action.'</div>';
} }
return $actions; return $actions;
@ -139,12 +137,13 @@ 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
'<div class="phabricator-remarkup">%s%s</div>', '<div class="phabricator-remarkup">'.
$engine->getOutput( $engine->getOutput(
$comment, $comment,
PhabricatorAuditComment::MARKUP_FIELD_BODY), PhabricatorAuditComment::MARKUP_FIELD_BODY).
$this->renderSingleView($this->renderInlines())); $this->renderSingleView($this->renderInlines()).
'</div>';
} }
} }
@ -187,7 +186,7 @@ final class DiffusionCommentView extends AphrontView {
foreach ($phids as $phid) { foreach ($phids as $phid) {
$result[] = $this->handles[$phid]->renderLink(); $result[] = $this->handles[$phid]->renderLink();
} }
return phutil_implode_html(', ', $result); return implode(', ', $result);
} }
private function renderClasses() { private function renderClasses() {

View file

@ -51,7 +51,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
), ),
$path); $path);
} else { } else {
$path_column = $path; $path_column = phutil_escape_html($path);
} }
$rows[] = array( $rows[] = array(

View file

@ -107,7 +107,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
} else { } else {
$committer = self::renderName($committer); $committer = self::renderName($committer);
} }
$author = hsprintf('%s/%s', $author, $committer); $author .= '/'.$committer;
} }
$commit = $history->getCommit(); $commit = $history->getCommit();
@ -118,7 +118,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
$path = null, $path = null,
$history->getCommitIdentifier()); $history->getCommitIdentifier());
} else { } else {
$change = phutil_tag('em', array(), "Importing\xE2\x80\xA6"); $change = "<em>Importing\xE2\x80\xA6</em>";
} }
$rows[] = array( $rows[] = array(

View file

@ -79,6 +79,7 @@ final class DiffusionTagListView extends DiffusionView {
$description = $tag->getDescription(); $description = $tag->getDescription();
} }
} }
$description = phutil_escape_html($description);
$rows[] = array( $rows[] = array(
$tag_link, $tag_link,

View file

@ -156,7 +156,7 @@ abstract class DiffusionView extends AphrontView {
), ),
$email->getDisplayName()); $email->getDisplayName());
} }
return hsprintf('%s', $name); return phutil_escape_html($name);
} }
} }

View file

@ -50,7 +50,10 @@ final class DivinerListController extends PhabricatorController {
$flavor); $flavor);
} }
$out = phutil_tag('div', array('class' => 'aphront-directory-list'), $out); $out =
'<div class="aphront-directory-list">'.
implode("\n", $out).
'</div>';
return $this->buildApplicationPage( return $this->buildApplicationPage(
$out, $out,

View file

@ -44,7 +44,7 @@ abstract class DrydockController extends PhabricatorController {
'href' => $lease_uri, 'href' => $lease_uri,
), ),
$log->getLeaseID()), $log->getLeaseID()),
$log->getMessage(), phutil_escape_html($log->getMessage()),
phabricator_date($log->getEpoch(), $user), phabricator_date($log->getEpoch(), $user),
); );
} }

View file

@ -24,8 +24,8 @@ final class DrydockLeaseReleaseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Lease Not Active')) ->setTitle(pht('Lease Not Active'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(
'You can only release "active" leases.'))) '<p>'.pht('You can only release "active" leases.').'</p>')
->addCancelButton($lease_uri); ->addCancelButton($lease_uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -35,10 +35,11 @@ final class DrydockLeaseReleaseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Really release lease?')) ->setTitle(pht('Really release lease?'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(
'Releasing a lease may cause trouble for the lease holder and '. '<p>'.pht(
'trigger cleanup of the underlying resource. It can not be '. 'Releasing a lease may cause trouble for the lease holder and '.
'undone. Continue?'))) 'trigger cleanup of the underlying resource. It can not be '.
'undone. Continue?').'</p>')
->addSubmitButton(pht('Release Lease')) ->addSubmitButton(pht('Release Lease'))
->addCancelButton($lease_uri); ->addCancelButton($lease_uri);

View file

@ -24,8 +24,8 @@ final class DrydockResourceCloseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Resource Not Open')) ->setTitle(pht('Resource Not Open'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(
'You can only close "open" resources.'))) '<p>'.pht('You can only close "open" resources.').'</p>')
->addCancelButton($resource_uri); ->addCancelButton($resource_uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -35,9 +35,10 @@ final class DrydockResourceCloseController extends DrydockController {
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->setTitle(pht('Really close resource?')) ->setTitle(pht('Really close resource?'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(
'Closing a resource releases all leases and destroys the '. '<p>'.pht(
'resource. It can not be undone. Continue?'))) 'Closing a resource releases all leases and destroys the '.
'resource. It can not be undone. Continue?').'</p>')
->addSubmitButton(pht('Close Resource')) ->addSubmitButton(pht('Close Resource'))
->addCancelButton($resource_uri); ->addCancelButton($resource_uri);

View file

@ -32,7 +32,10 @@ final class PhabricatorFactHomeController extends PhabricatorFactController {
$name = $spec->getName(); $name = $spec->getName();
$value = $spec->formatValueForDisplay($user, $fact->getValueX()); $value = $spec->formatValueForDisplay($user, $fact->getValueX());
$rows[] = array($name, $value); $rows[] = array(
phutil_escape_html($name),
phutil_escape_html($value),
);
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);

View file

@ -40,8 +40,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>')); '<div class="phabricator-feed-story-date-separator"></div>');
} }
$last_date = $date; $last_date = $date;
$null_view->appendChild( $null_view->appendChild(
@ -59,9 +59,10 @@ final class PhabricatorFeedBuilder {
$null_view->appendChild($view); $null_view->appendChild($view);
} }
return id(new AphrontNullView())->appendChild(hsprintf( return id(new AphrontNullView())->appendChild(
'<div class="phabricator-feed-frame">%s</div>', '<div class="phabricator-feed-frame">'.
$null_view->render())); $null_view->render().
'</div>');
} }
} }

View file

@ -224,7 +224,7 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface {
foreach ($phids as $phid) { foreach ($phids as $phid) {
$list[] = $this->linkTo($phid); $list[] = $this->linkTo($phid);
} }
return phutil_implode_html(', ', $list); return implode(', ', $list);
} }
final protected function linkTo($phid) { final protected function linkTo($phid) {

Some files were not shown because too many files have changed in this diff Show more