Skip to content

Commit 73cce6e

Browse files
author
epriestley
committed
Revert "Promote phutil-tag again"
This reverts commit 8fbabdc, reversing changes made to 2dab1c1.
1 parent 8fbabdc commit 73cce6e

File tree

264 files changed

+1716
-1690
lines changed

Some content is hidden

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

264 files changed

+1716
-1690
lines changed

src/aphront/AphrontRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
final class AphrontRequest {
1010

1111
// NOTE: These magic request-type parameters are automatically included in
12-
// certain requests (e.g., by phabricator_form(), JX.Request,
12+
// certain requests (e.g., by phabricator_render_form(), JX.Request,
1313
// JX.Workflow, and ConduitClient) and help us figure out what sort of
1414
// response the client expects.
1515

src/aphront/configuration/AphrontDefaultApplicationConfiguration.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function handleException(Exception $ex) {
210210

211211
if ($ex instanceof AphrontUsageException) {
212212
$error = new AphrontErrorView();
213-
$error->setTitle($ex->getTitle());
213+
$error->setTitle(phutil_escape_html($ex->getTitle()));
214214
$error->appendChild($ex->getMessage());
215215

216216
$view = new PhabricatorStandardPageView();
@@ -227,8 +227,8 @@ public function handleException(Exception $ex) {
227227
// Always log the unhandled exception.
228228
phlog($ex);
229229

230-
$class = get_class($ex);
231-
$message = $ex->getMessage();
230+
$class = phutil_escape_html(get_class($ex));
231+
$message = phutil_escape_html($ex->getMessage());
232232

233233
if ($ex instanceof AphrontQuerySchemaException) {
234234
$message .=
@@ -244,13 +244,11 @@ public function handleException(Exception $ex) {
244244
$trace = null;
245245
}
246246

247-
$content = hsprintf(
247+
$content =
248248
'<div class="aphront-unhandled-exception">'.
249-
'<div class="exception-message">%s</div>'.
250-
'%s'.
251-
'</div>',
252-
$message,
253-
$trace);
249+
'<div class="exception-message">'.$message.'</div>'.
250+
$trace.
251+
'</div>';
254252

255253
$dialog = new AphrontDialogView();
256254
$dialog
@@ -350,17 +348,17 @@ private function renderStackTrace($trace, PhabricatorUser $user) {
350348
),
351349
$relative);
352350
}
353-
$file_name = hsprintf('%s : %d', $file_name, $part['line']);
351+
$file_name = $file_name.' : '.(int)$part['line'];
354352
} else {
355-
$file_name = phutil_tag('em', array(), '(Internal)');
353+
$file_name = '<em>(Internal)</em>';
356354
}
357355

358356

359357
$rows[] = array(
360358
$depth--,
361-
$lib,
359+
phutil_escape_html($lib),
362360
$file_name,
363-
$where,
361+
phutil_escape_html($where),
364362
);
365363
}
366364
$table = new AphrontTableView($rows);
@@ -379,12 +377,11 @@ private function renderStackTrace($trace, PhabricatorUser $user) {
379377
'wide',
380378
));
381379

382-
return hsprintf(
380+
return
383381
'<div class="exception-trace">'.
384382
'<div class="exception-trace-header">Stack Trace</div>'.
385-
'%s',
386-
'</div>',
387-
$table->render());
383+
$table->render().
384+
'</div>';
388385
}
389386

390387
}

src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function renderPanel() {
3636
$data = $this->getData();
3737

3838
$rows = array();
39-
$details = array();
39+
$details = '';
4040

4141
foreach ($data as $index => $row) {
4242
$file = $row['file'];
@@ -50,11 +50,11 @@ public function renderPanel() {
5050
$row['str'].' at ['.basename($file).':'.$line.']');
5151
$rows[] = array($tag);
5252

53-
$details[] = hsprintf(
54-
'<div class="dark-console-panel-error-details" id="row-details-%s">'.
55-
"%s\nStack trace:\n",
56-
$index,
57-
$row['details']);
53+
$details .=
54+
'<div class="dark-console-panel-error-details" id="row-details-'.
55+
$index.'">'.
56+
phutil_escape_html($row['details'])."\n".
57+
'Stack trace:'."\n";
5858

5959
foreach ($row['trace'] as $key => $entry) {
6060
$line = '';
@@ -73,30 +73,28 @@ public function renderPanel() {
7373
}
7474
}
7575

76-
$details[] = phutil_tag(
76+
$details .= phutil_tag(
7777
'a',
7878
array(
7979
'href' => $href,
8080
),
8181
$line);
82-
$details[] = "\n";
82+
$details .= "\n";
8383
}
8484

85-
$details[] = hsprintf('</div>');
85+
$details .= '</div>';
8686
}
8787

8888
$table = new AphrontTableView($rows);
8989
$table->setClassName('error-log');
9090
$table->setHeaders(array('Error'));
9191
$table->setNoDataString('No errors.');
9292

93-
return hsprintf(
94-
'<div>'.
95-
'<div>%s</div>'.
96-
'<pre class="PhabricatorMonospaced">%s</pre>'.
97-
'</div>',
98-
$table->render(),
99-
phutil_implode_html('', $details));
93+
return '<div>'.
94+
'<div>'.$table->render().'</div>'.
95+
'<pre class="PhabricatorMonospaced">'.
96+
$details.'</pre>'.
97+
'</div>';
10098
}
10199
}
102100

src/aphront/console/plugin/DarkConsoleEventPlugin.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ public function renderPanel() {
4242

4343
$out = array();
4444

45-
$out[] = hsprintf(
45+
$out[] =
4646
'<div class="dark-console-panel-header">'.
4747
'<h1>Registered Event Listeners</h1>'.
48-
'</div>');
48+
'</div>';
4949

5050
$rows = array();
5151
foreach ($data['listeners'] as $listener) {
52-
$rows[] = array($listener['id'], $listener['class']);
52+
$rows[] = array(
53+
phutil_escape_html($listener['id']),
54+
phutil_escape_html($listener['class']),
55+
);
5356
}
5457

5558
$table = new AphrontTableView($rows);
@@ -66,15 +69,15 @@ public function renderPanel() {
6669

6770
$out[] = $table->render();
6871

69-
$out[] = hsprintf(
72+
$out[] =
7073
'<div class="dark-console-panel-header">'.
7174
'<h1>Event Log</h1>'.
72-
'</div>');
75+
'</div>';
7376

7477
$rows = array();
7578
foreach ($data['events'] as $event) {
7679
$rows[] = array(
77-
$event['type'],
80+
phutil_escape_html($event['type']),
7881
$event['stopped'] ? 'STOPPED' : null,
7982
);
8083
}
@@ -93,6 +96,6 @@ public function renderPanel() {
9396
$out[] = $table->render();
9497

9598

96-
return phutil_implode_html("\n", $out);
99+
return implode("\n", $out);
97100
}
98101
}

src/aphront/console/plugin/DarkConsoleRequestPlugin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public function renderPanel() {
4343
$rows = array();
4444
foreach ($map as $key => $value) {
4545
$rows[] = array(
46-
$key,
47-
(is_array($value) ? json_encode($value) : $value),
46+
phutil_escape_html($key),
47+
phutil_escape_html(is_array($value) ? json_encode($value) : $value),
4848
);
4949
}
5050

@@ -62,6 +62,6 @@ public function renderPanel() {
6262
$out[] = $table->render();
6363
}
6464

65-
return phutil_implode_html("\n", $out);
65+
return implode("\n", $out);
6666
}
6767
}

src/aphront/console/plugin/DarkConsoleServicesPlugin.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,21 +149,20 @@ public function renderPanel() {
149149
$log = $data['log'];
150150
$results = array();
151151

152-
$results[] = hsprintf(
152+
$results[] =
153153
'<div class="dark-console-panel-header">'.
154-
'%s'.
154+
phutil_tag(
155+
'a',
156+
array(
157+
'href' => $data['analyzeURI'],
158+
'class' => $data['didAnalyze']
159+
? 'disabled button'
160+
: 'green button',
161+
),
162+
'Analyze Query Plans').
155163
'<h1>Calls to External Services</h1>'.
156164
'<div style="clear: both;"></div>'.
157-
'</div>',
158-
phutil_tag(
159-
'a',
160-
array(
161-
'href' => $data['analyzeURI'],
162-
'class' => $data['didAnalyze']
163-
? 'disabled button'
164-
: 'green button',
165-
),
166-
'Analyze Query Plans'));
165+
'</div>';
167166

168167
$page_total = $data['end'] - $data['start'];
169168
$totals = array();
@@ -225,26 +224,31 @@ public function renderPanel() {
225224
$row['explain']['reason']);
226225
}
227226

227+
$info = phutil_escape_html($info);
228228
break;
229229
case 'connect':
230230
$info = $row['host'].':'.$row['database'];
231+
$info = phutil_escape_html($info);
231232
break;
232233
case 'exec':
233234
$info = $row['command'];
235+
$info = phutil_escape_html($info);
234236
break;
235237
case 'conduit':
236238
$info = $row['method'];
239+
$info = phutil_escape_html($info);
237240
break;
238241
case 'http':
239242
$info = $row['uri'];
243+
$info = phutil_escape_html($info);
240244
break;
241245
default:
242246
$info = '-';
243247
break;
244248
}
245249

246250
$rows[] = array(
247-
$row['type'],
251+
phutil_escape_html($row['type']),
248252
'+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms',
249253
number_format(1000000 * $row['duration']).' us',
250254
$info,
@@ -272,7 +276,7 @@ public function renderPanel() {
272276

273277
$results[] = $table->render();
274278

275-
return phutil_implode_html("\n", $results);
279+
return implode("\n", $results);
276280
}
277281
}
278282

src/aphront/console/plugin/DarkConsoleXHProfPlugin.php

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,52 +51,48 @@ public function renderPanel() {
5151
'class' => 'bright-link',
5252
),
5353
'Installation Guide');
54-
return hsprintf(
54+
return
5555
'<div class="dark-console-no-content">'.
5656
'The "xhprof" PHP extension is not available. Install xhprof '.
5757
'to enable the XHProf console plugin. You can find instructions in '.
58-
'the %s.'.
59-
'</div>',
60-
$install_guide);
58+
'the '.$install_guide.'.'.
59+
'</div>';
6160
}
6261

6362
$result = array();
6463

65-
$header = hsprintf(
64+
$header =
6665
'<div class="dark-console-panel-header">'.
67-
'%s'.
66+
phutil_tag(
67+
'a',
68+
array(
69+
'href' => $profile_uri,
70+
'class' => $run
71+
? 'disabled button'
72+
: 'green button',
73+
),
74+
'Profile Page').
6875
'<h1>XHProf Profiler</h1>'.
69-
'</div>',
70-
phutil_tag(
71-
'a',
72-
array(
73-
'href' => $profile_uri,
74-
'class' => $run
75-
? 'disabled button'
76-
: 'green button',
77-
),
78-
'Profile Page'));
76+
'</div>';
7977
$result[] = $header;
8078

8179
if ($run) {
82-
$result[] = hsprintf(
83-
'<a href="/xhprof/profile/%s/" '.
80+
$result[] =
81+
'<a href="/xhprof/profile/'.$run.'/" '.
8482
'class="bright-link" '.
8583
'style="float: right; margin: 1em 2em 0 0;'.
8684
'font-weight: bold;" '.
8785
'target="_blank">Profile Permalink</a>'.
88-
'<iframe src="/xhprof/profile/%s/?frame=true"></iframe>',
89-
$run,
90-
$run);
86+
'<iframe src="/xhprof/profile/'.$run.'/?frame=true"></iframe>';
9187
} else {
92-
$result[] = hsprintf(
88+
$result[] =
9389
'<div class="dark-console-no-content">'.
9490
'Profiling was not enabled for this page. Use the button above '.
9591
'to enable it.'.
96-
'</div>');
92+
'</div>';
9793
}
9894

99-
return phutil_implode_html("\n", $result);
95+
return implode("\n", $result);
10096
}
10197

10298

src/aphront/response/Aphront403Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function buildResponseString() {
2626
}
2727
$failure = new AphrontRequestFailureView();
2828
$failure->setHeader('403 Forbidden');
29-
$failure->appendChild(phutil_tag('p', array(), $forbidden_text));
29+
$failure->appendChild('<p>'.$forbidden_text.'</p>');
3030

3131
$view = new PhabricatorStandardPageView();
3232
$view->setTitle('403 Forbidden');

src/aphront/response/Aphront404Response.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public function getHTTPResponseCode() {
1212
public function buildResponseString() {
1313
$failure = new AphrontRequestFailureView();
1414
$failure->setHeader('404 Not Found');
15-
$failure->appendChild(phutil_tag('p', array(), pht(
16-
'The page you requested was not found.')));
15+
$failure->appendChild('<p>The page you requested was not found.</p>');
1716

1817
$view = new PhabricatorStandardPageView();
1918
$view->setTitle('404 Not Found');

src/aphront/response/AphrontWebpageResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function setContent($content) {
1313
}
1414

1515
public function buildResponseString() {
16-
return hsprintf('%s', $this->content);
16+
return $this->content;
1717
}
1818

1919
}

0 commit comments

Comments
 (0)