@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+76 -70
+17 -13
src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
··· 248 248 $trace = null; 249 249 } 250 250 251 - $content = hsprintf( 252 - '<div class="aphront-unhandled-exception">'. 253 - '<div class="exception-message">%s</div>'. 254 - '%s'. 255 - '</div>', 256 - $message, 257 - $trace); 251 + $content = phutil_tag( 252 + 'div', 253 + array('class' => 'aphront-unhandled-exception'), 254 + array( 255 + phutil_tag('div', array('class' => 'exception-message'), $message), 256 + $trace, 257 + )); 258 258 259 259 $dialog = new AphrontDialogView(); 260 260 $dialog ··· 384 384 'wide', 385 385 )); 386 386 387 - return hsprintf( 388 - '<div class="exception-trace">'. 389 - '<div class="exception-trace-header">Stack Trace</div>'. 390 - '%s'. 391 - '</div>', 392 - $table->render()); 387 + return phutil_tag( 388 + 'div', 389 + array('class' => 'exception-trace'), 390 + array( 391 + phutil_tag( 392 + 'div', 393 + array('class' => 'exception-trace-header'), 394 + pht('Stack Trace')), 395 + $table->render(), 396 + )); 393 397 } 394 398 395 399 }
+7 -7
src/aphront/console/plugin/DarkConsoleErrorLogPlugin.php
··· 90 90 $table->setHeaders(array('Error')); 91 91 $table->setNoDataString('No errors.'); 92 92 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 phutil_tag( 94 + 'div', 95 + array(), 96 + array( 97 + phutil_tag('div', array(), $table->render()), 98 + phutil_tag('pre', array('class' => 'PhabricatorMonospaced'), $details), 99 + )); 100 100 } 101 101 } 102 102
+8 -8
src/aphront/console/plugin/DarkConsoleEventPlugin.php
··· 42 42 43 43 $out = array(); 44 44 45 - $out[] = hsprintf( 46 - '<div class="dark-console-panel-header">'. 47 - '<h1>Registered Event Listeners</h1>'. 48 - '</div>'); 45 + $out[] = phutil_tag( 46 + 'div', 47 + array('class' => 'dark-console-panel-header'), 48 + phutil_tag('h1', array(), pht('Registered Event Listeners'))); 49 49 50 50 $rows = array(); 51 51 foreach ($data['listeners'] as $listener) { ··· 66 66 67 67 $out[] = $table->render(); 68 68 69 - $out[] = hsprintf( 70 - '<div class="dark-console-panel-header">'. 71 - '<h1>Event Log</h1>'. 72 - '</div>'); 69 + $out[] = phutil_tag( 70 + 'div', 71 + array('class' => 'dark-console-panel-header'), 72 + phutil_tag('h1', array(), pht('Event Log'))); 73 73 74 74 $rows = array(); 75 75 foreach ($data['events'] as $event) {
+14 -15
src/aphront/console/plugin/DarkConsoleServicesPlugin.php
··· 149 149 $log = $data['log']; 150 150 $results = array(); 151 151 152 - $results[] = hsprintf( 153 - '<div class="dark-console-panel-header">'. 154 - '%s'. 155 - '<h1>Calls to External Services</h1>'. 156 - '<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')); 152 + $results[] = phutil_tag( 153 + 'div', 154 + array('class' => 'dark-console-panel-header'), 155 + array( 156 + phutil_tag( 157 + 'a', 158 + array( 159 + 'href' => $data['analyzeURI'], 160 + 'class' => $data['didAnalyze'] ? 'disabled button' : 'green button', 161 + ), 162 + pht('Analyze Query Plans')), 163 + phutil_tag('h1', array(), pht('Calls to External Services')), 164 + phutil_tag('div', array('style' => 'clear: both;')), 165 + )); 167 166 168 167 $page_total = $data['end'] - $data['start']; 169 168 $totals = array();
+30 -27
src/aphront/console/plugin/DarkConsoleXHProfPlugin.php
··· 62 62 63 63 $result = array(); 64 64 65 - $header = hsprintf( 66 - '<div class="dark-console-panel-header">'. 67 - '%s'. 68 - '<h1>XHProf Profiler</h1>'. 69 - '</div>', 70 - phutil_tag( 65 + $header = phutil_tag( 66 + 'div', 67 + array('class' => 'dark-console-panel-header'), 68 + array( 69 + phutil_tag( 70 + 'a', 71 + array( 72 + 'href' => $profile_uri, 73 + 'class' => $run ? 'disabled button' : 'green button', 74 + ), 75 + pht('Profile Page')), 76 + phutil_tag('h1', array(), pht('XHProf Profiler')), 77 + )); 78 + $result[] = $header; 79 + 80 + if ($run) { 81 + $result[] = phutil_tag( 71 82 'a', 72 83 array( 73 - 'href' => $profile_uri, 74 - 'class' => $run 75 - ? 'disabled button' 76 - : 'green button', 84 + 'href' => "/xhprof/profile/$run/", 85 + 'class' => 'bright-link', 86 + 'style' => 'float: right; margin: 1em 2em 0 0; font-weight: bold;', 87 + 'target' => '_blank', 77 88 ), 78 - 'Profile Page')); 79 - $result[] = $header; 80 - 81 - if ($run) { 82 - $result[] = hsprintf( 83 - '<a href="/xhprof/profile/%s/" '. 84 - 'class="bright-link" '. 85 - 'style="float: right; margin: 1em 2em 0 0;'. 86 - 'font-weight: bold;" '. 87 - 'target="_blank">Profile Permalink</a>'. 88 - '<iframe src="/xhprof/profile/%s/?frame=true"></iframe>', 89 - $run, 90 - $run); 89 + pht('Profile Permalink')); 90 + $result = phutil_tag( 91 + 'iframe', 92 + array('src' => "/xhprof/profile/$run/?frame=true")); 91 93 } else { 92 - $result[] = hsprintf( 93 - '<div class="dark-console-no-content">'. 94 + $result[] = phutil_tag( 95 + 'div', 96 + array('class' => 'dark-console-no-content'), 97 + pht( 94 98 'Profiling was not enabled for this page. Use the button above '. 95 - 'to enable it.'. 96 - '</div>'); 99 + 'to enable it.')); 97 100 } 98 101 99 102 return phutil_implode_html("\n", $result);