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

Merge renderSingleView() and renderHTMLView()

Summary: They are same because render() returns safe HTML and raw strings are automatically escaped.

Test Plan: None.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4909
This commit is contained in:
vrana 2013-02-11 14:43:25 -08:00
parent c9ab1fe505
commit ae4e5807d6
27 changed files with 41 additions and 57 deletions

View file

@ -114,7 +114,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
array(
'class' => 'setup-issue',
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$name,
$description,
@ -187,7 +187,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
array(
'class' => 'setup-issue-config',
),
self::renderHTMLView(
self::renderSingleView(
array(
$table_info,
$table,
@ -293,7 +293,7 @@ final class PhabricatorSetupIssueView extends AphrontView {
array(
'class' => 'setup-issue-config',
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$table_info,
$table,

View file

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

View file

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

View file

@ -92,7 +92,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
'class' => $class,
'id' => $id,
),
$this->renderHTMLView(
$this->renderSingleView(
array(
id(new PhabricatorAnchorView())
->setAnchorName($changeset->getAnchorName())

View file

@ -187,7 +187,7 @@ final class DifferentialChangesetListView extends AphrontView {
));
}
return $this->renderHTMLView(
return $this->renderSingleView(
array(
id(new PhabricatorHeaderView())
->setHeader($this->getTitle())

View file

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

View file

@ -45,7 +45,7 @@ final class ManiphestTaskListView extends ManiphestView {
$views[] = $view->render();
}
return $this->renderHTMLView($views);
return $this->renderSingleView($views);
}
}

View file

@ -52,7 +52,7 @@ final class ManiphestTaskProjectsView extends ManiphestView {
"\xE2\x80\xA6");
}
return $this->renderHTMLView($tags);
return $this->renderSingleView($tags);
}
}

View file

@ -128,13 +128,13 @@ final class PhabricatorApplicationLaunchView extends AphrontView {
'href' => $application ? $application->getBaseURI() : null,
'title' => $application ? $application->getShortDescription() : null,
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$icon,
$content,
)));
return $this->renderHTMLView(
return $this->renderSingleView(
array(
$app_button,
$create_button,

View file

@ -81,6 +81,6 @@ final class PholioMockImagesView extends AphrontView {
$thumbnails);
}
return $this->renderHTMLView($mockview);
return $this->renderSingleView($mockview);
}
}

View file

@ -128,7 +128,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
'id' => $this->getPreviewPanelID(),
'style' => 'display: none',
),
self::renderHTMLView(
self::renderSingleView(
array(
$header,
$preview,

View file

@ -125,12 +125,12 @@ return `phutil_tag()` or `javelin_tag()`:
return phutil_tag('div', ...);
@{class:AphrontView} subclasses can use `renderHTMLChildren()` and
`renderHTMLView()` to build @{class@libphutil:PhutilSafeHTML} objects from
`renderSingleView()` to build @{class@libphutil:PhutilSafeHTML} objects from
children or arbitrary lists of components.
@{class:AphrontView} subclasses should avoid `renderChildren()` and
`renderSingleView()` and transition callers to the `HTML` varieties. These older
methods do not return @{class@libphutil:PhutilSafeHTML} objects.
@{class:AphrontView} subclasses should avoid `renderChildren()` and transition
callers to `renderHTMLChildren()`. This older method does not return
@{class@libphutil:PhutilSafeHTML} objects.
= Internationalization: pht() =

View file

@ -39,7 +39,7 @@ abstract class AphrontView extends Phobject {
final protected function renderHTMLChildren() {
$out = array();
foreach ($this->children as $child) {
$out[] = $this->renderHTMLView($child);
$out[] = $this->renderSingleView($child);
}
return $out;
}
@ -58,22 +58,6 @@ abstract class AphrontView extends Phobject {
}
}
final protected function renderHTMLView($child) {
if ($child instanceof AphrontView) {
return $child->render();
} else if ($child instanceof PhutilSafeHTML) {
return $child;
} else if (is_array($child)) {
$out = array();
foreach ($child as $element) {
$out[] = $this->renderHTMLView($element);
}
return phutil_implode_html('', $out);
} else {
return hsprintf('%s', $child);
}
}
final protected function isEmptyContent($content) {
if (is_array($content)) {
foreach ($content as $element) {

View file

@ -154,7 +154,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl {
array(
'sigil' => 'remarkup-assist-control',
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$buttons,
parent::renderInput(),

View file

@ -231,7 +231,7 @@ final class AphrontSideNavFilterView extends AphrontView {
),
'');
$local_menu = $this->renderHTMLView(
$local_menu = $this->renderSingleView(
array(
$menu_background,
phutil_tag(

View file

@ -42,7 +42,7 @@ final class PhabricatorActionListView extends AphrontView {
array(
'class' => 'phabricator-action-list-view',
),
$this->renderHTMLView($actions));
$this->renderSingleView($actions));
}

View file

@ -39,7 +39,7 @@ final class PhabricatorAnchorView extends AphrontView {
),
'');
return $this->renderHTMLView(array($marker, $anchor));
return $this->renderSingleView(array($marker, $anchor));
}
}

View file

@ -55,7 +55,7 @@ final class PhabricatorCrumbsView extends AphrontView {
array(
'class' => 'phabricator-crumbs-actions',
),
$this->renderHTMLView($actions));
$this->renderSingleView($actions));
}
if ($this->crumbs) {
@ -68,7 +68,7 @@ final class PhabricatorCrumbsView extends AphrontView {
'class' => 'phabricator-crumbs-view '.
'sprite-gradient gradient-breadcrumbs',
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$action_view,
$this->crumbs,

View file

@ -44,7 +44,7 @@ final class PhabricatorHeaderView extends AphrontView {
array(
'class' => 'phabricator-header-tags',
),
$this->renderHTMLView($this->tags));
$this->renderSingleView($this->tags));
}
return phutil_tag(

View file

@ -117,7 +117,7 @@ final class PhabricatorMenuItemView extends AphrontTagView {
$this->name.$external);
}
return $this->renderHTMLView(
return $this->renderSingleView(
array(
$this->renderHTMLChildren(),
$name,

View file

@ -167,6 +167,6 @@ final class PhabricatorMenuView extends AphrontTagView {
}
protected function getTagContent() {
return $this->renderHTMLView($this->items);
return $this->renderSingleView($this->items);
}
}

View file

@ -48,7 +48,7 @@ final class PhabricatorObjectItemListView extends AphrontView {
}
if ($this->items) {
$items = $this->renderHTMLView($this->items);
$items = $this->renderSingleView($this->items);
} else {
$string = nonempty($this->noDataString, pht('No data.'));
$items = id(new AphrontErrorView())
@ -58,7 +58,7 @@ final class PhabricatorObjectItemListView extends AphrontView {
$pager = null;
if ($this->pager) {
$pager = $this->renderHTMLView($this->pager);
$pager = $this->renderSingleView($this->pager);
}
$classes[] = 'phabricator-object-item-list-view';
@ -71,7 +71,7 @@ final class PhabricatorObjectItemListView extends AphrontView {
array(
'class' => implode(' ', $classes),
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$header,
$items,

View file

@ -166,7 +166,7 @@ final class PhabricatorObjectItemView extends AphrontView {
array(
'class' => 'phabricator-object-item-content',
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$header,
$attrs,

View file

@ -70,7 +70,7 @@ final class PhabricatorPinboardItemView extends AphrontView {
array(
'class' => 'phabricator-pinboard-item-view',
),
$this->renderHTMLView(
$this->renderSingleView(
array(
$header,
$image,

View file

@ -31,7 +31,7 @@ final class PhabricatorPinboardView extends AphrontView {
array(
'class' => 'phabricator-pinboard-view',
),
$this->renderHTMLView($this->items));
$this->renderSingleView($this->items));
}
}

View file

@ -78,7 +78,7 @@ final class PhabricatorPropertyListView extends AphrontView {
array(
'class' => 'phabricator-property-list-view',
),
$this->renderHTMLView($items));
$this->renderSingleView($items));
}
private function renderPropertyPart(array $part) {
@ -99,7 +99,7 @@ final class PhabricatorPropertyListView extends AphrontView {
array(
'class' => 'phabricator-property-list-value',
),
$this->renderHTMLView($value));
$this->renderSingleView($value));
}
$list = phutil_tag(
@ -107,7 +107,7 @@ final class PhabricatorPropertyListView extends AphrontView {
array(
'class' => 'phabricator-property-list-properties',
),
$this->renderHTMLView($items));
$this->renderSingleView($items));
$shortcuts = null;
if ($this->hasKeyboardShortcuts) {

View file

@ -138,7 +138,7 @@ final class PhabricatorTimelineEventView extends AphrontView {
),
array($title, $extra));
$title = $this->renderHTMLView(array($icon, $title));
$title = $this->renderSingleView(array($icon, $title));
}
$wedge = phutil_tag(
@ -275,7 +275,7 @@ final class PhabricatorTimelineEventView extends AphrontView {
->setAnchorName($this->anchor)
->render();
$date = $this->renderHTMLView(
$date = $this->renderSingleView(
array(
$anchor,
phutil_tag(