Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F548934
PhabricatorPhurlURLLongURLTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorPhurlURLLongURLTransaction.php
View Options
<?php
final
class
PhabricatorPhurlURLLongURLTransaction
extends
PhabricatorPhurlURLTransactionType
{
const
TRANSACTIONTYPE
=
'phurl.longurl'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getLongURL
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setLongURL
(
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the destination URL from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s changed the destination URL %s from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getLongURL
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'URL path is required'
));
}
foreach
(
$xactions
as
$xaction
)
{
if
(
$xaction
->
getOldValue
()
!=
$xaction
->
getNewValue
())
{
$protocols
=
PhabricatorEnv
::
getEnvConfig
(
'uri.allowed-protocols'
);
$uri
=
new
PhutilURI
(
$xaction
->
getNewValue
());
if
(!
isset
(
$protocols
[
$uri
->
getProtocol
()]))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'The protocol of the URL is invalid.'
));
}
}
}
return
$errors
;
}
public
function
getIcon
()
{
return
'fa-external-link-square'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:57 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
123110
Default Alt Text
PhabricatorPhurlURLLongURLTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment