@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 PhabricatorPhurlApplication extends PhabricatorApplication {
4
5 public function getName() {
6 return pht('Phurl');
7 }
8
9 public function getShortDescription() {
10 return pht('URL Shortener');
11 }
12
13 public function getFlavorText() {
14 return pht('Shorten your favorite URL.');
15 }
16
17 public function getBaseURI() {
18 return '/phurl/';
19 }
20
21 public function getIcon() {
22 return 'fa-compress';
23 }
24
25 public function isPrototype() {
26 return true;
27 }
28
29 public function getApplicationGroup() {
30 return self::GROUP_UTILITIES;
31 }
32
33 public function getRemarkupRules() {
34 return array(
35 new PhabricatorPhurlRemarkupRule(),
36 new PhabricatorPhurlLinkRemarkupRule(),
37 );
38 }
39
40 public function getMonograms() {
41 return array('U');
42 }
43
44 public function getRoutes() {
45 return array(
46 '/U(?P<id>[1-9]\d*)/?' => 'PhabricatorPhurlURLViewController',
47 '/u/(?P<id>[1-9]\d*)/?' => 'PhabricatorPhurlURLAccessController',
48 '/u/(?P<alias>[^/]+)/?' => 'PhabricatorPhurlURLAccessController',
49 '/phurl/' => array(
50 '(?:query/(?P<queryKey>[^/]+)/)?'
51 => 'PhabricatorPhurlURLListController',
52 'url/' => array(
53 $this->getEditRoutePattern('edit/')
54 => 'PhabricatorPhurlURLEditController',
55 ),
56 ),
57 );
58 }
59
60 public function getShortRoutes() {
61 return array(
62 '/status/' => 'PhabricatorStatusController',
63 '/favicon.ico' => 'PhabricatorFaviconController',
64 '/robots.txt' => 'PhabricatorRobotsShortController',
65
66 '/u/(?P<append>[^/]+)' => 'PhabricatorPhurlShortURLController',
67 '.*' => 'PhabricatorPhurlShortURLDefaultController',
68 );
69 }
70
71 protected function getCustomCapabilities() {
72 return array(
73 PhabricatorPhurlURLCreateCapability::CAPABILITY => array(
74 'default' => PhabricatorPolicies::POLICY_USER,
75 ),
76 PhabricatorPhurlURLDefaultViewCapability::CAPABILITY => array(
77 'template' => PhabricatorPhurlURLPHIDType::TYPECONST,
78 'capability' => PhabricatorPolicyCapability::CAN_VIEW,
79 ),
80 PhabricatorPhurlURLDefaultEditCapability::CAPABILITY => array(
81 'default' => PhabricatorPolicies::POLICY_USER,
82 'template' => PhabricatorPhurlURLPHIDType::TYPECONST,
83 'capability' => PhabricatorPolicyCapability::CAN_EDIT,
84 ),
85 );
86 }
87
88}