Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/files/application/PhabricatorFilesApplication.php
12242 views
1
<?php
2
3
final class PhabricatorFilesApplication extends PhabricatorApplication {
4
5
public function getBaseURI() {
6
return '/file/';
7
}
8
9
public function getName() {
10
return pht('Files');
11
}
12
13
public function getShortDescription() {
14
return pht('Store and Share Files');
15
}
16
17
public function getIcon() {
18
return 'fa-file';
19
}
20
21
public function getTitleGlyph() {
22
return "\xE2\x87\xAA";
23
}
24
25
public function getFlavorText() {
26
return pht('Blob store for Pokemon pictures.');
27
}
28
29
public function getApplicationGroup() {
30
return self::GROUP_UTILITIES;
31
}
32
33
public function canUninstall() {
34
return false;
35
}
36
37
public function getRemarkupRules() {
38
return array(
39
new PhabricatorEmbedFileRemarkupRule(),
40
new PhabricatorImageRemarkupRule(),
41
);
42
}
43
44
public function supportsEmailIntegration() {
45
return true;
46
}
47
48
public function getAppEmailBlurb() {
49
return pht(
50
'Send emails with file attachments to these addresses to upload '.
51
'files. %s',
52
phutil_tag(
53
'a',
54
array(
55
'href' => $this->getInboundEmailSupportLink(),
56
),
57
pht('Learn More')));
58
}
59
60
protected function getCustomCapabilities() {
61
return array(
62
FilesDefaultViewCapability::CAPABILITY => array(
63
'caption' => pht('Default view policy for newly created files.'),
64
'template' => PhabricatorFileFilePHIDType::TYPECONST,
65
'capability' => PhabricatorPolicyCapability::CAN_VIEW,
66
),
67
);
68
}
69
70
public function getRoutes() {
71
return array(
72
'/F(?P<id>[1-9]\d*)(?:\$(?P<lines>\d+(?:-\d+)?))?'
73
=> 'PhabricatorFileViewController',
74
'/file/' => array(
75
'(query/(?P<queryKey>[^/]+)/)?' => 'PhabricatorFileListController',
76
'view/(?P<id>[1-9]\d*)/'.
77
'(?:(?P<engineKey>[^/]+)/)?'.
78
'(?:\$(?P<lines>\d+(?:-\d+)?))?'
79
=> 'PhabricatorFileViewController',
80
'info/(?P<phid>[^/]+)/' => 'PhabricatorFileViewController',
81
'upload/' => 'PhabricatorFileUploadController',
82
'dropupload/' => 'PhabricatorFileDropUploadController',
83
'compose/' => 'PhabricatorFileComposeController',
84
'thread/(?P<phid>[^/]+)/' => 'PhabricatorFileLightboxController',
85
'delete/(?P<id>[1-9]\d*)/' => 'PhabricatorFileDeleteController',
86
$this->getEditRoutePattern('edit/')
87
=> 'PhabricatorFileEditController',
88
'imageproxy/' => 'PhabricatorFileImageProxyController',
89
'transforms/(?P<id>[1-9]\d*)/' =>
90
'PhabricatorFileTransformListController',
91
'uploaddialog/(?P<single>single/)?'
92
=> 'PhabricatorFileUploadDialogController',
93
'iconset/(?P<key>[^/]+)/' => array(
94
'select/' => 'PhabricatorFileIconSetSelectController',
95
),
96
'document/(?P<engineKey>[^/]+)/(?P<phid>[^/]+)/'
97
=> 'PhabricatorFileDocumentController',
98
'ui/' => array(
99
'detach/(?P<objectPHID>[^/]+)/(?P<filePHID>[^/]+)/'
100
=> 'PhabricatorFileDetachController',
101
'curtain/' => array(
102
'list/(?P<phid>[^/]+)/'
103
=> 'PhabricatorFileUICurtainListController',
104
'attach/(?P<objectPHID>[^/]+)/(?P<filePHID>[^/]+)/'
105
=> 'PhabricatorFileUICurtainAttachController',
106
),
107
),
108
) + $this->getResourceSubroutes(),
109
);
110
}
111
112
public function getResourceRoutes() {
113
return array(
114
'/file/' => $this->getResourceSubroutes(),
115
);
116
}
117
118
private function getResourceSubroutes() {
119
return array(
120
'(?P<kind>data|download)/'.
121
'(?:@(?P<instance>[^/]+)/)?'.
122
'(?P<key>[^/]+)/'.
123
'(?P<phid>[^/]+)/'.
124
'(?:(?P<token>[^/]+)/)?'.
125
'.*'
126
=> 'PhabricatorFileDataController',
127
'xform/'.
128
'(?:@(?P<instance>[^/]+)/)?'.
129
'(?P<transform>[^/]+)/'.
130
'(?P<phid>[^/]+)/'.
131
'(?P<key>[^/]+)/'
132
=> 'PhabricatorFileTransformController',
133
);
134
}
135
136
public function getMailCommandObjects() {
137
return array(
138
'file' => array(
139
'name' => pht('Email Commands: Files'),
140
'header' => pht('Interacting with Files'),
141
'object' => new PhabricatorFile(),
142
'summary' => pht(
143
'This page documents the commands you can use to interact with '.
144
'files.'),
145
),
146
);
147
}
148
149
public function getQuicksandURIPatternBlacklist() {
150
return array(
151
'/file/(data|download)/.*',
152
);
153
}
154
155
}
156
157