mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
Replace some hsprintf() with phutil_tag()
Summary: I just want to make sure that this is the style we want. It seems less readable to me in some cases. Test Plan: Looked at DarkConsole with errors. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7533
This commit is contained in:
parent
3eaac9eda9
commit
aca621e21f
5 changed files with 76 additions and 70 deletions
|
@ -248,13 +248,13 @@ class AphrontDefaultApplicationConfiguration
|
|||
$trace = null;
|
||||
}
|
||||
|
||||
$content = hsprintf(
|
||||
'<div class="aphront-unhandled-exception">'.
|
||||
'<div class="exception-message">%s</div>'.
|
||||
'%s'.
|
||||
'</div>',
|
||||
$message,
|
||||
$trace);
|
||||
$content = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'aphront-unhandled-exception'),
|
||||
array(
|
||||
phutil_tag('div', array('class' => 'exception-message'), $message),
|
||||
$trace,
|
||||
));
|
||||
|
||||
$dialog = new AphrontDialogView();
|
||||
$dialog
|
||||
|
@ -384,12 +384,16 @@ class AphrontDefaultApplicationConfiguration
|
|||
'wide',
|
||||
));
|
||||
|
||||
return hsprintf(
|
||||
'<div class="exception-trace">'.
|
||||
'<div class="exception-trace-header">Stack Trace</div>'.
|
||||
'%s'.
|
||||
'</div>',
|
||||
$table->render());
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array('class' => 'exception-trace'),
|
||||
array(
|
||||
phutil_tag(
|
||||
'div',
|
||||
array('class' => 'exception-trace-header'),
|
||||
pht('Stack Trace')),
|
||||
$table->render(),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -90,13 +90,13 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
|
|||
$table->setHeaders(array('Error'));
|
||||
$table->setNoDataString('No errors.');
|
||||
|
||||
return hsprintf(
|
||||
'<div>'.
|
||||
'<div>%s</div>'.
|
||||
'<pre class="PhabricatorMonospaced">%s</pre>'.
|
||||
'</div>',
|
||||
$table->render(),
|
||||
phutil_implode_html('', $details));
|
||||
return phutil_tag(
|
||||
'div',
|
||||
array(),
|
||||
array(
|
||||
phutil_tag('div', array(), $table->render()),
|
||||
phutil_tag('pre', array('class' => 'PhabricatorMonospaced'), $details),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,10 +42,10 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin {
|
|||
|
||||
$out = array();
|
||||
|
||||
$out[] = hsprintf(
|
||||
'<div class="dark-console-panel-header">'.
|
||||
'<h1>Registered Event Listeners</h1>'.
|
||||
'</div>');
|
||||
$out[] = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'dark-console-panel-header'),
|
||||
phutil_tag('h1', array(), pht('Registered Event Listeners')));
|
||||
|
||||
$rows = array();
|
||||
foreach ($data['listeners'] as $listener) {
|
||||
|
@ -66,10 +66,10 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin {
|
|||
|
||||
$out[] = $table->render();
|
||||
|
||||
$out[] = hsprintf(
|
||||
'<div class="dark-console-panel-header">'.
|
||||
'<h1>Event Log</h1>'.
|
||||
'</div>');
|
||||
$out[] = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'dark-console-panel-header'),
|
||||
phutil_tag('h1', array(), pht('Event Log')));
|
||||
|
||||
$rows = array();
|
||||
foreach ($data['events'] as $event) {
|
||||
|
|
|
@ -149,21 +149,20 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
|
|||
$log = $data['log'];
|
||||
$results = array();
|
||||
|
||||
$results[] = hsprintf(
|
||||
'<div class="dark-console-panel-header">'.
|
||||
'%s'.
|
||||
'<h1>Calls to External Services</h1>'.
|
||||
'<div style="clear: both;"></div>'.
|
||||
'</div>',
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $data['analyzeURI'],
|
||||
'class' => $data['didAnalyze']
|
||||
? 'disabled button'
|
||||
: 'green button',
|
||||
),
|
||||
'Analyze Query Plans'));
|
||||
$results[] = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'dark-console-panel-header'),
|
||||
array(
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $data['analyzeURI'],
|
||||
'class' => $data['didAnalyze'] ? 'disabled button' : 'green button',
|
||||
),
|
||||
pht('Analyze Query Plans')),
|
||||
phutil_tag('h1', array(), pht('Calls to External Services')),
|
||||
phutil_tag('div', array('style' => 'clear: both;')),
|
||||
));
|
||||
|
||||
$page_total = $data['end'] - $data['start'];
|
||||
$totals = array();
|
||||
|
|
|
@ -62,38 +62,41 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin {
|
|||
|
||||
$result = array();
|
||||
|
||||
$header = hsprintf(
|
||||
'<div class="dark-console-panel-header">'.
|
||||
'%s'.
|
||||
'<h1>XHProf Profiler</h1>'.
|
||||
'</div>',
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $profile_uri,
|
||||
'class' => $run
|
||||
? 'disabled button'
|
||||
: 'green button',
|
||||
),
|
||||
'Profile Page'));
|
||||
$header = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'dark-console-panel-header'),
|
||||
array(
|
||||
phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $profile_uri,
|
||||
'class' => $run ? 'disabled button' : 'green button',
|
||||
),
|
||||
pht('Profile Page')),
|
||||
phutil_tag('h1', array(), pht('XHProf Profiler')),
|
||||
));
|
||||
$result[] = $header;
|
||||
|
||||
if ($run) {
|
||||
$result[] = hsprintf(
|
||||
'<a href="/xhprof/profile/%s/" '.
|
||||
'class="bright-link" '.
|
||||
'style="float: right; margin: 1em 2em 0 0;'.
|
||||
'font-weight: bold;" '.
|
||||
'target="_blank">Profile Permalink</a>'.
|
||||
'<iframe src="/xhprof/profile/%s/?frame=true"></iframe>',
|
||||
$run,
|
||||
$run);
|
||||
$result[] = phutil_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => "/xhprof/profile/$run/",
|
||||
'class' => 'bright-link',
|
||||
'style' => 'float: right; margin: 1em 2em 0 0; font-weight: bold;',
|
||||
'target' => '_blank',
|
||||
),
|
||||
pht('Profile Permalink'));
|
||||
$result = phutil_tag(
|
||||
'iframe',
|
||||
array('src' => "/xhprof/profile/$run/?frame=true"));
|
||||
} else {
|
||||
$result[] = hsprintf(
|
||||
'<div class="dark-console-no-content">'.
|
||||
$result[] = phutil_tag(
|
||||
'div',
|
||||
array('class' => 'dark-console-no-content'),
|
||||
pht(
|
||||
'Profiling was not enabled for this page. Use the button above '.
|
||||
'to enable it.'.
|
||||
'</div>');
|
||||
'to enable it.'));
|
||||
}
|
||||
|
||||
return phutil_implode_html("\n", $result);
|
||||
|
|
Loading…
Reference in a new issue