diff --git a/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php b/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php index b00c08e6a1..9f96fd070a 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php @@ -79,8 +79,7 @@ final class PhabricatorCalendarViewStatusController ->setBarColor($color) ->addAttribute(pht('From %s to %s', $from, $to)) ->addAttribute( - phutil_escape_html( - phutil_utf8_shorten($status->getDescription(), 64))); + phutil_utf8_shorten($status->getDescription(), 64)); $list->addItem($item); } diff --git a/src/applications/config/controller/PhabricatorConfigListController.php b/src/applications/config/controller/PhabricatorConfigListController.php index 1561531f42..2cf891626a 100644 --- a/src/applications/config/controller/PhabricatorConfigListController.php +++ b/src/applications/config/controller/PhabricatorConfigListController.php @@ -52,7 +52,7 @@ final class PhabricatorConfigListController $item = id(new PhabricatorObjectItemView()) ->setHeader($group->getName()) ->setHref('/config/group/'.$group->getKey().'/') - ->addAttribute(phutil_escape_html($group->getDescription())); + ->addAttribute($group->getDescription()); $list->addItem($item); } diff --git a/src/applications/drydock/controller/DrydockController.php b/src/applications/drydock/controller/DrydockController.php index e05c1f6839..9b55ff5f01 100644 --- a/src/applications/drydock/controller/DrydockController.php +++ b/src/applications/drydock/controller/DrydockController.php @@ -105,7 +105,7 @@ abstract class DrydockController extends PhabricatorController { } $status = DrydockLeaseStatus::getNameForStatus($lease->getStatus()); - $item->addAttribute(phutil_escape_html($status)); + $item->addAttribute($status); $date_created = phabricator_date($lease->getDateCreated(), $user); $item->addAttribute(pht('Created on %s', $date_created)); diff --git a/src/applications/meta/controller/PhabricatorApplicationsListController.php b/src/applications/meta/controller/PhabricatorApplicationsListController.php index 3ef64b24bd..0b70056699 100644 --- a/src/applications/meta/controller/PhabricatorApplicationsListController.php +++ b/src/applications/meta/controller/PhabricatorApplicationsListController.php @@ -51,8 +51,7 @@ final class PhabricatorApplicationsListController $item = id(new PhabricatorObjectItemView()) ->setHeader($application->getName()) ->setHref('/applications/view/'.get_class($application).'/') - ->addAttribute( - phutil_escape_html($application->getShortDescription())); + ->addAttribute($application->getShortDescription()); $list->addItem($item); } return $list; diff --git a/src/applications/paste/controller/PhabricatorPasteListController.php b/src/applications/paste/controller/PhabricatorPasteListController.php index 32194daed1..6e38715507 100644 --- a/src/applications/paste/controller/PhabricatorPasteListController.php +++ b/src/applications/paste/controller/PhabricatorPasteListController.php @@ -85,7 +85,8 @@ final class PhabricatorPasteListController extends PhabricatorPasteController { $created = phabricator_date($paste->getDateCreated(), $user); $author = $this->getHandle($paste->getAuthorPHID())->renderLink(); $source_code = $this->buildSourceCodeView($paste, 5)->render(); - $source_code = phutil_render_tag( + + $source_code = phutil_tag( 'div', array( 'class' => 'phabricator-source-code-summary', diff --git a/src/applications/ponder/view/PonderUserProfileView.php b/src/applications/ponder/view/PonderUserProfileView.php index a05796c0b8..ad9e8033cf 100644 --- a/src/applications/ponder/view/PonderUserProfileView.php +++ b/src/applications/ponder/view/PonderUserProfileView.php @@ -84,7 +84,7 @@ final class PonderUserProfileView extends AphrontView { array( 'href' => '/Q'.$question->getID(), ), - phutil_escape_html(self::abbreviate($question->getTitle()))))); + self::abbreviate($question->getTitle())))); $view->addItem($item); } diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php index 4df6da5417..e1bf757429 100644 --- a/src/view/AphrontView.php +++ b/src/view/AphrontView.php @@ -36,6 +36,14 @@ abstract class AphrontView extends Phobject { return implode('', $out); } + final protected function renderHTMLChildren() { + $out = array(); + foreach ($this->children as $child) { + $out[] = $this->renderHTMLView($child); + } + return $out; + } + final protected function renderSingleView($child) { if ($child instanceof AphrontView) { return $child->render(); diff --git a/src/view/layout/PhabricatorObjectItemListView.php b/src/view/layout/PhabricatorObjectItemListView.php index 0059f136ff..76b9c7655f 100644 --- a/src/view/layout/PhabricatorObjectItemListView.php +++ b/src/view/layout/PhabricatorObjectItemListView.php @@ -48,7 +48,7 @@ final class PhabricatorObjectItemListView extends AphrontView { } if ($this->items) { - $items = $this->renderSingleView($this->items); + $items = $this->renderHTMLView($this->items); } else { $string = nonempty($this->noDataString, pht('No data.')); $items = id(new AphrontErrorView()) @@ -59,7 +59,7 @@ final class PhabricatorObjectItemListView extends AphrontView { $pager = null; if ($this->pager) { - $pager = $this->renderSingleView($this->pager); + $pager = $this->renderHTMLView($this->pager); } $classes[] = 'phabricator-object-item-list-view'; @@ -67,12 +67,17 @@ final class PhabricatorObjectItemListView extends AphrontView { $classes[] = 'phabricator-object-list-stackable'; } - return phutil_render_tag( + return phutil_tag( 'ul', array( 'class' => implode(' ', $classes), ), - $header.$items.$pager); + $this->renderHTMLView( + array( + $header, + $items, + $pager, + ))); } } diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index fe8940320e..c6646f2f9e 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -127,12 +127,15 @@ final class PhabricatorObjectItemView extends AphrontView { "\xC2\xB7"); $first = true; foreach ($this->attributes as $attribute) { - $attrs[] = phutil_render_tag( + $attrs[] = phutil_tag( 'li', array( 'class' => 'phabricator-object-item-attribute', ), - ($first ? null : $spacer).$attribute); + array( + ($first ? null : $spacer), + $attribute, + )); $first = false; } $attrs = phutil_tag( @@ -158,12 +161,17 @@ final class PhabricatorObjectItemView extends AphrontView { throw new Exception("Invalid effect!"); } - $content = phutil_render_tag( + $content = phutil_tag( 'div', array( 'class' => 'phabricator-object-item-content', ), - $header.$attrs.$this->renderChildren()); + $this->renderHTMLView( + array( + $header, + $attrs, + $this->renderHTMLChildren(), + ))); return phutil_tag( 'li',