From ef7f16180ce5d98af45d475023f81d1f714160da Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 13 Feb 2013 14:50:15 -0800 Subject: [PATCH] Restore merge of phutil_tag. --- src/aphront/AphrontRequest.php | 2 +- ...AphrontDefaultApplicationConfiguration.php | 31 +++--- .../plugin/DarkConsoleErrorLogPlugin.php | 30 +++--- .../console/plugin/DarkConsoleEventPlugin.php | 17 ++-- .../plugin/DarkConsoleRequestPlugin.php | 6 +- .../plugin/DarkConsoleServicesPlugin.php | 32 +++--- .../plugin/DarkConsoleXHProfPlugin.php | 44 +++++---- src/aphront/response/Aphront403Response.php | 2 +- src/aphront/response/Aphront404Response.php | 3 +- .../response/AphrontWebpageResponse.php | 2 +- .../PhabricatorAuditListController.php | 4 +- .../view/PhabricatorAuditCommitListView.php | 4 +- .../audit/view/PhabricatorAuditListView.php | 9 +- .../PhabricatorDisabledUserController.php | 4 +- .../PhabricatorEmailLoginController.php | 10 +- .../PhabricatorEmailTokenController.php | 15 ++- .../PhabricatorLDAPLoginController.php | 18 ++-- .../PhabricatorLDAPUnlinkController.php | 6 +- .../controller/PhabricatorLoginController.php | 10 +- .../PhabricatorLoginValidateController.php | 18 ++-- .../PhabricatorLogoutController.php | 3 +- .../PhabricatorMustVerifyEmailController.php | 39 ++++---- .../PhabricatorOAuthDiagnosticsController.php | 22 ++--- .../PhabricatorOAuthLoginController.php | 7 +- .../PhabricatorOAuthUnlinkController.php | 6 +- .../auth/view/PhabricatorOAuthFailureView.php | 9 +- .../base/controller/PhabricatorController.php | 9 +- .../PhabricatorCalendarBrowseController.php | 4 +- ...habricatorCalendarViewStatusController.php | 4 +- .../view/AphrontCalendarMonthView.php | 75 +++++++------- ...PhabricatorChatLogChannelLogController.php | 13 +-- .../PhabricatorConduitAPIController.php | 4 +- .../PhabricatorConduitConsoleController.php | 2 +- .../PhabricatorConduitListController.php | 4 +- .../PhabricatorConduitLogController.php | 6 +- .../PhabricatorConfigAllController.php | 5 +- .../response/PhabricatorConfigResponse.php | 35 ++++--- .../config/view/PhabricatorSetupIssueView.php | 10 +- .../controller/ConpherenceController.php | 3 +- .../controller/ConpherenceViewController.php | 10 +- .../storage/ConpherenceTransaction.php | 8 +- .../view/ConpherenceMenuItemView.php | 2 +- .../view/ConpherenceTransactionView.php | 2 +- .../PhabricatorCountdownListController.php | 2 +- .../PhabricatorDaemonConsoleController.php | 4 +- .../PhabricatorWorkerTaskUpdateController.php | 29 +++--- .../view/PhabricatorDaemonLogEventsView.php | 2 +- .../view/PhabricatorDaemonLogListView.php | 4 +- .../DifferentialCommentSaveController.php | 7 +- .../DifferentialDiffViewController.php | 17 ++-- .../DifferentialRevisionViewController.php | 26 ++--- .../DifferentialSubscribeController.php | 2 +- ...rentialBlameRevisionFieldSpecification.php | 2 +- .../DifferentialCommitsFieldSpecification.php | 2 +- ...erentialDependenciesFieldSpecification.php | 2 +- ...ifferentialDependsOnFieldSpecification.php | 2 +- .../DifferentialFieldSpecification.php | 2 +- ...entialManiphestTasksFieldSpecification.php | 2 +- ...ifferentialReviewersFieldSpecification.php | 12 ++- .../DifferentialUnitFieldSpecification.php | 2 +- .../parser/DifferentialChangesetParser.php | 2 +- .../DifferentialChangesetHTMLRenderer.php | 72 ++++++++------ .../DifferentialChangesetOneUpRenderer.php | 28 +++--- .../DifferentialChangesetTwoUpRenderer.php | 82 +++++++++------- .../view/DifferentialAddCommentView.php | 30 +++--- .../view/DifferentialChangesetDetailView.php | 4 +- .../view/DifferentialChangesetListView.php | 23 +++-- .../DifferentialDiffTableOfContentsView.php | 97 +++++++++---------- .../DifferentialInlineCommentEditView.php | 8 +- .../view/DifferentialInlineCommentView.php | 2 +- .../view/DifferentialLocalCommitsView.php | 38 ++++---- .../view/DifferentialPrimaryPaneView.php | 2 +- .../DifferentialRevisionCommentListView.php | 6 +- .../view/DifferentialRevisionCommentView.php | 66 ++++++++----- .../view/DifferentialRevisionDetailView.php | 6 +- .../view/DifferentialRevisionListView.php | 24 ++--- .../DifferentialRevisionUpdateHistoryView.php | 44 +++++---- .../controller/DiffusionBrowseController.php | 4 +- .../controller/DiffusionCommitController.php | 30 +++--- .../DiffusionExternalController.php | 2 +- .../controller/DiffusionHomeController.php | 4 +- .../controller/DiffusionLintController.php | 9 +- .../DiffusionLintDetailsController.php | 9 +- .../DiffusionRepositoryController.php | 6 +- .../controller/DiffusionSymbolController.php | 16 +-- .../query/browse/DiffusionBrowseQuery.php | 5 +- .../view/DiffusionBrowseTableView.php | 25 ++--- .../view/DiffusionCommentListView.php | 8 +- .../diffusion/view/DiffusionCommentView.php | 27 +++--- .../view/DiffusionCommitChangeTableView.php | 2 +- .../view/DiffusionHistoryTableView.php | 4 +- .../diffusion/view/DiffusionTagListView.php | 1 - .../diffusion/view/DiffusionView.php | 2 +- .../controller/DivinerListController.php | 5 +- .../drydock/controller/DrydockController.php | 2 +- .../DrydockLeaseReleaseController.php | 13 ++- .../DrydockResourceCloseController.php | 11 +-- .../PhabricatorFactHomeController.php | 5 +- .../feed/builder/PhabricatorFeedBuilder.php | 11 +-- .../feed/story/PhabricatorFeedStory.php | 2 +- .../feed/story/PhabricatorFeedStoryAudit.php | 10 +- .../feed/story/PhabricatorFeedStoryCommit.php | 15 ++- .../PhabricatorFeedStoryDifferential.php | 6 +- .../story/PhabricatorFeedStoryManiphest.php | 15 ++- .../story/PhabricatorFeedStoryPhriction.php | 9 +- .../story/PhabricatorFeedStoryProject.php | 67 ++++++------- .../feed/view/PhabricatorFeedStoryView.php | 8 +- .../PhabricatorFlagsUIEventListener.php | 2 +- .../flag/view/PhabricatorFlagListView.php | 2 +- ...bricatorHelpKeyboardShortcutController.php | 10 +- .../controller/HeraldTranscriptController.php | 19 ++-- .../herald/view/HeraldRuleEditHistoryView.php | 6 +- .../PhabricatorMacroDisableController.php | 8 +- .../PhabricatorMacroViewController.php | 2 +- .../storage/PhabricatorMacroTransaction.php | 8 +- .../PhabricatorMailingListsListController.php | 4 +- ...hestAuxiliaryFieldDefaultSpecification.php | 8 +- .../ManiphestAuxiliaryFieldSpecification.php | 2 +- .../controller/ManiphestExportController.php | 8 +- .../controller/ManiphestReportController.php | 6 +- .../ManiphestSavedQueryListController.php | 4 +- ...iphestTaskDescriptionPreviewController.php | 7 +- .../ManiphestTaskDetailController.php | 59 ++++++----- .../ManiphestTaskEditController.php | 8 +- .../ManiphestTaskListController.php | 50 +++++----- .../maniphest/view/ManiphestTaskListView.php | 2 +- .../view/ManiphestTaskProjectsView.php | 2 +- .../view/ManiphestTransactionDetailView.php | 15 ++- .../view/ManiphestTransactionListView.php | 8 +- .../view/PhabricatorApplicationLaunchView.php | 4 +- .../PhabricatorMetaMTAListController.php | 2 +- ...abricatorMetaMTAReceivedListController.php | 2 +- .../PhabricatorNotificationListController.php | 17 ++-- ...PhabricatorNotificationPanelController.php | 32 +++--- ...habricatorNotificationStatusController.php | 7 +- .../PhabricatorOAuthServerAuthController.php | 3 +- ...PhabricatorOAuthClientDeleteController.php | 8 +- .../PhabricatorOAuthClientListController.php | 2 - ...uthClientAuthorizationDeleteController.php | 9 +- ...OAuthClientAuthorizationListController.php | 1 - .../PhabricatorOwnersDetailController.php | 44 ++++----- .../PhabricatorOwnersListController.php | 17 ++-- .../PhabricatorPasteListController.php | 2 +- .../PhabricatorPeopleLdapController.php | 51 +++++----- .../PhabricatorPeopleListController.php | 2 +- .../PhabricatorPeopleLogsController.php | 6 +- .../PhabricatorPeopleProfileController.php | 17 ++-- .../blog/PhameBlogDeleteController.php | 2 +- .../post/PhamePostDeleteController.php | 2 +- .../post/PhamePostEditController.php | 4 +- .../post/PhamePostNotLiveController.php | 12 +-- .../post/PhamePostPreviewController.php | 2 +- .../post/PhamePostUnpublishController.php | 2 +- .../phame/skins/PhameBasicBlogSkin.php | 2 +- .../skins/PhameBasicTemplateBlogSkin.php | 4 +- .../PhabricatorPHIDLookupController.php | 6 +- .../controller/PholioMockViewController.php | 2 +- .../pholio/storage/PholioTransaction.php | 6 +- .../pholio/view/PholioMockImagesView.php | 2 +- ...habricatorXHPASTViewFramesetController.php | 15 +-- .../PhabricatorXHPASTViewInputController.php | 3 +- .../PhabricatorXHPASTViewPanelController.php | 9 +- .../PhabricatorXHPASTViewStreamController.php | 3 +- .../PhabricatorXHPASTViewTreeController.php | 24 ++--- .../controller/PhrictionDiffController.php | 32 +++--- .../PhrictionDocumentController.php | 76 +++++++-------- .../controller/PhrictionEditController.php | 22 ++--- .../controller/PhrictionHistoryController.php | 6 +- .../phriction/storage/PhrictionContent.php | 21 ++-- .../policy/filter/PhabricatorPolicy.php | 2 +- .../controller/PonderAnswerSaveController.php | 3 +- .../PonderCommentSaveController.php | 3 +- .../PonderQuestionAskController.php | 9 +- .../ponder/view/PonderAddAnswerView.php | 4 +- .../ponder/view/PonderAnswerListView.php | 3 +- .../ponder/view/PonderPostBodyView.php | 2 +- .../ponder/view/PonderQuestionSummaryView.php | 45 ++++----- .../ponder/view/PonderVotableView.php | 4 +- .../PhabricatorProjectListController.php | 7 +- ...habricatorProjectMembersEditController.php | 2 +- .../PhabricatorProjectProfileController.php | 61 ++++++------ .../PhabricatorProjectUpdateController.php | 8 +- .../ConduitAPI_remarkup_process_Method.php | 2 +- .../PhabricatorRepositoryListController.php | 10 +- .../PhabricatorSearchController.php | 16 +-- .../view/PhabricatorSearchResultView.php | 26 ++--- .../panel/PhabricatorSettingsPanelConduit.php | 6 +- ...PhabricatorSettingsPanelEmailAddresses.php | 14 +-- .../panel/PhabricatorSettingsPanelLDAP.php | 2 +- .../panel/PhabricatorSettingsPanelOAuth.php | 2 +- .../panel/PhabricatorSettingsPanelSSHKeys.php | 14 +-- .../PhabricatorSlowvotePollController.php | 7 +- ...habricatorSubscriptionsUIEventListener.php | 6 +- ...ApplicationTransactionNoEffectResponse.php | 3 +- .../PhabricatorApplicationTransaction.php | 12 +-- ...catorApplicationTransactionCommentView.php | 2 +- .../PhabricatorApplicationTransactionView.php | 4 +- ...torTypeaheadCommonDatasourceController.php | 3 - .../examples/PhabricatorActionListExample.php | 2 +- .../examples/PhabricatorButtonsExample.php | 4 +- .../examples/PhabricatorTagExample.php | 25 +++-- .../PhabricatorUINotificationExample.php | 2 +- .../examples/PhabricatorUIPagerExample.php | 12 +-- src/docs/developer/rendering_html.diviner | 40 +++++--- .../CelerityStaticResourceResponse.php | 8 +- .../PhabricatorInlineCommentController.php | 2 +- ...bricatorInlineCommentPreviewController.php | 2 +- .../view/PhabricatorInlineSummaryView.php | 35 ++++--- .../lint/PhabricatorLintEngine.php | 18 ++++ .../markup/PhabricatorMarkupEngine.php | 6 +- .../rule/PhabricatorRemarkupRuleCountdown.php | 17 ++-- .../rule/PhabricatorRemarkupRuleEmbedFile.php | 2 +- .../PhabricatorRemarkupRuleImageMacro.php | 8 +- .../rule/PhabricatorRemarkupRuleMeme.php | 2 +- .../rule/PhabricatorRemarkupRuleMention.php | 4 +- .../PhabricatorRemarkupRuleObjectHandle.php | 4 +- .../PhabricatorRemarkupRuleObjectName.php | 2 +- .../rule/PhabricatorRemarkupRulePhriction.php | 4 +- .../rule/PhabricatorRemarkupRuleYoutube.php | 36 +++---- src/view/AphrontDialogView.php | 42 ++++---- src/view/AphrontJavelinView.php | 4 +- src/view/AphrontNullView.php | 2 +- src/view/AphrontTagView.php | 2 +- src/view/AphrontView.php | 26 +---- src/view/control/AphrontAttachedFileView.php | 14 ++- src/view/control/AphrontCursorPagerView.php | 8 +- src/view/control/AphrontPagerView.php | 10 +- src/view/control/AphrontTableView.php | 77 +++++++-------- .../PhabricatorObjectSelectorDialog.php | 61 ++++++------ src/view/form/AphrontErrorView.php | 2 +- src/view/form/AphrontFormInsetView.php | 2 +- src/view/form/AphrontFormLayoutView.php | 2 +- src/view/form/AphrontFormView.php | 2 +- .../form/control/AphrontFormCropControl.php | 2 +- .../control/PhabricatorRemarkupControl.php | 2 +- src/view/layout/AphrontContextBarView.php | 14 ++- src/view/layout/AphrontCrumbsView.php | 15 ++- src/view/layout/AphrontListFilterView.php | 9 +- src/view/layout/AphrontMiniPanelView.php | 8 +- src/view/layout/AphrontPanelView.php | 25 ++--- src/view/layout/AphrontSideNavFilterView.php | 27 +++--- src/view/layout/PhabricatorActionListView.php | 2 +- src/view/layout/PhabricatorAnchorView.php | 2 +- src/view/layout/PhabricatorCrumbsView.php | 4 +- .../layout/PhabricatorFileLinkListView.php | 5 +- src/view/layout/PhabricatorHeaderView.php | 2 +- src/view/layout/PhabricatorMenuItemView.php | 4 +- src/view/layout/PhabricatorMenuView.php | 2 +- .../layout/PhabricatorObjectItemListView.php | 6 +- src/view/layout/PhabricatorObjectItemView.php | 4 +- .../layout/PhabricatorPinboardItemView.php | 4 +- src/view/layout/PhabricatorPinboardView.php | 2 +- .../layout/PhabricatorProfileHeaderView.php | 9 +- .../layout/PhabricatorPropertyListView.php | 6 +- src/view/layout/PhabricatorSourceCodeView.php | 20 ++-- .../layout/PhabricatorTimelineEventView.php | 8 +- .../layout/PhabricatorTransactionView.php | 52 +++++----- src/view/page/AphrontPageView.php | 34 ++++--- src/view/page/AphrontRequestFailureView.php | 12 +-- src/view/page/PhabricatorBarePageView.php | 24 ++--- src/view/page/PhabricatorStandardPageView.php | 39 ++++---- .../menu/PhabricatorMainMenuGroupView.php | 2 +- .../menu/PhabricatorMainMenuSearchView.php | 15 +-- .../page/menu/PhabricatorMainMenuView.php | 17 ++-- 264 files changed, 1690 insertions(+), 1716 deletions(-) diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php index 1d940c32d1..42c80f5f6f 100644 --- a/src/aphront/AphrontRequest.php +++ b/src/aphront/AphrontRequest.php @@ -9,7 +9,7 @@ final class AphrontRequest { // NOTE: These magic request-type parameters are automatically included in - // certain requests (e.g., by phabricator_render_form(), JX.Request, + // certain requests (e.g., by phabricator_form(), JX.Request, // JX.Workflow, and ConduitClient) and help us figure out what sort of // response the client expects. diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index 1981ee4428..44de55a4d3 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -210,7 +210,7 @@ class AphrontDefaultApplicationConfiguration if ($ex instanceof AphrontUsageException) { $error = new AphrontErrorView(); - $error->setTitle(phutil_escape_html($ex->getTitle())); + $error->setTitle($ex->getTitle()); $error->appendChild($ex->getMessage()); $view = new PhabricatorStandardPageView(); @@ -227,8 +227,8 @@ class AphrontDefaultApplicationConfiguration // Always log the unhandled exception. phlog($ex); - $class = phutil_escape_html(get_class($ex)); - $message = phutil_escape_html($ex->getMessage()); + $class = get_class($ex); + $message = $ex->getMessage(); if ($ex instanceof AphrontQuerySchemaException) { $message .= @@ -244,11 +244,13 @@ class AphrontDefaultApplicationConfiguration $trace = null; } - $content = + $content = hsprintf( '
'. - '
'.$message.'
'. - $trace. - '
'; + '
%s
'. + '%s'. + '', + $message, + $trace); $dialog = new AphrontDialogView(); $dialog @@ -348,17 +350,17 @@ class AphrontDefaultApplicationConfiguration ), $relative); } - $file_name = $file_name.' : '.(int)$part['line']; + $file_name = hsprintf('%s : %d', $file_name, $part['line']); } else { - $file_name = '(Internal)'; + $file_name = phutil_tag('em', array(), '(Internal)'); } $rows[] = array( $depth--, - phutil_escape_html($lib), + $lib, $file_name, - phutil_escape_html($where), + $where, ); } $table = new AphrontTableView($rows); @@ -377,11 +379,12 @@ class AphrontDefaultApplicationConfiguration 'wide', )); - return + return hsprintf( '
'. '
Stack Trace
'. - $table->render(). - '
'; + '%s', + '', + $table->render()); } } diff --git a/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php b/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php index 98df6d113c..e0d3cd5f8e 100644 --- a/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php @@ -36,7 +36,7 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { $data = $this->getData(); $rows = array(); - $details = ''; + $details = array(); foreach ($data as $index => $row) { $file = $row['file']; @@ -50,11 +50,11 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { $row['str'].' at ['.basename($file).':'.$line.']'); $rows[] = array($tag); - $details .= - '
'. - phutil_escape_html($row['details'])."\n". - 'Stack trace:'."\n"; + $details[] = hsprintf( + '
'. + "%s\nStack trace:\n", + $index, + $row['details']); foreach ($row['trace'] as $key => $entry) { $line = ''; @@ -73,16 +73,16 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { } } - $details .= phutil_tag( + $details[] = phutil_tag( 'a', array( 'href' => $href, ), $line); - $details .= "\n"; + $details[] = "\n"; } - $details .= '
'; + $details[] = hsprintf('
'); } $table = new AphrontTableView($rows); @@ -90,11 +90,13 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { $table->setHeaders(array('Error')); $table->setNoDataString('No errors.'); - return '
'. - '
'.$table->render().'
'. - '
'.
-      $details.'
'. - '
'; + return hsprintf( + '
'. + '
%s
'. + '
%s
'. + '
', + $table->render(), + phutil_implode_html('', $details)); } } diff --git a/src/aphront/console/plugin/DarkConsoleEventPlugin.php b/src/aphront/console/plugin/DarkConsoleEventPlugin.php index 8a855bb3f8..3b9236b4a2 100644 --- a/src/aphront/console/plugin/DarkConsoleEventPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleEventPlugin.php @@ -42,17 +42,14 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { $out = array(); - $out[] = + $out[] = hsprintf( '
'. '

Registered Event Listeners

'. - '
'; + ''); $rows = array(); foreach ($data['listeners'] as $listener) { - $rows[] = array( - phutil_escape_html($listener['id']), - phutil_escape_html($listener['class']), - ); + $rows[] = array($listener['id'], $listener['class']); } $table = new AphrontTableView($rows); @@ -69,15 +66,15 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { $out[] = $table->render(); - $out[] = + $out[] = hsprintf( '
'. '

Event Log

'. - '
'; + ''); $rows = array(); foreach ($data['events'] as $event) { $rows[] = array( - phutil_escape_html($event['type']), + $event['type'], $event['stopped'] ? 'STOPPED' : null, ); } @@ -96,6 +93,6 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { $out[] = $table->render(); - return implode("\n", $out); + return phutil_implode_html("\n", $out); } } diff --git a/src/aphront/console/plugin/DarkConsoleRequestPlugin.php b/src/aphront/console/plugin/DarkConsoleRequestPlugin.php index 7a59df8493..0d04d58dc0 100644 --- a/src/aphront/console/plugin/DarkConsoleRequestPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleRequestPlugin.php @@ -43,8 +43,8 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin { $rows = array(); foreach ($map as $key => $value) { $rows[] = array( - phutil_escape_html($key), - phutil_escape_html(is_array($value) ? json_encode($value) : $value), + $key, + (is_array($value) ? json_encode($value) : $value), ); } @@ -62,6 +62,6 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin { $out[] = $table->render(); } - return implode("\n", $out); + return phutil_implode_html("\n", $out); } } diff --git a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php index 094abea57d..a43a83c785 100644 --- a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php @@ -149,20 +149,21 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $log = $data['log']; $results = array(); - $results[] = + $results[] = hsprintf( '
'. - phutil_tag( - 'a', - array( - 'href' => $data['analyzeURI'], - 'class' => $data['didAnalyze'] - ? 'disabled button' - : 'green button', - ), - 'Analyze Query Plans'). + '%s'. '

Calls to External Services

'. '
'. - '
'; + '', + phutil_tag( + 'a', + array( + 'href' => $data['analyzeURI'], + 'class' => $data['didAnalyze'] + ? 'disabled button' + : 'green button', + ), + 'Analyze Query Plans')); $page_total = $data['end'] - $data['start']; $totals = array(); @@ -224,23 +225,18 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $row['explain']['reason']); } - $info = phutil_escape_html($info); break; case 'connect': $info = $row['host'].':'.$row['database']; - $info = phutil_escape_html($info); break; case 'exec': $info = $row['command']; - $info = phutil_escape_html($info); break; case 'conduit': $info = $row['method']; - $info = phutil_escape_html($info); break; case 'http': $info = $row['uri']; - $info = phutil_escape_html($info); break; default: $info = '-'; @@ -248,7 +244,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { } $rows[] = array( - phutil_escape_html($row['type']), + $row['type'], '+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms', number_format(1000000 * $row['duration']).' us', $info, @@ -276,7 +272,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $results[] = $table->render(); - return implode("\n", $results); + return phutil_implode_html("\n", $results); } } diff --git a/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php b/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php index 0cae8541d2..9649c11244 100644 --- a/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php @@ -51,48 +51,52 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { 'class' => 'bright-link', ), 'Installation Guide'); - return + return hsprintf( '
'. 'The "xhprof" PHP extension is not available. Install xhprof '. 'to enable the XHProf console plugin. You can find instructions in '. - 'the '.$install_guide.'.'. - '
'; + 'the %s.'. + '', + $install_guide); } $result = array(); - $header = + $header = hsprintf( '
'. - phutil_tag( - 'a', - array( - 'href' => $profile_uri, - 'class' => $run - ? 'disabled button' - : 'green button', - ), - 'Profile Page'). + '%s'. '

XHProf Profiler

'. - '
'; + '', + phutil_tag( + 'a', + array( + 'href' => $profile_uri, + 'class' => $run + ? 'disabled button' + : 'green button', + ), + 'Profile Page')); $result[] = $header; if ($run) { - $result[] = - 'Profile Permalink'. - ''; + '', + $run, + $run); } else { - $result[] = + $result[] = hsprintf( '
'. 'Profiling was not enabled for this page. Use the button above '. 'to enable it.'. - '
'; + ''); } - return implode("\n", $result); + return phutil_implode_html("\n", $result); } 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/aphront/response/AphrontWebpageResponse.php b/src/aphront/response/AphrontWebpageResponse.php index 4083b1be88..9bc2a54e83 100644 --- a/src/aphront/response/AphrontWebpageResponse.php +++ b/src/aphront/response/AphrontWebpageResponse.php @@ -13,7 +13,7 @@ final class AphrontWebpageResponse extends AphrontHTMLResponse { } public function buildResponseString() { - return $this->content; + return hsprintf('%s', $this->content); } } diff --git a/src/applications/audit/controller/PhabricatorAuditListController.php b/src/applications/audit/controller/PhabricatorAuditListController.php index d858dec6bf..d776fe12fd 100644 --- a/src/applications/audit/controller/PhabricatorAuditListController.php +++ b/src/applications/audit/controller/PhabricatorAuditListController.php @@ -335,7 +335,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController { } if ($handle) { - $handle_name = phutil_escape_html($handle->getName()); + $handle_name = $handle->getName(); } else { $handle_name = null; } @@ -435,7 +435,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController { } if ($handle) { - $handle_name = phutil_escape_html($handle->getName()); + $handle_name = $handle->getName(); } else { $handle_name = null; } diff --git a/src/applications/audit/view/PhabricatorAuditCommitListView.php b/src/applications/audit/view/PhabricatorAuditCommitListView.php index 6987fa117e..dc674cec8b 100644 --- a/src/applications/audit/view/PhabricatorAuditCommitListView.php +++ b/src/applications/audit/view/PhabricatorAuditCommitListView.php @@ -70,10 +70,10 @@ final class PhabricatorAuditCommitListView extends AphrontView { $rows[] = array( $commit_name, $author_name, - phutil_escape_html($commit->getCommitData()->getSummary()), + $commit->getCommitData()->getSummary(), PhabricatorAuditCommitStatusConstants::getStatusName( $commit->getAuditStatus()), - implode(', ', $auditors), + phutil_implode_html(', ', $auditors), phabricator_datetime($commit->getEpoch(), $this->user), ); } diff --git a/src/applications/audit/view/PhabricatorAuditListView.php b/src/applications/audit/view/PhabricatorAuditListView.php index 2bac041aa1..5a7ef11a1f 100644 --- a/src/applications/audit/view/PhabricatorAuditListView.php +++ b/src/applications/audit/view/PhabricatorAuditListView.php @@ -129,10 +129,7 @@ final class PhabricatorAuditListView extends AphrontView { } $reasons = $audit->getAuditReasons(); - foreach ($reasons as $key => $reason) { - $reasons[$key] = phutil_escape_html($reason); - } - $reasons = implode('
', $reasons); + $reasons = phutil_implode_html(phutil_tag('br'), $reasons); $status_code = $audit->getAuditStatus(); $status = PhabricatorAuditStatusConstants::getStatusName($status_code); @@ -140,10 +137,10 @@ final class PhabricatorAuditListView extends AphrontView { $auditor_handle = $this->getHandle($audit->getAuditorPHID()); $rows[] = array( $commit_name, - phutil_escape_html($commit_desc), + $commit_desc, $committed, $auditor_handle->renderLink(), - phutil_escape_html($status), + $status, $reasons, ); 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..3875de3c62 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( @@ -140,8 +138,8 @@ EOBODY; $panel = new AphrontPanelView(); $panel->setWidth(AphrontPanelView::WIDTH_FORM); - $panel->appendChild(' -

'.pht('Forgot Password / Email Login').'

'); + $panel->appendChild(phutil_tag('h1', array(), pht( + 'Forgot Password / Email Login'))); $panel->appendChild($email_auth); $panel->setNoBackground(); 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/PhabricatorLDAPLoginController.php b/src/applications/auth/controller/PhabricatorLDAPLoginController.php index 4dafe831f7..bbe64ccbd6 100644 --- a/src/applications/auth/controller/PhabricatorLDAPLoginController.php +++ b/src/applications/auth/controller/PhabricatorLDAPLoginController.php @@ -43,12 +43,11 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Already Linked to Another Account')); - $dialog->appendChild( - '

'.pht('The LDAP account you just authorized is already '. + $dialog->appendChild(phutil_tag('p', array(), pht( + 'The LDAP account you just authorized is already '. 'linked toanother Phabricator account. Before you can link it '. 'to a different LDAP account, you must unlink the old '. - 'account.').'

' - ); + 'account.'))); $dialog->addCancelButton('/settings/panel/ldap/'); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -62,10 +61,8 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Link LDAP Account')); - $dialog->appendChild( - '

'. - pht('Link your LDAP account to your Phabricator account?'). - '

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Link your LDAP account to your Phabricator account?'))); $dialog->addHiddenInput('username', $request->getStr('username')); $dialog->addHiddenInput('password', $request->getStr('password')); $dialog->addSubmitButton(pht('Link Accounts')); @@ -134,9 +131,10 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $panel = new AphrontPanelView(); $panel->setWidth(AphrontPanelView::WIDTH_FORM); - $panel->appendChild('

'.pht('LDAP login').'

'); + $panel->appendChild(phutil_tag('h1', array(), pht('LDAP login'))); $panel->appendChild($ldap_form); + $error_view = null; if (isset($errors) && count($errors) > 0) { $error_view = new AphrontErrorView(); $error_view->setTitle(pht('Login Failed')); @@ -145,7 +143,7 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { return $this->buildStandardPageResponse( array( - isset($error_view) ? $error_view : null, + $error_view, $panel, ), array( diff --git a/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php b/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php index 44cad5a398..c2c7aaf34b 100644 --- a/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php +++ b/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php @@ -18,9 +18,9 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Really unlink account?')); - $dialog->appendChild( - '

'.pht('You will not be able to login using this account '. - 'once you unlink it. Continue?').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You will not be able to login using this account '. + 'once you unlink it. Continue?'))); $dialog->addSubmitButton(pht('Unlink Account')); $dialog->addCancelButton('/settings/panel/ldap/'); diff --git a/src/applications/auth/controller/PhabricatorLoginController.php b/src/applications/auth/controller/PhabricatorLoginController.php index 23de5e7f2d..f4bb0ab57a 100644 --- a/src/applications/auth/controller/PhabricatorLoginController.php +++ b/src/applications/auth/controller/PhabricatorLoginController.php @@ -29,7 +29,8 @@ final class PhabricatorLoginController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Login Required')); - $dialog->appendChild('

'.pht('You must login to continue.').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You must login to continue.'))); $dialog->addSubmitButton(pht('Login')); $dialog->addCancelButton('/', pht('Cancel')); @@ -246,8 +247,7 @@ final class PhabricatorLoginController $title = pht("Login or Register with %s", $provider_name); $body = pht('Login or register for Phabricator using your %s account.', $provider_name); - $button = pht("Login or Register with %s", - phutil_escape_html($provider_name)); + $button = pht("Login or Register with %s", $provider_name); } else { $title = pht("Login with %s", $provider_name); $body = hsprintf( @@ -258,7 +258,7 @@ final class PhabricatorLoginController pht( 'You can not use %s to register a new account.', $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(); @@ -299,7 +299,7 @@ final class PhabricatorLoginController return $this->buildApplicationPage( array( $error_view, - $login_message, + phutil_safe_html($login_message), $panel, ), array( diff --git a/src/applications/auth/controller/PhabricatorLoginValidateController.php b/src/applications/auth/controller/PhabricatorLoginValidateController.php index a365618bd8..04b08b43f4 100644 --- a/src/applications/auth/controller/PhabricatorLoginValidateController.php +++ b/src/applications/auth/controller/PhabricatorLoginValidateController.php @@ -49,14 +49,18 @@ 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.', + hsprintf('')))); + $view->appendChild(hsprintf( '
'. - ''.pht('Try Again').''. - '
'); + '%s'. + '', + pht('Try Again'))); return $this->buildStandardPageResponse( $view, array( diff --git a/src/applications/auth/controller/PhabricatorLogoutController.php b/src/applications/auth/controller/PhabricatorLogoutController.php index e2cc5410fa..f75b4c601d 100644 --- a/src/applications/auth/controller/PhabricatorLogoutController.php +++ b/src/applications/auth/controller/PhabricatorLogoutController.php @@ -46,7 +46,8 @@ final class PhabricatorLogoutController $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Log out of Phabricator?')) - ->appendChild('

'.pht('Are you sure you want to log out?').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to log out?'))) ->addSubmitButton(pht('Logout')) ->addCancelButton('/'); 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/controller/PhabricatorOAuthDiagnosticsController.php b/src/applications/auth/controller/PhabricatorOAuthDiagnosticsController.php index 94ef4b23aa..03330b8138 100644 --- a/src/applications/auth/controller/PhabricatorOAuthDiagnosticsController.php +++ b/src/applications/auth/controller/PhabricatorOAuthDiagnosticsController.php @@ -21,11 +21,11 @@ final class PhabricatorOAuthDiagnosticsController $client_id = $provider->getClientID(); $client_secret = $provider->getClientSecret(); $key = $provider->getProviderKey(); - $name = phutil_escape_html($provider->getProviderName()); + $name = $provider->getProviderName(); - $res_ok = 'OK'; - $res_no = 'NO'; - $res_na = 'N/A'; + $res_ok = hsprintf('OK'); + $res_no = hsprintf('NO'); + $res_na = hsprintf('N/A'); $results = array(); $auth_key = $key . '.auth-enabled'; @@ -159,10 +159,10 @@ final class PhabricatorOAuthDiagnosticsController $rows = array(); foreach ($results as $key => $result) { $rows[] = array( - phutil_escape_html($key), + $key, $result[0], - phutil_escape_html($result[1]), - phutil_escape_html($result[2]), + $result[1], + $result[2], ); } @@ -186,11 +186,11 @@ final class PhabricatorOAuthDiagnosticsController $panel_view = new AphrontPanelView(); $panel_view->setHeader($title); - $panel_view->appendChild( + $panel_view->appendChild(hsprintf( '

These tests may be able to '. - 'help diagnose the root cause of problems you experience with '. - $provider->getProviderName() . - ' Authentication. Reload the page to run the tests again.

'); + 'help diagnose the root cause of problems you experience with %s '. + 'Authentication. Reload the page to run the tests again.

', + $provider->getProviderName())); $panel_view->appendChild($table_view); return $this->buildStandardPageResponse( diff --git a/src/applications/auth/controller/PhabricatorOAuthLoginController.php b/src/applications/auth/controller/PhabricatorOAuthLoginController.php index dbfcc81810..a226f5e9cf 100644 --- a/src/applications/auth/controller/PhabricatorOAuthLoginController.php +++ b/src/applications/auth/controller/PhabricatorOAuthLoginController.php @@ -116,10 +116,9 @@ final class PhabricatorOAuthLoginController $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Link %s Account', $provider_name)); - $dialog->appendChild( - pht( - '

Link your %s account to your Phabricator account?

', - phutil_escape_html($provider_name))); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Link your %s account to your Phabricator account?', + $provider_name))); $dialog->addHiddenInput('confirm_token', $provider->getAccessToken()); $dialog->addHiddenInput('expires', $oauth_info->getTokenExpires()); $dialog->addHiddenInput('state', $this->oauthState); diff --git a/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php b/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php index bff01b251b..97be2b7b8c 100644 --- a/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php +++ b/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php @@ -34,9 +34,9 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController { $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Really unlink account?')); - $dialog->appendChild( - '

'.pht('You will not be able to login using this account '. - 'once you unlink it. Continue?').'

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You will not be able to login using this account '. + 'once you unlink it. Continue?'))); $dialog->addSubmitButton(pht('Unlink Account')); $dialog->addCancelButton($provider->getSettingsPanelURI()); 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/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index e3d5d15196..9dbb9cb765 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -203,10 +203,9 @@ abstract class PhabricatorController extends AphrontController { $view = new PhabricatorStandardPageView(); $view->setRequest($request); $view->setController($this); - $view->appendChild( - '
'. - $response->buildResponseString(). - '
'); + $view->appendChild(hsprintf( + '
%s
', + $response->buildResponseString())); $response = new AphrontWebpageResponse(); $response->setContent($view->render()); return $response; @@ -277,7 +276,7 @@ abstract class PhabricatorController extends AphrontController { $items[] = $this->getHandle($phid)->renderLink(); } - return array_interleave($style_map[$style], $items); + return phutil_implode_html($style_map[$style], $items); } protected function buildApplicationMenu() { diff --git a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php index ad2b5e9863..9c4aaf4b4f 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarBrowseController.php @@ -55,9 +55,7 @@ final class PhabricatorCalendarBrowseController $nav->appendChild( array( $this->getNoticeView(), - '
', - $month_view, - '
', + hsprintf('
%s
', $month_view->render()), )); return $this->buildApplicationPage( diff --git a/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php b/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php index 9f96fd070a..6a7913e182 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php @@ -94,7 +94,7 @@ final class PhabricatorCalendarViewStatusController } else { $no_data = 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; } @@ -115,7 +115,7 @@ final class PhabricatorCalendarViewStatusController } else { $page_title = pht( 'Upcoming Statuses for %s', - phutil_escape_html($this->getHandle($this->phid)->getName()) + $this->getHandle($this->phid)->getName() ); } return $page_title; diff --git a/src/applications/calendar/view/AphrontCalendarMonthView.php b/src/applications/calendar/view/AphrontCalendarMonthView.php index 3367c01d88..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) { @@ -100,38 +102,42 @@ final class AphrontCalendarMonthView extends AphrontView { $holiday_markup = null; if ($holiday) { - $name = phutil_escape_html($holiday->getName()); - $holiday_markup = - '
'. - $name. - '
'; + $name = $holiday->getName(); + $holiday_markup = phutil_tag( + 'div', + array( + 'class' => 'aphront-calendar-holiday', + 'title' => $name, + ), + $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'. ''. ''. ''. @@ -141,8 +147,10 @@ final class AphrontCalendarMonthView extends AphrontView { ''. ''. ''. - implode("\n", $table). - '
SunMonFriSat
'; + '%s'. + '', + $this->renderCalendarHeader($first), + phutil_implode_html("\n", $table)); return $table; } @@ -173,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/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php index 581d3544ae..26dcadf1f8 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -94,7 +94,6 @@ final class PhabricatorChatLogChannelLogController require_celerity_resource('phabricator-chatlog-css'); $out = array(); - $out[] = ''; foreach ($blocks as $block) { $author = $block['author']; $author = phutil_utf8_shorten($author, 18); @@ -122,7 +121,6 @@ final class PhabricatorChatLogChannelLogController ), array($author, $message, $timestamp)); } - $out[] = '
'; $form = id(new AphrontFormView()) ->setUser($user) @@ -140,12 +138,11 @@ final class PhabricatorChatLogChannelLogController return $this->buildStandardPageResponse( array( - '
', - $form, - '
', - implode("\n", $out), - $pager, - '
', + hsprintf( + '
%s
%s%s
', + $form, + phutil_tag('table', array('class' => 'phabricator-chat-log'), $out), + $pager), ), array( 'title' => 'Channel Log', diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index b31ae55f2a..412ee74f47 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -346,7 +346,7 @@ final class PhabricatorConduitAPIController if ($request) { foreach ($request->getAllParameters() as $key => $value) { $param_rows[] = array( - phutil_escape_html($key), + $key, $this->renderAPIValue($value), ); } @@ -362,7 +362,7 @@ final class PhabricatorConduitAPIController $result_rows = array(); foreach ($result as $key => $value) { $result_rows[] = array( - phutil_escape_html($key), + $key, $this->renderAPIValue($value), ); } diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 8e7f2bec39..68f4fb4935 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -109,7 +109,7 @@ final class PhabricatorConduitConsoleController ->setValue('Call Method')); $panel = new AphrontPanelView(); - $panel->setHeader('Conduit API: '.phutil_escape_html($this->method)); + $panel->setHeader('Conduit API: '.$this->method); $panel->appendChild($form); $panel->setWidth(AphrontPanelView::WIDTH_FULL); diff --git a/src/applications/conduit/controller/PhabricatorConduitListController.php b/src/applications/conduit/controller/PhabricatorConduitListController.php index 617ca48288..e80a6fcba6 100644 --- a/src/applications/conduit/controller/PhabricatorConduitListController.php +++ b/src/applications/conduit/controller/PhabricatorConduitListController.php @@ -59,11 +59,11 @@ final class PhabricatorConduitListController $utils = new AphrontPanelView(); $utils->setHeader('Utilities'); - $utils->appendChild( + $utils->appendChild(hsprintf( ''); + '')); $utils->setWidth(AphrontPanelView::WIDTH_FULL); $this->setShowSideNav(false); diff --git a/src/applications/conduit/controller/PhabricatorConduitLogController.php b/src/applications/conduit/controller/PhabricatorConduitLogController.php index a6bcbf74d7..c752714dda 100644 --- a/src/applications/conduit/controller/PhabricatorConduitLogController.php +++ b/src/applications/conduit/controller/PhabricatorConduitLogController.php @@ -65,9 +65,9 @@ final class PhabricatorConduitLogController } $rows[] = array( $call->getConnectionID(), - phutil_escape_html($conn->getUserName()), - phutil_escape_html($call->getMethod()), - phutil_escape_html($call->getError()), + $conn->getUserName(), + $call->getMethod(), + $call->getError(), number_format($call->getDuration()).' us', phabricator_datetime($call->getDateCreated(), $user), ); diff --git a/src/applications/config/controller/PhabricatorConfigAllController.php b/src/applications/config/controller/PhabricatorConfigAllController.php index 60f95b2263..69daa9a760 100644 --- a/src/applications/config/controller/PhabricatorConfigAllController.php +++ b/src/applications/config/controller/PhabricatorConfigAllController.php @@ -14,13 +14,12 @@ final class PhabricatorConfigAllController $key = $option->getKey(); if ($option->getMasked()) { - $value = ''.pht('Masked').''; + $value = phutil_tag('em', array(), pht('Masked')); } else if ($option->getHidden()) { - $value = ''.pht('Hidden').''; + $value = phutil_tag('em', array(), pht('Hidden')); } else { $value = PhabricatorEnv::getEnvConfig($key); $value = PhabricatorConfigJSON::prettyPrintJSON($value); - $value = phutil_escape_html($value); } $rows[] = array( diff --git a/src/applications/config/response/PhabricatorConfigResponse.php b/src/applications/config/response/PhabricatorConfigResponse.php index 479df39cd1..923313bb2a 100644 --- a/src/applications/config/response/PhabricatorConfigResponse.php +++ b/src/applications/config/response/PhabricatorConfigResponse.php @@ -23,20 +23,18 @@ final class PhabricatorConfigResponse extends AphrontHTMLResponse { $view = $this->view->render(); - $template = << - - - Phabricator Setup - {$resources} - - - {$view} - - -EOTEMPLATE; - - return $template; + return hsprintf( + ''. + ''. + ''. + ''. + 'Phabricator Setup'. + '%s'. + ''. + '%s'. + '', + $resources, + $view); } private function buildResources() { @@ -49,11 +47,12 @@ EOTEMPLATE; $resources = array(); foreach ($css as $path) { - $resources[] = ''; + $resources[] = phutil_tag( + 'style', + array('type' => 'text/css'), + Filesystem::readFile($webroot.'/rsrc/css/'.$path)); } - return implode("\n", $resources); + return phutil_implode_html("\n", $resources); } diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index 203a62b81b..6912054f67 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -44,7 +44,7 @@ final class PhabricatorSetupIssueView extends AphrontView { ), array( phutil_tag('p', array(), $run_these), - phutil_tag('pre', array(), array_interleave("\n", $commands)), + phutil_tag('pre', array(), phutil_implode_html("\n", $commands)), )); } @@ -114,7 +114,7 @@ final class PhabricatorSetupIssueView extends AphrontView { array( 'class' => 'setup-issue', ), - $this->renderHTMLView( + $this->renderSingleView( array( $name, $description, @@ -155,7 +155,7 @@ final class PhabricatorSetupIssueView extends AphrontView { 'phabricator/ $ ./bin/config set %s value', $key); } - $update = phutil_tag('pre', array(), array_interleave("\n", $update)); + $update = phutil_tag('pre', array(), phutil_implode_html("\n", $update)); } else { $update = array(); foreach ($configs as $config) { @@ -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, diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index 006049b9c7..67fecfe264 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -159,8 +159,7 @@ abstract class ConpherenceController extends PhabricatorController { $item->addClass('hide-unread-count'); } - // TODO: [HTML] Clean this up when we clean up HTML stuff in Conpherence. - $nav->addCustomBlock(phutil_safe_html($item->render())); + $nav->addCustomBlock($item->render()); } if (empty($conpherences) || $read) { $nav->addCustomBlock($this->getNoConpherencesBlock()); diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 66f80ba133..65eee271f9 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -149,7 +149,7 @@ final class ConpherenceViewController extends ->setMarkupEngine($engine) ->render(); } - $transactions = implode(' ', $rendered_transactions); + $transactions = phutil_implode_html(' ', $rendered_transactions); $form = id(new AphrontFormView()) @@ -283,7 +283,7 @@ final class ConpherenceViewController extends 'src' => $thumb ), ''), - phutil_escape_html($file->getName()), + $file->getName(), ); } $header = id(new PhabricatorHeaderView()) @@ -292,7 +292,7 @@ final class ConpherenceViewController extends ->setNoDataString(pht('No files attached to conpherence.')) ->setHeaders(array('', pht('Name'))) ->setColumnClasses(array('', 'wide')); - return new PhutilSafeHTML($header->render() . $table->render()); + return hsprintf('%s%s', $header->render(), $table->render()); } private function renderTaskWidgetPaneContent() { @@ -328,7 +328,7 @@ final class ConpherenceViewController extends ->setColumnClasses(array('', 'wide')); $content[] = $table->render(); } - return new PhutilSafeHTML(implode('', $content)); + return phutil_implode_html('', $content); } private function renderCalendarWidgetPaneContent() { @@ -416,7 +416,7 @@ final class ConpherenceViewController extends } } - return new PhutilSafeHTML(implode('', $content)); + return phutil_implode_html('', $content); } private function getCalendarWidgetWeekTimestamps() { diff --git a/src/applications/conpherence/storage/ConpherenceTransaction.php b/src/applications/conpherence/storage/ConpherenceTransaction.php index 64afcf9157..b2ff0f97c0 100644 --- a/src/applications/conpherence/storage/ConpherenceTransaction.php +++ b/src/applications/conpherence/storage/ConpherenceTransaction.php @@ -50,18 +50,18 @@ final class ConpherenceTransaction extends PhabricatorApplicationTransaction { $title = pht( '%s renamed this conpherence from "%s" to "%s".', $this->renderHandleLink($author_phid), - phutil_escape_html($old), - phutil_escape_html($new)); + $old, + $new); } else if ($old) { $title = pht( '%s deleted the conpherence name "%s".', $this->renderHandleLink($author_phid), - phutil_escape_html($old)); + $old); } else { $title = pht( '%s named this conpherence "%s".', $this->renderHandleLink($author_phid), - phutil_escape_html($new)); + $new); } return $title; case ConpherenceTransactionType::TYPE_FILES: diff --git a/src/applications/conpherence/view/ConpherenceMenuItemView.php b/src/applications/conpherence/view/ConpherenceMenuItemView.php index c69d7c502d..539a107122 100644 --- a/src/applications/conpherence/view/ConpherenceMenuItemView.php +++ b/src/applications/conpherence/view/ConpherenceMenuItemView.php @@ -139,7 +139,7 @@ final class ConpherenceMenuItemView extends AphrontTagView { (int)$this->unreadCount); } - return $this->renderHTMLView( + return $this->renderSingleView( array( $image, $title, diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php index 2d785dc225..13238c04ec 100644 --- a/src/applications/conpherence/view/ConpherenceTransactionView.php +++ b/src/applications/conpherence/view/ConpherenceTransactionView.php @@ -87,7 +87,7 @@ final class ConpherenceTransactionView extends AphrontView { array( 'class' => $content_class ), - $this->renderHTMLView($content)) + $this->renderSingleView($content)) ); return $transaction_view->render(); diff --git a/src/applications/countdown/controller/PhabricatorCountdownListController.php b/src/applications/countdown/controller/PhabricatorCountdownListController.php index 93e4a916b7..b503d241d3 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownListController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownListController.php @@ -46,7 +46,7 @@ final class PhabricatorCountdownListController 'Delete'); } $rows[] = array( - phutil_escape_html($timer->getID()), + $timer->getID(), $handles[$timer->getAuthorPHID()]->renderLink(), phutil_tag( 'a', diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php index 26059e4ce2..f9a6d4615b 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -30,7 +30,7 @@ final class PhabricatorDaemonConsoleController $rows = array(); foreach ($completed_info as $class => $info) { $rows[] = array( - phutil_escape_html($class), + $class, number_format($info['n']), number_format((int)($info['duration'] / $info['n'])).' us', ); @@ -127,7 +127,7 @@ final class PhabricatorDaemonConsoleController $rows = array(); foreach ($queued as $row) { $rows[] = array( - phutil_escape_html($row['taskClass']), + $row['taskClass'], number_format($row['N']), ); } diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php index 72f9e256aa..811ef354be 100644 --- a/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskUpdateController.php @@ -72,41 +72,40 @@ final class PhabricatorWorkerTaskUpdateController case 'retry': if ($can_retry) { $dialog->setTitle('Really retry task?'); - $dialog->appendChild( - '

The task will be put back in the queue and executed '. - 'again.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'The task will be put back in the queue and executed again.'))); $dialog->addSubmitButton('Retry Task'); } else { $dialog->setTitle('Can Not Retry'); - $dialog->appendChild( - '

Only archived, unsuccessful tasks can be retried.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Only archived, unsuccessful tasks can be retried.'))); } break; case 'cancel': if ($can_cancel) { $dialog->setTitle('Really cancel task?'); - $dialog->appendChild( - '

The work this task represents will never be performed if you '. - 'cancel it. Are you sure you want to cancel it?

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'The work this task represents will never be performed if you '. + 'cancel it. Are you sure you want to cancel it?'))); $dialog->addSubmitButton('Cancel Task'); } else { $dialog->setTitle('Can Not Cancel'); - $dialog->appendChild( - '

Only active tasks can be cancelled.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Only active tasks can be cancelled.'))); } break; case 'release': if ($can_release) { $dialog->setTitle('Really free task lease?'); - $dialog->appendChild( - '

If the process which owns the task lease is still doing work '. + $dialog->appendChild(phutil_tag('p', array(), pht( + 'If the process which owns the task lease is still doing work '. 'on it, the work may be performed twice. Are you sure you '. - 'want to free the lease?

'); + 'want to free the lease?'))); $dialog->addSubmitButton('Free Lease'); } else { $dialog->setTitle('Can Not Free Lease'); - $dialog->appendChild( - '

Only active, leased tasks may have their leases freed.

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Only active, leased tasks may have their leases freed.'))); } break; default: diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php index e3cdc98779..600dc50e14 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php @@ -60,7 +60,7 @@ final class PhabricatorDaemonLogEventsView extends AphrontView { } $row = array( - phutil_escape_html($event->getLogType()), + $event->getLogType(), phabricator_date($event->getEpoch(), $this->user), phabricator_time($event->getEpoch(), $this->user), phutil_escape_html_newlines($message.$more), diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php index 190e17c3cd..47353b948f 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php @@ -76,8 +76,8 @@ final class PhabricatorDaemonLogListView extends AphrontView { $rows[] = array( $running, - phutil_escape_html($log->getDaemon()), - phutil_escape_html($log->getHost()), + $log->getDaemon(), + $log->getHost(), $log->getPID(), phabricator_date($epoch, $this->user), phabricator_time($epoch, $this->user), diff --git a/src/applications/differential/controller/DifferentialCommentSaveController.php b/src/applications/differential/controller/DifferentialCommentSaveController.php index d49232bb37..6f84e33282 100644 --- a/src/applications/differential/controller/DifferentialCommentSaveController.php +++ b/src/applications/differential/controller/DifferentialCommentSaveController.php @@ -60,10 +60,9 @@ final class DifferentialCommentSaveController extends DifferentialController { if (strlen($comment) || $has_inlines) { $dialog->addSubmitButton(pht('Post as Comment')); - $dialog->appendChild('
'); - $dialog->appendChild( - '

'.pht('Do you want to post your feedback anyway, as a normal '. - 'comment?').'

'); + $dialog->appendChild(phutil_tag('br')); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Do you want to post your feedback anyway, as a normal comment?'))); } return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php index afe4847c8c..6503ec2087 100644 --- a/src/applications/differential/controller/DifferentialDiffViewController.php +++ b/src/applications/differential/controller/DifferentialDiffViewController.php @@ -25,16 +25,21 @@ final class DifferentialDiffViewController extends DifferentialController { 'href' => PhabricatorEnv::getURI('/D'.$diff->getRevisionID()), ), 'D'.$diff->getRevisionID()); - $top_panel->appendChild( - "

".pht('This diff belongs to revision %s', $link)."

"); + $top_panel->appendChild(phutil_tag( + 'h1', + array(), + pht('This diff belongs to revision %s', $link))); } else { $action_panel = new AphrontPanelView(); $action_panel->setHeader('Preview Diff'); $action_panel->setWidth(AphrontPanelView::WIDTH_WIDE); - $action_panel->appendChild( - '

'.pht('Review the diff for '. - 'correctness. When you are satisfied, either create a new '. - 'revision or update an existing revision.')); + $action_panel->appendChild(hsprintf( + '

%s

', + pht( + 'Review the diff for correctness. When you are satisfied, either '. + 'create a new revision or update '. + 'an existing revision.', + hsprintf('')))); // TODO: implmenent optgroup support in AphrontFormSelectControl? $select = array(); 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/controller/DifferentialSubscribeController.php b/src/applications/differential/controller/DifferentialSubscribeController.php index 9d1ade910d..99fc019c3a 100644 --- a/src/applications/differential/controller/DifferentialSubscribeController.php +++ b/src/applications/differential/controller/DifferentialSubscribeController.php @@ -43,7 +43,7 @@ final class DifferentialSubscribeController extends DifferentialController { $dialog ->setUser($user) ->setTitle($title) - ->appendChild('

'.$prompt.'

') + ->appendChild(phutil_tag('p', array(), $prompt)) ->setSubmitURI($request->getRequestURI()) ->addSubmitButton($button) ->addCancelButton('/D'.$revision->getID()); diff --git a/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php b/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php index 11f7b5cf19..a246aa1a31 100644 --- a/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php @@ -49,7 +49,7 @@ final class DifferentialBlameRevisionFieldSpecification return null; } $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); - return phutil_safe_html($engine->markupText($this->value)); + return $engine->markupText($this->value); } public function shouldAppearOnConduitView() { diff --git a/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php b/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php index ae8339c05c..b5e6e2a37b 100644 --- a/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php @@ -26,7 +26,7 @@ final class DifferentialCommitsFieldSpecification $links[] = $this->getHandle($commit_phid)->renderLink(); } - return array_interleave(phutil_tag('br'), $links); + return phutil_implode_html(phutil_tag('br'), $links); } private function getCommitPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php b/src/applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php index 43f387bb57..d32047ee22 100644 --- a/src/applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialDependenciesFieldSpecification.php @@ -26,7 +26,7 @@ final class DifferentialDependenciesFieldSpecification $links[] = $this->getHandle($revision_phids)->renderLink(); } - return array_interleave(phutil_tag('br'), $links); + return phutil_implode_html(phutil_tag('br'), $links); } private function getDependentRevisionPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php b/src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php index 05c8ebef91..b195641432 100644 --- a/src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php @@ -26,7 +26,7 @@ final class DifferentialDependsOnFieldSpecification $links[] = $this->getHandle($revision_phids)->renderLink(); } - return array_interleave(phutil_tag('br'), $links); + return phutil_implode_html(phutil_tag('br'), $links); } private function getDependentRevisionPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialFieldSpecification.php b/src/applications/differential/field/specification/DifferentialFieldSpecification.php index d1b6dbdb3b..3521998248 100644 --- a/src/applications/differential/field/specification/DifferentialFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialFieldSpecification.php @@ -283,7 +283,7 @@ abstract class DifferentialFieldSpecification { $links[] = $handle->renderLink(); } - return array_interleave(', ', $links); + return phutil_implode_html(', ', $links); } diff --git a/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php b/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php index 38379da8f2..3112f0f379 100644 --- a/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php @@ -29,7 +29,7 @@ final class DifferentialManiphestTasksFieldSpecification $links[] = $this->getHandle($task_phid)->renderLink(); } - return array_interleave(phutil_tag('br'), $links); + return phutil_implode_html(phutil_tag('br'), $links); } private function getManiphestTaskPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php index b519c3e955..de6a89f05a 100644 --- a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php @@ -143,10 +143,9 @@ final class DifferentialReviewersFieldSpecification if ($other_reviewers) { $names = array(); foreach ($other_reviewers as $reviewer => $_) { - $names[] = phutil_escape_html( - $this->getHandle($reviewer)->getLinkName()); + $names[] = $this->getHandle($reviewer)->getLinkName(); } - $suffix = ' '.javelin_tag( + $suffix = javelin_tag( 'abbr', array( 'sigil' => 'has-tooltip', @@ -159,9 +158,12 @@ final class DifferentialReviewersFieldSpecification } else { $suffix = null; } - return $this->getHandle($primary_reviewer)->renderLink().$suffix; + return hsprintf( + '%s %s', + $this->getHandle($primary_reviewer)->renderLink(), + $suffix); } else { - return 'None'; + return phutil_tag('em', array(), 'None'); } } diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index ae189573ff..6b91e90f43 100644 --- a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php @@ -113,7 +113,7 @@ final class DifferentialUnitFieldSpecification $userdata = idx($test, 'userdata'); if ($userdata) { $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); - $userdata = phutil_safe_html($engine->markupText($userdata)); + $userdata = $engine->markupText($userdata); $rows[] = array( 'style' => 'details', 'value' => $userdata, diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php index 7cd5e115f4..479af1b778 100644 --- a/src/applications/differential/parser/DifferentialChangesetParser.php +++ b/src/applications/differential/parser/DifferentialChangesetParser.php @@ -1092,7 +1092,7 @@ final class DifferentialChangesetParser { * indicator of how well tested a change is. */ public function renderModifiedCoverage() { - $na = '-'; + $na = phutil_tag('em', array(), '-'); $coverage = $this->getCoverage(); if (!$coverage) { diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php index 3032e15cc1..3c8d90dcfd 100644 --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -21,27 +21,34 @@ abstract class DifferentialChangesetHTMLRenderer return null; } } else { + $none = $none; switch ($change) { case DifferentialChangeType::TYPE_ADD: switch ($file) { case DifferentialChangeType::FILE_TEXT: - $message = pht('This file was added.'); + $message = pht('This file was added.', $none); break; case DifferentialChangeType::FILE_IMAGE: - $message = pht('This image was added.'); + $message = pht('This image was added.', $none); break; case DifferentialChangeType::FILE_DIRECTORY: - $message = pht('This directory was added.'); + $message = pht( + 'This directory was added.', + $none); break; case DifferentialChangeType::FILE_BINARY: - $message = pht('This binary file was added.'); + $message = pht( + 'This binary file was added.', + $none); break; case DifferentialChangeType::FILE_SYMLINK: - $message = pht('This symlink was added.'); + $message = pht('This symlink was added.', $none); break; case DifferentialChangeType::FILE_SUBMODULE: - $message = pht('This submodule was added.'); + $message = pht( + 'This submodule was added.', + $none); break; } break; @@ -49,22 +56,30 @@ abstract class DifferentialChangesetHTMLRenderer case DifferentialChangeType::TYPE_DELETE: switch ($file) { case DifferentialChangeType::FILE_TEXT: - $message = pht('This file was deleted.'); + $message = pht('This file was deleted.', $none); break; case DifferentialChangeType::FILE_IMAGE: - $message = pht('This image was deleted.'); + $message = pht('This image was deleted.', $none); break; case DifferentialChangeType::FILE_DIRECTORY: - $message = pht('This directory was deleted.'); + $message = pht( + 'This directory was deleted.', + $none); break; case DifferentialChangeType::FILE_BINARY: - $message = pht('This binary file was deleted.'); + $message = pht( + 'This binary file was deleted.', + $none); break; case DifferentialChangeType::FILE_SYMLINK: - $message = pht('This symlink was deleted.'); + $message = pht( + 'This symlink was deleted.', + $none); break; case DifferentialChangeType::FILE_SUBMODULE: - $message = pht('This submodule was deleted.'); + $message = pht( + 'This submodule was deleted.', + $none); break; } break; @@ -235,10 +250,9 @@ abstract class DifferentialChangesetHTMLRenderer } } - return - '
'. - $message. - '
'; + return hsprintf( + '
%s
', + $message); } protected function renderPropertyChangeHeader() { @@ -279,15 +293,20 @@ abstract class DifferentialChangesetHTMLRenderer } } - return - ''. - ''. - ''. - ''. - ''. - ''. - implode('', $rows). - '
'.pht('Property Changes').''.pht('Old Value').''.pht('New Value').'
'; + array_unshift($rows, hsprintf( + ''. + '%s'. + '%s'. + '%s'. + '', + pht('Property Changes'), + pht('Old Value'), + pht('New Value'))); + + return phutil_tag( + 'table', + array('class' => 'differential-property-table'), + $rows); } public function renderShield($message, $force = 'default') { @@ -352,9 +371,6 @@ abstract class DifferentialChangesetHTMLRenderer return null; } - // TODO: [HTML] After TwoUpRenderer gets refactored, fix this. - $content = phutil_safe_html($content); - return javelin_tag( 'table', array( diff --git a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php index 18f49f6eaa..567116db05 100644 --- a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php @@ -20,32 +20,32 @@ final class DifferentialChangesetOneUpRenderer switch ($type) { case 'old': case 'new': - $out[] = ''; + $out[] = hsprintf(''); if ($type == 'old') { if ($p['htype']) { $class = 'left old'; } else { $class = 'left'; } - $out[] = ''.$p['line'].''; - $out[] = ''; - $out[] = ''.$p['render'].''; + $out[] = hsprintf('%s', $p['line']); + $out[] = hsprintf(''); + $out[] = hsprintf('%s', $class, $p['render']); } else if ($type == 'new') { if ($p['htype']) { $class = 'right new'; - $out[] = ''; + $out[] = hsprintf(''); } else { $class = 'right'; - $out[] = ''.$p['oline'].''; + $out[] = hsprintf('%s', $p['oline']); } - $out[] = ''.$p['line'].''; - $out[] = ''.$p['render'].''; + $out[] = hsprintf('%s', $p['line']); + $out[] = hsprintf('%s', $class, $p['render']); } - $out[] = ''; + $out[] = hsprintf(''); break; case 'inline': - $out[] = ''; - $out[] = ''; + $out[] = hsprintf(''); + $out[] = hsprintf(''); $inline = $this->buildInlineComment( $p['comment'], @@ -53,16 +53,16 @@ final class DifferentialChangesetOneUpRenderer $inline->setBuildScaffolding(false); $out[] = $inline->render(); - $out[] = ''; + $out[] = hsprintf(''); break; default: - $out[] = ''.$type.''; + $out[] = hsprintf('%s', $type); break; } } if ($out) { - return $this->wrapChangeInTable(implode('', $out)); + return $this->wrapChangeInTable(phutil_implode_html('', $out)); } return null; } diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 91cfbebabd..698ef4113f 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -160,7 +160,7 @@ final class DifferentialChangesetTwoUpRenderer 'colspan' => 2, 'class' => 'show-more', ), - array_interleave( + phutil_implode_html( " \xE2\x80\xA2 ", // Bullet $contents)), phutil_tag( @@ -205,7 +205,7 @@ final class DifferentialChangesetTwoUpRenderer } } - $n_copy = ''; + $n_copy = hsprintf(''); $n_cov = null; $n_colspan = 2; $n_classes = ''; @@ -224,7 +224,7 @@ final class DifferentialChangesetTwoUpRenderer $cov_class = $coverage[$n_num - 1]; } $cov_class = 'cov-'.$cov_class; - $n_cov = ''; + $n_cov = hsprintf('', $cov_class); $n_colspan--; } @@ -242,7 +242,7 @@ final class DifferentialChangesetTwoUpRenderer $n_classes = $n_class; if ($new_lines[$ii]['type'] == '\\' || !isset($copy_lines[$n_num])) { - $n_copy = ''; + $n_copy = hsprintf('', $n_class); } else { list($orig_file, $orig_line, $orig_type) = $copy_lines[$n_num]; $title = ($orig_type == '-' ? 'Moved' : 'Copied').' from '; @@ -274,13 +274,13 @@ final class DifferentialChangesetTwoUpRenderer } if ($o_num && $left_id) { - $o_id = ' id="C'.$left_id.$left_char.'L'.$o_num.'"'; + $o_id = 'C'.$left_id.$left_char.'L'.$o_num; } else { $o_id = null; } if ($n_num && $right_id) { - $n_id = ' id="C'.$right_id.$right_char.'L'.$n_num.'"'; + $n_id = 'C'.$right_id.$right_char.'L'.$n_num; } else { $n_id = null; } @@ -288,20 +288,26 @@ final class DifferentialChangesetTwoUpRenderer // NOTE: The Javascript is sensitive to whitespace changes in this // block! - $html[] = + $html[] = hsprintf( ''. - ''.$o_num.''. - ''.$o_text.''. - ''.$n_num.''. - $n_copy. + '%s'. + '%s'. + '%s'. + '%s'. // NOTE: This is a unicode zero-width space, which we use as a hint // when intercepting 'copy' events to make sure sensible text ends // up on the clipboard. See the 'phabricator-oncopy' behavior. - ''. - "\xE2\x80\x8B".$n_text. + ''. + "\xE2\x80\x8B%s". ''. - $n_cov. - ''; + '%s'. + '', + phutil_tag('th', array('id' => $o_id), $o_num), + $o_classes, $o_text, + phutil_tag('th', array('id' => $n_id), $n_num), + $n_copy, + $n_classes, $n_colspan, $n_text, + $n_cov); if ($context_not_available && ($ii == $rows - 1)) { $html[] = $context_not_available; @@ -351,7 +357,7 @@ final class DifferentialChangesetTwoUpRenderer } } - return $this->wrapChangeInTable(implode('', $html)); + return $this->wrapChangeInTable(phutil_implode_html('', $html)); } public function renderFileChange($old_file = null, @@ -395,51 +401,57 @@ final class DifferentialChangesetTwoUpRenderer foreach ($this->getOldComments() as $on_line => $comment_group) { foreach ($comment_group as $comment) { $comment_html = $this->renderInlineComment($comment, $on_right = false); - $html_old[] = + $html_old[] = hsprintf( ''. ''. - ''.$comment_html.''. + '%s'. ''. ''. - ''; + '', + $comment_html); } } foreach ($this->getNewComments() as $lin_line => $comment_group) { foreach ($comment_group as $comment) { $comment_html = $this->renderInlineComment($comment, $on_right = true); - $html_new[] = + $html_new[] = hsprintf( ''. ''. ''. ''. - ''.$comment_html.''. - ''; + '%s'. + '', + $comment_html); } } if (!$old) { - $th_old = ''; + $th_old = hsprintf(''); } else { - $th_old = '1'; + $th_old = hsprintf('1', $vs); } if (!$new) { - $th_new = ''; + $th_new = hsprintf(''); } else { - $th_new = '1'; + $th_new = hsprintf('1', $id); } - $output = + $output = hsprintf( ''. - $th_old. - ''.$old.''. - $th_new. - ''. - $new. - ''. + '%s'. + '%s'. + '%s'. + '%s'. ''. - implode('', $html_old). - implode('', $html_new); + '%s'. + '%s', + $th_old, + $old, + $th_new, + $new, + phutil_implode_html('', $html_old), + phutil_implode_html('', $html_new)); $output = $this->wrapChangeInTable($output); diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php index 0670a062ca..e73679b874 100644 --- a/src/applications/differential/view/DifferentialAddCommentView.php +++ b/src/applications/differential/view/DifferentialAddCommentView.php @@ -155,35 +155,35 @@ final class DifferentialAddCommentView extends AphrontView { 'inline' => 'inline-comment-preview', )); - $warning_container = '
'; + $warning_container = array(); foreach ($warnings as $warning) { if ($warning) { - $warning_container .= $warning->render(); + $warning_container[] = $warning->render(); } } - $warning_container .= '
'; $header = id(new PhabricatorHeaderView()) ->setHeader($is_serious ? pht('Add Comment') : pht('Leap Into Action')); - return - id(new PhabricatorAnchorView()) - ->setAnchorName('comment') - ->setNavigationMarker(true) - ->render(). + return hsprintf( + '%s'. '
'. - $header->render(). - $form->render(). - $warning_container. + '%s%s%s'. '
'. '
'. - ''. - pht('Loading comment preview...'). - ''. + '%s'. '
'. '
'. '
'. '
'. - '
'; + '', + id(new PhabricatorAnchorView()) + ->setAnchorName('comment') + ->setNavigationMarker(true) + ->render(), + $header->render(), + $form->render(), + phutil_tag('div', array('id' => 'warnings'), $warning_container), + pht('Loading comment preview...')); } } diff --git a/src/applications/differential/view/DifferentialChangesetDetailView.php b/src/applications/differential/view/DifferentialChangesetDetailView.php index f77b5377d3..e010d4e539 100644 --- a/src/applications/differential/view/DifferentialChangesetDetailView.php +++ b/src/applications/differential/view/DifferentialChangesetDetailView.php @@ -92,7 +92,7 @@ final class DifferentialChangesetDetailView extends AphrontView { 'class' => $class, 'id' => $id, ), - $this->renderHTMLView( + $this->renderSingleView( array( id(new PhabricatorAnchorView()) ->setAnchorName($changeset->getAnchorName()) @@ -101,7 +101,7 @@ final class DifferentialChangesetDetailView extends AphrontView { $buttons, phutil_tag('h1', array(), $display_filename), phutil_tag('div', array('style' => 'clear: both'), ''), - $this->renderHTMLChildren(), + $this->renderChildren(), ))); } diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index aae5f31f23..422e8fd9ab 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -187,7 +187,7 @@ final class DifferentialChangesetListView extends AphrontView { )); } - return $this->renderHTMLView( + return $this->renderSingleView( array( id(new PhabricatorHeaderView()) ->setHeader($this->getTitle()) @@ -221,15 +221,20 @@ final class DifferentialChangesetListView extends AphrontView { ), array('Changes discarded. ', $link)); - $template = - ''. - ''. - ''. - '
%s%s
'; - return array( - 'l' => sprintf($template, $div, ''), - 'r' => sprintf($template, '', $div), + 'l' => hsprintf( + ''. + ''. + ''. + '
%s
', + $div), + + 'r' => hsprintf( + ''. + ''. + ''. + '
%s
', + $div), ); } diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index cd30fa0c90..63de1f17fd 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -94,22 +94,20 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { $meta[] = pht('Copied to multiple locations:'); } foreach ($away as $path) { - $meta[] = phutil_escape_html($path); + $meta[] = $path; } - $meta = implode('
', $meta); + $meta = phutil_implode_html(phutil_tag('br'), $meta); } else { if ($type == DifferentialChangeType::TYPE_MOVE_AWAY) { - $meta = pht('Moved to %s', phutil_escape_html(reset($away))); + $meta = pht('Moved to %s', reset($away)); } 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) { - $meta = pht('Moved from %s', - phutil_escape_html($changeset->getOldFile())); + $meta = pht('Moved from %s', $changeset->getOldFile()); } else if ($type == DifferentialChangeType::TYPE_COPY_HERE) { - $meta = pht('Copied from %s', - phutil_escape_html($changeset->getOldFile())); + $meta = pht('Copied from %s', $changeset->getOldFile()); } else { $meta = null; } @@ -130,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', @@ -146,27 +144,28 @@ 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[] = + $rows[] = hsprintf( ''. ''. - ''.$meta.''. - ''; + '%s'. + '', + $meta); } if ($this->diff && $this->repository) { $paths[] = @@ -201,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'. '
'. ''. ''. @@ -221,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/DifferentialInlineCommentEditView.php b/src/applications/differential/view/DifferentialInlineCommentEditView.php index 1fccbe5f82..193e3520ca 100644 --- a/src/applications/differential/view/DifferentialInlineCommentEditView.php +++ b/src/applications/differential/view/DifferentialInlineCommentEditView.php @@ -55,7 +55,7 @@ final class DifferentialInlineCommentEditView extends AphrontView { 'method' => 'POST', 'sigil' => 'inline-edit-form', ), - $this->renderHTMLView( + $this->renderSingleView( array( $this->renderInputs(), $this->renderBody(), @@ -123,14 +123,14 @@ final class DifferentialInlineCommentEditView extends AphrontView { array( 'class' => 'differential-inline-comment-edit-body', ), - $this->renderHTMLChildren()); + $this->renderChildren()); $edit = phutil_tag( 'edit', 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, diff --git a/src/applications/differential/view/DifferentialInlineCommentView.php b/src/applications/differential/view/DifferentialInlineCommentView.php index 0fa497fa59..f9ff40e2b7 100644 --- a/src/applications/differential/view/DifferentialInlineCommentView.php +++ b/src/applications/differential/view/DifferentialInlineCommentView.php @@ -178,7 +178,7 @@ final class DifferentialInlineCommentView extends AphrontView { $links = phutil_tag( 'span', array('class' => 'differential-inline-comment-links'), - array_interleave(" \xC2\xB7 ", $links)); + phutil_implode_html(" \xC2\xB7 ", $links)); } else { $links = null; } diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php index d1207252d2..dfb58dd3a8 100644 --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -74,7 +74,7 @@ final class DifferentialLocalCommitsView extends AphrontView { } $parents[$k] = substr($parent, 0, 16); } - $parents = array_interleave(phutil_tag('br'), $parents); + $parents = phutil_implode_html(phutil_tag('br'), $parents); $row[] = phutil_tag('td', array(), $parents); $author = nonempty( @@ -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..cfa4215fd5 100644 --- a/src/applications/differential/view/DifferentialPrimaryPaneView.php +++ b/src/applications/differential/view/DifferentialPrimaryPaneView.php @@ -11,7 +11,7 @@ final class DifferentialPrimaryPaneView extends AphrontView { public function render() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'differential-primary-pane', 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/DifferentialRevisionCommentView.php b/src/applications/differential/view/DifferentialRevisionCommentView.php index 251c6d12fd..226e9a9e82 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentView.php @@ -87,10 +87,9 @@ final class DifferentialRevisionCommentView extends AphrontView { $comment, PhabricatorInlineCommentInterface::MARKUP_FIELD_BODY); - $content = - '
'. - $content. - '
'; + $content = hsprintf( + '
%s
', + $content); } $inline_render = $this->renderInlineComments(); @@ -116,19 +115,22 @@ final class DifferentialRevisionCommentView extends AphrontView { array()); $verb = DifferentialAction::getActionPastTenseVerb($comment->getAction()); - $verb = phutil_escape_html($verb); $actions = array(); // TODO: i18n switch ($comment->getAction()) { case DifferentialAction::ACTION_ADDCCS: - $actions[] = "{$author_link} added CCs: ". - $this->renderHandleList($added_ccs)."."; + $actions[] = hsprintf( + "%s added CCs: %s.", + $author_link, + $this->renderHandleList($added_ccs)); $added_ccs = null; break; case DifferentialAction::ACTION_ADDREVIEWERS: - $actions[] = "{$author_link} added reviewers: ". - $this->renderHandleList($added_reviewers)."."; + $actions[] = hsprintf( + "%s added reviewers: %s.", + $author_link, + $this->renderHandleList($added_reviewers)); $added_reviewers = null; break; case DifferentialAction::ACTION_UPDATE: @@ -140,33 +142,48 @@ final class DifferentialRevisionCommentView extends AphrontView { 'href' => '/D'.$comment->getRevisionID().'?id='.$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 { - $actions[] = "{$author_link} {$verb} this revision."; + $actions[] = hsprintf( + "%s %s this revision.", + $author_link, + $verb); } break; default: - $actions[] = "{$author_link} {$verb} this revision."; + $actions[] = hsprintf( + "%s %s this revision.", + $author_link, + $verb); break; } if ($added_reviewers) { - $actions[] = "{$author_link} added reviewers: ". - $this->renderHandleList($added_reviewers)."."; + $actions[] = hsprintf( + "%s added reviewers: %s.", + $author_link, + $this->renderHandleList($added_reviewers)); } if ($removed_reviewers) { - $actions[] = "{$author_link} removed reviewers: ". - $this->renderHandleList($removed_reviewers)."."; + $actions[] = hsprintf( + "%s removed reviewers: %s.", + $author_link, + $this->renderHandleList($removed_reviewers)); } if ($added_ccs) { - $actions[] = "{$author_link} added CCs: ". - $this->renderHandleList($added_ccs)."."; + $actions[] = hsprintf( + "%s added CCs: %s.", + $author_link, + $this->renderHandleList($added_ccs)); } foreach ($actions as $key => $action) { - $actions[$key] = '
'.$action.'
'; + $actions[$key] = phutil_tag('div', array(), $action); } $xaction_view = id(new PhabricatorTransactionView()) @@ -190,11 +207,10 @@ final class DifferentialRevisionCommentView extends AphrontView { } if (!$hide_comments) { - $xaction_view->appendChild( - '
'. - $content. - '
'. - $this->renderSingleView($inline_render)); + $xaction_view->appendChild(hsprintf( + '
%s%s
', + $content, + $this->renderSingleView($inline_render))); } return $xaction_view->render(); @@ -205,7 +221,7 @@ final class DifferentialRevisionCommentView extends AphrontView { foreach ($phids as $phid) { $result[] = $this->handles[$phid]->renderLink(); } - return implode(', ', $result); + return phutil_implode_html(', ', $result); } private function renderInlineComments() { 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/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php index b0306deec5..aad2cf13f1 100644 --- a/src/applications/differential/view/DifferentialRevisionListView.php +++ b/src/applications/differential/view/DifferentialRevisionListView.php @@ -128,18 +128,18 @@ final class DifferentialRevisionListView extends AphrontView { } else if (array_key_exists($revision->getID(), $this->drafts)) { $src = '/rsrc/image/icon/fatcow/page_white_edit.png'; - $flag = - ''. - phutil_tag( - 'img', - array( - 'src' => celerity_get_resource_uri($src), - 'width' => 16, - 'height' => 16, - 'alt' => 'Draft', - 'title' => pht('Draft Comment'), - )). - ''; + $flag = hsprintf( + '%s', + '/D'.$revision->getID().'#comment-preview', + phutil_tag( + 'img', + array( + 'src' => celerity_get_resource_uri($src), + 'width' => 16, + 'height' => 16, + 'alt' => 'Draft', + 'title' => pht('Draft Comment'), + ))); } $row = array($flag); 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/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index 7d3ac8ed7c..fbc56ffea4 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -21,7 +21,7 @@ final class DiffusionBrowseController extends DiffusionController { $title = 'Tag: '.$drequest->getSymbolicCommit(); $tag_view = new AphrontPanelView(); - $tag_view->setHeader(phutil_escape_html($title)); + $tag_view->setHeader($title); $tag_view->appendChild( $this->markupText($drequest->getTagContent())); @@ -106,7 +106,7 @@ final class DiffusionBrowseController extends DiffusionController { private function markupText($text) { $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); - $text = phutil_safe_html($engine->markupText($text)); + $text = $engine->markupText($text); $text = phutil_tag( 'div', diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 8726c5a91c..db7f751137 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -97,8 +97,7 @@ final class DiffusionCommitController extends DiffusionController { array( 'class' => 'diffusion-commit-message phabricator-remarkup', ), - phutil_safe_html( - $engine->markupText($commit_data->getCommitMessage())))); + $engine->markupText($commit_data->getCommitMessage()))); $content[] = $top_anchor; $content[] = $headsup_view; @@ -449,9 +448,7 @@ final class DiffusionCommitController extends DiffusionController { foreach ($parents as $parent) { $parent_links[] = $handles[$parent->getPHID()]->renderLink(); } - $props['Parents'] = array_interleave( - " \xC2\xB7 ", - $parent_links); + $props['Parents'] = phutil_implode_html(" \xC2\xB7 ", $parent_links); } $request = $this->getDiffusionRequest(); @@ -488,7 +485,7 @@ final class DiffusionCommitController extends DiffusionController { foreach ($task_phids as $phid) { $task_list[] = $handles[$phid]->renderLink(); } - $task_list = array_interleave(phutil_tag('br'), $task_list); + $task_list = phutil_implode_html(phutil_tag('br'), $task_list); $props['Tasks'] = $task_list; } @@ -497,7 +494,7 @@ final class DiffusionCommitController extends DiffusionController { foreach ($proj_phids as $phid) { $proj_list[] = $handles[$phid]->renderLink(); } - $proj_list = array_interleave(phutil_tag('br'), $proj_list); + $proj_list = phutil_implode_html(phutil_tag('br'), $proj_list); $props['Projects'] = $proj_list; } @@ -689,7 +686,7 @@ final class DiffusionCommitController extends DiffusionController { 'inlineuri' => '/diffusion/inline/preview/'.$commit->getPHID().'/', )); - $preview_panel = + $preview_panel = hsprintf( '
@@ -698,27 +695,24 @@ final class DiffusionCommitController extends DiffusionController {
-
'; +
'); // TODO: This is pretty awkward, unify the CSS between Diffusion and // Differential better. require_celerity_resource('differential-core-view-css'); - return phutil_render_tag( + return phutil_tag( 'div', array( 'id' => $pane_id, ), - phutil_render_tag( - 'div', - array( - 'class' => 'differential-add-comment-panel', - ), + hsprintf( + '
%s%s%s
', id(new PhabricatorAnchorView()) ->setAnchorName('comment') ->setNavigationMarker(true) - ->render(). - $panel->render(). + ->render(), + $panel->render(), $preview_panel)); } @@ -938,7 +932,7 @@ final class DiffusionCommitController extends DiffusionController { $ref); } - return array_interleave(', ', $ref_links); + return phutil_implode_html(', ', $ref_links); } private function buildRawDiffResponse(DiffusionRequest $drequest) { diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php index c20e11cb82..f8f5035d58 100644 --- a/src/applications/diffusion/controller/DiffusionExternalController.php +++ b/src/applications/diffusion/controller/DiffusionExternalController.php @@ -103,7 +103,7 @@ final class DiffusionExternalController extends DiffusionController { 'href' => $href, ), 'r'.$repo->getCallsign().$commit->getCommitIdentifier()), - phutil_escape_html($commit->loadCommitData()->getSummary()), + $commit->loadCommitData()->getSummary(), ); } diff --git a/src/applications/diffusion/controller/DiffusionHomeController.php b/src/applications/diffusion/controller/DiffusionHomeController.php index 93d0330414..0d9c5d786e 100644 --- a/src/applications/diffusion/controller/DiffusionHomeController.php +++ b/src/applications/diffusion/controller/DiffusionHomeController.php @@ -19,7 +19,7 @@ final class DiffusionHomeController extends DiffusionController { 'href' => $shortcut->getHref(), ), $shortcut->getName()), - phutil_escape_html($shortcut->getDescription()), + $shortcut->getDescription(), ); } @@ -130,7 +130,7 @@ final class DiffusionHomeController extends DiffusionController { 'href' => '/diffusion/'.$repository->getCallsign().'/', ), $repository->getName()), - phutil_escape_html($repository->getDetail('description')), + $repository->getDetail('description'), PhabricatorRepositoryType::getNameForRepositoryType( $repository->getVersionControlSystem()), $size, diff --git a/src/applications/diffusion/controller/DiffusionLintController.php b/src/applications/diffusion/controller/DiffusionLintController.php index 103fadb646..c239785122 100644 --- a/src/applications/diffusion/controller/DiffusionLintController.php +++ b/src/applications/diffusion/controller/DiffusionLintController.php @@ -71,11 +71,10 @@ final class DiffusionLintController extends DiffusionController { '%s', $drequest->generateURI(array('action' => 'lint')), $drequest->getCallsign()), - phutil_escape_html(ArcanistLintSeverity::getStringForSeverity( - $code['maxSeverity'])), - phutil_escape_html($code['code']), - phutil_escape_html($code['maxName']), - phutil_escape_html($code['maxDescription']), + ArcanistLintSeverity::getStringForSeverity($code['maxSeverity']), + $code['code'], + $code['maxName'], + $code['maxDescription'], ); } diff --git a/src/applications/diffusion/controller/DiffusionLintDetailsController.php b/src/applications/diffusion/controller/DiffusionLintDetailsController.php index 5eec9c507c..877a8479d0 100644 --- a/src/applications/diffusion/controller/DiffusionLintDetailsController.php +++ b/src/applications/diffusion/controller/DiffusionLintDetailsController.php @@ -34,10 +34,9 @@ final class DiffusionLintDetailsController extends DiffusionController { $rows[] = array( $path, $line, - phutil_escape_html(ArcanistLintSeverity::getStringForSeverity( - $message['severity'])), - phutil_escape_html($message['name']), - phutil_escape_html($message['description']), + ArcanistLintSeverity::getStringForSeverity($message['severity']), + $message['name'], + $message['description'], ); } @@ -71,7 +70,7 @@ final class DiffusionLintDetailsController extends DiffusionController { $content[] = id(new AphrontPanelView()) ->setHeader( - ($lint != '' ? phutil_escape_html($lint)." \xC2\xB7 " : ''). + ($lint != '' ? $lint." \xC2\xB7 " : ''). pht('%d Lint Message(s)', count($messages))) ->setCaption($link) ->appendChild($table) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index 714b2819c1..273dbc9250 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -68,7 +68,7 @@ final class DiffusionRepositoryController extends DiffusionController { 'View Full Commit History'); $panel = new AphrontPanelView(); - $panel->setHeader("Recent Commits · {$all}"); + $panel->setHeader(hsprintf("Recent Commits · %s", $all)); $panel->appendChild($history_table); $panel->setNoBackground(); @@ -125,9 +125,7 @@ final class DiffusionRepositoryController extends DiffusionController { $rows = array(); foreach ($properties as $key => $value) { - $rows[] = array( - phutil_escape_html($key), - phutil_escape_html($value)); + $rows[] = array($key, $value); } $table = new AphrontTableView($rows); diff --git a/src/applications/diffusion/controller/DiffusionSymbolController.php b/src/applications/diffusion/controller/DiffusionSymbolController.php index 17fcea83ae..2797bca4b3 100644 --- a/src/applications/diffusion/controller/DiffusionSymbolController.php +++ b/src/applications/diffusion/controller/DiffusionSymbolController.php @@ -81,8 +81,8 @@ final class DiffusionSymbolController extends DiffusionController { $project_name = '-'; } - $file = phutil_escape_html($symbol->getPath()); - $line = phutil_escape_html($symbol->getLineNumber()); + $file = $symbol->getPath(); + $line = $symbol->getLineNumber(); $repo = $symbol->getRepository(); if ($repo) { @@ -101,17 +101,17 @@ final class DiffusionSymbolController extends DiffusionController { ), $file.':'.$line); } else if ($file) { - $location = phutil_escape_html($file.':'.$line); + $location = $file.':'.$line; } else { $location = '?'; } $rows[] = array( - phutil_escape_html($symbol->getSymbolType()), - phutil_escape_html($symbol->getSymbolContext()), - phutil_escape_html($symbol->getSymbolName()), - phutil_escape_html($symbol->getSymbolLanguage()), - phutil_escape_html($project_name), + $symbol->getSymbolType(), + $symbol->getSymbolContext(), + $symbol->getSymbolName(), + $symbol->getSymbolLanguage(), + $project_name, $location, ); } diff --git a/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php b/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php index a4d2d44ceb..6a439ab2c4 100644 --- a/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php +++ b/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php @@ -119,15 +119,14 @@ abstract class DiffusionBrowseQuery { $readme_content = $highlighter ->getHighlightFuture($readme_content) ->resolve(); - $readme_content = nl2br($readme_content); - $readme_content = phutil_safe_html($readme_content); + $readme_content = phutil_escape_html_newlines($readme_content); require_celerity_resource('syntax-highlighting-css'); $class = 'remarkup-code'; } else { // Markup extensionless files as remarkup so we get links and such. $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); - $readme_content = phutil_safe_html($engine->markupText($readme_content)); + $readme_content = $engine->markupText($readme_content); $class = 'phabricator-remarkup'; } diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index 968b071209..3543f1e591 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -55,7 +55,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $committer = self::renderName($committer); } if ($author != $committer) { - $author .= '/'.$committer; + $author = hsprintf('%s/%s', $author, $committer); } } @@ -132,24 +132,17 @@ final class DiffusionBrowseTableView extends DiffusionView { $browse_text = $path->getPath().'/'; $dir_slash = '/'; - $browse_link = ''.$this->linkBrowse( + $browse_link = phutil_tag('strong', array(), $this->linkBrowse( $base_path.$path->getPath().$dir_slash, array( - 'text' => $this->renderPathIcon( - 'dir', - $browse_text), - )).''; + 'text' => $this->renderPathIcon('dir', $browse_text), + ))); } else if ($file_type == DifferentialChangeType::FILE_SUBMODULE) { $browse_text = $path->getPath().'/'; - $browse_link = - ''. - $this->linkExternal( - $path->getHash(), - $path->getExternalURI(), - $this->renderPathIcon( - 'ext', - $browse_text)). - ''; + $browse_link = phutil_tag('strong', array(), $this->linkExternal( + $path->getHash(), + $path->getExternalURI(), + $this->renderPathIcon('ext', $browse_text))); } else { if ($file_type == DifferentialChangeType::FILE_SYMLINK) { $type = 'link'; @@ -190,7 +183,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $need_pull[$uri] = $dict; foreach ($dict as $k => $uniq) { - $dict[$k] = ''; + $dict[$k] = phutil_tag('span', array('id' => $uniq), ''); } } 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/diffusion/view/DiffusionCommentView.php b/src/applications/diffusion/view/DiffusionCommentView.php index 1b37302b34..890052e667 100644 --- a/src/applications/diffusion/view/DiffusionCommentView.php +++ b/src/applications/diffusion/view/DiffusionCommentView.php @@ -114,17 +114,19 @@ final class DiffusionCommentView extends AphrontView { $actions = array(); if ($action == PhabricatorAuditActionConstants::ADD_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) { $rendered_auditors = $this->renderHandleList($added_auditors); - $actions[] = "{$author_link} added auditors: ". - "{$rendered_auditors}."; + $actions[] = hsprintf( + "%s added auditors: %s.", + $author_link, + $rendered_auditors); } else { - $actions[] = "{$author_link} ".phutil_escape_html($verb)." this commit."; + $actions[] = hsprintf("%s %s this commit.", $author_link, $verb); } foreach ($actions as $key => $action) { - $actions[$key] = '
'.$action.'
'; + $actions[$key] = phutil_tag('div', array(), $action); } return $actions; @@ -137,13 +139,12 @@ final class DiffusionCommentView extends AphrontView { if (!strlen($comment->getContent()) && empty($this->inlineComments)) { return null; } else { - return - '
'. - $engine->getOutput( - $comment, - PhabricatorAuditComment::MARKUP_FIELD_BODY). - $this->renderSingleView($this->renderInlines()). - '
'; + return hsprintf( + '
%s%s
', + $engine->getOutput( + $comment, + PhabricatorAuditComment::MARKUP_FIELD_BODY), + $this->renderSingleView($this->renderInlines())); } } @@ -186,7 +187,7 @@ final class DiffusionCommentView extends AphrontView { foreach ($phids as $phid) { $result[] = $this->handles[$phid]->renderLink(); } - return implode(', ', $result); + return phutil_implode_html(', ', $result); } private function renderClasses() { diff --git a/src/applications/diffusion/view/DiffusionCommitChangeTableView.php b/src/applications/diffusion/view/DiffusionCommitChangeTableView.php index 3d6d5eb7b1..3674920a6f 100644 --- a/src/applications/diffusion/view/DiffusionCommitChangeTableView.php +++ b/src/applications/diffusion/view/DiffusionCommitChangeTableView.php @@ -51,7 +51,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView { ), $path); } else { - $path_column = phutil_escape_html($path); + $path_column = $path; } $rows[] = array( diff --git a/src/applications/diffusion/view/DiffusionHistoryTableView.php b/src/applications/diffusion/view/DiffusionHistoryTableView.php index bd35f8134f..39bf2200d0 100644 --- a/src/applications/diffusion/view/DiffusionHistoryTableView.php +++ b/src/applications/diffusion/view/DiffusionHistoryTableView.php @@ -107,7 +107,7 @@ final class DiffusionHistoryTableView extends DiffusionView { } else { $committer = self::renderName($committer); } - $author .= '/'.$committer; + $author = hsprintf('%s/%s', $author, $committer); } $commit = $history->getCommit(); @@ -118,7 +118,7 @@ final class DiffusionHistoryTableView extends DiffusionView { $path = null, $history->getCommitIdentifier()); } else { - $change = "Importing\xE2\x80\xA6"; + $change = phutil_tag('em', array(), "Importing\xE2\x80\xA6"); } $rows[] = array( diff --git a/src/applications/diffusion/view/DiffusionTagListView.php b/src/applications/diffusion/view/DiffusionTagListView.php index b2291dcfe9..500b96f7c1 100644 --- a/src/applications/diffusion/view/DiffusionTagListView.php +++ b/src/applications/diffusion/view/DiffusionTagListView.php @@ -79,7 +79,6 @@ final class DiffusionTagListView extends DiffusionView { $description = $tag->getDescription(); } } - $description = phutil_escape_html($description); $rows[] = array( $tag_link, diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index c36ddc1c46..83a373d403 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -156,7 +156,7 @@ abstract class DiffusionView extends AphrontView { ), $email->getDisplayName()); } - return phutil_escape_html($name); + return hsprintf('%s', $name); } } diff --git a/src/applications/diviner/controller/DivinerListController.php b/src/applications/diviner/controller/DivinerListController.php index 3d408fcc37..ab3089ba91 100644 --- a/src/applications/diviner/controller/DivinerListController.php +++ b/src/applications/diviner/controller/DivinerListController.php @@ -50,10 +50,7 @@ final class DivinerListController extends PhabricatorController { $flavor); } - $out = - '
'. - implode("\n", $out). - '
'; + $out = phutil_tag('div', array('class' => 'aphront-directory-list'), $out); return $this->buildApplicationPage( $out, diff --git a/src/applications/drydock/controller/DrydockController.php b/src/applications/drydock/controller/DrydockController.php index 9b55ff5f01..f9c976c6a7 100644 --- a/src/applications/drydock/controller/DrydockController.php +++ b/src/applications/drydock/controller/DrydockController.php @@ -44,7 +44,7 @@ abstract class DrydockController extends PhabricatorController { 'href' => $lease_uri, ), $log->getLeaseID()), - phutil_escape_html($log->getMessage()), + $log->getMessage(), phabricator_date($log->getEpoch(), $user), ); } diff --git a/src/applications/drydock/controller/DrydockLeaseReleaseController.php b/src/applications/drydock/controller/DrydockLeaseReleaseController.php index 7032917424..dd238e2467 100644 --- a/src/applications/drydock/controller/DrydockLeaseReleaseController.php +++ b/src/applications/drydock/controller/DrydockLeaseReleaseController.php @@ -24,8 +24,8 @@ final class DrydockLeaseReleaseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Lease Not Active')) - ->appendChild( - '

'.pht('You can only release "active" leases.').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'You can only release "active" leases.'))) ->addCancelButton($lease_uri); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -35,11 +35,10 @@ final class DrydockLeaseReleaseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Really release lease?')) - ->appendChild( - '

'.pht( - 'Releasing a lease may cause trouble for the lease holder and '. - 'trigger cleanup of the underlying resource. It can not be '. - 'undone. Continue?').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'Releasing a lease may cause trouble for the lease holder and '. + 'trigger cleanup of the underlying resource. It can not be '. + 'undone. Continue?'))) ->addSubmitButton(pht('Release Lease')) ->addCancelButton($lease_uri); diff --git a/src/applications/drydock/controller/DrydockResourceCloseController.php b/src/applications/drydock/controller/DrydockResourceCloseController.php index 94ac736b78..8b28ce0319 100644 --- a/src/applications/drydock/controller/DrydockResourceCloseController.php +++ b/src/applications/drydock/controller/DrydockResourceCloseController.php @@ -24,8 +24,8 @@ final class DrydockResourceCloseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Resource Not Open')) - ->appendChild( - '

'.pht('You can only close "open" resources.').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'You can only close "open" resources.'))) ->addCancelButton($resource_uri); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -35,10 +35,9 @@ final class DrydockResourceCloseController extends DrydockController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('Really close resource?')) - ->appendChild( - '

'.pht( - 'Closing a resource releases all leases and destroys the '. - 'resource. It can not be undone. Continue?').'

') + ->appendChild(phutil_tag('p', array(), pht( + 'Closing a resource releases all leases and destroys the '. + 'resource. It can not be undone. Continue?'))) ->addSubmitButton(pht('Close Resource')) ->addCancelButton($resource_uri); diff --git a/src/applications/fact/controller/PhabricatorFactHomeController.php b/src/applications/fact/controller/PhabricatorFactHomeController.php index 82ce96baa1..342edb7fa3 100644 --- a/src/applications/fact/controller/PhabricatorFactHomeController.php +++ b/src/applications/fact/controller/PhabricatorFactHomeController.php @@ -32,10 +32,7 @@ final class PhabricatorFactHomeController extends PhabricatorFactController { $name = $spec->getName(); $value = $spec->formatValueForDisplay($user, $fact->getValueX()); - $rows[] = array( - phutil_escape_html($name), - phutil_escape_html($value), - ); + $rows[] = array($name, $value); } $table = new AphrontTableView($rows); 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/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php index c94392b302..f739781194 100644 --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -224,7 +224,7 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface { foreach ($phids as $phid) { $list[] = $this->linkTo($phid); } - return implode(', ', $list); + return phutil_implode_html(', ', $list); } final protected function linkTo($phid) { diff --git a/src/applications/feed/story/PhabricatorFeedStoryAudit.php b/src/applications/feed/story/PhabricatorFeedStoryAudit.php index 9fe789b046..fd3d55e463 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryAudit.php +++ b/src/applications/feed/story/PhabricatorFeedStoryAudit.php @@ -15,11 +15,11 @@ final class PhabricatorFeedStoryAudit extends PhabricatorFeedStory { $action = $this->getValue('action'); $verb = PhabricatorAuditActionConstants::getActionPastTenseVerb($action); - $view->setTitle( - $this->linkTo($author_phid). - " {$verb} commit ". - $this->linkTo($commit_phid). - "."); + $view->setTitle(hsprintf( + '%s %s commit %s.', + $this->linkTo($author_phid), + $verb, + $this->linkTo($commit_phid))); $view->setEpoch($this->getEpoch()); diff --git a/src/applications/feed/story/PhabricatorFeedStoryCommit.php b/src/applications/feed/story/PhabricatorFeedStoryCommit.php index 0e2030cbf3..57989e200c 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryCommit.php +++ b/src/applications/feed/story/PhabricatorFeedStoryCommit.php @@ -19,14 +19,14 @@ final class PhabricatorFeedStoryCommit extends PhabricatorFeedStory { if ($data->getValue('authorPHID')) { $author = $this->linkTo($data->getValue('authorPHID')); } else { - $author = phutil_escape_html($data->getValue('authorName')); + $author = $data->getValue('authorName'); } $committer = null; if ($data->getValue('committerPHID')) { $committer = $this->linkTo($data->getValue('committerPHID')); } else if ($data->getValue('committerName')) { - $committer = phutil_escape_html($data->getValue('committerName')); + $committer = $data->getValue('committerName'); } $commit = $this->linkTo($data->getValue('commitPHID')); @@ -37,9 +37,16 @@ final class PhabricatorFeedStoryCommit extends PhabricatorFeedStory { } if ($author) { - $title = "{$committer} committed {$commit} (authored by {$author})"; + $title = hsprintf( + "%s committed %s (authored by %s)", + $committer, + $commit, + $author); } else { - $title = "{$committer} committed {$commit}"; + $title = hsprintf( + "%s committed %s", + $committer, + $commit); } $view = new PhabricatorFeedStoryView(); diff --git a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php index 6382c39f8b..34ca11edd8 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryDifferential.php +++ b/src/applications/feed/story/PhabricatorFeedStoryDifferential.php @@ -51,7 +51,11 @@ final class PhabricatorFeedStoryDifferential extends PhabricatorFeedStory { $verb = DifferentialAction::getActionPastTenseVerb($action); - $one_line = "{$actor_link} {$verb} revision {$revision_link}"; + $one_line = hsprintf( + '%s %s revision %s', + $actor_link, + $verb, + $revision_link); return $one_line; } diff --git a/src/applications/feed/story/PhabricatorFeedStoryManiphest.php b/src/applications/feed/story/PhabricatorFeedStoryManiphest.php index c6c0348d6d..9f4fc2c23c 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryManiphest.php +++ b/src/applications/feed/story/PhabricatorFeedStoryManiphest.php @@ -66,16 +66,23 @@ final class PhabricatorFeedStoryManiphest case ManiphestAction::ACTION_REASSIGN: if ($owner_phid) { if ($owner_phid == $actor_phid) { - $one_line = "{$actor_link} claimed {$task_link}"; + $one_line = hsprintf('%s claimed %s', $actor_link, $task_link); } else { - $one_line = "{$actor_link} {$verb} {$task_link} to {$owner_link}"; + $one_line = hsprintf('%s %s %s to %s', + $actor_link, + $verb, + $owner_link, + $task_link); } } else { - $one_line = "{$actor_link} placed {$task_link} up for grabs"; + $one_line = hsprintf( + '%s placed %s up for grabs', + $actor_link, + $task_link); } break; default: - $one_line = "{$actor_link} {$verb} {$task_link}"; + $one_line = hsprintf('%s %s %s', $actor_link, $verb, $task_link); break; } diff --git a/src/applications/feed/story/PhabricatorFeedStoryPhriction.php b/src/applications/feed/story/PhabricatorFeedStoryPhriction.php index 9e22f7d5b2..4791214b75 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryPhriction.php +++ b/src/applications/feed/story/PhabricatorFeedStoryPhriction.php @@ -17,10 +17,11 @@ final class PhabricatorFeedStoryPhriction extends PhabricatorFeedStory { $action = $data->getValue('action'); $verb = PhrictionActionConstants::getActionPastTenseVerb($action); - $view->setTitle( - $this->linkTo($author_phid). - " {$verb} the document ". - $this->linkTo($document_phid).'.'); + $view->setTitle(hsprintf( + '%s %s the document %s.', + $this->linkTo($author_phid), + $verb, + $this->linkTo($document_phid))); $view->setEpoch($data->getEpoch()); $action = $data->getValue('action'); diff --git a/src/applications/feed/story/PhabricatorFeedStoryProject.php b/src/applications/feed/story/PhabricatorFeedStoryProject.php index c517a98496..7b4733dfbc 100644 --- a/src/applications/feed/story/PhabricatorFeedStoryProject.php +++ b/src/applications/feed/story/PhabricatorFeedStoryProject.php @@ -21,31 +21,25 @@ final class PhabricatorFeedStoryProject extends PhabricatorFeedStory { switch ($type) { case PhabricatorProjectTransactionType::TYPE_NAME: if (strlen($old)) { - $action = 'renamed project '. - $this->linkTo($proj_phid). - ' from '. - $this->renderString($old). - ' to '. - $this->renderString($new). - '.'; + $action = hsprintf( + 'renamed project %s from %s to %s.', + $this->linkTo($proj_phid), + $this->renderString($old), + $this->renderString($new)); } else { - $action = 'created project '. - $this->linkTo($proj_phid). - ' (as '. - $this->renderString($new). - ').'; + $action = hsprintf( + 'created project %s (as %s).', + $this->linkTo($proj_phid), + $this->renderString($new)); } break; case PhabricatorProjectTransactionType::TYPE_STATUS: - $action = 'changed project '. - $this->linkTo($proj_phid). - ' status from '. - $this->renderString( - PhabricatorProjectStatus::getNameForStatus($old)). - ' to '. - $this->renderString( - PhabricatorProjectStatus::getNameForStatus($new)). - '.'; + $action = hsprintf( + 'changed project %s status from %s to %s.', + $this->linkTo($proj_phid), + $this->renderString(PhabricatorProjectStatus::getNameForStatus($old)), + $this->renderString(PhabricatorProjectStatus::getNameForStatus($new)) + ); break; case PhabricatorProjectTransactionType::TYPE_MEMBERS: $add = array_diff($new, $old); @@ -53,30 +47,33 @@ final class PhabricatorFeedStoryProject extends PhabricatorFeedStory { if ((count($add) == 1) && (count($rem) == 0) && (head($add) == $author_phid)) { - $action = 'joined project '.$this->linkTo($proj_phid).'.'; + $action = hsprintf('joined project %s.', $this->linkTo($proj_phid)); } else if ((count($add) == 0) && (count($rem) == 1) && (head($rem) == $author_phid)) { - $action = 'left project '.$this->linkTo($proj_phid).'.'; + $action = hsprintf('left project %s.', $this->linkTo($proj_phid)); } else if (empty($rem)) { - $action = 'added members to project '. - $this->linkTo($proj_phid).': '. - $this->renderHandleList($add).'.'; + $action = hsprintf( + 'added members to project %s: %s.', + $this->linkTo($proj_phid), + $this->renderHandleList($add)); } else if (empty($add)) { - $action = 'removed members from project '. - $this->linkTo($proj_phid).': '. - $this->renderHandleList($rem).'.'; + $action = hsprintf( + 'removed members from project %s: %s.', + $this->linkTo($proj_phid), + $this->renderHandleList($rem)); } else { - $action = 'changed members of project '. - $this->linkTo($proj_phid).', added: '. - $this->renderHandleList($add).'; removed: '. - $this->renderHandleList($rem).'.'; + $action = hsprintf( + 'changed members of project %s, added: %s; removed: %s.', + $this->linkTo($proj_phid), + $this->renderHandleList($add), + $this->renderHandleList($rem)); } break; default: - $action = 'updated project '.$this->linkTo($proj_phid).'.'; + $action = hsprintf('updated project %s.', $this->linkTo($proj_phid)); break; } - $view->setTitle($this->linkTo($author_phid).' '.$action); + $view->setTitle(hsprintf('%s %s', $this->linkTo($author_phid), $action)); $view->setOneLineStory(true); return $view; diff --git a/src/applications/feed/view/PhabricatorFeedStoryView.php b/src/applications/feed/view/PhabricatorFeedStoryView.php index 9900b5e9a7..fb2d8df8f1 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), @@ -72,7 +72,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { public function render() { - $head = phutil_render_tag( + $head = phutil_tag( 'div', array( 'class' => 'phabricator-feed-story-head', @@ -84,7 +84,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { $image_style = null; if (!$this->oneLine) { - $body = phutil_render_tag( + $body = phutil_tag( 'div', array( 'class' => 'phabricator-feed-story-body', @@ -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/flag/events/PhabricatorFlagsUIEventListener.php b/src/applications/flag/events/PhabricatorFlagsUIEventListener.php index 1ec6e7f1c0..13ba11321b 100644 --- a/src/applications/flag/events/PhabricatorFlagsUIEventListener.php +++ b/src/applications/flag/events/PhabricatorFlagsUIEventListener.php @@ -31,7 +31,7 @@ final class PhabricatorFlagsUIEventListener extends PhutilEventListener { $flag_action = id(new PhabricatorActionView()) ->setWorkflow(true) ->setHref('/flag/delete/'.$flag->getID().'/') - ->setName(phutil_escape_html('Remove '.$color.' Flag')) + ->setName('Remove '.$color.' Flag') ->setIcon('flag-'.$flag->getColor()); } else { $flag_action = id(new PhabricatorActionView()) diff --git a/src/applications/flag/view/PhabricatorFlagListView.php b/src/applications/flag/view/PhabricatorFlagListView.php index 90be2b8f2f..eb200f6088 100644 --- a/src/applications/flag/view/PhabricatorFlagListView.php +++ b/src/applications/flag/view/PhabricatorFlagListView.php @@ -27,7 +27,7 @@ final class PhabricatorFlagListView extends AphrontView { ), ''), $flag->getHandle()->renderLink(), - phutil_escape_html($flag->getNote()), + $flag->getNote(), phabricator_datetime($flag->getDateCreated(), $user), phabricator_form( $user, diff --git a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php index 784f223011..06ea9e9d0e 100644 --- a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php +++ b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php @@ -27,7 +27,7 @@ final class PhabricatorHelpKeyboardShortcutController foreach ($shortcut['keys'] as $stroke) { $keystrokes[] = phutil_tag('kbd', array(), $stroke); } - $keystrokes = array_interleave(' or ', $keystrokes); + $keystrokes = phutil_implode_html(' or ', $keystrokes); $rows[] = phutil_tag( 'tr', array(), @@ -37,10 +37,10 @@ final class PhabricatorHelpKeyboardShortcutController )); } - $table = - ''. - implode('', $rows). - '
'; + $table = phutil_tag( + 'table', + array('class' => 'keyboard-shortcut-help'), + $rows); $dialog = id(new AphrontDialogView()) ->setUser($user) diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index 3903bbcb91..870fab3e68 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -301,8 +301,8 @@ final class HeraldTranscriptController extends HeraldController { } $rows[] = array( - phutil_escape_html($action_names[$apply_xscript->getAction()]), - phutil_escape_html($target), + $action_names[$apply_xscript->getAction()], + $target, hsprintf( 'Taken because: %s
'. 'Outcome: %s %s', @@ -437,10 +437,10 @@ final class HeraldTranscriptController extends HeraldController { $panel = new AphrontPanelView(); $panel->setHeader('Rule Details'); - $panel->appendChild( - '
    '. - implode("\n", $rule_markup). - '
'); + $panel->appendChild(phutil_tag( + 'ul', + array('class' => 'herald-explain-list'), + $rule_markup)); return $panel; } @@ -487,15 +487,10 @@ final class HeraldTranscriptController extends HeraldController { 'class' => 'herald-field-value-transcript', ), $value); - } else { - $value = phutil_escape_html($value); } } - $rows[] = array( - phutil_escape_html($name), - $value, - ); + $rows[] = array($name, $value); } $table = new AphrontTableView($rows); diff --git a/src/applications/herald/view/HeraldRuleEditHistoryView.php b/src/applications/herald/view/HeraldRuleEditHistoryView.php index 7e3fb7b625..7bbfd2342f 100644 --- a/src/applications/herald/view/HeraldRuleEditHistoryView.php +++ b/src/applications/herald/view/HeraldRuleEditHistoryView.php @@ -32,14 +32,14 @@ final class HeraldRuleEditHistoryView extends AphrontView { switch ($edit->getAction()) { case 'create': - $details = "Created rule '{$rule_name}'."; + $details = pht("Created rule '%s'.", $rule_name); break; case 'delete': - $details = "Deleted rule '{$rule_name}'."; + $details = pht("Deleted rule '%s'.", $rule_name); break; case 'edit': default: - $details = "Edited rule '{$rule_name}'."; + $details = pht("Edited rule '%s'.", $rule_name); break; } diff --git a/src/applications/macro/controller/PhabricatorMacroDisableController.php b/src/applications/macro/controller/PhabricatorMacroDisableController.php index 3e9e44aa9e..2dbe854d0c 100644 --- a/src/applications/macro/controller/PhabricatorMacroDisableController.php +++ b/src/applications/macro/controller/PhabricatorMacroDisableController.php @@ -43,10 +43,10 @@ final class PhabricatorMacroDisableController $dialog ->setUser($request->getUser()) ->setTitle(pht('Really disable macro?')) - ->appendChild( - '

'.pht('Really disable the much-beloved image macro %s? '. - 'It will be sorely missed.', phutil_escape_html($macro->getName())). - '

') + ->appendChild(phutil_tag('p', array(), pht( + 'Really disable the much-beloved image macro %s? '. + 'It will be sorely missed.', + $macro->getName()))) ->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/')) ->addSubmitButton(pht('Disable')) ->addCancelButton($view_uri); diff --git a/src/applications/macro/controller/PhabricatorMacroViewController.php b/src/applications/macro/controller/PhabricatorMacroViewController.php index 770ae16a1c..94e0c4691f 100644 --- a/src/applications/macro/controller/PhabricatorMacroViewController.php +++ b/src/applications/macro/controller/PhabricatorMacroViewController.php @@ -147,7 +147,7 @@ final class PhabricatorMacroViewController foreach ($subscribers as $subscriber) { $sub_view[] = $this->getHandle($subscriber)->renderLink(); } - $sub_view = array_interleave(', ', $sub_view); + $sub_view = phutil_implode_html(', ', $sub_view); } else { $sub_view = phutil_tag('em', array(), pht('None')); } diff --git a/src/applications/macro/storage/PhabricatorMacroTransaction.php b/src/applications/macro/storage/PhabricatorMacroTransaction.php index 5711d7899e..bd0ac70c49 100644 --- a/src/applications/macro/storage/PhabricatorMacroTransaction.php +++ b/src/applications/macro/storage/PhabricatorMacroTransaction.php @@ -64,8 +64,8 @@ final class PhabricatorMacroTransaction return pht( '%s renamed this macro from "%s" to "%s".', $this->renderHandleLink($author_phid), - phutil_escape_html($old), - phutil_escape_html($new)); + $old, + $new); break; case PhabricatorMacroTransactionType::TYPE_DISABLED: if ($new) { @@ -109,8 +109,8 @@ final class PhabricatorMacroTransaction '%s renamed %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->renderHandleLink($object_phid), - phutil_escape_html($old), - phutil_escape_html($new)); + $old, + $new); case PhabricatorMacroTransactionType::TYPE_DISABLED: if ($new) { return pht( diff --git a/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php b/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php index c675d4b30b..f5670b4895 100644 --- a/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php +++ b/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php @@ -31,8 +31,8 @@ final class PhabricatorMailingListsListController $rows = array(); foreach ($lists as $list) { $rows[] = array( - phutil_escape_html($list->getName()), - phutil_escape_html($list->getEmail()), + $list->getName(), + $list->getEmail(), phutil_tag( 'a', array( diff --git a/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php b/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php index b393a6e1de..15058a7302 100644 --- a/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php +++ b/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php @@ -152,13 +152,13 @@ class ManiphestAuxiliaryFieldDefaultSpecification switch ($this->getFieldType()) { case self::TYPE_BOOL: if ($this->getValue()) { - return phutil_escape_html($this->getCheckboxValue()); + return $this->getCheckboxValue(); } else { return null; } case self::TYPE_SELECT: $display = idx($this->getSelectOptions(), $this->getValue()); - return phutil_escape_html($display); + return $display; } return parent::renderForDetailView(); } @@ -203,10 +203,6 @@ class ManiphestAuxiliaryFieldDefaultSpecification break; } - if ($target == self::RENDER_TARGET_HTML) { - $desc = phutil_escape_html($desc); - } - return $desc; } diff --git a/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php b/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php index fba027e838..216227194d 100644 --- a/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php +++ b/src/applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php @@ -71,7 +71,7 @@ abstract class ManiphestAuxiliaryFieldSpecification { } public function renderForDetailView() { - return phutil_escape_html($this->getValue()); + return $this->getValue(); } diff --git a/src/applications/maniphest/controller/ManiphestExportController.php b/src/applications/maniphest/controller/ManiphestExportController.php index 591e8ff310..a33809b745 100644 --- a/src/applications/maniphest/controller/ManiphestExportController.php +++ b/src/applications/maniphest/controller/ManiphestExportController.php @@ -28,7 +28,7 @@ final class ManiphestExportController extends ManiphestController { $dialog->setUser($user); $dialog->setTitle('Excel Export Not Configured'); - $dialog->appendChild( + $dialog->appendChild(hsprintf( '

This system does not have PHPExcel installed. This software '. 'component is required to export tasks to Excel. Have your system '. 'administrator install it from:

'. @@ -38,7 +38,7 @@ final class ManiphestExportController extends ManiphestController { '

'. '
'. '

Your PHP "include_path" needs to be updated to include the '. - 'PHPExcel Classes/ directory.

'); + 'PHPExcel Classes/ directory.

')); $dialog->addCancelButton('/maniphest/'); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -59,8 +59,8 @@ final class ManiphestExportController extends ManiphestController { $dialog->setUser($user); $dialog->setTitle('Export Tasks to Excel'); - $dialog->appendChild( - '

Do you want to export the query results to Excel?

'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Do you want to export the query results to Excel?'))); $dialog->addCancelButton('/maniphest/'); $dialog->addSubmitButton('Export to Excel'); diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index 34c2b30494..229ba2e1f4 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -244,7 +244,7 @@ final class ManiphestReportController extends ManiphestController { )); if ($handle) { - $header = "Task Burn Rate for Project ".$handle->renderLink(); + $header = pht("Task Burn Rate for Project %s", $handle->renderLink()); $caption = hsprintf( "

NOTE: This table reflects tasks currently in ". "the project. If a task was opened in the past but added to ". @@ -363,9 +363,9 @@ final class ManiphestReportController extends ManiphestController { $fmt = number_format($delta); if ($delta > 0) { $fmt = '+'.$fmt; - $fmt = ''.$fmt.''; + $fmt = hsprintf('%s', $fmt); } else { - $fmt = ''.$fmt.''; + $fmt = hsprintf('%s', $fmt); } return array( diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php index d6377c10b7..2f80e6028d 100644 --- a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php +++ b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php @@ -81,7 +81,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { 'value' => 0, 'checked' => ($default === null ? 'checked' : null), )), - 'No Default', + phutil_tag('em', array(), 'No Default'), '', '', ); @@ -111,7 +111,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { 'Save Default Query')); $panel->appendChild($table); - $form = phabricator_render_form( + $form = phabricator_form( $user, array( 'method' => 'POST', diff --git a/src/applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php b/src/applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php index 64fa264dc8..ee185362c5 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDescriptionPreviewController.php @@ -18,10 +18,9 @@ final class ManiphestTaskDescriptionPreviewController ManiphestTask::MARKUP_FIELD_DESCRIPTION, $request->getUser()); - $content = - '

'. - $output. - '
'; + $content = hsprintf( + '
%s
', + $output); return id(new AphrontAjaxResponse()) ->setContent($content); diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index b4567f0ddf..4cb394d8c5 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.'); } @@ -305,14 +301,13 @@ final class ManiphestTaskDetailController extends ManiphestController { $comment_header = id(new PhabricatorHeaderView()) ->setHeader($is_serious ? pht('Add Comment') : pht('Weigh In')); - $preview_panel = + $preview_panel = hsprintf( '
-
- '.pht('Loading preview...').' -
+
%s
-
'; + ', + pht('Loading preview...')); $transaction_view = new ManiphestTransactionListView(); $transaction_view->setTransactions($transactions); diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 23fcf30bee..3ca0812884 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -456,7 +456,7 @@ final class ManiphestTaskEditController extends ManiphestController { if ($files) { $file_display = mpull($files, 'getName'); - $file_display = array_interleave(phutil_tag('br'), $file_display); + $file_display = phutil_implode_html(phutil_tag('br'), $file_display); $form->appendChild( id(new AphrontFormMarkupControl()) @@ -512,7 +512,7 @@ final class ManiphestTaskEditController extends ManiphestController { $panel->appendChild($form); $panel->setNoBackground(); - $description_preview_panel = + $description_preview_panel = hsprintf( '
Description Preview @@ -522,7 +522,7 @@ final class ManiphestTaskEditController extends ManiphestController { Loading preview...
- '; + '); Javelin::initBehavior( 'maniphest-description-preview', @@ -542,7 +542,7 @@ final class ManiphestTaskEditController extends ManiphestController { array( $error_view, $panel, - $description_preview_panel + $description_preview_panel, ), array( 'title' => $header_name, 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/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php index f808ab9104..aa8baac074 100644 --- a/src/applications/maniphest/view/ManiphestTaskListView.php +++ b/src/applications/maniphest/view/ManiphestTaskListView.php @@ -45,7 +45,7 @@ final class ManiphestTaskListView extends ManiphestView { $views[] = $view->render(); } - return $this->renderHTMLView($views); + return $this->renderSingleView($views); } } diff --git a/src/applications/maniphest/view/ManiphestTaskProjectsView.php b/src/applications/maniphest/view/ManiphestTaskProjectsView.php index 00f4ad86f2..f292157a91 100644 --- a/src/applications/maniphest/view/ManiphestTaskProjectsView.php +++ b/src/applications/maniphest/view/ManiphestTaskProjectsView.php @@ -52,7 +52,7 @@ final class ManiphestTaskProjectsView extends ManiphestView { "\xE2\x80\xA6"); } - return $this->renderHTMLView($tags); + return $this->renderSingleView($tags); } } diff --git a/src/applications/maniphest/view/ManiphestTransactionDetailView.php b/src/applications/maniphest/view/ManiphestTransactionDetailView.php index 4d5afbf8ad..62294c91ae 100644 --- a/src/applications/maniphest/view/ManiphestTransactionDetailView.php +++ b/src/applications/maniphest/view/ManiphestTransactionDetailView.php @@ -179,17 +179,17 @@ final class ManiphestTransactionDetailView extends ManiphestView { } if ($this->getRenderSummaryOnly()) { - return implode("\n", $descs); + return phutil_implode_html("\n", $descs); } if ($comment_transaction && $comment_transaction->hasComments()) { $comment_block = $this->markupEngine->getOutput( $comment_transaction, ManiphestTransaction::MARKUP_FIELD_BODY); - $comment_block = - '
'. - $comment_block. - '
'; + $comment_block = phutil_tag( + 'div', + array('class' => 'maniphest-transaction-comments phabricator-remarkup'), + $comment_block); } else { $comment_block = null; } @@ -590,9 +590,6 @@ final class ManiphestTransactionDetailView extends ManiphestView { DifferentialChangesetParser::parseRangeSpecification($spec); $output = $parser->render($range_s, $range_e, $mask); - // TODO: [HTML] DifferentialChangesetParser needs cleanup. - $output = phutil_safe_html($output); - return $output; } @@ -627,7 +624,7 @@ final class ManiphestTransactionDetailView extends ManiphestView { $links[] = $this->handles[$phid]->renderLink(); } } - return implode(', ', $links); + return phutil_implode_html(', ', $links); } private function renderString($string) { 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/meta/view/PhabricatorApplicationLaunchView.php b/src/applications/meta/view/PhabricatorApplicationLaunchView.php index 8af4f65ff4..faa0c348ff 100644 --- a/src/applications/meta/view/PhabricatorApplicationLaunchView.php +++ b/src/applications/meta/view/PhabricatorApplicationLaunchView.php @@ -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, diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAListController.php b/src/applications/metamta/controller/PhabricatorMetaMTAListController.php index eca61ceaf9..f7eb0ffbe6 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTAListController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAListController.php @@ -67,7 +67,7 @@ final class PhabricatorMetaMTAListController phabricator_datetime($mail->getDateCreated(), $user), phabricator_format_relative_time_detailed( time() - $mail->getDateModified()), - phutil_escape_html($mail->getSubject()), + $mail->getSubject(), phutil_tag( 'a', array( diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAReceivedListController.php b/src/applications/metamta/controller/PhabricatorMetaMTAReceivedListController.php index d55f4b7174..42913bb32d 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTAReceivedListController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAReceivedListController.php @@ -38,7 +38,7 @@ final class PhabricatorMetaMTAReceivedListController $mail->getRelatedPHID() ? $handles[$mail->getRelatedPHID()]->renderLink() : '-', - phutil_escape_html($mail->getMessage()), + $mail->getMessage(), ); } diff --git a/src/applications/notification/controller/PhabricatorNotificationListController.php b/src/applications/notification/controller/PhabricatorNotificationListController.php index 739a70f3ae..1557c8acc8 100644 --- a/src/applications/notification/controller/PhabricatorNotificationListController.php +++ b/src/applications/notification/controller/PhabricatorNotificationListController.php @@ -43,19 +43,16 @@ final class PhabricatorNotificationListController if ($notifications) { $builder = new PhabricatorNotificationBuilder($notifications); - $view = $builder->buildView(); + $view = $builder->buildView()->render(); } else { - $view = - '
'. - $no_data. - '
'; + $view = hsprintf( + '
%s
', + $no_data); } - $view = array( - '
', - $view, - '
', - ); + $view = hsprintf( + '
%s
', + $view); $panel = new AphrontPanelView(); $panel->setHeader($header); diff --git a/src/applications/notification/controller/PhabricatorNotificationPanelController.php b/src/applications/notification/controller/PhabricatorNotificationPanelController.php index b25365c607..19a811fe4e 100644 --- a/src/applications/notification/controller/PhabricatorNotificationPanelController.php +++ b/src/applications/notification/controller/PhabricatorNotificationPanelController.php @@ -20,25 +20,23 @@ final class PhabricatorNotificationPanelController $notifications_view = $builder->buildView(); $content = $notifications_view->render(); } else { - $content = - '
'. - 'You have no notifications.'. - '
'; + $content = hsprintf( + '
%s
', + pht('You have no notifications.')); } - $content = - '
'. - pht('Notifications'). - '
'. - $content. - '
'. - phutil_tag( - 'a', - array( - 'href' => '/notification/', - ), - 'View All Notifications'). - '
'; + $content = hsprintf( + '
%s
'. + '%s'. + '
%s
', + pht('Notifications'), + $content, + phutil_tag( + 'a', + array( + 'href' => '/notification/', + ), + 'View All Notifications')); $unread_count = id(new PhabricatorFeedStoryNotification()) ->countUnread($user); diff --git a/src/applications/notification/controller/PhabricatorNotificationStatusController.php b/src/applications/notification/controller/PhabricatorNotificationStatusController.php index 5c28923b9f..7f40302ff2 100644 --- a/src/applications/notification/controller/PhabricatorNotificationStatusController.php +++ b/src/applications/notification/controller/PhabricatorNotificationStatusController.php @@ -45,22 +45,19 @@ final class PhabricatorNotificationStatusController $rows = array(); foreach ($status as $key => $value) { - $label = phutil_escape_html($key); - switch ($key) { case 'uptime': $value /= 1000; $value = phabricator_format_relative_time_detailed($value); break; case 'log': - $value = phutil_escape_html($value); break; default: - $value = phutil_escape_html(number_format($value)); + $value = number_format($value); break; } - $rows[] = array($label, $value); + $rows[] = array($key, $value); } $table = new AphrontTableView($rows); diff --git a/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php b/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php index a0b4e1d592..4eb21e5b80 100644 --- a/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php +++ b/src/applications/oauthserver/controller/PhabricatorOAuthServerAuthController.php @@ -143,8 +143,7 @@ extends PhabricatorAuthController { // display time -- make a nice form for the user to grant the client // access to the granularity specified by $scope - $name = phutil_escape_html($client->getName()); - $title = 'Authorize ' . $name . '?'; + $title = 'Authorize '.$client->getName().'?'; $panel = new AphrontPanelView(); $panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setHeader($title); diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php index cb893c78ea..ae3f85a3ac 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientDeleteController.php @@ -32,15 +32,13 @@ extends PhabricatorOAuthClientBaseController { ->setURI('/oauthserver/client/?deleted=1'); } - $client_name = phutil_escape_html($client->getName()); - $title .= ' '.$client_name; + $title .= ' '.$client->getName(); $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle($title); - $dialog->appendChild( - '

Are you sure you want to delete this client?

' - ); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to delete this client?'))); $dialog->addSubmitButton(); $dialog->addCancelButton($client->getEditURI()); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php index 51104ae880..b8d6d65907 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php @@ -113,10 +113,8 @@ extends PhabricatorOAuthClientBaseController { $new = $this->getRequest()->getStr('new'); $deleted = $this->getRequest()->getBool('deleted'); if ($edited) { - $edited = phutil_escape_html($edited); $title = 'Successfully edited client with id '.$edited.'.'; } else if ($new) { - $new = phutil_escape_html($new); $title = 'Successfully created client with id '.$new.'.'; } else if ($deleted) { $title = 'Successfully deleted client.'; diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php index 94c9839d79..4f366c53d9 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationDeleteController.php @@ -37,20 +37,17 @@ extends PhabricatorOAuthClientAuthorizationBaseController { ->loadOneWhere('phid = %s', $client_phid); if ($client) { - $client_name = phutil_escape_html($client->getName()); - $title .= ' for '.$client_name; + $title .= ' for '.$client->getName(); } else { // the client does not exist so token is dead already (but // let's let the user clean this up anyway in that case) - $client_name = ''; } $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle($title); - $dialog->appendChild( - '

Are you sure you want to delete this client authorization?

' - ); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to delete this client authorization?'))); $dialog->addSubmitButton(); $dialog->addCancelButton($authorization->getEditURI()); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php index c3b0a927af..d45e4dc96d 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php @@ -137,7 +137,6 @@ extends PhabricatorOAuthClientAuthorizationBaseController { $edited = $this->getRequest()->getStr('edited'); $deleted = $this->getRequest()->getBool('deleted'); if ($edited) { - $edited = phutil_escape_html($edited); $title = 'Successfully edited client authorization.'; } else if ($deleted) { $title = 'Successfully deleted client authorization.'; diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index 58afadf36d..eae6ac2050 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -47,32 +47,25 @@ final class PhabricatorOwnersDetailController $rows = array(); - $rows[] = array( - 'Name', - phutil_escape_html($package->getName())); - $rows[] = array( - 'Description', - phutil_escape_html($package->getDescription())); + $rows[] = array('Name', $package->getName()); + $rows[] = array('Description', $package->getDescription()); $primary_owner = null; $primary_phid = $package->getPrimaryOwnerPHID(); if ($primary_phid && isset($handles[$primary_phid])) { - $primary_owner = - ''.$handles[$primary_phid]->renderLink().''; + $primary_owner = phutil_tag( + 'strong', + array(), + $handles[$primary_phid]->renderLink()); } - $rows[] = array( - 'Primary Owner', - $primary_owner, - ); + $rows[] = array('Primary Owner', $primary_owner); $owner_links = array(); foreach ($owners as $owner) { $owner_links[] = $handles[$owner->getUserPHID()]->renderLink(); } - $owner_links = implode('
', $owner_links); - $rows[] = array( - 'Owners', - $owner_links); + $owner_links = phutil_implode_html(phutil_tag('br'), $owner_links); + $rows[] = array('Owners', $owner_links); $rows[] = array( 'Auditing', @@ -99,14 +92,14 @@ final class PhabricatorOwnersDetailController 'href' => (string) $href, ), $path->getPath()); - $path_links[] = - ($path->getExcluded() ? '–' : '+').' '. - $repo_name.' '.$path_link; + $path_links[] = hsprintf( + '%s %s %s', + ($path->getExcluded() ? "\xE2\x80\x93" : '+'), + $repo_name, + $path_link); } - $path_links = implode('
', $path_links); - $rows[] = array( - 'Paths', - $path_links); + $path_links = phutil_implode_html(phutil_tag('br'), $path_links); + $rows[] = array('Paths', $path_links); $table = new AphrontTableView($rows); $table->setColumnClasses( @@ -116,8 +109,7 @@ final class PhabricatorOwnersDetailController )); $panel = new AphrontPanelView(); - $panel->setHeader( - 'Package Details for "'.phutil_escape_html($package->getName()).'"'); + $panel->setHeader('Package Details for "'.$package->getName().'"'); $panel->addButton( javelin_tag( 'a', @@ -207,7 +199,7 @@ final class PhabricatorOwnersDetailController $commit_panels = array(); foreach ($commit_views as $commit_view) { $commit_panel = new AphrontPanelView(); - $commit_panel->setHeader(phutil_escape_html($commit_view['header'])); + $commit_panel->setHeader($commit_view['header']); if (isset($commit_view['button'])) { $commit_panel->addButton($commit_view['button']); } diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index 9a140620b1..babe04b9c1 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -235,10 +235,10 @@ final class PhabricatorOwnersListController foreach ($pkg_owners as $key => $owner) { $pkg_owners[$key] = $handles[$owner->getUserPHID()]->renderLink(); if ($owner->getUserPHID() == $package->getPrimaryOwnerPHID()) { - $pkg_owners[$key] = ''.$pkg_owners[$key].''; + $pkg_owners[$key] = phutil_tag('strong', array(), $pkg_owners[$key]); } } - $pkg_owners = implode('
', $pkg_owners); + $pkg_owners = phutil_implode_html(phutil_tag('br'), $pkg_owners); $pkg_paths = idx($paths, $package->getID(), array()); foreach ($pkg_paths as $key => $path) { @@ -251,20 +251,21 @@ final class PhabricatorOwnersListController 'path' => $path->getPath(), 'action' => 'browse', )); - $pkg_paths[$key] = - ($path->getExcluded() ? '–' : '+').' '. - phutil_tag('strong', array(), $repo->getName()). + $pkg_paths[$key] = hsprintf( + '%s %s%s', + ($path->getExcluded() ? "\xE2\x80\x93" : '+'), + phutil_tag('strong', array(), $repo->getName()), phutil_tag( 'a', array( 'href' => (string) $href, ), - $path->getPath()); + $path->getPath())); } else { - $pkg_paths[$key] = phutil_escape_html($path->getPath()); + $pkg_paths[$key] = $path->getPath(); } } - $pkg_paths = implode('
', $pkg_paths); + $pkg_paths = phutil_implode_html(phutil_tag('br'), $pkg_paths); $rows[] = array( phutil_tag( diff --git a/src/applications/paste/controller/PhabricatorPasteListController.php b/src/applications/paste/controller/PhabricatorPasteListController.php index def6cc8f66..7d22d6fd62 100644 --- a/src/applications/paste/controller/PhabricatorPasteListController.php +++ b/src/applications/paste/controller/PhabricatorPasteListController.php @@ -109,7 +109,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController { $lang_name = $paste->getLanguage(); if ($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); diff --git a/src/applications/people/controller/PhabricatorPeopleLdapController.php b/src/applications/people/controller/PhabricatorPeopleLdapController.php index f29efb5335..0567e90b4c 100644 --- a/src/applications/people/controller/PhabricatorPeopleLdapController.php +++ b/src/applications/people/controller/PhabricatorPeopleLdapController.php @@ -153,34 +153,29 @@ final class PhabricatorPeopleLdapController private function renderUserInputs($user) { $username = $user[0]; - $inputs = phutil_tag( - 'input', - array( - 'type' => 'checkbox', - 'name' => 'usernames[]', - 'value' =>$username, - ), - ''); - - $inputs .= phutil_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => "email[$username]", - 'value' =>$user[1], - ), - ''); - - $inputs .= phutil_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => "name[$username]", - 'value' =>$user[2], - ), - ''); - - return $inputs; + return hsprintf( + '%s%s%s', + phutil_tag( + 'input', + array( + 'type' => 'checkbox', + 'name' => 'usernames[]', + 'value' => $username, + )), + phutil_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => "email[$username]", + 'value' => $user[1], + )), + phutil_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => "name[$username]", + 'value' => $user[2], + ))); } } diff --git a/src/applications/people/controller/PhabricatorPeopleListController.php b/src/applications/people/controller/PhabricatorPeopleListController.php index 290f77f174..f7eb21597a 100644 --- a/src/applications/people/controller/PhabricatorPeopleListController.php +++ b/src/applications/people/controller/PhabricatorPeopleListController.php @@ -55,7 +55,7 @@ final class PhabricatorPeopleListController 'href' => '/p/'.$user->getUsername().'/', ), $user->getUserName()), - phutil_escape_html($user->getRealName()), + $user->getRealName(), $status, $email, phutil_tag( diff --git a/src/applications/people/controller/PhabricatorPeopleLogsController.php b/src/applications/people/controller/PhabricatorPeopleLogsController.php index 9b10f34396..de42b37a33 100644 --- a/src/applications/people/controller/PhabricatorPeopleLogsController.php +++ b/src/applications/people/controller/PhabricatorPeopleLogsController.php @@ -157,10 +157,8 @@ final class PhabricatorPeopleLogsController phabricator_date($log->getDateCreated(),$user), phabricator_time($log->getDateCreated(),$user), $log->getAction(), - $log->getActorPHID() - ? phutil_escape_html($handles[$log->getActorPHID()]->getName()) - : null, - phutil_escape_html($handles[$log->getUserPHID()]->getName()), + $log->getActorPHID() ? $handles[$log->getActorPHID()]->getName() : null, + $handles[$log->getUserPHID()]->getName(), json_encode($log->getOldValue(), true), json_encode($log->getNewValue(), true), phutil_tag( diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index d16f5d948e..c255897caf 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -142,7 +142,7 @@ final class PhabricatorPeopleProfileController $nav->appendChild($header); - $content = '
'.$content.'
'; + $content = hsprintf('
%s
', $content); $header->appendChild($content); if ($user->getPHID() == $viewer->getPHID()) { @@ -172,13 +172,11 @@ final class PhabricatorPeopleProfileController $blurb = nonempty( $profile->getBlurb(), - '//'. - pht('Nothing is known about this rare specimen.') - .'//' + '//'.pht('Nothing is known about this rare specimen.').'//' ); $engine = PhabricatorMarkupEngine::newProfileMarkupEngine(); - $blurb = phutil_safe_html($engine->markupText($blurb)); + $blurb = $engine->markupText($blurb); $viewer = $this->getRequest()->getUser(); @@ -232,12 +230,11 @@ final class PhabricatorPeopleProfileController $builder->setUser($viewer); $view = $builder->buildView(); - return + return hsprintf( '

Activity Feed

-
- '.$view->render().' -
-
'; +
%s
+
', + $view->render()); } } diff --git a/src/applications/phame/controller/blog/PhameBlogDeleteController.php b/src/applications/phame/controller/blog/PhameBlogDeleteController.php index eb6f4695a8..e6d9b4dff6 100644 --- a/src/applications/phame/controller/blog/PhameBlogDeleteController.php +++ b/src/applications/phame/controller/blog/PhameBlogDeleteController.php @@ -41,7 +41,7 @@ final class PhameBlogDeleteController extends PhameController { ->appendChild( pht( 'Really delete the blog "%s"? It will be gone forever.', - phutil_escape_html($blog->getName()))) + $blog->getName())) ->addSubmitButton(pht('Delete')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phame/controller/post/PhamePostDeleteController.php b/src/applications/phame/controller/post/PhamePostDeleteController.php index 26719ff61c..8faa715a5e 100644 --- a/src/applications/phame/controller/post/PhamePostDeleteController.php +++ b/src/applications/phame/controller/post/PhamePostDeleteController.php @@ -41,7 +41,7 @@ final class PhamePostDeleteController extends PhameController { ->appendChild( pht( 'Really delete the post "%s"? It will be gone forever.', - phutil_escape_html($post->getTitle()))) + $post->getTitle())) ->addSubmitButton(pht('Delete')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phame/controller/post/PhamePostEditController.php b/src/applications/phame/controller/post/PhamePostEditController.php index 20217edc51..9af5a98b43 100644 --- a/src/applications/phame/controller/post/PhamePostEditController.php +++ b/src/applications/phame/controller/post/PhamePostEditController.php @@ -148,7 +148,7 @@ final class PhamePostEditController ->setValue($submit_button) ); - $preview_panel = + $preview_panel = hsprintf( '
Post Preview @@ -158,7 +158,7 @@ final class PhamePostEditController Loading preview...
- '; + '); require_celerity_resource('phame-css'); Javelin::initBehavior( diff --git a/src/applications/phame/controller/post/PhamePostNotLiveController.php b/src/applications/phame/controller/post/PhamePostNotLiveController.php index c2b4983736..885bc3b1a9 100644 --- a/src/applications/phame/controller/post/PhamePostNotLiveController.php +++ b/src/applications/phame/controller/post/PhamePostNotLiveController.php @@ -25,16 +25,16 @@ final class PhamePostNotLiveController extends PhameController { $reasons = array(); if (!$post->getBlog()) { - $reasons[] = - '

'.pht('You can not view the live version of this post because it '. + $reasons[] = phutil_tag('p', array(), pht( + 'You can not view the live version of this post because it '. 'is not associated with a blog. Move the post to a blog in order to '. - 'view it live.').'

'; + 'view it live.')); } if ($post->isDraft()) { - $reasons[] = - '

'.pht('You can not view the live version of this post because it '. - 'is still a draft. Use "Preview/Publish" to publish the post.').'

'; + $reasons[] = phutil_tag('p', array(), pht( + 'You can not view the live version of this post because it '. + 'is still a draft. Use "Preview/Publish" to publish the post.')); } if ($reasons) { diff --git a/src/applications/phame/controller/post/PhamePostPreviewController.php b/src/applications/phame/controller/post/PhamePostPreviewController.php index 38b007178d..06fe3de4da 100644 --- a/src/applications/phame/controller/post/PhamePostPreviewController.php +++ b/src/applications/phame/controller/post/PhamePostPreviewController.php @@ -23,7 +23,7 @@ extends PhameController { PhamePost::MARKUP_FIELD_BODY, $user); - $content = '
'.$content.'
'; + $content = hsprintf('
%s
', $content); return id(new AphrontAjaxResponse())->setContent($content); } diff --git a/src/applications/phame/controller/post/PhamePostUnpublishController.php b/src/applications/phame/controller/post/PhamePostUnpublishController.php index efc8153dab..f70cff773c 100644 --- a/src/applications/phame/controller/post/PhamePostUnpublishController.php +++ b/src/applications/phame/controller/post/PhamePostUnpublishController.php @@ -45,7 +45,7 @@ final class PhamePostUnpublishController extends PhameController { pht( 'The post "%s" will no longer be visible to other users until you '. 'republish it.', - phutil_escape_html($post->getTitle()))) + $post->getTitle())) ->addSubmitButton(pht('Unpublish')) ->addCancelButton($cancel_uri); diff --git a/src/applications/phame/skins/PhameBasicBlogSkin.php b/src/applications/phame/skins/PhameBasicBlogSkin.php index 569bb6b3b3..2c6f91e97b 100644 --- a/src/applications/phame/skins/PhameBasicBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicBlogSkin.php @@ -123,7 +123,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { } protected function render404Page() { - return '

404 Not Found

'; + return hsprintf('

404 Not Found

'); } final public function getResourceURI($resource) { diff --git a/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php b/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php index 39dc7df989..7ccd2cffe9 100644 --- a/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php @@ -26,7 +26,7 @@ final class PhameBasicTemplateBlogSkin extends PhameBasicBlogSkin { 'href' => $this->getResourceURI('css/'.$path), )); } - $this->cssResources = implode("\n", $this->cssResources); + $this->cssResources = phutil_implode_html("\n", $this->cssResources); } $request = $this->getRequest(); @@ -43,7 +43,7 @@ final class PhameBasicTemplateBlogSkin extends PhameBasicBlogSkin { ); $response = new AphrontWebpageResponse(); - $response->setContent(implode("\n", $content)); + $response->setContent(phutil_implode_html("\n", $content)); return $response; } diff --git a/src/applications/phid/controller/PhabricatorPHIDLookupController.php b/src/applications/phid/controller/PhabricatorPHIDLookupController.php index c6228df5c2..e7c93f60ba 100644 --- a/src/applications/phid/controller/PhabricatorPHIDLookupController.php +++ b/src/applications/phid/controller/PhabricatorPHIDLookupController.php @@ -24,9 +24,9 @@ final class PhabricatorPHIDLookupController } $rows[] = array( - phutil_escape_html($handle->getPHID()), - phutil_escape_html($handle->getType()), - phutil_escape_html($handle->getName()), + $handle->getPHID(), + $handle->getType(), + $handle->getName(), $link, ); } diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php index 94a3e447c7..361b7257fb 100644 --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -145,7 +145,7 @@ final class PholioMockViewController extends PholioController { foreach ($subscribers as $subscriber) { $sub_view[] = $this->getHandle($subscriber)->renderLink(); } - $sub_view = array_interleave(', ', $sub_view); + $sub_view = phutil_implode_html(', ', $sub_view); } else { $sub_view = phutil_tag('em', array(), pht('None')); } diff --git a/src/applications/pholio/storage/PholioTransaction.php b/src/applications/pholio/storage/PholioTransaction.php index 55a5ab7ba6..ece88cbdd5 100644 --- a/src/applications/pholio/storage/PholioTransaction.php +++ b/src/applications/pholio/storage/PholioTransaction.php @@ -44,15 +44,15 @@ final class PholioTransaction extends PhabricatorApplicationTransaction { return pht( '%s renamed this mock from "%s" to "%s".', $this->renderHandleLink($author_phid), - phutil_escape_html($old), - phutil_escape_html($new)); + $old, + $new); break; case PholioTransactionType::TYPE_DESCRIPTION: return pht( '%s updated the description of this mock. '. 'The old description was: %s', $this->renderHandleLink($author_phid), - phutil_escape_html($old)); + $old); } return parent::getTitle(); diff --git a/src/applications/pholio/view/PholioMockImagesView.php b/src/applications/pholio/view/PholioMockImagesView.php index b43020e8f1..7ab6363b89 100644 --- a/src/applications/pholio/view/PholioMockImagesView.php +++ b/src/applications/pholio/view/PholioMockImagesView.php @@ -91,6 +91,6 @@ final class PholioMockImagesView extends AphrontView { $thumbnails); } - return $this->renderHTMLView($mockview); + return $this->renderSingleView($mockview); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php index c21f9f2b0b..bec14d9a21 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewFramesetController.php @@ -14,12 +14,15 @@ final class PhabricatorXHPASTViewFramesetController $response = new AphrontWebpageResponse(); $response->setFrameable(true); - $response->setContent( - ''. - ''. - ''. - ''. - ''); + $response->setContent(hsprintf( + ''. + ''. + ''. + ''. + '', + $id, + $id, + $id)); return $response; } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php index 0d90598190..48ba6afc33 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewInputController.php @@ -5,7 +5,6 @@ final class PhabricatorXHPASTViewInputController public function processRequest() { $input = $this->getStorageTree()->getInput(); - return $this->buildXHPASTViewPanelResponse( - phutil_escape_html($input)); + return $this->buildXHPASTViewPanelResponse($input); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php index b4494eb44e..0e43c418f1 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php @@ -20,7 +20,7 @@ abstract class PhabricatorXHPASTViewPanelController } protected function buildXHPASTViewPanelResponse($content) { - $content = + $content = hsprintf( ''. ''. ''. @@ -57,10 +57,9 @@ li span { '. ''. - ''. - $content. - ''. - ''; + '%s'. + '', + $content); $response = new AphrontWebpageResponse(); $response->setFrameable(true); diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php index bf7c620be9..4931ab29e3 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php @@ -27,6 +27,7 @@ final class PhabricatorXHPASTViewStreamController $token->getValue()); } - return $this->buildXHPASTViewPanelResponse(implode('', $tokens)); + return $this->buildXHPASTViewPanelResponse( + phutil_implode_html('', $tokens)); } } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php index 5b7673386e..b332784e92 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php @@ -12,7 +12,7 @@ final class PhabricatorXHPASTViewTreeController $input, array(0, $stdout, '')); - $tree = '
    '.$this->buildTree($tree->getRootNode()).'
'; + $tree = phutil_tag('ul', array(), $this->buildTree($tree->getRootNode())); return $this->buildXHPASTViewPanelResponse($tree); } @@ -27,19 +27,19 @@ final class PhabricatorXHPASTViewTreeController } $tree = array(); - $tree[] = - '
  • '. - phutil_tag( - 'span', - array( - 'title' => $title, - ), - $name). - '
  • '; + $tree[] = phutil_tag( + 'li', + array(), + phutil_tag( + 'span', + array( + 'title' => $title, + ), + $name)); foreach ($root->getChildren() as $child) { - $tree[] = '
      '.$this->buildTree($child).'
    '; + $tree[] = phutil_tag('ul', array(), $this->buildTree($child)); } - return implode("\n", $tree); + return phutil_implode_html("\n", $tree); } } diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php index 0cc32b75e4..7ce9082a29 100644 --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -155,28 +155,32 @@ final class PhrictionDiffController $link_r = pht('Most Recent Change'); } - $navigation_table = + $navigation_table = hsprintf( ' - - + + -
    '; + ', + $link_l, + $link_r); } - $output = + $output = hsprintf( '
    '. - $comparison_table->render(). - '
    '. - '
    '. - $navigation_table. + '%s

    %s'. ''. - ''. + ''. '
    '.$revert_l.''.$revert_r.'
    %s%s
    '. - $output. - '
    '; + '%s'. + '', + $comparison_table->render(), + $navigation_table, + $revert_l, + $revert_r, + $output); return $this->buildStandardPageResponse( array( @@ -234,9 +238,9 @@ final class PhrictionDiffController $rows[] = array( phabricator_date($c->getDateCreated(), $user), phabricator_time($c->getDateCreated(), $user), - phutil_escape_html('Version '.$c->getVersion()), + 'Version '.$c->getVersion(), $handles[$c->getAuthorPHID()]->renderLink(), - phutil_escape_html($c->getDescription()), + $c->getDescription(), ); } diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index bf925650b7..338d894a66 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -110,9 +110,9 @@ final class PhrictionDocumentController $project_info = null; if ($project_phid) { - $project_info = - '
    This document is about the project '. - $handles[$project_phid]->renderLink().'.'; + $project_info = hsprintf( + '
    This document is about the project %s.', + $handles[$project_phid]->renderLink()); } $index_link = phutil_tag( @@ -122,12 +122,11 @@ final class PhrictionDocumentController ), pht('Document Index')); - $byline = - ''; + $byline = hsprintf( + '', + $when, + $handles[$content->getAuthorPHID()]->renderLink(), + $project_info); $doc_status = $document->getStatus(); @@ -145,19 +144,18 @@ final class PhrictionDocumentController throw new Exception("Unknown document status '{$doc_status}'!"); } - $page_content = - '
    '. - $index_link. - $byline. - $core_content. - '
    '; + $page_content = hsprintf( + '
    %s%s%s
    ', + $index_link, + $byline, + $core_content); } if ($version_note) { $version_note = $version_note->render(); } - $children = $this->renderChildren($slug); + $children = $this->renderDocumentChildren($slug); $crumbs = $this->buildApplicationCrumbs(); $crumb_views = $this->renderBreadcrumbs($slug); @@ -170,17 +168,14 @@ final class PhrictionDocumentController $header = id(new PhabricatorHeaderView()) ->setHeader($page_title); - $page = - $crumbs->render(). - $header->render(). - $actions->render(). - $version_note. - $page_content. - $children; - return $this->buildApplicationPage( array( - $page, + $crumbs->render(), + $header->render(), + $actions->render(), + $version_note, + $page_content, + $children, ), array( 'title' => $page_title, @@ -225,7 +220,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'); @@ -309,31 +304,32 @@ final class PhrictionDocumentController $children = isort($children, 'title'); $list = array(); - $list[] = '
      '; foreach ($children as $child) { + $list[] = hsprintf('
    • '); $list[] = $this->renderChildDocumentLink($child); $grand = idx($grandchildren, $child['slug'], array()); if ($grand) { - $list[] = '
        '; + $list[] = hsprintf('
          '); foreach ($grand as $grandchild) { + $list[] = hsprintf('
        • '); $list[] = $this->renderChildDocumentLink($grandchild); + $list[] = hsprintf('
        • '); } - $list[] = '
        '; + $list[] = hsprintf('
      '); } + $list[] = hsprintf('
    • '); } if ($more_children) { - $list[] = '
    • '.pht('More...').'
    • '; + $list[] = phutil_tag('li', array(), pht('More...')); } - $list[] = '
    '; - $list = implode("\n", $list); - return + return hsprintf( '
    '. - '
    '. - pht('Document Hierarchy'). - '
    '. - $list. - '
    '; + '
    %s
    '. + '%s'. + '', + pht('Document Hierarchy'), + phutil_tag('ul', array(), $list)); } private function renderChildDocumentLink(array $info) { @@ -346,10 +342,10 @@ final class PhrictionDocumentController $title); if (isset($info['empty'])) { - $item = ''.$item.''; + $item = phutil_tag('em', array(), $item); } - return '
  • '.$item.'
  • '; + return $item; } } diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index 188d54a14c..2b9b5bee23 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -108,8 +108,8 @@ final class PhrictionEditController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('No Edits')); - $dialog->appendChild( - '

    '.pht('You did not make any changes to the document.').'

    '); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You did not make any changes to the document.'))); $dialog->addCancelButton($request->getRequestURI()); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -122,8 +122,8 @@ final class PhrictionEditController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Empty Page')); - $dialog->appendChild( - '

    '.pht('You can not create an empty document.').'

    '); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'You can not create an empty document.'))); $dialog->addCancelButton($request->getRequestURI()); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -231,17 +231,15 @@ final class PhrictionEditController ->setHeader($panel_header) ->appendChild($form); - $preview_panel = + $preview_panel = hsprintf( '
    -
    - '.pht('Document Preview').' -
    +
    %s
    -
    - '.pht('Loading preview...').' -
    +
    %s
    -
    '; + ', + pht('Document Preview'), + pht('Loading preview...')); Javelin::initBehavior( 'phriction-document-preview', diff --git a/src/applications/phriction/controller/PhrictionHistoryController.php b/src/applications/phriction/controller/PhrictionHistoryController.php index f09521fe62..68c570ba73 100644 --- a/src/applications/phriction/controller/PhrictionHistoryController.php +++ b/src/applications/phriction/controller/PhrictionHistoryController.php @@ -49,7 +49,7 @@ final class PhrictionHistoryController $diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/'); - $vs_previous = ''.pht('Created').''; + $vs_previous = phutil_tag('em', array(), pht('Created')); if ($content->getVersion() != 1) { $uri = $diff_uri ->alter('l', $content->getVersion() - 1) @@ -62,7 +62,7 @@ final class PhrictionHistoryController pht('Show Change')); } - $vs_head = ''.pht('Current').''; + $vs_head = phutil_tag('em', array(), pht('Current')); if ($content->getID() != $document->getContentID()) { $uri = $diff_uri ->alter('l', $content->getVersion()) @@ -90,7 +90,7 @@ final class PhrictionHistoryController pht('Version %s', $version)), $handles[$content->getAuthorPHID()]->renderLink(), $change_type, - phutil_escape_html($content->getDescription()), + $content->getDescription(), $vs_previous, $vs_head, ); diff --git a/src/applications/phriction/storage/PhrictionContent.php b/src/applications/phriction/storage/PhrictionContent.php index 6c13c55fb7..ebc252cba8 100644 --- a/src/applications/phriction/storage/PhrictionContent.php +++ b/src/applications/phriction/storage/PhrictionContent.php @@ -75,20 +75,19 @@ final class PhrictionContent extends PhrictionDAO $engine); if ($toc) { - $toc = + $toc = hsprintf( '
    '. - '
    '. - pht('Table of Contents'). - '
    '. - $toc. - '
    '; + '
    %s
    '. + '%s'. + '', + pht('Table of Contents'), + $toc); } - return - '
    '. - $toc. - $output. - '
    '; + return hsprintf( + '
    %s%s
    ', + $toc, + $output); } diff --git a/src/applications/policy/filter/PhabricatorPolicy.php b/src/applications/policy/filter/PhabricatorPolicy.php index 305cae4cd1..8f8d1120f8 100644 --- a/src/applications/policy/filter/PhabricatorPolicy.php +++ b/src/applications/policy/filter/PhabricatorPolicy.php @@ -84,7 +84,7 @@ final class PhabricatorPolicy { ), $this->getName()); } else { - $desc = phutil_escape_html($this->getName()); + $desc = $this->getName(); } switch ($this->getType()) { diff --git a/src/applications/ponder/controller/PonderAnswerSaveController.php b/src/applications/ponder/controller/PonderAnswerSaveController.php index 85a311bcc6..9f505a3287 100644 --- a/src/applications/ponder/controller/PonderAnswerSaveController.php +++ b/src/applications/ponder/controller/PonderAnswerSaveController.php @@ -23,7 +23,8 @@ final class PonderAnswerSaveController extends PonderController { $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Empty answer'); - $dialog->appendChild('

    Your answer must not be empty.

    '); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Your answer must not be empty.'))); $dialog->addCancelButton('/Q'.$question_id); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/ponder/controller/PonderCommentSaveController.php b/src/applications/ponder/controller/PonderCommentSaveController.php index 125fee9a52..54bbc8a2ba 100644 --- a/src/applications/ponder/controller/PonderCommentSaveController.php +++ b/src/applications/ponder/controller/PonderCommentSaveController.php @@ -32,7 +32,8 @@ final class PonderCommentSaveController extends PonderController { $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Empty comment'); - $dialog->appendChild('

    Your comment must not be empty.

    '); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Your comment must not be empty.'))); $dialog->addCancelButton('/Q'.$question_id); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/ponder/controller/PonderQuestionAskController.php b/src/applications/ponder/controller/PonderQuestionAskController.php index 405ce3f7c5..77c6770ffe 100644 --- a/src/applications/ponder/controller/PonderQuestionAskController.php +++ b/src/applications/ponder/controller/PonderQuestionAskController.php @@ -74,14 +74,13 @@ final class PonderQuestionAskController extends PonderController { id(new AphrontFormSubmitControl()) ->setValue('Ask Away!')); - $preview = + $preview = hsprintf( '
    '. '
    '. - ''. - pht('Loading question preview...'). - ''. + '%s'. '
    '. - '
    '; + '', + pht('Loading question preview...')); Javelin::initBehavior( 'ponder-feedback-preview', 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/PonderAnswerListView.php b/src/applications/ponder/view/PonderAnswerListView.php index fa42d222a9..87c4674ae9 100644 --- a/src/applications/ponder/view/PonderAnswerListView.php +++ b/src/applications/ponder/view/PonderAnswerListView.php @@ -70,7 +70,8 @@ final class PonderAnswerListView extends AphrontView { $panel->appendChild($view); $panel->appendChild($commentview); - $panel->appendChild('
    '); + $panel->appendChild( + hsprintf('
    ')); } diff --git a/src/applications/ponder/view/PonderPostBodyView.php b/src/applications/ponder/view/PonderPostBodyView.php index 4bfb4362ea..1f02c5e8ff 100644 --- a/src/applications/ponder/view/PonderPostBodyView.php +++ b/src/applications/ponder/view/PonderPostBodyView.php @@ -64,7 +64,7 @@ final class PonderPostBodyView extends AphrontView { $content); $author = $this->handles[$target->getAuthorPHID()]; - $actions = array($author->renderLink().' '.$this->action); + $actions = array(hsprintf('%s %s', $author->renderLink(), $this->action)); $author_link = $author->renderLink(); $xaction_view = id(new PhabricatorTransactionView()) ->setUser($user) 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( ''; + '%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..11cbe6cde0 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,7 +80,7 @@ final class PonderVotableView extends AphrontView { 'class' => 'ponder-votebox', ), array($up, $count, $down)), - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'ponder-votebox-content', diff --git a/src/applications/project/controller/PhabricatorProjectListController.php b/src/applications/project/controller/PhabricatorProjectListController.php index 704acef6e5..ffcd020baa 100644 --- a/src/applications/project/controller/PhabricatorProjectListController.php +++ b/src/applications/project/controller/PhabricatorProjectListController.php @@ -97,10 +97,9 @@ final class PhabricatorProjectListController 'href' => '/project/view/'.$project->getID().'/', ), $project->getName()), - phutil_escape_html( - PhabricatorProjectStatus::getNameForStatus($project->getStatus())), - phutil_escape_html($blurb), - phutil_escape_html($population), + PhabricatorProjectStatus::getNameForStatus($project->getStatus()), + $blurb, + $population, phutil_tag( 'a', array( diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index 1c1dfa7473..1d817d691c 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -113,7 +113,7 @@ final class PhabricatorProjectMembersEditController $panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setNoBackground(); $panel->appendChild($form); - $panel->appendChild('
    '); + $panel->appendChild(phutil_tag('br')); $panel->appendChild($faux_form); $nav = $this->buildLocalNavigation($project); diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index df47270792..a4b22e6fdf 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -55,7 +55,7 @@ final class PhabricatorProjectProfileController $query->setViewer($this->getRequest()->getUser()); $stories = $query->execute(); - $content .= $this->renderStories($stories); + $content = hsprintf('%s%s', $content, $this->renderStories($stories)); break; case 'about': $content = $this->renderAboutPage($project, $profile); @@ -114,7 +114,7 @@ final class PhabricatorProjectProfileController $nav_view->appendChild($header); - $content = '
    '.$content.'
    '; + $content = hsprintf('
    %s
    ', $content); $header->appendChild($content); return $this->buildApplicationPage( @@ -183,25 +183,23 @@ final class PhabricatorProjectProfileController $affiliated = array(); foreach ($handles as $phids => $handle) { - $affiliated[] = '
  • '.$handle->renderLink().'
  • '; + $affiliated[] = phutil_tag('li', array(), $handle->renderLink()); } if ($affiliated) { - $affiliated = '
      '.implode("\n", $affiliated).'
    '; + $affiliated = phutil_tag('ul', array(), $affiliated); } else { - $affiliated = - '

    '. - pht('No one is affiliated with this project.'). - '

    '; + $affiliated = hsprintf('

    %s

    ', pht( + 'No one is affiliated with this project.')); } - return + return hsprintf( '
    '. - '

    '.pht('People').'

    '. - '
    '. - $affiliated. - '
    '. - '
    '; + '

    %s

    '. + '
    %s
    '. + '', + pht('People'), + $affiliated); } private function renderFeedPage( @@ -228,15 +226,13 @@ final class PhabricatorProjectProfileController $builder->setUser($this->getRequest()->getUser()); $view = $builder->buildView(); - return + return hsprintf( '
    '. - '

    '. - pht('Activity Feed'). - '

    '. - '
    '. - $view->render(). - '
    '. - '
    '; + '

    %s

    '. + '
    %s
    '. + '', + pht('Activity Feed'), + $view->render()); } @@ -267,9 +263,9 @@ final class PhabricatorProjectProfileController } if (empty($tasks)) { - $task_views = ''.pht('No open tasks.').''; + $task_views = phutil_tag('em', array(), pht('No open tasks.')); } else { - $task_views = implode('', $task_views); + $task_views = phutil_implode_html('', $task_views); } $open = number_format($count); @@ -281,18 +277,17 @@ final class PhabricatorProjectProfileController ), pht("View All Open Tasks \xC2\xBB")); - $content = + $content = hsprintf( '
    -

    '. - pht("Open Tasks (%d)", $open). - '

    '. +

    %s

    '. '
    '. - $task_views. - ''. + '%s'. + ''. '
    -
    '; + ', + pht('Open Tasks (%s)', $open), + $task_views, + $more_link); return $content; } diff --git a/src/applications/project/controller/PhabricatorProjectUpdateController.php b/src/applications/project/controller/PhabricatorProjectUpdateController.php index f6b6910eda..2c27daf760 100644 --- a/src/applications/project/controller/PhabricatorProjectUpdateController.php +++ b/src/applications/project/controller/PhabricatorProjectUpdateController.php @@ -62,11 +62,9 @@ final class PhabricatorProjectUpdateController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Really leave project?')); - $dialog->appendChild( - '

    '. - pht('Your tremendous contributions to this project will be sorely '. - 'missed. Are you sure you want to leave?'). - '

    '); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Your tremendous contributions to this project will be sorely '. + 'missed. Are you sure you want to leave?'))); $dialog->addCancelButton($project_uri); $dialog->addSubmitButton(pht('Leave Project')); break; diff --git a/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php b/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php index 7d51f23d26..fd827987fc 100644 --- a/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php +++ b/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php @@ -45,7 +45,7 @@ final class ConduitAPI_remarkup_process_Method extends ConduitAPIMethod { $text = $engine->markupText($content); if ($text) { - $content = phutil_safe_html($text)->getHTMLContent(); + $content = hsprintf('%s', $text)->getHTMLContent(); } else { $content = ''; } diff --git a/src/applications/repository/controller/PhabricatorRepositoryListController.php b/src/applications/repository/controller/PhabricatorRepositoryListController.php index 3b32685467..f09c5096ae 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryListController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryListController.php @@ -27,12 +27,12 @@ final class PhabricatorRepositoryListController ), 'View in Diffusion'); } else { - $diffusion_link = 'Not Tracked'; + $diffusion_link = phutil_tag('em', array(), 'Not Tracked'); } $rows[] = array( - phutil_escape_html($repo->getCallsign()), - phutil_escape_html($repo->getName()), + $repo->getCallsign(), + $repo->getName(), PhabricatorRepositoryType::getNameForRepositoryType( $repo->getVersionControlSystem()), $diffusion_link, @@ -98,13 +98,13 @@ final class PhabricatorRepositoryListController foreach ($projects as $project) { $repo = idx($repos, $project->getRepositoryID()); if ($repo) { - $repo_name = phutil_escape_html($repo->getName()); + $repo_name = $repo->getName(); } else { $repo_name = '-'; } $rows[] = array( - phutil_escape_html($project->getName()), + $project->getName(), $repo_name, phutil_tag( 'a', diff --git a/src/applications/search/controller/PhabricatorSearchController.php b/src/applications/search/controller/PhabricatorSearchController.php index 93e55a11de..e0f128a73e 100644 --- a/src/applications/search/controller/PhabricatorSearchController.php +++ b/src/applications/search/controller/PhabricatorSearchController.php @@ -242,18 +242,18 @@ final class PhabricatorSearchController ->setObject(idx($objects, $phid)); $results[] = $view->render(); } - $results = + $results = hsprintf( '
    '. - implode("\n", $results). - '
    '. - $pager->render(). - '
    '. - '
    '; + '%s'. + '
    %s
    '. + '', + phutil_implode_html("\n", $results), + $pager->render()); } else { - $results = + $results = hsprintf( '
    '. '

    No search results.

    '. - '
    '; + ''); } } else { $results = null; 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/settings/panel/PhabricatorSettingsPanelConduit.php b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php index d4ccec4194..7c9199e279 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php @@ -26,9 +26,9 @@ final class PhabricatorSettingsPanelConduit $dialog->setSubmitURI($this->getPanelURI()); $dialog->addSubmitButton('Regenerate'); $dialog->addCancelbutton($this->getPanelURI()); - $dialog->appendChild( - '

    Really destroy the old certificate? Any established '. - 'sessions will be terminated.'); + $dialog->appendChild(phutil_tag('p', array(), pht( + 'Really destroy the old certificate? Any established '. + 'sessions will be terminated.'))); return id(new AphrontDialogResponse()) ->setDialog($dialog); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php index 86a0d10dbc..09d385c506 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php @@ -103,7 +103,7 @@ final class PhabricatorSettingsPanelEmailAddresses } $rows[] = array( - phutil_escape_html($email->getAddress()), + $email->getAddress(), $action, $remove, ); @@ -191,9 +191,9 @@ final class PhabricatorSettingsPanelEmailAddresses ->setUser($user) ->addHiddenInput('new', 'verify') ->setTitle('Verification Email Sent') - ->appendChild( - '

    A verification email has been sent. Click the link in the '. - 'email to verify your address.

    ') + ->appendChild(phutil_tag('p', array(), pht( + 'A verification email has been sent. Click the link in the '. + 'email to verify your address.'))) ->setSubmitURI($uri) ->addSubmitButton('Done'); @@ -264,9 +264,9 @@ final class PhabricatorSettingsPanelEmailAddresses ->setUser($user) ->addHiddenInput('delete', $email_id) ->setTitle("Really delete address '{$address}'?") - ->appendChild( - '

    Are you sure you want to delete this address? You will no '. - 'longer be able to use it to login.

    ') + ->appendChild(phutil_tag('p', array(), pht( + 'Are you sure you want to delete this address? You will no '. + 'longer be able to use it to login.'))) ->addSubmitButton('Delete') ->addCancelButton($uri); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php b/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php index 25df530fdb..4adb085f63 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php @@ -75,7 +75,7 @@ final class PhabricatorSettingsPanelLDAP foreach ($forms as $name => $form) { if ($name) { - $panel->appendChild('

    '.$name.'


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

    %s


    ', $name)); } $panel->appendChild($form); } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php b/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php index b95640ba48..a1df581abb 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php @@ -215,7 +215,7 @@ final class PhabricatorSettingsPanelOAuth foreach ($forms as $name => $form) { if ($name) { - $panel->appendChild('

    '.$name.'


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

    %s


    ', $name)); } $panel->appendChild($form); } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php index 133c45ec9c..0519e45c54 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php @@ -182,8 +182,8 @@ final class PhabricatorSettingsPanelSSHKeys 'href' => $this->getPanelURI('?edit='.$key->getID()), ), $key->getName()), - phutil_escape_html($key->getKeyComment()), - phutil_escape_html($key->getKeyType()), + $key->getKeyComment(), + $key->getKeyType(), phabricator_date($key->getDateCreated(), $user), phabricator_time($key->getDateCreated(), $user), javelin_tag( @@ -240,7 +240,7 @@ final class PhabricatorSettingsPanelSSHKeys $user = $request->getUser(); - $name = phutil_escape_html($key->getName()); + $name = phutil_tag('strong', array(), $key->getName()); if ($request->isDialogFormPost()) { $key->delete(); @@ -252,10 +252,10 @@ final class PhabricatorSettingsPanelSSHKeys ->setUser($user) ->addHiddenInput('delete', $key->getID()) ->setTitle('Really delete SSH Public Key?') - ->appendChild( - '

    The key "'.$name.'" will be permanently deleted, '. - 'and you will not longer be able to use the corresponding private key '. - 'to authenticate.

    ') + ->appendChild(phutil_tag('p', array(), pht( + 'The key "%s" will be permanently deleted, and you will not longer be '. + 'able to use the corresponding private key to authenticate.', + $name))) ->addSubmitButton('Delete Public Key') ->addCancelButton($this->getPanelURI()); diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 44b3a06d5d..5c39fda9d1 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -177,11 +177,11 @@ final class PhabricatorSlowvotePollController $panel = new AphrontPanelView(); - $panel->setHeader(phutil_escape_html($poll->getQuestion())); + $panel->setHeader($poll->getQuestion()); $panel->setWidth(AphrontPanelView::WIDTH_WIDE); $panel->appendChild($form); - $panel->appendChild('

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

    ')); $panel->appendChild($result_markup); return $this->buildStandardPageResponse( @@ -203,8 +203,7 @@ final class PhabricatorSlowvotePollController foreach ($comments as $comment) { $handle = $handles[$comment->getAuthorPHID()]; - $markup = phutil_safe_html( - $engine->markupText($comment->getCommentText())); + $markup = $engine->markupText($comment->getCommentText()); require_celerity_resource('phabricator-remarkup-css'); diff --git a/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php b/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php index 3a3c7deb3a..93e5144ae0 100644 --- a/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php +++ b/src/applications/subscriptions/events/PhabricatorSubscriptionsUIEventListener.php @@ -36,7 +36,7 @@ final class PhabricatorSubscriptionsUIEventListener ->setDisabled(true) ->setRenderAsForm(true) ->setHref('/subscriptions/add/'.$object->getPHID().'/') - ->setName(phutil_escape_html('Automatically Subscribed')) + ->setName('Automatically Subscribed') ->setIcon('subscribe-auto'); } else { $subscribed = false; @@ -59,7 +59,7 @@ final class PhabricatorSubscriptionsUIEventListener ->setWorkflow(true) ->setRenderAsForm(true) ->setHref('/subscriptions/delete/'.$object->getPHID().'/') - ->setName(phutil_escape_html('Unsubscribe')) + ->setName('Unsubscribe') ->setIcon('subscribe-delete'); } else { $sub_action = id(new PhabricatorActionView()) @@ -67,7 +67,7 @@ final class PhabricatorSubscriptionsUIEventListener ->setWorkflow(true) ->setRenderAsForm(true) ->setHref('/subscriptions/add/'.$object->getPHID().'/') - ->setName(phutil_escape_html('Subscribe')) + ->setName('Subscribe') ->setIcon('subscribe-add'); } diff --git a/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php b/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php index 9c1caab76e..fe63299d1b 100644 --- a/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php +++ b/src/applications/transactions/response/PhabricatorApplicationTransactionNoEffectResponse.php @@ -57,7 +57,8 @@ final class PhabricatorApplicationTransactionNoEffectResponse ->setTitle($title); foreach ($xactions as $xaction) { - $dialog->appendChild('

    '.$xaction->getNoEffectDescription().'

    '); + $dialog->appendChild( + phutil_tag('p', array(), $xaction->getNoEffectDescription())); } $dialog->appendChild($tail); diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index 00bbde7e3d..6494929c15 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -134,7 +134,7 @@ abstract class PhabricatorApplicationTransaction if ($this->renderingTarget == self::TARGET_HTML) { return $this->getHandle($phid)->renderLink(); } else { - return $this->getHandle($phid)->getName(); + return hsprintf('%s', $this->getHandle($phid)->getName()); } } @@ -143,7 +143,7 @@ abstract class PhabricatorApplicationTransaction foreach ($phids as $phid) { $links[] = $this->renderHandleLink($phid); } - return phutil_safe_html(implode(', ', $links)); + return phutil_implode_html(', ', $links); } public function getIcon() { @@ -218,16 +218,16 @@ abstract class PhabricatorApplicationTransaction '%s changed the visibility of this %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->getApplicationObjectTypeName(), - phutil_escape_html($old), - phutil_escape_html($new)); + $old, + $new); case PhabricatorTransactions::TYPE_EDIT_POLICY: // TODO: Render human-readable. return pht( '%s changed the edit policy of this %s from "%s" to "%s".', $this->renderHandleLink($author_phid), $this->getApplicationObjectTypeName(), - phutil_escape_html($old), - phutil_escape_html($new)); + $old, + $new); case PhabricatorTransactions::TYPE_SUBSCRIBERS: $add = array_diff($new, $old); $rem = array_diff($old, $new); diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php index aba6d84bab..a943ec6179 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -128,7 +128,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { 'id' => $this->getPreviewPanelID(), 'style' => 'display: none', ), - self::renderHTMLView( + self::renderSingleView( array( $header, $preview, diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php index 07bcbafd47..96c106e60e 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php @@ -99,8 +99,8 @@ class PhabricatorApplicationTransactionView extends AphrontView { $event->appendChild( $engine->getOutput($xaction->getComment(), $field)); } else if ($has_deleted_comment) { - $event->appendChild( - ''.pht('This comment has been deleted.').''); + $event->appendChild(phutil_tag('em', array(), pht( + 'This comment has been deleted.'))); } $events[] = $event; diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php index 5d61db7853..18b3cceffe 100644 --- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php +++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php @@ -297,9 +297,6 @@ final class PhabricatorTypeaheadCommonDatasourceController $rows = array(); foreach ($results as $result) { $wire = $result->getWireFormat(); - foreach ($wire as $k => $v) { - $wire[$k] = phutil_escape_html($v); - } $rows[] = $wire; } diff --git a/src/applications/uiexample/examples/PhabricatorActionListExample.php b/src/applications/uiexample/examples/PhabricatorActionListExample.php index 33df2496b5..1fe7698ebc 100644 --- a/src/applications/uiexample/examples/PhabricatorActionListExample.php +++ b/src/applications/uiexample/examples/PhabricatorActionListExample.php @@ -104,7 +104,7 @@ final class PhabricatorActionListExample extends PhabricatorUIExample { return array( $view, - '
    ', + hsprintf('
    '), $notices, ); } diff --git a/src/applications/uiexample/examples/PhabricatorButtonsExample.php b/src/applications/uiexample/examples/PhabricatorButtonsExample.php index 0a3e57f715..fb7f0958bc 100644 --- a/src/applications/uiexample/examples/PhabricatorButtonsExample.php +++ b/src/applications/uiexample/examples/PhabricatorButtonsExample.php @@ -35,11 +35,11 @@ final class PhabricatorButtonsExample extends PhabricatorUIExample { ), ucwords($size.' '.$color.' '.$tag)); - $view[] = '

    '; + $view[] = hsprintf('

    '); } } } - return '
    '.implode('', $view).'
    '; + return phutil_tag('div', array('style' => 'margin: 1em 2em;'), $view); } } diff --git a/src/applications/uiexample/examples/PhabricatorTagExample.php b/src/applications/uiexample/examples/PhabricatorTagExample.php index e70a4f3a34..80518363ae 100644 --- a/src/applications/uiexample/examples/PhabricatorTagExample.php +++ b/src/applications/uiexample/examples/PhabricatorTagExample.php @@ -19,7 +19,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setName('@alincoln') ->setHref('#'); $tags[] = ' how is stuff?'; - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = 'Did you hear that '; @@ -41,7 +41,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setDotColor(PhabricatorTagView::COLOR_GREY) ->setHref('#'); $tags[] = ' is gone?'; - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = 'Take a look at '; $tags[] = id(new PhabricatorTagView()) @@ -49,7 +49,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setName('D123') ->setHref('#'); $tags[] = ' when you get a chance.'; - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = 'Hmm? '; $tags[] = id(new PhabricatorTagView()) @@ -63,7 +63,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setBackgroundColor(PhabricatorTagView::COLOR_BLACK) ->setName('Abandoned'); $tags[] = '.'; - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = 'I hope someone is going to '; $tags[] = id(new PhabricatorTagView()) @@ -77,7 +77,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setBackgroundColor(PhabricatorTagView::COLOR_REDORANGE) ->setName('High Priority'); $tags[] = '!'; - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = id(new PhabricatorHeaderView()) @@ -89,7 +89,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setType(PhabricatorTagView::TYPE_STATE) ->setBackgroundColor($color) ->setName(ucwords($color)); - $tags[] = '

    '; + $tags[] = hsprintf('

    '); } $tags[] = id(new PhabricatorHeaderView()) @@ -101,14 +101,14 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setDotColor(PhabricatorTagView::COLOR_RED) ->setBarColor(PhabricatorTagView::COLOR_RED) ->setName('Christmas'); - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = id(new PhabricatorTagView()) ->setType(PhabricatorTagView::TYPE_OBJECT) ->setBackgroundColor(PhabricatorTagView::COLOR_ORANGE) ->setDotColor(PhabricatorTagView::COLOR_BLACK) ->setBarColor(PhabricatorTagView::COLOR_BLACK) ->setName('Halloween'); - $tags[] = '

    '; + $tags[] = hsprintf('

    '); $tags[] = id(new PhabricatorTagView()) ->setType(PhabricatorTagView::TYPE_STATE) ->setBackgroundColor(PhabricatorTagView::COLOR_MAGENTA) @@ -116,10 +116,9 @@ final class PhabricatorTagExample extends PhabricatorUIExample { ->setBarColor(PhabricatorTagView::COLOR_BLUE) ->setName('Easter'); - return array( - '
    ', - $tags, - '
    ', - ); + return phutil_tag( + 'div', + array('style' => 'padding: 1em 2em;'), + $tags); } } diff --git a/src/applications/uiexample/examples/PhabricatorUINotificationExample.php b/src/applications/uiexample/examples/PhabricatorUINotificationExample.php index 429f6c1a12..3c53b2da47 100644 --- a/src/applications/uiexample/examples/PhabricatorUINotificationExample.php +++ b/src/applications/uiexample/examples/PhabricatorUINotificationExample.php @@ -23,7 +23,7 @@ final class PhabricatorUINotificationExample extends PhabricatorUIExample { ), 'Show Notification'); - $content = '
    '.$content.''; + $content = hsprintf('
    %s
    ', $content); return $content; } diff --git a/src/applications/uiexample/examples/PhabricatorUIPagerExample.php b/src/applications/uiexample/examples/PhabricatorUIPagerExample.php index f50a335547..1d34e84792 100644 --- a/src/applications/uiexample/examples/PhabricatorUIPagerExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIPagerExample.php @@ -35,10 +35,10 @@ final class PhabricatorUIPagerExample extends PhabricatorUIExample { $panel = new AphrontPanelView(); $panel->appendChild($table); - $panel->appendChild( + $panel->appendChild(hsprintf( '

    '. 'Use AphrontPagerView to render a pager element.'. - '

    '); + '

    ')); $pager = new AphrontPagerView(); $pager->setPageSize($page_size); @@ -47,10 +47,10 @@ final class PhabricatorUIPagerExample extends PhabricatorUIExample { $pager->setURI($request->getRequestURI(), 'offset'); $panel->appendChild($pager); - $panel->appendChild( + $panel->appendChild(hsprintf( '

    '. 'You can show more or fewer pages of surrounding context.'. - '

    '); + '

    ')); $many_pages_pager = new AphrontPagerView(); $many_pages_pager->setPageSize($page_size); @@ -60,12 +60,12 @@ final class PhabricatorUIPagerExample extends PhabricatorUIExample { $many_pages_pager->setSurroundingPages(7); $panel->appendChild($many_pages_pager); - $panel->appendChild( + $panel->appendChild(hsprintf( '

    '. 'When it is prohibitively expensive or complex to attain a complete '. 'count of the items, you can select one extra item and set '. 'hasMorePages(true) if it exists, creating an inexact pager.'. - '

    '); + '

    ')); $inexact_pager = new AphrontPagerView(); $inexact_pager->setPageSize($page_size); diff --git a/src/docs/developer/rendering_html.diviner b/src/docs/developer/rendering_html.diviner index 185c43caf9..5cd2c661d5 100644 --- a/src/docs/developer/rendering_html.diviner +++ b/src/docs/developer/rendering_html.diviner @@ -108,13 +108,13 @@ must to maintain backward compatibility.) If you need to build a list of items with some element in between each of them (like a middot, comma, or vertical bar) you can use -@{function:array_interleave}: +@{function:phutil_implode_html}: // Render links with commas between them. phutil_tag( 'div', array(), - array_interleave(', ', $list_of_links)); + phutil_implode_html(', ', $list_of_links)); = AphrontView Classes = @@ -124,14 +124,6 @@ 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 -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. - = Internationalization: pht() = The @{function:pht} function has some special rules. If any input to @@ -156,16 +148,36 @@ calling @{function:phutil_safe_html} on it. This is **dangerous**, because if you are wrong and the string is not actually safe, you have introduced an XSS vulnerability. Consequently, you should avoid calling this if possible. -You can use @{function@libphutil:phutil_escape_html} to explicitly escape an -HTML string. You should not normally need to use it. - You can use @{function@libphutil:phutil_escape_html_newlines} to escape HTML -while converting newlines to `
    `. +while converting newlines to `
    `. You should not need to explicitly use +@{function@libphutil:phutil_escape_html} anywhere. + +If you need to apply a string function (such as `trim()`) to safe HTML, use +@{method@libphutil:PhutilSafeHTML::applyFunction}. If you need to extract the content of a @{class@libphutil:PhutilSafeHTML} object, you should call `getHTMLContent()`, not cast it to a string. Eventually, we would like to remove the string cast entirely. +Functions @{function@libphutil:phutil_tag} and @{function@libphutil:hsprintf} +are not safe if you pass the user input for the tag or attribute name. All the +following examples are dangerous: + + counterexample + phutil_tag($evil); + + phutil_tag('span', array($evil => $evil2)); + + // Use PhutilURI to check if $evil is valid HTTP link. + phutil_tag('a', array('href' => $evil)); + + phutil_tag('span', array('onmouseover' => $evil)); + + hsprintf('<%s>%s', $evil, $evil2, $evil); + + // We have a lint rule disallowing this. + hsprintf($evil); + = Deprecated Functions = The functions @{function@libphutil:phutil_render_tag} and diff --git a/src/infrastructure/celerity/CelerityStaticResourceResponse.php b/src/infrastructure/celerity/CelerityStaticResourceResponse.php index a90dcb498e..1545cd2ee0 100644 --- a/src/infrastructure/celerity/CelerityStaticResourceResponse.php +++ b/src/infrastructure/celerity/CelerityStaticResourceResponse.php @@ -98,8 +98,9 @@ final class CelerityStaticResourceResponse { $this->hasRendered[$resource['uri']] = true; $output[] = $this->renderResource($resource); + $output[] = "\n"; } - return implode("\n", $output)."\n"; + return phutil_implode_html('', $output); } private function renderResource(array $resource) { @@ -180,8 +181,9 @@ final class CelerityStaticResourceResponse { if ($data) { $data = implode("\n", $data); - return ''; + return hsprintf( + '', + phutil_safe_html($data)); } else { return ''; } diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php index 99fe0b70da..3a8ad2f1ad 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -71,7 +71,7 @@ abstract class PhabricatorInlineCommentController $dialog->setTitle('Really delete this comment?'); $dialog->addHiddenInput('id', $this->getCommentID()); $dialog->addHiddenInput('op', 'delete'); - $dialog->appendChild('

    Delete this inline comment?

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

    Delete this inline comment?

    ')); $dialog->addCancelButton('#'); $dialog->addSubmitButton('Delete'); diff --git a/src/infrastructure/diff/PhabricatorInlineCommentPreviewController.php b/src/infrastructure/diff/PhabricatorInlineCommentPreviewController.php index cd9a65be96..77e6e67e60 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentPreviewController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentPreviewController.php @@ -34,7 +34,7 @@ abstract class PhabricatorInlineCommentPreviewController $view->setPreview(true); $views[] = $view->render(); } - $views = implode("\n", $views); + $views = phutil_implode_html("\n", $views); return id(new AphrontAjaxResponse()) ->setContent($views); diff --git a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php index de792665fb..f8686ebba0 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() { @@ -79,19 +79,26 @@ final class PhabricatorInlineSummaryView extends AphrontView { $where = idx($item, 'where'); - $colspan = ($has_where ? '' : ' colspan="2"'); - $rows[] = + $colspan = ($has_where ? null : 2); + $rows[] = hsprintf( ''. - ''.$lines.''. - ($has_where - ? hsprintf('%s', $where) - : null). - ''. - '
    '. - $item['content']. - '
    '. - ''. - ''; + '%s'. + '%s'. + '%s'. + '', + $lines, + ($has_where + ? hsprintf('%s', $where) + : null), + phutil_tag( + 'td', + array( + 'class' => 'inline-summary-content', + 'colspan' => $colspan, + ), + hsprintf( + '
    %s
    ', + $item['content']))); } } @@ -100,7 +107,7 @@ final class PhabricatorInlineSummaryView extends AphrontView { array( 'class' => 'phabricator-inline-summary-table', ), - new PhutilSafeHTML(implode("\n", $rows))); + phutil_implode_html("\n", $rows)); } } diff --git a/src/infrastructure/lint/PhabricatorLintEngine.php b/src/infrastructure/lint/PhabricatorLintEngine.php index 391d9fb5d1..28fb9967e6 100644 --- a/src/infrastructure/lint/PhabricatorLintEngine.php +++ b/src/infrastructure/lint/PhabricatorLintEngine.php @@ -5,6 +5,24 @@ final class PhabricatorLintEngine extends PhutilLintEngine { public function buildLinters() { $linters = parent::buildLinters(); + foreach ($linters as $linter) { + if ($linter instanceof ArcanistPhutilXHPASTLinter) { + $linter->setDeprecatedFunctions(array( + 'phutil_escape_html' => + 'The phutil_escape_html() function is deprecated. Raw strings '. + 'passed to phutil_tag() or hsprintf() are escaped automatically.', + + 'javelin_render_tag' => + 'The javelin_render_tag() function is deprecated and unsafe. '. + 'Use javelin_tag() instead.', + + 'phabricator_render_form' => + 'The phabricator_render_form() function is deprecated and unsafe. '. + 'Use phabricator_form() instead.', + )); + } + } + $paths = $this->getPaths(); foreach ($paths as $key => $path) { diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php index 5e9a96d31d..f242519c18 100644 --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -41,7 +41,7 @@ final class PhabricatorMarkupEngine { private $objects = array(); private $viewer; - private $version = 2; + private $version = 3; /* -( Markup Pipeline )---------------------------------------------------- */ @@ -160,7 +160,7 @@ final class PhabricatorMarkupEngine { "Call process() before getOutput()."); } - return new PhutilSafeHTML($this->objects[$key]['output']); + return $this->objects[$key]['output']; } @@ -424,7 +424,6 @@ final class PhabricatorMarkupEngine { $rules[] = new PhabricatorRemarkupRuleMention(); - $rules[] = new PhutilRemarkupRuleEscapeHTML(); $rules[] = new PhutilRemarkupRuleBold(); $rules[] = new PhutilRemarkupRuleItalic(); $rules[] = new PhutilRemarkupRuleDel(); @@ -450,7 +449,6 @@ final class PhabricatorMarkupEngine { foreach ($blocks as $block) { if ($block instanceof PhutilRemarkupEngineRemarkupLiteralBlockRule) { $literal_rules = array(); - $literal_rules[] = new PhutilRemarkupRuleEscapeHTML(); $literal_rules[] = new PhutilRemarkupRuleLinebreaks(); $block->setMarkupRules($literal_rules); } else if ( diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php index 548a2b1d64..3356aed8e2 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php @@ -8,13 +8,13 @@ final class PhabricatorRemarkupRuleCountdown extends PhutilRemarkupRule { const KEY_RULE_COUNTDOWN = 'rule.countdown'; public function apply($text) { - return preg_replace_callback( + return $this->replaceHTML( "@\B{C(\d+)}\B@", array($this, 'markupCountdown'), $text); } - private function markupCountdown($matches) { + protected function markupCountdown($matches) { $countdown = id(new PhabricatorTimer())->load($matches[1]); if (!$countdown) { return $matches[0]; @@ -46,20 +46,17 @@ final class PhabricatorRemarkupRuleCountdown extends PhutilRemarkupRule { foreach ($metadata as $id => $info) { list($time, $token) = $info; + $prefix = 'phabricator-timer-'; $count = phutil_tag( 'span', array( 'id' => $id, ), array( - javelin_tag('span', - array('sigil' => 'phabricator-timer-days'), '').'d', - javelin_tag('span', - array('sigil' => 'phabricator-timer-hours'), '').'h', - javelin_tag('span', - array('sigil' => 'phabricator-timer-minutes'), '').'m', - javelin_tag('span', - array('sigil' => 'phabricator-timer-seconds'), '').'s', + javelin_tag('span', array('sigil' => $prefix.'days'), ''), 'd', + javelin_tag('span', array('sigil' => $prefix.'hours'), ''), 'h', + javelin_tag('span', array('sigil' => $prefix.'minutes'), ''), 'm', + javelin_tag('span', array('sigil' => $prefix.'seconds'), ''), 's', )); Javelin::initBehavior('countdown-timer', array( 'timestamp' => $time, diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php index 9ef0ac8ad9..e7c25dd1fe 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php @@ -10,7 +10,7 @@ final class PhabricatorRemarkupRuleEmbedFile const KEY_EMBED_FILE_PHIDS = 'phabricator.embedded-file-phids'; public function apply($text) { - return preg_replace_callback( + return $this->replaceHTML( "@{F(\d+)([^}]+?)?}@", array($this, 'markupEmbedFile'), $text); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php index eb048f8c4c..006bfda0e8 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php @@ -9,7 +9,7 @@ final class PhabricatorRemarkupRuleImageMacro private $images; public function apply($text) { - return preg_replace_callback( + return $this->replaceHTML( '@^([a-zA-Z0-9:_\-]+)$@m', array($this, 'markupImageMacro'), $text); @@ -25,8 +25,10 @@ final class PhabricatorRemarkupRuleImageMacro } } - if (array_key_exists($matches[1], $this->images)) { - $phid = $this->images[$matches[1]]; + $name = (string)$matches[1]; + + if (array_key_exists($name, $this->images)) { + $phid = $this->images[$name]; $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $phid); $style = null; diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php index 1254d044ad..b569eb60ac 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php @@ -9,7 +9,7 @@ final class PhabricatorRemarkupRuleMeme private $images; public function apply($text) { - return preg_replace_callback( + return $this->replaceHTML( '@{meme,([^}]+)}$@m', array($this, 'markupMeme'), $text); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php index f68d05fb64..b2a98fc9af 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php @@ -21,13 +21,13 @@ final class PhabricatorRemarkupRuleMention const REGEX = '/(?replaceHTML( self::REGEX, array($this, 'markupMention'), $text); } - private function markupMention($matches) { + protected function markupMention($matches) { $engine = $this->getEngine(); $token = $engine->storeText(''); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectHandle.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectHandle.php index 4925459e4e..8aa082b621 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectHandle.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectHandle.php @@ -13,13 +13,13 @@ abstract class PhabricatorRemarkupRuleObjectHandle public function apply($text) { $prefix = $this->getObjectNamePrefix(); - return preg_replace_callback( + return $this->replaceHTML( "@\B{{$prefix}(\d+)}\B@", array($this, 'markupObjectHandle'), $text); } - private function markupObjectHandle($matches) { + protected function markupObjectHandle($matches) { // TODO: These are single gets but should be okay for now, they're behind // the cache. $phid = $this->loadObjectPHID($matches[1]); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php index b81c37cc2f..859bebdc74 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php @@ -15,7 +15,7 @@ abstract class PhabricatorRemarkupRuleObjectName public function apply($text) { $prefix = $this->getObjectNamePrefix(); $id = $this->getObjectIDPattern(); - return preg_replace_callback( + return $this->replaceHTML( "@\b({$prefix})({$id})(?:#([-\w\d]+))?\b@", array($this, 'markupObjectNameLink'), $text); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php index 410d507b47..56a84d0d75 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php @@ -7,7 +7,7 @@ final class PhabricatorRemarkupRulePhriction extends PhutilRemarkupRule { public function apply($text) { - return preg_replace_callback( + return $this->replaceHTML( '@\B\\[\\[([^|\\]]+)(?:\\|([^\\]]+))?\\]\\]\B@U', array($this, 'markupDocumentLink'), $text); @@ -28,7 +28,7 @@ final class PhabricatorRemarkupRulePhriction $href = (string) id(new PhutilURI($slug))->setFragment($fragment); if ($this->getEngine()->getState('toc')) { - $text = phutil_escape_html($name); + $text = $name; } else { $text = phutil_tag( 'a', diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php index f4e11e4cc6..3b099ef3be 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php @@ -10,7 +10,8 @@ final class PhabricatorRemarkupRuleYoutube $this->uri = new PhutilURI($text); if ($this->uri->getDomain() && - preg_match('/(^|\.)youtube\.com$/', $this->uri->getDomain())) { + preg_match('/(^|\.)youtube\.com$/', $this->uri->getDomain()) && + idx($this->uri->getQueryParams(), 'v')) { return $this->markupYoutubeLink(); } @@ -19,25 +20,20 @@ final class PhabricatorRemarkupRuleYoutube public function markupYoutubeLink() { $v = idx($this->uri->getQueryParams(), 'v'); - if ($v) { - $youtube_src = 'https://www.youtube.com/embed/'.$v; - $iframe = - '
    '. - phutil_tag( - 'iframe', - array( - 'width' => '650', - 'height' => '400', - 'style' => 'margin: 1em auto; border: 0px;', - 'src' => $youtube_src, - 'frameborder' => 0, - ), - ''). - '
    '; - return $this->getEngine()->storeText($iframe); - } else { - return $this->uri; - } + $youtube_src = 'https://www.youtube.com/embed/'.$v; + $iframe = hsprintf( + '
    %s
    ', + phutil_tag( + 'iframe', + array( + 'width' => '650', + 'height' => '400', + 'style' => 'margin: 1em auto; border: 0px;', + 'src' => $youtube_src, + 'frameborder' => 0, + ), + '')); + return $this->getEngine()->storeText($iframe); } } diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index 04122e0027..5b448678bb 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -99,7 +99,6 @@ final class AphrontDialogView extends AphrontView { ), $this->cancelText); } - $buttons = implode('', $buttons); if (!$this->user) { throw new Exception( @@ -131,6 +130,14 @@ final class AphrontDialogView extends AphrontView { ); $hidden_inputs = array(); + $hidden_inputs[] = phutil_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => '__dialog__', + 'value' => '1', + )); + foreach ($this->hidden as $desc) { list($key, $value) = $desc; $hidden_inputs[] = javelin_tag( @@ -142,37 +149,30 @@ final class AphrontDialogView extends AphrontView { 'sigil' => 'aphront-dialog-application-input' )); } - $hidden_inputs = implode("\n", $hidden_inputs); - $hidden_inputs = - ''. - $hidden_inputs; - if (!$this->renderAsForm) { - $buttons = phabricator_render_form( + $buttons = array(phabricator_form( $this->user, $form_attributes, - $hidden_inputs.$buttons); + array_merge($hidden_inputs, $buttons))); } - $content = - hsprintf('
    %s
    ', $this->title). - '
    '. - $this->renderChildren(). - '
    '. - '
    '. - $buttons. - '
    '. - '
    '; + $buttons[] = phutil_tag('div', array('style' => 'clear: both;'), ''); + $children = $this->renderChildren(); + + $content = hsprintf( + '%s%s%s', + phutil_tag('div', array('class' => 'aphront-dialog-head'), $this->title), + phutil_tag('div', array('class' => 'aphront-dialog-body'), $children), + phutil_tag('div', array('class' => 'aphront-dialog-tail'), $buttons)); if ($this->renderAsForm) { - return phabricator_render_form( + return phabricator_form( $this->user, $form_attributes + $attributes, - $hidden_inputs. - $content); + array($hidden_inputs, $content)); } else { - return javelin_render_tag( + return javelin_tag( 'div', $attributes, $content); diff --git a/src/view/AphrontJavelinView.php b/src/view/AphrontJavelinView.php index eb71b3100a..a563c4aecb 100644 --- a/src/view/AphrontJavelinView.php +++ b/src/view/AphrontJavelinView.php @@ -21,7 +21,7 @@ final class AphrontJavelinView extends AphrontView { public function render() { $id = celerity_generate_unique_node_id(); - $placeholder = ""; + $placeholder = phutil_tag('span', array('id' => $id)); require_celerity_resource($this->getCelerityResource()); @@ -32,7 +32,7 @@ final class AphrontJavelinView extends AphrontView { 'id' => $id, 'view' => $this->getName(), 'params' => $this->getParameters(), - 'children' => $this->renderChildren(), + 'children' => implode('', $this->renderChildren()), 'trigger_id' => $render_context, )); diff --git a/src/view/AphrontNullView.php b/src/view/AphrontNullView.php index cfcf48350e..2a218e700a 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 phutil_implode_html('', $this->renderChildren()); } } diff --git a/src/view/AphrontTagView.php b/src/view/AphrontTagView.php index 8e9595f0b6..514c8826f6 100644 --- a/src/view/AphrontTagView.php +++ b/src/view/AphrontTagView.php @@ -87,7 +87,7 @@ abstract class AphrontTagView extends AphrontView { } protected function getTagContent() { - return $this->renderHTMLChildren(); + return $this->renderChildren(); } protected function willRender() { diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php index bfe6f9d624..59c7a2172a 100644 --- a/src/view/AphrontView.php +++ b/src/view/AphrontView.php @@ -33,14 +33,6 @@ abstract class AphrontView extends Phobject { foreach ($this->children as $child) { $out[] = $this->renderSingleView($child); } - return implode('', $out); - } - - final protected function renderHTMLChildren() { - $out = array(); - foreach ($this->children as $child) { - $out[] = $this->renderHTMLView($child); - } return $out; } @@ -52,28 +44,12 @@ abstract class AphrontView extends Phobject { foreach ($child as $element) { $out[] = $this->renderSingleView($element); } - return implode('', $out); + return phutil_implode_html('', $out); } else { return $child; } } - final protected function renderHTMLView($child) { - if ($child instanceof AphrontView) { - return phutil_safe_html($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_safe_html(implode('', $out)); - } else { - return phutil_safe_html(phutil_escape_html($child)); - } - } - final protected function isEmptyContent($content) { if (is_array($content)) { foreach ($content as $element) { 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/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index 10c723c96a..db3b12eb95 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -111,18 +111,7 @@ final class AphrontTableView extends AphrontView { public function render() { require_celerity_resource('aphront-table-view-css'); - $table_class = $this->className; - - if ($this->deviceReadyTable) { - $table_class .= ' aphront-table-view-device-ready'; - } - - if ($table_class !== null) { - $table_class = ' class="aphront-table-view '.$table_class.'"'; - } else { - $table_class = ' class="aphront-table-view"'; - } - $table = array(''); + $table = array(); $col_classes = array(); foreach ($this->columnClasses as $key => $class) { @@ -151,7 +140,8 @@ final class AphrontTableView extends AphrontView { while (count($headers) > count($sort_values)) { $sort_values[] = null; } - $table[] = ''; + + $tr = array(); foreach ($headers as $col_num => $header) { if (!$visibility[$col_num]) { continue; @@ -202,7 +192,7 @@ final class AphrontTableView extends AphrontView { } if ($classes) { - $class = ' class="'.implode(' ', $classes).'"'; + $class = implode(' ', $classes); } else { $class = null; } @@ -221,12 +211,12 @@ final class AphrontTableView extends AphrontView { ), $short_headers[$col_num]); - $header = $header_nodevice.$header_device; + $header = hsprintf('%s %s', $header_nodevice, $header_device); } - $table[] = ''.$header.''; + $tr[] = phutil_tag('th', array('class' => $class), $header); } - $table[] = ''; + $table[] = phutil_tag('tr', array(), $tr); } foreach ($col_classes as $key => $value) { @@ -251,18 +241,7 @@ final class AphrontTableView extends AphrontView { while (count($row) > count($visibility)) { $visibility[] = true; } - $class = idx($this->rowClasses, $row_num); - if ($this->zebraStripes && ($row_num % 2)) { - if ($class !== null) { - $class = 'alt alt-'.$class; - } else { - $class = 'alt'; - } - } - if ($class !== null) { - $class = ' class="'.$class.'"'; - } - $table[] = ''; + $tr = array(); // NOTE: Use of a separate column counter is to allow this to work // correctly if the row data has string or non-sequential keys. $col_num = 0; @@ -275,26 +254,40 @@ final class AphrontTableView extends AphrontView { if (!empty($this->cellClasses[$row_num][$col_num])) { $class = trim($class.' '.$this->cellClasses[$row_num][$col_num]); } - if ($class !== null) { - $table[] = ''; - } else { - $table[] = ''; - } - $table[] = $value.''; + $tr[] = phutil_tag('td', array('class' => $class), $value); ++$col_num; } + + $class = idx($this->rowClasses, $row_num); + if ($this->zebraStripes && ($row_num % 2)) { + if ($class !== null) { + $class = 'alt alt-'.$class; + } else { + $class = 'alt'; + } + } + + $table[] = phutil_tag('tr', array('class' => $class), $tr); ++$row_num; } } else { $colspan = max(count(array_filter($visibility)), 1); - $table[] = - ''. - coalesce($this->noDataString, 'No data available.'). - ''; + $table[] = hsprintf( + '%s', + $colspan, + coalesce($this->noDataString, 'No data available.')); } - $table[] = ''; - $html = implode('', $table); - return '
    '.$html.'
    '; + + $table_class = 'aphront-table-view'; + if ($this->className !== null) { + $table_class .= ' '.$this->className; + } + if ($this->deviceReadyTable) { + $table_class .= ' aphront-table-view-device-ready'; + } + + $html = phutil_tag('table', array('class' => $table_class), $table); + return hsprintf('
    %s
    ', $html); } public static function renderSingleDisplayLine($line) { diff --git a/src/view/control/PhabricatorObjectSelectorDialog.php b/src/view/control/PhabricatorObjectSelectorDialog.php index 1466d4918c..1456c26c52 100644 --- a/src/view/control/PhabricatorObjectSelectorDialog.php +++ b/src/view/control/PhabricatorObjectSelectorDialog.php @@ -101,50 +101,51 @@ final class PhabricatorObjectSelectorDialog { ), $label); } - $options = implode("\n", $options); $instructions = null; if ($this->instructions) { - $instructions = - '

    '. - $this->instructions. - '

    '; + $instructions = phutil_tag( + 'p', + array('class' => 'phabricator-object-selector-instructions'), + $this->instructions); } - $search_box = phabricator_render_form( + $search_box = phabricator_form( $user, array( 'method' => 'POST', 'action' => $this->submitURI, 'id' => $search_id, ), - ' - - - - - '); - $result_box = - '
    '. - '
    '; - $attached_box = + hsprintf( + ' + + + + + ', + phutil_tag('select', array('id' => $filter_id), $options), + phutil_tag('input', array('id' => $query_id)))); + + $result_box = phutil_tag( + 'div', + array( + 'class' => 'phabricator-object-selector-results', + 'id' => $results_id, + ), + ''); + + $attached_box = hsprintf( '
    '. '
    '. - hsprintf( - '
    %s
    ', - $this->header). - '
    '. - '
    '. - $instructions. + '
    %s
    '. + '
    '. + '%s'. '
    '. - '
    '; - + '
    ', + $this->header, + $current_id, + $instructions); $dialog = new AphrontDialogView(); $dialog diff --git a/src/view/form/AphrontErrorView.php b/src/view/form/AphrontErrorView.php index cd97ff6a2f..938f0ae9ec 100644 --- a/src/view/form/AphrontErrorView.php +++ b/src/view/form/AphrontErrorView.php @@ -92,7 +92,7 @@ final class AphrontErrorView extends AphrontView { $classes[] = 'aphront-error-severity-'.$this->severity; $classes = implode(' ', $classes); - $children = $this->renderHTMLChildren(); + $children = $this->renderChildren(); $children[] = $list; return phutil_tag( diff --git a/src/view/form/AphrontFormInsetView.php b/src/view/form/AphrontFormInsetView.php index 014cdfffdd..1e504c4598 100644 --- a/src/view/form/AphrontFormInsetView.php +++ b/src/view/form/AphrontFormInsetView.php @@ -102,7 +102,7 @@ final class AphrontFormInsetView extends AphrontView { $content[] = $this->content; } - $content = array_merge($content, $this->renderHTMLChildren()); + $content = array_merge($content, $this->renderChildren()); return phutil_tag('div', $div_attributes, $content); } diff --git a/src/view/form/AphrontFormLayoutView.php b/src/view/form/AphrontFormLayoutView.php index 300c7370e0..83561491bb 100644 --- a/src/view/form/AphrontFormLayoutView.php +++ b/src/view/form/AphrontFormLayoutView.php @@ -38,6 +38,6 @@ final class AphrontFormLayoutView extends AphrontView { array( 'class' => $classes, ), - $this->renderHTMLChildren()); + $this->renderChildren()); } } diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index 76342830b8..5d5af2a430 100644 --- a/src/view/form/AphrontFormView.php +++ b/src/view/form/AphrontFormView.php @@ -68,7 +68,7 @@ final class AphrontFormView extends AphrontView { $layout ->appendChild($this->renderDataInputs()) - ->appendChild($this->renderHTMLChildren()); + ->appendChild($this->renderChildren()); if (!$this->user) { throw new Exception('You must pass the user to AphrontFormView.'); diff --git a/src/view/form/control/AphrontFormCropControl.php b/src/view/form/control/AphrontFormCropControl.php index 26cb70c0e4..94b65cd7d4 100644 --- a/src/view/form/control/AphrontFormCropControl.php +++ b/src/view/form/control/AphrontFormCropControl.php @@ -29,7 +29,7 @@ final class AphrontFormCropControl extends AphrontFormControl { $file = $this->getValue(); if ($file === null) { - return phutil_render_tag( + return phutil_tag( 'img', array( 'src' => PhabricatorUser::getDefaultProfileImageURI() diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index e34f090fcb..3ca49c2120 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -154,7 +154,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { array( 'sigil' => 'remarkup-assist-control', ), - $this->renderHTMLView( + $this->renderSingleView( array( $buttons, parent::renderInput(), diff --git a/src/view/layout/AphrontContextBarView.php b/src/view/layout/AphrontContextBarView.php index 57793ff4c7..07c640fbb5 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->renderChildren()); } } 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..cca43fa770 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->renderChildren()); } } diff --git a/src/view/layout/AphrontMiniPanelView.php b/src/view/layout/AphrontMiniPanelView.php index 9beb8e65d9..474eff4686 100644 --- a/src/view/layout/AphrontMiniPanelView.php +++ b/src/view/layout/AphrontMiniPanelView.php @@ -3,10 +3,10 @@ final class AphrontMiniPanelView extends AphrontView { public function render() { - return - '
    '. - $this->renderChildren(). - '
    '; + return phutil_tag( + 'div', + array('class' => 'aphront-mini-panel-view'), + $this->renderChildren()); } } diff --git a/src/view/layout/AphrontPanelView.php b/src/view/layout/AphrontPanelView.php index 651e2a0e80..0ae35ef0df 100644 --- a/src/view/layout/AphrontPanelView.php +++ b/src/view/layout/AphrontPanelView.php @@ -63,7 +63,7 @@ final class AphrontPanelView extends AphrontView { public function render() { if ($this->header !== null) { - $header = '

    '.$this->header.'

    '; + $header = phutil_tag('h1', array(), $this->header); } else { $header = null; } @@ -79,16 +79,17 @@ final class AphrontPanelView extends AphrontView { $buttons = null; if ($this->buttons) { - $buttons = - '
    '. - implode(" ", $this->buttons). - '
    '; + $buttons = hsprintf( + '
    %s
    ', + phutil_implode_html(" ", $this->buttons)); } - $header_elements = - '
    '. - $buttons.$header.$caption. - '
    '; - $table = $this->renderChildren(); + $header_elements = hsprintf( + '
    %s%s%s
    ', + $buttons, + $header, + $caption); + + $table = phutil_implode_html('', $this->renderChildren()); require_celerity_resource('aphront-panel-view-css'); @@ -98,13 +99,13 @@ 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); + array($header_elements, $table)); } } diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index ffbe0ca0bc..e4b2b7c9b9 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -231,7 +231,7 @@ final class AphrontSideNavFilterView extends AphrontView { ), ''); - $local_menu = $this->renderHTMLView( + $local_menu = $this->renderSingleView( array( $menu_background, phutil_tag( @@ -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_implode_html('', $this->renderChildren()), + )) + )); } } diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php index d4a9a22fdf..3240a821ed 100644 --- a/src/view/layout/PhabricatorActionListView.php +++ b/src/view/layout/PhabricatorActionListView.php @@ -42,7 +42,7 @@ final class PhabricatorActionListView extends AphrontView { array( 'class' => 'phabricator-action-list-view', ), - $this->renderHTMLView($actions)); + $this->renderSingleView($actions)); } diff --git a/src/view/layout/PhabricatorAnchorView.php b/src/view/layout/PhabricatorAnchorView.php index 44e8f33730..6ffd7e59fe 100644 --- a/src/view/layout/PhabricatorAnchorView.php +++ b/src/view/layout/PhabricatorAnchorView.php @@ -39,7 +39,7 @@ final class PhabricatorAnchorView extends AphrontView { ), ''); - return $this->renderHTMLView(array($marker, $anchor)); + return $this->renderSingleView(array($marker, $anchor)); } } diff --git a/src/view/layout/PhabricatorCrumbsView.php b/src/view/layout/PhabricatorCrumbsView.php index f621394f1e..2ee9d48022 100644 --- a/src/view/layout/PhabricatorCrumbsView.php +++ b/src/view/layout/PhabricatorCrumbsView.php @@ -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, diff --git a/src/view/layout/PhabricatorFileLinkListView.php b/src/view/layout/PhabricatorFileLinkListView.php index 8ba21fc68c..0eaf519d33 100644 --- a/src/view/layout/PhabricatorFileLinkListView.php +++ b/src/view/layout/PhabricatorFileLinkListView.php @@ -31,10 +31,7 @@ final class PhabricatorFileLinkListView extends AphrontView { $file_links[] = $view->render(); } - return $this->renderHTMLView( - array_interleave( - phutil_tag('br'), - $file_links)); + return phutil_implode_html(phutil_tag('br'), $file_links); } } diff --git a/src/view/layout/PhabricatorHeaderView.php b/src/view/layout/PhabricatorHeaderView.php index 8652de7095..63e0d9e930 100644 --- a/src/view/layout/PhabricatorHeaderView.php +++ b/src/view/layout/PhabricatorHeaderView.php @@ -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( diff --git a/src/view/layout/PhabricatorMenuItemView.php b/src/view/layout/PhabricatorMenuItemView.php index 934c93c940..6e021c8c97 100644 --- a/src/view/layout/PhabricatorMenuItemView.php +++ b/src/view/layout/PhabricatorMenuItemView.php @@ -117,9 +117,9 @@ final class PhabricatorMenuItemView extends AphrontTagView { $this->name.$external); } - return $this->renderHTMLView( + return $this->renderSingleView( array( - $this->renderHTMLChildren(), + $this->renderChildren(), $name, )); } diff --git a/src/view/layout/PhabricatorMenuView.php b/src/view/layout/PhabricatorMenuView.php index c3a27a173a..c350d00351 100644 --- a/src/view/layout/PhabricatorMenuView.php +++ b/src/view/layout/PhabricatorMenuView.php @@ -167,6 +167,6 @@ final class PhabricatorMenuView extends AphrontTagView { } protected function getTagContent() { - return $this->renderHTMLView($this->items); + return $this->renderSingleView($this->items); } } diff --git a/src/view/layout/PhabricatorObjectItemListView.php b/src/view/layout/PhabricatorObjectItemListView.php index cc9abb01a4..d98feaef38 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->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, diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index c6646f2f9e..09b9c16f88 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -166,11 +166,11 @@ final class PhabricatorObjectItemView extends AphrontView { array( 'class' => 'phabricator-object-item-content', ), - $this->renderHTMLView( + $this->renderSingleView( array( $header, $attrs, - $this->renderHTMLChildren(), + $this->renderChildren(), ))); return phutil_tag( diff --git a/src/view/layout/PhabricatorPinboardItemView.php b/src/view/layout/PhabricatorPinboardItemView.php index 683a6cf4dd..3154eadb10 100644 --- a/src/view/layout/PhabricatorPinboardItemView.php +++ b/src/view/layout/PhabricatorPinboardItemView.php @@ -55,7 +55,7 @@ final class PhabricatorPinboardItemView extends AphrontView { 'height' => $this->imageHeight, ))); - $content = $this->renderHTMLChildren(); + $content = $this->renderChildren(); if ($content) { $content = phutil_tag( 'div', @@ -70,7 +70,7 @@ final class PhabricatorPinboardItemView extends AphrontView { array( 'class' => 'phabricator-pinboard-item-view', ), - $this->renderHTMLView( + $this->renderSingleView( array( $header, $image, diff --git a/src/view/layout/PhabricatorPinboardView.php b/src/view/layout/PhabricatorPinboardView.php index f62a2be459..ace3b0b34f 100644 --- a/src/view/layout/PhabricatorPinboardView.php +++ b/src/view/layout/PhabricatorPinboardView.php @@ -31,7 +31,7 @@ final class PhabricatorPinboardView extends AphrontView { array( 'class' => 'phabricator-pinboard-view', ), - $this->renderHTMLView($this->items)); + $this->renderSingleView($this->items)); } } diff --git a/src/view/layout/PhabricatorProfileHeaderView.php b/src/view/layout/PhabricatorProfileHeaderView.php index ce86f56285..c99b802907 100644 --- a/src/view/layout/PhabricatorProfileHeaderView.php +++ b/src/view/layout/PhabricatorProfileHeaderView.php @@ -65,11 +65,12 @@ final class PhabricatorProfileHeaderView extends AphrontView { %s - ', + + %s', $this->profileName, - phutil_safe_html(self::renderSingleView($this->profileActions)), + self::renderSingleView($this->profileActions), $image, - $description). - $this->renderChildren(); + $description, + phutil_implode_html('', $this->renderChildren())); } } diff --git a/src/view/layout/PhabricatorPropertyListView.php b/src/view/layout/PhabricatorPropertyListView.php index 3cedcdbbf9..b0e0afbfbb 100644 --- a/src/view/layout/PhabricatorPropertyListView.php +++ b/src/view/layout/PhabricatorPropertyListView.php @@ -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) { diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php index 790ea663d3..f957c6ef88 100644 --- a/src/view/layout/PhabricatorSourceCodeView.php +++ b/src/view/layout/PhabricatorSourceCodeView.php @@ -38,21 +38,19 @@ final class PhabricatorSourceCodeView extends AphrontView { ), pht('...')); } else { - $content_number = phutil_escape_html($line_number); - $content_line = "\xE2\x80\x8B".$line; + $content_number = $line_number; + $content_line = hsprintf("\xE2\x80\x8B%s", $line); } // TODO: Provide nice links. - $rows[] = + $rows[] = hsprintf( ''. - ''. - $content_number. - ''. - ''. - $content_line. - ''. - ''; + '%s'. + '%s'. + '', + $content_number, + $content_line); if ($hit_limit) { break; @@ -76,7 +74,7 @@ final class PhabricatorSourceCodeView extends AphrontView { array( 'class' => implode(' ', $classes), ), - new PhutilSafeHTML(implode('', $rows)))); + phutil_implode_html('', $rows))); } } diff --git a/src/view/layout/PhabricatorTimelineEventView.php b/src/view/layout/PhabricatorTimelineEventView.php index 97c1970d61..fdc477340f 100644 --- a/src/view/layout/PhabricatorTimelineEventView.php +++ b/src/view/layout/PhabricatorTimelineEventView.php @@ -100,7 +100,7 @@ final class PhabricatorTimelineEventView extends AphrontView { } public function render() { - $content = $this->renderHTMLChildren(); + $content = $this->renderChildren(); $title = $this->title; if (($title === null) && $this->isEmptyContent($content)) { @@ -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( @@ -296,7 +296,7 @@ final class PhabricatorTimelineEventView extends AphrontView { array( 'class' => 'phabricator-timeline-extra', ), - array_interleave(" \xC2\xB7 ", $extra)); + phutil_implode_html(" \xC2\xB7 ", $extra)); } return $extra; diff --git a/src/view/layout/PhabricatorTransactionView.php b/src/view/layout/PhabricatorTransactionView.php index 64e5bf54d1..89f0fb85ae 100644 --- a/src/view/layout/PhabricatorTransactionView.php +++ b/src/view/layout/PhabricatorTransactionView.php @@ -58,24 +58,26 @@ final class PhabricatorTransactionView extends AphrontView { $actions = $this->renderTransactionActions(); $style = $this->renderTransactionStyle(); $content = $this->renderTransactionContent(); - $classes = phutil_escape_html(implode(' ', $this->classes)); + $classes = implode(' ', $this->classes); $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. - '
    '); + hsprintf( + '
    '. + '
    %s%s
    '. + '%s'. + '
    ', + $classes, + $info, + $actions, + $content)); } @@ -105,24 +107,24 @@ final class PhabricatorTransactionView extends AphrontView { ->setAnchorName($this->anchorName) ->render(); - $info[] = $anchor.phutil_tag( - 'a', - array( - 'href' => '#'.$this->anchorName, - ), - $this->anchorText); + $info[] = hsprintf( + '%s%s', + $anchor, + phutil_tag( + 'a', + array('href' => '#'.$this->anchorName), + $this->anchorText)); } - $info = implode(' · ', $info); + $info = phutil_implode_html(" \xC2\xB7 ", $info); - return - ''. - $info. - ''; + return hsprintf( + '%s', + $info); } private function renderTransactionActions() { - return implode('', $this->actions); + return phutil_implode_html('', $this->actions); } private function renderTransactionStyle() { @@ -138,10 +140,10 @@ final class PhabricatorTransactionView extends AphrontView { if (!$content) { return null; } - return - '
    '. - $content. - '
    '; + return phutil_tag( + 'div', + array('class' => 'phabricator-transaction-content'), + $this->renderSingleView($content)); } } diff --git a/src/view/page/AphrontPageView.php b/src/view/page/AphrontPageView.php index 8381176ee1..8f3704dca2 100644 --- a/src/view/page/AphrontPageView.php +++ b/src/view/page/AphrontPageView.php @@ -22,7 +22,7 @@ abstract class AphrontPageView extends AphrontView { } protected function getBody() { - return $this->renderChildren(); + return phutil_implode_html('', $this->renderChildren()); } protected function getTail() { @@ -45,34 +45,36 @@ abstract class AphrontPageView extends AphrontView { $this->willRenderPage(); - $title = phutil_escape_html($this->getTitle()); + $title = $this->getTitle(); $head = $this->getHead(); $body = $this->getBody(); $tail = $this->getTail(); $body_classes = $this->getBodyClasses(); - $body = phutil_render_tag( + $body = phutil_tag( 'body', array( 'class' => nonempty($body_classes, null), ), - $body.$tail); + array($body, $tail)); - $response = << - - - - {$title} - {$head} - - {$body} - - -EOHTML; + $response = hsprintf( + ''. + ''. + ''. + ''. + '%s'. + '%s'. + ''. + '%s'. + '', + $title, + $head, + $body); $response = $this->willSendResponse($response); + return $response; } diff --git a/src/view/page/AphrontRequestFailureView.php b/src/view/page/AphrontRequestFailureView.php index 026f3d8b61..1965340dd5 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->renderChildren()); } } diff --git a/src/view/page/PhabricatorBarePageView.php b/src/view/page/PhabricatorBarePageView.php index d3d849b888..d92836cabb 100644 --- a/src/view/page/PhabricatorBarePageView.php +++ b/src/view/page/PhabricatorBarePageView.php @@ -55,13 +55,13 @@ class PhabricatorBarePageView extends AphrontPageView { protected function willRenderPage() { // We render this now to resolve static resources so they can appear in the // document head. - $this->bodyContent = $this->renderChildren(); + $this->bodyContent = phutil_implode_html('', $this->renderChildren()); } protected function getHead() { $framebust = null; if (!$this->getFrameable()) { - $framebust = '(top != self) && top.location.replace(self.location.href);'; + $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; @@ -78,22 +78,12 @@ class PhabricatorBarePageView extends AphrontPageView { $response = CelerityAPI::getStaticResourceResponse(); - $head = array( + return hsprintf( + '%s%s', $viewport_tag, - - '', - - $response->renderResourcesOfType('css'), - ); - - return implode("\n", $head); + $framebust, + (PhabricatorEnv::getEnvConfig('phabricator.developer-mode') ? '1' : '0'), + $response->renderResourcesOfType('css')); } protected function getBody() { diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 80c7a37f5d..8b3848a3dd 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -212,15 +212,11 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { $response = CelerityAPI::getStaticResourceResponse(); - $head = array( + return hsprintf( + '%s%s', parent::getHead(), - '', - $response->renderSingleResource('javelin-magical-init'), - ); - - return implode("\n", $head); + phutil_safe_html($monospaced), + $response->renderSingleResource('javelin-magical-init')); } public function setGlyph($glyph) { @@ -239,8 +235,9 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { $console = $request->getApplicationConfiguration()->getConsole(); if ($console) { - $response = str_replace( - '', + $response = PhutilSafeHTML::applyFunction( + 'str_replace', + hsprintf(''), $console->render($request), $response); } @@ -295,20 +292,22 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { } return - phutil_render_tag( + phutil_tag( 'div', array( 'id' => 'base-page', 'class' => 'phabricator-standard-page', ), - $developer_warning. - $setup_warning. - $header_chrome. - '
    '. - ($console ? '' : null). - parent::getBody(). - '
    '. - '
    '); + hsprintf( + '%s%s%s'. + '
    '. + '%s%s
    '. + '
    ', + $developer_warning, + $setup_warning, + $header_chrome, + ($console ? hsprintf('') : null), + parent::getBody())); } protected function getTail() { @@ -357,7 +356,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { $response->renderHTMLFooter(), ); - return implode("\n", $tail); + return phutil_implode_html("\n", $tail); } protected function getBodyClasses() { diff --git a/src/view/page/menu/PhabricatorMainMenuGroupView.php b/src/view/page/menu/PhabricatorMainMenuGroupView.php index 31473aed4d..1eca04c3c6 100644 --- a/src/view/page/menu/PhabricatorMainMenuGroupView.php +++ b/src/view/page/menu/PhabricatorMainMenuGroupView.php @@ -33,7 +33,7 @@ final class PhabricatorMainMenuGroupView extends AphrontView { array( 'class' => implode(' ', $classes), ), - $this->renderHTMLChildren()); + $this->renderChildren()); } } 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..2234f92eee 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() { @@ -408,7 +409,9 @@ final class PhabricatorMainMenuView extends AphrontView { ''); return array( - $bubble_tag.$message_tag, $notification_dropdown); + hsprintf('%s%s', $bubble_tag, $message_tag), + $notification_dropdown, + ); } private function renderMenuIcon($name) {