diff --git a/src/aphront/response/Aphront403Response.php b/src/aphront/response/Aphront403Response.php index 350c0e3a38..33103ae197 100644 --- a/src/aphront/response/Aphront403Response.php +++ b/src/aphront/response/Aphront403Response.php @@ -26,7 +26,7 @@ final class Aphront403Response extends AphrontHTMLResponse { } $failure = new AphrontRequestFailureView(); $failure->setHeader('403 Forbidden'); - $failure->appendChild('

'.$forbidden_text.'

'); + $failure->appendChild(phutil_tag('p', array(), $forbidden_text)); $view = new PhabricatorStandardPageView(); $view->setTitle('403 Forbidden'); diff --git a/src/aphront/response/Aphront404Response.php b/src/aphront/response/Aphront404Response.php index 2821012fc4..fbfa41a0da 100644 --- a/src/aphront/response/Aphront404Response.php +++ b/src/aphront/response/Aphront404Response.php @@ -12,7 +12,8 @@ final class Aphront404Response extends AphrontHTMLResponse { public function buildResponseString() { $failure = new AphrontRequestFailureView(); $failure->setHeader('404 Not Found'); - $failure->appendChild('

The page you requested was not found.

'); + $failure->appendChild(phutil_tag('p', array(), pht( + 'The page you requested was not found.'))); $view = new PhabricatorStandardPageView(); $view->setTitle('404 Not Found'); diff --git a/src/applications/auth/controller/PhabricatorDisabledUserController.php b/src/applications/auth/controller/PhabricatorDisabledUserController.php index dcd1e36abc..364a9a61ec 100644 --- a/src/applications/auth/controller/PhabricatorDisabledUserController.php +++ b/src/applications/auth/controller/PhabricatorDisabledUserController.php @@ -16,8 +16,8 @@ final class PhabricatorDisabledUserController $failure_view = new AphrontRequestFailureView(); $failure_view->setHeader(pht('Account Disabled')); - $failure_view->appendChild( - '

'.pht('Your account has been disabled.').'

'); + $failure_view->appendChild(phutil_tag('p', array(), pht( + 'Your account has been disabled.'))); return $this->buildStandardPageResponse( $failure_view, diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php index e6cc6372df..52f2827b91 100644 --- a/src/applications/auth/controller/PhabricatorEmailLoginController.php +++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php @@ -98,10 +98,8 @@ EOBODY; $view = new AphrontRequestFailureView(); $view->setHeader(pht('Check Your Email')); - $view->appendChild( - '

'.pht( - 'An email has been sent with a link you can use to login.' - ).'

'); + $view->appendChild(phutil_tag('p', array(), pht( + 'An email has been sent with a link you can use to login.'))); return $this->buildStandardPageResponse( $view, array( diff --git a/src/applications/auth/controller/PhabricatorEmailTokenController.php b/src/applications/auth/controller/PhabricatorEmailTokenController.php index 855caa37af..16a828f7de 100644 --- a/src/applications/auth/controller/PhabricatorEmailTokenController.php +++ b/src/applications/auth/controller/PhabricatorEmailTokenController.php @@ -50,17 +50,16 @@ final class PhabricatorEmailTokenController $view = new AphrontRequestFailureView(); $view->setHeader(pht('Unable to Login')); - $view->appendChild( - '

'.pht('The authentication information in the link you clicked is '. + $view->appendChild(phutil_tag('p', array(), pht( + 'The authentication information in the link you clicked is '. 'invalid or out of date. Make sure you are copy-and-pasting the '. 'entire link into your browser. You can try again, or request '. - 'a new email.').'

'); - $view->appendChild( + 'a new email.'))); + $view->appendChild(hsprintf( '
'. - ''. - pht('Send Another Email'). - ''. - '
'); + '%s'. + '', + pht('Send Another Email'))); return $this->buildStandardPageResponse( $view, diff --git a/src/applications/auth/controller/PhabricatorLoginValidateController.php b/src/applications/auth/controller/PhabricatorLoginValidateController.php index a365618bd8..6ebef14e60 100644 --- a/src/applications/auth/controller/PhabricatorLoginValidateController.php +++ b/src/applications/auth/controller/PhabricatorLoginValidateController.php @@ -49,14 +49,16 @@ final class PhabricatorLoginValidateController $view = new AphrontRequestFailureView(); $view->setHeader(pht('Login Failed')); - $view->appendChild( - '

'.pht('Login failed:').'

'. - $list. - '

'.pht('Clear your cookies and try again.').'

'); - $view->appendChild( + $view->appendChild(hsprintf( + '

%s

%s

%s

', + pht('Login failed:'), + $list, + pht('Clear your cookies and try again.'))); + $view->appendChild(hsprintf( '
'. - ''.pht('Try Again').''. - '
'); + '%s'. + '', + pht('Try Again'))); return $this->buildStandardPageResponse( $view, array( diff --git a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php index b08f7432cc..67a253b406 100644 --- a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php +++ b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php @@ -41,31 +41,26 @@ final class PhabricatorMustVerifyEmailController $error_view = new AphrontRequestFailureView(); $error_view->setHeader(pht('Check Your Email')); - $error_view->appendChild( - '

'. - pht('You must verify your email address to login. You should have a new '. + $error_view->appendChild(phutil_tag('p', array(), pht( + 'You must verify your email address to login. You should have a new '. 'email message from Phabricator with verification instructions in your '. - 'inbox (%s).', phutil_tag('strong', array(), $email_address)). - '

'); - $error_view->appendChild( - '

'. - pht('If you did not receive an email, you can click the button below '. - 'to try sending another one.'). - '

'); - $error_view->appendChild( - '
'. - phabricator_form( - $user, + 'inbox (%s).', phutil_tag('strong', array(), $email_address)))); + $error_view->appendChild(phutil_tag('p', array(), pht( + 'If you did not receive an email, you can click the button below '. + 'to try sending another one.'))); + $error_view->appendChild(hsprintf( + '
%s
', + phabricator_form( + $user, + array( + 'action' => '/login/mustverify/', + 'method' => 'POST', + ), + phutil_tag( + 'button', array( - 'action' => '/login/mustverify/', - 'method' => 'POST', ), - phutil_tag( - 'button', - array( - ), - pht('Send Another Email'))). - '
'); + pht('Send Another Email'))))); return $this->buildApplicationPage( diff --git a/src/applications/auth/view/PhabricatorOAuthFailureView.php b/src/applications/auth/view/PhabricatorOAuthFailureView.php index a1e4549745..97b3447b9b 100644 --- a/src/applications/auth/view/PhabricatorOAuthFailureView.php +++ b/src/applications/auth/view/PhabricatorOAuthFailureView.php @@ -77,11 +77,12 @@ final class PhabricatorOAuthFailureView extends AphrontView { $provider_name); } - $view->appendChild( + $view->appendChild(hsprintf( '
'. - $diagnose. - ''.pht('Continue').''. - '
'); + '%s%s'. + '', + $diagnose, + pht('Continue'))); return $view->render(); } diff --git a/src/applications/calendar/view/AphrontCalendarMonthView.php b/src/applications/calendar/view/AphrontCalendarMonthView.php index c482204405..540ffba176 100644 --- a/src/applications/calendar/view/AphrontCalendarMonthView.php +++ b/src/applications/calendar/view/AphrontCalendarMonthView.php @@ -48,9 +48,10 @@ final class AphrontCalendarMonthView extends AphrontView { $markup = array(); - $empty_box = - '
'. - '
'; + $empty_box = phutil_tag( + 'div', + array('class' => 'aphront-calendar-day aphront-calendar-empty'), + ''); for ($ii = 0; $ii < $empty; $ii++) { $markup[] = $empty_box; @@ -79,9 +80,10 @@ final class AphrontCalendarMonthView extends AphrontView { } else { $show_events = array_fill_keys( array_keys($show_events), - '
'. - ' '. - '
'); + hsprintf( + '
'. + ' '. + '
')); } foreach ($events as $event) { @@ -110,31 +112,32 @@ final class AphrontCalendarMonthView extends AphrontView { $name); } - $markup[] = - '
'. - '
'. - $day_number. - '
'. - $holiday_markup. - implode("\n", $show_events). - '
'; + $markup[] = hsprintf( + '
'. + '
%s
'. + '%s%s'. + '
', + $class, + $day_number, + $holiday_markup, + phutil_implode_html("\n", $show_events)); } $table = array(); $rows = array_chunk($markup, 7); foreach ($rows as $row) { - $table[] = ''; + $table[] = hsprintf(''); while (count($row) < 7) { $row[] = $empty_box; } foreach ($row as $cell) { - $table[] = ''.$cell.''; + $table[] = phutil_tag('p', array(), $cell); } - $table[] = ''; + $table[] = hsprintf(''); } - $table = + $table = hsprintf( ''. - $this->renderCalendarHeader($first). + '%s'. ''. ''. ''. @@ -144,8 +147,10 @@ final class AphrontCalendarMonthView extends AphrontView { ''. ''. ''. - implode("\n", $table). - '
SunMonFriSat
'; + '%s'. + '', + $this->renderCalendarHeader($first), + phutil_implode_html("\n", $table)); return $table; } @@ -176,16 +181,15 @@ final class AphrontCalendarMonthView extends AphrontView { "\xE2\x86\x92" ); - $left_th = ''.$prev_link.''; - $right_th = ''.$next_link.''; + $left_th = phutil_tag('th', array(), $prev_link); + $right_th = phutil_tag('th', array(), $next_link); } - return - ''. - $left_th. - ''.$date->format('F Y').''. - $right_th. - ''; + return hsprintf( + '%s%s%s', + $left_th, + phutil_tag('th', array('colspan' => $colspan), $date->format('F Y')), + $right_th); } private function getNextYearAndMonth() { diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 1e572ab334..546a173607 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -386,14 +386,15 @@ final class DifferentialRevisionViewController extends DifferentialController { $page_pane = id(new DifferentialPrimaryPaneView()) ->setID($pane_id) - ->appendChild( - $comment_view->render(). - $diff_history->render(). - $warning. - $local_view->render(). - $toc_view->render(). - $other_view. - $changeset_view->render()); + ->appendChild(array( + $comment_view->render(), + $diff_history->render(), + $warning, + $local_view->render(), + $toc_view->render(), + $other_view, + $changeset_view->render(), + )); if ($comment_form) { $page_pane->appendChild($comment_form->render()); } @@ -857,13 +858,12 @@ final class DifferentialRevisionViewController extends DifferentialController { $handles = $this->loadViewerHandles($phids); $view->setHandles($handles); - return + return hsprintf( + '%s
%s
', id(new PhabricatorHeaderView()) ->setHeader(pht('Open Revisions Affecting These Files')) - ->render(). - '
'. - $view->render(). - '
'; + ->render(), + $view->render()); } /** diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index fc980608c4..63de1f17fd 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -128,12 +128,12 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { $pchar = ($changeset->getOldProperties() === $changeset->getNewProperties()) ? null - : 'M'; + : hsprintf('M', pht('Properties Changed')); $fname = $changeset->getFilename(); $cov = $this->renderCoverage($coverage, $fname); if ($cov === null) { - $mcov = $cov = '-'; + $mcov = $cov = phutil_tag('em', array(), '-'); } else { $mcov = phutil_tag( 'div', @@ -144,21 +144,21 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { (isset($this->visibleChangesets[$id]) ? 'Loading...' : '?')); } - $rows[] = - ''. - phutil_tag( - 'td', - array( - 'class' => 'differential-toc-char', - 'title' => $chartitle, - ), - $char). - ''.$pchar.''. - ''.$desc.''. - ''.$link.$lines.''. - ''.$cov.''. - ''.$mcov.''. - ''; + $rows[] = hsprintf( + ''. + '%s'. + '%s'. + '%s'. + '%s%s'. + '%s'. + '%s'. + '', + $chartitle, $char, + $pchar, + $desc, + $link, $lines, + $cov, + $mcov); if ($meta) { $rows[] = hsprintf( ''. @@ -200,19 +200,13 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { ), pht('Show All Context')); - $buttons = - ''. - $editor_link.$reveal_link. - ''; + $buttons = hsprintf( + '%s%s', + $editor_link, + $reveal_link); - return - id(new PhabricatorAnchorView()) - ->setAnchorName('toc') - ->setNavigationMarker(true) - ->render(). - id(new PhabricatorHeaderView()) - ->setHeader(pht('Table of Contents')) - ->render(). + return hsprintf( + '%s%s'. '
'. ''. ''. @@ -220,17 +214,23 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { ''. ''. ''. - ''. - ''. + ''. + ''. ''. - implode("\n", $rows). - $buttons. + '%s%s'. '
Path'. - pht('Coverage (All)'). - ''. - pht('Coverage (Touched)'). - '%s%s
'. - '
'; + '', + id(new PhabricatorAnchorView()) + ->setAnchorName('toc') + ->setNavigationMarker(true) + ->render(), + id(new PhabricatorHeaderView()) + ->setHeader(pht('Table of Contents')) + ->render(), + pht('Coverage (All)'), + pht('Coverage (Touched)'), + phutil_implode_html("\n", $rows), + $buttons); } private function renderCoverage(array $coverage, $file) { diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php index 2d9b33391f..dfb58dd3a8 100644 --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -114,29 +114,31 @@ final class DifferentialLocalCommitsView extends AphrontView { $headers = array(); - $headers[] = ''.pht('Commit').''; + $headers[] = phutil_tag('th', array(), pht('Commit')); if ($has_tree) { - $headers[] = ''.pht('Tree').''; + $headers[] = phutil_tag('th', array(), pht('Tree')); } if ($has_local) { - $headers[] = ''.pht('Local').''; + $headers[] = phutil_tag('th', array(), pht('Local')); } - $headers[] = ''.pht('Parents').''; - $headers[] = ''.pht('Author').''; - $headers[] = ''.pht('Summary').''; - $headers[] = ''.pht('Date').''; + $headers[] = phutil_tag('th', array(), pht('Parents')); + $headers[] = phutil_tag('th', array(), pht('Author')); + $headers[] = phutil_tag('th', array(), pht('Summary')); + $headers[] = phutil_tag('th', array(), pht('Date')); - $headers = ''.implode('', $headers).''; + $headers = phutil_tag('tr', array(), $headers); - return - id(new PhabricatorHeaderView()) - ->setHeader(pht('Local Commits')) - ->render(). + $header = id(new PhabricatorHeaderView()) + ->setHeader(pht('Local Commits')) + ->render(); + + return hsprintf( + '%s'. '
'. - ''. - $headers. - implode("\n", $rows). - '
'. - '
'; + '%s%s
'. + '', + $header, + $headers, + phutil_implode_html("\n", $rows)); } } diff --git a/src/applications/differential/view/DifferentialPrimaryPaneView.php b/src/applications/differential/view/DifferentialPrimaryPaneView.php index 11b8e33241..8e1e8602ef 100644 --- a/src/applications/differential/view/DifferentialPrimaryPaneView.php +++ b/src/applications/differential/view/DifferentialPrimaryPaneView.php @@ -11,13 +11,13 @@ final class DifferentialPrimaryPaneView extends AphrontView { public function render() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'differential-primary-pane', 'id' => $this->id, ), - $this->renderChildren()); + $this->renderHTMLChildren()); } } diff --git a/src/applications/differential/view/DifferentialRevisionCommentListView.php b/src/applications/differential/view/DifferentialRevisionCommentListView.php index 211f08d42a..86d0c76bfa 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentListView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentListView.php @@ -187,14 +187,12 @@ final class DifferentialRevisionCommentListView extends AphrontView { $hidden = null; } - return javelin_render_tag( + return javelin_tag( 'div', array( 'class' => 'differential-comment-list', 'id' => $this->getID(), ), - implode("\n", $header). - $hidden. - implode("\n", $visible)); + array_merge($header, array($hidden), $visible)); } } diff --git a/src/applications/differential/view/DifferentialRevisionDetailView.php b/src/applications/differential/view/DifferentialRevisionDetailView.php index 75fe45bfaf..07c1d60927 100644 --- a/src/applications/differential/view/DifferentialRevisionDetailView.php +++ b/src/applications/differential/view/DifferentialRevisionDetailView.php @@ -87,7 +87,11 @@ final class DifferentialRevisionDetailView extends AphrontView { } $properties->setHasKeyboardShortcuts(true); - return $header->render() . $actions->render() . $properties->render(); + return hsprintf( + '%s%s%s', + $header->render(), + $actions->render(), + $properties->render()); } private function renderHeader(DifferentialRevision $revision) { diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index 45f3de6c0b..308019c984 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -177,9 +177,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { DifferentialChangesetParser::WHITESPACE_SHOW_ALL => 'Show All', ); - $select = ''; + $select = phutil_tag('select', array('name' => 'whitespace'), $options); - return - id(new PhabricatorHeaderView()) - ->setHeader(pht('Revision Update History')) - ->render() . + array_unshift($rows, phutil_tag('tr', array(), array( + phutil_tag('th', array(), pht('Diff')), + phutil_tag('th', array(), pht('ID')), + phutil_tag('th', array(), pht('Base')), + phutil_tag('th', array(), pht('Description')), + phutil_tag('th', array(), pht('Created')), + phutil_tag('th', array(), pht('Lint')), + phutil_tag('th', array(), pht('Unit')), + ))); + + return hsprintf( + '%s'. '
'. '
'. ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - implode("\n", $rows). + '%s'. ''. ''. ''. '
'.pht('Diff').''.pht('ID').''.pht('Base').''.pht('Description').''.pht('Created').''.pht('Lint').''.pht('Unit').'
'. - ''. - ''. + ''. + ''. '
'. '
'. - '
'; + '', + id(new PhabricatorHeaderView()) + ->setHeader(pht('Revision Update History')) + ->render(), + phutil_implode_html("\n", $rows), + pht('Whitespace Changes: %s', $select), + pht('Show Diff')); } const STAR_NONE = 'none'; diff --git a/src/applications/diffusion/view/DiffusionCommentListView.php b/src/applications/diffusion/view/DiffusionCommentListView.php index bbec8ed0fd..fcbbb35791 100644 --- a/src/applications/diffusion/view/DiffusionCommentListView.php +++ b/src/applications/diffusion/view/DiffusionCommentListView.php @@ -87,10 +87,10 @@ final class DiffusionCommentListView extends AphrontView { ++$num; } - return - '
'. - $this->renderSingleView($comments). - '
'; + return phutil_tag( + 'div', + array('class' => 'diffusion-comment-list'), + $comments); } } diff --git a/src/applications/feed/builder/PhabricatorFeedBuilder.php b/src/applications/feed/builder/PhabricatorFeedBuilder.php index dfb9751cf8..9803fd51e1 100644 --- a/src/applications/feed/builder/PhabricatorFeedBuilder.php +++ b/src/applications/feed/builder/PhabricatorFeedBuilder.php @@ -40,8 +40,8 @@ final class PhabricatorFeedBuilder { if ($date !== $last_date) { if ($last_date !== null) { - $null_view->appendChild( - '
'); + $null_view->appendChild(hsprintf( + '
')); } $last_date = $date; $null_view->appendChild( @@ -59,10 +59,9 @@ final class PhabricatorFeedBuilder { $null_view->appendChild($view); } - return id(new AphrontNullView())->appendChild( - '
'. - $null_view->render(). - '
'); + return id(new AphrontNullView())->appendChild(hsprintf( + '
%s
', + $null_view->render())); } } diff --git a/src/applications/feed/view/PhabricatorFeedStoryView.php b/src/applications/feed/view/PhabricatorFeedStoryView.php index 9900b5e9a7..468ce0c802 100644 --- a/src/applications/feed/view/PhabricatorFeedStoryView.php +++ b/src/applications/feed/view/PhabricatorFeedStoryView.php @@ -58,7 +58,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { $classes[] = 'phabricator-notification-unread'; } - return javelin_render_tag( + return javelin_tag( 'div', array( 'class' => implode(' ', $classes), @@ -67,29 +67,29 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { 'href' => $this->getHref(), ), ), - $this->title); + phutil_safe_html($this->title)); } public function render() { - $head = phutil_render_tag( + $head = phutil_tag( 'div', array( 'class' => 'phabricator-feed-story-head', ), - nonempty($this->title, 'Untitled Story')); + nonempty(phutil_safe_html($this->title), 'Untitled Story')); $body = null; $foot = null; $image_style = null; if (!$this->oneLine) { - $body = phutil_render_tag( + $body = phutil_tag( 'div', array( 'class' => 'phabricator-feed-story-body', ), - $this->renderChildren()); + phutil_safe_html($this->renderChildren())); if ($this->epoch) { $foot = phabricator_datetime($this->epoch, $this->user); @@ -111,7 +111,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { require_celerity_resource('phabricator-feed-css'); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => $this->oneLine diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index b4567f0ddf..63b819a767 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -88,36 +88,32 @@ final class ManiphestTaskDetailController extends ManiphestController { if ($parent_task) { $context_bar = new AphrontContextBarView(); - $context_bar->addButton( - phutil_tag( - 'a', - array( - 'href' => '/maniphest/task/create/?parent='.$parent_task->getID(), - 'class' => 'green button', - ), - 'Create Another Subtask')); - $context_bar->appendChild( - 'Created a subtask of '. - $this->getHandle($parent_task->getPHID())->renderLink(). - ''); + $context_bar->addButton(phutil_tag( + 'a', + array( + 'href' => '/maniphest/task/create/?parent='.$parent_task->getID(), + 'class' => 'green button', + ), + 'Create Another Subtask')); + $context_bar->appendChild(hsprintf( + 'Created a subtask of %s', + $this->getHandle($parent_task->getPHID())->renderLink())); } else if ($workflow == 'create') { $context_bar = new AphrontContextBarView(); - $context_bar->addButton(''); - $context_bar->addButton( - phutil_tag( - 'a', - array( - 'href' => '/maniphest/task/create/?template='.$task->getID(), - 'class' => 'green button', - ), + $context_bar->addButton(phutil_tag('label', array(), 'Create Another')); + $context_bar->addButton(phutil_tag( + 'a', + array( + 'href' => '/maniphest/task/create/?template='.$task->getID(), + 'class' => 'green button', + ), 'Similar Task')); - $context_bar->addButton( - phutil_tag( - 'a', - array( - 'href' => '/maniphest/task/create/', - 'class' => 'green button', - ), + $context_bar->addButton(phutil_tag( + 'a', + array( + 'href' => '/maniphest/task/create/', + 'class' => 'green button', + ), 'Empty Task')); $context_bar->appendChild('New task created.'); } diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 3f89a567a6..a542754590 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -298,13 +298,14 @@ final class ManiphestTaskListController extends ManiphestController { require_celerity_resource('maniphest-task-summary-css'); $list_container = new AphrontNullView(); - $list_container->appendChild('
'); + $list_container->appendChild(hsprintf( + '
')); if (!$have_tasks) { - $list_container->appendChild( + $list_container->appendChild(hsprintf( '

'. 'No matching tasks.'. - '

'); + '')); } else { $pager = new AphrontPagerView(); $pager->setURI($request->getRequestURI(), 'offset'); @@ -316,14 +317,13 @@ final class ManiphestTaskListController extends ManiphestController { $max = min($pager->getOffset() + $page_size, $total_count); $tot = $total_count; - $cur = number_format($cur); - $max = number_format($max); - $tot = number_format($tot); - - $list_container->appendChild( + $list_container->appendChild(hsprintf( '
'. - "Displaying tasks {$cur} - {$max} of {$tot}.". - '
'); + "Displaying tasks %s - %s of %s.". + '
', + number_format($cur), + number_format($max), + number_format($tot))); $selector = new AphrontNullView(); @@ -334,7 +334,7 @@ final class ManiphestTaskListController extends ManiphestController { ($group == 'none' || $group == 'priority'); $lists = new AphrontNullView(); - $lists->appendChild('
'); + $lists->appendChild(hsprintf('
')); foreach ($tasks as $group => $list) { $task_list = new ManiphestTaskListView(); $task_list->setShowBatchControls(true); @@ -367,14 +367,14 @@ final class ManiphestTaskListController extends ManiphestController { $lists->appendChild($panel); } - $lists->appendChild('
'); + $lists->appendChild(hsprintf('
')); $selector->appendChild($lists); $selector->appendChild($this->renderBatchEditor($query)); $form_id = celerity_generate_unique_node_id(); - $selector = phabricator_render_form( + $selector = phabricator_form( $user, array( 'method' => 'POST', @@ -394,7 +394,7 @@ final class ManiphestTaskListController extends ManiphestController { )); } - $list_container->appendChild('
'); + $list_container->appendChild(hsprintf('')); $nav->appendChild($list_container); $title = pht('Task List'); @@ -678,25 +678,21 @@ final class ManiphestTaskListController extends ManiphestController { ), 'Export Tasks to Excel...'); - return + return hsprintf( '
'. '
Batch Task Editor
'. ''. ''. - ''. - ''. - ''. - ''. + ''. + ''. + ''. + ''. ''. '
'. - $select_all. - $select_none. - ''. - $export. - ''. - '0 Selected Tasks'. - ''.$submit.'%s%s%s0 Selected Tasks%s
'. - ''; + '', + $select_all, $select_none, + $export, + $submit); } private function buildQueryFromRequest() { diff --git a/src/applications/maniphest/view/ManiphestTransactionDetailView.php b/src/applications/maniphest/view/ManiphestTransactionDetailView.php index 4d5afbf8ad..a4b1222a99 100644 --- a/src/applications/maniphest/view/ManiphestTransactionDetailView.php +++ b/src/applications/maniphest/view/ManiphestTransactionDetailView.php @@ -179,7 +179,7 @@ final class ManiphestTransactionDetailView extends ManiphestView { } if ($this->getRenderSummaryOnly()) { - return implode("\n", $descs); + return phutil_implode_html("\n", $descs); } if ($comment_transaction && $comment_transaction->hasComments()) { diff --git a/src/applications/maniphest/view/ManiphestTransactionListView.php b/src/applications/maniphest/view/ManiphestTransactionListView.php index 14bff880e6..9e8ccc8f08 100644 --- a/src/applications/maniphest/view/ManiphestTransactionListView.php +++ b/src/applications/maniphest/view/ManiphestTransactionListView.php @@ -102,10 +102,10 @@ final class ManiphestTransactionListView extends ManiphestView { $views[] = $view->render(); } - return - '
'. - implode("\n", $views). - '
'; + return phutil_tag( + 'div', + array('class' => 'maniphest-transaction-list-view'), + $views); } } diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index bf925650b7..6096f8b61e 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -157,7 +157,7 @@ final class PhrictionDocumentController $version_note = $version_note->render(); } - $children = $this->renderChildren($slug); + $children = $this->renderDocumentChildren($slug); $crumbs = $this->buildApplicationCrumbs(); $crumb_views = $this->renderBreadcrumbs($slug); @@ -225,7 +225,7 @@ final class PhrictionDocumentController ->setHref(PhrictionDocument::getSlugURI($slug, 'history'))); } - private function renderChildren($slug) { + private function renderDocumentChildren($slug) { $document_dao = new PhrictionDocument(); $content_dao = new PhrictionContent(); $conn = $document_dao->establishConnection('r'); diff --git a/src/applications/ponder/view/PonderAddAnswerView.php b/src/applications/ponder/view/PonderAddAnswerView.php index a4b199180c..80109f39e3 100644 --- a/src/applications/ponder/view/PonderAddAnswerView.php +++ b/src/applications/ponder/view/PonderAddAnswerView.php @@ -44,14 +44,14 @@ final class PonderAddAnswerView extends AphrontView { id(new AphrontFormSubmitControl()) ->setValue($is_serious ? 'Submit' : 'Make it so')); - $preview = + $preview = hsprintf( '
'. '
'. ''. 'Loading answer preview...'. ''. '
'. - '
'; + '
'); Javelin::initBehavior( 'ponder-feedback-preview', diff --git a/src/applications/ponder/view/PonderQuestionSummaryView.php b/src/applications/ponder/view/PonderQuestionSummaryView.php index 530267f400..8bac384084 100644 --- a/src/applications/ponder/view/PonderQuestionSummaryView.php +++ b/src/applications/ponder/view/PonderQuestionSummaryView.php @@ -43,34 +43,29 @@ final class PonderQuestionSummaryView extends AphrontView { '', $question->getAnswerCount()); - $title = - '

'. - phutil_tag( - 'a', - array( - "href" => '/Q' . $question->getID(), - ), - 'Q' . $question->getID() . - ' ' . $question->getTitle() - ) . - '

'; + $title = hsprintf('

%s

', + phutil_tag( + 'a', + array( + "href" => '/Q' . $question->getID(), + ), + 'Q' . $question->getID() . + ' ' . $question->getTitle() + )); - $rhs = + $rhs = hsprintf( '
'. - $title. - ''. - 'asked on '. - phabricator_datetime($question->getDateCreated(), $user). - ' by ' . $authorlink. - ''. - '
'; + '%s asked on %s by %s'. + '', + $title, + phabricator_datetime($question->getDateCreated(), $user), + $authorlink); - $summary = - '
'. - $votecount. - $answercount. - $rhs. - '
'; + $summary = hsprintf( + '
%s%s%s
', + $votecount, + $answercount, + $rhs); return $summary; diff --git a/src/applications/ponder/view/PonderVotableView.php b/src/applications/ponder/view/PonderVotableView.php index a00e6bee07..e94777ef91 100644 --- a/src/applications/ponder/view/PonderVotableView.php +++ b/src/applications/ponder/view/PonderVotableView.php @@ -63,7 +63,7 @@ final class PonderVotableView extends AphrontView { ), $this->count); - return javelin_render_tag( + return javelin_tag( 'div', array( 'class' => 'ponder-votable', @@ -80,12 +80,12 @@ final class PonderVotableView extends AphrontView { 'class' => 'ponder-votebox', ), array($up, $count, $down)), - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'ponder-votebox-content', ), - $this->renderChildren()), + $this->renderHTMLChildren()), )); } diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php index 821853d2aa..0a95bdff54 100644 --- a/src/applications/search/view/PhabricatorSearchResultView.php +++ b/src/applications/search/view/PhabricatorSearchResultView.php @@ -70,21 +70,25 @@ final class PhabricatorSearchResultView extends AphrontView { break; } - return + return hsprintf( '
'. - $img. + '%s'. '
'. - phutil_tag( - 'a', - array( - 'class' => 'result-name', - 'href' => $handle->getURI(), - ), - $this->emboldenQuery($object_name)). - '
'.$type_name.' · '.$link.'
'. + '%s'. + '
%s · %s
'. '
'. '
'. - '
'; + '', + $img, + phutil_tag( + 'a', + array( + 'class' => 'result-name', + 'href' => $handle->getURI(), + ), + $this->emboldenQuery($object_name)), + $type_name, + $link); } private function emboldenQuery($str) { diff --git a/src/applications/uiexample/examples/JavelinViewExampleServerView.php b/src/applications/uiexample/examples/JavelinViewExampleServerView.php index 2d59917a7c..0f996df1c3 100644 --- a/src/applications/uiexample/examples/JavelinViewExampleServerView.php +++ b/src/applications/uiexample/examples/JavelinViewExampleServerView.php @@ -8,7 +8,7 @@ final class JavelinViewExampleServerView extends AphrontView { array( 'class' => 'server-view', ), - $this->renderChildren()); + $this->renderHTMLChildren()); } } diff --git a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php index de792665fb..b7c9f61bde 100644 --- a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php +++ b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php @@ -15,7 +15,7 @@ final class PhabricatorInlineSummaryView extends AphrontView { public function render() { require_celerity_resource('inline-comment-summary-css'); - return $this->renderHeader().$this->renderTable(); + return hsprintf('%s%s', $this->renderHeader(), $this->renderTable()); } private function renderHeader() { diff --git a/src/view/AphrontNullView.php b/src/view/AphrontNullView.php index cfcf48350e..df61ab81f3 100644 --- a/src/view/AphrontNullView.php +++ b/src/view/AphrontNullView.php @@ -3,7 +3,7 @@ final class AphrontNullView extends AphrontView { public function render() { - return $this->renderChildren(); + return $this->renderHTMLChildren(); } } diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php index bfe6f9d624..fa484885fe 100644 --- a/src/view/AphrontView.php +++ b/src/view/AphrontView.php @@ -52,7 +52,7 @@ abstract class AphrontView extends Phobject { foreach ($child as $element) { $out[] = $this->renderSingleView($element); } - return implode('', $out); + return phutil_implode_html('', $out); } else { return $child; } @@ -60,7 +60,7 @@ abstract class AphrontView extends Phobject { final protected function renderHTMLView($child) { if ($child instanceof AphrontView) { - return phutil_safe_html($child->render()); + return $child->render(); } else if ($child instanceof PhutilSafeHTML) { return $child; } else if (is_array($child)) { @@ -68,9 +68,9 @@ abstract class AphrontView extends Phobject { foreach ($child as $element) { $out[] = $this->renderHTMLView($element); } - return phutil_safe_html(implode('', $out)); + return phutil_implode_html('', $out); } else { - return phutil_safe_html(phutil_escape_html($child)); + return hsprintf('%s', $child); } } diff --git a/src/view/control/AphrontAttachedFileView.php b/src/view/control/AphrontAttachedFileView.php index a3e1cad357..37668525ae 100644 --- a/src/view/control/AphrontAttachedFileView.php +++ b/src/view/control/AphrontAttachedFileView.php @@ -44,14 +44,18 @@ final class AphrontAttachedFileView extends AphrontView { ), "\xE2\x9C\x96"); // "Heavy Multiplication X" - return + return hsprintf( ' - - - + + + -
'.$thumb.''.$name.'
'.$size.'
'.$remove.'%s%s
%s
%s
'; + ', + $thumb, + $name, + $size, + $remove); } } diff --git a/src/view/control/AphrontCursorPagerView.php b/src/view/control/AphrontCursorPagerView.php index f02f165fb9..ecfde94417 100644 --- a/src/view/control/AphrontCursorPagerView.php +++ b/src/view/control/AphrontCursorPagerView.php @@ -120,10 +120,10 @@ final class AphrontCursorPagerView extends AphrontView { "Next \xE2\x80\xBA"); } - return - '
'. - implode('', $links). - '
'; + return phutil_tag( + 'div', + array('class' => 'aphront-pager-view'), + $links); } } diff --git a/src/view/control/AphrontPagerView.php b/src/view/control/AphrontPagerView.php index 00a405273d..fe9340c0ae 100644 --- a/src/view/control/AphrontPagerView.php +++ b/src/view/control/AphrontPagerView.php @@ -115,7 +115,7 @@ final class AphrontPagerView extends AphrontView { if ($max - $min > $last) { $max = $min + $last; if ($max == $min) { - return '
'; + return phutil_tag('div', array('class' => 'aphront-pager-view'), ''); } } @@ -196,10 +196,10 @@ final class AphrontPagerView extends AphrontView { $label); } - return - '
'. - implode('', $rendered_links). - '
'; + return phutil_tag( + 'div', + array('class' => 'aphront-pager-view'), + $rendered_links); } private function getDisplayIndex($page_index) { diff --git a/src/view/layout/AphrontContextBarView.php b/src/view/layout/AphrontContextBarView.php index 57793ff4c7..0b4d1e9499 100644 --- a/src/view/layout/AphrontContextBarView.php +++ b/src/view/layout/AphrontContextBarView.php @@ -15,18 +15,16 @@ final class AphrontContextBarView extends AphrontView { require_celerity_resource('aphront-contextbar-view-css'); - return + return hsprintf( '
'. '
'. - '
'. - $view->render(). - '
'. - '
'. - $this->renderChildren(). - '
'. + '
%s
'. + '
%s
'. '
'. '
'. - '
'; + '', + $view->render(), + $this->renderHTMLChildren()); } } diff --git a/src/view/layout/AphrontCrumbsView.php b/src/view/layout/AphrontCrumbsView.php index 2a249dc9b9..f73901f687 100644 --- a/src/view/layout/AphrontCrumbsView.php +++ b/src/view/layout/AphrontCrumbsView.php @@ -17,18 +17,15 @@ final class AphrontCrumbsView extends AphrontView { foreach ($this->crumbs as $crumb) { $out[] = $this->renderSingleView($crumb); } - $out = implode( - ''. - "\xC2\xBB". - '', + $out = phutil_implode_html( + hsprintf(''."\xC2\xBB".''), $out); - return + return hsprintf( '
'. - '
'. - $out. - '
'. - '
'; + '
%s
'. + '', + $out); } } diff --git a/src/view/layout/AphrontListFilterView.php b/src/view/layout/AphrontListFilterView.php index a79d68046b..2f14ec83f0 100644 --- a/src/view/layout/AphrontListFilterView.php +++ b/src/view/layout/AphrontListFilterView.php @@ -4,14 +4,13 @@ final class AphrontListFilterView extends AphrontView { public function render() { require_celerity_resource('aphront-list-filter-view-css'); - return + return hsprintf( ''. ''. - ''. + ''. ''. - '
'. - $this->renderChildren(). - '%s
'; + '', + $this->renderHTMLChildren()); } } diff --git a/src/view/layout/AphrontMiniPanelView.php b/src/view/layout/AphrontMiniPanelView.php index 9beb8e65d9..02d29060db 100644 --- a/src/view/layout/AphrontMiniPanelView.php +++ b/src/view/layout/AphrontMiniPanelView.php @@ -3,10 +3,9 @@ final class AphrontMiniPanelView extends AphrontView { public function render() { - return - '
'. - $this->renderChildren(). - '
'; + return hsprintf( + '
%s
', + $this->renderHTMLChildren()); } } diff --git a/src/view/layout/AphrontPanelView.php b/src/view/layout/AphrontPanelView.php index 651e2a0e80..5c724eb8e5 100644 --- a/src/view/layout/AphrontPanelView.php +++ b/src/view/layout/AphrontPanelView.php @@ -98,13 +98,14 @@ final class AphrontPanelView extends AphrontView { $classes[] = 'aphront-panel-width-'.$this->width; } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => implode(' ', $classes), 'id' => $this->id, ), - $header_elements.$table); + // TODO: [HTML] Make HTML safe. + phutil_safe_html($header_elements.$table)); } } diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index ffbe0ca0bc..a7f295fb25 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -277,21 +277,26 @@ final class AphrontSideNavFilterView extends AphrontView { $nav_classes = array_merge($nav_classes, $this->classes); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => implode(' ', $nav_classes), 'id' => $main_id, ), - $local_menu. - $flex_bar. - phutil_render_tag( - 'div', - array( - 'class' => 'phabricator-nav-content', - 'id' => $content_id, - ), - $crumbs.$this->renderChildren())); + array( + $local_menu, + $flex_bar, + phutil_tag( + 'div', + array( + 'class' => 'phabricator-nav-content', + 'id' => $content_id, + ), + array( + $crumbs, + phutil_safe_html($this->renderChildren()), + )) + )); } } diff --git a/src/view/layout/PhabricatorFileLinkListView.php b/src/view/layout/PhabricatorFileLinkListView.php index 27b5201c2a..0eaf519d33 100644 --- a/src/view/layout/PhabricatorFileLinkListView.php +++ b/src/view/layout/PhabricatorFileLinkListView.php @@ -31,7 +31,7 @@ final class PhabricatorFileLinkListView extends AphrontView { $file_links[] = $view->render(); } - return implode('
', $file_links); + return phutil_implode_html(phutil_tag('br'), $file_links); } } diff --git a/src/view/layout/PhabricatorProfileHeaderView.php b/src/view/layout/PhabricatorProfileHeaderView.php index ce86f56285..338b0d0635 100644 --- a/src/view/layout/PhabricatorProfileHeaderView.php +++ b/src/view/layout/PhabricatorProfileHeaderView.php @@ -67,9 +67,9 @@ final class PhabricatorProfileHeaderView extends AphrontView { ', $this->profileName, - phutil_safe_html(self::renderSingleView($this->profileActions)), + self::renderSingleView($this->profileActions), $image, $description). - $this->renderChildren(); + $this->renderHTMLChildren(); } } diff --git a/src/view/layout/PhabricatorTransactionView.php b/src/view/layout/PhabricatorTransactionView.php index 64e5bf54d1..3c551d2176 100644 --- a/src/view/layout/PhabricatorTransactionView.php +++ b/src/view/layout/PhabricatorTransactionView.php @@ -62,20 +62,22 @@ final class PhabricatorTransactionView extends AphrontView { $transaction_id = $this->anchorName ? 'anchor-'.$this->anchorName : null; - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-transaction-view', 'id' => $transaction_id, 'style' => $style, ), - '
'. - '
'. - $info. - $actions. - '
'. - $content. - '
'); + // TODO: [HTML] Make HTML safe. + phutil_safe_html( + '
'. + '
'. + $info. + $actions. + '
'. + $content. + '
')); } diff --git a/src/view/page/AphrontPageView.php b/src/view/page/AphrontPageView.php index 8381176ee1..e2ddca7a0d 100644 --- a/src/view/page/AphrontPageView.php +++ b/src/view/page/AphrontPageView.php @@ -73,7 +73,9 @@ abstract class AphrontPageView extends AphrontView { EOHTML; $response = $this->willSendResponse($response); - return $response; + + // TODO: [HTML] Make HTML safe. + return phutil_safe_html($response); } diff --git a/src/view/page/AphrontRequestFailureView.php b/src/view/page/AphrontRequestFailureView.php index 026f3d8b61..9ffce467d6 100644 --- a/src/view/page/AphrontRequestFailureView.php +++ b/src/view/page/AphrontRequestFailureView.php @@ -13,15 +13,15 @@ final class AphrontRequestFailureView extends AphrontView { final public function render() { require_celerity_resource('aphront-request-failure-view-css'); - return + return hsprintf( '
'. '
'. - phutil_tag('h1', array(), $this->header). + '

%s

'. '
'. - '
'. - $this->renderChildren(). - '
'. - '
'; + '
%s
'. + '', + $this->header, + $this->renderHTMLChildren()); } } diff --git a/src/view/page/menu/PhabricatorMainMenuSearchView.php b/src/view/page/menu/PhabricatorMainMenuSearchView.php index fe3ab48e71..1f416a1f94 100644 --- a/src/view/page/menu/PhabricatorMainMenuSearchView.php +++ b/src/view/page/menu/PhabricatorMainMenuSearchView.php @@ -60,18 +60,19 @@ final class PhabricatorMainMenuSearchView extends AphrontView { 'value' => $scope, )); - $form = phabricator_render_form( + $form = phabricator_form( $user, array( 'action' => '/search/', 'method' => 'POST', ), - '
'. - $input. - ''. - $scope_input. - $target. - '
'); + hsprintf( + '
'. + '%s%s%s'. + '
', + $input, + $scope_input, + $target)); return $form; } diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index 446c19f82c..4c071e183e 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -51,7 +51,7 @@ final class PhabricatorMainMenuView extends AphrontView { $phabricator_menu = $this->renderPhabricatorMenu(); if ($alerts) { - $alerts = phutil_render_tag( + $alerts = phutil_tag( 'div', array( 'class' => 'phabricator-main-menu-alerts', @@ -65,14 +65,14 @@ final class PhabricatorMainMenuView extends AphrontView { $application_menu->addClass('phabricator-application-menu'); } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-main-menu', 'id' => $header_id, ), - self::renderSingleView( - array( + array( + self::renderSingleView(array( $this->renderPhabricatorMenuButton($header_id), $application_menu ? $this->renderApplicationMenuButton($header_id) @@ -81,8 +81,9 @@ final class PhabricatorMainMenuView extends AphrontView { $alerts, $phabricator_menu, $application_menu, - ))). - self::renderSingleView($menus); + )), + self::renderSingleView($menus), + )); } private function renderSearch() {