Skip to content

Commit 868ca71

Browse files
author
vrana
committed
Fix some HTML problems
Summary: I'm too lazy to attaching them for diffs where they were introduced. Test Plan: / /D1, wrote comment with code snippet DarkConsole commit detail, wrote comment task detail, wrote comment Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2432 Differential Revision: https://secure.phabricator.com/D4911
1 parent 8c71815 commit 868ca71

23 files changed

+141
-156
lines changed

src/applications/auth/controller/PhabricatorLDAPLoginController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public function processRequest() {
134134
$panel->appendChild('<h1>'.pht('LDAP login').'</h1>');
135135
$panel->appendChild($ldap_form);
136136

137+
$error_view = null;
137138
if (isset($errors) && count($errors) > 0) {
138139
$error_view = new AphrontErrorView();
139140
$error_view->setTitle(pht('Login Failed'));
@@ -142,7 +143,7 @@ public function processRequest() {
142143

143144
return $this->buildStandardPageResponse(
144145
array(
145-
isset($error_view) ? $error_view : null,
146+
$error_view,
146147
$panel,
147148
),
148149
array(

src/applications/auth/controller/PhabricatorLoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public function processRequest() {
299299
return $this->buildApplicationPage(
300300
array(
301301
$error_view,
302-
$login_message,
302+
phutil_safe_html($login_message),
303303
$panel,
304304
),
305305
array(

src/applications/calendar/controller/PhabricatorCalendarBrowseController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ public function processRequest() {
5555
$nav->appendChild(
5656
array(
5757
$this->getNoticeView(),
58-
'<div style="padding: 20px;">',
59-
$month_view,
60-
'</div>',
58+
hsprintf('<div style="padding: 20px;">%s</div>', $month_view->render()),
6159
));
6260

6361
return $this->buildApplicationPage(

src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public function processRequest() {
9494
require_celerity_resource('phabricator-chatlog-css');
9595

9696
$out = array();
97-
$out[] = '<table class="phabricator-chat-log">';
9897
foreach ($blocks as $block) {
9998
$author = $block['author'];
10099
$author = phutil_utf8_shorten($author, 18);
@@ -122,7 +121,6 @@ public function processRequest() {
122121
),
123122
array($author, $message, $timestamp));
124123
}
125-
$out[] = '</table>';
126124

127125
$form = id(new AphrontFormView())
128126
->setUser($user)
@@ -140,12 +138,11 @@ public function processRequest() {
140138

141139
return $this->buildStandardPageResponse(
142140
array(
143-
'<div class="phabricator-chat-log-panel">',
144-
$form,
145-
'<br />',
146-
implode("\n", $out),
147-
$pager,
148-
'</div>',
141+
hsprintf(
142+
'<div class="phabricator-chat-log-panel">%s<br />%s%s</div>',
143+
$form,
144+
phutil_tag('table', array('class' => 'phabricator-chat-log'), $out),
145+
$pager),
149146
),
150147
array(
151148
'title' => 'Channel Log',

src/applications/differential/view/DifferentialAddCommentView.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -155,35 +155,35 @@ public function render() {
155155
'inline' => 'inline-comment-preview',
156156
));
157157

158-
$warning_container = '<div id="warnings">';
158+
$warning_container = array();
159159
foreach ($warnings as $warning) {
160160
if ($warning) {
161-
$warning_container .= $warning->render();
161+
$warning_container[] = $warning->render();
162162
}
163163
}
164-
$warning_container .= '</div>';
165164

166165
$header = id(new PhabricatorHeaderView())
167166
->setHeader($is_serious ? pht('Add Comment') : pht('Leap Into Action'));
168167

169-
return
170-
id(new PhabricatorAnchorView())
171-
->setAnchorName('comment')
172-
->setNavigationMarker(true)
173-
->render().
168+
return hsprintf(
169+
'%s'.
174170
'<div class="differential-add-comment-panel">'.
175-
$header->render().
176-
$form->render().
177-
$warning_container.
171+
'%s%s%s'.
178172
'<div class="aphront-panel-preview aphront-panel-flush">'.
179173
'<div id="comment-preview">'.
180-
'<span class="aphront-panel-preview-loading-text">'.
181-
pht('Loading comment preview...').
182-
'</span>'.
174+
'<span class="aphront-panel-preview-loading-text">%s</span>'.
183175
'</div>'.
184176
'<div id="inline-comment-preview">'.
185177
'</div>'.
186178
'</div>'.
187-
'</div>';
179+
'</div>',
180+
id(new PhabricatorAnchorView())
181+
->setAnchorName('comment')
182+
->setNavigationMarker(true)
183+
->render(),
184+
$header->render(),
185+
$form->render(),
186+
phutil_tag('div', array('id' => 'warnings'), $warning_container),
187+
pht('Loading comment preview...'));
188188
}
189189
}

src/applications/diffusion/controller/DiffusionCommitController.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ private function renderAddCommentPanel(
687687
'inlineuri' => '/diffusion/inline/preview/'.$commit->getPHID().'/',
688688
));
689689

690-
$preview_panel =
690+
$preview_panel = hsprintf(
691691
'<div class="aphront-panel-preview aphront-panel-flush">
692692
<div id="audit-preview">
693693
<div class="aphront-panel-preview-loading-text">
@@ -696,27 +696,24 @@ private function renderAddCommentPanel(
696696
</div>
697697
<div id="inline-comment-preview">
698698
</div>
699-
</div>';
699+
</div>');
700700

701701
// TODO: This is pretty awkward, unify the CSS between Diffusion and
702702
// Differential better.
703703
require_celerity_resource('differential-core-view-css');
704704

705-
return phutil_render_tag(
705+
return phutil_tag(
706706
'div',
707707
array(
708708
'id' => $pane_id,
709709
),
710-
phutil_render_tag(
711-
'div',
712-
array(
713-
'class' => 'differential-add-comment-panel',
714-
),
710+
hsprintf(
711+
'<div class="differential-add-comment-panel">%s%s%s</div>',
715712
id(new PhabricatorAnchorView())
716713
->setAnchorName('comment')
717714
->setNavigationMarker(true)
718-
->render().
719-
$panel->render().
715+
->render(),
716+
$panel->render(),
720717
$preview_panel));
721718
}
722719

src/applications/diviner/controller/DivinerListController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ public function processRequest() {
5050
$flavor);
5151
}
5252

53-
$out =
54-
'<div class="aphront-directory-list">'.
55-
implode("\n", $out).
56-
'</div>';
53+
$out = phutil_tag('div', array('class' => 'aphront-directory-list'), $out);
5754

5855
return $this->buildApplicationPage(
5956
$out,

src/applications/herald/view/HeraldRuleEditHistoryView.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public function render() {
3232

3333
switch ($edit->getAction()) {
3434
case 'create':
35-
$details = "Created rule '{$rule_name}'.";
35+
$details = pht("Created rule '%s'.", $rule_name);
3636
break;
3737
case 'delete':
38-
$details = "Deleted rule '{$rule_name}'.";
38+
$details = pht("Deleted rule '%s'.", $rule_name);
3939
break;
4040
case 'edit':
4141
default:
42-
$details = "Edited rule '{$rule_name}'.";
42+
$details = pht("Edited rule '%s'.", $rule_name);
4343
break;
4444
}
4545

src/applications/maniphest/controller/ManiphestTaskDetailController.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,13 @@ public function processRequest() {
301301
$comment_header = id(new PhabricatorHeaderView())
302302
->setHeader($is_serious ? pht('Add Comment') : pht('Weigh In'));
303303

304-
$preview_panel =
304+
$preview_panel = hsprintf(
305305
'<div class="aphront-panel-preview">
306306
<div id="transaction-preview">
307-
<div class="aphront-panel-preview-loading-text">
308-
'.pht('Loading preview...').'
309-
</div>
307+
<div class="aphront-panel-preview-loading-text">%s</div>
310308
</div>
311-
</div>';
309+
</div>',
310+
pht('Loading preview...'));
312311

313312
$transaction_view = new ManiphestTransactionListView();
314313
$transaction_view->setTransactions($transactions);

src/applications/maniphest/controller/ManiphestTaskEditController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ public function processRequest() {
512512
$panel->appendChild($form);
513513
$panel->setNoBackground();
514514

515-
$description_preview_panel =
515+
$description_preview_panel = hsprintf(
516516
'<div class="aphront-panel-preview aphront-panel-preview-full">
517517
<div class="maniphest-description-preview-header">
518518
Description Preview
@@ -522,7 +522,7 @@ public function processRequest() {
522522
Loading preview...
523523
</div>
524524
</div>
525-
</div>';
525+
</div>');
526526

527527
Javelin::initBehavior(
528528
'maniphest-description-preview',
@@ -542,7 +542,7 @@ public function processRequest() {
542542
array(
543543
$error_view,
544544
$panel,
545-
$description_preview_panel
545+
$description_preview_panel,
546546
),
547547
array(
548548
'title' => $header_name,

src/applications/notification/controller/PhabricatorNotificationListController.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,16 @@ public function processRequest() {
4343

4444
if ($notifications) {
4545
$builder = new PhabricatorNotificationBuilder($notifications);
46-
$view = $builder->buildView();
46+
$view = $builder->buildView()->render();
4747
} else {
48-
$view =
49-
'<div class="phabricator-notification no-notifications">'.
50-
$no_data.
51-
'</div>';
48+
$view = hsprintf(
49+
'<div class="phabricator-notification no-notifications">%s</div>',
50+
$no_data);
5251
}
5352

54-
$view = array(
55-
'<div class="phabricator-notification-list">',
56-
$view,
57-
'</div>',
58-
);
53+
$view = hsprintf(
54+
'<div class="phabricator-notification-list">%s</div>',
55+
$view);
5956

6057
$panel = new AphrontPanelView();
6158
$panel->setHeader($header);

src/applications/phame/controller/post/PhamePostEditController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function processRequest() {
148148
->setValue($submit_button)
149149
);
150150

151-
$preview_panel =
151+
$preview_panel = hsprintf(
152152
'<div class="aphront-panel-preview">
153153
<div class="phame-post-preview-header">
154154
Post Preview
@@ -158,7 +158,7 @@ public function processRequest() {
158158
Loading preview...
159159
</div>
160160
</div>
161-
</div>';
161+
</div>');
162162

163163
require_celerity_resource('phame-css');
164164
Javelin::initBehavior(

src/applications/phriction/controller/PhrictionDiffController.php

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,28 +155,32 @@ public function processRequest() {
155155
$link_r = pht('Most Recent Change');
156156
}
157157

158-
$navigation_table =
158+
$navigation_table = hsprintf(
159159
'<table class="phriction-history-nav-table">
160160
<tr>
161-
<td class="nav-prev">'.$link_l.'</td>
162-
<td class="nav-next">'.$link_r.'</td>
161+
<td class="nav-prev">%s</td>
162+
<td class="nav-next">%s</td>
163163
</tr>
164-
</table>';
164+
</table>',
165+
$link_l,
166+
$link_r);
165167
}
166168

167169

168170

169-
$output =
171+
$output = hsprintf(
170172
'<div class="phriction-document-history-diff">'.
171-
$comparison_table->render().
172-
'<br />'.
173-
'<br />'.
174-
$navigation_table.
173+
'%s<br /><br />%s'.
175174
'<table class="phriction-revert-table">'.
176-
'<tr><td>'.$revert_l.'</td><td>'.$revert_r.'</td>'.
175+
'<tr><td>%s</td><td>%s</td>'.
177176
'</table>'.
178-
$output.
179-
'</div>';
177+
'%s'.
178+
'</div>',
179+
$comparison_table->render(),
180+
$navigation_table,
181+
$revert_l,
182+
$revert_r,
183+
$output);
180184

181185
return $this->buildStandardPageResponse(
182186
array(

0 commit comments

Comments
 (0)