From f8dbfdd59d514336a7039bebeb4f3486617eca50 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 17 Jan 2013 18:39:02 -0800 Subject: [PATCH 01/50] Convert phutil_render_tag(X, Y) to phutil_tag Summary: Created with spatch: lang=diff - phutil_render_tag + phutil_tag (X, Y) (and null manually) Test Plan: Loaded homepage Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4500 --- .../render/DifferentialChangesetTwoUpRenderer.php | 4 ++-- .../view/DifferentialInlineCommentEditView.php | 5 ++--- .../differential/view/DifferentialRevisionListView.php | 2 +- .../view/DifferentialRevisionUpdateHistoryView.php | 2 +- .../controller/DiffusionBrowseFileController.php | 2 +- .../controller/PhabricatorDirectoryMainController.php | 2 +- .../files/controller/PhabricatorFileInfoController.php | 2 +- .../controller/PhabricatorMacroViewController.php | 2 +- .../controller/ManiphestBatchEditController.php | 10 ++++------ .../controller/ManiphestSavedQueryListController.php | 4 ++-- src/applications/phame/skins/PhameBasicBlogSkin.php | 2 +- .../phame/skins/PhameBasicTemplateBlogSkin.php | 2 +- src/applications/phame/view/PhamePostView.php | 2 +- .../stripe/view/PhortuneStripePaymentFormView.php | 2 +- .../PhabricatorXHPASTViewFrameController.php | 2 +- .../PhabricatorProjectProfileEditController.php | 2 +- .../search/controller/PhabricatorSearchController.php | 2 +- .../settings/panel/PhabricatorSettingsPanelProfile.php | 2 +- .../controller/PhabricatorSlowvotePollController.php | 6 +++--- .../celerity/CelerityStaticResourceResponse.php | 2 +- src/infrastructure/javelin/markup.php | 4 ++-- .../markup/rule/PhabricatorRemarkupRuleEmbedFile.php | 2 +- .../markup/rule/PhabricatorRemarkupRuleImageMacro.php | 6 +++--- src/view/control/AphrontAttachedFileView.php | 2 +- src/view/control/AphrontTokenizerTemplateView.php | 2 +- src/view/form/AphrontFormInsetView.php | 2 +- src/view/form/AphrontFormView.php | 2 +- src/view/form/control/AphrontFormCheckboxControl.php | 2 +- src/view/form/control/AphrontFormFileControl.php | 2 +- src/view/form/control/AphrontFormImageControl.php | 4 ++-- src/view/form/control/AphrontFormPasswordControl.php | 2 +- .../form/control/AphrontFormRadioButtonControl.php | 2 +- src/view/layout/PhabricatorPinboardItemView.php | 2 +- src/view/page/PhabricatorBarePageView.php | 2 +- src/view/page/menu/PhabricatorMainMenuSearchView.php | 4 ++-- 35 files changed, 48 insertions(+), 51 deletions(-) diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index bf00225a64..74287042a8 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -342,7 +342,7 @@ final class DifferentialChangesetTwoUpRenderer array( 'class' => 'differential-image-stage' ), - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $old_file->getBestURI(), @@ -358,7 +358,7 @@ final class DifferentialChangesetTwoUpRenderer array( 'class' => 'differential-image-stage' ), - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $new_file->getBestURI(), diff --git a/src/applications/differential/view/DifferentialInlineCommentEditView.php b/src/applications/differential/view/DifferentialInlineCommentEditView.php index 73d44fb811..e60b198a0f 100644 --- a/src/applications/differential/view/DifferentialInlineCommentEditView.php +++ b/src/applications/differential/view/DifferentialInlineCommentEditView.php @@ -79,14 +79,13 @@ final class DifferentialInlineCommentEditView extends AphrontView { $out = array(); foreach ($this->inputs as $input) { list($name, $value) = $input; - $out[] = phutil_render_tag( + $out[] = phutil_tag( 'input', array( 'type' => 'hidden', 'name' => $name, 'value' => $value, - ), - null); + )); } return implode('', $out); } diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php index a28485c325..3d8a9cb89a 100644 --- a/src/applications/differential/view/DifferentialRevisionListView.php +++ b/src/applications/differential/view/DifferentialRevisionListView.php @@ -130,7 +130,7 @@ final class DifferentialRevisionListView extends AphrontView { $src = '/rsrc/image/icon/fatcow/page_white_edit.png'; $flag = ''. - phutil_render_tag( + phutil_tag( 'img', array( 'src' => celerity_get_resource_uri($src), diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index d4b6417e55..ff00f973e9 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -92,7 +92,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { if ($max_id != $id) { $uniq = celerity_generate_unique_node_id(); $old_checked = ($this->selectedVersusDiffID == $id); - $old = phutil_render_tag( + $old = phutil_tag( 'input', array( 'type' => 'radio', diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index e3f5592426..edab2227ed 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -789,7 +789,7 @@ final class DiffusionBrowseFileController extends DiffusionController { $properties->addProperty( pht('Image'), - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $file_uri, diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index a59914bfec..841f38de61 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -301,7 +301,7 @@ final class PhabricatorDirectoryMainController ), 'Jump Nav User Guide'); - $jump_input = phutil_render_tag( + $jump_input = phutil_tag( 'input', array( 'type' => 'text', diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php index cff0b780b1..26a095af51 100644 --- a/src/applications/files/controller/PhabricatorFileInfoController.php +++ b/src/applications/files/controller/PhabricatorFileInfoController.php @@ -141,7 +141,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { // TODO: Clean this up after Pholio (dark backgrounds, standardization, // etc.) - $image = phutil_render_tag( + $image = phutil_tag( 'img', array( 'src' => $file->getViewURI(), diff --git a/src/applications/macro/controller/PhabricatorMacroViewController.php b/src/applications/macro/controller/PhabricatorMacroViewController.php index 3a0ad35e42..b2b7d1e98a 100644 --- a/src/applications/macro/controller/PhabricatorMacroViewController.php +++ b/src/applications/macro/controller/PhabricatorMacroViewController.php @@ -158,7 +158,7 @@ final class PhabricatorMacroViewController if ($file) { $view->addTextContent( - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $file->getViewURI(), diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 3d69493ae1..01b656539b 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -79,25 +79,23 @@ final class ManiphestBatchEditController extends ManiphestController { foreach ($tasks as $task) { $form->appendChild( - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'hidden', 'name' => 'batch[]', 'value' => $task->getID(), - ), - null)); + ))); } $form->appendChild( - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'hidden', 'name' => 'actions', 'id' => 'batch-form-actions', - ), - null)); + ))); $form->appendChild('

These tasks will be edited:

'); $form->appendChild($list); $form->appendChild( diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php index 5f5a82666b..3578aad4e2 100644 --- a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php +++ b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php @@ -40,7 +40,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { $default = $query; } $rows[] = array( - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'radio', @@ -73,7 +73,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { } $rows[] = array( - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'radio', diff --git a/src/applications/phame/skins/PhameBasicBlogSkin.php b/src/applications/phame/skins/PhameBasicBlogSkin.php index 800f02e3da..2e1e2424d4 100644 --- a/src/applications/phame/skins/PhameBasicBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicBlogSkin.php @@ -104,7 +104,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { $pager = $this->renderOlderPageLink().$this->renderNewerPageLink(); if ($pager) { - $pager = phutil_render_tag( + $pager = phutil_tag( 'div', array( 'class' => 'phame-pager', diff --git a/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php b/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php index 709b3a1910..39dc7df989 100644 --- a/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicTemplateBlogSkin.php @@ -18,7 +18,7 @@ final class PhameBasicTemplateBlogSkin extends PhameBasicBlogSkin { if (!preg_match('/.css$/', $path)) { continue; } - $this->cssResources[] = phutil_render_tag( + $this->cssResources[] = phutil_tag( 'link', array( 'rel' => 'stylesheet', diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index a7c2ac7382..6e63fe7f17 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -201,7 +201,7 @@ final class PhamePostView extends AphrontView { $post = $this->getPost(); - $disqus_thread = phutil_render_tag('div', + $disqus_thread = phutil_tag('div', array( 'id' => 'disqus_thread' ) diff --git a/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php b/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php index c55f7030f2..569f7db994 100644 --- a/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php +++ b/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php @@ -106,7 +106,7 @@ final class PhortuneStripePaymentFormView extends AphrontView { ) ) ->appendChild( - phutil_render_tag( + phutil_tag( 'input', array( 'hidden' => true, diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php index 9fcf82bd5e..a800d37609 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php @@ -13,7 +13,7 @@ final class PhabricatorXHPASTViewFrameController $id = $this->id; return $this->buildStandardPageResponse( - phutil_render_tag( + phutil_tag( 'iframe', array( 'src' => '/xhpast/frameset/'.$id.'/', diff --git a/src/applications/project/controller/PhabricatorProjectProfileEditController.php b/src/applications/project/controller/PhabricatorProjectProfileEditController.php index e1e70b50c7..fcdcb34942 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileEditController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileEditController.php @@ -200,7 +200,7 @@ final class PhabricatorProjectProfileEditController id(new AphrontFormMarkupControl()) ->setLabel('Profile Image') ->setValue( - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $img_src, diff --git a/src/applications/search/controller/PhabricatorSearchController.php b/src/applications/search/controller/PhabricatorSearchController.php index 4ffe4798aa..93e55a11de 100644 --- a/src/applications/search/controller/PhabricatorSearchController.php +++ b/src/applications/search/controller/PhabricatorSearchController.php @@ -145,7 +145,7 @@ final class PhabricatorSearchController ->setUser($user) ->setAction('/search/') ->appendChild( - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php index 3eb398aa4b..692636405f 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php @@ -179,7 +179,7 @@ final class PhabricatorSettingsPanelProfile id(new AphrontFormMarkupControl()) ->setLabel('Profile Image') ->setValue( - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $img_src, diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index e94c1fb691..18a76bee96 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -261,7 +261,7 @@ final class PhabricatorSlowvotePollController $checked = null; } - $input = phutil_render_tag( + $input = phutil_tag( 'input', array( 'type' => 'radio', @@ -282,7 +282,7 @@ final class PhabricatorSlowvotePollController } } - $input = phutil_render_tag( + $input = phutil_tag( 'input', array( 'type' => 'checkbox', @@ -407,7 +407,7 @@ final class PhabricatorSlowvotePollController 'href' => $handle->getURI(), 'class' => 'phabricator-slowvote-facepile', ), - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $profile_image, diff --git a/src/infrastructure/celerity/CelerityStaticResourceResponse.php b/src/infrastructure/celerity/CelerityStaticResourceResponse.php index ae15728a95..c1f54033fc 100644 --- a/src/infrastructure/celerity/CelerityStaticResourceResponse.php +++ b/src/infrastructure/celerity/CelerityStaticResourceResponse.php @@ -106,7 +106,7 @@ final class CelerityStaticResourceResponse { $uri = PhabricatorEnv::getCDNURI($resource['uri']); switch ($resource['type']) { case 'css': - return phutil_render_tag( + return phutil_tag( 'link', array( 'rel' => 'stylesheet', diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php index 49569f2126..cff2e68d97 100644 --- a/src/infrastructure/javelin/markup.php +++ b/src/infrastructure/javelin/markup.php @@ -46,14 +46,14 @@ function phabricator_render_form(PhabricatorUser $user, $attributes, $content) { function phabricator_render_form_magic(PhabricatorUser $user) { return - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'hidden', 'name' => AphrontRequest::getCSRFTokenName(), 'value' => $user->getCSRFToken(), )). - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php index e5113f8240..72851c048d 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php @@ -108,7 +108,7 @@ final class PhabricatorRemarkupRuleEmbedFile } require_celerity_resource('lightbox-attachment-css'); - $img = phutil_render_tag('img', $data['attrs']); + $img = phutil_tag('img', $data['attrs']); $embed = javelin_render_tag( 'a', diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php index 19ff4b6bf0..0216850355 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleImageMacro.php @@ -35,13 +35,13 @@ final class PhabricatorRemarkupRuleImageMacro $src_uri = null; } - $img = phutil_render_tag( + $img = phutil_tag( 'img', array( 'src' => $src_uri, 'alt' => $matches[1], - 'title' => $matches[1]), - null); + 'title' => $matches[1], + )); return $this->getEngine()->storeText($img); } else { return $matches[1]; diff --git a/src/view/control/AphrontAttachedFileView.php b/src/view/control/AphrontAttachedFileView.php index 6953f85677..499162ba63 100644 --- a/src/view/control/AphrontAttachedFileView.php +++ b/src/view/control/AphrontAttachedFileView.php @@ -15,7 +15,7 @@ final class AphrontAttachedFileView extends AphrontView { $file = $this->file; $phid = $file->getPHID(); - $thumb = phutil_render_tag( + $thumb = phutil_tag( 'img', array( 'src' => $file->getThumb60x45URI(), diff --git a/src/view/control/AphrontTokenizerTemplateView.php b/src/view/control/AphrontTokenizerTemplateView.php index c3cc811967..0eda5ec879 100644 --- a/src/view/control/AphrontTokenizerTemplateView.php +++ b/src/view/control/AphrontTokenizerTemplateView.php @@ -75,7 +75,7 @@ final class AphrontTokenizerTemplateView extends AphrontView { 'class' => 'jx-tokenizer-token', ), phutil_escape_html($value). - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/view/form/AphrontFormInsetView.php b/src/view/form/AphrontFormInsetView.php index 2668bbe5a6..002b074eb5 100644 --- a/src/view/form/AphrontFormInsetView.php +++ b/src/view/form/AphrontFormInsetView.php @@ -57,7 +57,7 @@ final class AphrontFormInsetView extends AphrontView { $hidden_inputs = array(); foreach ($this->hidden as $inp) { list($key, $value) = $inp; - $hidden_inputs[] = phutil_render_tag( + $hidden_inputs[] = phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index a1e18a184b..1dca03e2cc 100644 --- a/src/view/form/AphrontFormView.php +++ b/src/view/form/AphrontFormView.php @@ -100,7 +100,7 @@ final class AphrontFormView extends AphrontView { if ($value === null) { continue; } - $inputs[] = phutil_render_tag( + $inputs[] = phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/view/form/control/AphrontFormCheckboxControl.php b/src/view/form/control/AphrontFormCheckboxControl.php index 543911d909..d2d05e77a3 100644 --- a/src/view/form/control/AphrontFormCheckboxControl.php +++ b/src/view/form/control/AphrontFormCheckboxControl.php @@ -22,7 +22,7 @@ final class AphrontFormCheckboxControl extends AphrontFormControl { $rows = array(); foreach ($this->boxes as $box) { $id = celerity_generate_unique_node_id(); - $checkbox = phutil_render_tag( + $checkbox = phutil_tag( 'input', array( 'id' => $id, diff --git a/src/view/form/control/AphrontFormFileControl.php b/src/view/form/control/AphrontFormFileControl.php index 8e0b75f477..9f7e7ab346 100644 --- a/src/view/form/control/AphrontFormFileControl.php +++ b/src/view/form/control/AphrontFormFileControl.php @@ -7,7 +7,7 @@ final class AphrontFormFileControl extends AphrontFormControl { } protected function renderInput() { - return phutil_render_tag( + return phutil_tag( 'input', array( 'type' => 'file', diff --git a/src/view/form/control/AphrontFormImageControl.php b/src/view/form/control/AphrontFormImageControl.php index d0acadb19a..c806ea38fc 100644 --- a/src/view/form/control/AphrontFormImageControl.php +++ b/src/view/form/control/AphrontFormImageControl.php @@ -10,7 +10,7 @@ final class AphrontFormImageControl extends AphrontFormControl { $id = celerity_generate_unique_node_id(); return - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'file', @@ -18,7 +18,7 @@ final class AphrontFormImageControl extends AphrontFormControl { 'class' => 'image', )). '
'. - phutil_render_tag( + phutil_tag( 'input', array( 'type' => 'checkbox', diff --git a/src/view/form/control/AphrontFormPasswordControl.php b/src/view/form/control/AphrontFormPasswordControl.php index 4cc0dd72d4..b2a3f1ef50 100644 --- a/src/view/form/control/AphrontFormPasswordControl.php +++ b/src/view/form/control/AphrontFormPasswordControl.php @@ -7,7 +7,7 @@ final class AphrontFormPasswordControl extends AphrontFormControl { } protected function renderInput() { - return phutil_render_tag( + return phutil_tag( 'input', array( 'type' => 'password', diff --git a/src/view/form/control/AphrontFormRadioButtonControl.php b/src/view/form/control/AphrontFormRadioButtonControl.php index 14373e0367..e15dd03c8d 100644 --- a/src/view/form/control/AphrontFormRadioButtonControl.php +++ b/src/view/form/control/AphrontFormRadioButtonControl.php @@ -22,7 +22,7 @@ final class AphrontFormRadioButtonControl extends AphrontFormControl { $rows = array(); foreach ($this->buttons as $button) { $id = celerity_generate_unique_node_id(); - $radio = phutil_render_tag( + $radio = phutil_tag( 'input', array( 'id' => $id, diff --git a/src/view/layout/PhabricatorPinboardItemView.php b/src/view/layout/PhabricatorPinboardItemView.php index a035325d63..7f97928c31 100644 --- a/src/view/layout/PhabricatorPinboardItemView.php +++ b/src/view/layout/PhabricatorPinboardItemView.php @@ -48,7 +48,7 @@ final class PhabricatorPinboardItemView extends AphrontView { 'href' => $this->uri, 'class' => 'phabricator-pinboard-item-image-link', ), - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $this->imageURI, diff --git a/src/view/page/PhabricatorBarePageView.php b/src/view/page/PhabricatorBarePageView.php index 9755ab4375..ca3d039738 100644 --- a/src/view/page/PhabricatorBarePageView.php +++ b/src/view/page/PhabricatorBarePageView.php @@ -66,7 +66,7 @@ class PhabricatorBarePageView extends AphrontPageView { $viewport_tag = null; if ($this->getDeviceReady()) { - $viewport_tag = phutil_render_tag( + $viewport_tag = phutil_tag( 'meta', array( 'name' => 'viewport', diff --git a/src/view/page/menu/PhabricatorMainMenuSearchView.php b/src/view/page/menu/PhabricatorMainMenuSearchView.php index e3108e9805..c444ca9078 100644 --- a/src/view/page/menu/PhabricatorMainMenuSearchView.php +++ b/src/view/page/menu/PhabricatorMainMenuSearchView.php @@ -23,7 +23,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView { $target_id = celerity_generate_unique_node_id(); $search_id = $this->getID(); - $input = phutil_render_tag( + $input = phutil_tag( 'input', array( 'type' => 'text', @@ -52,7 +52,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView { 'placeholder' => PhabricatorSearchScope::getScopePlaceholder($scope), )); - $scope_input = phutil_render_tag( + $scope_input = phutil_tag( 'input', array( 'type' => 'hidden', -- 2.51.2 From 48561a8b1f7bbfa66c12ae6e7ebbb099e7386f9b Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 17 Jan 2013 18:43:35 -0800 Subject: [PATCH 02/50] Convert phutil_render_tag(X, Y, phutil_escape_html(Z)) to phutil_tag Summary: Created with spatch: lang=diff - phutil_render_tag + phutil_tag (X, Y, - phutil_escape_html( Z - ) ) Test Plan: Loaded homepage Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4501 --- .../AphrontDefaultApplicationConfiguration.php | 8 ++++---- .../console/plugin/DarkConsoleErrorLogPlugin.php | 8 ++++---- .../PhabricatorChatLogChannelListController.php | 4 ++-- .../PhabricatorConduitListController.php | 4 ++-- .../PhabricatorConfigAllController.php | 4 ++-- .../config/view/PhabricatorSetupIssueView.php | 12 ++++++------ .../PhabricatorCountdownListController.php | 4 ++-- .../view/PhabricatorDaemonLogEventsView.php | 4 ++-- .../DifferentialDiffViewController.php | 8 ++++---- .../DifferentialTitleFieldSpecification.php | 4 ++-- ...fferentialChangesetFileTreeSideNavBuilder.php | 4 ++-- .../DifferentialRevisionUpdateHistoryView.php | 8 ++++---- .../controller/DiffusionBrowseFileController.php | 16 ++++++++-------- .../DiffusionCommitBranchesController.php | 4 ++-- .../controller/DiffusionCommitController.php | 12 ++++++------ .../controller/DiffusionCommitTagsController.php | 4 ++-- .../diffusion/controller/DiffusionController.php | 4 ++-- .../controller/DiffusionExternalController.php | 5 ++--- .../controller/DiffusionHistoryController.php | 4 ++-- .../controller/DiffusionHomeController.php | 8 ++++---- .../controller/DiffusionSymbolController.php | 4 ++-- .../diffusion/view/DiffusionBranchTableView.php | 4 ++-- .../diffusion/view/DiffusionBrowseTableView.php | 4 ++-- .../diffusion/view/DiffusionTagListView.php | 9 ++++----- .../diviner/controller/DivinerListController.php | 4 ++-- .../drydock/controller/DrydockController.php | 12 ++++++------ .../feed/builder/PhabricatorFeedBuilder.php | 4 ++-- .../feed/story/PhabricatorFeedStory.php | 4 ++-- .../controller/HeraldTranscriptController.php | 4 ++-- .../herald/view/HeraldRuleEditHistoryView.php | 4 ++-- .../herald/view/HeraldRuleListView.php | 4 ++-- .../controller/ManiphestReportController.php | 8 ++++---- .../ManiphestSavedQueryListController.php | 4 ++-- .../controller/ManiphestTaskDetailController.php | 4 ++-- .../maniphest/view/ManiphestTaskProjectsView.php | 5 ++--- .../maniphest/view/ManiphestTaskSummaryView.php | 4 ++-- .../view/PhabricatorApplicationLaunchView.php | 12 ++++++------ .../view/PhabricatorApplicationStatusView.php | 4 ++-- .../metamta/PhabricatorMetaMTAWorker.php | 4 ++-- .../PhabricatorOAuthClientListController.php | 8 ++++---- ...torOAuthClientAuthorizationEditController.php | 4 ++-- ...torOAuthClientAuthorizationListController.php | 4 ++-- .../PhabricatorOwnersDetailController.php | 4 ++-- .../PhabricatorOwnersListController.php | 12 ++++++------ .../PhabricatorPeopleListController.php | 4 ++-- .../PhabricatorPeopleLogsController.php | 8 ++++---- src/applications/phame/view/PhamePostView.php | 9 ++++----- .../phid/PhabricatorObjectHandle.php | 4 ++-- .../PhabricatorPHIDLookupController.php | 4 ++-- .../PhabricatorXHPASTViewStreamController.php | 4 ++-- .../PhabricatorXHPASTViewTreeController.php | 4 ++-- .../controller/PhrictionDiffController.php | 4 ++-- .../controller/PhrictionDocumentController.php | 4 ++-- .../controller/PhrictionListController.php | 4 ++-- .../policy/filter/PhabricatorPolicy.php | 4 ++-- .../ponder/view/PonderQuestionSummaryView.php | 4 +--- .../PhabricatorProjectListController.php | 8 ++++---- .../panel/PhabricatorSettingsPanelProfile.php | 4 ++-- .../panel/PhabricatorSettingsPanelSSHKeys.php | 4 ++-- .../PhabricatorSlowvoteListController.php | 4 ++-- ...bricatorApplicationTransactionCommentView.php | 4 ++-- .../examples/PhabricatorBarePageExample.php | 4 ++-- .../examples/PhabricatorButtonsExample.php | 4 ++-- .../xhprof/view/PhabricatorXHProfProfileView.php | 4 ++-- .../rule/PhabricatorRemarkupRuleMention.php | 8 ++++---- .../rule/PhabricatorRemarkupRulePhriction.php | 4 ++-- src/view/control/AphrontAttachedFileView.php | 4 ++-- src/view/control/AphrontTableView.php | 4 ++-- src/view/form/AphrontErrorView.php | 8 ++++---- .../form/control/AphrontFormCheckboxControl.php | 4 ++-- .../control/AphrontFormRadioButtonControl.php | 4 ++-- .../form/control/AphrontFormSelectControl.php | 4 ++-- .../form/control/AphrontFormSubmitControl.php | 8 ++++---- .../form/control/AphrontFormTextAreaControl.php | 4 ++-- .../control/AphrontFormToggleButtonsControl.php | 4 ++-- src/view/layout/PhabricatorActionView.php | 4 ++-- src/view/layout/PhabricatorHeaderView.php | 4 ++-- src/view/layout/PhabricatorMenuItemView.php | 4 ++-- .../layout/PhabricatorObjectItemListView.php | 4 ++-- src/view/layout/PhabricatorObjectItemView.php | 8 ++++---- src/view/layout/PhabricatorPropertyListView.php | 8 ++++---- src/view/layout/PhabricatorTransactionView.php | 4 ++-- src/view/layout/headsup/AphrontHeadsupView.php | 4 ++-- src/view/page/menu/PhabricatorMainMenuView.php | 4 ++-- 84 files changed, 225 insertions(+), 231 deletions(-) diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index e91884ef58..6d17506831 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -333,17 +333,17 @@ class AphrontDefaultApplicationConfiguration '$'.$part['line']; $attrs['target'] = '_blank'; } - $file_name = phutil_render_tag( + $file_name = phutil_tag( 'a', $attrs, - phutil_escape_html($relative)); + $relative); } else { - $file_name = phutil_render_tag( + $file_name = phutil_tag( 'span', array( 'title' => $file, ), - phutil_escape_html($relative)); + $relative); } $file_name = $file_name.' : '.(int)$part['line']; } else { diff --git a/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php b/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php index 20123516f8..fae5ff2cb1 100644 --- a/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php @@ -39,12 +39,12 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { $file = $row['file']; $line = $row['line']; - $tag = phutil_render_tag( + $tag = phutil_tag( 'a', array( 'onclick' => jsprintf('show_details(%d)', $index), ), - phutil_escape_html($row['str'].' at ['.basename($file).':'.$line.']')); + $row['str'].' at ['.basename($file).':'.$line.']'); $rows[] = array($tag); $details .= @@ -70,12 +70,12 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { } } - $details .= phutil_render_tag( + $details .= phutil_tag( 'a', array( 'href' => $href, ), - phutil_escape_html($line)); + $line); $details .= "\n"; } diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php index 9f2a03dfd6..1745e1f274 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php @@ -16,12 +16,12 @@ final class PhabricatorChatLogChannelListController foreach ($channels as $channel) { $name = $channel['channel']; $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/chatlog/channel/'.phutil_escape_uri($name).'/', ), - phutil_escape_html($name))); + $name)); } $table = new AphrontTableView($rows); diff --git a/src/applications/conduit/controller/PhabricatorConduitListController.php b/src/applications/conduit/controller/PhabricatorConduitListController.php index 7c16896516..617ca48288 100644 --- a/src/applications/conduit/controller/PhabricatorConduitListController.php +++ b/src/applications/conduit/controller/PhabricatorConduitListController.php @@ -25,12 +25,12 @@ final class PhabricatorConduitListController $rows[] = array( $group, - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/conduit/method/'.$info['full_name'], ), - phutil_escape_html($info['full_name'])), + $info['full_name']), $info['description'], $status, ); diff --git a/src/applications/config/controller/PhabricatorConfigAllController.php b/src/applications/config/controller/PhabricatorConfigAllController.php index e5bbc7552a..e140ffc9ef 100644 --- a/src/applications/config/controller/PhabricatorConfigAllController.php +++ b/src/applications/config/controller/PhabricatorConfigAllController.php @@ -24,12 +24,12 @@ final class PhabricatorConfigAllController } $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->getApplicationURI('edit/'.$key.'/'), ), - phutil_escape_html($key)), + $key), $value, ); } diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index c85caed1ee..645999f190 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -95,12 +95,12 @@ final class PhabricatorSetupIssueView extends AphrontView { ), pht('To continue, resolve this problem and reload the page.')); - $name = phutil_render_tag( + $name = phutil_tag( 'div', array( 'class' => 'setup-issue-name', ), - phutil_escape_html($issue->getName())); + $issue->getName()); return phutil_render_tag( 'div', @@ -283,10 +283,10 @@ final class PhabricatorSetupIssueView extends AphrontView { "To update these %d value(s), edit your PHP configuration file, ". "located here:", count($configs))); - $info .= phutil_render_tag( + $info .= phutil_tag( 'pre', array(), - phutil_escape_html($ini_loc)); + $ini_loc); } if ($more_loc) { @@ -296,10 +296,10 @@ final class PhabricatorSetupIssueView extends AphrontView { pht( "PHP also loaded these configuration file(s):", count($more_loc))); - $info .= phutil_render_tag( + $info .= phutil_tag( 'pre', array(), - phutil_escape_html(implode("\n", $more_loc))); + implode("\n", $more_loc)); } $info .= phutil_render_tag( diff --git a/src/applications/countdown/controller/PhabricatorCountdownListController.php b/src/applications/countdown/controller/PhabricatorCountdownListController.php index 1f8190254d..47cc610c6d 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownListController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownListController.php @@ -48,12 +48,12 @@ final class PhabricatorCountdownListController $rows[] = array( phutil_escape_html($timer->getID()), $handles[$timer->getAuthorPHID()]->renderLink(), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/countdown/'.$timer->getID().'/', ), - phutil_escape_html($timer->getTitle())), + $timer->getTitle()), phabricator_datetime($timer->getDatepoint(), $user), $edit_button, $delete_button, diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php index 57a3a5db2e..732b3b6a44 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php @@ -69,12 +69,12 @@ final class PhabricatorDaemonLogEventsView extends AphrontView { if ($this->combinedLog) { array_unshift( $row, - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/daemon/log/'.$event->getLogID().'/', ), - phutil_escape_html('Daemon '.$event->getLogID()))); + 'Daemon '.$event->getLogID())); } $rows[] = $row; diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php index b212c20293..1ca4a9de73 100644 --- a/src/applications/differential/controller/DifferentialDiffViewController.php +++ b/src/applications/differential/controller/DifferentialDiffViewController.php @@ -19,12 +19,12 @@ final class DifferentialDiffViewController extends DifferentialController { if ($diff->getRevisionID()) { $top_panel = new AphrontPanelView(); $top_panel->setWidth(AphrontPanelView::WIDTH_WIDE); - $link = phutil_render_tag( + $link = phutil_tag( 'a', array( 'href' => PhabricatorEnv::getURI('/D'.$diff->getRevisionID()), ), - phutil_escape_html('D'.$diff->getRevisionID())); + 'D'.$diff->getRevisionID()); $top_panel->appendChild( "

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

"); } else { @@ -52,12 +52,12 @@ final class DifferentialDiffViewController extends DifferentialController { if ($revisions) { $select[] = ''; foreach ($revisions as $revision) { - $select[] = phutil_render_tag( + $select[] = phutil_tag( 'option', array( 'value' => $revision->getID(), ), - phutil_escape_html($revision->getTitle())); + $revision->getTitle()); } $select[] = ''; } diff --git a/src/applications/differential/field/specification/DifferentialTitleFieldSpecification.php b/src/applications/differential/field/specification/DifferentialTitleFieldSpecification.php index 6a1c6ce20c..07095e0800 100644 --- a/src/applications/differential/field/specification/DifferentialTitleFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialTitleFieldSpecification.php @@ -87,12 +87,12 @@ final class DifferentialTitleFieldSpecification } public function renderValueForRevisionList(DifferentialRevision $revision) { - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => '/D'.$revision->getID(), ), - phutil_escape_html($revision->getTitle())); + $revision->getTitle()); } } diff --git a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php index e13117d2b5..dfa474be67 100644 --- a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php +++ b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php @@ -97,12 +97,12 @@ final class DifferentialChangesetFileTreeSideNavBuilder { ), ''); - $name_element = phutil_render_tag( + $name_element = phutil_tag( 'span', array( 'class' => 'phabricator-filetree-name', ), - phutil_escape_html($name)); + $name); $filetree[] = javelin_render_tag( $href ? 'a' : 'span', diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index ff00f973e9..8e7e9f926c 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -145,10 +145,10 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { } $last_base = $base; - $id_link = phutil_render_tag( + $id_link = phutil_tag( 'a', array('href' => '/differential/diff/'.$id.'/'), - phutil_escape_html($id)); + $id); $rows[] = ''. ''.phutil_escape_html($name).''. @@ -179,7 +179,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { $select = ''; diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index edab2227ed..c0835332f4 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -178,12 +178,12 @@ final class DiffusionBrowseFileController extends DiffusionController { case 'plain': $style = "margin: 1em 2em; width: 90%; height: 80em; font-family: monospace"; - $corpus = phutil_render_tag( + $corpus = phutil_tag( 'textarea', array( 'style' => $style, ), - phutil_escape_html($file_query->getRawData())); + $file_query->getRawData()); break; @@ -205,12 +205,12 @@ final class DiffusionBrowseFileController extends DiffusionController { sprintf("%-10s %-20s %s", substr($rev, 0, 7), $author, $line); } - $corpus = phutil_render_tag( + $corpus = phutil_tag( 'textarea', array( 'style' => $style, ), - phutil_escape_html(implode("\n", $rows))); + implode("\n", $rows)); break; @@ -493,11 +493,11 @@ final class DiffusionBrowseFileController extends DiffusionController { if (isset($blame['handle'])) { $author_link = $blame['handle']->renderLink(); } else { - $author_link = phutil_render_tag( + $author_link = phutil_tag( 'span', array( ), - phutil_escape_html($blame['author'])); + $blame['author']); } $display_line['author'] = $author_link; @@ -699,12 +699,12 @@ final class DiffusionBrowseFileController extends DiffusionController { idx($line, 'author')); } - $line_link = phutil_render_tag( + $line_link = phutil_tag( 'a', array( 'href' => $line_href, ), - phutil_escape_html($line['line'])); + $line['line']); $blame[] = javelin_render_tag( 'th', diff --git a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php index c456d5e9af..4b306f5b10 100644 --- a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php +++ b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php @@ -14,7 +14,7 @@ final class DiffusionCommitBranchesController extends DiffusionController { $branch_links = array(); foreach ($branches as $branch => $commit) { - $branch_links[] = phutil_render_tag( + $branch_links[] = phutil_tag( 'a', array( 'href' => $request->generateURI( @@ -23,7 +23,7 @@ final class DiffusionCommitBranchesController extends DiffusionController { 'branch' => $branch, )), ), - phutil_escape_html($branch)); + $branch); } return id(new AphrontAjaxResponse()) diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 72ba662840..8afcc4b0e7 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -178,13 +178,13 @@ final class DiffusionCommitController extends DiffusionController { $change_panel->setID('toc'); if ($count > self::CHANGES_LIMIT) { - $show_all_button = phutil_render_tag( + $show_all_button = phutil_tag( 'a', array( 'class' => 'button green', 'href' => '?show_all=true', ), - phutil_escape_html('Show All Changes')); + 'Show All Changes'); $warning_view = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setTitle('Very Large Commit') @@ -399,10 +399,10 @@ final class DiffusionCommitController extends DiffusionController { if ($commit->getAuditStatus()) { $status = PhabricatorAuditCommitStatusConstants::getStatusName( $commit->getAuditStatus()); - $props['Status'] = phutil_render_tag( + $props['Status'] = phutil_tag( 'strong', array(), - phutil_escape_html($status)); + $status); } $props['Committed'] = phabricator_datetime($commit->getEpoch(), $user); @@ -892,7 +892,7 @@ final class DiffusionCommitController extends DiffusionController { $ref_links = array(); foreach ($refs as $ref) { - $ref_links[] = phutil_render_tag( + $ref_links[] = phutil_tag( 'a', array( 'href' => $request->generateURI( @@ -901,7 +901,7 @@ final class DiffusionCommitController extends DiffusionController { 'branch' => $ref, )), ), - phutil_escape_html($ref)); + $ref); } $ref_links = implode(', ', $ref_links); return $ref_links; diff --git a/src/applications/diffusion/controller/DiffusionCommitTagsController.php b/src/applications/diffusion/controller/DiffusionCommitTagsController.php index fea9d58716..5dbabff240 100644 --- a/src/applications/diffusion/controller/DiffusionCommitTagsController.php +++ b/src/applications/diffusion/controller/DiffusionCommitTagsController.php @@ -19,7 +19,7 @@ final class DiffusionCommitTagsController extends DiffusionController { $tag_links = array(); foreach ($tags as $tag) { - $tag_links[] = phutil_render_tag( + $tag_links[] = phutil_tag( 'a', array( 'href' => $request->generateURI( @@ -28,7 +28,7 @@ final class DiffusionCommitTagsController extends DiffusionController { 'commit' => $tag->getName(), )), ), - phutil_escape_html($tag->getName())); + $tag->getName()); } if ($has_more_tags) { diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index 4178c6bd2a..ea11c4831b 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -278,7 +278,7 @@ abstract class DiffusionController extends PhabricatorController { $thus_far = ''; foreach ($path_parts as $path_part) { $thus_far .= $path_part.'/'; - $path_sections[] = phutil_render_tag( + $path_sections[] = phutil_tag( 'a', array( 'href' => $drequest->generateURI( @@ -286,7 +286,7 @@ abstract class DiffusionController extends PhabricatorController { 'path' => $thus_far, ) + $uri_params), ), - phutil_escape_html($path_part)); + $path_part); } $path_sections[] = phutil_escape_html($last); diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php index 1f3fc6c6b2..738cee81fd 100644 --- a/src/applications/diffusion/controller/DiffusionExternalController.php +++ b/src/applications/diffusion/controller/DiffusionExternalController.php @@ -95,13 +95,12 @@ final class DiffusionExternalController extends DiffusionController { 'commit' => $commit->getCommitIdentifier(), )); $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $href, ), - phutil_escape_html( - 'r'.$repo->getCallsign().$commit->getCommitIdentifier())), + 'r'.$repo->getCallsign().$commit->getCommitIdentifier()), phutil_escape_html($commit->loadCommitData()->getSummary()), ); } diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php index 4b9193616d..fe541054e7 100644 --- a/src/applications/diffusion/controller/DiffusionHistoryController.php +++ b/src/applications/diffusion/controller/DiffusionHistoryController.php @@ -47,13 +47,13 @@ final class DiffusionHistoryController extends DiffusionController { $copies_new = true; } - $button = phutil_render_tag( + $button = phutil_tag( 'a', array( 'class' => 'button small grey', 'href' => $request->getRequestURI()->alter('copies', $copies_new), ), - phutil_escape_html($button_title)); + $button_title); $history_table = new DiffusionHistoryTableView(); $history_table->setUser($request->getUser()); diff --git a/src/applications/diffusion/controller/DiffusionHomeController.php b/src/applications/diffusion/controller/DiffusionHomeController.php index d59504f69a..c951b764a8 100644 --- a/src/applications/diffusion/controller/DiffusionHomeController.php +++ b/src/applications/diffusion/controller/DiffusionHomeController.php @@ -13,12 +13,12 @@ final class DiffusionHomeController extends DiffusionController { $rows = array(); foreach ($shortcuts as $shortcut) { $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $shortcut->getHref(), ), - phutil_escape_html($shortcut->getName())), + $shortcut->getName()), phutil_escape_html($shortcut->getDescription()), ); } @@ -124,12 +124,12 @@ final class DiffusionHomeController extends DiffusionController { } $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/diffusion/'.$repository->getCallsign().'/', ), - phutil_escape_html($repository->getName())), + $repository->getName()), phutil_escape_html($repository->getDetail('description')), PhabricatorRepositoryType::getNameForRepositoryType( $repository->getVersionControlSystem()), diff --git a/src/applications/diffusion/controller/DiffusionSymbolController.php b/src/applications/diffusion/controller/DiffusionSymbolController.php index ab118c3948..17fcea83ae 100644 --- a/src/applications/diffusion/controller/DiffusionSymbolController.php +++ b/src/applications/diffusion/controller/DiffusionSymbolController.php @@ -94,12 +94,12 @@ final class DiffusionSymbolController extends DiffusionController { return id(new AphrontRedirectResponse())->setURI($href); } - $location = phutil_render_tag( + $location = phutil_tag( 'a', array( 'href' => $href, ), - phutil_escape_html($file.':'.$line)); + $file.':'.$line); } else if ($file) { $location = phutil_escape_html($file.':'.$line); } else { diff --git a/src/applications/diffusion/view/DiffusionBranchTableView.php b/src/applications/diffusion/view/DiffusionBranchTableView.php index ee95580932..4ac40d73ca 100644 --- a/src/applications/diffusion/view/DiffusionBranchTableView.php +++ b/src/applications/diffusion/view/DiffusionBranchTableView.php @@ -47,7 +47,7 @@ final class DiffusionBranchTableView extends DiffusionView { ), 'History' ), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $drequest->generateURI( @@ -56,7 +56,7 @@ final class DiffusionBranchTableView extends DiffusionView { 'branch' => $branch->getName(), )), ), - phutil_escape_html($branch->getName())), + $branch->getName()), self::linkCommit( $drequest->getRepository(), $branch->getHeadCommitIdentifier()), diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index 004faf0a21..fdf1651474 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -278,12 +278,12 @@ final class DiffusionBrowseTableView extends DiffusionView { require_celerity_resource('diffusion-icons-css'); - return phutil_render_tag( + return phutil_tag( 'span', array( 'class' => 'diffusion-path-icon diffusion-path-icon-'.$type, ), - phutil_escape_html($text)); + $text); } } diff --git a/src/applications/diffusion/view/DiffusionTagListView.php b/src/applications/diffusion/view/DiffusionTagListView.php index dee0ec3d2a..b2291dcfe9 100644 --- a/src/applications/diffusion/view/DiffusionTagListView.php +++ b/src/applications/diffusion/view/DiffusionTagListView.php @@ -34,7 +34,7 @@ final class DiffusionTagListView extends DiffusionView { foreach ($this->tags as $tag) { $commit = idx($this->commits, $tag->getCommitIdentifier()); - $tag_link = phutil_render_tag( + $tag_link = phutil_tag( 'a', array( 'href' => $drequest->generateURI( @@ -43,9 +43,9 @@ final class DiffusionTagListView extends DiffusionView { 'commit' => $tag->getName(), )), ), - phutil_escape_html($tag->getName())); + $tag->getName()); - $commit_link = phutil_render_tag( + $commit_link = phutil_tag( 'a', array( 'href' => $drequest->generateURI( @@ -54,9 +54,8 @@ final class DiffusionTagListView extends DiffusionView { 'commit' => $tag->getCommitIdentifier(), )), ), - phutil_escape_html( $repository->formatCommitName( - $tag->getCommitIdentifier()))); + $tag->getCommitIdentifier())); $author = null; if ($commit && $commit->getAuthorPHID()) { diff --git a/src/applications/diviner/controller/DivinerListController.php b/src/applications/diviner/controller/DivinerListController.php index 7ac7aa453a..2125532b98 100644 --- a/src/applications/diviner/controller/DivinerListController.php +++ b/src/applications/diviner/controller/DivinerListController.php @@ -33,13 +33,13 @@ final class DivinerListController extends PhabricatorController { $name = $link['name']; $flavor = $link['flavor']; - $link = phutil_render_tag( + $link = phutil_tag( 'a', array( 'href' => $href, 'target' => '_blank', ), - phutil_escape_html($name)); + $name); $out[] = '
'. diff --git a/src/applications/drydock/controller/DrydockController.php b/src/applications/drydock/controller/DrydockController.php index a3bcc28ea1..e05c1f6839 100644 --- a/src/applications/drydock/controller/DrydockController.php +++ b/src/applications/drydock/controller/DrydockController.php @@ -32,18 +32,18 @@ abstract class DrydockController extends PhabricatorController { $lease_uri = $this->getApplicationURI($lease_uri); $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $resource_uri, ), - phutil_escape_html($log->getResourceID())), - phutil_render_tag( + $log->getResourceID()), + phutil_tag( 'a', array( 'href' => $lease_uri, ), - phutil_escape_html($log->getLeaseID())), + $log->getLeaseID()), phutil_escape_html($log->getMessage()), phabricator_date($log->getEpoch(), $user), ); @@ -96,12 +96,12 @@ abstract class DrydockController extends PhabricatorController { $resource_name = $resource->getName(); $item->addAttribute( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $resource_href, ), - phutil_escape_html($resource_name))); + $resource_name)); } $status = DrydockLeaseStatus::getNameForStatus($lease->getStatus()); diff --git a/src/applications/feed/builder/PhabricatorFeedBuilder.php b/src/applications/feed/builder/PhabricatorFeedBuilder.php index 25a127bc5c..dfb9751cf8 100644 --- a/src/applications/feed/builder/PhabricatorFeedBuilder.php +++ b/src/applications/feed/builder/PhabricatorFeedBuilder.php @@ -45,12 +45,12 @@ final class PhabricatorFeedBuilder { } $last_date = $date; $null_view->appendChild( - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'phabricator-feed-story-date', ), - phutil_escape_html($date))); + $date)); } $view = $story->renderView(); diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php index 5d9823aac4..b9715efca6 100644 --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -233,13 +233,13 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface { // NOTE: We render our own link here to customize the styling and add // the '_top' target for framed feeds. - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $handle->getURI(), 'target' => $this->framed ? '_top' : null, ), - phutil_escape_html($handle->getLinkName())); + $handle->getLinkName()); } final protected function renderString($str) { diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index 5dec02733e..62af029da8 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -481,12 +481,12 @@ final class HeraldTranscriptController extends HeraldController { } if (strlen($value) > 256) { - $value = phutil_render_tag( + $value = phutil_tag( 'textarea', array( 'class' => 'herald-field-value-transcript', ), - phutil_escape_html($value)); + $value); } else if ($name === 'Object Link') { // The link cannot be escaped } else { diff --git a/src/applications/herald/view/HeraldRuleEditHistoryView.php b/src/applications/herald/view/HeraldRuleEditHistoryView.php index d931d2b2d6..7e3fb7b625 100644 --- a/src/applications/herald/view/HeraldRuleEditHistoryView.php +++ b/src/applications/herald/view/HeraldRuleEditHistoryView.php @@ -25,10 +25,10 @@ final class HeraldRuleEditHistoryView extends AphrontView { foreach ($this->edits as $edit) { $name = nonempty($edit->getRuleName(), 'Unknown Rule'); - $rule_name = phutil_render_tag( + $rule_name = phutil_tag( 'strong', array(), - phutil_escape_html($name)); + $name); switch ($edit->getAction()) { case 'create': diff --git a/src/applications/herald/view/HeraldRuleListView.php b/src/applications/herald/view/HeraldRuleListView.php index 65e0c8d2e0..2bfe609bdf 100644 --- a/src/applications/herald/view/HeraldRuleListView.php +++ b/src/applications/herald/view/HeraldRuleListView.php @@ -44,12 +44,12 @@ final class HeraldRuleListView extends AphrontView { $author = $this->handles[$rule->getAuthorPHID()]->renderLink(); } - $name = phutil_render_tag( + $name = phutil_tag( 'a', array( 'href' => '/herald/rule/'.$rule->getID().'/', ), - phutil_escape_html($rule->getName())); + $rule->getName()); $edit_log = phutil_render_tag( 'a', diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index bf44e11ecf..cee45c4c20 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -478,12 +478,12 @@ final class ManiphestReportController extends ManiphestController { } $tasks = idx($result, $handle->getPHID(), array()); - $name = phutil_render_tag( + $name = phutil_tag( 'a', array( 'href' => $base_link.$handle->getPHID(), ), - phutil_escape_html($handle->getName())); + $handle->getName()); $closed = idx($result_closed, $handle->getPHID(), array()); } else { $tasks = $leftover; @@ -524,13 +524,13 @@ final class ManiphestReportController extends ManiphestController { if ($closed) { $task_ids = implode(',', mpull($closed, 'getID')); - $row[] = phutil_render_tag( + $row[] = phutil_tag( 'a', array( 'href' => '/maniphest/view/custom/?s=oc&tasks='.$task_ids, 'target' => '_blank', ), - phutil_escape_html(number_format(count($closed)))); + number_format(count($closed))); } else { $row[] = '-'; } diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php index 3578aad4e2..9957aa0991 100644 --- a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php +++ b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php @@ -48,12 +48,12 @@ final class ManiphestSavedQueryListController extends ManiphestController { 'value' => $query->getID(), 'checked' => ($query->getIsDefault() ? 'checked' : null), )), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/view/custom/?key='.$query->getQueryKey(), ), - phutil_escape_html($query->getName())), + $query->getName()), phutil_render_tag( 'a', array( diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 5bdb168d77..13482b8f35 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -457,12 +457,12 @@ final class ManiphestTaskDetailController extends ManiphestController { $subject = '[T'.$task->getID().'] '.$task->getTitle(); $view->addProperty( pht('From Email'), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => 'mailto:'.$source.'?subject='.$subject ), - phutil_escape_html($source))); + $source)); } $view->addProperty( diff --git a/src/applications/maniphest/view/ManiphestTaskProjectsView.php b/src/applications/maniphest/view/ManiphestTaskProjectsView.php index d83a706e0f..5e63043238 100644 --- a/src/applications/maniphest/view/ManiphestTaskProjectsView.php +++ b/src/applications/maniphest/view/ManiphestTaskProjectsView.php @@ -21,14 +21,13 @@ final class ManiphestTaskProjectsView extends ManiphestView { $tags = array(); foreach ($show as $handle) { - $tags[] = phutil_render_tag( + $tags[] = phutil_tag( 'a', array( 'href' => $handle->getURI(), 'class' => 'phabricator-project-tag', ), - phutil_escape_html( - phutil_utf8_shorten($handle->getName(), 24))); + phutil_utf8_shorten($handle->getName(), 24)); } if (count($this->handles) > 2) { diff --git a/src/applications/maniphest/view/ManiphestTaskSummaryView.php b/src/applications/maniphest/view/ManiphestTaskSummaryView.php index a3adbab980..075bee78dd 100644 --- a/src/applications/maniphest/view/ManiphestTaskSummaryView.php +++ b/src/applications/maniphest/view/ManiphestTaskSummaryView.php @@ -119,12 +119,12 @@ final class ManiphestTaskSummaryView extends ManiphestView { : 'None'). ''. ''. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/T'.$task->getID(), ), - phutil_escape_html($task->getTitle())). + $task->getTitle()). ''. ''. $projects_view->render(). diff --git a/src/applications/meta/view/PhabricatorApplicationLaunchView.php b/src/applications/meta/view/PhabricatorApplicationLaunchView.php index c5c45ae1ef..d3658cdf29 100644 --- a/src/applications/meta/view/PhabricatorApplicationLaunchView.php +++ b/src/applications/meta/view/PhabricatorApplicationLaunchView.php @@ -31,12 +31,12 @@ final class PhabricatorApplicationLaunchView extends AphrontView { $icon = null; $create_button = null; if ($application) { - $content[] = phutil_render_tag( + $content[] = phutil_tag( 'span', array( 'class' => 'phabricator-application-launch-name', ), - phutil_escape_html($application->getName())); + $application->getName()); if ($application->isBeta()) { $content[] = phutil_render_tag( @@ -48,12 +48,12 @@ final class PhabricatorApplicationLaunchView extends AphrontView { } if ($this->fullWidth) { - $content[] = phutil_render_tag( + $content[] = phutil_tag( 'span', array( 'class' => 'phabricator-application-launch-description', ), - phutil_escape_html($application->getShortDescription())); + $application->getShortDescription()); } $count = 0; @@ -64,12 +64,12 @@ final class PhabricatorApplicationLaunchView extends AphrontView { } if ($count) { - $content[] = phutil_render_tag( + $content[] = phutil_tag( 'span', array( 'class' => 'phabricator-application-launch-attention', ), - phutil_escape_html($count)); + $count); } $classes = array(); diff --git a/src/applications/meta/view/PhabricatorApplicationStatusView.php b/src/applications/meta/view/PhabricatorApplicationStatusView.php index 81718177eb..cc2339b9c3 100644 --- a/src/applications/meta/view/PhabricatorApplicationStatusView.php +++ b/src/applications/meta/view/PhabricatorApplicationStatusView.php @@ -37,12 +37,12 @@ final class PhabricatorApplicationStatusView extends AphrontView { 'phabricator-application-status-type-'.$this->type, ); - return phutil_render_tag( + return phutil_tag( 'span', array( 'class' => implode(' ', $classes), ), - phutil_escape_html($this->text)); + $this->text); } } diff --git a/src/applications/metamta/PhabricatorMetaMTAWorker.php b/src/applications/metamta/PhabricatorMetaMTAWorker.php index 4e7bff2331..f3075033b3 100644 --- a/src/applications/metamta/PhabricatorMetaMTAWorker.php +++ b/src/applications/metamta/PhabricatorMetaMTAWorker.php @@ -42,10 +42,10 @@ final class PhabricatorMetaMTAWorker } public function renderForDisplay() { - return phutil_render_tag( + return phutil_tag( 'a', array('href' => '/mail/view/'.$this->getTaskData().'/'), - phutil_escape_html($this->getTaskData())); + $this->getTaskData()); } } diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php index b10d5c3c9a..072167576a 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php @@ -31,21 +31,21 @@ extends PhabricatorOAuthClientBaseController { $highlight = $this->getHighlightPHIDs(); foreach ($clients as $client) { $row = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $client->getViewURI(), ), - phutil_escape_html($client->getName()) + $client->getName() ), $client->getPHID(), $client->getSecret(), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $client->getRedirectURI(), ), - phutil_escape_html($client->getRedirectURI()) + $client->getRedirectURI() ), phutil_render_tag( 'a', diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php index 06d2969e67..ad834f75cf 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php @@ -61,12 +61,12 @@ extends PhabricatorOAuthClientAuthorizationBaseController { id(new AphrontFormMarkupControl()) ->setLabel('Client') ->setValue( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $client->getViewURI(), ), - phutil_escape_html($client->getName()))) + $client->getName())) ) ->appendChild( id(new AphrontFormStaticControl()) diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php index 9468457353..c74b040296 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php @@ -50,12 +50,12 @@ extends PhabricatorOAuthClientAuthorizationBaseController { 'article/Using_the_Phabricator_OAuth_Server.html#scopes' ); $row = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $client->getViewURI(), ), - phutil_escape_html($client->getName()) + $client->getName() ), phutil_render_tag( 'a', diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index f8137b977d..485a3014ab 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -94,12 +94,12 @@ final class PhabricatorOwnersDetailController )); $repo_name = ''.phutil_escape_html($repo->getName()). ''; - $path_link = phutil_render_tag( + $path_link = phutil_tag( 'a', array( 'href' => (string) $href, ), - phutil_escape_html($path->getPath())); + $path->getPath()); $path_links[] = ($path->getExcluded() ? '–' : '+').' '. $repo_name.' '.$path_link; diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index b734b38d56..c23ed1eb5f 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -254,12 +254,12 @@ final class PhabricatorOwnersListController $pkg_paths[$key] = ($path->getExcluded() ? '–' : '+').' '. ''.phutil_escape_html($repo->getName()).' '. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => (string) $href, ), - phutil_escape_html($path->getPath())); + $path->getPath()); } else { $pkg_paths[$key] = phutil_escape_html($path->getPath()); } @@ -267,20 +267,20 @@ final class PhabricatorOwnersListController $pkg_paths = implode('
', $pkg_paths); $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/owners/package/'.$package->getID().'/', ), - phutil_escape_html($package->getName())), + $package->getName()), $pkg_owners, $pkg_paths, - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/audit/view/packagecommits/?phid='.$package->getPHID(), ), - phutil_escape_html('Related Commits')) + 'Related Commits') ); } diff --git a/src/applications/people/controller/PhabricatorPeopleListController.php b/src/applications/people/controller/PhabricatorPeopleListController.php index 8ec8bf07d3..ce6f60e45a 100644 --- a/src/applications/people/controller/PhabricatorPeopleListController.php +++ b/src/applications/people/controller/PhabricatorPeopleListController.php @@ -49,12 +49,12 @@ final class PhabricatorPeopleListController $rows[] = array( phabricator_date($user->getDateCreated(), $viewer), phabricator_time($user->getDateCreated(), $viewer), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/p/'.$user->getUsername().'/', ), - phutil_escape_html($user->getUserName())), + $user->getUserName()), phutil_escape_html($user->getRealName()), $status, $email, diff --git a/src/applications/people/controller/PhabricatorPeopleLogsController.php b/src/applications/people/controller/PhabricatorPeopleLogsController.php index 1621bd58fe..9b10f34396 100644 --- a/src/applications/people/controller/PhabricatorPeopleLogsController.php +++ b/src/applications/people/controller/PhabricatorPeopleLogsController.php @@ -163,22 +163,22 @@ final class PhabricatorPeopleLogsController phutil_escape_html($handles[$log->getUserPHID()]->getName()), json_encode($log->getOldValue(), true), json_encode($log->getNewValue(), true), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $request ->getRequestURI() ->alter('ip', $log->getRemoteAddr()), ), - phutil_escape_html($log->getRemoteAddr())), - phutil_render_tag( + $log->getRemoteAddr()), + phutil_tag( 'a', array( 'href' => $request ->getRequestURI() ->alter('session', $log->getSession()), ), - phutil_escape_html($log->getSession())), + $log->getSession()), ); } diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index 6e63fe7f17..60ab1dbc5d 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -64,27 +64,26 @@ final class PhamePostView extends AphrontView { array( 'class' => 'phame-post-title', ), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $href, ), - phutil_escape_html($this->getPost()->getTitle()))); + $this->getPost()->getTitle())); } public function renderDatePublished() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-post-date', ), - phutil_escape_html( pht( 'Published on %s by %s', phabricator_datetime( $this->getPost()->getDatePublished(), $this->getUser()), - $this->getAuthor()->getName()))); + $this->getAuthor()->getName())); } public function renderBody() { diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php index 7fd232c385..c16059d505 100644 --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -190,14 +190,14 @@ final class PhabricatorObjectHandle { $title = 'disabled'; // Overwrite status. } - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $this->getURI(), 'class' => $class, 'title' => $title, ), - phutil_escape_html($name)); + $name); } public function getLinkName() { diff --git a/src/applications/phid/controller/PhabricatorPHIDLookupController.php b/src/applications/phid/controller/PhabricatorPHIDLookupController.php index 7fa5e64e12..c6228df5c2 100644 --- a/src/applications/phid/controller/PhabricatorPHIDLookupController.php +++ b/src/applications/phid/controller/PhabricatorPHIDLookupController.php @@ -13,12 +13,12 @@ final class PhabricatorPHIDLookupController $rows = array(); foreach ($handles as $handle) { if ($handle->getURI()) { - $link = phutil_render_tag( + $link = phutil_tag( 'a', array( 'href' => $handle->getURI(), ), - phutil_escape_html($handle->getURI())); + $handle->getURI()); } else { $link = null; } diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php index c3a3b30f67..bf7c620be9 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php @@ -18,13 +18,13 @@ final class PhabricatorXHPASTViewStreamController $name = $token->getTypeName(); $title = "Token {$seq}: {$name}"; - $tokens[] = phutil_render_tag( + $tokens[] = phutil_tag( 'span', array( 'title' => $title, 'class' => 'token', ), - phutil_escape_html($token->getValue())); + $token->getValue()); } return $this->buildXHPASTViewPanelResponse(implode('', $tokens)); diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php index 2e07a0317e..5b7673386e 100644 --- a/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php +++ b/src/applications/phpast/controller/PhabricatorXHPASTViewTreeController.php @@ -29,12 +29,12 @@ final class PhabricatorXHPASTViewTreeController $tree = array(); $tree[] = '
  • '. - phutil_render_tag( + phutil_tag( 'span', array( 'title' => $title, ), - phutil_escape_html($name)). + $name). '
  • '; foreach ($root->getChildren() as $child) { $tree[] = '
      '.$this->buildTree($child).'
    '; diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php index ee03806fac..2702854661 100644 --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -104,12 +104,12 @@ final class PhrictionDiffController $crumbs->setCrumbs( array( 'Phriction', - phutil_render_tag( + phutil_tag( 'a', array( 'href' => PhrictionDocument::getSlugURI($slug), ), - phutil_escape_html($current->getTitle())), + $current->getTitle()), phutil_render_tag( 'a', array( diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 7b7a88fd98..f48e562d18 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -341,12 +341,12 @@ final class PhrictionDocumentController private function renderChildDocumentLink(array $info) { $title = nonempty($info['title'], '(Untitled Document)'); - $item = phutil_render_tag( + $item = phutil_tag( 'a', array( 'href' => PhrictionDocument::getSlugURI($info['slug']), ), - phutil_escape_html($title)); + $title); if (isset($info['empty'])) { $item = ''.$item.''; diff --git a/src/applications/phriction/controller/PhrictionListController.php b/src/applications/phriction/controller/PhrictionListController.php index abd90432e9..65bfefe701 100644 --- a/src/applications/phriction/controller/PhrictionListController.php +++ b/src/applications/phriction/controller/PhrictionListController.php @@ -53,12 +53,12 @@ final class PhrictionListController $content = $document->getContent(); $rows[] = array( $handles[$content->getAuthorPHID()]->renderLink(), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => PhrictionDocument::getSlugURI($document->getSlug()), ), - phutil_escape_html($content->getTitle())), + $content->getTitle()), phabricator_date($content->getDateCreated(), $user), phabricator_time($content->getDateCreated(), $user), ); diff --git a/src/applications/policy/filter/PhabricatorPolicy.php b/src/applications/policy/filter/PhabricatorPolicy.php index b901efbfbc..305cae4cd1 100644 --- a/src/applications/policy/filter/PhabricatorPolicy.php +++ b/src/applications/policy/filter/PhabricatorPolicy.php @@ -77,12 +77,12 @@ final class PhabricatorPolicy { public function renderDescription() { if ($this->getHref()) { - $desc = phutil_render_tag( + $desc = phutil_tag( 'a', array( 'href' => $this->getHref(), ), - phutil_escape_html($this->getName())); + $this->getName()); } else { $desc = phutil_escape_html($this->getName()); } diff --git a/src/applications/ponder/view/PonderQuestionSummaryView.php b/src/applications/ponder/view/PonderQuestionSummaryView.php index cc03d6d138..a06cdcc46d 100644 --- a/src/applications/ponder/view/PonderQuestionSummaryView.php +++ b/src/applications/ponder/view/PonderQuestionSummaryView.php @@ -48,15 +48,13 @@ final class PonderQuestionSummaryView extends AphrontView { $title = '

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

    '; diff --git a/src/applications/project/controller/PhabricatorProjectListController.php b/src/applications/project/controller/PhabricatorProjectListController.php index ca215fdf19..869a7c2404 100644 --- a/src/applications/project/controller/PhabricatorProjectListController.php +++ b/src/applications/project/controller/PhabricatorProjectListController.php @@ -100,22 +100,22 @@ final class PhabricatorProjectListController $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/project/view/'.$project->getID().'/', ), - phutil_escape_html($project->getName())), + $project->getName()), phutil_escape_html( PhabricatorProjectStatus::getNameForStatus($project->getStatus())), phutil_escape_html($blurb), phutil_escape_html($population), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/view/all/?projects='.$phid, ), - phutil_escape_html($task_count)), + $task_count), ); } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php index 692636405f..0ade8c291a 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php @@ -160,12 +160,12 @@ final class PhabricatorSettingsPanelProfile id(new AphrontFormMarkupControl()) ->setLabel('Profile URI') ->setValue( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $profile_uri, ), - phutil_escape_html($profile_uri)))) + $profile_uri))) ->appendChild( '

    Write something about yourself! '. 'Make sure to include important information like '. diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php index 7bf018a2b5..0c33b30f0f 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php @@ -176,12 +176,12 @@ final class PhabricatorSettingsPanelSSHKeys $rows = array(); foreach ($keys as $key) { $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->getPanelURI('?edit='.$key->getID()), ), - phutil_escape_html($key->getName())), + $key->getName()), phutil_escape_html($key->getKeyComment()), phutil_escape_html($key->getKeyType()), phabricator_date($key->getDateCreated(), $user), diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php index 21ea6948be..19f16e9332 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteListController.php @@ -46,12 +46,12 @@ final class PhabricatorSlowvoteListController foreach ($polls as $poll) { $rows[] = array( 'V'.$poll->getID(), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/V'.$poll->getID(), ), - phutil_escape_html($poll->getQuestion())), + $poll->getQuestion()), $handles[$poll->getAuthorPHID()]->renderLink(), phabricator_date($poll->getDateCreated(), $user), phabricator_time($poll->getDateCreated(), $user), diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php index 4331bc27aa..04c4e2e566 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -115,12 +115,12 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { $preview = id(new PhabricatorTimelineView()) ->setID($this->getPreviewTimelineID()); - $header = phutil_render_tag( + $header = phutil_tag( 'div', array( 'class' => 'phabricator-timeline-preview-header', ), - phutil_escape_html(pht('Preview'))); + pht('Preview')); return phutil_render_tag( 'div', diff --git a/src/applications/uiexample/examples/PhabricatorBarePageExample.php b/src/applications/uiexample/examples/PhabricatorBarePageExample.php index 5a3bf279c4..15aeb681ba 100644 --- a/src/applications/uiexample/examples/PhabricatorBarePageExample.php +++ b/src/applications/uiexample/examples/PhabricatorBarePageExample.php @@ -13,10 +13,10 @@ final class PhabricatorBarePageExample extends PhabricatorUIExample { public function renderExample() { $view = new PhabricatorBarePageView(); $view->appendChild( - phutil_render_tag( + phutil_tag( 'h1', array(), - phutil_escape_html($this->getDescription()))); + $this->getDescription())); $response = new AphrontWebpageResponse(); $response->setContent($view->render()); diff --git a/src/applications/uiexample/examples/PhabricatorButtonsExample.php b/src/applications/uiexample/examples/PhabricatorButtonsExample.php index 0553a4b59f..d234bc2308 100644 --- a/src/applications/uiexample/examples/PhabricatorButtonsExample.php +++ b/src/applications/uiexample/examples/PhabricatorButtonsExample.php @@ -28,12 +28,12 @@ final class PhabricatorButtonsExample extends PhabricatorUIExample { $class .= ' button'; } - $view[] = phutil_render_tag( + $view[] = phutil_tag( $tag, array( 'class' => $class, ), - phutil_escape_html(ucwords($size.' '.$color.' '.$tag))); + ucwords($size.' '.$color.' '.$tag)); $view[] = '

    '; } diff --git a/src/applications/xhprof/view/PhabricatorXHProfProfileView.php b/src/applications/xhprof/view/PhabricatorXHProfProfileView.php index f4df87a422..fd06a49fdc 100644 --- a/src/applications/xhprof/view/PhabricatorXHProfProfileView.php +++ b/src/applications/xhprof/view/PhabricatorXHProfProfileView.php @@ -16,13 +16,13 @@ abstract class PhabricatorXHProfProfileView extends AphrontView { } protected function renderSymbolLink($symbol) { - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $this->baseURI.'?symbol='.$symbol, 'target' => $this->isFramed ? '_top' : null, ), - phutil_escape_html($symbol)); + $symbol); } } diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php index 1591d0b62b..f68d05fb64 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMention.php @@ -95,7 +95,7 @@ final class PhabricatorRemarkupRuleMention } if ($exists) { - $tag = phutil_render_tag( + $tag = phutil_tag( 'a', array( 'class' => $class, @@ -103,7 +103,7 @@ final class PhabricatorRemarkupRuleMention 'target' => '_blank', 'title' => $actual_users[$username]['realName'], ), - phutil_escape_html('@'.$actual_users[$username]['username'])); + '@'.$actual_users[$username]['username']); foreach ($tokens as $token) { $engine->overwriteStoredText($token, $tag); } @@ -112,12 +112,12 @@ final class PhabricatorRemarkupRuleMention // because we want to preserve the original text capitalization and it // may differ for each token. foreach ($tokens as $token) { - $tag = phutil_render_tag( + $tag = phutil_tag( 'span', array( 'class' => $class, ), - phutil_escape_html('@'.idx($original, $token, $username))); + '@'.idx($original, $token, $username)); $engine->overwriteStoredText($token, $tag); } } diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php index 04a10bed91..410d507b47 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRulePhriction.php @@ -30,13 +30,13 @@ final class PhabricatorRemarkupRulePhriction if ($this->getEngine()->getState('toc')) { $text = phutil_escape_html($name); } else { - $text = phutil_render_tag( + $text = phutil_tag( 'a', array( 'href' => $href, 'class' => 'phriction-link', ), - phutil_escape_html($name)); + $name); } return $this->getEngine()->storeText($text); diff --git a/src/view/control/AphrontAttachedFileView.php b/src/view/control/AphrontAttachedFileView.php index 499162ba63..a728515387 100644 --- a/src/view/control/AphrontAttachedFileView.php +++ b/src/view/control/AphrontAttachedFileView.php @@ -23,13 +23,13 @@ final class AphrontAttachedFileView extends AphrontView { 'height' => 45, )); - $name = phutil_render_tag( + $name = phutil_tag( 'a', array( 'href' => $file->getViewURI(), 'target' => '_blank', ), - phutil_escape_html($file->getName())); + $file->getName()); $size = number_format($file->getByteSize()).' bytes'; $remove = javelin_render_tag( diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index b5f4f826a4..c3bffde73f 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -210,12 +210,12 @@ final class AphrontTableView extends AphrontView { 'class' => 'aphront-table-view-nodevice', ), $header); - $header_device = phutil_render_tag( + $header_device = phutil_tag( 'span', array( 'class' => 'aphront-table-view-device', ), - phutil_escape_html($short_headers[$col_num])); + $short_headers[$col_num]); $header = $header_nodevice.$header_device; } diff --git a/src/view/form/AphrontErrorView.php b/src/view/form/AphrontErrorView.php index 632561ddec..d3dc20a0a3 100644 --- a/src/view/form/AphrontErrorView.php +++ b/src/view/form/AphrontErrorView.php @@ -40,10 +40,10 @@ final class AphrontErrorView extends AphrontView { if ($errors) { $list = array(); foreach ($errors as $error) { - $list[] = phutil_render_tag( + $list[] = phutil_tag( 'li', array(), - phutil_escape_html($error)); + $error); } $list = phutil_render_tag( 'ul', @@ -57,12 +57,12 @@ final class AphrontErrorView extends AphrontView { $title = $this->title; if (strlen($title)) { - $title = phutil_render_tag( + $title = phutil_tag( 'h1', array( 'class' => 'aphront-error-view-head', ), - phutil_escape_html($title)); + $title); } else { $title = null; } diff --git a/src/view/form/control/AphrontFormCheckboxControl.php b/src/view/form/control/AphrontFormCheckboxControl.php index d2d05e77a3..00a85f52a9 100644 --- a/src/view/form/control/AphrontFormCheckboxControl.php +++ b/src/view/form/control/AphrontFormCheckboxControl.php @@ -32,12 +32,12 @@ final class AphrontFormCheckboxControl extends AphrontFormControl { 'checked' => $box['checked'] ? 'checked' : null, 'disabled' => $this->getDisabled() ? 'disabled' : null, )); - $label = phutil_render_tag( + $label = phutil_tag( 'label', array( 'for' => $id, ), - phutil_escape_html($box['label'])); + $box['label']); $rows[] = ''. ''.$checkbox.''. diff --git a/src/view/form/control/AphrontFormRadioButtonControl.php b/src/view/form/control/AphrontFormRadioButtonControl.php index e15dd03c8d..6d6547c8b6 100644 --- a/src/view/form/control/AphrontFormRadioButtonControl.php +++ b/src/view/form/control/AphrontFormRadioButtonControl.php @@ -34,13 +34,13 @@ final class AphrontFormRadioButtonControl extends AphrontFormControl { : null, 'disabled' => $this->getDisabled() ? 'disabled' : null, )); - $label = phutil_render_tag( + $label = phutil_tag( 'label', array( 'for' => $id, 'class' => $button['class'], ), - phutil_escape_html($button['label'])); + $button['label']); if (strlen($button['caption'])) { $label .= diff --git a/src/view/form/control/AphrontFormSelectControl.php b/src/view/form/control/AphrontFormSelectControl.php index 419d8ea352..bc01e742b3 100644 --- a/src/view/form/control/AphrontFormSelectControl.php +++ b/src/view/form/control/AphrontFormSelectControl.php @@ -52,13 +52,13 @@ final class AphrontFormSelectControl extends AphrontFormControl { ), implode("\n", self::renderOptions($selected, $thing))); } else { - $tags[] = phutil_render_tag( + $tags[] = phutil_tag( 'option', array( 'selected' => ($value == $selected) ? 'selected' : null, 'value' => $value, ), - phutil_escape_html($thing)); + $thing); } } return $tags; diff --git a/src/view/form/control/AphrontFormSubmitControl.php b/src/view/form/control/AphrontFormSubmitControl.php index 9ec7593dcd..c2ccb915e5 100644 --- a/src/view/form/control/AphrontFormSubmitControl.php +++ b/src/view/form/control/AphrontFormSubmitControl.php @@ -5,13 +5,13 @@ final class AphrontFormSubmitControl extends AphrontFormControl { protected $cancelButton; public function addCancelButton($href, $label = 'Cancel') { - $this->cancelButton = phutil_render_tag( + $this->cancelButton = phutil_tag( 'a', array( 'href' => $href, 'class' => 'button grey', ), - phutil_escape_html($label)); + $label); return $this; } @@ -22,13 +22,13 @@ final class AphrontFormSubmitControl extends AphrontFormControl { protected function renderInput() { $submit_button = null; if ($this->getValue()) { - $submit_button = phutil_render_tag( + $submit_button = phutil_tag( 'button', array( 'name' => '__submit__', 'disabled' => $this->getDisabled() ? 'disabled' : null, ), - phutil_escape_html($this->getValue())); + $this->getValue()); } return $submit_button.$this->cancelButton; } diff --git a/src/view/form/control/AphrontFormTextAreaControl.php b/src/view/form/control/AphrontFormTextAreaControl.php index 921d8caef3..311beaea8e 100644 --- a/src/view/form/control/AphrontFormTextAreaControl.php +++ b/src/view/form/control/AphrontFormTextAreaControl.php @@ -61,7 +61,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl { $classes[] = $this->customClass; $classes = trim(implode(' ', $classes)); - return phutil_render_tag( + return phutil_tag( 'textarea', array( 'name' => $this->getName(), @@ -72,7 +72,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl { 'id' => $this->getID(), 'placeholder' => $this->getPlaceHolder(), ), - phutil_escape_html($this->getValue())); + $this->getValue()); } } diff --git a/src/view/form/control/AphrontFormToggleButtonsControl.php b/src/view/form/control/AphrontFormToggleButtonsControl.php index f4ec32bacd..43f83ed1b9 100644 --- a/src/view/form/control/AphrontFormToggleButtonsControl.php +++ b/src/view/form/control/AphrontFormToggleButtonsControl.php @@ -37,13 +37,13 @@ final class AphrontFormToggleButtonsControl extends AphrontFormControl { $more = null; } - $out[] = phutil_render_tag( + $out[] = phutil_tag( 'a', array( 'class' => 'toggle'.$more, 'href' => $this->baseURI->alter($this->param, $value), ), - phutil_escape_html($label)); + $label); } return implode('', $out); diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index c148cc380d..30bbd218f2 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -92,12 +92,12 @@ final class PhabricatorActionView extends AphrontView { phutil_escape_html($this->name)); } } else { - $item = phutil_render_tag( + $item = phutil_tag( 'span', array( 'class' => 'phabricator-action-view-item', ), - phutil_escape_html($this->name)); + $this->name); } $classes = array(); diff --git a/src/view/layout/PhabricatorHeaderView.php b/src/view/layout/PhabricatorHeaderView.php index 97d26bd6b9..8d2d7a911b 100644 --- a/src/view/layout/PhabricatorHeaderView.php +++ b/src/view/layout/PhabricatorHeaderView.php @@ -27,12 +27,12 @@ final class PhabricatorHeaderView extends AphrontView { $header = phutil_escape_html($this->header); if ($this->objectName) { - $header = phutil_render_tag( + $header = phutil_tag( 'a', array( 'href' => '/'.$this->objectName, ), - phutil_escape_html($this->objectName)).' '.$header; + $this->objectName).' '.$header; } if ($this->tags) { diff --git a/src/view/layout/PhabricatorMenuItemView.php b/src/view/layout/PhabricatorMenuItemView.php index 69f4d1db76..768ee2a709 100644 --- a/src/view/layout/PhabricatorMenuItemView.php +++ b/src/view/layout/PhabricatorMenuItemView.php @@ -117,12 +117,12 @@ final class PhabricatorMenuItemView extends AphrontTagView { if ($this->isExternal) { $external = " \xE2\x86\x97"; } - $name = phutil_render_tag( + $name = phutil_tag( 'span', array( 'class' => 'phabricator-menu-item-name', ), - phutil_escape_html($this->name.$external)); + $this->name.$external); } return $this->renderChildren().$name; diff --git a/src/view/layout/PhabricatorObjectItemListView.php b/src/view/layout/PhabricatorObjectItemListView.php index 8b5f933d7a..a145b7ba43 100644 --- a/src/view/layout/PhabricatorObjectItemListView.php +++ b/src/view/layout/PhabricatorObjectItemListView.php @@ -32,12 +32,12 @@ final class PhabricatorObjectItemListView extends AphrontView { $header = null; if (strlen($this->header)) { - $header = phutil_render_tag( + $header = phutil_tag( 'h1', array( 'class' => 'phabricator-object-item-list-header', ), - phutil_escape_html($this->header)); + $this->header); } if ($this->items) { diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index ae40e59117..6161073f84 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -71,13 +71,13 @@ final class PhabricatorObjectItemView extends AphrontView { } public function render() { - $header = phutil_render_tag( + $header = phutil_tag( 'a', array( 'href' => $this->href, 'class' => 'phabricator-object-item-name', ), - phutil_escape_html($this->header)); + $this->header); $icons = null; if ($this->icons) { @@ -93,12 +93,12 @@ final class PhabricatorObjectItemView extends AphrontView { ), ''); - $label = phutil_render_tag( + $label = phutil_tag( 'span', array( 'class' => 'phabricator-object-item-icon-label', ), - phutil_escape_html($spec['label'])); + $spec['label']); $icon_list[] = phutil_render_tag( 'li', diff --git a/src/view/layout/PhabricatorPropertyListView.php b/src/view/layout/PhabricatorPropertyListView.php index 8110791673..4fb140b04b 100644 --- a/src/view/layout/PhabricatorPropertyListView.php +++ b/src/view/layout/PhabricatorPropertyListView.php @@ -87,12 +87,12 @@ final class PhabricatorPropertyListView extends AphrontView { $key = $spec['key']; $value = $spec['value']; - $items[] = phutil_render_tag( + $items[] = phutil_tag( 'dt', array( 'class' => 'phabricator-property-list-key', ), - phutil_escape_html($key)); + $key); $items[] = phutil_render_tag( 'dd', array( @@ -137,12 +137,12 @@ final class PhabricatorPropertyListView extends AphrontView { } private function renderSectionPart(array $part) { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-property-list-section-header', ), - phutil_escape_html($part['name'])); + $part['name']); } private function renderTextPart(array $part) { diff --git a/src/view/layout/PhabricatorTransactionView.php b/src/view/layout/PhabricatorTransactionView.php index 4e6ab0d4ca..64e5bf54d1 100644 --- a/src/view/layout/PhabricatorTransactionView.php +++ b/src/view/layout/PhabricatorTransactionView.php @@ -105,12 +105,12 @@ final class PhabricatorTransactionView extends AphrontView { ->setAnchorName($this->anchorName) ->render(); - $info[] = $anchor.phutil_render_tag( + $info[] = $anchor.phutil_tag( 'a', array( 'href' => '#'.$this->anchorName, ), - phutil_escape_html($this->anchorText)); + $this->anchorText); } $info = implode(' · ', $info); diff --git a/src/view/layout/headsup/AphrontHeadsupView.php b/src/view/layout/headsup/AphrontHeadsupView.php index ba6fa8c827..9e3b8f0896 100644 --- a/src/view/layout/headsup/AphrontHeadsupView.php +++ b/src/view/layout/headsup/AphrontHeadsupView.php @@ -30,13 +30,13 @@ final class AphrontHeadsupView extends AphrontView { public function render() { $header = '

    '. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/'.$this->objectName, 'class' => 'aphront-headsup-object-name', ), - phutil_escape_html($this->objectName)). + $this->objectName). ' '. phutil_escape_html($this->header). '

    '; diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index f3c3596719..588467aca6 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -303,13 +303,13 @@ final class PhabricatorMainMenuView extends AphrontView { $count_number = "\xE2\x88\x9E"; } - $count_tag = phutil_render_tag( + $count_tag = phutil_tag( 'span', array( 'id' => $count_id, 'class' => 'phabricator-main-menu-alert-count' ), - phutil_escape_html($count_number)); + $count_number); $icon_tag = phutil_render_tag( 'span', -- 2.51.2 From 20768d65d5660c7fdc8c14dc7245339915feada8 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 17 Jan 2013 18:57:09 -0800 Subject: [PATCH 03/50] Convert phutil_render_tag(X, Y, '...') to phutil_tag Summary: Created with spatch: lang=diff - phutil_render_tag + phutil_tag (X, Y, '...') Then searched for `&` and `<` in the output and replaced them. Test Plan: Loaded homepage. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4503 --- .../console/plugin/DarkConsoleServicesPlugin.php | 2 +- .../console/plugin/DarkConsoleXHProfPlugin.php | 4 ++-- .../PhabricatorMustVerifyEmailController.php | 2 +- .../calendar/view/AphrontCalendarMonthView.php | 8 ++++---- .../PhabricatorCountdownListController.php | 2 +- .../PhabricatorDaemonConsoleController.php | 2 +- .../daemon/view/PhabricatorDaemonLogListView.php | 2 +- .../DifferentialDiffCreateController.php | 2 +- .../DifferentialRevisionViewController.php | 2 +- ...DifferentialChangesetFileTreeSideNavBuilder.php | 2 +- .../view/DifferentialDiffTableOfContentsView.php | 2 +- .../view/DifferentialInlineCommentEditView.php | 2 +- .../view/DifferentialInlineCommentView.php | 2 +- .../controller/DiffusionCommitTagsController.php | 2 +- .../diffusion/controller/DiffusionController.php | 2 +- .../controller/DiffusionHomeController.php | 2 +- .../controller/DiffusionRepositoryController.php | 6 +++--- .../diffusion/view/DiffusionBranchTableView.php | 2 +- .../diffusion/view/DiffusionBrowseTableView.php | 2 +- src/applications/diffusion/view/DiffusionView.php | 2 +- .../PhabricatorDirectoryMainController.php | 14 +++++++------- .../controller/PhabricatorFactChartController.php | 2 +- .../controller/PhabricatorFileUploadController.php | 2 +- .../flag/view/PhabricatorFlagListView.php | 6 +++--- .../herald/controller/HeraldHomeController.php | 2 +- .../controller/HeraldTranscriptListController.php | 2 +- .../herald/view/HeraldRuleListView.php | 2 +- .../PhabricatorMailingListsListController.php | 2 +- .../controller/ManiphestReportController.php | 10 +++++----- .../ManiphestSavedQueryListController.php | 4 ++-- .../controller/ManiphestTaskDetailController.php | 6 +++--- .../controller/ManiphestTaskListController.php | 4 ++-- .../meta/view/PhabricatorApplicationLaunchView.php | 2 +- .../PhabricatorMetaMTAListController.php | 2 +- .../PhabricatorMetaMTASendController.php | 4 ++-- .../PhabricatorNotificationPanelController.php | 2 +- .../PhabricatorOAuthClientEditController.php | 2 +- .../PhabricatorOAuthClientListController.php | 2 +- .../PhabricatorOAuthClientViewController.php | 2 +- ...catorOAuthClientAuthorizationEditController.php | 2 +- ...catorOAuthClientAuthorizationListController.php | 2 +- .../PhabricatorOwnersDetailController.php | 6 +++--- .../controller/PhabricatorPasteEditController.php | 2 +- .../application/PhabricatorApplicationPeople.php | 2 +- .../PhabricatorEmailVerificationController.php | 4 ++-- .../controller/PhabricatorPeopleEditController.php | 2 +- .../controller/PhabricatorPeopleLdapController.php | 6 +++--- .../controller/PhabricatorPeopleListController.php | 6 +++--- .../controller/post/PhamePostPublishController.php | 2 +- src/applications/phame/view/PhamePostView.php | 4 ++-- .../controller/PhrictionDiffController.php | 8 ++++---- .../controller/PhrictionDocumentController.php | 4 ++-- .../controller/PhrictionEditController.php | 4 ++-- .../controller/PhrictionHistoryController.php | 4 ++-- .../PhabricatorProjectMembersEditController.php | 2 +- .../PhabricatorProjectProfileController.php | 4 ++-- .../controller/PhabricatorRepositoryController.php | 2 +- .../PhabricatorRepositoryEditController.php | 2 +- .../PhabricatorRepositoryListController.php | 6 +++--- .../search/view/PhabricatorSearchResultView.php | 2 +- .../PhabricatorSettingsPanelDisplayPreferences.php | 2 +- .../PhabricatorSettingsPanelEmailAddresses.php | 2 +- .../panel/PhabricatorSettingsPanelSSHKeys.php | 2 +- ...habricatorApplicationTransactionCommentView.php | 2 +- .../view/PhabricatorXHProfProfileTopLevelView.php | 2 +- .../celerity/CelerityStaticResourceResponse.php | 2 +- .../diff/view/PhabricatorInlineSummaryView.php | 2 +- .../markup/rule/PhabricatorRemarkupRuleYoutube.php | 2 +- src/view/control/AphrontCursorPagerView.php | 6 +++--- src/view/control/AphrontTableView.php | 2 +- src/view/form/control/AphrontFormDateControl.php | 2 +- .../AphrontFormDragAndDropUploadControl.php | 2 +- src/view/form/control/AphrontFormImageControl.php | 2 +- .../form/control/PhabricatorRemarkupControl.php | 4 ++-- src/view/layout/AphrontSideNavFilterView.php | 4 ++-- src/view/layout/PhabricatorActionView.php | 2 +- src/view/layout/PhabricatorAnchorView.php | 2 +- src/view/layout/PhabricatorCrumbView.php | 4 ++-- src/view/layout/PhabricatorCrumbsView.php | 2 +- src/view/layout/PhabricatorObjectItemView.php | 6 +++--- src/view/layout/PhabricatorProfileHeaderView.php | 2 +- src/view/layout/PhabricatorTagView.php | 4 ++-- src/view/layout/PhabricatorTimelineEventView.php | 6 +++--- src/view/layout/PhabricatorTimelineView.php | 2 +- src/view/page/PhabricatorStandardPageView.php | 2 +- src/view/page/menu/PhabricatorMainMenuView.php | 10 +++++----- 86 files changed, 140 insertions(+), 140 deletions(-) diff --git a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php index 757c1e7049..442ca9db4c 100644 --- a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php @@ -146,7 +146,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $results[] = '
    '. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->getRequestURI()->alter('__analyze__', true), diff --git a/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php b/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php index 299566e863..9368cb7e66 100644 --- a/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php @@ -32,7 +32,7 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { public function render() { if (!DarkConsoleXHProfPluginAPI::isProfilerAvailable()) { $href = PhabricatorEnv::getDoclink('article/Installation_Guide.html'); - $install_guide = phutil_render_tag( + $install_guide = phutil_tag( 'a', array( 'href' => $href, @@ -53,7 +53,7 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { $header = '
    '. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->getRequestURI()->alter('__profile__', 'page'), diff --git a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php index 319163112d..58655c2e8b 100644 --- a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php +++ b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php @@ -53,7 +53,7 @@ final class PhabricatorMustVerifyEmailController 'action' => '/login/mustverify/', 'method' => 'POST', ), - phutil_render_tag( + phutil_tag( 'button', array( ), diff --git a/src/applications/calendar/view/AphrontCalendarMonthView.php b/src/applications/calendar/view/AphrontCalendarMonthView.php index fa7d119d1f..5d175e7594 100644 --- a/src/applications/calendar/view/AphrontCalendarMonthView.php +++ b/src/applications/calendar/view/AphrontCalendarMonthView.php @@ -159,18 +159,18 @@ final class AphrontCalendarMonthView extends AphrontView { $uri = new PhutilURI($uri); list($prev_year, $prev_month) = $this->getPrevYearAndMonth(); $query = array('year' => $prev_year, 'month' => $prev_month); - $prev_link = phutil_render_tag( + $prev_link = phutil_tag( 'a', array('href' => (string) $uri->setQueryParams($query)), - '←' + "\xE2\x86\x90" ); list($next_year, $next_month) = $this->getNextYearAndMonth(); $query = array('year' => $next_year, 'month' => $next_month); - $next_link = phutil_render_tag( + $next_link = phutil_tag( 'a', array('href' => (string) $uri->setQueryParams($query)), - '→' + "\xE2\x86\x92" ); $left_th = ''.$prev_link.''; diff --git a/src/applications/countdown/controller/PhabricatorCountdownListController.php b/src/applications/countdown/controller/PhabricatorCountdownListController.php index 47cc610c6d..b015eb602f 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownListController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownListController.php @@ -28,7 +28,7 @@ final class PhabricatorCountdownListController $delete_button = null; if ($user->getIsAdmin() || ($user->getPHID() == $timer->getAuthorPHID())) { - $edit_button = phutil_render_tag( + $edit_button = phutil_tag( 'a', array( 'class' => 'small button grey', diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php index da5e439979..26059e4ce2 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -81,7 +81,7 @@ final class PhabricatorDaemonConsoleController $task->getLeaseOwner(), $task->getLeaseExpires() - time(), $task->getFailureCount(), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/daemon/task/'.$task->getID().'/', diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php index c3f856d2ca..35f234733a 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php @@ -81,7 +81,7 @@ final class PhabricatorDaemonLogListView extends AphrontView { $log->getPID(), phabricator_date($epoch, $this->user), phabricator_time($epoch, $this->user), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/daemon/log/'.$log->getID().'/', diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php index 76fc629dbd..054e69cb90 100644 --- a/src/applications/differential/controller/DifferentialDiffCreateController.php +++ b/src/applications/differential/controller/DifferentialDiffCreateController.php @@ -30,7 +30,7 @@ final class DifferentialDiffCreateController extends DifferentialController { $form = new AphrontFormView(); $arcanist_href = PhabricatorEnv::getDoclink( 'article/Arcanist_User_Guide.html'); - $arcanist_link = phutil_render_tag( + $arcanist_link = phutil_tag( 'a', array( 'href' => $arcanist_href, diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 9cbead02b4..7f6d6057c3 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -184,7 +184,7 @@ final class DifferentialRevisionViewController extends DifferentialController { '

    '.pht('This diff is very large and affects %d files. Load '. 'each file individually. ', $count). "". - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $request_uri diff --git a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php index dfa474be67..1d5be8e265 100644 --- a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php +++ b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php @@ -90,7 +90,7 @@ final class DifferentialChangesetFileTreeSideNavBuilder { $icon = 'phabricator-filetree-icon-dir'; } - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => 'phabricator-filetree-icon '.$icon, diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index 6d622954aa..2c5d5058af 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -182,7 +182,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { $this->repository->getCallsign()); if ($editor_link) { $editor_link = - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $editor_link, diff --git a/src/applications/differential/view/DifferentialInlineCommentEditView.php b/src/applications/differential/view/DifferentialInlineCommentEditView.php index e60b198a0f..86a2706ce6 100644 --- a/src/applications/differential/view/DifferentialInlineCommentEditView.php +++ b/src/applications/differential/view/DifferentialInlineCommentEditView.php @@ -104,7 +104,7 @@ final class DifferentialInlineCommentEditView extends AphrontView { $buttons = implode('', $buttons); - $formatting = phutil_render_tag( + $formatting = phutil_tag( 'a', array( 'href' => PhabricatorEnv::getDoclink( diff --git a/src/applications/differential/view/DifferentialInlineCommentView.php b/src/applications/differential/view/DifferentialInlineCommentView.php index 015f89e4f5..09ac5a906b 100644 --- a/src/applications/differential/view/DifferentialInlineCommentView.php +++ b/src/applications/differential/view/DifferentialInlineCommentView.php @@ -190,7 +190,7 @@ final class DifferentialInlineCommentView extends AphrontView { if ($this->preview) { $anchor = null; } else { - $anchor = phutil_render_tag( + $anchor = phutil_tag( 'a', array( 'name' => $anchor_name, diff --git a/src/applications/diffusion/controller/DiffusionCommitTagsController.php b/src/applications/diffusion/controller/DiffusionCommitTagsController.php index 5dbabff240..7bb6091296 100644 --- a/src/applications/diffusion/controller/DiffusionCommitTagsController.php +++ b/src/applications/diffusion/controller/DiffusionCommitTagsController.php @@ -32,7 +32,7 @@ final class DiffusionCommitTagsController extends DiffusionController { } if ($has_more_tags) { - $tag_links[] = phutil_render_tag( + $tag_links[] = phutil_tag( 'a', array( 'href' => $request->generateURI( diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index ea11c4831b..14b734f43d 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -299,7 +299,7 @@ abstract class DiffusionController extends PhabricatorController { $last_crumb = array_pop($crumb_list); if ($raw_commit) { - $jump_link = phutil_render_tag( + $jump_link = phutil_tag( 'a', array( 'href' => $drequest->generateURI( diff --git a/src/applications/diffusion/controller/DiffusionHomeController.php b/src/applications/diffusion/controller/DiffusionHomeController.php index c951b764a8..d06f0d9863 100644 --- a/src/applications/diffusion/controller/DiffusionHomeController.php +++ b/src/applications/diffusion/controller/DiffusionHomeController.php @@ -146,7 +146,7 @@ final class DiffusionHomeController extends DiffusionController { } $repository_tool_uri = PhabricatorEnv::getProductionURI('/repository/'); - $repository_tool = phutil_render_tag('a', + $repository_tool = phutil_tag('a', array( 'href' => $repository_tool_uri, ), diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php index 5af0a056ba..714b2819c1 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php @@ -60,7 +60,7 @@ final class DiffusionRepositoryController extends DiffusionController { $history_table->setIsHead(true); $callsign = $drequest->getRepository()->getCallsign(); - $all = phutil_render_tag( + $all = phutil_tag( 'a', array( 'href' => "/diffusion/{$callsign}/history/", @@ -182,7 +182,7 @@ final class DiffusionRepositoryController extends DiffusionController { } $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $drequest->generateURI( @@ -240,7 +240,7 @@ final class DiffusionRepositoryController extends DiffusionController { } $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $drequest->generateURI( diff --git a/src/applications/diffusion/view/DiffusionBranchTableView.php b/src/applications/diffusion/view/DiffusionBranchTableView.php index 4ac40d73ca..2d59c04946 100644 --- a/src/applications/diffusion/view/DiffusionBranchTableView.php +++ b/src/applications/diffusion/view/DiffusionBranchTableView.php @@ -36,7 +36,7 @@ final class DiffusionBranchTableView extends DiffusionView { } $rows[] = array( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $drequest->generateURI( diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index fdf1651474..2aed5dbdd3 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -204,7 +204,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $request->getRepository()->getCallsign()); if ($editor_link) { $show_edit = true; - $editor_button = phutil_render_tag( + $editor_button = phutil_tag( 'a', array( 'href' => $editor_link, diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index afa52d9d36..df5f139307 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -47,7 +47,7 @@ abstract class DiffusionView extends AphrontView { 'path' => $path, )); - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $href, diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 841f38de61..0302df17ec 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -109,7 +109,7 @@ final class PhabricatorDirectoryMainController $panel->setHeader('Unbreak Now!'); $panel->setCaption('Open tasks with "Unbreak Now!" priority.'); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/view/all/', @@ -154,7 +154,7 @@ final class PhabricatorDirectoryMainController 'projects you are a member of.'); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( // TODO: This should filter to just your projects' need-triage @@ -198,7 +198,7 @@ final class PhabricatorDirectoryMainController $panel->setCaption('Revisions waiting for you for review or commit.'); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/differential/', @@ -248,7 +248,7 @@ final class PhabricatorDirectoryMainController $panel->setHeader('Assigned Tasks'); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/', @@ -294,7 +294,7 @@ final class PhabricatorDirectoryMainController require_celerity_resource('phabricator-jump-nav'); $doc_href = PhabricatorEnv::getDocLink('article/Jump_Nav_User_Guide.html'); - $doc_link = phutil_render_tag( + $doc_link = phutil_tag( 'a', array( 'href' => $doc_href, @@ -381,7 +381,7 @@ final class PhabricatorDirectoryMainController $panel->setCaption('Commits awaiting your audit.'); $panel->appendChild($view); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/audit/', @@ -426,7 +426,7 @@ final class PhabricatorDirectoryMainController $panel->setCaption('Commits which auditors have raised concerns about.'); $panel->appendChild($view); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/audit/', diff --git a/src/applications/fact/controller/PhabricatorFactChartController.php b/src/applications/fact/controller/PhabricatorFactChartController.php index 876866448f..12e52fdaa9 100644 --- a/src/applications/fact/controller/PhabricatorFactChartController.php +++ b/src/applications/fact/controller/PhabricatorFactChartController.php @@ -53,7 +53,7 @@ final class PhabricatorFactChartController extends PhabricatorFactController { $y = array_values($points); $id = celerity_generate_unique_node_id(); - $chart = phutil_render_tag( + $chart = phutil_tag( 'div', array( 'id' => $id, diff --git a/src/applications/files/controller/PhabricatorFileUploadController.php b/src/applications/files/controller/PhabricatorFileUploadController.php index 2c8ce155b9..74c5455e84 100644 --- a/src/applications/files/controller/PhabricatorFileUploadController.php +++ b/src/applications/files/controller/PhabricatorFileUploadController.php @@ -104,7 +104,7 @@ final class PhabricatorFileUploadController extends PhabricatorFileController { $doc_href = PhabricatorEnv::getDocLink( 'article/Configuring_File_Upload_Limits.html'); - $doc_link = phutil_render_tag( + $doc_link = phutil_tag( 'a', array( 'href' => $doc_href, diff --git a/src/applications/flag/view/PhabricatorFlagListView.php b/src/applications/flag/view/PhabricatorFlagListView.php index a1f86d5ffe..332f683418 100644 --- a/src/applications/flag/view/PhabricatorFlagListView.php +++ b/src/applications/flag/view/PhabricatorFlagListView.php @@ -20,7 +20,7 @@ final class PhabricatorFlagListView extends AphrontView { $class = PhabricatorFlagColor::getCSSClass($flag->getColor()); $rows[] = array( - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'phabricator-flag-icon '.$class, @@ -36,7 +36,7 @@ final class PhabricatorFlagListView extends AphrontView { 'action' => '/flag/edit/'.$flag->getObjectPHID().'/', 'sigil' => 'workflow', ), - phutil_render_tag( + phutil_tag( 'button', array( 'class' => 'small grey', @@ -49,7 +49,7 @@ final class PhabricatorFlagListView extends AphrontView { 'action' => '/flag/delete/'.$flag->getID().'/', 'sigil' => 'workflow', ), - phutil_render_tag( + phutil_tag( 'button', array( 'class' => 'small grey', diff --git a/src/applications/herald/controller/HeraldHomeController.php b/src/applications/herald/controller/HeraldHomeController.php index 16df2de2c2..c058881e31 100644 --- a/src/applications/herald/controller/HeraldHomeController.php +++ b/src/applications/herald/controller/HeraldHomeController.php @@ -98,7 +98,7 @@ final class HeraldHomeController extends HeraldController { if ($can_create) { $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/herald/new/'.$this->contentType.'/'.$this->ruleType.'/', diff --git a/src/applications/herald/controller/HeraldTranscriptListController.php b/src/applications/herald/controller/HeraldTranscriptListController.php index 256aa7588c..c4d131fb80 100644 --- a/src/applications/herald/controller/HeraldTranscriptListController.php +++ b/src/applications/herald/controller/HeraldTranscriptListController.php @@ -58,7 +58,7 @@ final class HeraldTranscriptListController extends HeraldController { $handles[$xscript['objectPHID']]->renderLink(), $xscript['dryRun'] ? 'Yes' : '', number_format((int)(1000 * $xscript['duration'])).' ms', - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/herald/transcript/'.$xscript['id'].'/', diff --git a/src/applications/herald/view/HeraldRuleListView.php b/src/applications/herald/view/HeraldRuleListView.php index 2bfe609bdf..18aa093b61 100644 --- a/src/applications/herald/view/HeraldRuleListView.php +++ b/src/applications/herald/view/HeraldRuleListView.php @@ -51,7 +51,7 @@ final class HeraldRuleListView extends AphrontView { ), $rule->getName()); - $edit_log = phutil_render_tag( + $edit_log = phutil_tag( 'a', array( 'href' => '/herald/history/'.$rule->getID().'/', diff --git a/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php b/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php index 74f4d75e66..c675d4b30b 100644 --- a/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php +++ b/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php @@ -33,7 +33,7 @@ final class PhabricatorMailingListsListController $rows[] = array( phutil_escape_html($list->getName()), phutil_escape_html($list->getEmail()), - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'button grey small', diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index cee45c4c20..cd77f4da3e 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -271,7 +271,7 @@ final class ManiphestReportController extends ManiphestController { $filter = $this->renderReportFilters($tokens, $has_window = false); $id = celerity_generate_unique_node_id(); - $chart = phutil_render_tag( + $chart = phutil_tag( 'div', array( 'id' => $id, @@ -409,12 +409,12 @@ final class ManiphestReportController extends ManiphestController { unset($result_closed['']); $base_link = '/maniphest/?users='; - $leftover_name = phutil_render_tag( + $leftover_name = phutil_tag( 'a', array( 'href' => $base_link.ManiphestTaskOwner::OWNER_UP_FOR_GRABS, ), - '(Up For Grabs)'); + phutil_render_html('em', array(), '(Up For Grabs)')); $col_header = 'User'; $header = 'Open Tasks by User and Priority ('.$date.')'; break; @@ -446,12 +446,12 @@ final class ManiphestReportController extends ManiphestController { } $base_link = '/maniphest/view/all/?projects='; - $leftover_name = phutil_render_tag( + $leftover_name = phutil_tag( 'a', array( 'href' => $base_link.ManiphestTaskOwner::PROJECT_NO_PROJECT, ), - '(No Project)'); + phutil_render_html('em', array(), '(No Project)')); $col_header = 'Project'; $header = 'Open Tasks by Project and Priority ('.$date.')'; break; diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php index 9957aa0991..ba8fcb1e85 100644 --- a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php +++ b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php @@ -54,7 +54,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { 'href' => '/maniphest/view/custom/?key='.$query->getQueryKey(), ), $query->getName()), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/custom/edit/'.$query->getID().'/', @@ -105,7 +105,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { $panel = new AphrontPanelView(); $panel->setHeader('Saved Custom Queries'); $panel->addButton( - phutil_render_tag( + phutil_tag( 'button', array(), 'Save Default Query')); diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index 13482b8f35..bbc7a4d5ac 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -89,7 +89,7 @@ final class ManiphestTaskDetailController extends ManiphestController { if ($parent_task) { $context_bar = new AphrontContextBarView(); $context_bar->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/task/create/?parent='.$parent_task->getID(), @@ -104,7 +104,7 @@ final class ManiphestTaskDetailController extends ManiphestController { $context_bar = new AphrontContextBarView(); $context_bar->addButton(''); $context_bar->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/task/create/?template='.$task->getID(), @@ -112,7 +112,7 @@ final class ManiphestTaskDetailController extends ManiphestController { ), 'Similar Task')); $context_bar->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/maniphest/task/create/', diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 3b8db2ed52..1508690729 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -661,14 +661,14 @@ final class ManiphestTaskListController extends ManiphestController { ), 'Clear Selection'); - $submit = phutil_render_tag( + $submit = phutil_tag( 'button', array( 'id' => 'batch-select-submit', 'disabled' => 'disabled', 'class' => 'disabled', ), - 'Batch Edit Selected Tasks »'); + "Batch Edit Selected Tasks \xC2\xBB"); $export = javelin_render_tag( 'a', diff --git a/src/applications/meta/view/PhabricatorApplicationLaunchView.php b/src/applications/meta/view/PhabricatorApplicationLaunchView.php index d3658cdf29..e3997c0c0b 100644 --- a/src/applications/meta/view/PhabricatorApplicationLaunchView.php +++ b/src/applications/meta/view/PhabricatorApplicationLaunchView.php @@ -84,7 +84,7 @@ final class PhabricatorApplicationLaunchView extends AphrontView { $classes[] = 'app-'.$icon.'-light-large'; } - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => implode(' ', $classes), diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAListController.php b/src/applications/metamta/controller/PhabricatorMetaMTAListController.php index bcd6897ea0..5e419987c4 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTAListController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAListController.php @@ -68,7 +68,7 @@ final class PhabricatorMetaMTAListController phabricator_format_relative_time_detailed( time() - $mail->getDateModified()), phutil_escape_html($mail->getSubject()), - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'button small grey', diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php index ae3b1afc68..bf1917e430 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php @@ -48,7 +48,7 @@ final class PhabricatorMetaMTASendController $doclink_href = PhabricatorEnv::getDoclink( 'article/Configuring_Outbound_Email.html'); - $doclink = phutil_render_tag( + $doclink = phutil_tag( 'a', array( 'href' => $doclink_href, @@ -77,7 +77,7 @@ final class PhabricatorMetaMTASendController $phdlink_href = PhabricatorEnv::getDoclink( 'article/Managing_Daemons_with_phd.html'); - $phdlink = phutil_render_tag( + $phdlink = phutil_tag( 'a', array( 'href' => $phdlink_href, diff --git a/src/applications/notification/controller/PhabricatorNotificationPanelController.php b/src/applications/notification/controller/PhabricatorNotificationPanelController.php index 969b139b52..b25365c607 100644 --- a/src/applications/notification/controller/PhabricatorNotificationPanelController.php +++ b/src/applications/notification/controller/PhabricatorNotificationPanelController.php @@ -32,7 +32,7 @@ final class PhabricatorNotificationPanelController '

    '. $content. '
    '. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/notification/', diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php index 5425be4d8d..3c782427a3 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php @@ -107,7 +107,7 @@ extends PhabricatorOAuthClientBaseController { $panel = new AphrontPanelView(); if ($this->isClientEdit()) { - $delete_button = phutil_render_tag( + $delete_button = phutil_tag( 'a', array( 'href' => $client->getDeleteURI(), diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php index 072167576a..51104ae880 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php @@ -47,7 +47,7 @@ extends PhabricatorOAuthClientBaseController { ), $client->getRedirectURI() ), - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'small button grey', diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientViewController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientViewController.php index b9c2f277b6..975b394f7b 100644 --- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientViewController.php +++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientViewController.php @@ -84,7 +84,7 @@ extends PhabricatorOAuthClientBaseController { $panel->appendChild($form); $admin_panel = null; if ($client->getCreatorPHID() == $current_user->getPHID()) { - $edit_button = phutil_render_tag( + $edit_button = phutil_tag( 'a', array( 'href' => $client->getEditURI(), diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php index ad834f75cf..06faaf208b 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationEditController.php @@ -45,7 +45,7 @@ extends PhabricatorOAuthClientAuthorizationBaseController { $current_user); $panel = new AphrontPanelView(); - $delete_button = phutil_render_tag( + $delete_button = phutil_tag( 'a', array( 'href' => $authorization->getDeleteURI(), diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php index c74b040296..563a2816f4 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php @@ -72,7 +72,7 @@ extends PhabricatorOAuthClientAuthorizationBaseController { $authorization->getDateModified(), $current_user ), - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'small button grey', diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index 485a3014ab..5046a740b7 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -129,7 +129,7 @@ final class PhabricatorOwnersDetailController ), 'Delete Package')); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/owners/edit/'.$package->getID().'/', @@ -164,7 +164,7 @@ final class PhabricatorOwnersDetailController $commit_views[] = array( 'view' => $view, 'header' => 'Commits in this Package that Need Attention', - 'button' => phutil_render_tag( + 'button' => phutil_tag( 'a', array( 'href' => $commit_uri->alter('status', 'open'), @@ -189,7 +189,7 @@ final class PhabricatorOwnersDetailController $commit_views[] = array( 'view' => $view, 'header' => 'Recent Commits in Package', - 'button' => phutil_render_tag( + 'button' => phutil_tag( 'a', array( 'href' => $commit_uri, diff --git a/src/applications/paste/controller/PhabricatorPasteEditController.php b/src/applications/paste/controller/PhabricatorPasteEditController.php index 1d3e8515b8..63beb71670 100644 --- a/src/applications/paste/controller/PhabricatorPasteEditController.php +++ b/src/applications/paste/controller/PhabricatorPasteEditController.php @@ -153,7 +153,7 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController { ->setCustomClass('PhabricatorMonospaced') ->setName('text')); } else { - $fork_link = phutil_render_tag( + $fork_link = phutil_tag( 'a', array( 'href' => $this->getApplicationURI('?parent='.$paste->getID()) diff --git a/src/applications/people/application/PhabricatorApplicationPeople.php b/src/applications/people/application/PhabricatorApplicationPeople.php index ad9754bc1c..b37667196b 100644 --- a/src/applications/people/application/PhabricatorApplicationPeople.php +++ b/src/applications/people/application/PhabricatorApplicationPeople.php @@ -63,7 +63,7 @@ final class PhabricatorApplicationPeople extends PhabricatorApplication { ); $item->appendChild( - phutil_render_tag( + phutil_tag( 'span', array( 'class' => implode(' ', $classes), diff --git a/src/applications/people/controller/PhabricatorEmailVerificationController.php b/src/applications/people/controller/PhabricatorEmailVerificationController.php index 9f69293dcc..221df9d2a5 100644 --- a/src/applications/people/controller/PhabricatorEmailVerificationController.php +++ b/src/applications/people/controller/PhabricatorEmailVerificationController.php @@ -24,7 +24,7 @@ final class PhabricatorEmailVerificationController $user->getPHID(), $this->code); - $home_link = phutil_render_tag( + $home_link = phutil_tag( 'a', array( 'href' => '/', @@ -32,7 +32,7 @@ final class PhabricatorEmailVerificationController 'Continue to Phabricator'); $home_link = '

    '.$home_link.'

    '; - $settings_link = phutil_render_tag( + $settings_link = phutil_tag( 'a', array( 'href' => '/settings/panel/email/', diff --git a/src/applications/people/controller/PhabricatorPeopleEditController.php b/src/applications/people/controller/PhabricatorPeopleEditController.php index 661957c901..d5e0ca8f0c 100644 --- a/src/applications/people/controller/PhabricatorPeopleEditController.php +++ b/src/applications/people/controller/PhabricatorPeopleEditController.php @@ -660,7 +660,7 @@ final class PhabricatorPeopleEditController } private function getRoleInstructions() { - $roles_link = phutil_render_tag( + $roles_link = phutil_tag( 'a', array( 'href' => PhabricatorEnv::getDoclink( diff --git a/src/applications/people/controller/PhabricatorPeopleLdapController.php b/src/applications/people/controller/PhabricatorPeopleLdapController.php index d0f1d715a9..f29efb5335 100644 --- a/src/applications/people/controller/PhabricatorPeopleLdapController.php +++ b/src/applications/people/controller/PhabricatorPeopleLdapController.php @@ -153,7 +153,7 @@ final class PhabricatorPeopleLdapController private function renderUserInputs($user) { $username = $user[0]; - $inputs = phutil_render_tag( + $inputs = phutil_tag( 'input', array( 'type' => 'checkbox', @@ -162,7 +162,7 @@ final class PhabricatorPeopleLdapController ), ''); - $inputs .= phutil_render_tag( + $inputs .= phutil_tag( 'input', array( 'type' => 'hidden', @@ -171,7 +171,7 @@ final class PhabricatorPeopleLdapController ), ''); - $inputs .= phutil_render_tag( + $inputs .= phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/applications/people/controller/PhabricatorPeopleListController.php b/src/applications/people/controller/PhabricatorPeopleListController.php index ce6f60e45a..290f77f174 100644 --- a/src/applications/people/controller/PhabricatorPeopleListController.php +++ b/src/applications/people/controller/PhabricatorPeopleListController.php @@ -58,7 +58,7 @@ final class PhabricatorPeopleListController phutil_escape_html($user->getRealName()), $status, $email, - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'button grey small', @@ -107,7 +107,7 @@ final class PhabricatorPeopleListController if ($is_admin) { $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/people/edit/', @@ -116,7 +116,7 @@ final class PhabricatorPeopleListController 'Create New Account')); if (PhabricatorEnv::getEnvConfig('ldap.auth-enabled')) { $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/people/ldap/', diff --git a/src/applications/phame/controller/post/PhamePostPublishController.php b/src/applications/phame/controller/post/PhamePostPublishController.php index 2c0cd075a4..0a04ec542e 100644 --- a/src/applications/phame/controller/post/PhamePostPublishController.php +++ b/src/applications/phame/controller/post/PhamePostPublishController.php @@ -75,7 +75,7 @@ final class PhamePostPublishController extends PhameController { array( 'style' => 'text-align: center; padding: 1em;', ), - phutil_render_tag( + phutil_tag( 'iframe', array( 'style' => 'width: 100%; height: 600px; '. diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index 60ab1dbc5d..daae25dd53 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -151,7 +151,7 @@ final class PhamePostView extends AphrontView { return null; } - $fb_root = phutil_render_tag('div', + $fb_root = phutil_tag('div', array( 'id' => 'fb-root', ), @@ -173,7 +173,7 @@ final class PhamePostView extends AphrontView { $uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()); - $fb_comments = phutil_render_tag('div', + $fb_comments = phutil_tag('div', array( 'class' => 'fb-comments', 'data-href' => $uri, diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php index 2702854661..b24b00331b 100644 --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -110,7 +110,7 @@ final class PhrictionDiffController 'href' => PhrictionDocument::getSlugURI($slug), ), $current->getTitle()), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/phriction/history/'.$document->getSlug().'/', @@ -133,7 +133,7 @@ final class PhrictionDiffController $uri = $request->getRequestURI(); if ($nav_l) { - $link_l = phutil_render_tag( + $link_l = phutil_tag( 'a', array( 'href' => $uri->alter('l', $l - 1)->alter('r', $r - 1), @@ -145,7 +145,7 @@ final class PhrictionDiffController $link_r = null; if ($nav_r) { - $link_r = phutil_render_tag( + $link_r = phutil_tag( 'a', array( 'href' => $uri->alter('l', $l + 1)->alter('r', $r + 1), @@ -202,7 +202,7 @@ final class PhrictionDiffController } if ($content->getID() == $current->getID()) { - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => '/phriction/edit/'.$document_id.'/', diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index f48e562d18..48e07a6de5 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -47,14 +47,14 @@ final class PhrictionDocumentController $create_uri = '/phriction/edit/?slug='.$slug; $create_sentence = 'You can '. - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $create_uri, ), 'create a new document'). '.'; - $button = phutil_render_tag( + $button = phutil_tag( 'a', array( 'href' => $create_uri, diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index e5ebe1bf11..72a6f50c0f 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -159,7 +159,7 @@ final class PhrictionEditController $panel_header = 'Edit Phriction Document'; $submit_button = 'Save Changes'; if ($document->getStatus() != PhrictionDocumentStatus::STATUS_DELETED) { - $delete_button = phutil_render_tag( + $delete_button = phutil_tag( 'a', array( 'href' => '/phriction/delete/'.$document->getID().'/', @@ -183,7 +183,7 @@ final class PhrictionEditController ($draft->getDraft() != $content->getContent())) { $content_text = $draft->getDraft(); - $discard = phutil_render_tag( + $discard = phutil_tag( 'a', array( 'href' => $request->getRequestURI()->alter('nodraft', true), diff --git a/src/applications/phriction/controller/PhrictionHistoryController.php b/src/applications/phriction/controller/PhrictionHistoryController.php index 35cc7e1a44..29f92e4b0d 100644 --- a/src/applications/phriction/controller/PhrictionHistoryController.php +++ b/src/applications/phriction/controller/PhrictionHistoryController.php @@ -54,7 +54,7 @@ final class PhrictionHistoryController $uri = $diff_uri ->alter('l', $content->getVersion() - 1) ->alter('r', $content->getVersion()); - $vs_previous = phutil_render_tag( + $vs_previous = phutil_tag( 'a', array( 'href' => $uri, @@ -68,7 +68,7 @@ final class PhrictionHistoryController ->alter('l', $content->getVersion()) ->alter('r', $current->getVersion()); - $vs_head = phutil_render_tag( + $vs_head = phutil_tag( 'a', array( 'href' => $uri, diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index b1eff0f88d..ae4adba176 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -133,7 +133,7 @@ final class PhabricatorProjectMembersEditController ->setHandles($handles); foreach ($handles as $handle) { - $hidden_input = phutil_render_tag( + $hidden_input = phutil_tag( 'input', array( 'type' => 'hidden', diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index cb0d7e6d0e..d843874993 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -91,7 +91,7 @@ final class PhabricatorProjectProfileController 'action' => '/project/update/'.$project->getID().'/join/', 'method' => 'post', ), - phutil_render_tag( + phutil_tag( 'button', array( 'class' => $class, @@ -261,7 +261,7 @@ final class PhabricatorProjectProfileController $open = number_format($count); - $more_link = phutil_render_tag( + $more_link = phutil_tag( 'a', array( 'href' => '/maniphest/view/all/?projects='.$project->getPHID(), diff --git a/src/applications/repository/controller/PhabricatorRepositoryController.php b/src/applications/repository/controller/PhabricatorRepositoryController.php index 918fbbced2..1f58eca9a4 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryController.php @@ -33,7 +33,7 @@ abstract class PhabricatorRepositoryController extends PhabricatorController { } protected function renderDaemonNotice() { - $documentation = phutil_render_tag( + $documentation = phutil_tag( 'a', array( 'href' => PhabricatorEnv::getDoclink( diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index 1a463908a5..bd6b43daac 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -348,7 +348,7 @@ final class PhabricatorRepositoryEditController } $doc_href = PhabricatorEnv::getDoclink('article/Diffusion_User_Guide.html'); - $user_guide_link = phutil_render_tag( + $user_guide_link = phutil_tag( 'a', array( 'href' => $doc_href, diff --git a/src/applications/repository/controller/PhabricatorRepositoryListController.php b/src/applications/repository/controller/PhabricatorRepositoryListController.php index 56921bd089..fd4b6fb37c 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryListController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryListController.php @@ -20,7 +20,7 @@ final class PhabricatorRepositoryListController foreach ($repos as $repo) { if ($repo->isTracked()) { - $diffusion_link = phutil_render_tag( + $diffusion_link = phutil_tag( 'a', array( 'href' => '/diffusion/'.$repo->getCallsign().'/', @@ -36,7 +36,7 @@ final class PhabricatorRepositoryListController PhabricatorRepositoryType::getNameForRepositoryType( $repo->getVersionControlSystem()), $diffusion_link, - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'button small grey', @@ -106,7 +106,7 @@ final class PhabricatorRepositoryListController $rows[] = array( phutil_escape_html($project->getName()), $repo_name, - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/repository/project/edit/'.$project->getID().'/', diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php index 555f602d40..8e82d4ae03 100644 --- a/src/applications/search/view/PhabricatorSearchResultView.php +++ b/src/applications/search/view/PhabricatorSearchResultView.php @@ -44,7 +44,7 @@ final class PhabricatorSearchResultView extends AphrontView { $img = $handle->getImageURI(); if ($img) { - $img = phutil_render_tag( + $img = phutil_tag( 'div', array( 'class' => 'result-image', diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php index 64195bd14d..c6bc086e0f 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php @@ -63,7 +63,7 @@ function helloWorld() { } EXAMPLE; - $editor_doc_link = phutil_render_tag( + $editor_doc_link = phutil_tag( 'a', array( 'href' => PhabricatorEnv::getDoclink( diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php index 072c1dcb9e..057ac4436d 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php @@ -79,7 +79,7 @@ final class PhabricatorSettingsPanelEmailAddresses ), 'Remove'); - $button_primary = phutil_render_tag( + $button_primary = phutil_tag( 'a', array( 'class' => 'button small disabled', diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php index 0c33b30f0f..a0b6b06616 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php @@ -220,7 +220,7 @@ final class PhabricatorSettingsPanelSSHKeys $panel = new AphrontPanelView(); $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->getPanelURI('?edit=true'), diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php index 04c4e2e566..f9ec9f0a1b 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -76,7 +76,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { } private function renderCommentPanel() { - $status = phutil_render_tag( + $status = phutil_tag( 'div', array( 'id' => $this->getStatusID(), diff --git a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php index 27c610f778..cd20ac4f39 100644 --- a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php +++ b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php @@ -126,7 +126,7 @@ final class PhabricatorXHProfProfileTopLevelView if ($this->file) { $panel->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->file->getBestURI(), diff --git a/src/infrastructure/celerity/CelerityStaticResourceResponse.php b/src/infrastructure/celerity/CelerityStaticResourceResponse.php index c1f54033fc..e16d75f799 100644 --- a/src/infrastructure/celerity/CelerityStaticResourceResponse.php +++ b/src/infrastructure/celerity/CelerityStaticResourceResponse.php @@ -114,7 +114,7 @@ final class CelerityStaticResourceResponse { 'href' => $uri, )); case 'js': - return phutil_render_tag( + return phutil_tag( 'script', array( 'type' => 'text/javascript', diff --git a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php index 17ce6e596b..ba773721e1 100644 --- a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php +++ b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php @@ -19,7 +19,7 @@ final class PhabricatorInlineSummaryView extends AphrontView { } private function renderHeader() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-inline-summary', diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php index 2664e16c52..f4e11e4cc6 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleYoutube.php @@ -23,7 +23,7 @@ final class PhabricatorRemarkupRuleYoutube $youtube_src = 'https://www.youtube.com/embed/'.$v; $iframe = '
    '. - phutil_render_tag( + phutil_tag( 'iframe', array( 'width' => '650', diff --git a/src/view/control/AphrontCursorPagerView.php b/src/view/control/AphrontCursorPagerView.php index 424b011990..f02f165fb9 100644 --- a/src/view/control/AphrontCursorPagerView.php +++ b/src/view/control/AphrontCursorPagerView.php @@ -88,7 +88,7 @@ final class AphrontCursorPagerView extends AphrontView { $links = array(); if ($this->afterID || ($this->beforeID && $this->moreResults)) { - $links[] = phutil_render_tag( + $links[] = phutil_tag( 'a', array( 'href' => $this->uri @@ -99,7 +99,7 @@ final class AphrontCursorPagerView extends AphrontView { } if ($this->prevPageID) { - $links[] = phutil_render_tag( + $links[] = phutil_tag( 'a', array( 'href' => $this->uri @@ -110,7 +110,7 @@ final class AphrontCursorPagerView extends AphrontView { } if ($this->nextPageID) { - $links[] = phutil_render_tag( + $links[] = phutil_tag( 'a', array( 'href' => $this->uri diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index c3bffde73f..d723907554 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -181,7 +181,7 @@ final class AphrontTableView extends AphrontView { $classes[] = 'aphront-table-view-sortable-selected'; } - $sort_glyph = phutil_render_tag( + $sort_glyph = phutil_tag( 'span', array( 'class' => $sort_glyph_class, diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php index 4d398f2fa5..aefdafbd75 100644 --- a/src/view/form/control/AphrontFormDateControl.php +++ b/src/view/form/control/AphrontFormDateControl.php @@ -234,7 +234,7 @@ final class AphrontFormDateControl extends AphrontFormControl { ), ''); - $time_sel = phutil_render_tag( + $time_sel = phutil_tag( 'input', array( 'name' => $this->getTimeInputName(), diff --git a/src/view/form/control/AphrontFormDragAndDropUploadControl.php b/src/view/form/control/AphrontFormDragAndDropUploadControl.php index 9f6f521068..d25c6190a8 100644 --- a/src/view/form/control/AphrontFormDragAndDropUploadControl.php +++ b/src/view/form/control/AphrontFormDragAndDropUploadControl.php @@ -46,7 +46,7 @@ final class AphrontFormDragAndDropUploadControl extends AphrontFormControl { 'activatedClass' => $this->activatedClass, )); - return phutil_render_tag( + return phutil_tag( 'div', array( 'id' => $list_id, diff --git a/src/view/form/control/AphrontFormImageControl.php b/src/view/form/control/AphrontFormImageControl.php index c806ea38fc..0953eabbf1 100644 --- a/src/view/form/control/AphrontFormImageControl.php +++ b/src/view/form/control/AphrontFormImageControl.php @@ -26,7 +26,7 @@ final class AphrontFormImageControl extends AphrontFormControl { 'class' => 'default-image', 'id' => $id, )). - phutil_render_tag( + phutil_tag( 'label', array( 'for' => $id, diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 5198c0cf8d..6b601ff735 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -66,7 +66,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { $buttons = array(); foreach ($actions as $action => $spec) { if (idx($spec, 'spacer')) { - $buttons[] = phutil_render_tag( + $buttons[] = phutil_tag( 'span', array( 'class' => 'remarkup-assist-separator', @@ -110,7 +110,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { 'target' => $target, 'tabindex' => -1, ), - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'remarkup-assist sprite-icon remarkup-assist-'.$action, diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index bceb20e981..6bea1c3e42 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -183,7 +183,7 @@ final class AphrontSideNavFilterView extends AphrontView { if ($this->flexible) { $nav_classes[] = 'has-drag-nav'; $drag_id = celerity_generate_unique_node_id(); - $flex_bar = phutil_render_tag( + $flex_bar = phutil_tag( 'div', array( 'class' => 'phabricator-nav-drag', @@ -200,7 +200,7 @@ final class AphrontSideNavFilterView extends AphrontView { $background_id = celerity_generate_unique_node_id(); $nav_classes[] = 'has-local-nav'; - $menu_background = phutil_render_tag( + $menu_background = phutil_tag( 'div', array( 'class' => 'phabricator-nav-column-background', diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index 30bbd218f2..5aa00d9ddc 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -50,7 +50,7 @@ final class PhabricatorActionView extends AphrontView { } require_celerity_resource('sprite-icon-css'); - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => 'phabricator-action-view-icon sprite-icon '. diff --git a/src/view/layout/PhabricatorAnchorView.php b/src/view/layout/PhabricatorAnchorView.php index b363839617..2f642fab3d 100644 --- a/src/view/layout/PhabricatorAnchorView.php +++ b/src/view/layout/PhabricatorAnchorView.php @@ -30,7 +30,7 @@ final class PhabricatorAnchorView extends AphrontView { ''); } - $anchor = phutil_render_tag( + $anchor = phutil_tag( 'a', array( 'name' => $this->anchorName, diff --git a/src/view/layout/PhabricatorCrumbView.php b/src/view/layout/PhabricatorCrumbView.php index 8d756281b7..2e422a1951 100644 --- a/src/view/layout/PhabricatorCrumbView.php +++ b/src/view/layout/PhabricatorCrumbView.php @@ -54,7 +54,7 @@ final class PhabricatorCrumbView extends AphrontView { $icon = null; if ($this->icon) { $classes[] = 'phabricator-crumb-has-icon'; - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => 'phabricator-crumb-icon '. @@ -72,7 +72,7 @@ final class PhabricatorCrumbView extends AphrontView { $divider = null; if (!$this->isLastCrumb) { - $divider = phutil_render_tag( + $divider = phutil_tag( 'span', array( 'class' => 'sprite-menu phabricator-crumb-divider', diff --git a/src/view/layout/PhabricatorCrumbsView.php b/src/view/layout/PhabricatorCrumbsView.php index 0f82ac33d7..457b0221cd 100644 --- a/src/view/layout/PhabricatorCrumbsView.php +++ b/src/view/layout/PhabricatorCrumbsView.php @@ -30,7 +30,7 @@ final class PhabricatorCrumbsView extends AphrontView { foreach ($this->actions as $action) { $icon = null; if ($action->getIcon()) { - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => 'sprite-icon action-'.$action->getIcon(), diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index 6161073f84..018cfe6ac3 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -85,7 +85,7 @@ final class PhabricatorObjectItemView extends AphrontView { foreach ($this->icons as $spec) { $icon = $spec['icon']; - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => 'phabricator-object-item-icon-image '. @@ -119,12 +119,12 @@ final class PhabricatorObjectItemView extends AphrontView { $attrs = null; if ($this->attributes) { $attrs = array(); - $spacer = phutil_render_tag( + $spacer = phutil_tag( 'span', array( 'class' => 'phabricator-object-item-attribute-spacer', ), - '·'); + "\xC2\xB7"); $first = true; foreach ($this->attributes as $attribute) { $attrs[] = phutil_render_tag( diff --git a/src/view/layout/PhabricatorProfileHeaderView.php b/src/view/layout/PhabricatorProfileHeaderView.php index 4c9adb37fc..f1e9746cf5 100644 --- a/src/view/layout/PhabricatorProfileHeaderView.php +++ b/src/view/layout/PhabricatorProfileHeaderView.php @@ -38,7 +38,7 @@ final class PhabricatorProfileHeaderView extends AphrontView { $image = null; if ($this->profilePicture) { - $image = phutil_render_tag( + $image = phutil_tag( 'div', array( 'class' => 'profile-header-picture-frame', diff --git a/src/view/layout/PhabricatorTagView.php b/src/view/layout/PhabricatorTagView.php index 165ed2b9fe..8755c048ef 100644 --- a/src/view/layout/PhabricatorTagView.php +++ b/src/view/layout/PhabricatorTagView.php @@ -99,7 +99,7 @@ final class PhabricatorTagView extends AphrontView { if ($this->dotColor) { $dotcolor = 'phabricator-tag-color-'.$this->dotColor; - $dot = phutil_render_tag( + $dot = phutil_tag( 'span', array( 'class' => 'phabricator-tag-dot '.$dotcolor, @@ -118,7 +118,7 @@ final class PhabricatorTagView extends AphrontView { if ($this->barColor) { $barcolor = 'phabricator-tag-color-'.$this->barColor; - $bar = phutil_render_tag( + $bar = phutil_tag( 'span', array( 'class' => 'phabricator-tag-bar '.$barcolor, diff --git a/src/view/layout/PhabricatorTimelineEventView.php b/src/view/layout/PhabricatorTimelineEventView.php index f3534d7797..7b0eb5546b 100644 --- a/src/view/layout/PhabricatorTimelineEventView.php +++ b/src/view/layout/PhabricatorTimelineEventView.php @@ -122,7 +122,7 @@ final class PhabricatorTimelineEventView extends AphrontView { array( 'class' => 'phabricator-timeline-icon-fill', ), - phutil_render_tag( + phutil_tag( 'span', array( 'class' => 'phabricator-timeline-icon sprite-icon '. @@ -141,7 +141,7 @@ final class PhabricatorTimelineEventView extends AphrontView { $title = $icon.$title; } - $wedge = phutil_render_tag( + $wedge = phutil_tag( 'div', array( 'class' => 'phabricator-timeline-wedge phabricator-timeline-border', @@ -149,7 +149,7 @@ final class PhabricatorTimelineEventView extends AphrontView { ''); $image_uri = $this->userHandle->getImageURI(); - $image = phutil_render_tag( + $image = phutil_tag( 'div', array( 'style' => 'background-image: url('.$image_uri.')', diff --git a/src/view/layout/PhabricatorTimelineView.php b/src/view/layout/PhabricatorTimelineView.php index 4def7593ea..e5d7dae568 100644 --- a/src/view/layout/PhabricatorTimelineView.php +++ b/src/view/layout/PhabricatorTimelineView.php @@ -37,7 +37,7 @@ final class PhabricatorTimelineView extends AphrontView { } public static function renderSpacer() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-timeline-event-view '. diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index f9735a79bc..02883bb2ac 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -309,7 +309,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { 'debug' => $enable_debug, 'pageObjects' => array_fill_keys($this->pageObjects, true), )); - $container = phutil_render_tag( + $container = phutil_tag( 'div', array( 'id' => $aphlict_container_id, diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index 588467aca6..65bd6cddc0 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -130,7 +130,7 @@ final class PhabricatorMainMenuView extends AphrontView { ), ), ), - phutil_render_tag( + phutil_tag( 'span', array( 'class' => 'phabricator-menu-button-icon sprite-menu menu-icon-eye', @@ -151,7 +151,7 @@ final class PhabricatorMainMenuView extends AphrontView { ), ), ), - phutil_render_tag( + phutil_tag( 'span', array( 'class' => 'phabricator-menu-button-icon sprite-menu menu-icon-app', @@ -277,7 +277,7 @@ final class PhabricatorMainMenuView extends AphrontView { 'class' => 'phabricator-main-menu-logo', 'href' => '/', ), - phutil_render_tag( + phutil_tag( 'span', array( 'class' => 'sprite-menu phabricator-main-menu-logo-image', @@ -311,7 +311,7 @@ final class PhabricatorMainMenuView extends AphrontView { ), $count_number); - $icon_tag = phutil_render_tag( + $icon_tag = phutil_tag( 'span', array( 'class' => 'sprite-menu phabricator-main-menu-alert-icon', @@ -358,7 +358,7 @@ final class PhabricatorMainMenuView extends AphrontView { } private function renderMenuIcon($name) { - return phutil_render_tag( + return phutil_tag( 'span', array( 'class' => 'phabricator-core-menu-icon '. -- 2.51.2 From 21a5956a35534bc142b7e2c6d58b0d898bd64a54 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 17 Jan 2013 19:15:06 -0800 Subject: [PATCH 04/50] Convert phutil_render_tag(X, Y, pht('...')) to phutil_tag Summary: Created with spatch: lang=diff - phutil_render_tag + phutil_tag (X, Y, pht('...')) The searched for `<` and `&` by sgrep. Test Plan: Loaded homepage. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4504 --- .../controller/PhabricatorCalendarDeleteStatusController.php | 2 +- .../controller/PhabricatorConfigIssueViewController.php | 2 +- src/applications/config/view/PhabricatorSetupIssueView.php | 4 ++-- .../controller/DifferentialRevisionViewController.php | 4 ++-- .../render/DifferentialChangesetTwoUpRenderer.php | 2 +- .../files/view/PhabricatorGlobalUploadTargetView.php | 2 +- .../maniphest/controller/ManiphestReportController.php | 4 ++-- src/applications/phame/skins/PhameBasicBlogSkin.php | 4 ++-- .../phriction/controller/PhrictionDocumentController.php | 2 +- .../phriction/controller/PhrictionNewController.php | 2 +- src/view/layout/PhabricatorSourceCodeView.php | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php b/src/applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php index 133b300321..e7823f38fa 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarDeleteStatusController.php @@ -37,7 +37,7 @@ final class PhabricatorCalendarDeleteStatusController $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle(pht('Really delete status?')); - $dialog->appendChild(phutil_render_tag( + $dialog->appendChild(phutil_tag( 'p', array(), pht('Permanently delete this status? This action can not be undone.') diff --git a/src/applications/config/controller/PhabricatorConfigIssueViewController.php b/src/applications/config/controller/PhabricatorConfigIssueViewController.php index 9df5f7a5c3..ddac26922c 100644 --- a/src/applications/config/controller/PhabricatorConfigIssueViewController.php +++ b/src/applications/config/controller/PhabricatorConfigIssueViewController.php @@ -22,7 +22,7 @@ final class PhabricatorConfigIssueViewController ->setTitle(pht('Issue Resolved')) ->appendChild(pht('This setup issue has been resolved. ')) ->appendChild( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $this->getApplicationURI('issue/'), diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index 645999f190..5ac904e99a 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -88,7 +88,7 @@ final class PhabricatorSetupIssueView extends AphrontView { } - $next = phutil_render_tag( + $next = phutil_tag( 'div', array( 'class' => 'setup-issue-next', @@ -308,7 +308,7 @@ final class PhabricatorSetupIssueView extends AphrontView { pht( "You can find more information about PHP configuration values in the ". "%s.", - phutil_render_tag( + phutil_tag( 'a', array( 'href' => 'http://php.net/manual/ini.list.php', diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 7f6d6057c3..9b5edc1077 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -153,7 +153,7 @@ final class DifferentialRevisionViewController extends DifferentialController { $reviewer_warning->setTitle(pht('No Active Reviewers')); if ($revision->getReviewers()) { $reviewer_warning->appendChild( - phutil_render_tag( + phutil_tag( 'p', array(), pht('All specified reviewers are disabled and this revision '. @@ -161,7 +161,7 @@ final class DifferentialRevisionViewController extends DifferentialController { )); } else { $reviewer_warning->appendChild( - phutil_render_tag( + phutil_tag( 'p', array(), pht('This revision has no specified reviewers and needs '. diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 74287042a8..337dd9a625 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -21,7 +21,7 @@ final class DifferentialChangesetTwoUpRenderer array( 'sigil' => 'context-target', ), - phutil_render_tag( + phutil_tag( 'td', array( 'colspan' => 6, diff --git a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php index 6b8a0f566a..01eb2902b1 100644 --- a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php +++ b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php @@ -25,7 +25,7 @@ final class PhabricatorGlobalUploadTargetView extends AphrontView { 'browseURI' => '/file/filter/my/', )); - return phutil_render_tag( + return phutil_tag( 'div', array( 'id' => $instructions_id, diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index cd77f4da3e..4b1bf10775 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -414,7 +414,7 @@ final class ManiphestReportController extends ManiphestController { array( 'href' => $base_link.ManiphestTaskOwner::OWNER_UP_FOR_GRABS, ), - phutil_render_html('em', array(), '(Up For Grabs)')); + phutil_tag('em', array(), '(Up For Grabs)')); $col_header = 'User'; $header = 'Open Tasks by User and Priority ('.$date.')'; break; @@ -451,7 +451,7 @@ final class ManiphestReportController extends ManiphestController { array( 'href' => $base_link.ManiphestTaskOwner::PROJECT_NO_PROJECT, ), - phutil_render_html('em', array(), '(No Project)')); + phutil_tag('em', array(), '(No Project)')); $col_header = 'Project'; $header = 'Open Tasks by Project and Priority ('.$date.')'; break; diff --git a/src/applications/phame/skins/PhameBasicBlogSkin.php b/src/applications/phame/skins/PhameBasicBlogSkin.php index 2e1e2424d4..74d70f4f52 100644 --- a/src/applications/phame/skins/PhameBasicBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicBlogSkin.php @@ -166,7 +166,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { if (!$uri) { return null; } - return phutil_render_tag( + return phutil_tag( 'a', array( 'class' => 'phame-page-link phame-page-older', @@ -198,7 +198,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { if (!$uri) { return null; } - return phutil_render_tag( + return phutil_tag( 'a', array( 'class' => 'phame-page-link phame-page-newer', diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 48e07a6de5..f3c89e9c1c 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -131,7 +131,7 @@ final class PhrictionDocumentController $handles[$project_phid]->renderLink().'.'; } - $index_link = phutil_render_tag( + $index_link = phutil_tag( 'a', array( 'href' => '/phriction/', diff --git a/src/applications/phriction/controller/PhrictionNewController.php b/src/applications/phriction/controller/PhrictionNewController.php index 4466600edc..02519dbae7 100644 --- a/src/applications/phriction/controller/PhrictionNewController.php +++ b/src/applications/phriction/controller/PhrictionNewController.php @@ -25,7 +25,7 @@ final class PhrictionNewController extends PhrictionController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle(pht('New Document')) - ->appendChild(phutil_render_tag('p', + ->appendChild(phutil_tag('p', array(), pht('Create a new document at'))) ->appendChild($view) diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php index 6705024e8a..49768fc1f8 100644 --- a/src/view/layout/PhabricatorSourceCodeView.php +++ b/src/view/layout/PhabricatorSourceCodeView.php @@ -31,7 +31,7 @@ final class PhabricatorSourceCodeView extends AphrontView { if ($hit_limit) { $content_number = ''; - $content_line = phutil_render_tag( + $content_line = phutil_tag( 'span', array( 'class' => 'c', -- 2.51.2 From 3c1b8df8ae6ee16de623afc2c69b6c4ce327341c Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 18 Jan 2013 00:32:58 -0800 Subject: [PATCH 05/50] Convert simple phutil_render_tag() to phutil_tag() Summary: Done manually. Test Plan: Loaded homepage. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4509 --- .../plugin/DarkConsoleServicesPlugin.php | 5 +- .../response/AphrontRedirectResponse.php | 4 +- ...PhabricatorChatLogChannelLogController.php | 14 ++- .../PhabricatorConfigEditController.php | 10 +-- .../PhabricatorConfigGroupController.php | 8 +- .../config/view/PhabricatorSetupIssueView.php | 85 +++++++++---------- .../view/PhabricatorDaemonLogListView.php | 2 +- .../DifferentialLintFieldSpecification.php | 2 +- .../DifferentialUnitFieldSpecification.php | 4 +- .../view/DifferentialChangesetListView.php | 8 +- .../DifferentialDiffTableOfContentsView.php | 2 +- .../view/DifferentialRevisionCommentView.php | 4 +- .../controller/DiffusionBrowseController.php | 2 +- .../DiffusionBrowseFileController.php | 19 ++--- .../controller/DiffusionHomeController.php | 2 +- .../view/DiffusionBrowseTableView.php | 4 +- .../diffusion/view/DiffusionView.php | 16 ++-- .../PhabricatorDirectoryMainController.php | 7 +- .../feed/view/PhabricatorFeedStoryView.php | 6 +- .../PhabricatorFileInfoController.php | 2 +- .../PhabricatorMacroListController.php | 2 +- .../PhabricatorContentSourceView.php | 2 +- ...OAuthClientAuthorizationListController.php | 2 +- src/applications/phame/view/PhamePostView.php | 22 +++-- .../controller/PhrictionDiffController.php | 4 +- .../controller/PhrictionHistoryController.php | 2 +- .../ponder/view/PonderCommentListView.php | 4 +- .../ponder/view/PonderUserProfileView.php | 2 +- .../view/PhabricatorSearchResultView.php | 6 +- .../PhabricatorSlowvotePollController.php | 8 +- .../uiexample/examples/JavelinUIExample.php | 4 +- .../view/PhabricatorXHProfSampleListView.php | 2 +- .../view/PhabricatorInlineSummaryView.php | 4 +- .../rule/PhabricatorRemarkupRuleCountdown.php | 20 +++-- .../rule/PhabricatorRemarkupRuleEmbedFile.php | 2 +- .../PhabricatorRemarkupRuleObjectName.php | 2 +- src/view/control/AphrontPagerView.php | 2 +- src/view/control/AphrontTableView.php | 2 +- .../control/AphrontTokenizerTemplateView.php | 32 ++++--- src/view/form/AphrontErrorView.php | 22 ++--- .../form/control/AphrontFormSelectControl.php | 4 +- .../control/PhabricatorRemarkupControl.php | 4 +- src/view/layout/PhabricatorActionView.php | 4 +- src/view/layout/PhabricatorCrumbView.php | 4 +- src/view/layout/PhabricatorHeaderView.php | 21 +++-- src/view/layout/PhabricatorObjectItemView.php | 16 ++-- .../layout/PhabricatorPinboardItemView.php | 8 +- .../layout/PhabricatorPropertyListView.php | 10 ++- src/view/layout/PhabricatorTagView.php | 8 +- .../layout/PhabricatorTimelineEventView.php | 2 +- .../page/menu/PhabricatorMainMenuView.php | 4 +- 51 files changed, 223 insertions(+), 214 deletions(-) diff --git a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php index 442ca9db4c..29e7c50d21 100644 --- a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php @@ -211,13 +211,12 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $info = wordwrap($info, 128, "\n", true); if (!empty($row['explain'])) { - $analysis = phutil_escape_html($row['explain']['reason']); - $analysis = phutil_render_tag( + $analysis = phutil_tag( 'span', array( 'class' => 'explain-sev-'.$row['explain']['sev'], ), - $analysis); + $row['explain']['reason']); } $info = phutil_escape_html($info); diff --git a/src/aphront/response/AphrontRedirectResponse.php b/src/aphront/response/AphrontRedirectResponse.php index bb34a97d5b..254073390d 100644 --- a/src/aphront/response/AphrontRedirectResponse.php +++ b/src/aphront/response/AphrontRedirectResponse.php @@ -42,12 +42,12 @@ class AphrontRedirectResponse extends AphrontResponse { $error->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error->setTitle('Stopped on Redirect'); - $link = phutil_render_tag( + $link = phutil_tag( 'a', array( 'href' => $this->getURI(), ), - 'Continue to: '.phutil_escape_html($this->getURI())); + 'Continue to: '.$this->getURI()); $error->appendChild( '

    You were stopped here because debug.stop-on-redirect '. diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php index 76f98c7eed..581d3544ae 100644 --- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php +++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php @@ -98,31 +98,29 @@ final class PhabricatorChatLogChannelLogController foreach ($blocks as $block) { $author = $block['author']; $author = phutil_utf8_shorten($author, 18); - $author = phutil_escape_html($author); - $author = phutil_render_tag('td', array('class' => 'author'), $author); + $author = phutil_tag('td', array('class' => 'author'), $author); $message = mpull($block['logs'], 'getMessage'); $message = implode("\n", $message); - $message = phutil_escape_html($message); - $message = phutil_render_tag('td', array('class' => 'message'), $message); + $message = phutil_tag('td', array('class' => 'message'), $message); $href = $uri->alter('at', $block['id']); $timestamp = $block['epoch']; $timestamp = phabricator_datetime($timestamp, $user); - $timestamp = phutil_render_tag('a', array('href' => $href), $timestamp); - $timestamp = phutil_render_tag( + $timestamp = phutil_tag('a', array('href' => $href), $timestamp); + $timestamp = phutil_tag( 'td', array( 'class' => 'timestamp', ), $timestamp); - $out[] = phutil_render_tag( + $out[] = phutil_tag( 'tr', array( 'class' => $block['class'], ), - $author.$message.$timestamp); + array($author, $message, $timestamp)); } $out[] = ''; diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index 78b9f96e0c..c0b5dcab9f 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -132,7 +132,7 @@ final class PhabricatorConfigEditController $engine = new PhabricatorMarkupEngine(); $engine->addObject($option, 'description'); $engine->process(); - $description = phutil_render_tag( + $description = phutil_tag( 'div', array( 'class' => 'phabricator-remarkup', @@ -440,12 +440,12 @@ final class PhabricatorConfigEditController require_celerity_resource('config-options-css'); - return phutil_render_tag( + return phutil_tag( 'table', array( 'class' => 'config-option-table', ), - implode("\n", $table)); + new PhutilSafeHTML(implode("\n", $table))); } private function renderDefaults(PhabricatorConfigOption $option) { @@ -492,12 +492,12 @@ final class PhabricatorConfigEditController require_celerity_resource('config-options-css'); - return phutil_render_tag( + return phutil_tag( 'table', array( 'class' => 'config-option-table', ), - implode("\n", $table)); + new PhutilSafeHTML(implode("\n", $table))); } } diff --git a/src/applications/config/controller/PhabricatorConfigGroupController.php b/src/applications/config/controller/PhabricatorConfigGroupController.php index a41bc4efdb..2f53b30496 100644 --- a/src/applications/config/controller/PhabricatorConfigGroupController.php +++ b/src/applications/config/controller/PhabricatorConfigGroupController.php @@ -84,13 +84,15 @@ final class PhabricatorConfigGroupController $current_value = PhabricatorEnv::getEnvConfig($option->getKey()); $current_value = PhabricatorConfigJSON::prettyPrintJSON( $current_value); - $current_value = phutil_render_tag( + $current_value = phutil_tag( 'div', array( 'class' => 'config-options-current-value', ), - ''.pht('Current Value:').' '. - phutil_escape_html($current_value)); + array( + phutil_tag('span', array(), pht('Current Value:')), + ' '.$current_value, + )); $item->appendChild($current_value); } diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index 5ac904e99a..795f124b9d 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -16,12 +16,12 @@ final class PhabricatorSetupIssueView extends AphrontView { public function render() { $issue = $this->getIssue(); - $description = phutil_render_tag( + $description = phutil_tag( 'div', array( 'class' => 'setup-issue-instructions', ), - nl2br(phutil_escape_html($issue->getMessage()))); + new PhutilSafeHTML(nl2br(phutil_escape_html($issue->getMessage())))); $configs = $issue->getPHPConfig(); if ($configs) { @@ -36,13 +36,15 @@ final class PhabricatorSetupIssueView extends AphrontView { $commands = $issue->getCommands(); if ($commands) { $run_these = pht("Run these %d command(s):", count($commands)); - $description .= phutil_render_tag( + $description .= phutil_tag( 'div', array( 'class' => 'setup-issue-config', ), - phutil_render_tag('p', array(), $run_these). - phutil_render_tag('pre', array(), implode("\n", $commands))); + array( + phutil_render_tag('p', array(), $run_these), + phutil_render_tag('pre', array(), implode("\n", $commands)), + )); } $extensions = $issue->getPHPExtensions(); @@ -74,17 +76,19 @@ final class PhabricatorSetupIssueView extends AphrontView { "After installing new PHP extensions, restart your webserver ". "for the changes to take effect."); - $description .= phutil_render_tag( + $description .= phutil_tag( 'div', array( 'class' => 'setup-issue-config', ), - phutil_render_tag('p', array(), $install_these). - phutil_render_tag('pre', array(), implode("\n", $extensions)). - phutil_render_tag('p', array(), $install_info). - phutil_render_tag('pre', array(), $install_commands). - phutil_render_tag('p', array(), $fallback_info). - phutil_render_tag('p', array(), $restart_info)); + array( + phutil_render_tag('p', array(), $install_these), + phutil_render_tag('pre', array(), implode("\n", $extensions)), + phutil_render_tag('p', array(), $install_info), + phutil_render_tag('pre', array(), $install_commands), + phutil_render_tag('p', array(), $fallback_info), + phutil_render_tag('p', array(), $restart_info), + )); } @@ -102,18 +106,18 @@ final class PhabricatorSetupIssueView extends AphrontView { ), $issue->getName()); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'setup-issue', ), - $name.$description.$next); + array($name, $description, $next)); } private function renderPhabricatorConfig(array $configs) { $issue = $this->getIssue(); - $table_info = phutil_render_tag( + $table_info = phutil_tag( 'p', array(), pht( @@ -141,16 +145,16 @@ final class PhabricatorSetupIssueView extends AphrontView { $table[] = ''; } - $table = phutil_render_tag( + $table = phutil_tag( 'table', array( ), - implode("\n", $table)); + new PhutilSafeHTML(implode("\n", $table))); $options = PhabricatorApplicationConfigOptions::loadAllOptions(); if ($this->getIssue()->getIsFatal()) { - $update_info = phutil_render_tag( + $update_info = phutil_tag( 'p', array(), pht( @@ -172,12 +176,12 @@ final class PhabricatorSetupIssueView extends AphrontView { if (!idx($options, $config) || $options[$config]->getLocked()) { continue; } - $link = phutil_render_tag( + $link = phutil_tag( 'a', array( 'href' => '/config/edit/'.$config.'/?issue='.$issue->getIssueKey(), ), - pht('Edit %s', phutil_escape_html($config))); + pht('Edit %s', $config)); $update[] = '

  • '.$link.'
  • '; } if ($update) { @@ -207,7 +211,7 @@ final class PhabricatorSetupIssueView extends AphrontView { } private function renderPHPConfig(array $configs) { - $table_info = phutil_render_tag( + $table_info = phutil_tag( 'p', array(), pht( @@ -236,12 +240,10 @@ final class PhabricatorSetupIssueView extends AphrontView { $table[] = ''; } - $table = phutil_render_tag( + $table = phutil_tag( 'table', - array( - - ), - implode("\n", $table)); + array(), + new PhutilSafeHTML(implode("\n", $table))); ob_start(); phpinfo(); @@ -269,14 +271,14 @@ final class PhabricatorSetupIssueView extends AphrontView { } if (!$ini_loc) { - $info = phutil_render_tag( + $info = phutil_tag( 'p', array(), pht( "To update these %d value(s), edit your PHP configuration file.", count($configs))); } else { - $info = phutil_render_tag( + $info = phutil_tag( 'p', array(), pht( @@ -290,7 +292,7 @@ final class PhabricatorSetupIssueView extends AphrontView { } if ($more_loc) { - $info .= phutil_render_tag( + $info .= phutil_tag( 'p', array(), pht( @@ -302,32 +304,27 @@ final class PhabricatorSetupIssueView extends AphrontView { implode("\n", $more_loc)); } - $info .= phutil_render_tag( + $info .= phutil_tag( 'p', array(), - pht( - "You can find more information about PHP configuration values in the ". - "%s.", - phutil_tag( - 'a', - array( - 'href' => 'http://php.net/manual/ini.list.php', - ), - pht('PHP Documentation')))); + phutil_safe_html(pht( + 'You can find more information about PHP configuration values in the '. + 'PHP Documentation.', + 'http://php.net/manual/ini.list.php'))); - $info .= phutil_render_tag( + $info .= phutil_tag( 'p', array(), - pht( + phutil_safe_html(pht( "After editing the PHP configuration, restart your ". - "webserver for the changes to take effect.")); + "webserver for the changes to take effect
    ."))); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'setup-issue-config', ), - $table_info.$table.$info); + array($table_info, $table, $info)); } } diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php index 35f234733a..c60b584209 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php @@ -66,7 +66,7 @@ final class PhabricatorDaemonLogListView extends AphrontView { $symbol = '?'; } - $running = phutil_render_tag( + $running = phutil_tag( 'span', array( 'style' => $style, diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index b2a9a4c943..2c0164a255 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -87,7 +87,7 @@ final class DifferentialLintFieldSpecification if ($diff->getID() != $this->getDiff()->getID()) { $href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href; } - $line_link = phutil_render_tag( + $line_link = phutil_tag( 'a', array( 'href' => $href, diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index 8900aef7f8..b4e89b3fa9 100644 --- a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php @@ -93,9 +93,9 @@ final class DifferentialUnitFieldSpecification $hidden[$result]++; } - $value = phutil_escape_html(idx($test, 'name')); + $value = idx($test, 'name'); if (!empty($test['link'])) { - $value = phutil_render_tag( + $value = phutil_tag( 'a', array( 'href' => $test['link'], diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index fc969acd94..acea5b060d 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -158,12 +158,12 @@ final class DifferentialChangesetListView extends AphrontView { 'Load'); } $detail->appendChild( - phutil_render_tag( + phutil_tag( 'div', array( 'id' => $uniq_id, ), - '
    '.$load.'
    ')); + phutil_tag('div', array('class' => 'differential-loading'), $load))); $output[] = $detail->render(); } @@ -217,12 +217,12 @@ final class DifferentialChangesetListView extends AphrontView { ), 'Undo'); - $div = phutil_render_tag( + $div = phutil_tag( 'div', array( 'class' => 'differential-inline-undo', ), - 'Changes discarded. '.$link); + array('Changes discarded. ', $link)); $template = ''. diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index 2c5d5058af..818522b2ba 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -137,7 +137,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { if ($cov === null) { $mcov = $cov = '-'; } else { - $mcov = phutil_render_tag( + $mcov = phutil_tag( 'div', array( 'id' => 'differential-mcoverage-'.md5($fname), diff --git a/src/applications/differential/view/DifferentialRevisionCommentView.php b/src/applications/differential/view/DifferentialRevisionCommentView.php index 0670e87bdb..251c6d12fd 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentView.php @@ -134,12 +134,12 @@ final class DifferentialRevisionCommentView extends AphrontView { case DifferentialAction::ACTION_UPDATE: $diff_id = idx($metadata, DifferentialComment::METADATA_DIFF_ID); if ($diff_id) { - $diff_link = phutil_render_tag( + $diff_link = phutil_tag( 'a', array( 'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id, ), - 'Diff #'.phutil_escape_html($diff_id)); + 'Diff #'.$diff_id); $actions[] = "{$author_link} updated this revision to {$diff_link}."; } else { $actions[] = "{$author_link} {$verb} this revision."; diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index b0565ca6ce..62d247a651 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -108,7 +108,7 @@ final class DiffusionBrowseController extends DiffusionController { $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); $text = $engine->markupText($text); - $text = phutil_render_tag( + $text = phutil_tag( 'div', array( 'class' => 'phabricator-remarkup', diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index c0835332f4..36bc8443a3 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -271,7 +271,7 @@ final class DiffusionBrowseFileController extends DiffusionController { 'sigil' => 'diffusion-source', ), implode("\n", $rows)); - $corpus = phutil_render_tag( + $corpus = phutil_tag( 'div', array( 'style' => 'padding: 0 2em;', @@ -666,7 +666,7 @@ final class DiffusionBrowseFileController extends DiffusionController { "\xC2\xAB"); } - $blame[] = phutil_render_tag( + $blame[] = phutil_tag( 'th', array( 'class' => 'diffusion-blame-link', @@ -674,7 +674,7 @@ final class DiffusionBrowseFileController extends DiffusionController { ), $before_link); - $blame[] = phutil_render_tag( + $blame[] = phutil_tag( 'th', array( 'class' => 'diffusion-rev-link', @@ -682,7 +682,7 @@ final class DiffusionBrowseFileController extends DiffusionController { ), $commit_link); - $blame[] = phutil_render_tag( + $blame[] = phutil_tag( 'th', array( 'class' => 'diffusion-rev-link', @@ -690,7 +690,7 @@ final class DiffusionBrowseFileController extends DiffusionController { ), $revision_link); - $blame[] = phutil_render_tag( + $blame[] = phutil_tag( 'th', array( 'class' => 'diffusion-author-link', @@ -717,8 +717,6 @@ final class DiffusionBrowseFileController extends DiffusionController { Javelin::initBehavior('diffusion-line-linker'); - $blame = implode('', $blame); - if ($line['target']) { Javelin::initBehavior( 'diffusion-jump-to', @@ -730,7 +728,7 @@ final class DiffusionBrowseFileController extends DiffusionController { $anchor_text = null; } - $line_text = phutil_render_tag( + $blame[] = phutil_render_tag( 'td', array( ), @@ -738,13 +736,12 @@ final class DiffusionBrowseFileController extends DiffusionController { "\xE2\x80\x8B". // NOTE: See phabricator-oncopy behavior. $line['data']); - $rows[] = phutil_render_tag( + $rows[] = phutil_tag( 'tr', array( 'class' => ($line['highlighted'] ? 'highlighted' : null), ), - $blame. - $line_text); + $blame); $rows = array_merge($rows, $this->renderInlines( idx($inlines, $line['line'], array()), diff --git a/src/applications/diffusion/controller/DiffusionHomeController.php b/src/applications/diffusion/controller/DiffusionHomeController.php index d06f0d9863..93d0330414 100644 --- a/src/applications/diffusion/controller/DiffusionHomeController.php +++ b/src/applications/diffusion/controller/DiffusionHomeController.php @@ -105,7 +105,7 @@ final class DiffusionHomeController extends DiffusionController { $branch = $repository->getDefaultArcanistBranch(); if (isset($lint_branches[$branch])) { $show_lint = true; - $lint_count = phutil_render_tag( + $lint_count = phutil_tag( 'a', array( 'href' => DiffusionRequest::generateDiffusionURI(array( diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index 2aed5dbdd3..e603b1aade 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -137,7 +137,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $browse_link = ''.$this->linkBrowse( $base_path.$path->getPath().$dir_slash, array( - 'html' => $this->renderPathIcon( + 'text' => $this->renderPathIcon( 'dir', $browse_text), )).''; @@ -162,7 +162,7 @@ final class DiffusionBrowseTableView extends DiffusionView { $browse_link = $this->linkBrowse( $base_path.$path->getPath(), array( - 'html' => $this->renderPathIcon($type, $browse_text), + 'text' => $this->renderPathIcon($type, $browse_text), )); } diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index df5f139307..83dff57748 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -32,7 +32,7 @@ abstract class DiffusionView extends AphrontView { 'commit' => $commit_identifier, )); - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $href, @@ -63,15 +63,13 @@ abstract class DiffusionView extends AphrontView { 'path' => $path, )); - if (isset($details['html'])) { - $text = $details['html']; - } else if (isset($details['text'])) { - $text = phutil_escape_html($details['text']); + if (isset($details['text'])) { + $text = $details['text']; } else { $text = 'Browse'; } - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $href, @@ -87,7 +85,7 @@ abstract class DiffusionView extends AphrontView { 'id' => $hash, )); - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => $href, @@ -120,7 +118,7 @@ abstract class DiffusionView extends AphrontView { $commit_name = self::nameCommit($repository, $commit); $callsign = $repository->getCallsign(); - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => "/r{$callsign}{$commit}", @@ -133,7 +131,7 @@ abstract class DiffusionView extends AphrontView { return null; } - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => "/D{$id}", diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 0302df17ec..b795ec238e 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -310,13 +310,14 @@ final class PhabricatorDirectoryMainController 'id' => $uniq_id, 'value' => $query, )); - $jump_caption = phutil_render_tag( + $jump_caption = phutil_tag( 'p', array( 'class' => 'phabricator-jump-nav-caption', ), - 'Enter the name of an object like D123 to quickly jump to '. - 'it. See '.$doc_link.' or type help.'); + new PhutilSafeHTML( + 'Enter the name of an object like D123 to quickly jump to '. + 'it. See '.$doc_link.' or type help.')); $panel = new AphrontPanelView(); $panel->setHeader('Jump Nav'); diff --git a/src/applications/feed/view/PhabricatorFeedStoryView.php b/src/applications/feed/view/PhabricatorFeedStoryView.php index 72b4a2a795..bf23a53890 100644 --- a/src/applications/feed/view/PhabricatorFeedStoryView.php +++ b/src/applications/feed/view/PhabricatorFeedStoryView.php @@ -97,7 +97,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { $foot = ''; } - $foot = phutil_render_tag( + $foot = phutil_tag( 'div', array( 'class' => 'phabricator-feed-story-foot', @@ -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 @@ -119,7 +119,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { : 'phabricator-feed-story', 'style' => $image_style, ), - $head.$body.$foot); + array($head, $body, $foot)); } } diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php index 26a095af51..cea2272bdb 100644 --- a/src/applications/files/controller/PhabricatorFileInfoController.php +++ b/src/applications/files/controller/PhabricatorFileInfoController.php @@ -148,7 +148,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { 'class' => 'phabricator-property-list-image', )); - $linked_image = phutil_render_tag( + $linked_image = phutil_tag( 'a', array( 'href' => $file->getViewURI(), diff --git a/src/applications/macro/controller/PhabricatorMacroListController.php b/src/applications/macro/controller/PhabricatorMacroListController.php index 3756d346a0..4a7560ec89 100644 --- a/src/applications/macro/controller/PhabricatorMacroListController.php +++ b/src/applications/macro/controller/PhabricatorMacroListController.php @@ -129,7 +129,7 @@ final class PhabricatorMacroListController } $datetime = phabricator_date($file->getDateCreated(), $viewer); $item->appendChild( - phutil_render_tag( + phutil_tag( 'div', array(), pht('Created on %s', $datetime))); diff --git a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php b/src/applications/metamta/contentsource/PhabricatorContentSourceView.php index 5cd1278770..81ffda8de8 100644 --- a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php +++ b/src/applications/metamta/contentsource/PhabricatorContentSourceView.php @@ -28,7 +28,7 @@ final class PhabricatorContentSourceView extends AphrontView { return; } - return phutil_render_tag( + return phutil_tag( 'span', array( 'class' => "phabricator-content-source-view", diff --git a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php index 563a2816f4..c3b0a927af 100644 --- a/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php +++ b/src/applications/oauthserver/controller/clientauthorization/PhabricatorOAuthClientAuthorizationListController.php @@ -57,7 +57,7 @@ extends PhabricatorOAuthClientAuthorizationBaseController { ), $client->getName() ), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $scope_doc_href, diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index daae25dd53..582e32ccf7 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -123,26 +123,30 @@ final class PhamePostView extends AphrontView { } public function render() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-post', ), - $this->renderTitle(). - $this->renderDatePublished(). - $this->renderBody(). - $this->renderComments()); + array( + $this->renderTitle(), + $this->renderDatePublished(), + $this->renderBody(), + $this->renderComments(), + )); } public function renderWithSummary() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-post', ), - $this->renderTitle(). - $this->renderDatePublished(). - $this->renderSummary()); + array( + $this->renderTitle(), + $this->renderDatePublished(), + $this->renderSummary(), + )); } private function renderFacebookComments() { diff --git a/src/applications/phriction/controller/PhrictionDiffController.php b/src/applications/phriction/controller/PhrictionDiffController.php index b24b00331b..1aa9625bf8 100644 --- a/src/applications/phriction/controller/PhrictionDiffController.php +++ b/src/applications/phriction/controller/PhrictionDiffController.php @@ -212,13 +212,13 @@ final class PhrictionDiffController } - return phutil_render_tag( + return phutil_tag( 'a', array( 'href' => '/phriction/edit/'.$document_id.'/?revert='.$version, 'class' => 'button', ), - 'Revert to Version '.phutil_escape_html($version).'...'); + 'Revert to Version '.$version.'...'); } private function renderComparisonTable(array $content) { diff --git a/src/applications/phriction/controller/PhrictionHistoryController.php b/src/applications/phriction/controller/PhrictionHistoryController.php index 29f92e4b0d..0f4bec40f7 100644 --- a/src/applications/phriction/controller/PhrictionHistoryController.php +++ b/src/applications/phriction/controller/PhrictionHistoryController.php @@ -82,7 +82,7 @@ final class PhrictionHistoryController $rows[] = array( phabricator_date($content->getDateCreated(), $user), phabricator_time($content->getDateCreated(), $user), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $slug_uri.'?v='.$version, diff --git a/src/applications/ponder/view/PonderCommentListView.php b/src/applications/ponder/view/PonderCommentListView.php index 566a975ef6..bef9942aa5 100644 --- a/src/applications/ponder/view/PonderCommentListView.php +++ b/src/applications/ponder/view/PonderCommentListView.php @@ -83,12 +83,12 @@ final class PonderCommentListView extends AphrontView { ''. ''; - $comment_markup = phutil_render_tag( + $comment_markup = phutil_tag( 'table', array( 'class' => 'ponder-comments', ), - implode("\n", $comment_markup) + new PhutilSafeHTML(implode("\n", $comment_markup)) ); diff --git a/src/applications/ponder/view/PonderUserProfileView.php b/src/applications/ponder/view/PonderUserProfileView.php index 0bd15efcfc..a05796c0b8 100644 --- a/src/applications/ponder/view/PonderUserProfileView.php +++ b/src/applications/ponder/view/PonderUserProfileView.php @@ -79,7 +79,7 @@ final class PonderUserProfileView extends AphrontView { $item->addAttribute( pht( 'Answer to %s', - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/Q'.$question->getID(), diff --git a/src/applications/search/view/PhabricatorSearchResultView.php b/src/applications/search/view/PhabricatorSearchResultView.php index 8e82d4ae03..b2a1aaafa9 100644 --- a/src/applications/search/view/PhabricatorSearchResultView.php +++ b/src/applications/search/view/PhabricatorSearchResultView.php @@ -34,7 +34,7 @@ final class PhabricatorSearchResultView extends AphrontView { require_celerity_resource('phabricator-search-results-css'); - $link = phutil_render_tag( + $link = phutil_tag( 'a', array( 'href' => $handle->getURI(), @@ -73,7 +73,7 @@ final class PhabricatorSearchResultView extends AphrontView { '
    '. $img. '
    '. - phutil_render_tag( + phutil_tag( 'a', array( 'class' => 'result-name', @@ -112,7 +112,7 @@ final class PhabricatorSearchResultView extends AphrontView { '\1', $str); } - return $str; + return phutil_safe_html($str); } } diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 18a76bee96..b1e15f43e1 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -223,12 +223,12 @@ final class PhabricatorSlowvotePollController } if ($comment_markup) { - $comment_markup = phutil_render_tag( + $comment_markup = phutil_tag( 'table', array( 'class' => 'phabricator-slowvote-comments', ), - implode("\n", $comment_markup)); + new PhutilSafeHTML(implode("\n", $comment_markup))); } else { $comment_markup = null; } @@ -301,12 +301,12 @@ final class PhabricatorSlowvotePollController $checked_class = null; } - return phutil_render_tag( + return phutil_tag( 'label', array( 'class' => 'phabricator-slowvote-label '.$checked_class, ), - $input.phutil_escape_html($option->getName())); + array($input, $option->getName())); } private function renderVoteCount( diff --git a/src/applications/uiexample/examples/JavelinUIExample.php b/src/applications/uiexample/examples/JavelinUIExample.php index 9b86f3f9a6..5c9096d1e8 100644 --- a/src/applications/uiexample/examples/JavelinUIExample.php +++ b/src/applications/uiexample/examples/JavelinUIExample.php @@ -53,13 +53,13 @@ final class JavelinUIExample extends PhabricatorUIExample { ), 'Toggle Blue Background'); - $div = phutil_render_tag( + $div = phutil_tag( 'div', array( 'id' => $container_id, 'class' => 'jxui-example-container jxui-blue-background', ), - $button_red.$button_blue); + array($button_red, $button_blue)); return array($div); } diff --git a/src/applications/xhprof/view/PhabricatorXHProfSampleListView.php b/src/applications/xhprof/view/PhabricatorXHProfSampleListView.php index db08dfbbfc..7bc8117519 100644 --- a/src/applications/xhprof/view/PhabricatorXHProfSampleListView.php +++ b/src/applications/xhprof/view/PhabricatorXHProfSampleListView.php @@ -25,7 +25,7 @@ final class PhabricatorXHProfSampleListView extends AphrontView { $user_phids = mpull($this->samples, 'getUserPHID'); $users = id(new PhabricatorObjectHandleData($user_phids))->loadObjects(); foreach ($this->samples as $sample) { - $sample_link = phutil_render_tag( + $sample_link = phutil_tag( 'a', array( 'href' => '/xhprof/profile/'.$sample->getFilePHID().'/', diff --git a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php index ba773721e1..f3aca0dc9f 100644 --- a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php +++ b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php @@ -100,12 +100,12 @@ final class PhabricatorInlineSummaryView extends AphrontView { } } - return phutil_render_tag( + return phutil_tag( 'table', array( 'class' => 'phabricator-inline-summary-table', ), - implode("\n", $rows)); + new PhutilSafeHTML(implode("\n", $rows))); } } diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php index 1c5f976ec4..b2219ad428 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php @@ -46,19 +46,21 @@ final class PhabricatorRemarkupRuleCountdown extends PhutilRemarkupRule { foreach ($metadata as $id => $info) { list($time, $token) = $info; - $count = phutil_render_tag( + $count = phutil_tag( 'span', array( 'id' => $id, ), - javelin_render_tag('span', - array('sigil' => 'phabricator-timer-days'), '').'d'. - javelin_render_tag('span', - array('sigil' => 'phabricator-timer-hours'), '').'h'. - javelin_render_tag('span', - array('sigil' => 'phabricator-timer-minutes'), '').'m'. - javelin_render_tag('span', - array('sigil' => 'phabricator-timer-seconds'), '').'s'); + array( + javelin_render_tag('span', + array('sigil' => 'phabricator-timer-days'), '').'d', + javelin_render_tag('span', + array('sigil' => 'phabricator-timer-hours'), '').'h', + javelin_render_tag('span', + array('sigil' => 'phabricator-timer-minutes'), '').'m', + javelin_render_tag('span', + array('sigil' => 'phabricator-timer-seconds'), '').'s', + )); Javelin::initBehavior('countdown-timer', array( 'timestamp' => $time, 'container' => $id, diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php index 72851c048d..6426f27fa0 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php @@ -151,7 +151,7 @@ final class PhabricatorRemarkupRuleEmbedFile } if ($layout_class) { - $embed = phutil_render_tag( + $embed = phutil_tag( 'div', array( 'class' => $layout_class, diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php index 5d11ae0131..b81c37cc2f 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObjectName.php @@ -40,7 +40,7 @@ abstract class PhabricatorRemarkupRuleObjectName } return $this->getEngine()->storeText( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $href, diff --git a/src/view/control/AphrontPagerView.php b/src/view/control/AphrontPagerView.php index a0d98d8dbe..00a405273d 100644 --- a/src/view/control/AphrontPagerView.php +++ b/src/view/control/AphrontPagerView.php @@ -187,7 +187,7 @@ final class AphrontPagerView extends AphrontView { list($index, $label, $class) = $link; $display_index = $this->getDisplayIndex($index); $link = $base_uri->alter($parameter, $display_index); - $rendered_links[] = phutil_render_tag( + $rendered_links[] = phutil_tag( 'a', array( 'href' => $link, diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index d723907554..92be011692 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -302,7 +302,7 @@ final class AphrontTableView extends AphrontView { // (alternatively, we could hard-code the line height). This is gross but // it's not clear that there's a better appraoch. - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'single-display-line-bounds', diff --git a/src/view/control/AphrontTokenizerTemplateView.php b/src/view/control/AphrontTokenizerTemplateView.php index 0eda5ec879..178b313873 100644 --- a/src/view/control/AphrontTokenizerTemplateView.php +++ b/src/view/control/AphrontTokenizerTemplateView.php @@ -53,15 +53,17 @@ final class AphrontTokenizerTemplateView extends AphrontView { 'type' => 'text', )); - return phutil_render_tag( + $content = $tokens; + $content[] = $input; + $content[] = phutil_tag('div', array('style' => 'clear: both;'), ''); + + return phutil_tag( 'div', array( 'id' => $id, 'class' => 'jx-tokenizer-container', ), - implode('', $tokens). - $input. - '
    '); + $content); } private function renderToken($key, $value) { @@ -69,20 +71,22 @@ final class AphrontTokenizerTemplateView extends AphrontView { if ($input_name) { $input_name .= '[]'; } - return phutil_render_tag( + return phutil_tag( 'a', array( 'class' => 'jx-tokenizer-token', ), - phutil_escape_html($value). - phutil_tag( - 'input', - array( - 'type' => 'hidden', - 'name' => $input_name, - 'value' => $key, - )). - ''); + array( + $value, + phutil_tag( + 'input', + array( + 'type' => 'hidden', + 'name' => $input_name, + 'value' => $key, + )). + phutil_tag('span', array('class' => 'jx-tokenizer-x-placeholder'), ''), + )); } } diff --git a/src/view/form/AphrontErrorView.php b/src/view/form/AphrontErrorView.php index d3dc20a0a3..0ff078261b 100644 --- a/src/view/form/AphrontErrorView.php +++ b/src/view/form/AphrontErrorView.php @@ -45,12 +45,12 @@ final class AphrontErrorView extends AphrontView { array(), $error); } - $list = phutil_render_tag( + $list = phutil_tag( 'ul', array( 'class' => 'aphront-error-view-list', ), - implode("\n", $list)); + $list); } else { $list = null; } @@ -79,13 +79,15 @@ final class AphrontErrorView extends AphrontView { 'id' => $this->id, 'class' => 'aphront-error-view '.$more_classes, ), - $title. - phutil_render_tag( - 'div', - array( - 'class' => 'aphront-error-view-body', - ), - $this->renderChildren(). - $list)); + array( + $title, + phutil_render_tag( + 'div', + array( + 'class' => 'aphront-error-view-body', + ), + $this->renderChildren(). + $list), + )); } } diff --git a/src/view/form/control/AphrontFormSelectControl.php b/src/view/form/control/AphrontFormSelectControl.php index bc01e742b3..9896eedef5 100644 --- a/src/view/form/control/AphrontFormSelectControl.php +++ b/src/view/form/control/AphrontFormSelectControl.php @@ -45,12 +45,12 @@ final class AphrontFormSelectControl extends AphrontFormControl { $tags = array(); foreach ($options as $value => $thing) { if (is_array($thing)) { - $tags[] = phutil_render_tag( + $tags[] = phutil_tag( 'optgroup', array( 'label' => $value, ), - implode("\n", self::renderOptions($selected, $thing))); + self::renderOptions($selected, $thing)); } else { $tags[] = phutil_tag( 'option', diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 6b601ff735..1272007c0c 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -118,12 +118,12 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { '')); } - $buttons = phutil_render_tag( + $buttons = phutil_tag( 'div', array( 'class' => 'remarkup-assist-bar', ), - implode('', $buttons)); + $buttons); $monospaced_textareas = null; $monospaced_textareas_class = null; diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index 5aa00d9ddc..b5a6cf5792 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -106,12 +106,12 @@ final class PhabricatorActionView extends AphrontView { $classes[] = 'phabricator-action-view-disabled'; } - return phutil_render_tag( + return phutil_tag( 'li', array( 'class' => implode(' ', $classes), ), - $icon.$item); + array($icon, $item)); } public static function getAvailableIcons() { diff --git a/src/view/layout/PhabricatorCrumbView.php b/src/view/layout/PhabricatorCrumbView.php index 2e422a1951..332d2f5465 100644 --- a/src/view/layout/PhabricatorCrumbView.php +++ b/src/view/layout/PhabricatorCrumbView.php @@ -80,13 +80,13 @@ final class PhabricatorCrumbView extends AphrontView { ''); } - return phutil_render_tag( + return phutil_tag( $this->href ? 'a' : 'span', array( 'href' => $this->href, 'class' => implode(' ', $classes), ), - $icon.$name.$divider); + array($icon, $name, $divider)); } diff --git a/src/view/layout/PhabricatorHeaderView.php b/src/view/layout/PhabricatorHeaderView.php index 8d2d7a911b..60a9e0655e 100644 --- a/src/view/layout/PhabricatorHeaderView.php +++ b/src/view/layout/PhabricatorHeaderView.php @@ -24,19 +24,22 @@ final class PhabricatorHeaderView extends AphrontView { public function render() { require_celerity_resource('phabricator-header-view-css'); - $header = phutil_escape_html($this->header); + $header = array($this->header); if ($this->objectName) { - $header = phutil_tag( - 'a', - array( - 'href' => '/'.$this->objectName, - ), - $this->objectName).' '.$header; + array_unshift( + $header, + phutil_tag( + 'a', + array( + 'href' => '/'.$this->objectName, + ), + $this->objectName), + ' '); } if ($this->tags) { - $header .= phutil_render_tag( + $header[] = phutil_render_tag( 'span', array( 'class' => 'phabricator-header-tags', @@ -49,7 +52,7 @@ final class PhabricatorHeaderView extends AphrontView { array( 'class' => 'phabricator-header-shell', ), - phutil_render_tag( + phutil_tag( 'h1', array( 'class' => 'phabricator-header-view', diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index 018cfe6ac3..662e63a783 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -100,20 +100,20 @@ final class PhabricatorObjectItemView extends AphrontView { ), $spec['label']); - $icon_list[] = phutil_render_tag( + $icon_list[] = phutil_tag( 'li', array( 'class' => 'phabricator-object-item-icon', ), - $label.$icon); + array($label, $icon)); } - $icons = phutil_render_tag( + $icons = phutil_tag( 'ul', array( 'class' => 'phabricator-object-item-icons', ), - implode('', $icon_list)); + $icon_list); } $attrs = null; @@ -135,12 +135,12 @@ final class PhabricatorObjectItemView extends AphrontView { ($first ? null : $spacer).$attribute); $first = false; } - $attrs = phutil_render_tag( + $attrs = phutil_tag( 'ul', array( 'class' => 'phabricator-object-item-attributes', ), - implode('', $attrs)); + $attrs); } $classes = array(); @@ -165,12 +165,12 @@ final class PhabricatorObjectItemView extends AphrontView { ), $header.$attrs.$this->renderChildren()); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => implode(' ', $classes), ), - $icons.$content); + array($icons, $content)); } } diff --git a/src/view/layout/PhabricatorPinboardItemView.php b/src/view/layout/PhabricatorPinboardItemView.php index 7f97928c31..ed8b2e2998 100644 --- a/src/view/layout/PhabricatorPinboardItemView.php +++ b/src/view/layout/PhabricatorPinboardItemView.php @@ -34,7 +34,7 @@ final class PhabricatorPinboardItemView extends AphrontView { $header = null; if ($this->header) { $header = hsprintf('%s', $this->uri, $this->header); - $header = phutil_render_tag( + $header = phutil_tag( 'div', array( 'class' => 'phabricator-pinboard-item-header', @@ -66,14 +66,12 @@ final class PhabricatorPinboardItemView extends AphrontView { $content); } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-pinboard-item-view', ), - $header. - $image. - $content); + array($header, $image, $content)); } } diff --git a/src/view/layout/PhabricatorPropertyListView.php b/src/view/layout/PhabricatorPropertyListView.php index 4fb140b04b..d89ee97fb4 100644 --- a/src/view/layout/PhabricatorPropertyListView.php +++ b/src/view/layout/PhabricatorPropertyListView.php @@ -131,9 +131,13 @@ final class PhabricatorPropertyListView extends AphrontView { array( 'class' => 'phabricator-property-list-container', ), - $list. - '
    ' - ); + array( + $list, + phutil_tag( + 'div', + array('class' => 'phabriator-property-list-view-end'), + ''), + )); } private function renderSectionPart(array $part) { diff --git a/src/view/layout/PhabricatorTagView.php b/src/view/layout/PhabricatorTagView.php index 8755c048ef..c28ba9cecd 100644 --- a/src/view/layout/PhabricatorTagView.php +++ b/src/view/layout/PhabricatorTagView.php @@ -109,12 +109,12 @@ final class PhabricatorTagView extends AphrontView { $dot = null; } - $content = phutil_render_tag( + $content = phutil_tag( 'span', array( 'class' => 'phabricator-tag-core '.$color, ), - $dot.phutil_escape_html($this->name)); + array($dot, $this->name)); if ($this->barColor) { $barcolor = 'phabricator-tag-color-'.$this->barColor; @@ -129,13 +129,13 @@ final class PhabricatorTagView extends AphrontView { $bar = null; } - return phutil_render_tag( + return phutil_tag( $this->href ? 'a' : 'span', array( 'href' => $this->href, 'class' => implode(' ', $classes), ), - $bar.$content); + array($bar, $content)); } public static function getTagTypes() { diff --git a/src/view/layout/PhabricatorTimelineEventView.php b/src/view/layout/PhabricatorTimelineEventView.php index 7b0eb5546b..4359a5c9c0 100644 --- a/src/view/layout/PhabricatorTimelineEventView.php +++ b/src/view/layout/PhabricatorTimelineEventView.php @@ -273,7 +273,7 @@ final class PhabricatorTimelineEventView extends AphrontView { ->setAnchorName($this->anchor) ->render(); - $date = $anchor.phutil_render_tag( + $date = $anchor.phutil_tag( 'a', array( 'href' => '#'.$this->anchor, diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index 65bd6cddc0..a8ada196e7 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -327,14 +327,14 @@ final class PhabricatorMainMenuView extends AphrontView { $container_classes[] = 'alert-unread'; } - $bubble_tag = phutil_render_tag( + $bubble_tag = phutil_tag( 'a', array( 'href' => '/notification/', 'class' => implode(' ', $container_classes), 'id' => $bubble_id, ), - $icon_tag.$count_tag); + array($icon_tag, $count_tag)); Javelin::initBehavior( 'aphlict-dropdown', -- 2.51.2 From 9670f0c6368e393948d27d99b4746e29a9412342 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 17 Jan 2013 18:47:13 -0800 Subject: [PATCH 06/50] Convert phutil_render_tag(X, Y, phutil_render_tag(...)) to phutil_render_html Summary: Created with spatch: lang=diff - phutil_render_tag + phutil_render_html (X, Y, phutil_render_tag(...)) - phutil_render_tag + phutil_render_html (X, Y, phutil_render_html(...)) Test Plan: Loaded homepage Reviewers: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4502 --- .../config/controller/PhabricatorConfigEditController.php | 2 +- .../render/DifferentialChangesetTwoUpRenderer.php | 4 ++-- .../phame/controller/post/PhamePostPublishController.php | 2 +- src/applications/phame/view/PhamePostView.php | 2 +- .../controller/PhabricatorSlowvotePollController.php | 2 +- src/view/layout/PhabricatorHeaderView.php | 2 +- src/view/layout/PhabricatorPinboardItemView.php | 2 +- src/view/layout/PhabricatorSourceCodeView.php | 6 +++--- src/view/layout/PhabricatorTimelineEventView.php | 2 +- src/view/page/menu/PhabricatorMainMenuView.php | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index c0b5dcab9f..5983bbc1ae 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -137,7 +137,7 @@ final class PhabricatorConfigEditController array( 'class' => 'phabricator-remarkup', ), - $engine->getOutput($option, 'description')); + phutil_safe_html($engine->getOutput($option, 'description'))); $form ->setUser($user) diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 337dd9a625..20c2920e6e 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -337,7 +337,7 @@ final class DifferentialChangesetTwoUpRenderer $vs = 0) { $old = null; if ($old_file) { - $old = phutil_render_tag( + $old = phutil_tag( 'div', array( 'class' => 'differential-image-stage' @@ -353,7 +353,7 @@ final class DifferentialChangesetTwoUpRenderer $new = null; if ($new_file) { - $new = phutil_render_tag( + $new = phutil_tag( 'div', array( 'class' => 'differential-image-stage' diff --git a/src/applications/phame/controller/post/PhamePostPublishController.php b/src/applications/phame/controller/post/PhamePostPublishController.php index 0a04ec542e..2a456fe394 100644 --- a/src/applications/phame/controller/post/PhamePostPublishController.php +++ b/src/applications/phame/controller/post/PhamePostPublishController.php @@ -70,7 +70,7 @@ final class PhamePostPublishController extends PhameController { // TODO: Clean up this CSS. - return phutil_render_tag( + return phutil_tag( 'div', array( 'style' => 'text-align: center; padding: 1em;', diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index 582e32ccf7..533d4402a5 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -59,7 +59,7 @@ final class PhamePostView extends AphrontView { public function renderTitle() { $href = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()); - return phutil_render_tag( + return phutil_tag( 'h2', array( 'class' => 'phame-post-title', diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index b1e15f43e1..531ddaba61 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -401,7 +401,7 @@ final class PhabricatorSlowvotePollController $profile_image = $handle->getImageURI(); - $user_markup[] = phutil_render_tag( + $user_markup[] = phutil_tag( 'a', array( 'href' => $handle->getURI(), diff --git a/src/view/layout/PhabricatorHeaderView.php b/src/view/layout/PhabricatorHeaderView.php index 60a9e0655e..7d8a6e5109 100644 --- a/src/view/layout/PhabricatorHeaderView.php +++ b/src/view/layout/PhabricatorHeaderView.php @@ -47,7 +47,7 @@ final class PhabricatorHeaderView extends AphrontView { self::renderSingleView($this->tags)); } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-header-shell', diff --git a/src/view/layout/PhabricatorPinboardItemView.php b/src/view/layout/PhabricatorPinboardItemView.php index ed8b2e2998..76cf5104ba 100644 --- a/src/view/layout/PhabricatorPinboardItemView.php +++ b/src/view/layout/PhabricatorPinboardItemView.php @@ -42,7 +42,7 @@ final class PhabricatorPinboardItemView extends AphrontView { $header); } - $image = phutil_render_tag( + $image = phutil_tag( 'a', array( 'href' => $this->uri, diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php index 49768fc1f8..790ea663d3 100644 --- a/src/view/layout/PhabricatorSourceCodeView.php +++ b/src/view/layout/PhabricatorSourceCodeView.php @@ -66,17 +66,17 @@ final class PhabricatorSourceCodeView extends AphrontView { $classes[] = 'remarkup-code'; $classes[] = 'PhabricatorMonospaced'; - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-source-code-container', ), - phutil_render_tag( + phutil_tag( 'table', array( 'class' => implode(' ', $classes), ), - implode('', $rows))); + new PhutilSafeHTML(implode('', $rows)))); } } diff --git a/src/view/layout/PhabricatorTimelineEventView.php b/src/view/layout/PhabricatorTimelineEventView.php index 4359a5c9c0..63f7af3cdc 100644 --- a/src/view/layout/PhabricatorTimelineEventView.php +++ b/src/view/layout/PhabricatorTimelineEventView.php @@ -117,7 +117,7 @@ final class PhabricatorTimelineEventView extends AphrontView { if ($this->icon) { $title_classes[] = 'phabricator-timeline-title-with-icon'; - $icon = phutil_render_tag( + $icon = phutil_tag( 'span', array( 'class' => 'phabricator-timeline-icon-fill', diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index a8ada196e7..e833a6f828 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -271,7 +271,7 @@ final class PhabricatorMainMenuView extends AphrontView { } private function renderPhabricatorLogo() { - return phutil_render_tag( + return phutil_tag( 'a', array( 'class' => 'phabricator-main-menu-logo', -- 2.51.2 From 3e147dd61cada45e8f798f7af672622a87f384d9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 25 Jan 2013 05:50:50 -0800 Subject: [PATCH 07/50] Fix some easy phutil_render_tag() Summary: - Grepped for phutil_render_tag(). - Fixed some easy ones. Test Plan: - Browsed around; site didn't seem more broken than it was before. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4638 --- .../controller/ConpherenceController.php | 6 +- .../controller/ConpherenceListController.php | 66 +++++++++---------- .../controller/ConpherenceNewController.php | 8 +-- .../ConpherenceUpdateController.php | 2 +- .../view/ConpherenceMenuItemView.php | 20 +++--- .../view/ConpherenceTransactionView.php | 5 +- .../PhabricatorCountdownViewController.php | 4 +- .../view/PhabricatorApplicationLaunchView.php | 6 +- .../pholio/view/PholioMockImagesView.php | 4 +- .../PhabricatorRepositoryDeleteController.php | 10 ++- .../view/PhabricatorInlineSummaryView.php | 8 ++- .../rule/PhabricatorRemarkupRuleMeme.php | 2 +- src/view/control/AphrontTableView.php | 10 ++- .../PhabricatorObjectSelectorDialog.php | 2 +- src/view/page/PhabricatorStandardPageView.php | 4 +- 15 files changed, 82 insertions(+), 75 deletions(-) diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index c5c6f0e5ec..6c537f0006 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -166,14 +166,12 @@ abstract class ConpherenceController extends PhabricatorController { } private function getNoConpherencesBlock() { - - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'no-conpherences-menu-item' ), - pht('No more conpherences.') - ); + pht('No more conpherences.')); } public function buildApplicationMenu() { diff --git a/src/applications/conpherence/controller/ConpherenceListController.php b/src/applications/conpherence/controller/ConpherenceListController.php index 80ef89d66a..73f845c94c 100644 --- a/src/applications/conpherence/controller/ConpherenceListController.php +++ b/src/applications/conpherence/controller/ConpherenceListController.php @@ -69,50 +69,48 @@ final class ConpherenceListController extends private function renderEmptyMainPane() { $this->initJavelinBehaviors(); - return phutil_render_tag( + return phutil_tag( 'div', array( 'id' => 'conpherence-main-pane' ), - phutil_render_tag( - 'div', - array( - 'class' => 'conpherence-header-pane', - 'id' => 'conpherence-header-pane', - ), - '' - ). - phutil_render_tag( - 'div', - array( - 'class' => 'conpherence-widget-pane', - 'id' => 'conpherence-widget-pane' - ), - '' - ). - javelin_render_tag( - 'div', - array( - 'class' => 'conpherence-message-pane', - 'id' => 'conpherence-message-pane' - ), - phutil_render_tag( + array( + phutil_tag( 'div', array( - 'class' => 'conpherence-messages', - 'id' => 'conpherence-messages' + 'class' => 'conpherence-header-pane', + 'id' => 'conpherence-header-pane', ), - '' - ). - phutil_render_tag( + ''), + phutil_tag( 'div', array( - 'id' => 'conpherence-form' + 'class' => 'conpherence-widget-pane', + 'id' => 'conpherence-widget-pane' ), - '' - ) - ) - ); + ''), + phutil_tag( + 'div', + array( + 'class' => 'conpherence-message-pane', + 'id' => 'conpherence-message-pane' + ), + array( + phutil_tag( + 'div', + array( + 'class' => 'conpherence-messages', + 'id' => 'conpherence-messages' + ), + ''), + phutil_tag( + 'div', + array( + 'id' => 'conpherence-form' + ), + ''), + )), + )); } diff --git a/src/applications/conpherence/controller/ConpherenceNewController.php b/src/applications/conpherence/controller/ConpherenceNewController.php index 1d0f082099..a167304e63 100644 --- a/src/applications/conpherence/controller/ConpherenceNewController.php +++ b/src/applications/conpherence/controller/ConpherenceNewController.php @@ -92,10 +92,10 @@ final class ConpherenceNewController extends ConpherenceController { ->setTitle('Success') ->addCancelButton('#', 'Okay') ->appendChild( - phutil_render_tag('p', - array(), - pht('Message sent successfully.') - ) + phutil_tag( + 'p', + array(), + pht('Message sent successfully.')) ); $response = id(new AphrontDialogResponse()) ->setDialog($dialog); diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php index 51f1e66bc4..baa2fc92ef 100644 --- a/src/applications/conpherence/controller/ConpherenceUpdateController.php +++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php @@ -182,7 +182,7 @@ final class ConpherenceUpdateController extends ->appendChild( id(new AphrontFormMarkupControl()) ->setLabel(pht('Image')) - ->setValue(phutil_render_tag( + ->setValue(phutil_tag( 'img', array( 'src' => $conpherence->loadImageURI(), diff --git a/src/applications/conpherence/view/ConpherenceMenuItemView.php b/src/applications/conpherence/view/ConpherenceMenuItemView.php index b2e7cbccd0..44ec161179 100644 --- a/src/applications/conpherence/view/ConpherenceMenuItemView.php +++ b/src/applications/conpherence/view/ConpherenceMenuItemView.php @@ -85,7 +85,7 @@ final class ConpherenceMenuItemView extends AphrontTagView { protected function getTagContent() { $image = null; if ($this->imageURI) { - $image = phutil_render_tag( + $image = phutil_tag( 'span', array( 'class' => 'conpherence-menu-item-image', @@ -95,34 +95,34 @@ final class ConpherenceMenuItemView extends AphrontTagView { } $title = null; if ($this->title) { - $title = phutil_render_tag( + $title = phutil_tag( 'span', array( 'class' => 'conpherence-menu-item-title', ), - phutil_escape_html($this->title)); + $this->title); } $subtitle = null; if ($this->subtitle) { - $subtitle = phutil_render_tag( + $subtitle = phutil_tag( 'span', array( 'class' => 'conpherence-menu-item-subtitle', ), - phutil_escape_html($this->subtitle)); + $this->subtitle); } $message = null; if ($this->messageText) { - $message = phutil_render_tag( + $message = phutil_tag( 'span', array( 'class' => 'conpherence-menu-item-message-text' ), - phutil_escape_html($this->messageText)); + $this->messageText); } $epoch = null; if ($this->epoch) { - $epoch = phutil_render_tag( + $epoch = phutil_tag( 'span', array( 'class' => 'conpherence-menu-item-date', @@ -131,12 +131,12 @@ final class ConpherenceMenuItemView extends AphrontTagView { } $unread_count = null; if ($this->unreadCount) { - $unread_count = phutil_render_tag( + $unread_count = phutil_tag( 'span', array( 'class' => 'conpherence-menu-item-unread-count' ), - $this->unreadCount); + (int)$this->unreadCount); } return $image.$title.$subtitle.$message.$epoch.$unread_count; diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php index d60f648414..c44b80faa5 100644 --- a/src/applications/conpherence/view/ConpherenceTransactionView.php +++ b/src/applications/conpherence/view/ConpherenceTransactionView.php @@ -47,12 +47,11 @@ final class ConpherenceTransactionView extends AphrontView { case ConpherenceTransactionType::TYPE_PICTURE: $img = $transaction->getHandle($transaction->getNewValue()); $content = $transaction->getTitle() . - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $img->getImageURI() - ) - ); + )); $transaction_view->addClass('conpherence-edited'); break; case ConpherenceTransactionType::TYPE_PARTICIPANTS: diff --git a/src/applications/countdown/controller/PhabricatorCountdownViewController.php b/src/applications/countdown/controller/PhabricatorCountdownViewController.php index 48a51ed1c0..494f918308 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownViewController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownViewController.php @@ -23,13 +23,13 @@ final class PhabricatorCountdownViewController $chrome_visible = $request->getBool('chrome', true); $chrome_new = $chrome_visible ? false : null; - $chrome_link = phutil_render_tag( + $chrome_link = phutil_tag( 'a', array( 'href' => $request->getRequestURI()->alter('chrome', $chrome_new), 'class' => 'phabricator-timer-chrome-link', ), - $chrome_visible ? 'Disable Chrome' : 'Enable Chrome'); + $chrome_visible ? pht('Disable Chrome') : pht('Enable Chrome')); $container = celerity_generate_unique_node_id(); $content = diff --git a/src/applications/meta/view/PhabricatorApplicationLaunchView.php b/src/applications/meta/view/PhabricatorApplicationLaunchView.php index e3997c0c0b..566783c5e2 100644 --- a/src/applications/meta/view/PhabricatorApplicationLaunchView.php +++ b/src/applications/meta/view/PhabricatorApplicationLaunchView.php @@ -39,7 +39,7 @@ final class PhabricatorApplicationLaunchView extends AphrontView { $application->getName()); if ($application->isBeta()) { - $content[] = phutil_render_tag( + $content[] = phutil_tag( 'span', array( 'class' => 'phabricator-application-beta', @@ -97,13 +97,13 @@ final class PhabricatorApplicationLaunchView extends AphrontView { $classes[] = 'phabricator-application-create-icon'; $classes[] = 'sprite-icon'; $classes[] = 'action-new-grey'; - $plus_icon = phutil_render_tag( + $plus_icon = phutil_tag( 'span', array( 'class' => implode(' ', $classes), )); - $create_button = phutil_render_tag( + $create_button = phutil_tag( 'a', array( 'href' => $application->getQuickCreateURI(), diff --git a/src/applications/pholio/view/PholioMockImagesView.php b/src/applications/pholio/view/PholioMockImagesView.php index 47383f5918..5658fded90 100644 --- a/src/applications/pholio/view/PholioMockImagesView.php +++ b/src/applications/pholio/view/PholioMockImagesView.php @@ -21,7 +21,7 @@ final class PholioMockImagesView extends AphrontView { "phid=%s", $image->getFilePHID()); - $image_tag = phutil_render_tag( + $image_tag = phutil_tag( 'img', array( 'src' => $file->getBestURI(), @@ -29,7 +29,7 @@ final class PholioMockImagesView extends AphrontView { ), ''); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'pholio-mock-image-container', diff --git a/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php b/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php index 4ab58929c9..da47f4304d 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php @@ -28,12 +28,18 @@ final class PhabricatorRepositoryDeleteController phutil_escape_html($repository->getCallsign()); $text_2 = pht('Repositories touch many objects and as such deletes are '. 'prohibitively expensive to run from the web UI.'); - $body = phutil_render_tag( + $body = phutil_tag( 'div', array( 'class' => 'phabricator-remarkup', ), - '

    '.$text_1.'

    '.$command.'

    '.$text_2.'

    '); + array( + phutil_tag('p', array(), $text_1), + phutil_tag('p', array(), + phutil_tag('tt', array(), $command)), + phutil_tag('p', array(), $text_2), + )); + $dialog ->setUser($request->getUser()) ->setTitle(pht('Really want to delete the repository?')) diff --git a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php index f3aca0dc9f..2fa90c9f01 100644 --- a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php +++ b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php @@ -68,16 +68,18 @@ final class PhabricatorInlineSummaryView extends AphrontView { $tail = null; } - $lines = phutil_escape_html($lines); if ($href) { - $lines = phutil_render_tag( + $lines = phutil_tag( 'a', array( 'href' => $href, 'target' => $target, 'class' => 'num', ), - $lines.$tail); + array( + $lines, + $tail, + )); } $where = idx($item, 'where'); diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php index 5b5135bc11..1254d044ad 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleMeme.php @@ -30,7 +30,7 @@ final class PhabricatorRemarkupRuleMeme ->alter('uppertext', $options['above']) ->alter('lowertext', $options['below']); - $img = phutil_render_tag( + $img = phutil_tag( 'img', array( 'src' => (string)$uri, diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index 92be011692..ace3c7b9d1 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -188,13 +188,17 @@ final class AphrontTableView extends AphrontView { ), ''); - $header = phutil_render_tag( + $header = phutil_tag( 'a', array( 'href' => $this->sortURI->alter($this->sortParam, $sort_value), 'class' => 'aphront-table-view-sort-link', ), - $header.' '.$sort_glyph); + array( + $header, + ' ', + $sort_glyph, + )); } if ($classes) { @@ -204,7 +208,7 @@ final class AphrontTableView extends AphrontView { } if ($short_headers[$col_num] !== null) { - $header_nodevice = phutil_render_tag( + $header_nodevice = phutil_tag( 'span', array( 'class' => 'aphront-table-view-nodevice', diff --git a/src/view/control/PhabricatorObjectSelectorDialog.php b/src/view/control/PhabricatorObjectSelectorDialog.php index 8361642f67..db60a6ba7c 100644 --- a/src/view/control/PhabricatorObjectSelectorDialog.php +++ b/src/view/control/PhabricatorObjectSelectorDialog.php @@ -91,7 +91,7 @@ final class PhabricatorObjectSelectorDialog { $options = array(); foreach ($this->filters as $key => $label) { - $options[] = phutil_render_tag( + $options[] = phutil_tag( 'option', array( 'value' => $key, diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 02883bb2ac..b1ce431b13 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -249,12 +249,12 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { if ($user && $user->getIsAdmin()) { $open = PhabricatorSetupCheck::getOpenSetupIssueCount(); if ($open) { - $setup_warning = phutil_render_tag( + $setup_warning = phutil_tag( 'div', array( 'class' => 'setup-warning-callout', ), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/config/issue/', -- 2.51.2 From fc6838b890ae1a2bca696955b03f93f0fa4c67e5 Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 25 Jan 2013 12:04:14 -0800 Subject: [PATCH 08/50] Fix double escaping after D4638 Auditors: epriestley --- src/applications/diffusion/view/DiffusionBrowseTableView.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index e603b1aade..0df7e7eb48 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -240,7 +240,7 @@ final class DiffusionBrowseTableView extends DiffusionView { 'History', 'Edit', 'Path', - ($lint ? phutil_escape_html($lint) : 'Lint'), + ($lint ? $lint : 'Lint'), 'Modified', 'Date', 'Time', -- 2.51.2 From 94da7c20335f33e5386a2970dbbee58ac360611c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 25 Jan 2013 08:13:08 -0800 Subject: [PATCH 09/50] Restore string cast for textarea control Summary: Removed in 48561a8b but actually necessary. Test Plan: Differential now renders textareas correctly. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4643 --- src/view/form/control/AphrontFormTextAreaControl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view/form/control/AphrontFormTextAreaControl.php b/src/view/form/control/AphrontFormTextAreaControl.php index 311beaea8e..bd36122ee9 100644 --- a/src/view/form/control/AphrontFormTextAreaControl.php +++ b/src/view/form/control/AphrontFormTextAreaControl.php @@ -72,7 +72,9 @@ class AphrontFormTextAreaControl extends AphrontFormControl { 'id' => $this->getID(), 'placeholder' => $this->getPlaceHolder(), ), - $this->getValue()); + // NOTE: This needs to be string cast, because if we pass `null` the + // tag will be self-closed and some browsers aren't thrilled about that. + (string)$this->getValue()); } } -- 2.51.2 From 3093d1663de4f5b03f99e27848444d12946d21f1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 25 Jan 2013 12:57:17 -0800 Subject: [PATCH 10/50] Add javelin_tag(), convert easy callsites Summary: - Implements `javelin_tag()`, which is `javelin_render_tag()` on top of `phutil_tag()` instead of `phutil_render_tag()`. - Manually converts all or almost all of the trivial callsites. Test Plan: - Site does not seem any more broken than before. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4639 --- src/aphront/console/DarkConsoleCore.php | 4 +- .../view/AphrontCalendarMonthView.php | 6 +-- .../controller/ConpherenceViewController.php | 44 ++++++++++--------- .../PhabricatorCountdownListController.php | 2 +- .../PhabricatorCountdownViewController.php | 8 ++-- ...ifferentialReviewersFieldSpecification.php | 2 +- .../DifferentialChangesetHTMLRenderer.php | 2 +- .../DifferentialChangesetTwoUpRenderer.php | 10 ++--- ...rentialChangesetFileTreeSideNavBuilder.php | 4 +- .../view/DifferentialChangesetListView.php | 12 ++--- .../DifferentialDiffTableOfContentsView.php | 10 ++--- .../DifferentialInlineCommentEditView.php | 2 +- .../view/DifferentialInlineCommentView.php | 14 +++--- .../DifferentialRevisionCommentListView.php | 2 +- .../view/DifferentialRevisionListView.php | 2 +- .../DifferentialRevisionUpdateHistoryView.php | 2 +- .../DiffusionBrowseFileController.php | 10 ++--- .../DiffusionCommitEditController.php | 6 +-- .../view/DiffusionCommitChangeTableView.php | 4 +- .../view/DiffusionHistoryTableView.php | 2 +- .../diffusion/view/DiffusionView.php | 4 +- .../controller/HeraldRuleController.php | 10 ++--- .../herald/view/HeraldRuleListView.php | 2 +- .../ManiphestBatchEditController.php | 4 +- .../controller/ManiphestReportController.php | 10 ++--- .../ManiphestSavedQueryListController.php | 2 +- .../ManiphestTaskEditController.php | 2 +- .../ManiphestTaskListController.php | 6 +-- .../view/ManiphestTaskProjectsView.php | 4 +- .../view/ManiphestTaskSummaryView.php | 7 ++- .../view/ManiphestTransactionDetailView.php | 2 +- .../PhabricatorNotificationListController.php | 2 +- .../PhabricatorOwnersDetailController.php | 2 +- .../PhabricatorOwnersEditController.php | 4 +- .../view/PhortuneStripePaymentFormView.php | 6 +-- .../ponder/view/PonderVotableView.php | 8 ++-- ...habricatorProjectMembersEditController.php | 2 +- .../PhabricatorProjectProfileController.php | 2 +- .../PhabricatorRepositoryListController.php | 2 +- ...PhabricatorSettingsPanelEmailAddresses.php | 8 ++-- .../panel/PhabricatorSettingsPanelSSHKeys.php | 2 +- .../uiexample/examples/JavelinUIExample.php | 4 +- .../PhabricatorUINotificationExample.php | 2 +- .../examples/PhabricatorUITooltipExample.php | 4 +- .../PhabricatorXHProfProfileTopLevelView.php | 4 +- .../PhabricatorInlineCommentController.php | 4 +- src/infrastructure/javelin/markup.php | 16 ++++++- .../rule/PhabricatorRemarkupRuleCountdown.php | 8 ++-- .../rule/PhabricatorRemarkupRuleEmbedFile.php | 2 +- src/view/AphrontDialogView.php | 10 ++--- src/view/control/AphrontAttachedFileView.php | 2 +- .../control/AphrontTokenizerTemplateView.php | 2 +- .../control/AphrontTypeaheadTemplateView.php | 10 +++-- .../form/control/AphrontFormDateControl.php | 2 +- .../form/control/AphrontFormTextControl.php | 2 +- .../control/PhabricatorRemarkupControl.php | 2 +- src/view/layout/AphrontMoreView.php | 2 +- src/view/layout/PhabricatorActionView.php | 8 ++-- src/view/layout/PhabricatorAnchorView.php | 2 +- src/view/layout/PhabricatorCrumbsView.php | 7 ++- src/view/layout/PhabricatorFileLinkView.php | 5 +-- .../layout/PhabricatorTimelineEventView.php | 4 +- .../headsup/AphrontHeadsupActionView.php | 4 +- .../page/menu/PhabricatorMainMenuIconView.php | 6 +-- .../menu/PhabricatorMainMenuSearchView.php | 2 +- .../page/menu/PhabricatorMainMenuView.php | 6 +-- 66 files changed, 188 insertions(+), 171 deletions(-) diff --git a/src/aphront/console/DarkConsoleCore.php b/src/aphront/console/DarkConsoleCore.php index 3a886a7a80..2a60c24bd1 100644 --- a/src/aphront/console/DarkConsoleCore.php +++ b/src/aphront/console/DarkConsoleCore.php @@ -97,7 +97,7 @@ final class DarkConsoleCore { $tabclass = null; } - $tabs_markup[] = javelin_render_tag( + $tabs_markup[] = javelin_tag( 'a', array( 'class' => "dark-console-tab {$tabclass}", @@ -173,7 +173,7 @@ final class DarkConsoleCore { ), '
    '. ''. - javelin_render_tag('td', + javelin_tag('td', array('sigil' => 'phabricator-timer-days'), ''). - javelin_render_tag('td', + javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), ''). - javelin_render_tag('td', + javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), ''). - javelin_render_tag('td', + javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), ''). '
    '.$addview->render().'
    '. - javelin_render_tag( + phutil_tag( 'a', array( 'class' => 'dark-console-tab dark-console-tab-selected', diff --git a/src/applications/calendar/view/AphrontCalendarMonthView.php b/src/applications/calendar/view/AphrontCalendarMonthView.php index 5d175e7594..3367c01d88 100644 --- a/src/applications/calendar/view/AphrontCalendarMonthView.php +++ b/src/applications/calendar/view/AphrontCalendarMonthView.php @@ -291,7 +291,7 @@ final class AphrontCalendarMonthView extends AphrontView { $href = null; } - $text_div = javelin_render_tag( + $text_div = javelin_tag( $tag, array( 'sigil' => 'has-tooltip', @@ -302,9 +302,9 @@ final class AphrontCalendarMonthView extends AphrontView { 'class' => 'aphront-calendar-event-text', 'href' => $href, ), - phutil_escape_html(phutil_utf8_shorten($event->getName(), 32))); + phutil_utf8_shorten($event->getName(), 32)); - return javelin_render_tag( + return javelin_tag( 'div', array( 'class' => implode(' ', $classes), diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 925843c45c..a36e1ab766 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -163,29 +163,33 @@ final class ConpherenceViewController extends array( 'class' => 'widgets-header' ), - javelin_render_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array('widget' => 'widgets-files') + array( + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array('widget' => 'widgets-files') + ), + pht('Files') ), - pht('Files') - ).' | '. - javelin_render_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array('widget' => 'widgets-tasks') + ' | ', + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array('widget' => 'widgets-tasks') + ), + pht('Tasks') ), - pht('Tasks') - ).' | '. - javelin_render_tag( - 'a', - array( - 'sigil' => 'conpherence-change-widget', - 'meta' => array('widget' => 'widgets-calendar') + ' | ', + javelin_tag( + 'a', + array( + 'sigil' => 'conpherence-change-widget', + 'meta' => array('widget' => 'widgets-calendar') + ), + pht('Calendar') ), - pht('Calendar') ) ). phutil_render_tag( diff --git a/src/applications/countdown/controller/PhabricatorCountdownListController.php b/src/applications/countdown/controller/PhabricatorCountdownListController.php index b015eb602f..93e4a916b7 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownListController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownListController.php @@ -36,7 +36,7 @@ final class PhabricatorCountdownListController ), 'Edit'); - $delete_button = javelin_render_tag( + $delete_button = javelin_tag( 'a', array( 'class' => 'small button grey', diff --git a/src/applications/countdown/controller/PhabricatorCountdownViewController.php b/src/applications/countdown/controller/PhabricatorCountdownViewController.php index 494f918308..6e084a3835 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownViewController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownViewController.php @@ -47,13 +47,13 @@ final class PhabricatorCountdownViewController Seconds
    diff --git a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php index 98ec21feb3..b519c3e955 100644 --- a/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialReviewersFieldSpecification.php @@ -146,7 +146,7 @@ final class DifferentialReviewersFieldSpecification $names[] = phutil_escape_html( $this->getHandle($reviewer)->getLinkName()); } - $suffix = ' '.javelin_render_tag( + $suffix = ' '.javelin_tag( 'abbr', array( 'sigil' => 'has-tooltip', diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php index 22bdc721e3..1a60831ac9 100644 --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -321,7 +321,7 @@ abstract class DifferentialChangesetHTMLRenderer $more = null; if ($force !== 'none') { - $more = ' '.javelin_render_tag( + $more = ' '.javelin_tag( 'a', array( 'mustcapture' => true, diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 20c2920e6e..cb22b44341 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -16,7 +16,7 @@ final class DifferentialChangesetTwoUpRenderer $context_not_available = null; if ($hunk_starts) { - $context_not_available = javelin_render_tag( + $context_not_available = javelin_tag( 'tr', array( 'sigil' => 'context-target', @@ -83,7 +83,7 @@ final class DifferentialChangesetTwoUpRenderer $is_first_block = true; } - $contents[] = javelin_render_tag( + $contents[] = javelin_tag( 'a', array( 'href' => '#', @@ -99,7 +99,7 @@ final class DifferentialChangesetTwoUpRenderer : pht("\xE2\x96\xB2 Show 20 Lines")); } - $contents[] = javelin_render_tag( + $contents[] = javelin_tag( 'a', array( 'href' => '#', @@ -119,7 +119,7 @@ final class DifferentialChangesetTwoUpRenderer } if ($len > 40) { - $contents[] = javelin_render_tag( + $contents[] = javelin_tag( 'a', array( 'href' => '#', @@ -235,7 +235,7 @@ final class DifferentialChangesetTwoUpRenderer dirname('/'.$orig_file); } $class = ($orig_type == '-' ? 'new-move' : 'new-copy'); - $n_copy = javelin_render_tag( + $n_copy = javelin_tag( 'td', array( 'meta' => array( diff --git a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php index 1d5be8e265..6ee62cc218 100644 --- a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php +++ b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php @@ -104,7 +104,7 @@ final class DifferentialChangesetFileTreeSideNavBuilder { ), $name); - $filetree[] = javelin_render_tag( + $filetree[] = javelin_tag( $href ? 'a' : 'span', array( 'href' => $href, @@ -112,7 +112,7 @@ final class DifferentialChangesetFileTreeSideNavBuilder { 'title' => $title, 'class' => 'phabricator-filetree-item', ), - $icon.$name_element); + array($icon, $name_element)); } $tree->destroy(); diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index acea5b060d..abbca39906 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -143,7 +143,7 @@ final class DifferentialChangesetListView extends AphrontView { $load = 'Loading...'; $mapping[$uniq_id] = $ref; } else { - $load = javelin_render_tag( + $load = javelin_tag( 'a', array( 'href' => '#'.$uniq_id, @@ -155,7 +155,7 @@ final class DifferentialChangesetListView extends AphrontView { 'sigil' => 'differential-load', 'mustcapture' => true, ), - 'Load'); + pht('Load')); } $detail->appendChild( phutil_tag( @@ -209,13 +209,13 @@ final class DifferentialChangesetListView extends AphrontView { * Render the "Undo" markup for the inline comment undo feature. */ private function renderUndoTemplates() { - $link = javelin_render_tag( + $link = javelin_tag( 'a', array( 'href' => '#', 'sigil' => 'differential-inline-comment-undo', ), - 'Undo'); + pht('Undo')); $div = phutil_tag( 'div', @@ -302,7 +302,7 @@ final class DifferentialChangesetListView extends AphrontView { 'differential-dropdown-menus', array()); - return javelin_render_tag( + return javelin_tag( 'a', array( 'class' => 'button small grey', @@ -311,7 +311,7 @@ final class DifferentialChangesetListView extends AphrontView { 'target' => '_blank', 'sigil' => 'differential-view-options', ), - "View Options \xE2\x96\xBC"); + pht("View Options \xE2\x96\xBC")); } } diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index 818522b2ba..75de304237 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -192,16 +192,14 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { } } - $reveal_link = - javelin_render_tag( + $reveal_link = javelin_tag( 'a', array( 'sigil' => 'differential-reveal-all', 'mustcapture' => true, 'class' => 'button differential-toc-reveal-all', ), - pht('Show All Context') - ); + pht('Show All Context')); $buttons = ''. @@ -256,7 +254,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { private function renderChangesetLink(DifferentialChangeset $changeset, $ref) { $display_file = $changeset->getDisplayFilename(); - return javelin_render_tag( + return javelin_tag( 'a', array( 'href' => '#'.$changeset->getAnchorName(), @@ -266,7 +264,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { ), 'sigil' => 'differential-load', ), - phutil_escape_html($display_file)); + $display_file); } } diff --git a/src/applications/differential/view/DifferentialInlineCommentEditView.php b/src/applications/differential/view/DifferentialInlineCommentEditView.php index 86a2706ce6..9471325c34 100644 --- a/src/applications/differential/view/DifferentialInlineCommentEditView.php +++ b/src/applications/differential/view/DifferentialInlineCommentEditView.php @@ -94,7 +94,7 @@ final class DifferentialInlineCommentEditView extends AphrontView { $buttons = array(); $buttons[] = ''; - $buttons[] = javelin_render_tag( + $buttons[] = javelin_tag( 'button', array( 'sigil' => 'inline-edit-cancel', diff --git a/src/applications/differential/view/DifferentialInlineCommentView.php b/src/applications/differential/view/DifferentialInlineCommentView.php index 09ac5a906b..0340d3287a 100644 --- a/src/applications/differential/view/DifferentialInlineCommentView.php +++ b/src/applications/differential/view/DifferentialInlineCommentView.php @@ -95,7 +95,7 @@ final class DifferentialInlineCommentView extends AphrontView { } if (!$this->preview) { - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'href' => '#', @@ -104,7 +104,7 @@ final class DifferentialInlineCommentView extends AphrontView { ), pht('Previous')); - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'href' => '#', @@ -122,7 +122,7 @@ final class DifferentialInlineCommentView extends AphrontView { // file/line information, and synthetic comments don't have an inline // comment ID. - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'href' => '#', @@ -138,7 +138,7 @@ final class DifferentialInlineCommentView extends AphrontView { $anchor_name = 'inline-'.$inline->getID(); if ($this->editable && !$this->preview) { - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'href' => '#', @@ -146,7 +146,7 @@ final class DifferentialInlineCommentView extends AphrontView { 'sigil' => 'differential-inline-edit', ), pht('Edit')); - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'href' => '#', @@ -155,7 +155,7 @@ final class DifferentialInlineCommentView extends AphrontView { ), pht('Delete')); } else if ($this->preview) { - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'meta' => array( @@ -164,7 +164,7 @@ final class DifferentialInlineCommentView extends AphrontView { 'sigil' => 'differential-inline-preview-jump', ), pht('Not Visible')); - $links[] = javelin_render_tag( + $links[] = javelin_tag( 'a', array( 'href' => '#', diff --git a/src/applications/differential/view/DifferentialRevisionCommentListView.php b/src/applications/differential/view/DifferentialRevisionCommentListView.php index 48d085a75d..8edeaeea81 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentListView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentListView.php @@ -166,7 +166,7 @@ final class DifferentialRevisionCommentListView extends AphrontView { ), '
    '. pht('%d older comments are hidden. ', number_format(count($hidden))). - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '#', diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php index 3d8a9cb89a..b0306deec5 100644 --- a/src/applications/differential/view/DifferentialRevisionListView.php +++ b/src/applications/differential/view/DifferentialRevisionListView.php @@ -111,7 +111,7 @@ final class DifferentialRevisionListView extends AphrontView { if (isset($flagged[$phid])) { $class = PhabricatorFlagColor::getCSSClass($flagged[$phid]->getColor()); $note = $flagged[$phid]->getNote(); - $flag = javelin_render_tag( + $flag = javelin_tag( 'div', $note ? array( 'class' => 'phabricator-flag-icon '.$class, diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index 8e7e9f926c..718d837f53 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -72,7 +72,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { if ($id) { $new_checked = ($this->selectedDiffID == $id); - $new = javelin_render_tag( + $new = javelin_tag( 'input', array( 'type' => 'radio', diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 36bc8443a3..624dbdb9ac 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -605,7 +605,7 @@ final class DiffusionBrowseFileController extends DiffusionController { Javelin::initBehavior('phabricator-tooltips', array()); require_celerity_resource('aphront-tooltip-css'); - $commit_link = javelin_render_tag( + $commit_link = javelin_tag( 'a', array( 'href' => $drequest->generateURI( @@ -620,7 +620,7 @@ final class DiffusionBrowseFileController extends DiffusionController { 'size' => 600, ), ), - phutil_escape_html(phutil_utf8_shorten($line['commit'], 9, ''))); + phutil_utf8_shorten($line['commit'], 9, '')); $revision_id = null; if (idx($commits, $commit)) { @@ -637,7 +637,7 @@ final class DiffusionBrowseFileController extends DiffusionController { " \xC2\xB7 ". $revision->getTitle(); } - $revision_link = javelin_render_tag( + $revision_link = javelin_tag( 'a', array( 'href' => '/D'.$revision_id, @@ -652,7 +652,7 @@ final class DiffusionBrowseFileController extends DiffusionController { } $uri = $line_href->alter('before', $commit); - $before_link = javelin_render_tag( + $before_link = javelin_tag( 'a', array( 'href' => $uri->setQueryParam('view', 'blame'), @@ -706,7 +706,7 @@ final class DiffusionBrowseFileController extends DiffusionController { ), $line['line']); - $blame[] = javelin_render_tag( + $blame[] = javelin_tag( 'th', array( 'class' => 'diffusion-line-link', diff --git a/src/applications/diffusion/controller/DiffusionCommitEditController.php b/src/applications/diffusion/controller/DiffusionCommitEditController.php index fcfb0cd42e..c70b47260d 100644 --- a/src/applications/diffusion/controller/DiffusionCommitEditController.php +++ b/src/applications/diffusion/controller/DiffusionCommitEditController.php @@ -62,15 +62,15 @@ final class DiffusionCommitEditController extends DiffusionController { ->setValue($proj_t_values) ->setID($tokenizer_id) ->setCaption( - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create', ), - 'Create New Project')) - ->setDatasource('/typeahead/common/projects/'));; + pht('Create New Project'))) + ->setDatasource('/typeahead/common/projects/'));; Javelin::initBehavior('project-create', array( 'tokenizerID' => $tokenizer_id, diff --git a/src/applications/diffusion/view/DiffusionCommitChangeTableView.php b/src/applications/diffusion/view/DiffusionCommitChangeTableView.php index c3ec644cd7..3d6d5eb7b1 100644 --- a/src/applications/diffusion/view/DiffusionCommitChangeTableView.php +++ b/src/applications/diffusion/view/DiffusionCommitChangeTableView.php @@ -39,7 +39,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView { } if (isset($this->renderingReferences[$id])) { - $path_column = javelin_render_tag( + $path_column = javelin_tag( 'a', array( 'href' => '#'.$hash, @@ -49,7 +49,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView { ), 'sigil' => 'differential-load', ), - phutil_escape_html($path)); + $path); } else { $path_column = phutil_escape_html($path); } diff --git a/src/applications/diffusion/view/DiffusionHistoryTableView.php b/src/applications/diffusion/view/DiffusionHistoryTableView.php index 73dd317a3d..08784f71f7 100644 --- a/src/applications/diffusion/view/DiffusionHistoryTableView.php +++ b/src/applications/diffusion/view/DiffusionHistoryTableView.php @@ -312,7 +312,7 @@ final class DiffusionHistoryTableView extends DiffusionView { // Render into tags for the behavior. foreach ($graph as $k => $meta) { - $graph[$k] = javelin_render_tag( + $graph[$k] = javelin_tag( 'div', array( 'sigil' => 'commit-graph', diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php index 83dff57748..c36ddc1c46 100644 --- a/src/applications/diffusion/view/DiffusionView.php +++ b/src/applications/diffusion/view/DiffusionView.php @@ -144,7 +144,7 @@ abstract class DiffusionView extends AphrontView { if ($email->getDisplayName() && $email->getDomainName()) { Javelin::initBehavior('phabricator-tooltips', array()); require_celerity_resource('aphront-tooltip-css'); - return javelin_render_tag( + return javelin_tag( 'span', array( 'sigil' => 'has-tooltip', @@ -154,7 +154,7 @@ abstract class DiffusionView extends AphrontView { 'size' => 'auto', ), ), - phutil_escape_html($email->getDisplayName())); + $email->getDisplayName()); } return phutil_escape_html($name); } diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index 998e31cca7..8b32bd6ae7 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -100,7 +100,7 @@ final class HeraldRuleController extends HeraldController { ->appendChild( // Build this explicitly (instead of using addHiddenInput()) // so we can add a sigil to it. - javelin_render_tag( + javelin_tag( 'input', array( 'type' => 'hidden', @@ -123,7 +123,7 @@ final class HeraldRuleController extends HeraldController { ->appendChild( id(new AphrontFormInsetView()) ->setTitle('Conditions') - ->setRightButton(javelin_render_tag( + ->setRightButton(javelin_tag( 'a', array( 'href' => '#', @@ -135,7 +135,7 @@ final class HeraldRuleController extends HeraldController { ->setDescription( 'When '.$must_match_selector . ' these conditions are met:') - ->setContent(javelin_render_tag( + ->setContent(javelin_tag( 'table', array( 'sigil' => 'rule-conditions', @@ -145,7 +145,7 @@ final class HeraldRuleController extends HeraldController { ->appendChild( id(new AphrontFormInsetView()) ->setTitle('Action') - ->setRightButton(javelin_render_tag( + ->setRightButton(javelin_tag( 'a', array( 'href' => '#', @@ -156,7 +156,7 @@ final class HeraldRuleController extends HeraldController { 'Create New Action')) ->setDescription('Take these actions '.$repetition_selector. ' this rule matches:') - ->setContent(javelin_render_tag( + ->setContent(javelin_tag( 'table', array( 'sigil' => 'rule-actions', diff --git a/src/applications/herald/view/HeraldRuleListView.php b/src/applications/herald/view/HeraldRuleListView.php index 18aa093b61..d95765ecd7 100644 --- a/src/applications/herald/view/HeraldRuleListView.php +++ b/src/applications/herald/view/HeraldRuleListView.php @@ -58,7 +58,7 @@ final class HeraldRuleListView extends AphrontView { ), 'View Edit Log'); - $delete = javelin_render_tag( + $delete = javelin_tag( 'a', array( 'href' => '/herald/delete/'.$rule->getID().'/', diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 01b656539b..6e1b533e45 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -101,7 +101,7 @@ final class ManiphestBatchEditController extends ManiphestController { $form->appendChild( id(new AphrontFormInsetView()) ->setTitle('Actions') - ->setRightButton(javelin_render_tag( + ->setRightButton(javelin_tag( 'a', array( 'href' => '#', @@ -110,7 +110,7 @@ final class ManiphestBatchEditController extends ManiphestController { 'mustcapture' => true, ), 'Add Another Action')) - ->setContent(javelin_render_tag( + ->setContent(javelin_tag( 'table', array( 'sigil' => 'maniphest-batch-actions', diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index 4b1bf10775..b8ce9c7e5d 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -574,7 +574,7 @@ final class ManiphestReportController extends ManiphestController { } $cname[] = 'Total'; $cclass[] = 'n'; - $cname[] = javelin_render_tag( + $cname[] = javelin_tag( 'span', array( 'sigil' => 'has-tooltip', @@ -585,7 +585,7 @@ final class ManiphestReportController extends ManiphestController { ), 'Oldest (All)'); $cclass[] = 'n'; - $cname[] = javelin_render_tag( + $cname[] = javelin_tag( 'span', array( 'sigil' => 'has-tooltip', @@ -599,7 +599,7 @@ final class ManiphestReportController extends ManiphestController { $cclass[] = 'n'; list($ignored, $window_epoch) = $this->getWindow(); - $cname[] = javelin_render_tag( + $cname[] = javelin_tag( 'span', array( 'sigil' => 'has-tooltip', @@ -745,7 +745,7 @@ final class ManiphestReportController extends ManiphestController { $raw_age = (time() - $oldest->getDateCreated()); $age = number_format($raw_age / (24 * 60 * 60)).' d'; - $link = javelin_render_tag( + $link = javelin_tag( 'a', array( 'href' => '/T'.$oldest->getID(), @@ -755,7 +755,7 @@ final class ManiphestReportController extends ManiphestController { ), 'target' => '_blank', ), - phutil_escape_html($age)); + $age); return array($link, $raw_age); } diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php index ba8fcb1e85..d6377c10b7 100644 --- a/src/applications/maniphest/controller/ManiphestSavedQueryListController.php +++ b/src/applications/maniphest/controller/ManiphestSavedQueryListController.php @@ -61,7 +61,7 @@ final class ManiphestSavedQueryListController extends ManiphestController { 'class' => 'grey small button', ), 'Edit'), - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '/maniphest/custom/delete/'.$query->getID().'/', diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index b2b8fc8f0c..103e342842 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -425,7 +425,7 @@ final class ManiphestTaskEditController extends ManiphestController { ->setValue($projects_value) ->setID($project_tokenizer_id) ->setCaption( - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '/project/create/', diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 1508690729..32952ce5af 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -641,7 +641,7 @@ final class ManiphestTaskListController extends ManiphestController { 'status' => 'batch-select-status-cell', )); - $select_all = javelin_render_tag( + $select_all = javelin_tag( 'a', array( 'href' => '#', @@ -651,7 +651,7 @@ final class ManiphestTaskListController extends ManiphestController { ), 'Select All'); - $select_none = javelin_render_tag( + $select_none = javelin_tag( 'a', array( 'href' => '#', @@ -670,7 +670,7 @@ final class ManiphestTaskListController extends ManiphestController { ), "Batch Edit Selected Tasks \xC2\xBB"); - $export = javelin_render_tag( + $export = javelin_tag( 'a', array( 'href' => '/maniphest/export/'.$search_query->getQueryKey().'/', diff --git a/src/applications/maniphest/view/ManiphestTaskProjectsView.php b/src/applications/maniphest/view/ManiphestTaskProjectsView.php index 5e63043238..358d3145bc 100644 --- a/src/applications/maniphest/view/ManiphestTaskProjectsView.php +++ b/src/applications/maniphest/view/ManiphestTaskProjectsView.php @@ -27,7 +27,7 @@ final class ManiphestTaskProjectsView extends ManiphestView { 'href' => $handle->getURI(), 'class' => 'phabricator-project-tag', ), - phutil_utf8_shorten($handle->getName(), 24)); + phutil_utf8_shorten($handle->getName(), 24)); } if (count($this->handles) > 2) { @@ -39,7 +39,7 @@ final class ManiphestTaskProjectsView extends ManiphestView { $all[] = $handle->getName(); } - $tags[] = javelin_render_tag( + $tags[] = javelin_tag( 'span', array( 'class' => 'phabricator-project-tag', diff --git a/src/applications/maniphest/view/ManiphestTaskSummaryView.php b/src/applications/maniphest/view/ManiphestTaskSummaryView.php index 075bee78dd..20c03b9fe0 100644 --- a/src/applications/maniphest/view/ManiphestTaskSummaryView.php +++ b/src/applications/maniphest/view/ManiphestTaskSummaryView.php @@ -62,15 +62,14 @@ final class ManiphestTaskSummaryView extends ManiphestView { if ($this->showBatchControls) { $batch = ''. - javelin_render_tag( + javelin_tag( 'input', array( 'type' => 'checkbox', 'name' => 'batch[]', 'value' => $task->getID(), 'sigil' => 'maniphest-batch', - ), - null). + )). ''; } @@ -87,7 +86,7 @@ final class ManiphestTaskSummaryView extends ManiphestView { $control_sigil = 'maniphest-task-handle'; } - $handle = javelin_render_tag( + $handle = javelin_tag( 'td', array( 'class' => 'maniphest-task-handle '.$pri_class.' '.$control_class, diff --git a/src/applications/maniphest/view/ManiphestTransactionDetailView.php b/src/applications/maniphest/view/ManiphestTransactionDetailView.php index 320b577c04..99d5aac688 100644 --- a/src/applications/maniphest/view/ManiphestTransactionDetailView.php +++ b/src/applications/maniphest/view/ManiphestTransactionDetailView.php @@ -590,7 +590,7 @@ final class ManiphestTransactionDetailView extends ManiphestView { Javelin::initBehavior('maniphest-transaction-expand'); - return javelin_render_tag( + return javelin_tag( 'a', array( 'href' => '/maniphest/task/descriptionchange/'.$id.'/', diff --git a/src/applications/notification/controller/PhabricatorNotificationListController.php b/src/applications/notification/controller/PhabricatorNotificationListController.php index 3c1bfeedf6..739a70f3ae 100644 --- a/src/applications/notification/controller/PhabricatorNotificationListController.php +++ b/src/applications/notification/controller/PhabricatorNotificationListController.php @@ -61,7 +61,7 @@ final class PhabricatorNotificationListController $panel->setHeader($header); $panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->addButton( - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '/notification/clear/', diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index 5046a740b7..fe07e5767d 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -120,7 +120,7 @@ final class PhabricatorOwnersDetailController $panel->setHeader( 'Package Details for "'.phutil_escape_html($package->getName()).'"'); $panel->addButton( - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '/owners/delete/'.$package->getID().'/', diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php index 9e953d6933..a5aece08d1 100644 --- a/src/applications/owners/controller/PhabricatorOwnersEditController.php +++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php @@ -218,7 +218,7 @@ final class PhabricatorOwnersEditController id(new AphrontFormInsetView()) ->setTitle('Paths') ->addDivAttributes(array('id' => 'path-editor')) - ->setRightButton(javelin_render_tag( + ->setRightButton(javelin_tag( 'a', array( 'href' => '#', @@ -229,7 +229,7 @@ final class PhabricatorOwnersEditController 'Add New Path')) ->setDescription('Specify the files and directories which comprise '. 'this package.') - ->setContent(javelin_render_tag( + ->setContent(javelin_tag( 'table', array( 'class' => 'owners-path-editor-table', diff --git a/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php b/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php index 569f7db994..c77b5b623f 100644 --- a/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php +++ b/src/applications/phortune/stripe/view/PhortuneStripePaymentFormView.php @@ -51,7 +51,7 @@ final class PhortuneStripePaymentFormView extends AphrontView { id(new AphrontFormMarkupControl()) ->setLabel('') ->setValue( - javelin_render_tag( + javelin_tag( 'div', array( 'class' => 'credit-card-logos', @@ -86,7 +86,7 @@ final class PhortuneStripePaymentFormView extends AphrontView { ->setError($this->getCardExpirationError()) ) ->appendChild( - javelin_render_tag( + javelin_tag( 'input', array( 'hidden' => true, @@ -96,7 +96,7 @@ final class PhortuneStripePaymentFormView extends AphrontView { ) ) ->appendChild( - javelin_render_tag( + javelin_tag( 'input', array( 'hidden' => true, diff --git a/src/applications/ponder/view/PonderVotableView.php b/src/applications/ponder/view/PonderVotableView.php index a921a79d11..c4bb4ab726 100644 --- a/src/applications/ponder/view/PonderVotableView.php +++ b/src/applications/ponder/view/PonderVotableView.php @@ -35,7 +35,7 @@ final class PonderVotableView extends AphrontView { $uri = id(new PhutilURI($this->uri))->alter('phid', $this->phid); - $up = javelin_render_tag( + $up = javelin_tag( 'a', array( 'href' => (string)$uri, @@ -45,7 +45,7 @@ final class PonderVotableView extends AphrontView { ), "\xE2\x96\xB2"); - $down = javelin_render_tag( + $down = javelin_tag( 'a', array( 'href' => (string)$uri, @@ -55,13 +55,13 @@ final class PonderVotableView extends AphrontView { ), "\xE2\x96\xBC"); - $count = javelin_render_tag( + $count = javelin_tag( 'div', array( 'class' => 'ponder-vote-count', 'sigil' => 'ponder-vote-count', ), - phutil_escape_html($this->count)); + $this->count); return javelin_render_tag( 'div', diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index ae4adba176..1e89cb307f 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -142,7 +142,7 @@ final class PhabricatorProjectMembersEditController ), ''); - $button = javelin_render_tag( + $button = javelin_tag( 'button', array( 'class' => 'grey', diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index d843874993..4d6e4b8eee 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -98,7 +98,7 @@ final class PhabricatorProjectProfileController ), 'Join Project')); } else { - $action = javelin_render_tag( + $action = javelin_tag( 'a', array( 'href' => '/project/update/'.$project->getID().'/leave/', diff --git a/src/applications/repository/controller/PhabricatorRepositoryListController.php b/src/applications/repository/controller/PhabricatorRepositoryListController.php index fd4b6fb37c..8c4baea1d0 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryListController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryListController.php @@ -43,7 +43,7 @@ final class PhabricatorRepositoryListController 'href' => '/repository/edit/'.$repo->getID().'/', ), 'Edit'), - javelin_render_tag( + javelin_tag( 'a', array( 'class' => 'button small grey', diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php index 057ac4436d..9ad348ed6b 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php @@ -52,7 +52,7 @@ final class PhabricatorSettingsPanelEmailAddresses $rows = array(); foreach ($emails as $email) { - $button_verify = javelin_render_tag( + $button_verify = javelin_tag( 'a', array( 'class' => 'button small grey', @@ -61,7 +61,7 @@ final class PhabricatorSettingsPanelEmailAddresses ), 'Verify'); - $button_make_primary = javelin_render_tag( + $button_make_primary = javelin_tag( 'a', array( 'class' => 'button small grey', @@ -70,7 +70,7 @@ final class PhabricatorSettingsPanelEmailAddresses ), 'Make Primary'); - $button_remove = javelin_render_tag( + $button_remove = javelin_tag( 'a', array( 'class' => 'button small grey', @@ -133,7 +133,7 @@ final class PhabricatorSettingsPanelEmailAddresses $view = new AphrontPanelView(); if ($editable) { $view->addButton( - javelin_render_tag( + javelin_tag( 'a', array( 'href' => $uri->alter('new', 'true'), diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php index a0b6b06616..133c45ec9c 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php @@ -186,7 +186,7 @@ final class PhabricatorSettingsPanelSSHKeys phutil_escape_html($key->getKeyType()), phabricator_date($key->getDateCreated(), $user), phabricator_time($key->getDateCreated(), $user), - javelin_render_tag( + javelin_tag( 'a', array( 'href' => $this->getPanelURI('?delete='.$key->getID()), diff --git a/src/applications/uiexample/examples/JavelinUIExample.php b/src/applications/uiexample/examples/JavelinUIExample.php index 5c9096d1e8..5976066bd2 100644 --- a/src/applications/uiexample/examples/JavelinUIExample.php +++ b/src/applications/uiexample/examples/JavelinUIExample.php @@ -20,7 +20,7 @@ final class JavelinUIExample extends PhabricatorUIExample { $button_red_id = celerity_generate_unique_node_id(); $button_blue_id = celerity_generate_unique_node_id(); - $button_red = javelin_render_tag( + $button_red = javelin_tag( 'a', array( 'class' => 'button', @@ -36,7 +36,7 @@ final class JavelinUIExample extends PhabricatorUIExample { ), 'Toggle Red Border'); - $button_blue = javelin_render_tag( + $button_blue = javelin_tag( 'a', array( 'class' => 'button jxui-active', diff --git a/src/applications/uiexample/examples/PhabricatorUINotificationExample.php b/src/applications/uiexample/examples/PhabricatorUINotificationExample.php index c112a33fcd..031bb42c30 100644 --- a/src/applications/uiexample/examples/PhabricatorUINotificationExample.php +++ b/src/applications/uiexample/examples/PhabricatorUINotificationExample.php @@ -15,7 +15,7 @@ final class PhabricatorUINotificationExample extends PhabricatorUIExample { require_celerity_resource('phabricator-notification-css'); Javelin::initBehavior('phabricator-notification-example'); - $content = javelin_render_tag( + $content = javelin_tag( 'a', array( 'sigil' => 'notification-example', diff --git a/src/applications/uiexample/examples/PhabricatorUITooltipExample.php b/src/applications/uiexample/examples/PhabricatorUITooltipExample.php index 77a346510b..9f806e3516 100644 --- a/src/applications/uiexample/examples/PhabricatorUITooltipExample.php +++ b/src/applications/uiexample/examples/PhabricatorUITooltipExample.php @@ -89,14 +89,14 @@ EOTEXT; $content = array(); foreach ($metas as $key => $meta) { - $content[] = javelin_render_tag( + $content[] = javelin_tag( 'div', array( 'sigil' => 'has-tooltip', 'meta' => $meta, 'style' => $style, ), - phutil_escape_html($key)); + $key); } return $content; diff --git a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php index cd20ac4f39..12326bb16d 100644 --- a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php +++ b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php @@ -84,7 +84,7 @@ final class PhabricatorXHProfProfileTopLevelView array( 'Symbol', 'Count', - javelin_render_tag( + javelin_tag( 'span', array( 'sigil' => 'has-tooltip', @@ -97,7 +97,7 @@ final class PhabricatorXHProfProfileTopLevelView ), 'Wall Time (Inclusive)'), '%', - javelin_render_tag( + javelin_tag( 'span', array( 'sigil' => 'has-tooltip', diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php index 8b7b91f191..99fe0b70da 100644 --- a/src/infrastructure/diff/PhabricatorInlineCommentController.php +++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php @@ -234,14 +234,14 @@ abstract class PhabricatorInlineCommentController } private function renderTextArea($text) { - return javelin_render_tag( + return javelin_tag( 'textarea', array( 'class' => 'differential-inline-comment-edit-textarea', 'sigil' => 'differential-inline-comment-edit-textarea', 'name' => 'text', ), - phutil_escape_html($text)); + $text); } } diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php index cff2e68d97..8c22002fe8 100644 --- a/src/infrastructure/javelin/markup.php +++ b/src/infrastructure/javelin/markup.php @@ -5,6 +5,19 @@ function javelin_render_tag( array $attributes = array(), $content = null) { + if (is_array($content)) { + $content = implode('', $content); + } + + $html = javelin_tag($tag, $attributes, phutil_safe_html($content)); + return $html->getHTMLContent(); +} + +function javelin_tag( + $tag, + array $attributes = array(), + $content = null) { + if (isset($attributes['sigil']) || isset($attributes['meta']) || isset($attributes['mustcapture'])) { @@ -32,10 +45,9 @@ function javelin_render_tag( } } - return phutil_render_tag($tag, $attributes, $content); + return phutil_tag($tag, $attributes, $content); } - function phabricator_render_form(PhabricatorUser $user, $attributes, $content) { if (strcasecmp(idx($attributes, 'method'), 'POST') == 0 && !preg_match('#^(https?:|//)#', idx($attributes, 'action'))) { diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php index b2219ad428..548a2b1d64 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleCountdown.php @@ -52,13 +52,13 @@ final class PhabricatorRemarkupRuleCountdown extends PhutilRemarkupRule { 'id' => $id, ), array( - javelin_render_tag('span', + javelin_tag('span', array('sigil' => 'phabricator-timer-days'), '').'d', - javelin_render_tag('span', + javelin_tag('span', array('sigil' => 'phabricator-timer-hours'), '').'h', - javelin_render_tag('span', + javelin_tag('span', array('sigil' => 'phabricator-timer-minutes'), '').'m', - javelin_render_tag('span', + javelin_tag('span', array('sigil' => 'phabricator-timer-seconds'), '').'s', )); Javelin::initBehavior('countdown-timer', array( diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php index 6426f27fa0..6adc7958f8 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleEmbedFile.php @@ -110,7 +110,7 @@ final class PhabricatorRemarkupRuleEmbedFile require_celerity_resource('lightbox-attachment-css'); $img = phutil_tag('img', $data['attrs']); - $embed = javelin_render_tag( + $embed = javelin_tag( 'a', array( 'href' => $meta['uri'], diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index 266286cef2..e1ebad90c8 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -79,17 +79,17 @@ final class AphrontDialogView extends AphrontView { $buttons = array(); if ($this->submitButton) { - $buttons[] = javelin_render_tag( + $buttons[] = javelin_tag( 'button', array( 'name' => '__submit__', 'sigil' => '__default__', ), - phutil_escape_html($this->submitButton)); + $this->submitButton); } if ($this->cancelURI) { - $buttons[] = javelin_render_tag( + $buttons[] = javelin_tag( 'a', array( 'href' => $this->cancelURI, @@ -97,7 +97,7 @@ final class AphrontDialogView extends AphrontView { 'name' => '__cancel__', 'sigil' => 'jx-workflow-button', ), - phutil_escape_html($this->cancelText)); + $this->cancelText); } $buttons = implode('', $buttons); @@ -133,7 +133,7 @@ final class AphrontDialogView extends AphrontView { $hidden_inputs = array(); foreach ($this->hidden as $desc) { list($key, $value) = $desc; - $hidden_inputs[] = javelin_render_tag( + $hidden_inputs[] = javelin_tag( 'input', array( 'type' => 'hidden', diff --git a/src/view/control/AphrontAttachedFileView.php b/src/view/control/AphrontAttachedFileView.php index a728515387..a3e1cad357 100644 --- a/src/view/control/AphrontAttachedFileView.php +++ b/src/view/control/AphrontAttachedFileView.php @@ -32,7 +32,7 @@ final class AphrontAttachedFileView extends AphrontView { $file->getName()); $size = number_format($file->getByteSize()).' bytes'; - $remove = javelin_render_tag( + $remove = javelin_tag( 'a', array( 'class' => 'button grey', diff --git a/src/view/control/AphrontTokenizerTemplateView.php b/src/view/control/AphrontTokenizerTemplateView.php index 178b313873..d80fe2566c 100644 --- a/src/view/control/AphrontTokenizerTemplateView.php +++ b/src/view/control/AphrontTokenizerTemplateView.php @@ -41,7 +41,7 @@ final class AphrontTokenizerTemplateView extends AphrontView { $tokens[] = $this->renderToken($key, $value); } - $input = javelin_render_tag( + $input = javelin_tag( 'input', array( 'mustcapture' => true, diff --git a/src/view/control/AphrontTypeaheadTemplateView.php b/src/view/control/AphrontTypeaheadTemplateView.php index 5e27c682cf..e536a7a7cf 100644 --- a/src/view/control/AphrontTypeaheadTemplateView.php +++ b/src/view/control/AphrontTypeaheadTemplateView.php @@ -41,7 +41,7 @@ final class AphrontTypeaheadTemplateView extends AphrontView { $tokens[] = $this->renderToken($key, $value); } - $input = javelin_render_tag( + $input = javelin_tag( 'input', array( 'name' => $name, @@ -52,14 +52,16 @@ final class AphrontTypeaheadTemplateView extends AphrontView { 'autocomplete' => 'off', )); - return javelin_render_tag( + return javelin_tag( 'div', array( 'id' => $id, 'sigil' => 'typeahead-hardpoint', 'class' => 'jx-typeahead-hardpoint', ), - $input. - '
    '); + array( + $input, + phutil_tag('div', array('style' => 'clear: both'), ''), + )); } } diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php index aefdafbd75..afe989f854 100644 --- a/src/view/form/control/AphrontFormDateControl.php +++ b/src/view/form/control/AphrontFormDateControl.php @@ -225,7 +225,7 @@ final class AphrontFormDateControl extends AphrontFormControl { 'sigil' => 'year-input', )); - $cal_icon = javelin_render_tag( + $cal_icon = javelin_tag( 'a', array( 'href' => '#', diff --git a/src/view/form/control/AphrontFormTextControl.php b/src/view/form/control/AphrontFormTextControl.php index 76b3cbb32e..7ba47a5728 100644 --- a/src/view/form/control/AphrontFormTextControl.php +++ b/src/view/form/control/AphrontFormTextControl.php @@ -25,7 +25,7 @@ final class AphrontFormTextControl extends AphrontFormControl { } protected function renderInput() { - return javelin_render_tag( + return javelin_tag( 'input', array( 'type' => 'text', diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 1272007c0c..be41fdf655 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -99,7 +99,7 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { require_celerity_resource('sprite-icon-css'); - $buttons[] = javelin_render_tag( + $buttons[] = javelin_tag( 'a', array( 'class' => implode(' ', $classes), diff --git a/src/view/layout/AphrontMoreView.php b/src/view/layout/AphrontMoreView.php index 09f9a099b0..3eb89714a5 100644 --- a/src/view/layout/AphrontMoreView.php +++ b/src/view/layout/AphrontMoreView.php @@ -32,7 +32,7 @@ final class AphrontMoreView extends AphrontView { $link = null; if ($this->more && $this->more != $this->some) { Javelin::initBehavior('aphront-more'); - $link = ' '.javelin_render_tag( + $link = ' '.javelin_tag( 'a', array( 'sigil' => 'aphront-more-view-show-more', diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index b5a6cf5792..53c2c1e943 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -66,12 +66,12 @@ final class PhabricatorActionView extends AphrontView { 'Call setUser() when rendering an action as a form.'); } - $item = javelin_render_tag( + $item = javelin_tag( 'button', array( 'class' => 'phabricator-action-view-item', ), - phutil_escape_html($this->name)); + $this->name); $item = phabricator_render_form( $this->user, @@ -82,14 +82,14 @@ final class PhabricatorActionView extends AphrontView { ), $item); } else { - $item = javelin_render_tag( + $item = javelin_tag( 'a', array( 'href' => $this->href, 'class' => 'phabricator-action-view-item', 'sigil' => $this->workflow ? 'workflow' : null, ), - phutil_escape_html($this->name)); + $this->name); } } else { $item = phutil_tag( diff --git a/src/view/layout/PhabricatorAnchorView.php b/src/view/layout/PhabricatorAnchorView.php index 2f642fab3d..4650a91b98 100644 --- a/src/view/layout/PhabricatorAnchorView.php +++ b/src/view/layout/PhabricatorAnchorView.php @@ -18,7 +18,7 @@ final class PhabricatorAnchorView extends AphrontView { public function render() { $marker = null; if ($this->navigationMarker) { - $marker = javelin_render_tag( + $marker = javelin_tag( 'legend', array( 'class' => 'phabricator-anchor-navigation-marker', diff --git a/src/view/layout/PhabricatorCrumbsView.php b/src/view/layout/PhabricatorCrumbsView.php index 457b0221cd..0ac55bb46f 100644 --- a/src/view/layout/PhabricatorCrumbsView.php +++ b/src/view/layout/PhabricatorCrumbsView.php @@ -37,14 +37,17 @@ final class PhabricatorCrumbsView extends AphrontView { ), ''); } - $actions[] = javelin_render_tag( + $actions[] = javelin_tag( 'a', array( 'href' => $action->getHref(), 'class' => 'phabricator-crumbs-action', 'sigil' => $action->getWorkflow() ? 'workflow' : null, ), - $icon.phutil_escape_html($action->getName())); + array( + $icon, + $action->getName(), + )); } $action_view = phutil_render_tag( diff --git a/src/view/layout/PhabricatorFileLinkView.php b/src/view/layout/PhabricatorFileLinkView.php index 6869e9cd35..ff3434d872 100644 --- a/src/view/layout/PhabricatorFileLinkView.php +++ b/src/view/layout/PhabricatorFileLinkView.php @@ -67,7 +67,7 @@ final class PhabricatorFileLinkView extends AphrontView { ); } - return javelin_render_tag( + return javelin_tag( 'a', array( 'href' => $this->getFileViewURI(), @@ -76,7 +76,6 @@ final class PhabricatorFileLinkView extends AphrontView { 'meta' => $meta, 'mustcapture' => $mustcapture, ), - phutil_escape_html($this->getFileName()) - ); + $this->getFileName()); } } diff --git a/src/view/layout/PhabricatorTimelineEventView.php b/src/view/layout/PhabricatorTimelineEventView.php index 63f7af3cdc..792c71da92 100644 --- a/src/view/layout/PhabricatorTimelineEventView.php +++ b/src/view/layout/PhabricatorTimelineEventView.php @@ -235,7 +235,7 @@ final class PhabricatorTimelineEventView extends AphrontView { if ($this->getIsEdited()) { - $extra[] = javelin_render_tag( + $extra[] = javelin_tag( 'a', array( 'href' => '/transactions/history/'.$xaction_phid.'/', @@ -245,7 +245,7 @@ final class PhabricatorTimelineEventView extends AphrontView { } if ($this->getIsEditable()) { - $extra[] = javelin_render_tag( + $extra[] = javelin_tag( 'a', array( 'href' => '/transactions/edit/'.$xaction_phid.'/', diff --git a/src/view/layout/headsup/AphrontHeadsupActionView.php b/src/view/layout/headsup/AphrontHeadsupActionView.php index 6371be8698..eaffca17a2 100644 --- a/src/view/layout/headsup/AphrontHeadsupActionView.php +++ b/src/view/layout/headsup/AphrontHeadsupActionView.php @@ -64,10 +64,10 @@ final class AphrontHeadsupActionView extends AphrontView { $attrs['sigil'] = 'workflow'; } - return javelin_render_tag( + return javelin_tag( $tag, $attrs, - phutil_escape_html($this->name)); + $this->name); } } diff --git a/src/view/page/menu/PhabricatorMainMenuIconView.php b/src/view/page/menu/PhabricatorMainMenuIconView.php index a94c903b55..467e2ba6ee 100644 --- a/src/view/page/menu/PhabricatorMainMenuIconView.php +++ b/src/view/page/menu/PhabricatorMainMenuIconView.php @@ -65,15 +65,15 @@ final class PhabricatorMainMenuIconView extends AphrontView { $classes = $this->classes; $classes[] = 'phabricator-main-menu-icon'; - $label = javelin_render_tag( + $label = javelin_tag( 'a', array( 'href' => $href, 'class' => 'phabricator-main-menu-icon-label', ), - phutil_escape_html($name)); + $name); - $item = javelin_render_tag( + $item = javelin_tag( 'a', array( 'href' => $href, diff --git a/src/view/page/menu/PhabricatorMainMenuSearchView.php b/src/view/page/menu/PhabricatorMainMenuSearchView.php index c444ca9078..fe3ab48e71 100644 --- a/src/view/page/menu/PhabricatorMainMenuSearchView.php +++ b/src/view/page/menu/PhabricatorMainMenuSearchView.php @@ -34,7 +34,7 @@ final class PhabricatorMainMenuSearchView extends AphrontView { $scope = $this->scope; - $target = javelin_render_tag( + $target = javelin_tag( 'div', array( 'id' => $target_id, diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index e833a6f828..b029e2cc8b 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -118,7 +118,7 @@ final class PhabricatorMainMenuView extends AphrontView { } private function renderPhabricatorMenuButton($header_id) { - return javelin_render_tag( + return javelin_tag( 'a', array( 'class' => 'phabricator-main-menu-expand-button '. @@ -139,7 +139,7 @@ final class PhabricatorMainMenuView extends AphrontView { } public function renderApplicationMenuButton($header_id) { - return javelin_render_tag( + return javelin_tag( 'a', array( 'class' => 'phabricator-main-menu-expand-button '. @@ -344,7 +344,7 @@ final class PhabricatorMainMenuView extends AphrontView { 'dropdownID' => $dropdown_id, )); - $notification_dropdown = javelin_render_tag( + $notification_dropdown = javelin_tag( 'div', array( 'id' => $dropdown_id, -- 2.51.2 From b9f394164f1858a9a4e074d8a2f7a4164befa713 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 25 Jan 2013 12:57:47 -0800 Subject: [PATCH 11/50] Add renderHTMLView Summary: - Implement AphrontView->renderHTMLView(), which works like AphrontView->renderSingleView() but always return PhutilSafeHTML. Test Plan: Action list view no longer as broken. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4642 --- src/view/AphrontView.php | 16 ++++++++++++++++ src/view/layout/PhabricatorActionListView.php | 5 +++-- src/view/layout/PhabricatorHeaderView.php | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php index c39a729413..4df6da5417 100644 --- a/src/view/AphrontView.php +++ b/src/view/AphrontView.php @@ -50,6 +50,22 @@ abstract class AphrontView extends Phobject { } } + 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)); + } + } + abstract public function render(); } diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php index c09b6dc454..d4a9a22fdf 100644 --- a/src/view/layout/PhabricatorActionListView.php +++ b/src/view/layout/PhabricatorActionListView.php @@ -36,12 +36,13 @@ final class PhabricatorActionListView extends AphrontView { } require_celerity_resource('phabricator-action-list-view-css'); - return phutil_render_tag( + + return phutil_tag( 'ul', array( 'class' => 'phabricator-action-list-view', ), - $this->renderSingleView($actions)); + $this->renderHTMLView($actions)); } diff --git a/src/view/layout/PhabricatorHeaderView.php b/src/view/layout/PhabricatorHeaderView.php index 7d8a6e5109..8652de7095 100644 --- a/src/view/layout/PhabricatorHeaderView.php +++ b/src/view/layout/PhabricatorHeaderView.php @@ -39,12 +39,12 @@ final class PhabricatorHeaderView extends AphrontView { } if ($this->tags) { - $header[] = phutil_render_tag( + $header[] = phutil_tag( 'span', array( 'class' => 'phabricator-header-tags', ), - self::renderSingleView($this->tags)); + $this->renderHTMLView($this->tags)); } return phutil_tag( -- 2.51.2 From a1ff679f41f83a6d34a8e918d6d742867f0d8d55 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 25 Jan 2013 17:07:07 -0800 Subject: [PATCH 12/50] Fix AphrontCrumbView (phutil_tag) Summary: Proper fix is to do some layout work in Diffusion. Short of that, make this escape properly. Test Plan: Viewed various crumbs, no more overescaping for non-diffusion crumbs. Reviewers: vrana Reviewed By: vrana CC: aran Differential Revision: https://secure.phabricator.com/D4641 --- .../controller/DiffusionController.php | 21 ++++++++++--------- src/view/layout/PhabricatorCrumbView.php | 19 ++++------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index 14b734f43d..cc30b41141 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -246,9 +246,9 @@ abstract class DiffusionController extends PhabricatorController { break; case 'change': $view_name = 'Change'; - $crumb_list[] = $crumb->setRawName( - phutil_escape_html($path).' ('.$commit_link.')' - ); + $crumb_list[] = $crumb->setName( + phutil_safe_html( + phutil_escape_html($path).' ('.$commit_link.')')); return $crumb_list; } @@ -293,7 +293,7 @@ abstract class DiffusionController extends PhabricatorController { $path_sections = '/'.implode('/', $path_sections); $crumb_list[] = id(new PhabricatorCrumbView()) - ->setRawName($path_sections); + ->setName(phutil_safe_html($path_sections)); } $last_crumb = array_pop($crumb_list); @@ -308,13 +308,14 @@ abstract class DiffusionController extends PhabricatorController { ) + $uri_params), ), 'Jump to HEAD'); - $last_crumb->setRawName( - $last_crumb->getNameForRender() . " @ {$commit_link} ({$jump_link})" - ); + + $name = $last_crumb->getName(); + $name = phutil_safe_html($name." @ {$commit_link} ({$jump_link})"); + $last_crumb->setName($name); } else if ($spec['view'] != 'lint') { - $last_crumb->setRawName( - $last_crumb->getNameForRender() . " @ HEAD" - ); + $name = $last_crumb->getName(); + $name = phutil_safe_html($name.' @ HEAD'); + $last_crumb->setName($name); } $crumb_list[] = $last_crumb; diff --git a/src/view/layout/PhabricatorCrumbView.php b/src/view/layout/PhabricatorCrumbView.php index 332d2f5465..11d311172b 100644 --- a/src/view/layout/PhabricatorCrumbView.php +++ b/src/view/layout/PhabricatorCrumbView.php @@ -6,25 +6,14 @@ final class PhabricatorCrumbView extends AphrontView { private $href; private $icon; private $isLastCrumb; - private $rawName; - - /** - * Allows for custom HTML inside the name field. - * - * NOTE: you must handle escaping user text if you use this method. - */ - public function setRawName($raw_name) { - $this->rawName = $raw_name; - return $this; - } public function setName($name) { $this->name = $name; return $this; } - public function getNameForRender() { - return nonempty($this->rawName, phutil_escape_html($this->name)); + public function getName() { + return $this->name; } public function setHref($href) { @@ -63,12 +52,12 @@ final class PhabricatorCrumbView extends AphrontView { ''); } - $name = phutil_render_tag( + $name = phutil_tag( 'span', array( 'class' => 'phabricator-crumb-name', ), - $this->getNameForRender()); + $this->name); $divider = null; if (!$this->isLastCrumb) { -- 2.51.2 From d83257c29a6b9b2dd6ce0ebce60e2bf8adb47427 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:09:00 -0800 Subject: [PATCH 13/50] Fix object ObjectItemListView attributes Summary: This works after pht() + html got sorted out. Test Plan: Looked at some object attribute lists. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4645 --- .../PhabricatorCalendarViewStatusController.php | 3 +-- .../PhabricatorConfigListController.php | 2 +- .../drydock/controller/DrydockController.php | 2 +- .../PhabricatorApplicationsListController.php | 3 +-- .../PhabricatorPasteListController.php | 3 ++- .../ponder/view/PonderUserProfileView.php | 2 +- src/view/AphrontView.php | 8 ++++++++ .../layout/PhabricatorObjectItemListView.php | 13 +++++++++---- src/view/layout/PhabricatorObjectItemView.php | 16 ++++++++++++---- 9 files changed, 36 insertions(+), 16 deletions(-) diff --git a/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php b/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php index b00c08e6a1..9f96fd070a 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarViewStatusController.php @@ -79,8 +79,7 @@ final class PhabricatorCalendarViewStatusController ->setBarColor($color) ->addAttribute(pht('From %s to %s', $from, $to)) ->addAttribute( - phutil_escape_html( - phutil_utf8_shorten($status->getDescription(), 64))); + phutil_utf8_shorten($status->getDescription(), 64)); $list->addItem($item); } diff --git a/src/applications/config/controller/PhabricatorConfigListController.php b/src/applications/config/controller/PhabricatorConfigListController.php index 1561531f42..2cf891626a 100644 --- a/src/applications/config/controller/PhabricatorConfigListController.php +++ b/src/applications/config/controller/PhabricatorConfigListController.php @@ -52,7 +52,7 @@ final class PhabricatorConfigListController $item = id(new PhabricatorObjectItemView()) ->setHeader($group->getName()) ->setHref('/config/group/'.$group->getKey().'/') - ->addAttribute(phutil_escape_html($group->getDescription())); + ->addAttribute($group->getDescription()); $list->addItem($item); } diff --git a/src/applications/drydock/controller/DrydockController.php b/src/applications/drydock/controller/DrydockController.php index e05c1f6839..9b55ff5f01 100644 --- a/src/applications/drydock/controller/DrydockController.php +++ b/src/applications/drydock/controller/DrydockController.php @@ -105,7 +105,7 @@ abstract class DrydockController extends PhabricatorController { } $status = DrydockLeaseStatus::getNameForStatus($lease->getStatus()); - $item->addAttribute(phutil_escape_html($status)); + $item->addAttribute($status); $date_created = phabricator_date($lease->getDateCreated(), $user); $item->addAttribute(pht('Created on %s', $date_created)); diff --git a/src/applications/meta/controller/PhabricatorApplicationsListController.php b/src/applications/meta/controller/PhabricatorApplicationsListController.php index 3ef64b24bd..0b70056699 100644 --- a/src/applications/meta/controller/PhabricatorApplicationsListController.php +++ b/src/applications/meta/controller/PhabricatorApplicationsListController.php @@ -51,8 +51,7 @@ final class PhabricatorApplicationsListController $item = id(new PhabricatorObjectItemView()) ->setHeader($application->getName()) ->setHref('/applications/view/'.get_class($application).'/') - ->addAttribute( - phutil_escape_html($application->getShortDescription())); + ->addAttribute($application->getShortDescription()); $list->addItem($item); } return $list; diff --git a/src/applications/paste/controller/PhabricatorPasteListController.php b/src/applications/paste/controller/PhabricatorPasteListController.php index 32194daed1..6e38715507 100644 --- a/src/applications/paste/controller/PhabricatorPasteListController.php +++ b/src/applications/paste/controller/PhabricatorPasteListController.php @@ -85,7 +85,8 @@ final class PhabricatorPasteListController extends PhabricatorPasteController { $created = phabricator_date($paste->getDateCreated(), $user); $author = $this->getHandle($paste->getAuthorPHID())->renderLink(); $source_code = $this->buildSourceCodeView($paste, 5)->render(); - $source_code = phutil_render_tag( + + $source_code = phutil_tag( 'div', array( 'class' => 'phabricator-source-code-summary', diff --git a/src/applications/ponder/view/PonderUserProfileView.php b/src/applications/ponder/view/PonderUserProfileView.php index a05796c0b8..ad9e8033cf 100644 --- a/src/applications/ponder/view/PonderUserProfileView.php +++ b/src/applications/ponder/view/PonderUserProfileView.php @@ -84,7 +84,7 @@ final class PonderUserProfileView extends AphrontView { array( 'href' => '/Q'.$question->getID(), ), - phutil_escape_html(self::abbreviate($question->getTitle()))))); + self::abbreviate($question->getTitle())))); $view->addItem($item); } diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php index 4df6da5417..e1bf757429 100644 --- a/src/view/AphrontView.php +++ b/src/view/AphrontView.php @@ -36,6 +36,14 @@ abstract class AphrontView extends Phobject { return implode('', $out); } + final protected function renderHTMLChildren() { + $out = array(); + foreach ($this->children as $child) { + $out[] = $this->renderHTMLView($child); + } + return $out; + } + final protected function renderSingleView($child) { if ($child instanceof AphrontView) { return $child->render(); diff --git a/src/view/layout/PhabricatorObjectItemListView.php b/src/view/layout/PhabricatorObjectItemListView.php index 0059f136ff..76b9c7655f 100644 --- a/src/view/layout/PhabricatorObjectItemListView.php +++ b/src/view/layout/PhabricatorObjectItemListView.php @@ -48,7 +48,7 @@ final class PhabricatorObjectItemListView extends AphrontView { } if ($this->items) { - $items = $this->renderSingleView($this->items); + $items = $this->renderHTMLView($this->items); } else { $string = nonempty($this->noDataString, pht('No data.')); $items = id(new AphrontErrorView()) @@ -59,7 +59,7 @@ final class PhabricatorObjectItemListView extends AphrontView { $pager = null; if ($this->pager) { - $pager = $this->renderSingleView($this->pager); + $pager = $this->renderHTMLView($this->pager); } $classes[] = 'phabricator-object-item-list-view'; @@ -67,12 +67,17 @@ final class PhabricatorObjectItemListView extends AphrontView { $classes[] = 'phabricator-object-list-stackable'; } - return phutil_render_tag( + return phutil_tag( 'ul', array( 'class' => implode(' ', $classes), ), - $header.$items.$pager); + $this->renderHTMLView( + array( + $header, + $items, + $pager, + ))); } } diff --git a/src/view/layout/PhabricatorObjectItemView.php b/src/view/layout/PhabricatorObjectItemView.php index fe8940320e..c6646f2f9e 100644 --- a/src/view/layout/PhabricatorObjectItemView.php +++ b/src/view/layout/PhabricatorObjectItemView.php @@ -127,12 +127,15 @@ final class PhabricatorObjectItemView extends AphrontView { "\xC2\xB7"); $first = true; foreach ($this->attributes as $attribute) { - $attrs[] = phutil_render_tag( + $attrs[] = phutil_tag( 'li', array( 'class' => 'phabricator-object-item-attribute', ), - ($first ? null : $spacer).$attribute); + array( + ($first ? null : $spacer), + $attribute, + )); $first = false; } $attrs = phutil_tag( @@ -158,12 +161,17 @@ final class PhabricatorObjectItemView extends AphrontView { throw new Exception("Invalid effect!"); } - $content = phutil_render_tag( + $content = phutil_tag( 'div', array( 'class' => 'phabricator-object-item-content', ), - $header.$attrs.$this->renderChildren()); + $this->renderHTMLView( + array( + $header, + $attrs, + $this->renderHTMLChildren(), + ))); return phutil_tag( 'li', -- 2.51.2 From 47f2df5f51185d77dc55542ac7f199709500a1da Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:09:33 -0800 Subject: [PATCH 14/50] Fix most timeline escaping Summary: Some content might be broken but it's hard to test since JS/Ajax is also a bit broken. Test Plan: Looked at timeline examples. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4683 --- .../examples/PhabricatorTimelineExample.php | 4 +- src/view/AphrontView.php | 13 ++++ src/view/layout/PhabricatorAnchorView.php | 2 +- .../layout/PhabricatorTimelineEventView.php | 61 ++++++++++--------- 4 files changed, 49 insertions(+), 31 deletions(-) diff --git a/src/applications/uiexample/examples/PhabricatorTimelineExample.php b/src/applications/uiexample/examples/PhabricatorTimelineExample.php index 645ec347fc..68e6878999 100644 --- a/src/applications/uiexample/examples/PhabricatorTimelineExample.php +++ b/src/applications/uiexample/examples/PhabricatorTimelineExample.php @@ -98,13 +98,13 @@ final class PhabricatorTimelineExample extends PhabricatorUIExample { $events[] = id(new PhabricatorTimelineEventView()) ->setUserHandle($handle) - ->setTitle(phutil_escape_html("Colorless")) + ->setTitle("Colorless") ->setIcon('lock'); foreach ($colors as $color) { $events[] = id(new PhabricatorTimelineEventView()) ->setUserHandle($handle) - ->setTitle(phutil_escape_html("Color '{$color}'")) + ->setTitle("Color '{$color}'") ->setIcon('lock') ->setColor($color); } diff --git a/src/view/AphrontView.php b/src/view/AphrontView.php index e1bf757429..bfe6f9d624 100644 --- a/src/view/AphrontView.php +++ b/src/view/AphrontView.php @@ -74,6 +74,19 @@ abstract class AphrontView extends Phobject { } } + final protected function isEmptyContent($content) { + if (is_array($content)) { + foreach ($content as $element) { + if (!$this->isEmptyContent($element)) { + return false; + } + } + return true; + } else { + return !strlen((string)$content); + } + } + abstract public function render(); } diff --git a/src/view/layout/PhabricatorAnchorView.php b/src/view/layout/PhabricatorAnchorView.php index 4650a91b98..44e8f33730 100644 --- a/src/view/layout/PhabricatorAnchorView.php +++ b/src/view/layout/PhabricatorAnchorView.php @@ -39,7 +39,7 @@ final class PhabricatorAnchorView extends AphrontView { ), ''); - return $marker.$anchor; + return $this->renderHTMLView(array($marker, $anchor)); } } diff --git a/src/view/layout/PhabricatorTimelineEventView.php b/src/view/layout/PhabricatorTimelineEventView.php index 792c71da92..97c1970d61 100644 --- a/src/view/layout/PhabricatorTimelineEventView.php +++ b/src/view/layout/PhabricatorTimelineEventView.php @@ -100,10 +100,10 @@ final class PhabricatorTimelineEventView extends AphrontView { } public function render() { - $content = $this->renderChildren(); + $content = $this->renderHTMLChildren(); $title = $this->title; - if (($title === null) && !strlen($content)) { + if (($title === null) && $this->isEmptyContent($content)) { $title = ''; } @@ -131,14 +131,14 @@ final class PhabricatorTimelineEventView extends AphrontView { '')); } - $title = phutil_render_tag( + $title = phutil_tag( 'div', array( 'class' => implode(' ', $title_classes), ), - $title.$extra); + array($title, $extra)); - $title = $icon.$title; + $title = $this->renderHTMLView(array($icon, $title)); } $wedge = phutil_tag( @@ -165,32 +165,34 @@ final class PhabricatorTimelineEventView extends AphrontView { $classes[] = 'phabricator-timeline-border'; if ($content) { $classes[] = 'phabricator-timeline-major-event'; - $content = phutil_render_tag( + $content = phutil_tag( 'div', array( 'class' => implode(' ', $content_classes), ), - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'phabricator-timeline-inner-content', ), - $title. - phutil_render_tag( - 'div', - array( - 'class' => 'phabricator-timeline-core-content', - ), - $content))); - $content = $image.$wedge.$content; + array( + $title, + phutil_tag( + 'div', + array( + 'class' => 'phabricator-timeline-core-content', + ), + $content), + ))); + $content = array($image, $wedge, $content); } else { $classes[] = 'phabricator-timeline-minor-event'; - $content = phutil_render_tag( + $content = phutil_tag( 'div', array( 'class' => implode(' ', $content_classes), ), - $image.$wedge.$title); + array($image, $wedge, $title)); } $outer_classes = $this->classes; @@ -209,7 +211,7 @@ final class PhabricatorTimelineEventView extends AphrontView { ); } - return javelin_render_tag( + return javelin_tag( 'div', array( 'class' => implode(' ', $outer_classes), @@ -217,7 +219,7 @@ final class PhabricatorTimelineEventView extends AphrontView { 'sigil' => $sigil, 'meta' => $meta, ), - phutil_render_tag( + phutil_tag( 'div', array( 'class' => implode(' ', $classes), @@ -273,25 +275,28 @@ final class PhabricatorTimelineEventView extends AphrontView { ->setAnchorName($this->anchor) ->render(); - $date = $anchor.phutil_tag( - 'a', - array( - 'href' => '#'.$this->anchor, - ), - $date); + $date = $this->renderHTMLView( + array( + $anchor, + phutil_tag( + 'a', + array( + 'href' => '#'.$this->anchor, + ), + $date), + )); } $extra[] = $date; } } - $extra = implode(' · ', $extra); if ($extra) { - $extra = phutil_render_tag( + $extra = phutil_tag( 'span', array( 'class' => 'phabricator-timeline-extra', ), - $extra); + array_interleave(" \xC2\xB7 ", $extra)); } return $extra; -- 2.51.2 From fc4cb5735702324b502ceecd5825a93406596a3e Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:11:27 -0800 Subject: [PATCH 15/50] Fix JSON encoding of PhutilSafeHTML for browser consumption Summary: If you run this code: json_encode(array('tag' => phutil_tag('div', array()))); ...you get this result, because json_encode() does not call toString() on objects: {"tag":{}} Instead, convert such objects to their underlying strings. Javelin has support for JX.HTML and for implicit conversion (which is kind of sketchy for other reasons) but it's sort of complicated (only happens on Ajax, not behaviors) and messy (not metadata-based), so ignore it for now. We'll need to do something similar for serialization to the database. My plan there is just to throw on any objects. The only time we put HTML in the database is cache-related and those tiny number of callsites can manually handle it. Test Plan: Various ajax things now receive the correct data. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4684 --- externals/javelinjs/src/lib/DOM.js | 11 +++++++++++ src/aphront/response/AphrontResponse.php | 16 +++++++++++++++- .../celerity/CelerityStaticResourceResponse.php | 7 +++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/externals/javelinjs/src/lib/DOM.js b/externals/javelinjs/src/lib/DOM.js index c51b43ed7b..b2bf50b65c 100644 --- a/externals/javelinjs/src/lib/DOM.js +++ b/externals/javelinjs/src/lib/DOM.js @@ -87,7 +87,18 @@ JX.$ = function(id) { JX.install('HTML', { construct : function(str) { + if (str instanceof JX.HTML) { + this._content = str._content; + return; + } + if (__DEV__) { + if ((typeof str !== 'string') && (!str || !str.match)) { + JX.$E( + 'new JX.HTML(): ' + + 'call initializes an HTML object with an empty value.'); + } + var tags = ['legend', 'thead', 'tbody', 'tfoot', 'column', 'colgroup', 'caption', 'tr', 'th', 'td', 'option']; var evil_stuff = new RegExp('^\\s*<(' + tags.join('|') + ')\\b', 'i'); diff --git a/src/aphront/response/AphrontResponse.php b/src/aphront/response/AphrontResponse.php index 291c493c59..e410262b39 100644 --- a/src/aphront/response/AphrontResponse.php +++ b/src/aphront/response/AphrontResponse.php @@ -54,7 +54,21 @@ abstract class AphrontResponse { return $this; } - protected function encodeJSONForHTTPResponse(array $object) { + public static function processValueForJSONEncoding(&$value, $key) { + if ($value instanceof PhutilSafeHTML) { + // TODO: Javelin supports implicity conversion of '__html' objects to + // JX.HTML, but only for Ajax responses, not behaviors. Just leave things + // as they are for now (where behaviors treat responses as HTML or plain + // text at their discretion). + $value = $value->getHTMLContent(); + } + } + + public static function encodeJSONForHTTPResponse(array $object) { + + array_walk_recursive( + $object, + array('AphrontResponse', 'processValueForJSONEncoding')); $response = json_encode($object); diff --git a/src/infrastructure/celerity/CelerityStaticResourceResponse.php b/src/infrastructure/celerity/CelerityStaticResourceResponse.php index e16d75f799..6891fa4fff 100644 --- a/src/infrastructure/celerity/CelerityStaticResourceResponse.php +++ b/src/infrastructure/celerity/CelerityStaticResourceResponse.php @@ -128,7 +128,8 @@ final class CelerityStaticResourceResponse { public function renderHTMLFooter() { $data = array(); if ($this->metadata) { - $json_metadata = json_encode($this->metadata); + $json_metadata = AphrontResponse::encodeJSONForHTTPResponse( + $this->metadata); $this->metadata = array(); } else { $json_metadata = '{}'; @@ -164,7 +165,9 @@ final class CelerityStaticResourceResponse { if (!$group) { continue; } - $onload[] = 'JX.initBehaviors('.json_encode($group).')'; + $group_json = AphrontResponse::encodeJSONForHTTPResponse( + $group); + $onload[] = 'JX.initBehaviors('.$group_json.')'; } } -- 2.51.2 From 08bcb8c30ab0cff78d499c98e558004ec55274b1 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:12:09 -0800 Subject: [PATCH 16/50] Simplify form/lightbox stuff Summary: I broke this a bit a few revisions ago by making `phabricator_render_csrf_magic()` return array instead of string without actually grepping for callsites. Instead of building a form in JS, build it in PHP and just change its action in JS. This is simpler and doesn't require us to expose CSRF magic in more places. This change triggered a rather subtle bug: if we rendered a normal form on the page (and thus installed the "disable forms when submitted" behavior), the download button would incorrectly disable after being clicked. This doesn't currently happen in Files because we don't put a form on the same page as the download button. Instead, make the "disable" behavior check if the form is downloading stuff, and not disable stuff if it is. Then mark the lightbox and Files form as both download forms. Test Plan: Used lightbox; used Files. Verified download buttons download the right stuff and behave correctly. Grepped for other download forms, but all the other places where we write "download" don't appear to actually be download links. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4685 --- .../PhabricatorFileInfoController.php | 1 + src/view/AphrontTagView.php | 4 +- src/view/form/AphrontFormView.php | 2 - src/view/layout/PhabricatorActionView.php | 20 +++++++- src/view/page/PhabricatorStandardPageView.php | 51 +++++++++++++------ .../rsrc/js/application/core/behavior-form.js | 6 +++ .../core/behavior-lightbox-attachments.js | 32 +++--------- 7 files changed, 70 insertions(+), 46 deletions(-) diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php index cea2272bdb..9b1f1c0619 100644 --- a/src/applications/files/controller/PhabricatorFileInfoController.php +++ b/src/applications/files/controller/PhabricatorFileInfoController.php @@ -72,6 +72,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { id(new PhabricatorActionView()) ->setUser($user) ->setRenderAsForm(true) + ->setDownload(true) ->setName(pht('Download File')) ->setIcon('download') ->setHref($file->getViewURI())); diff --git a/src/view/AphrontTagView.php b/src/view/AphrontTagView.php index 5b276e11f1..0b3f17a099 100644 --- a/src/view/AphrontTagView.php +++ b/src/view/AphrontTagView.php @@ -56,8 +56,8 @@ abstract class AphrontTagView extends AphrontView { return $this; } - final public function getSigil() { - return $this->sigil; + final public function getSigils() { + return $this->sigils; } public function addClass($class) { diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index 1dca03e2cc..8b0041f00a 100644 --- a/src/view/form/AphrontFormView.php +++ b/src/view/form/AphrontFormView.php @@ -58,8 +58,6 @@ final class AphrontFormView extends AphrontView { } require_celerity_resource('aphront-form-view-css'); - Javelin::initBehavior('aphront-form-disable-on-submit'); - $layout = new AphrontFormLayoutView(); if (!$this->flexible) { diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index 53c2c1e943..bb030b60c2 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -8,6 +8,16 @@ final class PhabricatorActionView extends AphrontView { private $disabled; private $workflow; private $renderAsForm; + private $download; + + public function setDownload($download) { + $this->download = $download; + return $this; + } + + public function getDownload() { + return $this->download; + } public function setHref($href) { $this->href = $href; @@ -73,12 +83,20 @@ final class PhabricatorActionView extends AphrontView { ), $this->name); + $sigils = array(); + if ($this->workflow) { + $sigils[] = 'workflow'; + } + if ($this->download) { + $sigils[] = 'download'; + } + $item = phabricator_render_form( $this->user, array( 'action' => $this->href, 'method' => 'POST', - 'sigil' => $this->workflow ? 'workflow' : null, + 'sigil' => implode(' ', $sigils), ), $item); } else { diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index b1ce431b13..26ae9f3c09 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -108,29 +108,47 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { Javelin::initBehavior('workflow', array()); - $current_token = null; $request = $this->getRequest(); + $user = null; if ($request) { $user = $request->getUser(); - if ($user) { - $current_token = $user->getCSRFToken(); - $download_form = phabricator_render_form_magic($user); - $default_img_uri = - PhabricatorEnv::getCDNURI( - '/rsrc/image/icon/fatcow/document_black.png' - ); - - Javelin::initBehavior( - 'lightbox-attachments', - array( - 'defaultImageUri' => $default_img_uri, - 'downloadForm' => $download_form, - )); - } } + if ($user) { + $default_img_uri = + PhabricatorEnv::getCDNURI( + '/rsrc/image/icon/fatcow/document_black.png' + ); + $download_form = phabricator_render_form( + $user, + array( + 'action' => '#', + 'method' => 'POST', + 'class' => 'lightbox-download-form', + 'sigil' => 'download', + ), + phutil_tag( + 'button', + array(), + pht('Download'))); + + Javelin::initBehavior( + 'lightbox-attachments', + array( + 'defaultImageUri' => $default_img_uri, + 'downloadForm' => $download_form, + )); + } + + Javelin::initBehavior('aphront-form-disable-on-submit'); Javelin::initBehavior('toggle-class', array()); Javelin::initBehavior('konami', array()); + + $current_token = null; + if ($user) { + $current_token = $user->getCSRFToken(); + } + Javelin::initBehavior( 'refresh-csrf', array( @@ -138,6 +156,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { 'header' => AphrontRequest::getCSRFHeaderName(), 'current' => $current_token, )); + Javelin::initBehavior('device'); if ($console) { diff --git a/webroot/rsrc/js/application/core/behavior-form.js b/webroot/rsrc/js/application/core/behavior-form.js index 25ebb59e74..9e4942d533 100644 --- a/webroot/rsrc/js/application/core/behavior-form.js +++ b/webroot/rsrc/js/application/core/behavior-form.js @@ -23,6 +23,12 @@ JX.behavior('aphront-form-disable-on-submit', function(config) { root = e.getNode('tag:form'); + // If the form is a "download" form, don't disable it on submit because + // we won't transition off the page. + if (JX.Stratcom.hasSigil(root, 'download')) { + return; + } + // Open the form to a new tab in Firefox explicitly (automatic in Chrome). // We render some buttons as links so users may be confused that the links // don't open to new tabs with Ctrl+click as normal links. diff --git a/webroot/rsrc/js/application/core/behavior-lightbox-attachments.js b/webroot/rsrc/js/application/core/behavior-lightbox-attachments.js index f299a6f9df..55d6bb4d22 100644 --- a/webroot/rsrc/js/application/core/behavior-lightbox-attachments.js +++ b/webroot/rsrc/js/application/core/behavior-lightbox-attachments.js @@ -15,7 +15,7 @@ JX.behavior('lightbox-attachments', function (config) { var next = null; var x_margin = 40; var y_margin = 100; - var downloadForm = JX.$H(config.downloadForm); + var downloadForm = JX.$H(config.downloadForm).getFragment().firstChild; function loadLightBox(e) { if (!e.isNormalClick()) { @@ -133,33 +133,11 @@ JX.behavior('lightbox-attachments', function (config) { }, 'Image '+current+' of '+total+'.'+extra_status ); - var form = JX.$N('form', - { - action : target_data.dUri, - method : 'POST', - className : 'lightbox-download-form' - }, - downloadForm - ); - JX.DOM.appendContent(form, JX.$N('button', {}, 'Download')); - JX.DOM.listen(form, - 'click', - null, - function (e) { - e.prevent(); - form.submit(); - // Firefox and probably IE need this trick to work. - // Removing a form from the DOM while its submitting is - // tricky business. - setTimeout(JX.bind(null, closeLightBox, e), 0); - } - ); + var downloadSpan = JX.$N('span', { className : 'lightbox-download' - }, - form - ); + }); var statusHTML = JX.$N('div', { className : 'lightbox-status' @@ -169,6 +147,10 @@ JX.behavior('lightbox-attachments', function (config) { JX.DOM.appendContent(lightbox, statusHTML); JX.DOM.alterClass(document.body, 'lightbox-attached', true); JX.Mask.show('jx-dark-mask'); + + downloadForm.action = target_data.dUri; + downloadSpan.appendChild(downloadForm); + document.body.appendChild(lightbox); JX.Busy.start(); -- 2.51.2 From fb6dbd7d3a288678183b37cc7727272001faeb59 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:41:43 -0800 Subject: [PATCH 17/50] Convert more render_tag -> tag Summary: Mostly straightforward. Test Plan: Browsed most of the affected interfaces. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4687 --- .../controller/ConpherenceViewController.php | 12 ++++----- .../query/browse/DiffusionBrowseQuery.php | 6 ++--- .../view/DiffusionBranchTableView.php | 3 +-- .../view/DiffusionBrowseTableView.php | 3 +-- .../view/DiffusionHistoryTableView.php | 3 +-- .../PhabricatorDirectoryMainController.php | 7 +++-- .../ponder/view/PonderVotableView.php | 26 ++++++++++--------- .../examples/JavelinViewExampleServerView.php | 11 +++++--- src/view/control/AphrontTableView.php | 15 ++++++----- 9 files changed, 46 insertions(+), 40 deletions(-) diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 9f1b37bd15..751079b316 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -237,14 +237,13 @@ final class ConpherenceViewController extends foreach ($files as $file) { $thumb = $file->getThumb60x45URI(); $table_data[] = array( - phutil_render_tag( + phutil_tag( 'img', array( 'src' => $thumb ), - '' - ), - $file->getName() + ''), + phutil_escape_html($file->getName()), ); } $header = id(new PhabricatorHeaderView()) @@ -274,13 +273,12 @@ final class ConpherenceViewController extends foreach ($actual_tasks as $task) { $data[] = array( idx($priority_map, $task->getPriority(), pht('???')), - phutil_render_tag( + phutil_tag( 'a', array( 'href' => '/T'.$task->getID() ), - phutil_escape_html($task->getTitle()) - ) + $task->getTitle()), ); } $table = id(new AphrontTableView($data)) diff --git a/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php b/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php index 358815c600..832f4784d9 100644 --- a/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php +++ b/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php @@ -111,8 +111,7 @@ abstract class DiffusionBrowseQuery { $readme_content = $content_query->getRawData(); if (preg_match('/\\.txt$/', $readme->getPath())) { - $readme_content = phutil_escape_html($readme_content); - $readme_content = nl2br($readme_content); + $readme_content = phutil_escape_html_newlines($readme_content); $class = null; } else if (preg_match('/\\.rainbow$/', $readme->getPath())) { @@ -121,6 +120,7 @@ abstract class DiffusionBrowseQuery { ->getHighlightFuture($readme_content) ->resolve(); $readme_content = nl2br($readme_content); + $readme_content = phutil_safe_html($readme_content); require_celerity_resource('syntax-highlighting-css'); $class = 'remarkup-code'; @@ -132,7 +132,7 @@ abstract class DiffusionBrowseQuery { $class = 'phabricator-remarkup'; } - $readme_content = phutil_render_tag( + $readme_content = phutil_tag( 'div', array( 'class' => $class, diff --git a/src/applications/diffusion/view/DiffusionBranchTableView.php b/src/applications/diffusion/view/DiffusionBranchTableView.php index 2d59c04946..9626ee8db0 100644 --- a/src/applications/diffusion/view/DiffusionBranchTableView.php +++ b/src/applications/diffusion/view/DiffusionBranchTableView.php @@ -61,8 +61,7 @@ final class DiffusionBranchTableView extends DiffusionView { $drequest->getRepository(), $branch->getHeadCommitIdentifier()), $datetime, - AphrontTableView::renderSingleDisplayLine( - phutil_escape_html($details)) + AphrontTableView::renderSingleDisplayLine($details), // TODO: etc etc ); if ($branch->getName() == $current_branch) { diff --git a/src/applications/diffusion/view/DiffusionBrowseTableView.php b/src/applications/diffusion/view/DiffusionBrowseTableView.php index 0df7e7eb48..2d85e1cc06 100644 --- a/src/applications/diffusion/view/DiffusionBrowseTableView.php +++ b/src/applications/diffusion/view/DiffusionBrowseTableView.php @@ -59,8 +59,7 @@ final class DiffusionBrowseTableView extends DiffusionView { } } - $details = AphrontTableView::renderSingleDisplayLine( - phutil_escape_html($data->getSummary())); + $details = AphrontTableView::renderSingleDisplayLine($data->getSummary()); } else { $author = ''; $details = ''; diff --git a/src/applications/diffusion/view/DiffusionHistoryTableView.php b/src/applications/diffusion/view/DiffusionHistoryTableView.php index 08784f71f7..bd35f8134f 100644 --- a/src/applications/diffusion/view/DiffusionHistoryTableView.php +++ b/src/applications/diffusion/view/DiffusionHistoryTableView.php @@ -138,8 +138,7 @@ final class DiffusionHistoryTableView extends DiffusionView { $date, $time, $author, - AphrontTableView::renderSingleDisplayLine( - phutil_escape_html($history->getSummary())), + AphrontTableView::renderSingleDisplayLine($history->getSummary()), // TODO: etc etc ); } diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index b795ec238e..15eeda8453 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -338,11 +338,14 @@ final class PhabricatorDirectoryMainController private function renderMiniPanel($title, $body) { $panel = new AphrontMiniPanelView(); $panel->appendChild( - phutil_render_tag( + phutil_tag( 'p', array( ), - ''.$title.': '.$body)); + array( + phutil_tag('strong', array(), $title.':'), + $body + ))); $this->minipanels[] = $panel; } diff --git a/src/applications/ponder/view/PonderVotableView.php b/src/applications/ponder/view/PonderVotableView.php index c4bb4ab726..a00e6bee07 100644 --- a/src/applications/ponder/view/PonderVotableView.php +++ b/src/applications/ponder/view/PonderVotableView.php @@ -73,18 +73,20 @@ final class PonderVotableView extends AphrontView { 'vote' => (int)$this->vote, ), ), - javelin_render_tag( - 'div', - array( - 'class' => 'ponder-votebox', - ), - $up.$count.$down). - phutil_render_tag( - 'div', - array( - 'class' => 'ponder-votebox-content', - ), - $this->renderChildren())); + array( + javelin_tag( + 'div', + array( + 'class' => 'ponder-votebox', + ), + array($up, $count, $down)), + phutil_render_tag( + 'div', + array( + 'class' => 'ponder-votebox-content', + ), + $this->renderChildren()), + )); } } diff --git a/src/applications/uiexample/examples/JavelinViewExampleServerView.php b/src/applications/uiexample/examples/JavelinViewExampleServerView.php index ba02d27cd9..2d59917a7c 100644 --- a/src/applications/uiexample/examples/JavelinViewExampleServerView.php +++ b/src/applications/uiexample/examples/JavelinViewExampleServerView.php @@ -1,11 +1,14 @@ 'server-view'), - $this->renderChildren() - ); + array( + 'class' => 'server-view', + ), + $this->renderChildren()); } + } diff --git a/src/view/control/AphrontTableView.php b/src/view/control/AphrontTableView.php index ace3c7b9d1..10c723c96a 100644 --- a/src/view/control/AphrontTableView.php +++ b/src/view/control/AphrontTableView.php @@ -311,12 +311,15 @@ final class AphrontTableView extends AphrontView { array( 'class' => 'single-display-line-bounds', ), - phutil_render_tag( - 'span', - array( - 'class' => 'single-display-line-content', - ), - $line).' '); + array( + phutil_tag( + 'span', + array( + 'class' => 'single-display-line-content', + ), + $line), + "\xC2\xA0", + )); } -- 2.51.2 From 820c6279f301b3f6eefe8451489c64f966fe2d55 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:42:57 -0800 Subject: [PATCH 18/50] More render_tag -> tag (misc, form inset view) Summary: Converts some callsites. Test Plan: Grepped; looked -- see inlines. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4688 --- .../herald/controller/HeraldRuleController.php | 9 +++++---- src/view/form/AphrontFormInsetView.php | 4 ++-- src/view/page/PhabricatorStandardPageView.php | 14 ++++++++------ src/view/page/menu/PhabricatorMainMenuView.php | 13 ++++++++----- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index 8b32bd6ae7..f61062520d 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -133,8 +133,8 @@ final class HeraldRuleController extends HeraldController { ), 'Create New Condition')) ->setDescription( - 'When '.$must_match_selector . - ' these conditions are met:') + phutil_safe_html( + 'When '.$must_match_selector.' these conditions are met:')) ->setContent(javelin_tag( 'table', array( @@ -154,8 +154,9 @@ final class HeraldRuleController extends HeraldController { 'mustcapture' => true, ), 'Create New Action')) - ->setDescription('Take these actions '.$repetition_selector. - ' this rule matches:') + ->setDescription( + phutil_safe_html( + 'Take these actions '.$repetition_selector.' this rule matches:')) ->setContent(javelin_tag( 'table', array( diff --git a/src/view/form/AphrontFormInsetView.php b/src/view/form/AphrontFormInsetView.php index 002b074eb5..185e5ead19 100644 --- a/src/view/form/AphrontFormInsetView.php +++ b/src/view/form/AphrontFormInsetView.php @@ -68,7 +68,7 @@ final class AphrontFormInsetView extends AphrontView { $hidden_inputs = implode("\n", $hidden_inputs); if ($this->rightButton) { - $right_button = phutil_render_tag( + $right_button = phutil_tag( 'div', array( 'style' => 'float: right;', @@ -77,7 +77,7 @@ final class AphrontFormInsetView extends AphrontView { } if ($this->description) { - $desc = phutil_render_tag( + $desc = phutil_tag( 'p', array(), $this->description); diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 26ae9f3c09..2e44c4af3d 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -255,12 +255,14 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { $developer_warning = null; if (PhabricatorEnv::getEnvConfig('phabricator.show-error-callout') && DarkConsoleErrorLogPluginAPI::getErrors()) { - $developer_warning = - '
    '. - pht( - 'This page raised PHP errors. Find them in DarkConsole '. - 'or the error log.'). - '
    '; + $developer_warning = phutil_tag( + 'div', + array( + 'class' => 'aphront-developer-error-callout', + ), + pht( + 'This page raised PHP errors. Find them in DarkConsole '. + 'or the error log.')); } // Render the "you have unresolved setup issues..." warning. diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php index a16e813575..e56ab6bcee 100644 --- a/src/view/page/menu/PhabricatorMainMenuView.php +++ b/src/view/page/menu/PhabricatorMainMenuView.php @@ -316,15 +316,15 @@ final class PhabricatorMainMenuView extends AphrontView { $message_count_number = "\xE2\x88\x9E"; } - $message_count_tag = phutil_render_tag( + $message_count_tag = phutil_tag( 'span', array( 'id' => $message_count_id, 'class' => 'phabricator-main-menu-message-count' ), - phutil_escape_html($message_count_number)); + $message_count_number); - $message_icon_tag = phutil_render_tag( + $message_icon_tag = phutil_tag( 'span', array( 'class' => 'sprite-menu phabricator-main-menu-message-icon', @@ -335,14 +335,17 @@ final class PhabricatorMainMenuView extends AphrontView { $container_classes[] = 'message-unread'; } - $message_tag = phutil_render_tag( + $message_tag = phutil_tag( 'a', array( 'href' => '/conpherence/', 'class' => implode(' ', $container_classes), 'id' => $message_id, ), - $message_icon_tag.$message_count_tag); + array( + $message_icon_tag, + $message_count_tag, + )); } $count_id = celerity_generate_unique_node_id(); -- 2.51.2 From edfcd7bd2d6a2979b3b136a481a6b207700dabed Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:44:15 -0800 Subject: [PATCH 19/50] render_tag -> tag: phame, remarkup Summary: Converts various callsites from render_tag variants to tag variants. Test Plan: See inlines. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4689 --- ...rentialBlameRevisionFieldSpecification.php | 2 +- .../DifferentialUnitFieldSpecification.php | 2 +- .../controller/DiffusionBrowseController.php | 2 +- .../controller/DiffusionCommitController.php | 3 +- .../query/browse/DiffusionBrowseQuery.php | 2 +- .../PhabricatorPeopleProfileController.php | 2 +- .../phame/skins/PhameBasicBlogSkin.php | 16 +++- src/applications/phame/view/PhamePostView.php | 84 ++++++++++--------- .../ConduitAPI_remarkup_process_Method.php | 9 +- .../PhabricatorSlowvotePollController.php | 3 +- .../markup/PhabricatorMarkupEngine.php | 2 +- 11 files changed, 73 insertions(+), 54 deletions(-) diff --git a/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php b/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php index 27573da141..0c4bb8c366 100644 --- a/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialBlameRevisionFieldSpecification.php @@ -48,7 +48,7 @@ final class DifferentialBlameRevisionFieldSpecification return null; } $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); - return $engine->markupText($this->value); + return phutil_safe_html($engine->markupText($this->value)); } public function shouldAppearOnConduitView() { diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index b4e89b3fa9..348964045c 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 = $engine->markupText($userdata); + $userdata = phutil_safe_html($engine->markupText($userdata)); $rows[] = array( 'style' => 'details', 'value' => $userdata, diff --git a/src/applications/diffusion/controller/DiffusionBrowseController.php b/src/applications/diffusion/controller/DiffusionBrowseController.php index 62d247a651..7d3ac8ed7c 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseController.php @@ -106,7 +106,7 @@ final class DiffusionBrowseController extends DiffusionController { private function markupText($text) { $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); - $text = $engine->markupText($text); + $text = phutil_safe_html($engine->markupText($text)); $text = phutil_tag( 'div', diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 8afcc4b0e7..235be74c25 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -93,7 +93,8 @@ final class DiffusionCommitController extends DiffusionController { $property_list->addTextContent( '
    '. - $engine->markupText($commit_data->getCommitMessage()). + phutil_safe_html( + $engine->markupText($commit_data->getCommitMessage())). '
    ' ); diff --git a/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php b/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php index 832f4784d9..a4d2d44ceb 100644 --- a/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php +++ b/src/applications/diffusion/query/browse/DiffusionBrowseQuery.php @@ -127,7 +127,7 @@ abstract class DiffusionBrowseQuery { } else { // Markup extensionless files as remarkup so we get links and such. $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); - $readme_content = $engine->markupText($readme_content); + $readme_content = phutil_safe_html($engine->markupText($readme_content)); $class = 'phabricator-remarkup'; } diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index 88a62a3dab..576758f2e9 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -165,7 +165,7 @@ final class PhabricatorPeopleProfileController '//Nothing is known about this rare specimen.//'); $engine = PhabricatorMarkupEngine::newProfileMarkupEngine(); - $blurb = $engine->markupText($blurb); + $blurb = phutil_safe_html($engine->markupText($blurb)); $viewer = $this->getRequest()->getUser(); diff --git a/src/applications/phame/skins/PhameBasicBlogSkin.php b/src/applications/phame/skins/PhameBasicBlogSkin.php index 74d70f4f52..569bb6b3b3 100644 --- a/src/applications/phame/skins/PhameBasicBlogSkin.php +++ b/src/applications/phame/skins/PhameBasicBlogSkin.php @@ -70,6 +70,7 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { $view->setFrameable(true); } + $view->appendChild($content); $response = new AphrontWebpageResponse(); @@ -95,23 +96,30 @@ abstract class PhameBasicBlogSkin extends PhameBlogSkin { $summaries[] = $post->renderWithSummary(); } - $list = phutil_render_tag( + $list = phutil_tag( 'div', array( 'class' => 'phame-post-list', ), id(new AphrontNullView())->appendChild($summaries)->render()); - $pager = $this->renderOlderPageLink().$this->renderNewerPageLink(); - if ($pager) { + $pager = null; + if ($this->renderOlderPageLink() || $this->renderNewerPageLink()) { $pager = phutil_tag( 'div', array( 'class' => 'phame-pager', + ), + array( + $this->renderOlderPageLink(), + $this->renderNewerPageLink(), )); } - return $list.$pager; + return array( + $list, + $pager, + ); } protected function render404Page() { diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index 533d4402a5..8c5a47c452 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -87,7 +87,7 @@ final class PhamePostView extends AphrontView { } public function renderBody() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-post-body', @@ -96,7 +96,7 @@ final class PhamePostView extends AphrontView { } public function renderSummary() { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-post-body', @@ -159,20 +159,19 @@ final class PhamePostView extends AphrontView { array( 'id' => 'fb-root', ), - '' - ); + ''); $c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id; - $fb_js = jsprintf( - '', - $c_uri - ); + $fb_js = phutil_safe_html( + jsprintf( + '', + $c_uri)); $uri = $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()); @@ -183,17 +182,18 @@ final class PhamePostView extends AphrontView { 'data-href' => $uri, 'data-num-posts' => 5, ), - '' - ); + ''); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-comments-facebook', ), - $fb_root. - $fb_js. - $fb_comments); + array( + $fb_root, + $fb_js, + $fb_comments, + )); } private function renderDisqusComments() { @@ -211,32 +211,34 @@ final class PhamePostView extends AphrontView { ); // protip - try some var disqus_developer = 1; action to test locally - $disqus_js = jsprintf( - '', - $post->getPHID(), - $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()), - $post->getTitle() - ); + $disqus_js = phutil_safe_html( + jsprintf( + '', + $post->getPHID(), + $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()), + $post->getTitle())); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phame-comments-disqus', ), - $disqus_thread. - $disqus_js); + array( + $disqus_thread, + $disqus_js, + )); } } diff --git a/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php b/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php index 6986488342..7d51f23d26 100644 --- a/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php +++ b/src/applications/remarkup/conduit/ConduitAPI_remarkup_process_Method.php @@ -43,8 +43,15 @@ final class ConduitAPI_remarkup_process_Method extends ConduitAPIMethod { $engine = PhabricatorMarkupEngine::$engine_class(); $engine->setConfig('viewer', $request->getUser()); + $text = $engine->markupText($content); + if ($text) { + $content = phutil_safe_html($text)->getHTMLContent(); + } else { + $content = ''; + } + $result = array( - 'content' => $engine->markupText($content), + 'content' => $content, ); return $result; diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 531ddaba61..2bc75bc744 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -203,7 +203,8 @@ final class PhabricatorSlowvotePollController foreach ($comments as $comment) { $handle = $handles[$comment->getAuthorPHID()]; - $markup = $engine->markupText($comment->getCommentText()); + $markup = phutil_safe_html( + $engine->markupText($comment->getCommentText())); require_celerity_resource('phabricator-remarkup-css'); diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php index 9a82942558..5e9a96d31d 100644 --- a/src/infrastructure/markup/PhabricatorMarkupEngine.php +++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php @@ -160,7 +160,7 @@ final class PhabricatorMarkupEngine { "Call process() before getOutput()."); } - return $this->objects[$key]['output']; + return new PhutilSafeHTML($this->objects[$key]['output']); } -- 2.51.2 From 9a0ae6376fe40f940eeea671d5b334a0cefbcc33 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:44:54 -0800 Subject: [PATCH 20/50] render_tag -> tag: pinboards Summary: Fix pinboard callsites. Test Plan: Looked at Pholio and Macro. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4690 --- .../controller/PhabricatorMacroListController.php | 2 +- src/view/layout/PhabricatorPinboardItemView.php | 14 +++++++++----- src/view/layout/PhabricatorPinboardView.php | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/applications/macro/controller/PhabricatorMacroListController.php b/src/applications/macro/controller/PhabricatorMacroListController.php index 0ed1bebc77..68d395ecfe 100644 --- a/src/applications/macro/controller/PhabricatorMacroListController.php +++ b/src/applications/macro/controller/PhabricatorMacroListController.php @@ -125,7 +125,7 @@ final class PhabricatorMacroListController if ($file->getAuthorPHID()) { $author_handle = $this->getHandle($file->getAuthorPHID()); $item->appendChild( - 'Created by '.$author_handle->renderLink()); + pht('Created by %s', $author_handle->renderLink())); } $datetime = phabricator_date($file->getDateCreated(), $viewer); $item->appendChild( diff --git a/src/view/layout/PhabricatorPinboardItemView.php b/src/view/layout/PhabricatorPinboardItemView.php index 76cf5104ba..683a6cf4dd 100644 --- a/src/view/layout/PhabricatorPinboardItemView.php +++ b/src/view/layout/PhabricatorPinboardItemView.php @@ -33,13 +33,12 @@ final class PhabricatorPinboardItemView extends AphrontView { public function render() { $header = null; if ($this->header) { - $header = hsprintf('%s', $this->uri, $this->header); $header = phutil_tag( 'div', array( 'class' => 'phabricator-pinboard-item-header', ), - $header); + phutil_tag('a', array('href' => $this->uri), $this->header)); } $image = phutil_tag( @@ -56,9 +55,9 @@ final class PhabricatorPinboardItemView extends AphrontView { 'height' => $this->imageHeight, ))); - $content = $this->renderChildren(); + $content = $this->renderHTMLChildren(); if ($content) { - $content = phutil_render_tag( + $content = phutil_tag( 'div', array( 'class' => 'phabricator-pinboard-item-content', @@ -71,7 +70,12 @@ final class PhabricatorPinboardItemView extends AphrontView { array( 'class' => 'phabricator-pinboard-item-view', ), - array($header, $image, $content)); + $this->renderHTMLView( + array( + $header, + $image, + $content, + ))); } } diff --git a/src/view/layout/PhabricatorPinboardView.php b/src/view/layout/PhabricatorPinboardView.php index 1fa98fe14a..a776025c20 100644 --- a/src/view/layout/PhabricatorPinboardView.php +++ b/src/view/layout/PhabricatorPinboardView.php @@ -26,12 +26,12 @@ final class PhabricatorPinboardView extends AphrontView { ->render(); } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-pinboard-view', ), - $this->renderSingleView($this->items)); + $this->renderHTMLView($this->items)); } } -- 2.51.2 From 114ed6c7feeafddfc0a92944990e9efbc66bd136 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:45:32 -0800 Subject: [PATCH 21/50] DarkConsole: fix rendering, move request log, load over ajax Summary: This accomplishes three major goals: # Fixes phutil_render_tag -> phutil_tag callsites in DarkConsole. # Moves the Ajax request log to a new panel on the left. This panel (and the tabs panel) get scrollbars when they get large, instead of making the page constantly scroll down. # Loads the panel content over ajax, instead of dumping it into the page body / ajax response body. I've been planning to do this for about 3 years, which is why the plugins are architected the way they are. This should make debugging easier by making response bodies not be 50%+ darkconsole stuff. Additionally, load the plugins dynamically (the old method predates library maps and PhutilSymbolLoader). Test Plan: {F30675} - Switched between requests and tabs, reloaded page, saw same tab. - Used "analyze queries", "profile page", triggered errors. - Verified page does not load anything by default if dark console is closed with Charles. - Generally banged on it a bit. Reviewers: vrana, btrahan, chad Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4692 --- scripts/celerity_mapper.php | 1 - src/__celerity_resource_map__.php | 155 ++++----- src/__phutil_library_map__.php | 2 + ...AphrontDefaultApplicationConfiguration.php | 5 +- src/aphront/console/DarkConsoleCore.php | 205 +++-------- .../console/DarkConsoleDataController.php | 69 ++++ .../plugin/DarkConsoleErrorLogPlugin.php | 23 +- .../console/plugin/DarkConsoleEventPlugin.php | 2 +- .../console/plugin/DarkConsolePlugin.php | 21 +- .../plugin/DarkConsoleRequestPlugin.php | 3 +- .../plugin/DarkConsoleServicesPlugin.php | 11 +- .../plugin/DarkConsoleXHProfPlugin.php | 30 +- src/aphront/response/AphrontAjaxResponse.php | 6 +- src/view/page/PhabricatorStandardPageView.php | 11 +- webroot/rsrc/css/aphront/dark-console.css | 123 ++++--- webroot/rsrc/image/darkload.gif | Bin 0 -> 9427 bytes .../core/behavior-dark-console-ajax.js | 49 --- .../application/core/behavior-dark-console.js | 323 +++++++++++------- 18 files changed, 559 insertions(+), 480 deletions(-) create mode 100644 src/aphront/console/DarkConsoleDataController.php create mode 100644 webroot/rsrc/image/darkload.gif delete mode 100644 webroot/rsrc/js/application/core/behavior-dark-console-ajax.js diff --git a/scripts/celerity_mapper.php b/scripts/celerity_mapper.php index fd24b0eaa4..93867c86ff 100755 --- a/scripts/celerity_mapper.php +++ b/scripts/celerity_mapper.php @@ -166,7 +166,6 @@ $package_spec = array( 'javelin-behavior-maniphest-subpriority-editor', ), 'darkconsole.pkg.js' => array( - 'javelin-behavior-dark-console-ajax', 'javelin-behavior-dark-console', 'javelin-behavior-error-log', ), diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index 6edcdb0feb..da47577120 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -42,6 +42,13 @@ celerity_register_resource_map(array( 'disk' => '/rsrc/image/credit_cards.png', 'type' => 'png', ), + '/rsrc/image/darkload.gif' => + array( + 'hash' => '3a52cb7145d6e70f461fed21273117f2', + 'uri' => '/res/3a52cb71/rsrc/image/darkload.gif', + 'disk' => '/rsrc/image/darkload.gif', + 'type' => 'gif', + ), '/rsrc/image/divot.png' => array( 'hash' => '3be267bd11ea375bf68e808893718e0e', @@ -598,7 +605,7 @@ celerity_register_resource_map(array( ), 'aphront-dark-console-css' => array( - 'uri' => '/res/1e1f78d4/rsrc/css/aphront/dark-console.css', + 'uri' => '/res/63841304/rsrc/css/aphront/dark-console.css', 'type' => 'css', 'requires' => array( @@ -1057,7 +1064,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-aphront-form-disable-on-submit' => array( - 'uri' => '/res/ca54e8b9/rsrc/js/application/core/behavior-form.js', + 'uri' => '/res/70fd43fd/rsrc/js/application/core/behavior-form.js', 'type' => 'js', 'requires' => array( @@ -1145,7 +1152,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-dark-console' => array( - 'uri' => '/res/aa6f8a71/rsrc/js/application/core/behavior-dark-console.js', + 'uri' => '/res/c3e8a3d8/rsrc/js/application/core/behavior-dark-console.js', 'type' => 'js', 'requires' => array( @@ -1155,21 +1162,9 @@ celerity_register_resource_map(array( 3 => 'javelin-dom', 4 => 'javelin-request', 5 => 'phabricator-keyboard-shortcut', - 6 => 'javelin-behavior-dark-console-ajax', ), 'disk' => '/rsrc/js/application/core/behavior-dark-console.js', ), - 'javelin-behavior-dark-console-ajax' => - array( - 'uri' => '/res/ac3ab63a/rsrc/js/application/core/behavior-dark-console-ajax.js', - 'type' => 'js', - 'requires' => - array( - 0 => 'javelin-behavior', - 1 => 'javelin-dom', - ), - 'disk' => '/rsrc/js/application/core/behavior-dark-console-ajax.js', - ), 'javelin-behavior-device' => array( 'uri' => '/res/a10b851b/rsrc/js/application/core/behavior-device.js', @@ -1493,7 +1488,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-lightbox-attachments' => array( - 'uri' => '/res/5efba371/rsrc/js/application/core/behavior-lightbox-attachments.js', + 'uri' => '/res/08f5e202/rsrc/js/application/core/behavior-lightbox-attachments.js', 'type' => 'js', 'requires' => array( @@ -1986,7 +1981,7 @@ celerity_register_resource_map(array( ), 'javelin-dom' => array( - 'uri' => '/res/2826c532/rsrc/js/javelin/lib/DOM.js', + 'uri' => '/res/459f3c08/rsrc/js/javelin/lib/DOM.js', 'type' => 'js', 'requires' => array( @@ -3393,7 +3388,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/023adc14/core.pkg.css', 'type' => 'css', ), - '66dca903' => + 'b3c1b6e7' => array( 'name' => 'core.pkg.js', 'symbols' => @@ -3432,19 +3427,18 @@ celerity_register_resource_map(array( 31 => 'javelin-behavior-global-drag-and-drop', 32 => 'javelin-behavior-phabricator-home-reveal-tiles', ), - 'uri' => '/res/pkg/66dca903/core.pkg.js', + 'uri' => '/res/pkg/b3c1b6e7/core.pkg.js', 'type' => 'js', ), - '8edbada5' => + '032118cf' => array( 'name' => 'darkconsole.pkg.js', 'symbols' => array( - 0 => 'javelin-behavior-dark-console-ajax', - 1 => 'javelin-behavior-dark-console', - 2 => 'javelin-behavior-error-log', + 0 => 'javelin-behavior-dark-console', + 1 => 'javelin-behavior-error-log', ), - 'uri' => '/res/pkg/8edbada5/darkconsole.pkg.js', + 'uri' => '/res/pkg/032118cf/darkconsole.pkg.js', 'type' => 'js', ), 'ec01d039' => @@ -3521,7 +3515,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/f96657b8/diffusion.pkg.js', 'type' => 'js', ), - 'fbeded59' => + '1c6f020b' => array( 'name' => 'javelin.pkg.js', 'symbols' => @@ -3546,7 +3540,7 @@ celerity_register_resource_map(array( 17 => 'javelin-typeahead-ondemand-source', 18 => 'javelin-tokenizer', ), - 'uri' => '/res/pkg/fbeded59/javelin.pkg.js', + 'uri' => '/res/pkg/1c6f020b/javelin.pkg.js', 'type' => 'js', ), 'e30a3fa8' => @@ -3608,18 +3602,17 @@ celerity_register_resource_map(array( 'diffusion-icons-css' => 'c8ce2d88', 'global-drag-and-drop-css' => '023adc14', 'inline-comment-summary-css' => 'ec01d039', - 'javelin-aphlict' => '66dca903', - 'javelin-behavior' => 'fbeded59', - 'javelin-behavior-aphlict-dropdown' => '66dca903', - 'javelin-behavior-aphlict-listen' => '66dca903', - 'javelin-behavior-aphront-basic-tokenizer' => '66dca903', + 'javelin-aphlict' => 'b3c1b6e7', + 'javelin-behavior' => '1c6f020b', + 'javelin-behavior-aphlict-dropdown' => 'b3c1b6e7', + 'javelin-behavior-aphlict-listen' => 'b3c1b6e7', + 'javelin-behavior-aphront-basic-tokenizer' => 'b3c1b6e7', 'javelin-behavior-aphront-drag-and-drop' => '310cd201', 'javelin-behavior-aphront-drag-and-drop-textarea' => '310cd201', - 'javelin-behavior-aphront-form-disable-on-submit' => '66dca903', + 'javelin-behavior-aphront-form-disable-on-submit' => 'b3c1b6e7', 'javelin-behavior-audit-preview' => 'f96657b8', - 'javelin-behavior-dark-console' => '8edbada5', - 'javelin-behavior-dark-console-ajax' => '8edbada5', - 'javelin-behavior-device' => '66dca903', + 'javelin-behavior-dark-console' => '032118cf', + 'javelin-behavior-device' => 'b3c1b6e7', 'javelin-behavior-differential-accept-with-errors' => '310cd201', 'javelin-behavior-differential-add-reviewers-and-ccs' => '310cd201', 'javelin-behavior-differential-comment-jump' => '310cd201', @@ -3634,84 +3627,84 @@ celerity_register_resource_map(array( 'javelin-behavior-differential-user-select' => '310cd201', 'javelin-behavior-diffusion-commit-graph' => 'f96657b8', 'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8', - 'javelin-behavior-error-log' => '8edbada5', - 'javelin-behavior-global-drag-and-drop' => '66dca903', - 'javelin-behavior-konami' => '66dca903', - 'javelin-behavior-lightbox-attachments' => '66dca903', + 'javelin-behavior-error-log' => '032118cf', + 'javelin-behavior-global-drag-and-drop' => 'b3c1b6e7', + 'javelin-behavior-konami' => 'b3c1b6e7', + 'javelin-behavior-lightbox-attachments' => 'b3c1b6e7', 'javelin-behavior-maniphest-batch-selector' => '7707de41', 'javelin-behavior-maniphest-subpriority-editor' => '7707de41', 'javelin-behavior-maniphest-transaction-controls' => '7707de41', 'javelin-behavior-maniphest-transaction-expand' => '7707de41', 'javelin-behavior-maniphest-transaction-preview' => '7707de41', - 'javelin-behavior-phabricator-active-nav' => '66dca903', - 'javelin-behavior-phabricator-autofocus' => '66dca903', - 'javelin-behavior-phabricator-home-reveal-tiles' => '66dca903', - 'javelin-behavior-phabricator-keyboard-shortcuts' => '66dca903', - 'javelin-behavior-phabricator-nav' => '66dca903', + 'javelin-behavior-phabricator-active-nav' => 'b3c1b6e7', + 'javelin-behavior-phabricator-autofocus' => 'b3c1b6e7', + 'javelin-behavior-phabricator-home-reveal-tiles' => 'b3c1b6e7', + 'javelin-behavior-phabricator-keyboard-shortcuts' => 'b3c1b6e7', + 'javelin-behavior-phabricator-nav' => 'b3c1b6e7', 'javelin-behavior-phabricator-object-selector' => '310cd201', - 'javelin-behavior-phabricator-oncopy' => '66dca903', - 'javelin-behavior-phabricator-remarkup-assist' => '66dca903', - 'javelin-behavior-phabricator-search-typeahead' => '66dca903', - 'javelin-behavior-phabricator-tooltips' => '66dca903', - 'javelin-behavior-phabricator-watch-anchor' => '66dca903', - 'javelin-behavior-refresh-csrf' => '66dca903', + 'javelin-behavior-phabricator-oncopy' => 'b3c1b6e7', + 'javelin-behavior-phabricator-remarkup-assist' => 'b3c1b6e7', + 'javelin-behavior-phabricator-search-typeahead' => 'b3c1b6e7', + 'javelin-behavior-phabricator-tooltips' => 'b3c1b6e7', + 'javelin-behavior-phabricator-watch-anchor' => 'b3c1b6e7', + 'javelin-behavior-refresh-csrf' => 'b3c1b6e7', 'javelin-behavior-repository-crossreference' => '310cd201', - 'javelin-behavior-toggle-class' => '66dca903', - 'javelin-behavior-workflow' => '66dca903', - 'javelin-dom' => 'fbeded59', - 'javelin-event' => 'fbeded59', - 'javelin-install' => 'fbeded59', - 'javelin-json' => 'fbeded59', - 'javelin-mask' => 'fbeded59', - 'javelin-request' => 'fbeded59', - 'javelin-resource' => 'fbeded59', - 'javelin-stratcom' => 'fbeded59', - 'javelin-tokenizer' => 'fbeded59', - 'javelin-typeahead' => 'fbeded59', - 'javelin-typeahead-normalizer' => 'fbeded59', - 'javelin-typeahead-ondemand-source' => 'fbeded59', - 'javelin-typeahead-preloaded-source' => 'fbeded59', - 'javelin-typeahead-source' => 'fbeded59', - 'javelin-uri' => 'fbeded59', - 'javelin-util' => 'fbeded59', - 'javelin-vector' => 'fbeded59', - 'javelin-workflow' => 'fbeded59', + 'javelin-behavior-toggle-class' => 'b3c1b6e7', + 'javelin-behavior-workflow' => 'b3c1b6e7', + 'javelin-dom' => '1c6f020b', + 'javelin-event' => '1c6f020b', + 'javelin-install' => '1c6f020b', + 'javelin-json' => '1c6f020b', + 'javelin-mask' => '1c6f020b', + 'javelin-request' => '1c6f020b', + 'javelin-resource' => '1c6f020b', + 'javelin-stratcom' => '1c6f020b', + 'javelin-tokenizer' => '1c6f020b', + 'javelin-typeahead' => '1c6f020b', + 'javelin-typeahead-normalizer' => '1c6f020b', + 'javelin-typeahead-ondemand-source' => '1c6f020b', + 'javelin-typeahead-preloaded-source' => '1c6f020b', + 'javelin-typeahead-source' => '1c6f020b', + 'javelin-uri' => '1c6f020b', + 'javelin-util' => '1c6f020b', + 'javelin-vector' => '1c6f020b', + 'javelin-workflow' => '1c6f020b', 'lightbox-attachment-css' => '023adc14', 'maniphest-task-summary-css' => 'e30a3fa8', 'maniphest-transaction-detail-css' => 'e30a3fa8', - 'phabricator-busy' => '66dca903', + 'phabricator-busy' => 'b3c1b6e7', 'phabricator-content-source-view-css' => 'ec01d039', 'phabricator-core-buttons-css' => '023adc14', 'phabricator-core-css' => '023adc14', 'phabricator-crumbs-view-css' => '023adc14', 'phabricator-directory-css' => '023adc14', 'phabricator-drag-and-drop-file-upload' => '310cd201', - 'phabricator-dropdown-menu' => '66dca903', - 'phabricator-file-upload' => '66dca903', + 'phabricator-dropdown-menu' => 'b3c1b6e7', + 'phabricator-file-upload' => 'b3c1b6e7', 'phabricator-filetree-view-css' => '023adc14', 'phabricator-flag-css' => '023adc14', 'phabricator-form-view-css' => '023adc14', 'phabricator-header-view-css' => '023adc14', 'phabricator-jump-nav' => '023adc14', - 'phabricator-keyboard-shortcut' => '66dca903', - 'phabricator-keyboard-shortcut-manager' => '66dca903', + 'phabricator-keyboard-shortcut' => 'b3c1b6e7', + 'phabricator-keyboard-shortcut-manager' => 'b3c1b6e7', 'phabricator-main-menu-view' => '023adc14', - 'phabricator-menu-item' => '66dca903', + 'phabricator-menu-item' => 'b3c1b6e7', 'phabricator-nav-view-css' => '023adc14', - 'phabricator-notification' => '66dca903', + 'phabricator-notification' => 'b3c1b6e7', 'phabricator-notification-css' => '023adc14', 'phabricator-notification-menu-css' => '023adc14', 'phabricator-object-item-list-view-css' => '023adc14', 'phabricator-object-selector-css' => 'ec01d039', - 'phabricator-paste-file-upload' => '66dca903', - 'phabricator-prefab' => '66dca903', + 'phabricator-paste-file-upload' => 'b3c1b6e7', + 'phabricator-prefab' => 'b3c1b6e7', 'phabricator-project-tag-css' => 'e30a3fa8', 'phabricator-remarkup-css' => '023adc14', 'phabricator-shaped-request' => '310cd201', 'phabricator-side-menu-view-css' => '023adc14', 'phabricator-standard-page-view' => '023adc14', - 'phabricator-textareautils' => '66dca903', - 'phabricator-tooltip' => '66dca903', + 'phabricator-textareautils' => 'b3c1b6e7', + 'phabricator-tooltip' => 'b3c1b6e7', 'phabricator-transaction-view-css' => '023adc14', 'phabricator-zindex-css' => '023adc14', 'sprite-apps-large-css' => '023adc14', diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 5090f256e3..c5474942ed 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -218,6 +218,7 @@ phutil_register_library_map(array( 'ConpherenceViewController' => 'applications/conpherence/controller/ConpherenceViewController.php', 'DarkConsoleController' => 'aphront/console/DarkConsoleController.php', 'DarkConsoleCore' => 'aphront/console/DarkConsoleCore.php', + 'DarkConsoleDataController' => 'aphront/console/DarkConsoleDataController.php', 'DarkConsoleErrorLogPlugin' => 'aphront/console/plugin/DarkConsoleErrorLogPlugin.php', 'DarkConsoleErrorLogPluginAPI' => 'aphront/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php', 'DarkConsoleEventPlugin' => 'aphront/console/plugin/DarkConsoleEventPlugin.php', @@ -1693,6 +1694,7 @@ phutil_register_library_map(array( 'ConpherenceUpdateController' => 'ConpherenceController', 'ConpherenceViewController' => 'ConpherenceController', 'DarkConsoleController' => 'PhabricatorController', + 'DarkConsoleDataController' => 'PhabricatorController', 'DarkConsoleErrorLogPlugin' => 'DarkConsolePlugin', 'DarkConsoleEventPlugin' => 'DarkConsolePlugin', 'DarkConsoleEventPluginAPI' => 'PhutilEventListener', diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index 6d17506831..764df9f141 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -73,7 +73,10 @@ class AphrontDefaultApplicationConfiguration 'profile/(?P[^/]+)/' => 'PhabricatorXHProfProfileController', ), - '/~/' => 'DarkConsoleController', + '/~/' => array( + '' => 'DarkConsoleController', + 'data/(?P[^/]+)/' => 'DarkConsoleDataController', + ), '/search/' => array( '' => 'PhabricatorSearchController', diff --git a/src/aphront/console/DarkConsoleCore.php b/src/aphront/console/DarkConsoleCore.php index 2a60c24bd1..90c5ec3ca8 100644 --- a/src/aphront/console/DarkConsoleCore.php +++ b/src/aphront/console/DarkConsoleCore.php @@ -5,57 +5,32 @@ */ final class DarkConsoleCore { - const PLUGIN_ERRORLOG = 'ErrorLog'; - const PLUGIN_SERVICES = 'Services'; - const PLUGIN_EVENT = 'Event'; - const PLUGIN_XHPROF = 'XHProf'; - const PLUGIN_REQUEST = 'Request'; - - public static function getPlugins() { - return array( - self::PLUGIN_ERRORLOG, - self::PLUGIN_REQUEST, - self::PLUGIN_SERVICES, - self::PLUGIN_EVENT, - self::PLUGIN_XHPROF, - ); - } - private $plugins = array(); - private $settings; - private $coredata; - - public function getPlugin($plugin_name) { - return idx($this->plugins, $plugin_name); - } + const STORAGE_VERSION = 1; public function __construct() { - foreach (self::getPlugins() as $plugin_name) { - $plugin = self::newPlugin($plugin_name); - if ($plugin->isPermanent() || !isset($disabled[$plugin_name])) { - if ($plugin->shouldStartup()) { - $plugin->didStartup(); - $plugin->setConsoleCore($this); - $this->plugins[$plugin_name] = $plugin; - } + $symbols = id(new PhutilSymbolLoader()) + ->setType('class') + ->setAncestorClass('DarkConsolePlugin') + ->selectAndLoadSymbols(); + + foreach ($symbols as $symbol) { + $plugin = newv($symbol['name'], array()); + if (!$plugin->shouldStartup()) { + continue; } + $plugin->setConsoleCore($this); + $plugin->didStartup(); + $this->plugins[$symbol['name']] = $plugin; } } - public static function newPlugin($plugin) { - $class = 'DarkConsole'.$plugin.'Plugin'; - return newv($class, array()); - } - - public function getEnabledPlugins() { + public function getPlugins() { return $this->plugins; } - public function render(AphrontRequest $request) { - - $user = $request->getUser(); - - $plugins = $this->getEnabledPlugins(); + public function getKey(AphrontRequest $request) { + $plugins = $this->getPlugins(); foreach ($plugins as $plugin) { $plugin->setRequest($request); @@ -70,128 +45,58 @@ final class DarkConsoleCore { $plugin->setData($plugin->generateData()); } - $selected = $user->getConsoleTab(); - $visible = $user->getConsoleVisible(); + $plugins = msort($plugins, 'getOrderKey'); - if (!isset($plugins[$selected])) { - $selected = head_key($plugins); - } + $key = Filesystem::readRandomCharacters(24); $tabs = array(); - foreach ($plugins as $key => $plugin) { - $tabs[$key] = array( + $data = array(); + foreach ($plugins as $plugin) { + $class = get_class($plugin); + $tabs[] = array( + 'class' => $class, 'name' => $plugin->getName(), - 'panel' => $plugin->render(), + 'color' => $plugin->getColor(), ); + $data[$class] = $plugin->getData(); } - $tabs_markup = array(); - $panel_markup = array(); - foreach ($tabs as $key => $data) { - $is_selected = ($key == $selected); - if ($is_selected) { - $style = null; - $tabclass = 'dark-console-tab-selected'; - } else { - $style = 'display: none;'; - $tabclass = null; - } + $storage = array( + 'vers' => self::STORAGE_VERSION, + 'tabs' => $tabs, + 'data' => $data, + 'user' => $request->getUser() + ? $request->getUser()->getPHID() + : null, + ); - $tabs_markup[] = javelin_tag( - 'a', - array( - 'class' => "dark-console-tab {$tabclass}", - 'sigil' => 'dark-console-tab', - 'id' => 'dark-console-tab-'.$key, - ), - (string)$data['name']); - - $panel_markup[] = javelin_render_tag( - 'div', - array( - 'class' => 'dark-console-panel dark-console-panel-'.$key, - 'style' => $style, - 'sigil' => 'dark-console-panel', - ), - (string)$data['panel']); - } + $cache = new PhabricatorKeyValueDatabaseCache(); + $cache = new PhutilKeyValueCacheProfiler($cache); + $cache->setProfiler(PhutilServiceProfiler::getInstance()); - $console = javelin_render_tag( - 'table', + $cache->setKeys( array( - 'class' => 'dark-console', - 'sigil' => 'dark-console', - 'style' => $visible ? '' : 'display: none;', + 'darkconsole:'.$key => json_encode($storage), ), - ''. - ''. - implode("\n", $tabs_markup). - ''. - ''.implode("\n", $panel_markup).''. - ''); - - if (!empty($_COOKIE['phsid'])) { - $console = str_replace( - $_COOKIE['phsid'], - phutil_escape_html(''), - $console); - } + $ttl = (60 * 60 * 6)); - if ($request->isAjax()) { - - // for ajax this HTML gets updated on the client - $request_history = null; - - } else { - - $request_table_header = - '
    '; - - $rows = array(); - - $table = new AphrontTableView($rows); - $table->setHeaders( - array( - 'Sequence', - 'Type', - 'URI', - )); - $table->setColumnClasses( - array( - '', - '', - 'wide', - )); - - $request_table = $request_table_header . $table->render(); - $request_history = javelin_render_tag( - 'table', - array( - 'class' => 'dark-console dark-console-request-log', - 'sigil' => 'dark-console-request-log', - 'style' => $visible ? '' : 'display: none;', - ), - ''. - ''. - phutil_tag( - 'a', - array( - 'class' => 'dark-console-tab dark-console-tab-selected', - ), - 'Request Log'). - ''. - ''. - javelin_render_tag( - 'div', - array( - 'class' => 'dark-console-panel dark-console-panel-RequestLog', - ), - $request_table). - ''. - ''); - } + return $key; + } + + public function render(AphrontRequest $request) { + $user = $request->getUser(); + $visible = $user ? $user->getConsoleVisible() : true; - return "\n\n\n\n".$console.$request_history."\n\n\n\n"; + return javelin_tag( + 'div', + array( + 'id' => 'darkconsole', + 'class' => 'dark-console', + 'style' => $visible ? '' : 'display: none;', + 'data-console-key' => $this->getKey($request), + ), + ''); } + } diff --git a/src/aphront/console/DarkConsoleDataController.php b/src/aphront/console/DarkConsoleDataController.php new file mode 100644 index 0000000000..e5f1cd9e84 --- /dev/null +++ b/src/aphront/console/DarkConsoleDataController.php @@ -0,0 +1,69 @@ +key = $data['key']; + } + + public function processRequest() { + $request = $this->getRequest(); + $user = $request->getUser(); + + $cache = new PhabricatorKeyValueDatabaseCache(); + $cache = new PhutilKeyValueCacheProfiler($cache); + $cache->setProfiler(PhutilServiceProfiler::getInstance()); + + $result = $cache->getKey('darkconsole:'.$this->key); + if (!$result) { + return new Aphront400Response(); + } + + $result = json_decode($result, true); + + if (!is_array($result)) { + return new Aphront400Response(); + } + + if ($result['vers'] != DarkConsoleCore::STORAGE_VERSION) { + return new Aphront400Response(); + } + + if ($result['user'] != $user->getPHID()) { + return new Aphront400Response(); + } + + $output = array(); + $output['tabs'] = $result['tabs']; + $output['panel'] = array(); + + foreach ($result['data'] as $class => $data) { + try { + $obj = newv($class, array()); + $obj->setData($data); + $obj->setRequest($request); + + $panel = $obj->renderPanel(); + + if (!empty($_COOKIE['phsid'])) { + $panel = str_replace( + $_COOKIE['phsid'], + '(session-key)', + $panel); + } + + $output['panel'][$class] = $panel; + } catch (Exception $ex) { + $output['panel'][$class] = 'error'; + } + } + + return id(new AphrontAjaxResponse())->setContent($output); + } + +} diff --git a/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php b/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php index fae5ff2cb1..98df6d113c 100644 --- a/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php @@ -7,29 +7,32 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin { public function getName() { $count = count($this->getData()); - if ($count) { - return - '• '. - "Error Log ({$count})"; + return pht('Error Log (%d)', $count); } + return pht('Error Log'); + } - return 'Error Log'; + public function getOrder() { + return 0; } + public function getColor() { + if (count($this->getData())) { + return '#ff0000'; + } + return null; + } public function getDescription() { - return 'Shows errors and warnings.'; + return pht('Shows errors and warnings.'); } - public function generateData() { return DarkConsoleErrorLogPluginAPI::getErrors(); } - - public function render() { - + public function renderPanel() { $data = $this->getData(); $rows = array(); diff --git a/src/aphront/console/plugin/DarkConsoleEventPlugin.php b/src/aphront/console/plugin/DarkConsoleEventPlugin.php index d4bd7dcc3b..8a855bb3f8 100644 --- a/src/aphront/console/plugin/DarkConsoleEventPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleEventPlugin.php @@ -37,7 +37,7 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin { ); } - public function render() { + public function renderPanel() { $data = $this->getData(); $out = array(); diff --git a/src/aphront/console/plugin/DarkConsolePlugin.php b/src/aphront/console/plugin/DarkConsolePlugin.php index 2499cfbc7a..20a93199c0 100644 --- a/src/aphront/console/plugin/DarkConsolePlugin.php +++ b/src/aphront/console/plugin/DarkConsolePlugin.php @@ -11,12 +11,27 @@ abstract class DarkConsolePlugin { abstract public function getName(); abstract public function getDescription(); - abstract public function render(); + abstract public function renderPanel(); public function __construct() { } + public function getColor() { + return null; + } + + final public function getOrderKey() { + return sprintf( + '%09d%s', + (int)(999999999 * $this->getOrder()), + $this->getName()); + } + + public function getOrder() { + return 1.0; + } + public function setConsoleCore(DarkConsoleCore $core) { $this->core = $core; return $this; @@ -52,10 +67,6 @@ abstract class DarkConsolePlugin { return $this->getRequest()->getRequestURI(); } - public function isPermanent() { - return false; - } - public function shouldStartup() { return true; } diff --git a/src/aphront/console/plugin/DarkConsoleRequestPlugin.php b/src/aphront/console/plugin/DarkConsoleRequestPlugin.php index e252f41e8a..7a59df8493 100644 --- a/src/aphront/console/plugin/DarkConsoleRequestPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleRequestPlugin.php @@ -20,8 +20,7 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin { ); } - public function render() { - + public function renderPanel() { $data = $this->getData(); $sections = array( diff --git a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php index 29e7c50d21..094abea57d 100644 --- a/src/aphront/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleServicesPlugin.php @@ -136,11 +136,16 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { 'start' => PhabricatorStartup::getStartTime(), 'end' => microtime(true), 'log' => $log, + 'analyzeURI' => (string)$this + ->getRequestURI() + ->alter('__analyze__', true), + 'didAnalyze' => isset($_REQUEST['__analyze__']), ); } - public function render() { + public function renderPanel() { $data = $this->getData(); + $log = $data['log']; $results = array(); @@ -149,8 +154,8 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { phutil_tag( 'a', array( - 'href' => $this->getRequestURI()->alter('__analyze__', true), - 'class' => isset($_REQUEST['__analyze__']) + 'href' => $data['analyzeURI'], + 'class' => $data['didAnalyze'] ? 'disabled button' : 'green button', ), diff --git a/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php b/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php index 9368cb7e66..4574056deb 100644 --- a/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php +++ b/src/aphront/console/plugin/DarkConsoleXHProfPlugin.php @@ -8,13 +8,15 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { protected $xhprofID; public function getName() { - $run = $this->getData(); + return 'XHProf'; + } - if ($run) { - return '• XHProf'; + public function getColor() { + $data = $this->getData(); + if ($data['xhprofID']) { + return '#ff00ff'; } - - return 'XHProf'; + return null; } public function getDescription() { @@ -22,14 +24,24 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { } public function generateData() { - return $this->xhprofID; + return array( + 'xhprofID' => $this->xhprofID, + 'profileURI' => (string)$this + ->getRequestURI() + ->alter('__profile__', 'page'), + ); } public function getXHProfRunID() { return $this->xhprofID; } - public function render() { + public function renderPanel() { + $data = $this->getData(); + + $run = $data['xhprofID']; + $profile_uri = $data['profileURI']; + if (!DarkConsoleXHProfPluginAPI::isProfilerAvailable()) { $href = PhabricatorEnv::getDoclink('article/Installation_Guide.html'); $install_guide = phutil_tag( @@ -49,14 +61,12 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin { $result = array(); - $run = $this->getXHProfRunID(); - $header = '
    '. phutil_tag( 'a', array( - 'href' => $this->getRequestURI()->alter('__profile__', 'page'), + 'href' => $profile_uri, 'class' => $run ? 'disabled button' : 'green button', diff --git a/src/aphront/response/AphrontAjaxResponse.php b/src/aphront/response/AphrontAjaxResponse.php index ff2dc2a9de..0b982000f7 100644 --- a/src/aphront/response/AphrontAjaxResponse.php +++ b/src/aphront/response/AphrontAjaxResponse.php @@ -38,10 +38,10 @@ final class AphrontAjaxResponse extends AphrontResponse { $console = $this->getConsole(); if ($console) { Javelin::initBehavior( - 'dark-console-ajax', + 'dark-console', array( - 'console' => $console->render($this->getRequest()), - 'uri' => (string) $this->getRequest()->getRequestURI(), + 'uri' => (string)$this->getRequest()->getRequestURI(), + 'key' => $console->getKey($this->getRequest()), )); } diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index 2e44c4af3d..e2db6f8d34 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -164,8 +164,9 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { Javelin::initBehavior( 'dark-console', array( - 'uri' => '/~/', - 'request_uri' => $request ? (string) $request->getRequestURI() : '/', + 'uri' => $request ? (string)$request->getRequestURI() : '?', + 'selected' => $user ? $user->getConsoleTab() : null, + 'visible' => $user ? (int)$user->getConsoleVisible() : true, )); // Change this to initBehavior when there is some behavior to initialize @@ -225,13 +226,15 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { } protected function willSendResponse($response) { + $request = $this->getRequest(); $response = parent::willSendResponse($response); - $console = $this->getRequest()->getApplicationConfiguration()->getConsole(); + $console = $request->getApplicationConfiguration()->getConsole(); + if ($console) { $response = str_replace( '', - $console->render($this->getRequest()), + $console->render($request), $response); } diff --git a/webroot/rsrc/css/aphront/dark-console.css b/webroot/rsrc/css/aphront/dark-console.css index ceb874ab4d..5be2bcfaa4 100644 --- a/webroot/rsrc/css/aphront/dark-console.css +++ b/webroot/rsrc/css/aphront/dark-console.css @@ -3,7 +3,7 @@ */ .dark-console { - background: #555555; + background: #444444; color: #eeeeee; width: 100%; font-family: "Verdana"; @@ -11,54 +11,101 @@ position: relative; } -.dark-console a:link { - color: inherit; +.dark-console-requests, +.dark-console-tabs { + position: absolute; + overflow-y: auto; + top: 0; + left: 0; + bottom: 0; + width: 15%; + padding: 8px 0; +} + +.dark-console-requests, +.dark-console-tabs, +.dark-console-panel, +.dark-console-load { + border-left: 1px solid #111111; + box-shadow: -2px 0px 2px rgba(0, 0, 0, 0.25); +} + +.dark-console-requests { + background: #222222; } .dark-console-tabs { - width: 180px; - background: #222222; - border-right: 1px solid #888888; - padding: 2.5em 0em; + background: #333333; + left: 15%; } +.dark-console-panel, +.dark-console-load { + position: relative; + min-height: 320px; +} -a.dark-console-tab { - padding: .75em 12px; - text-align: right; - background: #444444; - position: relative; - border: 1px solid #666666; +.dark-console-panel { + margin-left: 30%; + background: #444444; +} + +.dark-console-requests a.dark-console-request, +.dark-console-tabs a.dark-console-tab { + display: block; + padding: 6px; + overflow: hidden; + background: #444444; + margin: 3px 0; + color: #cccccc; + border-color: #666666; border-width: 1px 0; - border-right-color: #888888; - margin-bottom: 2px; - display: block; - color: #cccccc; + border-style: solid; +} + +.dark-console-requests a.dark-selected, +.dark-console-tabs a.dark-selected { + background: #0066aa; } -a.dark-console-tab-selected { - margin-right: -1px; - padding-right: 13px; - background: #555555; - border-color: #888888; - border-right-color: #555555; - color: #eeeeee; +.dark-console-requests a.dark-console-request:hover, +.dark-console-tabs a.dark-console-tab:hover { + background: #1188cc; } +.dark-console-tabs a.dark-console-tab { + text-align: right; +} + +.dark-console-load { + background-image: url(/rsrc/image/darkload.gif); + background-position: center center; + background-repeat: no-repeat; + background-color: #000; + margin-left: 15%; +} .dark-console .aphront-table-view { + font-size: 11px; background: #888888; color: #eeeeee; - margin: 1em 1%; - width: 98%; + width: 100%; border-color: #333333; + margin: 8px 0; } .dark-console .aphront-table-view th { + text-shadow: none; + font-family: "Verdana"; + font-size: 11px; background: #333333; color: #ffffff; } +.dark-console .aphront-table-view td { + font-size: 11px; +} + .dark-console .aphront-table-view td.header { background: #444444; color: #ffffff; @@ -77,13 +124,8 @@ a.dark-console-tab-selected { color: #dddddd; } -.dark-console-panel-ErrorLog { - max-height: 500px; - overflow: auto; -} - -.dark-console-panel-error-details { - display: none; +.dark-console-panel-core { + padding: 12px; } .explain-sev-1 { @@ -119,15 +161,11 @@ a.dark-console-tab-selected { } .dark-console-panel-header { - background: #606060; - border-bottom: 1px solid #505050; - padding: .25em 1em .25em 0; + padding: 8px 4px 0; } .dark-console-panel-header h1 { - padding: 1em; - font-size: 12px; - font-weight: normal; + font-size: 15px; } .dark-console-panel-header .button { @@ -168,4 +206,11 @@ a.dark-console-tab-selected { height: 2px; } +.dark-console-panel-ErrorLog { + max-height: 500px; + overflow: auto; +} +.dark-console-panel-error-details { + display: none; +} diff --git a/webroot/rsrc/image/darkload.gif b/webroot/rsrc/image/darkload.gif new file mode 100644 index 0000000000000000000000000000000000000000..1b8c1f28ad188ecd1fd8f5813704bbe43633635d GIT binary patch literal 9427 zcmZ?wbhEHbRA5kG_{IPN|NsAIVPVnG&`?oPVPax(adD}ut1Brfv9q(|;NTDw6Dun# zYiMYQi;I(xkm&2{TeD_OO-+rIloSsSPg7GDJgMr zakaFxL_|cev9Xz%nH@TGXwsxfA|fIQ2?=d&Z4M3&IyyS1PMtb->{w7xkcEYXk&%&r zfPj{k*12=%yu7@eoSeeK!ua_3CQO)+lar&SrY0jJQ&Caz=FOXT@7~?Ib?d{24;L<6 zNJ&YNlao_WP!JLl^7HdcN=nMe$e1%{PC-FIR#w)I9XmE{+O%%nx?Q_=ZP~IVFE7u) zz+l_9ZF~0Y(bLnjv9Z~(VMAJ4+LI?wu3fu!=FFKFFJ8QQ^~%l7ZOM`)t5&Uwii+y# z=~=dH*@6WNX3d(lXwjk-D^}dObLZZ@dk-EwxN_x+iHV7omDRLq(>y#pX3Usz>C&Z; zkdSB3p3R##@6n@2U0q!r9UVSCJ~wXMsH&%35e9mw<$lSd)m7wXNyA z3EYB`5|VrjB2sJZo4Cy#nEIH6q$D*Zj2O&p>@*mhG%o7(3rkCB87yXCk!cdXs39^z zMp;V9xXnpl!(x((w&B4x*%|#@BC@Q#zq*;&c!X4@2uxqWFoBVULrJP&fg>xwT7-rY zCeQK93I3zx`}Ggr>Lvb%`HS!o?$JldVv z>am7d=wF5FDr z%M_Mr2<+OWtCG-kXJ^IdS9edB2Pr_qjS*iUwet)2_lavoL{IMK5)6xsVV&8`ZK&HU z>oYfyYaxRIucw!BlgNswK!v6S{VHx=J^`D!Lc*eA7jT<9?CN24_x26+31$clw~1qL z(zvbH&#mSiAjQ!Xw3I>kwuZ=L2RUyqad2=gbTTwL-6Cr;S;1;e))D;!b(F28ryy`(B69bMr3U(-pIYsSQ=y7{nUsr>Qfx_cX23OVs0S=|Yi49F_q;|b% z=x{pg&f2t~;^JC?&MF5Z+W_^IqIwJ#SN^6PNxa=%@6P_gq;t`V#f$YlIFvT%YBHoa z#`y_Zyg0T^p;@$`&8ywX<6Il}o_lvsZ(o0Ze*-%!6Evil@P$;Hil4nmf3J{DD$mqz zS#O&(FNN97PDUEdCcZZ5K3t0#6gU!+ottDsRtGF%ke#X*pO}&$z9D6G3@ewAu>)%# zt4mUHY^)B0y@k*)Dz;Gyx=0^-jGAe zuTC6o5LaOlY-krb&?N21B4Sg~{ANLml`x}EgStxI5!RTuufQR-w~+xFPR#hjDU?s7 zzn3Gz&V6b(S8_yNtitSOR&&Q@k(7uGFRsN++VKL>O|mho1s5^!%l5OH#Y;=)FetdK zc4Ot@%@eff7nh6A&edh$la$D3@QAW42=3RjmlH_hV_?}$OjaIF2Bq~ujEsFuMob@@j*5tI2#YcpH87~UT3l-l*z6$4DWYJhGmAlJ3Ad}0 zS67G%!|`5eVKGqtJK;KWz0j@~r5%TS;~fL`SVVRl;TCZ)t7Vbg9N{9PT5qJJ88Yvp z^xmLZYg`f!FbFkqH282OG_LIEXIZeI3mB^NhNLp!zRyU*U5)jI1VKSsx9UejZZjJ*&KAD%Uo7d!Jwf< zfl0LT)h`^_|#nQ?eA7NKvNJa-oVk*&f)6s zRTT^|p4zRTCg`ioG`mx_cz%*XlY&0~RR0`}Caw~}fb2!w@p*wkeZq0}9+?bGyn>!3 z3|#T4=|z6~w8dQgSQttZ1albd%g%+B_9+DC^O;36u#R<$@_F$JO$tWNBK;~F{43|ilrS-<$Z6)e_i<$z zice;8&y5jc;1V^+C`;bfBdfUD*n+`G*=;7D<{2CNeiXv}F6R7(+I5*OlJUka+> zwy%dLCw6?H)ULqP-{XG?SKfGwEyS2CFbAmY3)<81K-G;OlqL2vRg}5}v_YBB^N* zzq(IB<`H+Bi>94`)6BK&+hj|%V`{QklA7$?oHzt#Y{+nuFqcZvVPfQE?W*he^y0=0 zmqw*7F?}toON)-ixV>^K;3k(obaMT-Q-s>sDmdiNw3IXnz*RM3dy&~agsTIQ+Z zw5>;l!~Mj(ez}O6kE>qvhB`U%wYooGGi6}WkqhNq(s16<{0N_scku<5Zg&3LVp;&0q3{2u4mS#*0 zdhUY0s{O+H%uWofr5@!w6#PO0d;~W2u$pUV=!-Du+jHnMILG?>NE!D#oYUZMQhCHG zbgM#iMW2GqdA+tcp9;AT6Ik^ww#i19n#}ES@Og36g9DV)Y%`i0IcK{vu{HdjexglA zJ8VirfJosYCFw|~teBJ!ZceWJM>--t2|QTHBr?VF(DrizthL{p_87Z7V&zhp=+R)! z=_JWlU?FW=@a<9jdFd4`4V#bm9pDve;;>-mN;t?XvskH>^}?Iy3pVPhTPVNS6u>AH z!gU)|9<95(6JDor;t!q<74C^WGS0^4Q@eD;`J9`X^s~4oC@3_s&Q+CXWiWBcO_uLh z(PwsQ$`p4IXJArwi;3l3*DC`K8HZ9a83wjZvEKXoEKX|hH<_q3`6b7OST5~TIH7OS zCZ6)-^#oSEGi_Yz(H~}aG4VS(9qVinP%uaooFF9?qVjXn`3Vh-x1^+YB`;U%*ESLo zZJ6Pcq{x!yG;3qB!$fW-b1to_4T@aCYJMy)j6)VQpLPFarI2LklDbec(A!#Xp**IcqCKO{6=BxFJU#6 z*H)VY7==7ugX{kIeeiJNA`ngrOcQ&Y{B=~OcClm{=`^#-I80PvZ8pzjGis8}ms8X2 zchWa^YML7z%)qLxCXmh74+$eDT{dBcEYSl=(ft-jHTavjOq%%Ov)w$n`W24o-)@bT zE;M`I&#HH#O+iQfyz~1k=4x;^DXcF&qZYTcM`4cs;npnn z5QY^O2Azijn%Q010u_9w zs5iTI^9u(m6g1CY#3^^8fid`Dq>U4+RY}EF4cR?TOi4#7UaoN1Abx_&aD&ou4?lO6 zC6z3S4goV{qt9?4pFU#P>%q+s-sLkgZs@E?(M}xbGNufzc%+ipW-z5SHAmK{W+$7#G)k&>R;fv%`c9nDrD7Gs#u?dQ1 zI!$~eTg{U9BKXULz8U?N8G9EmIS{+J`0JJ2o0BdDHY(hmCVJ}d<5O)Ny&e{~IhceQ zl*7*5Fl2b?s2{5mcjrgw5w8IKTSk*Qj)Fo)XhVTvYTkw3Rn1~P)z^7g*Gz2TnlPbr z+uGaP3s@eTaj`%HhL?zdv0$3qX@L|l%_=e?h;VVxVN;wS3=Ni5DvCy>IWzkBp`jvk z)ObfflZ=M`s#c3qdCm(HSoLnVSvWqN-@$64qH>}W946c@>~d-z4qY2HOhjsLY*^Oo zsPb&>VMQSdMmZ|mD} z(CGP9WuenLO&l5x-25hXFElEa=tMgR>F?XX*wDh>uN~oM!{qpYjWa^SW`gE|2i`N6 z$0>CRl`ykTT+5JAabQu(0rgmMk&cE(1z&?1g}B}7?wkg7*(Sg<86UxbViM+N1qT%O z%;p)O1k@~|H&K?w+^K1?hGUbkzJ>)nm_+u>(bb>8J!ftclfotq-7JR*tTGz<2U?wU zgEbcRv+7-IbDBQCd%5hL4sZZDX}kKF$*=8PuVK<<$j&P&DiUu-)HF^Ffm<>pW&9 zN!t@s`8&8w7+3!|(8Sn3-CZGUqQDoYqkV>~4iyqzi7gEo%~3yYII>L^;IIq&^W)2- zu0Ew@H(LI{H=Wb+dY999*T$z2v28r(BFSZ2#K%gRpVl3{UbS^y3i z{ptPuv-OvPvz62AwG+7a&t+gzSigT&KPXuCwC>Zen8d1gp-seOUJsYZ@osRS$Odc6 zYX^0&(YW2I6YA>WVgF(N{vYkZJpXviVl;%x7vDKx?vW#qczo>y23DqNJ2g@}+;}9p zlteim`6Miq_f=B3alGTm`XZ*N9ZZUD%pzKq8fL4W=0x*ZM({8cC^$I_X=%$fDik~x zVimP|Afd_Nt}K5oatPnaks;~)LC3yz5D&g_8_r;Vr*i84+$gDKlrN-6&|d zw($1$0@lZ;rou~PK_WuNX>u1oB4k)WAv2u;lw|nz&1EOd($L@R#B46Y;51u<9~Lsg z`&ad`%52-y3LZHFHv&!O^{_4l2TV7s12eP3iLNyocRTt0bu%-sz1#n>!_nxU(K?a9 z2L*@cC<*BL&6&V-XtrX(gbinJ9ed~g9L+tir;L(Vj&x*k4`+yj3Se6G$tO3m}+2O?;sSw!!BlRcS~XM zgCicZC1!}NIIt>oLQ}7ya$rEx@w2k+tpa)v7EWTzTga~R=GEQP(*s~Vdm$nMNe>)I zDv*4|1P&xfzT#(QQ2+%JsJ;RxAMOd<`wucKX%Yr!tZjQ?VRWHQ)?{AK(q2&7>1K7< zeYJay#+}Z?`)|(Q|F+}(?2qjtGUiXZSRM7*mb`ZR5GBCa=CEK#qd?GRrHDF-Ne2%c z6JwpwqF}I@xoM+`evjqKg6ABw+j`R?UNWY$H7H3=QDI0(;5%ufE4TFI1GWAJKJTCh zJCo0xmf;t=;h^-cOT?>mUQ$-l)g38>H76?97;?)Xdq`YU5JdJncf0 zP(Fvjwz=Nh*DZh*I>Lkl#|b5HSSP{D9DZgQCPdimn60t0pL-v76Vnm~;eC7hS!K4K zZhO``&gq?fcjT2^5*jWLFxE)t2m>jxVMRTq+ zRD5CKny17hvgT#d5|$I1aba_A{Pf^3WY9ZQ(plUxr9qr?Rbr9ga_<>7lDjVoJih97 z(8+y|l!f%$CdOqsY>!XPYVYuxTs*=K&QgE@=SaBip5`;YCqiN0#vg+vcHDsb#}m2G+R*o}jI zqM`!d&K)9}9^%G%G7^hKUki2`q^|ohfnfmyV-`a|%Y>#!2bI|s@2-eoeBi{($;`lF zxpC3~WzMoYOHL>|GY#)N4Tn73x}-r`%N(A>(fv*PnJURa}0jGiI1(_FZl)nV84E~f-9Qz7#%m3=JT zDw?*o*77et_K5pvn%>|7g^V3OgsS)9bM zna9B82yN)7usEpb%naxzXlS5mrzj-lej4QI}I-T3TxUk8eFm zC7zEOWmRQZnj}n?G_dUmY!i#|PC^Rhe2 ztV}`e0=hkoI}B6~hIKSW@K_r1yj5T|=c?NUsZv#}^`7WbiIcGshy)&+?%*G~_@Ai>0&363eIp1;1XFHjfZyrcSmd z3+WeE1eY+hC@Ac^V_KD*a#)7bpMj;)=)tvvzPBYfCv14=-73t$wPC?gp##j7qOxZT zPPNTpFx~Qx(SpshafQHct_-$a|(WTO~_t195X2)he5l&7vm%wh`loLIP0{nrD zGMgN9m=s+)EP^{@R4OLr3ACp7dsxgYUf!xGbVJH+Q9$dtMjK9+#tR$_?i>1hZ_Kc0 zcyOGT!GQfm)Q-%9%1Z1K3Wb~trk-K_T45G6d3ndI0M@)5DUJmWo^HaEI&UrERZ)y% z;T74Tn^FcI&ya(MkTfYFB;o`KAzfchS8!JpTn@=aT7|JOfZEUC5aKC_vKDG$+QI-1 zqL6}g$YkmyVb$m}kRWn0dC>K;BeOWgTTpHxI3dY)DwqZaN=a38XebH35mjO=nWYh8 z;XH9df`f>s;l*WVIix=eh#pYnKB6R`7vo@D+Tk`!`ZY_S#LE+{tv2>~5=s+wA1Mpu z_l5jya1!9?XDDEie$LT4St~BdhQXoOVPE@fE77${4-YYf&Cb!=!Mz2Bwl8k)XJw(@Zf?dID}rs!uuC8qy&)(EQkUmLlHs5o)(sBga{&coAfYC zSP%)P*p!t*Qju_+5hRF2^uR$B#GaH`X!#f%L|mOrqOq}p-rjl|N`gEc`>d0N)MOTU zcsRN;OUy91c;KLo3v0m%ri~s9tWvT*ny)?_dZ5U4K`yZ4Ve46DXO&GeYf2tD&(*xm z(C~nR;rM2Em9Q(8A5&t^Fe=LC?Rs*8Ra!DLjwvIx=wPn`lfuo{EDH|w`mSeLJ6j~> zGSkFX5tf+-VxTT5>*G_d@Q{%u7&83gdXrnYg9?1<5QF%?r9{io*F>X1PZs5*K$IF;n6R zSt{higM%(it}44214Wt}UAuL@c!oS_>Sbn^_bUkqVQ|+M=n>Iyn3*||L0p+XkmJV+ z26pgdVPl?>O5Qm&4yJ=b?&h<4I4r6a`=2*VJUh>kscABcS-PG0odEWg4c*NQc^2G8 g8u8wXHP&o1QF+jKYij{JXi7CaPl3T2v;+o>0om@^-v9sr literal 0 HcmV?d00001 diff --git a/webroot/rsrc/js/application/core/behavior-dark-console-ajax.js b/webroot/rsrc/js/application/core/behavior-dark-console-ajax.js deleted file mode 100644 index ecaa6053cc..0000000000 --- a/webroot/rsrc/js/application/core/behavior-dark-console-ajax.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @provides javelin-behavior-dark-console-ajax - * @requires javelin-behavior - * javelin-dom - */ - -JX.behavior('dark-console-ajax', function(config) { - var requestLog = JX.DOM.find(document.body, - 'table', - 'dark-console-request-log'); - var requestTable = JX.DOM.find(requestLog, 'table'); - var requestRows = JX.DOM.scry(requestTable, 'tr'); - var requestNumber = requestRows.length - 1; // header don't count - var requestURI = config.uri; - var console = JX.$H(config.console); - var newRowType = 'ajax'; - - var newRowNumber = JX.$N( - 'a', - { - 'sigil' : 'request-log-number', - 'meta' : { 'console' : console } - }, - requestNumber - ); - var newRowURI = JX.$N( - 'a', - { - 'sigil' : 'request-log-uri', - 'meta' : { 'console' : console } - }, - requestURI - ); - - var newRow = JX.$N( - 'tr', - { - 'className' : requestNumber % 2 ? 'alt' : '' - }, - [ - JX.$N('td', {}, newRowNumber), - JX.$N('td', {}, newRowType), - JX.$N('td', {}, newRowURI) - ] - ); - - JX.DOM.appendContent(requestTable, newRow); - -}); diff --git a/webroot/rsrc/js/application/core/behavior-dark-console.js b/webroot/rsrc/js/application/core/behavior-dark-console.js index 3f31ac1545..0c72d0469c 100644 --- a/webroot/rsrc/js/application/core/behavior-dark-console.js +++ b/webroot/rsrc/js/application/core/behavior-dark-console.js @@ -6,55 +6,221 @@ * javelin-dom * javelin-request * phabricator-keyboard-shortcut - * javelin-behavior-dark-console-ajax */ -JX.behavior('dark-console', function(config) { - var selected_tab = null; - - JX.Stratcom.listen( - 'click', - ['dark-console', 'dark-console-tab'], - function(e) { - var console = e.getNode('dark-console'); - var tabs = JX.DOM.scry(console, 'a', 'dark-console-tab'); - var panels = JX.DOM.scry(console, 'div', 'dark-console-panel'); - var target = e.getTarget(); - for (var ii = 0; ii < tabs.length; ii++) { - JX.DOM.alterClass( - tabs[ii], - 'dark-console-tab-selected', - tabs[ii] == target); - (tabs[ii] != target ? JX.DOM.hide : JX.DOM.show)(panels[ii]); +JX.behavior('dark-console', function(config, statics) { + var root = statics.root || setup_console(); + + config.key = config.key || root.getAttribute('data-console-key'); + add_request(config); + + + // Do first-time setup. + function setup_console() { + statics.root = JX.$('darkconsole'); + statics.req = {all: {}, current: null}; + statics.tab = {all: {}, current: null}; + + statics.el = {}; + + statics.el.reqs = JX.$N('div', {className: 'dark-console-requests'}); + statics.root.appendChild(statics.el.reqs); + + statics.el.tabs = JX.$N('div', {className: 'dark-console-tabs'}); + statics.root.appendChild(statics.el.tabs); + + statics.el.panel = JX.$N('div', {className: 'dark-console-panel'}); + statics.root.appendChild(statics.el.panel); + + statics.el.load = JX.$N('div', {className: 'dark-console-load'}); + statics.root.appendChild(statics.el.load); + + statics.cache = {}; + + statics.visible = config.visible; + statics.selected = config.selected; + + return statics.root; + } + + + // Add a new request to the console (initial page load, or new Ajax response). + function add_request(config) { + + // Ignore DarkConsole data requests. + if (config.uri.match(new RegExp('^/~/data/'))) { + return; + } + + var attr = { + className: 'dark-console-request', + sigil: 'dark-console-request', + title: config.uri, + meta: config, + href: '#' + }; + + var link = JX.$N('a', attr, config.uri); + statics.el.reqs.appendChild(link); + statics.req.all[config.key] = link; + + if (!statics.req.current) { + select_request(config.key); + } + } + + + // Select a request (on load, or when the user clicks one). + function select_request(key) { + var req = statics.req; + + if (req.current) { + JX.DOM.alterClass(req.all[req.current], 'dark-selected', false); + } + statics.req.current = key; + JX.DOM.alterClass(req.all[req.current], 'dark-selected', true); + + if (statics.visible) { + JX.log('visible!'); + draw_request(key); + } + } + + // When the user clicks a request, select it. + JX.Stratcom.listen('click', 'dark-console-request', function(e) { + e.kill(); + select_request(e.getNodeData('dark-console-request').key); + }); + + + // After the user selects a request, draw its tabs. + function draw_request(key) { + var cache = statics.cache; + + if (cache[key]) { + render_request(key); + return; + } + + new JX.Request( + '/~/data/' + key + '/', + function(r) { + cache[key] = r; + if (statics.req.current == key) { + render_request(key); + } + }) + .send(); + + show_loading(); + } + + // Show the loading indicator. + function show_loading() { + JX.DOM.hide(statics.el.tabs); + JX.DOM.hide(statics.el.panel); + JX.DOM.show(statics.el.load); + } + + // Hide the loading indicator. + function hide_loading() { + JX.DOM.show(statics.el.tabs); + JX.DOM.show(statics.el.panel); + JX.DOM.hide(statics.el.load); + } + + function render_request(key) { + var data = statics.cache[key]; + + statics.tab.all = {}; + + var links = []; + var first = null; + for (var ii = 0; ii < data.tabs.length; ii++) { + var tab = data.tabs[ii]; + var attr = { + className: 'dark-console-tab', + sigil: 'dark-console-tab', + meta: tab, + href: '#' + }; + + var bullet = null; + if (tab.color) { + bullet = JX.$N('span', {style: {color: tab.color}}, "\u2022"); } - selected_tab = target.id.replace('dark-console-tab-', ''); + var link = JX.$N('a', attr, [bullet, ' ', tab.name]); + links.push(link); + statics.tab.all[tab['class']] = link; + first = first || tab['class']; + } + + JX.DOM.setContent(statics.el.tabs, links); + + if (statics.tab.current in statics.tab.all) { + select_tab(statics.tab.current); + } else if (statics.selected in statics.tab.all) { + select_tab(statics.selected); + } else { + select_tab(first); + } + + hide_loading(); + } + + function select_tab(tclass) { + var tabs = statics.tab; + + if (tabs.current) { + JX.DOM.alterClass(tabs.current, 'dark-selected', false); + } + tabs.current = tabs.all[tclass]; + JX.DOM.alterClass(tabs.current, 'dark-selected', true); - new JX.Request(config.uri, JX.bag) - .setData({ tab : selected_tab }) + if (tclass != statics.selected) { + // Save user preference. + new JX.Request('/~/', JX.bag) + .setData({ tab : tclass }) .send(); - }); + } + + draw_panel(); + } + + // When the user clicks a tab, select it. + JX.Stratcom.listen('click', 'dark-console-tab', function(e) { + e.kill(); + select_tab(e.getNodeData('dark-console-tab')['class']); + }); + function draw_panel() { + var data = statics.cache[statics.req.current]; + var tclass = JX.Stratcom.getData(statics.tab.current)['class']; + var html = data.panel[tclass]; + + var div = JX.$N('div', {className: 'dark-console-panel-core'}, JX.$H(html)); + JX.DOM.setContent(statics.el.panel, div); + } + + // Install keyboard shortcut. var desc = 'Toggle visibility of DarkConsole.'; new JX.KeyboardShortcut('`', desc) .setHandler(function(manager) { - var console = JX.DOM.find(document.body, 'table', 'dark-console'); - var requestLog = JX.DOM.find( - document.body, - 'table', - 'dark-console-request-log'); - - config.visible = !config.visible; - if (config.visible) { - JX.DOM.show(console); - JX.DOM.show(requestLog); + statics.visible = !statics.visible; + + if (statics.visible) { + JX.DOM.show(root); + if (statics.req.current) { + draw_request(statics.req.current); + } } else { - JX.DOM.hide(console); - JX.DOM.hide(requestLog); + JX.DOM.hide(root); } - new JX.Request(config.uri, JX.bag) - .setData({visible: config.visible ? 1 : 0}) + // Save user preference. + new JX.Request('/~/', JX.bag) + .setData({visible: statics.visible ? 1 : 0}) .send(); // Force resize listeners to take effect. @@ -62,89 +228,4 @@ JX.behavior('dark-console', function(config) { }) .register(); - var initRequestLog = function() { - var console = JX.DOM.find(document.body, - 'table', - 'dark-console'); - var requestLog = JX.DOM.find(document.body, - 'table', - 'dark-console-request-log'); - var requestTable = JX.DOM.find(requestLog, 'table'); - var rows = JX.DOM.scry(requestTable, 'tr'); - var tableHeader = rows[0]; - var newRowNumber = JX.$N( - 'a', - { - 'sigil' : 'request-log-number', - 'meta' : { 'console' : console } - }, - "0" - ); - var newRowURI = JX.$N( - 'a', - { - 'sigil' : 'request-log-uri', - 'meta' : { 'console' : console } - }, - config.request_uri - ); - - var newRow = JX.$N( - 'tr', - { - 'className' : 'highlight' - }, - [ - JX.$N('td', {}, newRowNumber), - JX.$N('td', {}, 'main'), - JX.$N('td', {}, newRowURI) - ] - ); - - JX.DOM.setContent(requestTable, [tableHeader, newRow]); - } - - initRequestLog(); - - var updateActiveRequest = function(e) { - var log = e.getNode('dark-console-request-log'); - var table = JX.DOM.find(log, 'table'); - var rows = JX.DOM.scry(table, 'tr'); - var targetRow = e.getTarget().parentNode.parentNode; - var data = JX.Stratcom.getData(e.getTarget()); - var newConsole = data.console; - for (var ii = 0; ii < rows.length; ii++) { - JX.DOM.alterClass( - rows[ii], - 'highlight', - rows[ii] == targetRow); - } - var console = JX.DOM.find(document.body, 'table', 'dark-console'); - JX.DOM.replace(console, newConsole); - if (selected_tab) { - console = JX.DOM.find(document.body, 'table', 'dark-console'); - var s_id = 'dark-console-tab-' + selected_tab; - var tabs = JX.DOM.scry(console, 'a', 'dark-console-tab'); - var panels = JX.DOM.scry(console, 'div', 'dark-console-panel'); - for (var ii = 0; ii < tabs.length; ii++) { - JX.DOM.alterClass( - tabs[ii], - 'dark-console-tab-selected', - tabs[ii].id == s_id); - (tabs[ii].id != s_id ? JX.DOM.hide : JX.DOM.show)(panels[ii]); - } - } - } - - JX.Stratcom.listen( - 'click', - ['dark-console-request-log', 'request-log-number'], - updateActiveRequest - ); - JX.Stratcom.listen( - 'click', - ['dark-console-request-log', 'request-log-uri'], - updateActiveRequest - ); - }); -- 2.51.2 From da27b448fa318ce145000e266168d708fb06dcb0 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:46:04 -0800 Subject: [PATCH 22/50] render_tag -> tag: DifferentialResultsTableView Summary: Fix lint and unit results escaping. Test Plan: Looked at lint/unit results. Clicked show/hide: {F30680} Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4693 --- .../DifferentialLintFieldSpecification.php | 15 ++++++++----- .../DifferentialUnitFieldSpecification.php | 6 ++--- .../view/DifferentialResultsTableView.php | 22 +++++++++---------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index 2c0164a255..b773e38580 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -43,7 +43,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => 'star', - 'name' => $lstar, + 'name' => phutil_safe_html($lstar), 'value' => $lmsg, 'show' => true, ); @@ -53,7 +53,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => 'excuse', 'name' => 'Excuse', - 'value' => nl2br(phutil_escape_html($excuse)), + 'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))), 'show' => true, ); } @@ -67,7 +67,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => 'section', - 'name' => phutil_escape_html($path), + 'name' => $path, 'show' => $show_limit, ); @@ -108,7 +108,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => $this->getSeverityStyle($severity), - 'name' => phutil_escape_html(ucwords($severity)), + 'name' => ucwords($severity), 'value' => hsprintf( "(%s) %s at {$line_link}", $code, @@ -130,7 +130,10 @@ final class DifferentialLintFieldSpecification if (strlen($description)) { $rows[] = array( 'style' => 'details', - 'value' => nl2br(phutil_escape_html($description)), + 'value' => + phutil_safe_html( + nl2br( + phutil_escape_html($description))), 'show' => false, ); if (empty($hidden['details'])) { @@ -148,7 +151,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => $this->getPostponedStyle(), 'name' => 'Postponed', - 'value' => phutil_escape_html($linter), + 'value' => $linter, 'show' => false, ); if (empty($hidden['postponed'])) { diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index 348964045c..b19ae2f798 100644 --- a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php @@ -37,7 +37,7 @@ final class DifferentialUnitFieldSpecification $rows[] = array( 'style' => 'star', - 'name' => $ustar, + 'name' => phutil_safe_html($ustar), 'value' => $umsg, 'show' => true, ); @@ -47,7 +47,7 @@ final class DifferentialUnitFieldSpecification $rows[] = array( 'style' => 'excuse', 'name' => 'Excuse', - 'value' => nl2br(phutil_escape_html($excuse)), + 'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))), 'show' => true, ); } @@ -105,7 +105,7 @@ final class DifferentialUnitFieldSpecification } $rows[] = array( 'style' => $this->getResultStyle($result), - 'name' => phutil_escape_html(ucwords($result)), + 'name' => ucwords($result), 'value' => $value, 'show' => $show, ); diff --git a/src/applications/differential/view/DifferentialResultsTableView.php b/src/applications/differential/view/DifferentialResultsTableView.php index 46c8595968..519c9319f1 100644 --- a/src/applications/differential/view/DifferentialResultsTableView.php +++ b/src/applications/differential/view/DifferentialResultsTableView.php @@ -25,7 +25,7 @@ final class DifferentialResultsTableView extends AphrontView { $style = idx($row, 'style'); switch ($style) { case 'section': - $cells = phutil_render_tag( + $cells = phutil_tag( 'th', array( 'colspan' => 2, @@ -33,23 +33,23 @@ final class DifferentialResultsTableView extends AphrontView { idx($row, 'name')); break; default: - $name = phutil_render_tag( + $name = phutil_tag( 'th', array( ), idx($row, 'name')); - $value = phutil_render_tag( + $value = phutil_tag( 'td', array( ), idx($row, 'value')); - $cells = $name.$value; + $cells = array($name, $value); break; } $show = idx($row, 'show'); - $rows[] = javelin_render_tag( + $rows[] = javelin_tag( 'tr', array( 'style' => $show ? null : 'display: none', @@ -64,7 +64,7 @@ final class DifferentialResultsTableView extends AphrontView { } if ($any_hidden) { - $show_more = javelin_render_tag( + $show_more = javelin_tag( 'a', array( 'href' => '#', @@ -72,7 +72,7 @@ final class DifferentialResultsTableView extends AphrontView { ), $this->showMoreString); - $hide_more = javelin_render_tag( + $hide_more = javelin_tag( 'a', array( 'href' => '#', @@ -80,22 +80,22 @@ final class DifferentialResultsTableView extends AphrontView { ), 'Hide'); - $rows[] = javelin_render_tag( + $rows[] = javelin_tag( 'tr', array( 'class' => 'differential-results-row-show', 'sigil' => 'differential-results-row-show', ), - ''.$show_more.''); + phutil_tag('th', array('colspan' => 2), $show_more)); - $rows[] = javelin_render_tag( + $rows[] = javelin_tag( 'tr', array( 'class' => 'differential-results-row-show', 'sigil' => 'differential-results-row-hide', 'style' => 'display: none', ), - ''.$hide_more.''); + phutil_tag('th', array('colspan' => 2), $hide_more)); Javelin::initBehavior('differential-show-field-details'); } -- 2.51.2 From caa7fcef588b7901d211aa67849847faab0d0f9f Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 28 Jan 2013 18:46:48 -0800 Subject: [PATCH 23/50] render_tag -> tag: more miscellaenous easy cases Summary: These all yeilded fairly easily. Test Plan: Inspection / loaded pages. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4694 --- .../controller/ManiphestTaskDetailController.php | 2 +- .../controller/ManiphestTaskListController.php | 4 ++-- .../view/PhabricatorApplicationLaunchView.php | 15 +++++++++++---- ...abricatorApplicationTransactionCommentView.php | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index bbc7a4d5ac..cf1059d99e 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -520,7 +520,7 @@ final class ManiphestTaskDetailController extends ManiphestController { if (strlen($task->getDescription())) { $view->addSectionHeader(pht('Description')); $view->addTextContent( - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'phabricator-remarkup', diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php index 32952ce5af..a51951a4de 100644 --- a/src/applications/maniphest/controller/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/ManiphestTaskListController.php @@ -348,7 +348,7 @@ final class ManiphestTaskListController extends ManiphestController { $count = number_format(count($list)); $header = - javelin_render_tag( + javelin_tag( 'h1', array( 'class' => 'maniphest-task-group-header', @@ -357,7 +357,7 @@ final class ManiphestTaskListController extends ManiphestController { 'priority' => head($list)->getPriority(), ), ), - phutil_escape_html($group).' ('.$count.')'); + $group.' ('.$count.')'); $panel = new AphrontPanelView(); diff --git a/src/applications/meta/view/PhabricatorApplicationLaunchView.php b/src/applications/meta/view/PhabricatorApplicationLaunchView.php index 566783c5e2..3aea3fe3c5 100644 --- a/src/applications/meta/view/PhabricatorApplicationLaunchView.php +++ b/src/applications/meta/view/PhabricatorApplicationLaunchView.php @@ -120,16 +120,23 @@ final class PhabricatorApplicationLaunchView extends AphrontView { $classes[] = 'application-tile-full'; } - $app_button = phutil_render_tag( + $app_button = phutil_tag( $application ? 'a' : 'div', array( 'class' => implode(' ', $classes), 'href' => $application ? $application->getBaseURI() : null, 'title' => $application ? $application->getShortDescription() : null, ), - $icon. - $this->renderSingleView($content)); + $this->renderHTMLView( + array( + $icon, + $content, + ))); - return $app_button.$create_button; + return $this->renderHTMLView( + array( + $app_button, + $create_button, + )); } } diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php index f9ec9f0a1b..aba6d84bab 100644 --- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php +++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php @@ -122,13 +122,13 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView { ), pht('Preview')); - return phutil_render_tag( + return phutil_tag( 'div', array( 'id' => $this->getPreviewPanelID(), 'style' => 'display: none', ), - self::renderSingleView( + self::renderHTMLView( array( $header, $preview, -- 2.51.2 From 40547030a54e3dd33d5338266d4851cd982c2270 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 29 Jan 2013 11:01:47 -0800 Subject: [PATCH 24/50] render_tag -> tag: PropertyListView Summary: Converts callsites in PropertyListView (addDetail() and setTextContent()). Test Plan: Grepped for PhabricatorPropertyListView, addDetail() and setTextContent(). Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4695 --- .../base/controller/PhabricatorController.php | 3 +- .../PhabricatorConfigAllController.php | 11 ++++--- .../PhabricatorWorkerTaskDetailController.php | 16 +++++----- ...fferentialApplyPatchFieldSpecification.php | 2 +- ...ntialArcanistProjectFieldSpecification.php | 2 +- .../DifferentialBranchFieldSpecification.php | 2 +- .../DifferentialCommitsFieldSpecification.php | 2 +- ...erentialDependenciesFieldSpecification.php | 2 +- ...ifferentialDependsOnFieldSpecification.php | 2 +- ...ferentialExportPatchFieldSpecification.php | 5 +++- .../DifferentialFieldSpecification.php | 4 +-- .../DifferentialHostFieldSpecification.php | 2 +- .../DifferentialLinesFieldSpecification.php | 2 +- ...entialManiphestTasksFieldSpecification.php | 2 +- .../DifferentialPathFieldSpecification.php | 2 +- ...fferentialRevertPlanFieldSpecification.php | 2 +- .../view/DifferentialResultsTableView.php | 4 +-- .../view/DifferentialRevisionDetailView.php | 4 +-- .../DiffusionBrowseFileController.php | 14 ++++----- .../controller/DiffusionCommitController.php | 18 +++++++----- .../controller/DrydockLeaseViewController.php | 8 ++--- .../DrydockResourceViewController.php | 7 ++--- .../PhabricatorFileInfoController.php | 10 +++---- .../PhabricatorMacroViewController.php | 4 +-- .../ManiphestTaskDetailController.php | 9 +++--- .../blog/PhameBlogViewController.php | 13 +++++---- .../post/PhamePostViewController.php | 9 ++++-- .../controller/PholioMockViewController.php | 2 +- .../PonderQuestionViewController.php | 7 ++--- .../PhabricatorPropertyListExample.php | 7 +++-- .../layout/PhabricatorPropertyListView.php | 29 +++++++------------ 31 files changed, 102 insertions(+), 104 deletions(-) diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index 495291d59f..6e79333711 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -276,7 +276,8 @@ abstract class PhabricatorController extends AphrontController { foreach ($phids as $phid) { $items[] = $this->getHandle($phid)->renderLink(); } - return implode($style_map[$style], $items); + + return phutil_safe_html(implode($style_map[$style], $items)); } protected function buildApplicationMenu() { diff --git a/src/applications/config/controller/PhabricatorConfigAllController.php b/src/applications/config/controller/PhabricatorConfigAllController.php index e7b46c7c3c..60f95b2263 100644 --- a/src/applications/config/controller/PhabricatorConfigAllController.php +++ b/src/applications/config/controller/PhabricatorConfigAllController.php @@ -68,13 +68,16 @@ final class PhabricatorConfigAllController $display_version = pht('Unknown'); } $version_property_list = id(new PhabricatorPropertyListView()); - $version_property_list->addProperty('Version', - phutil_escape_html($display_version)); + $version_property_list->addProperty( + pht('Version'), + $display_version); + $version_path = $phabricator_root.'/conf/local/VERSION'; if (Filesystem::pathExists($version_path)) { $version_from_file = Filesystem::readFile($version_path); - $version_property_list->addProperty('Local Version', - phutil_escape_html($version_from_file)); + $version_property_list->addProperty( + pht('Local Version'), + $version_from_file); } $nav = $this->buildSideNavView(); diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php index 7c28657fcd..75f391c5a2 100644 --- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php @@ -124,7 +124,7 @@ final class PhabricatorWorkerTaskDetailController $view->addProperty( pht('Task Class'), - phutil_escape_html($task->getTaskClass())); + $task->getTaskClass()); if ($task->getLeaseExpires()) { if ($task->getLeaseExpires() > time()) { @@ -133,7 +133,7 @@ final class PhabricatorWorkerTaskDetailController $lease_status = pht('Lease Expired'); } } else { - $lease_status = ''.pht('Not Leased').''; + $lease_status = phutil_tag('em', array(), pht('Not Leased')); } $view->addProperty( @@ -143,14 +143,14 @@ final class PhabricatorWorkerTaskDetailController $view->addProperty( pht('Lease Owner'), $task->getLeaseOwner() - ? phutil_escape_html($task->getLeaseOwner()) - : ''.pht('None').''); + ? $task->getLeaseOwner() + : phutil_tag('em', array(), pht('None'))); if ($task->getLeaseExpires() && $task->getLeaseOwner()) { $expires = ($task->getLeaseExpires() - time()); $expires = phabricator_format_relative_time_detailed($expires); } else { - $expires = ''.pht('None').''; + $expires = phutil_tag('em', array(), pht('None')); } $view->addProperty( @@ -159,12 +159,12 @@ final class PhabricatorWorkerTaskDetailController $view->addProperty( pht('Failure Count'), - phutil_escape_html($task->getFailureCount())); + $task->getFailureCount()); if ($task->isArchived()) { - $duration = phutil_escape_html(number_format($task->getDuration()).' us'); + $duration = number_format($task->getDuration()).' us'; } else { - $duration = ''.pht('Not Completed').''; + $duration = phutil_tag('em', array(), pht('Not Completed')); } $view->addProperty( diff --git a/src/applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php b/src/applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php index 3a8c0efd6f..193162cf48 100644 --- a/src/applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialApplyPatchFieldSpecification.php @@ -13,7 +13,7 @@ final class DifferentialApplyPatchFieldSpecification public function renderValueForRevisionView() { $revision = $this->getRevision(); - return 'arc patch D'.$revision->getID().''; + return phutil_tag('tt', array(), 'arc patch D'.$revision->getID()); } } diff --git a/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php b/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php index c64839eb9b..085c8b7824 100644 --- a/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialArcanistProjectFieldSpecification.php @@ -27,7 +27,7 @@ final class DifferentialArcanistProjectFieldSpecification } $handle = $this->getHandle($arcanist_phid); - return phutil_escape_html($handle->getName()); + return $handle->getName(); } private function getArcanistProjectPHID() { diff --git a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php index 2119d5699e..86b1399df8 100644 --- a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php @@ -26,7 +26,7 @@ final class DifferentialBranchFieldSpecification return null; } - return phutil_escape_html($branch); + return $branch; } public function renderValueForMail($phase) { diff --git a/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php b/src/applications/differential/field/specification/DifferentialCommitsFieldSpecification.php index 671e3d5f9f..ae8339c05c 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 implode('
    ', $links); + return array_interleave(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 6d03fe7ecb..43f387bb57 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 implode('
    ', $links); + return array_interleave(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 24096ccabd..09da33abc2 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 implode('
    ', $links); + return phutil_safe_html(implode('
    ', $links)); } private function getDependentRevisionPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php b/src/applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php index 00c16b4547..313279bcb2 100644 --- a/src/applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialExportPatchFieldSpecification.php @@ -13,7 +13,10 @@ final class DifferentialExportPatchFieldSpecification public function renderValueForRevisionView() { $revision = $this->getRevision(); - return 'arc export --revision '.$revision->getID().''; + return phutil_tag( + 'tt', + array(), + 'arc export --revision '.$revision->getID()); } } diff --git a/src/applications/differential/field/specification/DifferentialFieldSpecification.php b/src/applications/differential/field/specification/DifferentialFieldSpecification.php index 2f78967d7d..9453668fae 100644 --- a/src/applications/differential/field/specification/DifferentialFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialFieldSpecification.php @@ -274,7 +274,7 @@ abstract class DifferentialFieldSpecification { */ public function renderUserList(array $user_phids) { if (!$user_phids) { - return 'None'; + return phutil_tag('em', array(), pht('None')); } $links = array(); @@ -283,7 +283,7 @@ abstract class DifferentialFieldSpecification { $links[] = $handle->renderLink(); } - return implode(', ', $links); + return phutil_safe_html(implode(', ', $links)); } diff --git a/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php b/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php index 1f9ed6b700..b1f1a9c099 100644 --- a/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php @@ -17,7 +17,7 @@ final class DifferentialHostFieldSpecification if (!$host) { return null; } - return phutil_escape_html($host); + return $host; } } diff --git a/src/applications/differential/field/specification/DifferentialLinesFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLinesFieldSpecification.php index 01ac9ec1f7..31a7b7bac3 100644 --- a/src/applications/differential/field/specification/DifferentialLinesFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLinesFieldSpecification.php @@ -13,7 +13,7 @@ final class DifferentialLinesFieldSpecification public function renderValueForRevisionView() { $diff = $this->getDiff(); - return phutil_escape_html(number_format($diff->getLineCount())); + return number_format($diff->getLineCount()); } public function shouldAppearOnRevisionList() { diff --git a/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php b/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php index d628897632..44890675bd 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 implode('
    ', $links); + return phutil_safe_html(implode('
    ', $links)); } private function getManiphestTaskPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php b/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php index 7a85823833..376d080add 100644 --- a/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php @@ -19,7 +19,7 @@ final class DifferentialPathFieldSpecification return null; } - return phutil_escape_html($path); + return $path; } } diff --git a/src/applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php b/src/applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php index f23b39c875..c3560c08a3 100644 --- a/src/applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialRevertPlanFieldSpecification.php @@ -47,7 +47,7 @@ final class DifferentialRevertPlanFieldSpecification if (!$this->value) { return null; } - return phutil_escape_html($this->value); + return $this->value; } public function shouldAppearOnConduitView() { diff --git a/src/applications/differential/view/DifferentialResultsTableView.php b/src/applications/differential/view/DifferentialResultsTableView.php index 519c9319f1..f2be210728 100644 --- a/src/applications/differential/view/DifferentialResultsTableView.php +++ b/src/applications/differential/view/DifferentialResultsTableView.php @@ -102,13 +102,13 @@ final class DifferentialResultsTableView extends AphrontView { require_celerity_resource('differential-results-table-css'); - return javelin_render_tag( + return javelin_tag( 'table', array( 'class' => 'differential-results-table', 'sigil' => 'differential-results-table', ), - implode("\n", $rows)); + $rows); } diff --git a/src/applications/differential/view/DifferentialRevisionDetailView.php b/src/applications/differential/view/DifferentialRevisionDetailView.php index 8e366f560c..1182012952 100644 --- a/src/applications/differential/view/DifferentialRevisionDetailView.php +++ b/src/applications/differential/view/DifferentialRevisionDetailView.php @@ -66,10 +66,10 @@ final class DifferentialRevisionDetailView extends AphrontView { switch ($local_vcs) { case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: - $next_step = 'arc land'; + $next_step = phutil_tag('tt', array(), 'arc land'); break; case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: - $next_step = 'arc commit'; + $next_step = phutil_tag('tt', array(), 'arc commit'); break; } } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 624dbdb9ac..534ddd7e8c 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -805,17 +805,17 @@ final class DiffusionBrowseFileController extends DiffusionController { $size = strlen($data); $properties->addTextContent( pht('This is a binary file. It is %2$s byte(s) in length.', - $size, - PhutilTranslator::getInstance()->formatNumber($size)) - ); + $size, + PhutilTranslator::getInstance()->formatNumber($size))); $actions = id(new PhabricatorActionListView()) ->setUser($this->getRequest()->getUser()) ->addAction($this->createEditAction()) - ->addAction(id(new PhabricatorActionView()) - ->setName(pht('Download Binary File...')) - ->setIcon('download') - ->setHref($file_uri)); + ->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Download Binary File...')) + ->setIcon('download') + ->setHref($file_uri)); return array($actions, $properties); diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 235be74c25..7181c0b5da 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -92,11 +92,13 @@ final class DiffusionCommitController extends DiffusionController { } $property_list->addTextContent( - '
    '. + phutil_tag( + 'div', + 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; @@ -412,7 +414,7 @@ final class DiffusionCommitController extends DiffusionController { if ($data->getCommitDetail('authorPHID')) { $props['Author'] = $handles[$author_phid]->renderLink(); } else { - $props['Author'] = phutil_escape_html($data->getAuthorName()); + $props['Author'] = $data->getAuthorName(); } $reviewer_phid = $data->getCommitDetail('reviewerPHID'); @@ -426,7 +428,7 @@ final class DiffusionCommitController extends DiffusionController { if ($data->getCommitDetail('committerPHID')) { $props['Committer'] = $handles[$committer_phid]->renderLink(); } else { - $props['Committer'] = phutil_escape_html($committer); + $props['Committer'] = $committer; } } @@ -467,7 +469,7 @@ final class DiffusionCommitController extends DiffusionController { foreach ($task_phids as $phid) { $task_list[] = $handles[$phid]->renderLink(); } - $task_list = implode('
    ', $task_list); + $task_list = array_interleave(phutil_tag('br'), $task_list); $props['Tasks'] = $task_list; } @@ -476,7 +478,7 @@ final class DiffusionCommitController extends DiffusionController { foreach ($proj_phids as $phid) { $proj_list[] = $handles[$phid]->renderLink(); } - $proj_list = implode('
    ', $proj_list); + $proj_list = array_interleave(phutil_tag('br'), $proj_list); $props['Projects'] = $proj_list; } diff --git a/src/applications/drydock/controller/DrydockLeaseViewController.php b/src/applications/drydock/controller/DrydockLeaseViewController.php index 21ab432f91..ac634b9ccc 100644 --- a/src/applications/drydock/controller/DrydockLeaseViewController.php +++ b/src/applications/drydock/controller/DrydockLeaseViewController.php @@ -109,19 +109,17 @@ final class DrydockLeaseViewController extends DrydockController { $view->addProperty( pht('Resource Type'), - phutil_escape_html($lease->getResourceType())); + $lease->getResourceType()); $view->addProperty( pht('Resource'), - phutil_escape_html($lease->getResourceID())); + $lease->getResourceID()); $attributes = $lease->getAttributes(); if ($attributes) { $view->addSectionHeader(pht('Attributes')); foreach ($attributes as $key => $value) { - $view->addProperty( - phutil_escape_html($key), - phutil_escape_html($value)); + $view->addProperty($key, $value); } } diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php index 47ffb98d4f..33dcf38514 100644 --- a/src/applications/drydock/controller/DrydockResourceViewController.php +++ b/src/applications/drydock/controller/DrydockResourceViewController.php @@ -97,7 +97,6 @@ final class DrydockResourceViewController extends DrydockController { $status = $resource->getStatus(); $status = DrydockResourceStatus::getNameForStatus($status); - $status = phutil_escape_html($status); $view->addProperty( pht('Status'), @@ -105,15 +104,13 @@ final class DrydockResourceViewController extends DrydockController { $view->addProperty( pht('Resource Type'), - phutil_escape_html($resource->getType())); + $resource->getType()); $attributes = $resource->getAttributes(); if ($attributes) { $view->addSectionHeader(pht('Attributes')); foreach ($attributes as $key => $value) { - $view->addProperty( - phutil_escape_html($key), - phutil_escape_html($value)); + $view->addProperty($key, $value); } } diff --git a/src/applications/files/controller/PhabricatorFileInfoController.php b/src/applications/files/controller/PhabricatorFileInfoController.php index 9b1f1c0619..faeac9c154 100644 --- a/src/applications/files/controller/PhabricatorFileInfoController.php +++ b/src/applications/files/controller/PhabricatorFileInfoController.php @@ -112,19 +112,19 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { $view->addProperty( pht('Mime Type'), - phutil_escape_html($file->getMimeType())); + $file->getMimeType()); $view->addProperty( pht('Engine'), - phutil_escape_html($file->getStorageEngine())); + $file->getStorageEngine()); $view->addProperty( pht('Format'), - phutil_escape_html($file->getStorageFormat())); + $file->getStorageFormat()); $view->addProperty( pht('Handle'), - phutil_escape_html($file->getStorageHandle())); + $file->getStorageHandle()); $metadata = $file->getMetadata(); if (!empty($metadata)) { @@ -133,7 +133,7 @@ final class PhabricatorFileInfoController extends PhabricatorFileController { foreach ($metadata as $key => $value) { $view->addProperty( PhabricatorFile::getMetadataName($key), - phutil_escape_html($value)); + $value); } } diff --git a/src/applications/macro/controller/PhabricatorMacroViewController.php b/src/applications/macro/controller/PhabricatorMacroViewController.php index b2b7d1e98a..770ae16a1c 100644 --- a/src/applications/macro/controller/PhabricatorMacroViewController.php +++ b/src/applications/macro/controller/PhabricatorMacroViewController.php @@ -147,9 +147,9 @@ final class PhabricatorMacroViewController foreach ($subscribers as $subscriber) { $sub_view[] = $this->getHandle($subscriber)->renderLink(); } - $sub_view = implode(', ', $sub_view); + $sub_view = array_interleave(', ', $sub_view); } else { - $sub_view = ''.pht('None').''; + $sub_view = phutil_tag('em', array(), pht('None')); } $view->addProperty( diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php index cf1059d99e..b4567f0ddf 100644 --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -435,18 +435,17 @@ final class ManiphestTaskDetailController extends ManiphestController { pht('Assigned To'), $task->getOwnerPHID() ? $this->getHandle($task->getOwnerPHID())->renderLink() - : ''.pht('None').''); + : phutil_tag('em', array(), pht('None'))); $view->addProperty( pht('Priority'), - phutil_escape_html( - ManiphestTaskPriority::getTaskPriorityName($task->getPriority()))); + ManiphestTaskPriority::getTaskPriorityName($task->getPriority())); $view->addProperty( pht('Subscribers'), $task->getCCPHIDs() ? $this->renderHandlesForPHIDs($task->getCCPHIDs(), ',') - : ''.pht('None').''); + : phutil_tag('em', array(), pht('None'))); $view->addProperty( pht('Author'), @@ -469,7 +468,7 @@ final class ManiphestTaskDetailController extends ManiphestController { pht('Projects'), $task->getProjectPHIDs() ? $this->renderHandlesForPHIDs($task->getProjectPHIDs(), ',') - : ''.pht('None').''); + : phutil_tag('em', array(), pht('None'))); foreach ($aux_fields as $aux_field) { $aux_key = $aux_field->getAuxiliaryKey(); diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php index 15fc82ad2a..00214cf100 100644 --- a/src/applications/phame/controller/blog/PhameBlogViewController.php +++ b/src/applications/phame/controller/blog/PhameBlogViewController.php @@ -69,11 +69,11 @@ final class PhameBlogViewController extends PhameController { $properties->addProperty( pht('Skin'), - phutil_escape_html($blog->getSkin())); + $blog->getSkin()); $properties->addProperty( pht('Domain'), - phutil_escape_html($blog->getDomain())); + $blog->getDomain()); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $user, @@ -97,9 +97,12 @@ final class PhameBlogViewController extends PhameController { ->process(); $properties->addTextContent( - '
    '. - $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION). - '
    '); + phutil_tag( + 'div', + array( + 'class' => 'phabricator-remarkup', + ), + $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION))); return $properties; } diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php index 967316014c..d29b582a05 100644 --- a/src/applications/phame/controller/post/PhamePostViewController.php +++ b/src/applications/phame/controller/post/PhamePostViewController.php @@ -184,9 +184,12 @@ final class PhamePostViewController extends PhameController { ->process(); $properties->addTextContent( - '
    '. - $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY). - '
    '); + phutil_tag( + 'div', + array( + 'class' => 'phabricator-remarkup', + ), + $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY))); return $properties; } diff --git a/src/applications/pholio/controller/PholioMockViewController.php b/src/applications/pholio/controller/PholioMockViewController.php index 0bf0022fe1..a03452a6d4 100644 --- a/src/applications/pholio/controller/PholioMockViewController.php +++ b/src/applications/pholio/controller/PholioMockViewController.php @@ -148,7 +148,7 @@ final class PholioMockViewController extends PholioController { } $sub_view = implode(', ', $sub_view); } else { - $sub_view = ''.pht('None').''; + $sub_view = phutil_tag('em', array(), pht('None')); } $properties->addProperty( diff --git a/src/applications/ponder/controller/PonderQuestionViewController.php b/src/applications/ponder/controller/PonderQuestionViewController.php index 4a34a328f0..0526d30d7b 100644 --- a/src/applications/ponder/controller/PonderQuestionViewController.php +++ b/src/applications/ponder/controller/PonderQuestionViewController.php @@ -117,15 +117,12 @@ final class PonderQuestionViewController extends PonderController { phabricator_datetime($question->getDateCreated(), $viewer)); if ($subscribers) { - foreach ($subscribers as $key => $subscriber) { - $subscribers[$key] = $this->getHandle($subscriber)->renderLink(); - } - $subscribers = implode(', ', $subscribers); + $subscribers = $this->renderHandlesForPHIDs($subscribers); } $view->addProperty( pht('Subscribers'), - nonempty($subscribers, ''.pht('None').'')); + nonempty($subscribers, phutil_tag('em', array(), pht('None')))); return $view; } diff --git a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php index 68e1449aa6..0e0e6dc2ec 100644 --- a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php +++ b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php @@ -49,9 +49,10 @@ final class PhabricatorPropertyListExample extends PhabricatorUIExample { $view->addSectionHeader('Haiku About Pasta'); $view->addTextContent( - 'this is a pasta
    '. - 'haiku. it is very bad.
    '. - 'what did you expect?'); + phutil_safe_html( + 'this is a pasta
    '. + 'haiku. it is very bad.
    '. + 'what did you expect?')); $edge_cases_header = id(new PhabricatorHeaderView()) ->setHeader(pht('Edge Cases')); diff --git a/src/view/layout/PhabricatorPropertyListView.php b/src/view/layout/PhabricatorPropertyListView.php index d89ee97fb4..85c1c2774b 100644 --- a/src/view/layout/PhabricatorPropertyListView.php +++ b/src/view/layout/PhabricatorPropertyListView.php @@ -93,30 +93,21 @@ final class PhabricatorPropertyListView extends AphrontView { 'class' => 'phabricator-property-list-key', ), $key); - $items[] = phutil_render_tag( + + $items[] = phutil_tag( 'dd', array( 'class' => 'phabricator-property-list-value', ), - $this->renderSingleView($value)); + $this->renderHTMLView($value)); } - $list = phutil_render_tag( + $list = phutil_tag( 'dl', array( 'class' => 'phabricator-property-list-properties', ), - $this->renderSingleView($items)); - - $content = $this->renderChildren(); - if (strlen($content)) { - $content = phutil_render_tag( - 'div', - array( - 'class' => 'phabricator-property-list-content', - ), - $content); - } + $this->renderHTMLView($items)); $shortcuts = null; if ($this->hasKeyboardShortcuts) { @@ -124,9 +115,9 @@ final class PhabricatorPropertyListView extends AphrontView { id(new AphrontKeyboardShortcutsAvailableView())->render(); } - return - $shortcuts. - phutil_render_tag( + return array( + $shortcuts, + phutil_tag( 'div', array( 'class' => 'phabricator-property-list-container', @@ -137,7 +128,7 @@ final class PhabricatorPropertyListView extends AphrontView { 'div', array('class' => 'phabriator-property-list-view-end'), ''), - )); + ))); } private function renderSectionPart(array $part) { @@ -150,7 +141,7 @@ final class PhabricatorPropertyListView extends AphrontView { } private function renderTextPart(array $part) { - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-property-list-text-content', -- 2.51.2 From fb59101cde0301950dcd66865daa6b2d4b33c632 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 29 Jan 2013 11:29:56 -0800 Subject: [PATCH 25/50] Use phutil_tag in Setup issue stuff Summary: These are pretty straightforward, they just have a fair amount of instructional text with inline markup. Test Plan: Added and viewed a UIExample. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4686 --- src/__phutil_library_map__.php | 2 + .../check/PhabricatorSetupCheckBaseURI.php | 9 +- .../check/PhabricatorSetupCheckDatabase.php | 2 +- .../config/view/PhabricatorSetupIssueView.php | 160 +++++++++--------- .../examples/PhabricatorSetupIssueExample.php | 38 +++++ 5 files changed, 125 insertions(+), 86 deletions(-) create mode 100644 src/applications/uiexample/examples/PhabricatorSetupIssueExample.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 7d83b3c810..2e6fb805e2 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1254,6 +1254,7 @@ phutil_register_library_map(array( 'PhabricatorSetupCheckStorage' => 'applications/config/check/PhabricatorSetupCheckStorage.php', 'PhabricatorSetupCheckTimezone' => 'applications/config/check/PhabricatorSetupCheckTimezone.php', 'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php', + 'PhabricatorSetupIssueExample' => 'applications/uiexample/examples/PhabricatorSetupIssueExample.php', 'PhabricatorSetupIssueView' => 'applications/config/view/PhabricatorSetupIssueView.php', 'PhabricatorSlowvoteChoice' => 'applications/slowvote/storage/PhabricatorSlowvoteChoice.php', 'PhabricatorSlowvoteComment' => 'applications/slowvote/storage/PhabricatorSlowvoteComment.php', @@ -2652,6 +2653,7 @@ phutil_register_library_map(array( 'PhabricatorSetupCheckPath' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckStorage' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckTimezone' => 'PhabricatorSetupCheck', + 'PhabricatorSetupIssueExample' => 'PhabricatorUIExample', 'PhabricatorSetupIssueView' => 'AphrontView', 'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO', 'PhabricatorSlowvoteComment' => 'PhabricatorSlowvoteDAO', diff --git a/src/applications/config/check/PhabricatorSetupCheckBaseURI.php b/src/applications/config/check/PhabricatorSetupCheckBaseURI.php index 1a5671a737..83c6fb2624 100644 --- a/src/applications/config/check/PhabricatorSetupCheckBaseURI.php +++ b/src/applications/config/check/PhabricatorSetupCheckBaseURI.php @@ -59,9 +59,10 @@ final class PhabricatorSetupCheckBaseURI extends PhabricatorSetupCheck { ->setSummary($summary) ->setMessage($message) ->addCommand( - csprintf( - 'phabricator/ $ '. - './bin/config set phabricator.base-uri %s', - $base_uri_guess)); + hsprintf( + 'phabricator/ $ %s', + csprintf( + './bin/config set phabricator.base-uri %s', + $base_uri_guess))); } } diff --git a/src/applications/config/check/PhabricatorSetupCheckDatabase.php b/src/applications/config/check/PhabricatorSetupCheckDatabase.php index adef6a7cc1..d966b19b97 100644 --- a/src/applications/config/check/PhabricatorSetupCheckDatabase.php +++ b/src/applications/config/check/PhabricatorSetupCheckDatabase.php @@ -79,7 +79,7 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck { ->setName(pht('Setup MySQL Schema')) ->setMessage($message) ->setIsFatal(true) - ->addCommand('phabricator/ $ ./bin/storage upgrade'); + ->addCommand(hsprintf('phabricator/ $ ./bin/storage upgrade')); } } } diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index 795f124b9d..e212d71010 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -16,7 +16,8 @@ final class PhabricatorSetupIssueView extends AphrontView { public function render() { $issue = $this->getIssue(); - $description = phutil_tag( + $description = array(); + $description[] = phutil_tag( 'div', array( 'class' => 'setup-issue-instructions', @@ -25,25 +26,25 @@ final class PhabricatorSetupIssueView extends AphrontView { $configs = $issue->getPHPConfig(); if ($configs) { - $description .= $this->renderPHPConfig($configs); + $description[] = $this->renderPHPConfig($configs); } $configs = $issue->getPhabricatorConfig(); if ($configs) { - $description .= $this->renderPhabricatorConfig($configs); + $description[] = $this->renderPhabricatorConfig($configs); } $commands = $issue->getCommands(); if ($commands) { $run_these = pht("Run these %d command(s):", count($commands)); - $description .= phutil_tag( + $description[] = phutil_tag( 'div', array( 'class' => 'setup-issue-config', ), array( - phutil_render_tag('p', array(), $run_these), - phutil_render_tag('pre', array(), implode("\n", $commands)), + phutil_tag('p', array(), $run_these), + phutil_tag('pre', array(), array_interleave("\n", $commands)), )); } @@ -52,11 +53,11 @@ final class PhabricatorSetupIssueView extends AphrontView { $install_these = pht( "Install these %d PHP extension(s):", count($extensions)); - $install_info = pht( + $install_info = phutil_safe_html(pht( "You can usually install a PHP extension using apt-get or ". "yum. Common package names are ". "php-extname or php5-extname. ". - "Try commands like these:"); + "Try commands like these:")); // TODO: We should do a better job of detecting how to install extensions // on the current system. @@ -65,6 +66,7 @@ final class PhabricatorSetupIssueView extends AphrontView { "$ sudo yum install php-extname # Red Hat / Derivatives", ); $install_commands = implode("\n", $install_commands); + $install_commands = phutil_safe_html($install_commands); $fallback_info = pht( "If those commands don't work, try Google. The process of installing ". @@ -75,19 +77,20 @@ final class PhabricatorSetupIssueView extends AphrontView { $restart_info = pht( "After installing new PHP extensions, restart your webserver ". "for the changes to take effect."); + $restart_info = phutil_safe_html($restart_info); - $description .= phutil_tag( + $description[] = phutil_tag( 'div', array( 'class' => 'setup-issue-config', ), array( - phutil_render_tag('p', array(), $install_these), - phutil_render_tag('pre', array(), implode("\n", $extensions)), - phutil_render_tag('p', array(), $install_info), - phutil_render_tag('pre', array(), $install_commands), - phutil_render_tag('p', array(), $fallback_info), - phutil_render_tag('p', array(), $restart_info), + phutil_tag('p', array(), $install_these), + phutil_tag('pre', array(), implode("\n", $extensions)), + phutil_tag('p', array(), $install_info), + phutil_tag('pre', array(), $install_commands), + phutil_tag('p', array(), $fallback_info), + phutil_tag('p', array(), $restart_info), )); } @@ -111,7 +114,12 @@ final class PhabricatorSetupIssueView extends AphrontView { array( 'class' => 'setup-issue', ), - array($name, $description, $next)); + $this->renderHTMLView( + array( + $name, + $description, + $next, + ))); } private function renderPhabricatorConfig(array $configs) { @@ -124,32 +132,11 @@ final class PhabricatorSetupIssueView extends AphrontView { "The current Phabricator configuration has these %d value(s):", count($configs))); - $table = array(); + $dict = array(); foreach ($configs as $key) { - $table[] = ''; - $table[] = ''.phutil_escape_html($key).''; - - $value = PhabricatorEnv::getUnrepairedEnvConfig($key); - if ($value === null) { - $value = 'null'; - } else if ($value === false) { - $value = 'false'; - } else if ($value === true) { - $value = 'true'; - } else { - $value = phutil_escape_html( - PhabricatorConfigJSON::prettyPrintJSON($value)); - } - - $table[] = ''.$value.''; - $table[] = ''; + $dict[$key] = PhabricatorEnv::getUnrepairedEnvConfig($key); } - - $table = phutil_tag( - 'table', - array( - ), - new PhutilSafeHTML(implode("\n", $table))); + $table = $this->renderValueTable($dict); $options = PhabricatorApplicationConfigOptions::loadAllOptions(); @@ -164,12 +151,11 @@ final class PhabricatorSetupIssueView extends AphrontView { $update = array(); foreach ($configs as $key) { - $cmd = 'phabricator/ $ ./bin/config set '. - phutil_escape_html($key).' '. - 'value'; - $update[] = $cmd; + $update[] = hsprintf( + 'phabricator/ $ ./bin/config set %s value', + $key); } - $update = phutil_render_tag('pre', array(), implode("\n", $update)); + $update = phutil_tag('pre', array(), array_interleave("\n", $update)); } else { $update = array(); foreach ($configs as $config) { @@ -182,11 +168,11 @@ final class PhabricatorSetupIssueView extends AphrontView { 'href' => '/config/edit/'.$config.'/?issue='.$issue->getIssueKey(), ), pht('Edit %s', $config)); - $update[] = '
  • '.$link.'
  • '; + $update[] = phutil_tag('li', array(), $link); } if ($update) { - $update = '
      '.implode("\n", $update).'
    '; - $update_info = phutil_render_tag( + $update = phutil_tag('ul', array(), $update); + $update_info = phutil_tag( 'p', array(), pht("You can update these %d value(s) here:", count($configs))); @@ -196,12 +182,12 @@ final class PhabricatorSetupIssueView extends AphrontView { } } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'setup-issue-config', ), - self::renderSingleView( + self::renderHTMLView( array( $table_info, $table, @@ -218,32 +204,12 @@ final class PhabricatorSetupIssueView extends AphrontView { "The current PHP configuration has these %d value(s):", count($configs))); - $table = array(); + $dict = array(); foreach ($configs as $key) { - $table[] = ''; - $table[] = ''.phutil_escape_html($key).''; - - $value = ini_get($key); - if ($value === null) { - $value = 'null'; - } else if ($value === false) { - $value = 'false'; - } else if ($value === true) { - $value = 'true'; - } else if ($value === '') { - $value = '(empty string)'; - } else { - $value = phutil_escape_html($value); - } - - $table[] = ''.$value.''; - $table[] = ''; + $dict[$key] = ini_get($key); } - $table = phutil_tag( - 'table', - array(), - new PhutilSafeHTML(implode("\n", $table))); + $table = $this->renderValueTable($dict); ob_start(); phpinfo(); @@ -270,41 +236,42 @@ final class PhabricatorSetupIssueView extends AphrontView { } } + $info = array(); if (!$ini_loc) { - $info = phutil_tag( + $info[] = phutil_tag( 'p', array(), pht( "To update these %d value(s), edit your PHP configuration file.", count($configs))); } else { - $info = phutil_tag( + $info[] = phutil_tag( 'p', array(), pht( "To update these %d value(s), edit your PHP configuration file, ". "located here:", count($configs))); - $info .= phutil_tag( + $info[] = phutil_tag( 'pre', array(), $ini_loc); } if ($more_loc) { - $info .= phutil_tag( + $info[] = phutil_tag( 'p', array(), pht( "PHP also loaded these configuration file(s):", count($more_loc))); - $info .= phutil_tag( + $info[] = phutil_tag( 'pre', array(), implode("\n", $more_loc)); } - $info .= phutil_tag( + $info[] = phutil_tag( 'p', array(), phutil_safe_html(pht( @@ -312,7 +279,7 @@ final class PhabricatorSetupIssueView extends AphrontView { 'PHP Documentation.', 'http://php.net/manual/ini.list.php'))); - $info .= phutil_tag( + $info[] = phutil_tag( 'p', array(), phutil_safe_html(pht( @@ -324,7 +291,38 @@ final class PhabricatorSetupIssueView extends AphrontView { array( 'class' => 'setup-issue-config', ), - array($table_info, $table, $info)); + $this->renderHTMLView( + array( + $table_info, + $table, + $info, + ))); + } + + private function renderValueTable(array $dict) { + $rows = array(); + foreach ($dict as $key => $value) { + $cols = array( + phutil_tag('th', array(), $key), + phutil_tag('td', array(), $this->renderValueForDisplay($value)), + ); + $rows[] = phutil_tag('tr', array(), $cols); + } + return phutil_tag('table', array(), $rows); + } + + private function renderValueForDisplay($value) { + if ($value === null) { + return phutil_tag('em', array(), 'null'); + } else if ($value === false) { + return phutil_tag('em', array(), 'false'); + } else if ($value === true) { + return phutil_tag('em', array(), 'true'); + } else if ($value === '') { + return phutil_tag('em', array(), 'empty string'); + } else { + return PhabricatorConfigJSON::prettyPrintJSON($value); + } } } diff --git a/src/applications/uiexample/examples/PhabricatorSetupIssueExample.php b/src/applications/uiexample/examples/PhabricatorSetupIssueExample.php new file mode 100644 index 0000000000..1f25ef3e0a --- /dev/null +++ b/src/applications/uiexample/examples/PhabricatorSetupIssueExample.php @@ -0,0 +1,38 @@ +getRequest(); + $user = $request->getUser(); + + $issue = id(new PhabricatorSetupIssue()) + ->setShortName(pht('Short Name')) + ->setName(pht('Name')) + ->setSummary(pht('Summary')) + ->setMessage(pht('Message')) + ->setIssueKey('example.key') + ->addCommand('$ # Add Command') + ->addCommand(hsprintf('$ %s', '$ ls -1 > /dev/null')) + ->addPHPConfig('php.config.example') + ->addPhabricatorConfig('test.value') + ->addPHPExtension('libexample'); + + // NOTE: Since setup issues may be rendered before we can build the page + // chrome, they don't explicitly include resources. + require_celerity_resource('setup-issue-css'); + + $view = id(new PhabricatorSetupIssueView()) + ->setIssue($issue); + + return $view; + } +} -- 2.51.2 From 0a9f378594f07df699f6fb6f6ea8c9ef6b9d8300 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Jan 2013 10:58:21 -0800 Subject: [PATCH 26/50] render_tag -> tag: Differential Changeset stuff Summary: I cheated in a couple of places here, but this is in the process of getting refactored anyway, and there's a pretty clear boundary. Test Plan: Viewed changesets in Differential, viewed standalone. Viewed context elements. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4723 --- .../DifferentialChangesetViewController.php | 4 +++ .../DifferentialChangesetHTMLRenderer.php | 24 ++++++++----- .../DifferentialChangesetTwoUpRenderer.php | 32 +++++++++++++---- .../view/DifferentialChangesetDetailView.php | 34 ++++++++++--------- .../view/DifferentialChangesetListView.php | 22 ++++++------ .../application/core/behavior-dark-console.js | 1 - 6 files changed, 76 insertions(+), 41 deletions(-) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index dc09fd6db5..3d7454c229 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -234,6 +234,10 @@ final class DifferentialChangesetViewController extends DifferentialController { Javelin::initBehavior('differential-comment-jump', array()); + // TODO: [HTML] Clean up DifferentialChangesetParser output, but it's + // undergoing like six kinds of refactoring anyway. + $output = phutil_safe_html($output); + $detail = new DifferentialChangesetDetailView(); $detail->setChangeset($changeset); $detail->appendChild($output); diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php index 1a60831ac9..4efe69250a 100644 --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -319,9 +319,11 @@ abstract class DifferentialChangesetHTMLRenderer $meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL; } - $more = null; + $content = array(); + $content[] = $message; if ($force !== 'none') { - $more = ' '.javelin_tag( + $content[] = ' '; + $content[] = javelin_tag( 'a', array( 'mustcapture' => true, @@ -334,15 +336,18 @@ abstract class DifferentialChangesetHTMLRenderer } return $this->wrapChangeInTable( - javelin_render_tag( + javelin_tag( 'tr', array( 'sigil' => 'context-target', ), - ''. - phutil_escape_html($message). - $more. - '')); + phutil_tag( + 'td', + array( + 'class' => 'differential-shield', + 'colspan' => 6, + ), + $content))); } protected function wrapChangeInTable($content) { @@ -350,7 +355,10 @@ abstract class DifferentialChangesetHTMLRenderer return null; } - return javelin_render_tag( + // TODO: [HTML] After TwoUpRenderer gets refactored, fix this. + $content = phutil_safe_html($content); + + return javelin_tag( 'table', array( 'class' => 'differential-diff remarkup-code PhabricatorMonospaced', diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index cb22b44341..7a9bb3a1af 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -148,16 +148,36 @@ final class DifferentialChangesetTwoUpRenderer } } - $container = javelin_render_tag( + $container = javelin_tag( 'tr', array( 'sigil' => 'context-target', ), - ''. - implode(' • ', $contents). - ''. - ''.$context_line.''. - ''.$context.''); + array( + phutil_tag( + 'td', + array( + 'colspan' => 2, + 'class' => 'show-more', + ), + array_interleave( + " \xE2\x80\xA2 ", // Bullet + $contents)), + phutil_tag( + 'th', + array( + 'class' => 'show-context-line', + ), + $context_line ? (int)$context_line : null), + phutil_tag( + 'td', + array( + 'colspan' => 3, + 'class' => 'show-context', + ), + // TODO: [HTML] Escaping model here isn't ideal. + phutil_safe_html($context)), + )); $html[] = $container; diff --git a/src/applications/differential/view/DifferentialChangesetDetailView.php b/src/applications/differential/view/DifferentialChangesetDetailView.php index 364fe35701..f77b5377d3 100644 --- a/src/applications/differential/view/DifferentialChangesetDetailView.php +++ b/src/applications/differential/view/DifferentialChangesetDetailView.php @@ -59,10 +59,12 @@ final class DifferentialChangesetDetailView extends AphrontView { $buttons = null; if ($this->buttons) { - $buttons = - '
    '. - implode('', $this->buttons). - '
    '; + $buttons = phutil_tag( + 'div', + array( + 'class' => 'differential-changeset-buttons', + ), + $this->buttons); } $id = $this->getID(); @@ -77,7 +79,7 @@ final class DifferentialChangesetDetailView extends AphrontView { $display_filename = $changeset->getDisplayFilename(); - $output = javelin_render_tag( + return javelin_tag( 'div', array( 'sigil' => 'differential-changeset', @@ -90,17 +92,17 @@ final class DifferentialChangesetDetailView extends AphrontView { 'class' => $class, 'id' => $id, ), - id(new PhabricatorAnchorView()) - ->setAnchorName($changeset->getAnchorName()) - ->setNavigationMarker(true) - ->render(). - $buttons. - '

    '.phutil_escape_html($display_filename).'

    '. - '
    '. - $this->renderChildren()); - - - return $output; + $this->renderHTMLView( + array( + id(new PhabricatorAnchorView()) + ->setAnchorName($changeset->getAnchorName()) + ->setNavigationMarker(true) + ->render(), + $buttons, + phutil_tag('h1', array(), $display_filename), + phutil_tag('div', array('style' => 'clear: both'), ''), + $this->renderHTMLChildren(), + ))); } } diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index abbca39906..00094164f4 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -192,17 +192,19 @@ final class DifferentialChangesetListView extends AphrontView { )); } - return - id(new PhabricatorHeaderView()) - ->setHeader($this->getTitle()) - ->render(). - phutil_render_tag( - 'div', + return $this->renderHTMLView( array( - 'class' => 'differential-review-stage', - 'id' => 'differential-review-stage', - ), - implode("\n", $output)); + id(new PhabricatorHeaderView()) + ->setHeader($this->getTitle()) + ->render(), + phutil_tag( + 'div', + array( + 'class' => 'differential-review-stage', + 'id' => 'differential-review-stage', + ), + $output), + )); } /** diff --git a/webroot/rsrc/js/application/core/behavior-dark-console.js b/webroot/rsrc/js/application/core/behavior-dark-console.js index 0c72d0469c..99370a9342 100644 --- a/webroot/rsrc/js/application/core/behavior-dark-console.js +++ b/webroot/rsrc/js/application/core/behavior-dark-console.js @@ -81,7 +81,6 @@ JX.behavior('dark-console', function(config, statics) { JX.DOM.alterClass(req.all[req.current], 'dark-selected', true); if (statics.visible) { - JX.log('visible!'); draw_request(key); } } -- 2.51.2 From 74a90999d86c3a95e601c6bf5e30c47e84c1f395 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Jan 2013 11:24:30 -0800 Subject: [PATCH 27/50] render_tag -> tag: phabricator_form, differential inline comment Summary: Pretty straightforward. Test Plan: Viewed inline edit on left / right and new /edit. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4724 --- src/__phutil_library_map__.php | 2 +- .../DifferentialInlineCommentEditView.php | 88 +++++++++++-------- src/infrastructure/javelin/markup.php | 40 ++++++--- 3 files changed, 83 insertions(+), 47 deletions(-) diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 2e6fb805e2..617299a3de 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1483,6 +1483,7 @@ phutil_register_library_map(array( 'javelin_tag' => 'infrastructure/javelin/markup.php', 'phabricator_date' => 'view/viewutils.php', 'phabricator_datetime' => 'view/viewutils.php', + 'phabricator_form' => 'infrastructure/javelin/markup.php', 'phabricator_format_bytes' => 'view/viewutils.php', 'phabricator_format_local_time' => 'view/viewutils.php', 'phabricator_format_relative_time' => 'view/viewutils.php', @@ -1492,7 +1493,6 @@ phutil_register_library_map(array( 'phabricator_parse_bytes' => 'view/viewutils.php', 'phabricator_relative_date' => 'view/viewutils.php', 'phabricator_render_form' => 'infrastructure/javelin/markup.php', - 'phabricator_render_form_magic' => 'infrastructure/javelin/markup.php', 'phabricator_time' => 'view/viewutils.php', 'phid_get_subtype' => 'applications/phid/utils.php', 'phid_get_type' => 'applications/phid/utils.php', diff --git a/src/applications/differential/view/DifferentialInlineCommentEditView.php b/src/applications/differential/view/DifferentialInlineCommentEditView.php index 9471325c34..1fccbe5f82 100644 --- a/src/applications/differential/view/DifferentialInlineCommentEditView.php +++ b/src/applications/differential/view/DifferentialInlineCommentEditView.php @@ -48,31 +48,30 @@ final class DifferentialInlineCommentEditView extends AphrontView { throw new Exception("Call setUser() before render()!"); } - $content = phabricator_render_form( + $content = phabricator_form( $this->user, array( 'action' => $this->uri, 'method' => 'POST', 'sigil' => 'inline-edit-form', ), - $this->renderInputs(). - $this->renderBody()); - - if ($this->onRight) { - $core = - ''. - ''. - ''. - ''.$content.''; - } else { - $core = - ''. - ''.$content.''. - ''. - ''; - } - - return ''.$core.'
    '; + $this->renderHTMLView( + array( + $this->renderInputs(), + $this->renderBody(), + ))); + + return hsprintf( + ''. + ''. + ''. + ''. + ''. + ''. + ''. + '
    %s%s
    ', + $this->onRight ? null : $content, + $this->onRight ? $content : null); } private function renderInputs() { @@ -87,13 +86,13 @@ final class DifferentialInlineCommentEditView extends AphrontView { 'value' => $value, )); } - return implode('', $out); + return $out; } private function renderBody() { $buttons = array(); - $buttons[] = ''; + $buttons[] = phutil_tag('button', array(), 'Ready'); $buttons[] = javelin_tag( 'button', array( @@ -102,8 +101,6 @@ final class DifferentialInlineCommentEditView extends AphrontView { ), pht('Cancel')); - $buttons = implode('', $buttons); - $formatting = phutil_tag( 'a', array( @@ -114,7 +111,33 @@ final class DifferentialInlineCommentEditView extends AphrontView { ), pht('Formatting Reference')); - return javelin_render_tag( + $title = phutil_tag( + 'div', + array( + 'class' => 'differential-inline-comment-edit-title', + ), + $this->title); + + $body = phutil_tag( + 'div', + array( + 'class' => 'differential-inline-comment-edit-body', + ), + $this->renderHTMLChildren()); + + $edit = phutil_tag( + 'edit', + array( + 'class' => 'differential-inline-comment-edit-buttons', + ), + $this->renderHTMLView( + array( + $formatting, + $buttons, + phutil_tag('div', array('style' => 'clear: both'), ''), + ))); + + return javelin_tag( 'div', array( 'class' => 'differential-inline-comment-edit', @@ -125,17 +148,12 @@ final class DifferentialInlineCommentEditView extends AphrontView { 'length' => $this->length, ), ), - '
    '. - phutil_escape_html($this->title). - '
    '. - '
    '. - $this->renderChildren(). - '
    '. - '
    '. - $formatting. - $buttons. - '
    '. - '
    '); + $this->renderHTMLView( + array( + $title, + $body, + $edit, + ))); } } diff --git a/src/infrastructure/javelin/markup.php b/src/infrastructure/javelin/markup.php index 8c22002fe8..9397a3e6b3 100644 --- a/src/infrastructure/javelin/markup.php +++ b/src/infrastructure/javelin/markup.php @@ -48,29 +48,47 @@ function javelin_tag( return phutil_tag($tag, $attributes, $content); } -function phabricator_render_form(PhabricatorUser $user, $attributes, $content) { +function phabricator_form(PhabricatorUser $user, $attributes, $content) { + $body = array(); + if (strcasecmp(idx($attributes, 'method'), 'POST') == 0 && !preg_match('#^(https?:|//)#', idx($attributes, 'action'))) { - $content = phabricator_render_form_magic($user).$content; - } - return javelin_render_tag('form', $attributes, $content); -} - -function phabricator_render_form_magic(PhabricatorUser $user) { - return - phutil_tag( + $body[] = phutil_tag( 'input', array( 'type' => 'hidden', 'name' => AphrontRequest::getCSRFTokenName(), 'value' => $user->getCSRFToken(), - )). - phutil_tag( + )); + + $body[] = phutil_tag( 'input', array( 'type' => 'hidden', 'name' => '__form__', 'value' => true, )); + } + + if (is_array($content)) { + $body = array_merge($body, $content); + } else { + $body[] = $content; + } + + return javelin_tag('form', $attributes, $body); +} + + +/** + * @deprecated + */ +function phabricator_render_form(PhabricatorUser $user, $attributes, $content) { + if (is_array($content)) { + $content = implode('', $content); + } + + $html = phabricator_form($user, $attributes, phutil_safe_html($content)); + return $html->getHTMLContent(); } -- 2.51.2 From 607fca98df1257571659850064c1bc173819ab11 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Jan 2013 11:26:03 -0800 Subject: [PATCH 28/50] render_tag -> tag: Maniphest summary view, setup issue view Summary: One trivial, one not-so-trivial. Test Plan: Viewed maniphest list; saw expected output. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4725 --- .../PhabricatorConfigIssueViewController.php | 2 +- .../view/ManiphestTaskProjectsView.php | 2 +- .../view/ManiphestTaskSummaryView.php | 119 ++++++++++++------ 3 files changed, 80 insertions(+), 43 deletions(-) diff --git a/src/applications/config/controller/PhabricatorConfigIssueViewController.php b/src/applications/config/controller/PhabricatorConfigIssueViewController.php index ddac26922c..546261ed07 100644 --- a/src/applications/config/controller/PhabricatorConfigIssueViewController.php +++ b/src/applications/config/controller/PhabricatorConfigIssueViewController.php @@ -64,7 +64,7 @@ final class PhabricatorConfigIssueViewController $view = new PhabricatorSetupIssueView(); $view->setIssue($issue); - $container = phutil_render_tag( + $container = phutil_tag( 'div', array( 'class' => 'setup-issue-background', diff --git a/src/applications/maniphest/view/ManiphestTaskProjectsView.php b/src/applications/maniphest/view/ManiphestTaskProjectsView.php index 358d3145bc..00f4ad86f2 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 implode("\n", $tags); + return $this->renderHTMLView($tags); } } diff --git a/src/applications/maniphest/view/ManiphestTaskSummaryView.php b/src/applications/maniphest/view/ManiphestTaskSummaryView.php index 20c03b9fe0..6e7b13c7ea 100644 --- a/src/applications/maniphest/view/ManiphestTaskSummaryView.php +++ b/src/applications/maniphest/view/ManiphestTaskSummaryView.php @@ -60,17 +60,19 @@ final class ManiphestTaskSummaryView extends ManiphestView { $batch = null; if ($this->showBatchControls) { - $batch = - ''. - javelin_tag( - 'input', - array( - 'type' => 'checkbox', - 'name' => 'batch[]', - 'value' => $task->getID(), - 'sigil' => 'maniphest-batch', - )). - ''; + $batch = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-batch', + ), + javelin_tag( + 'input', + array( + 'type' => 'checkbox', + 'name' => 'batch[]', + 'value' => $task->getID(), + 'sigil' => 'maniphest-batch', + ))); } $projects_view = new ManiphestTaskProjectsView(); @@ -94,7 +96,70 @@ final class ManiphestTaskSummaryView extends ManiphestView { ), ''); - return javelin_render_tag( + $task_id = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-number', + ), + 'T'.$task->getID()); + + $task_status = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-status', + ), + idx($status_map, $task->getStatus(), 'Unknown')); + + $task_owner = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-owner', + ), + $task->getOwnerPHID() + ? $handles[$task->getOwnerPHID()]->renderLink() + : phutil_tag('em', array(), pht('None'))); + + $task_name = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-name', + ), + phutil_tag( + 'a', + array( + 'href' => '/T'.$task->getID(), + ), + $task->getTitle())); + + $task_projects = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-projects', + ), + $projects_view->render()); + + $task_updated = phutil_tag( + 'td', + array( + 'class' => 'maniphest-task-updated', + ), + phabricator_date($task->getDateModified(), $this->user)); + + $row = phutil_tag( + 'tr', + array(), + array( + $handle, + $batch, + $task_id, + $task_status, + $task_owner, + $task_name, + $task_projects, + $task_updated, + )); + + return javelin_tag( 'table', array( 'class' => 'maniphest-task-summary', @@ -103,35 +168,7 @@ final class ManiphestTaskSummaryView extends ManiphestView { 'taskID' => $task->getID(), ), ), - ''. - $handle. - $batch. - ''. - 'T'.$task->getID(). - ''. - ''. - idx($status_map, $task->getStatus(), 'Unknown'). - ''. - ''. - ($task->getOwnerPHID() - ? $handles[$task->getOwnerPHID()]->renderLink() - : 'None'). - ''. - ''. - phutil_tag( - 'a', - array( - 'href' => '/T'.$task->getID(), - ), - $task->getTitle()). - ''. - ''. - $projects_view->render(). - ''. - ''. - phabricator_date($task->getDateModified(), $this->user). - ''. - ''); + $row); } } -- 2.51.2 From f705c978b5d732e6523ef1b370af65ab85783c07 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 30 Jan 2013 11:30:38 -0800 Subject: [PATCH 29/50] render_tag -> tag: phabricator_render_form -> phabricator_form Summary: Convert most phabricator_render_form callsites. In the case of the "headsup view", it converts it by deleting the element entirely (this is the very old Maniphest/Differential header which we no longer use). Test Plan: Poked around a bit. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4726 --- scripts/celerity_mapper.php | 2 - src/__celerity_resource_map__.php | 182 ++++++++---------- src/__phutil_library_map__.php | 6 - .../PhabricatorMustVerifyEmailController.php | 2 +- .../DifferentialDiffViewController.php | 9 +- .../PhabricatorDirectoryMainController.php | 8 +- .../flag/view/PhabricatorFlagListView.php | 4 +- ...habricatorProjectMembersEditController.php | 4 +- .../PhabricatorProjectProfileController.php | 2 +- src/view/layout/PhabricatorActionView.php | 2 +- .../headsup/AphrontHeadsupActionListView.php | 28 --- .../headsup/AphrontHeadsupActionView.php | 73 ------- .../layout/headsup/AphrontHeadsupView.php | 81 -------- src/view/page/PhabricatorStandardPageView.php | 2 +- .../css/aphront/headsup-action-list-view.css | 74 ------- webroot/rsrc/css/aphront/headsup.css | 49 ----- 16 files changed, 98 insertions(+), 430 deletions(-) delete mode 100644 src/view/layout/headsup/AphrontHeadsupActionListView.php delete mode 100644 src/view/layout/headsup/AphrontHeadsupActionView.php delete mode 100644 src/view/layout/headsup/AphrontHeadsupView.php delete mode 100644 webroot/rsrc/css/aphront/headsup-action-list-view.css delete mode 100644 webroot/rsrc/css/aphront/headsup.css diff --git a/scripts/celerity_mapper.php b/scripts/celerity_mapper.php index 93867c86ff..d62d84b1a3 100755 --- a/scripts/celerity_mapper.php +++ b/scripts/celerity_mapper.php @@ -81,7 +81,6 @@ $package_spec = array( 'aphront-pager-view-css', 'phabricator-transaction-view-css', 'aphront-tooltip-css', - 'aphront-headsup-view-css', 'phabricator-flag-css', 'aphront-error-view-css', @@ -115,7 +114,6 @@ $package_spec = array( 'differential-revision-add-comment-css', 'differential-revision-comment-list-css', 'phabricator-object-selector-css', - 'aphront-headsup-action-list-view-css', 'phabricator-content-source-view-css', 'differential-local-commits-view-css', 'inline-comment-summary-css', diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index e6b8caacdf..4d694646f7 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -653,24 +653,6 @@ celerity_register_resource_map(array( ), 'disk' => '/rsrc/css/aphront/form-view.css', ), - 'aphront-headsup-action-list-view-css' => - array( - 'uri' => '/res/1dce0ad7/rsrc/css/aphront/headsup-action-list-view.css', - 'type' => 'css', - 'requires' => - array( - ), - 'disk' => '/rsrc/css/aphront/headsup-action-list-view.css', - ), - 'aphront-headsup-view-css' => - array( - 'uri' => '/res/73874cd2/rsrc/css/aphront/headsup.css', - 'type' => 'css', - 'requires' => - array( - ), - 'disk' => '/rsrc/css/aphront/headsup.css', - ), 'aphront-list-filter-view-css' => array( 'uri' => '/res/e783d6e1/rsrc/css/aphront/list-filter-view.css', @@ -1166,7 +1148,7 @@ celerity_register_resource_map(array( ), 'javelin-behavior-dark-console' => array( - 'uri' => '/res/c3e8a3d8/rsrc/js/application/core/behavior-dark-console.js', + 'uri' => '/res/52444d4e/rsrc/js/application/core/behavior-dark-console.js', 'type' => 'js', 'requires' => array( @@ -3375,7 +3357,7 @@ celerity_register_resource_map(array( ), array( 'packages' => array( - '0cb71c48' => + '0e6165d0' => array( 'name' => 'core.pkg.css', 'symbols' => @@ -3399,27 +3381,26 @@ celerity_register_resource_map(array( 16 => 'aphront-pager-view-css', 17 => 'phabricator-transaction-view-css', 18 => 'aphront-tooltip-css', - 19 => 'aphront-headsup-view-css', - 20 => 'phabricator-flag-css', - 21 => 'aphront-error-view-css', - 22 => 'sprite-icon-css', - 23 => 'sprite-gradient-css', - 24 => 'sprite-menu-css', - 25 => 'sprite-apps-large-css', - 26 => 'phabricator-main-menu-view', - 27 => 'phabricator-notification-css', - 28 => 'phabricator-notification-menu-css', - 29 => 'lightbox-attachment-css', - 30 => 'phabricator-header-view-css', - 31 => 'phabricator-form-view-css', - 32 => 'phabricator-filetree-view-css', - 33 => 'phabricator-nav-view-css', - 34 => 'phabricator-side-menu-view-css', - 35 => 'phabricator-crumbs-view-css', - 36 => 'phabricator-object-item-list-view-css', - 37 => 'global-drag-and-drop-css', + 19 => 'phabricator-flag-css', + 20 => 'aphront-error-view-css', + 21 => 'sprite-icon-css', + 22 => 'sprite-gradient-css', + 23 => 'sprite-menu-css', + 24 => 'sprite-apps-large-css', + 25 => 'phabricator-main-menu-view', + 26 => 'phabricator-notification-css', + 27 => 'phabricator-notification-menu-css', + 28 => 'lightbox-attachment-css', + 29 => 'phabricator-header-view-css', + 30 => 'phabricator-form-view-css', + 31 => 'phabricator-filetree-view-css', + 32 => 'phabricator-nav-view-css', + 33 => 'phabricator-side-menu-view-css', + 34 => 'phabricator-crumbs-view-css', + 35 => 'phabricator-object-item-list-view-css', + 36 => 'global-drag-and-drop-css', ), - 'uri' => '/res/pkg/0cb71c48/core.pkg.css', + 'uri' => '/res/pkg/0e6165d0/core.pkg.css', 'type' => 'css', ), 'ff199687' => @@ -3464,7 +3445,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/ff199687/core.pkg.js', 'type' => 'js', ), - '032118cf' => + '74593df4' => array( 'name' => 'darkconsole.pkg.js', 'symbols' => @@ -3472,10 +3453,10 @@ celerity_register_resource_map(array( 0 => 'javelin-behavior-dark-console', 1 => 'javelin-behavior-error-log', ), - 'uri' => '/res/pkg/032118cf/darkconsole.pkg.js', + 'uri' => '/res/pkg/74593df4/darkconsole.pkg.js', 'type' => 'js', ), - 'ec01d039' => + '8aaacd1b' => array( 'name' => 'differential.pkg.css', 'symbols' => @@ -3490,12 +3471,11 @@ celerity_register_resource_map(array( 7 => 'differential-revision-add-comment-css', 8 => 'differential-revision-comment-list-css', 9 => 'phabricator-object-selector-css', - 10 => 'aphront-headsup-action-list-view-css', - 11 => 'phabricator-content-source-view-css', - 12 => 'differential-local-commits-view-css', - 13 => 'inline-comment-summary-css', + 10 => 'phabricator-content-source-view-css', + 11 => 'differential-local-commits-view-css', + 12 => 'inline-comment-summary-css', ), - 'uri' => '/res/pkg/ec01d039/differential.pkg.css', + 'uri' => '/res/pkg/8aaacd1b/differential.pkg.css', 'type' => 'css', ), '9dae5f20' => @@ -3608,34 +3588,32 @@ celerity_register_resource_map(array( 'reverse' => array( 'aphront-attached-file-view-css' => 'e30a3fa8', - 'aphront-crumbs-view-css' => '0cb71c48', - 'aphront-dialog-view-css' => '0cb71c48', - 'aphront-error-view-css' => '0cb71c48', - 'aphront-form-view-css' => '0cb71c48', - 'aphront-headsup-action-list-view-css' => 'ec01d039', - 'aphront-headsup-view-css' => '0cb71c48', - 'aphront-list-filter-view-css' => '0cb71c48', - 'aphront-pager-view-css' => '0cb71c48', - 'aphront-panel-view-css' => '0cb71c48', - 'aphront-table-view-css' => '0cb71c48', - 'aphront-tokenizer-control-css' => '0cb71c48', - 'aphront-tooltip-css' => '0cb71c48', - 'aphront-typeahead-control-css' => '0cb71c48', - 'differential-changeset-view-css' => 'ec01d039', - 'differential-core-view-css' => 'ec01d039', + 'aphront-crumbs-view-css' => '0e6165d0', + 'aphront-dialog-view-css' => '0e6165d0', + 'aphront-error-view-css' => '0e6165d0', + 'aphront-form-view-css' => '0e6165d0', + 'aphront-list-filter-view-css' => '0e6165d0', + 'aphront-pager-view-css' => '0e6165d0', + 'aphront-panel-view-css' => '0e6165d0', + 'aphront-table-view-css' => '0e6165d0', + 'aphront-tokenizer-control-css' => '0e6165d0', + 'aphront-tooltip-css' => '0e6165d0', + 'aphront-typeahead-control-css' => '0e6165d0', + 'differential-changeset-view-css' => '8aaacd1b', + 'differential-core-view-css' => '8aaacd1b', 'differential-inline-comment-editor' => '9dae5f20', - 'differential-local-commits-view-css' => 'ec01d039', - 'differential-results-table-css' => 'ec01d039', - 'differential-revision-add-comment-css' => 'ec01d039', - 'differential-revision-comment-css' => 'ec01d039', - 'differential-revision-comment-list-css' => 'ec01d039', - 'differential-revision-history-css' => 'ec01d039', - 'differential-revision-list-css' => 'ec01d039', - 'differential-table-of-contents-css' => 'ec01d039', + 'differential-local-commits-view-css' => '8aaacd1b', + 'differential-results-table-css' => '8aaacd1b', + 'differential-revision-add-comment-css' => '8aaacd1b', + 'differential-revision-comment-css' => '8aaacd1b', + 'differential-revision-comment-list-css' => '8aaacd1b', + 'differential-revision-history-css' => '8aaacd1b', + 'differential-revision-list-css' => '8aaacd1b', + 'differential-table-of-contents-css' => '8aaacd1b', 'diffusion-commit-view-css' => 'c8ce2d88', 'diffusion-icons-css' => 'c8ce2d88', - 'global-drag-and-drop-css' => '0cb71c48', - 'inline-comment-summary-css' => 'ec01d039', + 'global-drag-and-drop-css' => '0e6165d0', + 'inline-comment-summary-css' => '8aaacd1b', 'javelin-aphlict' => 'ff199687', 'javelin-behavior' => '1c6f020b', 'javelin-behavior-aphlict-dropdown' => 'ff199687', @@ -3645,7 +3623,7 @@ celerity_register_resource_map(array( 'javelin-behavior-aphront-drag-and-drop-textarea' => '9dae5f20', 'javelin-behavior-aphront-form-disable-on-submit' => 'ff199687', 'javelin-behavior-audit-preview' => 'f96657b8', - 'javelin-behavior-dark-console' => '032118cf', + 'javelin-behavior-dark-console' => '74593df4', 'javelin-behavior-device' => 'ff199687', 'javelin-behavior-differential-accept-with-errors' => '9dae5f20', 'javelin-behavior-differential-add-reviewers-and-ccs' => '9dae5f20', @@ -3661,7 +3639,7 @@ celerity_register_resource_map(array( 'javelin-behavior-differential-user-select' => '9dae5f20', 'javelin-behavior-diffusion-commit-graph' => 'f96657b8', 'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8', - 'javelin-behavior-error-log' => '032118cf', + 'javelin-behavior-error-log' => '74593df4', 'javelin-behavior-global-drag-and-drop' => 'ff199687', 'javelin-behavior-konami' => 'ff199687', 'javelin-behavior-lightbox-attachments' => 'ff199687', @@ -3703,48 +3681,48 @@ celerity_register_resource_map(array( 'javelin-util' => '1c6f020b', 'javelin-vector' => '1c6f020b', 'javelin-workflow' => '1c6f020b', - 'lightbox-attachment-css' => '0cb71c48', + 'lightbox-attachment-css' => '0e6165d0', 'maniphest-task-summary-css' => 'e30a3fa8', 'maniphest-transaction-detail-css' => 'e30a3fa8', 'phabricator-busy' => 'ff199687', - 'phabricator-content-source-view-css' => 'ec01d039', - 'phabricator-core-buttons-css' => '0cb71c48', - 'phabricator-core-css' => '0cb71c48', - 'phabricator-crumbs-view-css' => '0cb71c48', - 'phabricator-directory-css' => '0cb71c48', + 'phabricator-content-source-view-css' => '8aaacd1b', + 'phabricator-core-buttons-css' => '0e6165d0', + 'phabricator-core-css' => '0e6165d0', + 'phabricator-crumbs-view-css' => '0e6165d0', + 'phabricator-directory-css' => '0e6165d0', 'phabricator-drag-and-drop-file-upload' => '9dae5f20', 'phabricator-dropdown-menu' => 'ff199687', 'phabricator-file-upload' => 'ff199687', - 'phabricator-filetree-view-css' => '0cb71c48', - 'phabricator-flag-css' => '0cb71c48', - 'phabricator-form-view-css' => '0cb71c48', - 'phabricator-header-view-css' => '0cb71c48', - 'phabricator-jump-nav' => '0cb71c48', + 'phabricator-filetree-view-css' => '0e6165d0', + 'phabricator-flag-css' => '0e6165d0', + 'phabricator-form-view-css' => '0e6165d0', + 'phabricator-header-view-css' => '0e6165d0', + 'phabricator-jump-nav' => '0e6165d0', 'phabricator-keyboard-shortcut' => 'ff199687', 'phabricator-keyboard-shortcut-manager' => 'ff199687', - 'phabricator-main-menu-view' => '0cb71c48', + 'phabricator-main-menu-view' => '0e6165d0', 'phabricator-menu-item' => 'ff199687', - 'phabricator-nav-view-css' => '0cb71c48', + 'phabricator-nav-view-css' => '0e6165d0', 'phabricator-notification' => 'ff199687', - 'phabricator-notification-css' => '0cb71c48', - 'phabricator-notification-menu-css' => '0cb71c48', - 'phabricator-object-item-list-view-css' => '0cb71c48', - 'phabricator-object-selector-css' => 'ec01d039', + 'phabricator-notification-css' => '0e6165d0', + 'phabricator-notification-menu-css' => '0e6165d0', + 'phabricator-object-item-list-view-css' => '0e6165d0', + 'phabricator-object-selector-css' => '8aaacd1b', 'phabricator-paste-file-upload' => 'ff199687', 'phabricator-prefab' => 'ff199687', 'phabricator-project-tag-css' => 'e30a3fa8', - 'phabricator-remarkup-css' => '0cb71c48', + 'phabricator-remarkup-css' => '0e6165d0', 'phabricator-shaped-request' => '9dae5f20', - 'phabricator-side-menu-view-css' => '0cb71c48', - 'phabricator-standard-page-view' => '0cb71c48', + 'phabricator-side-menu-view-css' => '0e6165d0', + 'phabricator-standard-page-view' => '0e6165d0', 'phabricator-textareautils' => 'ff199687', 'phabricator-tooltip' => 'ff199687', - 'phabricator-transaction-view-css' => '0cb71c48', - 'phabricator-zindex-css' => '0cb71c48', - 'sprite-apps-large-css' => '0cb71c48', - 'sprite-gradient-css' => '0cb71c48', - 'sprite-icon-css' => '0cb71c48', - 'sprite-menu-css' => '0cb71c48', - 'syntax-highlighting-css' => '0cb71c48', + 'phabricator-transaction-view-css' => '0e6165d0', + 'phabricator-zindex-css' => '0e6165d0', + 'sprite-apps-large-css' => '0e6165d0', + 'sprite-gradient-css' => '0e6165d0', + 'sprite-icon-css' => '0e6165d0', + 'sprite-menu-css' => '0e6165d0', + 'syntax-highlighting-css' => '0e6165d0', ), )); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 617299a3de..70424e5d79 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -55,9 +55,6 @@ phutil_register_library_map(array( 'AphrontHTMLResponse' => 'aphront/response/AphrontHTMLResponse.php', 'AphrontHTTPSink' => 'aphront/sink/AphrontHTTPSink.php', 'AphrontHTTPSinkTestCase' => 'aphront/sink/__tests__/AphrontHTTPSinkTestCase.php', - 'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php', - 'AphrontHeadsupActionView' => 'view/layout/headsup/AphrontHeadsupActionView.php', - 'AphrontHeadsupView' => 'view/layout/headsup/AphrontHeadsupView.php', 'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php', 'AphrontIsolatedHTTPSink' => 'aphront/sink/AphrontIsolatedHTTPSink.php', 'AphrontJSONResponse' => 'aphront/response/AphrontJSONResponse.php', @@ -1544,9 +1541,6 @@ phutil_register_library_map(array( 'AphrontFormView' => 'AphrontView', 'AphrontHTMLResponse' => 'AphrontResponse', 'AphrontHTTPSinkTestCase' => 'PhabricatorTestCase', - 'AphrontHeadsupActionListView' => 'AphrontView', - 'AphrontHeadsupActionView' => 'AphrontView', - 'AphrontHeadsupView' => 'AphrontView', 'AphrontIsolatedDatabaseConnectionTestCase' => 'PhabricatorTestCase', 'AphrontIsolatedHTTPSink' => 'AphrontHTTPSink', 'AphrontJSONResponse' => 'AphrontResponse', diff --git a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php index 21af745ed2..7aa356f9e6 100644 --- a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php +++ b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php @@ -51,7 +51,7 @@ final class PhabricatorMustVerifyEmailController '

    '); $error_view->appendChild( '
    '. - phabricator_render_form( + phabricator_form( $user, array( 'action' => '/login/mustverify/', diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php index 1ca4a9de73..d764f560e3 100644 --- a/src/applications/differential/controller/DifferentialDiffViewController.php +++ b/src/applications/differential/controller/DifferentialDiffViewController.php @@ -113,9 +113,10 @@ final class DifferentialDiffViewController extends DifferentialController { } } - $action_panel = new AphrontHeadsupView(); - $action_panel->setProperties($dict); - $action_panel->setHeader(pht('Diff Properties')); + $property_view = new PhabricatorPropertyListView(); + foreach ($dict as $key => $value) { + $property_view->addProperty($key, $value); + } $changesets = $diff->loadChangesets(); $changesets = msort($changesets, 'getSortKey'); @@ -144,7 +145,7 @@ final class DifferentialDiffViewController extends DifferentialController { ->appendChild( array( $top_panel->render(), - $action_panel->render(), + $property_view, $table_of_contents->render(), $details->render(), )), diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 15eeda8453..eca0c28b1a 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -322,15 +322,17 @@ final class PhabricatorDirectoryMainController $panel = new AphrontPanelView(); $panel->setHeader('Jump Nav'); $panel->appendChild( - phabricator_render_form( + phabricator_form( $user, array( 'action' => '/jump/', 'method' => 'POST', 'class' => 'phabricator-jump-nav-form', ), - $jump_input. - $jump_caption)); + array( + $jump_input, + $jump_caption, + ))); return $panel; } diff --git a/src/applications/flag/view/PhabricatorFlagListView.php b/src/applications/flag/view/PhabricatorFlagListView.php index 332f683418..90be2b8f2f 100644 --- a/src/applications/flag/view/PhabricatorFlagListView.php +++ b/src/applications/flag/view/PhabricatorFlagListView.php @@ -29,7 +29,7 @@ final class PhabricatorFlagListView extends AphrontView { $flag->getHandle()->renderLink(), phutil_escape_html($flag->getNote()), phabricator_datetime($flag->getDateCreated(), $user), - phabricator_render_form( + phabricator_form( $user, array( 'method' => 'POST', @@ -42,7 +42,7 @@ final class PhabricatorFlagListView extends AphrontView { 'class' => 'small grey', ), 'Edit Flag')), - phabricator_render_form( + phabricator_form( $user, array( 'method' => 'POST', diff --git a/src/applications/project/controller/PhabricatorProjectMembersEditController.php b/src/applications/project/controller/PhabricatorProjectMembersEditController.php index 1e89cb307f..1e84d2823e 100644 --- a/src/applications/project/controller/PhabricatorProjectMembersEditController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersEditController.php @@ -151,13 +151,13 @@ final class PhabricatorProjectMembersEditController $list->addButton( $handle, - phabricator_render_form( + phabricator_form( $user, array( 'method' => 'POST', 'action' => $request->getRequestURI(), ), - $hidden_input.$button)); + array($hidden_input, $button))); } return $list; diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index 4d6e4b8eee..9e18af9849 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -85,7 +85,7 @@ final class PhabricatorProjectProfileController $class = 'grey disabled'; } - $action = phabricator_render_form( + $action = phabricator_form( $user, array( 'action' => '/project/update/'.$project->getID().'/join/', diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php index bb030b60c2..9cac7a6723 100644 --- a/src/view/layout/PhabricatorActionView.php +++ b/src/view/layout/PhabricatorActionView.php @@ -91,7 +91,7 @@ final class PhabricatorActionView extends AphrontView { $sigils[] = 'download'; } - $item = phabricator_render_form( + $item = phabricator_form( $this->user, array( 'action' => $this->href, diff --git a/src/view/layout/headsup/AphrontHeadsupActionListView.php b/src/view/layout/headsup/AphrontHeadsupActionListView.php deleted file mode 100644 index d3777d362b..0000000000 --- a/src/view/layout/headsup/AphrontHeadsupActionListView.php +++ /dev/null @@ -1,28 +0,0 @@ -actions = $actions; - return $this; - } - - public function render() { - - require_celerity_resource('aphront-headsup-action-list-view-css'); - - $actions = array(); - foreach ($this->actions as $action_view) { - $actions[] = $action_view->render(); - } - $actions = implode("\n", $actions); - - return - '
    '. - $actions. - '
    '; - } - -} diff --git a/src/view/layout/headsup/AphrontHeadsupActionView.php b/src/view/layout/headsup/AphrontHeadsupActionView.php deleted file mode 100644 index eaffca17a2..0000000000 --- a/src/view/layout/headsup/AphrontHeadsupActionView.php +++ /dev/null @@ -1,73 +0,0 @@ -name = $name; - return $this; - } - - public function setClass($class) { - $this->class = $class; - return $this; - } - - public function setURI($uri) { - $this->uri = $uri; - return $this; - } - - public function setWorkflow($workflow) { - $this->workflow = $workflow; - return $this; - } - - public function setInstant($instant) { - $this->instant = $instant; - return $this; - } - - public function render() { - if ($this->instant) { - $button_class = $this->class.' link'; - return phabricator_render_form( - $this->user, - array( - 'action' => $this->uri, - 'method' => 'post', - 'style' => 'display: inline', - ), - '' - ); - } - - if ($this->uri) { - $tag = 'a'; - } else { - $tag = 'span'; - } - - $attrs = array( - 'href' => $this->uri, - 'class' => $this->class, - ); - - if ($this->workflow) { - $attrs['sigil'] = 'workflow'; - } - - return javelin_tag( - $tag, - $attrs, - $this->name); - } - -} diff --git a/src/view/layout/headsup/AphrontHeadsupView.php b/src/view/layout/headsup/AphrontHeadsupView.php deleted file mode 100644 index 9e3b8f0896..0000000000 --- a/src/view/layout/headsup/AphrontHeadsupView.php +++ /dev/null @@ -1,81 +0,0 @@ -actionList = $action_list; - return $this; - } - - public function setHeader($header) { - $this->header = $header; - return $this; - } - - public function setProperties(array $dict) { - $this->properties = $dict; - return $this; - } - - public function setObjectName($name) { - $this->objectName = $name; - return $this; - } - - public function render() { - $header = - '

    '. - phutil_tag( - 'a', - array( - 'href' => '/'.$this->objectName, - 'class' => 'aphront-headsup-object-name', - ), - $this->objectName). - ' '. - phutil_escape_html($this->header). - '

    '; - - require_celerity_resource('aphront-headsup-view-css'); - - $prop_table = null; - if ($this->properties) { - $prop_table = array(); - foreach ($this->properties as $key => $value) { - $prop_table[] = - ''. - ''.phutil_escape_html($key.':').''. - ''.$value.''. - ''; - } - $prop_table = - ''. - implode("\n", $prop_table). - '
    '; - } - - $children = $this->renderChildren(); - if (strlen($children)) { - $children = - '
    '. - $children. - '
    '; - } - - return - '
    '. - self::renderSingleView($this->actionList). - '
    '. - $header. - $prop_table. - $children. - '
    '. - '
    '; - } - -} diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php index e2db6f8d34..1821a0cda7 100644 --- a/src/view/page/PhabricatorStandardPageView.php +++ b/src/view/page/PhabricatorStandardPageView.php @@ -119,7 +119,7 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView { PhabricatorEnv::getCDNURI( '/rsrc/image/icon/fatcow/document_black.png' ); - $download_form = phabricator_render_form( + $download_form = phabricator_form( $user, array( 'action' => '#', diff --git a/webroot/rsrc/css/aphront/headsup-action-list-view.css b/webroot/rsrc/css/aphront/headsup-action-list-view.css deleted file mode 100644 index c69e102e97..0000000000 --- a/webroot/rsrc/css/aphront/headsup-action-list-view.css +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @provides aphront-headsup-action-list-view-css - */ - -.aphront-headsup-action-list { - float: right; - width: 250px; - background: #cfcfbf; - border: 1px solid #666622; - border-width: 0px 0px 1px 1px; - margin: -15px 0px 1em 0; - font-size: 11px; -} - -.aphront-headsup-action-list a, -.aphront-headsup-action-list span, -.aphront-headsup-action-list button { - background-position: 8px center; - background-repeat: no-repeat; - display: block; - padding: 4px 4px 4px 32px; - line-height: normal; -} - -.aphront-headsup-action-list span.unavailable { - color: #666666; - font-style: italic; -} - -.aphront-headsup-action-list .subscribe-rem { - background-image: url(/rsrc/image/icon/unsubscribe.png); -} - -.aphront-headsup-action-list .subscribe-add { - background-image: url(/rsrc/image/icon/subscribe.png); -} - -.aphront-headsup-action-list .action-edit, -.aphront-headsup-action-list .revision-edit { - background-image: url(/rsrc/image/icon/tango/edit.png); -} - -.aphront-headsup-action-list .action-attach, -.aphront-headsup-action-list .attach-maniphest { - background-image: url(/rsrc/image/icon/tango/attachment.png); -} - -.aphront-headsup-action-list .action-upload { - background-image: url(/rsrc/image/icon/tango/upload.png); -} - -.aphront-headsup-action-list .action-download { - background-image: url(/rsrc/image/icon/tango/go-down.png); -} - -.aphront-headsup-action-list .transcripts-metamta { - background-image: url(/rsrc/image/icon/tango/log.png); -} - -.aphront-headsup-action-list .transcripts-herald { - background-image: url(/rsrc/image/icon/tango/log.png); -} - -.aphront-headsup-action-list .action-merge { - background-image: url(/rsrc/image/icon/fatcow/arrow_merge.png); -} - -.aphront-headsup-action-list .action-branch { - background-image: url(/rsrc/image/icon/fatcow/arrow_branch.png); -} - -.aphront-headsup-action-list .action-dependencies { - background-image: url(/rsrc/image/icon/fatcow/link.png); -} diff --git a/webroot/rsrc/css/aphront/headsup.css b/webroot/rsrc/css/aphront/headsup.css deleted file mode 100644 index 4384cc3044..0000000000 --- a/webroot/rsrc/css/aphront/headsup.css +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @provides aphront-headsup-view-css - */ - -.aphront-headsup-panel { - border: 1px solid #666622; - background: #efefdf; - font-size: 13px; - margin: .5em 2em .25em; - padding: 15px 0 0; -} - -.aphront-headsup-panel h1 { - border-bottom: 1px solid #aaaa99; - - margin: 0 285px 8px 20px; - padding-bottom: 8px; -} - -.aphront-headsup-property-table { - font-size: 12px; - width: auto; - margin: 0 285px 15px 20px; -} - -.aphront-headsup-property-table th { - font-weight: bold; - width: 100px; - text-align: right; - padding: 3px; - color: #333333; - white-space: nowrap; -} - -.aphront-headsup-property-table td { - padding: 3px; -} - -.aphront-headsup-details { - clear: both; - border-top: 1px solid #666622; - background: #fbfbef; - margin-top: 1em; - padding: .75em 20px; -} - -.aphront-headsup-object-name { - margin-right: 0.25em; -} -- 2.51.2 From 95d37af5d90999bdaf2642570142ed916af8545a Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 31 Jan 2013 09:07:31 -0800 Subject: [PATCH 30/50] render_tag -> tag: fix some more callsites Summary: - Crumbs is straightforward. - Maniphest does a lot of string construction which isn't i18n or safehtml aware. I cheated under the theory that we'll resolve this properly in {T2217}. Test Plan: Looked at crumbs and Maniphest. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4748 --- .../view/ManiphestTransactionDetailView.php | 18 ++++++++++++++++-- src/view/layout/PhabricatorCrumbsView.php | 13 ++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/applications/maniphest/view/ManiphestTransactionDetailView.php b/src/applications/maniphest/view/ManiphestTransactionDetailView.php index 99d5aac688..4d5afbf8ad 100644 --- a/src/applications/maniphest/view/ManiphestTransactionDetailView.php +++ b/src/applications/maniphest/view/ManiphestTransactionDetailView.php @@ -164,12 +164,18 @@ final class ManiphestTransactionDetailView extends ManiphestView { if ($this->getRenderFullSummary()) { $full_summary = $this->renderFullSummary($transaction); } - $descs[] = javelin_render_tag( + $descs[] = javelin_tag( 'div', array( 'sigil' => 'maniphest-transaction-description', ), - $author->renderLink().' '.$desc.'.'.$full_summary); + array( + $author->renderLink(), + ' ', + $desc, + '.', + $full_summary, + )); } if ($this->getRenderSummaryOnly()) { @@ -551,6 +557,11 @@ final class ManiphestTransactionDetailView extends ManiphestView { return array($type, ' brazenly '.$type."'d", $classes); } + // TODO: [HTML] This code will all be rewritten when we switch to using + // ApplicationTransactions. It does not handle HTML or translations + // correctly right now. + $desc = phutil_safe_html($desc); + return array($verb, $desc, $classes); } @@ -579,6 +590,9 @@ 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; } diff --git a/src/view/layout/PhabricatorCrumbsView.php b/src/view/layout/PhabricatorCrumbsView.php index 0ac55bb46f..f621394f1e 100644 --- a/src/view/layout/PhabricatorCrumbsView.php +++ b/src/view/layout/PhabricatorCrumbsView.php @@ -50,26 +50,29 @@ final class PhabricatorCrumbsView extends AphrontView { )); } - $action_view = phutil_render_tag( + $action_view = phutil_tag( 'div', array( 'class' => 'phabricator-crumbs-actions', ), - self::renderSingleView($actions)); + $this->renderHTMLView($actions)); } if ($this->crumbs) { last($this->crumbs)->setIsLastCrumb(true); } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-crumbs-view '. 'sprite-gradient gradient-breadcrumbs', ), - $action_view. - self::renderSingleView($this->crumbs)); + $this->renderHTMLView( + array( + $action_view, + $this->crumbs, + ))); } } -- 2.51.2 From 7f43826854d2be401c95d5df36a004c414c1f8fe Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 31 Jan 2013 09:08:02 -0800 Subject: [PATCH 31/50] render_tag -> tag: fix more callsites (more view, misc) Summary: Fixes even more callsites. Test Plan: See inlines. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4749 --- .../DifferentialChangesetViewController.php | 8 +++-- .../DifferentialDiffTableOfContentsView.php | 2 +- .../view/DifferentialLocalCommitsView.php | 6 ++-- .../DifferentialRevisionCommentListView.php | 31 ++++++++++++------- .../DiffusionBrowseFileController.php | 25 ++++++++++++--- .../controller/DiffusionCommitController.php | 22 ++++++++++--- .../ponder/view/PonderAddCommentView.php | 4 +-- src/view/layout/AphrontMoreView.php | 20 ++++++------ 8 files changed, 78 insertions(+), 40 deletions(-) diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php index 3d7454c229..e1c35f9808 100644 --- a/src/applications/differential/controller/DifferentialChangesetViewController.php +++ b/src/applications/differential/controller/DifferentialChangesetViewController.php @@ -244,12 +244,14 @@ final class DifferentialChangesetViewController extends DifferentialController { $detail->setVsChangesetID($left_source); $panel = new DifferentialPrimaryPaneView(); - $panel->appendChild(phutil_render_tag('div', + $panel->appendChild( + phutil_tag( + 'div', array( 'class' => 'differential-review-stage', 'id' => 'differential-review-stage', - ), $detail->render()) - ); + ), + $detail->render())); return $this->buildStandardPageResponse( array( diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php index 75de304237..cd30fa0c90 100644 --- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php +++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php @@ -148,7 +148,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView { $rows[] = ''. - phutil_render_tag( + phutil_tag( 'td', array( 'class' => 'differential-toc-char', diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php index f3f6eab6de..6a3cae9439 100644 --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -88,13 +88,13 @@ final class DifferentialLocalCommitsView extends AphrontView { $summary = phutil_utf8_shorten($summary, 80); $view = new AphrontMoreView(); - $view->setSome(phutil_escape_html($summary)); + $view->setSome($summary); if ($message && (trim($summary) != trim($message))) { - $view->setMore(nl2br(phutil_escape_html($message))); + $view->setMore(phutil_escape_html_newlines($message)); } - $row[] = phutil_render_tag( + $row[] = phutil_tag( 'td', array( 'class' => 'summary', diff --git a/src/applications/differential/view/DifferentialRevisionCommentListView.php b/src/applications/differential/view/DifferentialRevisionCommentListView.php index 8edeaeea81..ebccc8c78a 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentListView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentListView.php @@ -159,22 +159,29 @@ final class DifferentialRevisionCommentListView extends AphrontView { array( 'markup' => implode("\n", $hidden), )); - $hidden = javelin_render_tag( + $hidden = javelin_tag( 'div', array( 'sigil' => "differential-all-comments-container", ), - '
    '. - pht('%d older comments are hidden. ', number_format(count($hidden))). - javelin_tag( - 'a', - array( - 'href' => '#', - 'mustcapture' => true, - 'sigil' => 'differential-show-all-comments', - ), - pht('Show all comments.')). - '
    '); + phutil_tag( + 'div', + array( + 'class' => 'differential-older-comments-are-hidden', + ), + array( + pht( + '%d older comments are hidden. ', + number_format(count($hidden))), + javelin_tag( + 'a', + array( + 'href' => '#', + 'mustcapture' => true, + 'sigil' => 'differential-show-all-comments', + ), + pht('Show all comments.')), + ))); } else { $hidden = null; } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 534ddd7e8c..b690c484ea 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -271,6 +271,10 @@ final class DiffusionBrowseFileController extends DiffusionController { 'sigil' => 'diffusion-source', ), implode("\n", $rows)); + + // TODO: [HTML] Major cheating here. + $corpus_table = phutil_safe_html($corpus_table); + $corpus = phutil_tag( 'div', array( @@ -723,18 +727,29 @@ final class DiffusionBrowseFileController extends DiffusionController { array( 'target' => 'scroll_target', )); - $anchor_text = ''; + $anchor_text = phutil_tag( + 'a', + array( + 'id' => 'scroll_target', + ), + ''); } else { $anchor_text = null; } - $blame[] = phutil_render_tag( + $blame[] = phutil_tag( 'td', array( ), - $anchor_text. - "\xE2\x80\x8B". // NOTE: See phabricator-oncopy behavior. - $line['data']); + array( + $anchor_text, + + // NOTE: See phabricator-oncopy behavior. + "\xE2\x80\x8B", + + // TODO: [HTML] Not ideal. + phutil_safe_html($line['data']), + )); $rows[] = phutil_tag( 'tr', diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 7181c0b5da..52392e1746 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -442,13 +442,25 @@ final class DiffusionCommitController extends DiffusionController { foreach ($parents as $parent) { $parent_links[] = $handles[$parent->getPHID()]->renderLink(); } - $props['Parents'] = implode(' · ', $parent_links); + $props['Parents'] = array_interleave( + " \xC2\xB7 ", + $parent_links); } $request = $this->getDiffusionRequest(); - $props['Branches'] = 'Unknown'; - $props['Tags'] = 'Unknown'; + $props['Branches'] = phutil_tag( + 'span', + array( + 'id' => 'commit-branches', + ), + 'Unknown'); + $props['Tags'] = phutil_tag( + 'span', + array( + 'id' => 'commit-tags', + ), + 'Unknown'); $callsign = $request->getRepository()->getCallsign(); $root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier(); @@ -906,8 +918,8 @@ final class DiffusionCommitController extends DiffusionController { ), $ref); } - $ref_links = implode(', ', $ref_links); - return $ref_links; + + return array_interleave(', ', $ref_links); } private function buildRawDiffResponse(DiffusionRequest $drequest) { diff --git a/src/applications/ponder/view/PonderAddCommentView.php b/src/applications/ponder/view/PonderAddCommentView.php index 16a324e7f4..f23f624df7 100644 --- a/src/applications/ponder/view/PonderAddCommentView.php +++ b/src/applications/ponder/view/PonderAddCommentView.php @@ -44,8 +44,8 @@ final class PonderAddCommentView extends AphrontView { ->setValue($is_serious ? 'Submit' : 'Editorialize')); $view = id(new AphrontMoreView()) - ->setSome(id(new AphrontNullView())->render()) - ->setMore($form->render()) + ->setSome('') + ->setMore(phutil_safe_html($form->render())) ->setExpandText('Add Comment'); return $view->render(); diff --git a/src/view/layout/AphrontMoreView.php b/src/view/layout/AphrontMoreView.php index 3eb89714a5..0bd1b82d80 100644 --- a/src/view/layout/AphrontMoreView.php +++ b/src/view/layout/AphrontMoreView.php @@ -22,17 +22,19 @@ final class AphrontMoreView extends AphrontView { } public function render() { - $some = $this->some; - $text = "(Show More\xE2\x80\xA6)"; - if ($this->expandtext !== null) { - $text = $this->expandtext; - } + $content = array(); + $content[] = $this->some; - $link = null; if ($this->more && $this->more != $this->some) { + $text = "(Show More\xE2\x80\xA6)"; + if ($this->expandtext !== null) { + $text = $this->expandtext; + } + Javelin::initBehavior('aphront-more'); - $link = ' '.javelin_tag( + $content[] = ' '; + $content[] = javelin_tag( 'a', array( 'sigil' => 'aphront-more-view-show-more', @@ -45,11 +47,11 @@ final class AphrontMoreView extends AphrontView { $text); } - return javelin_render_tag( + return javelin_tag( 'div', array( 'sigil' => 'aphront-more-view', ), - $some.$link); + $content); } } -- 2.51.2 From b7e10831a635bc4f43b430d722270074135b627f Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 31 Jan 2013 16:07:17 -0800 Subject: [PATCH 32/50] Use PhutilNumber instead of number_format() Summary: Also convert to `phutil_tag()`. Test Plan: Displayed revision with hidden comments. Reviewers: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4772 --- .../view/DifferentialRevisionCommentListView.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/applications/differential/view/DifferentialRevisionCommentListView.php b/src/applications/differential/view/DifferentialRevisionCommentListView.php index ebccc8c78a..211f08d42a 100644 --- a/src/applications/differential/view/DifferentialRevisionCommentListView.php +++ b/src/applications/differential/view/DifferentialRevisionCommentListView.php @@ -171,8 +171,9 @@ final class DifferentialRevisionCommentListView extends AphrontView { ), array( pht( - '%d older comments are hidden. ', - number_format(count($hidden))), + '%s older comments are hidden.', + new PhutilNumber(count($hidden))), + ' ', javelin_tag( 'a', array( -- 2.51.2 From de0261358f6148cb1b43ea55628048779e3771ce Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 1 Feb 2013 08:46:22 -0800 Subject: [PATCH 33/50] Document all the SafeHTML stuff Summary: Write documentation about how to use phutil_tag(), etc., safely. Test Plan: Read carefully. {F31223} Reviewers: vrana, btrahan, chad Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4769 --- src/docs/developer/rendering_html.diviner | 178 ++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 src/docs/developer/rendering_html.diviner diff --git a/src/docs/developer/rendering_html.diviner b/src/docs/developer/rendering_html.diviner new file mode 100644 index 0000000000..185c43caf9 --- /dev/null +++ b/src/docs/developer/rendering_html.diviner @@ -0,0 +1,178 @@ +@title Rendering HTML +@group developer + +Rendering HTML in the Phabricator environment. + += Overview = + +Phabricator attempts to prevent XSS by treating strings as default-unsafe when +rendering. This means that if you try to build HTML through string +concatenation, it won't work: the string will be escaped by the rendering +pipeline, and the browser will treat it as plain text, not HTML. + +This document describes the right way to build HTML components so they are safe +from XSS and render correctly. Broadly: + + - Use @{function@libphutil:phutil_tag} (and @{function:javelin_tag}) to build + tags. + - Use @{function@libphutil:hsprintf} where @{function@libphutil:phutil_tag} + is awkward. + - Combine elements with arrays, not string concatenation. + - @{class:AphrontView} subclasses should return a + @{class@libphutil:PhutilSafeHTML} object from their `render()` method. + - @{function:pht} has some special rules. + - There are some other things that you should be aware of. + - Do not use @{function:phutil_render_tag} or @{function:javelin_render_tag}, + they are deprecated and unsafe. + +See below for discussion. + += Building Tags: phutil_tag() = + +Build HTML tags with @{function@libphutil:phutil_tag}. For example: + + phutil_tag( + 'div', + array( + 'class' => 'some-class', + ), + $content); + +@{function@libphutil:phutil_tag} will properly escape the content and all the +attributes, and return a @{class@libphutil:PhutilSafeHTML} object. The rendering +pipeline knows that this object represents a properly escaped HTML tag. This +allows @{function@libphutil:phutil_tag} to render tags with other tags as +content correctly (without double-escaping): + + phutil_tag( + 'div', + array(), + phutil_tag( + 'strong', + array(), + $content)); + +In Phabricator, the @{function:javelin_tag} function is similar to +@{function@libphutil:phutil_tag}, but provides special handling for the +`sigil` and `meta` attributes. + += Building Blocks: hsprintf() = + +Sometimes, @{function@libphutil:phutil_tag} can be particularly awkward to +use. You can use @{function@libphutil:hsprintf} to build larger and more +complex blocks of HTML, when @{function@libphutil:phutil_tag} is a poor fit. +@{function:hsprintf} has `sprintf()` semantics, but `%s` escapes HTML: + + // Safely build fragments or unwieldy blocks. + hsprintf( + '
    ', + $div_id); + +@{function:hsprintf} can be especially useful when: + + - You need to build a block with a lot of tags, like a table with rows and + cells. + - You need to build part of a tag (usually you should avoid this, but if you + do need to, @{function@libphutil:phutil_tag} can not do it). + +Note that it is unsafe to provide any user-controlled data to the first +parameter of @{function@libphutil:hsprintf} (the `sprintf()`-style pattern). + +Like @{function@libphutil:phutil_tag}, this function returns a +@{class@libphutil:PhutilSafeHTML} object. + += Composing Tags = + +When you are building a view which combines smaller components, like a section +with a header and a body: + + $header = phutil_tag('h1', ...); + $body = phutil_tag('p', ...); + +...you should NOT use string concatenation: + + COUNTEREXAMPLE + // Not dangerous, but does the wrong thing. + phutil_tag('div', array(), $header.$body); + +Instead, use an array: + + // Render a tag containing other tags safely. + phutil_tag('div', array(), array($header, $body)); + +If you concatenate @{class@libphutil:PhutilSafeHTML} objects, they revert to +normal strings and are no longer marked as properly escaped tags. + +(In the future, these objects may stop converting to strings, but for now they +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}: + + // Render links with commas between them. + phutil_tag( + 'div', + array(), + array_interleave(', ', $list_of_links)); + += AphrontView Classes = + +Subclasses of @{class:AphrontView} in Phabricator should return a +@{class@libphutil:PhutilSafeHTML} object. The easiest way to do this is to +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 +@{function:pht} is a @{class@libphutil:PhutilSafeHTML} object, @{function:pht} +returns a @{class@libphutil:PhutilSafeHTML} object itself. Otherwise, it returns +normal text. + +This is generally safe because translations are not permitted to have more tags +than the original text did (so if the original text had no tags, translations +can not add any). + +Normally, this just means that @{function:pht} does the right thing and behaves +like you would expect, but it is worth being aware of. + += Special Cases = + +NOTE: This section describes dangerous methods which can bypass XSS protections. +If possible, do not use them. + +You can build @{class@libphutil:PhutilSafeHTML} out of a string explicitly by +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 `
    `. + +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. + += Deprecated Functions = + +The functions @{function@libphutil:phutil_render_tag} and +@{function:javelin_render_tag} are unsafe versions of +@{function@libphutil:phutil_tag} and @{function:javelin_tag}, are deprecated, +and will be removed in the future. You should avoid their use and convert code +to use @{function@libphutil:phutil_tag} and @{function:javelin_tag}. + +The function @{function:phabricator_render_form} is also deprecated, in favor of +@{function:phabricator_form}. -- 2.51.2 From 6e959011611a08ca5968b272cd2a5d365d1a3835 Mon Sep 17 00:00:00 2001 From: vrana Date: Sat, 2 Feb 2013 05:15:30 -0800 Subject: [PATCH 34/50] Convert phutil_render_tag() to phutil_tag() for inline comments Test Plan: Looked at file with lint errors in Diffusion. I've also tried inline comments in Differential but it failed. I'll try it again after you land all your diffs. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4755 --- .../DifferentialChangesetTwoUpRenderer.php | 17 ++++---- .../view/DifferentialInlineCommentView.php | 41 ++++++++++--------- .../DiffusionBrowseFileController.php | 15 +++---- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php index 7a9bb3a1af..91cfbebabd 100644 --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -324,26 +324,29 @@ final class DifferentialChangesetTwoUpRenderer } } } - $html[] = + $html[] = hsprintf( ''. ''. - ''.$comment_html.''. + '%s'. ''. - ''.$new.''. - ''; + '%s'. + '', + $comment_html, + $new); } } if ($n_num && isset($new_comments[$n_num])) { foreach ($new_comments[$n_num] as $comment) { $comment_html = $this->renderInlineComment($comment, $on_right = true); - $html[] = + $html[] = hsprintf( ''. ''. ''. ''. - ''.$comment_html.''. - ''; + '%s'. + '', + $comment_html); } } } diff --git a/src/applications/differential/view/DifferentialInlineCommentView.php b/src/applications/differential/view/DifferentialInlineCommentView.php index 0340d3287a..0fa497fa59 100644 --- a/src/applications/differential/view/DifferentialInlineCommentView.php +++ b/src/applications/differential/view/DifferentialInlineCommentView.php @@ -175,10 +175,10 @@ final class DifferentialInlineCommentView extends AphrontView { } if ($links) { - $links = - ''. - implode(' · ', $links). - ''; + $links = phutil_tag( + 'span', + array('class' => 'differential-inline-comment-links'), + array_interleave(" \xC2\xB7 ", $links)); } else { $links = null; } @@ -217,24 +217,25 @@ final class DifferentialInlineCommentView extends AphrontView { $author = $handles[$inline->getAuthorPHID()]->getName(); } - $markup = javelin_render_tag( + $markup = javelin_tag( 'div', array( 'class' => $classes, 'sigil' => $sigil, 'meta' => $metadata, ), - '
    '. - $anchor. - $links. - ' '.$line.' '. - phutil_escape_html($author). - '
    '. - '
    '. - '
    '. - $content. + hsprintf( + '
    '. + '%s%s %s %s'. '
    '. - '
    '); + '
    '. + '
    %s
    '. + '
    ', + $anchor, + $links, + $line, + $author, + $content)); return $this->scaffoldMarkup($markup); } @@ -247,15 +248,17 @@ final class DifferentialInlineCommentView extends AphrontView { $left_markup = !$this->onRight ? $markup : ''; $right_markup = $this->onRight ? $markup : ''; - return + return hsprintf( ''. ''. ''. - ''. + ''. ''. - ''. + ''. ''. - '
    '.$left_markup.'%s'.$right_markup.'%s
    '; + '', + $left_markup, + $right_markup); } } diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index b690c484ea..f89e6ef7c6 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -264,16 +264,13 @@ final class DiffusionBrowseFileController extends DiffusionController { )); } - $corpus_table = javelin_render_tag( + $corpus_table = javelin_tag( 'table', array( 'class' => "diffusion-source remarkup-code PhabricatorMonospaced", 'sigil' => 'diffusion-source', ), - implode("\n", $rows)); - - // TODO: [HTML] Major cheating here. - $corpus_table = phutil_safe_html($corpus_table); + $rows); $corpus = phutil_tag( 'div', @@ -774,11 +771,9 @@ final class DiffusionBrowseFileController extends DiffusionController { ->setMarkupEngine($engine) ->setInlineComment($inline) ->render(); - $rows[] = - ''. - str_repeat('', ($needs_blame ? 5 : 1)). - ''.$inline_view.''. - ''; + $row = array_fill(0, ($needs_blame ? 5 : 1), phutil_tag('th')); + $row[] = phutil_tag('td', array(), $inline_view); + $rows[] = phutil_tag('tr', array('class' => 'inline'), $row); } return $rows; } -- 2.51.2 From 41e0f97c197a51db427b1cd77208f4700ab902a8 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 2 Feb 2013 06:04:54 -0800 Subject: [PATCH 35/50] render_tag -> tag: forms / remarkup Summary: See inlines. Test Plan: See inlines. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4767 --- .../form/control/AphrontFormDateControl.php | 17 ++++++++--------- .../form/control/AphrontFormSelectControl.php | 4 ++-- .../form/control/PhabricatorRemarkupControl.php | 9 ++++++--- src/view/layout/PhabricatorPropertyListView.php | 4 ++-- .../AphrontKeyboardShortcutsAvailableView.php | 12 ++++++++---- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php index 27166c8440..61c470bccf 100644 --- a/src/view/form/control/AphrontFormDateControl.php +++ b/src/view/form/control/AphrontFormDateControl.php @@ -247,20 +247,19 @@ final class AphrontFormDateControl extends AphrontFormControl { Javelin::initBehavior('fancy-datepicker', array()); - return javelin_render_tag( + return javelin_tag( 'div', array( 'class' => 'aphront-form-date-container', 'sigil' => 'phabricator-date-control', ), - self::renderSingleView( - array( - $days_sel, - $months_sel, - $years_sel, - $cal_icon, - $time_sel, - ))); + array( + $days_sel, + $months_sel, + $years_sel, + $cal_icon, + $time_sel, + )); } } diff --git a/src/view/form/control/AphrontFormSelectControl.php b/src/view/form/control/AphrontFormSelectControl.php index 9896eedef5..06c0c43e02 100644 --- a/src/view/form/control/AphrontFormSelectControl.php +++ b/src/view/form/control/AphrontFormSelectControl.php @@ -35,10 +35,10 @@ final class AphrontFormSelectControl extends AphrontFormControl { $option_tags = self::renderOptions($selected, $options); - return javelin_render_tag( + return javelin_tag( 'select', $attrs, - implode("\n", $option_tags)); + $option_tags); } private static function renderOptions($selected, array $options) { diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index be41fdf655..e1faf1dfb3 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -142,13 +142,16 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { $this->setCustomClass( 'remarkup-assist-textarea '.$monospaced_textareas_class); - return javelin_render_tag( + return javelin_tag( 'div', array( 'sigil' => 'remarkup-assist-control', ), - $buttons. - parent::renderInput()); + $this->renderHTMLView( + array( + $buttons, + parent::renderInput(), + ))); } } diff --git a/src/view/layout/PhabricatorPropertyListView.php b/src/view/layout/PhabricatorPropertyListView.php index 85c1c2774b..3cedcdbbf9 100644 --- a/src/view/layout/PhabricatorPropertyListView.php +++ b/src/view/layout/PhabricatorPropertyListView.php @@ -73,12 +73,12 @@ final class PhabricatorPropertyListView extends AphrontView { } } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-property-list-view', ), - $this->renderSingleView($items)); + $this->renderHTMLView($items)); } private function renderPropertyPart(array $part) { diff --git a/src/view/widget/AphrontKeyboardShortcutsAvailableView.php b/src/view/widget/AphrontKeyboardShortcutsAvailableView.php index bfb8850605..a371445664 100644 --- a/src/view/widget/AphrontKeyboardShortcutsAvailableView.php +++ b/src/view/widget/AphrontKeyboardShortcutsAvailableView.php @@ -3,10 +3,14 @@ final class AphrontKeyboardShortcutsAvailableView extends AphrontView { public function render() { - return - '
    '. - 'Press ? to show keyboard shortcuts.'. - '
    '; + return phutil_tag( + 'div', + array( + 'class' => 'keyboard-shortcuts-available', + ), + pht( + 'Press %s to show keyboard shortcuts.', + phutil_tag('strong', array(), '?'))); } } -- 2.51.2 From 87dc464159f64bc08adb63e7bdde0f98e49c3390 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 2 Feb 2013 06:12:36 -0800 Subject: [PATCH 36/50] render_tag -> tag: misc views Summary: See inlines. Test Plan: See inlines. Reviewers: vrana Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4768 --- .../view/ConpherenceMenuItemView.php | 10 ++++++- .../PhabricatorDirectoryController.php | 13 ++++----- src/view/AphrontTagView.php | 4 +-- .../control/PhabricatorObjectListView.php | 27 ++++++++++++------- src/view/layout/AphrontSideNavFilterView.php | 17 +++++++----- src/view/layout/PhabricatorMenuItemView.php | 6 ++++- .../menu/PhabricatorMainMenuGroupView.php | 4 +-- 7 files changed, 52 insertions(+), 29 deletions(-) diff --git a/src/applications/conpherence/view/ConpherenceMenuItemView.php b/src/applications/conpherence/view/ConpherenceMenuItemView.php index 44ec161179..c69d7c502d 100644 --- a/src/applications/conpherence/view/ConpherenceMenuItemView.php +++ b/src/applications/conpherence/view/ConpherenceMenuItemView.php @@ -139,6 +139,14 @@ final class ConpherenceMenuItemView extends AphrontTagView { (int)$this->unreadCount); } - return $image.$title.$subtitle.$message.$epoch.$unread_count; + return $this->renderHTMLView( + array( + $image, + $title, + $subtitle, + $message, + $epoch, + $unread_count, + )); } } diff --git a/src/applications/directory/controller/PhabricatorDirectoryController.php b/src/applications/directory/controller/PhabricatorDirectoryController.php index 70391fa2d7..a1ce71b876 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryController.php @@ -96,9 +96,9 @@ abstract class PhabricatorDirectoryController extends PhabricatorController { $nav->addMenuItem($show_item); $nav->addCustomBlock( - '
    '); + hsprintf( + ''); + $nav->addCustomBlock(hsprintf('
    ')); } } diff --git a/src/view/AphrontTagView.php b/src/view/AphrontTagView.php index 0b3f17a099..8e9595f0b6 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->renderChildren(); + return $this->renderHTMLChildren(); } protected function willRender() { @@ -150,7 +150,7 @@ abstract class AphrontTagView extends AphrontView { } } - return javelin_render_tag( + return javelin_tag( $this->getTagName(), $attributes, $this->getTagContent()); diff --git a/src/view/control/PhabricatorObjectListView.php b/src/view/control/PhabricatorObjectListView.php index b5c8d163ed..ec352334b8 100644 --- a/src/view/control/PhabricatorObjectListView.php +++ b/src/view/control/PhabricatorObjectListView.php @@ -26,27 +26,34 @@ final class PhabricatorObjectListView extends AphrontView { foreach ($handles as $handle) { $buttons = idx($this->buttons, $handle->getPHID(), array()); if ($buttons) { - $buttons = - '
    '. - implode('', $buttons). - '
    '; + $buttons = phutil_tag( + 'div', + array( + 'class' => 'phabricator-object-list-view-buttons', + ), + $buttons); } else { $buttons = null; } - $out[] = javelin_render_tag( + $out[] = javelin_tag( 'div', array( 'class' => 'phabricator-object-list-view-item', 'style' => 'background-image: url('.$handle->getImageURI().');', ), - $handle->renderLink().$buttons); + array( + $handle->renderLink(), + $buttons, + )); } - return - '
    '. - implode("\n", $out). - '
    '; + return phutil_tag( + 'div', + array( + 'class' => 'phabricator-object-list-view', + ), + $out); } } diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php index ad7cd815a8..933d23b50d 100644 --- a/src/view/layout/AphrontSideNavFilterView.php +++ b/src/view/layout/AphrontSideNavFilterView.php @@ -220,14 +220,17 @@ final class AphrontSideNavFilterView extends AphrontView { ), ''); - $local_menu = $menu_background.phutil_render_tag( - 'div', + $local_menu = $this->renderHTMLView( array( - 'class' => 'phabricator-nav-local phabricator-side-menu', - 'id' => $local_id, - ), - self::renderSingleView($this->menu->setID($this->getMenuID())) - ); + $menu_background, + phutil_tag( + 'div', + array( + 'class' => 'phabricator-nav-local phabricator-side-menu', + 'id' => $local_id, + ), + self::renderSingleView($this->menu->setID($this->getMenuID()))), + )); } $crumbs = null; diff --git a/src/view/layout/PhabricatorMenuItemView.php b/src/view/layout/PhabricatorMenuItemView.php index ab5e21c410..913674abfd 100644 --- a/src/view/layout/PhabricatorMenuItemView.php +++ b/src/view/layout/PhabricatorMenuItemView.php @@ -126,7 +126,11 @@ final class PhabricatorMenuItemView extends AphrontTagView { $this->name.$external); } - return $this->renderChildren().$name; + return $this->renderHTMLView( + array( + $this->renderHTMLChildren(), + $name, + )); } } diff --git a/src/view/page/menu/PhabricatorMainMenuGroupView.php b/src/view/page/menu/PhabricatorMainMenuGroupView.php index 98f3048b80..31473aed4d 100644 --- a/src/view/page/menu/PhabricatorMainMenuGroupView.php +++ b/src/view/page/menu/PhabricatorMainMenuGroupView.php @@ -28,12 +28,12 @@ final class PhabricatorMainMenuGroupView extends AphrontView { $classes = array_merge($classes, $this->classes); } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => implode(' ', $classes), ), - $this->renderChildren()); + $this->renderHTMLChildren()); } } -- 2.51.2 From 8e7af64dd6239ffe4ab71d9ce6670a917dfa49d0 Mon Sep 17 00:00:00 2001 From: vrana Date: Sat, 2 Feb 2013 13:54:20 -0800 Subject: [PATCH 37/50] Fix dynamic string usage as safe input in phutil_tag Test Plan: $ arc lint Reviewers: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4797 --- .../specification/DifferentialLintFieldSpecification.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index b773e38580..36080efee4 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -110,9 +110,10 @@ final class DifferentialLintFieldSpecification 'style' => $this->getSeverityStyle($severity), 'name' => ucwords($severity), 'value' => hsprintf( - "(%s) %s at {$line_link}", + '(%s) %s at %s', $code, - $name), + $name, + $line_link), 'show' => $show, ); -- 2.51.2 From ebc2937dc89f4d62563681e5d9c408a4be08cdf9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 4 Feb 2013 11:38:04 -0800 Subject: [PATCH 38/50] render_tag -> tag: final block Summary: Convert a final few `render_tag()` calls to `tag()` calls. This leaves us with 36 calls: - 9 are in Conpherence, and will be converted after merging. Using Views makes the most sense here, to get access to renderHTMLView() and such. - 2 are the definition and its library map entry. - 3 are in the documentation. - I believe the remaining 22 are too difficult to convert pre-merge. About half are in code which is slated for destruction; the other half are in the base implementations of very common classes (like PhabricatorStandardPageView) and can only be converted by converting the entire codebase. My plan at this point is: - Test the branch thoroughly. - Merge to master. - Over time, resolve the remaining issues: lint means things shouldn't get any worse. Test Plan: See inlines. Reviewers: vrana Reviewed By: vrana CC: aran, edward Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4802 --- .../ponder/view/PonderPostBodyView.php | 30 ++++++++----------- .../PhabricatorRepositoryListController.php | 2 +- src/view/layout/AphrontPanelView.php | 2 +- src/view/layout/PhabricatorMenuView.php | 2 +- src/view/layout/PhabricatorTimelineView.php | 4 +-- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/applications/ponder/view/PonderPostBodyView.php b/src/applications/ponder/view/PonderPostBodyView.php index 77e72ee33b..4bfb4362ea 100644 --- a/src/applications/ponder/view/PonderPostBodyView.php +++ b/src/applications/ponder/view/PonderPostBodyView.php @@ -56,10 +56,12 @@ final class PonderPostBodyView extends AphrontView { $target->getMarkupField(), $this->user); - $content = - '
    '. - $content. - '
    '; + $content = phutil_tag( + 'div', + array( + 'class' => 'phabricator-remarkup', + ), + $content); $author = $this->handles[$target->getAuthorPHID()]; $actions = array($author->renderLink().' '.$this->action); @@ -88,10 +90,12 @@ final class PonderPostBodyView extends AphrontView { } $xaction_view->appendChild( - '
    '. - $content. - '
    ' - ); + phutil_tag( + 'div', + array( + 'class' => 'ponder-post-core', + ), + $content)); $outerview = $xaction_view; if (!$this->preview) { @@ -113,14 +117,4 @@ final class PonderPostBodyView extends AphrontView { return $outerview->render(); } - private function renderHandleList(array $phids) { - $result = array(); - foreach ($phids as $phid) { - $result[] = $this->handles[$phid]->renderLink(); - } - return implode(', ', $result); - } - - - } diff --git a/src/applications/repository/controller/PhabricatorRepositoryListController.php b/src/applications/repository/controller/PhabricatorRepositoryListController.php index 8c4baea1d0..3b32685467 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryListController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryListController.php @@ -113,7 +113,7 @@ final class PhabricatorRepositoryListController 'class' => 'button grey small', ), 'Edit'), - javelin_render_tag( + javelin_tag( 'a', array( 'href' => '/repository/project/delete/'.$project->getID().'/', diff --git a/src/view/layout/AphrontPanelView.php b/src/view/layout/AphrontPanelView.php index 2c186d6e24..2d2e313977 100644 --- a/src/view/layout/AphrontPanelView.php +++ b/src/view/layout/AphrontPanelView.php @@ -15,7 +15,7 @@ final class AphrontPanelView extends AphrontView { public function setCreateButton($create_button, $href) { $this->addButton( - phutil_render_tag( + phutil_tag( 'a', array( 'href' => $href, diff --git a/src/view/layout/PhabricatorMenuView.php b/src/view/layout/PhabricatorMenuView.php index bf1d601eb2..c863f9dfa1 100644 --- a/src/view/layout/PhabricatorMenuView.php +++ b/src/view/layout/PhabricatorMenuView.php @@ -159,6 +159,6 @@ final class PhabricatorMenuView extends AphrontTagView { } protected function getTagContent() { - return $this->renderSingleView($this->items); + return $this->renderHTMLView($this->items); } } diff --git a/src/view/layout/PhabricatorTimelineView.php b/src/view/layout/PhabricatorTimelineView.php index e5d7dae568..3977a320b2 100644 --- a/src/view/layout/PhabricatorTimelineView.php +++ b/src/view/layout/PhabricatorTimelineView.php @@ -27,13 +27,13 @@ final class PhabricatorTimelineView extends AphrontView { } $events[] = $spacer; - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => 'phabricator-timeline-view', 'id' => $this->id, ), - implode('', $events)); + $events); } public static function renderSpacer() { -- 2.51.2 From 94f6b6ca4e693efea8a924df63fd62cd85e9d0bb Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 4 Feb 2013 17:06:34 -0800 Subject: [PATCH 39/50] Fix every HTML issue I could find Summary: I attempted to test every interface. I probably missed some stuff, but I at least have some level of confidence that the `phutil_tag` branch is fairly stable. Fixed these issues: [1] Fixed a Herald issue with object links in transcripts. Some actions return links; this was previously hard-coded. [2] DarkConsole refactoring created an issue where the "`" event handler registered too many times. [3] Fixed a bug where `strlen($value)` was being checked, but fields may now return array(). Possibly we should implement phutil_is_empty_html() or similar. [4] Fixed a undefined variable issue for image edit transactions. [5] Fixed an issue with rendering participant transactions. This required phutil_safe_html() because `pht()` can't handle `array()` for `%s`. [6] Fixed an issue where feed was entirely overescaped by reverting an overly ambitious render_tag -> tag. [7] Fixed an issue with strict tables and inserting `''` instead of `0` into an integer column. [8] Fixed an issue where • was shown escaped. [9] Fixed an issue where "no data" was overescaped. [10] Fixed an issue with strict tables and inserting `''` instead of `0` into an integer column. [11] Fixed an issue with strict tables and inserting `''`. [12] Fixed an issue with missing space after ":" for mini panels. Encountered (but did not fix) these issues: [X1] "e" works incorrectly on comments you are not allowed to edit. Did not fix. [X2] Coverage currently interacts incorrectly with "--everything" for Phutil tests. Test Plan: - Viewed Differential. - Created a diff via copy/paste. - Viewed standalone diff. - Jumped to diff via changeset table. - Created a revision. - Updated revision. - Added a comment. - Edited revision dependencies. - Edited revision tasks. - Viewed MetaMTA transcripts. - Viewed Herald transcripts [1]. - Downloaded raw diff. - Flagged / unflagged revision. - Added/edited/deleted inline comment. - Collapsed/expanded file. - Did show raw left. - Did show raw right. - Checked previews for available actions. - Clicked remarkup buttons - Used filetree view. - Used keyboard: F, j, k, J, K, n, p, t, h, "?" [2] [X1]. - Created a meme. - Uploaded a file via drag and drop. - Viewed a revision with no reviewers. - Viewed a revision with >100 files. - Viewed various other revisions [3]. - Viewed an image diff. - Added image diff inline comments. - Viewed Maniphest. - Ran various queries. - Created task. - Created similar task. - Added comments to tasks. - Ran custom query. - Saved custom query. - Edited custom queries. - Drag-reordered tasks. - Batch edited tasks. - Exported tasks to excel. - Looked at reports (issue in T2311 notwithstanding). - Viewed Diffusion. - Browsed Git, SVN, HG repositories. - Looked at history, browse, change, commit views. - Viewed audit. - Performed various audit searches. - Viewed Paste. - Performed paste searches. - Created, edited, forked paste. - Viewed Phriction. - Edited a page. - Viewed edit history. - Used search typeahead to search for user / application. - Used search to search for text. - Viewed Phame. - Viewed Blog, Post. - Viewed live post. - Published/unpublished post. - Previewed post. - Viewed Pholio. - Edited/commented mock. - Viewed ponder. - Viewed question. - Added answer/comment. - Viewed Diviner. - Viewed Conpherence [4] [5]. - Made Conpherence updates. - Viewed calendar. - Created status. - Viewed status. - Viewed Feed [6]. - Viewed Projects. - Viewed project detail. - Edited project. - Viewed Owners. - Viewed package detail. - Edited package [7]. - Viewed flags. - Edited flag. - Deleted flag. - Viewed Herald. - Viewed rules. - Created rule. - Edited rule. - Viewed edit log. - Viewed transcripts. - Inspected a transcript. - Viewed People. - Viewed list. - Administrated user. - Checked username/delete stuff. - Looked at create/import LDAP/activity logs. - Looked at a user profile. - Looked at user about page. - Looked at Repositories. - Edited repository. - Edited arcanist project. - Looked at daemons. - Looked at all daemons [8]. - Viewed combined log. - Looked at configuration. - Edited configuration. - Looked at setup issues [9]. - Looked at current settings. - Looked at application list. - Installed / uninstalled applications [10]. - Looked at mailing lists. - Created a mailing list. - Edited a mailing list. - Looked at sent mail. - Looked at received mail. - Looked at send/receive tests. - Looked at settings. - Clicked through all the panels. - Looked at slowvote. - Created a slowvote [11]. - Voted in a slowvote. - Looked at Macro. - Created a macro. - Edited a macro. - Commented on a macro. - Looked at Countdown. - Created a Countdown. - Looked at it. - Looked at Drydock. - Poked around a bit. - Looked at Fact. - Poked around a bit. - Looked at files. - Looked at a file. - Uploaded a file. - Looked at Conduit. - Made a Conduit call. - Looked at UIExamples. - Looked at PHPAST. - Looked at PHIDs. - Looked at notification menu. - Looked at notification detail. - Logged out. - Logged in. - Looked at homepage [12]. - Ran `arc unit --everything --no-coverage` [X2]. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4807 --- .../config/editor/PhabricatorConfigEditor.php | 4 +- .../controller/ConpherenceController.php | 4 +- .../view/ConpherenceTransactionView.php | 1 + .../view/PhabricatorDaemonLogListView.php | 6 +-- ...rentialChangesetFileTreeSideNavBuilder.php | 11 +++-- .../view/DifferentialRevisionDetailView.php | 2 +- .../PhabricatorDirectoryMainController.php | 2 +- .../feed/view/PhabricatorFeedStoryView.php | 4 +- .../controller/HeraldTranscriptController.php | 28 ++++++------ .../PhabricatorOwnersEditController.php | 5 ++- .../PhabricatorSlowvoteCreateController.php | 2 +- .../PhabricatorApplicationTransaction.php | 2 +- .../layout/PhabricatorObjectItemListView.php | 3 +- .../application/core/behavior-dark-console.js | 45 ++++++++++--------- 14 files changed, 65 insertions(+), 54 deletions(-) diff --git a/src/applications/config/editor/PhabricatorConfigEditor.php b/src/applications/config/editor/PhabricatorConfigEditor.php index a2ca330fdf..cb21eb2a0d 100644 --- a/src/applications/config/editor/PhabricatorConfigEditor.php +++ b/src/applications/config/editor/PhabricatorConfigEditor.php @@ -18,7 +18,7 @@ final class PhabricatorConfigEditor switch ($xaction->getTransactionType()) { case PhabricatorConfigTransaction::TYPE_EDIT: return array( - 'deleted' => (bool)$object->getIsDeleted(), + 'deleted' => (int)$object->getIsDeleted(), 'value' => $object->getValue(), ); } @@ -54,7 +54,7 @@ final class PhabricatorConfigEditor $v['value']); } - $object->setIsDeleted($v['deleted']); + $object->setIsDeleted((int)$v['deleted']); $object->setValue($v['value']); break; } diff --git a/src/applications/conpherence/controller/ConpherenceController.php b/src/applications/conpherence/controller/ConpherenceController.php index 6ca418661d..3050ceb224 100644 --- a/src/applications/conpherence/controller/ConpherenceController.php +++ b/src/applications/conpherence/controller/ConpherenceController.php @@ -155,7 +155,9 @@ abstract class ConpherenceController extends PhabricatorController { $item->addClass('conpherence-selected'); $item->addClass('hide-unread-count'); } - $nav->addCustomBlock($item->render()); + + // TODO: [HTML] Clean this up when we clean up HTML stuff in Conpherence. + $nav->addCustomBlock(phutil_safe_html($item->render())); } if (empty($conpherences) || $read) { $nav->addCustomBlock($this->getNoConpherencesBlock()); diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php index c44b80faa5..bcb3278fa7 100644 --- a/src/applications/conpherence/view/ConpherenceTransactionView.php +++ b/src/applications/conpherence/view/ConpherenceTransactionView.php @@ -35,6 +35,7 @@ final class ConpherenceTransactionView extends AphrontView { ->setEpoch($transaction->getDateCreated()) ->setContentSource($transaction->getContentSource()); + $content = null; $content_class = null; switch ($transaction->getTransactionType()) { case ConpherenceTransactionType::TYPE_TITLE: diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php index c60b584209..190e17c3cd 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php @@ -47,17 +47,17 @@ final class PhabricatorDaemonLogListView extends AphrontView { case PhabricatorDaemonLog::STATUS_RUNNING: $style = 'color: #00cc00'; $title = 'Running'; - $symbol = '•'; + $symbol = "\xE2\x80\xA2"; break; case PhabricatorDaemonLog::STATUS_DEAD: $style = 'color: #cc0000'; $title = 'Died'; - $symbol = '•'; + $symbol = "\xE2\x80\xA2"; break; case PhabricatorDaemonLog::STATUS_EXITED: $style = 'color: #000000'; $title = 'Exited'; - $symbol = '•'; + $symbol = "\xE2\x80\xA2"; break; case PhabricatorDaemonLog::STATUS_UNKNOWN: default: // fallthrough diff --git a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php index 6ee62cc218..f2b1e59f40 100644 --- a/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php +++ b/src/applications/differential/view/DifferentialChangesetFileTreeSideNavBuilder.php @@ -116,10 +116,13 @@ final class DifferentialChangesetFileTreeSideNavBuilder { } $tree->destroy(); - $filetree = - '
    '. - implode("\n", $filetree). - '
    '; + $filetree = phutil_tag( + 'div', + array( + 'class' => 'phabricator-filetree', + ), + $filetree); + $nav->addLabel(pht('Changed Files')); $nav->addCustomBlock($filetree); $nav->setActive(true); diff --git a/src/applications/differential/view/DifferentialRevisionDetailView.php b/src/applications/differential/view/DifferentialRevisionDetailView.php index 55204ed32b..75fe45bfaf 100644 --- a/src/applications/differential/view/DifferentialRevisionDetailView.php +++ b/src/applications/differential/view/DifferentialRevisionDetailView.php @@ -80,7 +80,7 @@ final class DifferentialRevisionDetailView extends AphrontView { foreach ($this->auxiliaryFields as $field) { $value = $field->renderValueForRevisionView(); - if (strlen($value)) { + if ($value !== null) { $label = rtrim($field->renderLabelForRevisionView(), ':'); $properties->addProperty($label, $value); } diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index eca0c28b1a..e61cf16b48 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -345,7 +345,7 @@ final class PhabricatorDirectoryMainController array( ), array( - phutil_tag('strong', array(), $title.':'), + phutil_tag('strong', array(), $title.': '), $body ))); $this->minipanels[] = $panel; diff --git a/src/applications/feed/view/PhabricatorFeedStoryView.php b/src/applications/feed/view/PhabricatorFeedStoryView.php index bf23a53890..9900b5e9a7 100644 --- a/src/applications/feed/view/PhabricatorFeedStoryView.php +++ b/src/applications/feed/view/PhabricatorFeedStoryView.php @@ -111,7 +111,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { require_celerity_resource('phabricator-feed-css'); - return phutil_tag( + return phutil_render_tag( 'div', array( 'class' => $this->oneLine @@ -119,7 +119,7 @@ final class PhabricatorFeedStoryView extends PhabricatorFeedView { : 'phabricator-feed-story', 'style' => $image_style, ), - array($head, $body, $foot)); + $this->renderSingleView(array($head, $body, $foot))); } } diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index 62af029da8..7008b49c6a 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -476,21 +476,21 @@ final class HeraldTranscriptController extends HeraldController { $rows = array(); foreach ($data as $name => $value) { - if (!is_scalar($value) && !is_null($value)) { - $value = implode("\n", $value); - } + if (!($value instanceof PhutilSafeHTML)) { + if (!is_scalar($value) && !is_null($value)) { + $value = implode("\n", $value); + } - if (strlen($value) > 256) { - $value = phutil_tag( - 'textarea', - array( - 'class' => 'herald-field-value-transcript', - ), - $value); - } else if ($name === 'Object Link') { - // The link cannot be escaped - } else { - $value = phutil_escape_html($value); + if (strlen($value) > 256) { + $value = phutil_tag( + 'textarea', + array( + 'class' => 'herald-field-value-transcript', + ), + $value); + } else { + $value = phutil_escape_html($value); + } } $rows[] = array( diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php index a5aece08d1..1be18ddd8c 100644 --- a/src/applications/owners/controller/PhabricatorOwnersEditController.php +++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php @@ -32,7 +32,10 @@ final class PhabricatorOwnersEditController $package->setName($request->getStr('name')); $package->setDescription($request->getStr('description')); $old_auditing_enabled = $package->getAuditingEnabled(); - $package->setAuditingEnabled($request->getStr('auditing') === 'enabled'); + $package->setAuditingEnabled( + ($request->getStr('auditing') === 'enabled') + ? 1 + : 0); $primary = $request->getArr('primary'); $primary = reset($primary); diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php index 5dcb904707..3f3d5f1b6d 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php @@ -23,7 +23,7 @@ final class PhabricatorSlowvoteCreateController if ($request->isFormPost()) { $poll->setQuestion($request->getStr('question')); $poll->setResponseVisibility($request->getInt('response_visibility')); - $poll->setShuffle($request->getBool('shuffle', false)); + $poll->setShuffle((int)$request->getBool('shuffle', false)); $poll->setMethod($request->getInt('method')); if (!strlen($poll->getQuestion())) { diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php index 72e7ac08ad..00bbde7e3d 100644 --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -143,7 +143,7 @@ abstract class PhabricatorApplicationTransaction foreach ($phids as $phid) { $links[] = $this->renderHandleLink($phid); } - return implode(', ', $links); + return phutil_safe_html(implode(', ', $links)); } public function getIcon() { diff --git a/src/view/layout/PhabricatorObjectItemListView.php b/src/view/layout/PhabricatorObjectItemListView.php index 76b9c7655f..4ae41564ca 100644 --- a/src/view/layout/PhabricatorObjectItemListView.php +++ b/src/view/layout/PhabricatorObjectItemListView.php @@ -53,8 +53,7 @@ final class PhabricatorObjectItemListView extends AphrontView { $string = nonempty($this->noDataString, pht('No data.')); $items = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NODATA) - ->appendChild(phutil_escape_html($string)) - ->render(); + ->appendChild(phutil_escape_html($string)); } $pager = null; diff --git a/webroot/rsrc/js/application/core/behavior-dark-console.js b/webroot/rsrc/js/application/core/behavior-dark-console.js index 99370a9342..50a3471997 100644 --- a/webroot/rsrc/js/application/core/behavior-dark-console.js +++ b/webroot/rsrc/js/application/core/behavior-dark-console.js @@ -40,6 +40,8 @@ JX.behavior('dark-console', function(config, statics) { statics.visible = config.visible; statics.selected = config.selected; + install_shortcut(); + return statics.root; } @@ -202,29 +204,30 @@ JX.behavior('dark-console', function(config, statics) { JX.DOM.setContent(statics.el.panel, div); } - // Install keyboard shortcut. - var desc = 'Toggle visibility of DarkConsole.'; - new JX.KeyboardShortcut('`', desc) - .setHandler(function(manager) { - statics.visible = !statics.visible; - - if (statics.visible) { - JX.DOM.show(root); - if (statics.req.current) { - draw_request(statics.req.current); + function install_shortcut() { + var desc = 'Toggle visibility of DarkConsole.'; + new JX.KeyboardShortcut('`', desc) + .setHandler(function(manager) { + statics.visible = !statics.visible; + + if (statics.visible) { + JX.DOM.show(root); + if (statics.req.current) { + draw_request(statics.req.current); + } + } else { + JX.DOM.hide(root); } - } else { - JX.DOM.hide(root); - } - // Save user preference. - new JX.Request('/~/', JX.bag) - .setData({visible: statics.visible ? 1 : 0}) - .send(); + // Save user preference. + new JX.Request('/~/', JX.bag) + .setData({visible: statics.visible ? 1 : 0}) + .send(); - // Force resize listeners to take effect. - JX.Stratcom.invoke('resize'); - }) - .register(); + // Force resize listeners to take effect. + JX.Stratcom.invoke('resize'); + }) + .register(); + } }); -- 2.51.2 From bcf9b9d4a7076a2c2019d8a9bdde73d6fcecd634 Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 5 Feb 2013 12:49:46 -0800 Subject: [PATCH 40/50] Convert some phutil_escape_html() to hsprintf() Summary: In the second phase, I want to get rid of the most of `phutil_escape_html()` calls in favor of plain strings or `PhutilSafeHTML`. This is an example of how it could look. Test Plan: /api/user.whoami Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4823 --- .../controller/PhabricatorConduitAPIController.php | 5 +---- .../controller/PhabricatorConduitConsoleController.php | 9 ++++----- .../controller/PhabricatorConduitTokenController.php | 7 ++++--- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php index 1cae2c40b7..b31ae55f2a 100644 --- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php +++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php @@ -396,12 +396,9 @@ final class PhabricatorConduitAPIController $json = new PhutilJSON(); if (is_array($value)) { $value = $json->encodeFormatted($value); - $value = phutil_escape_html($value); - } else { - $value = phutil_escape_html($value); } - $value = '
    '.$value.'
    '; + $value = hsprintf('
    %s
    ', $value); return $value; } diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 3d0f2c41a0..5020173b88 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -58,11 +58,10 @@ final class PhabricatorConduitConsoleController if ($error_types) { $error_description[] = '
      '; foreach ($error_types as $error => $meaning) { - $error_description[] = - '
    • '. - ''.phutil_escape_html($error).': '. - phutil_escape_html($meaning). - '
    • '; + $error_description[] = hsprintf( + '
    • %s: %s
    • ', + $error, + $meaning); } $error_description[] = '
    '; $error_description = implode("\n", $error_description); diff --git a/src/applications/conduit/controller/PhabricatorConduitTokenController.php b/src/applications/conduit/controller/PhabricatorConduitTokenController.php index 54273ad477..50f87cbd6d 100644 --- a/src/applications/conduit/controller/PhabricatorConduitTokenController.php +++ b/src/applications/conduit/controller/PhabricatorConduitTokenController.php @@ -32,14 +32,15 @@ final class PhabricatorConduitTokenController $panel->setHeader('Certificate Install Token'); $panel->setWidth(AphrontPanelView::WIDTH_FORM); - $panel->appendChild( + $panel->appendChild(hsprintf( '

    Copy and paste this token into '. 'the prompt given to you by "arc install-certificate":

    '. '

    '. - ''.phutil_escape_html($token->getToken()).''. + '%s'. '

    '. '

    arc will then complete the '. - 'install process for you.

    '); + 'install process for you.

    ', + $token->getToken())); $this->setShowSideNav(false); -- 2.51.2 From be4662e6670dfc17280653922a5cbcaa150a958e Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 5 Feb 2013 13:23:05 -0800 Subject: [PATCH 41/50] Convert setCaption() to safe HTML Test Plan: /settings/panel/display/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4824 --- .../auth/controller/PhabricatorLoginController.php | 6 +++--- .../PhabricatorConduitConsoleController.php | 2 +- .../PhabricatorCountdownEditController.php | 4 ++-- .../PhabricatorDirectoryMainController.php | 4 ++-- .../controller/PhabricatorFileUploadController.php | 4 ++-- .../controller/ManiphestReportController.php | 13 +++++++------ .../controller/ManiphestTaskEditController.php | 5 +++-- .../PhabricatorMetaMTAReceiveController.php | 5 ++++- .../PhabricatorMetaMTASendController.php | 9 +++++---- .../controller/blog/PhameBlogEditController.php | 3 +-- ...atorRepositoryArcanistProjectEditController.php | 3 ++- .../PhabricatorRepositoryEditController.php | 9 +++++---- .../PhabricatorSettingsPanelDisplayPreferences.php | 14 +++++++------- src/view/form/control/AphrontFormControl.php | 8 ++++---- src/view/layout/AphrontPanelView.php | 8 ++++---- 15 files changed, 52 insertions(+), 45 deletions(-) diff --git a/src/applications/auth/controller/PhabricatorLoginController.php b/src/applications/auth/controller/PhabricatorLoginController.php index c4bda38a77..7918b1cff8 100644 --- a/src/applications/auth/controller/PhabricatorLoginController.php +++ b/src/applications/auth/controller/PhabricatorLoginController.php @@ -177,9 +177,9 @@ final class PhabricatorLoginController id(new AphrontFormPasswordControl()) ->setLabel(pht('Password')) ->setName('password') - ->setCaption( - ''. - pht('Forgot your password? / Email Login').'')); + ->setCaption(hsprintf( + '%s', + pht('Forgot your password? / Email Login')))); if ($require_captcha) { $form->appendChild( diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 5020173b88..a50e713c0c 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -97,7 +97,7 @@ final class PhabricatorConduitConsoleController id(new AphrontFormTextControl()) ->setLabel($param) ->setName("params[{$param}]") - ->setCaption(phutil_escape_html($desc))); + ->setCaption($desc)); } $form diff --git a/src/applications/countdown/controller/PhabricatorCountdownEditController.php b/src/applications/countdown/controller/PhabricatorCountdownEditController.php index d4bab9ad35..76b49ab63a 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownEditController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownEditController.php @@ -97,11 +97,11 @@ final class PhabricatorCountdownEditController ->setLabel('End date') ->setValue($display_datepoint) ->setName('datepoint') - ->setCaption( + ->setCaption(hsprintf( 'Examples: '. '2011-12-25 or '. '3 hours or '. - 'June 8 2011, 5 PM.')) + 'June 8 2011, 5 PM.'))) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/countdown/') diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index e61cf16b48..9201d2c838 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -149,9 +149,9 @@ final class PhabricatorDirectoryMainController $panel = new AphrontPanelView(); $panel->setHeader('Needs Triage'); - $panel->setCaption( + $panel->setCaption(hsprintf( 'Open tasks with "Needs Triage" priority in '. - 'projects you are a member of.'); + 'projects you are a member of.')); $panel->addButton( phutil_tag( diff --git a/src/applications/files/controller/PhabricatorFileUploadController.php b/src/applications/files/controller/PhabricatorFileUploadController.php index 74c5455e84..94a1130ca5 100644 --- a/src/applications/files/controller/PhabricatorFileUploadController.php +++ b/src/applications/files/controller/PhabricatorFileUploadController.php @@ -99,7 +99,7 @@ final class PhabricatorFileUploadController extends PhabricatorFileController { $limit = phabricator_parse_bytes($limit); if ($limit) { $formatted = phabricator_format_bytes($limit); - return 'Maximum file size: '.phutil_escape_html($formatted); + return 'Maximum file size: '.$formatted; } $doc_href = PhabricatorEnv::getDocLink( @@ -112,7 +112,7 @@ final class PhabricatorFileUploadController extends PhabricatorFileController { ), 'Configuring File Upload Limits'); - return 'Upload limit is not configured, see '.$doc_link.'.'; + return hsprintf('Upload limit is not configured, see %s.', $doc_link); } } diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php index b8ce9c7e5d..34c2b30494 100644 --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -245,12 +245,13 @@ final class ManiphestReportController extends ManiphestController { if ($handle) { $header = "Task Burn Rate for Project ".$handle->renderLink(); - $caption = "

    NOTE: This table reflects tasks currently in ". - "the project. If a task was opened in the past but added to ". - "the project recently, it is counted on the day it was ". - "opened, not the day it was categorized. If a task was part ". - "of this project in the past but no longer is, it is not ". - "counted at all.

    "; + $caption = hsprintf( + "

    NOTE: This table reflects tasks currently in ". + "the project. If a task was opened in the past but added to ". + "the project recently, it is counted on the day it was ". + "opened, not the day it was categorized. If a task was part ". + "of this project in the past but no longer is, it is not ". + "counted at all.

    "); } else { $header = "Task Burn Rate for All Tasks"; $caption = null; diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 103e342842..5b258baf8f 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -478,8 +478,9 @@ final class ManiphestTaskEditController extends ManiphestController { $email_create = PhabricatorEnv::getEnvConfig( 'metamta.maniphest.public-create-email'); if (!$task->getID() && $email_create) { - $email_hint = pht('You can also create tasks by sending an email to: '). - ''.phutil_escape_html($email_create).''; + $email_hint = pht( + 'You can also create tasks by sending an email to: %s', + phutil_tag('tt', array(), $email_create)); $description_control->setCaption($email_hint); } diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php index 2d4591408c..ccf1410f39 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php @@ -57,7 +57,10 @@ final class PhabricatorMetaMTAReceiveController id(new AphrontFormTextControl()) ->setLabel(pht('To')) ->setName('obj') - ->setCaption(pht('e.g. D1234 or T1234'))) + ->setCaption(pht( + 'e.g. %s or %s', + phutil_tag('tt', array(), 'D1234'), + phutil_tag('tt', array(), 'T1234')))) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel(pht('Body')) diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php index 3c1d6a6a99..c2a0b58452 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php @@ -116,8 +116,10 @@ final class PhabricatorMetaMTASendController id(new AphrontFormTextControl()) ->setLabel(pht('Mail Tags')) ->setName('mailtags') - ->setCaption( - pht('Example:').' differential-cc, differential-comment')) + ->setCaption(pht( + 'Example: %s', + phutil_tag('tt', array(), 'differential-cc, differential-comment')) + )) ->appendChild( id(new AphrontFormDragAndDropUploadControl()) ->setLabel(pht('Attach Files')) @@ -144,8 +146,7 @@ final class PhabricatorMetaMTASendController '1', pht('Send immediately. (Do not enqueue for daemons.)'), PhabricatorEnv::getEnvConfig('metamta.send-immediately')) - ->setCaption(pht('Daemons can be started with %s.', $phdlink)) - ) + ->setCaption(pht('Daemons can be started with %s.', $phdlink))) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue(pht('Send Mail'))); diff --git a/src/applications/phame/controller/blog/PhameBlogEditController.php b/src/applications/phame/controller/blog/PhameBlogEditController.php index 6a9f952726..368e2e7118 100644 --- a/src/applications/phame/controller/blog/PhameBlogEditController.php +++ b/src/applications/phame/controller/blog/PhameBlogEditController.php @@ -150,8 +150,7 @@ final class PhameBlogEditController ->setLabel('Custom Domain') ->setName('custom_domain') ->setValue($blog->getDomain()) - ->setCaption('Must include at least one dot (.), e.g. '. - 'blog.example.com') + ->setCaption('Must include at least one dot (.), e.g. blog.example.com') ->setError($e_custom_domain) ) ->appendChild( diff --git a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php index 00fe0a6df1..61f68daa18 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php @@ -83,7 +83,8 @@ final class PhabricatorRepositoryArcanistProjectEditController id(new AphrontFormTextControl()) ->setLabel('Indexed Languages') ->setName('symbolIndexLanguages') - ->setCaption('Separate with commas, for example: php, py') + ->setCaption( + hsprintf('Separate with commas, for example: php, py')) ->setValue($langs)) ->appendChild( id(new AphrontFormTokenizerControl()) diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index bd6b43daac..cbf2574e4c 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -456,7 +456,8 @@ final class PhabricatorRepositoryEditController ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT) ->setValue($repository->getDetail('ssh-key')) ->setError($e_ssh_key) - ->setCaption('Specify the entire private key, or...')) + ->setCaption( + hsprintf('Specify the entire private key, or...'))) ->appendChild( id(new AphrontFormTextControl()) ->setName('ssh-keyfile') @@ -552,10 +553,10 @@ final class PhabricatorRepositoryEditController ->setName('branch-filter') ->setLabel('Track Only') ->setValue($branch_filter_str) - ->setCaption( + ->setCaption(hsprintf( 'Optional list of branches to track. Other branches will be '. 'completely ignored. If left empty, all branches are tracked. '. - 'Example: master, release')); + 'Example: master, release'))); } $inset @@ -651,7 +652,7 @@ final class PhabricatorRepositoryEditController ->setName('uuid') ->setLabel('UUID') ->setValue($repository->getUUID()) - ->setCaption('Repository UUID from svn info.')); + ->setCaption(hsprintf('Repository UUID from svn info.'))); } $form->appendChild($inset); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php index 9c77817262..97b1a21c4b 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php @@ -67,7 +67,6 @@ EXAMPLE; 'User Guide: Configuring an External Editor'); $font_default = PhabricatorEnv::getEnvConfig('style.monospace'); - $font_default = phutil_escape_html($font_default); $pref_monospaced_textareas_value = $preferences ->getPreference($pref_monospaced_textareas); @@ -97,11 +96,11 @@ EXAMPLE; id(new AphrontFormTextControl()) ->setLabel('Editor Link') ->setName($pref_editor) - ->setCaption( + ->setCaption(hsprintf( 'Link to edit files in external editor. '. - '%f is replaced by filename, %l by line number, %r by repository '. - 'callsign, %% by literal %. '. - "For documentation, see {$editor_doc_link}.") + '%%f is replaced by filename, %%l by line number, %%r by repository '. + 'callsign, %%%% by literal %%. For documentation, see %s.', + $editor_doc_link)) ->setValue($preferences->getPreference($pref_editor))) ->appendChild( id(new AphrontFormSelectControl()) @@ -116,9 +115,10 @@ EXAMPLE; id(new AphrontFormTextControl()) ->setLabel('Monospaced Font') ->setName($pref_monospaced) - ->setCaption( + ->setCaption(hsprintf( 'Overrides default fonts in tools like Differential.
    '. - '(Default: '.$font_default.')') + '(Default: %s)', + $font_default)) ->setValue($preferences->getPreference($pref_monospaced))) ->appendChild( id(new AphrontFormMarkupControl()) diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php index 69786d2902..6bbdfe853e 100644 --- a/src/view/form/control/AphrontFormControl.php +++ b/src/view/form/control/AphrontFormControl.php @@ -140,10 +140,10 @@ abstract class AphrontFormControl extends AphrontView { } if (strlen($this->getCaption())) { - $caption = - '
    '. - $this->getCaption(). - '
    '; + $caption = phutil_tag( + 'div', + array('class' => 'aphront-form-caption'), + $this->getCaption()); } else { $caption = null; } diff --git a/src/view/layout/AphrontPanelView.php b/src/view/layout/AphrontPanelView.php index 2d2e313977..651e2a0e80 100644 --- a/src/view/layout/AphrontPanelView.php +++ b/src/view/layout/AphrontPanelView.php @@ -69,10 +69,10 @@ final class AphrontPanelView extends AphrontView { } if ($this->caption !== null) { - $caption = - '
    '. - $this->caption. - '
    '; + $caption = phutil_tag( + 'div', + array('class' => 'aphront-panel-view-caption'), + $this->caption); } else { $caption = null; } -- 2.51.2 From 6bb7a282b1b5eb06068d5182094c04ae5bdc51bf Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 5 Feb 2013 14:30:29 -0800 Subject: [PATCH 42/50] Convert AphrontFormControl to safe HTML Summary: Everything here now should properly handle plain strings and safe HTML. Test Plan: /settings/panel/display/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4826 --- .../PhabricatorConduitConsoleController.php | 6 +-- .../PhabricatorConfigEditController.php | 44 ++++++++-------- .../DifferentialDiffViewController.php | 24 +++++---- .../PhabricatorFileUploadController.php | 11 ++-- .../controller/HeraldRuleController.php | 13 ++--- .../ManiphestTaskEditController.php | 7 +-- .../PhabricatorPasteEditController.php | 7 ++- .../PhortuneMonthYearExpiryControl.php | 7 +-- ...ricatorSettingsPanelDisplayPreferences.php | 8 +-- .../PhabricatorSlowvotePollController.php | 1 - .../control/AphrontFormCheckboxControl.php | 17 +++---- src/view/form/control/AphrontFormControl.php | 50 ++++++++++--------- .../control/AphrontFormDividerControl.php | 2 +- .../form/control/AphrontFormImageControl.php | 11 ++-- .../control/AphrontFormRadioButtonControl.php | 25 +++++----- .../control/AphrontFormRecaptchaControl.php | 4 +- .../form/control/AphrontFormStaticControl.php | 2 +- .../form/control/AphrontFormSubmitControl.php | 2 +- .../AphrontFormToggleButtonsControl.php | 2 +- .../control/PhabricatorRemarkupControl.php | 2 + 20 files changed, 118 insertions(+), 127 deletions(-) diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index a50e713c0c..61248cbbf1 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -53,18 +53,16 @@ final class PhabricatorConduitConsoleController } } - $error_description = array(); $error_types = $method_object->defineErrorTypes(); if ($error_types) { - $error_description[] = '
      '; + $error_description = array(); foreach ($error_types as $error => $meaning) { $error_description[] = hsprintf( '
    • %s: %s
    • ', $error, $meaning); } - $error_description[] = '
    '; - $error_description = implode("\n", $error_description); + $error_description = phutil_tag('ul', array(), $error_description); } else { $error_description = "This method does not raise any specific errors."; } diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index 5983bbc1ae..57ee007a08 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -137,7 +137,7 @@ final class PhabricatorConfigEditController array( 'class' => 'phabricator-remarkup', ), - phutil_safe_html($engine->getOutput($option, 'description'))); + $engine->getOutput($option, 'description')); $form ->setUser($user) @@ -419,23 +419,23 @@ final class PhabricatorConfigEditController } $table = array(); - $table[] = ''; - $table[] = ''.pht('Example').''; - $table[] = ''.pht('Value').''; - $table[] = ''; + $table[] = hsprintf( + '%s%s', + pht('Example'), + pht('Value')); foreach ($examples as $example) { list($value, $description) = $example; if ($value === null) { - $value = ''.pht('(empty)').''; + $value = phutil_tag('em', array(), pht('(empty)')); } else { - $value = nl2br(phutil_escape_html($value)); + $value = phutil_escape_html_newlines($value); } - $table[] = ''; - $table[] = ''.phutil_escape_html($description).''; - $table[] = ''.$value.''; - $table[] = ''; + $table[] = hsprintf( + '%s%s', + $description, + $value); } require_celerity_resource('config-options-css'); @@ -445,7 +445,7 @@ final class PhabricatorConfigEditController array( 'class' => 'config-option-table', ), - new PhutilSafeHTML(implode("\n", $table))); + $table); } private function renderDefaults(PhabricatorConfigOption $option) { @@ -467,10 +467,10 @@ final class PhabricatorConfigEditController $table = array(); - $table[] = ''; - $table[] = ''.pht('Source').''; - $table[] = ''.pht('Value').''; - $table[] = ''; + $table[] = hsprintf( + '%s%s', + pht('Source'), + pht('Value')); foreach ($stack as $key => $source) { $value = $source->getKeys( array( @@ -478,16 +478,16 @@ final class PhabricatorConfigEditController )); if (!array_key_exists($option->getKey(), $value)) { - $value = ''.pht('(empty)').''; + $value = phutil_tag('em', array(), pht('(empty)')); } else { $value = PhabricatorConfigJSON::prettyPrintJSON( $value[$option->getKey()]); } - $table[] = ''; - $table[] = ''.phutil_escape_html($source->getName()).''; - $table[] = ''.$value.''; - $table[] = ''; + $table[] = hsprintf( + '%s%s', + $source->getName(), + $value); } require_celerity_resource('config-options-css'); @@ -497,7 +497,7 @@ final class PhabricatorConfigEditController array( 'class' => 'config-option-table', ), - new PhutilSafeHTML(implode("\n", $table))); + $table); } } diff --git a/src/applications/differential/controller/DifferentialDiffViewController.php b/src/applications/differential/controller/DifferentialDiffViewController.php index d764f560e3..afe4847c8c 100644 --- a/src/applications/differential/controller/DifferentialDiffViewController.php +++ b/src/applications/differential/controller/DifferentialDiffViewController.php @@ -38,11 +38,11 @@ final class DifferentialDiffViewController extends DifferentialController { // TODO: implmenent optgroup support in AphrontFormSelectControl? $select = array(); - $select[] = ''; - $select[] = ''; - $select[] = ''; + $select[] = hsprintf('', pht('Create New Revision')); + $select[] = hsprintf( + '', + pht('Create a new Revision...')); + $select[] = hsprintf(''); $revision_data = new DifferentialRevisionListData( DifferentialRevisionListData::QUERY_OPEN_OWNED, @@ -50,7 +50,9 @@ final class DifferentialDiffViewController extends DifferentialController { $revisions = $revision_data->loadRevisions(); if ($revisions) { - $select[] = ''; + $select[] = hsprintf( + '', + pht('Update Existing Revision')); foreach ($revisions as $revision) { $select[] = phutil_tag( 'option', @@ -59,13 +61,13 @@ final class DifferentialDiffViewController extends DifferentialController { ), $revision->getTitle()); } - $select[] = ''; + $select[] = hsprintf(''); } - $select = - ''; + $select = phutil_tag( + 'select', + array('name' => 'revisionID'), + $select); $action_form = new AphrontFormView(); $action_form diff --git a/src/applications/files/controller/PhabricatorFileUploadController.php b/src/applications/files/controller/PhabricatorFileUploadController.php index 94a1130ca5..cab1f145f6 100644 --- a/src/applications/files/controller/PhabricatorFileUploadController.php +++ b/src/applications/files/controller/PhabricatorFileUploadController.php @@ -30,13 +30,12 @@ final class PhabricatorFileUploadController extends PhabricatorFileController { $instructions = id(new AphrontFormMarkupControl()) ->setControlID($support_id) ->setControlStyle('display: none') - ->setValue( - '

    '. + ->setValue(hsprintf( + '

    %s %s

    ', + pht('Drag and Drop:'), pht( - 'Drag and Drop: You can also upload files by '. - 'dragging and dropping them from your desktop onto this page or '. - 'the Phabricator home page.'). - '

    '); + 'You can also upload files by dragging and dropping them from your '. + 'desktop onto this page or the Phabricator home page.'))); $form = id(new AphrontFormView()) ->setFlexible(true) diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index f61062520d..b5fee57e90 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -117,9 +117,10 @@ final class HeraldRuleController extends HeraldController { $form ->appendChild( id(new AphrontFormMarkupControl()) - ->setValue( - "This ${rule_type_name} rule triggers for " . - "${content_type_name}.")) + ->setValue(hsprintf( + "This %s rule triggers for %s.", + $rule_type_name, + $content_type_name))) ->appendChild( id(new AphrontFormInsetView()) ->setTitle('Conditions') @@ -154,9 +155,9 @@ final class HeraldRuleController extends HeraldController { 'mustcapture' => true, ), 'Create New Action')) - ->setDescription( - phutil_safe_html( - 'Take these actions '.$repetition_selector.' this rule matches:')) + ->setDescription(hsprintf( + 'Take these actions %s this rule matches:', + $repetition_selector)) ->setContent(javelin_tag( 'table', array( diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 5b258baf8f..23fcf30bee 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -455,11 +455,8 @@ final class ManiphestTaskEditController extends ManiphestController { )); if ($files) { - $file_display = array(); - foreach ($files as $file) { - $file_display[] = phutil_escape_html($file->getName()); - } - $file_display = implode('
    ', $file_display); + $file_display = mpull($files, 'getName'); + $file_display = array_interleave(phutil_tag('br'), $file_display); $form->appendChild( id(new AphrontFormMarkupControl()) diff --git a/src/applications/paste/controller/PhabricatorPasteEditController.php b/src/applications/paste/controller/PhabricatorPasteEditController.php index 63beb71670..29d0272209 100644 --- a/src/applications/paste/controller/PhabricatorPasteEditController.php +++ b/src/applications/paste/controller/PhabricatorPasteEditController.php @@ -164,10 +164,9 @@ final class PhabricatorPasteEditController extends PhabricatorPasteController { ->appendChild( id(new AphrontFormMarkupControl()) ->setLabel('Text') - ->setValue( - 'Paste text can not be edited. '. - $fork_link.' to create a new paste.' - )); + ->setValue(hsprintf( + 'Paste text can not be edited. %s to create a new paste.', + $fork_link))); } $submit = new AphrontFormSubmitControl(); diff --git a/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php b/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php index a4701aa11c..b9c48cd595 100644 --- a/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php +++ b/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php @@ -80,12 +80,7 @@ final class PhortuneMonthYearExpiryControl extends AphrontFormControl { 'sigil' => 'year-input', )); - return self::renderSingleView( - array( - $months_sel, - $years_sel - ) - ); + return hsprintf('%s%s', $months_sel, $years_sel); } } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php index 97b1a21c4b..b5b4d00d35 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php @@ -122,10 +122,10 @@ EXAMPLE; ->setValue($preferences->getPreference($pref_monospaced))) ->appendChild( id(new AphrontFormMarkupControl()) - ->setValue( - '
    '.
    -          phutil_escape_html($example_string).
    -          '
    ')) + ->setValue(phutil_tag( + 'pre', + array('class' => 'PhabricatorMonospaced'), + $example_string))) ->appendChild( id(new AphrontFormRadioButtonControl()) ->setLabel('Monospaced Textareas') diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 2bc75bc744..9440e476b4 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -112,7 +112,6 @@ final class PhabricatorSlowvotePollController $viewer_choices, $option); } - $option_markup = implode("\n", $option_markup); $comments_by_option = array(); switch ($poll->getMethod()) { diff --git a/src/view/form/control/AphrontFormCheckboxControl.php b/src/view/form/control/AphrontFormCheckboxControl.php index 00a85f52a9..4d452c448e 100644 --- a/src/view/form/control/AphrontFormCheckboxControl.php +++ b/src/view/form/control/AphrontFormCheckboxControl.php @@ -38,16 +38,15 @@ final class AphrontFormCheckboxControl extends AphrontFormControl { 'for' => $id, ), $box['label']); - $rows[] = - ''. - ''.$checkbox.''. - ''.$label.''. - ''; + $rows[] = hsprintf( + '%s%s', + $checkbox, + $label); } - return - ''. - implode("\n", $rows). - '
    '; + return phutil_tag( + 'table', + array('class' => 'aphront-form-control-checkbox-layout'), + $rows); } } diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php index 6bbdfe853e..0e21457e29 100644 --- a/src/view/form/control/AphrontFormControl.php +++ b/src/view/form/control/AphrontFormControl.php @@ -108,32 +108,32 @@ abstract class AphrontFormControl extends AphrontView { $custom_class = $this->getCustomControlClass(); if (strlen($this->getLabel())) { - $label = - ''; + $label = phutil_tag( + 'label', + array('class' => 'aphront-form-label'), + $this->getLabel()); } else { $label = null; $custom_class .= ' aphront-form-control-nolabel'; } - $input = - '
    '. - $this->renderInput(). - '
    '; + $input = phutil_tag( + 'div', + array('class' => 'aphront-form-input'), + $this->renderInput()); if (strlen($this->getError())) { $error = $this->getError(); if ($error === true) { - $error = - '
    '. - 'Required'. - '
    '; + $error = phutil_tag( + 'div', + array('class' => 'aphront-form-error aphront-form-required'), + 'Required'); } else { - $error = - '
    '. - phutil_escape_html($error). - '
    '; + $error = phutil_tag( + 'div', + array('class' => 'aphront-form-error'), + $error); } } else { $error = null; @@ -148,19 +148,21 @@ abstract class AphrontFormControl extends AphrontView { $caption = null; } - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => "aphront-form-control {$custom_class}", 'id' => $this->controlID, 'style' => $this->controlStyle, ), - $label. - $error. - $input. - $caption. - - // TODO: Remove this once the redesign finishes up. - '
    '); + array( + $label, + $error, + $input, + $caption, + + // TODO: Remove this once the redesign finishes up. + phutil_tag('div', array('style' => 'clear: both;'), ''), + )); } } diff --git a/src/view/form/control/AphrontFormDividerControl.php b/src/view/form/control/AphrontFormDividerControl.php index 7b9090b9a5..b76d9e055b 100644 --- a/src/view/form/control/AphrontFormDividerControl.php +++ b/src/view/form/control/AphrontFormDividerControl.php @@ -7,7 +7,7 @@ final class AphrontFormDividerControl extends AphrontFormControl { } protected function renderInput() { - return '
    '; + return phutil_tag('hr'); } } diff --git a/src/view/form/control/AphrontFormImageControl.php b/src/view/form/control/AphrontFormImageControl.php index ba2adb2c92..8e84d6fefc 100644 --- a/src/view/form/control/AphrontFormImageControl.php +++ b/src/view/form/control/AphrontFormImageControl.php @@ -9,14 +9,14 @@ final class AphrontFormImageControl extends AphrontFormControl { protected function renderInput() { $id = celerity_generate_unique_node_id(); - return + return hsprintf( + '%s
    %s%s
    ', phutil_tag( 'input', array( 'type' => 'file', 'name' => $this->getName(), - )). - '
    '. + )), phutil_tag( 'input', array( @@ -24,14 +24,13 @@ final class AphrontFormImageControl extends AphrontFormControl { 'name' => 'default_image', 'class' => 'default-image', 'id' => $id, - )). + )), phutil_tag( 'label', array( 'for' => $id, ), - 'Use Default Image instead'). - '
    '; + 'Use Default Image instead')); } } diff --git a/src/view/form/control/AphrontFormRadioButtonControl.php b/src/view/form/control/AphrontFormRadioButtonControl.php index 6d6547c8b6..1fca18e9d5 100644 --- a/src/view/form/control/AphrontFormRadioButtonControl.php +++ b/src/view/form/control/AphrontFormRadioButtonControl.php @@ -43,22 +43,21 @@ final class AphrontFormRadioButtonControl extends AphrontFormControl { $button['label']); if (strlen($button['caption'])) { - $label .= - '
    '. - phutil_escape_html($button['caption']). - '
    '; + $label = hsprintf( + '%s
    %s
    ', + $label, + $button['caption']); } - $rows[] = - ''. - ''.$radio.''. - ''.$label.''. - ''; + $rows[] = hsprintf( + '%s%s', + $radio, + $label); } - return - ''. - implode("\n", $rows). - '
    '; + return phutil_tag( + 'table', + array('class' => 'aphront-form-control-radio-layout'), + $rows); } } diff --git a/src/view/form/control/AphrontFormRecaptchaControl.php b/src/view/form/control/AphrontFormRecaptchaControl.php index 25bc39792c..078eb1afc2 100644 --- a/src/view/form/control/AphrontFormRecaptchaControl.php +++ b/src/view/form/control/AphrontFormRecaptchaControl.php @@ -53,10 +53,10 @@ final class AphrontFormRecaptchaControl extends AphrontFormControl { $protocol = $uri->getProtocol(); $use_ssl = ($protocol == 'https'); - return recaptcha_get_html( + return phutil_safe_html(recaptcha_get_html( PhabricatorEnv::getEnvConfig('recaptcha.public-key'), $error = null, - $use_ssl); + $use_ssl)); } } diff --git a/src/view/form/control/AphrontFormStaticControl.php b/src/view/form/control/AphrontFormStaticControl.php index d72fa37586..47060ea292 100644 --- a/src/view/form/control/AphrontFormStaticControl.php +++ b/src/view/form/control/AphrontFormStaticControl.php @@ -7,7 +7,7 @@ final class AphrontFormStaticControl extends AphrontFormControl { } protected function renderInput() { - return phutil_escape_html($this->getValue()); + return $this->getValue(); } } diff --git a/src/view/form/control/AphrontFormSubmitControl.php b/src/view/form/control/AphrontFormSubmitControl.php index c2ccb915e5..a6f505f905 100644 --- a/src/view/form/control/AphrontFormSubmitControl.php +++ b/src/view/form/control/AphrontFormSubmitControl.php @@ -30,7 +30,7 @@ final class AphrontFormSubmitControl extends AphrontFormControl { ), $this->getValue()); } - return $submit_button.$this->cancelButton; + return hsprintf('%s%s', $submit_button, $this->cancelButton); } } diff --git a/src/view/form/control/AphrontFormToggleButtonsControl.php b/src/view/form/control/AphrontFormToggleButtonsControl.php index 43f83ed1b9..1c2fb3a673 100644 --- a/src/view/form/control/AphrontFormToggleButtonsControl.php +++ b/src/view/form/control/AphrontFormToggleButtonsControl.php @@ -46,7 +46,7 @@ final class AphrontFormToggleButtonsControl extends AphrontFormControl { $label); } - return implode('', $out); + return $out; } } diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 42b5d143b8..e34f090fcb 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -2,10 +2,12 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { private $disableMacro = false; + public function setDisableMacros($disable) { $this->disableMacro = $disable; return $this; } + protected function renderInput() { $id = $this->getID(); if (!$id) { -- 2.51.2 From 2f508bf0dc52db7e7184c5ff740e6549cf51d0b6 Mon Sep 17 00:00:00 2001 From: vrana Date: Tue, 5 Feb 2013 15:14:18 -0800 Subject: [PATCH 43/50] Delete some phutil_safe_html() Test Plan: Displayed revision. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4829 --- .../base/controller/PhabricatorController.php | 4 +-- .../config/view/PhabricatorSetupIssueView.php | 34 ++++++++++--------- ...ifferentialDependsOnFieldSpecification.php | 2 +- .../DifferentialFieldSpecification.php | 2 +- .../DifferentialLintFieldSpecification.php | 9 ++--- ...entialManiphestTasksFieldSpecification.php | 2 +- .../DifferentialUnitFieldSpecification.php | 4 +-- .../DifferentialRevisionUpdateHistoryView.php | 8 ++--- .../controller/DiffusionController.php | 13 ++++--- .../controller/HeraldRuleController.php | 3 +- src/applications/phame/view/PhamePostView.php | 13 +++---- .../PhabricatorPropertyListExample.php | 2 +- 12 files changed, 47 insertions(+), 49 deletions(-) diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php index 6e79333711..e3d5d15196 100644 --- a/src/applications/base/controller/PhabricatorController.php +++ b/src/applications/base/controller/PhabricatorController.php @@ -264,7 +264,7 @@ abstract class PhabricatorController extends AphrontController { */ protected function renderHandlesForPHIDs(array $phids, $style = "\n") { $style_map = array( - "\n" => '
    ', + "\n" => phutil_tag('br'), ',' => ', ', ); @@ -277,7 +277,7 @@ abstract class PhabricatorController extends AphrontController { $items[] = $this->getHandle($phid)->renderLink(); } - return phutil_safe_html(implode($style_map[$style], $items)); + return array_interleave($style_map[$style], $items); } protected function buildApplicationMenu() { diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index e212d71010..a65dae3e63 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -53,20 +53,20 @@ final class PhabricatorSetupIssueView extends AphrontView { $install_these = pht( "Install these %d PHP extension(s):", count($extensions)); - $install_info = phutil_safe_html(pht( - "You can usually install a PHP extension using apt-get or ". - "yum. Common package names are ". - "php-extname or php5-extname. ". - "Try commands like these:")); + $install_info = pht( + "You can usually install a PHP extension using %s or %s. Common ". + "package names are %s or %s. Try commands like these:", + phutil_tag('tt', array(), 'apt-get'), + phutil_tag('tt', array(), 'yum'), + hsprintf('php-%s', pht('extname')), + hsprintf('php5-%s', pht('extname'))); // TODO: We should do a better job of detecting how to install extensions // on the current system. - $install_commands = array( - "$ sudo apt-get install php5-extname # Debian / Ubuntu", - "$ sudo yum install php-extname # Red Hat / Derivatives", + $install_commands = hsprintf( + "\$ sudo apt-get install php5-extname # Debian / Ubuntu\n". + "\$ sudo yum install php-extname # Red Hat / Derivatives" ); - $install_commands = implode("\n", $install_commands); - $install_commands = phutil_safe_html($install_commands); $fallback_info = pht( "If those commands don't work, try Google. The process of installing ". @@ -76,8 +76,8 @@ final class PhabricatorSetupIssueView extends AphrontView { $restart_info = pht( "After installing new PHP extensions, restart your webserver ". - "for the changes to take effect."); - $restart_info = phutil_safe_html($restart_info); + "for the changes to take effect.", + hsprintf('')); $description[] = phutil_tag( 'div', @@ -274,17 +274,19 @@ final class PhabricatorSetupIssueView extends AphrontView { $info[] = phutil_tag( 'p', array(), - phutil_safe_html(pht( + pht( 'You can find more information about PHP configuration values in the '. 'PHP Documentation.', - 'http://php.net/manual/ini.list.php'))); + 'http://php.net/manual/ini.list.php', + hsprintf(''))); $info[] = phutil_tag( 'p', array(), - phutil_safe_html(pht( + pht( "After editing the PHP configuration, restart your ". - "webserver for the changes to take effect."))); + "webserver for the changes to take effect.", + hsprintf(''))); return phutil_tag( 'div', diff --git a/src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php b/src/applications/differential/field/specification/DifferentialDependsOnFieldSpecification.php index 09da33abc2..05c8ebef91 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 phutil_safe_html(implode('
    ', $links)); + return array_interleave(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 9453668fae..d1b6dbdb3b 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 phutil_safe_html(implode(', ', $links)); + return array_interleave(', ', $links); } diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index 36080efee4..8cf2bfab8d 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -43,7 +43,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => 'star', - 'name' => phutil_safe_html($lstar), + 'name' => $lstar, 'value' => $lmsg, 'show' => true, ); @@ -53,7 +53,7 @@ final class DifferentialLintFieldSpecification $rows[] = array( 'style' => 'excuse', 'name' => 'Excuse', - 'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))), + 'value' => phutil_escape_html_newlines($excuse), 'show' => true, ); } @@ -131,10 +131,7 @@ final class DifferentialLintFieldSpecification if (strlen($description)) { $rows[] = array( 'style' => 'details', - 'value' => - phutil_safe_html( - nl2br( - phutil_escape_html($description))), + 'value' => phutil_escape_html_newlines($description), 'show' => false, ); if (empty($hidden['details'])) { diff --git a/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php b/src/applications/differential/field/specification/DifferentialManiphestTasksFieldSpecification.php index 44890675bd..38379da8f2 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 phutil_safe_html(implode('
    ', $links)); + return array_interleave(phutil_tag('br'), $links); } private function getManiphestTaskPHIDs() { diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index b19ae2f798..0e442314a6 100644 --- a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php @@ -37,7 +37,7 @@ final class DifferentialUnitFieldSpecification $rows[] = array( 'style' => 'star', - 'name' => phutil_safe_html($ustar), + 'name' => $ustar, 'value' => $umsg, 'show' => true, ); @@ -47,7 +47,7 @@ final class DifferentialUnitFieldSpecification $rows[] = array( 'style' => 'excuse', 'name' => 'Excuse', - 'value' => phutil_safe_html(nl2br(phutil_escape_html($excuse))), + 'value' => phutil_escape_html_newlines($excuse), 'show' => true, ); } diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index 718d837f53..67e6ee4da4 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -293,10 +293,10 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { private static function renderDiffStar($star) { $class = 'diff-star-'.$star; - return - ''. - "\xE2\x98\x85". - ''; + return phutil_tag( + 'span', + array('class' => $class), + "\xE2\x98\x85"); } private function renderBaseRevision(DifferentialDiff $diff) { diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php index cc30b41141..3025434485 100644 --- a/src/applications/diffusion/controller/DiffusionController.php +++ b/src/applications/diffusion/controller/DiffusionController.php @@ -247,8 +247,7 @@ abstract class DiffusionController extends PhabricatorController { case 'change': $view_name = 'Change'; $crumb_list[] = $crumb->setName( - phutil_safe_html( - phutil_escape_html($path).' ('.$commit_link.')')); + hsprintf('%s (%s)', $path, $commit_link)); return $crumb_list; } @@ -278,6 +277,7 @@ abstract class DiffusionController extends PhabricatorController { $thus_far = ''; foreach ($path_parts as $path_part) { $thus_far .= $path_part.'/'; + $path_sections[] = '/'; $path_sections[] = phutil_tag( 'a', array( @@ -289,11 +289,10 @@ abstract class DiffusionController extends PhabricatorController { $path_part); } - $path_sections[] = phutil_escape_html($last); - $path_sections = '/'.implode('/', $path_sections); + $path_sections[] = '/'.$last; $crumb_list[] = id(new PhabricatorCrumbView()) - ->setName(phutil_safe_html($path_sections)); + ->setName($path_sections); } $last_crumb = array_pop($crumb_list); @@ -310,11 +309,11 @@ abstract class DiffusionController extends PhabricatorController { 'Jump to HEAD'); $name = $last_crumb->getName(); - $name = phutil_safe_html($name." @ {$commit_link} ({$jump_link})"); + $name = hsprintf('%s @ %s (%s)', $name, $commit_link, $jump_link); $last_crumb->setName($name); } else if ($spec['view'] != 'lint') { $name = $last_crumb->getName(); - $name = phutil_safe_html($name.' @ HEAD'); + $name = hsprintf('%s @ HEAD', $name); $last_crumb->setName($name); } diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php index b5fee57e90..6371e5ad2e 100644 --- a/src/applications/herald/controller/HeraldRuleController.php +++ b/src/applications/herald/controller/HeraldRuleController.php @@ -134,8 +134,7 @@ final class HeraldRuleController extends HeraldController { ), 'Create New Condition')) ->setDescription( - phutil_safe_html( - 'When '.$must_match_selector.' these conditions are met:')) + hsprintf('When %s these conditions are met:', $must_match_selector)) ->setContent(javelin_tag( 'table', array( diff --git a/src/applications/phame/view/PhamePostView.php b/src/applications/phame/view/PhamePostView.php index 8c5a47c452..874d4c0513 100644 --- a/src/applications/phame/view/PhamePostView.php +++ b/src/applications/phame/view/PhamePostView.php @@ -162,15 +162,16 @@ final class PhamePostView extends AphrontView { ''); $c_uri = '//connect.facebook.net/en_US/all.js#xfbml=1&appId='.$fb_id; - $fb_js = phutil_safe_html( + $fb_js = hsprintf( + '', jsprintf( - '', + '}(document, \'script\', \'facebook-jssdk\'));', $c_uri)); @@ -211,9 +212,9 @@ final class PhamePostView extends AphrontView { ); // protip - try some var disqus_developer = 1; action to test locally - $disqus_js = phutil_safe_html( + $disqus_js = hsprintf( + '', jsprintf( - '', + '})();', $post->getPHID(), $this->getSkin()->getURI('post/'.$this->getPost()->getPhameTitle()), $post->getTitle())); diff --git a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php index 0e0e6dc2ec..9ac216d82b 100644 --- a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php +++ b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php @@ -49,7 +49,7 @@ final class PhabricatorPropertyListExample extends PhabricatorUIExample { $view->addSectionHeader('Haiku About Pasta'); $view->addTextContent( - phutil_safe_html( + hsprintf( 'this is a pasta
    '. 'haiku. it is very bad.
    '. 'what did you expect?')); -- 2.51.2 From f864d9e61132aa64de59f2c56d71ac92a084c0d4 Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 6 Feb 2013 14:49:34 -0800 Subject: [PATCH 44/50] Fix double escaping in phutil_tag Summary: I wasn't able to reproduce the "recursion detected" in real web request but I saw lots of 1073741824 refcounts in `debug_zval_dump()` of $object. I'm not sure how that happens. Test Plan: D4807#4 Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4839 --- .../controller/PhabricatorDirectoryMainController.php | 5 +++-- .../worker/PhabricatorRepositoryCommitParserWorker.php | 2 +- src/infrastructure/daemon/workers/PhabricatorWorker.php | 4 +--- src/view/control/AphrontTokenizerTemplateView.php | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 9201d2c838..7e823ec8d3 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -143,8 +143,9 @@ final class PhabricatorDirectoryMainController if (!$tasks) { return $this->renderMiniPanel( 'No "Needs Triage" Tasks', - 'No tasks in projects you are a member of '. - 'need triage.'); + hsprintf( + 'No tasks in projects you are a member of '. + 'need triage.')); } $panel = new AphrontPanelView(); diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php index a17245fb58..5aa3327100 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php @@ -96,6 +96,6 @@ abstract class PhabricatorRepositoryCommitParserWorker ->load($commit->getRepositoryID()); $link = DiffusionView::linkCommit($repository, $commit->getCommitIdentifier()); - return $link.$suffix; + return hsprintf('%s%s', $link, $suffix); } } diff --git a/src/infrastructure/daemon/workers/PhabricatorWorker.php b/src/infrastructure/daemon/workers/PhabricatorWorker.php index 3cf3159ca7..3a49f1b0f6 100644 --- a/src/infrastructure/daemon/workers/PhabricatorWorker.php +++ b/src/infrastructure/daemon/workers/PhabricatorWorker.php @@ -151,9 +151,7 @@ abstract class PhabricatorWorker { public function renderForDisplay() { $data = PhutilReadableSerializer::printableValue($this->data); - $data = phutil_escape_html($data); - $data = '
    '.$data.'
    '; - return $data; + return phutil_tag('pre', array(), $data); } } diff --git a/src/view/control/AphrontTokenizerTemplateView.php b/src/view/control/AphrontTokenizerTemplateView.php index d80fe2566c..4e4e442593 100644 --- a/src/view/control/AphrontTokenizerTemplateView.php +++ b/src/view/control/AphrontTokenizerTemplateView.php @@ -84,7 +84,7 @@ final class AphrontTokenizerTemplateView extends AphrontView { 'type' => 'hidden', 'name' => $input_name, 'value' => $key, - )). + )), phutil_tag('span', array('class' => 'jx-tokenizer-x-placeholder'), ''), )); } -- 2.51.2 From 059920c2dac57147116a706a7205c51c69d3ff3a Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 6 Feb 2013 16:53:49 -0800 Subject: [PATCH 45/50] Convert AphrontErrorView to safe HTML Summary: Done by searching for `AphrontErrorView` and then `appendChild()`. Test Plan: Looked at Commit Detail. Looked at Revision Detail. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4843 --- ...AphrontDefaultApplicationConfiguration.php | 2 +- .../response/AphrontRedirectResponse.php | 5 +-- .../PhabricatorMustVerifyEmailController.php | 9 +++-- .../PhabricatorConduitConsoleController.php | 14 +++----- .../PhabricatorConfigEditController.php | 4 +-- .../PhabricatorWorkerTaskDetailController.php | 6 ++-- .../DifferentialRevisionViewController.php | 23 +++++++------ .../DifferentialLintFieldSpecification.php | 14 ++++---- .../DifferentialUnitFieldSpecification.php | 14 ++++---- .../view/DifferentialAddCommentView.php | 15 --------- .../DiffusionBrowseFileController.php | 5 ++- .../controller/DiffusionCommitController.php | 13 ++++---- .../DiffusionExternalController.php | 12 ++++--- .../view/DiffusionEmptyResultView.php | 17 +++++----- .../PhabricatorFactHomeController.php | 7 ++-- .../controller/HeraldTranscriptController.php | 6 ++-- .../PhabricatorMetaMTASendController.php | 16 +++++---- ...habricatorNotificationStatusController.php | 7 ++-- ...PhabricatorEmailVerificationController.php | 33 +++++++++++-------- .../PhabricatorPeopleEditController.php | 7 ++-- .../controller/PhrictionEditController.php | 5 +-- .../PhabricatorRepositoryController.php | 22 ++++++------- .../PhabricatorRepositoryEditController.php | 3 +- .../panel/PhabricatorSettingsPanelAccount.php | 3 +- .../panel/PhabricatorSettingsPanelConduit.php | 8 +++-- ...abricatorSettingsPanelEmailPreferences.php | 3 +- .../PhabricatorSettingsPanelPassword.php | 3 +- .../panel/PhabricatorSettingsPanelProfile.php | 3 +- src/view/form/AphrontErrorView.php | 10 +++--- .../layout/PhabricatorObjectItemListView.php | 2 +- src/view/layout/PhabricatorPinboardView.php | 2 +- 31 files changed, 152 insertions(+), 141 deletions(-) diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index c50f278672..4d18f54528 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -211,7 +211,7 @@ class AphrontDefaultApplicationConfiguration if ($ex instanceof AphrontUsageException) { $error = new AphrontErrorView(); $error->setTitle(phutil_escape_html($ex->getTitle())); - $error->appendChild(phutil_escape_html($ex->getMessage())); + $error->appendChild($ex->getMessage()); $view = new PhabricatorStandardPageView(); $view->setRequest($this->getRequest()); diff --git a/src/aphront/response/AphrontRedirectResponse.php b/src/aphront/response/AphrontRedirectResponse.php index 254073390d..b01cc3644d 100644 --- a/src/aphront/response/AphrontRedirectResponse.php +++ b/src/aphront/response/AphrontRedirectResponse.php @@ -49,10 +49,11 @@ class AphrontRedirectResponse extends AphrontResponse { ), 'Continue to: '.$this->getURI()); - $error->appendChild( + $error->appendChild(hsprintf( '

    You were stopped here because debug.stop-on-redirect '. 'is set in your configuration.

    '. - '

    '.$link.'

    '); + '

    %s

    ', + $link)); $view->appendChild($error); diff --git a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php index 7aa356f9e6..183954eebe 100644 --- a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php +++ b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php @@ -31,9 +31,12 @@ final class PhabricatorMustVerifyEmailController $sent = new AphrontErrorView(); $sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $sent->setTitle(pht('Email Sent')); - $sent->appendChild('

    '. - pht('Another verification email was sent to %s.', - phutil_escape_html($email_address)).'

    '); + $sent->appendChild(phutil_tag( + 'p', + array(), + pht( + 'Another verification email was sent to %s.', + phutil_tag('strong', array(), $email_address)))); } $error_view = new AphrontRequestFailureView(); diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 61248cbbf1..43a645e4d1 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -35,20 +35,16 @@ final class PhabricatorConduitConsoleController case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: $status_view->setTitle('Deprecated Method'); $status_view->appendChild( - phutil_escape_html( - nonempty( - $reason, - "This method is deprecated."))); + nonempty($reason, "This method is deprecated.")); break; case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: $status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING); $status_view->setTitle('Unstable Method'); $status_view->appendChild( - phutil_escape_html( - nonempty( - $reason, - "This method is new and unstable. Its interface is subject ". - "to change."))); + nonempty( + $reason, + "This method is new and unstable. Its interface is subject ". + "to change.")); break; } } diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index 57ee007a08..c02e20f3cb 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -108,7 +108,7 @@ final class PhabricatorConfigEditController $error_view = id(new AphrontErrorView()) ->setTitle(pht('Configuration Hidden')) ->setSeverity(AphrontErrorView::SEVERITY_WARNING) - ->appendChild('

    '.phutil_escape_html($msg).'

    '); + ->appendChild(phutil_tag('p', array(), $msg)); } else if ($option->getLocked()) { $msg = pht( "This configuration is locked and can not be edited from the web ". @@ -117,7 +117,7 @@ final class PhabricatorConfigEditController $error_view = id(new AphrontErrorView()) ->setTitle(pht('Configuration Locked')) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) - ->appendChild('

    '.phutil_escape_html($msg).'

    '); + ->appendChild(phutil_tag('p', array(), $msg)); } if ($option->getHidden()) { diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php index 75f391c5a2..3444d66dfc 100644 --- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php @@ -23,8 +23,10 @@ final class PhabricatorWorkerTaskDetailController $error_view = new AphrontErrorView(); $error_view->setTitle('No Such Task'); - $error_view->appendChild( - '

    This task may have recently been garbage collected.

    '); + $error_view->appendChild(phutil_tag( + 'p', + array(), + 'This task may have recently been garbage collected.')); $error_view->setSeverity(AphrontErrorView::SEVERITY_NODATA); $content = $error_view; diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 5dc9211297..1e572ab334 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -180,21 +180,20 @@ final class DifferentialRevisionViewController extends DifferentialController { $warning = new AphrontErrorView(); $warning->setTitle('Very Large Diff'); $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); - $warning->appendChild( + $warning->appendChild(hsprintf( + '%s %s', pht( 'This diff is very large and affects %s files. Load each file '. 'individually.', - new PhutilNumber($count)). - " ". - phutil_tag( - 'a', - array( - 'href' => $request_uri - ->alter('large', 'true') - ->setFragment('toc'), - ), - pht('Show All Files Inline')). - ""); + new PhutilNumber($count)), + phutil_tag( + 'a', + array( + 'href' => $request_uri + ->alter('large', 'true') + ->setFragment('toc'), + ), + pht('Show All Files Inline')))); $warning = $warning->render(); $my_inlines = id(new DifferentialInlineComment())->loadAllWhere( diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index 8cf2bfab8d..8c9e7b9639 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -245,24 +245,24 @@ final class DifferentialLintFieldSpecification if ($status == DifferentialLintStatus::LINT_SKIP) { $content = - "

    This diff was created without running lint. Make sure you are ". - "OK with that before you accept this diff.

    "; + "This diff was created without running lint. Make sure you are ". + "OK with that before you accept this diff."; } else if ($status == DifferentialLintStatus::LINT_POSTPONED) { $severity = AphrontErrorView::SEVERITY_WARNING; $content = - "

    Postponed linters didn't finish yet. Make sure you are OK with ". - "that before you accept this diff.

    "; + "Postponed linters didn't finish yet. Make sure you are OK with ". + "that before you accept this diff."; } else { $content = - "

    This diff has Lint Problems. Make sure you are OK with them ". - "before you accept this diff.

    "; + "This diff has Lint Problems. Make sure you are OK with them ". + "before you accept this diff."; } return id(new AphrontErrorView()) ->setSeverity($severity) - ->appendChild($content) + ->appendChild(phutil_tag('p', array(), $content)) ->setTitle(idx($titles, $status, 'Warning')); } diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index 0e442314a6..ae189573ff 100644 --- a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php @@ -200,21 +200,21 @@ final class DifferentialUnitFieldSpecification ); if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) { $content = - "

    This diff has postponed unit tests. The results should be ". + "This diff has postponed unit tests. The results should be ". "coming in soon. You should probably wait for them before accepting ". - "this diff.

    "; + "this diff."; } else if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_SKIP) { $content = - "

    Unit tests were skipped when this diff was created. Make sure ". - "you are OK with that before you accept this diff.

    "; + "Unit tests were skipped when this diff was created. Make sure ". + "you are OK with that before you accept this diff."; } else { $content = - "

    This diff has Unit Test Problems. Make sure you are OK with ". - "them before you accept this diff.

    "; + "This diff has Unit Test Problems. Make sure you are OK with ". + "them before you accept this diff."; } $unit_warning = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_ERROR) - ->appendChild($content) + ->appendChild(phutil_tag('p', array(), $content)) ->setTitle(idx($titles, $diff->getUnitStatus(), 'Warning')); } return $unit_warning; diff --git a/src/applications/differential/view/DifferentialAddCommentView.php b/src/applications/differential/view/DifferentialAddCommentView.php index 881b8de3d6..0670a062ca 100644 --- a/src/applications/differential/view/DifferentialAddCommentView.php +++ b/src/applications/differential/view/DifferentialAddCommentView.php @@ -46,21 +46,6 @@ final class DifferentialAddCommentView extends AphrontView { return $this; } - private function generateWarningView( - $status, - array $titles, - $id, - $content) { - - $warning = new AphrontErrorView(); - $warning->setSeverity(AphrontErrorView::SEVERITY_ERROR); - $warning->setID($id); - $warning->appendChild($content); - $warning->setTitle(idx($titles, $status, 'Warning')); - - return $warning; - } - public function render() { require_celerity_resource('differential-revision-add-comment-css'); diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php index 93caaab144..474605c44c 100644 --- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php @@ -96,9 +96,8 @@ final class DiffusionBrowseFileController extends DiffusionController { $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setTitle('File Renamed'); $notice->appendChild( - "File history passes through a rename from '". - phutil_escape_html($drequest->getPath())."' to '". - phutil_escape_html($renamed)."'."); + "File history passes through a rename from '".$drequest->getPath(). + "' to '".$renamed."'."); $content[] = $notice; } diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php index 65e47e3af1..8726c5a91c 100644 --- a/src/applications/diffusion/controller/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/DiffusionCommitController.php @@ -62,8 +62,8 @@ final class DiffusionCommitController extends DiffusionController { $error_panel->appendChild( "This Diffusion repository is configured to track only one ". "subdirectory of the entire Subversion repository, and this commit ". - "didn't affect the tracked subdirectory ('". - phutil_escape_html($subpath)."'), so no information is available."); + "didn't affect the tracked subdirectory ('".$subpath."'), so no ". + "information is available."); $content[] = $error_panel; $content[] = $top_anchor; } else { @@ -162,8 +162,7 @@ final class DiffusionCommitController extends DiffusionController { if ($bad_commit) { $error_panel = new AphrontErrorView(); $error_panel->setTitle('Bad Commit'); - $error_panel->appendChild( - phutil_escape_html($bad_commit['description'])); + $error_panel->appendChild($bad_commit['description']); $content[] = $error_panel; } else if ($is_foreign) { @@ -207,8 +206,10 @@ final class DiffusionCommitController extends DiffusionController { $warning_view = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setTitle('Very Large Commit') - ->appendChild( - "

    This commit is very large. Load each file individually.

    "); + ->appendChild(phutil_tag( + 'p', + array(), + "This commit is very large. Load each file individually.")); $change_panel->appendChild($warning_view); $change_panel->addButton($show_all_button); diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php index 738cee81fd..c20e11cb82 100644 --- a/src/applications/diffusion/controller/DiffusionExternalController.php +++ b/src/applications/diffusion/controller/DiffusionExternalController.php @@ -60,17 +60,19 @@ final class DiffusionExternalController extends DiffusionController { if (empty($commits)) { $desc = null; if ($uri) { - $desc = phutil_escape_html($uri).', at '; + $desc = $uri.', at '; } - $desc .= phutil_escape_html($id); + $desc .= $id; $content = id(new AphrontErrorView()) ->setTitle('Unknown External') ->setSeverity(AphrontErrorView::SEVERITY_WARNING) - ->appendChild( - "

    This external ({$desc}) does not appear in any tracked ". + ->appendChild(phutil_tag( + 'p', + array(), + "This external ({$desc}) does not appear in any tracked ". "repository. It may exist in an untracked repository that ". - "Diffusion does not know about.

    "); + "Diffusion does not know about.")); } else if (count($commits) == 1) { $commit = head($commits); $repo = $repositories[$commit->getRepositoryID()]; diff --git a/src/applications/diffusion/view/DiffusionEmptyResultView.php b/src/applications/diffusion/view/DiffusionEmptyResultView.php index 75997fafa0..7dcba04caf 100644 --- a/src/applications/diffusion/view/DiffusionEmptyResultView.php +++ b/src/applications/diffusion/view/DiffusionEmptyResultView.php @@ -43,8 +43,6 @@ final class DiffusionEmptyResultView extends DiffusionView { $deleted = $this->browseQuery->getDeletedAtCommit(); $existed = $this->browseQuery->getExistedAtCommit(); - $deleted = self::linkCommit($drequest->getRepository(), $deleted); - $browse = $this->linkBrowse( $drequest->getPath(), array( @@ -54,11 +52,14 @@ final class DiffusionEmptyResultView extends DiffusionView { ) ); - $existed = "r{$callsign}{$existed}"; - $title = 'Path Was Deleted'; - $body = "This path does not exist at {$commit}. It was deleted in ". - "{$deleted} and last {$browse} at {$existed}."; + $body = hsprintf( + "This path does not exist at %s. It was deleted in %s and last %s ". + "at %s.", + $commit, + self::linkCommit($drequest->getRepository(), $deleted), + $browse, + "r{$callsign}{$existed}"); $severity = AphrontErrorView::SEVERITY_WARNING; break; case DiffusionBrowseQuery::REASON_IS_UNTRACKED_PARENT: @@ -66,7 +67,7 @@ final class DiffusionEmptyResultView extends DiffusionView { $title = 'Directory Not Tracked'; $body = "This repository is configured to track only one subdirectory ". - "of the entire repository ('".phutil_escape_html($subdir)."'), ". + "of the entire repository ('{$subdir}'), ". "but you aren't looking at something in that subdirectory, so no ". "information is available."; $severity = AphrontErrorView::SEVERITY_WARNING; @@ -78,7 +79,7 @@ final class DiffusionEmptyResultView extends DiffusionView { $error_view = new AphrontErrorView(); $error_view->setSeverity($severity); $error_view->setTitle($title); - $error_view->appendChild('

    '.$body.'

    '); + $error_view->appendChild(phutil_tag('p', array(), $body)); return $error_view->render(); } diff --git a/src/applications/fact/controller/PhabricatorFactHomeController.php b/src/applications/fact/controller/PhabricatorFactHomeController.php index 4f079392b9..82ce96baa1 100644 --- a/src/applications/fact/controller/PhabricatorFactHomeController.php +++ b/src/applications/fact/controller/PhabricatorFactHomeController.php @@ -94,9 +94,10 @@ final class PhabricatorFactHomeController extends PhabricatorFactController { return id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setTitle(pht('No Chartable Facts')) - ->appendChild( - '

    '.pht( - 'There are no facts that can be plotted yet.').'

    '); + ->appendChild(phutil_tag( + 'p', + array(), + pht('There are no facts that can be plotted yet.'))); } $form = id(new AphrontFormView()) diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index 7008b49c6a..0b80cdf3b4 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -35,8 +35,10 @@ final class HeraldTranscriptController extends HeraldController { $notice = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setTitle('Old Transcript') - ->appendChild( - '

    Details of this transcript have been garbage collected.

    '); + ->appendChild(phutil_tag( + 'p', + array(), + 'Details of this transcript have been garbage collected.')); $nav->appendChild($notice); } else { $filter = $this->getFilterPHIDs(); diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php index c2a0b58452..bd423186cd 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php @@ -67,12 +67,16 @@ final class PhabricatorMetaMTASendController $warning = new AphrontErrorView(); $warning->setTitle('Email is Disabled'); $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); - $warning->appendChild( - '

    '.pht('This installation of Phabricator is currently set to use '. - 'PhabricatorMailImplementationTestAdapter to deliver '. - 'outbound email. This completely disables outbound email! All '. - 'outbound email will be thrown in a deep, dark hole until you '. - 'configure a real adapter.').'

    '); + $warning->appendChild(phutil_tag( + 'p', + array(), + pht( + 'This installation of Phabricator is currently set to use %s to '. + 'deliver outbound email. This completely disables outbound email! '. + 'All outbound email will be thrown in a deep, dark hole until you '. + 'configure a real adapter.', + phutil_tag('tt', array(), 'PhabricatorMailImplementationTestAdapter')) + )); } $phdlink_href = PhabricatorEnv::getDoclink( diff --git a/src/applications/notification/controller/PhabricatorNotificationStatusController.php b/src/applications/notification/controller/PhabricatorNotificationStatusController.php index 31a0de4552..5c28923b9f 100644 --- a/src/applications/notification/controller/PhabricatorNotificationStatusController.php +++ b/src/applications/notification/controller/PhabricatorNotificationStatusController.php @@ -24,13 +24,14 @@ final class PhabricatorNotificationStatusController } catch (Exception $ex) { $status = new AphrontErrorView(); $status->setTitle("Notification Server Issue"); - $status->appendChild( + $status->appendChild(hsprintf( 'Unable to determine server status. This probably means the server '. 'is not in great shape. The specific issue encountered was:'. '
    '. '
    '. - ''.phutil_escape_html(get_class($ex)).' '. - nl2br(phutil_escape_html($ex->getMessage()))); + '%s %s', + get_class($ex), + phutil_escape_html_newlines($ex->getMessage()))); } return $this->buildStandardPageResponse( diff --git a/src/applications/people/controller/PhabricatorEmailVerificationController.php b/src/applications/people/controller/PhabricatorEmailVerificationController.php index 221df9d2a5..80432f15b0 100644 --- a/src/applications/people/controller/PhabricatorEmailVerificationController.php +++ b/src/applications/people/controller/PhabricatorEmailVerificationController.php @@ -30,7 +30,9 @@ final class PhabricatorEmailVerificationController 'href' => '/', ), 'Continue to Phabricator'); - $home_link = '

    '.$home_link.'

    '; + $home_link = hsprintf( + '

    %s

    ', + $home_link); $settings_link = phutil_tag( 'a', @@ -38,23 +40,26 @@ final class PhabricatorEmailVerificationController 'href' => '/settings/panel/email/', ), 'Return to Email Settings'); - $settings_link = '

    '.$settings_link.'

    '; - + $settings_link = hsprintf( + '

    %s

    ', + $settings_link); if (!$email) { $content = id(new AphrontErrorView()) ->setTitle('Unable To Verify') - ->appendChild( - '

    The verification code is incorrect, the email address has '. - 'been removed, or the email address is owned by another user. Make '. - 'sure you followed the link in the email correctly.

    '); + ->appendChild(phutil_tag( + 'p', + array(), + 'The verification code is incorrect, the email address has been '. + 'removed, or the email address is owned by another user. Make '. + 'sure you followed the link in the email correctly.')); } else if ($email->getIsVerified()) { $content = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setTitle('Address Already Verified') - ->appendChild( - '

    This email address has already been verified.

    '. - $settings_link); + ->appendChild(hsprintf( + '

    This email address has already been verified.

    %s', + $settings_link)); } else { $guard = AphrontWriteGuard::beginScopedUnguardedWrites(); @@ -65,10 +70,10 @@ final class PhabricatorEmailVerificationController $content = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setTitle('Address Verified') - ->appendChild( - '

    This email address has now been verified. Thanks!

    '. - $home_link. - $settings_link); + ->appendChild(hsprintf( + '

    This email address has now been verified. Thanks!

    %s%s', + $home_link, + $settings_link)); } return $this->buildApplicationPage( diff --git a/src/applications/people/controller/PhabricatorPeopleEditController.php b/src/applications/people/controller/PhabricatorPeopleEditController.php index d5e0ca8f0c..bedf1b43fa 100644 --- a/src/applications/people/controller/PhabricatorPeopleEditController.php +++ b/src/applications/people/controller/PhabricatorPeopleEditController.php @@ -54,7 +54,8 @@ final class PhabricatorPeopleEditController $notice = new AphrontErrorView(); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setTitle('Changes Saved'); - $notice->appendChild('

    Your changes were saved.

    '); + $notice->appendChild( + phutil_tag('p', array(), 'Your changes were saved.')); $content[] = $notice; } @@ -578,10 +579,10 @@ final class PhabricatorPeopleEditController if ($user->getPHID() == $admin->getPHID()) { $error = new AphrontErrorView(); $error->setTitle('You Shall Journey No Farther'); - $error->appendChild( + $error->appendChild(hsprintf( '

    As you stare into the gaping maw of the abyss, something holds '. 'you back.

    '. - '

    You can not delete your own account.

    '); + '

    You can not delete your own account.

    ')); return $error; } diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php index 43b8c3824a..502feaa9e1 100644 --- a/src/applications/phriction/controller/PhrictionEditController.php +++ b/src/applications/phriction/controller/PhrictionEditController.php @@ -183,8 +183,9 @@ final class PhrictionEditController $draft_note = new AphrontErrorView(); $draft_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $draft_note->setTitle('Recovered Draft'); - $draft_note->appendChild( - '

    Showing a saved draft of your edits, you can '.$discard.'.

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

    Showing a saved draft of your edits, you can %s.

    ', + $discard)); } else { $content_text = $content->getContent(); $draft_note = null; diff --git a/src/applications/repository/controller/PhabricatorRepositoryController.php b/src/applications/repository/controller/PhabricatorRepositoryController.php index 1f58eca9a4..cf4f986d60 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryController.php @@ -41,10 +41,10 @@ abstract class PhabricatorRepositoryController extends PhabricatorController { ), 'Diffusion User Guide'); - $common = + $common = hsprintf( "Without this daemon, Phabricator will not be able to import or update ". - "repositories. For instructions on starting the daemon, see ". - "{$documentation}."; + "repositories. For instructions on starting the daemon, see %s.", + phutil_tag('strong', array(), $documentation)); try { $daemon_running = $this->isPullDaemonRunning(); @@ -52,17 +52,17 @@ abstract class PhabricatorRepositoryController extends PhabricatorController { return null; } $title = "Repository Daemon Not Running"; - $message = - "

    The repository daemon is not running on this machine. ". - "{$common}

    "; + $message = hsprintf( + "

    The repository daemon is not running on this machine. %s

    ", + $common); } catch (Exception $ex) { $title = "Unable To Verify Repository Daemon"; - $message = + $message = hsprintf( "

    Unable to determine if the repository daemon is running on this ". - "machine. {$common}

    ". - "

    Exception: ". - phutil_escape_html($ex->getMessage()). - "

    "; + "machine. %s

    ". + "

    Exception: %s

    ", + $common, + $ex->getMessage()); } $view = new AphrontErrorView(); diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index cbf2574e4c..4a6074a7e8 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -94,8 +94,7 @@ final class PhabricatorRepositoryEditController $error_view = new AphrontErrorView(); $error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error_view->setTitle('Changes Saved'); - $error_view->appendChild( - 'Repository changes were saved.'); + $error_view->appendChild('Repository changes were saved.'); } $encoding_doc_link = PhabricatorEnv::getDoclink( diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelAccount.php b/src/applications/settings/panel/PhabricatorSettingsPanelAccount.php index 72b58dae2a..a913330530 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelAccount.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelAccount.php @@ -51,7 +51,8 @@ final class PhabricatorSettingsPanelAccount $notice = new AphrontErrorView(); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setTitle('Changes Saved'); - $notice->appendChild('

    Your changes have been saved.

    '); + $notice->appendChild( + phutil_tag('p', array(), 'Your changes have been saved.')); $notice = $notice->render(); } } else { diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php index bdcfd8cada..a80a32d222 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php @@ -53,10 +53,12 @@ final class PhabricatorSettingsPanelConduit $notice = new AphrontErrorView(); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setTitle('Certificate Regenerated'); - $notice->appendChild( - '

    Your old certificate has been destroyed and you have been issued '. + $notice->appendChild(phutil_tag( + 'p', + array(), + 'Your old certificate has been destroyed and you have been issued '. 'a new certificate. Sessions established under the old certificate '. - 'are no longer valid.

    '); + 'are no longer valid.')); $notice = $notice->render(); } else { $notice = null; diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php index dadca328a6..f3e3c55c2a 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php @@ -72,7 +72,8 @@ final class PhabricatorSettingsPanelEmailPreferences $notice = new AphrontErrorView(); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setTitle('Changes Saved'); - $notice->appendChild('

    Your changes have been saved.

    '); + $notice->appendChild( + phutil_tag('p', array(), 'Your changes have been saved.')); } } else { $notice = new AphrontErrorView(); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php b/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php index e7d6e69879..b6d79811ec 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php @@ -114,7 +114,8 @@ final class PhabricatorSettingsPanelPassword $notice = new AphrontErrorView(); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setTitle('Changes Saved'); - $notice->appendChild('

    Your password has been updated.

    '); + $notice->appendChild( + phutil_tag('p', array(), 'Your password has been updated.')); } } else { $notice = new AphrontErrorView(); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php index 358ab27438..d78cbbcd6a 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php @@ -119,7 +119,8 @@ final class PhabricatorSettingsPanelProfile $error_view = new AphrontErrorView(); $error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error_view->setTitle('Changes Saved'); - $error_view->appendChild('

    Your changes have been saved.

    '); + $error_view->appendChild( + phutil_tag('p', array(), 'Your changes have been saved.')); $error_view = $error_view->render(); } } diff --git a/src/view/form/AphrontErrorView.php b/src/view/form/AphrontErrorView.php index 06fa19ceb7..cd97ff6a2f 100644 --- a/src/view/form/AphrontErrorView.php +++ b/src/view/form/AphrontErrorView.php @@ -92,7 +92,10 @@ final class AphrontErrorView extends AphrontView { $classes[] = 'aphront-error-severity-'.$this->severity; $classes = implode(' ', $classes); - return phutil_render_tag( + $children = $this->renderHTMLChildren(); + $children[] = $list; + + return phutil_tag( 'div', array( 'id' => $this->id, @@ -100,13 +103,12 @@ final class AphrontErrorView extends AphrontView { ), array( $title, - phutil_render_tag( + phutil_tag( 'div', array( 'class' => 'aphront-error-view-body', ), - $this->renderChildren(). - $list), + $children), )); } } diff --git a/src/view/layout/PhabricatorObjectItemListView.php b/src/view/layout/PhabricatorObjectItemListView.php index 4ae41564ca..cc9abb01a4 100644 --- a/src/view/layout/PhabricatorObjectItemListView.php +++ b/src/view/layout/PhabricatorObjectItemListView.php @@ -53,7 +53,7 @@ final class PhabricatorObjectItemListView extends AphrontView { $string = nonempty($this->noDataString, pht('No data.')); $items = id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NODATA) - ->appendChild(phutil_escape_html($string)); + ->appendChild($string); } $pager = null; diff --git a/src/view/layout/PhabricatorPinboardView.php b/src/view/layout/PhabricatorPinboardView.php index a776025c20..f62a2be459 100644 --- a/src/view/layout/PhabricatorPinboardView.php +++ b/src/view/layout/PhabricatorPinboardView.php @@ -22,7 +22,7 @@ final class PhabricatorPinboardView extends AphrontView { $string = nonempty($this->noDataString, pht('No data.')); return id(new AphrontErrorView()) ->setSeverity(AphrontErrorView::SEVERITY_NODATA) - ->appendChild(phutil_escape_html($string)) + ->appendChild($string) ->render(); } -- 2.51.2 From 85961c8eca78947cbc5fbd0c0dbb3703ceb4b944 Mon Sep 17 00:00:00 2001 From: vrana Date: Wed, 6 Feb 2013 17:13:50 -0800 Subject: [PATCH 46/50] Convert AphrontFormInsetView to safe HTML Summary: Done by searching for `AphrontFormInsetView` and verifying all method calls. Test Plan: /repository/edit/1/tracking/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4845 --- .../PhabricatorRepositoryEditController.php | 54 ++++++++++--------- src/view/form/AphrontFormInsetView.php | 26 ++++----- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index 4a6074a7e8..f995c97229 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -401,28 +401,30 @@ final class PhabricatorRepositoryEditController $uri_label = 'Repository URI'; if ($has_local) { if ($is_git) { - $instructions = + $instructions = hsprintf( 'Enter the URI to clone this repository from. It should look like '. 'git@github.com:example/example.git, '. 'ssh://user@host.com/git/example.git, or '. - 'file:///local/path/to/repo'; + 'file:///local/path/to/repo'); } else if ($is_mercurial) { - $instructions = + $instructions = hsprintf( 'Enter the URI to clone this repository from. It should look '. - 'something like ssh://user@host.com/hg/example'; + 'something like ssh://user@host.com/hg/example'); } - $inset->appendChild( - '

    '.$instructions.'

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

    %s

    ', + $instructions)); } else if ($is_svn) { - $instructions = + $instructions = hsprintf( 'Enter the Repository Root for this SVN repository. '. 'You can figure this out by running svn info and looking at '. 'the value in the Repository Root field. It should be a URI '. 'and look like http://svn.example.org/svn/, '. 'svn+ssh://svn.example.com/svnroot/, or '. - 'svn://svn.example.net/svn/'; - $inset->appendChild( - '

    '.$instructions.'

    '); + 'svn://svn.example.net/svn/'); + $inset->appendChild(hsprintf( + '

    %s

    ', + $instructions)); $uri_label = 'Repository Root'; } @@ -435,12 +437,12 @@ final class PhabricatorRepositoryEditController ->setValue($repository->getDetail('remote-uri')) ->setError($e_uri)); - $inset->appendChild( + $inset->appendChild(hsprintf( '
    '. 'If you want to connect to this repository over SSH, enter the '. 'username and private key to use. You can leave these fields blank if '. 'the repository does not use SSH.'. - '
    '); + '
    ')); $inset ->appendChild( @@ -469,14 +471,14 @@ final class PhabricatorRepositoryEditController if ($has_auth_support) { $inset - ->appendChild( + ->appendChild(hsprintf( '
    '. 'If you want to connect to this repository with a username and '. 'password, such as over HTTP Basic Auth or SVN with SASL, '. 'enter the username and password to use. You can leave these '. 'fields blank if the repository does not use a username and '. 'password for authentication.'. - '
    ') + '
    ')) ->appendChild( id(new AphrontFormTextControl()) ->setName('http-login') @@ -490,18 +492,18 @@ final class PhabricatorRepositoryEditController } $inset - ->appendChild( + ->appendChild(hsprintf( '
    '. 'To test your authentication configuration, save this '. 'form and then run this script:'. ''. - 'phabricator/ $ ./scripts/repository/test_connection.php '. - phutil_escape_html($repository->getCallsign()). + 'phabricator/ $ ./scripts/repository/test_connection.php %s'. ''. 'This will verify that your configuration is correct and the '. 'daemons can connect to the remote repository and pull changes '. 'from it.'. - '
    '); + '
    ', + $repository->getCallsign())); $form->appendChild($inset); @@ -515,12 +517,14 @@ final class PhabricatorRepositoryEditController if (!$repository->getDetail('remote-uri') && $default) { $default_local_path = $default.strtolower($repository->getCallsign()); } - $inset->appendChild( + $inset->appendChild(hsprintf( '

    Select a path on local disk '. - 'which the daemons should '.$clone_command.' the repository '. - 'into. This must be readable and writable by the daemons, and '. - 'readable by the webserver. The daemons will '.$fetch_command. - ' and keep this repository up to date.

    '); + 'which the daemons should %s the repository into. This must '. + 'be readable and writable by the daemons, and readable by the '. + 'webserver. The daemons will %s and keep this repository up '. + 'to date.

    ', + $clone_command, + $fetch_command)); $inset->appendChild( id(new AphrontFormTextControl()) ->setName('path') @@ -528,12 +532,12 @@ final class PhabricatorRepositoryEditController ->setValue($repository->getDetail('local-path', $default_local_path)) ->setError($e_path)); } else if ($is_svn) { - $inset->appendChild( + $inset->appendChild(hsprintf( '

    If you only want to parse one '. 'subpath of the repository, specify it here, relative to the '. 'repository root (e.g., trunk/ or projects/wheel/). '. 'If you want to parse multiple subdirectories, create a separate '. - 'Phabricator repository for each one.

    '); + 'Phabricator repository for each one.

    ')); $inset->appendChild( id(new AphrontFormTextControl()) ->setName('svn-subpath') diff --git a/src/view/form/AphrontFormInsetView.php b/src/view/form/AphrontFormInsetView.php index 185e5ead19..014cdfffdd 100644 --- a/src/view/form/AphrontFormInsetView.php +++ b/src/view/form/AphrontFormInsetView.php @@ -48,11 +48,7 @@ final class AphrontFormInsetView extends AphrontView { public function render() { - $title = $hidden_inputs = $right_button = $desc = $content = ''; - - if ($this->title) { - $title = '

    '.phutil_escape_html($this->title).'

    '; - } + $right_button = $desc = ''; $hidden_inputs = array(); foreach ($this->hidden as $inp) { @@ -65,7 +61,6 @@ final class AphrontFormInsetView extends AphrontView { 'value' => $value, )); } - $hidden_inputs = implode("\n", $hidden_inputs); if ($this->rightButton) { $right_button = phutil_tag( @@ -83,7 +78,7 @@ final class AphrontFormInsetView extends AphrontView { $this->description); if ($right_button) { - $desc .= '
    '; + $desc = hsprintf('%s
    ', $desc); } } @@ -95,13 +90,20 @@ final class AphrontFormInsetView extends AphrontView { $div_attributes['class'] = implode(' ', $classes); + $content = $hidden_inputs; + $content[] = $right_button; + $content[] = $desc; + + if ($this->title != '') { + array_unshift($content, phutil_tag('h1', array(), $this->title)); + } + if ($this->content) { - $content = $this->content; + $content[] = $this->content; } - return $title.phutil_render_tag( - 'div', - $div_attributes, - $hidden_inputs.$right_button.$desc.$content.$this->renderChildren()); + $content = array_merge($content, $this->renderHTMLChildren()); + + return phutil_tag('div', $div_attributes, $content); } } -- 2.51.2 From afc5333bb3aad03367ecfa87080432549e5c3c9e Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 7 Feb 2013 14:39:04 -0800 Subject: [PATCH 47/50] Convert AphrontFormView to safe HTML Summary: Searched for `AphrontFormView` and then for `appendChild()`. Test Plan: /login/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4855 --- .../controller/PhabricatorLoginController.php | 32 ++++++------ .../PhabricatorConduitConsoleController.php | 4 +- .../DifferentialDiffCreateController.php | 15 +++--- .../HeraldTestConsoleController.php | 4 +- .../ManiphestBatchEditController.php | 2 +- .../maniphest/view/ManiphestTaskListView.php | 2 +- .../PhabricatorMetaMTAReceiveController.php | 7 ++- .../PhabricatorMetaMTASendController.php | 11 ++-- .../PhabricatorPeopleEditController.php | 24 ++++----- ...habricatorProjectProfileEditController.php | 4 +- .../PhabricatorRepositoryCreateController.php | 4 +- .../PhabricatorRepositoryEditController.php | 14 ++--- .../panel/PhabricatorSettingsPanelConduit.php | 8 +-- ...abricatorSettingsPanelEmailPreferences.php | 4 +- .../panel/PhabricatorSettingsPanelLDAP.php | 11 ++-- .../panel/PhabricatorSettingsPanelOAuth.php | 51 +++++++++++-------- .../panel/PhabricatorSettingsPanelProfile.php | 4 +- .../PhabricatorSlowvoteCreateController.php | 4 +- .../PhabricatorSlowvotePollController.php | 5 +- 19 files changed, 111 insertions(+), 99 deletions(-) diff --git a/src/applications/auth/controller/PhabricatorLoginController.php b/src/applications/auth/controller/PhabricatorLoginController.php index 7918b1cff8..23de5e7f2d 100644 --- a/src/applications/auth/controller/PhabricatorLoginController.php +++ b/src/applications/auth/controller/PhabricatorLoginController.php @@ -243,22 +243,21 @@ final class PhabricatorLoginController // CSRF for logged-out users is vaugely tricky. if ($provider->isProviderRegistrationEnabled()) { - $title = pht("Login or Register with %s", - phutil_escape_html($provider_name)); + $title = pht("Login or Register with %s", $provider_name); $body = pht('Login or register for Phabricator using your %s account.', - phutil_escape_html($provider_name)); + $provider_name); $button = pht("Login or Register with %s", phutil_escape_html($provider_name)); } else { - $title = pht("Login with %s", - phutil_escape_html($provider_name)); - $body = pht('Login to your existing Phabricator account using your '. - '%s account.', phutil_escape_html($provider_name)). - '

    '. - ''. - pht('You can not use %s to register a new account.', - phutil_escape_html($provider_name)). - ''; + $title = pht("Login with %s", $provider_name); + $body = hsprintf( + '%s

    %s', + pht( + 'Login to your existing Phabricator account using your %s account.', + $provider_name), + pht( + 'You can not use %s to register a new account.', + $provider_name)); $button = pht("Log in with %s", phutil_escape_html($provider_name)); } @@ -276,8 +275,9 @@ final class PhabricatorLoginController $auth_form ->setUser($request->getUser()) ->setMethod('GET') - ->appendChild( - '

    '.$body.'

    ') + ->appendChild(hsprintf( + '

    %s

    ', + $body)) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue("{$button} \xC2\xBB")); @@ -289,9 +289,9 @@ final class PhabricatorLoginController $panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setNoBackground(); foreach ($forms as $name => $form) { - $panel->appendChild('

    '.$name.'

    '); + $panel->appendChild(phutil_tag('h1', array(), $name)); $panel->appendChild($form); - $panel->appendChild('
    '); + $panel->appendChild(phutil_tag('br')); } $login_message = PhabricatorEnv::getEnvConfig('auth.login-message'); diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php index 43a645e4d1..8e7f2bec39 100644 --- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php @@ -80,10 +80,10 @@ final class PhabricatorConduitConsoleController id(new AphrontFormMarkupControl()) ->setLabel('Errors') ->setValue($error_description)) - ->appendChild( + ->appendChild(hsprintf( '

    Enter parameters using '. 'JSON. For instance, to enter a list, type: '. - '["apple", "banana", "cherry"]'); + '["apple", "banana", "cherry"]')); $params = $method_object->defineParamTypes(); foreach ($params as $param => $desc) { diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php index 054e69cb90..b141bcb17d 100644 --- a/src/applications/differential/controller/DifferentialDiffCreateController.php +++ b/src/applications/differential/controller/DifferentialDiffCreateController.php @@ -41,12 +41,15 @@ final class DifferentialDiffCreateController extends DifferentialController { ->setAction('/differential/diff/create/') ->setEncType('multipart/form-data') ->setUser($request->getUser()) - ->appendChild( - '

    '.pht('The best way to create '. - 'a Differential diff is by using %s, but you '. - 'can also just paste a diff (e.g., from svn diff or '. - 'git diff) into this box or upload it as a file if you '. - 'really want.', $arcanist_link).'

    ') + ->appendChild(hsprintf( + '

    %s

    ', + pht( + 'The best way to create a Differential diff is by using %s, but you '. + 'can also just paste a diff (e.g., from %s or %s) into this box '. + 'or upload it as a file if you really want.', + $arcanist_link, + phutil_tag('tt', array(), 'svn diff'), + phutil_tag('tt', array(), 'git diff')))) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel(pht('Raw Diff')) diff --git a/src/applications/herald/controller/HeraldTestConsoleController.php b/src/applications/herald/controller/HeraldTestConsoleController.php index 8856c879c4..f0225d7081 100644 --- a/src/applications/herald/controller/HeraldTestConsoleController.php +++ b/src/applications/herald/controller/HeraldTestConsoleController.php @@ -96,11 +96,11 @@ final class HeraldTestConsoleController extends HeraldController { $form = id(new AphrontFormView()) ->setUser($user) - ->appendChild( + ->appendChild(hsprintf( '

    Enter an object to test rules '. 'for, like a Diffusion commit (e.g., rX123) or a '. 'Differential revision (e.g., D123). You will be shown the '. - 'results of a dry run on the object.

    ') + 'results of a dry run on the object.

    ')) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('Object Name')) diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php index 6e1b533e45..7ecd0db24c 100644 --- a/src/applications/maniphest/controller/ManiphestBatchEditController.php +++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php @@ -96,7 +96,7 @@ final class ManiphestBatchEditController extends ManiphestController { 'name' => 'actions', 'id' => 'batch-form-actions', ))); - $form->appendChild('

    These tasks will be edited:

    '); + $form->appendChild(phutil_tag('p', array(), 'These tasks will be edited:')); $form->appendChild($list); $form->appendChild( id(new AphrontFormInsetView()) diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php index b27beeb633..f808ab9104 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 implode("\n", $views); + return $this->renderHTMLView($views); } } diff --git a/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php index ccf1410f39..fde8a1d468 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTAReceiveController.php @@ -49,10 +49,9 @@ final class PhabricatorMetaMTAReceiveController $form->setUser($request->getUser()); $form->setAction($this->getApplicationURI('/receive/')); $form - ->appendChild( - '

    '. - pht('This form will simulate sending mail to an object.'). - '

    ') + ->appendChild(hsprintf( + '

    %s

    ', + pht('This form will simulate sending mail to an object.'))) ->appendChild( id(new AphrontFormTextControl()) ->setLabel(pht('To')) diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php index bd423186cd..0540ff189f 100644 --- a/src/applications/metamta/controller/PhabricatorMetaMTASendController.php +++ b/src/applications/metamta/controller/PhabricatorMetaMTASendController.php @@ -55,11 +55,12 @@ final class PhabricatorMetaMTASendController 'target' => '_blank', ), pht('Configuring Outbound Email')); - $instructions = - '

    '. - pht('This form will send a normal email using the settings you have '. - 'configured for Phabricator. For more information, see %s.', $doclink). - '

    '; + $instructions = hsprintf( + '

    %s

    ', + pht( + 'This form will send a normal email using the settings you have '. + 'configured for Phabricator. For more information, see %s.', + $doclink)); $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter'); $warning = null; diff --git a/src/applications/people/controller/PhabricatorPeopleEditController.php b/src/applications/people/controller/PhabricatorPeopleEditController.php index bedf1b43fa..78100bf21d 100644 --- a/src/applications/people/controller/PhabricatorPeopleEditController.php +++ b/src/applications/people/controller/PhabricatorPeopleEditController.php @@ -393,9 +393,9 @@ final class PhabricatorPeopleEditController ->setAction($request->getRequestURI()->alter('saved', null)); if ($is_self) { - $form->appendChild( + $form->appendChild(hsprintf( '

    NOTE: You can not edit your own '. - 'role.

    '); + 'role.

    ')); } $form @@ -448,10 +448,10 @@ final class PhabricatorPeopleEditController $form ->setUser($admin) ->setAction($request->getRequestURI()) - ->appendChild( + ->appendChild(hsprintf( '

    You can use this certificate '. 'to write scripts or bots which interface with Phabricator over '. - 'Conduit.

    '); + 'Conduit.

    ')); if ($user->getIsSystemAgent()) { $form @@ -530,7 +530,7 @@ final class PhabricatorPeopleEditController $form ->setUser($admin) ->setAction($request->getRequestURI()) - ->appendChild( + ->appendChild(hsprintf( '

    '. 'Be careful when renaming users! '. 'The old username will no longer be tied to the user, so anything '. @@ -549,7 +549,7 @@ final class PhabricatorPeopleEditController 'after their username is changed (their username is part of the '. 'salt in the password hash). They will receive an email with '. 'instructions on how to do this.'. - '

    ') + '

    ')) ->appendChild( id(new AphrontFormStaticControl()) ->setLabel('Old Username') @@ -622,7 +622,7 @@ final class PhabricatorPeopleEditController $form ->setUser($admin) ->setAction($request->getRequestURI()) - ->appendChild( + ->appendChild(hsprintf( '

    '. 'Be careful when deleting users! '. 'If this user interacted with anything, it is generally better '. @@ -636,7 +636,7 @@ final class PhabricatorPeopleEditController 'It is generally safe to delete newly created users (and test users '. 'and so on), but less safe to delete established users. If '. 'possible, disable them instead.'. - '

    ') + '

    ')) ->appendChild( id(new AphrontFormStaticControl()) ->setLabel('Username') @@ -670,11 +670,11 @@ final class PhabricatorPeopleEditController ), 'User Guide: Account Roles'); - return + return hsprintf( '

    '. - 'For a detailed explanation of account roles, see '. - $roles_link.'.'. - '

    '; + 'For a detailed explanation of account roles, see %s.'. + '

    ', + $roles_link); } } diff --git a/src/applications/project/controller/PhabricatorProjectProfileEditController.php b/src/applications/project/controller/PhabricatorProjectProfileEditController.php index fcdcb34942..83bdf90a59 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileEditController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileEditController.php @@ -168,10 +168,10 @@ final class PhabricatorProjectProfileEditController ->setLabel('Blurb') ->setName('blurb') ->setValue($profile->getBlurb())) - ->appendChild( + ->appendChild(hsprintf( '

    NOTE: Policy settings are not '. 'yet fully implemented. Some interfaces still ignore these settings, '. - 'particularly "Visible To".

    ') + 'particularly "Visible To".

    ')) ->appendChild( id(new AphrontFormPolicyControl()) ->setUser($user) diff --git a/src/applications/repository/controller/PhabricatorRepositoryCreateController.php b/src/applications/repository/controller/PhabricatorRepositoryCreateController.php index 698e3105c7..179ad55f41 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryCreateController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryCreateController.php @@ -78,11 +78,11 @@ final class PhabricatorRepositoryCreateController ->setValue($repository->getName()) ->setError($e_name) ->setCaption('Human-readable repository name.')) - ->appendChild( + ->appendChild(hsprintf( '

    Select a "Callsign" — a '. 'short, uppercase string to identify revisions in this repository. If '. 'you choose "EX", revisions in this repository will be identified '. - 'with the prefix "rEX".

    ') + 'with the prefix "rEX".

    ')) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Callsign') diff --git a/src/applications/repository/controller/PhabricatorRepositoryEditController.php b/src/applications/repository/controller/PhabricatorRepositoryEditController.php index f995c97229..0a1a0ca364 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryEditController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryEditController.php @@ -122,16 +122,15 @@ final class PhabricatorRepositoryEditController ->setLabel('Callsign') ->setName('callsign') ->setValue($repository->getCallsign())) - ->appendChild(' + ->appendChild(hsprintf('

    '. 'If source code in this repository uses a character '. 'encoding other than UTF-8 (for example, ISO-8859-1), '. 'specify it here. You can usually leave this field blank. '. 'See User Guide: '. - ''. - 'UTF-8 and Character Encoding'. - ' for more information.'. - '

    ') + 'UTF-8 and Character Encoding for more information.'. + '

    ', + $encoding_doc_link)) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Encoding') @@ -358,13 +357,14 @@ final class PhabricatorRepositoryEditController $form ->setUser($user) ->setAction('/repository/edit/'.$repository->getID().'/tracking/') - ->appendChild( + ->appendChild(hsprintf( '

    Phabricator can track '. 'repositories, importing commits as they happen and notifying '. 'Differential, Diffusion, Herald, and other services. To enable '. 'tracking for a repository, configure it here and then start (or '. 'restart) the daemons. More information is available in the '. - ''.$user_guide_link.'.

    '); + '%s.

    ', + $user_guide_link)); $form ->appendChild( diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php index a80a32d222..d4ccec4194 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelConduit.php @@ -67,10 +67,10 @@ final class PhabricatorSettingsPanelConduit $cert_form = new AphrontFormView(); $cert_form ->setUser($user) - ->appendChild( + ->appendChild(hsprintf( '

    This certificate allows you to '. 'authenticate over Conduit, the Phabricator API. Normally, you just '. - 'run arc install-certificate to install it.') + 'run arc install-certificate to install it.')) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel('Certificate') @@ -87,10 +87,10 @@ final class PhabricatorSettingsPanelConduit ->setUser($user) ->setAction($this->getPanelURI()) ->setWorkflow(true) - ->appendChild( + ->appendChild(hsprintf( '

    You can regenerate this '. 'certificate, which will invalidate the old certificate and create '. - 'a new one.

    ') + 'a new one.

    ')) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue('Regenerate Certificate')); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php index f3e3c55c2a..58d913db95 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php @@ -165,7 +165,7 @@ final class PhabricatorSettingsPanelEmailPreferences 'break threading in some clients.')); $form - ->appendChild( + ->appendChild(hsprintf( '
    '. '

    '. 'You can customize what mail you receive from Phabricator here.'. @@ -176,7 +176,7 @@ final class PhabricatorSettingsPanelEmailPreferences 'still receive an email as long as at least one of the changes '. 'is set to notify you.'. '

    ' - ); + )); $mailtags = $preferences->getPreference('mailtags', array()); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php b/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php index ebff08540a..25df530fdb 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php @@ -35,10 +35,11 @@ final class PhabricatorSettingsPanelLDAP $unlink_form ->setUser($user) ->setAction('/ldap/login/') - ->appendChild( + ->appendChild(hsprintf( '

    There is currently no '. - 'LDAP account linked to your Phabricator account. You can link an ' . - 'account, which will allow you to use it to log into Phabricator

    ') + 'LDAP account linked to your Phabricator account. You can link an '. + 'account, which will allow you to use it to log into Phabricator.'. + '

    ')) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('LDAP username') @@ -57,10 +58,10 @@ final class PhabricatorSettingsPanelLDAP $unlink_form = new AphrontFormView(); $unlink_form ->setUser($user) - ->appendChild( + ->appendChild(hsprintf( '

    You may unlink this account '. 'from your LDAP account. This will prevent you from logging in with '. - 'your LDAP credentials.

    ') + 'your LDAP credentials.

    ')) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/ldap/unlink/', $unlink)); diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php b/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php index 41565afbdb..b95640ba48 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php @@ -84,11 +84,12 @@ final class PhabricatorSettingsPanelOAuth $forms[] = $form; if (!$oauth_info) { $form - ->appendChild( - '

    There is currently no '. - phutil_escape_html($provider_name).' account linked to your '. - 'Phabricator account. You can link an account, which will allow you '. - 'to use it to log into Phabricator.

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

    There is currently no %s '. + 'account linked to your Phabricator account. You can link an '. + 'account, which will allow you to use it to log into Phabricator.'. + '

    ', + $provider_name)); $this->prepareAuthForm($form); @@ -100,11 +101,12 @@ final class PhabricatorSettingsPanelOAuth $expires = $oauth_info->getTokenExpires(); $form - ->appendChild( + ->appendChild(hsprintf( '

    Your account is linked with '. - 'a '.phutil_escape_html($provider_name).' account. You may use your '. - phutil_escape_html($provider_name).' credentials to log into '. - 'Phabricator.

    ') + 'a %s account. You may use your %s credentials to log into '. + 'Phabricator.

    ', + $provider_name, + $provider_name)) ->appendChild( id(new AphrontFormStaticControl()) ->setLabel($provider_name.' ID') @@ -133,11 +135,12 @@ final class PhabricatorSettingsPanelOAuth $unlink_form = new AphrontFormView(); $unlink_form ->setUser($user) - ->appendChild( + ->appendChild(hsprintf( '

    You may unlink this account '. - 'from your '.phutil_escape_html($provider_name).' account. This '. - 'will prevent you from logging in with your '. - phutil_escape_html($provider_name).' credentials.

    ') + 'from your %s account. This will prevent you from logging in '. + 'with your %s credentials.

    ', + $provider_name, + $provider_name)) ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/oauth/'.$provider_key.'/unlink/', $unlink)); @@ -165,18 +168,22 @@ final class PhabricatorSettingsPanelOAuth $rappable_status = PhabricatorUserOAuthInfo::getRappableTokenStatus( $status); $beat = self::getBeat(); - $rap = $beat . "Yo yo yo
    ". + $rap = hsprintf( + "%s Yo yo yo
    ". 'My name\'s DJ Token and I\'m here to say
    '. // pronounce as "dollar rappable status" for meter to work - "$rappable_status, hey hey hey hey
    ". + "%s, hey hey hey hey
    ". 'I rap \'bout tokens, that might be why
    '. - 'I\'m such a cool and popular guy'; + 'I\'m such a cool and popular guy', + $beat, + $rappable_status); $token_form = new AphrontFormView(); $token_form ->setUser($user) - ->appendChild( - '

    '.$rap.'

    ') + ->appendChild(hsprintf( + '

    %s

    ', + $rap)) ->appendChild( id(new AphrontFormStaticControl()) ->setLabel('Token Status') @@ -282,12 +289,12 @@ final class PhabricatorSettingsPanelOAuth private static function getBeat() { // Gangsta's Paradise (karaoke version). // Chosen because it's the only thing I listen to. - $song_id = "Gangsta\\'s Paradise"; + $song_id = "Gangsta's Paradise"; // Make a musical note which you can click for the beat. - $beat = '♫ '; + $beat = hsprintf( + '♫', + jsprintf('alert(%s); return 0;', "Think about {$song_id}.")); return $beat; } } diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php index d78cbbcd6a..a668967dba 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php @@ -182,10 +182,10 @@ final class PhabricatorSettingsPanelProfile 'href' => $profile_uri, ), $profile_uri))) - ->appendChild( + ->appendChild(hsprintf( '

    Write something about yourself! '. 'Make sure to include important information like '. - 'your favorite Pokemon and which Starcraft race you play.

    ') + 'your favorite Pokemon and which Starcraft race you play.

    ')) ->appendChild( id(new AphrontFormTextAreaControl()) ->setLabel('Blurb') diff --git a/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php b/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php index 3f3d5f1b6d..9ffa72245f 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvoteCreateController.php @@ -65,9 +65,9 @@ final class PhabricatorSlowvoteCreateController $form = id(new AphrontFormView()) ->setUser($user) - ->appendChild( + ->appendChild(hsprintf( '

    Resolve issues and build '. - 'consensus through protracted deliberation.

    ') + 'consensus through protracted deliberation.

    ')) ->appendChild( id(new AphrontFormTextControl()) ->setLabel('Question') diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 9440e476b4..95938fa958 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -158,8 +158,9 @@ final class PhabricatorSlowvotePollController $form = id(new AphrontFormView()) ->setUser($user) - ->appendChild( - '

    '.$instructions.'

    ') + ->appendChild(hsprintf( + '

    %s

    ', + $instructions)) ->appendChild( id(new AphrontFormMarkupControl()) ->setLabel('Vote') -- 2.51.2 From 7dd19ba93fb60001b859f070359c640bc340af7c Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 7 Feb 2013 15:18:34 -0800 Subject: [PATCH 48/50] Convert AphrontFormLayoutView to safe HTML Summary: Searched for `AphrontFormLayoutView` and then `appendChild()`. Test Plan: /V1 Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4856 --- .../PhabricatorFlagEditController.php | 7 +-- .../ponder/view/PonderAddCommentView.php | 2 +- .../PhabricatorSlowvotePollController.php | 50 ++++++++++--------- src/view/form/AphrontFormLayoutView.php | 4 +- src/view/form/AphrontFormView.php | 6 +-- 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/applications/flag/controller/PhabricatorFlagEditController.php b/src/applications/flag/controller/PhabricatorFlagEditController.php index 17adca8be9..e8f02dc951 100644 --- a/src/applications/flag/controller/PhabricatorFlagEditController.php +++ b/src/applications/flag/controller/PhabricatorFlagEditController.php @@ -52,9 +52,10 @@ final class PhabricatorFlagEditController extends PhabricatorFlagController { if ($is_new) { $form - ->appendChild( - "

    You can flag this {$type_name} if you want to remember to look ". - "at it later.


    "); + ->appendChild(hsprintf( + "

    You can flag this %s if you want to remember to look ". + "at it later.


    ", + $type_name)); } $radio = new AphrontFormRadioButtonControl(); diff --git a/src/applications/ponder/view/PonderAddCommentView.php b/src/applications/ponder/view/PonderAddCommentView.php index f23f624df7..ba26fe961e 100644 --- a/src/applications/ponder/view/PonderAddCommentView.php +++ b/src/applications/ponder/view/PonderAddCommentView.php @@ -45,7 +45,7 @@ final class PonderAddCommentView extends AphrontView { $view = id(new AphrontMoreView()) ->setSome('') - ->setMore(phutil_safe_html($form->render())) + ->setMore($form->render()) ->setExpandText('Add Comment'); return $view->render(); diff --git a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php index 95938fa958..44b3a06d5d 100644 --- a/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php +++ b/src/applications/slowvote/controller/PhabricatorSlowvotePollController.php @@ -208,19 +208,19 @@ final class PhabricatorSlowvotePollController require_celerity_resource('phabricator-remarkup-css'); - $comment_markup[] = + $comment_markup[] = hsprintf( ''. ''. - $handle->renderLink(). - '
    '. - phabricator_datetime($comment->getDateCreated(), $viewer). - '
    '. + '%s'. + '
    %s
    '. + ''. ''. - '
    '. - $markup. - '
    '. + '
    %s
    '. ''. - ''; + '', + $handle->renderLink(), + phabricator_datetime($comment->getDateCreated(), $viewer), + $markup); } if ($comment_markup) { @@ -229,7 +229,7 @@ final class PhabricatorSlowvotePollController array( 'class' => 'phabricator-slowvote-comments', ), - new PhutilSafeHTML(implode("\n", $comment_markup))); + $comment_markup); } else { $comment_markup = null; } @@ -373,7 +373,7 @@ final class PhabricatorSlowvotePollController } $result_markup = id(new AphrontFormLayoutView()) - ->appendChild('

    Ongoing Deliberation

    '); + ->appendChild(phutil_tag('h1', array(), 'Ongoing Deliberation')); if (!$can_see_responses) { if ($need_vote) { @@ -382,8 +382,9 @@ final class PhabricatorSlowvotePollController $reason = "The results are not public."; } $result_markup - ->appendChild( - '

    '.$reason.'

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

    %s

    ', + $reason)); return $result_markup; } @@ -414,7 +415,6 @@ final class PhabricatorSlowvotePollController 'src' => $profile_image, ))); } - $user_markup = implode('', $user_markup); } else { $user_markup = 'This option has failed to appeal to anyone.'; } @@ -428,18 +428,20 @@ final class PhabricatorSlowvotePollController $choices, $chosen); - $result_markup->appendChild( + $result_markup->appendChild(hsprintf( '
    '. - '
    '. - $vote_count. - '
    '. - '

    '.phutil_escape_html($option->getName()).'

    '. + '
    %s
    '. + '

    %s

    '. '
    '. - $user_markup. - '
    '. + '%s'. + '
    '. '
    '. - $comment_markup. - '
    '); + '%s'. + '
    ', + $vote_count, + $option->getName(), + phutil_tag('div', array(), $user_markup), + $comment_markup)); } if ($poll->getMethod() == PhabricatorSlowvotePoll::METHOD_APPROVAL && @@ -448,7 +450,7 @@ final class PhabricatorSlowvotePollController $comments, $handles); $result_markup->appendChild( - '

    Motions Proposed for Consideration

    '); + phutil_tag('h1', array(), 'Motions Proposed for Consideration')); $result_markup->appendChild($comment_markup); } diff --git a/src/view/form/AphrontFormLayoutView.php b/src/view/form/AphrontFormLayoutView.php index 5780353475..300c7370e0 100644 --- a/src/view/form/AphrontFormLayoutView.php +++ b/src/view/form/AphrontFormLayoutView.php @@ -33,11 +33,11 @@ final class AphrontFormLayoutView extends AphrontView { $classes = implode(' ', $classes); - return phutil_render_tag( + return phutil_tag( 'div', array( 'class' => $classes, ), - $this->renderChildren()); + $this->renderHTMLChildren()); } } diff --git a/src/view/form/AphrontFormView.php b/src/view/form/AphrontFormView.php index 8b0041f00a..76342830b8 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->renderChildren()); + ->appendChild($this->renderHTMLChildren()); if (!$this->user) { throw new Exception('You must pass the user to AphrontFormView.'); @@ -79,7 +79,7 @@ final class AphrontFormView extends AphrontView { $sigils[] = 'workflow'; } - return phabricator_render_form( + return phabricator_form( $this->user, array( 'class' => $this->flexible ? 'phabricator-form-view' : null, @@ -106,7 +106,7 @@ final class AphrontFormView extends AphrontView { 'value' => $value, )); } - return implode("\n", $inputs); + return $inputs; } } -- 2.51.2 From 138da5a2799646c3293e7336f1bb71a1ed26a2a3 Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 7 Feb 2013 15:57:37 -0800 Subject: [PATCH 49/50] Kill some PhutilSafeHTML Summary: Also couple of unrelated Ponder changes. Test Plan: /Q5 Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4858 --- resources/sql/quickstart.sql | 2 +- .../config/view/PhabricatorSetupIssueView.php | 2 +- .../PhabricatorDirectoryMainController.php | 5 +-- .../PhabricatorApplicationPonder.php | 7 ++-- .../ponder/view/PonderCommentListView.php | 34 +++++++------------ 5 files changed, 22 insertions(+), 28 deletions(-) diff --git a/resources/sql/quickstart.sql b/resources/sql/quickstart.sql index afe0b33d01..3439af6d4e 100644 --- a/resources/sql/quickstart.sql +++ b/resources/sql/quickstart.sql @@ -1666,7 +1666,7 @@ CREATE TABLE `ponder_question` ( UNIQUE KEY `phid` (`phid`), KEY `authorPHID` (`authorPHID`), KEY `heat` (`heat`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11; CREATE DATABASE `{$NAMESPACE}_project` /*!40100 DEFAULT CHARACTER SET utf8 */; diff --git a/src/applications/config/view/PhabricatorSetupIssueView.php b/src/applications/config/view/PhabricatorSetupIssueView.php index a65dae3e63..203a62b81b 100644 --- a/src/applications/config/view/PhabricatorSetupIssueView.php +++ b/src/applications/config/view/PhabricatorSetupIssueView.php @@ -22,7 +22,7 @@ final class PhabricatorSetupIssueView extends AphrontView { array( 'class' => 'setup-issue-instructions', ), - new PhutilSafeHTML(nl2br(phutil_escape_html($issue->getMessage())))); + phutil_escape_html_newlines($issue->getMessage())); $configs = $issue->getPHPConfig(); if ($configs) { diff --git a/src/applications/directory/controller/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/PhabricatorDirectoryMainController.php index 7e823ec8d3..fa4ee538bb 100644 --- a/src/applications/directory/controller/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/PhabricatorDirectoryMainController.php @@ -316,9 +316,10 @@ final class PhabricatorDirectoryMainController array( 'class' => 'phabricator-jump-nav-caption', ), - new PhutilSafeHTML( + hsprintf( 'Enter the name of an object like D123 to quickly jump to '. - 'it. See '.$doc_link.' or type help.')); + 'it. See %s or type help.', + $doc_link)); $panel = new AphrontPanelView(); $panel->setHeader('Jump Nav'); diff --git a/src/applications/ponder/application/PhabricatorApplicationPonder.php b/src/applications/ponder/application/PhabricatorApplicationPonder.php index e83b0fd89d..5fb8ff55aa 100644 --- a/src/applications/ponder/application/PhabricatorApplicationPonder.php +++ b/src/applications/ponder/application/PhabricatorApplicationPonder.php @@ -39,7 +39,7 @@ final class PhabricatorApplicationPonder extends PhabricatorApplication { return true; } - public function getroutes() { + public function getRoutes() { return array( '/Q(?P[1-9]\d*)' => 'PonderQuestionViewController', '/ponder/' => array( @@ -53,7 +53,8 @@ final class PhabricatorApplicationPonder extends PhabricatorApplication { 'comment/add/' => 'PonderCommentSaveController', '(?Pquestion)/vote/' => 'PonderVoteSaveController', '(?Panswer)/vote/' => 'PonderVoteSaveController' - )); + ), + ); } -} +} diff --git a/src/applications/ponder/view/PonderCommentListView.php b/src/applications/ponder/view/PonderCommentListView.php index bef9942aa5..fd08369f57 100644 --- a/src/applications/ponder/view/PonderCommentListView.php +++ b/src/applications/ponder/view/PonderCommentListView.php @@ -51,24 +51,20 @@ final class PonderCommentListView extends AphrontView { $comment->getMarkupField(), $this->user); - $comment_anchor = ''; - $comment_markup[] = + $comment_anchor = ''; + $comment_markup[] = hsprintf( ''. - ''. - $comment_anchor. - ''. + ''. ''. '
    '. - $body. - ' —'. - $handle->renderLink(). - ' '. - ''. - phabricator_datetime($comment->getDateCreated(), $user). - ''. + '%s —%s %s'. '
    '. ''. - ''; + '', + $comment->getID(), + $body, + $handle->renderLink(), + phabricator_datetime($comment->getDateCreated(), $user)); } $addview = id(new PonderAddCommentView) @@ -77,20 +73,16 @@ final class PonderCommentListView extends AphrontView { ->setQuestionID($this->questionID) ->setActionURI($this->actionURI); - $comment_markup[] = - ''. - ' '. - ''.$addview->render().''. - ''; + $comment_markup[] = hsprintf( + ' %s', + $addview->render()); $comment_markup = phutil_tag( 'table', array( 'class' => 'ponder-comments', ), - new PhutilSafeHTML(implode("\n", $comment_markup)) - ); - + $comment_markup); return $comment_markup; } -- 2.51.2 From d817dfa8fcce8ef7a1c3890af4b2ae7e6d8db31b Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 8 Feb 2013 12:07:44 -0800 Subject: [PATCH 50/50] Convert some phutil_escape_html() to hsprintf() Summary: Found by `sgrep_php -e '"...".phutil_escape_html(...)'`. Test Plan: / /D1 /uiexample/ /countdown/1/ /herald/transcript/1/all/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4869 --- ...AphrontDefaultApplicationConfiguration.php | 7 +- .../PhabricatorLoginValidateController.php | 4 +- .../PhabricatorMustVerifyEmailController.php | 2 +- .../PhabricatorOAuthLoginController.php | 42 ++++++---- .../PhabricatorCountdownDeleteController.php | 6 +- .../PhabricatorCountdownViewController.php | 34 ++++---- .../view/PhabricatorDaemonLogEventsView.php | 2 +- .../DifferentialCommentSaveController.php | 2 +- .../DifferentialChangesetHTMLRenderer.php | 55 ++++++------- .../view/DifferentialLocalCommitsView.php | 18 ++--- .../DifferentialRevisionUpdateHistoryView.php | 38 ++++----- .../controller/DivinerListController.php | 10 ++- .../feed/story/PhabricatorFeedStory.php | 5 +- .../PhabricatorFileDeleteController.php | 6 +- ...bricatorHelpKeyboardShortcutController.php | 16 ++-- .../controller/HeraldDeleteController.php | 6 +- .../controller/HeraldTranscriptController.php | 79 +++++++++---------- .../ManiphestSavedQueryDeleteController.php | 8 +- .../PhabricatorOwnersDeleteController.php | 8 +- .../PhabricatorOwnersDetailController.php | 3 +- .../PhabricatorOwnersListController.php | 2 +- .../PhabricatorPeopleProfileController.php | 18 ++--- .../blog/PhameBlogFeedController.php | 53 +++++++------ .../PhrictionDocumentController.php | 27 ++----- .../ponder/view/PonderQuestionSummaryView.php | 23 +++--- .../PhabricatorProjectProfileController.php | 19 +++-- ...ositoryArcanistProjectDeleteController.php | 8 +- .../PhabricatorRepositoryDeleteController.php | 3 +- ...PhabricatorSettingsPanelEmailAddresses.php | 11 +-- .../PhabricatorUIExampleRenderController.php | 16 ++-- .../examples/PhabricatorActionListExample.php | 3 +- .../examples/PhabricatorButtonsExample.php | 2 +- .../examples/PhabricatorErrorExample.php | 4 +- .../examples/PhabricatorFormExample.php | 2 +- .../PhabricatorPropertyListExample.php | 4 +- .../examples/PhabricatorTagExample.php | 2 +- .../examples/PhabricatorTimelineExample.php | 3 +- .../PhabricatorUIListFilterExample.php | 5 +- .../PhabricatorUINotificationExample.php | 2 +- .../examples/PhabricatorUIPagerExample.php | 5 +- .../examples/PhabricatorUITooltipExample.php | 2 +- .../view/PhabricatorInlineSummaryView.php | 13 +-- src/view/AphrontDialogView.php | 4 +- .../PhabricatorObjectSelectorDialog.php | 6 +- .../layout/PhabricatorProfileHeaderView.php | 34 ++++---- src/view/page/AphrontRequestFailureView.php | 2 +- 46 files changed, 299 insertions(+), 325 deletions(-) diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php index 4d18f54528..d175a175ad 100644 --- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php @@ -182,10 +182,9 @@ class AphrontDefaultApplicationConfiguration return $login_controller->processRequest(); } - $content = - '
    '. - phutil_escape_html($ex->getMessage()). - '
    '; + $content = hsprintf( + '
    %s
    ', + $ex->getMessage()); $dialog = new AphrontDialogView(); $dialog diff --git a/src/applications/auth/controller/PhabricatorLoginValidateController.php b/src/applications/auth/controller/PhabricatorLoginValidateController.php index 9423199711..a365618bd8 100644 --- a/src/applications/auth/controller/PhabricatorLoginValidateController.php +++ b/src/applications/auth/controller/PhabricatorLoginValidateController.php @@ -43,9 +43,9 @@ final class PhabricatorLoginValidateController $list = array(); foreach ($failures as $failure) { - $list[] = '
  • '.phutil_escape_html($failure).'
  • '; + $list[] = phutil_tag('li', array(), $failure); } - $list = '
      '.implode("\n", $list).'
    '; + $list = phutil_tag('ul', array(), $list); $view = new AphrontRequestFailureView(); $view->setHeader(pht('Login Failed')); diff --git a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php index 183954eebe..b08f7432cc 100644 --- a/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php +++ b/src/applications/auth/controller/PhabricatorMustVerifyEmailController.php @@ -45,7 +45,7 @@ final class PhabricatorMustVerifyEmailController '

    '. 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_escape_html($email_address)). + 'inbox (%s).', phutil_tag('strong', array(), $email_address)). '

    '); $error_view->appendChild( '

    '. diff --git a/src/applications/auth/controller/PhabricatorOAuthLoginController.php b/src/applications/auth/controller/PhabricatorOAuthLoginController.php index 2a6c9da6e1..dbfcc81810 100644 --- a/src/applications/auth/controller/PhabricatorOAuthLoginController.php +++ b/src/applications/auth/controller/PhabricatorOAuthLoginController.php @@ -69,14 +69,16 @@ final class PhabricatorOAuthLoginController $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Already Linked to Another Account')); - $dialog->appendChild('

    '. + $dialog->appendChild(phutil_tag( + 'p', + array(), pht( 'The %s account you just authorized is already linked to '. 'another Phabricator account. Before you can associate your %s '. 'account with this Phabriactor account, you must unlink it from '. - 'the Phabricator account it is currently linked to.

    ', - phutil_escape_html($provider_name), - phutil_escape_html($provider_name))).'

    '; + 'the Phabricator account it is currently linked to.', + $provider_name, + $provider_name))); $dialog->addCancelButton($provider->getSettingsPanelURI()); return id(new AphrontDialogResponse())->setDialog($dialog); @@ -97,13 +99,15 @@ final class PhabricatorOAuthLoginController $dialog->setUser($current_user); $dialog->setTitle( pht('Already Linked to an Account From This Provider')); - $dialog->appendChild('

    '. + $dialog->appendChild(phutil_tag( + 'p', + array(), pht( 'The account you are logged in with is already linked to a %s '. 'account. Before you can link it to a different %s account, you '. - 'must unlink the old account.

    ', - phutil_escape_html($provider_name), - phutil_escape_html($provider_name))).'

    '; + 'must unlink the old account.', + $provider_name, + $provider_name))); $dialog->addCancelButton($provider->getSettingsPanelURI()); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -170,13 +174,15 @@ final class PhabricatorOAuthLoginController $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('Already Linked to Another Account')); - $dialog->appendChild('

    '. + $dialog->appendChild(phutil_tag( + 'p', + array(), pht( 'The %s account you just authorized has an email address which '. 'is already in use by another Phabricator account. To link the '. 'accounts, log in to your Phabricator account and then go to '. 'Settings.', - phutil_escape_html($provider_name))).'

    '; + $provider_name))); $user = id(new PhabricatorUser()) ->loadOneWhere('phid = %s', $known_email->getUserPHID()); @@ -189,10 +195,12 @@ final class PhabricatorOAuthLoginController $providers[] = PhabricatorOAuthProvider::newProvider($provider) ->getProviderName(); } - $dialog->appendChild( + $dialog->appendChild(phutil_tag( + 'p', + array(), pht( - '

    The account is associated with: %s.

    ', - implode(', ', phutil_escape_html($providers)))); + 'The account is associated with: %s.', + implode(', ', $providers)))); } $dialog->addCancelButton('/login/'); @@ -205,13 +213,15 @@ final class PhabricatorOAuthLoginController $dialog = new AphrontDialogView(); $dialog->setUser($current_user); $dialog->setTitle(pht('No Account Registration with %s', $provider_name)); - $dialog->appendChild('

    '. + $dialog->appendChild(phutil_tag( + 'p', + array(), pht( 'You can not register a new account using %s; you can only use '. 'your %s account to log into an existing Phabricator account which '. 'you have registered through other means.', - phutil_escape_html($provider_name), - phutil_escape_html($provider_name))).'

    '; + $provider_name, + $provider_name))); $dialog->addCancelButton('/login/'); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php index d544723cd2..db1ab235f0 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php @@ -33,9 +33,9 @@ final class PhabricatorCountdownDeleteController $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Really delete this countdown?'); - $dialog->appendChild( - '

    Are you sure you want to delete the countdown "'. - phutil_escape_html($timer->getTitle()).'"?

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

    Are you sure you want to delete the countdown "%s"?

    ', + $timer->getTitle())); $dialog->addSubmitButton('Delete'); $dialog->addCancelButton('/countdown/'); $dialog->setSubmitURI($request->getPath()); diff --git a/src/applications/countdown/controller/PhabricatorCountdownViewController.php b/src/applications/countdown/controller/PhabricatorCountdownViewController.php index 6e084a3835..ed27dfdb58 100644 --- a/src/applications/countdown/controller/PhabricatorCountdownViewController.php +++ b/src/applications/countdown/controller/PhabricatorCountdownViewController.php @@ -32,12 +32,9 @@ final class PhabricatorCountdownViewController $chrome_visible ? pht('Disable Chrome') : pht('Enable Chrome')); $container = celerity_generate_unique_node_id(); - $content = - '
    -

    '. - phutil_escape_html($timer->getTitle()).' · '. - phabricator_datetime($timer->getDatePoint(), $user). - '

    + $content = hsprintf( + '
    +

    %s · %s

    @@ -46,20 +43,19 @@ final class PhabricatorCountdownViewController - '. - javelin_tag('td', - array('sigil' => 'phabricator-timer-days'), ''). - javelin_tag('td', - array('sigil' => 'phabricator-timer-hours'), ''). - javelin_tag('td', - array('sigil' => 'phabricator-timer-minutes'), ''). - javelin_tag('td', - array('sigil' => 'phabricator-timer-seconds'), ''). - ' + %s%s%s%s
    Minutes Seconds
    -
    '. - $chrome_link. - '
    '; +
    + %s +
    ', + $container, + $timer->getTitle(), + phabricator_datetime($timer->getDatePoint(), $user), + javelin_tag('td', array('sigil' => 'phabricator-timer-days'), ''), + javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), ''), + javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), ''), + javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), ''), + $chrome_link); Javelin::initBehavior('countdown-timer', array( 'timestamp' => $timer->getDatepoint(), diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php index 732b3b6a44..e3cdc98779 100644 --- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php +++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php @@ -63,7 +63,7 @@ final class PhabricatorDaemonLogEventsView extends AphrontView { phutil_escape_html($event->getLogType()), phabricator_date($event->getEpoch(), $this->user), phabricator_time($event->getEpoch(), $this->user), - str_replace("\n", '
    ', phutil_escape_html($message.$more)), + phutil_escape_html_newlines($message.$more), ); if ($this->combinedLog) { diff --git a/src/applications/differential/controller/DifferentialCommentSaveController.php b/src/applications/differential/controller/DifferentialCommentSaveController.php index f03b26c01a..d49232bb37 100644 --- a/src/applications/differential/controller/DifferentialCommentSaveController.php +++ b/src/applications/differential/controller/DifferentialCommentSaveController.php @@ -56,7 +56,7 @@ final class DifferentialCommentSaveController extends DifferentialController { $dialog->setTitle(pht('Action Has No Effect')); $dialog->appendChild( - '

    '.phutil_escape_html($no_effect->getMessage()).'

    '); + phutil_tag('p', array(), $no_effect->getMessage())); if (strlen($comment) || $has_inlines) { $dialog->addSubmitButton(pht('Post as Comment')); diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php index 4efe69250a..3032e15cc1 100644 --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -70,10 +70,7 @@ abstract class DifferentialChangesetHTMLRenderer break; case DifferentialChangeType::TYPE_MOVE_HERE: - $from = - "". - phutil_escape_html($changeset->getOldFile()). - ""; + $from = phutil_tag('strong', array(), $changeset->getOldFile()); switch ($file) { case DifferentialChangeType::FILE_TEXT: $message = pht('This file was moved from %s.', $from); @@ -97,10 +94,7 @@ abstract class DifferentialChangesetHTMLRenderer break; case DifferentialChangeType::TYPE_COPY_HERE: - $from = - "". - phutil_escape_html($changeset->getOldFile()). - ""; + $from = phutil_tag('strong', array(), $changeset->getOldFile()); switch ($file) { case DifferentialChangeType::FILE_TEXT: $message = pht('This file was copied from %s.', $from); @@ -124,10 +118,10 @@ abstract class DifferentialChangesetHTMLRenderer break; case DifferentialChangeType::TYPE_MOVE_AWAY: - $paths = - "". - phutil_escape_html(implode(', ', $changeset->getAwayPaths())). - ""; + $paths = phutil_tag( + 'strong', + array(), + implode(', ', $changeset->getAwayPaths())); switch ($file) { case DifferentialChangeType::FILE_TEXT: $message = pht('This file was moved to %s.', $paths); @@ -151,10 +145,10 @@ abstract class DifferentialChangesetHTMLRenderer break; case DifferentialChangeType::TYPE_COPY_AWAY: - $paths = - "". - phutil_escape_html(implode(', ', $changeset->getAwayPaths())). - ""; + $paths = phutil_tag( + 'strong', + array(), + implode(', ', $changeset->getAwayPaths())); switch ($file) { case DifferentialChangeType::FILE_TEXT: $message = pht('This file was copied to %s.', $paths); @@ -178,10 +172,10 @@ abstract class DifferentialChangesetHTMLRenderer break; case DifferentialChangeType::TYPE_MULTICOPY: - $paths = - "". - phutil_escape_html(implode(', ', $changeset->getAwayPaths())). - ""; + $paths = phutil_tag( + 'strong', + array(), + implode(', ', $changeset->getAwayPaths())); switch ($file) { case DifferentialChangeType::FILE_TEXT: $message = pht( @@ -262,23 +256,26 @@ abstract class DifferentialChangesetHTMLRenderer $nval = idx($new, $key); if ($oval !== $nval) { if ($oval === null) { - $oval = 'null'; + $oval = phutil_tag('em', array(), 'null'); } else { - $oval = nl2br(phutil_escape_html($oval)); + $oval = phutil_escape_html_newlines($oval); } if ($nval === null) { - $nval = 'null'; + $nval = phutil_tag('em', array(), 'null'); } else { - $nval = nl2br(phutil_escape_html($nval)); + $nval = phutil_escape_html_newlines($nval); } - $rows[] = + $rows[] = hsprintf( ''. - ''.phutil_escape_html($key).''. - ''.$oval.''. - ''.$nval.''. - ''; + '%s'. + '%s'. + '%s'. + '', + $key, + $oval, + $nval); } } diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php index 6a3cae9439..d1207252d2 100644 --- a/src/applications/differential/view/DifferentialLocalCommitsView.php +++ b/src/applications/differential/view/DifferentialLocalCommitsView.php @@ -54,17 +54,17 @@ final class DifferentialLocalCommitsView extends AphrontView { } else { $commit_hash = null; } - $row[] = ''.phutil_escape_html($commit_hash).''; + $row[] = phutil_tag('td', array(), $commit_hash); if ($has_tree) { $tree = idx($commit, 'tree'); $tree = substr($tree, 0, 16); - $row[] = ''.phutil_escape_html($tree).''; + $row[] = phutil_tag('td', array(), $tree); } if ($has_local) { $local_rev = idx($commit, 'local', null); - $row[] = ''.phutil_escape_html($local_rev).''; + $row[] = phutil_tag('td', array(), $local_rev); } $parents = idx($commit, 'parents', array()); @@ -72,15 +72,15 @@ final class DifferentialLocalCommitsView extends AphrontView { if (is_array($parent)) { $parent = idx($parent, 'rev'); } - $parents[$k] = phutil_escape_html(substr($parent, 0, 16)); + $parents[$k] = substr($parent, 0, 16); } - $parents = implode('
    ', $parents); - $row[] = ''.$parents.''; + $parents = array_interleave(phutil_tag('br'), $parents); + $row[] = phutil_tag('td', array(), $parents); $author = nonempty( idx($commit, 'user'), idx($commit, 'author')); - $row[] = ''.phutil_escape_html($author).''; + $row[] = phutil_tag('td', array(), $author); $message = idx($commit, 'message'); @@ -107,9 +107,9 @@ final class DifferentialLocalCommitsView extends AphrontView { if ($date) { $date = phabricator_datetime($date, $user); } - $row[] = ''.$date.''; + $row[] = phutil_tag('td', array(), $date); - $rows[] = ''.implode('', $row).''; + $rows[] = phutil_tag('tr', array('class' => $class), $row); } diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php index 67e6ee4da4..45f3de6c0b 100644 --- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php +++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php @@ -119,24 +119,22 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { } if (++$idx % 2) { - $class = ' class="alt"'; + $class = 'alt'; } else { $class = null; } + $lint_attrs = array('class' => 'revhistory-star'); + $unit_attrs = array('class' => 'revhistory-star'); if ($diff) { $lint = self::renderDiffLintStar($row['obj']); $unit = self::renderDiffUnitStar($row['obj']); - $lint_message = self::getDiffLintMessage($diff); - $unit_message = self::getDiffUnitMessage($diff); - $lint_title = ' title="'.phutil_escape_html($lint_message).'"'; - $unit_title = ' title="'.phutil_escape_html($unit_message).'"'; + $lint_attrs['title'] = self::getDiffLintMessage($diff); + $unit_attrs['title'] = self::getDiffUnitMessage($diff); $base = $this->renderBaseRevision($diff); } else { $lint = null; $unit = null; - $lint_title = null; - $unit_title = null; $base = null; } @@ -149,18 +147,20 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView { 'a', array('href' => '/differential/diff/'.$id.'/'), $id); - $rows[] = - ''. - ''.phutil_escape_html($name).''. - ''.$id_link.''. - ''.phutil_escape_html($base).''. - ''.phutil_escape_html($desc).''. - ''.$age.''. - ''.$lint.''. - ''.$unit.''. - ''.$old.''. - ''.$new.''. - ''; + $rows[] = phutil_tag( + 'tr', + array('class' => $class), + array( + phutil_tag('td', array('class' => 'revhistory-name'), $name), + phutil_tag('td', array('class' => 'revhistory-id'), $id_link), + phutil_tag('td', array('class' => 'revhistory-base'), $base), + phutil_tag('td', array('class' => 'revhistory-desc'), $desc), + phutil_tag('td', array('class' => 'revhistory-age'), $age), + phutil_tag('td', $lint_attrs, $lint), + phutil_tag('td', $unit_attrs, $unit), + phutil_tag('td', array('class' => 'revhistory-old'.$old_class), $old), + phutil_tag('td', array('class' => 'revhistory-new'.$new_class), $new), + )); } Javelin::initBehavior( diff --git a/src/applications/diviner/controller/DivinerListController.php b/src/applications/diviner/controller/DivinerListController.php index 2125532b98..3d408fcc37 100644 --- a/src/applications/diviner/controller/DivinerListController.php +++ b/src/applications/diviner/controller/DivinerListController.php @@ -41,11 +41,13 @@ final class DivinerListController extends PhabricatorController { ), $name); - $out[] = + $out[] = hsprintf( '
    '. - '

    '.$link.'

    '. - '

    '.phutil_escape_html($flavor).'

    '. - '
    '; + '

    %s

    '. + '

    %s

    '. + '
    ', + $link, + $flavor); } $out = diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php index b9715efca6..c94392b302 100644 --- a/src/applications/feed/story/PhabricatorFeedStory.php +++ b/src/applications/feed/story/PhabricatorFeedStory.php @@ -243,15 +243,14 @@ abstract class PhabricatorFeedStory implements PhabricatorPolicyInterface { } final protected function renderString($str) { - return ''.phutil_escape_html($str).''; + return phutil_tag('strong', array(), $str); } final protected function renderSummary($text, $len = 128) { if ($len) { $text = phutil_utf8_shorten($text, $len); } - $text = phutil_escape_html($text); - $text = str_replace("\n", '
    ', $text); + $text = phutil_escape_html_newlines($text); return $text; } diff --git a/src/applications/files/controller/PhabricatorFileDeleteController.php b/src/applications/files/controller/PhabricatorFileDeleteController.php index 127f297680..5f54debdc9 100644 --- a/src/applications/files/controller/PhabricatorFileDeleteController.php +++ b/src/applications/files/controller/PhabricatorFileDeleteController.php @@ -33,9 +33,9 @@ final class PhabricatorFileDeleteController extends PhabricatorFileController { $dialog = new AphrontDialogView(); $dialog->setUser($user); $dialog->setTitle('Really delete file?'); - $dialog->appendChild( - "

    Permanently delete '".phutil_escape_html($file->getName())."'? This ". - "action can not be undone."); + $dialog->appendChild(hsprintf( + "

    Permanently delete '%s'? This action can not be undone.

    ", + $file->getName())); $dialog->addSubmitButton('Delete'); $dialog->addCancelButton($file->getInfoURI()); diff --git a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php index 73c300cc2f..784f223011 100644 --- a/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php +++ b/src/applications/help/controller/PhabricatorHelpKeyboardShortcutController.php @@ -25,14 +25,16 @@ final class PhabricatorHelpKeyboardShortcutController foreach ($keys as $shortcut) { $keystrokes = array(); foreach ($shortcut['keys'] as $stroke) { - $keystrokes[] = ''.phutil_escape_html($stroke).''; + $keystrokes[] = phutil_tag('kbd', array(), $stroke); } - $keystrokes = implode(' or ', $keystrokes); - $rows[] = - ''. - ''.$keystrokes.''. - ''.phutil_escape_html($shortcut['description']).''. - ''; + $keystrokes = array_interleave(' or ', $keystrokes); + $rows[] = phutil_tag( + 'tr', + array(), + array( + phutil_tag('th', array(), $keystrokes), + phutil_tag('td', array(), $shortcut['description']), + )); } $table = diff --git a/src/applications/herald/controller/HeraldDeleteController.php b/src/applications/herald/controller/HeraldDeleteController.php index 179ad8c838..8649f63993 100644 --- a/src/applications/herald/controller/HeraldDeleteController.php +++ b/src/applications/herald/controller/HeraldDeleteController.php @@ -43,9 +43,9 @@ final class HeraldDeleteController extends HeraldController { $dialog = new AphrontDialogView(); $dialog->setUser($request->getUser()); $dialog->setTitle('Really delete this rule?'); - $dialog->appendChild( - "Are you sure you want to delete the rule ". - "'".phutil_escape_html($rule->getName())."'?"); + $dialog->appendChild(hsprintf( + "Are you sure you want to delete the rule '%s'?", + $rule->getName())); $dialog->addSubmitButton('Delete'); $dialog->addCancelButton('/herald/'); $dialog->setSubmitURI($request->getPath()); diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php index 0b80cdf3b4..3903bbcb91 100644 --- a/src/applications/herald/controller/HeraldTranscriptController.php +++ b/src/applications/herald/controller/HeraldTranscriptController.php @@ -108,10 +108,7 @@ final class HeraldTranscriptController extends HeraldController { $value = implode(', ', $value); } - return - ''. - phutil_escape_html($value). - ''; + return hsprintf('%s', $value); } private function buildSideNav() { @@ -296,22 +293,22 @@ final class HeraldTranscriptController extends HeraldController { } break; } - $target = phutil_escape_html($target); if ($apply_xscript->getApplied()) { - $outcome = 'SUCCESS'; + $outcome = hsprintf('SUCCESS'); } else { - $outcome = 'FAILURE'; + $outcome = hsprintf('FAILURE'); } - $outcome .= ' '.phutil_escape_html($apply_xscript->getAppliedReason()); $rows[] = array( phutil_escape_html($action_names[$apply_xscript->getAction()]), - $target, - 'Taken because: '. - phutil_escape_html($apply_xscript->getReason()). - '
    '. - 'Outcome: '.$outcome, + phutil_escape_html($target), + hsprintf( + 'Taken because: %s
    '. + 'Outcome: %s %s', + $apply_xscript->getReason(), + $outcome, + $apply_xscript->getAppliedReason()), ); } @@ -351,48 +348,48 @@ final class HeraldTranscriptController extends HeraldController { $cond_markup = array(); foreach ($xscript->getConditionTranscriptsForRule($rule_id) as $cond) { if ($cond->getNote()) { - $note = - '
    '. - phutil_escape_html($cond->getNote()). - '
    '; + $note = hsprintf( + '
    %s
    ', + $cond->getNote()); } else { $note = null; } if ($cond->getResult()) { - $result = + $result = hsprintf( ''. "\xE2\x9C\x93". - ''; + ''); } else { - $result = + $result = hsprintf( ''. "\xE2\x9C\x98". - ''; + ''); } - $cond_markup[] = - '
  • '. - $result.' Condition: '. - phutil_escape_html($field_names[$cond->getFieldName()]). - ' '. - phutil_escape_html($condition_names[$cond->getCondition()]). - ' '. - $this->renderConditionTestValue($cond, $handles). - $note. - '
  • '; + $cond_markup[] = phutil_tag( + 'li', + array(), + hsprintf( + '%s Condition: %s %s %s%s', + $result, + $field_names[$cond->getFieldName()], + $condition_names[$cond->getCondition()], + $this->renderConditionTestValue($cond, $handles), + $note)); } if ($rule->getResult()) { - $result = 'PASS'; + $result = hsprintf( + 'PASS'); $class = 'herald-rule-pass'; } else { - $result = 'FAIL'; + $result = hsprintf( + 'FAIL'); $class = 'herald-rule-fail'; } - $cond_markup[] = - '
  • '.$result.' '.phutil_escape_html($rule->getReason()).'
  • '; + $cond_markup[] = hsprintf('
  • %s %s
  • ', $result, $rule->getReason()); /* if ($rule->getResult()) { @@ -426,16 +423,16 @@ final class HeraldTranscriptController extends HeraldController { } $rule_markup[] = - phutil_render_tag( + phutil_tag( 'li', array( 'class' => $class, ), - '
    '. - ''.phutil_escape_html($name).' '. - phutil_escape_html($handles[$rule->getRuleOwner()]->getName()). - '
    '. - '
      '.implode("\n", $cond_markup).'
    '); + hsprintf( + '
    %s %s
    %s', + $name, + $handles[$rule->getRuleOwner()]->getName(), + phutil_tag('ul', array(), $cond_markup))); } $panel = new AphrontPanelView(); diff --git a/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php b/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php index dd4f9a35d0..9fae6869aa 100644 --- a/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php +++ b/src/applications/maniphest/controller/ManiphestSavedQueryDeleteController.php @@ -34,11 +34,9 @@ final class ManiphestSavedQueryDeleteController extends ManiphestController { $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle('Really delete this query?') - ->appendChild( - '

    '. - 'Really delete the query "'.phutil_escape_html($name).'"? '. - 'It will be lost forever!'. - '

    ') + ->appendChild(hsprintf( + '

    Really delete the query "%s"? It will be lost forever!

    ', + $name)) ->addCancelButton('/maniphest/custom/') ->addSubmitButton('Delete'); diff --git a/src/applications/owners/controller/PhabricatorOwnersDeleteController.php b/src/applications/owners/controller/PhabricatorOwnersDeleteController.php index 4aa31e8d51..8e45a4c98e 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDeleteController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDeleteController.php @@ -27,10 +27,10 @@ final class PhabricatorOwnersDeleteController $dialog = id(new AphrontDialogView()) ->setUser($user) ->setTitle('Really delete this package?') - ->appendChild( - '

    Are you sure you want to delete the "'. - phutil_escape_html($package->getName()).'" package? This operation '. - 'can not be undone.

    ') + ->appendChild(hsprintf( + '

    Are you sure you want to delete the "%s" package? This operation '. + 'can not be undone.

    ', + $package->getName())) ->addSubmitButton('Delete') ->addCancelButton('/owners/package/'.$package->getID().'/') ->setSubmitURI($request->getRequestURI()); diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php index fe07e5767d..58afadf36d 100644 --- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php +++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php @@ -92,8 +92,7 @@ final class PhabricatorOwnersDetailController 'path' => $path->getPath(), 'action' => 'browse' )); - $repo_name = ''.phutil_escape_html($repo->getName()). - ''; + $repo_name = phutil_tag('strong', array(), $repo->getName()); $path_link = phutil_tag( 'a', array( diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php index c23ed1eb5f..9a140620b1 100644 --- a/src/applications/owners/controller/PhabricatorOwnersListController.php +++ b/src/applications/owners/controller/PhabricatorOwnersListController.php @@ -253,7 +253,7 @@ final class PhabricatorOwnersListController )); $pkg_paths[$key] = ($path->getExcluded() ? '–' : '+').' '. - ''.phutil_escape_html($repo->getName()).' '. + phutil_tag('strong', array(), $repo->getName()). phutil_tag( 'a', array( diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index f88c7dfa0e..d16f5d948e 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -182,36 +182,36 @@ final class PhabricatorPeopleProfileController $viewer = $this->getRequest()->getUser(); - $content = + $content = hsprintf( '

    Basic Information

    - + - +
    PHID'.phutil_escape_html($user->getPHID()).'%s
    User Since'.phabricator_datetime($user->getDateCreated(), - $viewer). - '%s
    -
    '; - $content .= +
    '. '

    Flavor Text

    - +
    Blurb'.$blurb.'%s
    -
    '; +
    ', + $user->getPHID(), + phabricator_datetime($user->getDateCreated(), $viewer), + $blurb); return $content; } diff --git a/src/applications/phame/controller/blog/PhameBlogFeedController.php b/src/applications/phame/controller/blog/PhameBlogFeedController.php index 53593a0a9e..88d80a06a7 100644 --- a/src/applications/phame/controller/blog/PhameBlogFeedController.php +++ b/src/applications/phame/controller/blog/PhameBlogFeedController.php @@ -35,20 +35,19 @@ final class PhameBlogFeedController extends PhameController { ->execute(); $content = array(); - $content[] = ''; - $content[] = ''.phutil_escape_html($blog->getName()).''; - $content[] = ''.phutil_escape_html(PhabricatorEnv::getProductionURI( - '/phame/blog/view/'.$blog->getID().'/')).''; + $content[] = phutil_tag('title', array(), $blog->getName()); + $content[] = phutil_tag('id', array(), PhabricatorEnv::getProductionURI( + '/phame/blog/view/'.$blog->getID().'/')); $updated = $blog->getDateModified(); if ($posts) { $updated = max($updated, max(mpull($posts, 'getDateModified'))); } - $content[] = ''.date('c', $updated).''; + $content[] = phutil_tag('updated', array(), date('c', $updated)); $description = $blog->getDescription(); if ($description != '') { - $content[] = ''.phutil_escape_html($description).''; + $content[] = phutil_tag('subtitle', array(), $description); } $engine = id(new PhabricatorMarkupEngine())->setViewer($user); @@ -63,37 +62,39 @@ final class PhameBlogFeedController extends PhameController { ->loadHandles(); foreach ($posts as $post) { - $content[] = ''; - $content[] = ''.phutil_escape_html($post->getTitle()).''; - $content[] = ''; + $content[] = hsprintf(''); + $content[] = phutil_tag('title', array(), $post->getTitle()); + $content[] = phutil_tag('link', array('href' => $post->getViewURI())); - $content[] = ''.phutil_escape_html(PhabricatorEnv::getProductionURI( - '/phame/post/view/'.$post->getID().'/')).''; + $content[] = phutil_tag('id', array(), PhabricatorEnv::getProductionURI( + '/phame/post/view/'.$post->getID().'/')); - $content[] = - ''. - ''. - phutil_escape_html($bloggers[$post->getBloggerPHID()]->getFullName()). - ''. - ''; + $content[] = hsprintf( + '%s%s', + $bloggers[$post->getBloggerPHID()]->getFullName()); - $content[] = ''.date('c', $post->getDateModified()).''; + $content[] = phutil_tag( + 'updated', + array(), + date('c', $post->getDateModified())); - $content[] = + $content[] = hsprintf( ''. - '
    '. - $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY). - '
    '. - '
    '; + '
    %s
    '. + '', + $engine->getOutput($post, PhamePost::MARKUP_FIELD_BODY)); - $content[] = '
    '; + $content[] = hsprintf('
    '); } - $content[] = '
    '; + $content = phutil_tag( + 'feed', + array('xmlns' => 'http://www.w3.org/2005/Atom'), + $content); return id(new AphrontFileResponse()) ->setMimeType('application/xml') - ->setContent(implode('', $content)); + ->setContent($content); } } diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php index 2e9fe01800..85f0b4b396 100644 --- a/src/applications/phriction/controller/PhrictionDocumentController.php +++ b/src/applications/phriction/controller/PhrictionDocumentController.php @@ -45,31 +45,16 @@ final class PhrictionDocumentController } } $create_uri = '/phriction/edit/?slug='.$slug; - $create_sentence = - 'You can '. - phutil_tag( - 'a', - array( - 'href' => $create_uri, - ), - 'create a new document'). - '.'; - $button = phutil_tag( - 'a', - array( - 'href' => $create_uri, - 'class' => 'green button', - ), - 'Create Page'); - $page_content = + $page_content = hsprintf( '
    '. 'No content here!
    '. - 'No document found at '.phutil_escape_html($slug).'. '. - $create_sentence. - '
    '; + 'No document found at %s. '. + 'You can
    create a new document.'. + '
    ', + $slug, + $create_uri); $page_title = 'Page Not Found'; - $buttons = $button; } else { $version = $request->getInt('v'); if ($version) { diff --git a/src/applications/ponder/view/PonderQuestionSummaryView.php b/src/applications/ponder/view/PonderQuestionSummaryView.php index a06cdcc46d..530267f400 100644 --- a/src/applications/ponder/view/PonderQuestionSummaryView.php +++ b/src/applications/ponder/view/PonderQuestionSummaryView.php @@ -25,26 +25,23 @@ final class PonderQuestionSummaryView extends AphrontView { $authorlink = $handles[$author_phid] ->renderLink(); - $votecount = + $votecount = hsprintf( '
    '. - phutil_escape_html($question->getVoteCount()). - '
    '. - 'votes'. - '
    '. - '
    '; + '%s'. + '
    votes
    '. + '
    ', + $question->getVoteCount()); $answerclass = "ponder-summary-answers"; if ($question->getAnswercount() == 0) { $answerclass .= " ponder-not-answered"; } - $answercount = + $answercount = hsprintf( '
    '. - phutil_escape_html($question->getAnswerCount()). - '
    '. - 'answers'. - '
    '. - '
    '; - + '%s'. + '
    answers
    '. + '
    ', + $question->getAnswerCount()); $title = '

    '. diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index 9e18af9849..60e9639e9a 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -129,8 +129,7 @@ final class PhabricatorProjectProfileController $viewer = $this->getRequest()->getUser(); $blurb = $profile->getBlurb(); - $blurb = phutil_escape_html($blurb); - $blurb = str_replace("\n", '
    ', $blurb); + $blurb = phutil_escape_html_newlines($blurb); $phids = array($project->getAuthorPHID()); $phids = array_unique($phids); @@ -138,30 +137,34 @@ final class PhabricatorProjectProfileController $timestamp = phabricator_datetime($project->getDateCreated(), $viewer); - $about = + $about = hsprintf( '

    About

    - + - + - + - +
    Creator'.$handles[$project->getAuthorPHID()]->renderLink().'%s
    Created'.$timestamp.'%s
    PHID'.phutil_escape_html($project->getPHID()).'%s
    Blurb'.$blurb.'%s
    -
    '; +

    ', + $handles[$project->getAuthorPHID()]->renderLink(), + $timestamp, + $project->getPHID(), + $blurb); return $about; } diff --git a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php index edce5a443d..3604513e69 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php @@ -28,10 +28,10 @@ final class PhabricatorRepositoryArcanistProjectDeleteController $dialog ->setUser($request->getUser()) ->setTitle('Really delete this arcanist project?') - ->appendChild( - '

    Really delete the "'.phutil_escape_html($arc_project->getName()). - '" arcanist project? '. - 'This operation can not be undone.

    ') + ->appendChild(hsprintf( + '

    Really delete the "%s" arcanist project? '. + 'This operation can not be undone.

    ', + $arc_project->getName())) ->setSubmitURI('/repository/project/delete/'.$this->id.'/') ->addSubmitButton('Delete Arcanist Project') ->addCancelButton('/repository/'); diff --git a/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php b/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php index da47f4304d..4e89e68839 100644 --- a/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php +++ b/src/applications/repository/controller/PhabricatorRepositoryDeleteController.php @@ -24,8 +24,7 @@ final class PhabricatorRepositoryDeleteController $dialog = new AphrontDialogView(); $text_1 = pht('If you really want to delete the repository, you must run:'); - $command = 'bin/repository delete '. - phutil_escape_html($repository->getCallsign()); + $command = 'bin/repository delete '.$repository->getCallsign(); $text_2 = pht('Repositories touch many objects and as such deletes are '. 'prohibitively expensive to run from the web UI.'); $body = phutil_tag( diff --git a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php index 9ad348ed6b..86a0d10dbc 100644 --- a/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php +++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php @@ -301,9 +301,9 @@ final class PhabricatorSettingsPanelEmailAddresses ->setUser($user) ->addHiddenInput('verify', $email_id) ->setTitle("Send Another Verification Email?") - ->appendChild( - '

    Send another copy of the verification email to '. - phutil_escape_html($address).'?

    ') + ->appendChild(hsprintf( + '

    Send another copy of the verification email to %s?

    ', + $address)) ->addSubmitButton('Send Email') ->addCancelButton($uri); @@ -342,9 +342,10 @@ final class PhabricatorSettingsPanelEmailAddresses ->setUser($user) ->addHiddenInput('primary', $email_id) ->setTitle("Change primary email address?") - ->appendChild( + ->appendChild(hsprintf( '

    If you change your primary address, Phabricator will send all '. - 'email to '.phutil_escape_html($address).'.

    ') + 'email to %s.

    ', + $address)) ->addSubmitButton('Change Primary Address') ->addCancelButton($uri); diff --git a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php index 4da5cb002a..f386982964 100644 --- a/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php +++ b/src/applications/uiexample/controller/PhabricatorUIExampleRenderController.php @@ -43,16 +43,14 @@ final class PhabricatorUIExampleRenderController extends PhabricatorController { require_celerity_resource('phabricator-ui-example-css'); - $nav->appendChild( + $nav->appendChild(hsprintf( '
    '. - '

    '. - phutil_escape_html($example->getName()). - ' ('.get_class($example).')'. - '

    '. - '

    ' - .$example->getDescription(). - '

    '. - '
    '); + '

    %s (%s)

    '. + '

    %s

    '. + '', + $example->getName(), + get_class($example), + $example->getDescription())); $nav->appendChild($result); diff --git a/src/applications/uiexample/examples/PhabricatorActionListExample.php b/src/applications/uiexample/examples/PhabricatorActionListExample.php index 44f6e01791..33df2496b5 100644 --- a/src/applications/uiexample/examples/PhabricatorActionListExample.php +++ b/src/applications/uiexample/examples/PhabricatorActionListExample.php @@ -7,7 +7,8 @@ final class PhabricatorActionListExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use PhabricatorActionListView to render object actions.'; + return hsprintf( + 'Use PhabricatorActionListView to render object actions.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorButtonsExample.php b/src/applications/uiexample/examples/PhabricatorButtonsExample.php index d234bc2308..0a3e57f715 100644 --- a/src/applications/uiexample/examples/PhabricatorButtonsExample.php +++ b/src/applications/uiexample/examples/PhabricatorButtonsExample.php @@ -7,7 +7,7 @@ final class PhabricatorButtonsExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use <button> to render buttons.'; + return hsprintf('Use <button> to render buttons.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorErrorExample.php b/src/applications/uiexample/examples/PhabricatorErrorExample.php index 5f1a1a5cfb..b021c6f7fd 100644 --- a/src/applications/uiexample/examples/PhabricatorErrorExample.php +++ b/src/applications/uiexample/examples/PhabricatorErrorExample.php @@ -7,8 +7,8 @@ final class PhabricatorErrorExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use AphrontErrorView to render errors, warnings and '. - 'notices.'; + return hsprintf( + 'Use AphrontErrorView to render errors, warnings and notices.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorFormExample.php b/src/applications/uiexample/examples/PhabricatorFormExample.php index c045766fa7..ac65b37cd4 100644 --- a/src/applications/uiexample/examples/PhabricatorFormExample.php +++ b/src/applications/uiexample/examples/PhabricatorFormExample.php @@ -7,7 +7,7 @@ final class PhabricatorFormExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use AphrontFormView to render forms.'; + return hsprintf('Use AphrontFormView to render forms.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php index 9ac216d82b..58b751830d 100644 --- a/src/applications/uiexample/examples/PhabricatorPropertyListExample.php +++ b/src/applications/uiexample/examples/PhabricatorPropertyListExample.php @@ -7,8 +7,8 @@ final class PhabricatorPropertyListExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use PhabricatorPropertyListView to render object '. - 'properties.'; + return hsprintf( + 'Use PhabricatorPropertyListView to render object properties.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorTagExample.php b/src/applications/uiexample/examples/PhabricatorTagExample.php index 4461ee11e8..e70a4f3a34 100644 --- a/src/applications/uiexample/examples/PhabricatorTagExample.php +++ b/src/applications/uiexample/examples/PhabricatorTagExample.php @@ -7,7 +7,7 @@ final class PhabricatorTagExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use PhabricatorTagView to render various tags.'; + return hsprintf('Use PhabricatorTagView to render various tags.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorTimelineExample.php b/src/applications/uiexample/examples/PhabricatorTimelineExample.php index 68e6878999..ced405e78c 100644 --- a/src/applications/uiexample/examples/PhabricatorTimelineExample.php +++ b/src/applications/uiexample/examples/PhabricatorTimelineExample.php @@ -7,7 +7,8 @@ final class PhabricatorTimelineExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use PhabricatorTimelineView to comments and transactions.'; + return hsprintf( + 'Use PhabricatorTimelineView to comments and transactions.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorUIListFilterExample.php b/src/applications/uiexample/examples/PhabricatorUIListFilterExample.php index 2ca377965a..81ce37b04c 100644 --- a/src/applications/uiexample/examples/PhabricatorUIListFilterExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIListFilterExample.php @@ -7,8 +7,9 @@ final class PhabricatorUIListFilterExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use AphrontListFilterView to layout controls for '. - 'filtering and manipulating lists of objects.'; + return hsprintf( + 'Use AphrontListFilterView to layout controls for filtering '. + 'and manipulating lists of objects.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorUINotificationExample.php b/src/applications/uiexample/examples/PhabricatorUINotificationExample.php index 031bb42c30..429f6c1a12 100644 --- a/src/applications/uiexample/examples/PhabricatorUINotificationExample.php +++ b/src/applications/uiexample/examples/PhabricatorUINotificationExample.php @@ -7,7 +7,7 @@ final class PhabricatorUINotificationExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use JX.Notification to create notifications.'; + return hsprintf('Use JX.Notification to create notifications.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorUIPagerExample.php b/src/applications/uiexample/examples/PhabricatorUIPagerExample.php index aabacecd90..f50a335547 100644 --- a/src/applications/uiexample/examples/PhabricatorUIPagerExample.php +++ b/src/applications/uiexample/examples/PhabricatorUIPagerExample.php @@ -7,8 +7,9 @@ final class PhabricatorUIPagerExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use AphrontPagerView to create a control which allows '. - 'users to paginate through large amounts of content.'; + return hsprintf( + 'Use AphrontPagerView to create a control which allows '. + 'users to paginate through large amounts of content.'); } public function renderExample() { diff --git a/src/applications/uiexample/examples/PhabricatorUITooltipExample.php b/src/applications/uiexample/examples/PhabricatorUITooltipExample.php index 9f806e3516..178b16beb9 100644 --- a/src/applications/uiexample/examples/PhabricatorUITooltipExample.php +++ b/src/applications/uiexample/examples/PhabricatorUITooltipExample.php @@ -7,7 +7,7 @@ final class PhabricatorUITooltipExample extends PhabricatorUIExample { } public function getDescription() { - return 'Use JX.Tooltip to create tooltips.'; + return hsprintf('Use JX.Tooltip to create tooltips.'); } public function renderExample() { diff --git a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php index 2fa90c9f01..de792665fb 100644 --- a/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php +++ b/src/infrastructure/diff/view/PhabricatorInlineSummaryView.php @@ -39,12 +39,7 @@ final class PhabricatorInlineSummaryView extends AphrontView { } } - $rows[] = - ''. - ''. - phutil_escape_html($group). - ''. - ''; + $rows[] = hsprintf('%s', $group); foreach ($items as $item) { @@ -88,10 +83,8 @@ final class PhabricatorInlineSummaryView extends AphrontView { $rows[] = ''. ''.$lines.''. - ($has_where ? - ''. - phutil_escape_html($where). - '' + ($has_where + ? hsprintf('%s', $where) : null). ''. '
    '. diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php index e1ebad90c8..04122e0027 100644 --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -156,9 +156,7 @@ final class AphrontDialogView extends AphrontView { } $content = - '
    '. - phutil_escape_html($this->title). - '
    '. + hsprintf('
    %s
    ', $this->title). '
    '. $this->renderChildren(). '
    '. diff --git a/src/view/control/PhabricatorObjectSelectorDialog.php b/src/view/control/PhabricatorObjectSelectorDialog.php index db60a6ba7c..1466d4918c 100644 --- a/src/view/control/PhabricatorObjectSelectorDialog.php +++ b/src/view/control/PhabricatorObjectSelectorDialog.php @@ -136,9 +136,9 @@ final class PhabricatorObjectSelectorDialog { $attached_box = '
    '. '
    '. - '
    '. - phutil_escape_html($this->header). - '
    '. + hsprintf( + '
    %s
    ', + $this->header). '
    '. '
    '. $instructions. diff --git a/src/view/layout/PhabricatorProfileHeaderView.php b/src/view/layout/PhabricatorProfileHeaderView.php index f1e9746cf5..ce86f56285 100644 --- a/src/view/layout/PhabricatorProfileHeaderView.php +++ b/src/view/layout/PhabricatorProfileHeaderView.php @@ -47,33 +47,29 @@ final class PhabricatorProfileHeaderView extends AphrontView { ''); } - $description = phutil_escape_html($this->profileDescription); + $description = $this->profileDescription; if ($this->profileStatus != '') { - $description = - ''.phutil_escape_html($this->profileStatus).''. - ($description != '' ? ' — ' : ''). - $description; + $description = hsprintf( + '%s%s', + $this->profileStatus, + ($description != '' ? "\xE2\x80\x94".$description : '')); } - return + return hsprintf( ' - - - + + + - + -
    '. - phutil_escape_html($this->profileName). - ''. - self::renderSingleView($this->profileActions). - ''. - $image. - '%s%s%s
    '. - $description. - '%s
    '. + ', + $this->profileName, + phutil_safe_html(self::renderSingleView($this->profileActions)), + $image, + $description). $this->renderChildren(); } } diff --git a/src/view/page/AphrontRequestFailureView.php b/src/view/page/AphrontRequestFailureView.php index bba198accb..026f3d8b61 100644 --- a/src/view/page/AphrontRequestFailureView.php +++ b/src/view/page/AphrontRequestFailureView.php @@ -16,7 +16,7 @@ final class AphrontRequestFailureView extends AphrontView { return '
    '. '
    '. - '

    '.phutil_escape_html($this->header).'

    '. + phutil_tag('h1', array(), $this->header). '
    '. '
    '. $this->renderChildren(). -- 2.51.2