Skip to content

Commit ef7f161

Browse files
author
epriestley
committed
Restore merge of phutil_tag.
1 parent 73cce6e commit ef7f161

File tree

264 files changed

+1690
-1716
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

+1690
-1716
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_render_form(), JX.Request,
12+
// certain requests (e.g., by phabricator_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: 17 additions & 14 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(phutil_escape_html($ex->getTitle()));
213+
$error->setTitle($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 = phutil_escape_html(get_class($ex));
231-
$message = phutil_escape_html($ex->getMessage());
230+
$class = get_class($ex);
231+
$message = $ex->getMessage();
232232

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

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

253255
$dialog = new AphrontDialogView();
254256
$dialog
@@ -348,17 +350,17 @@ private function renderStackTrace($trace, PhabricatorUser $user) {
348350
),
349351
$relative);
350352
}
351-
$file_name = $file_name.' : '.(int)$part['line'];
353+
$file_name = hsprintf('%s : %d', $file_name, $part['line']);
352354
} else {
353-
$file_name = '<em>(Internal)</em>';
355+
$file_name = phutil_tag('em', array(), '(Internal)');
354356
}
355357

356358

357359
$rows[] = array(
358360
$depth--,
359-
phutil_escape_html($lib),
361+
$lib,
360362
$file_name,
361-
phutil_escape_html($where),
363+
$where,
362364
);
363365
}
364366
$table = new AphrontTableView($rows);
@@ -377,11 +379,12 @@ private function renderStackTrace($trace, PhabricatorUser $user) {
377379
'wide',
378380
));
379381

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

387390
}

src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php

Lines changed: 16 additions & 14 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 = '';
39+
$details = array();
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 .=
54-
'<div class="dark-console-panel-error-details" id="row-details-'.
55-
$index.'">'.
56-
phutil_escape_html($row['details'])."\n".
57-
'Stack trace:'."\n";
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']);
5858

5959
foreach ($row['trace'] as $key => $entry) {
6060
$line = '';
@@ -73,28 +73,30 @@ 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 .= '</div>';
85+
$details[] = hsprintf('</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 '<div>'.
94-
'<div>'.$table->render().'</div>'.
95-
'<pre class="PhabricatorMonospaced">'.
96-
$details.'</pre>'.
97-
'</div>';
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));
98100
}
99101
}
100102

src/aphront/console/plugin/DarkConsoleEventPlugin.php

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

4343
$out = array();
4444

45-
$out[] =
45+
$out[] = hsprintf(
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(
53-
phutil_escape_html($listener['id']),
54-
phutil_escape_html($listener['class']),
55-
);
52+
$rows[] = array($listener['id'], $listener['class']);
5653
}
5754

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

7067
$out[] = $table->render();
7168

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

7774
$rows = array();
7875
foreach ($data['events'] as $event) {
7976
$rows[] = array(
80-
phutil_escape_html($event['type']),
77+
$event['type'],
8178
$event['stopped'] ? 'STOPPED' : null,
8279
);
8380
}
@@ -96,6 +93,6 @@ public function renderPanel() {
9693
$out[] = $table->render();
9794

9895

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

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-
phutil_escape_html($key),
47-
phutil_escape_html(is_array($value) ? json_encode($value) : $value),
46+
$key,
47+
(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 implode("\n", $out);
65+
return phutil_implode_html("\n", $out);
6666
}
6767
}

src/aphront/console/plugin/DarkConsoleServicesPlugin.php

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

152-
$results[] =
152+
$results[] = hsprintf(
153153
'<div class="dark-console-panel-header">'.
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').
154+
'%s'.
163155
'<h1>Calls to External Services</h1>'.
164156
'<div style="clear: both;"></div>'.
165-
'</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'));
166167

167168
$page_total = $data['end'] - $data['start'];
168169
$totals = array();
@@ -224,31 +225,26 @@ public function renderPanel() {
224225
$row['explain']['reason']);
225226
}
226227

227-
$info = phutil_escape_html($info);
228228
break;
229229
case 'connect':
230230
$info = $row['host'].':'.$row['database'];
231-
$info = phutil_escape_html($info);
232231
break;
233232
case 'exec':
234233
$info = $row['command'];
235-
$info = phutil_escape_html($info);
236234
break;
237235
case 'conduit':
238236
$info = $row['method'];
239-
$info = phutil_escape_html($info);
240237
break;
241238
case 'http':
242239
$info = $row['uri'];
243-
$info = phutil_escape_html($info);
244240
break;
245241
default:
246242
$info = '-';
247243
break;
248244
}
249245

250246
$rows[] = array(
251-
phutil_escape_html($row['type']),
247+
$row['type'],
252248
'+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms',
253249
number_format(1000000 * $row['duration']).' us',
254250
$info,
@@ -276,7 +272,7 @@ public function renderPanel() {
276272

277273
$results[] = $table->render();
278274

279-
return implode("\n", $results);
275+
return phutil_implode_html("\n", $results);
280276
}
281277
}
282278

src/aphront/console/plugin/DarkConsoleXHProfPlugin.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,48 +51,52 @@ public function renderPanel() {
5151
'class' => 'bright-link',
5252
),
5353
'Installation Guide');
54-
return
54+
return hsprintf(
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 '.$install_guide.'.'.
59-
'</div>';
58+
'the %s.'.
59+
'</div>',
60+
$install_guide);
6061
}
6162

6263
$result = array();
6364

64-
$header =
65+
$header = hsprintf(
6566
'<div class="dark-console-panel-header">'.
66-
phutil_tag(
67-
'a',
68-
array(
69-
'href' => $profile_uri,
70-
'class' => $run
71-
? 'disabled button'
72-
: 'green button',
73-
),
74-
'Profile Page').
67+
'%s'.
7568
'<h1>XHProf Profiler</h1>'.
76-
'</div>';
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'));
7779
$result[] = $header;
7880

7981
if ($run) {
80-
$result[] =
81-
'<a href="/xhprof/profile/'.$run.'/" '.
82+
$result[] = hsprintf(
83+
'<a href="/xhprof/profile/%s/" '.
8284
'class="bright-link" '.
8385
'style="float: right; margin: 1em 2em 0 0;'.
8486
'font-weight: bold;" '.
8587
'target="_blank">Profile Permalink</a>'.
86-
'<iframe src="/xhprof/profile/'.$run.'/?frame=true"></iframe>';
88+
'<iframe src="/xhprof/profile/%s/?frame=true"></iframe>',
89+
$run,
90+
$run);
8791
} else {
88-
$result[] =
92+
$result[] = hsprintf(
8993
'<div class="dark-console-no-content">'.
9094
'Profiling was not enabled for this page. Use the button above '.
9195
'to enable it.'.
92-
'</div>';
96+
'</div>');
9397
}
9498

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

98102

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('<p>'.$forbidden_text.'</p>');
29+
$failure->appendChild(phutil_tag('p', array(), $forbidden_text));
3030

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

src/aphront/response/Aphront404Response.php

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

1718
$view = new PhabricatorStandardPageView();
1819
$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 $this->content;
16+
return hsprintf('%s', $this->content);
1717
}
1818

1919
}

0 commit comments

Comments
 (0)