@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorPasteApplication extends PhabricatorApplication {
4
5 public function getName() {
6 return pht('Paste');
7 }
8
9 public function getBaseURI() {
10 return '/paste/';
11 }
12
13 public function getIcon() {
14 return 'fa-clipboard';
15 }
16
17 public function getTitleGlyph() {
18 return "\xE2\x9C\x8E";
19 }
20
21 public function getApplicationGroup() {
22 return self::GROUP_UTILITIES;
23 }
24
25 public function getShortDescription() {
26 return pht('Share Text Snippets');
27 }
28
29 public function getRemarkupRules() {
30 return array(
31 new PhabricatorPasteRemarkupRule(),
32 );
33 }
34
35 public function getMonograms() {
36 return array('P');
37 }
38
39 public function getRoutes() {
40 return array(
41 '/P(?P<id>[1-9]\d*)(?:\$(?P<lines>\d+(?:-\d+)?))?'
42 => 'PhabricatorPasteViewController',
43 '/paste/' => array(
44 '(query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorPasteListController',
45 $this->getEditRoutePattern('edit/') => 'PhabricatorPasteEditController',
46 'raw/(?P<id>[1-9]\d*)/' => 'PhabricatorPasteRawController',
47 'archive/(?P<id>[1-9]\d*)/' => 'PhabricatorPasteArchiveController',
48 ),
49 );
50 }
51
52 public function supportsEmailIntegration() {
53 return true;
54 }
55
56 public function getAppEmailBlurb() {
57 return pht(
58 'Send email to these addresses to create pastes. %s',
59 phutil_tag(
60 'a',
61 array(
62 'href' => $this->getInboundEmailSupportLink(),
63 ),
64 pht('Learn More')));
65 }
66
67 protected function getCustomCapabilities() {
68 return array(
69 PasteDefaultViewCapability::CAPABILITY => array(
70 'caption' => pht('Default view policy for newly created pastes.'),
71 'template' => PhabricatorPastePastePHIDType::TYPECONST,
72 'capability' => PhabricatorPolicyCapability::CAN_VIEW,
73 ),
74 PasteDefaultEditCapability::CAPABILITY => array(
75 'caption' => pht('Default edit policy for newly created pastes.'),
76 'template' => PhabricatorPastePastePHIDType::TYPECONST,
77 'capability' => PhabricatorPolicyCapability::CAN_EDIT,
78 ),
79 );
80 }
81
82 public function getMailCommandObjects() {
83 return array(
84 'paste' => array(
85 'name' => pht('Email Commands: Pastes'),
86 'header' => pht('Interacting with Pastes'),
87 'object' => new PhabricatorPaste(),
88 'summary' => pht(
89 'This page documents the commands you can use to interact with '.
90 'pastes.'),
91 ),
92 );
93 }
94
95 public function getApplicationSearchDocumentTypes() {
96 return array(
97 PhabricatorPastePastePHIDType::TYPECONST,
98 );
99 }
100
101}