1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 07:12:41 +01:00

Convert some phutil_escape_html() to hsprintf()

Summary:
In the second phase, I want to get rid of the most of `phutil_escape_html()` calls in favor of plain strings or `PhutilSafeHTML`.
This is an example of how it could look.

Test Plan: /api/user.whoami

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4823
This commit is contained in:
vrana 2013-02-05 12:49:46 -08:00
parent 8f1311bbc1
commit bcf9b9d4a7
3 changed files with 9 additions and 12 deletions

View file

@ -396,12 +396,9 @@ final class PhabricatorConduitAPIController
$json = new PhutilJSON();
if (is_array($value)) {
$value = $json->encodeFormatted($value);
$value = phutil_escape_html($value);
} else {
$value = phutil_escape_html($value);
}
$value = '<pre style="white-space: pre-wrap;">'.$value.'</pre>';
$value = hsprintf('<pre style="white-space: pre-wrap;">%s</pre>', $value);
return $value;
}

View file

@ -58,11 +58,10 @@ final class PhabricatorConduitConsoleController
if ($error_types) {
$error_description[] = '<ul>';
foreach ($error_types as $error => $meaning) {
$error_description[] =
'<li>'.
'<strong>'.phutil_escape_html($error).':</strong> '.
phutil_escape_html($meaning).
'</li>';
$error_description[] = hsprintf(
'<li><strong>%s:</strong> %s</li>',
$error,
$meaning);
}
$error_description[] = '</ul>';
$error_description = implode("\n", $error_description);

View file

@ -32,14 +32,15 @@ final class PhabricatorConduitTokenController
$panel->setHeader('Certificate Install Token');
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild(
$panel->appendChild(hsprintf(
'<p class="aphront-form-instructions">Copy and paste this token into '.
'the prompt given to you by "arc install-certificate":</p>'.
'<p style="padding: 0 0 1em 4em;">'.
'<strong>'.phutil_escape_html($token->getToken()).'</strong>'.
'<strong>%s</strong>'.
'</p>'.
'<p class="aphront-form-instructions">arc will then complete the '.
'install process for you.</p>');
'install process for you.</p>',
$token->getToken()));
$this->setShowSideNav(false);