Page MenuHomePhabricator

D15997.id38505.diff
No OneTemporary

D15997.id38505.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1711,6 +1711,7 @@
'PhabricatorAccessControlTestCase' => 'applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php',
'PhabricatorAccessLog' => 'infrastructure/log/PhabricatorAccessLog.php',
'PhabricatorAccessLogConfigOptions' => 'applications/config/option/PhabricatorAccessLogConfigOptions.php',
+ 'PhabricatorAccessibilitySetting' => 'applications/settings/setting/PhabricatorAccessibilitySetting.php',
'PhabricatorAccountSettingsPanel' => 'applications/settings/panel/PhabricatorAccountSettingsPanel.php',
'PhabricatorActionListView' => 'view/layout/PhabricatorActionListView.php',
'PhabricatorActionView' => 'view/layout/PhabricatorActionView.php',
@@ -2373,6 +2374,8 @@
'PhabricatorEditPage' => 'applications/transactions/editengine/PhabricatorEditPage.php',
'PhabricatorEditType' => 'applications/transactions/edittype/PhabricatorEditType.php',
'PhabricatorEditor' => 'infrastructure/PhabricatorEditor.php',
+ 'PhabricatorEditorMultipleSetting' => 'applications/settings/setting/PhabricatorEditorMultipleSetting.php',
+ 'PhabricatorEditorSetting' => 'applications/settings/setting/PhabricatorEditorSetting.php',
'PhabricatorElasticFulltextStorageEngine' => 'applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php',
'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php',
'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php',
@@ -2732,6 +2735,8 @@
'PhabricatorMetaMTASendGridReceiveController' => 'applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php',
'PhabricatorMetaMTAWorker' => 'applications/metamta/PhabricatorMetaMTAWorker.php',
'PhabricatorMetronomicTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php',
+ 'PhabricatorMonospacedFontSetting' => 'applications/settings/setting/PhabricatorMonospacedFontSetting.php',
+ 'PhabricatorMonospacedTextareasSetting' => 'applications/settings/setting/PhabricatorMonospacedTextareasSetting.php',
'PhabricatorMotivatorProfilePanel' => 'applications/search/profilepanel/PhabricatorMotivatorProfilePanel.php',
'PhabricatorMultiColumnUIExample' => 'applications/uiexample/examples/PhabricatorMultiColumnUIExample.php',
'PhabricatorMultiFactorSettingsPanel' => 'applications/settings/panel/PhabricatorMultiFactorSettingsPanel.php',
@@ -3463,6 +3468,7 @@
'PhabricatorStorageSetupCheck' => 'applications/config/check/PhabricatorStorageSetupCheck.php',
'PhabricatorStreamingProtocolAdapter' => 'infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php',
'PhabricatorStringListEditField' => 'applications/transactions/editfield/PhabricatorStringListEditField.php',
+ 'PhabricatorStringSetting' => 'applications/settings/setting/PhabricatorStringSetting.php',
'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php',
'PhabricatorSubscribedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorSubscribedToObjectEdgeType.php',
'PhabricatorSubscribersEditField' => 'applications/transactions/editfield/PhabricatorSubscribersEditField.php',
@@ -3522,6 +3528,7 @@
'PhabricatorTimeGuard' => 'infrastructure/time/PhabricatorTimeGuard.php',
'PhabricatorTimeTestCase' => 'infrastructure/time/__tests__/PhabricatorTimeTestCase.php',
'PhabricatorTimezoneSetupCheck' => 'applications/config/check/PhabricatorTimezoneSetupCheck.php',
+ 'PhabricatorTitleGlyphsSetting' => 'applications/settings/setting/PhabricatorTitleGlyphsSetting.php',
'PhabricatorToken' => 'applications/tokens/storage/PhabricatorToken.php',
'PhabricatorTokenController' => 'applications/tokens/controller/PhabricatorTokenController.php',
'PhabricatorTokenCount' => 'applications/tokens/storage/PhabricatorTokenCount.php',
@@ -6137,6 +6144,7 @@
'PhabricatorAccessControlTestCase' => 'PhabricatorTestCase',
'PhabricatorAccessLog' => 'Phobject',
'PhabricatorAccessLogConfigOptions' => 'PhabricatorApplicationConfigOptions',
+ 'PhabricatorAccessibilitySetting' => 'PhabricatorSelectSetting',
'PhabricatorAccountSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorActionListView' => 'AphrontView',
'PhabricatorActionView' => 'AphrontView',
@@ -6914,6 +6922,8 @@
'PhabricatorEditPage' => 'Phobject',
'PhabricatorEditType' => 'Phobject',
'PhabricatorEditor' => 'Phobject',
+ 'PhabricatorEditorMultipleSetting' => 'PhabricatorSelectSetting',
+ 'PhabricatorEditorSetting' => 'PhabricatorStringSetting',
'PhabricatorElasticFulltextStorageEngine' => 'PhabricatorFulltextStorageEngine',
'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel',
@@ -7318,6 +7328,8 @@
'PhabricatorMetaMTASendGridReceiveController' => 'PhabricatorMetaMTAController',
'PhabricatorMetaMTAWorker' => 'PhabricatorWorker',
'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock',
+ 'PhabricatorMonospacedFontSetting' => 'PhabricatorStringSetting',
+ 'PhabricatorMonospacedTextareasSetting' => 'PhabricatorSelectSetting',
'PhabricatorMotivatorProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorMultiColumnUIExample' => 'PhabricatorUIExample',
'PhabricatorMultiFactorSettingsPanel' => 'PhabricatorSettingsPanel',
@@ -8204,6 +8216,7 @@
'PhabricatorStorageSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorStreamingProtocolAdapter' => 'PhabricatorProtocolAdapter',
'PhabricatorStringListEditField' => 'PhabricatorEditField',
+ 'PhabricatorStringSetting' => 'PhabricatorSetting',
'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorSubscribersEditField' => 'PhabricatorTokenizerEditField',
'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
@@ -8262,6 +8275,7 @@
'PhabricatorTimeGuard' => 'Phobject',
'PhabricatorTimeTestCase' => 'PhabricatorTestCase',
'PhabricatorTimezoneSetupCheck' => 'PhabricatorSetupCheck',
+ 'PhabricatorTitleGlyphsSetting' => 'PhabricatorSelectSetting',
'PhabricatorToken' => array(
'PhabricatorTokenDAO',
'PhabricatorPolicyInterface',
diff --git a/src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php b/src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php
--- a/src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php
+++ b/src/applications/celerity/postprocessor/CelerityDefaultPostprocessor.php
@@ -10,7 +10,7 @@
}
public function getPostprocessorName() {
- return pht('Use Default Colors');
+ return pht('Use Standard Colors');
}
public function buildDefaultPostprocessor() {
diff --git a/src/applications/settings/setting/PhabricatorAccessibilitySetting.php b/src/applications/settings/setting/PhabricatorAccessibilitySetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorAccessibilitySetting.php
@@ -0,0 +1,39 @@
+<?php
+
+final class PhabricatorAccessibilitySetting
+ extends PhabricatorSelectSetting {
+
+ const SETTINGKEY = 'resource-postprocessor';
+
+ public function getSettingName() {
+ return pht('Accessibility');
+ }
+
+ protected function getControlInstructions() {
+ return pht(
+ 'If you have difficulty reading the Phabricator UI, these settings '.
+ 'may make Phabricator more accessible.');
+ }
+
+ public function getSettingDefaultValue() {
+ return CelerityDefaultPostprocessor::POSTPROCESSOR_KEY;
+ }
+
+ protected function getSelectOptions() {
+ $postprocessor_map = CelerityPostprocessor::getAllPostprocessors();
+
+ $postprocessor_map = mpull($postprocessor_map, 'getPostprocessorName');
+ asort($postprocessor_map);
+
+ $postprocessor_order = array(
+ CelerityDefaultPostprocessor::POSTPROCESSOR_KEY,
+ );
+
+ $postprocessor_map = array_select_keys(
+ $postprocessor_map,
+ $postprocessor_order) + $postprocessor_map;
+
+ return $postprocessor_map;
+ }
+
+}
diff --git a/src/applications/settings/setting/PhabricatorEditorMultipleSetting.php b/src/applications/settings/setting/PhabricatorEditorMultipleSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorEditorMultipleSetting.php
@@ -0,0 +1,32 @@
+<?php
+
+final class PhabricatorEditorMultipleSetting
+ extends PhabricatorSelectSetting {
+
+ const SETTINGKEY = 'multiedit';
+
+ const VALUE_SPACES = 'spaces';
+ const VALUE_SINGLE = 'disable';
+
+ public function getSettingName() {
+ return pht('Edit Mulitple Files');
+ }
+
+ protected function getControlInstructions() {
+ return pht(
+ 'Some editors support opening multiple files with a single URI. You '.
+ 'can specify the behavior of your editor here.');
+ }
+
+ public function getSettingDefaultValue() {
+ return self::VALUE_SPACES;
+ }
+
+ protected function getSelectOptions() {
+ return array(
+ self::VALUE_SPACES => pht('Supported, Separated by Spaces'),
+ self::VALUE_SINGLE => pht('Not Supported'),
+ );
+ }
+
+}
diff --git a/src/applications/settings/setting/PhabricatorEditorSetting.php b/src/applications/settings/setting/PhabricatorEditorSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorEditorSetting.php
@@ -0,0 +1,33 @@
+<?php
+
+final class PhabricatorEditorSetting
+ extends PhabricatorStringSetting {
+
+ const SETTINGKEY = 'editor';
+
+ public function getSettingName() {
+ return pht('Editor Link');
+ }
+
+ protected function getControlInstructions() {
+ return pht(
+ "Many text editors can be configured as URI handlers for special ".
+ "protocols like `editor://`. If you have such an editor, Phabricator ".
+ "can generate links that you can click to open files locally.".
+ "\n\n".
+ "These special variables are supported:".
+ "\n\n".
+ "| Value | Replaced With |\n".
+ "|-------|---------------|\n".
+ "| `%%f` | Filename |\n".
+ "| `%%l` | Line Number |\n".
+ "| `%%r` | Repository Callsign |\n".
+ "| `%%%%` | Literal `%%` |\n".
+ "\n\n".
+ "For complete instructions on editor configuration, ".
+ "see **[[ %s | %s ]]**.",
+ PhabricatorEnv::getDoclink('User Guide: Configuring an External Editor'),
+ pht('User Guide: Configuring an External Editor'));
+ }
+
+}
diff --git a/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php b/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorMonospacedFontSetting.php
@@ -0,0 +1,40 @@
+<?php
+
+final class PhabricatorMonospacedFontSetting
+ extends PhabricatorStringSetting {
+
+ const SETTINGKEY = 'monospaced';
+
+ public function getSettingName() {
+ return pht('Monospaced Font');
+ }
+
+ protected function getControlInstructions() {
+ return pht(
+ 'You can customize the font used when showing monospaced text, '.
+ 'including source code. You should enter a valid CSS font declaration '.
+ 'like: `13px Consolas`');
+ }
+
+ public function validateTransactionValue($value) {
+ if (!strlen($value)) {
+ return;
+ }
+
+ $filtered = self::filterMonospacedCSSRule($value);
+ if ($filtered !== $value) {
+ throw new Exception(
+ pht(
+ 'Monospaced font value "%s" is unsafe. You may only enter '.
+ 'letters, numbers, spaces, commas, periods, forward slashes '.
+ 'and double quotes.',
+ $value));
+ }
+ }
+
+ public static function filterMonospacedCSSRule($monospaced) {
+ // Prevent the user from doing dangerous things.
+ return preg_replace('([^a-z0-9 ,"./]+)i', '', $monospaced);
+ }
+
+}
diff --git a/src/applications/settings/setting/PhabricatorMonospacedTextareasSetting.php b/src/applications/settings/setting/PhabricatorMonospacedTextareasSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorMonospacedTextareasSetting.php
@@ -0,0 +1,34 @@
+<?php
+
+final class PhabricatorMonospacedTextareasSetting
+ extends PhabricatorSelectSetting {
+
+ const SETTINGKEY = 'monospaced-textareas';
+
+ const VALUE_TEXT_VARIABLE_WIDTH = 'disabled';
+ const VALUE_TEXT_MONOSPACED = 'enabled';
+
+ public function getSettingName() {
+ return pht('Monospaced Textareas');
+ }
+
+ protected function getControlInstructions() {
+ return pht(
+ 'You can choose to use either a monospaced or variable-width font '.
+ 'in textareas in the UI. Textareas are used for editing descriptions '.
+ 'and writing comments, among other things.');
+ }
+
+ public function getSettingDefaultValue() {
+ return self::VALUE_TEXT_VARIABLE_WIDTH;
+ }
+
+ protected function getSelectOptions() {
+ return array(
+ self::VALUE_TEXT_VARIABLE_WIDTH => pht('Use Variable-Width Font'),
+ self::VALUE_TEXT_MONOSPACED => pht('Use Monospaced Font'),
+ );
+ }
+
+
+}
diff --git a/src/applications/settings/setting/PhabricatorStringSetting.php b/src/applications/settings/setting/PhabricatorStringSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorStringSetting.php
@@ -0,0 +1,18 @@
+<?php
+
+abstract class PhabricatorStringSetting
+ extends PhabricatorSetting {
+
+ final protected function newCustomEditField($object) {
+ return $this->newEditField($object, new PhabricatorTextEditField());
+ }
+
+ public function getTransactionNewValue($value) {
+ if (!strlen($value)) {
+ return null;
+ }
+
+ return (string)$value;
+ }
+
+}
diff --git a/src/applications/settings/setting/PhabricatorTitleGlyphsSetting.php b/src/applications/settings/setting/PhabricatorTitleGlyphsSetting.php
new file mode 100644
--- /dev/null
+++ b/src/applications/settings/setting/PhabricatorTitleGlyphsSetting.php
@@ -0,0 +1,33 @@
+<?php
+
+final class PhabricatorTitleGlyphsSetting
+ extends PhabricatorSelectSetting {
+
+ const SETTINGKEY = 'titles';
+
+ const VALUE_TITLE_GLYPHS = 'glyph';
+ const VALUE_TITLE_TEXT = 'text';
+
+ public function getSettingName() {
+ return pht('Page Titles');
+ }
+
+ protected function getControlInstructions() {
+ return pht(
+ 'Phabricator uses unicode glyphs in page titles to provide a compact '.
+ 'representation of the current application. You can substitute plain '.
+ 'text instead if these glyphs do not display on your system.');
+ }
+
+ public function getSettingDefaultValue() {
+ return self::VALUE_TITLE_GLYPHS;
+ }
+
+ protected function getSelectOptions() {
+ return array(
+ self::VALUE_TITLE_GLYPHS => pht("Use Unicode Glyphs: \xE2\x9A\x99"),
+ self::VALUE_TITLE_TEXT => pht('Use Plain Text: [Differential]'),
+ );
+ }
+
+}
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -374,7 +374,7 @@
// We can't print this normally because escaping quotation marks will
// break the CSS. Instead, filter it strictly and then mark it as safe.
$monospaced = new PhutilSafeHTML(
- PhabricatorUserPreferences::filterMonospacedCSSRule(
+ PhabricatorMonospacedFontSetting::filterMonospacedCSSRule(
$monospaced));
$font_css = hsprintf(

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 7:25 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286684
Default Alt Text
D15997.id38505.diff (15 KB)

Event Timeline