1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +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', {
construct : function(str) {
if (str instanceof JX.HTML) {
this._content = str._content;
return;
}
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',
'caption', 'tr', 'th', 'td', 'option'];
var evil_stuff = new RegExp('^\\s*<(' + tags.join('|') + ')\\b', 'i');

View file

@ -1666,7 +1666,7 @@ CREATE TABLE `ponder_question` (
UNIQUE KEY `phid` (`phid`),
KEY `authorPHID` (`authorPHID`),
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 */;

View file

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

View file

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

View file

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

View file

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

View file

@ -5,57 +5,32 @@
*/
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 $settings;
private $coredata;
public function getPlugin($plugin_name) {
return idx($this->plugins, $plugin_name);
}
const STORAGE_VERSION = 1;
public function __construct() {
foreach (self::getPlugins() as $plugin_name) {
$plugin = self::newPlugin($plugin_name);
if ($plugin->isPermanent() || !isset($disabled[$plugin_name])) {
if ($plugin->shouldStartup()) {
$plugin->didStartup();
$plugin->setConsoleCore($this);
$this->plugins[$plugin_name] = $plugin;
}
$symbols = id(new PhutilSymbolLoader())
->setType('class')
->setAncestorClass('DarkConsolePlugin')
->selectAndLoadSymbols();
foreach ($symbols as $symbol) {
$plugin = newv($symbol['name'], array());
if (!$plugin->shouldStartup()) {
continue;
}
$plugin->setConsoleCore($this);
$plugin->didStartup();
$this->plugins[$symbol['name']] = $plugin;
}
}
public static function newPlugin($plugin) {
$class = 'DarkConsole'.$plugin.'Plugin';
return newv($class, array());
}
public function getEnabledPlugins() {
public function getPlugins() {
return $this->plugins;
}
public function render(AphrontRequest $request) {
$user = $request->getUser();
$plugins = $this->getEnabledPlugins();
public function getKey(AphrontRequest $request) {
$plugins = $this->getPlugins();
foreach ($plugins as $plugin) {
$plugin->setRequest($request);
@ -70,128 +45,58 @@ final class DarkConsoleCore {
$plugin->setData($plugin->generateData());
}
$selected = $user->getConsoleTab();
$visible = $user->getConsoleVisible();
$plugins = msort($plugins, 'getOrderKey');
if (!isset($plugins[$selected])) {
$selected = head_key($plugins);
}
$key = Filesystem::readRandomCharacters(24);
$tabs = array();
foreach ($plugins as $key => $plugin) {
$tabs[$key] = array(
$data = array();
foreach ($plugins as $plugin) {
$class = get_class($plugin);
$tabs[] = array(
'class' => $class,
'name' => $plugin->getName(),
'panel' => $plugin->render(),
'color' => $plugin->getColor(),
);
$data[$class] = $plugin->getData();
}
$tabs_markup = array();
$panel_markup = array();
foreach ($tabs as $key => $data) {
$is_selected = ($key == $selected);
if ($is_selected) {
$style = null;
$tabclass = 'dark-console-tab-selected';
} else {
$style = 'display: none;';
$tabclass = null;
}
$storage = array(
'vers' => self::STORAGE_VERSION,
'tabs' => $tabs,
'data' => $data,
'user' => $request->getUser()
? $request->getUser()->getPHID()
: null,
);
$tabs_markup[] = javelin_render_tag(
'a',
array(
'class' => "dark-console-tab {$tabclass}",
'sigil' => 'dark-console-tab',
'id' => 'dark-console-tab-'.$key,
),
(string)$data['name']);
$cache = new PhabricatorKeyValueDatabaseCache();
$cache = new PhutilKeyValueCacheProfiler($cache);
$cache->setProfiler(PhutilServiceProfiler::getInstance());
$panel_markup[] = javelin_render_tag(
'div',
array(
'class' => 'dark-console-panel dark-console-panel-'.$key,
'style' => $style,
'sigil' => 'dark-console-panel',
),
(string)$data['panel']);
}
$console = javelin_render_tag(
'table',
$cache->setKeys(
array(
'class' => 'dark-console',
'sigil' => 'dark-console',
'style' => $visible ? '' : 'display: none;',
'darkconsole:'.$key => json_encode($storage),
),
'<tr>'.
'<th class="dark-console-tabs">'.
implode("\n", $tabs_markup).
'</th>'.
'<td>'.implode("\n", $panel_markup).'</td>'.
'</tr>');
$ttl = (60 * 60 * 6));
if (!empty($_COOKIE['phsid'])) {
$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";
return $key;
}
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() {
$count = count($this->getData());
if ($count) {
return
'<span style="color: #ff0000;">&bull;</span> '.
"Error Log ({$count})";
return pht('Error Log (%d)', $count);
}
return 'Error Log';
return pht('Error Log');
}
public function getOrder() {
return 0;
}
public function getColor() {
if (count($this->getData())) {
return '#ff0000';
}
return null;
}
public function getDescription() {
return 'Shows errors and warnings.';
return pht('Shows errors and warnings.');
}
public function generateData() {
return DarkConsoleErrorLogPluginAPI::getErrors();
}
public function render() {
public function renderPanel() {
$data = $this->getData();
$rows = array();
@ -39,12 +42,12 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
$file = $row['file'];
$line = $row['line'];
$tag = phutil_render_tag(
$tag = phutil_tag(
'a',
array(
'onclick' => jsprintf('show_details(%d)', $index),
),
phutil_escape_html($row['str'].' at ['.basename($file).':'.$line.']'));
$row['str'].' at ['.basename($file).':'.$line.']');
$rows[] = array($tag);
$details .=
@ -70,12 +73,12 @@ final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
}
}
$details .= phutil_render_tag(
$details .= phutil_tag(
'a',
array(
'href' => $href,
),
phutil_escape_html($line));
$line);
$details .= "\n";
}

View file

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

View file

@ -11,12 +11,27 @@ abstract class DarkConsolePlugin {
abstract public function getName();
abstract public function getDescription();
abstract public function render();
abstract public function renderPanel();
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) {
$this->core = $core;
return $this;
@ -52,10 +67,6 @@ abstract class DarkConsolePlugin {
return $this->getRequest()->getRequestURI();
}
public function isPermanent() {
return false;
}
public function shouldStartup() {
return true;
}

View file

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

View file

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

View file

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

View file

@ -38,10 +38,10 @@ final class AphrontAjaxResponse extends AphrontResponse {
$console = $this->getConsole();
if ($console) {
Javelin::initBehavior(
'dark-console-ajax',
'dark-console',
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->setTitle('Stopped on Redirect');
$link = phutil_render_tag(
$link = phutil_tag(
'a',
array(
'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> '.
'is set in your configuration.</p>'.
'<p>'.$link.'</p>');
'<p>%s</p>',
$link));
$view->appendChild($error);

View file

@ -54,7 +54,21 @@ abstract class AphrontResponse {
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);

View file

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

View file

@ -43,9 +43,9 @@ final class PhabricatorLoginValidateController
$list = array();
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->setHeader(pht('Login Failed'));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -396,12 +396,9 @@ final class PhabricatorConduitAPIController
$json = new PhutilJSON();
if (is_array($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;
}

View file

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

View file

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

View file

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

View file

@ -59,9 +59,10 @@ final class PhabricatorSetupCheckBaseURI extends PhabricatorSetupCheck {
->setSummary($summary)
->setMessage($message)
->addCommand(
csprintf(
'<tt>phabricator/ $</tt> '.
'./bin/config set phabricator.base-uri %s',
$base_uri_guess));
hsprintf(
'<tt>phabricator/ $</tt> %s',
csprintf(
'./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'))
->setMessage($message)
->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(
phutil_render_tag(
phutil_tag(
'a',
array(
'href' => $this->getApplicationURI('edit/'.$key.'/'),
),
phutil_escape_html($key)),
$key),
$value,
);
}
@ -68,13 +68,16 @@ final class PhabricatorConfigAllController
$display_version = pht('Unknown');
}
$version_property_list = id(new PhabricatorPropertyListView());
$version_property_list->addProperty('Version',
phutil_escape_html($display_version));
$version_property_list->addProperty(
pht('Version'),
$display_version);
$version_path = $phabricator_root.'/conf/local/VERSION';
if (Filesystem::pathExists($version_path)) {
$version_from_file = Filesystem::readFile($version_path);
$version_property_list->addProperty('Local Version',
phutil_escape_html($version_from_file));
$version_property_list->addProperty(
pht('Local Version'),
$version_from_file);
}
$nav = $this->buildSideNavView();

View file

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

View file

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

View file

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

View file

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

View file

@ -16,33 +16,36 @@ final class PhabricatorSetupIssueView extends AphrontView {
public function render() {
$issue = $this->getIssue();
$description = phutil_render_tag(
$description = array();
$description[] = phutil_tag(
'div',
array(
'class' => 'setup-issue-instructions',
),
nl2br(phutil_escape_html($issue->getMessage())));
phutil_escape_html_newlines($issue->getMessage()));
$configs = $issue->getPHPConfig();
if ($configs) {
$description .= $this->renderPHPConfig($configs);
$description[] = $this->renderPHPConfig($configs);
}
$configs = $issue->getPhabricatorConfig();
if ($configs) {
$description .= $this->renderPhabricatorConfig($configs);
$description[] = $this->renderPhabricatorConfig($configs);
}
$commands = $issue->getCommands();
if ($commands) {
$run_these = pht("Run these %d command(s):", count($commands));
$description .= phutil_render_tag(
$description[] = phutil_tag(
'div',
array(
'class' => 'setup-issue-config',
),
phutil_render_tag('p', array(), $run_these).
phutil_render_tag('pre', array(), implode("\n", $commands)));
array(
phutil_tag('p', array(), $run_these),
phutil_tag('pre', array(), array_interleave("\n", $commands)),
));
}
$extensions = $issue->getPHPExtensions();
@ -51,18 +54,19 @@ final class PhabricatorSetupIssueView extends AphrontView {
"Install these %d PHP extension(s):", count($extensions));
$install_info = pht(
"You can usually install a PHP extension using <tt>apt-get</tt> or ".
"<tt>yum</tt>. Common package names are ".
"<tt>php-<em>extname</em></tt> or <tt>php5-<em>extname</em></tt>. ".
"Try commands like these:");
"You can usually install a PHP extension using %s or %s. Common ".
"package names are %s or %s. Try commands like these:",
phutil_tag('tt', array(), 'apt-get'),
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
// on the current system.
$install_commands = array(
"$ sudo apt-get install php5-<em>extname</em> # Debian / Ubuntu",
"$ sudo yum install php-<em>extname</em> # Red Hat / Derivatives",
$install_commands = hsprintf(
"\$ sudo apt-get install php5-<em>extname</em> # Debian / Ubuntu\n".
"\$ sudo yum install php-<em>extname</em> # Red Hat / Derivatives"
);
$install_commands = implode("\n", $install_commands);
$fallback_info = pht(
"If those commands don't work, try Google. The process of installing ".
@ -72,85 +76,72 @@ final class PhabricatorSetupIssueView extends AphrontView {
$restart_info = pht(
"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',
array(
'class' => 'setup-issue-config',
),
phutil_render_tag('p', array(), $install_these).
phutil_render_tag('pre', array(), implode("\n", $extensions)).
phutil_render_tag('p', array(), $install_info).
phutil_render_tag('pre', array(), $install_commands).
phutil_render_tag('p', array(), $fallback_info).
phutil_render_tag('p', array(), $restart_info));
array(
phutil_tag('p', array(), $install_these),
phutil_tag('pre', array(), implode("\n", $extensions)),
phutil_tag('p', array(), $install_info),
phutil_tag('pre', array(), $install_commands),
phutil_tag('p', array(), $fallback_info),
phutil_tag('p', array(), $restart_info),
));
}
$next = phutil_render_tag(
$next = phutil_tag(
'div',
array(
'class' => 'setup-issue-next',
),
pht('To continue, resolve this problem and reload the page.'));
$name = phutil_render_tag(
$name = phutil_tag(
'div',
array(
'class' => 'setup-issue-name',
),
phutil_escape_html($issue->getName()));
$issue->getName());
return phutil_render_tag(
return phutil_tag(
'div',
array(
'class' => 'setup-issue',
),
$name.$description.$next);
$this->renderHTMLView(
array(
$name,
$description,
$next,
)));
}
private function renderPhabricatorConfig(array $configs) {
$issue = $this->getIssue();
$table_info = phutil_render_tag(
$table_info = phutil_tag(
'p',
array(),
pht(
"The current Phabricator configuration has these %d value(s):",
count($configs)));
$table = array();
$dict = array();
foreach ($configs as $key) {
$table[] = '<tr>';
$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>';
$dict[$key] = PhabricatorEnv::getUnrepairedEnvConfig($key);
}
$table = phutil_render_tag(
'table',
array(
),
implode("\n", $table));
$table = $this->renderValueTable($dict);
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
if ($this->getIssue()->getIsFatal()) {
$update_info = phutil_render_tag(
$update_info = phutil_tag(
'p',
array(),
pht(
@ -160,29 +151,28 @@ final class PhabricatorSetupIssueView extends AphrontView {
$update = array();
foreach ($configs as $key) {
$cmd = '<tt>phabricator/ $</tt> ./bin/config set '.
phutil_escape_html($key).' '.
'<em>value</em>';
$update[] = $cmd;
$update[] = hsprintf(
'<tt>phabricator/ $</tt> ./bin/config set %s <em>value</em>',
$key);
}
$update = phutil_render_tag('pre', array(), implode("\n", $update));
$update = phutil_tag('pre', array(), array_interleave("\n", $update));
} else {
$update = array();
foreach ($configs as $config) {
if (!idx($options, $config) || $options[$config]->getLocked()) {
continue;
}
$link = phutil_render_tag(
$link = phutil_tag(
'a',
array(
'href' => '/config/edit/'.$config.'/?issue='.$issue->getIssueKey(),
),
pht('Edit %s', phutil_escape_html($config)));
$update[] = '<li>'.$link.'</li>';
pht('Edit %s', $config));
$update[] = phutil_tag('li', array(), $link);
}
if ($update) {
$update = '<ul>'.implode("\n", $update).'</ul>';
$update_info = phutil_render_tag(
$update = phutil_tag('ul', array(), $update);
$update_info = phutil_tag(
'p',
array(),
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',
array(
'class' => 'setup-issue-config',
),
self::renderSingleView(
self::renderHTMLView(
array(
$table_info,
$table,
@ -207,41 +197,19 @@ final class PhabricatorSetupIssueView extends AphrontView {
}
private function renderPHPConfig(array $configs) {
$table_info = phutil_render_tag(
$table_info = phutil_tag(
'p',
array(),
pht(
"The current PHP configuration has these %d value(s):",
count($configs)));
$table = array();
$dict = array();
foreach ($configs as $key) {
$table[] = '<tr>';
$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>';
$dict[$key] = ini_get($key);
}
$table = phutil_render_tag(
'table',
array(
),
implode("\n", $table));
$table = $this->renderValueTable($dict);
ob_start();
phpinfo();
@ -268,66 +236,95 @@ final class PhabricatorSetupIssueView extends AphrontView {
}
}
$info = array();
if (!$ini_loc) {
$info = phutil_render_tag(
$info[] = phutil_tag(
'p',
array(),
pht(
"To update these %d value(s), edit your PHP configuration file.",
count($configs)));
} else {
$info = phutil_render_tag(
$info[] = phutil_tag(
'p',
array(),
pht(
"To update these %d value(s), edit your PHP configuration file, ".
"located here:",
count($configs)));
$info .= phutil_render_tag(
$info[] = phutil_tag(
'pre',
array(),
phutil_escape_html($ini_loc));
$ini_loc);
}
if ($more_loc) {
$info .= phutil_render_tag(
$info[] = phutil_tag(
'p',
array(),
pht(
"PHP also loaded these configuration file(s):",
count($more_loc)));
$info .= phutil_render_tag(
$info[] = phutil_tag(
'pre',
array(),
phutil_escape_html(implode("\n", $more_loc)));
implode("\n", $more_loc));
}
$info .= phutil_render_tag(
$info[] = phutil_tag(
'p',
array(),
pht(
"You can find more information about PHP configuration values in the ".
"%s.",
phutil_render_tag(
'a',
array(
'href' => 'http://php.net/manual/ini.list.php',
),
pht('PHP Documentation'))));
'You can find more information about PHP configuration values in the '.
'<a href="%s">PHP Documentation</a>.',
'http://php.net/manual/ini.list.php',
hsprintf('')));
$info .= phutil_render_tag(
$info[] = phutil_tag(
'p',
array(),
pht(
"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',
array(
'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('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) {
$nav->addCustomBlock($this->getNoConpherencesBlock());
@ -168,14 +170,12 @@ abstract class ConpherenceController extends PhabricatorController {
}
private function getNoConpherencesBlock() {
return phutil_tag(
'div',
array(
'class' => 'no-conpherences-menu-item'
),
pht('No more conversations.')
);
pht('No more conpherences.'));
}
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')
->addCancelButton('#', 'Okay')
->appendChild(
phutil_tag('p',
array(),
pht('Message sent successfully.')
)
);
phutil_tag(
'p',
array(),
pht('Message sent successfully.')));
$response = id(new AphrontDialogResponse())
->setDialog($dialog);
} else {

View file

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

View file

@ -136,9 +136,17 @@ final class ConpherenceMenuItemView extends AphrontTagView {
array(
'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())
->setContentSource($transaction->getContentSource());
$content = null;
$content_class = null;
$content = null;
switch ($transaction->getTransactionType()) {
@ -53,6 +54,17 @@ final class ConpherenceTransactionView extends AphrontView {
case ConpherenceTransactionType::TYPE_FILES:
$content = $transaction->getTitle();
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:
$content = $transaction->getTitle();
$transaction_view->addClass('conpherence-edited');
@ -79,7 +91,7 @@ final class ConpherenceTransactionView extends AphrontView {
array(
'class' => $content_class
),
new PhutilSafeHTML($content))
$this->renderHTMLView($content))
);
return $transaction_view->render();

View file

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

View file

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

View file

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

View file

@ -23,21 +23,18 @@ final class PhabricatorCountdownViewController
$chrome_visible = $request->getBool('chrome', true);
$chrome_new = $chrome_visible ? false : null;
$chrome_link = phutil_render_tag(
$chrome_link = phutil_tag(
'a',
array(
'href' => $request->getRequestURI()->alter('chrome', $chrome_new),
'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();
$content =
'<div class="phabricator-timer" id="'.$container.'">
<h1 class="phabricator-timer-header">'.
phutil_escape_html($timer->getTitle()).' &middot; '.
phabricator_datetime($timer->getDatePoint(), $user).
'</h1>
$content = hsprintf(
'<div class="phabricator-timer" id="%s">
<h1 class="phabricator-timer-header">%s &middot; %s</h1>
<div class="phabricator-timer-pane">
<table class="phabricator-timer-table">
<tr>
@ -46,20 +43,19 @@ final class PhabricatorCountdownViewController
<th>Minutes</th>
<th>Seconds</th>
</tr>
<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>
<tr>%s%s%s%s</tr>
</table>
</div>'.
$chrome_link.
'</div>';
</div>
%s
</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(
'timestamp' => $timer->getDatepoint(),

View file

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

View file

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

View file

@ -63,18 +63,18 @@ final class PhabricatorDaemonLogEventsView extends AphrontView {
phutil_escape_html($event->getLogType()),
phabricator_date($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) {
array_unshift(
$row,
phutil_render_tag(
phutil_tag(
'a',
array(
'href' => '/daemon/log/'.$event->getLogID().'/',
),
phutil_escape_html('Daemon '.$event->getLogID())));
'Daemon '.$event->getLogID()));
}
$rows[] = $row;

View file

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

View file

@ -234,18 +234,24 @@ final class DifferentialChangesetViewController extends DifferentialController {
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->setChangeset($changeset);
$detail->appendChild($output);
$detail->setVsChangesetID($left_source);
$panel = new DifferentialPrimaryPaneView();
$panel->appendChild(phutil_render_tag('div',
$panel->appendChild(
phutil_tag(
'div',
array(
'class' => 'differential-review-stage',
'id' => 'differential-review-stage',
), $detail->render())
);
),
$detail->render()));
return $this->buildStandardPageResponse(
array(

View file

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

View file

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

View file

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

View file

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

View file

@ -13,7 +13,7 @@ final class DifferentialApplyPatchFieldSpecification
public function renderValueForRevisionView() {
$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);
return phutil_escape_html($handle->getName());
return $handle->getName();
}
private function getArcanistProjectPHID() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,7 +13,10 @@ final class DifferentialExportPatchFieldSpecification
public function renderValueForRevisionView() {
$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) {
if (!$user_phids) {
return '<em>None</em>';
return phutil_tag('em', array(), pht('None'));
}
$links = array();
@ -283,7 +283,7 @@ abstract class DifferentialFieldSpecification {
$links[] = $handle->renderLink();
}
return implode(', ', $links);
return array_interleave(', ', $links);
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -46,21 +46,6 @@ final class DifferentialAddCommentView extends AphrontView {
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() {
require_celerity_resource('differential-revision-add-comment-css');

View file

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

View file

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

View file

@ -138,7 +138,7 @@ final class DifferentialChangesetListView extends AphrontView {
$load = 'Loading...';
$mapping[$uniq_id] = $ref;
} else {
$load = javelin_render_tag(
$load = javelin_tag(
'a',
array(
'href' => '#'.$uniq_id,
@ -150,15 +150,15 @@ final class DifferentialChangesetListView extends AphrontView {
'sigil' => 'differential-load',
'mustcapture' => true,
),
'Load');
pht('Load'));
}
$detail->appendChild(
phutil_render_tag(
phutil_tag(
'div',
array(
'id' => $uniq_id,
),
'<div class="differential-loading">'.$load.'</div>'));
phutil_tag('div', array('class' => 'differential-loading'), $load)));
$output[] = $detail->render();
}
@ -187,37 +187,39 @@ final class DifferentialChangesetListView extends AphrontView {
));
}
return
id(new PhabricatorHeaderView())
->setHeader($this->getTitle())
->render().
phutil_render_tag(
'div',
return $this->renderHTMLView(
array(
'class' => 'differential-review-stage',
'id' => 'differential-review-stage',
),
implode("\n", $output));
id(new PhabricatorHeaderView())
->setHeader($this->getTitle())
->render(),
phutil_tag(
'div',
array(
'class' => 'differential-review-stage',
'id' => 'differential-review-stage',
),
$output),
));
}
/**
* Render the "Undo" markup for the inline comment undo feature.
*/
private function renderUndoTemplates() {
$link = javelin_render_tag(
$link = javelin_tag(
'a',
array(
'href' => '#',
'sigil' => 'differential-inline-comment-undo',
),
'Undo');
pht('Undo'));
$div = phutil_render_tag(
$div = phutil_tag(
'div',
array(
'class' => 'differential-inline-undo',
),
'Changes discarded. '.$link);
array('Changes discarded. ', $link));
$template =
'<table><tr>'.
@ -302,7 +304,7 @@ final class DifferentialChangesetListView extends AphrontView {
'differential-dropdown-menus',
array());
return javelin_render_tag(
return javelin_tag(
'a',
array(
'class' => 'button small grey',
@ -311,7 +313,7 @@ final class DifferentialChangesetListView extends AphrontView {
'target' => '_blank',
'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) {
$mcov = $cov = '<em>-</em>';
} else {
$mcov = phutil_render_tag(
$mcov = phutil_tag(
'div',
array(
'id' => 'differential-mcoverage-'.md5($fname),
@ -148,7 +148,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$rows[] =
'<tr>'.
phutil_render_tag(
phutil_tag(
'td',
array(
'class' => 'differential-toc-char',
@ -182,7 +182,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
$this->repository->getCallsign());
if ($editor_link) {
$editor_link =
phutil_render_tag(
phutil_tag(
'a',
array(
'href' => $editor_link,
@ -192,16 +192,14 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
}
}
$reveal_link =
javelin_render_tag(
$reveal_link = javelin_tag(
'a',
array(
'sigil' => 'differential-reveal-all',
'mustcapture' => true,
'class' => 'button differential-toc-reveal-all',
),
pht('Show All Context')
);
pht('Show All Context'));
$buttons =
'<tr><td colspan="7">'.
@ -256,7 +254,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
private function renderChangesetLink(DifferentialChangeset $changeset, $ref) {
$display_file = $changeset->getDisplayFilename();
return javelin_render_tag(
return javelin_tag(
'a',
array(
'href' => '#'.$changeset->getAnchorName(),
@ -266,7 +264,7 @@ final class DifferentialDiffTableOfContentsView extends AphrontView {
),
'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()!");
}
$content = phabricator_render_form(
$content = phabricator_form(
$this->user,
array(
'action' => $this->uri,
'method' => 'POST',
'sigil' => 'inline-edit-form',
),
$this->renderInputs().
$this->renderBody());
$this->renderHTMLView(
array(
$this->renderInputs(),
$this->renderBody(),
)));
if ($this->onRight) {
$core =
'<th></th>'.
'<td class="left"></td>'.
'<th></th>'.
'<td colspan="3" class="right3">'.$content.'</td>';
} else {
$core =
'<th></th>'.
'<td class="left">'.$content.'</td>'.
'<th></th>'.
'<td colspan="3" class="right3"></td>';
}
return '<table><tr class="inline-comment-splint">'.$core.'</tr></table>';
return hsprintf(
'<table>'.
'<tr class="inline-comment-splint">'.
'<th></th>'.
'<td class="left">%s</td>'.
'<th></th>'.
'<td colspan="3" class="right3">%s</td>'.
'</tr>'.
'</table>',
$this->onRight ? null : $content,
$this->onRight ? $content : null);
}
private function renderInputs() {
$out = array();
foreach ($this->inputs as $input) {
list($name, $value) = $input;
$out[] = phutil_render_tag(
$out[] = phutil_tag(
'input',
array(
'type' => 'hidden',
'name' => $name,
'value' => $value,
),
null);
));
}
return implode('', $out);
return $out;
}
private function renderBody() {
$buttons = array();
$buttons[] = '<button>Ready</button>';
$buttons[] = javelin_render_tag(
$buttons[] = phutil_tag('button', array(), 'Ready');
$buttons[] = javelin_tag(
'button',
array(
'sigil' => 'inline-edit-cancel',
@ -103,9 +101,7 @@ final class DifferentialInlineCommentEditView extends AphrontView {
),
pht('Cancel'));
$buttons = implode('', $buttons);
$formatting = phutil_render_tag(
$formatting = phutil_tag(
'a',
array(
'href' => PhabricatorEnv::getDoclink(
@ -115,7 +111,33 @@ final class DifferentialInlineCommentEditView extends AphrontView {
),
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',
array(
'class' => 'differential-inline-comment-edit',
@ -126,17 +148,12 @@ final class DifferentialInlineCommentEditView extends AphrontView {
'length' => $this->length,
),
),
'<div class="differential-inline-comment-edit-title">'.
phutil_escape_html($this->title).
'</div>'.
'<div class="differential-inline-comment-edit-body">'.
$this->renderChildren().
'</div>'.
'<div class="differential-inline-comment-edit-buttons">'.
$formatting.
$buttons.
'<div style="clear: both;"></div>'.
'</div>');
$this->renderHTMLView(
array(
$title,
$body,
$edit,
)));
}
}

View file

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

View file

@ -54,17 +54,17 @@ final class DifferentialLocalCommitsView extends AphrontView {
} else {
$commit_hash = null;
}
$row[] = '<td>'.phutil_escape_html($commit_hash).'</td>';
$row[] = phutil_tag('td', array(), $commit_hash);
if ($has_tree) {
$tree = idx($commit, 'tree');
$tree = substr($tree, 0, 16);
$row[] = '<td>'.phutil_escape_html($tree).'</td>';
$row[] = phutil_tag('td', array(), $tree);
}
if ($has_local) {
$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());
@ -72,15 +72,15 @@ final class DifferentialLocalCommitsView extends AphrontView {
if (is_array($parent)) {
$parent = idx($parent, 'rev');
}
$parents[$k] = phutil_escape_html(substr($parent, 0, 16));
$parents[$k] = substr($parent, 0, 16);
}
$parents = implode('<br />', $parents);
$row[] = '<td>'.$parents.'</td>';
$parents = array_interleave(phutil_tag('br'), $parents);
$row[] = phutil_tag('td', array(), $parents);
$author = nonempty(
idx($commit, 'user'),
idx($commit, 'author'));
$row[] = '<td>'.phutil_escape_html($author).'</td>';
$row[] = phutil_tag('td', array(), $author);
$message = idx($commit, 'message');
@ -88,13 +88,13 @@ final class DifferentialLocalCommitsView extends AphrontView {
$summary = phutil_utf8_shorten($summary, 80);
$view = new AphrontMoreView();
$view->setSome(phutil_escape_html($summary));
$view->setSome($summary);
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',
array(
'class' => 'summary',
@ -107,9 +107,9 @@ final class DifferentialLocalCommitsView extends AphrontView {
if ($date) {
$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');
switch ($style) {
case 'section':
$cells = phutil_render_tag(
$cells = phutil_tag(
'th',
array(
'colspan' => 2,
@ -33,23 +33,23 @@ final class DifferentialResultsTableView extends AphrontView {
idx($row, 'name'));
break;
default:
$name = phutil_render_tag(
$name = phutil_tag(
'th',
array(
),
idx($row, 'name'));
$value = phutil_render_tag(
$value = phutil_tag(
'td',
array(
),
idx($row, 'value'));
$cells = $name.$value;
$cells = array($name, $value);
break;
}
$show = idx($row, 'show');
$rows[] = javelin_render_tag(
$rows[] = javelin_tag(
'tr',
array(
'style' => $show ? null : 'display: none',
@ -64,7 +64,7 @@ final class DifferentialResultsTableView extends AphrontView {
}
if ($any_hidden) {
$show_more = javelin_render_tag(
$show_more = javelin_tag(
'a',
array(
'href' => '#',
@ -72,7 +72,7 @@ final class DifferentialResultsTableView extends AphrontView {
),
$this->showMoreString);
$hide_more = javelin_render_tag(
$hide_more = javelin_tag(
'a',
array(
'href' => '#',
@ -80,35 +80,35 @@ final class DifferentialResultsTableView extends AphrontView {
),
'Hide');
$rows[] = javelin_render_tag(
$rows[] = javelin_tag(
'tr',
array(
'class' => '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',
array(
'class' => 'differential-results-row-show',
'sigil' => 'differential-results-row-hide',
'style' => 'display: none',
),
'<th colspan="2">'.$hide_more.'</th>');
phutil_tag('th', array('colspan' => 2), $hide_more));
Javelin::initBehavior('differential-show-field-details');
}
require_celerity_resource('differential-results-table-css');
return javelin_render_tag(
return javelin_tag(
'table',
array(
'class' => 'differential-results-table',
'sigil' => 'differential-results-table',
),
implode("\n", $rows));
$rows);
}

View file

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

View file

@ -134,12 +134,12 @@ final class DifferentialRevisionCommentView extends AphrontView {
case DifferentialAction::ACTION_UPDATE:
$diff_id = idx($metadata, DifferentialComment::METADATA_DIFF_ID);
if ($diff_id) {
$diff_link = phutil_render_tag(
$diff_link = phutil_tag(
'a',
array(
'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}.";
} else {
$actions[] = "{$author_link} {$verb} this revision.";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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