1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-21 11:09:02 +01:00

Promote phutil_tag

Summary: Fixes T2432. Anything else we should do before we land this? I'll land the lint rules at the same time.

Test Plan: See D4807.

Reviewers: vrana, btrahan

CC: aran, lesha, edward

Maniphest Tasks: T2432

Differential Revision: https://secure.phabricator.com/D4822
This commit is contained in:
epriestley 2013-02-07 08:12:09 -08:00
commit 3706ec4879
352 changed files with 3627 additions and 3309 deletions

View file

@ -87,7 +87,18 @@ JX.$ = function(id) {
JX.install('HTML', { JX.install('HTML', {
construct : function(str) { construct : function(str) {
if (str instanceof JX.HTML) {
this._content = str._content;
return;
}
if (__DEV__) { if (__DEV__) {
if ((typeof str !== 'string') && (!str || !str.match)) {
JX.$E(
'new JX.HTML(<empty?>): ' +
'call initializes an HTML object with an empty value.');
}
var tags = ['legend', 'thead', 'tbody', 'tfoot', 'column', 'colgroup', var tags = ['legend', 'thead', 'tbody', 'tfoot', 'column', 'colgroup',
'caption', 'tr', 'th', 'td', 'option']; 'caption', 'tr', 'th', 'td', 'option'];
var evil_stuff = new RegExp('^\\s*<(' + tags.join('|') + ')\\b', 'i'); var evil_stuff = new RegExp('^\\s*<(' + tags.join('|') + ')\\b', 'i');

View file

@ -1666,7 +1666,7 @@ CREATE TABLE `ponder_question` (
UNIQUE KEY `phid` (`phid`), UNIQUE KEY `phid` (`phid`),
KEY `authorPHID` (`authorPHID`), KEY `authorPHID` (`authorPHID`),
KEY `heat` (`heat`) KEY `heat` (`heat`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=11;
CREATE DATABASE `{$NAMESPACE}_project` /*!40100 DEFAULT CHARACTER SET utf8 */; CREATE DATABASE `{$NAMESPACE}_project` /*!40100 DEFAULT CHARACTER SET utf8 */;

View file

@ -81,7 +81,6 @@ $package_spec = array(
'aphront-pager-view-css', 'aphront-pager-view-css',
'phabricator-transaction-view-css', 'phabricator-transaction-view-css',
'aphront-tooltip-css', 'aphront-tooltip-css',
'aphront-headsup-view-css',
'phabricator-flag-css', 'phabricator-flag-css',
'aphront-error-view-css', 'aphront-error-view-css',
@ -115,7 +114,6 @@ $package_spec = array(
'differential-revision-add-comment-css', 'differential-revision-add-comment-css',
'differential-revision-comment-list-css', 'differential-revision-comment-list-css',
'phabricator-object-selector-css', 'phabricator-object-selector-css',
'aphront-headsup-action-list-view-css',
'phabricator-content-source-view-css', 'phabricator-content-source-view-css',
'differential-local-commits-view-css', 'differential-local-commits-view-css',
'inline-comment-summary-css', 'inline-comment-summary-css',
@ -166,7 +164,6 @@ $package_spec = array(
'javelin-behavior-maniphest-subpriority-editor', 'javelin-behavior-maniphest-subpriority-editor',
), ),
'darkconsole.pkg.js' => array( 'darkconsole.pkg.js' => array(
'javelin-behavior-dark-console-ajax',
'javelin-behavior-dark-console', 'javelin-behavior-dark-console',
'javelin-behavior-error-log', 'javelin-behavior-error-log',
), ),

View file

@ -42,6 +42,13 @@ celerity_register_resource_map(array(
'disk' => '/rsrc/image/credit_cards.png', 'disk' => '/rsrc/image/credit_cards.png',
'type' => 'png', 'type' => 'png',
), ),
'/rsrc/image/darkload.gif' =>
array(
'hash' => '3a52cb7145d6e70f461fed21273117f2',
'uri' => '/res/3a52cb71/rsrc/image/darkload.gif',
'disk' => '/rsrc/image/darkload.gif',
'type' => 'gif',
),
'/rsrc/image/divot.png' => '/rsrc/image/divot.png' =>
array( array(
'hash' => '3be267bd11ea375bf68e808893718e0e', 'hash' => '3be267bd11ea375bf68e808893718e0e',
@ -612,7 +619,7 @@ celerity_register_resource_map(array(
), ),
'aphront-dark-console-css' => 'aphront-dark-console-css' =>
array( array(
'uri' => '/res/1e1f78d4/rsrc/css/aphront/dark-console.css', 'uri' => '/res/63841304/rsrc/css/aphront/dark-console.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -646,24 +653,6 @@ celerity_register_resource_map(array(
), ),
'disk' => '/rsrc/css/aphront/form-view.css', 'disk' => '/rsrc/css/aphront/form-view.css',
), ),
'aphront-headsup-action-list-view-css' =>
array(
'uri' => '/res/1dce0ad7/rsrc/css/aphront/headsup-action-list-view.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/headsup-action-list-view.css',
),
'aphront-headsup-view-css' =>
array(
'uri' => '/res/73874cd2/rsrc/css/aphront/headsup.css',
'type' => 'css',
'requires' =>
array(
),
'disk' => '/rsrc/css/aphront/headsup.css',
),
'aphront-list-filter-view-css' => 'aphront-list-filter-view-css' =>
array( array(
'uri' => '/res/e783d6e1/rsrc/css/aphront/list-filter-view.css', 'uri' => '/res/e783d6e1/rsrc/css/aphront/list-filter-view.css',
@ -1084,7 +1073,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-aphront-form-disable-on-submit' => 'javelin-behavior-aphront-form-disable-on-submit' =>
array( array(
'uri' => '/res/f5cb51f1/rsrc/js/application/core/behavior-form.js', 'uri' => '/res/b5052cd0/rsrc/js/application/core/behavior-form.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -1185,7 +1174,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-dark-console' => 'javelin-behavior-dark-console' =>
array( array(
'uri' => '/res/aa6f8a71/rsrc/js/application/core/behavior-dark-console.js', 'uri' => '/res/ae7f15ce/rsrc/js/application/core/behavior-dark-console.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -1195,21 +1184,9 @@ celerity_register_resource_map(array(
3 => 'javelin-dom', 3 => 'javelin-dom',
4 => 'javelin-request', 4 => 'javelin-request',
5 => 'phabricator-keyboard-shortcut', 5 => 'phabricator-keyboard-shortcut',
6 => 'javelin-behavior-dark-console-ajax',
), ),
'disk' => '/rsrc/js/application/core/behavior-dark-console.js', 'disk' => '/rsrc/js/application/core/behavior-dark-console.js',
), ),
'javelin-behavior-dark-console-ajax' =>
array(
'uri' => '/res/ac3ab63a/rsrc/js/application/core/behavior-dark-console-ajax.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-dom',
),
'disk' => '/rsrc/js/application/core/behavior-dark-console-ajax.js',
),
'javelin-behavior-device' => 'javelin-behavior-device' =>
array( array(
'uri' => '/res/a10b851b/rsrc/js/application/core/behavior-device.js', 'uri' => '/res/a10b851b/rsrc/js/application/core/behavior-device.js',
@ -1534,7 +1511,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-lightbox-attachments' => 'javelin-behavior-lightbox-attachments' =>
array( array(
'uri' => '/res/5efba371/rsrc/js/application/core/behavior-lightbox-attachments.js', 'uri' => '/res/08f5e202/rsrc/js/application/core/behavior-lightbox-attachments.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -1889,7 +1866,7 @@ celerity_register_resource_map(array(
), ),
'javelin-behavior-pholio-mock-view' => 'javelin-behavior-pholio-mock-view' =>
array( array(
'uri' => '/res/518a169e/rsrc/js/application/pholio/behavior-pholio-mock-view.js', 'uri' => '/res/e5f432ac/rsrc/js/application/pholio/behavior-pholio-mock-view.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -2054,7 +2031,7 @@ celerity_register_resource_map(array(
), ),
'javelin-dom' => 'javelin-dom' =>
array( array(
'uri' => '/res/2826c532/rsrc/js/javelin/lib/DOM.js', 'uri' => '/res/459f3c08/rsrc/js/javelin/lib/DOM.js',
'type' => 'js', 'type' => 'js',
'requires' => 'requires' =>
array( array(
@ -2614,7 +2591,7 @@ celerity_register_resource_map(array(
), ),
'phabricator-core-css' => 'phabricator-core-css' =>
array( array(
'uri' => '/res/27afb689/rsrc/css/core/core.css', 'uri' => '/res/2a055ecb/rsrc/css/core/core.css',
'type' => 'css', 'type' => 'css',
'requires' => 'requires' =>
array( array(
@ -3423,7 +3400,7 @@ celerity_register_resource_map(array(
), array( ), array(
'packages' => 'packages' =>
array( array(
'77c4590d' => 'acc46105' =>
array( array(
'name' => 'core.pkg.css', 'name' => 'core.pkg.css',
'symbols' => 'symbols' =>
@ -3447,30 +3424,29 @@ celerity_register_resource_map(array(
16 => 'aphront-pager-view-css', 16 => 'aphront-pager-view-css',
17 => 'phabricator-transaction-view-css', 17 => 'phabricator-transaction-view-css',
18 => 'aphront-tooltip-css', 18 => 'aphront-tooltip-css',
19 => 'aphront-headsup-view-css', 19 => 'phabricator-flag-css',
20 => 'phabricator-flag-css', 20 => 'aphront-error-view-css',
21 => 'aphront-error-view-css', 21 => 'sprite-icon-css',
22 => 'sprite-icon-css', 22 => 'sprite-gradient-css',
23 => 'sprite-gradient-css', 23 => 'sprite-menu-css',
24 => 'sprite-menu-css', 24 => 'sprite-apps-large-css',
25 => 'sprite-apps-large-css', 25 => 'phabricator-main-menu-view',
26 => 'phabricator-main-menu-view', 26 => 'phabricator-notification-css',
27 => 'phabricator-notification-css', 27 => 'phabricator-notification-menu-css',
28 => 'phabricator-notification-menu-css', 28 => 'lightbox-attachment-css',
29 => 'lightbox-attachment-css', 29 => 'phabricator-header-view-css',
30 => 'phabricator-header-view-css', 30 => 'phabricator-form-view-css',
31 => 'phabricator-form-view-css', 31 => 'phabricator-filetree-view-css',
32 => 'phabricator-filetree-view-css', 32 => 'phabricator-nav-view-css',
33 => 'phabricator-nav-view-css', 33 => 'phabricator-side-menu-view-css',
34 => 'phabricator-side-menu-view-css', 34 => 'phabricator-crumbs-view-css',
35 => 'phabricator-crumbs-view-css', 35 => 'phabricator-object-item-list-view-css',
36 => 'phabricator-object-item-list-view-css', 36 => 'global-drag-and-drop-css',
37 => 'global-drag-and-drop-css',
), ),
'uri' => '/res/pkg/77c4590d/core.pkg.css', 'uri' => '/res/pkg/acc46105/core.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'58743fec' => 'bc0774e5' =>
array( array(
'name' => 'core.pkg.js', 'name' => 'core.pkg.js',
'symbols' => 'symbols' =>
@ -3509,22 +3485,21 @@ celerity_register_resource_map(array(
31 => 'javelin-behavior-global-drag-and-drop', 31 => 'javelin-behavior-global-drag-and-drop',
32 => 'javelin-behavior-phabricator-home-reveal-tiles', 32 => 'javelin-behavior-phabricator-home-reveal-tiles',
), ),
'uri' => '/res/pkg/58743fec/core.pkg.js', 'uri' => '/res/pkg/bc0774e5/core.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'8edbada5' => '3e0098ea' =>
array( array(
'name' => 'darkconsole.pkg.js', 'name' => 'darkconsole.pkg.js',
'symbols' => 'symbols' =>
array( array(
0 => 'javelin-behavior-dark-console-ajax', 0 => 'javelin-behavior-dark-console',
1 => 'javelin-behavior-dark-console', 1 => 'javelin-behavior-error-log',
2 => 'javelin-behavior-error-log',
), ),
'uri' => '/res/pkg/8edbada5/darkconsole.pkg.js', 'uri' => '/res/pkg/3e0098ea/darkconsole.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'ec01d039' => '8aaacd1b' =>
array( array(
'name' => 'differential.pkg.css', 'name' => 'differential.pkg.css',
'symbols' => 'symbols' =>
@ -3539,12 +3514,11 @@ celerity_register_resource_map(array(
7 => 'differential-revision-add-comment-css', 7 => 'differential-revision-add-comment-css',
8 => 'differential-revision-comment-list-css', 8 => 'differential-revision-comment-list-css',
9 => 'phabricator-object-selector-css', 9 => 'phabricator-object-selector-css',
10 => 'aphront-headsup-action-list-view-css', 10 => 'phabricator-content-source-view-css',
11 => 'phabricator-content-source-view-css', 11 => 'differential-local-commits-view-css',
12 => 'differential-local-commits-view-css', 12 => 'inline-comment-summary-css',
13 => 'inline-comment-summary-css',
), ),
'uri' => '/res/pkg/ec01d039/differential.pkg.css', 'uri' => '/res/pkg/8aaacd1b/differential.pkg.css',
'type' => 'css', 'type' => 'css',
), ),
'95d0d865' => '95d0d865' =>
@ -3598,7 +3572,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/f96657b8/diffusion.pkg.js', 'uri' => '/res/pkg/f96657b8/diffusion.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'88225b70' => 'd466c034' =>
array( array(
'name' => 'javelin.pkg.js', 'name' => 'javelin.pkg.js',
'symbols' => 'symbols' =>
@ -3623,7 +3597,7 @@ celerity_register_resource_map(array(
17 => 'javelin-typeahead-ondemand-source', 17 => 'javelin-typeahead-ondemand-source',
18 => 'javelin-tokenizer', 18 => 'javelin-tokenizer',
), ),
'uri' => '/res/pkg/88225b70/javelin.pkg.js', 'uri' => '/res/pkg/d466c034/javelin.pkg.js',
'type' => 'js', 'type' => 'js',
), ),
'e30a3fa8' => 'e30a3fa8' =>
@ -3657,46 +3631,43 @@ celerity_register_resource_map(array(
'reverse' => 'reverse' =>
array( array(
'aphront-attached-file-view-css' => 'e30a3fa8', 'aphront-attached-file-view-css' => 'e30a3fa8',
'aphront-crumbs-view-css' => '77c4590d', 'aphront-crumbs-view-css' => 'acc46105',
'aphront-dialog-view-css' => '77c4590d', 'aphront-dialog-view-css' => 'acc46105',
'aphront-error-view-css' => '77c4590d', 'aphront-error-view-css' => 'acc46105',
'aphront-form-view-css' => '77c4590d', 'aphront-form-view-css' => 'acc46105',
'aphront-headsup-action-list-view-css' => 'ec01d039', 'aphront-list-filter-view-css' => 'acc46105',
'aphront-headsup-view-css' => '77c4590d', 'aphront-pager-view-css' => 'acc46105',
'aphront-list-filter-view-css' => '77c4590d', 'aphront-panel-view-css' => 'acc46105',
'aphront-pager-view-css' => '77c4590d', 'aphront-table-view-css' => 'acc46105',
'aphront-panel-view-css' => '77c4590d', 'aphront-tokenizer-control-css' => 'acc46105',
'aphront-table-view-css' => '77c4590d', 'aphront-tooltip-css' => 'acc46105',
'aphront-tokenizer-control-css' => '77c4590d', 'aphront-typeahead-control-css' => 'acc46105',
'aphront-tooltip-css' => '77c4590d', 'differential-changeset-view-css' => '8aaacd1b',
'aphront-typeahead-control-css' => '77c4590d', 'differential-core-view-css' => '8aaacd1b',
'differential-changeset-view-css' => 'ec01d039',
'differential-core-view-css' => 'ec01d039',
'differential-inline-comment-editor' => '95d0d865', 'differential-inline-comment-editor' => '95d0d865',
'differential-local-commits-view-css' => 'ec01d039', 'differential-local-commits-view-css' => '8aaacd1b',
'differential-results-table-css' => 'ec01d039', 'differential-results-table-css' => '8aaacd1b',
'differential-revision-add-comment-css' => 'ec01d039', 'differential-revision-add-comment-css' => '8aaacd1b',
'differential-revision-comment-css' => 'ec01d039', 'differential-revision-comment-css' => '8aaacd1b',
'differential-revision-comment-list-css' => 'ec01d039', 'differential-revision-comment-list-css' => '8aaacd1b',
'differential-revision-history-css' => 'ec01d039', 'differential-revision-history-css' => '8aaacd1b',
'differential-revision-list-css' => 'ec01d039', 'differential-revision-list-css' => '8aaacd1b',
'differential-table-of-contents-css' => 'ec01d039', 'differential-table-of-contents-css' => '8aaacd1b',
'diffusion-commit-view-css' => 'c8ce2d88', 'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88', 'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '77c4590d', 'global-drag-and-drop-css' => 'acc46105',
'inline-comment-summary-css' => 'ec01d039', 'inline-comment-summary-css' => '8aaacd1b',
'javelin-aphlict' => '58743fec', 'javelin-aphlict' => 'bc0774e5',
'javelin-behavior' => '88225b70', 'javelin-behavior' => 'd466c034',
'javelin-behavior-aphlict-dropdown' => '58743fec', 'javelin-behavior-aphlict-dropdown' => 'bc0774e5',
'javelin-behavior-aphlict-listen' => '58743fec', 'javelin-behavior-aphlict-listen' => 'bc0774e5',
'javelin-behavior-aphront-basic-tokenizer' => '58743fec', 'javelin-behavior-aphront-basic-tokenizer' => 'bc0774e5',
'javelin-behavior-aphront-drag-and-drop' => '95d0d865', 'javelin-behavior-aphront-drag-and-drop' => '95d0d865',
'javelin-behavior-aphront-drag-and-drop-textarea' => '95d0d865', 'javelin-behavior-aphront-drag-and-drop-textarea' => '95d0d865',
'javelin-behavior-aphront-form-disable-on-submit' => '58743fec', 'javelin-behavior-aphront-form-disable-on-submit' => 'bc0774e5',
'javelin-behavior-audit-preview' => 'f96657b8', 'javelin-behavior-audit-preview' => 'f96657b8',
'javelin-behavior-dark-console' => '8edbada5', 'javelin-behavior-dark-console' => '3e0098ea',
'javelin-behavior-dark-console-ajax' => '8edbada5', 'javelin-behavior-device' => 'bc0774e5',
'javelin-behavior-device' => '58743fec',
'javelin-behavior-differential-accept-with-errors' => '95d0d865', 'javelin-behavior-differential-accept-with-errors' => '95d0d865',
'javelin-behavior-differential-add-reviewers-and-ccs' => '95d0d865', 'javelin-behavior-differential-add-reviewers-and-ccs' => '95d0d865',
'javelin-behavior-differential-comment-jump' => '95d0d865', 'javelin-behavior-differential-comment-jump' => '95d0d865',
@ -3711,90 +3682,90 @@ celerity_register_resource_map(array(
'javelin-behavior-differential-user-select' => '95d0d865', 'javelin-behavior-differential-user-select' => '95d0d865',
'javelin-behavior-diffusion-commit-graph' => 'f96657b8', 'javelin-behavior-diffusion-commit-graph' => 'f96657b8',
'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8', 'javelin-behavior-diffusion-pull-lastmodified' => 'f96657b8',
'javelin-behavior-error-log' => '8edbada5', 'javelin-behavior-error-log' => '3e0098ea',
'javelin-behavior-global-drag-and-drop' => '58743fec', 'javelin-behavior-global-drag-and-drop' => 'bc0774e5',
'javelin-behavior-konami' => '58743fec', 'javelin-behavior-konami' => 'bc0774e5',
'javelin-behavior-lightbox-attachments' => '58743fec', 'javelin-behavior-lightbox-attachments' => 'bc0774e5',
'javelin-behavior-maniphest-batch-selector' => '7707de41', 'javelin-behavior-maniphest-batch-selector' => '7707de41',
'javelin-behavior-maniphest-subpriority-editor' => '7707de41', 'javelin-behavior-maniphest-subpriority-editor' => '7707de41',
'javelin-behavior-maniphest-transaction-controls' => '7707de41', 'javelin-behavior-maniphest-transaction-controls' => '7707de41',
'javelin-behavior-maniphest-transaction-expand' => '7707de41', 'javelin-behavior-maniphest-transaction-expand' => '7707de41',
'javelin-behavior-maniphest-transaction-preview' => '7707de41', 'javelin-behavior-maniphest-transaction-preview' => '7707de41',
'javelin-behavior-phabricator-active-nav' => '58743fec', 'javelin-behavior-phabricator-active-nav' => 'bc0774e5',
'javelin-behavior-phabricator-autofocus' => '58743fec', 'javelin-behavior-phabricator-autofocus' => 'bc0774e5',
'javelin-behavior-phabricator-home-reveal-tiles' => '58743fec', 'javelin-behavior-phabricator-home-reveal-tiles' => 'bc0774e5',
'javelin-behavior-phabricator-keyboard-shortcuts' => '58743fec', 'javelin-behavior-phabricator-keyboard-shortcuts' => 'bc0774e5',
'javelin-behavior-phabricator-nav' => '58743fec', 'javelin-behavior-phabricator-nav' => 'bc0774e5',
'javelin-behavior-phabricator-object-selector' => '95d0d865', 'javelin-behavior-phabricator-object-selector' => '95d0d865',
'javelin-behavior-phabricator-oncopy' => '58743fec', 'javelin-behavior-phabricator-oncopy' => 'bc0774e5',
'javelin-behavior-phabricator-remarkup-assist' => '58743fec', 'javelin-behavior-phabricator-remarkup-assist' => 'bc0774e5',
'javelin-behavior-phabricator-search-typeahead' => '58743fec', 'javelin-behavior-phabricator-search-typeahead' => 'bc0774e5',
'javelin-behavior-phabricator-tooltips' => '58743fec', 'javelin-behavior-phabricator-tooltips' => 'bc0774e5',
'javelin-behavior-phabricator-watch-anchor' => '58743fec', 'javelin-behavior-phabricator-watch-anchor' => 'bc0774e5',
'javelin-behavior-refresh-csrf' => '58743fec', 'javelin-behavior-refresh-csrf' => 'bc0774e5',
'javelin-behavior-repository-crossreference' => '95d0d865', 'javelin-behavior-repository-crossreference' => '95d0d865',
'javelin-behavior-toggle-class' => '58743fec', 'javelin-behavior-toggle-class' => 'bc0774e5',
'javelin-behavior-workflow' => '58743fec', 'javelin-behavior-workflow' => 'bc0774e5',
'javelin-dom' => '88225b70', 'javelin-dom' => 'd466c034',
'javelin-event' => '88225b70', 'javelin-event' => 'd466c034',
'javelin-install' => '88225b70', 'javelin-install' => 'd466c034',
'javelin-json' => '88225b70', 'javelin-json' => 'd466c034',
'javelin-mask' => '88225b70', 'javelin-mask' => 'd466c034',
'javelin-request' => '88225b70', 'javelin-request' => 'd466c034',
'javelin-resource' => '88225b70', 'javelin-resource' => 'd466c034',
'javelin-stratcom' => '88225b70', 'javelin-stratcom' => 'd466c034',
'javelin-tokenizer' => '88225b70', 'javelin-tokenizer' => 'd466c034',
'javelin-typeahead' => '88225b70', 'javelin-typeahead' => 'd466c034',
'javelin-typeahead-normalizer' => '88225b70', 'javelin-typeahead-normalizer' => 'd466c034',
'javelin-typeahead-ondemand-source' => '88225b70', 'javelin-typeahead-ondemand-source' => 'd466c034',
'javelin-typeahead-preloaded-source' => '88225b70', 'javelin-typeahead-preloaded-source' => 'd466c034',
'javelin-typeahead-source' => '88225b70', 'javelin-typeahead-source' => 'd466c034',
'javelin-uri' => '88225b70', 'javelin-uri' => 'd466c034',
'javelin-util' => '88225b70', 'javelin-util' => 'd466c034',
'javelin-vector' => '88225b70', 'javelin-vector' => 'd466c034',
'javelin-workflow' => '88225b70', 'javelin-workflow' => 'd466c034',
'lightbox-attachment-css' => '77c4590d', 'lightbox-attachment-css' => 'acc46105',
'maniphest-task-summary-css' => 'e30a3fa8', 'maniphest-task-summary-css' => 'e30a3fa8',
'maniphest-transaction-detail-css' => 'e30a3fa8', 'maniphest-transaction-detail-css' => 'e30a3fa8',
'phabricator-busy' => '58743fec', 'phabricator-busy' => 'bc0774e5',
'phabricator-content-source-view-css' => 'ec01d039', 'phabricator-content-source-view-css' => '8aaacd1b',
'phabricator-core-buttons-css' => '77c4590d', 'phabricator-core-buttons-css' => 'acc46105',
'phabricator-core-css' => '77c4590d', 'phabricator-core-css' => 'acc46105',
'phabricator-crumbs-view-css' => '77c4590d', 'phabricator-crumbs-view-css' => 'acc46105',
'phabricator-directory-css' => '77c4590d', 'phabricator-directory-css' => 'acc46105',
'phabricator-drag-and-drop-file-upload' => '95d0d865', 'phabricator-drag-and-drop-file-upload' => '95d0d865',
'phabricator-dropdown-menu' => '58743fec', 'phabricator-dropdown-menu' => 'bc0774e5',
'phabricator-file-upload' => '58743fec', 'phabricator-file-upload' => 'bc0774e5',
'phabricator-filetree-view-css' => '77c4590d', 'phabricator-filetree-view-css' => 'acc46105',
'phabricator-flag-css' => '77c4590d', 'phabricator-flag-css' => 'acc46105',
'phabricator-form-view-css' => '77c4590d', 'phabricator-form-view-css' => 'acc46105',
'phabricator-header-view-css' => '77c4590d', 'phabricator-header-view-css' => 'acc46105',
'phabricator-jump-nav' => '77c4590d', 'phabricator-jump-nav' => 'acc46105',
'phabricator-keyboard-shortcut' => '58743fec', 'phabricator-keyboard-shortcut' => 'bc0774e5',
'phabricator-keyboard-shortcut-manager' => '58743fec', 'phabricator-keyboard-shortcut-manager' => 'bc0774e5',
'phabricator-main-menu-view' => '77c4590d', 'phabricator-main-menu-view' => 'acc46105',
'phabricator-menu-item' => '58743fec', 'phabricator-menu-item' => 'bc0774e5',
'phabricator-nav-view-css' => '77c4590d', 'phabricator-nav-view-css' => 'acc46105',
'phabricator-notification' => '58743fec', 'phabricator-notification' => 'bc0774e5',
'phabricator-notification-css' => '77c4590d', 'phabricator-notification-css' => 'acc46105',
'phabricator-notification-menu-css' => '77c4590d', 'phabricator-notification-menu-css' => 'acc46105',
'phabricator-object-item-list-view-css' => '77c4590d', 'phabricator-object-item-list-view-css' => 'acc46105',
'phabricator-object-selector-css' => 'ec01d039', 'phabricator-object-selector-css' => '8aaacd1b',
'phabricator-paste-file-upload' => '58743fec', 'phabricator-paste-file-upload' => 'bc0774e5',
'phabricator-prefab' => '58743fec', 'phabricator-prefab' => 'bc0774e5',
'phabricator-project-tag-css' => 'e30a3fa8', 'phabricator-project-tag-css' => 'e30a3fa8',
'phabricator-remarkup-css' => '77c4590d', 'phabricator-remarkup-css' => 'acc46105',
'phabricator-shaped-request' => '95d0d865', 'phabricator-shaped-request' => '95d0d865',
'phabricator-side-menu-view-css' => '77c4590d', 'phabricator-side-menu-view-css' => 'acc46105',
'phabricator-standard-page-view' => '77c4590d', 'phabricator-standard-page-view' => 'acc46105',
'phabricator-textareautils' => '58743fec', 'phabricator-textareautils' => 'bc0774e5',
'phabricator-tooltip' => '58743fec', 'phabricator-tooltip' => 'bc0774e5',
'phabricator-transaction-view-css' => '77c4590d', 'phabricator-transaction-view-css' => 'acc46105',
'phabricator-zindex-css' => '77c4590d', 'phabricator-zindex-css' => 'acc46105',
'sprite-apps-large-css' => '77c4590d', 'sprite-apps-large-css' => 'acc46105',
'sprite-gradient-css' => '77c4590d', 'sprite-gradient-css' => 'acc46105',
'sprite-icon-css' => '77c4590d', 'sprite-icon-css' => 'acc46105',
'sprite-menu-css' => '77c4590d', 'sprite-menu-css' => 'acc46105',
'syntax-highlighting-css' => '77c4590d', 'syntax-highlighting-css' => 'acc46105',
), ),
)); ));

View file

@ -56,9 +56,6 @@ phutil_register_library_map(array(
'AphrontHTMLResponse' => 'aphront/response/AphrontHTMLResponse.php', 'AphrontHTMLResponse' => 'aphront/response/AphrontHTMLResponse.php',
'AphrontHTTPSink' => 'aphront/sink/AphrontHTTPSink.php', 'AphrontHTTPSink' => 'aphront/sink/AphrontHTTPSink.php',
'AphrontHTTPSinkTestCase' => 'aphront/sink/__tests__/AphrontHTTPSinkTestCase.php', 'AphrontHTTPSinkTestCase' => 'aphront/sink/__tests__/AphrontHTTPSinkTestCase.php',
'AphrontHeadsupActionListView' => 'view/layout/headsup/AphrontHeadsupActionListView.php',
'AphrontHeadsupActionView' => 'view/layout/headsup/AphrontHeadsupActionView.php',
'AphrontHeadsupView' => 'view/layout/headsup/AphrontHeadsupView.php',
'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php', 'AphrontIsolatedDatabaseConnectionTestCase' => 'infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php',
'AphrontIsolatedHTTPSink' => 'aphront/sink/AphrontIsolatedHTTPSink.php', 'AphrontIsolatedHTTPSink' => 'aphront/sink/AphrontIsolatedHTTPSink.php',
'AphrontJSONResponse' => 'aphront/response/AphrontJSONResponse.php', 'AphrontJSONResponse' => 'aphront/response/AphrontJSONResponse.php',
@ -223,6 +220,7 @@ phutil_register_library_map(array(
'ConpherenceViewController' => 'applications/conpherence/controller/ConpherenceViewController.php', 'ConpherenceViewController' => 'applications/conpherence/controller/ConpherenceViewController.php',
'DarkConsoleController' => 'aphront/console/DarkConsoleController.php', 'DarkConsoleController' => 'aphront/console/DarkConsoleController.php',
'DarkConsoleCore' => 'aphront/console/DarkConsoleCore.php', 'DarkConsoleCore' => 'aphront/console/DarkConsoleCore.php',
'DarkConsoleDataController' => 'aphront/console/DarkConsoleDataController.php',
'DarkConsoleErrorLogPlugin' => 'aphront/console/plugin/DarkConsoleErrorLogPlugin.php', 'DarkConsoleErrorLogPlugin' => 'aphront/console/plugin/DarkConsoleErrorLogPlugin.php',
'DarkConsoleErrorLogPluginAPI' => 'aphront/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php', 'DarkConsoleErrorLogPluginAPI' => 'aphront/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php',
'DarkConsoleEventPlugin' => 'aphront/console/plugin/DarkConsoleEventPlugin.php', 'DarkConsoleEventPlugin' => 'aphront/console/plugin/DarkConsoleEventPlugin.php',
@ -1270,6 +1268,7 @@ phutil_register_library_map(array(
'PhabricatorSetupCheckStorage' => 'applications/config/check/PhabricatorSetupCheckStorage.php', 'PhabricatorSetupCheckStorage' => 'applications/config/check/PhabricatorSetupCheckStorage.php',
'PhabricatorSetupCheckTimezone' => 'applications/config/check/PhabricatorSetupCheckTimezone.php', 'PhabricatorSetupCheckTimezone' => 'applications/config/check/PhabricatorSetupCheckTimezone.php',
'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php', 'PhabricatorSetupIssue' => 'applications/config/issue/PhabricatorSetupIssue.php',
'PhabricatorSetupIssueExample' => 'applications/uiexample/examples/PhabricatorSetupIssueExample.php',
'PhabricatorSetupIssueView' => 'applications/config/view/PhabricatorSetupIssueView.php', 'PhabricatorSetupIssueView' => 'applications/config/view/PhabricatorSetupIssueView.php',
'PhabricatorSlowvoteChoice' => 'applications/slowvote/storage/PhabricatorSlowvoteChoice.php', 'PhabricatorSlowvoteChoice' => 'applications/slowvote/storage/PhabricatorSlowvoteChoice.php',
'PhabricatorSlowvoteComment' => 'applications/slowvote/storage/PhabricatorSlowvoteComment.php', 'PhabricatorSlowvoteComment' => 'applications/slowvote/storage/PhabricatorSlowvoteComment.php',
@ -1501,6 +1500,7 @@ phutil_register_library_map(array(
'javelin_tag' => 'infrastructure/javelin/markup.php', 'javelin_tag' => 'infrastructure/javelin/markup.php',
'phabricator_date' => 'view/viewutils.php', 'phabricator_date' => 'view/viewutils.php',
'phabricator_datetime' => 'view/viewutils.php', 'phabricator_datetime' => 'view/viewutils.php',
'phabricator_form' => 'infrastructure/javelin/markup.php',
'phabricator_format_bytes' => 'view/viewutils.php', 'phabricator_format_bytes' => 'view/viewutils.php',
'phabricator_format_local_time' => 'view/viewutils.php', 'phabricator_format_local_time' => 'view/viewutils.php',
'phabricator_format_relative_time' => 'view/viewutils.php', 'phabricator_format_relative_time' => 'view/viewutils.php',
@ -1510,7 +1510,6 @@ phutil_register_library_map(array(
'phabricator_parse_bytes' => 'view/viewutils.php', 'phabricator_parse_bytes' => 'view/viewutils.php',
'phabricator_relative_date' => 'view/viewutils.php', 'phabricator_relative_date' => 'view/viewutils.php',
'phabricator_render_form' => 'infrastructure/javelin/markup.php', 'phabricator_render_form' => 'infrastructure/javelin/markup.php',
'phabricator_render_form_magic' => 'infrastructure/javelin/markup.php',
'phabricator_time' => 'view/viewutils.php', 'phabricator_time' => 'view/viewutils.php',
'phid_get_subtype' => 'applications/phid/utils.php', 'phid_get_subtype' => 'applications/phid/utils.php',
'phid_get_type' => 'applications/phid/utils.php', 'phid_get_type' => 'applications/phid/utils.php',
@ -1563,9 +1562,6 @@ phutil_register_library_map(array(
'AphrontFormView' => 'AphrontView', 'AphrontFormView' => 'AphrontView',
'AphrontHTMLResponse' => 'AphrontResponse', 'AphrontHTMLResponse' => 'AphrontResponse',
'AphrontHTTPSinkTestCase' => 'PhabricatorTestCase', 'AphrontHTTPSinkTestCase' => 'PhabricatorTestCase',
'AphrontHeadsupActionListView' => 'AphrontView',
'AphrontHeadsupActionView' => 'AphrontView',
'AphrontHeadsupView' => 'AphrontView',
'AphrontIsolatedDatabaseConnectionTestCase' => 'PhabricatorTestCase', 'AphrontIsolatedDatabaseConnectionTestCase' => 'PhabricatorTestCase',
'AphrontIsolatedHTTPSink' => 'AphrontHTTPSink', 'AphrontIsolatedHTTPSink' => 'AphrontHTTPSink',
'AphrontJSONResponse' => 'AphrontResponse', 'AphrontJSONResponse' => 'AphrontResponse',
@ -1720,6 +1716,7 @@ phutil_register_library_map(array(
'ConpherenceUpdateController' => 'ConpherenceController', 'ConpherenceUpdateController' => 'ConpherenceController',
'ConpherenceViewController' => 'ConpherenceController', 'ConpherenceViewController' => 'ConpherenceController',
'DarkConsoleController' => 'PhabricatorController', 'DarkConsoleController' => 'PhabricatorController',
'DarkConsoleDataController' => 'PhabricatorController',
'DarkConsoleErrorLogPlugin' => 'DarkConsolePlugin', 'DarkConsoleErrorLogPlugin' => 'DarkConsolePlugin',
'DarkConsoleEventPlugin' => 'DarkConsolePlugin', 'DarkConsoleEventPlugin' => 'DarkConsolePlugin',
'DarkConsoleEventPluginAPI' => 'PhutilEventListener', 'DarkConsoleEventPluginAPI' => 'PhutilEventListener',
@ -2686,6 +2683,7 @@ phutil_register_library_map(array(
'PhabricatorSetupCheckPath' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckPath' => 'PhabricatorSetupCheck',
'PhabricatorSetupCheckStorage' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckStorage' => 'PhabricatorSetupCheck',
'PhabricatorSetupCheckTimezone' => 'PhabricatorSetupCheck', 'PhabricatorSetupCheckTimezone' => 'PhabricatorSetupCheck',
'PhabricatorSetupIssueExample' => 'PhabricatorUIExample',
'PhabricatorSetupIssueView' => 'AphrontView', 'PhabricatorSetupIssueView' => 'AphrontView',
'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO', 'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO',
'PhabricatorSlowvoteComment' => 'PhabricatorSlowvoteDAO', 'PhabricatorSlowvoteComment' => 'PhabricatorSlowvoteDAO',

View file

@ -73,7 +73,10 @@ class AphrontDefaultApplicationConfiguration
'profile/(?P<phid>[^/]+)/' => 'PhabricatorXHProfProfileController', 'profile/(?P<phid>[^/]+)/' => 'PhabricatorXHProfProfileController',
), ),
'/~/' => 'DarkConsoleController', '/~/' => array(
'' => 'DarkConsoleController',
'data/(?P<key>[^/]+)/' => 'DarkConsoleDataController',
),
'/search/' => array( '/search/' => array(
'' => 'PhabricatorSearchController', '' => 'PhabricatorSearchController',
@ -179,10 +182,9 @@ class AphrontDefaultApplicationConfiguration
return $login_controller->processRequest(); return $login_controller->processRequest();
} }
$content = $content = hsprintf(
'<div class="aphront-policy-exception">'. '<div class="aphront-policy-exception">%s</div>',
phutil_escape_html($ex->getMessage()). $ex->getMessage());
'</div>';
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog $dialog
@ -208,7 +210,7 @@ class AphrontDefaultApplicationConfiguration
if ($ex instanceof AphrontUsageException) { if ($ex instanceof AphrontUsageException) {
$error = new AphrontErrorView(); $error = new AphrontErrorView();
$error->setTitle(phutil_escape_html($ex->getTitle())); $error->setTitle(phutil_escape_html($ex->getTitle()));
$error->appendChild(phutil_escape_html($ex->getMessage())); $error->appendChild($ex->getMessage());
$view = new PhabricatorStandardPageView(); $view = new PhabricatorStandardPageView();
$view->setRequest($this->getRequest()); $view->setRequest($this->getRequest());
@ -333,17 +335,17 @@ class AphrontDefaultApplicationConfiguration
'$'.$part['line']; '$'.$part['line'];
$attrs['target'] = '_blank'; $attrs['target'] = '_blank';
} }
$file_name = phutil_render_tag( $file_name = phutil_tag(
'a', 'a',
$attrs, $attrs,
phutil_escape_html($relative)); $relative);
} else { } else {
$file_name = phutil_render_tag( $file_name = phutil_tag(
'span', 'span',
array( array(
'title' => $file, 'title' => $file,
), ),
phutil_escape_html($relative)); $relative);
} }
$file_name = $file_name.' : '.(int)$part['line']; $file_name = $file_name.' : '.(int)$part['line'];
} else { } else {

View file

@ -5,57 +5,32 @@
*/ */
final class DarkConsoleCore { final class DarkConsoleCore {
const PLUGIN_ERRORLOG = 'ErrorLog';
const PLUGIN_SERVICES = 'Services';
const PLUGIN_EVENT = 'Event';
const PLUGIN_XHPROF = 'XHProf';
const PLUGIN_REQUEST = 'Request';
public static function getPlugins() {
return array(
self::PLUGIN_ERRORLOG,
self::PLUGIN_REQUEST,
self::PLUGIN_SERVICES,
self::PLUGIN_EVENT,
self::PLUGIN_XHPROF,
);
}
private $plugins = array(); private $plugins = array();
private $settings; const STORAGE_VERSION = 1;
private $coredata;
public function getPlugin($plugin_name) {
return idx($this->plugins, $plugin_name);
}
public function __construct() { public function __construct() {
foreach (self::getPlugins() as $plugin_name) { $symbols = id(new PhutilSymbolLoader())
$plugin = self::newPlugin($plugin_name); ->setType('class')
if ($plugin->isPermanent() || !isset($disabled[$plugin_name])) { ->setAncestorClass('DarkConsolePlugin')
if ($plugin->shouldStartup()) { ->selectAndLoadSymbols();
$plugin->didStartup();
$plugin->setConsoleCore($this); foreach ($symbols as $symbol) {
$this->plugins[$plugin_name] = $plugin; $plugin = newv($symbol['name'], array());
} if (!$plugin->shouldStartup()) {
continue;
} }
$plugin->setConsoleCore($this);
$plugin->didStartup();
$this->plugins[$symbol['name']] = $plugin;
} }
} }
public static function newPlugin($plugin) { public function getPlugins() {
$class = 'DarkConsole'.$plugin.'Plugin';
return newv($class, array());
}
public function getEnabledPlugins() {
return $this->plugins; return $this->plugins;
} }
public function render(AphrontRequest $request) { public function getKey(AphrontRequest $request) {
$plugins = $this->getPlugins();
$user = $request->getUser();
$plugins = $this->getEnabledPlugins();
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
$plugin->setRequest($request); $plugin->setRequest($request);
@ -70,128 +45,58 @@ final class DarkConsoleCore {
$plugin->setData($plugin->generateData()); $plugin->setData($plugin->generateData());
} }
$selected = $user->getConsoleTab(); $plugins = msort($plugins, 'getOrderKey');
$visible = $user->getConsoleVisible();
if (!isset($plugins[$selected])) { $key = Filesystem::readRandomCharacters(24);
$selected = head_key($plugins);
}
$tabs = array(); $tabs = array();
foreach ($plugins as $key => $plugin) { $data = array();
$tabs[$key] = array( foreach ($plugins as $plugin) {
$class = get_class($plugin);
$tabs[] = array(
'class' => $class,
'name' => $plugin->getName(), 'name' => $plugin->getName(),
'panel' => $plugin->render(), 'color' => $plugin->getColor(),
); );
$data[$class] = $plugin->getData();
} }
$tabs_markup = array(); $storage = array(
$panel_markup = array(); 'vers' => self::STORAGE_VERSION,
foreach ($tabs as $key => $data) { 'tabs' => $tabs,
$is_selected = ($key == $selected); 'data' => $data,
if ($is_selected) { 'user' => $request->getUser()
$style = null; ? $request->getUser()->getPHID()
$tabclass = 'dark-console-tab-selected'; : null,
} else { );
$style = 'display: none;';
$tabclass = null;
}
$tabs_markup[] = javelin_render_tag( $cache = new PhabricatorKeyValueDatabaseCache();
'a', $cache = new PhutilKeyValueCacheProfiler($cache);
array( $cache->setProfiler(PhutilServiceProfiler::getInstance());
'class' => "dark-console-tab {$tabclass}",
'sigil' => 'dark-console-tab',
'id' => 'dark-console-tab-'.$key,
),
(string)$data['name']);
$panel_markup[] = javelin_render_tag( $cache->setKeys(
'div',
array(
'class' => 'dark-console-panel dark-console-panel-'.$key,
'style' => $style,
'sigil' => 'dark-console-panel',
),
(string)$data['panel']);
}
$console = javelin_render_tag(
'table',
array( array(
'class' => 'dark-console', 'darkconsole:'.$key => json_encode($storage),
'sigil' => 'dark-console',
'style' => $visible ? '' : 'display: none;',
), ),
'<tr>'. $ttl = (60 * 60 * 6));
'<th class="dark-console-tabs">'.
implode("\n", $tabs_markup).
'</th>'.
'<td>'.implode("\n", $panel_markup).'</td>'.
'</tr>');
if (!empty($_COOKIE['phsid'])) { return $key;
$console = str_replace(
$_COOKIE['phsid'],
phutil_escape_html('<session-key>'),
$console);
}
if ($request->isAjax()) {
// for ajax this HTML gets updated on the client
$request_history = null;
} else {
$request_table_header =
'<div class="dark-console-panel-request-log-separator"></div>';
$rows = array();
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
'Sequence',
'Type',
'URI',
));
$table->setColumnClasses(
array(
'',
'',
'wide',
));
$request_table = $request_table_header . $table->render();
$request_history = javelin_render_tag(
'table',
array(
'class' => 'dark-console dark-console-request-log',
'sigil' => 'dark-console-request-log',
'style' => $visible ? '' : 'display: none;',
),
'<tr>'.
'<th class="dark-console-tabs">'.
javelin_render_tag(
'a',
array(
'class' => 'dark-console-tab dark-console-tab-selected',
),
'Request Log').
'</th>'.
'<td>'.
javelin_render_tag(
'div',
array(
'class' => 'dark-console-panel dark-console-panel-RequestLog',
),
$request_table).
'</td>'.
'</tr>');
}
return "\n\n\n\n".$console.$request_history."\n\n\n\n";
} }
public function render(AphrontRequest $request) {
$user = $request->getUser();
$visible = $user ? $user->getConsoleVisible() : true;
return javelin_tag(
'div',
array(
'id' => 'darkconsole',
'class' => 'dark-console',
'style' => $visible ? '' : 'display: none;',
'data-console-key' => $this->getKey($request),
),
'');
}
} }

View file

@ -0,0 +1,69 @@
<?php
/**
* @group console
*/
final class DarkConsoleDataController extends PhabricatorController {
private $key;
public function willProcessRequest(array $data) {
$this->key = $data['key'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$cache = new PhabricatorKeyValueDatabaseCache();
$cache = new PhutilKeyValueCacheProfiler($cache);
$cache->setProfiler(PhutilServiceProfiler::getInstance());
$result = $cache->getKey('darkconsole:'.$this->key);
if (!$result) {
return new Aphront400Response();
}
$result = json_decode($result, true);
if (!is_array($result)) {
return new Aphront400Response();
}
if ($result['vers'] != DarkConsoleCore::STORAGE_VERSION) {
return new Aphront400Response();
}
if ($result['user'] != $user->getPHID()) {
return new Aphront400Response();
}
$output = array();
$output['tabs'] = $result['tabs'];
$output['panel'] = array();
foreach ($result['data'] as $class => $data) {
try {
$obj = newv($class, array());
$obj->setData($data);
$obj->setRequest($request);
$panel = $obj->renderPanel();
if (!empty($_COOKIE['phsid'])) {
$panel = str_replace(
$_COOKIE['phsid'],
'(session-key)',
$panel);
}
$output['panel'][$class] = $panel;
} catch (Exception $ex) {
$output['panel'][$class] = 'error';
}
}
return id(new AphrontAjaxResponse())->setContent($output);
}
}

View file

@ -7,29 +7,32 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
public function getName() { public function getName() {
$count = count($this->getData()); $count = count($this->getData());
if ($count) { if ($count) {
return return pht('Error Log (%d)', $count);
'<span style="color: #ff0000;">&bull;</span> '.
"Error Log ({$count})";
} }
return pht('Error Log');
return 'Error Log';
} }
public function getOrder() {
return 0;
}
public function getColor() {
if (count($this->getData())) {
return '#ff0000';
}
return null;
}
public function getDescription() { public function getDescription() {
return 'Shows errors and warnings.'; return pht('Shows errors and warnings.');
} }
public function generateData() { public function generateData() {
return DarkConsoleErrorLogPluginAPI::getErrors(); return DarkConsoleErrorLogPluginAPI::getErrors();
} }
public function renderPanel() {
public function render() {
$data = $this->getData(); $data = $this->getData();
$rows = array(); $rows = array();
@ -39,12 +42,12 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$file = $row['file']; $file = $row['file'];
$line = $row['line']; $line = $row['line'];
$tag = phutil_render_tag( $tag = phutil_tag(
'a', 'a',
array( array(
'onclick' => jsprintf('show_details(%d)', $index), 'onclick' => jsprintf('show_details(%d)', $index),
), ),
phutil_escape_html($row['str'].' at ['.basename($file).':'.$line.']')); $row['str'].' at ['.basename($file).':'.$line.']');
$rows[] = array($tag); $rows[] = array($tag);
$details .= $details .=
@ -70,12 +73,12 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
} }
} }
$details .= phutil_render_tag( $details .= phutil_tag(
'a', 'a',
array( array(
'href' => $href, 'href' => $href,
), ),
phutil_escape_html($line)); $line);
$details .= "\n"; $details .= "\n";
} }

View file

@ -37,7 +37,7 @@ final class DarkConsoleEventPlugin extends DarkConsolePlugin {
); );
} }
public function render() { public function renderPanel() {
$data = $this->getData(); $data = $this->getData();
$out = array(); $out = array();

View file

@ -11,12 +11,27 @@ abstract class DarkConsolePlugin {
abstract public function getName(); abstract public function getName();
abstract public function getDescription(); abstract public function getDescription();
abstract public function render(); abstract public function renderPanel();
public function __construct() { public function __construct() {
} }
public function getColor() {
return null;
}
final public function getOrderKey() {
return sprintf(
'%09d%s',
(int)(999999999 * $this->getOrder()),
$this->getName());
}
public function getOrder() {
return 1.0;
}
public function setConsoleCore(DarkConsoleCore $core) { public function setConsoleCore(DarkConsoleCore $core) {
$this->core = $core; $this->core = $core;
return $this; return $this;
@ -52,10 +67,6 @@ abstract class DarkConsolePlugin {
return $this->getRequest()->getRequestURI(); return $this->getRequest()->getRequestURI();
} }
public function isPermanent() {
return false;
}
public function shouldStartup() { public function shouldStartup() {
return true; return true;
} }

View file

@ -20,8 +20,7 @@ final class DarkConsoleRequestPlugin extends DarkConsolePlugin {
); );
} }
public function render() { public function renderPanel() {
$data = $this->getData(); $data = $this->getData();
$sections = array( $sections = array(

View file

@ -136,21 +136,26 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
'start' => PhabricatorStartup::getStartTime(), 'start' => PhabricatorStartup::getStartTime(),
'end' => microtime(true), 'end' => microtime(true),
'log' => $log, 'log' => $log,
'analyzeURI' => (string)$this
->getRequestURI()
->alter('__analyze__', true),
'didAnalyze' => isset($_REQUEST['__analyze__']),
); );
} }
public function render() { public function renderPanel() {
$data = $this->getData(); $data = $this->getData();
$log = $data['log']; $log = $data['log'];
$results = array(); $results = array();
$results[] = $results[] =
'<div class="dark-console-panel-header">'. '<div class="dark-console-panel-header">'.
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => $this->getRequestURI()->alter('__analyze__', true), 'href' => $data['analyzeURI'],
'class' => isset($_REQUEST['__analyze__']) 'class' => $data['didAnalyze']
? 'disabled button' ? 'disabled button'
: 'green button', : 'green button',
), ),
@ -211,13 +216,12 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
$info = wordwrap($info, 128, "\n", true); $info = wordwrap($info, 128, "\n", true);
if (!empty($row['explain'])) { if (!empty($row['explain'])) {
$analysis = phutil_escape_html($row['explain']['reason']); $analysis = phutil_tag(
$analysis = phutil_render_tag(
'span', 'span',
array( array(
'class' => 'explain-sev-'.$row['explain']['sev'], 'class' => 'explain-sev-'.$row['explain']['sev'],
), ),
$analysis); $row['explain']['reason']);
} }
$info = phutil_escape_html($info); $info = phutil_escape_html($info);

View file

@ -8,31 +8,43 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin {
protected $xhprofID; protected $xhprofID;
public function getName() { public function getName() {
$run = $this->getData();
if ($run) {
return '<span style="color: #ff00ff;">&bull;</span> XHProf';
}
return 'XHProf'; return 'XHProf';
} }
public function getColor() {
$data = $this->getData();
if ($data['xhprofID']) {
return '#ff00ff';
}
return null;
}
public function getDescription() { public function getDescription() {
return 'Provides detailed PHP profiling information through XHProf.'; return 'Provides detailed PHP profiling information through XHProf.';
} }
public function generateData() { public function generateData() {
return $this->xhprofID; return array(
'xhprofID' => $this->xhprofID,
'profileURI' => (string)$this
->getRequestURI()
->alter('__profile__', 'page'),
);
} }
public function getXHProfRunID() { public function getXHProfRunID() {
return $this->xhprofID; return $this->xhprofID;
} }
public function render() { public function renderPanel() {
$data = $this->getData();
$run = $data['xhprofID'];
$profile_uri = $data['profileURI'];
if (!DarkConsoleXHProfPluginAPI::isProfilerAvailable()) { if (!DarkConsoleXHProfPluginAPI::isProfilerAvailable()) {
$href = PhabricatorEnv::getDoclink('article/Installation_Guide.html'); $href = PhabricatorEnv::getDoclink('article/Installation_Guide.html');
$install_guide = phutil_render_tag( $install_guide = phutil_tag(
'a', 'a',
array( array(
'href' => $href, 'href' => $href,
@ -49,14 +61,12 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin {
$result = array(); $result = array();
$run = $this->getXHProfRunID();
$header = $header =
'<div class="dark-console-panel-header">'. '<div class="dark-console-panel-header">'.
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => $this->getRequestURI()->alter('__profile__', 'page'), 'href' => $profile_uri,
'class' => $run 'class' => $run
? 'disabled button' ? 'disabled button'
: 'green button', : 'green button',

View file

@ -38,10 +38,10 @@ final class AphrontAjaxResponse extends AphrontResponse {
$console = $this->getConsole(); $console = $this->getConsole();
if ($console) { if ($console) {
Javelin::initBehavior( Javelin::initBehavior(
'dark-console-ajax', 'dark-console',
array( array(
'console' => $console->render($this->getRequest()), 'uri' => (string)$this->getRequest()->getRequestURI(),
'uri' => (string) $this->getRequest()->getRequestURI(), 'key' => $console->getKey($this->getRequest()),
)); ));
} }

View file

@ -42,17 +42,18 @@ class AphrontRedirectResponse extends AphrontResponse {
$error->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$error->setTitle('Stopped on Redirect'); $error->setTitle('Stopped on Redirect');
$link = phutil_render_tag( $link = phutil_tag(
'a', 'a',
array( array(
'href' => $this->getURI(), 'href' => $this->getURI(),
), ),
'Continue to: '.phutil_escape_html($this->getURI())); 'Continue to: '.$this->getURI());
$error->appendChild( $error->appendChild(hsprintf(
'<p>You were stopped here because <tt>debug.stop-on-redirect</tt> '. '<p>You were stopped here because <tt>debug.stop-on-redirect</tt> '.
'is set in your configuration.</p>'. 'is set in your configuration.</p>'.
'<p>'.$link.'</p>'); '<p>%s</p>',
$link));
$view->appendChild($error); $view->appendChild($error);

View file

@ -54,7 +54,21 @@ abstract class AphrontResponse {
return $this; return $this;
} }
protected function encodeJSONForHTTPResponse(array $object) { public static function processValueForJSONEncoding(&$value, $key) {
if ($value instanceof PhutilSafeHTML) {
// TODO: Javelin supports implicity conversion of '__html' objects to
// JX.HTML, but only for Ajax responses, not behaviors. Just leave things
// as they are for now (where behaviors treat responses as HTML or plain
// text at their discretion).
$value = $value->getHTMLContent();
}
}
public static function encodeJSONForHTTPResponse(array $object) {
array_walk_recursive(
$object,
array('AphrontResponse', 'processValueForJSONEncoding'));
$response = json_encode($object); $response = json_encode($object);

View file

@ -177,9 +177,9 @@ final class PhabricatorLoginController
id(new AphrontFormPasswordControl()) id(new AphrontFormPasswordControl())
->setLabel(pht('Password')) ->setLabel(pht('Password'))
->setName('password') ->setName('password')
->setCaption( ->setCaption(hsprintf(
'<a href="/login/email/">'. '<a href="/login/email/">%s</a>',
pht('Forgot your password? / Email Login').'</a>')); pht('Forgot your password? / Email Login'))));
if ($require_captcha) { if ($require_captcha) {
$form->appendChild( $form->appendChild(
@ -243,22 +243,21 @@ final class PhabricatorLoginController
// CSRF for logged-out users is vaugely tricky. // CSRF for logged-out users is vaugely tricky.
if ($provider->isProviderRegistrationEnabled()) { if ($provider->isProviderRegistrationEnabled()) {
$title = pht("Login or Register with %s", $title = pht("Login or Register with %s", $provider_name);
phutil_escape_html($provider_name));
$body = pht('Login or register for Phabricator using your %s account.', $body = pht('Login or register for Phabricator using your %s account.',
phutil_escape_html($provider_name)); $provider_name);
$button = pht("Login or Register with %s", $button = pht("Login or Register with %s",
phutil_escape_html($provider_name)); phutil_escape_html($provider_name));
} else { } else {
$title = pht("Login with %s", $title = pht("Login with %s", $provider_name);
phutil_escape_html($provider_name)); $body = hsprintf(
$body = pht('Login to your existing Phabricator account using your '. '%s<br /><br /><strong>%s</strong>',
'%s account.', phutil_escape_html($provider_name)). pht(
'<br /><br />'. 'Login to your existing Phabricator account using your %s account.',
'<strong>'. $provider_name),
pht('You can not use %s to register a new account.', pht(
phutil_escape_html($provider_name)). 'You can not use %s to register a new account.',
'</strong>'; $provider_name));
$button = pht("Log in with %s", phutil_escape_html($provider_name)); $button = pht("Log in with %s", phutil_escape_html($provider_name));
} }
@ -276,8 +275,9 @@ final class PhabricatorLoginController
$auth_form $auth_form
->setUser($request->getUser()) ->setUser($request->getUser())
->setMethod('GET') ->setMethod('GET')
->appendChild( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">'.$body.'</p>') '<p class="aphront-form-instructions">%s</p>',
$body))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue("{$button} \xC2\xBB")); ->setValue("{$button} \xC2\xBB"));
@ -289,9 +289,9 @@ final class PhabricatorLoginController
$panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->setNoBackground(); $panel->setNoBackground();
foreach ($forms as $name => $form) { foreach ($forms as $name => $form) {
$panel->appendChild('<h1>'.$name.'</h1>'); $panel->appendChild(phutil_tag('h1', array(), $name));
$panel->appendChild($form); $panel->appendChild($form);
$panel->appendChild('<br />'); $panel->appendChild(phutil_tag('br'));
} }
$login_message = PhabricatorEnv::getEnvConfig('auth.login-message'); $login_message = PhabricatorEnv::getEnvConfig('auth.login-message');

View file

@ -43,9 +43,9 @@ final class PhabricatorLoginValidateController
$list = array(); $list = array();
foreach ($failures as $failure) { foreach ($failures as $failure) {
$list[] = '<li>'.phutil_escape_html($failure).'</li>'; $list[] = phutil_tag('li', array(), $failure);
} }
$list = '<ul>'.implode("\n", $list).'</ul>'; $list = phutil_tag('ul', array(), $list);
$view = new AphrontRequestFailureView(); $view = new AphrontRequestFailureView();
$view->setHeader(pht('Login Failed')); $view->setHeader(pht('Login Failed'));

View file

@ -31,9 +31,12 @@ final class PhabricatorMustVerifyEmailController
$sent = new AphrontErrorView(); $sent = new AphrontErrorView();
$sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $sent->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$sent->setTitle(pht('Email Sent')); $sent->setTitle(pht('Email Sent'));
$sent->appendChild('<p>'. $sent->appendChild(phutil_tag(
pht('Another verification email was sent to <strong>%s</strong>.', 'p',
phutil_escape_html($email_address)).'</p>'); array(),
pht(
'Another verification email was sent to %s.',
phutil_tag('strong', array(), $email_address))));
} }
$error_view = new AphrontRequestFailureView(); $error_view = new AphrontRequestFailureView();
@ -42,7 +45,7 @@ final class PhabricatorMustVerifyEmailController
'<p>'. '<p>'.
pht('You must verify your email address to login. You should have a new '. pht('You must verify your email address to login. You should have a new '.
'email message from Phabricator with verification instructions in your '. 'email message from Phabricator with verification instructions in your '.
'inbox (<strong>%s</strong>).', phutil_escape_html($email_address)). 'inbox (%s).', phutil_tag('strong', array(), $email_address)).
'</p>'); '</p>');
$error_view->appendChild( $error_view->appendChild(
'<p>'. '<p>'.
@ -51,13 +54,13 @@ final class PhabricatorMustVerifyEmailController
'</p>'); '</p>');
$error_view->appendChild( $error_view->appendChild(
'<div class="aphront-failure-continue">'. '<div class="aphront-failure-continue">'.
phabricator_render_form( phabricator_form(
$user, $user,
array( array(
'action' => '/login/mustverify/', 'action' => '/login/mustverify/',
'method' => 'POST', 'method' => 'POST',
), ),
phutil_render_tag( phutil_tag(
'button', 'button',
array( array(
), ),

View file

@ -69,14 +69,16 @@ final class PhabricatorOAuthLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Already Linked to Another Account')); $dialog->setTitle(pht('Already Linked to Another Account'));
$dialog->appendChild('<p>'. $dialog->appendChild(phutil_tag(
'p',
array(),
pht( pht(
'The %s account you just authorized is already linked to '. 'The %s account you just authorized is already linked to '.
'another Phabricator account. Before you can associate your %s '. 'another Phabricator account. Before you can associate your %s '.
'account with this Phabriactor account, you must unlink it from '. 'account with this Phabriactor account, you must unlink it from '.
'the Phabricator account it is currently linked to.</p>', 'the Phabricator account it is currently linked to.',
phutil_escape_html($provider_name), $provider_name,
phutil_escape_html($provider_name))).'</p>'; $provider_name)));
$dialog->addCancelButton($provider->getSettingsPanelURI()); $dialog->addCancelButton($provider->getSettingsPanelURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -97,13 +99,15 @@ final class PhabricatorOAuthLoginController
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle( $dialog->setTitle(
pht('Already Linked to an Account From This Provider')); pht('Already Linked to an Account From This Provider'));
$dialog->appendChild('<p>'. $dialog->appendChild(phutil_tag(
'p',
array(),
pht( pht(
'The account you are logged in with is already linked to a %s '. 'The account you are logged in with is already linked to a %s '.
'account. Before you can link it to a different %s account, you '. 'account. Before you can link it to a different %s account, you '.
'must unlink the old account.</p>', 'must unlink the old account.',
phutil_escape_html($provider_name), $provider_name,
phutil_escape_html($provider_name))).'</p>'; $provider_name)));
$dialog->addCancelButton($provider->getSettingsPanelURI()); $dialog->addCancelButton($provider->getSettingsPanelURI());
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
} }
@ -170,13 +174,15 @@ final class PhabricatorOAuthLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('Already Linked to Another Account')); $dialog->setTitle(pht('Already Linked to Another Account'));
$dialog->appendChild('<p>'. $dialog->appendChild(phutil_tag(
'p',
array(),
pht( pht(
'The %s account you just authorized has an email address which '. 'The %s account you just authorized has an email address which '.
'is already in use by another Phabricator account. To link the '. 'is already in use by another Phabricator account. To link the '.
'accounts, log in to your Phabricator account and then go to '. 'accounts, log in to your Phabricator account and then go to '.
'Settings.', 'Settings.',
phutil_escape_html($provider_name))).'</p>'; $provider_name)));
$user = id(new PhabricatorUser()) $user = id(new PhabricatorUser())
->loadOneWhere('phid = %s', $known_email->getUserPHID()); ->loadOneWhere('phid = %s', $known_email->getUserPHID());
@ -189,10 +195,12 @@ final class PhabricatorOAuthLoginController
$providers[] = PhabricatorOAuthProvider::newProvider($provider) $providers[] = PhabricatorOAuthProvider::newProvider($provider)
->getProviderName(); ->getProviderName();
} }
$dialog->appendChild( $dialog->appendChild(phutil_tag(
'p',
array(),
pht( pht(
'<p>The account is associated with: %s.</p>', 'The account is associated with: %s.',
implode(', ', phutil_escape_html($providers)))); implode(', ', $providers))));
} }
$dialog->addCancelButton('/login/'); $dialog->addCancelButton('/login/');
@ -205,13 +213,15 @@ final class PhabricatorOAuthLoginController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($current_user); $dialog->setUser($current_user);
$dialog->setTitle(pht('No Account Registration with %s', $provider_name)); $dialog->setTitle(pht('No Account Registration with %s', $provider_name));
$dialog->appendChild('<p>'. $dialog->appendChild(phutil_tag(
'p',
array(),
pht( pht(
'You can not register a new account using %s; you can only use '. 'You can not register a new account using %s; you can only use '.
'your %s account to log into an existing Phabricator account which '. 'your %s account to log into an existing Phabricator account which '.
'you have registered through other means.', 'you have registered through other means.',
phutil_escape_html($provider_name), $provider_name,
phutil_escape_html($provider_name))).'</p>'; $provider_name)));
$dialog->addCancelButton('/login/'); $dialog->addCancelButton('/login/');
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -264,7 +264,7 @@ abstract class PhabricatorController extends AphrontController {
*/ */
protected function renderHandlesForPHIDs(array $phids, $style = "\n") { protected function renderHandlesForPHIDs(array $phids, $style = "\n") {
$style_map = array( $style_map = array(
"\n" => '<br />', "\n" => phutil_tag('br'),
',' => ', ', ',' => ', ',
); );
@ -276,7 +276,8 @@ abstract class PhabricatorController extends AphrontController {
foreach ($phids as $phid) { foreach ($phids as $phid) {
$items[] = $this->getHandle($phid)->renderLink(); $items[] = $this->getHandle($phid)->renderLink();
} }
return implode($style_map[$style], $items);
return array_interleave($style_map[$style], $items);
} }
protected function buildApplicationMenu() { protected function buildApplicationMenu() {

View file

@ -37,7 +37,7 @@ final class PhabricatorCalendarDeleteStatusController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle(pht('Really delete status?')); $dialog->setTitle(pht('Really delete status?'));
$dialog->appendChild(phutil_render_tag( $dialog->appendChild(phutil_tag(
'p', 'p',
array(), array(),
pht('Permanently delete this status? This action can not be undone.') pht('Permanently delete this status? This action can not be undone.')

View file

@ -79,8 +79,7 @@ final class PhabricatorCalendarViewStatusController
->setBarColor($color) ->setBarColor($color)
->addAttribute(pht('From %s to %s', $from, $to)) ->addAttribute(pht('From %s to %s', $from, $to))
->addAttribute( ->addAttribute(
phutil_escape_html( phutil_utf8_shorten($status->getDescription(), 64));
phutil_utf8_shorten($status->getDescription(), 64)));
$list->addItem($item); $list->addItem($item);
} }

View file

@ -159,18 +159,18 @@ final class AphrontCalendarMonthView extends AphrontView {
$uri = new PhutilURI($uri); $uri = new PhutilURI($uri);
list($prev_year, $prev_month) = $this->getPrevYearAndMonth(); list($prev_year, $prev_month) = $this->getPrevYearAndMonth();
$query = array('year' => $prev_year, 'month' => $prev_month); $query = array('year' => $prev_year, 'month' => $prev_month);
$prev_link = phutil_render_tag( $prev_link = phutil_tag(
'a', 'a',
array('href' => (string) $uri->setQueryParams($query)), array('href' => (string) $uri->setQueryParams($query)),
'&larr;' "\xE2\x86\x90"
); );
list($next_year, $next_month) = $this->getNextYearAndMonth(); list($next_year, $next_month) = $this->getNextYearAndMonth();
$query = array('year' => $next_year, 'month' => $next_month); $query = array('year' => $next_year, 'month' => $next_month);
$next_link = phutil_render_tag( $next_link = phutil_tag(
'a', 'a',
array('href' => (string) $uri->setQueryParams($query)), array('href' => (string) $uri->setQueryParams($query)),
'&rarr;' "\xE2\x86\x92"
); );
$left_th = '<th>'.$prev_link.'</th>'; $left_th = '<th>'.$prev_link.'</th>';
@ -291,7 +291,7 @@ final class AphrontCalendarMonthView extends AphrontView {
$href = null; $href = null;
} }
$text_div = javelin_render_tag( $text_div = javelin_tag(
$tag, $tag,
array( array(
'sigil' => 'has-tooltip', 'sigil' => 'has-tooltip',
@ -302,9 +302,9 @@ final class AphrontCalendarMonthView extends AphrontView {
'class' => 'aphront-calendar-event-text', 'class' => 'aphront-calendar-event-text',
'href' => $href, 'href' => $href,
), ),
phutil_escape_html(phutil_utf8_shorten($event->getName(), 32))); phutil_utf8_shorten($event->getName(), 32));
return javelin_render_tag( return javelin_tag(
'div', 'div',
array( array(
'class' => implode(' ', $classes), 'class' => implode(' ', $classes),

View file

@ -16,12 +16,12 @@ final class PhabricatorChatLogChannelListController
foreach ($channels as $channel) { foreach ($channels as $channel) {
$name = $channel['channel']; $name = $channel['channel'];
$rows[] = array( $rows[] = array(
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => '/chatlog/channel/'.phutil_escape_uri($name).'/', 'href' => '/chatlog/channel/'.phutil_escape_uri($name).'/',
), ),
phutil_escape_html($name))); $name));
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);

View file

@ -98,31 +98,29 @@ final class PhabricatorChatLogChannelLogController
foreach ($blocks as $block) { foreach ($blocks as $block) {
$author = $block['author']; $author = $block['author'];
$author = phutil_utf8_shorten($author, 18); $author = phutil_utf8_shorten($author, 18);
$author = phutil_escape_html($author); $author = phutil_tag('td', array('class' => 'author'), $author);
$author = phutil_render_tag('td', array('class' => 'author'), $author);
$message = mpull($block['logs'], 'getMessage'); $message = mpull($block['logs'], 'getMessage');
$message = implode("\n", $message); $message = implode("\n", $message);
$message = phutil_escape_html($message); $message = phutil_tag('td', array('class' => 'message'), $message);
$message = phutil_render_tag('td', array('class' => 'message'), $message);
$href = $uri->alter('at', $block['id']); $href = $uri->alter('at', $block['id']);
$timestamp = $block['epoch']; $timestamp = $block['epoch'];
$timestamp = phabricator_datetime($timestamp, $user); $timestamp = phabricator_datetime($timestamp, $user);
$timestamp = phutil_render_tag('a', array('href' => $href), $timestamp); $timestamp = phutil_tag('a', array('href' => $href), $timestamp);
$timestamp = phutil_render_tag( $timestamp = phutil_tag(
'td', 'td',
array( array(
'class' => 'timestamp', 'class' => 'timestamp',
), ),
$timestamp); $timestamp);
$out[] = phutil_render_tag( $out[] = phutil_tag(
'tr', 'tr',
array( array(
'class' => $block['class'], 'class' => $block['class'],
), ),
$author.$message.$timestamp); array($author, $message, $timestamp));
} }
$out[] = '</table>'; $out[] = '</table>';

View file

@ -396,12 +396,9 @@ final class PhabricatorConduitAPIController
$json = new PhutilJSON(); $json = new PhutilJSON();
if (is_array($value)) { if (is_array($value)) {
$value = $json->encodeFormatted($value); $value = $json->encodeFormatted($value);
$value = phutil_escape_html($value);
} else {
$value = phutil_escape_html($value);
} }
$value = '<pre style="white-space: pre-wrap;">'.$value.'</pre>'; $value = hsprintf('<pre style="white-space: pre-wrap;">%s</pre>', $value);
return $value; return $value;
} }

View file

@ -35,37 +35,30 @@ final class PhabricatorConduitConsoleController
case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
$status_view->setTitle('Deprecated Method'); $status_view->setTitle('Deprecated Method');
$status_view->appendChild( $status_view->appendChild(
phutil_escape_html( nonempty($reason, "This method is deprecated."));
nonempty(
$reason,
"This method is deprecated.")));
break; break;
case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
$status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING); $status_view->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$status_view->setTitle('Unstable Method'); $status_view->setTitle('Unstable Method');
$status_view->appendChild( $status_view->appendChild(
phutil_escape_html( nonempty(
nonempty( $reason,
$reason, "This method is new and unstable. Its interface is subject ".
"This method is new and unstable. Its interface is subject ". "to change."));
"to change.")));
break; break;
} }
} }
$error_description = array();
$error_types = $method_object->defineErrorTypes(); $error_types = $method_object->defineErrorTypes();
if ($error_types) { if ($error_types) {
$error_description[] = '<ul>'; $error_description = array();
foreach ($error_types as $error => $meaning) { foreach ($error_types as $error => $meaning) {
$error_description[] = $error_description[] = hsprintf(
'<li>'. '<li><strong>%s:</strong> %s</li>',
'<strong>'.phutil_escape_html($error).':</strong> '. $error,
phutil_escape_html($meaning). $meaning);
'</li>';
} }
$error_description[] = '</ul>'; $error_description = phutil_tag('ul', array(), $error_description);
$error_description = implode("\n", $error_description);
} else { } else {
$error_description = "This method does not raise any specific errors."; $error_description = "This method does not raise any specific errors.";
} }
@ -87,10 +80,10 @@ final class PhabricatorConduitConsoleController
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setLabel('Errors') ->setLabel('Errors')
->setValue($error_description)) ->setValue($error_description))
->appendChild( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">Enter parameters using '. '<p class="aphront-form-instructions">Enter parameters using '.
'<strong>JSON</strong>. For instance, to enter a list, type: '. '<strong>JSON</strong>. For instance, to enter a list, type: '.
'<tt>["apple", "banana", "cherry"]</tt>'); '<tt>["apple", "banana", "cherry"]</tt>'));
$params = $method_object->defineParamTypes(); $params = $method_object->defineParamTypes();
foreach ($params as $param => $desc) { foreach ($params as $param => $desc) {
@ -98,7 +91,7 @@ final class PhabricatorConduitConsoleController
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel($param) ->setLabel($param)
->setName("params[{$param}]") ->setName("params[{$param}]")
->setCaption(phutil_escape_html($desc))); ->setCaption($desc));
} }
$form $form

View file

@ -25,12 +25,12 @@ final class PhabricatorConduitListController
$rows[] = array( $rows[] = array(
$group, $group,
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => '/conduit/method/'.$info['full_name'], 'href' => '/conduit/method/'.$info['full_name'],
), ),
phutil_escape_html($info['full_name'])), $info['full_name']),
$info['description'], $info['description'],
$status, $status,
); );

View file

@ -32,14 +32,15 @@ final class PhabricatorConduitTokenController
$panel->setHeader('Certificate Install Token'); $panel->setHeader('Certificate Install Token');
$panel->setWidth(AphrontPanelView::WIDTH_FORM); $panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild( $panel->appendChild(hsprintf(
'<p class="aphront-form-instructions">Copy and paste this token into '. '<p class="aphront-form-instructions">Copy and paste this token into '.
'the prompt given to you by "arc install-certificate":</p>'. 'the prompt given to you by "arc install-certificate":</p>'.
'<p style="padding: 0 0 1em 4em;">'. '<p style="padding: 0 0 1em 4em;">'.
'<strong>'.phutil_escape_html($token->getToken()).'</strong>'. '<strong>%s</strong>'.
'</p>'. '</p>'.
'<p class="aphront-form-instructions">arc will then complete the '. '<p class="aphront-form-instructions">arc will then complete the '.
'install process for you.</p>'); 'install process for you.</p>',
$token->getToken()));
$this->setShowSideNav(false); $this->setShowSideNav(false);

View file

@ -59,9 +59,10 @@ final class PhabricatorSetupCheckBaseURI extends PhabricatorSetupCheck {
->setSummary($summary) ->setSummary($summary)
->setMessage($message) ->setMessage($message)
->addCommand( ->addCommand(
csprintf( hsprintf(
'<tt>phabricator/ $</tt> '. '<tt>phabricator/ $</tt> %s',
'./bin/config set phabricator.base-uri %s', csprintf(
$base_uri_guess)); './bin/config set phabricator.base-uri %s',
$base_uri_guess)));
} }
} }

View file

@ -79,7 +79,7 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck {
->setName(pht('Setup MySQL Schema')) ->setName(pht('Setup MySQL Schema'))
->setMessage($message) ->setMessage($message)
->setIsFatal(true) ->setIsFatal(true)
->addCommand('<tt>phabricator/ $</tt> ./bin/storage upgrade'); ->addCommand(hsprintf('<tt>phabricator/ $</tt> ./bin/storage upgrade'));
} }
} }
} }

View file

@ -24,12 +24,12 @@ final class PhabricatorConfigAllController
} }
$rows[] = array( $rows[] = array(
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => $this->getApplicationURI('edit/'.$key.'/'), 'href' => $this->getApplicationURI('edit/'.$key.'/'),
), ),
phutil_escape_html($key)), $key),
$value, $value,
); );
} }
@ -68,13 +68,16 @@ final class PhabricatorConfigAllController
$display_version = pht('Unknown'); $display_version = pht('Unknown');
} }
$version_property_list = id(new PhabricatorPropertyListView()); $version_property_list = id(new PhabricatorPropertyListView());
$version_property_list->addProperty('Version', $version_property_list->addProperty(
phutil_escape_html($display_version)); pht('Version'),
$display_version);
$version_path = $phabricator_root.'/conf/local/VERSION'; $version_path = $phabricator_root.'/conf/local/VERSION';
if (Filesystem::pathExists($version_path)) { if (Filesystem::pathExists($version_path)) {
$version_from_file = Filesystem::readFile($version_path); $version_from_file = Filesystem::readFile($version_path);
$version_property_list->addProperty('Local Version', $version_property_list->addProperty(
phutil_escape_html($version_from_file)); pht('Local Version'),
$version_from_file);
} }
$nav = $this->buildSideNavView(); $nav = $this->buildSideNavView();

View file

@ -108,7 +108,7 @@ final class PhabricatorConfigEditController
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle(pht('Configuration Hidden')) ->setTitle(pht('Configuration Hidden'))
->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setSeverity(AphrontErrorView::SEVERITY_WARNING)
->appendChild('<p>'.phutil_escape_html($msg).'</p>'); ->appendChild(phutil_tag('p', array(), $msg));
} else if ($option->getLocked()) { } else if ($option->getLocked()) {
$msg = pht( $msg = pht(
"This configuration is locked and can not be edited from the web ". "This configuration is locked and can not be edited from the web ".
@ -117,7 +117,7 @@ final class PhabricatorConfigEditController
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle(pht('Configuration Locked')) ->setTitle(pht('Configuration Locked'))
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->appendChild('<p>'.phutil_escape_html($msg).'</p>'); ->appendChild(phutil_tag('p', array(), $msg));
} }
if ($option->getHidden()) { if ($option->getHidden()) {
@ -132,7 +132,7 @@ final class PhabricatorConfigEditController
$engine = new PhabricatorMarkupEngine(); $engine = new PhabricatorMarkupEngine();
$engine->addObject($option, 'description'); $engine->addObject($option, 'description');
$engine->process(); $engine->process();
$description = phutil_render_tag( $description = phutil_tag(
'div', 'div',
array( array(
'class' => 'phabricator-remarkup', 'class' => 'phabricator-remarkup',
@ -419,33 +419,33 @@ final class PhabricatorConfigEditController
} }
$table = array(); $table = array();
$table[] = '<tr class="column-labels">'; $table[] = hsprintf(
$table[] = '<th>'.pht('Example').'</th>'; '<tr class="column-labels"><th>%s</th><th>%s</th></tr>',
$table[] = '<th>'.pht('Value').'</th>'; pht('Example'),
$table[] = '</tr>'; pht('Value'));
foreach ($examples as $example) { foreach ($examples as $example) {
list($value, $description) = $example; list($value, $description) = $example;
if ($value === null) { if ($value === null) {
$value = '<em>'.pht('(empty)').'</em>'; $value = phutil_tag('em', array(), pht('(empty)'));
} else { } else {
$value = nl2br(phutil_escape_html($value)); $value = phutil_escape_html_newlines($value);
} }
$table[] = '<tr>'; $table[] = hsprintf(
$table[] = '<th>'.phutil_escape_html($description).'</th>'; '<tr><th>%s</th><td>%s</td></tr>',
$table[] = '<td>'.$value.'</td>'; $description,
$table[] = '</tr>'; $value);
} }
require_celerity_resource('config-options-css'); require_celerity_resource('config-options-css');
return phutil_render_tag( return phutil_tag(
'table', 'table',
array( array(
'class' => 'config-option-table', 'class' => 'config-option-table',
), ),
implode("\n", $table)); $table);
} }
private function renderDefaults(PhabricatorConfigOption $option) { private function renderDefaults(PhabricatorConfigOption $option) {
@ -467,10 +467,10 @@ final class PhabricatorConfigEditController
$table = array(); $table = array();
$table[] = '<tr class="column-labels">'; $table[] = hsprintf(
$table[] = '<th>'.pht('Source').'</th>'; '<tr class="column-labels"><th>%s</th><th>%s</th></tr>',
$table[] = '<th>'.pht('Value').'</th>'; pht('Source'),
$table[] = '</tr>'; pht('Value'));
foreach ($stack as $key => $source) { foreach ($stack as $key => $source) {
$value = $source->getKeys( $value = $source->getKeys(
array( array(
@ -478,26 +478,26 @@ final class PhabricatorConfigEditController
)); ));
if (!array_key_exists($option->getKey(), $value)) { if (!array_key_exists($option->getKey(), $value)) {
$value = '<em>'.pht('(empty)').'</em>'; $value = phutil_tag('em', array(), pht('(empty)'));
} else { } else {
$value = PhabricatorConfigJSON::prettyPrintJSON( $value = PhabricatorConfigJSON::prettyPrintJSON(
$value[$option->getKey()]); $value[$option->getKey()]);
} }
$table[] = '<tr>'; $table[] = hsprintf(
$table[] = '<th>'.phutil_escape_html($source->getName()).'</th>'; '<tr><th>%s</th><td>%s</td></tr>',
$table[] = '<td>'.$value.'</td>'; $source->getName(),
$table[] = '</tr>'; $value);
} }
require_celerity_resource('config-options-css'); require_celerity_resource('config-options-css');
return phutil_render_tag( return phutil_tag(
'table', 'table',
array( array(
'class' => 'config-option-table', 'class' => 'config-option-table',
), ),
implode("\n", $table)); $table);
} }
} }

View file

@ -85,13 +85,15 @@ final class PhabricatorConfigGroupController
$current_value = PhabricatorEnv::getEnvConfig($option->getKey()); $current_value = PhabricatorEnv::getEnvConfig($option->getKey());
$current_value = PhabricatorConfigJSON::prettyPrintJSON( $current_value = PhabricatorConfigJSON::prettyPrintJSON(
$current_value); $current_value);
$current_value = phutil_render_tag( $current_value = phutil_tag(
'div', 'div',
array( array(
'class' => 'config-options-current-value', 'class' => 'config-options-current-value',
), ),
'<span>'.pht('Current Value:').'</span> '. array(
phutil_escape_html($current_value)); phutil_tag('span', array(), pht('Current Value:')),
' '.$current_value,
));
$item->appendChild($current_value); $item->appendChild($current_value);
} }

View file

@ -22,7 +22,7 @@ final class PhabricatorConfigIssueViewController
->setTitle(pht('Issue Resolved')) ->setTitle(pht('Issue Resolved'))
->appendChild(pht('This setup issue has been resolved. ')) ->appendChild(pht('This setup issue has been resolved. '))
->appendChild( ->appendChild(
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => $this->getApplicationURI('issue/'), 'href' => $this->getApplicationURI('issue/'),
@ -64,7 +64,7 @@ final class PhabricatorConfigIssueViewController
$view = new PhabricatorSetupIssueView(); $view = new PhabricatorSetupIssueView();
$view->setIssue($issue); $view->setIssue($issue);
$container = phutil_render_tag( $container = phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-background', 'class' => 'setup-issue-background',

View file

@ -52,7 +52,7 @@ final class PhabricatorConfigListController
$item = id(new PhabricatorObjectItemView()) $item = id(new PhabricatorObjectItemView())
->setHeader($group->getName()) ->setHeader($group->getName())
->setHref('/config/group/'.$group->getKey().'/') ->setHref('/config/group/'.$group->getKey().'/')
->addAttribute(phutil_escape_html($group->getDescription())); ->addAttribute($group->getDescription());
$list->addItem($item); $list->addItem($item);
} }

View file

@ -18,7 +18,7 @@ final class PhabricatorConfigEditor
switch ($xaction->getTransactionType()) { switch ($xaction->getTransactionType()) {
case PhabricatorConfigTransaction::TYPE_EDIT: case PhabricatorConfigTransaction::TYPE_EDIT:
return array( return array(
'deleted' => (bool)$object->getIsDeleted(), 'deleted' => (int)$object->getIsDeleted(),
'value' => $object->getValue(), 'value' => $object->getValue(),
); );
} }
@ -54,7 +54,7 @@ final class PhabricatorConfigEditor
$v['value']); $v['value']);
} }
$object->setIsDeleted($v['deleted']); $object->setIsDeleted((int)$v['deleted']);
$object->setValue($v['value']); $object->setValue($v['value']);
break; break;
} }

View file

@ -16,33 +16,36 @@ final class PhabricatorSetupIssueView extends AphrontView {
public function render() { public function render() {
$issue = $this->getIssue(); $issue = $this->getIssue();
$description = phutil_render_tag( $description = array();
$description[] = phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-instructions', 'class' => 'setup-issue-instructions',
), ),
nl2br(phutil_escape_html($issue->getMessage()))); phutil_escape_html_newlines($issue->getMessage()));
$configs = $issue->getPHPConfig(); $configs = $issue->getPHPConfig();
if ($configs) { if ($configs) {
$description .= $this->renderPHPConfig($configs); $description[] = $this->renderPHPConfig($configs);
} }
$configs = $issue->getPhabricatorConfig(); $configs = $issue->getPhabricatorConfig();
if ($configs) { if ($configs) {
$description .= $this->renderPhabricatorConfig($configs); $description[] = $this->renderPhabricatorConfig($configs);
} }
$commands = $issue->getCommands(); $commands = $issue->getCommands();
if ($commands) { if ($commands) {
$run_these = pht("Run these %d command(s):", count($commands)); $run_these = pht("Run these %d command(s):", count($commands));
$description .= phutil_render_tag( $description[] = phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-config', 'class' => 'setup-issue-config',
), ),
phutil_render_tag('p', array(), $run_these). array(
phutil_render_tag('pre', array(), implode("\n", $commands))); phutil_tag('p', array(), $run_these),
phutil_tag('pre', array(), array_interleave("\n", $commands)),
));
} }
$extensions = $issue->getPHPExtensions(); $extensions = $issue->getPHPExtensions();
@ -51,18 +54,19 @@ final class PhabricatorSetupIssueView extends AphrontView {
"Install these %d PHP extension(s):", count($extensions)); "Install these %d PHP extension(s):", count($extensions));
$install_info = pht( $install_info = pht(
"You can usually install a PHP extension using <tt>apt-get</tt> or ". "You can usually install a PHP extension using %s or %s. Common ".
"<tt>yum</tt>. Common package names are ". "package names are %s or %s. Try commands like these:",
"<tt>php-<em>extname</em></tt> or <tt>php5-<em>extname</em></tt>. ". phutil_tag('tt', array(), 'apt-get'),
"Try commands like these:"); phutil_tag('tt', array(), 'yum'),
hsprintf('<tt>php-<em>%s</em></tt>', pht('extname')),
hsprintf('<tt>php5-<em>%s</em></tt>', pht('extname')));
// TODO: We should do a better job of detecting how to install extensions // TODO: We should do a better job of detecting how to install extensions
// on the current system. // on the current system.
$install_commands = array( $install_commands = hsprintf(
"$ sudo apt-get install php5-<em>extname</em> # Debian / Ubuntu", "\$ sudo apt-get install php5-<em>extname</em> # Debian / Ubuntu\n".
"$ sudo yum install php-<em>extname</em> # Red Hat / Derivatives", "\$ sudo yum install php-<em>extname</em> # Red Hat / Derivatives"
); );
$install_commands = implode("\n", $install_commands);
$fallback_info = pht( $fallback_info = pht(
"If those commands don't work, try Google. The process of installing ". "If those commands don't work, try Google. The process of installing ".
@ -72,85 +76,72 @@ final class PhabricatorSetupIssueView extends AphrontView {
$restart_info = pht( $restart_info = pht(
"After installing new PHP extensions, <strong>restart your webserver ". "After installing new PHP extensions, <strong>restart your webserver ".
"for the changes to take effect</strong>."); "for the changes to take effect</strong>.",
hsprintf(''));
$description .= phutil_render_tag( $description[] = phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-config', 'class' => 'setup-issue-config',
), ),
phutil_render_tag('p', array(), $install_these). array(
phutil_render_tag('pre', array(), implode("\n", $extensions)). phutil_tag('p', array(), $install_these),
phutil_render_tag('p', array(), $install_info). phutil_tag('pre', array(), implode("\n", $extensions)),
phutil_render_tag('pre', array(), $install_commands). phutil_tag('p', array(), $install_info),
phutil_render_tag('p', array(), $fallback_info). phutil_tag('pre', array(), $install_commands),
phutil_render_tag('p', array(), $restart_info)); phutil_tag('p', array(), $fallback_info),
phutil_tag('p', array(), $restart_info),
));
} }
$next = phutil_render_tag( $next = phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-next', 'class' => 'setup-issue-next',
), ),
pht('To continue, resolve this problem and reload the page.')); pht('To continue, resolve this problem and reload the page.'));
$name = phutil_render_tag( $name = phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-name', 'class' => 'setup-issue-name',
), ),
phutil_escape_html($issue->getName())); $issue->getName());
return phutil_render_tag( return phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue', 'class' => 'setup-issue',
), ),
$name.$description.$next); $this->renderHTMLView(
array(
$name,
$description,
$next,
)));
} }
private function renderPhabricatorConfig(array $configs) { private function renderPhabricatorConfig(array $configs) {
$issue = $this->getIssue(); $issue = $this->getIssue();
$table_info = phutil_render_tag( $table_info = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"The current Phabricator configuration has these %d value(s):", "The current Phabricator configuration has these %d value(s):",
count($configs))); count($configs)));
$table = array(); $dict = array();
foreach ($configs as $key) { foreach ($configs as $key) {
$table[] = '<tr>'; $dict[$key] = PhabricatorEnv::getUnrepairedEnvConfig($key);
$table[] = '<th>'.phutil_escape_html($key).'</th>';
$value = PhabricatorEnv::getUnrepairedEnvConfig($key);
if ($value === null) {
$value = '<em>null</em>';
} else if ($value === false) {
$value = '<em>false</em>';
} else if ($value === true) {
$value = '<em>true</em>';
} else {
$value = phutil_escape_html(
PhabricatorConfigJSON::prettyPrintJSON($value));
}
$table[] = '<td>'.$value.'</td>';
$table[] = '</tr>';
} }
$table = $this->renderValueTable($dict);
$table = phutil_render_tag(
'table',
array(
),
implode("\n", $table));
$options = PhabricatorApplicationConfigOptions::loadAllOptions(); $options = PhabricatorApplicationConfigOptions::loadAllOptions();
if ($this->getIssue()->getIsFatal()) { if ($this->getIssue()->getIsFatal()) {
$update_info = phutil_render_tag( $update_info = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
@ -160,29 +151,28 @@ final class PhabricatorSetupIssueView extends AphrontView {
$update = array(); $update = array();
foreach ($configs as $key) { foreach ($configs as $key) {
$cmd = '<tt>phabricator/ $</tt> ./bin/config set '. $update[] = hsprintf(
phutil_escape_html($key).' '. '<tt>phabricator/ $</tt> ./bin/config set %s <em>value</em>',
'<em>value</em>'; $key);
$update[] = $cmd;
} }
$update = phutil_render_tag('pre', array(), implode("\n", $update)); $update = phutil_tag('pre', array(), array_interleave("\n", $update));
} else { } else {
$update = array(); $update = array();
foreach ($configs as $config) { foreach ($configs as $config) {
if (!idx($options, $config) || $options[$config]->getLocked()) { if (!idx($options, $config) || $options[$config]->getLocked()) {
continue; continue;
} }
$link = phutil_render_tag( $link = phutil_tag(
'a', 'a',
array( array(
'href' => '/config/edit/'.$config.'/?issue='.$issue->getIssueKey(), 'href' => '/config/edit/'.$config.'/?issue='.$issue->getIssueKey(),
), ),
pht('Edit %s', phutil_escape_html($config))); pht('Edit %s', $config));
$update[] = '<li>'.$link.'</li>'; $update[] = phutil_tag('li', array(), $link);
} }
if ($update) { if ($update) {
$update = '<ul>'.implode("\n", $update).'</ul>'; $update = phutil_tag('ul', array(), $update);
$update_info = phutil_render_tag( $update_info = phutil_tag(
'p', 'p',
array(), array(),
pht("You can update these %d value(s) here:", count($configs))); pht("You can update these %d value(s) here:", count($configs)));
@ -192,12 +182,12 @@ final class PhabricatorSetupIssueView extends AphrontView {
} }
} }
return phutil_render_tag( return phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-config', 'class' => 'setup-issue-config',
), ),
self::renderSingleView( self::renderHTMLView(
array( array(
$table_info, $table_info,
$table, $table,
@ -207,41 +197,19 @@ final class PhabricatorSetupIssueView extends AphrontView {
} }
private function renderPHPConfig(array $configs) { private function renderPHPConfig(array $configs) {
$table_info = phutil_render_tag( $table_info = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"The current PHP configuration has these %d value(s):", "The current PHP configuration has these %d value(s):",
count($configs))); count($configs)));
$table = array(); $dict = array();
foreach ($configs as $key) { foreach ($configs as $key) {
$table[] = '<tr>'; $dict[$key] = ini_get($key);
$table[] = '<th>'.phutil_escape_html($key).'</th>';
$value = ini_get($key);
if ($value === null) {
$value = '<em>null</em>';
} else if ($value === false) {
$value = '<em>false</em>';
} else if ($value === true) {
$value = '<em>true</em>';
} else if ($value === '') {
$value = '<em>(empty string)</em>';
} else {
$value = phutil_escape_html($value);
}
$table[] = '<td>'.$value.'</td>';
$table[] = '</tr>';
} }
$table = phutil_render_tag( $table = $this->renderValueTable($dict);
'table',
array(
),
implode("\n", $table));
ob_start(); ob_start();
phpinfo(); phpinfo();
@ -268,66 +236,95 @@ final class PhabricatorSetupIssueView extends AphrontView {
} }
} }
$info = array();
if (!$ini_loc) { if (!$ini_loc) {
$info = phutil_render_tag( $info[] = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"To update these %d value(s), edit your PHP configuration file.", "To update these %d value(s), edit your PHP configuration file.",
count($configs))); count($configs)));
} else { } else {
$info = phutil_render_tag( $info[] = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"To update these %d value(s), edit your PHP configuration file, ". "To update these %d value(s), edit your PHP configuration file, ".
"located here:", "located here:",
count($configs))); count($configs)));
$info .= phutil_render_tag( $info[] = phutil_tag(
'pre', 'pre',
array(), array(),
phutil_escape_html($ini_loc)); $ini_loc);
} }
if ($more_loc) { if ($more_loc) {
$info .= phutil_render_tag( $info[] = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"PHP also loaded these configuration file(s):", "PHP also loaded these configuration file(s):",
count($more_loc))); count($more_loc)));
$info .= phutil_render_tag( $info[] = phutil_tag(
'pre', 'pre',
array(), array(),
phutil_escape_html(implode("\n", $more_loc))); implode("\n", $more_loc));
} }
$info .= phutil_render_tag( $info[] = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"You can find more information about PHP configuration values in the ". 'You can find more information about PHP configuration values in the '.
"%s.", '<a href="%s">PHP Documentation</a>.',
phutil_render_tag( 'http://php.net/manual/ini.list.php',
'a', hsprintf('')));
array(
'href' => 'http://php.net/manual/ini.list.php',
),
pht('PHP Documentation'))));
$info .= phutil_render_tag( $info[] = phutil_tag(
'p', 'p',
array(), array(),
pht( pht(
"After editing the PHP configuration, <strong>restart your ". "After editing the PHP configuration, <strong>restart your ".
"webserver for the changes to take effect</strong>.")); "webserver for the changes to take effect</strong>.",
hsprintf('')));
return phutil_render_tag( return phutil_tag(
'div', 'div',
array( array(
'class' => 'setup-issue-config', 'class' => 'setup-issue-config',
), ),
$table_info.$table.$info); $this->renderHTMLView(
array(
$table_info,
$table,
$info,
)));
}
private function renderValueTable(array $dict) {
$rows = array();
foreach ($dict as $key => $value) {
$cols = array(
phutil_tag('th', array(), $key),
phutil_tag('td', array(), $this->renderValueForDisplay($value)),
);
$rows[] = phutil_tag('tr', array(), $cols);
}
return phutil_tag('table', array(), $rows);
}
private function renderValueForDisplay($value) {
if ($value === null) {
return phutil_tag('em', array(), 'null');
} else if ($value === false) {
return phutil_tag('em', array(), 'false');
} else if ($value === true) {
return phutil_tag('em', array(), 'true');
} else if ($value === '') {
return phutil_tag('em', array(), 'empty string');
} else {
return PhabricatorConfigJSON::prettyPrintJSON($value);
}
} }
} }

View file

@ -158,7 +158,9 @@ abstract class ConpherenceController extends PhabricatorController {
$item->addClass('conpherence-selected'); $item->addClass('conpherence-selected');
$item->addClass('hide-unread-count'); $item->addClass('hide-unread-count');
} }
$nav->addCustomBlock($item->render());
// TODO: [HTML] Clean this up when we clean up HTML stuff in Conpherence.
$nav->addCustomBlock(phutil_safe_html($item->render()));
} }
if (empty($conpherences) || $read) { if (empty($conpherences) || $read) {
$nav->addCustomBlock($this->getNoConpherencesBlock()); $nav->addCustomBlock($this->getNoConpherencesBlock());
@ -168,14 +170,12 @@ abstract class ConpherenceController extends PhabricatorController {
} }
private function getNoConpherencesBlock() { private function getNoConpherencesBlock() {
return phutil_tag( return phutil_tag(
'div', 'div',
array( array(
'class' => 'no-conpherences-menu-item' 'class' => 'no-conpherences-menu-item'
), ),
pht('No more conversations.') pht('No more conpherences.'));
);
} }
public function buildApplicationMenu() { public function buildApplicationMenu() {

View file

@ -116,4 +116,4 @@ final class ConpherenceListController extends
} }
} }

View file

@ -92,11 +92,10 @@ final class ConpherenceNewController extends ConpherenceController {
->setTitle('Success') ->setTitle('Success')
->addCancelButton('#', 'Okay') ->addCancelButton('#', 'Okay')
->appendChild( ->appendChild(
phutil_tag('p', phutil_tag(
array(), 'p',
pht('Message sent successfully.') array(),
) pht('Message sent successfully.')));
);
$response = id(new AphrontDialogResponse()) $response = id(new AphrontDialogResponse())
->setDialog($dialog); ->setDialog($dialog);
} else { } else {

View file

@ -282,9 +282,8 @@ final class ConpherenceViewController extends
array( array(
'src' => $thumb 'src' => $thumb
), ),
'' ''),
), phutil_escape_html($file->getName()),
$file->getName()
); );
} }
$header = id(new PhabricatorHeaderView()) $header = id(new PhabricatorHeaderView())

View file

@ -136,9 +136,17 @@ final class ConpherenceMenuItemView extends AphrontTagView {
array( array(
'class' => 'conpherence-menu-item-unread-count' 'class' => 'conpherence-menu-item-unread-count'
), ),
$this->unreadCount); (int)$this->unreadCount);
} }
return $image.$title.$subtitle.$message.$epoch.$unread_count; return $this->renderHTMLView(
array(
$image,
$title,
$subtitle,
$message,
$epoch,
$unread_count,
));
} }
} }

View file

@ -41,6 +41,7 @@ final class ConpherenceTransactionView extends AphrontView {
->setEpoch($transaction->getDateCreated()) ->setEpoch($transaction->getDateCreated())
->setContentSource($transaction->getContentSource()); ->setContentSource($transaction->getContentSource());
$content = null;
$content_class = null; $content_class = null;
$content = null; $content = null;
switch ($transaction->getTransactionType()) { switch ($transaction->getTransactionType()) {
@ -53,6 +54,17 @@ final class ConpherenceTransactionView extends AphrontView {
case ConpherenceTransactionType::TYPE_FILES: case ConpherenceTransactionType::TYPE_FILES:
$content = $transaction->getTitle(); $content = $transaction->getTitle();
break; break;
case ConpherenceTransactionType::TYPE_PICTURE:
$img = $transaction->getHandle($transaction->getNewValue());
$content = array(
$transaction->getTitle(),
phutil_tag(
'img',
array(
'src' => $img->getImageURI()
)));
$transaction_view->addClass('conpherence-edited');
break;
case ConpherenceTransactionType::TYPE_PARTICIPANTS: case ConpherenceTransactionType::TYPE_PARTICIPANTS:
$content = $transaction->getTitle(); $content = $transaction->getTitle();
$transaction_view->addClass('conpherence-edited'); $transaction_view->addClass('conpherence-edited');
@ -79,7 +91,7 @@ final class ConpherenceTransactionView extends AphrontView {
array( array(
'class' => $content_class 'class' => $content_class
), ),
new PhutilSafeHTML($content)) $this->renderHTMLView($content))
); );
return $transaction_view->render(); return $transaction_view->render();

View file

@ -33,9 +33,9 @@ final class PhabricatorCountdownDeleteController
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($request->getUser()); $dialog->setUser($request->getUser());
$dialog->setTitle('Really delete this countdown?'); $dialog->setTitle('Really delete this countdown?');
$dialog->appendChild( $dialog->appendChild(hsprintf(
'<p>Are you sure you want to delete the countdown "'. '<p>Are you sure you want to delete the countdown "%s"?</p>',
phutil_escape_html($timer->getTitle()).'"?</p>'); $timer->getTitle()));
$dialog->addSubmitButton('Delete'); $dialog->addSubmitButton('Delete');
$dialog->addCancelButton('/countdown/'); $dialog->addCancelButton('/countdown/');
$dialog->setSubmitURI($request->getPath()); $dialog->setSubmitURI($request->getPath());

View file

@ -97,11 +97,11 @@ final class PhabricatorCountdownEditController
->setLabel('End date') ->setLabel('End date')
->setValue($display_datepoint) ->setValue($display_datepoint)
->setName('datepoint') ->setName('datepoint')
->setCaption( ->setCaption(hsprintf(
'Examples: '. 'Examples: '.
'<tt>2011-12-25</tt> or '. '<tt>2011-12-25</tt> or '.
'<tt>3 hours</tt> or '. '<tt>3 hours</tt> or '.
'<tt>June 8 2011, 5 PM</tt>.')) '<tt>June 8 2011, 5 PM</tt>.')))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->addCancelButton('/countdown/') ->addCancelButton('/countdown/')

View file

@ -28,7 +28,7 @@ final class PhabricatorCountdownListController
$delete_button = null; $delete_button = null;
if ($user->getIsAdmin() || if ($user->getIsAdmin() ||
($user->getPHID() == $timer->getAuthorPHID())) { ($user->getPHID() == $timer->getAuthorPHID())) {
$edit_button = phutil_render_tag( $edit_button = phutil_tag(
'a', 'a',
array( array(
'class' => 'small button grey', 'class' => 'small button grey',
@ -36,7 +36,7 @@ final class PhabricatorCountdownListController
), ),
'Edit'); 'Edit');
$delete_button = javelin_render_tag( $delete_button = javelin_tag(
'a', 'a',
array( array(
'class' => 'small button grey', 'class' => 'small button grey',
@ -48,12 +48,12 @@ final class PhabricatorCountdownListController
$rows[] = array( $rows[] = array(
phutil_escape_html($timer->getID()), phutil_escape_html($timer->getID()),
$handles[$timer->getAuthorPHID()]->renderLink(), $handles[$timer->getAuthorPHID()]->renderLink(),
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => '/countdown/'.$timer->getID().'/', 'href' => '/countdown/'.$timer->getID().'/',
), ),
phutil_escape_html($timer->getTitle())), $timer->getTitle()),
phabricator_datetime($timer->getDatepoint(), $user), phabricator_datetime($timer->getDatepoint(), $user),
$edit_button, $edit_button,
$delete_button, $delete_button,

View file

@ -23,21 +23,18 @@ final class PhabricatorCountdownViewController
$chrome_visible = $request->getBool('chrome', true); $chrome_visible = $request->getBool('chrome', true);
$chrome_new = $chrome_visible ? false : null; $chrome_new = $chrome_visible ? false : null;
$chrome_link = phutil_render_tag( $chrome_link = phutil_tag(
'a', 'a',
array( array(
'href' => $request->getRequestURI()->alter('chrome', $chrome_new), 'href' => $request->getRequestURI()->alter('chrome', $chrome_new),
'class' => 'phabricator-timer-chrome-link', 'class' => 'phabricator-timer-chrome-link',
), ),
$chrome_visible ? 'Disable Chrome' : 'Enable Chrome'); $chrome_visible ? pht('Disable Chrome') : pht('Enable Chrome'));
$container = celerity_generate_unique_node_id(); $container = celerity_generate_unique_node_id();
$content = $content = hsprintf(
'<div class="phabricator-timer" id="'.$container.'"> '<div class="phabricator-timer" id="%s">
<h1 class="phabricator-timer-header">'. <h1 class="phabricator-timer-header">%s &middot; %s</h1>
phutil_escape_html($timer->getTitle()).' &middot; '.
phabricator_datetime($timer->getDatePoint(), $user).
'</h1>
<div class="phabricator-timer-pane"> <div class="phabricator-timer-pane">
<table class="phabricator-timer-table"> <table class="phabricator-timer-table">
<tr> <tr>
@ -46,20 +43,19 @@ final class PhabricatorCountdownViewController
<th>Minutes</th> <th>Minutes</th>
<th>Seconds</th> <th>Seconds</th>
</tr> </tr>
<tr>'. <tr>%s%s%s%s</tr>
javelin_render_tag('td',
array('sigil' => 'phabricator-timer-days'), '').
javelin_render_tag('td',
array('sigil' => 'phabricator-timer-hours'), '').
javelin_render_tag('td',
array('sigil' => 'phabricator-timer-minutes'), '').
javelin_render_tag('td',
array('sigil' => 'phabricator-timer-seconds'), '').
'</tr>
</table> </table>
</div>'. </div>
$chrome_link. %s
'</div>'; </div>',
$container,
$timer->getTitle(),
phabricator_datetime($timer->getDatePoint(), $user),
javelin_tag('td', array('sigil' => 'phabricator-timer-days'), ''),
javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), ''),
javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), ''),
javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), ''),
$chrome_link);
Javelin::initBehavior('countdown-timer', array( Javelin::initBehavior('countdown-timer', array(
'timestamp' => $timer->getDatepoint(), 'timestamp' => $timer->getDatepoint(),

View file

@ -81,7 +81,7 @@ final class PhabricatorDaemonConsoleController
$task->getLeaseOwner(), $task->getLeaseOwner(),
$task->getLeaseExpires() - time(), $task->getLeaseExpires() - time(),
$task->getFailureCount(), $task->getFailureCount(),
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => '/daemon/task/'.$task->getID().'/', 'href' => '/daemon/task/'.$task->getID().'/',

View file

@ -23,8 +23,10 @@ final class PhabricatorWorkerTaskDetailController
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('No Such Task'); $error_view->setTitle('No Such Task');
$error_view->appendChild( $error_view->appendChild(phutil_tag(
'<p>This task may have recently been garbage collected.</p>'); 'p',
array(),
'This task may have recently been garbage collected.'));
$error_view->setSeverity(AphrontErrorView::SEVERITY_NODATA); $error_view->setSeverity(AphrontErrorView::SEVERITY_NODATA);
$content = $error_view; $content = $error_view;
@ -124,7 +126,7 @@ final class PhabricatorWorkerTaskDetailController
$view->addProperty( $view->addProperty(
pht('Task Class'), pht('Task Class'),
phutil_escape_html($task->getTaskClass())); $task->getTaskClass());
if ($task->getLeaseExpires()) { if ($task->getLeaseExpires()) {
if ($task->getLeaseExpires() > time()) { if ($task->getLeaseExpires() > time()) {
@ -133,7 +135,7 @@ final class PhabricatorWorkerTaskDetailController
$lease_status = pht('Lease Expired'); $lease_status = pht('Lease Expired');
} }
} else { } else {
$lease_status = '<em>'.pht('Not Leased').'</em>'; $lease_status = phutil_tag('em', array(), pht('Not Leased'));
} }
$view->addProperty( $view->addProperty(
@ -143,14 +145,14 @@ final class PhabricatorWorkerTaskDetailController
$view->addProperty( $view->addProperty(
pht('Lease Owner'), pht('Lease Owner'),
$task->getLeaseOwner() $task->getLeaseOwner()
? phutil_escape_html($task->getLeaseOwner()) ? $task->getLeaseOwner()
: '<em>'.pht('None').'</em>'); : phutil_tag('em', array(), pht('None')));
if ($task->getLeaseExpires() && $task->getLeaseOwner()) { if ($task->getLeaseExpires() && $task->getLeaseOwner()) {
$expires = ($task->getLeaseExpires() - time()); $expires = ($task->getLeaseExpires() - time());
$expires = phabricator_format_relative_time_detailed($expires); $expires = phabricator_format_relative_time_detailed($expires);
} else { } else {
$expires = '<em>'.pht('None').'</em>'; $expires = phutil_tag('em', array(), pht('None'));
} }
$view->addProperty( $view->addProperty(
@ -159,12 +161,12 @@ final class PhabricatorWorkerTaskDetailController
$view->addProperty( $view->addProperty(
pht('Failure Count'), pht('Failure Count'),
phutil_escape_html($task->getFailureCount())); $task->getFailureCount());
if ($task->isArchived()) { if ($task->isArchived()) {
$duration = phutil_escape_html(number_format($task->getDuration()).' us'); $duration = number_format($task->getDuration()).' us';
} else { } else {
$duration = '<em>'.pht('Not Completed').'</em>'; $duration = phutil_tag('em', array(), pht('Not Completed'));
} }
$view->addProperty( $view->addProperty(

View file

@ -63,18 +63,18 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
phutil_escape_html($event->getLogType()), phutil_escape_html($event->getLogType()),
phabricator_date($event->getEpoch(), $this->user), phabricator_date($event->getEpoch(), $this->user),
phabricator_time($event->getEpoch(), $this->user), phabricator_time($event->getEpoch(), $this->user),
str_replace("\n", '<br />', phutil_escape_html($message.$more)), phutil_escape_html_newlines($message.$more),
); );
if ($this->combinedLog) { if ($this->combinedLog) {
array_unshift( array_unshift(
$row, $row,
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => '/daemon/log/'.$event->getLogID().'/', 'href' => '/daemon/log/'.$event->getLogID().'/',
), ),
phutil_escape_html('Daemon '.$event->getLogID()))); 'Daemon '.$event->getLogID()));
} }
$rows[] = $row; $rows[] = $row;

View file

@ -47,17 +47,17 @@ final class PhabricatorDaemonLogListView extends AphrontView {
case PhabricatorDaemonLog::STATUS_RUNNING: case PhabricatorDaemonLog::STATUS_RUNNING:
$style = 'color: #00cc00'; $style = 'color: #00cc00';
$title = 'Running'; $title = 'Running';
$symbol = '&bull;'; $symbol = "\xE2\x80\xA2";
break; break;
case PhabricatorDaemonLog::STATUS_DEAD: case PhabricatorDaemonLog::STATUS_DEAD:
$style = 'color: #cc0000'; $style = 'color: #cc0000';
$title = 'Died'; $title = 'Died';
$symbol = '&bull;'; $symbol = "\xE2\x80\xA2";
break; break;
case PhabricatorDaemonLog::STATUS_EXITED: case PhabricatorDaemonLog::STATUS_EXITED:
$style = 'color: #000000'; $style = 'color: #000000';
$title = 'Exited'; $title = 'Exited';
$symbol = '&bull;'; $symbol = "\xE2\x80\xA2";
break; break;
case PhabricatorDaemonLog::STATUS_UNKNOWN: case PhabricatorDaemonLog::STATUS_UNKNOWN:
default: // fallthrough default: // fallthrough
@ -66,7 +66,7 @@ final class PhabricatorDaemonLogListView extends AphrontView {
$symbol = '?'; $symbol = '?';
} }
$running = phutil_render_tag( $running = phutil_tag(
'span', 'span',
array( array(
'style' => $style, 'style' => $style,
@ -81,7 +81,7 @@ final class PhabricatorDaemonLogListView extends AphrontView {
$log->getPID(), $log->getPID(),
phabricator_date($epoch, $this->user), phabricator_date($epoch, $this->user),
phabricator_time($epoch, $this->user), phabricator_time($epoch, $this->user),
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => '/daemon/log/'.$log->getID().'/', 'href' => '/daemon/log/'.$log->getID().'/',

View file

@ -234,18 +234,24 @@ final class DifferentialChangesetViewController extends DifferentialController {
Javelin::initBehavior('differential-comment-jump', array()); Javelin::initBehavior('differential-comment-jump', array());
// TODO: [HTML] Clean up DifferentialChangesetParser output, but it's
// undergoing like six kinds of refactoring anyway.
$output = phutil_safe_html($output);
$detail = new DifferentialChangesetDetailView(); $detail = new DifferentialChangesetDetailView();
$detail->setChangeset($changeset); $detail->setChangeset($changeset);
$detail->appendChild($output); $detail->appendChild($output);
$detail->setVsChangesetID($left_source); $detail->setVsChangesetID($left_source);
$panel = new DifferentialPrimaryPaneView(); $panel = new DifferentialPrimaryPaneView();
$panel->appendChild(phutil_render_tag('div', $panel->appendChild(
phutil_tag(
'div',
array( array(
'class' => 'differential-review-stage', 'class' => 'differential-review-stage',
'id' => 'differential-review-stage', 'id' => 'differential-review-stage',
), $detail->render()) ),
); $detail->render()));
return $this->buildStandardPageResponse( return $this->buildStandardPageResponse(
array( array(

View file

@ -56,7 +56,7 @@ final class DifferentialCommentSaveController extends DifferentialController {
$dialog->setTitle(pht('Action Has No Effect')); $dialog->setTitle(pht('Action Has No Effect'));
$dialog->appendChild( $dialog->appendChild(
'<p>'.phutil_escape_html($no_effect->getMessage()).'</p>'); phutil_tag('p', array(), $no_effect->getMessage()));
if (strlen($comment) || $has_inlines) { if (strlen($comment) || $has_inlines) {
$dialog->addSubmitButton(pht('Post as Comment')); $dialog->addSubmitButton(pht('Post as Comment'));

View file

@ -30,7 +30,7 @@ final class DifferentialDiffCreateController extends DifferentialController {
$form = new AphrontFormView(); $form = new AphrontFormView();
$arcanist_href = PhabricatorEnv::getDoclink( $arcanist_href = PhabricatorEnv::getDoclink(
'article/Arcanist_User_Guide.html'); 'article/Arcanist_User_Guide.html');
$arcanist_link = phutil_render_tag( $arcanist_link = phutil_tag(
'a', 'a',
array( array(
'href' => $arcanist_href, 'href' => $arcanist_href,
@ -41,12 +41,15 @@ final class DifferentialDiffCreateController extends DifferentialController {
->setAction('/differential/diff/create/') ->setAction('/differential/diff/create/')
->setEncType('multipart/form-data') ->setEncType('multipart/form-data')
->setUser($request->getUser()) ->setUser($request->getUser())
->appendChild( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">'.pht('The best way to create '. '<p class="aphront-form-instructions">%s</p>',
'a Differential diff is by using %s, but you '. pht(
'can also just paste a diff (e.g., from <tt>svn diff</tt> or '. 'The best way to create a Differential diff is by using %s, but you '.
'<tt>git diff</tt>) into this box or upload it as a file if you '. 'can also just paste a diff (e.g., from %s or %s) into this box '.
'really want.', $arcanist_link).'</p>') 'or upload it as a file if you really want.',
$arcanist_link,
phutil_tag('tt', array(), 'svn diff'),
phutil_tag('tt', array(), 'git diff'))))
->appendChild( ->appendChild(
id(new AphrontFormTextAreaControl()) id(new AphrontFormTextAreaControl())
->setLabel(pht('Raw Diff')) ->setLabel(pht('Raw Diff'))

View file

@ -19,12 +19,12 @@ final class DifferentialDiffViewController extends DifferentialController {
if ($diff->getRevisionID()) { if ($diff->getRevisionID()) {
$top_panel = new AphrontPanelView(); $top_panel = new AphrontPanelView();
$top_panel->setWidth(AphrontPanelView::WIDTH_WIDE); $top_panel->setWidth(AphrontPanelView::WIDTH_WIDE);
$link = phutil_render_tag( $link = phutil_tag(
'a', 'a',
array( array(
'href' => PhabricatorEnv::getURI('/D'.$diff->getRevisionID()), 'href' => PhabricatorEnv::getURI('/D'.$diff->getRevisionID()),
), ),
phutil_escape_html('D'.$diff->getRevisionID())); 'D'.$diff->getRevisionID());
$top_panel->appendChild( $top_panel->appendChild(
"<h1>".pht('This diff belongs to revision %s', $link)."</h1>"); "<h1>".pht('This diff belongs to revision %s', $link)."</h1>");
} else { } else {
@ -38,11 +38,11 @@ final class DifferentialDiffViewController extends DifferentialController {
// TODO: implmenent optgroup support in AphrontFormSelectControl? // TODO: implmenent optgroup support in AphrontFormSelectControl?
$select = array(); $select = array();
$select[] = '<optgroup label="Create New Revision">'; $select[] = hsprintf('<optgroup label="%s">', pht('Create New Revision'));
$select[] = '<option value="">'. $select[] = hsprintf(
pht('Create a new Revision...'). '<option value="">%s</option>',
'</option>'; pht('Create a new Revision...'));
$select[] = '</optgroup>'; $select[] = hsprintf('</optgroup>');
$revision_data = new DifferentialRevisionListData( $revision_data = new DifferentialRevisionListData(
DifferentialRevisionListData::QUERY_OPEN_OWNED, DifferentialRevisionListData::QUERY_OPEN_OWNED,
@ -50,22 +50,24 @@ final class DifferentialDiffViewController extends DifferentialController {
$revisions = $revision_data->loadRevisions(); $revisions = $revision_data->loadRevisions();
if ($revisions) { if ($revisions) {
$select[] = '<optgroup label="'.pht('Update Existing Revision').'">'; $select[] = hsprintf(
'<optgroup label="%s">',
pht('Update Existing Revision'));
foreach ($revisions as $revision) { foreach ($revisions as $revision) {
$select[] = phutil_render_tag( $select[] = phutil_tag(
'option', 'option',
array( array(
'value' => $revision->getID(), 'value' => $revision->getID(),
), ),
phutil_escape_html($revision->getTitle())); $revision->getTitle());
} }
$select[] = '</optgroup>'; $select[] = hsprintf('</optgroup>');
} }
$select = $select = phutil_tag(
'<select name="revisionID">'. 'select',
implode("\n", $select). array('name' => 'revisionID'),
'</select>'; $select);
$action_form = new AphrontFormView(); $action_form = new AphrontFormView();
$action_form $action_form
@ -113,9 +115,10 @@ final class DifferentialDiffViewController extends DifferentialController {
} }
} }
$action_panel = new AphrontHeadsupView(); $property_view = new PhabricatorPropertyListView();
$action_panel->setProperties($dict); foreach ($dict as $key => $value) {
$action_panel->setHeader(pht('Diff Properties')); $property_view->addProperty($key, $value);
}
$changesets = $diff->loadChangesets(); $changesets = $diff->loadChangesets();
$changesets = msort($changesets, 'getSortKey'); $changesets = msort($changesets, 'getSortKey');
@ -144,7 +147,7 @@ final class DifferentialDiffViewController extends DifferentialController {
->appendChild( ->appendChild(
array( array(
$top_panel->render(), $top_panel->render(),
$action_panel->render(), $property_view,
$table_of_contents->render(), $table_of_contents->render(),
$details->render(), $details->render(),
)), )),

View file

@ -153,7 +153,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
$reviewer_warning->setTitle(pht('No Active Reviewers')); $reviewer_warning->setTitle(pht('No Active Reviewers'));
if ($revision->getReviewers()) { if ($revision->getReviewers()) {
$reviewer_warning->appendChild( $reviewer_warning->appendChild(
phutil_render_tag( phutil_tag(
'p', 'p',
array(), array(),
pht('All specified reviewers are disabled and this revision '. pht('All specified reviewers are disabled and this revision '.
@ -161,7 +161,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
)); ));
} else { } else {
$reviewer_warning->appendChild( $reviewer_warning->appendChild(
phutil_render_tag( phutil_tag(
'p', 'p',
array(), array(),
pht('This revision has no specified reviewers and needs '. pht('This revision has no specified reviewers and needs '.
@ -180,21 +180,20 @@ final class DifferentialRevisionViewController extends DifferentialController {
$warning = new AphrontErrorView(); $warning = new AphrontErrorView();
$warning->setTitle('Very Large Diff'); $warning->setTitle('Very Large Diff');
$warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING);
$warning->appendChild( $warning->appendChild(hsprintf(
'%s <strong>%s</strong>',
pht( pht(
'This diff is very large and affects %s files. Load each file '. 'This diff is very large and affects %s files. Load each file '.
'individually.', 'individually.',
new PhutilNumber($count)). new PhutilNumber($count)),
" <strong>". phutil_tag(
phutil_render_tag( 'a',
'a', array(
array( 'href' => $request_uri
'href' => $request_uri ->alter('large', 'true')
->alter('large', 'true') ->setFragment('toc'),
->setFragment('toc'), ),
), pht('Show All Files Inline'))));
pht('Show All Files Inline')).
"</strong>");
$warning = $warning->render(); $warning = $warning->render();
$my_inlines = id(new DifferentialInlineComment())->loadAllWhere( $my_inlines = id(new DifferentialInlineComment())->loadAllWhere(

View file

@ -13,7 +13,7 @@ final class DifferentialApplyPatchFieldSpecification
public function renderValueForRevisionView() { public function renderValueForRevisionView() {
$revision = $this->getRevision(); $revision = $this->getRevision();
return '<tt>arc patch D'.$revision->getID().'</tt>'; return phutil_tag('tt', array(), 'arc patch D'.$revision->getID());
} }
} }

View file

@ -27,7 +27,7 @@ final class DifferentialArcanistProjectFieldSpecification
} }
$handle = $this->getHandle($arcanist_phid); $handle = $this->getHandle($arcanist_phid);
return phutil_escape_html($handle->getName()); return $handle->getName();
} }
private function getArcanistProjectPHID() { private function getArcanistProjectPHID() {

View file

@ -49,7 +49,7 @@ final class DifferentialBlameRevisionFieldSpecification
return null; return null;
} }
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
return $engine->markupText($this->value); return phutil_safe_html($engine->markupText($this->value));
} }
public function shouldAppearOnConduitView() { public function shouldAppearOnConduitView() {

View file

@ -26,7 +26,7 @@ final class DifferentialBranchFieldSpecification
return null; return null;
} }
return phutil_escape_html($branch); return $branch;
} }
public function renderValueForMail($phase) { public function renderValueForMail($phase) {

View file

@ -26,7 +26,7 @@ final class DifferentialCommitsFieldSpecification
$links[] = $this->getHandle($commit_phid)->renderLink(); $links[] = $this->getHandle($commit_phid)->renderLink();
} }
return implode('<br />', $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getCommitPHIDs() { private function getCommitPHIDs() {

View file

@ -26,7 +26,7 @@ final class DifferentialDependenciesFieldSpecification
$links[] = $this->getHandle($revision_phids)->renderLink(); $links[] = $this->getHandle($revision_phids)->renderLink();
} }
return implode('<br />', $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getDependentRevisionPHIDs() { private function getDependentRevisionPHIDs() {

View file

@ -26,7 +26,7 @@ final class DifferentialDependsOnFieldSpecification
$links[] = $this->getHandle($revision_phids)->renderLink(); $links[] = $this->getHandle($revision_phids)->renderLink();
} }
return implode('<br />', $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getDependentRevisionPHIDs() { private function getDependentRevisionPHIDs() {

View file

@ -13,7 +13,10 @@ final class DifferentialExportPatchFieldSpecification
public function renderValueForRevisionView() { public function renderValueForRevisionView() {
$revision = $this->getRevision(); $revision = $this->getRevision();
return '<tt>arc export --revision '.$revision->getID().'</tt>'; return phutil_tag(
'tt',
array(),
'arc export --revision '.$revision->getID());
} }
} }

View file

@ -274,7 +274,7 @@ abstract class DifferentialFieldSpecification {
*/ */
public function renderUserList(array $user_phids) { public function renderUserList(array $user_phids) {
if (!$user_phids) { if (!$user_phids) {
return '<em>None</em>'; return phutil_tag('em', array(), pht('None'));
} }
$links = array(); $links = array();
@ -283,7 +283,7 @@ abstract class DifferentialFieldSpecification {
$links[] = $handle->renderLink(); $links[] = $handle->renderLink();
} }
return implode(', ', $links); return array_interleave(', ', $links);
} }

View file

@ -17,7 +17,7 @@ final class DifferentialHostFieldSpecification
if (!$host) { if (!$host) {
return null; return null;
} }
return phutil_escape_html($host); return $host;
} }
} }

View file

@ -13,7 +13,7 @@ final class DifferentialLinesFieldSpecification
public function renderValueForRevisionView() { public function renderValueForRevisionView() {
$diff = $this->getDiff(); $diff = $this->getDiff();
return phutil_escape_html(number_format($diff->getLineCount())); return number_format($diff->getLineCount());
} }
public function shouldAppearOnRevisionList() { public function shouldAppearOnRevisionList() {

View file

@ -53,7 +53,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'excuse', 'style' => 'excuse',
'name' => 'Excuse', 'name' => 'Excuse',
'value' => nl2br(phutil_escape_html($excuse)), 'value' => phutil_escape_html_newlines($excuse),
'show' => true, 'show' => true,
); );
} }
@ -67,7 +67,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'section', 'style' => 'section',
'name' => phutil_escape_html($path), 'name' => $path,
'show' => $show_limit, 'show' => $show_limit,
); );
@ -87,7 +87,7 @@ final class DifferentialLintFieldSpecification
if ($diff->getID() != $this->getDiff()->getID()) { if ($diff->getID() != $this->getDiff()->getID()) {
$href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href; $href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href;
} }
$line_link = phutil_render_tag( $line_link = phutil_tag(
'a', 'a',
array( array(
'href' => $href, 'href' => $href,
@ -108,11 +108,12 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => $this->getSeverityStyle($severity), 'style' => $this->getSeverityStyle($severity),
'name' => phutil_escape_html(ucwords($severity)), 'name' => ucwords($severity),
'value' => hsprintf( 'value' => hsprintf(
"(%s) %s at {$line_link}", '(%s) %s at %s',
$code, $code,
$name), $name,
$line_link),
'show' => $show, 'show' => $show,
); );
@ -130,7 +131,7 @@ final class DifferentialLintFieldSpecification
if (strlen($description)) { if (strlen($description)) {
$rows[] = array( $rows[] = array(
'style' => 'details', 'style' => 'details',
'value' => nl2br(phutil_escape_html($description)), 'value' => phutil_escape_html_newlines($description),
'show' => false, 'show' => false,
); );
if (empty($hidden['details'])) { if (empty($hidden['details'])) {
@ -148,7 +149,7 @@ final class DifferentialLintFieldSpecification
$rows[] = array( $rows[] = array(
'style' => $this->getPostponedStyle(), 'style' => $this->getPostponedStyle(),
'name' => 'Postponed', 'name' => 'Postponed',
'value' => phutil_escape_html($linter), 'value' => $linter,
'show' => false, 'show' => false,
); );
if (empty($hidden['postponed'])) { if (empty($hidden['postponed'])) {
@ -244,24 +245,24 @@ final class DifferentialLintFieldSpecification
if ($status == DifferentialLintStatus::LINT_SKIP) { if ($status == DifferentialLintStatus::LINT_SKIP) {
$content = $content =
"<p>This diff was created without running lint. Make sure you are ". "This diff was created without running lint. Make sure you are ".
"OK with that before you accept this diff.</p>"; "OK with that before you accept this diff.";
} else if ($status == DifferentialLintStatus::LINT_POSTPONED) { } else if ($status == DifferentialLintStatus::LINT_POSTPONED) {
$severity = AphrontErrorView::SEVERITY_WARNING; $severity = AphrontErrorView::SEVERITY_WARNING;
$content = $content =
"<p>Postponed linters didn't finish yet. Make sure you are OK with ". "Postponed linters didn't finish yet. Make sure you are OK with ".
"that before you accept this diff.</p>"; "that before you accept this diff.";
} else { } else {
$content = $content =
"<p>This diff has Lint Problems. Make sure you are OK with them ". "This diff has Lint Problems. Make sure you are OK with them ".
"before you accept this diff.</p>"; "before you accept this diff.";
} }
return id(new AphrontErrorView()) return id(new AphrontErrorView())
->setSeverity($severity) ->setSeverity($severity)
->appendChild($content) ->appendChild(phutil_tag('p', array(), $content))
->setTitle(idx($titles, $status, 'Warning')); ->setTitle(idx($titles, $status, 'Warning'));
} }

View file

@ -29,7 +29,7 @@ final class DifferentialManiphestTasksFieldSpecification
$links[] = $this->getHandle($task_phid)->renderLink(); $links[] = $this->getHandle($task_phid)->renderLink();
} }
return implode('<br />', $links); return array_interleave(phutil_tag('br'), $links);
} }
private function getManiphestTaskPHIDs() { private function getManiphestTaskPHIDs() {

View file

@ -19,7 +19,7 @@ final class DifferentialPathFieldSpecification
return null; return null;
} }
return phutil_escape_html($path); return $path;
} }
} }

View file

@ -47,7 +47,7 @@ final class DifferentialRevertPlanFieldSpecification
if (!$this->value) { if (!$this->value) {
return null; return null;
} }
return phutil_escape_html($this->value); return $this->value;
} }
public function shouldAppearOnConduitView() { public function shouldAppearOnConduitView() {

View file

@ -146,7 +146,7 @@ final class DifferentialReviewersFieldSpecification
$names[] = phutil_escape_html( $names[] = phutil_escape_html(
$this->getHandle($reviewer)->getLinkName()); $this->getHandle($reviewer)->getLinkName());
} }
$suffix = ' '.javelin_render_tag( $suffix = ' '.javelin_tag(
'abbr', 'abbr',
array( array(
'sigil' => 'has-tooltip', 'sigil' => 'has-tooltip',

View file

@ -87,12 +87,12 @@ final class DifferentialTitleFieldSpecification
} }
public function renderValueForRevisionList(DifferentialRevision $revision) { public function renderValueForRevisionList(DifferentialRevision $revision) {
return phutil_render_tag( return phutil_tag(
'a', 'a',
array( array(
'href' => '/D'.$revision->getID(), 'href' => '/D'.$revision->getID(),
), ),
phutil_escape_html($revision->getTitle())); $revision->getTitle());
} }
} }

View file

@ -47,7 +47,7 @@ final class DifferentialUnitFieldSpecification
$rows[] = array( $rows[] = array(
'style' => 'excuse', 'style' => 'excuse',
'name' => 'Excuse', 'name' => 'Excuse',
'value' => nl2br(phutil_escape_html($excuse)), 'value' => phutil_escape_html_newlines($excuse),
'show' => true, 'show' => true,
); );
} }
@ -93,9 +93,9 @@ final class DifferentialUnitFieldSpecification
$hidden[$result]++; $hidden[$result]++;
} }
$value = phutil_escape_html(idx($test, 'name')); $value = idx($test, 'name');
if (!empty($test['link'])) { if (!empty($test['link'])) {
$value = phutil_render_tag( $value = phutil_tag(
'a', 'a',
array( array(
'href' => $test['link'], 'href' => $test['link'],
@ -105,7 +105,7 @@ final class DifferentialUnitFieldSpecification
} }
$rows[] = array( $rows[] = array(
'style' => $this->getResultStyle($result), 'style' => $this->getResultStyle($result),
'name' => phutil_escape_html(ucwords($result)), 'name' => ucwords($result),
'value' => $value, 'value' => $value,
'show' => $show, 'show' => $show,
); );
@ -113,7 +113,7 @@ final class DifferentialUnitFieldSpecification
$userdata = idx($test, 'userdata'); $userdata = idx($test, 'userdata');
if ($userdata) { if ($userdata) {
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$userdata = $engine->markupText($userdata); $userdata = phutil_safe_html($engine->markupText($userdata));
$rows[] = array( $rows[] = array(
'style' => 'details', 'style' => 'details',
'value' => $userdata, 'value' => $userdata,
@ -200,21 +200,21 @@ final class DifferentialUnitFieldSpecification
); );
if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) { if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
$content = $content =
"<p>This diff has postponed unit tests. The results should be ". "This diff has postponed unit tests. The results should be ".
"coming in soon. You should probably wait for them before accepting ". "coming in soon. You should probably wait for them before accepting ".
"this diff.</p>"; "this diff.";
} else if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_SKIP) { } else if ($diff->getUnitStatus() == DifferentialUnitStatus::UNIT_SKIP) {
$content = $content =
"<p>Unit tests were skipped when this diff was created. Make sure ". "Unit tests were skipped when this diff was created. Make sure ".
"you are OK with that before you accept this diff.</p>"; "you are OK with that before you accept this diff.";
} else { } else {
$content = $content =
"<p>This diff has Unit Test Problems. Make sure you are OK with ". "This diff has Unit Test Problems. Make sure you are OK with ".
"them before you accept this diff.</p>"; "them before you accept this diff.";
} }
$unit_warning = id(new AphrontErrorView()) $unit_warning = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_ERROR) ->setSeverity(AphrontErrorView::SEVERITY_ERROR)
->appendChild($content) ->appendChild(phutil_tag('p', array(), $content))
->setTitle(idx($titles, $diff->getUnitStatus(), 'Warning')); ->setTitle(idx($titles, $diff->getUnitStatus(), 'Warning'));
} }
return $unit_warning; return $unit_warning;

View file

@ -70,10 +70,7 @@ abstract class DifferentialChangesetHTMLRenderer
break; break;
case DifferentialChangeType::TYPE_MOVE_HERE: case DifferentialChangeType::TYPE_MOVE_HERE:
$from = $from = phutil_tag('strong', array(), $changeset->getOldFile());
"<strong>".
phutil_escape_html($changeset->getOldFile()).
"</strong>";
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht('This file was moved from %s.', $from); $message = pht('This file was moved from %s.', $from);
@ -97,10 +94,7 @@ abstract class DifferentialChangesetHTMLRenderer
break; break;
case DifferentialChangeType::TYPE_COPY_HERE: case DifferentialChangeType::TYPE_COPY_HERE:
$from = $from = phutil_tag('strong', array(), $changeset->getOldFile());
"<strong>".
phutil_escape_html($changeset->getOldFile()).
"</strong>";
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht('This file was copied from %s.', $from); $message = pht('This file was copied from %s.', $from);
@ -124,10 +118,10 @@ abstract class DifferentialChangesetHTMLRenderer
break; break;
case DifferentialChangeType::TYPE_MOVE_AWAY: case DifferentialChangeType::TYPE_MOVE_AWAY:
$paths = $paths = phutil_tag(
"<strong>". 'strong',
phutil_escape_html(implode(', ', $changeset->getAwayPaths())). array(),
"</strong>"; implode(', ', $changeset->getAwayPaths()));
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht('This file was moved to %s.', $paths); $message = pht('This file was moved to %s.', $paths);
@ -151,10 +145,10 @@ abstract class DifferentialChangesetHTMLRenderer
break; break;
case DifferentialChangeType::TYPE_COPY_AWAY: case DifferentialChangeType::TYPE_COPY_AWAY:
$paths = $paths = phutil_tag(
"<strong>". 'strong',
phutil_escape_html(implode(', ', $changeset->getAwayPaths())). array(),
"</strong>"; implode(', ', $changeset->getAwayPaths()));
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht('This file was copied to %s.', $paths); $message = pht('This file was copied to %s.', $paths);
@ -178,10 +172,10 @@ abstract class DifferentialChangesetHTMLRenderer
break; break;
case DifferentialChangeType::TYPE_MULTICOPY: case DifferentialChangeType::TYPE_MULTICOPY:
$paths = $paths = phutil_tag(
"<strong>". 'strong',
phutil_escape_html(implode(', ', $changeset->getAwayPaths())). array(),
"</strong>"; implode(', ', $changeset->getAwayPaths()));
switch ($file) { switch ($file) {
case DifferentialChangeType::FILE_TEXT: case DifferentialChangeType::FILE_TEXT:
$message = pht( $message = pht(
@ -262,23 +256,26 @@ abstract class DifferentialChangesetHTMLRenderer
$nval = idx($new, $key); $nval = idx($new, $key);
if ($oval !== $nval) { if ($oval !== $nval) {
if ($oval === null) { if ($oval === null) {
$oval = '<em>null</em>'; $oval = phutil_tag('em', array(), 'null');
} else { } else {
$oval = nl2br(phutil_escape_html($oval)); $oval = phutil_escape_html_newlines($oval);
} }
if ($nval === null) { if ($nval === null) {
$nval = '<em>null</em>'; $nval = phutil_tag('em', array(), 'null');
} else { } else {
$nval = nl2br(phutil_escape_html($nval)); $nval = phutil_escape_html_newlines($nval);
} }
$rows[] = $rows[] = hsprintf(
'<tr>'. '<tr>'.
'<th>'.phutil_escape_html($key).'</th>'. '<th>%s</th>'.
'<td class="oval">'.$oval.'</td>'. '<td class="oval">%s</td>'.
'<td class="nval">'.$nval.'</td>'. '<td class="nval">%s</td>'.
'</tr>'; '</tr>',
$key,
$oval,
$nval);
} }
} }
@ -319,9 +316,11 @@ abstract class DifferentialChangesetHTMLRenderer
$meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL; $meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL;
} }
$more = null; $content = array();
$content[] = $message;
if ($force !== 'none') { if ($force !== 'none') {
$more = ' '.javelin_render_tag( $content[] = ' ';
$content[] = javelin_tag(
'a', 'a',
array( array(
'mustcapture' => true, 'mustcapture' => true,
@ -334,15 +333,18 @@ abstract class DifferentialChangesetHTMLRenderer
} }
return $this->wrapChangeInTable( return $this->wrapChangeInTable(
javelin_render_tag( javelin_tag(
'tr', 'tr',
array( array(
'sigil' => 'context-target', 'sigil' => 'context-target',
), ),
'<td class="differential-shield" colspan="6">'. phutil_tag(
phutil_escape_html($message). 'td',
$more. array(
'</td>')); 'class' => 'differential-shield',
'colspan' => 6,
),
$content)));
} }
protected function wrapChangeInTable($content) { protected function wrapChangeInTable($content) {
@ -350,7 +352,10 @@ abstract class DifferentialChangesetHTMLRenderer
return null; return null;
} }
return javelin_render_tag( // TODO: [HTML] After TwoUpRenderer gets refactored, fix this.
$content = phutil_safe_html($content);
return javelin_tag(
'table', 'table',
array( array(
'class' => 'differential-diff remarkup-code PhabricatorMonospaced', 'class' => 'differential-diff remarkup-code PhabricatorMonospaced',

View file

@ -16,12 +16,12 @@ final class DifferentialChangesetTwoUpRenderer
$context_not_available = null; $context_not_available = null;
if ($hunk_starts) { if ($hunk_starts) {
$context_not_available = javelin_render_tag( $context_not_available = javelin_tag(
'tr', 'tr',
array( array(
'sigil' => 'context-target', 'sigil' => 'context-target',
), ),
phutil_render_tag( phutil_tag(
'td', 'td',
array( array(
'colspan' => 6, 'colspan' => 6,
@ -83,7 +83,7 @@ final class DifferentialChangesetTwoUpRenderer
$is_first_block = true; $is_first_block = true;
} }
$contents[] = javelin_render_tag( $contents[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -99,7 +99,7 @@ final class DifferentialChangesetTwoUpRenderer
: pht("\xE2\x96\xB2 Show 20 Lines")); : pht("\xE2\x96\xB2 Show 20 Lines"));
} }
$contents[] = javelin_render_tag( $contents[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -119,7 +119,7 @@ final class DifferentialChangesetTwoUpRenderer
} }
if ($len > 40) { if ($len > 40) {
$contents[] = javelin_render_tag( $contents[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -148,16 +148,36 @@ final class DifferentialChangesetTwoUpRenderer
} }
} }
$container = javelin_render_tag( $container = javelin_tag(
'tr', 'tr',
array( array(
'sigil' => 'context-target', 'sigil' => 'context-target',
), ),
'<td colspan="2" class="show-more">'. array(
implode(' &bull; ', $contents). phutil_tag(
'</td>'. 'td',
'<th class="show-context-line">'.$context_line.'</td>'. array(
'<td colspan="3" class="show-context">'.$context.'</td>'); 'colspan' => 2,
'class' => 'show-more',
),
array_interleave(
" \xE2\x80\xA2 ", // Bullet
$contents)),
phutil_tag(
'th',
array(
'class' => 'show-context-line',
),
$context_line ? (int)$context_line : null),
phutil_tag(
'td',
array(
'colspan' => 3,
'class' => 'show-context',
),
// TODO: [HTML] Escaping model here isn't ideal.
phutil_safe_html($context)),
));
$html[] = $container; $html[] = $container;
@ -235,7 +255,7 @@ final class DifferentialChangesetTwoUpRenderer
dirname('/'.$orig_file); dirname('/'.$orig_file);
} }
$class = ($orig_type == '-' ? 'new-move' : 'new-copy'); $class = ($orig_type == '-' ? 'new-move' : 'new-copy');
$n_copy = javelin_render_tag( $n_copy = javelin_tag(
'td', 'td',
array( array(
'meta' => array( 'meta' => array(
@ -304,26 +324,29 @@ final class DifferentialChangesetTwoUpRenderer
} }
} }
} }
$html[] = $html[] = hsprintf(
'<tr class="inline">'. '<tr class="inline">'.
'<th />'. '<th />'.
'<td class="left">'.$comment_html.'</td>'. '<td class="left">%s</td>'.
'<th />'. '<th />'.
'<td colspan="3" class="right3">'.$new.'</td>'. '<td colspan="3" class="right3">%s</td>'.
'</tr>'; '</tr>',
$comment_html,
$new);
} }
} }
if ($n_num && isset($new_comments[$n_num])) { if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $comment) { foreach ($new_comments[$n_num] as $comment) {
$comment_html = $this->renderInlineComment($comment, $comment_html = $this->renderInlineComment($comment,
$on_right = true); $on_right = true);
$html[] = $html[] = hsprintf(
'<tr class="inline">'. '<tr class="inline">'.
'<th />'. '<th />'.
'<td class="left" />'. '<td class="left" />'.
'<th />'. '<th />'.
'<td colspan="3" class="right3">'.$comment_html.'</td>'. '<td colspan="3" class="right3">%s</td>'.
'</tr>'; '</tr>',
$comment_html);
} }
} }
} }
@ -337,12 +360,12 @@ final class DifferentialChangesetTwoUpRenderer
$vs = 0) { $vs = 0) {
$old = null; $old = null;
if ($old_file) { if ($old_file) {
$old = phutil_render_tag( $old = phutil_tag(
'div', 'div',
array( array(
'class' => 'differential-image-stage' 'class' => 'differential-image-stage'
), ),
phutil_render_tag( phutil_tag(
'img', 'img',
array( array(
'src' => $old_file->getBestURI(), 'src' => $old_file->getBestURI(),
@ -353,12 +376,12 @@ final class DifferentialChangesetTwoUpRenderer
$new = null; $new = null;
if ($new_file) { if ($new_file) {
$new = phutil_render_tag( $new = phutil_tag(
'div', 'div',
array( array(
'class' => 'differential-image-stage' 'class' => 'differential-image-stage'
), ),
phutil_render_tag( phutil_tag(
'img', 'img',
array( array(
'src' => $new_file->getBestURI(), 'src' => $new_file->getBestURI(),

View file

@ -46,21 +46,6 @@ final class DifferentialAddCommentView extends AphrontView {
return $this; return $this;
} }
private function generateWarningView(
$status,
array $titles,
$id,
$content) {
$warning = new AphrontErrorView();
$warning->setSeverity(AphrontErrorView::SEVERITY_ERROR);
$warning->setID($id);
$warning->appendChild($content);
$warning->setTitle(idx($titles, $status, 'Warning'));
return $warning;
}
public function render() { public function render() {
require_celerity_resource('differential-revision-add-comment-css'); require_celerity_resource('differential-revision-add-comment-css');

View file

@ -59,10 +59,12 @@ final class DifferentialChangesetDetailView extends AphrontView {
$buttons = null; $buttons = null;
if ($this->buttons) { if ($this->buttons) {
$buttons = $buttons = phutil_tag(
'<div class="differential-changeset-buttons">'. 'div',
implode('', $this->buttons). array(
'</div>'; 'class' => 'differential-changeset-buttons',
),
$this->buttons);
} }
$id = $this->getID(); $id = $this->getID();
@ -77,7 +79,7 @@ final class DifferentialChangesetDetailView extends AphrontView {
$display_filename = $changeset->getDisplayFilename(); $display_filename = $changeset->getDisplayFilename();
$output = javelin_render_tag( return javelin_tag(
'div', 'div',
array( array(
'sigil' => 'differential-changeset', 'sigil' => 'differential-changeset',
@ -90,17 +92,17 @@ final class DifferentialChangesetDetailView extends AphrontView {
'class' => $class, 'class' => $class,
'id' => $id, 'id' => $id,
), ),
id(new PhabricatorAnchorView()) $this->renderHTMLView(
->setAnchorName($changeset->getAnchorName()) array(
->setNavigationMarker(true) id(new PhabricatorAnchorView())
->render(). ->setAnchorName($changeset->getAnchorName())
$buttons. ->setNavigationMarker(true)
'<h1>'.phutil_escape_html($display_filename).'</h1>'. ->render(),
'<div style="clear: both;"></div>'. $buttons,
$this->renderChildren()); phutil_tag('h1', array(), $display_filename),
phutil_tag('div', array('style' => 'clear: both'), ''),
$this->renderHTMLChildren(),
return $output; )));
} }
} }

View file

@ -97,21 +97,21 @@ final class DifferentialChangesetFileTreeSideNavBuilder {
$icon = 'phabricator-filetree-icon-dir'; $icon = 'phabricator-filetree-icon-dir';
} }
$icon = phutil_render_tag( $icon = phutil_tag(
'span', 'span',
array( array(
'class' => 'phabricator-filetree-icon '.$icon, 'class' => 'phabricator-filetree-icon '.$icon,
), ),
''); '');
$name_element = phutil_render_tag( $name_element = phutil_tag(
'span', 'span',
array( array(
'class' => 'phabricator-filetree-name', 'class' => 'phabricator-filetree-name',
), ),
phutil_escape_html($name)); $name);
$filetree[] = javelin_render_tag( $filetree[] = javelin_tag(
$href ? 'a' : 'span', $href ? 'a' : 'span',
array( array(
'href' => $href, 'href' => $href,
@ -119,16 +119,19 @@ final class DifferentialChangesetFileTreeSideNavBuilder {
'title' => $title, 'title' => $title,
'class' => 'phabricator-filetree-item', 'class' => 'phabricator-filetree-item',
), ),
$icon.$name_element); array($icon, $name_element));
} }
$tree->destroy(); $tree->destroy();
$filetree = phutil_tag(
'div',
array(
'class' => 'phabricator-filetree',
),
$filetree);
Javelin::initBehavior('phabricator-file-tree', array()); Javelin::initBehavior('phabricator-file-tree', array());
$filetree =
'<div class="phabricator-filetree">'.
implode("\n", $filetree).
'</div>';
$nav->addLabel(pht('Changed Files')); $nav->addLabel(pht('Changed Files'));
$nav->addCustomBlock($filetree); $nav->addCustomBlock($filetree);
$nav->setActive(true); $nav->setActive(true);

View file

@ -138,7 +138,7 @@ final class DifferentialChangesetListView extends AphrontView {
$load = 'Loading...'; $load = 'Loading...';
$mapping[$uniq_id] = $ref; $mapping[$uniq_id] = $ref;
} else { } else {
$load = javelin_render_tag( $load = javelin_tag(
'a', 'a',
array( array(
'href' => '#'.$uniq_id, 'href' => '#'.$uniq_id,
@ -150,15 +150,15 @@ final class DifferentialChangesetListView extends AphrontView {
'sigil' => 'differential-load', 'sigil' => 'differential-load',
'mustcapture' => true, 'mustcapture' => true,
), ),
'Load'); pht('Load'));
} }
$detail->appendChild( $detail->appendChild(
phutil_render_tag( phutil_tag(
'div', 'div',
array( array(
'id' => $uniq_id, 'id' => $uniq_id,
), ),
'<div class="differential-loading">'.$load.'</div>')); phutil_tag('div', array('class' => 'differential-loading'), $load)));
$output[] = $detail->render(); $output[] = $detail->render();
} }
@ -187,37 +187,39 @@ final class DifferentialChangesetListView extends AphrontView {
)); ));
} }
return return $this->renderHTMLView(
id(new PhabricatorHeaderView())
->setHeader($this->getTitle())
->render().
phutil_render_tag(
'div',
array( array(
'class' => 'differential-review-stage', id(new PhabricatorHeaderView())
'id' => 'differential-review-stage', ->setHeader($this->getTitle())
), ->render(),
implode("\n", $output)); phutil_tag(
'div',
array(
'class' => 'differential-review-stage',
'id' => 'differential-review-stage',
),
$output),
));
} }
/** /**
* Render the "Undo" markup for the inline comment undo feature. * Render the "Undo" markup for the inline comment undo feature.
*/ */
private function renderUndoTemplates() { private function renderUndoTemplates() {
$link = javelin_render_tag( $link = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
'sigil' => 'differential-inline-comment-undo', 'sigil' => 'differential-inline-comment-undo',
), ),
'Undo'); pht('Undo'));
$div = phutil_render_tag( $div = phutil_tag(
'div', 'div',
array( array(
'class' => 'differential-inline-undo', 'class' => 'differential-inline-undo',
), ),
'Changes discarded. '.$link); array('Changes discarded. ', $link));
$template = $template =
'<table><tr>'. '<table><tr>'.
@ -302,7 +304,7 @@ final class DifferentialChangesetListView extends AphrontView {
'differential-dropdown-menus', 'differential-dropdown-menus',
array()); array());
return javelin_render_tag( return javelin_tag(
'a', 'a',
array( array(
'class' => 'button small grey', 'class' => 'button small grey',
@ -311,7 +313,7 @@ final class DifferentialChangesetListView extends AphrontView {
'target' => '_blank', 'target' => '_blank',
'sigil' => 'differential-view-options', 'sigil' => 'differential-view-options',
), ),
"View Options \xE2\x96\xBC"); pht("View Options \xE2\x96\xBC"));
} }
} }

View file

@ -137,7 +137,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
if ($cov === null) { if ($cov === null) {
$mcov = $cov = '<em>-</em>'; $mcov = $cov = '<em>-</em>';
} else { } else {
$mcov = phutil_render_tag( $mcov = phutil_tag(
'div', 'div',
array( array(
'id' => 'differential-mcoverage-'.md5($fname), 'id' => 'differential-mcoverage-'.md5($fname),
@ -148,7 +148,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$rows[] = $rows[] =
'<tr>'. '<tr>'.
phutil_render_tag( phutil_tag(
'td', 'td',
array( array(
'class' => 'differential-toc-char', 'class' => 'differential-toc-char',
@ -182,7 +182,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$this->repository->getCallsign()); $this->repository->getCallsign());
if ($editor_link) { if ($editor_link) {
$editor_link = $editor_link =
phutil_render_tag( phutil_tag(
'a', 'a',
array( array(
'href' => $editor_link, 'href' => $editor_link,
@ -192,16 +192,14 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
} }
} }
$reveal_link = $reveal_link = javelin_tag(
javelin_render_tag(
'a', 'a',
array( array(
'sigil' => 'differential-reveal-all', 'sigil' => 'differential-reveal-all',
'mustcapture' => true, 'mustcapture' => true,
'class' => 'button differential-toc-reveal-all', 'class' => 'button differential-toc-reveal-all',
), ),
pht('Show All Context') pht('Show All Context'));
);
$buttons = $buttons =
'<tr><td colspan="7">'. '<tr><td colspan="7">'.
@ -256,7 +254,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
private function renderChangesetLink(DifferentialChangeset $changeset, $ref) { private function renderChangesetLink(DifferentialChangeset $changeset, $ref) {
$display_file = $changeset->getDisplayFilename(); $display_file = $changeset->getDisplayFilename();
return javelin_render_tag( return javelin_tag(
'a', 'a',
array( array(
'href' => '#'.$changeset->getAnchorName(), 'href' => '#'.$changeset->getAnchorName(),
@ -266,7 +264,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
), ),
'sigil' => 'differential-load', 'sigil' => 'differential-load',
), ),
phutil_escape_html($display_file)); $display_file);
} }
} }

View file

@ -48,54 +48,52 @@ final class DifferentialInlineCommentEditView extends AphrontView {
throw new Exception("Call setUser() before render()!"); throw new Exception("Call setUser() before render()!");
} }
$content = phabricator_render_form( $content = phabricator_form(
$this->user, $this->user,
array( array(
'action' => $this->uri, 'action' => $this->uri,
'method' => 'POST', 'method' => 'POST',
'sigil' => 'inline-edit-form', 'sigil' => 'inline-edit-form',
), ),
$this->renderInputs(). $this->renderHTMLView(
$this->renderBody()); array(
$this->renderInputs(),
$this->renderBody(),
)));
if ($this->onRight) { return hsprintf(
$core = '<table>'.
'<th></th>'. '<tr class="inline-comment-splint">'.
'<td class="left"></td>'. '<th></th>'.
'<th></th>'. '<td class="left">%s</td>'.
'<td colspan="3" class="right3">'.$content.'</td>'; '<th></th>'.
} else { '<td colspan="3" class="right3">%s</td>'.
$core = '</tr>'.
'<th></th>'. '</table>',
'<td class="left">'.$content.'</td>'. $this->onRight ? null : $content,
'<th></th>'. $this->onRight ? $content : null);
'<td colspan="3" class="right3"></td>';
}
return '<table><tr class="inline-comment-splint">'.$core.'</tr></table>';
} }
private function renderInputs() { private function renderInputs() {
$out = array(); $out = array();
foreach ($this->inputs as $input) { foreach ($this->inputs as $input) {
list($name, $value) = $input; list($name, $value) = $input;
$out[] = phutil_render_tag( $out[] = phutil_tag(
'input', 'input',
array( array(
'type' => 'hidden', 'type' => 'hidden',
'name' => $name, 'name' => $name,
'value' => $value, 'value' => $value,
), ));
null);
} }
return implode('', $out); return $out;
} }
private function renderBody() { private function renderBody() {
$buttons = array(); $buttons = array();
$buttons[] = '<button>Ready</button>'; $buttons[] = phutil_tag('button', array(), 'Ready');
$buttons[] = javelin_render_tag( $buttons[] = javelin_tag(
'button', 'button',
array( array(
'sigil' => 'inline-edit-cancel', 'sigil' => 'inline-edit-cancel',
@ -103,9 +101,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
), ),
pht('Cancel')); pht('Cancel'));
$buttons = implode('', $buttons); $formatting = phutil_tag(
$formatting = phutil_render_tag(
'a', 'a',
array( array(
'href' => PhabricatorEnv::getDoclink( 'href' => PhabricatorEnv::getDoclink(
@ -115,7 +111,33 @@ final class DifferentialInlineCommentEditView extends AphrontView {
), ),
pht('Formatting Reference')); pht('Formatting Reference'));
return javelin_render_tag( $title = phutil_tag(
'div',
array(
'class' => 'differential-inline-comment-edit-title',
),
$this->title);
$body = phutil_tag(
'div',
array(
'class' => 'differential-inline-comment-edit-body',
),
$this->renderHTMLChildren());
$edit = phutil_tag(
'edit',
array(
'class' => 'differential-inline-comment-edit-buttons',
),
$this->renderHTMLView(
array(
$formatting,
$buttons,
phutil_tag('div', array('style' => 'clear: both'), ''),
)));
return javelin_tag(
'div', 'div',
array( array(
'class' => 'differential-inline-comment-edit', 'class' => 'differential-inline-comment-edit',
@ -126,17 +148,12 @@ final class DifferentialInlineCommentEditView extends AphrontView {
'length' => $this->length, 'length' => $this->length,
), ),
), ),
'<div class="differential-inline-comment-edit-title">'. $this->renderHTMLView(
phutil_escape_html($this->title). array(
'</div>'. $title,
'<div class="differential-inline-comment-edit-body">'. $body,
$this->renderChildren(). $edit,
'</div>'. )));
'<div class="differential-inline-comment-edit-buttons">'.
$formatting.
$buttons.
'<div style="clear: both;"></div>'.
'</div>');
} }
} }

View file

@ -95,7 +95,7 @@ final class DifferentialInlineCommentView extends AphrontView {
} }
if (!$this->preview) { if (!$this->preview) {
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -104,7 +104,7 @@ final class DifferentialInlineCommentView extends AphrontView {
), ),
pht('Previous')); pht('Previous'));
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -122,7 +122,7 @@ final class DifferentialInlineCommentView extends AphrontView {
// file/line information, and synthetic comments don't have an inline // file/line information, and synthetic comments don't have an inline
// comment ID. // comment ID.
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -138,7 +138,7 @@ final class DifferentialInlineCommentView extends AphrontView {
$anchor_name = 'inline-'.$inline->getID(); $anchor_name = 'inline-'.$inline->getID();
if ($this->editable && !$this->preview) { if ($this->editable && !$this->preview) {
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -146,7 +146,7 @@ final class DifferentialInlineCommentView extends AphrontView {
'sigil' => 'differential-inline-edit', 'sigil' => 'differential-inline-edit',
), ),
pht('Edit')); pht('Edit'));
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -155,7 +155,7 @@ final class DifferentialInlineCommentView extends AphrontView {
), ),
pht('Delete')); pht('Delete'));
} else if ($this->preview) { } else if ($this->preview) {
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'meta' => array( 'meta' => array(
@ -164,7 +164,7 @@ final class DifferentialInlineCommentView extends AphrontView {
'sigil' => 'differential-inline-preview-jump', 'sigil' => 'differential-inline-preview-jump',
), ),
pht('Not Visible')); pht('Not Visible'));
$links[] = javelin_render_tag( $links[] = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -175,10 +175,10 @@ final class DifferentialInlineCommentView extends AphrontView {
} }
if ($links) { if ($links) {
$links = $links = phutil_tag(
'<span class="differential-inline-comment-links">'. 'span',
implode(' &middot; ', $links). array('class' => 'differential-inline-comment-links'),
'</span>'; array_interleave(" \xC2\xB7 ", $links));
} else { } else {
$links = null; $links = null;
} }
@ -190,7 +190,7 @@ final class DifferentialInlineCommentView extends AphrontView {
if ($this->preview) { if ($this->preview) {
$anchor = null; $anchor = null;
} else { } else {
$anchor = phutil_render_tag( $anchor = phutil_tag(
'a', 'a',
array( array(
'name' => $anchor_name, 'name' => $anchor_name,
@ -217,24 +217,25 @@ final class DifferentialInlineCommentView extends AphrontView {
$author = $handles[$inline->getAuthorPHID()]->getName(); $author = $handles[$inline->getAuthorPHID()]->getName();
} }
$markup = javelin_render_tag( $markup = javelin_tag(
'div', 'div',
array( array(
'class' => $classes, 'class' => $classes,
'sigil' => $sigil, 'sigil' => $sigil,
'meta' => $metadata, 'meta' => $metadata,
), ),
'<div class="differential-inline-comment-head">'. hsprintf(
$anchor. '<div class="differential-inline-comment-head">'.
$links. '%s%s <span class="differential-inline-comment-line">%s</span> %s'.
' <span class="differential-inline-comment-line">'.$line.'</span> '.
phutil_escape_html($author).
'</div>'.
'<div class="differential-inline-comment-content">'.
'<div class="phabricator-remarkup">'.
$content.
'</div>'. '</div>'.
'</div>'); '<div class="differential-inline-comment-content">'.
'<div class="phabricator-remarkup">%s</div>'.
'</div>',
$anchor,
$links,
$line,
$author,
$content));
return $this->scaffoldMarkup($markup); return $this->scaffoldMarkup($markup);
} }
@ -247,15 +248,17 @@ final class DifferentialInlineCommentView extends AphrontView {
$left_markup = !$this->onRight ? $markup : ''; $left_markup = !$this->onRight ? $markup : '';
$right_markup = $this->onRight ? $markup : ''; $right_markup = $this->onRight ? $markup : '';
return return hsprintf(
'<table>'. '<table>'.
'<tr class="inline">'. '<tr class="inline">'.
'<th></th>'. '<th></th>'.
'<td class="left">'.$left_markup.'</td>'. '<td class="left">%s</td>'.
'<th></th>'. '<th></th>'.
'<td class="right3" colspan="3">'.$right_markup.'</td>'. '<td class="right3" colspan="3">%s</td>'.
'</tr>'. '</tr>'.
'</table>'; '</table>',
$left_markup,
$right_markup);
} }
} }

View file

@ -54,17 +54,17 @@ final class DifferentialLocalCommitsView extends AphrontView {
} else { } else {
$commit_hash = null; $commit_hash = null;
} }
$row[] = '<td>'.phutil_escape_html($commit_hash).'</td>'; $row[] = phutil_tag('td', array(), $commit_hash);
if ($has_tree) { if ($has_tree) {
$tree = idx($commit, 'tree'); $tree = idx($commit, 'tree');
$tree = substr($tree, 0, 16); $tree = substr($tree, 0, 16);
$row[] = '<td>'.phutil_escape_html($tree).'</td>'; $row[] = phutil_tag('td', array(), $tree);
} }
if ($has_local) { if ($has_local) {
$local_rev = idx($commit, 'local', null); $local_rev = idx($commit, 'local', null);
$row[] = '<td>'.phutil_escape_html($local_rev).'</td>'; $row[] = phutil_tag('td', array(), $local_rev);
} }
$parents = idx($commit, 'parents', array()); $parents = idx($commit, 'parents', array());
@ -72,15 +72,15 @@ final class DifferentialLocalCommitsView extends AphrontView {
if (is_array($parent)) { if (is_array($parent)) {
$parent = idx($parent, 'rev'); $parent = idx($parent, 'rev');
} }
$parents[$k] = phutil_escape_html(substr($parent, 0, 16)); $parents[$k] = substr($parent, 0, 16);
} }
$parents = implode('<br />', $parents); $parents = array_interleave(phutil_tag('br'), $parents);
$row[] = '<td>'.$parents.'</td>'; $row[] = phutil_tag('td', array(), $parents);
$author = nonempty( $author = nonempty(
idx($commit, 'user'), idx($commit, 'user'),
idx($commit, 'author')); idx($commit, 'author'));
$row[] = '<td>'.phutil_escape_html($author).'</td>'; $row[] = phutil_tag('td', array(), $author);
$message = idx($commit, 'message'); $message = idx($commit, 'message');
@ -88,13 +88,13 @@ final class DifferentialLocalCommitsView extends AphrontView {
$summary = phutil_utf8_shorten($summary, 80); $summary = phutil_utf8_shorten($summary, 80);
$view = new AphrontMoreView(); $view = new AphrontMoreView();
$view->setSome(phutil_escape_html($summary)); $view->setSome($summary);
if ($message && (trim($summary) != trim($message))) { if ($message && (trim($summary) != trim($message))) {
$view->setMore(nl2br(phutil_escape_html($message))); $view->setMore(phutil_escape_html_newlines($message));
} }
$row[] = phutil_render_tag( $row[] = phutil_tag(
'td', 'td',
array( array(
'class' => 'summary', 'class' => 'summary',
@ -107,9 +107,9 @@ final class DifferentialLocalCommitsView extends AphrontView {
if ($date) { if ($date) {
$date = phabricator_datetime($date, $user); $date = phabricator_datetime($date, $user);
} }
$row[] = '<td>'.$date.'</td>'; $row[] = phutil_tag('td', array(), $date);
$rows[] = '<tr class="'.$class.'">'.implode('', $row).'</tr>'; $rows[] = phutil_tag('tr', array('class' => $class), $row);
} }

View file

@ -25,7 +25,7 @@ final class DifferentialResultsTableView extends AphrontView {
$style = idx($row, 'style'); $style = idx($row, 'style');
switch ($style) { switch ($style) {
case 'section': case 'section':
$cells = phutil_render_tag( $cells = phutil_tag(
'th', 'th',
array( array(
'colspan' => 2, 'colspan' => 2,
@ -33,23 +33,23 @@ final class DifferentialResultsTableView extends AphrontView {
idx($row, 'name')); idx($row, 'name'));
break; break;
default: default:
$name = phutil_render_tag( $name = phutil_tag(
'th', 'th',
array( array(
), ),
idx($row, 'name')); idx($row, 'name'));
$value = phutil_render_tag( $value = phutil_tag(
'td', 'td',
array( array(
), ),
idx($row, 'value')); idx($row, 'value'));
$cells = $name.$value; $cells = array($name, $value);
break; break;
} }
$show = idx($row, 'show'); $show = idx($row, 'show');
$rows[] = javelin_render_tag( $rows[] = javelin_tag(
'tr', 'tr',
array( array(
'style' => $show ? null : 'display: none', 'style' => $show ? null : 'display: none',
@ -64,7 +64,7 @@ final class DifferentialResultsTableView extends AphrontView {
} }
if ($any_hidden) { if ($any_hidden) {
$show_more = javelin_render_tag( $show_more = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -72,7 +72,7 @@ final class DifferentialResultsTableView extends AphrontView {
), ),
$this->showMoreString); $this->showMoreString);
$hide_more = javelin_render_tag( $hide_more = javelin_tag(
'a', 'a',
array( array(
'href' => '#', 'href' => '#',
@ -80,35 +80,35 @@ final class DifferentialResultsTableView extends AphrontView {
), ),
'Hide'); 'Hide');
$rows[] = javelin_render_tag( $rows[] = javelin_tag(
'tr', 'tr',
array( array(
'class' => 'differential-results-row-show', 'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-show', 'sigil' => 'differential-results-row-show',
), ),
'<th colspan="2">'.$show_more.'</td>'); phutil_tag('th', array('colspan' => 2), $show_more));
$rows[] = javelin_render_tag( $rows[] = javelin_tag(
'tr', 'tr',
array( array(
'class' => 'differential-results-row-show', 'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-hide', 'sigil' => 'differential-results-row-hide',
'style' => 'display: none', 'style' => 'display: none',
), ),
'<th colspan="2">'.$hide_more.'</th>'); phutil_tag('th', array('colspan' => 2), $hide_more));
Javelin::initBehavior('differential-show-field-details'); Javelin::initBehavior('differential-show-field-details');
} }
require_celerity_resource('differential-results-table-css'); require_celerity_resource('differential-results-table-css');
return javelin_render_tag( return javelin_tag(
'table', 'table',
array( array(
'class' => 'differential-results-table', 'class' => 'differential-results-table',
'sigil' => 'differential-results-table', 'sigil' => 'differential-results-table',
), ),
implode("\n", $rows)); $rows);
} }

View file

@ -159,22 +159,30 @@ final class DifferentialRevisionCommentListView extends AphrontView {
array( array(
'markup' => implode("\n", $hidden), 'markup' => implode("\n", $hidden),
)); ));
$hidden = javelin_render_tag( $hidden = javelin_tag(
'div', 'div',
array( array(
'sigil' => "differential-all-comments-container", 'sigil' => "differential-all-comments-container",
), ),
'<div class="differential-older-comments-are-hidden">'. phutil_tag(
pht('%d older comments are hidden. ', number_format(count($hidden))). 'div',
javelin_render_tag( array(
'a', 'class' => 'differential-older-comments-are-hidden',
array( ),
'href' => '#', array(
'mustcapture' => true, pht(
'sigil' => 'differential-show-all-comments', '%s older comments are hidden.',
), new PhutilNumber(count($hidden))),
pht('Show all comments.')). ' ',
'</div>'); javelin_tag(
'a',
array(
'href' => '#',
'mustcapture' => true,
'sigil' => 'differential-show-all-comments',
),
pht('Show all comments.')),
)));
} else { } else {
$hidden = null; $hidden = null;
} }

View file

@ -134,12 +134,12 @@ final class DifferentialRevisionCommentView extends AphrontView {
case DifferentialAction::ACTION_UPDATE: case DifferentialAction::ACTION_UPDATE:
$diff_id = idx($metadata, DifferentialComment::METADATA_DIFF_ID); $diff_id = idx($metadata, DifferentialComment::METADATA_DIFF_ID);
if ($diff_id) { if ($diff_id) {
$diff_link = phutil_render_tag( $diff_link = phutil_tag(
'a', 'a',
array( array(
'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id, 'href' => '/D'.$comment->getRevisionID().'?id='.$diff_id,
), ),
'Diff #'.phutil_escape_html($diff_id)); 'Diff #'.$diff_id);
$actions[] = "{$author_link} updated this revision to {$diff_link}."; $actions[] = "{$author_link} updated this revision to {$diff_link}.";
} else { } else {
$actions[] = "{$author_link} {$verb} this revision."; $actions[] = "{$author_link} {$verb} this revision.";

View file

@ -67,10 +67,10 @@ final class DifferentialRevisionDetailView extends AphrontView {
switch ($local_vcs) { switch ($local_vcs) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL: case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT: case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$next_step = '<tt>arc land</tt>'; $next_step = phutil_tag('tt', array(), 'arc land');
break; break;
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN: case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
$next_step = '<tt>arc commit</tt>'; $next_step = phutil_tag('tt', array(), 'arc commit');
break; break;
} }
} }
@ -80,7 +80,7 @@ final class DifferentialRevisionDetailView extends AphrontView {
foreach ($this->auxiliaryFields as $field) { foreach ($this->auxiliaryFields as $field) {
$value = $field->renderValueForRevisionView(); $value = $field->renderValueForRevisionView();
if (strlen($value)) { if ($value !== null) {
$label = rtrim($field->renderLabelForRevisionView(), ':'); $label = rtrim($field->renderLabelForRevisionView(), ':');
$properties->addProperty($label, $value); $properties->addProperty($label, $value);
} }

View file

@ -111,7 +111,7 @@ final class DifferentialRevisionListView extends AphrontView {
if (isset($flagged[$phid])) { if (isset($flagged[$phid])) {
$class = PhabricatorFlagColor::getCSSClass($flagged[$phid]->getColor()); $class = PhabricatorFlagColor::getCSSClass($flagged[$phid]->getColor());
$note = $flagged[$phid]->getNote(); $note = $flagged[$phid]->getNote();
$flag = javelin_render_tag( $flag = javelin_tag(
'div', 'div',
$note ? array( $note ? array(
'class' => 'phabricator-flag-icon '.$class, 'class' => 'phabricator-flag-icon '.$class,
@ -130,7 +130,7 @@ final class DifferentialRevisionListView extends AphrontView {
$src = '/rsrc/image/icon/fatcow/page_white_edit.png'; $src = '/rsrc/image/icon/fatcow/page_white_edit.png';
$flag = $flag =
'<a href="/D'.$revision->getID().'#comment-preview">'. '<a href="/D'.$revision->getID().'#comment-preview">'.
phutil_render_tag( phutil_tag(
'img', 'img',
array( array(
'src' => celerity_get_resource_uri($src), 'src' => celerity_get_resource_uri($src),

View file

@ -72,7 +72,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
if ($id) { if ($id) {
$new_checked = ($this->selectedDiffID == $id); $new_checked = ($this->selectedDiffID == $id);
$new = javelin_render_tag( $new = javelin_tag(
'input', 'input',
array( array(
'type' => 'radio', 'type' => 'radio',
@ -92,7 +92,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
if ($max_id != $id) { if ($max_id != $id) {
$uniq = celerity_generate_unique_node_id(); $uniq = celerity_generate_unique_node_id();
$old_checked = ($this->selectedVersusDiffID == $id); $old_checked = ($this->selectedVersusDiffID == $id);
$old = phutil_render_tag( $old = phutil_tag(
'input', 'input',
array( array(
'type' => 'radio', 'type' => 'radio',
@ -119,24 +119,22 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
} }
if (++$idx % 2) { if (++$idx % 2) {
$class = ' class="alt"'; $class = 'alt';
} else { } else {
$class = null; $class = null;
} }
$lint_attrs = array('class' => 'revhistory-star');
$unit_attrs = array('class' => 'revhistory-star');
if ($diff) { if ($diff) {
$lint = self::renderDiffLintStar($row['obj']); $lint = self::renderDiffLintStar($row['obj']);
$unit = self::renderDiffUnitStar($row['obj']); $unit = self::renderDiffUnitStar($row['obj']);
$lint_message = self::getDiffLintMessage($diff); $lint_attrs['title'] = self::getDiffLintMessage($diff);
$unit_message = self::getDiffUnitMessage($diff); $unit_attrs['title'] = self::getDiffUnitMessage($diff);
$lint_title = ' title="'.phutil_escape_html($lint_message).'"';
$unit_title = ' title="'.phutil_escape_html($unit_message).'"';
$base = $this->renderBaseRevision($diff); $base = $this->renderBaseRevision($diff);
} else { } else {
$lint = null; $lint = null;
$unit = null; $unit = null;
$lint_title = null;
$unit_title = null;
$base = null; $base = null;
} }
@ -145,22 +143,24 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
} }
$last_base = $base; $last_base = $base;
$id_link = phutil_render_tag( $id_link = phutil_tag(
'a', 'a',
array('href' => '/differential/diff/'.$id.'/'), array('href' => '/differential/diff/'.$id.'/'),
phutil_escape_html($id)); $id);
$rows[] = $rows[] = phutil_tag(
'<tr'.$class.'>'. 'tr',
'<td class="revhistory-name">'.phutil_escape_html($name).'</td>'. array('class' => $class),
'<td class="revhistory-id">'.$id_link.'</td>'. array(
'<td class="revhistory-base">'.phutil_escape_html($base).'</td>'. phutil_tag('td', array('class' => 'revhistory-name'), $name),
'<td class="revhistory-desc">'.phutil_escape_html($desc).'</td>'. phutil_tag('td', array('class' => 'revhistory-id'), $id_link),
'<td class="revhistory-age">'.$age.'</td>'. phutil_tag('td', array('class' => 'revhistory-base'), $base),
'<td class="revhistory-star"'.$lint_title.'>'.$lint.'</td>'. phutil_tag('td', array('class' => 'revhistory-desc'), $desc),
'<td class="revhistory-star"'.$unit_title.'>'.$unit.'</td>'. phutil_tag('td', array('class' => 'revhistory-age'), $age),
'<td class="revhistory-old'.$old_class.'">'.$old.'</td>'. phutil_tag('td', $lint_attrs, $lint),
'<td class="revhistory-new'.$new_class.'">'.$new.'</td>'. phutil_tag('td', $unit_attrs, $unit),
'</tr>'; phutil_tag('td', array('class' => 'revhistory-old'.$old_class), $old),
phutil_tag('td', array('class' => 'revhistory-new'.$new_class), $new),
));
} }
Javelin::initBehavior( Javelin::initBehavior(
@ -179,7 +179,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$select = '<select name="whitespace">'; $select = '<select name="whitespace">';
foreach ($options as $value => $label) { foreach ($options as $value => $label) {
$select .= phutil_render_tag( $select .= phutil_tag(
'option', 'option',
array( array(
'value' => $value, 'value' => $value,
@ -187,7 +187,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
? 'selected' ? 'selected'
: null, : null,
), ),
phutil_escape_html($label)); $label);
} }
$select .= '</select>'; $select .= '</select>';
@ -293,10 +293,10 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
private static function renderDiffStar($star) { private static function renderDiffStar($star) {
$class = 'diff-star-'.$star; $class = 'diff-star-'.$star;
return return phutil_tag(
'<span class="'.$class.'">'. 'span',
"\xE2\x98\x85". array('class' => $class),
'</span>'; "\xE2\x98\x85");
} }
private function renderBaseRevision(DifferentialDiff $diff) { private function renderBaseRevision(DifferentialDiff $diff) {

View file

@ -106,9 +106,9 @@ final class DiffusionBrowseController extends DiffusionController {
private function markupText($text) { private function markupText($text) {
$engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine(); $engine = PhabricatorMarkupEngine::newDiffusionMarkupEngine();
$text = $engine->markupText($text); $text = phutil_safe_html($engine->markupText($text));
$text = phutil_render_tag( $text = phutil_tag(
'div', 'div',
array( array(
'class' => 'phabricator-remarkup', 'class' => 'phabricator-remarkup',

View file

@ -96,9 +96,8 @@ final class DiffusionBrowseFileController extends DiffusionController {
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('File Renamed'); $notice->setTitle('File Renamed');
$notice->appendChild( $notice->appendChild(
"File history passes through a rename from '". "File history passes through a rename from '".$drequest->getPath().
phutil_escape_html($drequest->getPath())."' to '". "' to '".$renamed."'.");
phutil_escape_html($renamed)."'.");
$content[] = $notice; $content[] = $notice;
} }
@ -178,12 +177,12 @@ final class DiffusionBrowseFileController extends DiffusionController {
case 'plain': case 'plain':
$style = $style =
"margin: 1em 2em; width: 90%; height: 80em; font-family: monospace"; "margin: 1em 2em; width: 90%; height: 80em; font-family: monospace";
$corpus = phutil_render_tag( $corpus = phutil_tag(
'textarea', 'textarea',
array( array(
'style' => $style, 'style' => $style,
), ),
phutil_escape_html($file_query->getRawData())); $file_query->getRawData());
break; break;
@ -205,12 +204,12 @@ final class DiffusionBrowseFileController extends DiffusionController {
sprintf("%-10s %-20s %s", substr($rev, 0, 7), $author, $line); sprintf("%-10s %-20s %s", substr($rev, 0, 7), $author, $line);
} }
$corpus = phutil_render_tag( $corpus = phutil_tag(
'textarea', 'textarea',
array( array(
'style' => $style, 'style' => $style,
), ),
phutil_escape_html(implode("\n", $rows))); implode("\n", $rows));
break; break;
@ -261,14 +260,15 @@ final class DiffusionBrowseFileController extends DiffusionController {
)); ));
} }
$corpus_table = javelin_render_tag( $corpus_table = javelin_tag(
'table', 'table',
array( array(
'class' => "diffusion-source remarkup-code PhabricatorMonospaced", 'class' => "diffusion-source remarkup-code PhabricatorMonospaced",
'sigil' => 'diffusion-source', 'sigil' => 'diffusion-source',
), ),
implode("\n", $rows)); $rows);
$corpus = phutil_render_tag(
$corpus = phutil_tag(
'div', 'div',
array( array(
'style' => 'padding: 0 2em;', 'style' => 'padding: 0 2em;',
@ -490,11 +490,11 @@ final class DiffusionBrowseFileController extends DiffusionController {
if (isset($blame['handle'])) { if (isset($blame['handle'])) {
$author_link = $blame['handle']->renderLink(); $author_link = $blame['handle']->renderLink();
} else { } else {
$author_link = phutil_render_tag( $author_link = phutil_tag(
'span', 'span',
array( array(
), ),
phutil_escape_html($blame['author'])); $blame['author']);
} }
$display_line['author'] = $author_link; $display_line['author'] = $author_link;
@ -602,7 +602,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
Javelin::initBehavior('phabricator-tooltips', array()); Javelin::initBehavior('phabricator-tooltips', array());
require_celerity_resource('aphront-tooltip-css'); require_celerity_resource('aphront-tooltip-css');
$commit_link = javelin_render_tag( $commit_link = javelin_tag(
'a', 'a',
array( array(
'href' => $drequest->generateURI( 'href' => $drequest->generateURI(
@ -617,7 +617,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
'size' => 600, 'size' => 600,
), ),
), ),
phutil_escape_html(phutil_utf8_shorten($line['commit'], 9, ''))); phutil_utf8_shorten($line['commit'], 9, ''));
$revision_id = null; $revision_id = null;
if (idx($commits, $commit)) { if (idx($commits, $commit)) {
@ -634,7 +634,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
" \xC2\xB7 ". " \xC2\xB7 ".
$revision->getTitle(); $revision->getTitle();
} }
$revision_link = javelin_render_tag( $revision_link = javelin_tag(
'a', 'a',
array( array(
'href' => '/D'.$revision_id, 'href' => '/D'.$revision_id,
@ -649,7 +649,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
} }
$uri = $line_href->alter('before', $commit); $uri = $line_href->alter('before', $commit);
$before_link = javelin_render_tag( $before_link = javelin_tag(
'a', 'a',
array( array(
'href' => $uri->setQueryParam('view', 'blame'), 'href' => $uri->setQueryParam('view', 'blame'),
@ -663,7 +663,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
"\xC2\xAB"); "\xC2\xAB");
} }
$blame[] = phutil_render_tag( $blame[] = phutil_tag(
'th', 'th',
array( array(
'class' => 'diffusion-blame-link', 'class' => 'diffusion-blame-link',
@ -671,7 +671,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
), ),
$before_link); $before_link);
$blame[] = phutil_render_tag( $blame[] = phutil_tag(
'th', 'th',
array( array(
'class' => 'diffusion-rev-link', 'class' => 'diffusion-rev-link',
@ -679,7 +679,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
), ),
$commit_link); $commit_link);
$blame[] = phutil_render_tag( $blame[] = phutil_tag(
'th', 'th',
array( array(
'class' => 'diffusion-rev-link', 'class' => 'diffusion-rev-link',
@ -687,7 +687,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
), ),
$revision_link); $revision_link);
$blame[] = phutil_render_tag( $blame[] = phutil_tag(
'th', 'th',
array( array(
'class' => 'diffusion-author-link', 'class' => 'diffusion-author-link',
@ -696,14 +696,14 @@ final class DiffusionBrowseFileController extends DiffusionController {
idx($line, 'author')); idx($line, 'author'));
} }
$line_link = phutil_render_tag( $line_link = phutil_tag(
'a', 'a',
array( array(
'href' => $line_href, 'href' => $line_href,
), ),
phutil_escape_html($line['line'])); $line['line']);
$blame[] = javelin_render_tag( $blame[] = javelin_tag(
'th', 'th',
array( array(
'class' => 'diffusion-line-link', 'class' => 'diffusion-line-link',
@ -714,34 +714,42 @@ final class DiffusionBrowseFileController extends DiffusionController {
Javelin::initBehavior('diffusion-line-linker'); Javelin::initBehavior('diffusion-line-linker');
$blame = implode('', $blame);
if ($line['target']) { if ($line['target']) {
Javelin::initBehavior( Javelin::initBehavior(
'diffusion-jump-to', 'diffusion-jump-to',
array( array(
'target' => 'scroll_target', 'target' => 'scroll_target',
)); ));
$anchor_text = '<a id="scroll_target"></a>'; $anchor_text = phutil_tag(
'a',
array(
'id' => 'scroll_target',
),
'');
} else { } else {
$anchor_text = null; $anchor_text = null;
} }
$line_text = phutil_render_tag( $blame[] = phutil_tag(
'td', 'td',
array( array(
), ),
$anchor_text. array(
"\xE2\x80\x8B". // NOTE: See phabricator-oncopy behavior. $anchor_text,
$line['data']);
$rows[] = phutil_render_tag( // NOTE: See phabricator-oncopy behavior.
"\xE2\x80\x8B",
// TODO: [HTML] Not ideal.
phutil_safe_html($line['data']),
));
$rows[] = phutil_tag(
'tr', 'tr',
array( array(
'class' => ($line['highlighted'] ? 'highlighted' : null), 'class' => ($line['highlighted'] ? 'highlighted' : null),
), ),
$blame. $blame);
$line_text);
$rows = array_merge($rows, $this->renderInlines( $rows = array_merge($rows, $this->renderInlines(
idx($inlines, $line['line'], array()), idx($inlines, $line['line'], array()),
@ -759,11 +767,9 @@ final class DiffusionBrowseFileController extends DiffusionController {
->setMarkupEngine($engine) ->setMarkupEngine($engine)
->setInlineComment($inline) ->setInlineComment($inline)
->render(); ->render();
$rows[] = $row = array_fill(0, ($needs_blame ? 5 : 1), phutil_tag('th'));
'<tr class="inline">'. $row[] = phutil_tag('td', array(), $inline_view);
str_repeat('<th></th>', ($needs_blame ? 5 : 1)). $rows[] = phutil_tag('tr', array('class' => 'inline'), $row);
'<td>'.$inline_view.'</td>'.
'</tr>';
} }
return $rows; return $rows;
} }
@ -786,7 +792,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
$properties->addProperty( $properties->addProperty(
pht('Image'), pht('Image'),
phutil_render_tag( phutil_tag(
'img', 'img',
array( array(
'src' => $file_uri, 'src' => $file_uri,
@ -811,10 +817,11 @@ final class DiffusionBrowseFileController extends DiffusionController {
$actions = id(new PhabricatorActionListView()) $actions = id(new PhabricatorActionListView())
->setUser($this->getRequest()->getUser()) ->setUser($this->getRequest()->getUser())
->addAction($this->createEditAction()) ->addAction($this->createEditAction())
->addAction(id(new PhabricatorActionView()) ->addAction(
->setName(pht('Download Binary File...')) id(new PhabricatorActionView())
->setIcon('download') ->setName(pht('Download Binary File...'))
->setHref($file_uri)); ->setIcon('download')
->setHref($file_uri));
return array($actions, $properties); return array($actions, $properties);

View file

@ -14,7 +14,7 @@ final class DiffusionCommitBranchesController extends DiffusionController {
$branch_links = array(); $branch_links = array();
foreach ($branches as $branch => $commit) { foreach ($branches as $branch => $commit) {
$branch_links[] = phutil_render_tag( $branch_links[] = phutil_tag(
'a', 'a',
array( array(
'href' => $request->generateURI( 'href' => $request->generateURI(
@ -23,7 +23,7 @@ final class DiffusionCommitBranchesController extends DiffusionController {
'branch' => $branch, 'branch' => $branch,
)), )),
), ),
phutil_escape_html($branch)); $branch);
} }
return id(new AphrontAjaxResponse()) return id(new AphrontAjaxResponse())

View file

@ -62,8 +62,8 @@ final class DiffusionCommitController extends DiffusionController {
$error_panel->appendChild( $error_panel->appendChild(
"This Diffusion repository is configured to track only one ". "This Diffusion repository is configured to track only one ".
"subdirectory of the entire Subversion repository, and this commit ". "subdirectory of the entire Subversion repository, and this commit ".
"didn't affect the tracked subdirectory ('". "didn't affect the tracked subdirectory ('".$subpath."'), so no ".
phutil_escape_html($subpath)."'), so no information is available."); "information is available.");
$content[] = $error_panel; $content[] = $error_panel;
$content[] = $top_anchor; $content[] = $top_anchor;
} else { } else {
@ -92,10 +92,13 @@ final class DiffusionCommitController extends DiffusionController {
} }
$property_list->addTextContent( $property_list->addTextContent(
'<div class="diffusion-commit-message phabricator-remarkup">'. phutil_tag(
$engine->markupText($commit_data->getCommitMessage()). 'div',
'</div>' array(
); 'class' => 'diffusion-commit-message phabricator-remarkup',
),
phutil_safe_html(
$engine->markupText($commit_data->getCommitMessage()))));
$content[] = $top_anchor; $content[] = $top_anchor;
$content[] = $headsup_view; $content[] = $headsup_view;
@ -159,8 +162,7 @@ final class DiffusionCommitController extends DiffusionController {
if ($bad_commit) { if ($bad_commit) {
$error_panel = new AphrontErrorView(); $error_panel = new AphrontErrorView();
$error_panel->setTitle('Bad Commit'); $error_panel->setTitle('Bad Commit');
$error_panel->appendChild( $error_panel->appendChild($bad_commit['description']);
phutil_escape_html($bad_commit['description']));
$content[] = $error_panel; $content[] = $error_panel;
} else if ($is_foreign) { } else if ($is_foreign) {
@ -194,18 +196,20 @@ final class DiffusionCommitController extends DiffusionController {
$change_panel->setHeader("Changes (".number_format($count).")"); $change_panel->setHeader("Changes (".number_format($count).")");
$change_panel->setID('toc'); $change_panel->setID('toc');
if ($count > self::CHANGES_LIMIT) { if ($count > self::CHANGES_LIMIT) {
$show_all_button = phutil_render_tag( $show_all_button = phutil_tag(
'a', 'a',
array( array(
'class' => 'button green', 'class' => 'button green',
'href' => '?show_all=true', 'href' => '?show_all=true',
), ),
phutil_escape_html('Show All Changes')); 'Show All Changes');
$warning_view = id(new AphrontErrorView()) $warning_view = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_WARNING) ->setSeverity(AphrontErrorView::SEVERITY_WARNING)
->setTitle('Very Large Commit') ->setTitle('Very Large Commit')
->appendChild( ->appendChild(phutil_tag(
"<p>This commit is very large. Load each file individually.</p>"); 'p',
array(),
"This commit is very large. Load each file individually."));
$change_panel->appendChild($warning_view); $change_panel->appendChild($warning_view);
$change_panel->addButton($show_all_button); $change_panel->addButton($show_all_button);
@ -405,10 +409,10 @@ final class DiffusionCommitController extends DiffusionController {
if ($commit->getAuditStatus()) { if ($commit->getAuditStatus()) {
$status = PhabricatorAuditCommitStatusConstants::getStatusName( $status = PhabricatorAuditCommitStatusConstants::getStatusName(
$commit->getAuditStatus()); $commit->getAuditStatus());
$props['Status'] = phutil_render_tag( $props['Status'] = phutil_tag(
'strong', 'strong',
array(), array(),
phutil_escape_html($status)); $status);
} }
$props['Committed'] = phabricator_datetime($commit->getEpoch(), $user); $props['Committed'] = phabricator_datetime($commit->getEpoch(), $user);
@ -417,7 +421,7 @@ final class DiffusionCommitController extends DiffusionController {
if ($data->getCommitDetail('authorPHID')) { if ($data->getCommitDetail('authorPHID')) {
$props['Author'] = $handles[$author_phid]->renderLink(); $props['Author'] = $handles[$author_phid]->renderLink();
} else { } else {
$props['Author'] = phutil_escape_html($data->getAuthorName()); $props['Author'] = $data->getAuthorName();
} }
$reviewer_phid = $data->getCommitDetail('reviewerPHID'); $reviewer_phid = $data->getCommitDetail('reviewerPHID');
@ -431,7 +435,7 @@ final class DiffusionCommitController extends DiffusionController {
if ($data->getCommitDetail('committerPHID')) { if ($data->getCommitDetail('committerPHID')) {
$props['Committer'] = $handles[$committer_phid]->renderLink(); $props['Committer'] = $handles[$committer_phid]->renderLink();
} else { } else {
$props['Committer'] = phutil_escape_html($committer); $props['Committer'] = $committer;
} }
} }
@ -445,13 +449,25 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($parents as $parent) { foreach ($parents as $parent) {
$parent_links[] = $handles[$parent->getPHID()]->renderLink(); $parent_links[] = $handles[$parent->getPHID()]->renderLink();
} }
$props['Parents'] = implode(' &middot; ', $parent_links); $props['Parents'] = array_interleave(
" \xC2\xB7 ",
$parent_links);
} }
$request = $this->getDiffusionRequest(); $request = $this->getDiffusionRequest();
$props['Branches'] = '<span id="commit-branches">Unknown</span>'; $props['Branches'] = phutil_tag(
$props['Tags'] = '<span id="commit-tags">Unknown</span>'; 'span',
array(
'id' => 'commit-branches',
),
'Unknown');
$props['Tags'] = phutil_tag(
'span',
array(
'id' => 'commit-tags',
),
'Unknown');
$callsign = $request->getRepository()->getCallsign(); $callsign = $request->getRepository()->getCallsign();
$root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier(); $root = '/diffusion/'.$callsign.'/commit/'.$commit->getCommitIdentifier();
@ -472,7 +488,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($task_phids as $phid) { foreach ($task_phids as $phid) {
$task_list[] = $handles[$phid]->renderLink(); $task_list[] = $handles[$phid]->renderLink();
} }
$task_list = implode('<br />', $task_list); $task_list = array_interleave(phutil_tag('br'), $task_list);
$props['Tasks'] = $task_list; $props['Tasks'] = $task_list;
} }
@ -481,7 +497,7 @@ final class DiffusionCommitController extends DiffusionController {
foreach ($proj_phids as $phid) { foreach ($proj_phids as $phid) {
$proj_list[] = $handles[$phid]->renderLink(); $proj_list[] = $handles[$phid]->renderLink();
} }
$proj_list = implode('<br />', $proj_list); $proj_list = array_interleave(phutil_tag('br'), $proj_list);
$props['Projects'] = $proj_list; $props['Projects'] = $proj_list;
} }
@ -910,7 +926,7 @@ final class DiffusionCommitController extends DiffusionController {
$ref_links = array(); $ref_links = array();
foreach ($refs as $ref) { foreach ($refs as $ref) {
$ref_links[] = phutil_render_tag( $ref_links[] = phutil_tag(
'a', 'a',
array( array(
'href' => $request->generateURI( 'href' => $request->generateURI(
@ -919,10 +935,10 @@ final class DiffusionCommitController extends DiffusionController {
'branch' => $ref, 'branch' => $ref,
)), )),
), ),
phutil_escape_html($ref)); $ref);
} }
$ref_links = implode(', ', $ref_links);
return $ref_links; return array_interleave(', ', $ref_links);
} }
private function buildRawDiffResponse(DiffusionRequest $drequest) { private function buildRawDiffResponse(DiffusionRequest $drequest) {

View file

@ -62,15 +62,15 @@ final class DiffusionCommitEditController extends DiffusionController {
->setValue($proj_t_values) ->setValue($proj_t_values)
->setID($tokenizer_id) ->setID($tokenizer_id)
->setCaption( ->setCaption(
javelin_render_tag( javelin_tag(
'a', 'a',
array( array(
'href' => '/project/create/', 'href' => '/project/create/',
'mustcapture' => true, 'mustcapture' => true,
'sigil' => 'project-create', 'sigil' => 'project-create',
), ),
'Create New Project')) pht('Create New Project')))
->setDatasource('/typeahead/common/projects/'));; ->setDatasource('/typeahead/common/projects/'));;
Javelin::initBehavior('project-create', array( Javelin::initBehavior('project-create', array(
'tokenizerID' => $tokenizer_id, 'tokenizerID' => $tokenizer_id,

View file

@ -19,7 +19,7 @@ final class DiffusionCommitTagsController extends DiffusionController {
$tag_links = array(); $tag_links = array();
foreach ($tags as $tag) { foreach ($tags as $tag) {
$tag_links[] = phutil_render_tag( $tag_links[] = phutil_tag(
'a', 'a',
array( array(
'href' => $request->generateURI( 'href' => $request->generateURI(
@ -28,11 +28,11 @@ final class DiffusionCommitTagsController extends DiffusionController {
'commit' => $tag->getName(), 'commit' => $tag->getName(),
)), )),
), ),
phutil_escape_html($tag->getName())); $tag->getName());
} }
if ($has_more_tags) { if ($has_more_tags) {
$tag_links[] = phutil_render_tag( $tag_links[] = phutil_tag(
'a', 'a',
array( array(
'href' => $request->generateURI( 'href' => $request->generateURI(

View file

@ -246,9 +246,8 @@ abstract class DiffusionController extends PhabricatorController {
break; break;
case 'change': case 'change':
$view_name = 'Change'; $view_name = 'Change';
$crumb_list[] = $crumb->setRawName( $crumb_list[] = $crumb->setName(
phutil_escape_html($path).' ('.$commit_link.')' hsprintf('%s (%s)', $path, $commit_link));
);
return $crumb_list; return $crumb_list;
} }
@ -278,7 +277,8 @@ abstract class DiffusionController extends PhabricatorController {
$thus_far = ''; $thus_far = '';
foreach ($path_parts as $path_part) { foreach ($path_parts as $path_part) {
$thus_far .= $path_part.'/'; $thus_far .= $path_part.'/';
$path_sections[] = phutil_render_tag( $path_sections[] = '/';
$path_sections[] = phutil_tag(
'a', 'a',
array( array(
'href' => $drequest->generateURI( 'href' => $drequest->generateURI(
@ -286,20 +286,19 @@ abstract class DiffusionController extends PhabricatorController {
'path' => $thus_far, 'path' => $thus_far,
) + $uri_params), ) + $uri_params),
), ),
phutil_escape_html($path_part)); $path_part);
} }
$path_sections[] = phutil_escape_html($last); $path_sections[] = '/'.$last;
$path_sections = '/'.implode('/', $path_sections);
$crumb_list[] = id(new PhabricatorCrumbView()) $crumb_list[] = id(new PhabricatorCrumbView())
->setRawName($path_sections); ->setName($path_sections);
} }
$last_crumb = array_pop($crumb_list); $last_crumb = array_pop($crumb_list);
if ($raw_commit) { if ($raw_commit) {
$jump_link = phutil_render_tag( $jump_link = phutil_tag(
'a', 'a',
array( array(
'href' => $drequest->generateURI( 'href' => $drequest->generateURI(
@ -308,13 +307,14 @@ abstract class DiffusionController extends PhabricatorController {
) + $uri_params), ) + $uri_params),
), ),
'Jump to HEAD'); 'Jump to HEAD');
$last_crumb->setRawName(
$last_crumb->getNameForRender() . " @ {$commit_link} ({$jump_link})" $name = $last_crumb->getName();
); $name = hsprintf('%s @ %s (%s)', $name, $commit_link, $jump_link);
$last_crumb->setName($name);
} else if ($spec['view'] != 'lint') { } else if ($spec['view'] != 'lint') {
$last_crumb->setRawName( $name = $last_crumb->getName();
$last_crumb->getNameForRender() . " @ HEAD" $name = hsprintf('%s @ HEAD', $name);
); $last_crumb->setName($name);
} }
$crumb_list[] = $last_crumb; $crumb_list[] = $last_crumb;

Some files were not shown because too many files have changed in this diff Show more