mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 22:40:55 +01:00
Kill most of phutil_escape_html()
Summary: This resolves lots of double escaping. We changed most of `phutil_render_tag(, , $s)` to `phutil_tag(, , $s)` which means that `$s` is now auto-escaped. Also `pht()` auto escapes if it gets `PhutilSafeHTML`. Test Plan: None. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4889
This commit is contained in:
parent
9b8da73765
commit
a22ef4e9b4
24 changed files with 127 additions and 101 deletions
|
@ -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 .=
|
$details .= hsprintf(
|
||||||
'<div class="dark-console-panel-error-details" id="row-details-'.
|
'<div class="dark-console-panel-error-details" id="row-details-%s">'.
|
||||||
$index.'">'.
|
"%s\nStack trace:\n",
|
||||||
phutil_escape_html($row['details'])."\n".
|
$index,
|
||||||
'Stack trace:'."\n";
|
$row['details']);
|
||||||
|
|
||||||
foreach ($row['trace'] as $key => $entry) {
|
foreach ($row['trace'] as $key => $entry) {
|
||||||
$line = '';
|
$line = '';
|
||||||
|
|
|
@ -247,8 +247,7 @@ 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",
|
$button = pht("Login or Register with %s", $provider_name);
|
||||||
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(
|
||||||
|
@ -259,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", phutil_escape_html($provider_name));
|
$button = pht("Log in with %s", $provider_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth_form = new AphrontFormView();
|
$auth_form = new AphrontFormView();
|
||||||
|
|
|
@ -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.',
|
||||||
phutil_escape_html($this->getHandle($this->phid)->getName()));
|
$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',
|
||||||
phutil_escape_html($this->getHandle($this->phid)->getName())
|
$this->getHandle($this->phid)->getName()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $page_title;
|
return $page_title;
|
||||||
|
|
|
@ -100,11 +100,14 @@ final class AphrontCalendarMonthView extends AphrontView {
|
||||||
|
|
||||||
$holiday_markup = null;
|
$holiday_markup = null;
|
||||||
if ($holiday) {
|
if ($holiday) {
|
||||||
$name = phutil_escape_html($holiday->getName());
|
$name = $holiday->getName();
|
||||||
$holiday_markup =
|
$holiday_markup = phutil_tag(
|
||||||
'<div class="aphront-calendar-holiday" title="'.$name.'">'.
|
'div',
|
||||||
$name.
|
array(
|
||||||
'</div>';
|
'class' => 'aphront-calendar-holiday',
|
||||||
|
'title' => $name,
|
||||||
|
),
|
||||||
|
$name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$markup[] =
|
$markup[] =
|
||||||
|
|
|
@ -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),
|
||||||
phutil_escape_html($old),
|
$old,
|
||||||
phutil_escape_html($new));
|
$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),
|
||||||
phutil_escape_html($old));
|
$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),
|
||||||
phutil_escape_html($new));
|
$new);
|
||||||
}
|
}
|
||||||
return $title;
|
return $title;
|
||||||
case ConpherenceTransactionType::TYPE_FILES:
|
case ConpherenceTransactionType::TYPE_FILES:
|
||||||
|
|
|
@ -143,8 +143,7 @@ final class DifferentialReviewersFieldSpecification
|
||||||
if ($other_reviewers) {
|
if ($other_reviewers) {
|
||||||
$names = array();
|
$names = array();
|
||||||
foreach ($other_reviewers as $reviewer => $_) {
|
foreach ($other_reviewers as $reviewer => $_) {
|
||||||
$names[] = phutil_escape_html(
|
$names[] = $this->getHandle($reviewer)->getLinkName();
|
||||||
$this->getHandle($reviewer)->getLinkName());
|
|
||||||
}
|
}
|
||||||
$suffix = javelin_tag(
|
$suffix = javelin_tag(
|
||||||
'abbr',
|
'abbr',
|
||||||
|
|
|
@ -94,22 +94,20 @@ 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[] = phutil_escape_html($path);
|
$meta[] = $path;
|
||||||
}
|
}
|
||||||
$meta = implode('<br />', $meta);
|
$meta = phutil_implode_html(phutil_tag('br'), $meta);
|
||||||
} else {
|
} else {
|
||||||
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
|
if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) {
|
||||||
$meta = pht('Moved to %s', phutil_escape_html(reset($away)));
|
$meta = pht('Moved to %s', reset($away));
|
||||||
} else {
|
} else {
|
||||||
$meta = pht('Copied to %s', phutil_escape_html(reset($away)));
|
$meta = pht('Copied to %s', reset($away));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) {
|
} else if ($type == DifferentialChangeType::TYPE_MOVE_HERE) {
|
||||||
$meta = pht('Moved from %s',
|
$meta = pht('Moved from %s', $changeset->getOldFile());
|
||||||
phutil_escape_html($changeset->getOldFile()));
|
|
||||||
} else if ($type == DifferentialChangeType::TYPE_COPY_HERE) {
|
} else if ($type == DifferentialChangeType::TYPE_COPY_HERE) {
|
||||||
$meta = pht('Copied from %s',
|
$meta = pht('Copied from %s', $changeset->getOldFile());
|
||||||
phutil_escape_html($changeset->getOldFile()));
|
|
||||||
} else {
|
} else {
|
||||||
$meta = null;
|
$meta = null;
|
||||||
}
|
}
|
||||||
|
@ -162,11 +160,12 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
|
||||||
'<td class="differential-toc-mcov">'.$mcov.'</td>'.
|
'<td class="differential-toc-mcov">'.$mcov.'</td>'.
|
||||||
'</tr>';
|
'</tr>';
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
$rows[] =
|
$rows[] = hsprintf(
|
||||||
'<tr>'.
|
'<tr>'.
|
||||||
'<td colspan="3"></td>'.
|
'<td colspan="3"></td>'.
|
||||||
'<td class="differential-toc-meta">'.$meta.'</td>'.
|
'<td class="differential-toc-meta">%s</td>'.
|
||||||
'</tr>';
|
'</tr>',
|
||||||
|
$meta);
|
||||||
}
|
}
|
||||||
if ($this->diff && $this->repository) {
|
if ($this->diff && $this->repository) {
|
||||||
$paths[] =
|
$paths[] =
|
||||||
|
|
|
@ -116,19 +116,22 @@ 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[] = "{$author_link} added CCs: ".
|
$actions[] = hsprintf(
|
||||||
$this->renderHandleList($added_ccs).".";
|
"%s added CCs: %s.",
|
||||||
|
$author_link,
|
||||||
|
$this->renderHandleList($added_ccs));
|
||||||
$added_ccs = null;
|
$added_ccs = null;
|
||||||
break;
|
break;
|
||||||
case DifferentialAction::ACTION_ADDREVIEWERS:
|
case DifferentialAction::ACTION_ADDREVIEWERS:
|
||||||
$actions[] = "{$author_link} added reviewers: ".
|
$actions[] = hsprintf(
|
||||||
$this->renderHandleList($added_reviewers).".";
|
"%s added reviewers: %s.",
|
||||||
|
$author_link,
|
||||||
|
$this->renderHandleList($added_reviewers));
|
||||||
$added_reviewers = null;
|
$added_reviewers = null;
|
||||||
break;
|
break;
|
||||||
case DifferentialAction::ACTION_UPDATE:
|
case DifferentialAction::ACTION_UPDATE:
|
||||||
|
@ -140,33 +143,48 @@ 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[] = "{$author_link} updated this revision to {$diff_link}.";
|
$actions[] = hsprintf(
|
||||||
|
"%s updated this revision to %s.",
|
||||||
|
$author_link,
|
||||||
|
$diff_link);
|
||||||
} else {
|
} else {
|
||||||
$actions[] = "{$author_link} {$verb} this revision.";
|
$actions[] = hsprintf(
|
||||||
|
"%s %s this revision.",
|
||||||
|
$author_link,
|
||||||
|
$verb);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$actions[] = "{$author_link} {$verb} this revision.";
|
$actions[] = hsprintf(
|
||||||
|
"%s %s this revision.",
|
||||||
|
$author_link,
|
||||||
|
$verb);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($added_reviewers) {
|
if ($added_reviewers) {
|
||||||
$actions[] = "{$author_link} added reviewers: ".
|
$actions[] = hsprintf(
|
||||||
$this->renderHandleList($added_reviewers).".";
|
"%s added reviewers: %s.",
|
||||||
|
$author_link,
|
||||||
|
$this->renderHandleList($added_reviewers));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($removed_reviewers) {
|
if ($removed_reviewers) {
|
||||||
$actions[] = "{$author_link} removed reviewers: ".
|
$actions[] = hsprintf(
|
||||||
$this->renderHandleList($removed_reviewers).".";
|
"%s removed reviewers: %s.",
|
||||||
|
$author_link,
|
||||||
|
$this->renderHandleList($removed_reviewers));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($added_ccs) {
|
if ($added_ccs) {
|
||||||
$actions[] = "{$author_link} added CCs: ".
|
$actions[] = hsprintf(
|
||||||
$this->renderHandleList($added_ccs).".";
|
"%s added CCs: %s.",
|
||||||
|
$author_link,
|
||||||
|
$this->renderHandleList($added_ccs));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($actions as $key => $action) {
|
foreach ($actions as $key => $action) {
|
||||||
$actions[$key] = '<div>'.$action.'</div>';
|
$actions[$key] = phutil_tag('div', array(), $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
$xaction_view = id(new PhabricatorTransactionView())
|
$xaction_view = id(new PhabricatorTransactionView())
|
||||||
|
@ -205,7 +223,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 implode(', ', $result);
|
return phutil_implode_html(', ', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderInlineComments() {
|
private function renderInlineComments() {
|
||||||
|
|
|
@ -114,17 +114,19 @@ 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[] = "{$author_link} added CCs: {$rendered_ccs}.";
|
$actions[] = hsprintf("%s added CCs: %s.", $author_link, $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[] = "{$author_link} added auditors: ".
|
$actions[] = hsprintf(
|
||||||
"{$rendered_auditors}.";
|
"%s added auditors: %s.",
|
||||||
|
$author_link,
|
||||||
|
$rendered_auditors);
|
||||||
} else {
|
} else {
|
||||||
$actions[] = "{$author_link} ".phutil_escape_html($verb)." this commit.";
|
$actions[] = hsprintf("%s %s this commit.", $author_link, $verb);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($actions as $key => $action) {
|
foreach ($actions as $key => $action) {
|
||||||
$actions[$key] = '<div>'.$action.'</div>';
|
$actions[$key] = phutil_tag('div', array(), $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $actions;
|
return $actions;
|
||||||
|
@ -186,7 +188,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 implode(', ', $result);
|
return phutil_implode_html(', ', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function renderClasses() {
|
private function renderClasses() {
|
||||||
|
|
|
@ -19,14 +19,14 @@ final class PhabricatorFeedStoryCommit extends PhabricatorFeedStory {
|
||||||
if ($data->getValue('authorPHID')) {
|
if ($data->getValue('authorPHID')) {
|
||||||
$author = $this->linkTo($data->getValue('authorPHID'));
|
$author = $this->linkTo($data->getValue('authorPHID'));
|
||||||
} else {
|
} else {
|
||||||
$author = phutil_escape_html($data->getValue('authorName'));
|
$author = $data->getValue('authorName');
|
||||||
}
|
}
|
||||||
|
|
||||||
$committer = null;
|
$committer = null;
|
||||||
if ($data->getValue('committerPHID')) {
|
if ($data->getValue('committerPHID')) {
|
||||||
$committer = $this->linkTo($data->getValue('committerPHID'));
|
$committer = $this->linkTo($data->getValue('committerPHID'));
|
||||||
} else if ($data->getValue('committerName')) {
|
} else if ($data->getValue('committerName')) {
|
||||||
$committer = phutil_escape_html($data->getValue('committerName'));
|
$committer = $data->getValue('committerName');
|
||||||
}
|
}
|
||||||
|
|
||||||
$commit = $this->linkTo($data->getValue('commitPHID'));
|
$commit = $this->linkTo($data->getValue('commitPHID'));
|
||||||
|
@ -37,9 +37,16 @@ final class PhabricatorFeedStoryCommit extends PhabricatorFeedStory {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($author) {
|
if ($author) {
|
||||||
$title = "{$committer} committed {$commit} (authored by {$author})";
|
$title = hsprintf(
|
||||||
|
"%s committed %s (authored by %s)",
|
||||||
|
$committer,
|
||||||
|
$commit,
|
||||||
|
$author);
|
||||||
} else {
|
} else {
|
||||||
$title = "{$committer} committed {$commit}";
|
$title = hsprintf(
|
||||||
|
"%s committed %s",
|
||||||
|
$committer,
|
||||||
|
$commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = new PhabricatorFeedStoryView();
|
$view = new PhabricatorFeedStoryView();
|
||||||
|
|
|
@ -31,7 +31,7 @@ final class PhabricatorFlagsUIEventListener extends PhutilEventListener {
|
||||||
$flag_action = id(new PhabricatorActionView())
|
$flag_action = id(new PhabricatorActionView())
|
||||||
->setWorkflow(true)
|
->setWorkflow(true)
|
||||||
->setHref('/flag/delete/'.$flag->getID().'/')
|
->setHref('/flag/delete/'.$flag->getID().'/')
|
||||||
->setName(phutil_escape_html('Remove '.$color.' Flag'))
|
->setName('Remove '.$color.' Flag')
|
||||||
->setIcon('flag-'.$flag->getColor());
|
->setIcon('flag-'.$flag->getColor());
|
||||||
} else {
|
} else {
|
||||||
$flag_action = id(new PhabricatorActionView())
|
$flag_action = id(new PhabricatorActionView())
|
||||||
|
|
|
@ -64,8 +64,8 @@ final class PhabricatorMacroTransaction
|
||||||
return pht(
|
return pht(
|
||||||
'%s renamed this macro from "%s" to "%s".',
|
'%s renamed this macro from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
phutil_escape_html($old),
|
$old,
|
||||||
phutil_escape_html($new));
|
$new);
|
||||||
break;
|
break;
|
||||||
case PhabricatorMacroTransactionType::TYPE_DISABLED:
|
case PhabricatorMacroTransactionType::TYPE_DISABLED:
|
||||||
if ($new) {
|
if ($new) {
|
||||||
|
@ -109,8 +109,8 @@ final class PhabricatorMacroTransaction
|
||||||
'%s renamed %s from "%s" to "%s".',
|
'%s renamed %s from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->renderHandleLink($object_phid),
|
$this->renderHandleLink($object_phid),
|
||||||
phutil_escape_html($old),
|
$old,
|
||||||
phutil_escape_html($new));
|
$new);
|
||||||
case PhabricatorMacroTransactionType::TYPE_DISABLED:
|
case PhabricatorMacroTransactionType::TYPE_DISABLED:
|
||||||
if ($new) {
|
if ($new) {
|
||||||
return pht(
|
return pht(
|
||||||
|
|
|
@ -152,13 +152,13 @@ class ManiphestAuxiliaryFieldDefaultSpecification
|
||||||
switch ($this->getFieldType()) {
|
switch ($this->getFieldType()) {
|
||||||
case self::TYPE_BOOL:
|
case self::TYPE_BOOL:
|
||||||
if ($this->getValue()) {
|
if ($this->getValue()) {
|
||||||
return phutil_escape_html($this->getCheckboxValue());
|
return $this->getCheckboxValue();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
case self::TYPE_SELECT:
|
case self::TYPE_SELECT:
|
||||||
$display = idx($this->getSelectOptions(), $this->getValue());
|
$display = idx($this->getSelectOptions(), $this->getValue());
|
||||||
return phutil_escape_html($display);
|
return $display;
|
||||||
}
|
}
|
||||||
return parent::renderForDetailView();
|
return parent::renderForDetailView();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ abstract class ManiphestAuxiliaryFieldSpecification {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderForDetailView() {
|
public function renderForDetailView() {
|
||||||
return phutil_escape_html($this->getValue());
|
return $this->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
|
||||||
$lang_name = $paste->getLanguage();
|
$lang_name = $paste->getLanguage();
|
||||||
if ($lang_name) {
|
if ($lang_name) {
|
||||||
$lang_name = idx($lang_map, $lang_name, $lang_name);
|
$lang_name = idx($lang_map, $lang_name, $lang_name);
|
||||||
$item->addIcon('none', phutil_escape_html($lang_name));
|
$item->addIcon('none', $lang_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
$list->addItem($item);
|
$list->addItem($item);
|
||||||
|
|
|
@ -44,15 +44,15 @@ final class PholioTransaction extends PhabricatorApplicationTransaction {
|
||||||
return pht(
|
return pht(
|
||||||
'%s renamed this mock from "%s" to "%s".',
|
'%s renamed this mock from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
phutil_escape_html($old),
|
$old,
|
||||||
phutil_escape_html($new));
|
$new);
|
||||||
break;
|
break;
|
||||||
case PholioTransactionType::TYPE_DESCRIPTION:
|
case PholioTransactionType::TYPE_DESCRIPTION:
|
||||||
return pht(
|
return pht(
|
||||||
'%s updated the description of this mock. '.
|
'%s updated the description of this mock. '.
|
||||||
'The old description was: %s',
|
'The old description was: %s',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
phutil_escape_html($old));
|
$old);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::getTitle();
|
return parent::getTitle();
|
||||||
|
|
|
@ -5,7 +5,6 @@ final class PhabricatorXHPASTViewInputController
|
||||||
|
|
||||||
public function processRequest() {
|
public function processRequest() {
|
||||||
$input = $this->getStorageTree()->getInput();
|
$input = $this->getStorageTree()->getInput();
|
||||||
return $this->buildXHPASTViewPanelResponse(
|
return $this->buildXHPASTViewPanelResponse($input);
|
||||||
phutil_escape_html($input));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ abstract class PhabricatorXHPASTViewPanelController
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildXHPASTViewPanelResponse($content) {
|
protected function buildXHPASTViewPanelResponse($content) {
|
||||||
$content =
|
$content = hsprintf(
|
||||||
'<!DOCTYPE html>'.
|
'<!DOCTYPE html>'.
|
||||||
'<html>'.
|
'<html>'.
|
||||||
'<head>'.
|
'<head>'.
|
||||||
|
@ -57,10 +57,9 @@ li span {
|
||||||
|
|
||||||
</style>'.
|
</style>'.
|
||||||
'</head>'.
|
'</head>'.
|
||||||
'<body>'.
|
'<body>%s</body>'.
|
||||||
$content.
|
'</html>',
|
||||||
'</body>'.
|
$content);
|
||||||
'</html>';
|
|
||||||
|
|
||||||
$response = new AphrontWebpageResponse();
|
$response = new AphrontWebpageResponse();
|
||||||
$response->setFrameable(true);
|
$response->setFrameable(true);
|
||||||
|
|
|
@ -27,6 +27,7 @@ final class PhabricatorXHPASTViewStreamController
|
||||||
$token->getValue());
|
$token->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildXHPASTViewPanelResponse(implode('', $tokens));
|
return $this->buildXHPASTViewPanelResponse(
|
||||||
|
phutil_implode_html('', $tokens));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ final class PhabricatorXHPASTViewTreeController
|
||||||
$input,
|
$input,
|
||||||
array(0, $stdout, ''));
|
array(0, $stdout, ''));
|
||||||
|
|
||||||
$tree = '<ul>'.$this->buildTree($tree->getRootNode()).'</ul>';
|
$tree = phutil_tag('ul', array(), $this->buildTree($tree->getRootNode()));
|
||||||
return $this->buildXHPASTViewPanelResponse($tree);
|
return $this->buildXHPASTViewPanelResponse($tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,19 +27,19 @@ final class PhabricatorXHPASTViewTreeController
|
||||||
}
|
}
|
||||||
|
|
||||||
$tree = array();
|
$tree = array();
|
||||||
$tree[] =
|
$tree[] = phutil_tag(
|
||||||
'<li>'.
|
'li',
|
||||||
|
array(),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'span',
|
'span',
|
||||||
array(
|
array(
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
),
|
),
|
||||||
$name).
|
$name));
|
||||||
'</li>';
|
|
||||||
foreach ($root->getChildren() as $child) {
|
foreach ($root->getChildren() as $child) {
|
||||||
$tree[] = '<ul>'.$this->buildTree($child).'</ul>';
|
$tree[] = phutil_tag('ul', array(), $this->buildTree($child));
|
||||||
}
|
}
|
||||||
return implode("\n", $tree);
|
return phutil_implode_html("\n", $tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ final class PhabricatorPolicy {
|
||||||
),
|
),
|
||||||
$this->getName());
|
$this->getName());
|
||||||
} else {
|
} else {
|
||||||
$desc = phutil_escape_html($this->getName());
|
$desc = $this->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->getType()) {
|
switch ($this->getType()) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ final class PhabricatorSubscriptionsUIEventListener
|
||||||
->setDisabled(true)
|
->setDisabled(true)
|
||||||
->setRenderAsForm(true)
|
->setRenderAsForm(true)
|
||||||
->setHref('/subscriptions/add/'.$object->getPHID().'/')
|
->setHref('/subscriptions/add/'.$object->getPHID().'/')
|
||||||
->setName(phutil_escape_html('Automatically Subscribed'))
|
->setName('Automatically Subscribed')
|
||||||
->setIcon('subscribe-auto');
|
->setIcon('subscribe-auto');
|
||||||
} else {
|
} else {
|
||||||
$subscribed = false;
|
$subscribed = false;
|
||||||
|
@ -59,7 +59,7 @@ final class PhabricatorSubscriptionsUIEventListener
|
||||||
->setWorkflow(true)
|
->setWorkflow(true)
|
||||||
->setRenderAsForm(true)
|
->setRenderAsForm(true)
|
||||||
->setHref('/subscriptions/delete/'.$object->getPHID().'/')
|
->setHref('/subscriptions/delete/'.$object->getPHID().'/')
|
||||||
->setName(phutil_escape_html('Unsubscribe'))
|
->setName('Unsubscribe')
|
||||||
->setIcon('subscribe-delete');
|
->setIcon('subscribe-delete');
|
||||||
} else {
|
} else {
|
||||||
$sub_action = id(new PhabricatorActionView())
|
$sub_action = id(new PhabricatorActionView())
|
||||||
|
@ -67,7 +67,7 @@ final class PhabricatorSubscriptionsUIEventListener
|
||||||
->setWorkflow(true)
|
->setWorkflow(true)
|
||||||
->setRenderAsForm(true)
|
->setRenderAsForm(true)
|
||||||
->setHref('/subscriptions/add/'.$object->getPHID().'/')
|
->setHref('/subscriptions/add/'.$object->getPHID().'/')
|
||||||
->setName(phutil_escape_html('Subscribe'))
|
->setName('Subscribe')
|
||||||
->setIcon('subscribe-add');
|
->setIcon('subscribe-add');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ abstract class PhabricatorApplicationTransaction
|
||||||
if ($this->renderingTarget == self::TARGET_HTML) {
|
if ($this->renderingTarget == self::TARGET_HTML) {
|
||||||
return $this->getHandle($phid)->renderLink();
|
return $this->getHandle($phid)->renderLink();
|
||||||
} else {
|
} else {
|
||||||
return $this->getHandle($phid)->getName();
|
return hsprintf('%s', $this->getHandle($phid)->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ abstract class PhabricatorApplicationTransaction
|
||||||
foreach ($phids as $phid) {
|
foreach ($phids as $phid) {
|
||||||
$links[] = $this->renderHandleLink($phid);
|
$links[] = $this->renderHandleLink($phid);
|
||||||
}
|
}
|
||||||
return phutil_safe_html(implode(', ', $links));
|
return phutil_implode_html(', ', $links);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIcon() {
|
public function getIcon() {
|
||||||
|
@ -218,16 +218,16 @@ abstract class PhabricatorApplicationTransaction
|
||||||
'%s changed the visibility of this %s from "%s" to "%s".',
|
'%s changed the visibility of this %s from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->getApplicationObjectTypeName(),
|
$this->getApplicationObjectTypeName(),
|
||||||
phutil_escape_html($old),
|
$old,
|
||||||
phutil_escape_html($new));
|
$new);
|
||||||
case PhabricatorTransactions::TYPE_EDIT_POLICY:
|
case PhabricatorTransactions::TYPE_EDIT_POLICY:
|
||||||
// TODO: Render human-readable.
|
// TODO: Render human-readable.
|
||||||
return pht(
|
return pht(
|
||||||
'%s changed the edit policy of this %s from "%s" to "%s".',
|
'%s changed the edit policy of this %s from "%s" to "%s".',
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->getApplicationObjectTypeName(),
|
$this->getApplicationObjectTypeName(),
|
||||||
phutil_escape_html($old),
|
$old,
|
||||||
phutil_escape_html($new));
|
$new);
|
||||||
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
|
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
|
||||||
$add = array_diff($new, $old);
|
$add = array_diff($new, $old);
|
||||||
$rem = array_diff($old, $new);
|
$rem = array_diff($old, $new);
|
||||||
|
|
|
@ -38,7 +38,7 @@ final class PhabricatorSourceCodeView extends AphrontView {
|
||||||
),
|
),
|
||||||
pht('...'));
|
pht('...'));
|
||||||
} else {
|
} else {
|
||||||
$content_number = phutil_escape_html($line_number);
|
$content_number = $line_number;
|
||||||
$content_line = "\xE2\x80\x8B".$line;
|
$content_line = "\xE2\x80\x8B".$line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue