From 3e147dd61cada45e8f798f7af672622a87f384d9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 25 Jan 2013 05:50:50 -0800 Subject: [PATCH] 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/',