Skip to content

Commit 3c1b8df

Browse files
author
vrana
committed
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
1 parent 21a5956 commit 3c1b8df

File tree

51 files changed

+223
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+223
-214
lines changed

src/aphront/console/plugin/DarkConsoleServicesPlugin.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,12 @@ public function render() {
211211
$info = wordwrap($info, 128, "\n", true);
212212

213213
if (!empty($row['explain'])) {
214-
$analysis = phutil_escape_html($row['explain']['reason']);
215-
$analysis = phutil_render_tag(
214+
$analysis = phutil_tag(
216215
'span',
217216
array(
218217
'class' => 'explain-sev-'.$row['explain']['sev'],
219218
),
220-
$analysis);
219+
$row['explain']['reason']);
221220
}
222221

223222
$info = phutil_escape_html($info);

src/aphront/response/AphrontRedirectResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public function buildResponseString() {
4242
$error->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
4343
$error->setTitle('Stopped on Redirect');
4444

45-
$link = phutil_render_tag(
45+
$link = phutil_tag(
4646
'a',
4747
array(
4848
'href' => $this->getURI(),
4949
),
50-
'Continue to: '.phutil_escape_html($this->getURI()));
50+
'Continue to: '.$this->getURI());
5151

5252
$error->appendChild(
5353
'<p>You were stopped here because <tt>debug.stop-on-redirect</tt> '.

src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,31 +98,29 @@ public function processRequest() {
9898
foreach ($blocks as $block) {
9999
$author = $block['author'];
100100
$author = phutil_utf8_shorten($author, 18);
101-
$author = phutil_escape_html($author);
102-
$author = phutil_render_tag('td', array('class' => 'author'), $author);
101+
$author = phutil_tag('td', array('class' => 'author'), $author);
103102

104103
$message = mpull($block['logs'], 'getMessage');
105104
$message = implode("\n", $message);
106-
$message = phutil_escape_html($message);
107-
$message = phutil_render_tag('td', array('class' => 'message'), $message);
105+
$message = phutil_tag('td', array('class' => 'message'), $message);
108106

109107
$href = $uri->alter('at', $block['id']);
110108
$timestamp = $block['epoch'];
111109
$timestamp = phabricator_datetime($timestamp, $user);
112-
$timestamp = phutil_render_tag('a', array('href' => $href), $timestamp);
113-
$timestamp = phutil_render_tag(
110+
$timestamp = phutil_tag('a', array('href' => $href), $timestamp);
111+
$timestamp = phutil_tag(
114112
'td',
115113
array(
116114
'class' => 'timestamp',
117115
),
118116
$timestamp);
119117

120-
$out[] = phutil_render_tag(
118+
$out[] = phutil_tag(
121119
'tr',
122120
array(
123121
'class' => $block['class'],
124122
),
125-
$author.$message.$timestamp);
123+
array($author, $message, $timestamp));
126124
}
127125
$out[] = '</table>';
128126

src/applications/config/controller/PhabricatorConfigEditController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function processRequest() {
132132
$engine = new PhabricatorMarkupEngine();
133133
$engine->addObject($option, 'description');
134134
$engine->process();
135-
$description = phutil_render_tag(
135+
$description = phutil_tag(
136136
'div',
137137
array(
138138
'class' => 'phabricator-remarkup',
@@ -440,12 +440,12 @@ private function renderExamples(PhabricatorConfigOption $option) {
440440

441441
require_celerity_resource('config-options-css');
442442

443-
return phutil_render_tag(
443+
return phutil_tag(
444444
'table',
445445
array(
446446
'class' => 'config-option-table',
447447
),
448-
implode("\n", $table));
448+
new PhutilSafeHTML(implode("\n", $table)));
449449
}
450450

451451
private function renderDefaults(PhabricatorConfigOption $option) {
@@ -492,12 +492,12 @@ private function renderDefaults(PhabricatorConfigOption $option) {
492492

493493
require_celerity_resource('config-options-css');
494494

495-
return phutil_render_tag(
495+
return phutil_tag(
496496
'table',
497497
array(
498498
'class' => 'config-option-table',
499499
),
500-
implode("\n", $table));
500+
new PhutilSafeHTML(implode("\n", $table)));
501501
}
502502

503503
}

src/applications/config/controller/PhabricatorConfigGroupController.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,15 @@ private function buildOptionList(array $options) {
8484
$current_value = PhabricatorEnv::getEnvConfig($option->getKey());
8585
$current_value = PhabricatorConfigJSON::prettyPrintJSON(
8686
$current_value);
87-
$current_value = phutil_render_tag(
87+
$current_value = phutil_tag(
8888
'div',
8989
array(
9090
'class' => 'config-options-current-value',
9191
),
92-
'<span>'.pht('Current Value:').'</span> '.
93-
phutil_escape_html($current_value));
92+
array(
93+
phutil_tag('span', array(), pht('Current Value:')),
94+
' '.$current_value,
95+
));
9496

9597
$item->appendChild($current_value);
9698
}

src/applications/config/view/PhabricatorSetupIssueView.php

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public function getIssue() {
1616
public function render() {
1717
$issue = $this->getIssue();
1818

19-
$description = phutil_render_tag(
19+
$description = phutil_tag(
2020
'div',
2121
array(
2222
'class' => 'setup-issue-instructions',
2323
),
24-
nl2br(phutil_escape_html($issue->getMessage())));
24+
new PhutilSafeHTML(nl2br(phutil_escape_html($issue->getMessage()))));
2525

2626
$configs = $issue->getPHPConfig();
2727
if ($configs) {
@@ -36,13 +36,15 @@ public function render() {
3636
$commands = $issue->getCommands();
3737
if ($commands) {
3838
$run_these = pht("Run these %d command(s):", count($commands));
39-
$description .= phutil_render_tag(
39+
$description .= phutil_tag(
4040
'div',
4141
array(
4242
'class' => 'setup-issue-config',
4343
),
44-
phutil_render_tag('p', array(), $run_these).
45-
phutil_render_tag('pre', array(), implode("\n", $commands)));
44+
array(
45+
phutil_render_tag('p', array(), $run_these),
46+
phutil_render_tag('pre', array(), implode("\n", $commands)),
47+
));
4648
}
4749

4850
$extensions = $issue->getPHPExtensions();
@@ -74,17 +76,19 @@ public function render() {
7476
"After installing new PHP extensions, <strong>restart your webserver ".
7577
"for the changes to take effect</strong>.");
7678

77-
$description .= phutil_render_tag(
79+
$description .= phutil_tag(
7880
'div',
7981
array(
8082
'class' => 'setup-issue-config',
8183
),
82-
phutil_render_tag('p', array(), $install_these).
83-
phutil_render_tag('pre', array(), implode("\n", $extensions)).
84-
phutil_render_tag('p', array(), $install_info).
85-
phutil_render_tag('pre', array(), $install_commands).
86-
phutil_render_tag('p', array(), $fallback_info).
87-
phutil_render_tag('p', array(), $restart_info));
84+
array(
85+
phutil_render_tag('p', array(), $install_these),
86+
phutil_render_tag('pre', array(), implode("\n", $extensions)),
87+
phutil_render_tag('p', array(), $install_info),
88+
phutil_render_tag('pre', array(), $install_commands),
89+
phutil_render_tag('p', array(), $fallback_info),
90+
phutil_render_tag('p', array(), $restart_info),
91+
));
8892

8993
}
9094

@@ -102,18 +106,18 @@ public function render() {
102106
),
103107
$issue->getName());
104108

105-
return phutil_render_tag(
109+
return phutil_tag(
106110
'div',
107111
array(
108112
'class' => 'setup-issue',
109113
),
110-
$name.$description.$next);
114+
array($name, $description, $next));
111115
}
112116

113117
private function renderPhabricatorConfig(array $configs) {
114118
$issue = $this->getIssue();
115119

116-
$table_info = phutil_render_tag(
120+
$table_info = phutil_tag(
117121
'p',
118122
array(),
119123
pht(
@@ -141,16 +145,16 @@ private function renderPhabricatorConfig(array $configs) {
141145
$table[] = '</tr>';
142146
}
143147

144-
$table = phutil_render_tag(
148+
$table = phutil_tag(
145149
'table',
146150
array(
147151
),
148-
implode("\n", $table));
152+
new PhutilSafeHTML(implode("\n", $table)));
149153

150154
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
151155

152156
if ($this->getIssue()->getIsFatal()) {
153-
$update_info = phutil_render_tag(
157+
$update_info = phutil_tag(
154158
'p',
155159
array(),
156160
pht(
@@ -172,12 +176,12 @@ private function renderPhabricatorConfig(array $configs) {
172176
if (!idx($options, $config) || $options[$config]->getLocked()) {
173177
continue;
174178
}
175-
$link = phutil_render_tag(
179+
$link = phutil_tag(
176180
'a',
177181
array(
178182
'href' => '/config/edit/'.$config.'/?issue='.$issue->getIssueKey(),
179183
),
180-
pht('Edit %s', phutil_escape_html($config)));
184+
pht('Edit %s', $config));
181185
$update[] = '<li>'.$link.'</li>';
182186
}
183187
if ($update) {
@@ -207,7 +211,7 @@ private function renderPhabricatorConfig(array $configs) {
207211
}
208212

209213
private function renderPHPConfig(array $configs) {
210-
$table_info = phutil_render_tag(
214+
$table_info = phutil_tag(
211215
'p',
212216
array(),
213217
pht(
@@ -236,12 +240,10 @@ private function renderPHPConfig(array $configs) {
236240
$table[] = '</tr>';
237241
}
238242

239-
$table = phutil_render_tag(
243+
$table = phutil_tag(
240244
'table',
241-
array(
242-
243-
),
244-
implode("\n", $table));
245+
array(),
246+
new PhutilSafeHTML(implode("\n", $table)));
245247

246248
ob_start();
247249
phpinfo();
@@ -269,14 +271,14 @@ private function renderPHPConfig(array $configs) {
269271
}
270272

271273
if (!$ini_loc) {
272-
$info = phutil_render_tag(
274+
$info = phutil_tag(
273275
'p',
274276
array(),
275277
pht(
276278
"To update these %d value(s), edit your PHP configuration file.",
277279
count($configs)));
278280
} else {
279-
$info = phutil_render_tag(
281+
$info = phutil_tag(
280282
'p',
281283
array(),
282284
pht(
@@ -290,7 +292,7 @@ private function renderPHPConfig(array $configs) {
290292
}
291293

292294
if ($more_loc) {
293-
$info .= phutil_render_tag(
295+
$info .= phutil_tag(
294296
'p',
295297
array(),
296298
pht(
@@ -302,32 +304,27 @@ private function renderPHPConfig(array $configs) {
302304
implode("\n", $more_loc));
303305
}
304306

305-
$info .= phutil_render_tag(
307+
$info .= phutil_tag(
306308
'p',
307309
array(),
308-
pht(
309-
"You can find more information about PHP configuration values in the ".
310-
"%s.",
311-
phutil_tag(
312-
'a',
313-
array(
314-
'href' => 'http://php.net/manual/ini.list.php',
315-
),
316-
pht('PHP Documentation'))));
310+
phutil_safe_html(pht(
311+
'You can find more information about PHP configuration values in the '.
312+
'<a href="%s">PHP Documentation</a>.',
313+
'http://php.net/manual/ini.list.php')));
317314

318-
$info .= phutil_render_tag(
315+
$info .= phutil_tag(
319316
'p',
320317
array(),
321-
pht(
318+
phutil_safe_html(pht(
322319
"After editing the PHP configuration, <strong>restart your ".
323-
"webserver for the changes to take effect</strong>."));
320+
"webserver for the changes to take effect</strong>.")));
324321

325-
return phutil_render_tag(
322+
return phutil_tag(
326323
'div',
327324
array(
328325
'class' => 'setup-issue-config',
329326
),
330-
$table_info.$table.$info);
327+
array($table_info, $table, $info));
331328
}
332329

333330
}

src/applications/daemon/view/PhabricatorDaemonLogListView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function render() {
6666
$symbol = '?';
6767
}
6868

69-
$running = phutil_render_tag(
69+
$running = phutil_tag(
7070
'span',
7171
array(
7272
'style' => $style,

src/applications/differential/field/specification/DifferentialLintFieldSpecification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function renderValueForRevisionView() {
8787
if ($diff->getID() != $this->getDiff()->getID()) {
8888
$href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href;
8989
}
90-
$line_link = phutil_render_tag(
90+
$line_link = phutil_tag(
9191
'a',
9292
array(
9393
'href' => $href,

src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ public function renderValueForRevisionView() {
9393
$hidden[$result]++;
9494
}
9595

96-
$value = phutil_escape_html(idx($test, 'name'));
96+
$value = idx($test, 'name');
9797
if (!empty($test['link'])) {
98-
$value = phutil_render_tag(
98+
$value = phutil_tag(
9999
'a',
100100
array(
101101
'href' => $test['link'],

src/applications/differential/view/DifferentialChangesetListView.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ public function render() {
158158
'Load');
159159
}
160160
$detail->appendChild(
161-
phutil_render_tag(
161+
phutil_tag(
162162
'div',
163163
array(
164164
'id' => $uniq_id,
165165
),
166-
'<div class="differential-loading">'.$load.'</div>'));
166+
phutil_tag('div', array('class' => 'differential-loading'), $load)));
167167
$output[] = $detail->render();
168168
}
169169

@@ -217,12 +217,12 @@ private function renderUndoTemplates() {
217217
),
218218
'Undo');
219219

220-
$div = phutil_render_tag(
220+
$div = phutil_tag(
221221
'div',
222222
array(
223223
'class' => 'differential-inline-undo',
224224
),
225-
'Changes discarded. '.$link);
225+
array('Changes discarded. ', $link));
226226

227227
$template =
228228
'<table><tr>'.

0 commit comments

Comments
 (0)