1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22: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(); $json = new PhutilJSON();
if (is_array($value)) { if (is_array($value)) {
$value = $json->encodeFormatted($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; return $value;
} }

View file

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

View file

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